@nexus-cross/crossx-sdk-core 1.3.7 → 1.3.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
@@ -167,26 +167,34 @@ class Fs {
167
167
  };
168
168
  }
169
169
  }
170
- let Se = null;
171
- function vt(r) {
172
- Se = r;
170
+ let _e = null;
171
+ function St(r) {
172
+ _e = r;
173
173
  }
174
174
  const d = {
175
+ /** 빌드 모드와 무관하게 항상 출력되는 정보성 로그 (SDK 수명주기 등) */
176
+ info(...r) {
177
+ if (_e) {
178
+ _e.log(...r);
179
+ return;
180
+ }
181
+ console.log(...r);
182
+ },
175
183
  log(...r) {
176
- if (Se) {
177
- Se.log(...r);
184
+ if (_e) {
185
+ _e.log(...r);
178
186
  return;
179
187
  }
180
188
  },
181
189
  warn(...r) {
182
- if (Se) {
183
- Se.warn(...r);
190
+ if (_e) {
191
+ _e.warn(...r);
184
192
  return;
185
193
  }
186
194
  },
187
195
  error(...r) {
188
- if (Se) {
189
- Se.error(...r);
196
+ if (_e) {
197
+ _e.error(...r);
190
198
  return;
191
199
  }
192
200
  }
@@ -256,7 +264,8 @@ const d = {
256
264
  verifyPin_subtitle: "계속하려면 PIN을 확인해 주세요.",
257
265
  // ── PIN 잠금 안내 ─────────────────────────────────────────────
258
266
  pinLocked_message: "잠금이 해제된 후 다시 시도해 주세요.",
259
- pinLocked_availableFrom: "이용 가능 시간"
267
+ pinLocked_availableFrom: "이용 가능 시간",
268
+ alert_sessionExpired: "인증이 만료되었습니다. 확인을 누른 뒤 다시 로그인해 주세요."
260
269
  }, Qt = {
261
270
  // ── Common buttons ───────────────────────────────────────────
262
271
  confirm: "Confirm",
@@ -323,12 +332,13 @@ const d = {
323
332
  verifyPin_subtitle: "To continue, please confirm your PIN.",
324
333
  // ── PIN lock message ─────────────────────────────────────────
325
334
  pinLocked_message: "Please try again after the lock expires.",
326
- pinLocked_availableFrom: "Available from"
335
+ pinLocked_availableFrom: "Available from",
336
+ alert_sessionExpired: "Your session has expired. Tap OK and sign in again."
327
337
  }, Ws = {
328
338
  ko: Gs,
329
339
  en: Qt
330
340
  };
331
- function St(r = "en", e) {
341
+ function Xe(r = "en", e) {
332
342
  return Ws[r] ?? Qt;
333
343
  }
334
344
  const Et = "crossx_access_token", It = "crossx_refresh_token", Tt = "crossx_user_info";
@@ -869,7 +879,7 @@ function Js() {
869
879
  const Xs = 2e3, At = 6e4, Zs = 1e3, Qs = 1e4, er = "0x77359400", Rt = "0x3B9ACA00", kt = 130, Pt = 6, Ot = 18, tr = 3e4, sr = 5 * 60 * 1e3, rr = 30 * 1e3, re = class re extends js {
870
880
  constructor(e, s, t, n, o, i, a, c, l, u, h) {
871
881
  var _, f;
872
- super(), this.storage = t, this.crypto = n, this.transport = o, this.oauth = i, this.walletProvider = a, this.tokenStore = c, this.initialized = !1, this._initPromise = null, this.authenticated = !1, this.userId = null, this.address = null, this.activeWalletIndex = 0, this.userEmail = null, this.loginType = null, this.providerSub = null, this.tokenSignatureVerified = !1, this._verifyPinMutex = null, this._config = Object.freeze({ ...e }), this.internalConfig = e, this.adapterConfig = s, e.logger && vt(e.logger), this.confirmation = l, this.pinStore = h ?? new es(), this.chainRegistry = u, this.jsonRpc = new zs(u, o), this.signInUseCase = new qs(
882
+ super(), this.storage = t, this.crypto = n, this.transport = o, this.oauth = i, this.walletProvider = a, this.tokenStore = c, this.initialized = !1, this._initPromise = null, this.authenticated = !1, this.userId = null, this.address = null, this.activeWalletIndex = 0, this.userEmail = null, this.loginType = null, this.providerSub = null, this.tokenSignatureVerified = !1, this._verifyPinMutex = null, this._themeMediaCleanup = null, this._config = Object.freeze({ ...e }), this.internalConfig = e, this.adapterConfig = s, e.logger && St(e.logger), this.confirmation = l, this.pinStore = h ?? new es(), this.chainRegistry = u, this.jsonRpc = new zs(u, o), this.signInUseCase = new qs(
873
883
  this.internalConfig,
874
884
  t,
875
885
  n,
@@ -880,7 +890,7 @@ const Xs = 2e3, At = 6e4, Zs = 1e3, Qs = 1e4, er = "0x77359400", Rt = "0x3B9ACA0
880
890
  ), this.signOutUseCase = new Ks(this.internalConfig, t, c), this.migrateWalletUseCase = new Vs(t, a), (_ = a.setOnUnauthorized) == null || _.call(a, () => this.forceLogout()), (f = a.setTokenRefresher) == null || f.call(
881
891
  a,
882
892
  () => this.signInUseCase.refreshAccessToken()
883
- );
893
+ ), e.autoDetectTheme && this._setupAutoDetectTheme();
884
894
  }
885
895
  get config() {
886
896
  return this._config;
@@ -906,7 +916,7 @@ const Xs = 2e3, At = 6e4, Zs = 1e3, Qs = 1e4, er = "0x77359400", Rt = "0x3B9ACA0
906
916
  }
907
917
  async _doInitialize(e) {
908
918
  var s, t;
909
- d.log("[CROSSx SDK] v1.3.7 초기화 중..."), this.confirmation.setMessages(St(this._config.locale));
919
+ d.log("[CROSSx SDK] v1.3.9 초기화 중..."), this.confirmation.setMessages(Xe(this._config.locale));
910
920
  try {
911
921
  const n = Js();
912
922
  this.internalConfig.oauthServiceUrl = n.oauthServiceUrl, this.internalConfig.authApiUrl = n.authApiUrl, this.internalConfig.walletGatewayUrl = n.walletGatewayUrl, this.adapterConfig.gatewayUrl = n.walletGatewayUrl, (t = (s = this.crypto).setJWKSEndpoint) == null || t.call(s, `${n.authApiUrl}/.well-known/jwks.json`);
@@ -921,7 +931,7 @@ const Xs = 2e3, At = 6e4, Zs = 1e3, Qs = 1e4, er = "0x77359400", Rt = "0x3B9ACA0
921
931
  d.log("[CROSSx] initialize: 비밀번호 입력 취소 — 지갑 미로드 상태로 계속");
922
932
  }
923
933
  }
924
- return this.initialized = !0, this.emit("initialized", { restored: !!(o != null && o.success) }), o ?? null;
934
+ return this.initialized = !0, d.info("[CROSSx SDK] v1.3.9 초기화 완료"), this.emit("initialized", { restored: !!(o != null && o.success) }), o ?? null;
925
935
  } catch (n) {
926
936
  throw new m(p.AUTH_NOT_INITIALIZED, "SDK 초기화에 실패했습니다", n);
927
937
  }
@@ -1290,6 +1300,20 @@ const Xs = 2e3, At = 6e4, Zs = 1e3, Qs = 1e4, er = "0x77359400", Rt = "0x3B9ACA0
1290
1300
  // ============================================================================
1291
1301
  // 테마
1292
1302
  // ============================================================================
1303
+ /**
1304
+ * `prefers-color-scheme` 미디어 쿼리를 감시하여
1305
+ * 시스템 다크모드 변경 시 자동으로 테마를 전환합니다.
1306
+ */
1307
+ _setupAutoDetectTheme() {
1308
+ if (typeof window > "u" || !window.matchMedia) return;
1309
+ const e = window.matchMedia("(prefers-color-scheme: dark)"), s = (n) => {
1310
+ const o = n ? "dark" : "light";
1311
+ this.applyTheme(o, this._config.themeTokens ?? {});
1312
+ };
1313
+ s(e.matches);
1314
+ const t = (n) => s(n.matches);
1315
+ e.addEventListener("change", t), this._themeMediaCleanup = () => e.removeEventListener("change", t);
1316
+ }
1293
1317
  /**
1294
1318
  * 컨펌 모달 테마를 런타임에 변경합니다.
1295
1319
  * 다음 모달이 열릴 때부터 적용됩니다.
@@ -1315,7 +1339,7 @@ const Xs = 2e3, At = 6e4, Zs = 1e3, Qs = 1e4, er = "0x77359400", Rt = "0x3B9ACA0
1315
1339
  * sdk.applyLocale('ko');
1316
1340
  */
1317
1341
  applyLocale(e = this._config.locale ?? "en") {
1318
- this._config = Object.freeze({ ...this._config, locale: e }), this.confirmation.setMessages(St(e));
1342
+ this._config = Object.freeze({ ...this._config, locale: e }), this.confirmation.setMessages(Xe(e));
1319
1343
  }
1320
1344
  /**
1321
1345
  * 지갑 생성/로드 (로그인 후 address가 없는 경우)
@@ -1684,7 +1708,7 @@ const Xs = 2e3, At = 6e4, Zs = 1e3, Qs = 1e4, er = "0x77359400", Rt = "0x3B9ACA0
1684
1708
  let _, f;
1685
1709
  const w = this.waitForTxAndGetReceipt(a, e, { intervalMs: c, timeoutMs: l }).then((T) => {
1686
1710
  _ = T;
1687
- const C = BigInt(T.gasUsed) * BigInt(T.effectiveGasPrice), W = s.value ? BigInt(s.value) : 0n, B = re.formatTxAmount(s.value, u.symbol, u.decimals), j = re.formatTxAmount("0x" + C.toString(16), u.symbol, u.decimals), q = re.formatTxAmount("0x" + (W + C).toString(16), u.symbol, u.decimals);
1711
+ const N = BigInt(T.gasUsed) * BigInt(T.effectiveGasPrice), W = s.value ? BigInt(s.value) : 0n, B = re.formatTxAmount(s.value, u.symbol, u.decimals), j = re.formatTxAmount("0x" + N.toString(16), u.symbol, u.decimals), q = re.formatTxAmount("0x" + (W + N).toString(16), u.symbol, u.decimals);
1688
1712
  return {
1689
1713
  chainId: e,
1690
1714
  txHash: a,
@@ -2258,6 +2282,10 @@ const Xs = 2e3, At = 6e4, Zs = 1e3, Qs = 1e4, er = "0x77359400", Rt = "0x3B9ACA0
2258
2282
  throw new m(p.PIN_CANCELLED, "사용자가 PIN 입력을 취소했습니다");
2259
2283
  this.pinStore.set(o), d.log("[CROSSx] PIN 갱신 완료 (verify 모달 닫힘)"), t();
2260
2284
  } catch (o) {
2285
+ if (o instanceof m && (o.code === p.AUTH_NOT_AUTHENTICATED || o.code === p.AUTH_TOKEN_EXPIRED)) {
2286
+ const { alert_sessionExpired: i } = Xe(this._config.locale ?? "en");
2287
+ typeof globalThis.alert == "function" && globalThis.alert(i);
2288
+ }
2261
2289
  throw n(o), o;
2262
2290
  } finally {
2263
2291
  this._verifyPinMutex = null;
@@ -2374,7 +2402,8 @@ const Xs = 2e3, At = 6e4, Zs = 1e3, Qs = 1e4, er = "0x77359400", Rt = "0x3B9ACA0
2374
2402
  * dispose 후 SDK 인스턴스는 더 이상 사용할 수 없습니다.
2375
2403
  */
2376
2404
  dispose() {
2377
- this.clearAuthState(), this.tokenStore.clear(), this.pinStore.clear(), this.initialized = !1, this.removeAllListeners(), vt(null);
2405
+ var e;
2406
+ (e = this._themeMediaCleanup) == null || e.call(this), this._themeMediaCleanup = null, this.clearAuthState(), this.tokenStore.clear(), this.pinStore.clear(), this.initialized = !1, this.removeAllListeners(), St(null);
2378
2407
  }
2379
2408
  /**
2380
2409
  * @internal internal 패키지 전용 — 공개 문서에 기재하지 않음
@@ -2395,7 +2424,7 @@ const Xs = 2e3, At = 6e4, Zs = 1e3, Qs = 1e4, er = "0x77359400", Rt = "0x3B9ACA0
2395
2424
  }
2396
2425
  };
2397
2426
  re.OFFCHAIN_CHAIN_ID = "0";
2398
- let it = re;
2427
+ let at = re;
2399
2428
  class nr {
2400
2429
  constructor() {
2401
2430
  this.prefix = "crossx_";
@@ -2433,8 +2462,8 @@ class nr {
2433
2462
  }
2434
2463
  }
2435
2464
  }
2436
- const Xe = "crossx-sdk", or = 1, de = "data", ve = "keys", $e = "aes-primary", ir = 12;
2437
- class Nt {
2465
+ const Ze = "crossx-sdk", or = 1, de = "data", Se = "keys", $e = "aes-primary", ir = 12;
2466
+ class Ct {
2438
2467
  constructor(e) {
2439
2468
  this.db = null, this.cryptoKey = null, this.initPromise = null, this.dbName = `crossx-sdk-${e}`;
2440
2469
  }
@@ -2446,7 +2475,7 @@ class Nt {
2446
2475
  const n = indexedDB.open(e, or);
2447
2476
  n.onupgradeneeded = () => {
2448
2477
  const o = n.result;
2449
- o.objectStoreNames.contains(de) || o.createObjectStore(de), o.objectStoreNames.contains(ve) || o.createObjectStore(ve);
2478
+ o.objectStoreNames.contains(de) || o.createObjectStore(de), o.objectStoreNames.contains(Se) || o.createObjectStore(Se);
2450
2479
  }, n.onsuccess = () => s(n.result), n.onerror = () => t(n.error);
2451
2480
  });
2452
2481
  }
@@ -2476,7 +2505,7 @@ class Nt {
2476
2505
  }
2477
2506
  async init() {
2478
2507
  this.db = await this.openDB();
2479
- const e = await this.idbGet(ve, $e);
2508
+ const e = await this.idbGet(Se, $e);
2480
2509
  if (e) {
2481
2510
  this.cryptoKey = e;
2482
2511
  return;
@@ -2490,16 +2519,16 @@ class Nt {
2490
2519
  { name: "AES-GCM", length: 256 },
2491
2520
  !1,
2492
2521
  ["encrypt", "decrypt"]
2493
- ), await this.idbPut(ve, $e, this.cryptoKey);
2522
+ ), await this.idbPut(Se, $e, this.cryptoKey);
2494
2523
  }
2495
2524
  /**
2496
2525
  * 레거시 DB('crossx-sdk')에서 projectId 스코프 DB로 암호키·데이터 마이그레이션.
2497
2526
  * 마이그레이션 성공 시 레거시 DB 삭제.
2498
2527
  */
2499
2528
  async migrateFromLegacyDB() {
2500
- if (this.dbName === Xe) return null;
2529
+ if (this.dbName === Ze) return null;
2501
2530
  try {
2502
- const e = await this.openDB(Xe), s = e.transaction([ve, de], "readonly"), t = s.objectStore(ve).get($e), n = await new Promise((l, u) => {
2531
+ const e = await this.openDB(Ze), s = e.transaction([Se, de], "readonly"), t = s.objectStore(Se).get($e), n = await new Promise((l, u) => {
2503
2532
  t.onsuccess = () => l(t.result), t.onerror = () => u(t.error);
2504
2533
  });
2505
2534
  if (!n)
@@ -2512,10 +2541,10 @@ class Nt {
2512
2541
  i.onsuccess = () => l(i.result), i.onerror = () => u(i.error);
2513
2542
  })
2514
2543
  ]);
2515
- e.close(), await this.idbPut(ve, $e, n);
2544
+ e.close(), await this.idbPut(Se, $e, n);
2516
2545
  for (let l = 0; l < c.length; l++)
2517
2546
  await this.idbPut(de, String(c[l]), a[l]);
2518
- return indexedDB.deleteDatabase(Xe), d.log("[CROSSx] IndexedDB 레거시 DB 마이그레이션 완료"), n;
2547
+ return indexedDB.deleteDatabase(Ze), d.log("[CROSSx] IndexedDB 레거시 DB 마이그레이션 완료"), n;
2519
2548
  } catch (e) {
2520
2549
  return d.warn("[CROSSx] IndexedDB 레거시 DB 마이그레이션 실패:", e), null;
2521
2550
  }
@@ -2580,17 +2609,17 @@ class Nt {
2580
2609
  }
2581
2610
  }
2582
2611
  /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
2583
- function ut(r) {
2612
+ function ht(r) {
2584
2613
  return r instanceof Uint8Array || ArrayBuffer.isView(r) && r.constructor.name === "Uint8Array";
2585
2614
  }
2586
- function ge(r, e = "") {
2615
+ function me(r, e = "") {
2587
2616
  if (!Number.isSafeInteger(r) || r < 0) {
2588
2617
  const s = e && `"${e}" `;
2589
2618
  throw new Error(`${s}expected integer >= 0, got ${r}`);
2590
2619
  }
2591
2620
  }
2592
2621
  function V(r, e, s = "") {
2593
- const t = ut(r), n = r == null ? void 0 : r.length, o = e !== void 0;
2622
+ const t = ht(r), n = r == null ? void 0 : r.length, o = e !== void 0;
2594
2623
  if (!t || o && n !== e) {
2595
2624
  const i = s && `"${s}" `, a = o ? ` of length ${e}` : "", c = t ? `length=${n}` : `type=${typeof r}`;
2596
2625
  throw new Error(i + "expected Uint8Array" + a + ", got " + c);
@@ -2600,7 +2629,7 @@ function V(r, e, s = "") {
2600
2629
  function ts(r) {
2601
2630
  if (typeof r != "function" || typeof r.create != "function")
2602
2631
  throw new Error("Hash must wrapped by utils.createHasher");
2603
- ge(r.outputLen), ge(r.blockLen);
2632
+ me(r.outputLen), me(r.blockLen);
2604
2633
  }
2605
2634
  function ke(r, e = !0) {
2606
2635
  if (r.destroyed)
@@ -2621,7 +2650,7 @@ function Pe(...r) {
2621
2650
  for (let e = 0; e < r.length; e++)
2622
2651
  r[e].fill(0);
2623
2652
  }
2624
- function Ze(r) {
2653
+ function Qe(r) {
2625
2654
  return new DataView(r.buffer, r.byteOffset, r.byteLength);
2626
2655
  }
2627
2656
  function ue(r, e) {
@@ -2636,7 +2665,7 @@ function dr(r) {
2636
2665
  r[e] = lr(r[e]);
2637
2666
  return r;
2638
2667
  }
2639
- const Ct = cr ? (r) => r : dr, rs = /* @ts-ignore */ typeof Uint8Array.from([]).toHex == "function" && typeof Uint8Array.fromHex == "function", ur = /* @__PURE__ */ Array.from({ length: 256 }, (r, e) => e.toString(16).padStart(2, "0"));
2668
+ const Nt = cr ? (r) => r : dr, rs = /* @ts-ignore */ typeof Uint8Array.from([]).toHex == "function" && typeof Uint8Array.fromHex == "function", ur = /* @__PURE__ */ Array.from({ length: 256 }, (r, e) => e.toString(16).padStart(2, "0"));
2640
2669
  function Me(r) {
2641
2670
  if (V(r), rs)
2642
2671
  return r.toHex();
@@ -2673,7 +2702,7 @@ function We(r) {
2673
2702
  }
2674
2703
  return t;
2675
2704
  }
2676
- function be(...r) {
2705
+ function ve(...r) {
2677
2706
  let e = 0;
2678
2707
  for (let t = 0; t < r.length; t++) {
2679
2708
  const n = r[t];
@@ -2718,7 +2747,7 @@ class _r {
2718
2747
  E(this, "length", 0);
2719
2748
  E(this, "pos", 0);
2720
2749
  E(this, "destroyed", !1);
2721
- this.blockLen = e, this.outputLen = s, this.padOffset = t, this.isLE = n, this.buffer = new Uint8Array(e), this.view = Ze(this.buffer);
2750
+ this.blockLen = e, this.outputLen = s, this.padOffset = t, this.isLE = n, this.buffer = new Uint8Array(e), this.view = Qe(this.buffer);
2722
2751
  }
2723
2752
  update(e) {
2724
2753
  ke(this), V(e);
@@ -2726,7 +2755,7 @@ class _r {
2726
2755
  for (let i = 0; i < o; ) {
2727
2756
  const a = Math.min(n - this.pos, o - i);
2728
2757
  if (a === n) {
2729
- const c = Ze(e);
2758
+ const c = Qe(e);
2730
2759
  for (; n <= o - i; i += n)
2731
2760
  this.process(c, i);
2732
2761
  continue;
@@ -2743,7 +2772,7 @@ class _r {
2743
2772
  for (let h = i; h < n; h++)
2744
2773
  s[h] = 0;
2745
2774
  t.setBigUint64(n - 8, BigInt(this.length * 8), o), this.process(t, 0);
2746
- const a = Ze(e), c = this.outputLen;
2775
+ const a = Qe(e), c = this.outputLen;
2747
2776
  if (c % 4)
2748
2777
  throw new Error("_sha2: outputLen must be aligned to 32bit");
2749
2778
  const l = c / 4, u = this.get();
@@ -2767,7 +2796,7 @@ class _r {
2767
2796
  return this._cloneInto();
2768
2797
  }
2769
2798
  }
2770
- const me = /* @__PURE__ */ Uint32Array.from([
2799
+ const we = /* @__PURE__ */ Uint32Array.from([
2771
2800
  1779033703,
2772
2801
  3144134277,
2773
2802
  1013904242,
@@ -2854,7 +2883,7 @@ const mr = (r, e, s) => r << s | e >>> 32 - s, wr = (r, e, s) => e << s | r >>>
2854
2883
  2756734187,
2855
2884
  3204031479,
2856
2885
  3329325298
2857
- ]), we = /* @__PURE__ */ new Uint32Array(64);
2886
+ ]), ye = /* @__PURE__ */ new Uint32Array(64);
2858
2887
  class Sr extends _r {
2859
2888
  constructor(e) {
2860
2889
  super(64, e, 8, !1);
@@ -2869,20 +2898,20 @@ class Sr extends _r {
2869
2898
  }
2870
2899
  process(e, s) {
2871
2900
  for (let h = 0; h < 16; h++, s += 4)
2872
- we[h] = e.getUint32(s, !1);
2901
+ ye[h] = e.getUint32(s, !1);
2873
2902
  for (let h = 16; h < 64; h++) {
2874
- const _ = we[h - 15], f = we[h - 2], w = ue(_, 7) ^ ue(_, 18) ^ _ >>> 3, b = ue(f, 17) ^ ue(f, 19) ^ f >>> 10;
2875
- we[h] = b + we[h - 7] + w + we[h - 16] | 0;
2903
+ const _ = ye[h - 15], f = ye[h - 2], w = ue(_, 7) ^ ue(_, 18) ^ _ >>> 3, b = ue(f, 17) ^ ue(f, 19) ^ f >>> 10;
2904
+ ye[h] = b + ye[h - 7] + w + ye[h - 16] | 0;
2876
2905
  }
2877
2906
  let { A: t, B: n, C: o, D: i, E: a, F: c, G: l, H: u } = this;
2878
2907
  for (let h = 0; h < 64; h++) {
2879
- const _ = ue(a, 6) ^ ue(a, 11) ^ ue(a, 25), f = u + _ + pr(a, c, l) + vr[h] + we[h] | 0, b = (ue(t, 2) ^ ue(t, 13) ^ ue(t, 22)) + fr(t, n, o) | 0;
2908
+ const _ = ue(a, 6) ^ ue(a, 11) ^ ue(a, 25), f = u + _ + pr(a, c, l) + vr[h] + ye[h] | 0, b = (ue(t, 2) ^ ue(t, 13) ^ ue(t, 22)) + fr(t, n, o) | 0;
2880
2909
  u = l, l = c, c = a, a = i + f | 0, i = o, o = n, n = t, t = f + b | 0;
2881
2910
  }
2882
2911
  t = t + this.A | 0, n = n + this.B | 0, o = o + this.C | 0, i = i + this.D | 0, a = a + this.E | 0, c = c + this.F | 0, l = l + this.G | 0, u = u + this.H | 0, this.set(t, n, o, i, a, c, l, u);
2883
2912
  }
2884
2913
  roundClean() {
2885
- Pe(we);
2914
+ Pe(ye);
2886
2915
  }
2887
2916
  destroy() {
2888
2917
  this.set(0, 0, 0, 0, 0, 0, 0, 0), Pe(this.buffer);
@@ -2893,14 +2922,14 @@ class Er extends Sr {
2893
2922
  super(32);
2894
2923
  // We cannot use array here since array allows indexing by variable
2895
2924
  // which means optimizer/compiler cannot use registers.
2896
- E(this, "A", me[0] | 0);
2897
- E(this, "B", me[1] | 0);
2898
- E(this, "C", me[2] | 0);
2899
- E(this, "D", me[3] | 0);
2900
- E(this, "E", me[4] | 0);
2901
- E(this, "F", me[5] | 0);
2902
- E(this, "G", me[6] | 0);
2903
- E(this, "H", me[7] | 0);
2925
+ E(this, "A", we[0] | 0);
2926
+ E(this, "B", we[1] | 0);
2927
+ E(this, "C", we[2] | 0);
2928
+ E(this, "D", we[3] | 0);
2929
+ E(this, "E", we[4] | 0);
2930
+ E(this, "F", we[5] | 0);
2931
+ E(this, "G", we[6] | 0);
2932
+ E(this, "H", we[7] | 0);
2904
2933
  }
2905
2934
  }
2906
2935
  const Ir = /* @__PURE__ */ ns(
@@ -2908,7 +2937,7 @@ const Ir = /* @__PURE__ */ ns(
2908
2937
  /* @__PURE__ */ hr(1)
2909
2938
  );
2910
2939
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
2911
- const ht = /* @__PURE__ */ BigInt(0), at = /* @__PURE__ */ BigInt(1);
2940
+ const pt = /* @__PURE__ */ BigInt(0), ct = /* @__PURE__ */ BigInt(1);
2912
2941
  function qe(r, e = "") {
2913
2942
  if (typeof r != "boolean") {
2914
2943
  const s = e && `"${e}" `;
@@ -2921,7 +2950,7 @@ function is(r) {
2921
2950
  if (!Fe(r))
2922
2951
  throw new Error("positive bigint expected, got " + r);
2923
2952
  } else
2924
- ge(r);
2953
+ me(r);
2925
2954
  return r;
2926
2955
  }
2927
2956
  function Ue(r) {
@@ -2931,7 +2960,7 @@ function Ue(r) {
2931
2960
  function as(r) {
2932
2961
  if (typeof r != "string")
2933
2962
  throw new Error("hex string expected, got " + typeof r);
2934
- return r === "" ? ht : BigInt("0x" + r);
2963
+ return r === "" ? pt : BigInt("0x" + r);
2935
2964
  }
2936
2965
  function ze(r) {
2937
2966
  return as(Me(r));
@@ -2939,20 +2968,20 @@ function ze(r) {
2939
2968
  function cs(r) {
2940
2969
  return as(Me(Tr(V(r)).reverse()));
2941
2970
  }
2942
- function pt(r, e) {
2943
- ge(e), r = is(r);
2971
+ function ft(r, e) {
2972
+ me(e), r = is(r);
2944
2973
  const s = We(r.toString(16).padStart(e * 2, "0"));
2945
2974
  if (s.length !== e)
2946
2975
  throw new Error("number too large");
2947
2976
  return s;
2948
2977
  }
2949
2978
  function ls(r, e) {
2950
- return pt(r, e).reverse();
2979
+ return ft(r, e).reverse();
2951
2980
  }
2952
2981
  function Tr(r) {
2953
2982
  return Uint8Array.from(r);
2954
2983
  }
2955
- const Fe = (r) => typeof r == "bigint" && ht <= r;
2984
+ const Fe = (r) => typeof r == "bigint" && pt <= r;
2956
2985
  function Ar(r, e, s) {
2957
2986
  return Fe(r) && Fe(e) && Fe(s) && e <= r && r < s;
2958
2987
  }
@@ -2962,19 +2991,19 @@ function Rr(r, e, s, t) {
2962
2991
  }
2963
2992
  function kr(r) {
2964
2993
  let e;
2965
- for (e = 0; r > ht; r >>= at, e += 1)
2994
+ for (e = 0; r > pt; r >>= ct, e += 1)
2966
2995
  ;
2967
2996
  return e;
2968
2997
  }
2969
- const ft = (r) => (at << BigInt(r)) - at;
2998
+ const _t = (r) => (ct << BigInt(r)) - ct;
2970
2999
  function Pr(r, e, s) {
2971
- if (ge(r, "hashLen"), ge(e, "qByteLen"), typeof s != "function")
3000
+ if (me(r, "hashLen"), me(e, "qByteLen"), typeof s != "function")
2972
3001
  throw new Error("hmacFn must be a function");
2973
3002
  const t = (y) => new Uint8Array(y), n = Uint8Array.of(), o = Uint8Array.of(0), i = Uint8Array.of(1), a = 1e3;
2974
3003
  let c = t(r), l = t(r), u = 0;
2975
3004
  const h = () => {
2976
3005
  c.fill(1), l.fill(0), u = 0;
2977
- }, _ = (...y) => s(l, be(c, ...y)), f = (y = n) => {
3006
+ }, _ = (...y) => s(l, ve(c, ...y)), f = (y = n) => {
2978
3007
  l = _(o, y), c = _(), y.length !== 0 && (l = _(i, y), c = _());
2979
3008
  }, w = () => {
2980
3009
  if (u++ >= a)
@@ -2983,20 +3012,20 @@ function Pr(r, e, s) {
2983
3012
  const T = [];
2984
3013
  for (; y < e; ) {
2985
3014
  c = _();
2986
- const C = c.slice();
2987
- T.push(C), y += c.length;
3015
+ const N = c.slice();
3016
+ T.push(N), y += c.length;
2988
3017
  }
2989
- return be(...T);
3018
+ return ve(...T);
2990
3019
  };
2991
3020
  return (y, T) => {
2992
3021
  h(), f(y);
2993
- let C;
2994
- for (; !(C = T(w())); )
3022
+ let N;
3023
+ for (; !(N = T(w())); )
2995
3024
  f();
2996
- return h(), C;
3025
+ return h(), N;
2997
3026
  };
2998
3027
  }
2999
- function _t(r, e = {}, s = {}) {
3028
+ function xt(r, e = {}, s = {}) {
3000
3029
  if (!r || typeof r != "object")
3001
3030
  throw new Error("expected valid options object");
3002
3031
  function t(o, i, a) {
@@ -3021,7 +3050,7 @@ function Mt(r) {
3021
3050
  };
3022
3051
  }
3023
3052
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
3024
- const ne = /* @__PURE__ */ BigInt(0), ee = /* @__PURE__ */ BigInt(1), Ie = /* @__PURE__ */ BigInt(2), ds = /* @__PURE__ */ BigInt(3), us = /* @__PURE__ */ BigInt(4), hs = /* @__PURE__ */ BigInt(5), Or = /* @__PURE__ */ BigInt(7), ps = /* @__PURE__ */ BigInt(8), Nr = /* @__PURE__ */ BigInt(9), fs = /* @__PURE__ */ BigInt(16);
3053
+ const ne = /* @__PURE__ */ BigInt(0), ee = /* @__PURE__ */ BigInt(1), Ie = /* @__PURE__ */ BigInt(2), ds = /* @__PURE__ */ BigInt(3), us = /* @__PURE__ */ BigInt(4), hs = /* @__PURE__ */ BigInt(5), Or = /* @__PURE__ */ BigInt(7), ps = /* @__PURE__ */ BigInt(8), Cr = /* @__PURE__ */ BigInt(9), fs = /* @__PURE__ */ BigInt(16);
3025
3054
  function le(r, e) {
3026
3055
  const s = r % e;
3027
3056
  return s >= ne ? s : e + s;
@@ -3046,17 +3075,17 @@ function $t(r, e) {
3046
3075
  throw new Error("invert: does not exist");
3047
3076
  return le(n, e);
3048
3077
  }
3049
- function xt(r, e, s) {
3078
+ function gt(r, e, s) {
3050
3079
  if (!r.eql(r.sqr(e), s))
3051
3080
  throw new Error("Cannot find square root");
3052
3081
  }
3053
3082
  function _s(r, e) {
3054
3083
  const s = (r.ORDER + ee) / us, t = r.pow(e, s);
3055
- return xt(r, t, e), t;
3084
+ return gt(r, t, e), t;
3056
3085
  }
3057
- function Cr(r, e) {
3086
+ function Nr(r, e) {
3058
3087
  const s = (r.ORDER - hs) / ps, t = r.mul(e, Ie), n = r.pow(t, s), o = r.mul(e, n), i = r.mul(r.mul(o, Ie), n), a = r.mul(o, r.sub(i, r.ONE));
3059
- return xt(r, a, e), a;
3088
+ return gt(r, a, e), a;
3060
3089
  }
3061
3090
  function Lr(r) {
3062
3091
  const e = je(r), s = xs(r), t = s(e, e.neg(e.ONE)), n = s(e, t), o = s(e, e.neg(t)), i = (r + Or) / fs;
@@ -3065,7 +3094,7 @@ function Lr(r) {
3065
3094
  const h = a.mul(l, n), _ = a.mul(l, o), f = a.eql(a.sqr(u), c), w = a.eql(a.sqr(h), c);
3066
3095
  l = a.cmov(l, u, f), u = a.cmov(_, h, w);
3067
3096
  const b = a.eql(a.sqr(u), c), y = a.cmov(l, u, b);
3068
- return xt(a, y, c), y;
3097
+ return gt(a, y, c), y;
3069
3098
  };
3070
3099
  }
3071
3100
  function xs(r) {
@@ -3103,7 +3132,7 @@ function xs(r) {
3103
3132
  };
3104
3133
  }
3105
3134
  function Dr(r) {
3106
- return r % us === ds ? _s : r % ps === hs ? Cr : r % fs === Nr ? Lr(r) : xs(r);
3135
+ return r % us === ds ? _s : r % ps === hs ? Nr : r % fs === Cr ? Lr(r) : xs(r);
3107
3136
  }
3108
3137
  const Mr = [
3109
3138
  "create",
@@ -3130,7 +3159,7 @@ function $r(r) {
3130
3159
  BYTES: "number",
3131
3160
  BITS: "number"
3132
3161
  }, s = Mr.reduce((t, n) => (t[n] = "function", t), e);
3133
- return _t(r, s), r;
3162
+ return xt(r, s), r;
3134
3163
  }
3135
3164
  function Br(r, e, s) {
3136
3165
  if (s < ne)
@@ -3155,7 +3184,7 @@ function Bt(r, e) {
3155
3184
  return n ? 1 : o ? 0 : -1;
3156
3185
  }
3157
3186
  function Ur(r, e) {
3158
- e !== void 0 && ge(e);
3187
+ e !== void 0 && me(e);
3159
3188
  const s = e !== void 0 ? e : r.toString(2).length, t = Math.ceil(s / 8);
3160
3189
  return { nBitLength: s, nByteLength: t };
3161
3190
  }
@@ -3243,7 +3272,7 @@ class Hr {
3243
3272
  return this._sqrt || (this._sqrt = Dr(this.ORDER)), this._sqrt(this, e);
3244
3273
  }
3245
3274
  toBytes(e) {
3246
- return this.isLE ? ls(e, this.BYTES) : pt(e, this.BYTES);
3275
+ return this.isLE ? ls(e, this.BYTES) : ft(e, this.BYTES);
3247
3276
  }
3248
3277
  fromBytes(e, s = !1) {
3249
3278
  V(e);
@@ -3290,7 +3319,7 @@ function Fr(r, e, s = !1) {
3290
3319
  if (t < 16 || t < o || t > 1024)
3291
3320
  throw new Error("expected " + o + "-1024 bytes of input, got " + t);
3292
3321
  const i = s ? cs(r) : ze(r), a = le(i, e - ee) + ee;
3293
- return s ? ls(a, n) : pt(a, n);
3322
+ return s ? ls(a, n) : ft(a, n);
3294
3323
  }
3295
3324
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
3296
3325
  const Oe = /* @__PURE__ */ BigInt(0), Te = /* @__PURE__ */ BigInt(1);
@@ -3306,9 +3335,9 @@ function ys(r, e) {
3306
3335
  if (!Number.isSafeInteger(r) || r <= 0 || r > e)
3307
3336
  throw new Error("invalid window size, expected [1.." + e + "], got W=" + r);
3308
3337
  }
3309
- function Qe(r, e) {
3338
+ function et(r, e) {
3310
3339
  ys(r, e);
3311
- const s = Math.ceil(e / r) + 1, t = 2 ** (r - 1), n = 2 ** r, o = ft(r), i = BigInt(r);
3340
+ const s = Math.ceil(e / r) + 1, t = 2 ** (r - 1), n = 2 ** r, o = _t(r), i = BigInt(r);
3312
3341
  return { windows: s, windowSize: t, mask: o, maxNumber: n, shiftBy: i };
3313
3342
  }
3314
3343
  function Ht(r, e, s) {
@@ -3318,8 +3347,8 @@ function Ht(r, e, s) {
3318
3347
  const l = e * t, u = l + Math.abs(a) - 1, h = a === 0, _ = a < 0, f = e % 2 !== 0;
3319
3348
  return { nextN: c, offset: u, isZero: h, isNeg: _, isNegF: f, offsetF: l };
3320
3349
  }
3321
- const et = /* @__PURE__ */ new WeakMap(), bs = /* @__PURE__ */ new WeakMap();
3322
- function tt(r) {
3350
+ const tt = /* @__PURE__ */ new WeakMap(), bs = /* @__PURE__ */ new WeakMap();
3351
+ function st(r) {
3323
3352
  return bs.get(r) || 1;
3324
3353
  }
3325
3354
  function Ft(r) {
@@ -3355,7 +3384,7 @@ class Gr {
3355
3384
  * @returns precomputed point tables flattened to a single array
3356
3385
  */
3357
3386
  precomputeWindow(e, s) {
3358
- const { windows: t, windowSize: n } = Qe(s, this.bits), o = [];
3387
+ const { windows: t, windowSize: n } = et(s, this.bits), o = [];
3359
3388
  let i = e, a = i;
3360
3389
  for (let c = 0; c < t; c++) {
3361
3390
  a = i, o.push(a);
@@ -3375,7 +3404,7 @@ class Gr {
3375
3404
  if (!this.Fn.isValid(t))
3376
3405
  throw new Error("invalid scalar");
3377
3406
  let n = this.ZERO, o = this.BASE;
3378
- const i = Qe(e, this.bits);
3407
+ const i = et(e, this.bits);
3379
3408
  for (let a = 0; a < i.windows; a++) {
3380
3409
  const { nextN: c, offset: l, isZero: u, isNeg: h, isNegF: _, offsetF: f } = Ht(t, a, i);
3381
3410
  t = c, u ? o = o.add(Ke(_, s[f])) : n = n.add(Ke(h, s[l]));
@@ -3388,7 +3417,7 @@ class Gr {
3388
3417
  * @returns point
3389
3418
  */
3390
3419
  wNAFUnsafe(e, s, t, n = this.ZERO) {
3391
- const o = Qe(e, this.bits);
3420
+ const o = et(e, this.bits);
3392
3421
  for (let i = 0; i < o.windows && t !== Oe; i++) {
3393
3422
  const { nextN: a, offset: c, isZero: l, isNeg: u } = Ht(t, i, o);
3394
3423
  if (t = a, !l) {
@@ -3399,25 +3428,25 @@ class Gr {
3399
3428
  return Ft(t), n;
3400
3429
  }
3401
3430
  getPrecomputes(e, s, t) {
3402
- let n = et.get(s);
3403
- return n || (n = this.precomputeWindow(s, e), e !== 1 && (typeof t == "function" && (n = t(n)), et.set(s, n))), n;
3431
+ let n = tt.get(s);
3432
+ return n || (n = this.precomputeWindow(s, e), e !== 1 && (typeof t == "function" && (n = t(n)), tt.set(s, n))), n;
3404
3433
  }
3405
3434
  cached(e, s, t) {
3406
- const n = tt(e);
3435
+ const n = st(e);
3407
3436
  return this.wNAF(n, this.getPrecomputes(n, e, t), s);
3408
3437
  }
3409
3438
  unsafe(e, s, t, n) {
3410
- const o = tt(e);
3439
+ const o = st(e);
3411
3440
  return o === 1 ? this._unsafeLadder(e, s, n) : this.wNAFUnsafe(o, this.getPrecomputes(o, e, t), s, n);
3412
3441
  }
3413
3442
  // We calculate precomputes for elliptic curve point multiplication
3414
3443
  // using windowed method. This specifies window size and
3415
3444
  // stores precomputed values. Usually only base point would be precomputed.
3416
3445
  createCache(e, s) {
3417
- ys(s, this.bits), bs.set(e, s), et.delete(e);
3446
+ ys(s, this.bits), bs.set(e, s), tt.delete(e);
3418
3447
  }
3419
3448
  hasCache(e) {
3420
- return tt(e) !== 1;
3449
+ return st(e) !== 1;
3421
3450
  }
3422
3451
  }
3423
3452
  function Wr(r, e, s, t) {
@@ -3503,36 +3532,36 @@ const Wt = (r, e) => (r + (r >= 0 ? e : -e) / Es) / e;
3503
3532
  function Vr(r, e, s) {
3504
3533
  const [[t, n], [o, i]] = e, a = Wt(i * r, s), c = Wt(-n * r, s);
3505
3534
  let l = r - a * t - c * o, u = -a * n - c * i;
3506
- const h = l < _e, _ = u < _e;
3535
+ const h = l < xe, _ = u < xe;
3507
3536
  h && (l = -l), _ && (u = -u);
3508
- const f = ft(Math.ceil(kr(s) / 2)) + Re;
3509
- if (l < _e || l >= f || u < _e || u >= f)
3537
+ const f = _t(Math.ceil(kr(s) / 2)) + Re;
3538
+ if (l < xe || l >= f || u < xe || u >= f)
3510
3539
  throw new Error("splitScalar (endomorphism): failed, k=" + r);
3511
3540
  return { k1neg: h, k1: l, k2neg: _, k2: u };
3512
3541
  }
3513
- function ct(r) {
3542
+ function lt(r) {
3514
3543
  if (!["compact", "recovered", "der"].includes(r))
3515
3544
  throw new Error('Signature format must be "compact", "recovered", or "der"');
3516
3545
  return r;
3517
3546
  }
3518
- function st(r, e) {
3547
+ function rt(r, e) {
3519
3548
  const s = {};
3520
3549
  for (let t of Object.keys(e))
3521
3550
  s[t] = r[t] === void 0 ? e[t] : r[t];
3522
- return qe(s.lowS, "lowS"), qe(s.prehash, "prehash"), s.format !== void 0 && ct(s.format), s;
3551
+ return qe(s.lowS, "lowS"), qe(s.prehash, "prehash"), s.format !== void 0 && lt(s.format), s;
3523
3552
  }
3524
3553
  class zr extends Error {
3525
3554
  constructor(e = "") {
3526
3555
  super(e);
3527
3556
  }
3528
3557
  }
3529
- const ye = {
3558
+ const be = {
3530
3559
  // asn.1 DER encoding utils
3531
3560
  Err: zr,
3532
3561
  // Basic building block is TLV (Tag-Length-Value)
3533
3562
  _tlv: {
3534
3563
  encode: (r, e) => {
3535
- const { Err: s } = ye;
3564
+ const { Err: s } = be;
3536
3565
  if (r < 0 || r > 256)
3537
3566
  throw new s("tlv.encode: wrong tag");
3538
3567
  if (e.length & 1)
@@ -3545,7 +3574,7 @@ const ye = {
3545
3574
  },
3546
3575
  // v - value, l - left bytes (unparsed)
3547
3576
  decode(r, e) {
3548
- const { Err: s } = ye;
3577
+ const { Err: s } = be;
3549
3578
  let t = 0;
3550
3579
  if (r < 0 || r > 256)
3551
3580
  throw new s("tlv.encode: wrong tag");
@@ -3583,8 +3612,8 @@ const ye = {
3583
3612
  // - if next byte doesn't have a flag, leading zero is not allowed (minimal encoding)
3584
3613
  _int: {
3585
3614
  encode(r) {
3586
- const { Err: e } = ye;
3587
- if (r < _e)
3615
+ const { Err: e } = be;
3616
+ if (r < xe)
3588
3617
  throw new e("integer: negative integers are not allowed");
3589
3618
  let s = Ue(r);
3590
3619
  if (Number.parseInt(s[0], 16) & 8 && (s = "00" + s), s.length & 1)
@@ -3592,7 +3621,7 @@ const ye = {
3592
3621
  return s;
3593
3622
  },
3594
3623
  decode(r) {
3595
- const { Err: e } = ye;
3624
+ const { Err: e } = be;
3596
3625
  if (r[0] & 128)
3597
3626
  throw new e("invalid signature integer: negative");
3598
3627
  if (r[0] === 0 && !(r[1] & 128))
@@ -3601,7 +3630,7 @@ const ye = {
3601
3630
  }
3602
3631
  },
3603
3632
  toSig(r) {
3604
- const { Err: e, _int: s, _tlv: t } = ye, n = V(r, void 0, "signature"), { v: o, l: i } = t.decode(48, n);
3633
+ const { Err: e, _int: s, _tlv: t } = be, n = V(r, void 0, "signature"), { v: o, l: i } = t.decode(48, n);
3605
3634
  if (i.length)
3606
3635
  throw new e("invalid signature: left bytes after parsing");
3607
3636
  const { v: a, l: c } = t.decode(2, o), { v: l, l: u } = t.decode(2, c);
@@ -3610,15 +3639,15 @@ const ye = {
3610
3639
  return { r: s.decode(a), s: s.decode(l) };
3611
3640
  },
3612
3641
  hexFromSig(r) {
3613
- const { _tlv: e, _int: s } = ye, t = e.encode(2, s.encode(r.r)), n = e.encode(2, s.encode(r.s)), o = t + n;
3642
+ const { _tlv: e, _int: s } = be, t = e.encode(2, s.encode(r.r)), n = e.encode(2, s.encode(r.s)), o = t + n;
3614
3643
  return e.encode(48, o);
3615
3644
  }
3616
- }, _e = BigInt(0), Re = BigInt(1), Es = BigInt(2), He = BigInt(3), jr = BigInt(4);
3645
+ }, xe = BigInt(0), Re = BigInt(1), Es = BigInt(2), He = BigInt(3), jr = BigInt(4);
3617
3646
  function Yr(r, e = {}) {
3618
3647
  const s = qr("weierstrass", r, e), { Fp: t, Fn: n } = s;
3619
3648
  let o = s.CURVE;
3620
3649
  const { h: i, n: a } = o;
3621
- _t(e, {}, {
3650
+ xt(e, {}, {
3622
3651
  allowInfinityPoint: "boolean",
3623
3652
  clearCofactor: "function",
3624
3653
  isTorsionFree: "function",
@@ -3638,19 +3667,19 @@ function Yr(r, e = {}) {
3638
3667
  const { x: v, y: k } = x.toAffine(), D = t.toBytes(v);
3639
3668
  if (qe(g, "isCompressed"), g) {
3640
3669
  u();
3641
- const N = !t.isOdd(k);
3642
- return be(Is(N), D);
3670
+ const C = !t.isOdd(k);
3671
+ return ve(Is(C), D);
3643
3672
  } else
3644
- return be(Uint8Array.of(4), D, t.toBytes(k));
3673
+ return ve(Uint8Array.of(4), D, t.toBytes(k));
3645
3674
  }
3646
3675
  function _(I) {
3647
3676
  V(I, void 0, "Point");
3648
3677
  const { publicKey: x, publicKeyUncompressed: g } = l, v = I.length, k = I[0], D = I.subarray(1);
3649
3678
  if (v === x && (k === 2 || k === 3)) {
3650
- const N = t.fromBytes(D);
3651
- if (!t.isValid(N))
3679
+ const C = t.fromBytes(D);
3680
+ if (!t.isValid(C))
3652
3681
  throw new Error("bad point: is not on curve, wrong x");
3653
- const M = b(N);
3682
+ const M = b(C);
3654
3683
  let R;
3655
3684
  try {
3656
3685
  R = t.sqrt(M);
@@ -3660,9 +3689,9 @@ function Yr(r, e = {}) {
3660
3689
  }
3661
3690
  u();
3662
3691
  const $ = t.isOdd(R);
3663
- return (k & 1) === 1 !== $ && (R = t.neg(R)), { x: N, y: R };
3692
+ return (k & 1) === 1 !== $ && (R = t.neg(R)), { x: C, y: R };
3664
3693
  } else if (v === g && k === 4) {
3665
- const N = t.BYTES, M = t.fromBytes(D.subarray(0, N)), R = t.fromBytes(D.subarray(N, N * 2));
3694
+ const C = t.BYTES, M = t.fromBytes(D.subarray(0, C)), R = t.fromBytes(D.subarray(C, C * 2));
3666
3695
  if (!y(M, R))
3667
3696
  throw new Error("bad point: is not on curve");
3668
3697
  return { x: M, y: R };
@@ -3680,8 +3709,8 @@ function Yr(r, e = {}) {
3680
3709
  }
3681
3710
  if (!y(o.Gx, o.Gy))
3682
3711
  throw new Error("bad curve params: generator point");
3683
- const T = t.mul(t.pow(o.a, He), jr), C = t.mul(t.sqr(o.b), BigInt(27));
3684
- if (t.is0(t.add(T, C)))
3712
+ const T = t.mul(t.pow(o.a, He), jr), N = t.mul(t.sqr(o.b), BigInt(27));
3713
+ if (t.is0(t.add(T, N)))
3685
3714
  throw new Error("bad curve params: a or b");
3686
3715
  function W(I, x, g = !1) {
3687
3716
  if (!t.isValid(x) || g && t.is0(x))
@@ -3703,12 +3732,12 @@ function Yr(r, e = {}) {
3703
3732
  return { x: g, y: v };
3704
3733
  const D = I.is0();
3705
3734
  x == null && (x = D ? t.ONE : t.inv(k));
3706
- const N = t.mul(g, x), M = t.mul(v, x), R = t.mul(k, x);
3735
+ const C = t.mul(g, x), M = t.mul(v, x), R = t.mul(k, x);
3707
3736
  if (D)
3708
3737
  return { x: t.ZERO, y: t.ZERO };
3709
3738
  if (!t.eql(R, t.ONE))
3710
3739
  throw new Error("invZ was invalid");
3711
- return { x: N, y: M };
3740
+ return { x: C, y: M };
3712
3741
  }), P = Mt((I) => {
3713
3742
  if (I.is0()) {
3714
3743
  if (e.allowInfinityPoint && !t.is0(I.Y))
@@ -3783,7 +3812,7 @@ function Yr(r, e = {}) {
3783
3812
  /** Compare one point to another. */
3784
3813
  equals(x) {
3785
3814
  B(x);
3786
- const { X: g, Y: v, Z: k } = this, { X: D, Y: N, Z: M } = x, R = t.eql(t.mul(g, M), t.mul(D, k)), $ = t.eql(t.mul(v, M), t.mul(N, k));
3815
+ const { X: g, Y: v, Z: k } = this, { X: D, Y: C, Z: M } = x, R = t.eql(t.mul(g, M), t.mul(D, k)), $ = t.eql(t.mul(v, M), t.mul(C, k));
3787
3816
  return R && $;
3788
3817
  }
3789
3818
  /** Flips point to one corresponding to (x, -y) in Affine coordinates. */
@@ -3795,9 +3824,9 @@ function Yr(r, e = {}) {
3795
3824
  // https://eprint.iacr.org/2015/1060, algorithm 3
3796
3825
  // Cost: 8M + 3S + 3*a + 2*b3 + 15add.
3797
3826
  double() {
3798
- const { a: x, b: g } = o, v = t.mul(g, He), { X: k, Y: D, Z: N } = this;
3799
- let M = t.ZERO, R = t.ZERO, $ = t.ZERO, F = t.mul(k, k), J = t.mul(D, D), K = t.mul(N, N), H = t.mul(k, D);
3800
- return H = t.add(H, H), $ = t.mul(k, N), $ = t.add($, $), M = t.mul(x, $), R = t.mul(v, K), R = t.add(M, R), M = t.sub(J, R), R = t.add(J, R), R = t.mul(M, R), M = t.mul(H, M), $ = t.mul(v, $), K = t.mul(x, K), H = t.sub(F, K), H = t.mul(x, H), H = t.add(H, $), $ = t.add(F, F), F = t.add($, F), F = t.add(F, K), F = t.mul(F, H), R = t.add(R, F), K = t.mul(D, N), K = t.add(K, K), F = t.mul(K, H), M = t.sub(M, F), $ = t.mul(K, J), $ = t.add($, $), $ = t.add($, $), new A(M, R, $);
3827
+ const { a: x, b: g } = o, v = t.mul(g, He), { X: k, Y: D, Z: C } = this;
3828
+ let M = t.ZERO, R = t.ZERO, $ = t.ZERO, F = t.mul(k, k), J = t.mul(D, D), K = t.mul(C, C), H = t.mul(k, D);
3829
+ return H = t.add(H, H), $ = t.mul(k, C), $ = t.add($, $), M = t.mul(x, $), R = t.mul(v, K), R = t.add(M, R), M = t.sub(J, R), R = t.add(J, R), R = t.mul(M, R), M = t.mul(H, M), $ = t.mul(v, $), K = t.mul(x, K), H = t.sub(F, K), H = t.mul(x, H), H = t.add(H, $), $ = t.add(F, F), F = t.add($, F), F = t.add(F, K), F = t.mul(F, H), R = t.add(R, F), K = t.mul(D, C), K = t.add(K, K), F = t.mul(K, H), M = t.sub(M, F), $ = t.mul(K, J), $ = t.add($, $), $ = t.add($, $), new A(M, R, $);
3801
3830
  }
3802
3831
  // Renes-Costello-Batina exception-free addition formula.
3803
3832
  // There is 30% faster Jacobian formula, but it is not complete.
@@ -3805,13 +3834,13 @@ function Yr(r, e = {}) {
3805
3834
  // Cost: 12M + 0S + 3*a + 3*b3 + 23add.
3806
3835
  add(x) {
3807
3836
  B(x);
3808
- const { X: g, Y: v, Z: k } = this, { X: D, Y: N, Z: M } = x;
3837
+ const { X: g, Y: v, Z: k } = this, { X: D, Y: C, Z: M } = x;
3809
3838
  let R = t.ZERO, $ = t.ZERO, F = t.ZERO;
3810
3839
  const J = o.a, K = t.mul(o.b, He);
3811
- let H = t.mul(g, D), X = t.mul(v, N), Z = t.mul(k, M), oe = t.add(g, v), z = t.add(D, N);
3840
+ let H = t.mul(g, D), X = t.mul(v, C), Z = t.mul(k, M), oe = t.add(g, v), z = t.add(D, C);
3812
3841
  oe = t.mul(oe, z), z = t.add(H, X), oe = t.sub(oe, z), z = t.add(g, k);
3813
3842
  let Q = t.add(D, M);
3814
- return z = t.mul(z, Q), Q = t.add(H, Z), z = t.sub(z, Q), Q = t.add(v, k), R = t.add(N, M), Q = t.mul(Q, R), R = t.add(X, Z), Q = t.sub(Q, R), F = t.mul(J, z), R = t.mul(K, Z), F = t.add(R, F), R = t.sub(X, F), F = t.add(X, F), $ = t.mul(R, F), X = t.add(H, H), X = t.add(X, H), Z = t.mul(J, Z), z = t.mul(K, z), X = t.add(X, Z), Z = t.sub(H, Z), Z = t.mul(J, Z), z = t.add(z, Z), H = t.mul(X, z), $ = t.add($, H), H = t.mul(Q, z), R = t.mul(oe, R), R = t.sub(R, H), H = t.mul(oe, X), F = t.mul(Q, F), F = t.add(F, H), new A(R, $, F);
3843
+ return z = t.mul(z, Q), Q = t.add(H, Z), z = t.sub(z, Q), Q = t.add(v, k), R = t.add(C, M), Q = t.mul(Q, R), R = t.add(X, Z), Q = t.sub(Q, R), F = t.mul(J, z), R = t.mul(K, Z), F = t.add(R, F), R = t.sub(X, F), F = t.add(X, F), $ = t.mul(R, F), X = t.add(H, H), X = t.add(X, H), Z = t.mul(J, Z), z = t.mul(K, z), X = t.add(X, Z), Z = t.sub(H, Z), Z = t.mul(J, Z), z = t.add(z, Z), H = t.mul(X, z), $ = t.add($, H), H = t.mul(Q, z), R = t.mul(oe, R), R = t.sub(R, H), H = t.mul(oe, X), F = t.mul(Q, F), F = t.add(F, H), new A(R, $, F);
3815
3844
  }
3816
3845
  subtract(x) {
3817
3846
  return this.add(x.negate());
@@ -3833,13 +3862,13 @@ function Yr(r, e = {}) {
3833
3862
  if (!n.isValidNot0(x))
3834
3863
  throw new Error("invalid scalar: out of range");
3835
3864
  let v, k;
3836
- const D = (N) => O.cached(this, N, (M) => Ut(A, M));
3865
+ const D = (C) => O.cached(this, C, (M) => Ut(A, M));
3837
3866
  if (g) {
3838
- const { k1neg: N, k1: M, k2neg: R, k2: $ } = j(x), { p: F, f: J } = D(M), { p: K, f: H } = D($);
3839
- k = J.add(H), v = S(g.beta, F, K, N, R);
3867
+ const { k1neg: C, k1: M, k2neg: R, k2: $ } = j(x), { p: F, f: J } = D(M), { p: K, f: H } = D($);
3868
+ k = J.add(H), v = S(g.beta, F, K, C, R);
3840
3869
  } else {
3841
- const { p: N, f: M } = D(x);
3842
- v = N, k = M;
3870
+ const { p: C, f: M } = D(x);
3871
+ v = C, k = M;
3843
3872
  }
3844
3873
  return Ut(A, [v, k])[0];
3845
3874
  }
@@ -3852,15 +3881,15 @@ function Yr(r, e = {}) {
3852
3881
  const { endo: g } = e, v = this;
3853
3882
  if (!n.isValid(x))
3854
3883
  throw new Error("invalid scalar: out of range");
3855
- if (x === _e || v.is0())
3884
+ if (x === xe || v.is0())
3856
3885
  return A.ZERO;
3857
3886
  if (x === Re)
3858
3887
  return v;
3859
3888
  if (O.hasCache(this))
3860
3889
  return this.multiply(x);
3861
3890
  if (g) {
3862
- const { k1neg: k, k1: D, k2neg: N, k2: M } = j(x), { p1: R, p2: $ } = Wr(A, v, D, M);
3863
- return S(g.beta, R, $, k, N);
3891
+ const { k1neg: k, k1: D, k2neg: C, k2: M } = j(x), { p1: R, p2: $ } = Wr(A, v, D, M);
3892
+ return S(g.beta, R, $, k, C);
3864
3893
  } else
3865
3894
  return O.unsafe(v, x);
3866
3895
  }
@@ -3945,7 +3974,7 @@ function Jr(r, e = {}) {
3945
3974
  }
3946
3975
  function l(f) {
3947
3976
  const { secretKey: w, publicKey: b, publicKeyUncompressed: y } = n;
3948
- if (!ut(f) || "_lengths" in s && s._lengths || w === b)
3977
+ if (!ht(f) || "_lengths" in s && s._lengths || w === b)
3949
3978
  return;
3950
3979
  const T = V(f, void 0, "key").length;
3951
3980
  return T === b || T === y;
@@ -3966,7 +3995,7 @@ function Jr(r, e = {}) {
3966
3995
  return Object.freeze({ getPublicKey: c, getSharedSecret: u, keygen: _, Point: r, utils: h, lengths: n });
3967
3996
  }
3968
3997
  function Xr(r, e, s = {}) {
3969
- ts(e), _t(s, {}, {
3998
+ ts(e), xt(s, {}, {
3970
3999
  hmac: "function",
3971
4000
  lowS: "boolean",
3972
4001
  randomBytes: "function",
@@ -3988,12 +4017,12 @@ function Xr(r, e, s = {}) {
3988
4017
  throw new Error(`invalid signature ${x}: out of range 1..Point.Fn.ORDER`);
3989
4018
  return g;
3990
4019
  }
3991
- function C() {
4020
+ function N() {
3992
4021
  if (b)
3993
4022
  throw new Error('"recovered" sig type is not supported for cofactor >2 curves');
3994
4023
  }
3995
4024
  function W(x, g) {
3996
- ct(g);
4025
+ lt(g);
3997
4026
  const v = f.signature, k = g === "compact" ? v : g === "recovered" ? v + 1 : void 0;
3998
4027
  return V(x, k);
3999
4028
  }
@@ -4003,7 +4032,7 @@ function Xr(r, e, s = {}) {
4003
4032
  E(this, "s");
4004
4033
  E(this, "recovery");
4005
4034
  if (this.r = T("r", g), this.s = T("s", v), k != null) {
4006
- if (C(), ![0, 1, 2, 3].includes(k))
4035
+ if (N(), ![0, 1, 2, 3].includes(k))
4007
4036
  throw new Error("invalid recovery id");
4008
4037
  this.recovery = k;
4009
4038
  }
@@ -4013,12 +4042,12 @@ function Xr(r, e, s = {}) {
4013
4042
  W(g, v);
4014
4043
  let k;
4015
4044
  if (v === "der") {
4016
- const { r: R, s: $ } = ye.toSig(V(g));
4045
+ const { r: R, s: $ } = be.toSig(V(g));
4017
4046
  return new B(R, $);
4018
4047
  }
4019
4048
  v === "recovered" && (k = g[0], v = "compact", g = g.subarray(1));
4020
- const D = f.signature / 2, N = g.subarray(0, D), M = g.subarray(D, D * 2);
4021
- return new B(i.fromBytes(N), i.fromBytes(M), k);
4049
+ const D = f.signature / 2, C = g.subarray(0, D), M = g.subarray(D, D * 2);
4050
+ return new B(i.fromBytes(C), i.fromBytes(M), k);
4022
4051
  }
4023
4052
  static fromHex(g, v) {
4024
4053
  return this.fromBytes(We(g), v);
@@ -4033,10 +4062,10 @@ function Xr(r, e, s = {}) {
4033
4062
  return new B(this.r, this.s, g);
4034
4063
  }
4035
4064
  recoverPublicKey(g) {
4036
- const { r: v, s: k } = this, D = this.assertRecovery(), N = D === 2 || D === 3 ? v + a : v;
4037
- if (!o.isValid(N))
4065
+ const { r: v, s: k } = this, D = this.assertRecovery(), C = D === 2 || D === 3 ? v + a : v;
4066
+ if (!o.isValid(C))
4038
4067
  throw new Error("invalid recovery id: sig.r+curve.n != R.x");
4039
- const M = o.toBytes(N), R = r.fromBytes(be(Is((D & 1) === 0), M)), $ = i.inv(N), F = q(V(g, void 0, "msgHash")), J = i.create(-F * $), K = i.create(k * $), H = r.BASE.multiplyUnsafe(J).add(R.multiplyUnsafe(K));
4068
+ const M = o.toBytes(C), R = r.fromBytes(ve(Is((D & 1) === 0), M)), $ = i.inv(C), F = q(V(g, void 0, "msgHash")), J = i.create(-F * $), K = i.create(k * $), H = r.BASE.multiplyUnsafe(J).add(R.multiplyUnsafe(K));
4040
4069
  if (H.is0())
4041
4070
  throw new Error("invalid recovery: point at infinify");
4042
4071
  return H.assertValidity(), H;
@@ -4046,10 +4075,10 @@ function Xr(r, e, s = {}) {
4046
4075
  return y(this.s);
4047
4076
  }
4048
4077
  toBytes(g = w.format) {
4049
- if (ct(g), g === "der")
4050
- return We(ye.hexFromSig(this));
4051
- const { r: v, s: k } = this, D = i.toBytes(v), N = i.toBytes(k);
4052
- return g === "recovered" ? (C(), be(Uint8Array.of(this.assertRecovery()), D, N)) : be(D, N);
4078
+ if (lt(g), g === "der")
4079
+ return We(be.hexFromSig(this));
4080
+ const { r: v, s: k } = this, D = i.toBytes(v), C = i.toBytes(k);
4081
+ return g === "recovered" ? (N(), ve(Uint8Array.of(this.assertRecovery()), D, C)) : ve(D, C);
4053
4082
  }
4054
4083
  toHex(g) {
4055
4084
  return Me(this.toBytes(g));
@@ -4062,37 +4091,37 @@ function Xr(r, e, s = {}) {
4062
4091
  return k > 0 ? v >> BigInt(k) : v;
4063
4092
  }, q = s.bits2int_modN || function(g) {
4064
4093
  return i.create(j(g));
4065
- }, P = ft(c);
4094
+ }, P = _t(c);
4066
4095
  function S(x) {
4067
- return Rr("num < 2^" + c, x, _e, P), i.toBytes(x);
4096
+ return Rr("num < 2^" + c, x, xe, P), i.toBytes(x);
4068
4097
  }
4069
4098
  function L(x, g) {
4070
4099
  return V(x, void 0, "message"), g ? V(e(x), void 0, "prehashed message") : x;
4071
4100
  }
4072
4101
  function G(x, g, v) {
4073
- const { lowS: k, prehash: D, extraEntropy: N } = st(v, w);
4102
+ const { lowS: k, prehash: D, extraEntropy: C } = rt(v, w);
4074
4103
  x = L(x, D);
4075
4104
  const M = q(x), R = i.fromBytes(g);
4076
4105
  if (!i.isValidNot0(R))
4077
4106
  throw new Error("invalid private key");
4078
4107
  const $ = [S(R), S(M)];
4079
- if (N != null && N !== !1) {
4080
- const H = N === !0 ? t(f.secretKey) : N;
4108
+ if (C != null && C !== !1) {
4109
+ const H = C === !0 ? t(f.secretKey) : C;
4081
4110
  $.push(V(H, void 0, "extraEntropy"));
4082
4111
  }
4083
- const F = be(...$), J = M;
4112
+ const F = ve(...$), J = M;
4084
4113
  function K(H) {
4085
4114
  const X = j(H);
4086
4115
  if (!i.isValidNot0(X))
4087
4116
  return;
4088
4117
  const Z = i.inv(X), oe = r.BASE.multiply(X).toAffine(), z = i.create(oe.x);
4089
- if (z === _e)
4118
+ if (z === xe)
4090
4119
  return;
4091
4120
  const Q = i.create(Z * i.create(J + z * R));
4092
- if (Q === _e)
4121
+ if (Q === xe)
4093
4122
  return;
4094
- let yt = (oe.x === z ? 0 : 2) | Number(oe.y & Re), bt = Q;
4095
- return k && y(Q) && (bt = i.neg(Q), yt ^= 1), new B(z, bt, b ? void 0 : yt);
4123
+ let bt = (oe.x === z ? 0 : 2) | Number(oe.y & Re), vt = Q;
4124
+ return k && y(Q) && (vt = i.neg(Q), bt ^= 1), new B(z, vt, b ? void 0 : bt);
4096
4125
  }
4097
4126
  return { seed: F, k2sig: K };
4098
4127
  }
@@ -4101,8 +4130,8 @@ function Xr(r, e, s = {}) {
4101
4130
  return Pr(e.outputLen, i.BYTES, n)(k, D).toBytes(v.format);
4102
4131
  }
4103
4132
  function A(x, g, v, k = {}) {
4104
- const { lowS: D, prehash: N, format: M } = st(k, w);
4105
- if (v = V(v, void 0, "publicKey"), g = L(g, N), !ut(x)) {
4133
+ const { lowS: D, prehash: C, format: M } = rt(k, w);
4134
+ if (v = V(v, void 0, "publicKey"), g = L(g, C), !ht(x)) {
4106
4135
  const R = x instanceof B ? ", use sig.toBytes()" : "";
4107
4136
  throw new Error("verify expects Uint8Array signature" + R);
4108
4137
  }
@@ -4118,7 +4147,7 @@ function Xr(r, e, s = {}) {
4118
4147
  }
4119
4148
  }
4120
4149
  function I(x, g, v = {}) {
4121
- const { prehash: k } = st(v, w);
4150
+ const { prehash: k } = rt(v, w);
4122
4151
  return g = L(g, k), B.fromBytes(x, "recovered").recoverPublicKey(g).toBytes();
4123
4152
  }
4124
4153
  return Object.freeze({
@@ -4136,7 +4165,7 @@ function Xr(r, e, s = {}) {
4136
4165
  });
4137
4166
  }
4138
4167
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
4139
- const gt = {
4168
+ const mt = {
4140
4169
  p: BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),
4141
4170
  n: BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),
4142
4171
  h: BigInt(1),
@@ -4152,20 +4181,20 @@ const gt = {
4152
4181
  ]
4153
4182
  }, qt = /* @__PURE__ */ BigInt(2);
4154
4183
  function Qr(r) {
4155
- const e = gt.p, s = BigInt(3), t = BigInt(6), n = BigInt(11), o = BigInt(22), i = BigInt(23), a = BigInt(44), c = BigInt(88), l = r * r * r % e, u = l * l * r % e, h = ae(u, s, e) * u % e, _ = ae(h, s, e) * u % e, f = ae(_, qt, e) * l % e, w = ae(f, n, e) * f % e, b = ae(w, o, e) * w % e, y = ae(b, a, e) * b % e, T = ae(y, c, e) * y % e, C = ae(T, a, e) * b % e, W = ae(C, s, e) * u % e, B = ae(W, i, e) * w % e, j = ae(B, t, e) * l % e, q = ae(j, qt, e);
4156
- if (!lt.eql(lt.sqr(q), r))
4184
+ const e = mt.p, s = BigInt(3), t = BigInt(6), n = BigInt(11), o = BigInt(22), i = BigInt(23), a = BigInt(44), c = BigInt(88), l = r * r * r % e, u = l * l * r % e, h = ae(u, s, e) * u % e, _ = ae(h, s, e) * u % e, f = ae(_, qt, e) * l % e, w = ae(f, n, e) * f % e, b = ae(w, o, e) * w % e, y = ae(b, a, e) * b % e, T = ae(y, c, e) * y % e, N = ae(T, a, e) * b % e, W = ae(N, s, e) * u % e, B = ae(W, i, e) * w % e, j = ae(B, t, e) * l % e, q = ae(j, qt, e);
4185
+ if (!dt.eql(dt.sqr(q), r))
4157
4186
  throw new Error("Cannot find square root");
4158
4187
  return q;
4159
4188
  }
4160
- const lt = je(gt.p, { sqrt: Qr }), en = /* @__PURE__ */ Yr(gt, {
4161
- Fp: lt,
4189
+ const dt = je(mt.p, { sqrt: Qr }), en = /* @__PURE__ */ Yr(mt, {
4190
+ Fp: dt,
4162
4191
  endo: Zr
4163
- }), tn = /* @__PURE__ */ Xr(en, Ir), sn = BigInt(0), Ne = BigInt(1), rn = BigInt(2), nn = BigInt(7), on = BigInt(256), an = BigInt(113), As = [], Rs = [], ks = [];
4164
- for (let r = 0, e = Ne, s = 1, t = 0; r < 24; r++) {
4192
+ }), tn = /* @__PURE__ */ Xr(en, Ir), sn = BigInt(0), Ce = BigInt(1), rn = BigInt(2), nn = BigInt(7), on = BigInt(256), an = BigInt(113), As = [], Rs = [], ks = [];
4193
+ for (let r = 0, e = Ce, s = 1, t = 0; r < 24; r++) {
4165
4194
  [s, t] = [t, (2 * s + 3 * t) % 5], As.push(2 * (5 * t + s)), Rs.push((r + 1) * (r + 2) / 2 % 64);
4166
4195
  let n = sn;
4167
4196
  for (let o = 0; o < 7; o++)
4168
- e = (e << Ne ^ (e >> nn) * an) % on, e & rn && (n ^= Ne << (Ne << BigInt(o)) - Ne);
4197
+ e = (e << Ce ^ (e >> nn) * an) % on, e & rn && (n ^= Ce << (Ce << BigInt(o)) - Ce);
4169
4198
  ks.push(n);
4170
4199
  }
4171
4200
  const Ps = gr(ks, !0), cn = Ps[0], ln = Ps[1], Kt = (r, e, s) => s > 32 ? yr(r, e, s) : mr(r, e, s), Vt = (r, e, s) => s > 32 ? br(r, e, s) : wr(r, e, s);
@@ -4194,7 +4223,7 @@ function dn(r, e = 24) {
4194
4223
  }
4195
4224
  Pe(s);
4196
4225
  }
4197
- class mt {
4226
+ class wt {
4198
4227
  // NOTE: we accept arguments in bytes instead of bits here.
4199
4228
  constructor(e, s, t, n = !1, o = 24) {
4200
4229
  E(this, "state");
@@ -4208,7 +4237,7 @@ class mt {
4208
4237
  E(this, "outputLen");
4209
4238
  E(this, "enableXOF", !1);
4210
4239
  E(this, "rounds");
4211
- if (this.blockLen = e, this.suffix = s, this.outputLen = t, this.enableXOF = n, this.rounds = o, ge(t, "outputLen"), !(0 < e && e < 200))
4240
+ if (this.blockLen = e, this.suffix = s, this.outputLen = t, this.enableXOF = n, this.rounds = o, me(t, "outputLen"), !(0 < e && e < 200))
4212
4241
  throw new Error("only keccak-f1600 function is supported");
4213
4242
  this.state = new Uint8Array(200), this.state32 = ar(this.state);
4214
4243
  }
@@ -4216,7 +4245,7 @@ class mt {
4216
4245
  return this._cloneInto();
4217
4246
  }
4218
4247
  keccak() {
4219
- Ct(this.state32), dn(this.state32, this.rounds), Ct(this.state32), this.posOut = 0, this.pos = 0;
4248
+ Nt(this.state32), dn(this.state32, this.rounds), Nt(this.state32), this.posOut = 0, this.pos = 0;
4220
4249
  }
4221
4250
  update(e) {
4222
4251
  ke(this), V(e);
@@ -4252,7 +4281,7 @@ class mt {
4252
4281
  return this.writeInto(e);
4253
4282
  }
4254
4283
  xof(e) {
4255
- return ge(e), this.xofInto(new Uint8Array(e));
4284
+ return me(e), this.xofInto(new Uint8Array(e));
4256
4285
  }
4257
4286
  digestInto(e) {
4258
4287
  if (ss(e, this), this.finished)
@@ -4267,10 +4296,10 @@ class mt {
4267
4296
  }
4268
4297
  _cloneInto(e) {
4269
4298
  const { blockLen: s, suffix: t, outputLen: n, rounds: o, enableXOF: i } = this;
4270
- return e || (e = new mt(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;
4299
+ return e || (e = new wt(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;
4271
4300
  }
4272
4301
  }
4273
- const un = (r, e, s, t = {}) => ns(() => new mt(e, r, s), t), zt = /* @__PURE__ */ un(1, 136, 32), hn = 60;
4302
+ const un = (r, e, s, t = {}) => ns(() => new wt(e, r, s), t), zt = /* @__PURE__ */ un(1, 136, 32), hn = 60;
4274
4303
  class pn {
4275
4304
  constructor() {
4276
4305
  this.jwks = null;
@@ -4490,7 +4519,7 @@ class Ee {
4490
4519
  d.warn("[CROSSx] OAuth 타임아웃 (5분) — postMessage를 수신하지 못했습니다"), B(), t(new Error("Authentication timeout"));
4491
4520
  }, 5 * 60 * 1e3), w = 10, b = 30;
4492
4521
  let y = 0, T = null;
4493
- const C = () => {
4522
+ const N = () => {
4494
4523
  clearInterval(W), d.warn("[CROSSx] COOP 감지 — OAuth 서버 응답을 " + b + "초간 대기합니다"), T = setTimeout(() => {
4495
4524
  B(), t(new Error(
4496
4525
  "OAuth 서버로부터 응답을 받지 못했습니다. 브라우저 보안 정책(COOP)으로 인해 팝업 통신이 차단되었을 수 있습니다. 다시 시도해 주세요."
@@ -4499,9 +4528,9 @@ class Ee {
4499
4528
  }, W = setInterval(() => {
4500
4529
  y++;
4501
4530
  try {
4502
- _.closed && (y <= w ? C() : (B(), t(new Error("로그인이 취소되었습니다"))));
4531
+ _.closed && (y <= w ? N() : (B(), t(new Error("로그인이 취소되었습니다"))));
4503
4532
  } catch {
4504
- C();
4533
+ N();
4505
4534
  }
4506
4535
  }, 1e3), B = () => {
4507
4536
  clearTimeout(f), clearInterval(W), T && clearTimeout(T), window.removeEventListener("message", j);
@@ -4552,7 +4581,7 @@ class Ee {
4552
4581
  });
4553
4582
  }
4554
4583
  }
4555
- const Ce = "crossx_wallet_data", Ae = "crossx_mock_pin_hash";
4584
+ const Ne = "crossx_wallet_data", Ae = "crossx_mock_pin_hash";
4556
4585
  class wn {
4557
4586
  constructor(e, s) {
4558
4587
  this.storage = e, this.pinStore = s ?? null;
@@ -4566,13 +4595,13 @@ class wn {
4566
4595
  async checkWallet() {
4567
4596
  if (this.migrateScenario !== void 0)
4568
4597
  return d.log("[Mock] checkWallet → migration_required"), "migration_required";
4569
- const s = await this.storage.get(Ce) ? "exists" : "not_found";
4598
+ const s = await this.storage.get(Ne) ? "exists" : "not_found";
4570
4599
  return d.log(`[Mock] checkWallet → ${s}`), s;
4571
4600
  }
4572
4601
  async getOrCreateWallet(e) {
4573
4602
  var s;
4574
4603
  try {
4575
- const t = await this.storage.get(Ce);
4604
+ const t = await this.storage.get(Ne);
4576
4605
  if (t) return t;
4577
4606
  const n = {
4578
4607
  id: e,
@@ -4580,7 +4609,7 @@ class wn {
4580
4609
  derivationPath: "m/44'/60'/0'/0/0",
4581
4610
  createdAt: Date.now()
4582
4611
  };
4583
- await this.storage.set(Ce, n);
4612
+ await this.storage.set(Ne, n);
4584
4613
  const o = (s = this.pinStore) == null ? void 0 : s.get();
4585
4614
  return o && (await this.storage.set(Ae, o), d.log("[Mock] 지갑 생성 — PIN 저장됨")), n;
4586
4615
  } catch (t) {
@@ -4589,7 +4618,7 @@ class wn {
4589
4618
  }
4590
4619
  /** GET /mnemonic/addresses 모킹 — PIN 불필요, 캐시된 주소 반환 */
4591
4620
  async getAddresses(e) {
4592
- const s = await this.storage.get(Ce);
4621
+ const s = await this.storage.get(Ne);
4593
4622
  return s ? [{ address: s.address, index: 0 }] : [];
4594
4623
  }
4595
4624
  async getAddress(e, s) {
@@ -4669,7 +4698,7 @@ class wn {
4669
4698
  derivationPath: "m/44'/60'/0'/0/0",
4670
4699
  createdAt: Date.now()
4671
4700
  };
4672
- await this.storage.set(Ce, t);
4701
+ await this.storage.set(Ne, t);
4673
4702
  const n = (o = this.pinStore) == null ? void 0 : o.get();
4674
4703
  return n && (await this.storage.set(Ae, n), d.log("[Mock] 마이그레이션 — PIN 저장됨")), t;
4675
4704
  }
@@ -4770,8 +4799,8 @@ class Le {
4770
4799
  const w = Le.mapGatewayError(_.code, _.data);
4771
4800
  if (w === p.AUTH_NOT_AUTHENTICATED && !n && this._onTokenRefresh && (d.warn("[CROSSx] Gateway -10002 감지 — 토큰 갱신 후 재시도"), await this.deduplicatedRefresh()))
4772
4801
  return this.request(e, s, t, !0);
4773
- const b = Le.getGatewayErrorMessage(_.code, f), y = _.data, T = w === p.PIN_LOCKED ? Le.extractLockDetails(y) : y ?? void 0, C = new m(w, b, T);
4774
- throw w === p.AUTH_NOT_AUTHENTICATED && this._onUnauthorized && (d.warn("[CROSSx] Gateway -10002 갱신 재시도 실패 — 강제 로그아웃 실행"), this._onUnauthorized()), C;
4802
+ const b = Le.getGatewayErrorMessage(_.code, f), y = _.data, T = w === p.PIN_LOCKED ? Le.extractLockDetails(y) : y ?? void 0, N = new m(w, b, T);
4803
+ throw w === p.AUTH_NOT_AUTHENTICATED && this._onUnauthorized && (d.warn("[CROSSx] Gateway -10002 갱신 재시도 실패 — 강제 로그아웃 실행"), this._onUnauthorized()), N;
4775
4804
  }
4776
4805
  return d.log("[CROSSx] Wallet Gateway API 성공:", { code: _.code, url: i, method: e }), _.data ?? _;
4777
4806
  }
@@ -7041,7 +7070,7 @@ function vn(r, e = "CROSS", s = 18) {
7041
7070
  try {
7042
7071
  const t = BigInt(r);
7043
7072
  if (t === 0n) return null;
7044
- const n = dt(t, s);
7073
+ const n = ut(t, s);
7045
7074
  return n === "0" ? null : `${n} ${e}`;
7046
7075
  } catch {
7047
7076
  return null;
@@ -7074,12 +7103,12 @@ function Os(r) {
7074
7103
  const e = parseInt(r.split(":")[1] ?? "", 10);
7075
7104
  return !isNaN(e) && Xt[e] ? Xt[e] : r;
7076
7105
  }
7077
- function dt(r, e) {
7106
+ function ut(r, e) {
7078
7107
  if (r === 0n) return "0";
7079
7108
  const s = 10n ** BigInt(e), t = r / s, i = (r % s).toString().padStart(e, "0").slice(0, 6).replace(/0+$/, "");
7080
7109
  return i ? `${t}.${i}` : `${t}`;
7081
7110
  }
7082
- function rt(r) {
7111
+ function nt(r) {
7083
7112
  try {
7084
7113
  const e = BigInt(r), s = e / 1000000000n, n = (e % 1000000000n).toString().padStart(9, "0").slice(0, 2).replace(/0+$/, "");
7085
7114
  return n ? `${s}.${n}` : `${s}`;
@@ -7103,9 +7132,9 @@ function En(r) {
7103
7132
  const l = a * BigInt(t);
7104
7133
  return {
7105
7134
  isDynamic: !0,
7106
- estTxFee: `${dt(l, i)} ${o}`,
7107
- maxFeeGwei: rt(t),
7108
- maxPriorityFeeGwei: n ? rt(n) : void 0,
7135
+ estTxFee: `${ut(l, i)} ${o}`,
7136
+ maxFeeGwei: nt(t),
7137
+ maxPriorityFeeGwei: n ? nt(n) : void 0,
7109
7138
  gasLimitFormatted: c
7110
7139
  };
7111
7140
  }
@@ -7113,8 +7142,8 @@ function En(r) {
7113
7142
  const l = a * BigInt(s);
7114
7143
  return {
7115
7144
  isDynamic: !1,
7116
- estTxFee: `${dt(l, i)} ${o}`,
7117
- gasPriceGwei: rt(s),
7145
+ estTxFee: `${ut(l, i)} ${o}`,
7146
+ gasPriceGwei: nt(s),
7118
7147
  gasLimitFormatted: c
7119
7148
  };
7120
7149
  }
@@ -7123,13 +7152,13 @@ function En(r) {
7123
7152
  return null;
7124
7153
  }
7125
7154
  }
7126
- function Ns(r) {
7155
+ function Cs(r) {
7127
7156
  const e = En(r);
7128
7157
  if (!e) return Y("Estimated fee", "<span>—</span>");
7129
7158
  let s = Y("Est. Tx Fee", `<span>${e.estTxFee}</span>`);
7130
7159
  return e.isDynamic ? (e.maxPriorityFeeGwei !== void 0 && (s += Y("Max Priority Fee", `<span>${e.maxPriorityFeeGwei} Gwei</span>`)), e.maxFeeGwei !== void 0 && (s += Y("Max Gas Fee", `<span>${e.maxFeeGwei} Gwei</span>`))) : e.gasPriceGwei !== void 0 && (s += Y("Gas Price", `<span>${e.gasPriceGwei} Gwei</span>`)), e.gasLimitFormatted && (s += Y("Gas Limit", `<span>${e.gasLimitFormatted}</span>`)), s;
7131
7160
  }
7132
- const xe = `<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
7161
+ const ge = `<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
7133
7162
  <rect x="9" y="9" width="13" height="13" rx="2"/>
7134
7163
  <path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/>
7135
7164
  </svg>`, ie = `<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round">
@@ -7138,7 +7167,7 @@ const xe = `<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="
7138
7167
  </svg>`, In = `<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
7139
7168
  <circle cx="20" cy="20" r="20" fill="#00D5AA"/>
7140
7169
  <path fill-rule="evenodd" clip-rule="evenodd" d="M20.3225 2.85742L23.7249 6.25982V11.8301L28.1175 7.43757L32.9292 12.2493L28.5806 16.5979H20.3225C18.4435 16.5979 16.9201 18.1212 16.9201 20.0003C16.9201 21.8794 18.4434 23.4027 20.3225 23.4027H28.5372L32.9293 27.7948L28.1176 32.6066L23.7249 28.2139V33.7407L20.3225 37.1431L16.9201 33.7407V28.2584L12.5719 32.6066L7.76022 27.7948L12.1524 23.4027H6.58209L3.17969 20.0003L6.58209 16.5979H12.1089L7.76035 12.2493L12.5721 7.43757L16.9201 11.7857V6.25982L20.3225 2.85742Z" fill="#121212"/>
7141
- </svg>`, wt = `<svg width="20" height="20" viewBox="0 0 20 20" fill="none">
7170
+ </svg>`, yt = `<svg width="20" height="20" viewBox="0 0 20 20" fill="none">
7142
7171
  <rect x="2" y="5" width="16" height="12" rx="2" stroke="currentColor" stroke-width="1.5"/>
7143
7172
  <path d="M2 9h16" stroke="currentColor" stroke-width="1.5"/>
7144
7173
  <rect x="12.5" y="11.5" width="3.5" height="2.5" rx="0.75" fill="currentColor"/>
@@ -7184,7 +7213,7 @@ function Y(r, e) {
7184
7213
  }
7185
7214
  function Rn(r, e) {
7186
7215
  const s = e, t = Ye(r.dappName), n = r.to ? `<span class="__crossx-addr-text">${se(r.to)}</span>
7187
- <button class="__crossx-copy-btn" data-copy="${U(r.to)}" title="Copy address">${xe}</button>` : "<span>—</span>", o = Ns(r), i = r.data ?? "0x", a = document.createElement("div");
7216
+ <button class="__crossx-copy-btn" data-copy="${U(r.to)}" title="Copy address">${ge}</button>` : "<span>—</span>", o = Cs(r), i = r.data ?? "0x", a = document.createElement("div");
7188
7217
  return a.id = te, a.innerHTML = `
7189
7218
  <div class="__crossx-card __crossx-card--migration __crossx-card--sign-tx" style="${ce(s)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
7190
7219
  <div class="__crossx-header">
@@ -7199,7 +7228,7 @@ function Rn(r, e) {
7199
7228
  <span class="__crossx-sig-origin">${U(t)} </span>is requesting a Signature
7200
7229
  </p>
7201
7230
  <div class="__crossx-addr-pill">
7202
- ${wt}
7231
+ ${yt}
7203
7232
  <span class="__crossx-addr-pill-text">${se(r.from)}</span>
7204
7233
  </div>
7205
7234
  <p class="__crossx-warning">After you sign, changes or cancellations are not possible.</p>
@@ -7224,7 +7253,7 @@ function Rn(r, e) {
7224
7253
  }
7225
7254
  function kn(r, e) {
7226
7255
  const s = e, t = r.nativeSymbol ?? "ETH", n = r.nativeDecimals ?? 18, o = Ye(r.dappName), i = r.to ? `<span class="__crossx-addr-text">${se(r.to)}</span>
7227
- <button class="__crossx-copy-btn" data-copy="${U(r.to)}" title="Copy address">${xe}</button>` : "<span>—</span>", a = Ns(r), l = vn(r.value, t, n) ?? "—", u = document.createElement("div");
7256
+ <button class="__crossx-copy-btn" data-copy="${U(r.to)}" title="Copy address">${ge}</button>` : "<span>—</span>", a = Cs(r), l = vn(r.value, t, n) ?? "—", u = document.createElement("div");
7228
7257
  return u.id = te, u.innerHTML = `
7229
7258
  <div class="__crossx-card __crossx-card--migration __crossx-card--send-tx" style="${ce(s)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
7230
7259
  <div class="__crossx-header">
@@ -7276,14 +7305,14 @@ function On(r) {
7276
7305
  return String(r);
7277
7306
  }
7278
7307
  }
7279
- function Nn(r, e) {
7308
+ function Cn(r, e) {
7280
7309
  const s = Y(
7281
7310
  "From",
7282
7311
  `<span class="__crossx-addr-text">${se(r.from)}</span>
7283
- <button class="__crossx-copy-btn" data-copy="${U(r.from)}" title="Copy address">${xe}</button>`
7312
+ <button class="__crossx-copy-btn" data-copy="${U(r.from)}" title="Copy address">${ge}</button>`
7284
7313
  ), t = r.to ? Y("To", `<span class="__crossx-addr-text">${se(r.to)}</span>
7285
- <button class="__crossx-copy-btn" data-copy="${U(r.to)}" title="Copy address">${xe}</button>`) : "", n = r.amount ? Y("Transfer", `<span>${U(r.amount)}</span>`) : "", o = r.fees ? Y("Tx Fee", `<span>${U(r.fees)}</span>`) : "", i = r.txHash ? Y("Tx Hash", `<span class="__crossx-addr-text">${se(r.txHash)}</span>
7286
- <button class="__crossx-copy-btn" data-copy="${U(r.txHash)}" title="Copy hash">${xe}</button>`) : "", a = r.total ? `<div class="__crossx-total-pill">
7314
+ <button class="__crossx-copy-btn" data-copy="${U(r.to)}" title="Copy address">${ge}</button>`) : "", n = r.amount ? Y("Transfer", `<span>${U(r.amount)}</span>`) : "", o = r.fees ? Y("Tx Fee", `<span>${U(r.fees)}</span>`) : "", i = r.txHash ? Y("Tx Hash", `<span class="__crossx-addr-text">${se(r.txHash)}</span>
7315
+ <button class="__crossx-copy-btn" data-copy="${U(r.txHash)}" title="Copy hash">${ge}</button>`) : "", a = r.total ? `<div class="__crossx-total-pill">
7287
7316
  <span class="__crossx-total-label">Total<br>(including fees)</span>
7288
7317
  <span class="__crossx-total-amount">${U(r.total)}</span>
7289
7318
  </div>` : "", c = document.createElement("div");
@@ -7308,7 +7337,7 @@ function Nn(r, e) {
7308
7337
  </div>
7309
7338
  `, c;
7310
7339
  }
7311
- function Cn(r, e) {
7340
+ function Nn(r, e) {
7312
7341
  const s = document.createElement("div");
7313
7342
  return s.id = te, s.innerHTML = `
7314
7343
  <div class="__crossx-card __crossx-card--migration" style="${ce(e)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
@@ -7338,9 +7367,9 @@ function Ln(r, e, s) {
7338
7367
  const a = r.querySelector("#__crossx-progress-body");
7339
7368
  if (!a) return;
7340
7369
  const c = e.from ? Y("From", `<span class="__crossx-addr-text">${se(e.from)}</span>
7341
- <button class="__crossx-copy-btn" data-copy="${U(e.from)}" title="Copy address">${xe}</button>`) : "", l = e.to ? Y("To", `<span class="__crossx-addr-text">${se(e.to)}</span>
7342
- <button class="__crossx-copy-btn" data-copy="${U(e.to)}" title="Copy address">${xe}</button>`) : "", u = e.amount ? Y("Transfer", `<span>${U(e.amount)}</span>`) : "", h = e.fees ? Y("Tx Fee", `<span>${U(e.fees)}</span>`) : "", _ = e.txHash ? Y("Tx Hash", `<span class="__crossx-addr-text">${se(e.txHash)}</span>
7343
- <button class="__crossx-copy-btn" data-copy="${U(e.txHash)}" title="Copy hash">${xe}</button>`) : "", f = e.total ? `<div class="__crossx-total-pill">
7370
+ <button class="__crossx-copy-btn" data-copy="${U(e.from)}" title="Copy address">${ge}</button>`) : "", l = e.to ? Y("To", `<span class="__crossx-addr-text">${se(e.to)}</span>
7371
+ <button class="__crossx-copy-btn" data-copy="${U(e.to)}" title="Copy address">${ge}</button>`) : "", u = e.amount ? Y("Transfer", `<span>${U(e.amount)}</span>`) : "", h = e.fees ? Y("Tx Fee", `<span>${U(e.fees)}</span>`) : "", _ = e.txHash ? Y("Tx Hash", `<span class="__crossx-addr-text">${se(e.txHash)}</span>
7372
+ <button class="__crossx-copy-btn" data-copy="${U(e.txHash)}" title="Copy hash">${ge}</button>`) : "", f = e.total ? `<div class="__crossx-total-pill">
7344
7373
  <span class="__crossx-total-label">Total<br>(including fees)</span>
7345
7374
  <span class="__crossx-total-amount">${U(e.total)}</span>
7346
7375
  </div>` : "";
@@ -7380,7 +7409,7 @@ function Dn(r, e) {
7380
7409
  <span class="__crossx-sig-origin">${U(t)} </span>is requesting a Signature
7381
7410
  </p>
7382
7411
  <div class="__crossx-addr-pill">
7383
- ${wt}
7412
+ ${yt}
7384
7413
  <span class="__crossx-addr-pill-text">${se(r.from)}</span>
7385
7414
  </div>
7386
7415
  <p class="__crossx-warning">After you sign, changes or cancellations are not possible.</p>
@@ -7413,7 +7442,7 @@ function Mn(r, e) {
7413
7442
  </div>`;
7414
7443
  for (const [l, u] of Object.entries(i)) {
7415
7444
  const h = On(u), f = Pn(u) ? `<span class="__crossx-addr-text">${se(u)}</span>
7416
- <button class="__crossx-copy-btn" data-copy="${U(String(u))}" title="Copy">${xe}</button>` : `<span>${h}</span>`;
7445
+ <button class="__crossx-copy-btn" data-copy="${U(String(u))}" title="Copy">${ge}</button>` : `<span>${h}</span>`;
7417
7446
  a += `
7418
7447
  <div class="__crossx-td-row">
7419
7448
  <span class="__crossx-td-label">${U(l)}</span>
@@ -7435,7 +7464,7 @@ function Mn(r, e) {
7435
7464
  <span class="__crossx-sig-origin">${U(t)} </span>is requesting a Signature
7436
7465
  </p>
7437
7466
  <div class="__crossx-addr-pill">
7438
- ${wt}
7467
+ ${yt}
7439
7468
  <span class="__crossx-addr-pill-text">${se(r.from)}</span>
7440
7469
  </div>
7441
7470
  <p class="__crossx-warning">After you sign, changes or cancellations are not possible.</p>
@@ -7662,9 +7691,9 @@ function Vn(r) {
7662
7691
  <div class="__crossx-home-indicator"></div>
7663
7692
  `;
7664
7693
  }
7665
- function nt(r) {
7694
+ function ot(r) {
7666
7695
  const e = !!r.lockExpiresAt && r.lockExpiresAt > Date.now(), s = r.lockExpiresAt ? ` data-lock-expires="${r.lockExpiresAt}"` : "", t = r.headerSubtitle ? `<p class="__crossx-pin6-header-sub">${U(r.headerSubtitle)}</p>` : "", n = r.subtitle ? `<p class="__crossx-pin6-subtitle">${U(r.subtitle)}</p>` : "", o = r.errorMessage ? `<p class="__crossx-pin6-error" id="__crossx-pin6-error">${U(r.errorMessage)}</p>` : '<p class="__crossx-pin6-error" id="__crossx-pin6-error"></p>', i = e ? `<p class="__crossx-pin6-lock-msg" id="__crossx-pin6-lock-msg">
7667
- ${Cs}
7696
+ ${Ns}
7668
7697
  <span id="__crossx-pin6-lock-countdown"></span>
7669
7698
  </p>` : "", a = e ? " --locked" : "", c = Array.from(
7670
7699
  { length: 6 },
@@ -7707,7 +7736,7 @@ function jn(r) {
7707
7736
  const e = Math.max(0, Math.ceil(r / 1e3)), s = Math.floor(e / 3600), t = Math.floor(e % 3600 / 60), n = e % 60;
7708
7737
  return s > 0 ? `${s}h ${String(t).padStart(2, "0")}m` : `${String(t).padStart(2, "0")}:${String(n).padStart(2, "0")}`;
7709
7738
  }
7710
- function ot(r, e, s, t, n, o) {
7739
+ function it(r, e, s, t, n, o) {
7711
7740
  var j, q;
7712
7741
  let i = !!(o && o > Date.now()), a = !1;
7713
7742
  const c = () => Array.from(r.querySelectorAll(".__crossx-pin6-box")), l = () => r.querySelector("#__crossx-pin6-boxes"), u = () => r.querySelector("#__crossx-pin6-error"), h = () => r.querySelector("#__crossx-pin6-lock-msg"), _ = () => r.querySelector("#__crossx-pin6-lock-countdown"), f = () => r.querySelector(".__crossx-pin6-body"), w = () => c().map((P) => P.value).join(""), b = (P) => {
@@ -7727,7 +7756,7 @@ function ot(r, e, s, t, n, o) {
7727
7756
  var G;
7728
7757
  return (G = c()[0]) == null ? void 0 : G.focus();
7729
7758
  }, 50);
7730
- }, C = (P) => {
7759
+ }, N = (P) => {
7731
7760
  var A;
7732
7761
  b(!0), c().forEach((I) => {
7733
7762
  I.value = "";
@@ -7735,7 +7764,7 @@ function ot(r, e, s, t, n, o) {
7735
7764
  const S = u();
7736
7765
  if (S && (S.textContent = "Too many failed attempts. Please wait."), !h()) {
7737
7766
  const I = document.createElement("p");
7738
- I.className = "__crossx-pin6-lock-msg", I.id = "__crossx-pin6-lock-msg", I.innerHTML = `${Cs}<span id="__crossx-pin6-lock-countdown"></span>`;
7767
+ I.className = "__crossx-pin6-lock-msg", I.id = "__crossx-pin6-lock-msg", I.innerHTML = `${Ns}<span id="__crossx-pin6-lock-countdown"></span>`;
7739
7768
  const x = u();
7740
7769
  x ? x.insertAdjacentElement("afterend", I) : (A = f()) == null || A.appendChild(I);
7741
7770
  }
@@ -7762,7 +7791,7 @@ function ot(r, e, s, t, n, o) {
7762
7791
  try {
7763
7792
  if (n) {
7764
7793
  const S = await n(P);
7765
- S.ok ? e(P) : S.lockExpiresAt ? C(S.lockExpiresAt) : T(S.error ?? "Incorrect PIN. Please try again.");
7794
+ S.ok ? e(P) : S.lockExpiresAt ? N(S.lockExpiresAt) : T(S.error ?? "Incorrect PIN. Please try again.");
7766
7795
  } else
7767
7796
  e(P);
7768
7797
  } catch (S) {
@@ -7774,7 +7803,7 @@ function ot(r, e, s, t, n, o) {
7774
7803
  }
7775
7804
  }
7776
7805
  };
7777
- o && o > Date.now() ? C(o) : setTimeout(() => {
7806
+ o && o > Date.now() ? N(o) : setTimeout(() => {
7778
7807
  var P;
7779
7808
  return (P = c()[0]) == null ? void 0 : P.focus();
7780
7809
  }, 100);
@@ -7815,7 +7844,7 @@ function ot(r, e, s, t, n, o) {
7815
7844
  }), P.addEventListener("focus", () => P.select());
7816
7845
  });
7817
7846
  }
7818
- const Cs = `<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
7847
+ const Ns = `<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
7819
7848
  <path d="M14.5 8.5H14V6.5C14 4.015 11.985 2 9.5 2C7.015 2 5 4.015 5 6.5V8.5H4.5C3.672 8.5 3 9.172 3 10V16.5C3 17.328 3.672 18 4.5 18H14.5C15.328 18 16 17.328 16 16.5V10C16 9.172 15.328 8.5 14.5 8.5ZM10.5 13.415V15C10.5 15.276 10.276 15.5 10 15.5H9C8.724 15.5 8.5 15.276 8.5 15V13.415C8.187 13.196 8 12.847 8 12.5C8 11.672 8.672 11 9.5 11C10.328 11 11 11.672 11 12.5C11 12.847 10.813 13.196 10.5 13.415ZM12.5 8.5H6.5V6.5C6.5 4.843 7.843 3.5 9.5 3.5C11.157 3.5 12.5 4.843 12.5 6.5V8.5Z" fill="currentColor"/>
7820
7849
  </svg>`, Yn = `<svg width="11" height="9" viewBox="0 0 11 9" fill="none" xmlns="http://www.w3.org/2000/svg">
7821
7850
  <path d="M1 4.5L4 7.5L10 1" stroke="white" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
@@ -7890,8 +7919,8 @@ class Zn {
7890
7919
  (() => {
7891
7920
  i.querySelectorAll(".__crossx-wallet-item").forEach((y) => {
7892
7921
  y.addEventListener("click", () => {
7893
- const T = y.dataset.walletAddress ?? "", C = parseInt(y.dataset.walletIndex ?? "0", 10);
7894
- u({ address: T, index: C });
7922
+ const T = y.dataset.walletAddress ?? "", N = parseInt(y.dataset.walletIndex ?? "0", 10);
7923
+ u({ address: T, index: N });
7895
7924
  });
7896
7925
  });
7897
7926
  })();
@@ -7903,8 +7932,8 @@ class Zn {
7903
7932
  o.push(y);
7904
7933
  const T = i.querySelector("#__crossx-wallet-list");
7905
7934
  if (T) {
7906
- const C = document.createElement("button");
7907
- C.className = "__crossx-wallet-item", C.dataset.walletIndex = String(y.index), C.dataset.walletAddress = y.address, C.innerHTML = `<span class="__crossx-wallet-addr">${se(y.address)}</span>`, C.addEventListener("click", () => u(y)), T.appendChild(C), C.scrollIntoView({ behavior: "smooth", block: "nearest" });
7935
+ const N = document.createElement("button");
7936
+ N.className = "__crossx-wallet-item", N.dataset.walletIndex = String(y.index), N.dataset.walletAddress = y.address, N.innerHTML = `<span class="__crossx-wallet-addr">${se(y.address)}</span>`, N.addEventListener("click", () => u(y)), T.appendChild(N), N.scrollIntoView({ behavior: "smooth", block: "nearest" });
7908
7937
  }
7909
7938
  } catch {
7910
7939
  } finally {
@@ -8008,8 +8037,8 @@ class Zn {
8008
8037
  let l = !1;
8009
8038
  const u = () => {
8010
8039
  l || (l = !0, a.remove(), document.body.style.overflow = c);
8011
- }, h = (C) => {
8012
- u(), s(C);
8040
+ }, h = (N) => {
8041
+ u(), s(N);
8013
8042
  }, _ = () => {
8014
8043
  u(), s(null);
8015
8044
  }, f = a.querySelector(".__crossx-card"), w = {
@@ -8018,32 +8047,32 @@ class Zn {
8018
8047
  repeatingDigit: (t == null ? void 0 : t.pinValidation_repeatingDigit) ?? "Cannot use the same number 3+ times in a row.",
8019
8048
  sequential: (t == null ? void 0 : t.pinValidation_sequential) ?? "Sequential numbers (e.g., 123456) are not allowed.",
8020
8049
  alternatingPattern: (t == null ? void 0 : t.pinValidation_alternatingPattern) ?? "Repeating patterns (e.g., 121212) are not allowed."
8021
- }, b = (C) => {
8050
+ }, b = (N) => {
8022
8051
  var W;
8023
- f.innerHTML = nt({
8052
+ f.innerHTML = ot({
8024
8053
  title: i.title,
8025
8054
  headerSubtitle: i.headerSubtitle
8026
- }), (W = f.querySelector("#__crossx-close-btn")) == null || W.addEventListener("click", _), ot(f, (B) => {
8027
- B === C ? h(C) : y(o.mismatchError);
8055
+ }), (W = f.querySelector("#__crossx-close-btn")) == null || W.addEventListener("click", _), it(f, (B) => {
8056
+ B === N ? h(N) : y(o.mismatchError);
8028
8057
  }, _);
8029
- }, y = (C) => {
8058
+ }, y = (N) => {
8030
8059
  var W;
8031
- f.innerHTML = nt({
8060
+ f.innerHTML = ot({
8032
8061
  title: o.title,
8033
8062
  headerSubtitle: o.headerSubtitle,
8034
8063
  subtitle: o.subtitle,
8035
- errorMessage: C
8036
- }), (W = f.querySelector("#__crossx-close-btn")) == null || W.addEventListener("click", _), ot(f, (B) => {
8064
+ errorMessage: N
8065
+ }), (W = f.querySelector("#__crossx-close-btn")) == null || W.addEventListener("click", _), it(f, (B) => {
8037
8066
  const j = zn(B, w);
8038
8067
  j ? y(j) : b(B);
8039
8068
  }, _);
8040
8069
  };
8041
8070
  (() => {
8042
8071
  var G;
8043
- const C = Array.from(f.querySelectorAll(".__crossx-pw-notice-item")), W = f.querySelector("#__crossx-pin-notice-next"), B = /* @__PURE__ */ new Set();
8072
+ const N = Array.from(f.querySelectorAll(".__crossx-pw-notice-item")), W = f.querySelector("#__crossx-pin-notice-next"), B = /* @__PURE__ */ new Set();
8044
8073
  W.removeAttribute("disabled");
8045
8074
  const j = W.dataset.nextLabel ?? "Next", q = W.dataset.submitLabel ?? "I Understand", P = () => {
8046
- const O = B.size === C.length;
8075
+ const O = B.size === N.length;
8047
8076
  W.classList.toggle("--disabled", !O), W.textContent = O ? q : j;
8048
8077
  }, S = (O, A) => {
8049
8078
  if (B.has(A)) return;
@@ -8054,7 +8083,7 @@ class Zn {
8054
8083
  const I = O.querySelector(`#__crossx-notice-check-${A}`);
8055
8084
  B.delete(A), I.classList.remove("--checked"), O.setAttribute("aria-checked", "false"), P();
8056
8085
  };
8057
- C.forEach((O) => {
8086
+ N.forEach((O) => {
8058
8087
  const A = parseInt(O.dataset.checkIndex ?? "0", 10);
8059
8088
  O.addEventListener("click", () => {
8060
8089
  B.has(A) ? L(O, A) : S(O, A);
@@ -8062,11 +8091,11 @@ class Zn {
8062
8091
  (I.key === " " || I.key === "Enter") && (I.preventDefault(), B.has(A) ? L(O, A) : S(O, A));
8063
8092
  });
8064
8093
  }), W.addEventListener("click", () => {
8065
- if (B.size === C.length) {
8094
+ if (B.size === N.length) {
8066
8095
  y(e == null ? void 0 : e.errorMessage);
8067
8096
  return;
8068
8097
  }
8069
- const O = C.find((I) => {
8098
+ const O = N.find((I) => {
8070
8099
  const x = parseInt(I.dataset.checkIndex ?? "0", 10);
8071
8100
  return !B.has(x);
8072
8101
  });
@@ -8076,8 +8105,8 @@ class Zn {
8076
8105
  O.classList.remove("--highlight"), S(O, A);
8077
8106
  }, 400);
8078
8107
  }), (G = f.querySelector("#__crossx-close-btn")) == null || G.addEventListener("click", _);
8079
- })(), a.addEventListener("click", (C) => {
8080
- C.target === a && _();
8108
+ })(), a.addEventListener("click", (N) => {
8109
+ N.target === a && _();
8081
8110
  });
8082
8111
  });
8083
8112
  }
@@ -8092,7 +8121,7 @@ class Zn {
8092
8121
  he();
8093
8122
  const n = this.messages, o = (e == null ? void 0 : e.verifyMode) === !0, i = o ? (n == null ? void 0 : n.verifyPin_title) ?? "Verify Your PIN" : (n == null ? void 0 : n.pinInput_title) ?? "Enter PIN", a = o ? (n == null ? void 0 : n.verifyPin_subtitle) ?? "Enter your PIN to authorize this transaction." : (n == null ? void 0 : n.pinInput_subtitle) ?? "Enter your 6-digit PIN to continue.", c = Zt(
8094
8123
  this.tokens,
8095
- nt({
8124
+ ot({
8096
8125
  title: i,
8097
8126
  headerSubtitle: a,
8098
8127
  errorMessage: e == null ? void 0 : e.errorMessage,
@@ -8110,7 +8139,7 @@ class Zn {
8110
8139
  }, w = (T) => {
8111
8140
  h(), t(T);
8112
8141
  }, b = c.querySelector(".__crossx-card");
8113
- (y = b.querySelector("#__crossx-close-btn")) == null || y.addEventListener("click", f), ot(b, _, f, w, e == null ? void 0 : e.onSubmit, e == null ? void 0 : e.lockExpiresAt), c.addEventListener("click", (T) => {
8142
+ (y = b.querySelector("#__crossx-close-btn")) == null || y.addEventListener("click", f), it(b, _, f, w, e == null ? void 0 : e.onSubmit, e == null ? void 0 : e.lockExpiresAt), c.addEventListener("click", (T) => {
8114
8143
  T.target === c && f();
8115
8144
  });
8116
8145
  });
@@ -8168,7 +8197,7 @@ class Zn {
8168
8197
  return new Promise((s) => {
8169
8198
  var a, c;
8170
8199
  he();
8171
- const t = Nn(e, this.tokens);
8200
+ const t = Cn(e, this.tokens);
8172
8201
  pe(t);
8173
8202
  const n = () => t.remove(), o = () => {
8174
8203
  n(), s();
@@ -8197,7 +8226,7 @@ class Zn {
8197
8226
  showTransactionProgress(e, s) {
8198
8227
  return new Promise((t) => {
8199
8228
  he();
8200
- const n = Cn(e, this.tokens);
8229
+ const n = Nn(e, this.tokens);
8201
8230
  pe(n);
8202
8231
  const o = () => n.remove();
8203
8232
  let i = !1;
@@ -8289,13 +8318,13 @@ function ao(r, e) {
8289
8318
  }, n = {
8290
8319
  gatewayUrl: s.walletGatewayUrl,
8291
8320
  projectId: r.projectId
8292
- }, o = t.authMode !== "cookie" && Nt.isAvailable();
8321
+ }, o = t.authMode !== "cookie" && Ct.isAvailable();
8293
8322
  !o && t.authMode !== "cookie" && d.warn(
8294
8323
  "[CROSSx] IndexedDB 사용 불가 — LocalStorage fallback 사용 중.",
8295
8324
  "refresh_token이 평문 저장되지 않도록 세션 영속성이 제한됩니다.",
8296
8325
  "IndexedDB를 지원하는 브라우저 사용을 권장합니다."
8297
8326
  ), t.secureStorageAvailable = o;
8298
- const i = o ? new Nt(r.projectId) : new nr(), a = new pn(), c = new gn(), l = new Ee(), u = new Qn(), h = new es();
8327
+ const i = o ? new Ct(r.projectId) : new nr(), a = new pn(), c = new gn(), l = new Ee(), u = new Qn(), h = new es();
8299
8328
  let _;
8300
8329
  r.useMockWallet ? (d.log("[CROSSx] Mock Wallet Provider 사용"), _ = new wn(i, h)) : (d.log("[CROSSx] Remote Wallet Provider 사용"), _ = new Le(
8301
8330
  n,
@@ -8304,7 +8333,7 @@ function ao(r, e) {
8304
8333
  u,
8305
8334
  h
8306
8335
  ));
8307
- const f = new De(n, c), w = new Zn(r.theme ?? "light", r.themeTokens), b = e != null && e.wrapConfirmation ? e.wrapConfirmation(w) : w, y = new it(
8336
+ const f = new De(n, c), w = new Zn(r.theme ?? "light", r.themeTokens), b = e != null && e.wrapConfirmation ? e.wrapConfirmation(w) : w, y = new at(
8308
8337
  t,
8309
8338
  n,
8310
8339
  i,
@@ -8379,7 +8408,7 @@ function ro(r) {
8379
8408
  export {
8380
8409
  m as CROSSxError,
8381
8410
  Fs as CROSSxEthereumProvider,
8382
- it as CROSSxSDK,
8411
+ at as CROSSxSDK,
8383
8412
  io as ChainId,
8384
8413
  p as ErrorCode,
8385
8414
  es as PinMemoryStore,