@nexus-cross/crossx-sdk-core 1.0.7 → 1.0.9

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
1
  var Is = Object.defineProperty;
2
- var Ts = (r, e, s) => e in r ? Is(r, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : r[e] = s;
3
- var v = (r, e, s) => Ts(r, typeof e != "symbol" ? e + "" : e, s);
4
- import { decodeJwt as As } from "jose";
2
+ var As = (r, e, s) => e in r ? Is(r, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : r[e] = s;
3
+ var v = (r, e, s) => As(r, typeof e != "symbol" ? e + "" : e, s);
4
+ import { decodeJwt as Rs } from "jose";
5
5
  var g = /* @__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.WALLET_NOT_FOUND = "WALLET_NOT_FOUND", r.WALLET_CREATION_FAILED = "WALLET_CREATION_FAILED", r.SIGN_FAILED = "SIGN_FAILED", r.SIGN_REJECTED = "SIGN_REJECTED", r.TX_FAILED = "TX_FAILED", r.TX_REJECTED = "TX_REJECTED", 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.GATEWAY_INTERNAL_ERROR = "GATEWAY_INTERNAL_ERROR", r.GATEWAY_LOCK_CONFLICT = "GATEWAY_LOCK_CONFLICT", 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.INVALID_CONFIG = "INVALID_CONFIG", r.UNKNOWN_ERROR = "UNKNOWN_ERROR", r))(g || {});
6
6
  class x extends Error {
7
7
  constructor(e, s, t) {
@@ -65,20 +65,20 @@ const We = {
65
65
  rpcUrl: "https://saigon-testnet.roninchain.com/rpc",
66
66
  testnet: !0
67
67
  }
68
- }, $n = Object.fromEntries(
68
+ }, Fn = Object.fromEntries(
69
69
  Object.entries(We).map(([r, e]) => [r, e.caipId])
70
- ), Rs = new Map(
70
+ ), Os = new Map(
71
71
  Object.values(We).map((r) => [r.caipId, r])
72
72
  );
73
73
  new Map(
74
74
  Object.values(We).map((r) => [r.chainId, r])
75
75
  );
76
- const Os = { symbol: "", decimals: 18 };
76
+ const Cs = { symbol: "", decimals: 18 };
77
77
  function ze(r) {
78
78
  var e;
79
- return ((e = Rs.get(r)) == null ? void 0 : e.nativeCurrency) ?? Os;
79
+ return ((e = Os.get(r)) == null ? void 0 : e.nativeCurrency) ?? Cs;
80
80
  }
81
- class Cs {
81
+ class ks {
82
82
  constructor(e, s) {
83
83
  this.sdk = e, this.chainId = s, this._listeners = /* @__PURE__ */ new Map();
84
84
  }
@@ -108,7 +108,7 @@ class Cs {
108
108
  case "eth_sign":
109
109
  throw new x(
110
110
  g.NOT_IMPLEMENTED,
111
- `${e} is not yet supported. Use sdk.signMessage() directly.`
111
+ `${e}은(는) 아직 지원되지 않습니다. sdk.signMessage() 직접 사용하세요.`
112
112
  );
113
113
  case "eth_signTypedData":
114
114
  case "eth_signTypedData_v1":
@@ -116,7 +116,7 @@ class Cs {
116
116
  case "eth_signTypedData_v4":
117
117
  throw new x(
118
118
  g.NOT_IMPLEMENTED,
119
- `${e} is not yet supported. Use sdk.signTypedData() or sdk.signTypedDataOffchain() directly.`
119
+ `${e}은(는) 아직 지원되지 않습니다. sdk.signTypedData() 또는 sdk.signTypedDataOffchain() 직접 사용하세요.`
120
120
  );
121
121
  default:
122
122
  return this.sdk.walletRpc(e, s, this.chainId);
@@ -187,8 +187,83 @@ const p = {
187
187
  return;
188
188
  }
189
189
  }
190
- }, Ye = "crossx_access_token", Ne = "crossx_refresh_token", Pe = "crossx_user_info";
191
- class ks {
190
+ }, Ns = {
191
+ // ── 공통 버튼 ────────────────────────────────────────────────
192
+ confirm: "확인",
193
+ cancel: "취소",
194
+ close: "닫기",
195
+ // ── 메시지 서명 모달 ─────────────────────────────────────────
196
+ signMessage_title: "메시지 서명",
197
+ // ── Typed Data 서명 모달 ─────────────────────────────────────
198
+ signTypedData_title: "데이터 서명",
199
+ // ── 트랜잭션 서명 / 전송 모달 ────────────────────────────────
200
+ signTransaction_title: "트랜잭션 서명",
201
+ sendTransaction_title: "트랜잭션 전송",
202
+ // ── 트랜잭션 진행 모달 ───────────────────────────────────────
203
+ tx_pending: "트랜잭션 처리 중...",
204
+ tx_success: "트랜잭션이 완료되었습니다",
205
+ tx_failed: "트랜잭션이 실패했습니다",
206
+ tx_timeout: "트랜잭션 확인 시간이 초과되었습니다",
207
+ // ── 로그인 선택 모달 ─────────────────────────────────────────
208
+ loginSelector_title: "로그인 방법 선택",
209
+ loginSelector_google: "Google로 계속하기",
210
+ loginSelector_apple: "Apple로 계속하기",
211
+ // ── 마이그레이션 모달 ────────────────────────────────────────
212
+ migration_foundTitle: "기존 지갑 발견",
213
+ migration_foundDescription: "기존 CROSSx 지갑이 발견되었습니다. 복구하시겠습니까?",
214
+ migration_recoverButton: "복구하기",
215
+ migration_skipButton: "건너뛰기",
216
+ // ── PIN 입력 모달 ────────────────────────────────────────────
217
+ pinInput_title: "PIN 입력",
218
+ pinInput_placeholder: "4자리 PIN을 입력하세요",
219
+ pinInput_error: "PIN이 올바르지 않습니다. 다시 시도해 주세요.",
220
+ // ── 지갑 선택 모달 ───────────────────────────────────────────
221
+ walletSelector_title: "지갑 선택",
222
+ walletSelector_addButton: "지갑 추가",
223
+ walletSelector_selected: "선택됨"
224
+ }, Kt = {
225
+ // ── Common buttons ───────────────────────────────────────────
226
+ confirm: "Confirm",
227
+ cancel: "Cancel",
228
+ close: "Close",
229
+ // ── Sign message modal ───────────────────────────────────────
230
+ signMessage_title: "Sign Message",
231
+ // ── Typed Data sign modal ────────────────────────────────────
232
+ signTypedData_title: "Sign Data",
233
+ // ── Sign / Send transaction modal ────────────────────────────
234
+ signTransaction_title: "Sign Transaction",
235
+ sendTransaction_title: "Send Transaction",
236
+ // ── Transaction progress modal ───────────────────────────────
237
+ tx_pending: "Processing transaction...",
238
+ tx_success: "Transaction completed",
239
+ tx_failed: "Transaction failed",
240
+ tx_timeout: "Transaction confirmation timed out",
241
+ // ── Login selector modal ─────────────────────────────────────
242
+ loginSelector_title: "Choose a sign-in method",
243
+ loginSelector_google: "Continue with Google",
244
+ loginSelector_apple: "Continue with Apple",
245
+ // ── Migration modal ──────────────────────────────────────────
246
+ migration_foundTitle: "Existing Wallet Found",
247
+ migration_foundDescription: "An existing CROSSx wallet was found. Would you like to recover it?",
248
+ migration_recoverButton: "Recover",
249
+ migration_skipButton: "Skip",
250
+ // ── PIN input modal ──────────────────────────────────────────
251
+ pinInput_title: "Enter PIN",
252
+ pinInput_placeholder: "Enter your 4-digit PIN",
253
+ pinInput_error: "Incorrect PIN. Please try again.",
254
+ // ── Wallet selector modal ────────────────────────────────────
255
+ walletSelector_title: "Select Wallet",
256
+ walletSelector_addButton: "Add Wallet",
257
+ walletSelector_selected: "Selected"
258
+ }, Ps = {
259
+ ko: Ns,
260
+ en: Kt
261
+ };
262
+ function yt(r = "en", e) {
263
+ return Ps[r] ?? Kt;
264
+ }
265
+ const Ye = "crossx_access_token", Ne = "crossx_refresh_token", Pe = "crossx_user_info";
266
+ class Ls {
192
267
  constructor(e, s, t, n, o, i, a) {
193
268
  this.config = e, this.storage = s, this.crypto = t, this.oauth = n, this.transport = o, this.walletProvider = i, this.tokenStore = a, this._refreshPromise = null;
194
269
  }
@@ -204,7 +279,7 @@ class ks {
204
279
  if (e != null && e.code && e.code !== 200 && e.code > 0)
205
280
  throw new x(
206
281
  g.AUTH_FAILED,
207
- `${s} failed (code ${e.code}): ${e.message}`
282
+ `${s} 실패 (코드 ${e.code}): ${e.message}`
208
283
  );
209
284
  const t = e == null ? void 0 : e.data;
210
285
  if (typeof t == "object" && t !== null && "code" in t) {
@@ -212,7 +287,7 @@ class ks {
212
287
  if (n.code && n.code !== 200 && n.code > 0)
213
288
  throw new x(
214
289
  g.AUTH_FAILED,
215
- `${s} failed (code ${n.code}): ${n.message}`
290
+ `${s} 실패 (코드 ${n.code}): ${n.message}`
216
291
  );
217
292
  }
218
293
  }
@@ -231,34 +306,34 @@ class ks {
231
306
  });
232
307
  p.log("[CROSSx] OAuth Firebase 토큰 받음 (length:", _.length, ")");
233
308
  const { accessToken: m, refreshToken: A } = await this.exchangeFirebaseToken(_, f);
234
- let y, I;
309
+ let y, T;
235
310
  try {
236
- const U = this.crypto.decodeJWT(_);
237
- I = (n = U.firebase) == null ? void 0 : n.sign_in_provider;
238
- const $ = ((o = U.firebase) == null ? void 0 : o.identities) ?? {};
239
- I === "google.com" ? y = (i = $["google.com"]) == null ? void 0 : i[0] : I === "apple.com" && (y = (a = $["apple.com"]) == null ? void 0 : a[0]), p.log("[CROSSx] OAuth provider sub 추출 — provider:", I, "hasProviderSub:", !!y);
311
+ const F = this.crypto.decodeJWT(_);
312
+ T = (n = F.firebase) == null ? void 0 : n.sign_in_provider;
313
+ const $ = ((o = F.firebase) == null ? void 0 : o.identities) ?? {};
314
+ T === "google.com" ? y = (i = $["google.com"]) == null ? void 0 : i[0] : T === "apple.com" && (y = (a = $["apple.com"]) == null ? void 0 : a[0]), p.log("[CROSSx] OAuth provider sub 추출 — provider:", T, "hasProviderSub:", !!y);
240
315
  } catch {
241
316
  p.warn("[CROSSx] firebaseToken에서 providerSub 추출 실패");
242
317
  }
243
318
  if (m) {
244
- const U = this.crypto.decodeJWT(m);
245
- p.log("[CROSSx] access_token 디코딩 — sub:", U.sub, "exp:", U.exp);
319
+ const F = this.crypto.decodeJWT(m);
320
+ p.log("[CROSSx] access_token 디코딩 — sub:", F.sub, "exp:", F.exp);
246
321
  const $ = await this.crypto.verifyJWT(m);
247
322
  if (t = $.signatureVerified ?? !1, !$.valid)
248
- throw p.error("[CROSSx] access_token 검증 실패"), new Error("Invalid access token");
323
+ throw p.error("[CROSSx] access_token 검증 실패"), new Error("유효하지 않은 access token");
249
324
  const B = $.payload;
250
325
  s = {
251
326
  id: B.sub,
252
327
  email: B.email,
253
- signInProvider: I,
328
+ signInProvider: T,
254
329
  providerSub: y
255
330
  }, this.tokenStore.set(m), this.useCookieAuth || (await this.storage.set(Ye, m), A && await this.storage.set(Ne, A));
256
331
  } else {
257
- const U = this.crypto.decodeJWT(_);
332
+ const F = this.crypto.decodeJWT(_);
258
333
  s = {
259
- id: U.sub,
260
- email: U.email,
261
- signInProvider: I,
334
+ id: F.sub,
335
+ email: F.email,
336
+ signInProvider: T,
262
337
  providerSub: y
263
338
  }, p.log("[CROSSx] Cookie 모드 — Firebase 토큰에서 사용자 정보 추출 — id:", s.id);
264
339
  }
@@ -297,7 +372,7 @@ class ks {
297
372
  if (!a)
298
373
  throw new x(
299
374
  g.AUTH_FAILED,
300
- "access_token not found in exchange response"
375
+ "토큰 교환 응답에서 access_token을 찾을 수 없습니다"
301
376
  );
302
377
  p.log("[CROSSx] access_token 교환 성공");
303
378
  let c;
@@ -427,7 +502,7 @@ class ks {
427
502
  return;
428
503
  }
429
504
  if (!c)
430
- throw new x(g.AUTH_FAILED, "Silent refresh failed: no token in response");
505
+ throw new x(g.AUTH_FAILED, "토큰 자동 갱신 실패: 응답에 토큰이 없습니다");
431
506
  if (this.tokenStore.set(c), !t) {
432
507
  await this.storage.set(Ye, c);
433
508
  const l = this.extractRefreshToken(a);
@@ -451,16 +526,16 @@ class ks {
451
526
  return p.log("[CROSSx][Migration Phase 2] loadWallet 결과 — address:", t, "needsMigration:", n), { success: !0, address: t, user: e, needsMigration: n, tokenSignatureVerified: s };
452
527
  }
453
528
  }
454
- const Ns = "crossx_access_token", Ps = "crossx_refresh_token", Ls = "crossx_user_info";
455
- class Ds {
529
+ const Ds = "crossx_access_token", $s = "crossx_refresh_token", Ms = "crossx_user_info";
530
+ class Bs {
456
531
  constructor(e, s, t) {
457
532
  this.config = e, this.storage = s, this.tokenStore = t;
458
533
  }
459
534
  async execute() {
460
- this.tokenStore.clear(), this.config.authMode !== "cookie" && (await this.storage.remove(Ns), await this.storage.remove(Ps)), await this.storage.remove(Ls);
535
+ this.tokenStore.clear(), this.config.authMode !== "cookie" && (await this.storage.remove(Ds), await this.storage.remove($s)), await this.storage.remove(Ms);
461
536
  }
462
537
  }
463
- class $s {
538
+ class Fs {
464
539
  constructor(e, s) {
465
540
  this.storage = e, this.walletProvider = s;
466
541
  }
@@ -468,7 +543,7 @@ class $s {
468
543
  if (!this.walletProvider.migrateWallet)
469
544
  throw new x(
470
545
  g.NOT_IMPLEMENTED,
471
- "Migration is not supported in the current environment"
546
+ "현재 환경에서는 마이그레이션이 지원되지 않습니다"
472
547
  );
473
548
  p.log("[CROSSx][Migration Phase 4] MigrateWalletUseCase.execute() — pin 길이:", e.length, "sub:", s);
474
549
  const t = await this.walletProvider.migrateWallet(e, s);
@@ -477,7 +552,7 @@ class $s {
477
552
  };
478
553
  }
479
554
  }
480
- class Ms {
555
+ class Us {
481
556
  constructor(e, s) {
482
557
  this.chainRegistry = e, this.transport = s;
483
558
  }
@@ -504,12 +579,12 @@ class Ms {
504
579
  if (a != null && a.error)
505
580
  throw new x(
506
581
  g.UNKNOWN_ERROR,
507
- `RPC error [${e}] (${t}): ${a.error.message} (code: ${a.error.code})`
582
+ `RPC 오류 [${e}] (${t}): ${a.error.message} (코드: ${a.error.code})`
508
583
  );
509
584
  return a == null ? void 0 : a.result;
510
585
  }
511
586
  }
512
- class Bs {
587
+ class Hs {
513
588
  constructor() {
514
589
  this.listeners = /* @__PURE__ */ new Map();
515
590
  }
@@ -532,11 +607,17 @@ class Bs {
532
607
  this.listeners.clear();
533
608
  }
534
609
  }
535
- const Ue = {
610
+ const Fe = {
611
+ // TODO(v2.0.0-BEFORE-RELEASE): 아래 블록으로 교체
612
+ // production: {
613
+ // oauthServiceUrl: 'https://cross-wallet-oauth.crosstoken.io',
614
+ // authApiUrl: 'https://cross-auth.crosstoken.io',
615
+ // walletGatewayUrl: 'https://embedded-wallet-gateway.crosstoken.io/api/v1',
616
+ // },
536
617
  production: {
537
- oauthServiceUrl: "https://cross-wallet-oauth.crosstoken.io",
538
- authApiUrl: "https://cross-auth.crosstoken.io",
539
- walletGatewayUrl: "https://embedded-wallet-gateway.crosstoken.io/api/v1"
618
+ oauthServiceUrl: "https://stg-cross-wallet-oauth.crosstoken.io",
619
+ authApiUrl: "https://stg-cross-auth.crosstoken.io",
620
+ walletGatewayUrl: "https://stg-embedded-wallet-gateway.crosstoken.io/api/v1"
540
621
  },
541
622
  staging: {
542
623
  oauthServiceUrl: "https://stg-cross-wallet-oauth.crosstoken.io",
@@ -548,32 +629,24 @@ const Ue = {
548
629
  authApiUrl: "https://dev-cross-auth.crosstoken.io",
549
630
  walletGatewayUrl: "https://dev-embedded-wallet-gateway.crosstoken.io/api/v1"
550
631
  }
551
- }, Us = "/crossx.config.json";
552
- function yt(r) {
632
+ };
633
+ function Gs(r) {
553
634
  const e = r.environment;
554
- return e && e in Ue ? Ue[e] : null;
635
+ return e && e in Fe ? Fe[e] : null;
555
636
  }
556
- async function Fs() {
637
+ function qs() {
557
638
  try {
558
639
  if (typeof __CROSSX_CONFIG__ < "u") {
559
- const r = typeof __CROSSX_CONFIG__ == "string" ? JSON.parse(__CROSSX_CONFIG__) : __CROSSX_CONFIG__, e = yt(r);
640
+ const r = typeof __CROSSX_CONFIG__ == "string" ? JSON.parse(__CROSSX_CONFIG__) : __CROSSX_CONFIG__, e = Gs(r);
560
641
  if (e) return e;
561
642
  }
562
643
  } catch {
563
644
  }
564
- try {
565
- const r = await fetch(Us);
566
- if (r.ok) {
567
- const e = await r.json(), s = yt(e);
568
- if (s) return s;
569
- }
570
- } catch {
571
- }
572
- return Ue.production;
645
+ return Fe.production;
573
646
  }
574
- const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA00", St = 130, Et = 6, It = 18, js = 0, Vs = 30 * 1e3, X = class X extends Bs {
647
+ const Ws = 2e3, bt = 6e4, js = 1e3, Vs = 1e4, Ks = "0x77359400", vt = "0x3B9ACA00", St = 130, Et = 6, Tt = 18, zs = 0, Ys = 30 * 1e3, X = class X extends Hs {
575
648
  constructor(e, s, t, n, o, i, a, c, l, d) {
576
- super(), this.storage = t, this.crypto = n, this.transport = o, this.oauth = i, this.walletProvider = a, this.tokenStore = c, this.initialized = !1, this.authenticated = !1, this.userId = null, this.address = null, this.userEmail = null, this.loginType = null, this.providerSub = null, this.tokenSignatureVerified = !1, this._config = Object.freeze({ ...e }), this.internalConfig = e, this.adapterConfig = s, e.logger && wt(e.logger), this.confirmation = l, this.chainRegistry = d, this.jsonRpc = new Ms(d, o), this.signInUseCase = new ks(
649
+ super(), this.storage = t, this.crypto = n, this.transport = o, this.oauth = i, this.walletProvider = a, this.tokenStore = c, this.initialized = !1, this.authenticated = !1, this.userId = null, this.address = null, this.userEmail = null, this.loginType = null, this.providerSub = null, this.tokenSignatureVerified = !1, this._config = Object.freeze({ ...e }), this.internalConfig = e, this.adapterConfig = s, e.logger && wt(e.logger), this.confirmation = l, this.chainRegistry = d, this.jsonRpc = new Us(d, o), this.signInUseCase = new Ls(
577
650
  this.internalConfig,
578
651
  t,
579
652
  n,
@@ -581,7 +654,7 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
581
654
  o,
582
655
  a,
583
656
  c
584
- ), this.signOutUseCase = new Ds(this.internalConfig, t, c), this.migrateWalletUseCase = new $s(t, a);
657
+ ), this.signOutUseCase = new Bs(this.internalConfig, t, c), this.migrateWalletUseCase = new Fs(t, a);
585
658
  }
586
659
  get config() {
587
660
  return this._config;
@@ -602,14 +675,14 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
602
675
  */
603
676
  async initialize() {
604
677
  if (this.initialized) return this.authenticated ? { success: !0, address: this.address ?? void 0 } : null;
605
- console.log("[CROSSx SDK] v1.0.7 initializing...");
678
+ console.log("[CROSSx SDK] v1.0.9 초기화 중..."), this.confirmation.setMessages(yt(this._config.locale));
606
679
  try {
607
- const e = await Fs();
680
+ const e = qs();
608
681
  this.internalConfig.oauthServiceUrl = e.oauthServiceUrl, this.internalConfig.authApiUrl = e.authApiUrl, this.internalConfig.walletGatewayUrl = e.walletGatewayUrl, this.adapterConfig.gatewayUrl = e.walletGatewayUrl;
609
682
  const s = await this.signInUseCase.restoreSession();
610
683
  return s != null && s.success && this.applyAuthResult(s), this.initialized = !0, this.emit("initialized", { restored: !!(s != null && s.success) }), s ?? null;
611
684
  } catch (e) {
612
- throw new x(g.AUTH_NOT_INITIALIZED, "SDK initialization failed", e);
685
+ throw new x(g.AUTH_NOT_INITIALIZED, "SDK 초기화에 실패했습니다", e);
613
686
  }
614
687
  }
615
688
  async signIn(e) {
@@ -625,7 +698,7 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
625
698
  const t = await this.signInUseCase.execute(s);
626
699
  return t.success && this.applyAuthResult(t), t;
627
700
  } catch (t) {
628
- throw new x(g.AUTH_FAILED, "Sign in failed", t);
701
+ throw new x(g.AUTH_FAILED, "로그인에 실패했습니다", t);
629
702
  }
630
703
  }
631
704
  /**
@@ -660,7 +733,7 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
660
733
  try {
661
734
  await this.signOutUseCase.execute(), this.clearAuthState();
662
735
  } catch (e) {
663
- throw new x(g.UNKNOWN_ERROR, "Sign out failed", e);
736
+ throw new x(g.UNKNOWN_ERROR, "로그아웃에 실패했습니다", e);
664
737
  }
665
738
  }
666
739
  isAuthenticated() {
@@ -736,14 +809,14 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
736
809
  */
737
810
  async migrateWallet(e) {
738
811
  if (this.ensureAuthenticated(), !this.userId)
739
- throw new x(g.AUTH_NOT_AUTHENTICATED, "User ID not found");
812
+ throw new x(g.AUTH_NOT_AUTHENTICATED, "사용자 ID 찾을 수 없습니다");
740
813
  try {
741
814
  const s = await this.migrateWalletUseCase.execute(e, this.userId);
742
815
  return this.address = s.address, this.emit("addressChanged", { address: s.address, index: 0 }), p.log("[CROSSx] migrateWallet 완료 — address:", s.address), s;
743
816
  } catch (s) {
744
817
  throw s instanceof x ? s : new x(
745
818
  g.MIGRATION_FAILED,
746
- "Wallet migration failed",
819
+ "지갑 마이그레이션에 실패했습니다",
747
820
  s
748
821
  );
749
822
  }
@@ -763,7 +836,7 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
763
836
  async getAddress(e) {
764
837
  if (e !== void 0) {
765
838
  if (this.ensureAuthenticated(), !this.userId)
766
- throw new x(g.AUTH_NOT_AUTHENTICATED, "User ID not found");
839
+ throw new x(g.AUTH_NOT_AUTHENTICATED, "사용자 ID 찾을 수 없습니다");
767
840
  return { address: (await this.walletProvider.getAddress(this.userId, e)).address, index: e };
768
841
  }
769
842
  return !this.authenticated || !this.address ? null : { address: this.address, index: 0 };
@@ -798,7 +871,7 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
798
871
  */
799
872
  async selectWallet(e) {
800
873
  if (this.ensureAuthenticated(), !this.userId)
801
- throw new x(g.AUTH_NOT_AUTHENTICATED, "User ID not found");
874
+ throw new x(g.AUTH_NOT_AUTHENTICATED, "사용자 ID 찾을 수 없습니다");
802
875
  const s = await this.walletProvider.getAddresses(this.userId), t = await this.confirmation.showWalletSelector(
803
876
  s,
804
877
  async () => {
@@ -837,7 +910,7 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
837
910
  try {
838
911
  return await this.chainRegistry.getChains();
839
912
  } catch (e) {
840
- throw e instanceof x ? e : new x(g.UNKNOWN_ERROR, "Failed to fetch chains", e);
913
+ throw e instanceof x ? e : new x(g.UNKNOWN_ERROR, "체인 목록 조회에 실패했습니다", e);
841
914
  }
842
915
  }
843
916
  /**
@@ -856,7 +929,7 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
856
929
  try {
857
930
  return await this.chainRegistry.getChain(e);
858
931
  } catch (s) {
859
- throw s instanceof x ? s : new x(g.CHAIN_NOT_SUPPORTED, `Failed to fetch chain: ${e}`, s);
932
+ throw s instanceof x ? s : new x(g.CHAIN_NOT_SUPPORTED, `체인 조회에 실패했습니다: ${e}`, s);
860
933
  }
861
934
  }
862
935
  // ============================================================================
@@ -876,13 +949,26 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
876
949
  applyTheme(e = this._config.theme ?? "light", s = this._config.themeTokens ?? {}) {
877
950
  this._config = Object.freeze({ ...this._config, theme: e, themeTokens: s }), this.confirmation.setTheme(e, s);
878
951
  }
952
+ /**
953
+ * 모달 UI 언어를 런타임에 변경합니다.
954
+ * 다음 모달이 열릴 때부터 적용됩니다.
955
+ *
956
+ * @param locale 빌트인 언어팩 선택 ('ko' | 'en')
957
+ *
958
+ * @example
959
+ * sdk.applyLocale('en');
960
+ * sdk.applyLocale('ko');
961
+ */
962
+ applyLocale(e = this._config.locale ?? "en") {
963
+ this._config = Object.freeze({ ...this._config, locale: e }), this.confirmation.setMessages(yt(e));
964
+ }
879
965
  /**
880
966
  * 지갑 생성 (로그인 후 지갑이 없는 경우)
881
967
  * 기존 CROSSx 백업이 발견되면 자동으로 마이그레이션 플로우 실행
882
968
  */
883
969
  async createWallet() {
884
970
  if (this.ensureAuthenticated(), !this.userId)
885
- throw new x(g.AUTH_NOT_AUTHENTICATED, "User ID not found");
971
+ throw new x(g.AUTH_NOT_AUTHENTICATED, "사용자 ID 찾을 수 없습니다");
886
972
  p.log("[CROSSx] 지갑 생성 시작");
887
973
  try {
888
974
  const e = await this.walletProvider.getOrCreateWallet(this.userId);
@@ -896,7 +982,7 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
896
982
  return this.address = t.address, this.emit("addressChanged", { address: t.address, index: 0 }), { address: t.address };
897
983
  throw new x(
898
984
  g.MIGRATION_FAILED,
899
- "Migration skipped by user"
985
+ "사용자가 마이그레이션을 건너뛰었습니다"
900
986
  );
901
987
  }
902
988
  throw e;
@@ -914,7 +1000,7 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
914
1000
  */
915
1001
  async signMessage(e, s, t) {
916
1002
  if (this.ensureAuthenticated(), !this.userId)
917
- throw new x(g.AUTH_NOT_AUTHENTICATED, "User ID not found");
1003
+ throw new x(g.AUTH_NOT_AUTHENTICATED, "사용자 ID 찾을 수 없습니다");
918
1004
  const n = t == null ? void 0 : t.index, o = await this.walletProvider.getAddress(this.userId, n ?? 0);
919
1005
  let i;
920
1006
  if (this.walletProvider.prepare && (i = (await this.walletProvider.prepare("sign-message", { message: s, from: o.address })).uuid), !await this.confirmation.requestConfirmation({
@@ -925,7 +1011,7 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
925
1011
  dappName: t == null ? void 0 : t.dappName,
926
1012
  accountName: t == null ? void 0 : t.accountName
927
1013
  }))
928
- throw new x(g.USER_REJECTED, "User rejected message signing");
1014
+ throw new x(g.USER_REJECTED, "사용자가 메시지 서명을 거부했습니다");
929
1015
  try {
930
1016
  const c = await this.walletProvider.signMessage(
931
1017
  this.userId,
@@ -942,7 +1028,7 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
942
1028
  address: o.address
943
1029
  };
944
1030
  } catch (c) {
945
- throw c instanceof x ? c : new x(g.SIGNATURE_FAILED, `Message signing failed (${e})`, c);
1031
+ throw c instanceof x ? c : new x(g.SIGNATURE_FAILED, `메시지 서명에 실패했습니다 (${e})`, c);
946
1032
  }
947
1033
  }
948
1034
  /**
@@ -968,9 +1054,9 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
968
1054
  */
969
1055
  async signTypedData(e, s, t) {
970
1056
  if (this.ensureAuthenticated(), !this.userId)
971
- throw new x(g.AUTH_NOT_AUTHENTICATED, "User ID not found");
1057
+ throw new x(g.AUTH_NOT_AUTHENTICATED, "사용자 ID 찾을 수 없습니다");
972
1058
  if (!this.walletProvider.signTypedData)
973
- throw new x(g.NOT_IMPLEMENTED, "signTypedData is not implemented");
1059
+ throw new x(g.NOT_IMPLEMENTED, "signTypedData 구현되어 있지 않습니다");
974
1060
  X.validateTypedDataChainId(e, s);
975
1061
  const n = await this.walletProvider.getAddress(this.userId, (t == null ? void 0 : t.index) ?? 0);
976
1062
  let o;
@@ -982,7 +1068,7 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
982
1068
  dappName: t == null ? void 0 : t.dappName,
983
1069
  accountName: t == null ? void 0 : t.accountName
984
1070
  }))
985
- throw new x(g.USER_REJECTED, "User rejected typed data signing");
1071
+ throw new x(g.USER_REJECTED, "사용자가 타입 데이터 서명을 거부했습니다");
986
1072
  try {
987
1073
  const a = await this.walletProvider.signTypedData(
988
1074
  this.userId,
@@ -998,7 +1084,7 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
998
1084
  address: n.address
999
1085
  };
1000
1086
  } catch (a) {
1001
- throw a instanceof x ? a : new x(g.SIGNATURE_FAILED, `Typed data signing failed (${e})`, a);
1087
+ throw a instanceof x ? a : new x(g.SIGNATURE_FAILED, `타입 데이터 서명에 실패했습니다 (${e})`, a);
1002
1088
  }
1003
1089
  }
1004
1090
  /**
@@ -1034,7 +1120,7 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
1034
1120
  */
1035
1121
  async signTransaction(e, s, t) {
1036
1122
  if (this.ensureAuthenticated(), !this.userId)
1037
- throw new x(g.AUTH_NOT_AUTHENTICATED, "User ID not found");
1123
+ throw new x(g.AUTH_NOT_AUTHENTICATED, "사용자 ID 찾을 수 없습니다");
1038
1124
  const n = await this.withResolvedGasAndFee(s, e);
1039
1125
  let o;
1040
1126
  this.walletProvider.prepare && (o = (await this.walletProvider.prepare("sign", { tx: n })).uuid);
@@ -1055,7 +1141,7 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
1055
1141
  dappName: t == null ? void 0 : t.dappName,
1056
1142
  accountName: t == null ? void 0 : t.accountName
1057
1143
  }))
1058
- throw new x(g.USER_REJECTED, "User rejected transaction signing");
1144
+ throw new x(g.USER_REJECTED, "사용자가 트랜잭션 서명을 거부했습니다");
1059
1145
  try {
1060
1146
  const c = await this.walletProvider.signTransaction(
1061
1147
  this.userId,
@@ -1074,7 +1160,7 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
1074
1160
  const l = c instanceof Error ? c.message : String(c);
1075
1161
  throw new x(
1076
1162
  g.SIGNATURE_FAILED,
1077
- `Transaction signing failed (${e}): ${l}`,
1163
+ `트랜잭션 서명에 실패했습니다 (${e}): ${l}`,
1078
1164
  c
1079
1165
  );
1080
1166
  }
@@ -1087,7 +1173,7 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
1087
1173
  */
1088
1174
  async sendTransaction(e, s, t) {
1089
1175
  if (this.ensureAuthenticated(), !this.userId)
1090
- throw new x(g.AUTH_NOT_AUTHENTICATED, "User ID not found");
1176
+ throw new x(g.AUTH_NOT_AUTHENTICATED, "사용자 ID 찾을 수 없습니다");
1091
1177
  const n = await this.withResolvedGasAndFee(s, e);
1092
1178
  let o;
1093
1179
  this.walletProvider.prepare && (o = (await this.walletProvider.prepare("send", { tx: n })).uuid);
@@ -1108,7 +1194,7 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
1108
1194
  dappName: t == null ? void 0 : t.dappName,
1109
1195
  accountName: t == null ? void 0 : t.accountName
1110
1196
  }))
1111
- throw new x(g.USER_REJECTED, "User rejected transaction");
1197
+ throw new x(g.USER_REJECTED, "사용자가 트랜잭션을 거부했습니다");
1112
1198
  try {
1113
1199
  let c;
1114
1200
  if (this.walletProvider.sendTransaction)
@@ -1133,7 +1219,7 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
1133
1219
  const l = c instanceof Error ? c.message : String(c);
1134
1220
  throw new x(
1135
1221
  g.TRANSACTION_FAILED,
1136
- `Transaction failed (${e}): ${l}`,
1222
+ `트랜잭션 전송에 실패했습니다 (${e}): ${l}`,
1137
1223
  c
1138
1224
  );
1139
1225
  }
@@ -1157,7 +1243,7 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
1157
1243
  * @param opts.timeoutMs 최대 대기 시간 (기본 60000ms)
1158
1244
  */
1159
1245
  async waitForTxAndGetReceipt(e, s, t = {}) {
1160
- const n = t.intervalMs ?? Gs, o = qs, i = t.timeoutMs ?? bt, a = Date.now() + i;
1246
+ const n = t.intervalMs ?? js, o = Vs, i = t.timeoutMs ?? bt, a = Date.now() + i;
1161
1247
  let c = n;
1162
1248
  for (; Date.now() < a; ) {
1163
1249
  const l = await this.getTransactionReceipt(e, s);
@@ -1166,7 +1252,7 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
1166
1252
  }
1167
1253
  throw new x(
1168
1254
  g.UNKNOWN_ERROR,
1169
- `Transaction receipt timeout (${e})`
1255
+ `트랜잭션 영수증 조회 시간이 초과되었습니다 (${e})`
1170
1256
  );
1171
1257
  }
1172
1258
  /**
@@ -1186,23 +1272,23 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
1186
1272
  */
1187
1273
  async sendTransactionWithWaitForReceipt(e, s, t = {}) {
1188
1274
  var A, y;
1189
- const { intervalMs: n, timeoutMs: o, ...i } = t, { txHash: a } = await this.sendTransaction(e, s, i), c = n ?? ((A = this._config.receiptPolling) == null ? void 0 : A.intervalMs) ?? Hs, l = o ?? ((y = this._config.receiptPolling) == null ? void 0 : y.timeoutMs) ?? bt, d = ze(e), f = s.from ?? "";
1275
+ const { intervalMs: n, timeoutMs: o, ...i } = t, { txHash: a } = await this.sendTransaction(e, s, i), c = n ?? ((A = this._config.receiptPolling) == null ? void 0 : A.intervalMs) ?? Ws, l = o ?? ((y = this._config.receiptPolling) == null ? void 0 : y.timeoutMs) ?? bt, d = ze(e), f = s.from ?? "";
1190
1276
  let w, _;
1191
- const m = this.waitForTxAndGetReceipt(a, e, { intervalMs: c, timeoutMs: l }).then((I) => {
1192
- w = I;
1193
- const L = BigInt(I.gasUsed) * BigInt(I.effectiveGasPrice), U = s.value ? BigInt(s.value) : 0n, $ = X.formatTxAmount(s.value, d.symbol, d.decimals), B = X.formatTxAmount("0x" + L.toString(16), d.symbol, d.decimals), Q = X.formatTxAmount("0x" + (U + L).toString(16), d.symbol, d.decimals);
1277
+ const m = this.waitForTxAndGetReceipt(a, e, { intervalMs: c, timeoutMs: l }).then((T) => {
1278
+ w = T;
1279
+ const L = BigInt(T.gasUsed) * BigInt(T.effectiveGasPrice), F = s.value ? BigInt(s.value) : 0n, $ = X.formatTxAmount(s.value, d.symbol, d.decimals), B = X.formatTxAmount("0x" + L.toString(16), d.symbol, d.decimals), Q = X.formatTxAmount("0x" + (F + L).toString(16), d.symbol, d.decimals);
1194
1280
  return {
1195
1281
  chainId: e,
1196
1282
  txHash: a,
1197
- from: I.from,
1198
- to: I.to ?? s.to,
1283
+ from: T.from,
1284
+ to: T.to ?? s.to,
1199
1285
  amount: $,
1200
1286
  fees: B,
1201
1287
  total: Q,
1202
1288
  nativeSymbol: d.symbol,
1203
- status: I.status === "0x1" ? "success" : "reverted"
1289
+ status: T.status === "0x1" ? "success" : "reverted"
1204
1290
  };
1205
- }).catch((I) => (_ = I instanceof Error ? I : new Error(String(I)), {
1291
+ }).catch((T) => (_ = T instanceof Error ? T : new Error(String(T)), {
1206
1292
  chainId: e,
1207
1293
  txHash: a,
1208
1294
  from: f,
@@ -1235,7 +1321,7 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
1235
1321
  return await this.walletRpc("eth_gasPrice", [], e);
1236
1322
  } catch (s) {
1237
1323
  const t = s instanceof Error ? s.message : String(s);
1238
- throw new x(g.GAS_ESTIMATION_FAILED, `Failed to get gas price (${e}): ${t}`, s);
1324
+ throw new x(g.GAS_ESTIMATION_FAILED, `가스 가격 조회에 실패했습니다 (${e}): ${t}`, s);
1239
1325
  }
1240
1326
  }
1241
1327
  /**
@@ -1256,7 +1342,7 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
1256
1342
  return await this.walletRpc("eth_estimateGas", [t], s);
1257
1343
  } catch (n) {
1258
1344
  const o = n instanceof Error ? n.message : String(n);
1259
- throw new x(g.GAS_ESTIMATION_FAILED, `Failed to estimate gas (${s}): ${o}`, n);
1345
+ throw new x(g.GAS_ESTIMATION_FAILED, `가스 추정에 실패했습니다 (${s}): ${o}`, n);
1260
1346
  }
1261
1347
  }
1262
1348
  /**
@@ -1277,7 +1363,7 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
1277
1363
  return (s == null ? void 0 : s.baseFeePerGas) ?? null;
1278
1364
  } catch (s) {
1279
1365
  const t = s instanceof Error ? s.message : String(s);
1280
- throw new x(g.GAS_ESTIMATION_FAILED, `Failed to get baseFeePerGas (${e}): ${t}`, s);
1366
+ throw new x(g.GAS_ESTIMATION_FAILED, `baseFeePerGas 조회에 실패했습니다 (${e}): ${t}`, s);
1281
1367
  }
1282
1368
  }
1283
1369
  /**
@@ -1296,7 +1382,7 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
1296
1382
  return await this.walletRpc("eth_maxPriorityFeePerGas", [], e);
1297
1383
  } catch (s) {
1298
1384
  const t = s instanceof Error ? s.message : String(s);
1299
- throw new x(g.GAS_ESTIMATION_FAILED, `Failed to get maxPriorityFeePerGas (${e}): ${t}`, s);
1385
+ throw new x(g.GAS_ESTIMATION_FAILED, `maxPriorityFeePerGas 조회에 실패했습니다 (${e}): ${t}`, s);
1300
1386
  }
1301
1387
  }
1302
1388
  // ============================================================================
@@ -1316,7 +1402,7 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
1316
1402
  } catch (t) {
1317
1403
  if (t instanceof x) throw t;
1318
1404
  const n = t instanceof Error ? t.message : String(t);
1319
- throw new x(g.UNKNOWN_ERROR, `Failed to get nonce: ${n}`, t);
1405
+ throw new x(g.UNKNOWN_ERROR, `Nonce 조회에 실패했습니다: ${n}`, t);
1320
1406
  }
1321
1407
  }
1322
1408
  /**
@@ -1335,7 +1421,7 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
1335
1421
  } catch (t) {
1336
1422
  if (t instanceof x) throw t;
1337
1423
  const n = t instanceof Error ? t.message : String(t);
1338
- throw new x(g.UNKNOWN_ERROR, `Failed to get balance (${e}): ${n}`, t);
1424
+ throw new x(g.UNKNOWN_ERROR, `잔액 조회에 실패했습니다 (${e}): ${n}`, t);
1339
1425
  }
1340
1426
  }
1341
1427
  static formatWei(e) {
@@ -1343,7 +1429,7 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
1343
1429
  try {
1344
1430
  const s = BigInt(e);
1345
1431
  if (s === 0n) return "0";
1346
- const t = 10n ** BigInt(It), n = s / t, i = (s % t).toString().padStart(It, "0").replace(/0+$/, "").slice(0, Et);
1432
+ const t = 10n ** BigInt(Tt), n = s / t, i = (s % t).toString().padStart(Tt, "0").replace(/0+$/, "").slice(0, Et);
1347
1433
  return i ? `${n}.${i}` : `${n}`;
1348
1434
  } catch {
1349
1435
  return "?";
@@ -1368,7 +1454,7 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
1368
1454
  * const client = createWalletClient({ transport: custom(provider) });
1369
1455
  */
1370
1456
  getProvider(e) {
1371
- return this.ensureAuthenticated(), new Cs(this, e);
1457
+ return this.ensureAuthenticated(), new ks(this, e);
1372
1458
  }
1373
1459
  /**
1374
1460
  * 범용 JSON-RPC 요청 — 노드에 직접 연결.
@@ -1386,7 +1472,7 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
1386
1472
  } catch (n) {
1387
1473
  if (n instanceof x) throw n;
1388
1474
  const o = n instanceof Error ? n.message : String(n);
1389
- throw new x(g.UNKNOWN_ERROR, `walletRpc failed [${e}] (${t}): ${o}`, n);
1475
+ throw new x(g.UNKNOWN_ERROR, `walletRpc 호출에 실패했습니다 [${e}] (${t}): ${o}`, n);
1390
1476
  }
1391
1477
  }
1392
1478
  // ============================================================================
@@ -1430,7 +1516,7 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
1430
1516
  return p.log("[CROSSx][Migration Phase 5] 마이그레이션 성공 — address:", i.address), i;
1431
1517
  } catch (i) {
1432
1518
  if (i instanceof x && i.code === g.MIGRATION_FAILED) {
1433
- p.warn(`[CROSSx][Migration Phase 4] PIN 불일치 (시도 #${n}) — 재시도 요청`), t = "Incorrect PIN. Please try again.";
1519
+ p.warn(`[CROSSx][Migration Phase 4] PIN 불일치 (시도 #${n}) — 재시도 요청`), t = "PIN 올바르지 않습니다. 다시 시도해 주세요.";
1434
1520
  continue;
1435
1521
  }
1436
1522
  throw p.error("[CROSSx][Migration Phase 4] 마이그레이션 실패 (복구 불가):", i), i;
@@ -1468,7 +1554,7 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
1468
1554
  const d = vt;
1469
1555
  c.maxFeePerGas = "0x" + (BigInt(l) + BigInt(d)).toString(16), c.maxPriorityFeePerGas = d, p.log("[CROSSx] Dynamic 체인 감지 — baseFee:", l, "maxFeePerGas:", c.maxFeePerGas, "maxPriorityFeePerGas: 1 Gwei");
1470
1556
  } else
1471
- c.gasPrice = Ws, p.log("[CROSSx] Legacy 체인 감지 — gasPrice: 2 Gwei");
1557
+ c.gasPrice = Ks, p.log("[CROSSx] Legacy 체인 감지 — gasPrice: 2 Gwei");
1472
1558
  }
1473
1559
  return !i && a && (c.maxPriorityFeePerGas = vt, p.log("[CROSSx] maxPriorityFeePerGas 비어있음 → 1 Gwei 기본값 적용")), c;
1474
1560
  }
@@ -1484,7 +1570,7 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
1484
1570
  if (t !== void 0 && t !== 0)
1485
1571
  throw new x(
1486
1572
  g.TYPED_DATA_CHAIN_ID_MISMATCH,
1487
- `Off-chain signing (chainId=0) requires typedData.domain.chainId to be absent or 0, got ${t}`
1573
+ `오프체인 서명(chainId=0)에서는 typedData.domain.chainId 없거나 0이어야 합니다. 현재 값: ${t}`
1488
1574
  );
1489
1575
  return;
1490
1576
  }
@@ -1494,12 +1580,12 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
1494
1580
  if (t === void 0)
1495
1581
  throw new x(
1496
1582
  g.TYPED_DATA_CHAIN_ID_MISMATCH,
1497
- `On-chain signing (${e}) requires typedData.domain.chainId to be present`
1583
+ `온체인 서명(${e})에서는 typedData.domain.chainId 반드시 있어야 합니다`
1498
1584
  );
1499
1585
  if (t !== o)
1500
1586
  throw new x(
1501
1587
  g.TYPED_DATA_CHAIN_ID_MISMATCH,
1502
- `typedData.domain.chainId (${t}) does not match chainId (${e}, expected ${o})`
1588
+ `typedData.domain.chainId (${t}) chainId (${e}, 예상값: ${o})와 일치하지 않습니다`
1503
1589
  );
1504
1590
  }
1505
1591
  }
@@ -1516,20 +1602,20 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
1516
1602
  static validateSignatureFormat(e) {
1517
1603
  const s = e.startsWith("0x") ? e.slice(2) : e;
1518
1604
  if (!/^[0-9a-fA-F]+$/.test(s))
1519
- throw new x(g.SIGNATURE_FAILED, "Invalid signature: not a valid hex string");
1605
+ throw new x(g.SIGNATURE_FAILED, "유효하지 않은 서명: 올바른 hex 문자열이 아닙니다");
1520
1606
  if (s.length !== St)
1521
1607
  throw new x(
1522
1608
  g.SIGNATURE_FAILED,
1523
- `Invalid signature length: expected ${St} hex chars (65 bytes), got ${s.length}`
1609
+ `서명 길이가 유효하지 않습니다: ${St} hex 문자(65 바이트) 예상, 현재 ${s.length}`
1524
1610
  );
1525
1611
  }
1526
1612
  /** RLP-encoded signed transaction 형식 검증 */
1527
1613
  static validateSignedTxFormat(e) {
1528
1614
  const s = e.startsWith("0x") ? e.slice(2) : e;
1529
1615
  if (!/^[0-9a-fA-F]+$/.test(s))
1530
- throw new x(g.SIGNATURE_FAILED, "Invalid signedTx: not a valid hex string");
1616
+ throw new x(g.SIGNATURE_FAILED, "유효하지 않은 서명된 트랜잭션: 올바른 hex 문자열이 아닙니다");
1531
1617
  if (s.length < 2)
1532
- throw new x(g.SIGNATURE_FAILED, "Invalid signedTx: too short");
1618
+ throw new x(g.SIGNATURE_FAILED, "유효하지 않은 서명된 트랜잭션: 너무 짧습니다");
1533
1619
  }
1534
1620
  /**
1535
1621
  * Gateway 서명 응답의 ecrecover 검증 (XF-036)
@@ -1547,7 +1633,7 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
1547
1633
  recovered: n
1548
1634
  }), new x(
1549
1635
  g.SIGNATURE_SIGNER_MISMATCH,
1550
- `Signature signer mismatch: expected ${t}, recovered ${n}`
1636
+ `서명자 주소가 일치하지 않습니다: 예상 ${t}, 복원된 주소 ${n}`
1551
1637
  );
1552
1638
  p.log("[CROSSx] 서명 ecrecover 검증 성공");
1553
1639
  } catch (n) {
@@ -1583,14 +1669,14 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
1583
1669
  if (!this.initialized)
1584
1670
  throw new x(
1585
1671
  g.AUTH_NOT_INITIALIZED,
1586
- "SDK is not initialized. Call initialize() first."
1672
+ "SDK 초기화되지 않았습니다. initialize() 먼저 호출하세요."
1587
1673
  );
1588
1674
  }
1589
1675
  ensureAuthenticated() {
1590
1676
  if (this.ensureInitialized(), !this.authenticated)
1591
1677
  throw new x(
1592
1678
  g.AUTH_NOT_AUTHENTICATED,
1593
- "Not authenticated. Call signIn() first."
1679
+ "인증되지 않은 상태입니다. signIn() 먼저 호출하세요."
1594
1680
  );
1595
1681
  }
1596
1682
  /**
@@ -1605,7 +1691,7 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
1605
1691
  };
1606
1692
  X.OFFCHAIN_CHAIN_ID = "0";
1607
1693
  let st = X;
1608
- class Ks {
1694
+ class Zs {
1609
1695
  constructor() {
1610
1696
  this.prefix = "crossx_";
1611
1697
  }
@@ -1642,7 +1728,7 @@ class Ks {
1642
1728
  }
1643
1729
  }
1644
1730
  }
1645
- const zs = "crossx-sdk", Ys = 1, Se = "data", Le = "keys", Tt = "aes-primary", Zs = 12;
1731
+ const Xs = "crossx-sdk", Js = 1, Se = "data", Le = "keys", It = "aes-primary", Qs = 12;
1646
1732
  class At {
1647
1733
  constructor() {
1648
1734
  this.db = null, this.cryptoKey = null, this.initPromise = null;
@@ -1652,7 +1738,7 @@ class At {
1652
1738
  }
1653
1739
  openDB() {
1654
1740
  return new Promise((e, s) => {
1655
- const t = indexedDB.open(zs, Ys);
1741
+ const t = indexedDB.open(Xs, Js);
1656
1742
  t.onupgradeneeded = () => {
1657
1743
  const n = t.result;
1658
1744
  n.objectStoreNames.contains(Se) || n.createObjectStore(Se), n.objectStoreNames.contains(Le) || n.createObjectStore(Le);
@@ -1685,7 +1771,7 @@ class At {
1685
1771
  }
1686
1772
  async init() {
1687
1773
  this.db = await this.openDB();
1688
- const e = await this.idbGet(Le, Tt);
1774
+ const e = await this.idbGet(Le, It);
1689
1775
  if (e) {
1690
1776
  this.cryptoKey = e;
1691
1777
  return;
@@ -1694,10 +1780,10 @@ class At {
1694
1780
  { name: "AES-GCM", length: 256 },
1695
1781
  !1,
1696
1782
  ["encrypt", "decrypt"]
1697
- ), await this.idbPut(Le, Tt, this.cryptoKey);
1783
+ ), await this.idbPut(Le, It, this.cryptoKey);
1698
1784
  }
1699
1785
  async encrypt(e) {
1700
- const s = new Uint8Array(Zs);
1786
+ const s = new Uint8Array(Qs);
1701
1787
  crypto.getRandomValues(s);
1702
1788
  const t = new TextEncoder().encode(e), n = await crypto.subtle.encrypt(
1703
1789
  { name: "AES-GCM", iv: s },
@@ -1773,27 +1859,27 @@ function H(r, e, s = "") {
1773
1859
  }
1774
1860
  return r;
1775
1861
  }
1776
- function Kt(r) {
1862
+ function zt(r) {
1777
1863
  if (typeof r != "function" || typeof r.create != "function")
1778
1864
  throw new Error("Hash must wrapped by utils.createHasher");
1779
1865
  ue(r.outputLen), ue(r.blockLen);
1780
1866
  }
1781
- function Ie(r, e = !0) {
1867
+ function Te(r, e = !0) {
1782
1868
  if (r.destroyed)
1783
1869
  throw new Error("Hash instance has been destroyed");
1784
1870
  if (e && r.finished)
1785
1871
  throw new Error("Hash#digest() has already been called");
1786
1872
  }
1787
- function zt(r, e) {
1873
+ function Yt(r, e) {
1788
1874
  H(r, void 0, "digestInto() output");
1789
1875
  const s = e.outputLen;
1790
1876
  if (r.length < s)
1791
1877
  throw new Error('"digestInto() output" expected to be of length >=' + s);
1792
1878
  }
1793
- function Xs(r) {
1879
+ function er(r) {
1794
1880
  return new Uint32Array(r.buffer, r.byteOffset, Math.floor(r.byteLength / 4));
1795
1881
  }
1796
- function Te(...r) {
1882
+ function Ie(...r) {
1797
1883
  for (let e = 0; e < r.length; e++)
1798
1884
  r[e].fill(0);
1799
1885
  }
@@ -1803,22 +1889,22 @@ function Ze(r) {
1803
1889
  function oe(r, e) {
1804
1890
  return r << 32 - e | r >>> e;
1805
1891
  }
1806
- const Js = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
1807
- function Qs(r) {
1892
+ const tr = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
1893
+ function sr(r) {
1808
1894
  return r << 24 & 4278190080 | r << 8 & 16711680 | r >>> 8 & 65280 | r >>> 24 & 255;
1809
1895
  }
1810
- function er(r) {
1896
+ function rr(r) {
1811
1897
  for (let e = 0; e < r.length; e++)
1812
- r[e] = Qs(r[e]);
1898
+ r[e] = sr(r[e]);
1813
1899
  return r;
1814
1900
  }
1815
- const Rt = Js ? (r) => r : er, Yt = /* @ts-ignore */ typeof Uint8Array.from([]).toHex == "function" && typeof Uint8Array.fromHex == "function", tr = /* @__PURE__ */ Array.from({ length: 256 }, (r, e) => e.toString(16).padStart(2, "0"));
1901
+ const Rt = tr ? (r) => r : rr, Zt = /* @ts-ignore */ typeof Uint8Array.from([]).toHex == "function" && typeof Uint8Array.fromHex == "function", nr = /* @__PURE__ */ Array.from({ length: 256 }, (r, e) => e.toString(16).padStart(2, "0"));
1816
1902
  function ke(r) {
1817
- if (H(r), Yt)
1903
+ if (H(r), Zt)
1818
1904
  return r.toHex();
1819
1905
  let e = "";
1820
1906
  for (let s = 0; s < r.length; s++)
1821
- e += tr[r[s]];
1907
+ e += nr[r[s]];
1822
1908
  return e;
1823
1909
  }
1824
1910
  const ce = { _0: 48, _9: 57, A: 65, F: 70, a: 97, f: 102 };
@@ -1830,10 +1916,10 @@ function Ot(r) {
1830
1916
  if (r >= ce.a && r <= ce.f)
1831
1917
  return r - (ce.a - 10);
1832
1918
  }
1833
- function Fe(r) {
1919
+ function Ue(r) {
1834
1920
  if (typeof r != "string")
1835
1921
  throw new Error("hex string expected, got " + typeof r);
1836
- if (Yt)
1922
+ if (Zt)
1837
1923
  return Uint8Array.fromHex(r);
1838
1924
  const e = r.length, s = e / 2;
1839
1925
  if (e % 2)
@@ -1862,26 +1948,26 @@ function _e(...r) {
1862
1948
  }
1863
1949
  return s;
1864
1950
  }
1865
- function Zt(r, e = {}) {
1951
+ function Xt(r, e = {}) {
1866
1952
  const s = (n, o) => r(o).update(n).digest(), t = r(void 0);
1867
1953
  return s.outputLen = t.outputLen, s.blockLen = t.blockLen, s.create = (n) => r(n), Object.assign(s, e), Object.freeze(s);
1868
1954
  }
1869
- function Xt(r = 32) {
1955
+ function Jt(r = 32) {
1870
1956
  const e = typeof globalThis == "object" ? globalThis.crypto : null;
1871
1957
  if (typeof (e == null ? void 0 : e.getRandomValues) != "function")
1872
1958
  throw new Error("crypto.getRandomValues must be defined");
1873
1959
  return e.getRandomValues(new Uint8Array(r));
1874
1960
  }
1875
- const sr = (r) => ({
1961
+ const or = (r) => ({
1876
1962
  oid: Uint8Array.from([6, 9, 96, 134, 72, 1, 101, 3, 4, 2, r])
1877
1963
  });
1878
- function rr(r, e, s) {
1964
+ function ir(r, e, s) {
1879
1965
  return r & e ^ ~r & s;
1880
1966
  }
1881
- function nr(r, e, s) {
1967
+ function ar(r, e, s) {
1882
1968
  return r & e ^ r & s ^ e & s;
1883
1969
  }
1884
- class or {
1970
+ class cr {
1885
1971
  constructor(e, s, t, n) {
1886
1972
  v(this, "blockLen");
1887
1973
  v(this, "outputLen");
@@ -1897,7 +1983,7 @@ class or {
1897
1983
  this.blockLen = e, this.outputLen = s, this.padOffset = t, this.isLE = n, this.buffer = new Uint8Array(e), this.view = Ze(this.buffer);
1898
1984
  }
1899
1985
  update(e) {
1900
- Ie(this), H(e);
1986
+ Te(this), H(e);
1901
1987
  const { view: s, buffer: t, blockLen: n } = this, o = e.length;
1902
1988
  for (let i = 0; i < o; ) {
1903
1989
  const a = Math.min(n - this.pos, o - i);
@@ -1912,10 +1998,10 @@ class or {
1912
1998
  return this.length += e.length, this.roundClean(), this;
1913
1999
  }
1914
2000
  digestInto(e) {
1915
- Ie(this), zt(e, this), this.finished = !0;
2001
+ Te(this), Yt(e, this), this.finished = !0;
1916
2002
  const { buffer: s, view: t, blockLen: n, isLE: o } = this;
1917
2003
  let { pos: i } = this;
1918
- s[i++] = 128, Te(this.buffer.subarray(i)), this.padOffset > n - i && (this.process(t, 0), i = 0);
2004
+ s[i++] = 128, Ie(this.buffer.subarray(i)), this.padOffset > n - i && (this.process(t, 0), i = 0);
1919
2005
  for (let f = i; f < n; f++)
1920
2006
  s[f] = 0;
1921
2007
  t.setBigUint64(n - 8, BigInt(this.length * 8), o), this.process(t, 0);
@@ -1953,19 +2039,19 @@ const fe = /* @__PURE__ */ Uint32Array.from([
1953
2039
  528734635,
1954
2040
  1541459225
1955
2041
  ]), De = /* @__PURE__ */ BigInt(2 ** 32 - 1), Ct = /* @__PURE__ */ BigInt(32);
1956
- function ir(r, e = !1) {
2042
+ function lr(r, e = !1) {
1957
2043
  return e ? { h: Number(r & De), l: Number(r >> Ct & De) } : { h: Number(r >> Ct & De) | 0, l: Number(r & De) | 0 };
1958
2044
  }
1959
- function ar(r, e = !1) {
2045
+ function dr(r, e = !1) {
1960
2046
  const s = r.length;
1961
2047
  let t = new Uint32Array(s), n = new Uint32Array(s);
1962
2048
  for (let o = 0; o < s; o++) {
1963
- const { h: i, l: a } = ir(r[o], e);
2049
+ const { h: i, l: a } = lr(r[o], e);
1964
2050
  [t[o], n[o]] = [i, a];
1965
2051
  }
1966
2052
  return [t, n];
1967
2053
  }
1968
- const cr = (r, e, s) => r << s | e >>> 32 - s, lr = (r, e, s) => e << s | r >>> 32 - s, dr = (r, e, s) => e << s - 32 | r >>> 64 - s, ur = (r, e, s) => r << s - 32 | e >>> 64 - s, hr = /* @__PURE__ */ Uint32Array.from([
2054
+ const ur = (r, e, s) => r << s | e >>> 32 - s, hr = (r, e, s) => e << s | r >>> 32 - s, fr = (r, e, s) => e << s - 32 | r >>> 64 - s, pr = (r, e, s) => r << s - 32 | e >>> 64 - s, gr = /* @__PURE__ */ Uint32Array.from([
1969
2055
  1116352408,
1970
2056
  1899447441,
1971
2057
  3049323471,
@@ -2031,7 +2117,7 @@ const cr = (r, e, s) => r << s | e >>> 32 - s, lr = (r, e, s) => e << s | r >>>
2031
2117
  3204031479,
2032
2118
  3329325298
2033
2119
  ]), pe = /* @__PURE__ */ new Uint32Array(64);
2034
- class fr extends or {
2120
+ class _r extends cr {
2035
2121
  constructor(e) {
2036
2122
  super(64, e, 8, !1);
2037
2123
  }
@@ -2052,19 +2138,19 @@ class fr extends or {
2052
2138
  }
2053
2139
  let { A: t, B: n, C: o, D: i, E: a, F: c, G: l, H: d } = this;
2054
2140
  for (let f = 0; f < 64; f++) {
2055
- const w = oe(a, 6) ^ oe(a, 11) ^ oe(a, 25), _ = d + w + rr(a, c, l) + hr[f] + pe[f] | 0, A = (oe(t, 2) ^ oe(t, 13) ^ oe(t, 22)) + nr(t, n, o) | 0;
2141
+ const w = oe(a, 6) ^ oe(a, 11) ^ oe(a, 25), _ = d + w + ir(a, c, l) + gr[f] + pe[f] | 0, A = (oe(t, 2) ^ oe(t, 13) ^ oe(t, 22)) + ar(t, n, o) | 0;
2056
2142
  d = l, l = c, c = a, a = i + _ | 0, i = o, o = n, n = t, t = _ + A | 0;
2057
2143
  }
2058
2144
  t = t + this.A | 0, n = n + this.B | 0, o = o + this.C | 0, i = i + this.D | 0, a = a + this.E | 0, c = c + this.F | 0, l = l + this.G | 0, d = d + this.H | 0, this.set(t, n, o, i, a, c, l, d);
2059
2145
  }
2060
2146
  roundClean() {
2061
- Te(pe);
2147
+ Ie(pe);
2062
2148
  }
2063
2149
  destroy() {
2064
- this.set(0, 0, 0, 0, 0, 0, 0, 0), Te(this.buffer);
2150
+ this.set(0, 0, 0, 0, 0, 0, 0, 0), Ie(this.buffer);
2065
2151
  }
2066
2152
  }
2067
- class pr extends fr {
2153
+ class xr extends _r {
2068
2154
  constructor() {
2069
2155
  super(32);
2070
2156
  // We cannot use array here since array allows indexing by variable
@@ -2079,9 +2165,9 @@ class pr extends fr {
2079
2165
  v(this, "H", fe[7] | 0);
2080
2166
  }
2081
2167
  }
2082
- const gr = /* @__PURE__ */ Zt(
2083
- () => new pr(),
2084
- /* @__PURE__ */ sr(1)
2168
+ const mr = /* @__PURE__ */ Xt(
2169
+ () => new xr(),
2170
+ /* @__PURE__ */ or(1)
2085
2171
  );
2086
2172
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
2087
2173
  const ct = /* @__PURE__ */ BigInt(0), rt = /* @__PURE__ */ BigInt(1);
@@ -2092,7 +2178,7 @@ function He(r, e = "") {
2092
2178
  }
2093
2179
  return r;
2094
2180
  }
2095
- function Jt(r) {
2181
+ function Qt(r) {
2096
2182
  if (typeof r == "bigint") {
2097
2183
  if (!Be(r))
2098
2184
  throw new Error("positive bigint expected, got " + r);
@@ -2101,49 +2187,49 @@ function Jt(r) {
2101
2187
  return r;
2102
2188
  }
2103
2189
  function $e(r) {
2104
- const e = Jt(r).toString(16);
2190
+ const e = Qt(r).toString(16);
2105
2191
  return e.length & 1 ? "0" + e : e;
2106
2192
  }
2107
- function Qt(r) {
2193
+ function es(r) {
2108
2194
  if (typeof r != "string")
2109
2195
  throw new Error("hex string expected, got " + typeof r);
2110
2196
  return r === "" ? ct : BigInt("0x" + r);
2111
2197
  }
2112
2198
  function je(r) {
2113
- return Qt(ke(r));
2199
+ return es(ke(r));
2114
2200
  }
2115
- function es(r) {
2116
- return Qt(ke(_r(H(r)).reverse()));
2201
+ function ts(r) {
2202
+ return es(ke(wr(H(r)).reverse()));
2117
2203
  }
2118
2204
  function lt(r, e) {
2119
- ue(e), r = Jt(r);
2120
- const s = Fe(r.toString(16).padStart(e * 2, "0"));
2205
+ ue(e), r = Qt(r);
2206
+ const s = Ue(r.toString(16).padStart(e * 2, "0"));
2121
2207
  if (s.length !== e)
2122
2208
  throw new Error("number too large");
2123
2209
  return s;
2124
2210
  }
2125
- function ts(r, e) {
2211
+ function ss(r, e) {
2126
2212
  return lt(r, e).reverse();
2127
2213
  }
2128
- function _r(r) {
2214
+ function wr(r) {
2129
2215
  return Uint8Array.from(r);
2130
2216
  }
2131
2217
  const Be = (r) => typeof r == "bigint" && ct <= r;
2132
- function xr(r, e, s) {
2218
+ function yr(r, e, s) {
2133
2219
  return Be(r) && Be(e) && Be(s) && e <= r && r < s;
2134
2220
  }
2135
- function mr(r, e, s, t) {
2136
- if (!xr(e, s, t))
2221
+ function br(r, e, s, t) {
2222
+ if (!yr(e, s, t))
2137
2223
  throw new Error("expected valid " + r + ": " + s + " <= n < " + t + ", got " + e);
2138
2224
  }
2139
- function wr(r) {
2225
+ function vr(r) {
2140
2226
  let e;
2141
2227
  for (e = 0; r > ct; r >>= rt, e += 1)
2142
2228
  ;
2143
2229
  return e;
2144
2230
  }
2145
2231
  const dt = (r) => (rt << BigInt(r)) - rt;
2146
- function yr(r, e, s) {
2232
+ function Sr(r, e, s) {
2147
2233
  if (ue(r, "hashLen"), ue(e, "qByteLen"), typeof s != "function")
2148
2234
  throw new Error("hmacFn must be a function");
2149
2235
  const t = (y) => new Uint8Array(y), n = Uint8Array.of(), o = Uint8Array.of(0), i = Uint8Array.of(1), a = 1e3;
@@ -2156,18 +2242,18 @@ function yr(r, e, s) {
2156
2242
  if (d++ >= a)
2157
2243
  throw new Error("drbg: tried max amount of iterations");
2158
2244
  let y = 0;
2159
- const I = [];
2245
+ const T = [];
2160
2246
  for (; y < e; ) {
2161
2247
  c = w();
2162
2248
  const L = c.slice();
2163
- I.push(L), y += c.length;
2249
+ T.push(L), y += c.length;
2164
2250
  }
2165
- return _e(...I);
2251
+ return _e(...T);
2166
2252
  };
2167
- return (y, I) => {
2253
+ return (y, T) => {
2168
2254
  f(), _(y);
2169
2255
  let L;
2170
- for (; !(L = I(m())); )
2256
+ for (; !(L = T(m())); )
2171
2257
  _();
2172
2258
  return f(), L;
2173
2259
  };
@@ -2197,7 +2283,7 @@ function kt(r) {
2197
2283
  };
2198
2284
  }
2199
2285
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
2200
- const J = /* @__PURE__ */ BigInt(0), z = /* @__PURE__ */ BigInt(1), ye = /* @__PURE__ */ BigInt(2), ss = /* @__PURE__ */ BigInt(3), rs = /* @__PURE__ */ BigInt(4), ns = /* @__PURE__ */ BigInt(5), br = /* @__PURE__ */ BigInt(7), os = /* @__PURE__ */ BigInt(8), vr = /* @__PURE__ */ BigInt(9), is = /* @__PURE__ */ BigInt(16);
2286
+ const J = /* @__PURE__ */ BigInt(0), z = /* @__PURE__ */ BigInt(1), ye = /* @__PURE__ */ BigInt(2), rs = /* @__PURE__ */ BigInt(3), ns = /* @__PURE__ */ BigInt(4), os = /* @__PURE__ */ BigInt(5), Er = /* @__PURE__ */ BigInt(7), is = /* @__PURE__ */ BigInt(8), Tr = /* @__PURE__ */ BigInt(9), as = /* @__PURE__ */ BigInt(16);
2201
2287
  function re(r, e) {
2202
2288
  const s = r % e;
2203
2289
  return s >= J ? s : e + s;
@@ -2226,16 +2312,16 @@ function ht(r, e, s) {
2226
2312
  if (!r.eql(r.sqr(e), s))
2227
2313
  throw new Error("Cannot find square root");
2228
2314
  }
2229
- function as(r, e) {
2230
- const s = (r.ORDER + z) / rs, t = r.pow(e, s);
2315
+ function cs(r, e) {
2316
+ const s = (r.ORDER + z) / ns, t = r.pow(e, s);
2231
2317
  return ht(r, t, e), t;
2232
2318
  }
2233
- function Sr(r, e) {
2234
- const s = (r.ORDER - ns) / os, t = r.mul(e, ye), n = r.pow(t, s), o = r.mul(e, n), i = r.mul(r.mul(o, ye), n), a = r.mul(o, r.sub(i, r.ONE));
2319
+ function Ir(r, e) {
2320
+ const s = (r.ORDER - os) / is, t = r.mul(e, ye), n = r.pow(t, s), o = r.mul(e, n), i = r.mul(r.mul(o, ye), n), a = r.mul(o, r.sub(i, r.ONE));
2235
2321
  return ht(r, a, e), a;
2236
2322
  }
2237
- function Er(r) {
2238
- const e = Ve(r), s = cs(r), t = s(e, e.neg(e.ONE)), n = s(e, t), o = s(e, e.neg(t)), i = (r + br) / is;
2323
+ function Ar(r) {
2324
+ const e = Ve(r), s = ls(r), t = s(e, e.neg(e.ONE)), n = s(e, t), o = s(e, e.neg(t)), i = (r + Er) / as;
2239
2325
  return (a, c) => {
2240
2326
  let l = a.pow(c, i), d = a.mul(l, t);
2241
2327
  const f = a.mul(l, n), w = a.mul(l, o), _ = a.eql(a.sqr(d), c), m = a.eql(a.sqr(f), c);
@@ -2244,8 +2330,8 @@ function Er(r) {
2244
2330
  return ht(a, y, c), y;
2245
2331
  };
2246
2332
  }
2247
- function cs(r) {
2248
- if (r < ss)
2333
+ function ls(r) {
2334
+ if (r < rs)
2249
2335
  throw new Error("sqrt is not defined for small field");
2250
2336
  let e = r - z, s = 0;
2251
2337
  for (; e % ye === J; )
@@ -2256,7 +2342,7 @@ function cs(r) {
2256
2342
  if (t++ > 1e3)
2257
2343
  throw new Error("Cannot find square root: probably non-prime P");
2258
2344
  if (s === 1)
2259
- return as;
2345
+ return cs;
2260
2346
  let o = n.pow(t, e);
2261
2347
  const i = (e + z) / ye;
2262
2348
  return function(c, l) {
@@ -2272,16 +2358,16 @@ function cs(r) {
2272
2358
  for (; !c.eql(A, c.ONE); )
2273
2359
  if (m++, A = c.sqr(A), m === d)
2274
2360
  throw new Error("Cannot find square root");
2275
- const y = z << BigInt(d - m - 1), I = c.pow(f, y);
2276
- d = m, f = c.sqr(I), w = c.mul(w, f), _ = c.mul(_, I);
2361
+ const y = z << BigInt(d - m - 1), T = c.pow(f, y);
2362
+ d = m, f = c.sqr(T), w = c.mul(w, f), _ = c.mul(_, T);
2277
2363
  }
2278
2364
  return _;
2279
2365
  };
2280
2366
  }
2281
- function Ir(r) {
2282
- return r % rs === ss ? as : r % os === ns ? Sr : r % is === vr ? Er(r) : cs(r);
2367
+ function Rr(r) {
2368
+ return r % ns === rs ? cs : r % is === os ? Ir : r % as === Tr ? Ar(r) : ls(r);
2283
2369
  }
2284
- const Tr = [
2370
+ const Or = [
2285
2371
  "create",
2286
2372
  "isValid",
2287
2373
  "is0",
@@ -2300,15 +2386,15 @@ const Tr = [
2300
2386
  "mulN",
2301
2387
  "sqrN"
2302
2388
  ];
2303
- function Ar(r) {
2389
+ function Cr(r) {
2304
2390
  const e = {
2305
2391
  ORDER: "bigint",
2306
2392
  BYTES: "number",
2307
2393
  BITS: "number"
2308
- }, s = Tr.reduce((t, n) => (t[n] = "function", t), e);
2394
+ }, s = Or.reduce((t, n) => (t[n] = "function", t), e);
2309
2395
  return ut(r, s), r;
2310
2396
  }
2311
- function Rr(r, e, s) {
2397
+ function kr(r, e, s) {
2312
2398
  if (s < J)
2313
2399
  throw new Error("invalid exponent, negatives unsupported");
2314
2400
  if (s === J)
@@ -2320,7 +2406,7 @@ function Rr(r, e, s) {
2320
2406
  s & z && (t = r.mul(t, n)), n = r.sqr(n), s >>= z;
2321
2407
  return t;
2322
2408
  }
2323
- function ls(r, e, s = !1) {
2409
+ function ds(r, e, s = !1) {
2324
2410
  const t = new Array(e.length).fill(s ? r.ZERO : void 0), n = e.reduce((i, a, c) => r.is0(a) ? i : (t[c] = i, r.mul(i, a)), r.ONE), o = r.inv(n);
2325
2411
  return e.reduceRight((i, a, c) => r.is0(a) ? i : (t[c] = r.mul(i, t[c]), r.mul(i, a)), o), t;
2326
2412
  }
@@ -2330,12 +2416,12 @@ function Pt(r, e) {
2330
2416
  throw new Error("invalid Legendre symbol result");
2331
2417
  return n ? 1 : o ? 0 : -1;
2332
2418
  }
2333
- function Or(r, e) {
2419
+ function Nr(r, e) {
2334
2420
  e !== void 0 && ue(e);
2335
2421
  const s = e !== void 0 ? e : r.toString(2).length, t = Math.ceil(s / 8);
2336
2422
  return { nBitLength: s, nByteLength: t };
2337
2423
  }
2338
- class Cr {
2424
+ class Pr {
2339
2425
  constructor(e, s = {}) {
2340
2426
  v(this, "ORDER");
2341
2427
  v(this, "BITS");
@@ -2352,7 +2438,7 @@ class Cr {
2352
2438
  throw new Error("invalid field: expected ORDER > 0, got " + e);
2353
2439
  let t;
2354
2440
  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 = (i = s.allowedLengths) == null ? void 0 : i.slice()), typeof s.modFromBytes == "boolean" && (this._mod = s.modFromBytes));
2355
- const { nBitLength: n, nByteLength: o } = Or(e, t);
2441
+ const { nBitLength: n, nByteLength: o } = Nr(e, t);
2356
2442
  if (o > 2048)
2357
2443
  throw new Error("invalid field: expected ORDER of <= 2048 bytes");
2358
2444
  this.ORDER = e, this.BITS = n, this.BYTES = o, this._sqrt = void 0, Object.preventExtensions(this);
@@ -2394,7 +2480,7 @@ class Cr {
2394
2480
  return re(e * s, this.ORDER);
2395
2481
  }
2396
2482
  pow(e, s) {
2397
- return Rr(this, e, s);
2483
+ return kr(this, e, s);
2398
2484
  }
2399
2485
  div(e, s) {
2400
2486
  return re(e * Nt(s, this.ORDER), this.ORDER);
@@ -2416,10 +2502,10 @@ class Cr {
2416
2502
  return Nt(e, this.ORDER);
2417
2503
  }
2418
2504
  sqrt(e) {
2419
- return this._sqrt || (this._sqrt = Ir(this.ORDER)), this._sqrt(this, e);
2505
+ return this._sqrt || (this._sqrt = Rr(this.ORDER)), this._sqrt(this, e);
2420
2506
  }
2421
2507
  toBytes(e) {
2422
- return this.isLE ? ts(e, this.BYTES) : lt(e, this.BYTES);
2508
+ return this.isLE ? ss(e, this.BYTES) : lt(e, this.BYTES);
2423
2509
  }
2424
2510
  fromBytes(e, s = !1) {
2425
2511
  H(e);
@@ -2432,14 +2518,14 @@ class Cr {
2432
2518
  }
2433
2519
  if (e.length !== n)
2434
2520
  throw new Error("Field.fromBytes: expected " + n + " bytes, got " + e.length);
2435
- let c = o ? es(e) : je(e);
2521
+ let c = o ? ts(e) : je(e);
2436
2522
  if (a && (c = re(c, i)), !s && !this.isValid(c))
2437
2523
  throw new Error("invalid field element: outside of range 0..ORDER");
2438
2524
  return c;
2439
2525
  }
2440
2526
  // TODO: we don't need it here, move out to separate fn
2441
2527
  invertBatch(e) {
2442
- return ls(this, e);
2528
+ return ds(this, e);
2443
2529
  }
2444
2530
  // We can't move this out because Fp6, Fp12 implement it
2445
2531
  // and it's unclear what to return in there.
@@ -2448,25 +2534,25 @@ class Cr {
2448
2534
  }
2449
2535
  }
2450
2536
  function Ve(r, e = {}) {
2451
- return new Cr(r, e);
2537
+ return new Pr(r, e);
2452
2538
  }
2453
- function ds(r) {
2539
+ function us(r) {
2454
2540
  if (typeof r != "bigint")
2455
2541
  throw new Error("field order must be bigint");
2456
2542
  const e = r.toString(2).length;
2457
2543
  return Math.ceil(e / 8);
2458
2544
  }
2459
- function us(r) {
2460
- const e = ds(r);
2545
+ function hs(r) {
2546
+ const e = us(r);
2461
2547
  return e + Math.ceil(e / 2);
2462
2548
  }
2463
- function kr(r, e, s = !1) {
2549
+ function Lr(r, e, s = !1) {
2464
2550
  H(r);
2465
- const t = r.length, n = ds(e), o = us(e);
2551
+ const t = r.length, n = us(e), o = hs(e);
2466
2552
  if (t < 16 || t < o || t > 1024)
2467
2553
  throw new Error("expected " + o + "-1024 bytes of input, got " + t);
2468
- const i = s ? es(r) : je(r), a = re(i, e - z) + z;
2469
- return s ? ts(a, n) : lt(a, n);
2554
+ const i = s ? ts(r) : je(r), a = re(i, e - z) + z;
2555
+ return s ? ss(a, n) : lt(a, n);
2470
2556
  }
2471
2557
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
2472
2558
  const Ae = /* @__PURE__ */ BigInt(0), be = /* @__PURE__ */ BigInt(1);
@@ -2475,15 +2561,15 @@ function Ge(r, e) {
2475
2561
  return r ? s : e;
2476
2562
  }
2477
2563
  function Lt(r, e) {
2478
- const s = ls(r.Fp, e.map((t) => t.Z));
2564
+ const s = ds(r.Fp, e.map((t) => t.Z));
2479
2565
  return e.map((t, n) => r.fromAffine(t.toAffine(s[n])));
2480
2566
  }
2481
- function hs(r, e) {
2567
+ function fs(r, e) {
2482
2568
  if (!Number.isSafeInteger(r) || r <= 0 || r > e)
2483
2569
  throw new Error("invalid window size, expected [1.." + e + "], got W=" + r);
2484
2570
  }
2485
2571
  function Xe(r, e) {
2486
- hs(r, e);
2572
+ fs(r, e);
2487
2573
  const s = Math.ceil(e / r) + 1, t = 2 ** (r - 1), n = 2 ** r, o = dt(r), i = BigInt(r);
2488
2574
  return { windows: s, windowSize: t, mask: o, maxNumber: n, shiftBy: i };
2489
2575
  }
@@ -2494,15 +2580,15 @@ function Dt(r, e, s) {
2494
2580
  const l = e * t, d = l + Math.abs(a) - 1, f = a === 0, w = a < 0, _ = e % 2 !== 0;
2495
2581
  return { nextN: c, offset: d, isZero: f, isNeg: w, isNegF: _, offsetF: l };
2496
2582
  }
2497
- const Je = /* @__PURE__ */ new WeakMap(), fs = /* @__PURE__ */ new WeakMap();
2583
+ const Je = /* @__PURE__ */ new WeakMap(), ps = /* @__PURE__ */ new WeakMap();
2498
2584
  function Qe(r) {
2499
- return fs.get(r) || 1;
2585
+ return ps.get(r) || 1;
2500
2586
  }
2501
2587
  function $t(r) {
2502
2588
  if (r !== Ae)
2503
2589
  throw new Error("invalid wNAF");
2504
2590
  }
2505
- class Nr {
2591
+ class Dr {
2506
2592
  // Parametrized with a given Point class (not individual point)
2507
2593
  constructor(e, s) {
2508
2594
  v(this, "BASE");
@@ -2590,13 +2676,13 @@ class Nr {
2590
2676
  // using windowed method. This specifies window size and
2591
2677
  // stores precomputed values. Usually only base point would be precomputed.
2592
2678
  createCache(e, s) {
2593
- hs(s, this.bits), fs.set(e, s), Je.delete(e);
2679
+ fs(s, this.bits), ps.set(e, s), Je.delete(e);
2594
2680
  }
2595
2681
  hasCache(e) {
2596
2682
  return Qe(e) !== 1;
2597
2683
  }
2598
2684
  }
2599
- function Pr(r, e, s, t) {
2685
+ function $r(r, e, s, t) {
2600
2686
  let n = e, o = r.ZERO, i = r.ZERO;
2601
2687
  for (; s > Ae || t > Ae; )
2602
2688
  s & be && (o = o.add(n)), t & be && (i = i.add(n)), n = n.double(), s >>= be, t >>= be;
@@ -2606,11 +2692,11 @@ function Mt(r, e, s) {
2606
2692
  if (e) {
2607
2693
  if (e.ORDER !== r)
2608
2694
  throw new Error("Field.ORDER must match order: Fp == p, Fn == n");
2609
- return Ar(e), e;
2695
+ return Cr(e), e;
2610
2696
  } else
2611
2697
  return Ve(r, { isLE: s });
2612
2698
  }
2613
- function Lr(r, e, s = {}, t) {
2699
+ function Mr(r, e, s = {}, t) {
2614
2700
  if (t === void 0 && (t = r === "edwards"), !e || typeof e != "object")
2615
2701
  throw new Error(`expected valid ${r} CURVE object`);
2616
2702
  for (const c of ["p", "n", "h"]) {
@@ -2624,13 +2710,13 @@ function Lr(r, e, s = {}, t) {
2624
2710
  throw new Error(`CURVE.${c} must be valid field element of CURVE.Fp`);
2625
2711
  return e = Object.freeze(Object.assign({}, e)), { CURVE: e, Fp: n, Fn: o };
2626
2712
  }
2627
- function Dr(r, e) {
2713
+ function Br(r, e) {
2628
2714
  return function(t) {
2629
2715
  const n = r(t);
2630
2716
  return { secretKey: n, publicKey: e(n) };
2631
2717
  };
2632
2718
  }
2633
- class ps {
2719
+ class gs {
2634
2720
  constructor(e, s) {
2635
2721
  v(this, "oHash");
2636
2722
  v(this, "iHash");
@@ -2638,7 +2724,7 @@ class ps {
2638
2724
  v(this, "outputLen");
2639
2725
  v(this, "finished", !1);
2640
2726
  v(this, "destroyed", !1);
2641
- if (Kt(e), H(s, void 0, "key"), this.iHash = e.create(), typeof this.iHash.update != "function")
2727
+ if (zt(e), H(s, void 0, "key"), this.iHash = e.create(), typeof this.iHash.update != "function")
2642
2728
  throw new Error("Expected instance of class which extends utils.Hash");
2643
2729
  this.blockLen = this.iHash.blockLen, this.outputLen = this.iHash.outputLen;
2644
2730
  const t = this.blockLen, n = new Uint8Array(t);
@@ -2648,13 +2734,13 @@ class ps {
2648
2734
  this.iHash.update(n), this.oHash = e.create();
2649
2735
  for (let o = 0; o < n.length; o++)
2650
2736
  n[o] ^= 106;
2651
- this.oHash.update(n), Te(n);
2737
+ this.oHash.update(n), Ie(n);
2652
2738
  }
2653
2739
  update(e) {
2654
- return Ie(this), this.iHash.update(e), this;
2740
+ return Te(this), this.iHash.update(e), this;
2655
2741
  }
2656
2742
  digestInto(e) {
2657
- Ie(this), H(e, this.outputLen, "output"), this.finished = !0, this.iHash.digestInto(e), this.oHash.update(e), this.oHash.digestInto(e), this.destroy();
2743
+ Te(this), H(e, this.outputLen, "output"), this.finished = !0, this.iHash.digestInto(e), this.oHash.update(e), this.oHash.digestInto(e), this.destroy();
2658
2744
  }
2659
2745
  digest() {
2660
2746
  const e = new Uint8Array(this.oHash.outputLen);
@@ -2672,16 +2758,16 @@ class ps {
2672
2758
  this.destroyed = !0, this.oHash.destroy(), this.iHash.destroy();
2673
2759
  }
2674
2760
  }
2675
- const gs = (r, e, s) => new ps(r, e).update(s).digest();
2676
- gs.create = (r, e) => new ps(r, e);
2761
+ const _s = (r, e, s) => new gs(r, e).update(s).digest();
2762
+ _s.create = (r, e) => new gs(r, e);
2677
2763
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
2678
- const Bt = (r, e) => (r + (r >= 0 ? e : -e) / _s) / e;
2679
- function $r(r, e, s) {
2764
+ const Bt = (r, e) => (r + (r >= 0 ? e : -e) / xs) / e;
2765
+ function Fr(r, e, s) {
2680
2766
  const [[t, n], [o, i]] = e, a = Bt(i * r, s), c = Bt(-n * r, s);
2681
2767
  let l = r - a * t - c * o, d = -a * n - c * i;
2682
2768
  const f = l < le, w = d < le;
2683
2769
  f && (l = -l), w && (d = -d);
2684
- const _ = dt(Math.ceil(wr(s) / 2)) + Ee;
2770
+ const _ = dt(Math.ceil(vr(s) / 2)) + Ee;
2685
2771
  if (l < le || l >= _ || d < le || d >= _)
2686
2772
  throw new Error("splitScalar (endomorphism): failed, k=" + r);
2687
2773
  return { k1neg: f, k1: l, k2neg: w, k2: d };
@@ -2697,14 +2783,14 @@ function et(r, e) {
2697
2783
  s[t] = r[t] === void 0 ? e[t] : r[t];
2698
2784
  return He(s.lowS, "lowS"), He(s.prehash, "prehash"), s.format !== void 0 && nt(s.format), s;
2699
2785
  }
2700
- class Mr extends Error {
2786
+ class Ur extends Error {
2701
2787
  constructor(e = "") {
2702
2788
  super(e);
2703
2789
  }
2704
2790
  }
2705
2791
  const ge = {
2706
2792
  // asn.1 DER encoding utils
2707
- Err: Mr,
2793
+ Err: Ur,
2708
2794
  // Basic building block is TLV (Tag-Length-Value)
2709
2795
  _tlv: {
2710
2796
  encode: (r, e) => {
@@ -2789,9 +2875,9 @@ const ge = {
2789
2875
  const { _tlv: e, _int: s } = ge, t = e.encode(2, s.encode(r.r)), n = e.encode(2, s.encode(r.s)), o = t + n;
2790
2876
  return e.encode(48, o);
2791
2877
  }
2792
- }, le = BigInt(0), Ee = BigInt(1), _s = BigInt(2), Me = BigInt(3), Br = BigInt(4);
2793
- function Ur(r, e = {}) {
2794
- const s = Lr("weierstrass", r, e), { Fp: t, Fn: n } = s;
2878
+ }, le = BigInt(0), Ee = BigInt(1), xs = BigInt(2), Me = BigInt(3), Hr = BigInt(4);
2879
+ function Gr(r, e = {}) {
2880
+ const s = Mr("weierstrass", r, e), { Fp: t, Fn: n } = s;
2795
2881
  let o = s.CURVE;
2796
2882
  const { h: i, n: a } = o;
2797
2883
  ut(e, {}, {
@@ -2805,7 +2891,7 @@ function Ur(r, e = {}) {
2805
2891
  const { endo: c } = e;
2806
2892
  if (c && (!t.is0(o.a) || typeof c.beta != "bigint" || !Array.isArray(c.basises)))
2807
2893
  throw new Error('invalid endo: expected "beta": bigint and "basises": array');
2808
- const l = ms(t, n);
2894
+ const l = ws(t, n);
2809
2895
  function d() {
2810
2896
  if (!t.isOdd)
2811
2897
  throw new Error("compression is not supported: Field does not have .isOdd()");
@@ -2814,8 +2900,8 @@ function Ur(r, e = {}) {
2814
2900
  const { x: b, y: E } = u.toAffine(), R = t.toBytes(b);
2815
2901
  if (He(h, "isCompressed"), h) {
2816
2902
  d();
2817
- const T = !t.isOdd(E);
2818
- return _e(xs(T), R);
2903
+ const I = !t.isOdd(E);
2904
+ return _e(ms(I), R);
2819
2905
  } else
2820
2906
  return _e(Uint8Array.of(4), R, t.toBytes(E));
2821
2907
  }
@@ -2823,22 +2909,22 @@ function Ur(r, e = {}) {
2823
2909
  H(P, void 0, "Point");
2824
2910
  const { publicKey: u, publicKeyUncompressed: h } = l, b = P.length, E = P[0], R = P.subarray(1);
2825
2911
  if (b === u && (E === 2 || E === 3)) {
2826
- const T = t.fromBytes(R);
2827
- if (!t.isValid(T))
2912
+ const I = t.fromBytes(R);
2913
+ if (!t.isValid(I))
2828
2914
  throw new Error("bad point: is not on curve, wrong x");
2829
- const O = A(T);
2915
+ const O = A(I);
2830
2916
  let S;
2831
2917
  try {
2832
2918
  S = t.sqrt(O);
2833
2919
  } catch (W) {
2834
- const F = W instanceof Error ? ": " + W.message : "";
2835
- throw new Error("bad point: is not on curve, sqrt error" + F);
2920
+ const U = W instanceof Error ? ": " + W.message : "";
2921
+ throw new Error("bad point: is not on curve, sqrt error" + U);
2836
2922
  }
2837
2923
  d();
2838
2924
  const C = t.isOdd(S);
2839
- return (E & 1) === 1 !== C && (S = t.neg(S)), { x: T, y: S };
2925
+ return (E & 1) === 1 !== C && (S = t.neg(S)), { x: I, y: S };
2840
2926
  } else if (b === h && E === 4) {
2841
- const T = t.BYTES, O = t.fromBytes(R.subarray(0, T)), S = t.fromBytes(R.subarray(T, T * 2));
2927
+ const I = t.BYTES, O = t.fromBytes(R.subarray(0, I)), S = t.fromBytes(R.subarray(I, I * 2));
2842
2928
  if (!y(O, S))
2843
2929
  throw new Error("bad point: is not on curve");
2844
2930
  return { x: O, y: S };
@@ -2856,10 +2942,10 @@ function Ur(r, e = {}) {
2856
2942
  }
2857
2943
  if (!y(o.Gx, o.Gy))
2858
2944
  throw new Error("bad curve params: generator point");
2859
- const I = t.mul(t.pow(o.a, Me), Br), L = t.mul(t.sqr(o.b), BigInt(27));
2860
- if (t.is0(t.add(I, L)))
2945
+ const T = t.mul(t.pow(o.a, Me), Hr), L = t.mul(t.sqr(o.b), BigInt(27));
2946
+ if (t.is0(t.add(T, L)))
2861
2947
  throw new Error("bad curve params: a or b");
2862
- function U(P, u, h = !1) {
2948
+ function F(P, u, h = !1) {
2863
2949
  if (!t.isValid(u) || h && t.is0(u))
2864
2950
  throw new Error(`bad point coordinate ${P}`);
2865
2951
  return u;
@@ -2871,7 +2957,7 @@ function Ur(r, e = {}) {
2871
2957
  function B(P) {
2872
2958
  if (!c || !c.basises)
2873
2959
  throw new Error("no endo");
2874
- return $r(P, c.basises, n.ORDER);
2960
+ return Fr(P, c.basises, n.ORDER);
2875
2961
  }
2876
2962
  const Q = kt((P, u) => {
2877
2963
  const { X: h, Y: b, Z: E } = P;
@@ -2879,12 +2965,12 @@ function Ur(r, e = {}) {
2879
2965
  return { x: h, y: b };
2880
2966
  const R = P.is0();
2881
2967
  u == null && (u = R ? t.ONE : t.inv(E));
2882
- const T = t.mul(h, u), O = t.mul(b, u), S = t.mul(E, u);
2968
+ const I = t.mul(h, u), O = t.mul(b, u), S = t.mul(E, u);
2883
2969
  if (R)
2884
2970
  return { x: t.ZERO, y: t.ZERO };
2885
2971
  if (!t.eql(S, t.ONE))
2886
2972
  throw new Error("invZ was invalid");
2887
- return { x: T, y: O };
2973
+ return { x: I, y: O };
2888
2974
  }), ve = kt((P) => {
2889
2975
  if (P.is0()) {
2890
2976
  if (e.allowInfinityPoint && !t.is0(P.Y))
@@ -2909,7 +2995,7 @@ function Ur(r, e = {}) {
2909
2995
  v(this, "X");
2910
2996
  v(this, "Y");
2911
2997
  v(this, "Z");
2912
- this.X = U("x", u), this.Y = U("y", h, !0), this.Z = U("z", b), Object.freeze(this);
2998
+ this.X = F("x", u), this.Y = F("y", h, !0), this.Z = F("z", b), Object.freeze(this);
2913
2999
  }
2914
3000
  static CURVE() {
2915
3001
  return o;
@@ -2928,7 +3014,7 @@ function Ur(r, e = {}) {
2928
3014
  return h.assertValidity(), h;
2929
3015
  }
2930
3016
  static fromHex(u) {
2931
- return D.fromBytes(Fe(u));
3017
+ return D.fromBytes(Ue(u));
2932
3018
  }
2933
3019
  get x() {
2934
3020
  return this.toAffine().x;
@@ -2959,7 +3045,7 @@ function Ur(r, e = {}) {
2959
3045
  /** Compare one point to another. */
2960
3046
  equals(u) {
2961
3047
  $(u);
2962
- const { X: h, Y: b, Z: E } = this, { X: R, Y: T, Z: O } = u, S = t.eql(t.mul(h, O), t.mul(R, E)), C = t.eql(t.mul(b, O), t.mul(T, E));
3048
+ const { X: h, Y: b, Z: E } = this, { X: R, Y: I, Z: O } = u, S = t.eql(t.mul(h, O), t.mul(R, E)), C = t.eql(t.mul(b, O), t.mul(I, E));
2963
3049
  return S && C;
2964
3050
  }
2965
3051
  /** Flips point to one corresponding to (x, -y) in Affine coordinates. */
@@ -2971,9 +3057,9 @@ function Ur(r, e = {}) {
2971
3057
  // https://eprint.iacr.org/2015/1060, algorithm 3
2972
3058
  // Cost: 8M + 3S + 3*a + 2*b3 + 15add.
2973
3059
  double() {
2974
- const { a: u, b: h } = o, b = t.mul(h, Me), { X: E, Y: R, Z: T } = this;
2975
- let O = t.ZERO, S = t.ZERO, C = t.ZERO, N = t.mul(E, E), W = t.mul(R, R), F = t.mul(T, T), k = t.mul(E, R);
2976
- return k = t.add(k, k), C = t.mul(E, T), C = t.add(C, C), O = t.mul(u, C), S = t.mul(b, F), S = t.add(O, S), O = t.sub(W, S), S = t.add(W, S), S = t.mul(O, S), O = t.mul(k, O), C = t.mul(b, C), F = t.mul(u, F), k = t.sub(N, F), k = t.mul(u, k), k = t.add(k, C), C = t.add(N, N), N = t.add(C, N), N = t.add(N, F), N = t.mul(N, k), S = t.add(S, N), F = t.mul(R, T), F = t.add(F, F), N = t.mul(F, k), O = t.sub(O, N), C = t.mul(F, W), C = t.add(C, C), C = t.add(C, C), new D(O, S, C);
3060
+ const { a: u, b: h } = o, b = t.mul(h, Me), { X: E, Y: R, Z: I } = this;
3061
+ let O = t.ZERO, S = t.ZERO, C = t.ZERO, N = t.mul(E, E), W = t.mul(R, R), U = t.mul(I, I), k = t.mul(E, R);
3062
+ return k = t.add(k, k), C = t.mul(E, I), C = t.add(C, C), O = t.mul(u, C), S = t.mul(b, U), S = t.add(O, S), O = t.sub(W, S), S = t.add(W, S), S = t.mul(O, S), O = t.mul(k, O), C = t.mul(b, C), U = t.mul(u, U), k = t.sub(N, U), k = t.mul(u, k), k = t.add(k, C), C = t.add(N, N), N = t.add(C, N), N = t.add(N, U), N = t.mul(N, k), S = t.add(S, N), U = t.mul(R, I), U = t.add(U, U), N = t.mul(U, k), O = t.sub(O, N), C = t.mul(U, W), C = t.add(C, C), C = t.add(C, C), new D(O, S, C);
2977
3063
  }
2978
3064
  // Renes-Costello-Batina exception-free addition formula.
2979
3065
  // There is 30% faster Jacobian formula, but it is not complete.
@@ -2981,13 +3067,13 @@ function Ur(r, e = {}) {
2981
3067
  // Cost: 12M + 0S + 3*a + 3*b3 + 23add.
2982
3068
  add(u) {
2983
3069
  $(u);
2984
- const { X: h, Y: b, Z: E } = this, { X: R, Y: T, Z: O } = u;
3070
+ const { X: h, Y: b, Z: E } = this, { X: R, Y: I, Z: O } = u;
2985
3071
  let S = t.ZERO, C = t.ZERO, N = t.ZERO;
2986
- const W = o.a, F = t.mul(o.b, Me);
2987
- let k = t.mul(h, R), j = t.mul(b, T), V = t.mul(E, O), ee = t.add(h, b), G = t.add(R, T);
3072
+ const W = o.a, U = t.mul(o.b, Me);
3073
+ let k = t.mul(h, R), j = t.mul(b, I), V = t.mul(E, O), ee = t.add(h, b), G = t.add(R, I);
2988
3074
  ee = t.mul(ee, G), G = t.add(k, j), ee = t.sub(ee, G), G = t.add(h, E);
2989
3075
  let K = t.add(R, O);
2990
- return G = t.mul(G, K), K = t.add(k, V), G = t.sub(G, K), K = t.add(b, E), S = t.add(T, O), K = t.mul(K, S), S = t.add(j, V), K = t.sub(K, S), N = t.mul(W, G), S = t.mul(F, V), N = t.add(S, N), S = t.sub(j, N), N = t.add(j, N), C = t.mul(S, N), j = t.add(k, k), j = t.add(j, k), V = t.mul(W, V), G = t.mul(F, G), j = t.add(j, V), V = t.sub(k, V), V = t.mul(W, V), G = t.add(G, V), k = t.mul(j, G), C = t.add(C, k), k = t.mul(K, G), S = t.mul(ee, S), S = t.sub(S, k), k = t.mul(ee, j), N = t.mul(K, N), N = t.add(N, k), new D(S, C, N);
3076
+ return G = t.mul(G, K), K = t.add(k, V), G = t.sub(G, K), K = t.add(b, E), S = t.add(I, O), K = t.mul(K, S), S = t.add(j, V), K = t.sub(K, S), N = t.mul(W, G), S = t.mul(U, V), N = t.add(S, N), S = t.sub(j, N), N = t.add(j, N), C = t.mul(S, N), j = t.add(k, k), j = t.add(j, k), V = t.mul(W, V), G = t.mul(U, G), j = t.add(j, V), V = t.sub(k, V), V = t.mul(W, V), G = t.add(G, V), k = t.mul(j, G), C = t.add(C, k), k = t.mul(K, G), S = t.mul(ee, S), S = t.sub(S, k), k = t.mul(ee, j), N = t.mul(K, N), N = t.add(N, k), new D(S, C, N);
2991
3077
  }
2992
3078
  subtract(u) {
2993
3079
  return this.add(u.negate());
@@ -3009,13 +3095,13 @@ function Ur(r, e = {}) {
3009
3095
  if (!n.isValidNot0(u))
3010
3096
  throw new Error("invalid scalar: out of range");
3011
3097
  let b, E;
3012
- const R = (T) => ne.cached(this, T, (O) => Lt(D, O));
3098
+ const R = (I) => ne.cached(this, I, (O) => Lt(D, O));
3013
3099
  if (h) {
3014
- const { k1neg: T, k1: O, k2neg: S, k2: C } = B(u), { p: N, f: W } = R(O), { p: F, f: k } = R(C);
3015
- E = W.add(k), b = he(h.beta, N, F, T, S);
3100
+ const { k1neg: I, k1: O, k2neg: S, k2: C } = B(u), { p: N, f: W } = R(O), { p: U, f: k } = R(C);
3101
+ E = W.add(k), b = he(h.beta, N, U, I, S);
3016
3102
  } else {
3017
- const { p: T, f: O } = R(u);
3018
- b = T, E = O;
3103
+ const { p: I, f: O } = R(u);
3104
+ b = I, E = O;
3019
3105
  }
3020
3106
  return Lt(D, [b, E])[0];
3021
3107
  }
@@ -3035,8 +3121,8 @@ function Ur(r, e = {}) {
3035
3121
  if (ne.hasCache(this))
3036
3122
  return this.multiply(u);
3037
3123
  if (h) {
3038
- const { k1neg: E, k1: R, k2neg: T, k2: O } = B(u), { p1: S, p2: C } = Pr(D, b, R, O);
3039
- return he(h.beta, S, C, E, T);
3124
+ const { k1neg: E, k1: R, k2neg: I, k2: O } = B(u), { p1: S, p2: C } = $r(D, b, R, O);
3125
+ return he(h.beta, S, C, E, I);
3040
3126
  } else
3041
3127
  return ne.unsafe(b, u);
3042
3128
  }
@@ -3079,13 +3165,13 @@ function Ur(r, e = {}) {
3079
3165
  v(D, "Fp", t), // scalar field
3080
3166
  v(D, "Fn", n);
3081
3167
  let Z = D;
3082
- const xe = n.BITS, ne = new Nr(Z, e.endo ? Math.ceil(xe / 2) : xe);
3168
+ const xe = n.BITS, ne = new Dr(Z, e.endo ? Math.ceil(xe / 2) : xe);
3083
3169
  return Z.BASE.precompute(8), Z;
3084
3170
  }
3085
- function xs(r) {
3171
+ function ms(r) {
3086
3172
  return Uint8Array.of(r ? 2 : 3);
3087
3173
  }
3088
- function ms(r, e) {
3174
+ function ws(r, e) {
3089
3175
  return {
3090
3176
  secretKey: e.BYTES,
3091
3177
  publicKey: 1 + r.BYTES,
@@ -3094,8 +3180,8 @@ function ms(r, e) {
3094
3180
  signature: 2 * e.BYTES
3095
3181
  };
3096
3182
  }
3097
- function Fr(r, e = {}) {
3098
- const { Fn: s } = r, t = e.randomBytes || Xt, n = Object.assign(ms(r.Fp, s), { seed: us(s.ORDER) });
3183
+ function qr(r, e = {}) {
3184
+ const { Fn: s } = r, t = e.randomBytes || Jt, n = Object.assign(ws(r.Fp, s), { seed: hs(s.ORDER) });
3099
3185
  function o(_) {
3100
3186
  try {
3101
3187
  const m = s.fromBytes(_);
@@ -3107,14 +3193,14 @@ function Fr(r, e = {}) {
3107
3193
  function i(_, m) {
3108
3194
  const { publicKey: A, publicKeyUncompressed: y } = n;
3109
3195
  try {
3110
- const I = _.length;
3111
- return m === !0 && I !== A || m === !1 && I !== y ? !1 : !!r.fromBytes(_);
3196
+ const T = _.length;
3197
+ return m === !0 && T !== A || m === !1 && T !== y ? !1 : !!r.fromBytes(_);
3112
3198
  } catch {
3113
3199
  return !1;
3114
3200
  }
3115
3201
  }
3116
3202
  function a(_ = t(n.seed)) {
3117
- return kr(H(_, n.seed, "seed"), s.ORDER);
3203
+ return Lr(H(_, n.seed, "seed"), s.ORDER);
3118
3204
  }
3119
3205
  function c(_, m = !0) {
3120
3206
  return r.BASE.multiply(s.fromBytes(_)).toBytes(m);
@@ -3123,8 +3209,8 @@ function Fr(r, e = {}) {
3123
3209
  const { secretKey: m, publicKey: A, publicKeyUncompressed: y } = n;
3124
3210
  if (!at(_) || "_lengths" in s && s._lengths || m === A)
3125
3211
  return;
3126
- const I = H(_, void 0, "key").length;
3127
- return I === A || I === y;
3212
+ const T = H(_, void 0, "key").length;
3213
+ return T === A || T === y;
3128
3214
  }
3129
3215
  function d(_, m, A = !0) {
3130
3216
  if (l(_) === !0)
@@ -3138,28 +3224,28 @@ function Fr(r, e = {}) {
3138
3224
  isValidSecretKey: o,
3139
3225
  isValidPublicKey: i,
3140
3226
  randomSecretKey: a
3141
- }, w = Dr(a, c);
3227
+ }, w = Br(a, c);
3142
3228
  return Object.freeze({ getPublicKey: c, getSharedSecret: d, keygen: w, Point: r, utils: f, lengths: n });
3143
3229
  }
3144
- function Hr(r, e, s = {}) {
3145
- Kt(e), ut(s, {}, {
3230
+ function Wr(r, e, s = {}) {
3231
+ zt(e), ut(s, {}, {
3146
3232
  hmac: "function",
3147
3233
  lowS: "boolean",
3148
3234
  randomBytes: "function",
3149
3235
  bits2int: "function",
3150
3236
  bits2int_modN: "function"
3151
3237
  }), s = Object.assign({}, s);
3152
- const t = s.randomBytes || Xt, n = s.hmac || ((u, h) => gs(e, u, h)), { Fp: o, Fn: i } = r, { ORDER: a, BITS: c } = i, { keygen: l, getPublicKey: d, getSharedSecret: f, utils: w, lengths: _ } = Fr(r, s), m = {
3238
+ const t = s.randomBytes || Jt, n = s.hmac || ((u, h) => _s(e, u, h)), { Fp: o, Fn: i } = r, { ORDER: a, BITS: c } = i, { keygen: l, getPublicKey: d, getSharedSecret: f, utils: w, lengths: _ } = qr(r, s), m = {
3153
3239
  prehash: !0,
3154
3240
  lowS: typeof s.lowS == "boolean" ? s.lowS : !0,
3155
3241
  format: "compact",
3156
3242
  extraEntropy: !1
3157
- }, A = a * _s < o.ORDER;
3243
+ }, A = a * xs < o.ORDER;
3158
3244
  function y(u) {
3159
3245
  const h = a >> Ee;
3160
3246
  return u > h;
3161
3247
  }
3162
- function I(u, h) {
3248
+ function T(u, h) {
3163
3249
  if (!i.isValidNot0(h))
3164
3250
  throw new Error(`invalid signature ${u}: out of range 1..Point.Fn.ORDER`);
3165
3251
  return h;
@@ -3168,7 +3254,7 @@ function Hr(r, e, s = {}) {
3168
3254
  if (A)
3169
3255
  throw new Error('"recovered" sig type is not supported for cofactor >2 curves');
3170
3256
  }
3171
- function U(u, h) {
3257
+ function F(u, h) {
3172
3258
  nt(h);
3173
3259
  const b = _.signature, E = h === "compact" ? b : h === "recovered" ? b + 1 : void 0;
3174
3260
  return H(u, E);
@@ -3178,7 +3264,7 @@ function Hr(r, e, s = {}) {
3178
3264
  v(this, "r");
3179
3265
  v(this, "s");
3180
3266
  v(this, "recovery");
3181
- if (this.r = I("r", h), this.s = I("s", b), E != null) {
3267
+ if (this.r = T("r", h), this.s = T("s", b), E != null) {
3182
3268
  if (L(), ![0, 1, 2, 3].includes(E))
3183
3269
  throw new Error("invalid recovery id");
3184
3270
  this.recovery = E;
@@ -3186,18 +3272,18 @@ function Hr(r, e, s = {}) {
3186
3272
  Object.freeze(this);
3187
3273
  }
3188
3274
  static fromBytes(h, b = m.format) {
3189
- U(h, b);
3275
+ F(h, b);
3190
3276
  let E;
3191
3277
  if (b === "der") {
3192
3278
  const { r: S, s: C } = ge.toSig(H(h));
3193
3279
  return new $(S, C);
3194
3280
  }
3195
3281
  b === "recovered" && (E = h[0], b = "compact", h = h.subarray(1));
3196
- const R = _.signature / 2, T = h.subarray(0, R), O = h.subarray(R, R * 2);
3197
- return new $(i.fromBytes(T), i.fromBytes(O), E);
3282
+ const R = _.signature / 2, I = h.subarray(0, R), O = h.subarray(R, R * 2);
3283
+ return new $(i.fromBytes(I), i.fromBytes(O), E);
3198
3284
  }
3199
3285
  static fromHex(h, b) {
3200
- return this.fromBytes(Fe(h), b);
3286
+ return this.fromBytes(Ue(h), b);
3201
3287
  }
3202
3288
  assertRecovery() {
3203
3289
  const { recovery: h } = this;
@@ -3209,10 +3295,10 @@ function Hr(r, e, s = {}) {
3209
3295
  return new $(this.r, this.s, h);
3210
3296
  }
3211
3297
  recoverPublicKey(h) {
3212
- const { r: b, s: E } = this, R = this.assertRecovery(), T = R === 2 || R === 3 ? b + a : b;
3213
- if (!o.isValid(T))
3298
+ const { r: b, s: E } = this, R = this.assertRecovery(), I = R === 2 || R === 3 ? b + a : b;
3299
+ if (!o.isValid(I))
3214
3300
  throw new Error("invalid recovery id: sig.r+curve.n != R.x");
3215
- const O = o.toBytes(T), S = r.fromBytes(_e(xs((R & 1) === 0), O)), C = i.inv(T), N = Q(H(h, void 0, "msgHash")), W = i.create(-N * C), F = i.create(E * C), k = r.BASE.multiplyUnsafe(W).add(S.multiplyUnsafe(F));
3301
+ const O = o.toBytes(I), S = r.fromBytes(_e(ms((R & 1) === 0), O)), C = i.inv(I), N = Q(H(h, void 0, "msgHash")), W = i.create(-N * C), U = i.create(E * C), k = r.BASE.multiplyUnsafe(W).add(S.multiplyUnsafe(U));
3216
3302
  if (k.is0())
3217
3303
  throw new Error("invalid recovery: point at infinify");
3218
3304
  return k.assertValidity(), k;
@@ -3223,9 +3309,9 @@ function Hr(r, e, s = {}) {
3223
3309
  }
3224
3310
  toBytes(h = m.format) {
3225
3311
  if (nt(h), h === "der")
3226
- return Fe(ge.hexFromSig(this));
3227
- const { r: b, s: E } = this, R = i.toBytes(b), T = i.toBytes(E);
3228
- return h === "recovered" ? (L(), _e(Uint8Array.of(this.assertRecovery()), R, T)) : _e(R, T);
3312
+ return Ue(ge.hexFromSig(this));
3313
+ const { r: b, s: E } = this, R = i.toBytes(b), I = i.toBytes(E);
3314
+ return h === "recovered" ? (L(), _e(Uint8Array.of(this.assertRecovery()), R, I)) : _e(R, I);
3229
3315
  }
3230
3316
  toHex(h) {
3231
3317
  return ke(this.toBytes(h));
@@ -3240,24 +3326,24 @@ function Hr(r, e, s = {}) {
3240
3326
  return i.create(B(h));
3241
3327
  }, ve = dt(c);
3242
3328
  function he(u) {
3243
- return mr("num < 2^" + c, u, le, ve), i.toBytes(u);
3329
+ return br("num < 2^" + c, u, le, ve), i.toBytes(u);
3244
3330
  }
3245
3331
  function Z(u, h) {
3246
3332
  return H(u, void 0, "message"), h ? H(e(u), void 0, "prehashed message") : u;
3247
3333
  }
3248
3334
  function xe(u, h, b) {
3249
- const { lowS: E, prehash: R, extraEntropy: T } = et(b, m);
3335
+ const { lowS: E, prehash: R, extraEntropy: I } = et(b, m);
3250
3336
  u = Z(u, R);
3251
3337
  const O = Q(u), S = i.fromBytes(h);
3252
3338
  if (!i.isValidNot0(S))
3253
3339
  throw new Error("invalid private key");
3254
3340
  const C = [he(S), he(O)];
3255
- if (T != null && T !== !1) {
3256
- const k = T === !0 ? t(_.secretKey) : T;
3341
+ if (I != null && I !== !1) {
3342
+ const k = I === !0 ? t(_.secretKey) : I;
3257
3343
  C.push(H(k, void 0, "extraEntropy"));
3258
3344
  }
3259
3345
  const N = _e(...C), W = O;
3260
- function F(k) {
3346
+ function U(k) {
3261
3347
  const j = B(k);
3262
3348
  if (!i.isValidNot0(j))
3263
3349
  return;
@@ -3270,24 +3356,24 @@ function Hr(r, e, s = {}) {
3270
3356
  let xt = (ee.x === G ? 0 : 2) | Number(ee.y & Ee), mt = K;
3271
3357
  return E && y(K) && (mt = i.neg(K), xt ^= 1), new $(G, mt, A ? void 0 : xt);
3272
3358
  }
3273
- return { seed: N, k2sig: F };
3359
+ return { seed: N, k2sig: U };
3274
3360
  }
3275
3361
  function ne(u, h, b = {}) {
3276
3362
  const { seed: E, k2sig: R } = xe(u, h, b);
3277
- return yr(e.outputLen, i.BYTES, n)(E, R).toBytes(b.format);
3363
+ return Sr(e.outputLen, i.BYTES, n)(E, R).toBytes(b.format);
3278
3364
  }
3279
3365
  function D(u, h, b, E = {}) {
3280
- const { lowS: R, prehash: T, format: O } = et(E, m);
3281
- if (b = H(b, void 0, "publicKey"), h = Z(h, T), !at(u)) {
3366
+ const { lowS: R, prehash: I, format: O } = et(E, m);
3367
+ if (b = H(b, void 0, "publicKey"), h = Z(h, I), !at(u)) {
3282
3368
  const S = u instanceof $ ? ", use sig.toBytes()" : "";
3283
3369
  throw new Error("verify expects Uint8Array signature" + S);
3284
3370
  }
3285
- U(u, O);
3371
+ F(u, O);
3286
3372
  try {
3287
3373
  const S = $.fromBytes(u, O), C = r.fromBytes(b);
3288
3374
  if (R && S.hasHighS())
3289
3375
  return !1;
3290
- const { r: N, s: W } = S, F = Q(h), k = i.inv(W), j = i.create(F * k), V = i.create(N * k), ee = r.BASE.multiplyUnsafe(j).add(C.multiplyUnsafe(V));
3376
+ const { r: N, s: W } = S, U = Q(h), k = i.inv(W), j = i.create(U * k), V = i.create(N * k), ee = r.BASE.multiplyUnsafe(j).add(C.multiplyUnsafe(V));
3291
3377
  return ee.is0() ? !1 : i.create(ee.x) === N;
3292
3378
  } catch {
3293
3379
  return !1;
@@ -3320,44 +3406,44 @@ const ft = {
3320
3406
  b: BigInt(7),
3321
3407
  Gx: BigInt("0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),
3322
3408
  Gy: BigInt("0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")
3323
- }, Gr = {
3409
+ }, jr = {
3324
3410
  beta: BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),
3325
3411
  basises: [
3326
3412
  [BigInt("0x3086d221a7d46bcde86c90e49284eb15"), -BigInt("0xe4437ed6010e88286f547fa90abfe4c3")],
3327
3413
  [BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"), BigInt("0x3086d221a7d46bcde86c90e49284eb15")]
3328
3414
  ]
3329
- }, Ut = /* @__PURE__ */ BigInt(2);
3330
- function qr(r) {
3331
- const e = ft.p, s = BigInt(3), t = BigInt(6), n = BigInt(11), o = BigInt(22), i = BigInt(23), a = BigInt(44), c = BigInt(88), l = r * r * r % e, d = l * l * r % e, f = se(d, s, e) * d % e, w = se(f, s, e) * d % e, _ = se(w, Ut, e) * l % e, m = se(_, n, e) * _ % e, A = se(m, o, e) * m % e, y = se(A, a, e) * A % e, I = se(y, c, e) * y % e, L = se(I, a, e) * A % e, U = se(L, s, e) * d % e, $ = se(U, i, e) * m % e, B = se($, t, e) * l % e, Q = se(B, Ut, e);
3415
+ }, Ft = /* @__PURE__ */ BigInt(2);
3416
+ function Vr(r) {
3417
+ const e = ft.p, s = BigInt(3), t = BigInt(6), n = BigInt(11), o = BigInt(22), i = BigInt(23), a = BigInt(44), c = BigInt(88), l = r * r * r % e, d = l * l * r % e, f = se(d, s, e) * d % e, w = se(f, s, e) * d % e, _ = se(w, Ft, e) * l % e, m = se(_, n, e) * _ % e, A = se(m, o, e) * m % e, y = se(A, a, e) * A % e, T = se(y, c, e) * y % e, L = se(T, a, e) * A % e, F = se(L, s, e) * d % e, $ = se(F, i, e) * m % e, B = se($, t, e) * l % e, Q = se(B, Ft, e);
3332
3418
  if (!ot.eql(ot.sqr(Q), r))
3333
3419
  throw new Error("Cannot find square root");
3334
3420
  return Q;
3335
3421
  }
3336
- const ot = Ve(ft.p, { sqrt: qr }), Wr = /* @__PURE__ */ Ur(ft, {
3422
+ const ot = Ve(ft.p, { sqrt: Vr }), Kr = /* @__PURE__ */ Gr(ft, {
3337
3423
  Fp: ot,
3338
- endo: Gr
3339
- }), jr = /* @__PURE__ */ Hr(Wr, gr), Vr = BigInt(0), Re = BigInt(1), Kr = BigInt(2), zr = BigInt(7), Yr = BigInt(256), Zr = BigInt(113), ws = [], ys = [], bs = [];
3424
+ endo: jr
3425
+ }), zr = /* @__PURE__ */ Wr(Kr, mr), Yr = BigInt(0), Re = BigInt(1), Zr = BigInt(2), Xr = BigInt(7), Jr = BigInt(256), Qr = BigInt(113), ys = [], bs = [], vs = [];
3340
3426
  for (let r = 0, e = Re, s = 1, t = 0; r < 24; r++) {
3341
- [s, t] = [t, (2 * s + 3 * t) % 5], ws.push(2 * (5 * t + s)), ys.push((r + 1) * (r + 2) / 2 % 64);
3342
- let n = Vr;
3427
+ [s, t] = [t, (2 * s + 3 * t) % 5], ys.push(2 * (5 * t + s)), bs.push((r + 1) * (r + 2) / 2 % 64);
3428
+ let n = Yr;
3343
3429
  for (let o = 0; o < 7; o++)
3344
- e = (e << Re ^ (e >> zr) * Zr) % Yr, e & Kr && (n ^= Re << (Re << BigInt(o)) - Re);
3345
- bs.push(n);
3430
+ e = (e << Re ^ (e >> Xr) * Qr) % Jr, e & Zr && (n ^= Re << (Re << BigInt(o)) - Re);
3431
+ vs.push(n);
3346
3432
  }
3347
- const vs = ar(bs, !0), Xr = vs[0], Jr = vs[1], Ft = (r, e, s) => s > 32 ? dr(r, e, s) : cr(r, e, s), Ht = (r, e, s) => s > 32 ? ur(r, e, s) : lr(r, e, s);
3348
- function Qr(r, e = 24) {
3433
+ const Ss = dr(vs, !0), en = Ss[0], tn = Ss[1], Ut = (r, e, s) => s > 32 ? fr(r, e, s) : ur(r, e, s), Ht = (r, e, s) => s > 32 ? pr(r, e, s) : hr(r, e, s);
3434
+ function sn(r, e = 24) {
3349
3435
  const s = new Uint32Array(10);
3350
3436
  for (let t = 24 - e; t < 24; t++) {
3351
3437
  for (let i = 0; i < 10; i++)
3352
3438
  s[i] = r[i] ^ r[i + 10] ^ r[i + 20] ^ r[i + 30] ^ r[i + 40];
3353
3439
  for (let i = 0; i < 10; i += 2) {
3354
- const a = (i + 8) % 10, c = (i + 2) % 10, l = s[c], d = s[c + 1], f = Ft(l, d, 1) ^ s[a], w = Ht(l, d, 1) ^ s[a + 1];
3440
+ const a = (i + 8) % 10, c = (i + 2) % 10, l = s[c], d = s[c + 1], f = Ut(l, d, 1) ^ s[a], w = Ht(l, d, 1) ^ s[a + 1];
3355
3441
  for (let _ = 0; _ < 50; _ += 10)
3356
3442
  r[i + _] ^= f, r[i + _ + 1] ^= w;
3357
3443
  }
3358
3444
  let n = r[2], o = r[3];
3359
3445
  for (let i = 0; i < 24; i++) {
3360
- const a = ys[i], c = Ft(n, o, a), l = Ht(n, o, a), d = ws[i];
3446
+ const a = bs[i], c = Ut(n, o, a), l = Ht(n, o, a), d = ys[i];
3361
3447
  n = r[d], o = r[d + 1], r[d] = c, r[d + 1] = l;
3362
3448
  }
3363
3449
  for (let i = 0; i < 50; i += 10) {
@@ -3366,9 +3452,9 @@ function Qr(r, e = 24) {
3366
3452
  for (let a = 0; a < 10; a++)
3367
3453
  r[i + a] ^= ~s[(a + 2) % 10] & s[(a + 4) % 10];
3368
3454
  }
3369
- r[0] ^= Xr[t], r[1] ^= Jr[t];
3455
+ r[0] ^= en[t], r[1] ^= tn[t];
3370
3456
  }
3371
- Te(s);
3457
+ Ie(s);
3372
3458
  }
3373
3459
  class pt {
3374
3460
  // NOTE: we accept arguments in bytes instead of bits here.
@@ -3386,16 +3472,16 @@ class pt {
3386
3472
  v(this, "rounds");
3387
3473
  if (this.blockLen = e, this.suffix = s, this.outputLen = t, this.enableXOF = n, this.rounds = o, ue(t, "outputLen"), !(0 < e && e < 200))
3388
3474
  throw new Error("only keccak-f1600 function is supported");
3389
- this.state = new Uint8Array(200), this.state32 = Xs(this.state);
3475
+ this.state = new Uint8Array(200), this.state32 = er(this.state);
3390
3476
  }
3391
3477
  clone() {
3392
3478
  return this._cloneInto();
3393
3479
  }
3394
3480
  keccak() {
3395
- Rt(this.state32), Qr(this.state32, this.rounds), Rt(this.state32), this.posOut = 0, this.pos = 0;
3481
+ Rt(this.state32), sn(this.state32, this.rounds), Rt(this.state32), this.posOut = 0, this.pos = 0;
3396
3482
  }
3397
3483
  update(e) {
3398
- Ie(this), H(e);
3484
+ Te(this), H(e);
3399
3485
  const { blockLen: s, state: t } = this, n = e.length;
3400
3486
  for (let o = 0; o < n; ) {
3401
3487
  const i = Math.min(s - this.pos, n - o);
@@ -3413,7 +3499,7 @@ class pt {
3413
3499
  e[t] ^= s, s & 128 && t === n - 1 && this.keccak(), e[n - 1] ^= 128, this.keccak();
3414
3500
  }
3415
3501
  writeInto(e) {
3416
- Ie(this, !1), H(e), this.finish();
3502
+ Te(this, !1), H(e), this.finish();
3417
3503
  const s = this.state, { blockLen: t } = this;
3418
3504
  for (let n = 0, o = e.length; n < o; ) {
3419
3505
  this.posOut >= t && this.keccak();
@@ -3431,7 +3517,7 @@ class pt {
3431
3517
  return ue(e), this.xofInto(new Uint8Array(e));
3432
3518
  }
3433
3519
  digestInto(e) {
3434
- if (zt(e, this), this.finished)
3520
+ if (Yt(e, this), this.finished)
3435
3521
  throw new Error("digest() was already called");
3436
3522
  return this.writeInto(e), this.destroy(), e;
3437
3523
  }
@@ -3439,15 +3525,15 @@ class pt {
3439
3525
  return this.digestInto(new Uint8Array(this.outputLen));
3440
3526
  }
3441
3527
  destroy() {
3442
- this.destroyed = !0, Te(this.state);
3528
+ this.destroyed = !0, Ie(this.state);
3443
3529
  }
3444
3530
  _cloneInto(e) {
3445
3531
  const { blockLen: s, suffix: t, outputLen: n, rounds: o, enableXOF: i } = this;
3446
3532
  return e || (e = new pt(s, t, n, i, o)), e.state32.set(this.state32), e.pos = this.pos, e.posOut = this.posOut, e.finished = this.finished, e.rounds = o, e.suffix = t, e.outputLen = n, e.enableXOF = i, e.destroyed = this.destroyed, e;
3447
3533
  }
3448
3534
  }
3449
- const en = (r, e, s, t = {}) => Zt(() => new pt(e, r, s), t), Gt = /* @__PURE__ */ en(1, 136, 32);
3450
- class tn {
3535
+ const rn = (r, e, s, t = {}) => Xt(() => new pt(e, r, s), t), Gt = /* @__PURE__ */ rn(1, 136, 32);
3536
+ class nn {
3451
3537
  async verifyJWT(e, s) {
3452
3538
  try {
3453
3539
  const t = this.decodeJWT(e);
@@ -3468,7 +3554,7 @@ class tn {
3468
3554
  }
3469
3555
  }
3470
3556
  decodeJWT(e) {
3471
- return As(e);
3557
+ return Rs(e);
3472
3558
  }
3473
3559
  /**
3474
3560
  * EIP-191 personal_sign 서명에서 서명자 Ethereum 주소를 복원합니다.
@@ -3485,15 +3571,15 @@ ${t.length}`
3485
3571
  o.set(n, 0), o.set(t, n.length);
3486
3572
  const i = Gt(o), a = s.startsWith("0x") ? s.slice(2) : s;
3487
3573
  if (a.length !== 130)
3488
- throw new Error(`Invalid signature length: expected 130 hex chars, got ${a.length}`);
3489
- const c = sn(a), l = c.slice(0, 32), d = c.slice(32, 64), f = c[64], w = f >= 27 ? f - 27 : f, A = new jr.Signature(
3574
+ throw new Error(`서명 길이가 유효하지 않습니다: 130 hex 문자 예상, 현재 ${a.length}`);
3575
+ const c = on(a), l = c.slice(0, 32), d = c.slice(32, 64), f = c[64], w = f >= 27 ? f - 27 : f, A = new zr.Signature(
3490
3576
  qt(l),
3491
3577
  qt(d)
3492
3578
  ).addRecoveryBit(w).recoverPublicKey(i).toBytes(!1).slice(1), y = Gt(A);
3493
3579
  return "0x" + ke(y.slice(12));
3494
3580
  }
3495
3581
  }
3496
- function sn(r) {
3582
+ function on(r) {
3497
3583
  const e = new Uint8Array(r.length / 2);
3498
3584
  for (let s = 0; s < e.length; s++)
3499
3585
  e[s] = parseInt(r.substring(s * 2, s * 2 + 2), 16);
@@ -3504,12 +3590,12 @@ function qt(r) {
3504
3590
  for (const s of r) e += s.toString(16).padStart(2, "0");
3505
3591
  return BigInt(e);
3506
3592
  }
3507
- const rn = 3e4;
3508
- class nn {
3593
+ const an = 3e4;
3594
+ class cn {
3509
3595
  async request(e) {
3510
3596
  const s = new AbortController(), t = setTimeout(
3511
3597
  () => s.abort(),
3512
- e.timeoutMs ?? rn
3598
+ e.timeoutMs ?? an
3513
3599
  );
3514
3600
  try {
3515
3601
  const n = await fetch(e.url, {
@@ -3543,7 +3629,7 @@ class gt {
3543
3629
  }
3544
3630
  openAuth(e) {
3545
3631
  return new Promise((s, t) => {
3546
- const n = e.width ?? 500, o = e.height ?? 600, i = window.screenX + (window.outerWidth - n) / 2, a = window.screenY + (window.outerHeight - o) / 2, c = gt.generateState(), l = e.authUrl.includes("?") ? "&" : "?", d = `${e.authUrl}${l}state=${c}`, f = window.open(
3632
+ const n = Math.max(e.width ?? 500, 500), o = Math.max(e.height ?? 700, 700), i = window.screenX + (window.outerWidth - n) / 2, a = window.screenY + (window.outerHeight - o) / 2, c = gt.generateState(), l = e.authUrl.includes("?") ? "&" : "?", d = `${e.authUrl}${l}state=${c}`, f = window.open(
3547
3633
  d,
3548
3634
  "CROSSx OAuth",
3549
3635
  `width=${n},height=${o},left=${i},top=${a}`
@@ -3553,28 +3639,28 @@ class gt {
3553
3639
  return;
3554
3640
  }
3555
3641
  const w = setTimeout(() => {
3556
- p.warn("[CROSSx] OAuth 타임아웃 (5분) — postMessage를 수신하지 못했습니다"), U(), t(new Error("Authentication timeout"));
3642
+ p.warn("[CROSSx] OAuth 타임아웃 (5분) — postMessage를 수신하지 못했습니다"), F(), t(new Error("Authentication timeout"));
3557
3643
  }, 5 * 60 * 1e3), _ = 10, m = 30;
3558
3644
  let A = 0, y = null;
3559
- const I = () => {
3645
+ const T = () => {
3560
3646
  clearInterval(L), p.warn("[CROSSx] COOP 감지 — OAuth 서버 응답을 " + m + "초간 대기합니다"), y = setTimeout(() => {
3561
- U(), t(new Error(
3647
+ F(), t(new Error(
3562
3648
  "OAuth 서버로부터 응답을 받지 못했습니다. 브라우저 보안 정책(COOP)으로 인해 팝업 통신이 차단되었을 수 있습니다. 다시 시도해 주세요."
3563
3649
  ));
3564
3650
  }, m * 1e3);
3565
3651
  }, L = setInterval(() => {
3566
3652
  A++;
3567
3653
  try {
3568
- f.closed && (A <= _ ? I() : (U(), t(new Error("로그인이 취소되었습니다"))));
3654
+ f.closed && (A <= _ ? T() : (F(), t(new Error("로그인이 취소되었습니다"))));
3569
3655
  } catch {
3570
- I();
3656
+ T();
3571
3657
  }
3572
- }, 1e3), U = () => {
3658
+ }, 1e3), F = () => {
3573
3659
  clearTimeout(w), clearInterval(L), y && clearTimeout(y), window.removeEventListener("message", $);
3574
3660
  }, $ = (B) => {
3575
3661
  var ve, he, Z, xe, ne, D, P;
3576
3662
  if (B.origin !== e.expectedOrigin) return;
3577
- U(), p.log("[CROSSx] OAuth postMessage 수신 — status:", B.data.status);
3663
+ F(), p.log("[CROSSx] OAuth postMessage 수신 — status:", B.data.status);
3578
3664
  const Q = B.data.state ?? ((ve = B.data.data) == null ? void 0 : ve.state);
3579
3665
  if (!Q || Q !== c) {
3580
3666
  t(new Error("OAuth state mismatch — possible CSRF attack"));
@@ -3594,7 +3680,7 @@ class gt {
3594
3680
  }
3595
3681
  }
3596
3682
  const Oe = "crossx_wallet_data";
3597
- class on {
3683
+ class ln {
3598
3684
  constructor(e) {
3599
3685
  this.storage = e;
3600
3686
  }
@@ -3610,7 +3696,7 @@ class on {
3610
3696
  };
3611
3697
  return await this.storage.set(Oe, t), t;
3612
3698
  } catch (s) {
3613
- throw new x(g.WALLET_CREATION_FAILED, "Wallet creation failed", s);
3699
+ throw new x(g.WALLET_CREATION_FAILED, "지갑 생성에 실패했습니다", s);
3614
3700
  }
3615
3701
  }
3616
3702
  async getAddresses(e) {
@@ -3684,7 +3770,7 @@ class qe {
3684
3770
  if (!e)
3685
3771
  throw new x(
3686
3772
  g.AUTH_NOT_AUTHENTICATED,
3687
- "No auth token found. Please sign in first."
3773
+ "인증 토큰을 찾을 없습니다. 먼저 로그인해 주세요."
3688
3774
  );
3689
3775
  return e;
3690
3776
  }
@@ -3704,7 +3790,7 @@ class qe {
3704
3790
  })).data;
3705
3791
  if (d && typeof d.code == "number") {
3706
3792
  if (d.code < 0 || d.code >= 400) {
3707
- const f = d.message || d.data || "API request failed";
3793
+ const f = d.message || d.data || "API 요청에 실패했습니다";
3708
3794
  p.error("[CROSSx] Wallet Gateway API 에러 (HTTP 200):", {
3709
3795
  code: d.code,
3710
3796
  message: f,
@@ -3721,7 +3807,7 @@ class qe {
3721
3807
  } catch (l) {
3722
3808
  if (l instanceof x) throw l;
3723
3809
  if ((a = l.response) != null && a.data) {
3724
- const d = l.response.data, f = d.message || d.data || "API request failed", w = d.code || "UNKNOWN";
3810
+ const d = l.response.data, f = d.message || d.data || "API 요청에 실패했습니다", w = d.code || "UNKNOWN";
3725
3811
  throw p.error("[CROSSx] Wallet Gateway API 에러 (HTTP 에러):", {
3726
3812
  code: w,
3727
3813
  message: f,
@@ -3730,7 +3816,7 @@ class qe {
3730
3816
  status: (c = l.response) == null ? void 0 : c.status
3731
3817
  }), new x(
3732
3818
  g.UNKNOWN_ERROR,
3733
- `Wallet Gateway error (${w}): ${f}`
3819
+ `Wallet Gateway 오류 (${w}): ${f}`
3734
3820
  );
3735
3821
  }
3736
3822
  throw l;
@@ -3804,15 +3890,15 @@ class qe {
3804
3890
  switch (e) {
3805
3891
  case "sign":
3806
3892
  case "send":
3807
- if (!s.tx) throw new x(g.TX_INVALID_PARAMS, "prepare: tx is required");
3893
+ if (!s.tx) throw new x(g.TX_INVALID_PARAMS, "prepare: tx 필요합니다");
3808
3894
  t = { unsignedTx: this.buildUnsignedTx(s.tx) };
3809
3895
  break;
3810
3896
  case "sign-message":
3811
- if (!s.message) throw new x(g.TX_INVALID_PARAMS, "prepare: message is required");
3897
+ if (!s.message) throw new x(g.TX_INVALID_PARAMS, "prepare: message 필요합니다");
3812
3898
  t = { message: s.message }, s.from && (t.from = s.from);
3813
3899
  break;
3814
3900
  case "sign-typed-data":
3815
- if (!s.typedData) throw new x(g.TX_INVALID_PARAMS, "prepare: typedData is required");
3901
+ if (!s.typedData) throw new x(g.TX_INVALID_PARAMS, "prepare: typedData 필요합니다");
3816
3902
  t = { typedData: s.typedData }, s.from && (t.from = s.from);
3817
3903
  break;
3818
3904
  }
@@ -3986,7 +4072,7 @@ class Ce {
3986
4072
  }
3987
4073
  isCacheValid() {
3988
4074
  if (this.loadedAt === 0) return !1;
3989
- const e = this.usingFallback ? Vs : js;
4075
+ const e = this.usingFallback ? Ys : zs;
3990
4076
  return e === 0 ? !0 : Date.now() - this.loadedAt < e;
3991
4077
  }
3992
4078
  populateCache(e, s) {
@@ -4006,7 +4092,7 @@ class Ce {
4006
4092
  }
4007
4093
  handleEnvelopeError(e) {
4008
4094
  if (e.code < 0) {
4009
- const s = typeof e.data == "string" ? e.data : e.message ?? "Chain registry request failed";
4095
+ const s = typeof e.data == "string" ? e.data : e.message ?? "체인 레지스트리 요청에 실패했습니다";
4010
4096
  throw new x(
4011
4097
  Ce.mapErrorCode(e.code),
4012
4098
  s
@@ -4020,7 +4106,7 @@ class Ce {
4020
4106
  if (s) return s;
4021
4107
  throw new x(
4022
4108
  g.CHAIN_NOT_SUPPORTED,
4023
- `Unsupported chain: ${e}`
4109
+ `지원하지 않는 체인: ${e}`
4024
4110
  );
4025
4111
  }
4026
4112
  static fallbackChains() {
@@ -4048,7 +4134,7 @@ class Ce {
4048
4134
  }
4049
4135
  }
4050
4136
  }
4051
- const Wt = "__crossx-confirm-style", te = "__crossx-confirm-overlay", an = {
4137
+ const Wt = "__crossx-confirm-style", te = "__crossx-confirm-overlay", dn = {
4052
4138
  light: {
4053
4139
  bg: "#FFFFFF",
4054
4140
  border: "rgba(18,18,18,0.05)",
@@ -4095,7 +4181,7 @@ const Wt = "__crossx-confirm-style", te = "__crossx-confirm-overlay", an = {
4095
4181
  }
4096
4182
  };
4097
4183
  function jt(r, e) {
4098
- const s = an[r], t = e == null ? void 0 : e[r];
4184
+ const s = dn[r], t = e == null ? void 0 : e[r];
4099
4185
  return t ? {
4100
4186
  ...s,
4101
4187
  // ── Brand
@@ -4124,7 +4210,7 @@ function jt(r, e) {
4124
4210
  ...t.bg !== void 0 && { bg: t.bg, inputBg: t.bg }
4125
4211
  } : s;
4126
4212
  }
4127
- const cn = `
4213
+ const un = `
4128
4214
  @import url('https://fonts.googleapis.com/css2?family=Sora:wght@400;600&display=swap');
4129
4215
 
4130
4216
  #${te} {
@@ -5042,12 +5128,12 @@ const cn = `
5042
5128
  `;
5043
5129
  function me() {
5044
5130
  let r = document.getElementById(Wt);
5045
- r || (r = document.createElement("style"), r.id = Wt, document.head.appendChild(r)), r.textContent = cn;
5131
+ r || (r = document.createElement("style"), r.id = Wt, document.head.appendChild(r)), r.textContent = un;
5046
5132
  }
5047
5133
  function Y(r) {
5048
5134
  return r ? r.length <= 13 ? r : `${r.slice(0, 6)}…${r.slice(-4)}` : "—";
5049
5135
  }
5050
- function ln(r, e = "CROSS", s = 18) {
5136
+ function hn(r, e = "CROSS", s = 18) {
5051
5137
  if (!r || r === "0x" || r === "0x0") return null;
5052
5138
  try {
5053
5139
  const t = BigInt(r);
@@ -5081,7 +5167,7 @@ const Vt = {
5081
5167
  612044: "CROSS Testnet",
5082
5168
  612055: "CROSS Mainnet"
5083
5169
  };
5084
- function Ss(r) {
5170
+ function Es(r) {
5085
5171
  const e = parseInt(r.split(":")[1] ?? "", 10);
5086
5172
  return !isNaN(e) && Vt[e] ? Vt[e] : r;
5087
5173
  }
@@ -5098,18 +5184,18 @@ function tt(r) {
5098
5184
  return r;
5099
5185
  }
5100
5186
  }
5101
- function dn(r) {
5187
+ function fn(r) {
5102
5188
  try {
5103
5189
  return BigInt(r).toLocaleString();
5104
5190
  } catch {
5105
5191
  return r;
5106
5192
  }
5107
5193
  }
5108
- function un(r) {
5194
+ function pn(r) {
5109
5195
  const { gasLimit: e, gasPrice: s, maxFeePerGas: t, maxPriorityFeePerGas: n, nativeSymbol: o = "ETH", nativeDecimals: i = 18 } = r;
5110
5196
  if (!e) return null;
5111
5197
  try {
5112
- const a = BigInt(e), c = dn(e);
5198
+ const a = BigInt(e), c = fn(e);
5113
5199
  if (t) {
5114
5200
  const l = a * BigInt(t);
5115
5201
  return {
@@ -5134,8 +5220,8 @@ function un(r) {
5134
5220
  return null;
5135
5221
  }
5136
5222
  }
5137
- function Es(r) {
5138
- const e = un(r);
5223
+ function Ts(r) {
5224
+ const e = pn(r);
5139
5225
  if (!e) return q("Estimated fee", "<span>—</span>");
5140
5226
  let s = q("Est. Tx Fee", `<span>${e.estTxFee}</span>`);
5141
5227
  return e.isDynamic ? (e.maxPriorityFeeGwei !== void 0 && (s += q("Max Priority Fee", `<span>${e.maxPriorityFeeGwei} Gwei</span>`)), e.maxFeeGwei !== void 0 && (s += q("Max Gas Fee", `<span>${e.maxFeeGwei} Gwei</span>`))) : e.gasPriceGwei !== void 0 && (s += q("Gas Price", `<span>${e.gasPriceGwei} Gwei</span>`)), e.gasLimitFormatted && (s += q("Gas Limit", `<span>${e.gasLimitFormatted}</span>`)), s;
@@ -5147,7 +5233,7 @@ const de = `<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="
5147
5233
  <line x1="18" y1="6" x2="6" y2="18"/>
5148
5234
  <line x1="6" y1="6" x2="18" y2="18"/>
5149
5235
  </svg>`;
5150
- function hn(r) {
5236
+ function gn(r) {
5151
5237
  return `<svg width="28" height="28" viewBox="0 0 28 28" fill="none">
5152
5238
  <circle cx="14" cy="14" r="14" fill="${r}"/>
5153
5239
  <path d="M14 7.5L19.2 10.5V16.5L14 19.5L8.8 16.5V10.5L14 7.5Z" fill="white" opacity="0.9"/>
@@ -5157,9 +5243,9 @@ const _t = `<svg width="20" height="20" viewBox="0 0 20 20" fill="none">
5157
5243
  <rect x="2" y="5" width="16" height="12" rx="2" stroke="currentColor" stroke-width="1.5"/>
5158
5244
  <path d="M2 9h16" stroke="currentColor" stroke-width="1.5"/>
5159
5245
  <rect x="12.5" y="11.5" width="3.5" height="2.5" rx="0.75" fill="currentColor"/>
5160
- </svg>`, fn = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none">
5246
+ </svg>`, _n = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none">
5161
5247
  <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-secondary)"/>
5162
- </svg>`, pn = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none">
5248
+ </svg>`, xn = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none">
5163
5249
  <circle cx="12" cy="12" r="12" fill="var(--cx-secondary)"/>
5164
5250
  <circle cx="12" cy="12" r="5.5" stroke="white" stroke-width="1.5"/>
5165
5251
  <path d="M12 9.5v3l2 1.5" stroke="white" stroke-width="1.5" stroke-linecap="round"/>
@@ -5195,9 +5281,9 @@ function q(r, e) {
5195
5281
  <div class="__crossx-row-value">${e}</div>
5196
5282
  </div>`;
5197
5283
  }
5198
- function gn(r, e) {
5284
+ function mn(r, e) {
5199
5285
  const s = e, t = Ke(), n = r.to ? `<span class="__crossx-addr-text">${Y(r.to)}</span>
5200
- <button class="__crossx-copy-btn" data-copy="${M(r.to)}" title="Copy address">${de}</button>` : "<span>—</span>", o = Es(r), i = r.data && r.data !== "0x" ? r.data : "0x", a = document.createElement("div");
5286
+ <button class="__crossx-copy-btn" data-copy="${M(r.to)}" title="Copy address">${de}</button>` : "<span>—</span>", o = Ts(r), i = r.data && r.data !== "0x" ? r.data : "0x", a = document.createElement("div");
5201
5287
  return a.id = te, a.innerHTML = `
5202
5288
  <div class="__crossx-card __crossx-card--migration __crossx-card--sign-tx" style="${ae(s)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
5203
5289
  <div class="__crossx-header">
@@ -5219,7 +5305,7 @@ function gn(r, e) {
5219
5305
  <hr class="__crossx-divider">
5220
5306
  <div class="__crossx-rows">
5221
5307
  ${q("To", n)}
5222
- ${q("Network", `<span>${Ss(r.chainId)}</span>`)}
5308
+ ${q("Network", `<span>${Es(r.chainId)}</span>`)}
5223
5309
  ${o}
5224
5310
  </div>
5225
5311
  </div>
@@ -5233,9 +5319,9 @@ function gn(r, e) {
5233
5319
  </div>
5234
5320
  `, a;
5235
5321
  }
5236
- function _n(r, e) {
5322
+ function wn(r, e) {
5237
5323
  const s = e, t = r.nativeSymbol ?? "ETH", n = r.nativeDecimals ?? 18, o = Ke(), i = r.to ? `<span class="__crossx-addr-text">${Y(r.to)}</span>
5238
- <button class="__crossx-copy-btn" data-copy="${M(r.to)}" title="Copy address">${de}</button>` : "<span>—</span>", a = Es(r), l = ln(r.value, t, n) ?? "—", d = document.createElement("div");
5324
+ <button class="__crossx-copy-btn" data-copy="${M(r.to)}" title="Copy address">${de}</button>` : "<span>—</span>", a = Ts(r), l = hn(r.value, t, n) ?? "—", d = document.createElement("div");
5239
5325
  return d.id = te, d.innerHTML = `
5240
5326
  <div class="__crossx-card __crossx-card--migration __crossx-card--send-tx" style="${ae(s)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
5241
5327
  <div class="__crossx-header">
@@ -5250,7 +5336,7 @@ function _n(r, e) {
5250
5336
  <div class="__crossx-body-cols">
5251
5337
  <div class="__crossx-rows">
5252
5338
  ${q("To", i)}
5253
- ${q("Network", `<span>${Ss(r.chainId)}</span>`)}
5339
+ ${q("Network", `<span>${Es(r.chainId)}</span>`)}
5254
5340
  ${a}
5255
5341
  </div>
5256
5342
  <div class="__crossx-pill">
@@ -5274,10 +5360,10 @@ function Ke() {
5274
5360
  function M(r) {
5275
5361
  return r.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
5276
5362
  }
5277
- function xn(r) {
5363
+ function yn(r) {
5278
5364
  return typeof r == "string" && /^0x[0-9a-fA-F]{40}$/i.test(r);
5279
5365
  }
5280
- function mn(r) {
5366
+ function bn(r) {
5281
5367
  if (typeof r == "string") return M(r);
5282
5368
  if (typeof r == "number" || typeof r == "bigint" || typeof r == "boolean") return String(r);
5283
5369
  try {
@@ -5286,7 +5372,7 @@ function mn(r) {
5286
5372
  return String(r);
5287
5373
  }
5288
5374
  }
5289
- function wn(r, e) {
5375
+ function vn(r, e) {
5290
5376
  const s = q(
5291
5377
  "From",
5292
5378
  `<span class="__crossx-addr-text">${Y(r.from)}</span>
@@ -5318,7 +5404,7 @@ function wn(r, e) {
5318
5404
  </div>
5319
5405
  `, c;
5320
5406
  }
5321
- function yn(r, e) {
5407
+ function Sn(r, e) {
5322
5408
  const s = document.createElement("div");
5323
5409
  return s.id = te, s.innerHTML = `
5324
5410
  <div class="__crossx-card __crossx-card--migration" style="${ae(e)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
@@ -5335,10 +5421,10 @@ function yn(r, e) {
5335
5421
  </div>
5336
5422
  `, s;
5337
5423
  }
5338
- function bn(r, e, s) {
5424
+ function En(r, e, s) {
5339
5425
  const t = e.status !== "reverted" && e.status !== "timeout", n = e.status === "timeout", o = r.querySelector("#__crossx-ttl"), i = r.querySelector(".__crossx-header");
5340
5426
  if (o) {
5341
- const m = n ? pn : t ? "" : fn, A = n ? "Transaction timeout" : t ? "Transaction complete" : "Transaction failed";
5427
+ const m = n ? xn : t ? "" : _n, A = n ? "Transaction timeout" : t ? "Transaction complete" : "Transaction failed";
5342
5428
  m ? (o.style.display = "flex", o.style.alignItems = "center", o.style.gap = "8px", o.innerHTML = `${m}<span>${A}</span>`) : o.textContent = A;
5343
5429
  }
5344
5430
  if (i && !r.querySelector("#__crossx-close-btn")) {
@@ -5366,15 +5452,15 @@ function bn(r, e, s) {
5366
5452
  <button class="__crossx-approve-btn" id="__crossx-done-btn">${t ? "All Done" : "Done"}</button>
5367
5453
  `, a.querySelectorAll(".__crossx-copy-btn").forEach((m) => {
5368
5454
  m.addEventListener("click", (A) => {
5369
- var I;
5455
+ var T;
5370
5456
  A.stopPropagation();
5371
5457
  const y = m.dataset.copy;
5372
- y && ((I = navigator.clipboard) == null || I.writeText(y).catch(() => {
5458
+ y && ((T = navigator.clipboard) == null || T.writeText(y).catch(() => {
5373
5459
  }));
5374
5460
  });
5375
5461
  });
5376
5462
  }
5377
- function vn(r, e) {
5463
+ function Tn(r, e) {
5378
5464
  const s = e, t = Ke(), n = M(r.message), o = document.createElement("div");
5379
5465
  return o.id = te, o.innerHTML = `
5380
5466
  <div class="__crossx-card __crossx-card--migration __crossx-card--sign-msg" style="${ae(s)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
@@ -5406,7 +5492,7 @@ function vn(r, e) {
5406
5492
  </div>
5407
5493
  `, o;
5408
5494
  }
5409
- function Sn(r, e) {
5495
+ function In(r, e) {
5410
5496
  const s = e, t = Ke();
5411
5497
  let n = {};
5412
5498
  if (typeof r.typedData == "string")
@@ -5422,7 +5508,7 @@ function Sn(r, e) {
5422
5508
  <span class="__crossx-td-value">${M(o)}</span>
5423
5509
  </div>`;
5424
5510
  for (const [l, d] of Object.entries(i)) {
5425
- const f = mn(d), _ = xn(d) ? `<span class="__crossx-addr-text">${Y(d)}</span>
5511
+ const f = bn(d), _ = yn(d) ? `<span class="__crossx-addr-text">${Y(d)}</span>
5426
5512
  <button class="__crossx-copy-btn" data-copy="${M(String(d))}" title="Copy">${de}</button>` : `<span>${f}</span>`;
5427
5513
  a += `
5428
5514
  <div class="__crossx-td-row">
@@ -5461,11 +5547,11 @@ function Sn(r, e) {
5461
5547
  </div>
5462
5548
  `, c;
5463
5549
  }
5464
- const En = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round">
5550
+ const An = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round">
5465
5551
  <line x1="12" y1="5" x2="12" y2="19"/>
5466
5552
  <line x1="5" y1="12" x2="19" y2="12"/>
5467
5553
  </svg>`;
5468
- function In(r, e, s) {
5554
+ function Rn(r, e, s) {
5469
5555
  const t = s == null ? void 0 : s.toLowerCase(), n = r.map((i) => {
5470
5556
  const a = t && i.address.toLowerCase() === t;
5471
5557
  return `<button class="__crossx-wallet-item" data-wallet-index="${i.index}" data-wallet-address="${M(i.address)}">
@@ -5496,7 +5582,7 @@ function In(r, e, s) {
5496
5582
  ${n}
5497
5583
  </div>
5498
5584
  <button class="__crossx-wallet-add" id="__crossx-add-wallet-btn" type="button">
5499
- <span class="__crossx-wallet-add-icon">${En}</span>
5585
+ <span class="__crossx-wallet-add-icon">${An}</span>
5500
5586
  <span class="__crossx-wallet-add-label">add a wallet</span>
5501
5587
  </button>
5502
5588
  </div>
@@ -5505,16 +5591,16 @@ function In(r, e, s) {
5505
5591
  </div>
5506
5592
  `, o;
5507
5593
  }
5508
- const Tn = `<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
5594
+ const On = `<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
5509
5595
  <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"/>
5510
5596
  <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"/>
5511
- </svg>`, An = `<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
5597
+ </svg>`, Cn = `<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
5512
5598
  <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"/>
5513
5599
  <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"/>
5514
5600
  <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"/>
5515
5601
  <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"/>
5516
5602
  </svg>`;
5517
- function Rn(r) {
5603
+ function kn(r) {
5518
5604
  const e = r, s = document.createElement("div");
5519
5605
  return s.id = te, s.innerHTML = `
5520
5606
  <div class="__crossx-card __crossx-card--migration" style="${ae(e)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
@@ -5529,11 +5615,11 @@ function Rn(r) {
5529
5615
  <div class="__crossx-body">
5530
5616
  <div class="__crossx-login-btn-row">
5531
5617
  <button class="__crossx-login-btn" id="__crossx-apple-btn" type="button">
5532
- <span class="__crossx-login-icon" style="color:var(--cx-value);">${Tn}</span>
5618
+ <span class="__crossx-login-icon" style="color:var(--cx-value);">${On}</span>
5533
5619
  <span class="__crossx-login-btn-label">Sign in with&nbsp;&nbsp;Apple</span>
5534
5620
  </button>
5535
5621
  <button class="__crossx-login-btn" id="__crossx-google-btn" type="button">
5536
- <span class="__crossx-login-icon">${An}</span>
5622
+ <span class="__crossx-login-icon">${Cn}</span>
5537
5623
  <span class="__crossx-login-btn-label">Sign in with&nbsp;&nbsp;Google</span>
5538
5624
  </button>
5539
5625
  </div>
@@ -5545,7 +5631,7 @@ function Rn(r) {
5545
5631
  </div>
5546
5632
  `, s;
5547
5633
  }
5548
- function On(r) {
5634
+ function Nn(r) {
5549
5635
  const e = r, s = document.createElement("div");
5550
5636
  return s.id = te, s.innerHTML = `
5551
5637
  <div class="__crossx-card __crossx-card--migration" style="${ae(e)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
@@ -5561,7 +5647,7 @@ function On(r) {
5561
5647
  <p class="__crossx-mig-info-desc">It safely restores and integrates all your previous assets. Simply verify your PIN to get started.</p>
5562
5648
  </div>
5563
5649
  <button class="__crossx-recover-btn" id="__crossx-recover-btn">
5564
- <span>${hn(e.primary)}</span>
5650
+ <span>${gn(e.primary)}</span>
5565
5651
  <span class="__crossx-recover-label">Recover My Wallet</span>
5566
5652
  </button>
5567
5653
  <button class="__crossx-skip-btn" id="__crossx-skip-btn">Skip for Now</button>
@@ -5569,7 +5655,7 @@ function On(r) {
5569
5655
  </div>
5570
5656
  `, s;
5571
5657
  }
5572
- function Cn(r, e) {
5658
+ function Pn(r, e) {
5573
5659
  const s = r, t = e ? `<p class="__crossx-pin-error-text">${e}</p>` : "", n = document.createElement("div");
5574
5660
  return n.id = te, n.innerHTML = `
5575
5661
  <div class="__crossx-card __crossx-card--migration" style="${ae(s)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
@@ -5591,7 +5677,7 @@ function Cn(r, e) {
5591
5677
  </div>
5592
5678
  `, n;
5593
5679
  }
5594
- function kn(r, e, s) {
5680
+ function Ln(r, e, s) {
5595
5681
  var n;
5596
5682
  const t = r.querySelectorAll(".__crossx-pin-input");
5597
5683
  t.forEach((o, i) => {
@@ -5617,13 +5703,16 @@ function kn(r, e, s) {
5617
5703
  });
5618
5704
  }), (n = t[0]) == null || n.focus();
5619
5705
  }
5620
- class Nn {
5706
+ class Dn {
5621
5707
  constructor(e = "light", s) {
5622
5708
  this.theme = e, this.overrides = s, this.tokens = jt(e, s);
5623
5709
  }
5624
5710
  setTheme(e, s) {
5625
5711
  this.theme = e, s !== void 0 && (this.overrides = s), this.tokens = jt(e, this.overrides);
5626
5712
  }
5713
+ setMessages(e) {
5714
+ this.messages = e;
5715
+ }
5627
5716
  getTheme() {
5628
5717
  return this.theme;
5629
5718
  }
@@ -5636,7 +5725,7 @@ class Nn {
5636
5725
  return new Promise((n) => {
5637
5726
  var A;
5638
5727
  me();
5639
- const o = [...e], i = In(o, this.tokens, t), a = document.body.style.overflow;
5728
+ const o = [...e], i = Rn(o, this.tokens, t), a = document.body.style.overflow;
5640
5729
  document.body.style.overflow = "hidden", document.body.appendChild(i);
5641
5730
  let c = !1;
5642
5731
  const l = () => {
@@ -5649,8 +5738,8 @@ class Nn {
5649
5738
  (() => {
5650
5739
  i.querySelectorAll(".__crossx-wallet-item").forEach((y) => {
5651
5740
  y.addEventListener("click", () => {
5652
- const I = y.dataset.walletAddress ?? "", L = parseInt(y.dataset.walletIndex ?? "0", 10);
5653
- d({ address: I, index: L });
5741
+ const T = y.dataset.walletAddress ?? "", L = parseInt(y.dataset.walletIndex ?? "0", 10);
5742
+ d({ address: T, index: L });
5654
5743
  });
5655
5744
  });
5656
5745
  })();
@@ -5660,10 +5749,10 @@ class Nn {
5660
5749
  try {
5661
5750
  const y = await s();
5662
5751
  o.push(y);
5663
- const I = i.querySelector("#__crossx-wallet-list");
5664
- if (I) {
5752
+ const T = i.querySelector("#__crossx-wallet-list");
5753
+ if (T) {
5665
5754
  const L = document.createElement("button");
5666
- L.className = "__crossx-wallet-item", L.dataset.walletIndex = String(y.index), L.dataset.walletAddress = y.address, L.innerHTML = `<span class="__crossx-wallet-addr">${Y(y.address)}</span>`, L.addEventListener("click", () => d(y)), I.appendChild(L), L.scrollIntoView({ behavior: "smooth", block: "nearest" });
5755
+ L.className = "__crossx-wallet-item", L.dataset.walletIndex = String(y.index), L.dataset.walletAddress = y.address, L.innerHTML = `<span class="__crossx-wallet-addr">${Y(y.address)}</span>`, L.addEventListener("click", () => d(y)), T.appendChild(L), L.scrollIntoView({ behavior: "smooth", block: "nearest" });
5667
5756
  }
5668
5757
  } catch {
5669
5758
  } finally {
@@ -5687,7 +5776,7 @@ class Nn {
5687
5776
  return new Promise((e) => {
5688
5777
  var a, c, l;
5689
5778
  me();
5690
- const s = Rn(this.tokens);
5779
+ const s = kn(this.tokens);
5691
5780
  document.body.appendChild(s);
5692
5781
  const t = () => s.remove(), n = (d) => {
5693
5782
  t(), e(d);
@@ -5713,7 +5802,7 @@ class Nn {
5713
5802
  return new Promise((e) => {
5714
5803
  var a, c, l;
5715
5804
  me();
5716
- const s = On(this.tokens);
5805
+ const s = Nn(this.tokens);
5717
5806
  document.body.appendChild(s);
5718
5807
  const t = () => s.remove(), n = () => {
5719
5808
  t(), e("recover");
@@ -5738,14 +5827,14 @@ class Nn {
5738
5827
  return new Promise((s) => {
5739
5828
  var a;
5740
5829
  me();
5741
- const t = Cn(this.tokens, e);
5830
+ const t = Pn(this.tokens, e);
5742
5831
  document.body.appendChild(t);
5743
5832
  const n = () => t.remove(), o = (c) => {
5744
5833
  n(), s(c);
5745
5834
  }, i = () => {
5746
5835
  n(), s(null);
5747
5836
  };
5748
- kn(t, o, i), (a = t.querySelector("#__crossx-close-btn")) == null || a.addEventListener("click", i), t.addEventListener("click", (c) => {
5837
+ Ln(t, o, i), (a = t.querySelector("#__crossx-close-btn")) == null || a.addEventListener("click", i), t.addEventListener("click", (c) => {
5749
5838
  c.target === t && i();
5750
5839
  });
5751
5840
  });
@@ -5758,7 +5847,7 @@ class Nn {
5758
5847
  return new Promise((s) => {
5759
5848
  var a, c;
5760
5849
  me();
5761
- const t = wn(e, this.tokens);
5850
+ const t = vn(e, this.tokens);
5762
5851
  document.body.appendChild(t);
5763
5852
  const n = () => t.remove(), o = () => {
5764
5853
  n(), s();
@@ -5787,7 +5876,7 @@ class Nn {
5787
5876
  showTransactionProgress(e, s) {
5788
5877
  return new Promise((t) => {
5789
5878
  me();
5790
- const n = yn(e, this.tokens);
5879
+ const n = Sn(e, this.tokens);
5791
5880
  document.body.appendChild(n);
5792
5881
  const o = () => n.remove();
5793
5882
  let i = !1;
@@ -5804,7 +5893,7 @@ class Nn {
5804
5893
  document.addEventListener("keydown", l);
5805
5894
  };
5806
5895
  s.then((l) => {
5807
- i || (bn(n, l, this.tokens), c());
5896
+ i || (En(n, l, this.tokens), c());
5808
5897
  });
5809
5898
  });
5810
5899
  }
@@ -5813,7 +5902,7 @@ class Nn {
5813
5902
  var c, l, d;
5814
5903
  me();
5815
5904
  let t;
5816
- e.type === "sign-message" ? t = vn(e, this.tokens) : e.type === "sign-typed-data" ? t = Sn(e, this.tokens) : e.type === "sign" ? t = gn(e, this.tokens) : t = _n(e, this.tokens), document.body.appendChild(t);
5905
+ e.type === "sign-message" ? t = Tn(e, this.tokens) : e.type === "sign-typed-data" ? t = In(e, this.tokens) : e.type === "sign" ? t = mn(e, this.tokens) : t = wn(e, this.tokens), document.body.appendChild(t);
5817
5906
  const n = () => t.remove(), o = () => {
5818
5907
  n(), s(!0);
5819
5908
  }, i = () => {
@@ -5837,7 +5926,7 @@ class Nn {
5837
5926
  });
5838
5927
  }
5839
5928
  }
5840
- class Pn {
5929
+ class $n {
5841
5930
  constructor() {
5842
5931
  this._accessToken = null;
5843
5932
  }
@@ -5854,9 +5943,9 @@ class Pn {
5854
5943
  return this._accessToken !== null;
5855
5944
  }
5856
5945
  }
5857
- function Mn(r) {
5946
+ function Un(r) {
5858
5947
  r.debug;
5859
- const e = Ue.production, s = {
5948
+ const e = Fe.production, s = {
5860
5949
  ...r,
5861
5950
  oauthServiceUrl: e.oauthServiceUrl,
5862
5951
  authApiUrl: e.authApiUrl,
@@ -5864,15 +5953,15 @@ function Mn(r) {
5864
5953
  }, t = {
5865
5954
  gatewayUrl: e.walletGatewayUrl,
5866
5955
  projectId: r.projectId
5867
- }, o = s.authMode !== "cookie" && At.isAvailable() ? new At() : new Ks(), i = new tn(), a = new nn(), c = new gt(), l = new Pn();
5956
+ }, o = s.authMode !== "cookie" && At.isAvailable() ? new At() : new Zs(), i = new nn(), a = new cn(), c = new gt(), l = new $n();
5868
5957
  let d;
5869
- r.useMockWallet ? (p.log("[CROSSx] Mock Wallet Provider 사용"), d = new on(o)) : (p.log("[CROSSx] Remote Wallet Provider 사용"), d = new qe(
5958
+ r.useMockWallet ? (p.log("[CROSSx] Mock Wallet Provider 사용"), d = new ln(o)) : (p.log("[CROSSx] Remote Wallet Provider 사용"), d = new qe(
5870
5959
  t,
5871
5960
  o,
5872
5961
  a,
5873
5962
  l
5874
5963
  ));
5875
- const f = new Ce(t, a), w = new Nn(r.theme ?? "light", r.themeTokens);
5964
+ const f = new Ce(t, a), w = new Dn(r.theme ?? "light", r.themeTokens);
5876
5965
  return new st(
5877
5966
  s,
5878
5967
  t,
@@ -5888,9 +5977,9 @@ function Mn(r) {
5888
5977
  }
5889
5978
  export {
5890
5979
  x as CROSSxError,
5891
- Cs as CROSSxEthereumProvider,
5980
+ ks as CROSSxEthereumProvider,
5892
5981
  st as CROSSxSDK,
5893
- $n as ChainId,
5982
+ Fn as ChainId,
5894
5983
  g as ErrorCode,
5895
- Mn as createCROSSxSDK
5984
+ Un as createCROSSxSDK
5896
5985
  };