@rhinestone/deposit-modal 0.13.0 → 0.14.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/README.md +47 -12
  2. package/bridge-transcript.json +653 -0
  3. package/dist/ClaimModal-GDFENSLV.mjs +13 -0
  4. package/dist/ClaimModal-L3FUBI5U.cjs +13 -0
  5. package/dist/{DepositModalReown-3H75G3XQ.mjs → DepositModalReown-2EVV64OA.mjs} +30 -27
  6. package/dist/{DepositModalReown-YNNHLAV2.cjs → DepositModalReown-GAD45GIC.cjs} +77 -74
  7. package/dist/WithdrawModal-FAQH35NG.cjs +12 -0
  8. package/dist/WithdrawModal-IKUHF5CF.mjs +12 -0
  9. package/dist/{chunk-RAADLTSW.cjs → chunk-4J5ADVIN.cjs} +184 -139
  10. package/dist/{chunk-DSIZNRWA.mjs → chunk-5Q5CSVKF.mjs} +1049 -388
  11. package/dist/{chunk-HOGZKHHY.cjs → chunk-62UCV2LG.cjs} +3 -3
  12. package/dist/{chunk-CVGNCUVU.cjs → chunk-7AZFT2MV.cjs} +22 -13
  13. package/dist/{chunk-7N77GIP4.cjs → chunk-A6JPBMYY.cjs} +465 -171
  14. package/dist/{chunk-GACIGCSN.cjs → chunk-AQVJUXSG.cjs} +1 -1
  15. package/dist/{chunk-LTMMETAB.mjs → chunk-GZ4GQ5MC.mjs} +404 -110
  16. package/dist/{chunk-ZMT4ATHR.cjs → chunk-HAQOFI3D.cjs} +594 -41
  17. package/dist/{chunk-FZ5FZFIG.mjs → chunk-LMG46EP2.mjs} +1 -1
  18. package/dist/{chunk-2G2EIN4A.cjs → chunk-NQMC5VKQ.cjs} +1343 -682
  19. package/dist/{chunk-OLCD75JK.mjs → chunk-QACOOLOE.mjs} +451 -131
  20. package/dist/{chunk-XYJFEN5D.mjs → chunk-R5UQ3TN4.mjs} +1 -1
  21. package/dist/{chunk-EOMT5LKX.mjs → chunk-UX35GYLM.mjs} +556 -3
  22. package/dist/{chunk-YREVFB64.mjs → chunk-VALXN5IO.mjs} +16 -7
  23. package/dist/{chunk-COCBCQQC.mjs → chunk-XCTRKCNM.mjs} +51 -6
  24. package/dist/{chunk-5NUIKYSF.cjs → chunk-YP7QVKQ6.cjs} +458 -138
  25. package/dist/claim.cjs +6 -6
  26. package/dist/claim.d.cts +3 -3
  27. package/dist/claim.d.ts +3 -3
  28. package/dist/claim.mjs +5 -5
  29. package/dist/constants.cjs +2 -2
  30. package/dist/constants.d.cts +1 -1
  31. package/dist/constants.d.ts +1 -1
  32. package/dist/constants.mjs +1 -1
  33. package/dist/deposit.cjs +6 -6
  34. package/dist/deposit.d.cts +2 -2
  35. package/dist/deposit.d.ts +2 -2
  36. package/dist/deposit.mjs +5 -5
  37. package/dist/embed.cjs +310 -102
  38. package/dist/embed.d.cts +7 -1
  39. package/dist/embed.d.ts +7 -1
  40. package/dist/embed.mjs +285 -77
  41. package/dist/index.cjs +9 -9
  42. package/dist/index.d.cts +1 -1
  43. package/dist/index.d.ts +1 -1
  44. package/dist/index.mjs +8 -8
  45. package/dist/types-Bho4OA03.d.ts +982 -0
  46. package/dist/types-DP_3KwlD.d.cts +982 -0
  47. package/dist/withdraw.cjs +5 -5
  48. package/dist/withdraw.d.cts +3 -3
  49. package/dist/withdraw.d.ts +3 -3
  50. package/dist/withdraw.mjs +4 -4
  51. package/package.json +29 -7
  52. package/dist/ClaimModal-CREZO27I.mjs +0 -11
  53. package/dist/ClaimModal-JRIA32U2.cjs +0 -11
  54. package/dist/WithdrawModal-NVRX44IZ.mjs +0 -10
  55. package/dist/WithdrawModal-YYSBPCJJ.cjs +0 -10
  56. package/dist/types-B89I8_8H.d.ts +0 -638
  57. package/dist/types-nnDR4tqA.d.cts +0 -638
@@ -1,6 +1,7 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
2
 
3
- var _chunkGACIGCSNcjs = require('./chunk-GACIGCSN.cjs');
3
+
4
+ var _chunkAQVJUXSGcjs = require('./chunk-AQVJUXSG.cjs');
4
5
 
5
6
 
6
7
 
@@ -83,7 +84,7 @@ function Modal({
83
84
  (event) => {
84
85
  if (event.key === "Escape") {
85
86
  event.preventDefault();
86
- onClose();
87
+ onClose("escape");
87
88
  return;
88
89
  }
89
90
  if (event.key === "Tab" && contentRef.current) {
@@ -109,7 +110,7 @@ function Modal({
109
110
  const handleOverlayClick = _react.useCallback.call(void 0,
110
111
  (event) => {
111
112
  if (closeOnOverlayClick && event.target === overlayRef.current) {
112
- onClose();
113
+ onClose("overlay");
113
114
  }
114
115
  },
115
116
  [closeOnOverlayClick, onClose]
@@ -891,7 +892,7 @@ function createDepositService(baseUrl, options) {
891
892
  try {
892
893
  const response = await fetch(apiUrl("/qr/tokens"), {
893
894
  method: "GET",
894
- headers: _chunkGACIGCSNcjs.serviceHeaders.call(void 0, )
895
+ headers: _chunkAQVJUXSGcjs.serviceHeaders.call(void 0, )
895
896
  });
896
897
  if (!response.ok) {
897
898
  debugLog(debug, scope, "getTopTokens:unavailable", {
@@ -918,7 +919,7 @@ function createDepositService(baseUrl, options) {
918
919
  try {
919
920
  const response = await fetch(apiUrl("/chains"), {
920
921
  method: "GET",
921
- headers: _chunkGACIGCSNcjs.serviceHeaders.call(void 0, )
922
+ headers: _chunkAQVJUXSGcjs.serviceHeaders.call(void 0, )
922
923
  });
923
924
  if (!response.ok) {
924
925
  debugLog(debug, scope, "getChains:unavailable", {
@@ -972,7 +973,7 @@ function createDepositService(baseUrl, options) {
972
973
  });
973
974
  const response = await fetch(url, {
974
975
  method: "POST",
975
- headers: _chunkGACIGCSNcjs.serviceHeaders.call(void 0, ),
976
+ headers: _chunkAQVJUXSGcjs.serviceHeaders.call(void 0, ),
976
977
  body: JSON.stringify({ account: params })
977
978
  });
978
979
  if (!response.ok) {
@@ -1004,7 +1005,7 @@ function createDepositService(baseUrl, options) {
1004
1005
  debugLog(debug, scope, "fetchPortfolio:request", { url, address });
1005
1006
  const response = await fetch(url, {
1006
1007
  method: "GET",
1007
- headers: _chunkGACIGCSNcjs.serviceHeaders.call(void 0, )
1008
+ headers: _chunkAQVJUXSGcjs.serviceHeaders.call(void 0, )
1008
1009
  });
1009
1010
  if (!response.ok) {
1010
1011
  const error = await response.json().catch(() => ({ error: "Unknown error" }));
@@ -1055,7 +1056,7 @@ function createDepositService(baseUrl, options) {
1055
1056
  });
1056
1057
  const response = await fetch(url, {
1057
1058
  method: "GET",
1058
- headers: _chunkGACIGCSNcjs.serviceHeaders.call(void 0, )
1059
+ headers: _chunkAQVJUXSGcjs.serviceHeaders.call(void 0, )
1059
1060
  });
1060
1061
  if (!response.ok) {
1061
1062
  const error = await response.json().catch(() => ({ error: "Unknown error" }));
@@ -1084,7 +1085,7 @@ function createDepositService(baseUrl, options) {
1084
1085
  debugLog(debug, scope, "checkAccount:request", { url, address });
1085
1086
  const response = await fetch(url, {
1086
1087
  method: "GET",
1087
- headers: _chunkGACIGCSNcjs.serviceHeaders.call(void 0, )
1088
+ headers: _chunkAQVJUXSGcjs.serviceHeaders.call(void 0, )
1088
1089
  });
1089
1090
  if (!response.ok) {
1090
1091
  const error = await response.json().catch(() => ({ error: "Unknown error" }));
@@ -1120,7 +1121,7 @@ function createDepositService(baseUrl, options) {
1120
1121
  );
1121
1122
  const response = await fetch(url, {
1122
1123
  method: "GET",
1123
- headers: _chunkGACIGCSNcjs.serviceHeaders.call(void 0, ),
1124
+ headers: _chunkAQVJUXSGcjs.serviceHeaders.call(void 0, ),
1124
1125
  cache: "no-store"
1125
1126
  });
1126
1127
  if (!response.ok) {
@@ -1148,7 +1149,7 @@ function createDepositService(baseUrl, options) {
1148
1149
  );
1149
1150
  const response = await fetch(url, {
1150
1151
  method: "GET",
1151
- headers: _chunkGACIGCSNcjs.serviceHeaders.call(void 0, ),
1152
+ headers: _chunkAQVJUXSGcjs.serviceHeaders.call(void 0, ),
1152
1153
  cache: "no-store"
1153
1154
  });
1154
1155
  if (!response.ok) {
@@ -1172,7 +1173,7 @@ function createDepositService(baseUrl, options) {
1172
1173
  );
1173
1174
  const response = await fetch(url, {
1174
1175
  method: "GET",
1175
- headers: _chunkGACIGCSNcjs.serviceHeaders.call(void 0, ),
1176
+ headers: _chunkAQVJUXSGcjs.serviceHeaders.call(void 0, ),
1176
1177
  cache: "no-store"
1177
1178
  });
1178
1179
  if (!response.ok) {
@@ -1194,7 +1195,7 @@ function createDepositService(baseUrl, options) {
1194
1195
  async getPositions(address) {
1195
1196
  const url = apiUrl(`/positions/${address}`);
1196
1197
  debugLog(debug, scope, "getPositions:request", { url, address });
1197
- const response = await fetch(url, { headers: _chunkGACIGCSNcjs.serviceHeaders.call(void 0, ) });
1198
+ const response = await fetch(url, { headers: _chunkAQVJUXSGcjs.serviceHeaders.call(void 0, ) });
1198
1199
  if (!response.ok) {
1199
1200
  const error = await response.json().catch(() => ({ error: "Unknown error" }));
1200
1201
  debugError(debug, scope, "getPositions:failed", error, {
@@ -1228,7 +1229,7 @@ function createDepositService(baseUrl, options) {
1228
1229
  });
1229
1230
  const response = await fetch(url, {
1230
1231
  method: "POST",
1231
- headers: _chunkGACIGCSNcjs.serviceHeaders.call(void 0, ),
1232
+ headers: _chunkAQVJUXSGcjs.serviceHeaders.call(void 0, ),
1232
1233
  body: JSON.stringify({ account, market, chainId, asset, amount })
1233
1234
  });
1234
1235
  if (!response.ok) {
@@ -1264,7 +1265,7 @@ function createDepositService(baseUrl, options) {
1264
1265
  });
1265
1266
  const response = await fetch(url, {
1266
1267
  method: "POST",
1267
- headers: _chunkGACIGCSNcjs.serviceHeaders.call(void 0, ),
1268
+ headers: _chunkAQVJUXSGcjs.serviceHeaders.call(void 0, ),
1268
1269
  body: JSON.stringify({
1269
1270
  depositWallet,
1270
1271
  owner,
@@ -1306,7 +1307,7 @@ function createDepositService(baseUrl, options) {
1306
1307
  });
1307
1308
  const response = await fetch(url, {
1308
1309
  method: "GET",
1309
- headers: _chunkGACIGCSNcjs.serviceHeaders.call(void 0, ),
1310
+ headers: _chunkAQVJUXSGcjs.serviceHeaders.call(void 0, ),
1310
1311
  cache: "no-store"
1311
1312
  });
1312
1313
  if (!response.ok) {
@@ -1356,7 +1357,7 @@ function createDepositService(baseUrl, options) {
1356
1357
  });
1357
1358
  const response = await fetch(url, {
1358
1359
  method: "GET",
1359
- headers: _chunkGACIGCSNcjs.serviceHeaders.call(void 0, ),
1360
+ headers: _chunkAQVJUXSGcjs.serviceHeaders.call(void 0, ),
1360
1361
  cache: "no-store"
1361
1362
  });
1362
1363
  if (!response.ok) {
@@ -1404,7 +1405,7 @@ function createDepositService(baseUrl, options) {
1404
1405
  try {
1405
1406
  const response = await fetch(url, {
1406
1407
  method: "POST",
1407
- headers: _chunkGACIGCSNcjs.serviceHeaders.call(void 0, ),
1408
+ headers: _chunkAQVJUXSGcjs.serviceHeaders.call(void 0, ),
1408
1409
  body: JSON.stringify(body),
1409
1410
  cache: "no-store"
1410
1411
  });
@@ -1444,7 +1445,7 @@ function createDepositService(baseUrl, options) {
1444
1445
  try {
1445
1446
  const response = await fetch(url, {
1446
1447
  method: "POST",
1447
- headers: _chunkGACIGCSNcjs.serviceHeaders.call(void 0, ),
1448
+ headers: _chunkAQVJUXSGcjs.serviceHeaders.call(void 0, ),
1448
1449
  body: JSON.stringify({ ...params, kind: "auto" }),
1449
1450
  cache: "no-store"
1450
1451
  });
@@ -1538,7 +1539,7 @@ function createDepositService(baseUrl, options) {
1538
1539
  try {
1539
1540
  response = await fetch(url, {
1540
1541
  method: "POST",
1541
- headers: _chunkGACIGCSNcjs.serviceHeaders.call(void 0, ),
1542
+ headers: _chunkAQVJUXSGcjs.serviceHeaders.call(void 0, ),
1542
1543
  body: JSON.stringify(params)
1543
1544
  });
1544
1545
  } catch (error) {
@@ -1589,7 +1590,7 @@ function createDepositService(baseUrl, options) {
1589
1590
  try {
1590
1591
  const response = await fetch(url, {
1591
1592
  method: "GET",
1592
- headers: _chunkGACIGCSNcjs.serviceHeaders.call(void 0, ),
1593
+ headers: _chunkAQVJUXSGcjs.serviceHeaders.call(void 0, ),
1593
1594
  cache: "no-store"
1594
1595
  });
1595
1596
  if (!response.ok) {
@@ -1621,7 +1622,7 @@ function createDepositService(baseUrl, options) {
1621
1622
  try {
1622
1623
  const response = await fetch(url, {
1623
1624
  method: "GET",
1624
- headers: _chunkGACIGCSNcjs.serviceHeaders.call(void 0, ),
1625
+ headers: _chunkAQVJUXSGcjs.serviceHeaders.call(void 0, ),
1625
1626
  cache: "no-store"
1626
1627
  });
1627
1628
  if (!response.ok) {
@@ -1646,7 +1647,7 @@ function createDepositService(baseUrl, options) {
1646
1647
  });
1647
1648
  const response = await fetch(url, {
1648
1649
  method: "POST",
1649
- headers: _chunkGACIGCSNcjs.serviceHeaders.call(void 0, ),
1650
+ headers: _chunkAQVJUXSGcjs.serviceHeaders.call(void 0, ),
1650
1651
  body: JSON.stringify(params)
1651
1652
  });
1652
1653
  if (!response.ok) {
@@ -1678,7 +1679,7 @@ function createDepositService(baseUrl, options) {
1678
1679
  });
1679
1680
  const response = await fetch(url, {
1680
1681
  method: "POST",
1681
- headers: _chunkGACIGCSNcjs.serviceHeaders.call(void 0, ),
1682
+ headers: _chunkAQVJUXSGcjs.serviceHeaders.call(void 0, ),
1682
1683
  body: JSON.stringify(params)
1683
1684
  });
1684
1685
  if (!response.ok) {
@@ -1715,7 +1716,7 @@ function createDepositService(baseUrl, options) {
1715
1716
  debugLog(debug, scope, "getSwappedConnectExchanges:request");
1716
1717
  const response = await fetch(url, {
1717
1718
  method: "GET",
1718
- headers: _chunkGACIGCSNcjs.serviceHeaders.call(void 0, ),
1719
+ headers: _chunkAQVJUXSGcjs.serviceHeaders.call(void 0, ),
1719
1720
  cache: "no-store"
1720
1721
  });
1721
1722
  if (!response.ok) {
@@ -1768,7 +1769,7 @@ function createDepositService(baseUrl, options) {
1768
1769
  try {
1769
1770
  const response = await fetch(url, {
1770
1771
  method: "GET",
1771
- headers: _chunkGACIGCSNcjs.serviceHeaders.call(void 0, ),
1772
+ headers: _chunkAQVJUXSGcjs.serviceHeaders.call(void 0, ),
1772
1773
  cache: "no-store"
1773
1774
  });
1774
1775
  if (!response.ok) {
@@ -1854,7 +1855,7 @@ function createDepositService(baseUrl, options) {
1854
1855
  try {
1855
1856
  const response = await fetch(url, {
1856
1857
  method: "GET",
1857
- headers: _chunkGACIGCSNcjs.serviceHeaders.call(void 0, ),
1858
+ headers: _chunkAQVJUXSGcjs.serviceHeaders.call(void 0, ),
1858
1859
  cache: "no-store"
1859
1860
  });
1860
1861
  if (!response.ok) {
@@ -1881,7 +1882,7 @@ function createDepositService(baseUrl, options) {
1881
1882
  );
1882
1883
  const response = await fetch(url, {
1883
1884
  method: "GET",
1884
- headers: _chunkGACIGCSNcjs.serviceHeaders.call(void 0, ),
1885
+ headers: _chunkAQVJUXSGcjs.serviceHeaders.call(void 0, ),
1885
1886
  cache: "no-store"
1886
1887
  });
1887
1888
  if (!response.ok) return null;
@@ -2875,6 +2876,554 @@ function formatReceiveEstimate(params) {
2875
2876
  return sameSymbol ? `${formatted} ${params.targetSymbol}` : `~${formatted} ${params.targetSymbol}`;
2876
2877
  }
2877
2878
 
2879
+ // src/core/analytics.tsx
2880
+
2881
+
2882
+
2883
+
2884
+
2885
+
2886
+
2887
+
2888
+
2889
+ // src/core/analytics-ingest.ts
2890
+ var DEFAULT_ANALYTICS_INGEST_URL = "https://v1.orchestrator.rhinestone.dev/deposit-processor/analytics/events";
2891
+ var MAX_BATCH = 20;
2892
+ var MAX_QUEUE = 200;
2893
+ var FLUSH_DELAY_MS = 5e3;
2894
+ var MAX_BODY_BYTES = 48 * 1024;
2895
+ var TOKEN_REFRESH_MARGIN_MS = 6e4;
2896
+ var TOKEN_TIMEOUT_MS = 3e3;
2897
+ var CLOSE_MINT_WAIT_MS = 1500;
2898
+ var MAX_ATTEMPTS = 3;
2899
+ var MAX_BACKOFF_MS = 3e4;
2900
+ var IDLE = 0;
2901
+ var CLOSING = 1;
2902
+ var DISMISSAL = 2;
2903
+ var ENVELOPE_FIELDS = /* @__PURE__ */ new Set([
2904
+ "type",
2905
+ "timestamp",
2906
+ "session_id",
2907
+ "modal",
2908
+ "widget_version",
2909
+ "session_properties",
2910
+ "funding_method"
2911
+ ]);
2912
+ function createIngestTransport(options) {
2913
+ const {
2914
+ ingestUrl,
2915
+ backendUrl,
2916
+ proxyOrigin,
2917
+ sessionId,
2918
+ modal,
2919
+ widgetVersion,
2920
+ sessionProperties,
2921
+ onFailure
2922
+ } = options;
2923
+ const fetchImpl = _nullishCoalesce(options.fetchImpl, () => ( (typeof globalThis.fetch === "function" ? globalThis.fetch.bind(globalThis) : void 0)));
2924
+ const now = _nullishCoalesce(options.now, () => ( (() => Date.now())));
2925
+ const createEventId = _nullishCoalesce(options.createEventId, () => ( randomUuid));
2926
+ const mintUrl = `${backendUrl.replace(/\/$/, "")}/analytics/ingest-token`;
2927
+ const queue = [];
2928
+ let sequence = 0;
2929
+ let dropped = 0;
2930
+ let token = null;
2931
+ let mintUnavailable = false;
2932
+ let mintFailures = 0;
2933
+ let mintBackoffUntil = 0;
2934
+ let timer = null;
2935
+ let sending = false;
2936
+ let disposed = false;
2937
+ let pendingRun = false;
2938
+ let urgency = IDLE;
2939
+ let minting = null;
2940
+ let mintAbort = null;
2941
+ const sleepers = /* @__PURE__ */ new Set();
2942
+ function report(reason, status) {
2943
+ try {
2944
+ onFailure({ reason, status, droppedEvents: dropped });
2945
+ } catch (e6) {
2946
+ }
2947
+ }
2948
+ function drop(batch, reason, status) {
2949
+ dropped += batch.length;
2950
+ report(reason, status);
2951
+ }
2952
+ function toWireEvent(event) {
2953
+ const payload = {};
2954
+ for (const [key, value] of Object.entries(event)) {
2955
+ if (!ENVELOPE_FIELDS.has(key)) payload[key] = value;
2956
+ }
2957
+ const wire = {
2958
+ event_id: createEventId(),
2959
+ session_id: sessionId,
2960
+ sequence: sequence++,
2961
+ type: String(event.type),
2962
+ timestamp: String(event.timestamp),
2963
+ widget_version: widgetVersion,
2964
+ proxy_origin: proxyOrigin,
2965
+ modal,
2966
+ session_properties: sessionProperties,
2967
+ payload
2968
+ };
2969
+ if (modal === "deposit") wire.funding_method = _nullishCoalesce(event.funding_method, () => ( null));
2970
+ return wire;
2971
+ }
2972
+ function takeBatch() {
2973
+ const batch = queue.slice(0, MAX_BATCH);
2974
+ while (batch.length > 1 && bodyOf(batch).length > MAX_BODY_BYTES) {
2975
+ batch.pop();
2976
+ }
2977
+ queue.splice(0, batch.length);
2978
+ return batch;
2979
+ }
2980
+ function bodyOf(batch) {
2981
+ return JSON.stringify({ events: batch });
2982
+ }
2983
+ function backoff(attempt) {
2984
+ return Math.min(1e3 * 2 ** (attempt - 1), MAX_BACKOFF_MS);
2985
+ }
2986
+ function sleep(ms) {
2987
+ return new Promise((resolve) => {
2988
+ const timeout = setTimeout(finish, ms);
2989
+ function finish() {
2990
+ clearTimeout(timeout);
2991
+ sleepers.delete(finish);
2992
+ resolve();
2993
+ }
2994
+ sleepers.add(finish);
2995
+ });
2996
+ }
2997
+ function interruptForUnload() {
2998
+ for (const wake of [...sleepers]) wake();
2999
+ _optionalChain([mintAbort, 'optionalAccess', _109 => _109.abort, 'call', _110 => _110()]);
3000
+ }
3001
+ function retryDelay(response, attempt) {
3002
+ const seconds = Number(_optionalChain([response, 'access', _111 => _111.headers, 'optionalAccess', _112 => _112.get, 'optionalCall', _113 => _113("Retry-After")]));
3003
+ if (Number.isFinite(seconds) && seconds > 0) {
3004
+ return Math.min(seconds * 1e3, MAX_BACKOFF_MS);
3005
+ }
3006
+ return backoff(attempt);
3007
+ }
3008
+ async function mintToken() {
3009
+ if (mintUnavailable || !fetchImpl) return;
3010
+ const controller = typeof AbortController === "function" ? new AbortController() : null;
3011
+ mintAbort = controller;
3012
+ const timeout = controller ? setTimeout(() => controller.abort(), TOKEN_TIMEOUT_MS) : null;
3013
+ let response;
3014
+ try {
3015
+ response = await fetchImpl(mintUrl, {
3016
+ method: "POST",
3017
+ headers: _chunkAQVJUXSGcjs.serviceHeaders.call(void 0, ),
3018
+ signal: _optionalChain([controller, 'optionalAccess', _114 => _114.signal])
3019
+ });
3020
+ } catch (e7) {
3021
+ if (urgency !== DISMISSAL) {
3022
+ mintFailures += 1;
3023
+ mintBackoffUntil = now() + backoff(mintFailures);
3024
+ }
3025
+ return;
3026
+ } finally {
3027
+ if (timeout !== null) clearTimeout(timeout);
3028
+ mintAbort = null;
3029
+ }
3030
+ if (response.status === 404 || response.status === 401 || response.status === 403) {
3031
+ mintUnavailable = true;
3032
+ report("token_unavailable", response.status);
3033
+ return;
3034
+ }
3035
+ if (!response.ok) {
3036
+ mintFailures += 1;
3037
+ mintBackoffUntil = now() + backoff(mintFailures);
3038
+ return;
3039
+ }
3040
+ try {
3041
+ const data = await response.json();
3042
+ const value = typeof data.token === "string" ? data.token : "";
3043
+ const expiresAt = Date.parse(String(data.expiresAt));
3044
+ if (!value || Number.isNaN(expiresAt)) throw new Error("malformed");
3045
+ token = { value, expiresAt };
3046
+ mintFailures = 0;
3047
+ mintBackoffUntil = 0;
3048
+ } catch (e8) {
3049
+ mintUnavailable = true;
3050
+ report("token_unavailable", response.status);
3051
+ }
3052
+ }
3053
+ function startMint() {
3054
+ if (!minting) {
3055
+ minting = mintToken().finally(() => {
3056
+ minting = null;
3057
+ });
3058
+ }
3059
+ return minting;
3060
+ }
3061
+ async function ensureToken(maxWaitMs) {
3062
+ if (mintUnavailable) return;
3063
+ if (token && token.expiresAt - now() > TOKEN_REFRESH_MARGIN_MS) return;
3064
+ if (now() < mintBackoffUntil) return;
3065
+ const pending = startMint();
3066
+ await (maxWaitMs === void 0 ? pending : Promise.race([pending, sleep(maxWaitMs)]));
3067
+ }
3068
+ async function deliver(batch) {
3069
+ if (!fetchImpl) return drop(batch, "unsupported");
3070
+ let attempt = 0;
3071
+ let refreshed = false;
3072
+ let unattributed = false;
3073
+ for (; ; ) {
3074
+ const terminal = urgency === DISMISSAL;
3075
+ attempt += 1;
3076
+ const headers = {
3077
+ "Content-Type": "application/json"
3078
+ };
3079
+ if (token && !unattributed) headers.Authorization = `Bearer ${token.value}`;
3080
+ let response;
3081
+ try {
3082
+ response = await fetchImpl(ingestUrl, {
3083
+ method: "POST",
3084
+ headers,
3085
+ body: bodyOf(batch),
3086
+ keepalive: true
3087
+ });
3088
+ } catch (e9) {
3089
+ if (terminal || attempt >= MAX_ATTEMPTS) {
3090
+ return drop(batch, "network");
3091
+ }
3092
+ await sleep(backoff(attempt));
3093
+ continue;
3094
+ }
3095
+ if (response.ok) return;
3096
+ const status = response.status;
3097
+ if (status === 401) {
3098
+ token = null;
3099
+ if (!refreshed && !terminal) {
3100
+ refreshed = true;
3101
+ await startMint();
3102
+ if (token) continue;
3103
+ }
3104
+ if (!unattributed) {
3105
+ unattributed = true;
3106
+ continue;
3107
+ }
3108
+ return drop(batch, "unauthorized", status);
3109
+ }
3110
+ if (status === 409) return drop(batch, "conflict", status);
3111
+ if (status === 429 || status >= 500) {
3112
+ if (terminal || attempt >= MAX_ATTEMPTS) {
3113
+ return drop(batch, status === 429 ? "throttled" : "unavailable", status);
3114
+ }
3115
+ await sleep(retryDelay(response, attempt));
3116
+ continue;
3117
+ }
3118
+ return drop(batch, "rejected", status);
3119
+ }
3120
+ }
3121
+ function escalate(level) {
3122
+ if (level <= urgency) return;
3123
+ urgency = level;
3124
+ if (level === DISMISSAL) interruptForUnload();
3125
+ }
3126
+ function onDismissal(event) {
3127
+ if (event.type === "pagehide" || document.visibilityState === "hidden") {
3128
+ escalate(DISMISSAL);
3129
+ }
3130
+ }
3131
+ function dismissalGuard(attach) {
3132
+ if (typeof window === "undefined" || typeof document === "undefined") return;
3133
+ const bind = attach ? "addEventListener" : "removeEventListener";
3134
+ window[bind]("pagehide", onDismissal);
3135
+ document[bind]("visibilitychange", onDismissal);
3136
+ }
3137
+ async function run(level) {
3138
+ escalate(level);
3139
+ if (sending) {
3140
+ pendingRun = true;
3141
+ return;
3142
+ }
3143
+ sending = true;
3144
+ try {
3145
+ while (queue.length > 0) {
3146
+ const batch = takeBatch();
3147
+ if (urgency !== DISMISSAL) {
3148
+ await ensureToken(urgency === CLOSING ? CLOSE_MINT_WAIT_MS : void 0);
3149
+ }
3150
+ await deliver(batch);
3151
+ }
3152
+ } finally {
3153
+ sending = false;
3154
+ }
3155
+ if (pendingRun) {
3156
+ pendingRun = false;
3157
+ await run(urgency);
3158
+ return;
3159
+ }
3160
+ if (!disposed) urgency = IDLE;
3161
+ else dismissalGuard(false);
3162
+ }
3163
+ function clearFlushTimer() {
3164
+ if (timer !== null) {
3165
+ clearTimeout(timer);
3166
+ timer = null;
3167
+ }
3168
+ }
3169
+ function scheduleFlush() {
3170
+ if (timer !== null || disposed) return;
3171
+ timer = setTimeout(() => {
3172
+ timer = null;
3173
+ void run(IDLE);
3174
+ }, FLUSH_DELAY_MS);
3175
+ }
3176
+ return {
3177
+ enqueue(event) {
3178
+ if (disposed) return;
3179
+ queue.push(toWireEvent(event));
3180
+ if (sequence === 1) void ensureToken();
3181
+ if (queue.length > MAX_QUEUE) {
3182
+ dropped += queue.length - MAX_QUEUE;
3183
+ queue.splice(0, queue.length - MAX_QUEUE);
3184
+ }
3185
+ if (queue.length >= MAX_BATCH) {
3186
+ clearFlushTimer();
3187
+ void run(IDLE);
3188
+ } else {
3189
+ scheduleFlush();
3190
+ }
3191
+ },
3192
+ flush(flushOptions) {
3193
+ const dismissal = _nullishCoalesce(_optionalChain([flushOptions, 'optionalAccess', _115 => _115.terminal]), () => ( false));
3194
+ if (disposed && !dismissal) return;
3195
+ clearFlushTimer();
3196
+ void run(dismissal ? DISMISSAL : IDLE);
3197
+ },
3198
+ dispose() {
3199
+ if (disposed) return;
3200
+ disposed = true;
3201
+ clearFlushTimer();
3202
+ dismissalGuard(true);
3203
+ void run(CLOSING);
3204
+ }
3205
+ };
3206
+ }
3207
+ function randomUuid() {
3208
+ if (typeof _optionalChain([globalThis, 'access', _116 => _116.crypto, 'optionalAccess', _117 => _117.randomUUID]) === "function") {
3209
+ return globalThis.crypto.randomUUID();
3210
+ }
3211
+ const bytes = new Uint8Array(16);
3212
+ _optionalChain([globalThis, 'access', _118 => _118.crypto, 'optionalAccess', _119 => _119.getRandomValues, 'optionalCall', _120 => _120(bytes)]);
3213
+ if (!bytes.some(Boolean)) {
3214
+ for (let index = 0; index < bytes.length; index += 1) {
3215
+ bytes[index] = Math.floor(Math.random() * 256);
3216
+ }
3217
+ }
3218
+ bytes[6] = bytes[6] & 15 | 64;
3219
+ bytes[8] = bytes[8] & 63 | 128;
3220
+ const hex = Array.from(bytes, (byte) => byte.toString(16).padStart(2, "0"));
3221
+ return `${hex.slice(0, 4).join("")}-${hex.slice(4, 6).join("")}-${hex.slice(6, 8).join("")}-${hex.slice(8, 10).join("")}-${hex.slice(10).join("")}`;
3222
+ }
3223
+ function resolveProxyOrigin(backendUrl) {
3224
+ if (!backendUrl.trim()) return null;
3225
+ try {
3226
+ const { origin } = new URL(backendUrl, _optionalChain([globalThis, 'access', _121 => _121.location, 'optionalAccess', _122 => _122.href]));
3227
+ return origin.startsWith("http") ? origin : null;
3228
+ } catch (e10) {
3229
+ return null;
3230
+ }
3231
+ }
3232
+
3233
+ // src/core/analytics.tsx
3234
+
3235
+ var AnalyticsContext = _react.createContext.call(void 0, null);
3236
+ var noopDepositEmitter = () => {
3237
+ };
3238
+ var noopWithdrawEmitter = () => {
3239
+ };
3240
+ var noopClaimEmitter = () => {
3241
+ };
3242
+ function cloneAndFreeze(value) {
3243
+ if (Array.isArray(value)) {
3244
+ return Object.freeze(value.map(cloneAndFreeze));
3245
+ }
3246
+ if (value && typeof value === "object") {
3247
+ const clone = Object.fromEntries(
3248
+ Object.entries(value).map(([key, child]) => [key, cloneAndFreeze(child)])
3249
+ );
3250
+ return Object.freeze(clone);
3251
+ }
3252
+ return value;
3253
+ }
3254
+ function AnalyticsSession(props) {
3255
+ const sessionIdRef = _react.useRef.call(void 0, void 0);
3256
+ if (sessionIdRef.current === void 0) {
3257
+ sessionIdRef.current = (_nullishCoalesce(props.createSessionId, () => ( randomUuid)))();
3258
+ }
3259
+ const sessionPropertiesRef = _react.useRef.call(void 0, void 0);
3260
+ if (sessionPropertiesRef.current === void 0) {
3261
+ sessionPropertiesRef.current = cloneAndFreeze(props.sessionProperties);
3262
+ }
3263
+ const onEventRef = _react.useRef.call(void 0, props.onEvent);
3264
+ onEventRef.current = props.onEvent;
3265
+ const nowRef = _react.useRef.call(void 0, _nullishCoalesce(props.now, () => ( (() => /* @__PURE__ */ new Date()))));
3266
+ nowRef.current = _nullishCoalesce(props.now, () => ( (() => /* @__PURE__ */ new Date())));
3267
+ const modal = props.modal;
3268
+ const reportedFailuresRef = _react.useRef.call(void 0, /* @__PURE__ */ new Set());
3269
+ const emitFailure = _react.useCallback.call(void 0,
3270
+ ({ reason, status, droppedEvents }) => {
3271
+ if (reportedFailuresRef.current.has(reason)) return;
3272
+ reportedFailuresRef.current.add(reason);
3273
+ const event = {
3274
+ type: "analytics_ingest_failure",
3275
+ session_id: sessionIdRef.current,
3276
+ modal,
3277
+ widget_version: _chunkAQVJUXSGcjs.MODAL_VERSION,
3278
+ timestamp: nowRef.current().toISOString(),
3279
+ reason,
3280
+ ...status === void 0 ? {} : { status },
3281
+ dropped_events: droppedEvents
3282
+ };
3283
+ _optionalChain([onEventRef, 'access', _123 => _123.current, 'optionalCall', _124 => _124(event)]);
3284
+ },
3285
+ [modal]
3286
+ );
3287
+ function createIngest() {
3288
+ if (props.enableIngest === false) {
3289
+ return { transport: null, initialFailure: null };
3290
+ }
3291
+ const proxyOrigin = resolveProxyOrigin(_nullishCoalesce(props.backendUrl, () => ( "")));
3292
+ if (!proxyOrigin || typeof globalThis.fetch !== "function") {
3293
+ return {
3294
+ transport: null,
3295
+ initialFailure: { reason: "unsupported", droppedEvents: 0 }
3296
+ };
3297
+ }
3298
+ return {
3299
+ transport: createIngestTransport({
3300
+ ingestUrl: _nullishCoalesce(props.ingestUrl, () => ( DEFAULT_ANALYTICS_INGEST_URL)),
3301
+ backendUrl: props.backendUrl,
3302
+ proxyOrigin,
3303
+ sessionId: sessionIdRef.current,
3304
+ modal,
3305
+ widgetVersion: _chunkAQVJUXSGcjs.MODAL_VERSION,
3306
+ sessionProperties: sessionPropertiesRef.current,
3307
+ onFailure: (failure) => emitFailure(failure),
3308
+ fetchImpl: props.fetchImpl,
3309
+ createEventId: props.createEventId
3310
+ }),
3311
+ initialFailure: null
3312
+ };
3313
+ }
3314
+ const ingestRef = _react.useRef.call(void 0, void 0);
3315
+ if (ingestRef.current === void 0) {
3316
+ ingestRef.current = createIngest();
3317
+ }
3318
+ const pendingDisposalRef = _react.useRef.call(void 0, null);
3319
+ const enqueue = _react.useCallback.call(void 0,
3320
+ (event) => {
3321
+ try {
3322
+ _optionalChain([ingestRef, 'access', _125 => _125.current, 'optionalAccess', _126 => _126.transport, 'optionalAccess', _127 => _127.enqueue, 'call', _128 => _128(
3323
+ event
3324
+ )]);
3325
+ } catch (e11) {
3326
+ }
3327
+ },
3328
+ []
3329
+ );
3330
+ _react.useEffect.call(void 0, () => {
3331
+ if (pendingDisposalRef.current !== null) {
3332
+ clearTimeout(pendingDisposalRef.current);
3333
+ pendingDisposalRef.current = null;
3334
+ }
3335
+ const setup = ingestRef.current;
3336
+ if (setup.initialFailure) emitFailure(setup.initialFailure);
3337
+ const transport = setup.transport;
3338
+ if (!transport) return;
3339
+ const flush = () => transport.flush({ terminal: true });
3340
+ const onVisibilityChange = () => {
3341
+ if (document.visibilityState === "hidden") flush();
3342
+ };
3343
+ window.addEventListener("pagehide", flush);
3344
+ document.addEventListener("visibilitychange", onVisibilityChange);
3345
+ return () => {
3346
+ window.removeEventListener("pagehide", flush);
3347
+ document.removeEventListener("visibilitychange", onVisibilityChange);
3348
+ pendingDisposalRef.current = setTimeout(() => {
3349
+ pendingDisposalRef.current = null;
3350
+ transport.dispose();
3351
+ }, 0);
3352
+ };
3353
+ }, [emitFailure]);
3354
+ const emitDeposit = _react.useCallback.call(void 0,
3355
+ (...[payload, fundingMethod]) => {
3356
+ if (modal !== "deposit") return;
3357
+ const event = {
3358
+ ...payload,
3359
+ session_id: sessionIdRef.current,
3360
+ modal,
3361
+ widget_version: _chunkAQVJUXSGcjs.MODAL_VERSION,
3362
+ timestamp: nowRef.current().toISOString(),
3363
+ session_properties: sessionPropertiesRef.current,
3364
+ funding_method: fundingMethod
3365
+ };
3366
+ _optionalChain([onEventRef, 'access', _129 => _129.current, 'optionalCall', _130 => _130(
3367
+ event
3368
+ )]);
3369
+ enqueue(event);
3370
+ },
3371
+ [enqueue, modal, nowRef, onEventRef]
3372
+ );
3373
+ const emitWithdraw = _react.useCallback.call(void 0,
3374
+ (payload) => {
3375
+ if (modal !== "withdraw") return;
3376
+ const event = {
3377
+ ...payload,
3378
+ session_id: sessionIdRef.current,
3379
+ modal,
3380
+ widget_version: _chunkAQVJUXSGcjs.MODAL_VERSION,
3381
+ timestamp: nowRef.current().toISOString(),
3382
+ session_properties: sessionPropertiesRef.current
3383
+ };
3384
+ _optionalChain([onEventRef, 'access', _131 => _131.current, 'optionalCall', _132 => _132(event)]);
3385
+ enqueue(event);
3386
+ },
3387
+ [enqueue, modal, nowRef, onEventRef]
3388
+ );
3389
+ const emitClaim = _react.useCallback.call(void 0,
3390
+ (payload) => {
3391
+ if (modal !== "claim") return;
3392
+ const event = {
3393
+ ...payload,
3394
+ session_id: sessionIdRef.current,
3395
+ modal,
3396
+ widget_version: _chunkAQVJUXSGcjs.MODAL_VERSION,
3397
+ timestamp: nowRef.current().toISOString(),
3398
+ session_properties: sessionPropertiesRef.current
3399
+ };
3400
+ _optionalChain([onEventRef, 'access', _133 => _133.current, 'optionalCall', _134 => _134(event)]);
3401
+ enqueue(event);
3402
+ },
3403
+ [enqueue, modal, nowRef, onEventRef]
3404
+ );
3405
+ const context = _react.useMemo.call(void 0,
3406
+ () => modal === "deposit" ? { modal, emit: emitDeposit } : modal === "withdraw" ? { modal, emit: emitWithdraw } : { modal, emit: emitClaim },
3407
+ [modal, emitDeposit, emitWithdraw, emitClaim]
3408
+ );
3409
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, AnalyticsContext.Provider, { value: context, children: props.children });
3410
+ }
3411
+ function useDepositAnalyticsEmitter() {
3412
+ const context = _react.useContext.call(void 0, AnalyticsContext);
3413
+ if (!context || context.modal !== "deposit") return noopDepositEmitter;
3414
+ return context.emit;
3415
+ }
3416
+ function useWithdrawAnalyticsEmitter() {
3417
+ const context = _react.useContext.call(void 0, AnalyticsContext);
3418
+ if (!context || context.modal !== "withdraw") return noopWithdrawEmitter;
3419
+ return context.emit;
3420
+ }
3421
+ function useClaimAnalyticsEmitter() {
3422
+ const context = _react.useContext.call(void 0, AnalyticsContext);
3423
+ if (!context || context.modal !== "claim") return noopClaimEmitter;
3424
+ return context.emit;
3425
+ }
3426
+
2878
3427
  // src/core/theme.ts
2879
3428
  var RADIUS_SCALE = {
2880
3429
  none: { sm: "0", md: "0", lg: "0" },
@@ -2979,11 +3528,11 @@ var NOTHING_TO_STOP = () => {
2979
3528
  };
2980
3529
  function resolveThemeMode(mode) {
2981
3530
  if (mode !== "system") return mode;
2982
- return _optionalChain([globalThis, 'access', _109 => _109.matchMedia, 'optionalCall', _110 => _110(DARK_SCHEME_QUERY), 'access', _111 => _111.matches]) ? "dark" : "light";
3531
+ return _optionalChain([globalThis, 'access', _135 => _135.matchMedia, 'optionalCall', _136 => _136(DARK_SCHEME_QUERY), 'access', _137 => _137.matches]) ? "dark" : "light";
2983
3532
  }
2984
3533
  function followSystemAppearance(mode, onChange) {
2985
3534
  if (mode !== "system") return NOTHING_TO_STOP;
2986
- const query = _optionalChain([globalThis, 'access', _112 => _112.matchMedia, 'optionalCall', _113 => _113(DARK_SCHEME_QUERY)]);
3535
+ const query = _optionalChain([globalThis, 'access', _138 => _138.matchMedia, 'optionalCall', _139 => _139(DARK_SCHEME_QUERY)]);
2987
3536
  if (!query) return NOTHING_TO_STOP;
2988
3537
  query.addEventListener("change", onChange);
2989
3538
  return () => query.removeEventListener("change", onChange);
@@ -2991,22 +3540,22 @@ function followSystemAppearance(mode, onChange) {
2991
3540
  function applyTheme(element, theme) {
2992
3541
  if (!element) return NOTHING_TO_STOP;
2993
3542
  const parent = element.parentElement;
2994
- const targets = _optionalChain([parent, 'optionalAccess', _114 => _114.classList, 'access', _115 => _115.contains, 'call', _116 => _116("rs-modal-content")]) ? [element, parent] : [element];
3543
+ const targets = _optionalChain([parent, 'optionalAccess', _140 => _140.classList, 'access', _141 => _141.contains, 'call', _142 => _142("rs-modal-content")]) ? [element, parent] : [element];
2995
3544
  const paintMode = () => {
2996
- const resolved = resolveThemeMode(_optionalChain([theme, 'optionalAccess', _117 => _117.mode]));
3545
+ const resolved = resolveThemeMode(_optionalChain([theme, 'optionalAccess', _143 => _143.mode]));
2997
3546
  for (const t of targets) {
2998
3547
  if (resolved) t.setAttribute("data-theme", resolved);
2999
3548
  else t.removeAttribute("data-theme");
3000
3549
  }
3001
3550
  };
3002
3551
  paintMode();
3003
- if (_optionalChain([theme, 'optionalAccess', _118 => _118.fontColor])) {
3552
+ if (_optionalChain([theme, 'optionalAccess', _144 => _144.fontColor])) {
3004
3553
  setVar(targets, "--rs-foreground", theme.fontColor);
3005
3554
  }
3006
- if (_optionalChain([theme, 'optionalAccess', _119 => _119.iconColor])) {
3555
+ if (_optionalChain([theme, 'optionalAccess', _145 => _145.iconColor])) {
3007
3556
  setVar(targets, "--rs-icon", theme.iconColor);
3008
3557
  }
3009
- if (_optionalChain([theme, 'optionalAccess', _120 => _120.ctaColor])) {
3558
+ if (_optionalChain([theme, 'optionalAccess', _146 => _146.ctaColor])) {
3010
3559
  const derived = deriveCustomPrimary(theme.ctaColor);
3011
3560
  if (derived) {
3012
3561
  setVar(targets, "--rs-primary", derived.base);
@@ -3031,25 +3580,25 @@ function applyTheme(element, theme) {
3031
3580
  }
3032
3581
  } else {
3033
3582
  for (const v of CUSTOM_PRIMARY_VARS) clearVar(targets, v);
3034
- if (_optionalChain([theme, 'optionalAccess', _121 => _121.ctaHoverColor])) {
3583
+ if (_optionalChain([theme, 'optionalAccess', _147 => _147.ctaHoverColor])) {
3035
3584
  setVar(targets, "--rs-primary-hover", theme.ctaHoverColor);
3036
3585
  }
3037
3586
  }
3038
- if (_optionalChain([theme, 'optionalAccess', _122 => _122.borderColor])) {
3587
+ if (_optionalChain([theme, 'optionalAccess', _148 => _148.borderColor])) {
3039
3588
  setVar(targets, "--rs-border", theme.borderColor);
3040
3589
  setVar(targets, "--rs-border-surface", theme.borderColor);
3041
3590
  }
3042
- if (_optionalChain([theme, 'optionalAccess', _123 => _123.backgroundColor])) {
3591
+ if (_optionalChain([theme, 'optionalAccess', _149 => _149.backgroundColor])) {
3043
3592
  setVar(targets, "--rs-background", theme.backgroundColor);
3044
3593
  }
3045
- if (_optionalChain([theme, 'optionalAccess', _124 => _124.radius])) {
3594
+ if (_optionalChain([theme, 'optionalAccess', _150 => _150.radius])) {
3046
3595
  const scale = RADIUS_SCALE[theme.radius];
3047
3596
  setVar(targets, "--rs-radius-sm", scale.sm);
3048
3597
  setVar(targets, "--rs-radius-md", scale.md);
3049
3598
  setVar(targets, "--rs-radius-lg", scale.lg);
3050
3599
  setVar(targets, "--rs-radius", scale.md);
3051
3600
  }
3052
- return followSystemAppearance(_optionalChain([theme, 'optionalAccess', _125 => _125.mode]), paintMode);
3601
+ return followSystemAppearance(_optionalChain([theme, 'optionalAccess', _151 => _151.mode]), paintMode);
3053
3602
  }
3054
3603
 
3055
3604
  // src/core/backend-url.ts
@@ -3143,4 +3692,8 @@ function checkBackendUrl(component, backendUrl) {
3143
3692
 
3144
3693
 
3145
3694
 
3146
- exports.Modal = Modal; exports.WalletIcon = WalletIcon; exports.ExternalLinkIcon = ExternalLinkIcon; exports.CheckIcon = CheckIcon; exports.TransferCryptoIcon = TransferCryptoIcon; exports.ChevronRightIcon = ChevronRightIcon; exports.ChevronLeftIcon = ChevronLeftIcon; exports.ChevronDownIcon = ChevronDownIcon; exports.CloseIcon = CloseIcon; exports.HandCoinsIcon = HandCoinsIcon; exports.CoinsIcon = CoinsIcon; exports.HistoryIcon = HistoryIcon; exports.InfoIcon = InfoIcon; exports.CopyIcon = CopyIcon; exports.ArrowUpRightIcon = ArrowUpRightIcon; exports.AlertTriangleIcon = AlertTriangleIcon; exports.CircleArrowOutUpLeftIcon = CircleArrowOutUpLeftIcon; exports.CardIcon = CardIcon; exports.BankIcon = BankIcon; exports.UnplugIcon = UnplugIcon; exports.MigrateAssetsIcon = MigrateAssetsIcon; exports.AppleIcon = AppleIcon; exports.BodyHeader = BodyHeader; exports.CdnIcon = CdnIcon; exports.PoweredBy = PoweredBy; exports.Spinner = Spinner; exports.catalogKeyForChain = catalogKeyForChain; exports.debugLog = debugLog; exports.debugError = debugError; exports.getAssetId = getAssetId; exports.chainIdsByValue = chainIdsByValue; exports.portfolioToAssets = portfolioToAssets; exports.isNativeAsset = isNativeAsset; exports.formatFeeUsd = formatFeeUsd; exports.quoteFeeRow = quoteFeeRow; exports.quoteFeeGroups = quoteFeeGroups; exports.SwappedConnectFeeChangedError = SwappedConnectFeeChangedError; exports.SUPPORTED_CONNECT_EXCHANGE_COUNT = SUPPORTED_CONNECT_EXCHANGE_COUNT; exports.resolveAppFeeBps = resolveAppFeeBps; exports.PermitDepositSubmitError = PermitDepositSubmitError; exports.createDepositService = createDepositService; exports.rpcUrlFor = rpcUrlFor; exports.RpcUrlsProvider = RpcUrlsProvider; exports.useRpcUrls = useRpcUrls; exports.useStableRpcUrls = useStableRpcUrls; exports.getPublicClient = getPublicClient; exports.peekRuntimeChains = peekRuntimeChains; exports.primeRuntimeChains = primeRuntimeChains; exports.useChainCatalog = useChainCatalog; exports.useCatalogChain = useCatalogChain; exports.useDepositChainIds = useDepositChainIds; exports.useDestinationChains = useDestinationChains; exports.useTargetTokens = useTargetTokens; exports.useIsDepositChain = useIsDepositChain; exports.useChainName = useChainName; exports.useReadClient = useReadClient; exports.useExplorerTxUrl = useExplorerTxUrl; exports.ChainCatalogProvider = ChainCatalogProvider; exports.useLatestRef = useLatestRef; exports.Button = Button; exports.Callout = Callout; exports.TokenIcon = TokenIcon; exports.currencyFormatter = currencyFormatter; exports.tokenFormatter = tokenFormatter; exports.isUnsupportedChainSwitchError = isUnsupportedChainSwitchError; exports.formatUserError = formatUserError; exports.resolveTokenDisplay = resolveTokenDisplay; exports.formatTokenAmount = formatTokenAmount; exports.tokenAmountToNumber = tokenAmountToNumber; exports.formatRawTokenAmount = formatRawTokenAmount; exports.isDisplayStablecoinSymbol = isDisplayStablecoinSymbol; exports.isRecognizedToken = isRecognizedToken; exports.estimateReceiveAmount = estimateReceiveAmount; exports.formatQuotedReceive = formatQuotedReceive; exports.formatReceiveEstimate = formatReceiveEstimate; exports.resolveThemeMode = resolveThemeMode; exports.followSystemAppearance = followSystemAppearance; exports.applyTheme = applyTheme; exports.checkBackendUrl = checkBackendUrl;
3695
+
3696
+
3697
+
3698
+
3699
+ exports.Modal = Modal; exports.WalletIcon = WalletIcon; exports.ExternalLinkIcon = ExternalLinkIcon; exports.CheckIcon = CheckIcon; exports.TransferCryptoIcon = TransferCryptoIcon; exports.ChevronRightIcon = ChevronRightIcon; exports.ChevronLeftIcon = ChevronLeftIcon; exports.ChevronDownIcon = ChevronDownIcon; exports.CloseIcon = CloseIcon; exports.HandCoinsIcon = HandCoinsIcon; exports.CoinsIcon = CoinsIcon; exports.HistoryIcon = HistoryIcon; exports.InfoIcon = InfoIcon; exports.CopyIcon = CopyIcon; exports.ArrowUpRightIcon = ArrowUpRightIcon; exports.AlertTriangleIcon = AlertTriangleIcon; exports.CircleArrowOutUpLeftIcon = CircleArrowOutUpLeftIcon; exports.CardIcon = CardIcon; exports.BankIcon = BankIcon; exports.UnplugIcon = UnplugIcon; exports.MigrateAssetsIcon = MigrateAssetsIcon; exports.AppleIcon = AppleIcon; exports.BodyHeader = BodyHeader; exports.CdnIcon = CdnIcon; exports.PoweredBy = PoweredBy; exports.Spinner = Spinner; exports.catalogKeyForChain = catalogKeyForChain; exports.debugLog = debugLog; exports.debugError = debugError; exports.getAssetId = getAssetId; exports.chainIdsByValue = chainIdsByValue; exports.portfolioToAssets = portfolioToAssets; exports.isNativeAsset = isNativeAsset; exports.formatFeeUsd = formatFeeUsd; exports.quoteFeeRow = quoteFeeRow; exports.quoteFeeGroups = quoteFeeGroups; exports.SwappedConnectFeeChangedError = SwappedConnectFeeChangedError; exports.SUPPORTED_CONNECT_EXCHANGE_COUNT = SUPPORTED_CONNECT_EXCHANGE_COUNT; exports.resolveAppFeeBps = resolveAppFeeBps; exports.PermitDepositSubmitError = PermitDepositSubmitError; exports.createDepositService = createDepositService; exports.rpcUrlFor = rpcUrlFor; exports.RpcUrlsProvider = RpcUrlsProvider; exports.useRpcUrls = useRpcUrls; exports.useStableRpcUrls = useStableRpcUrls; exports.getPublicClient = getPublicClient; exports.peekRuntimeChains = peekRuntimeChains; exports.primeRuntimeChains = primeRuntimeChains; exports.useChainCatalog = useChainCatalog; exports.useCatalogChain = useCatalogChain; exports.useDepositChainIds = useDepositChainIds; exports.useDestinationChains = useDestinationChains; exports.useTargetTokens = useTargetTokens; exports.useIsDepositChain = useIsDepositChain; exports.useChainName = useChainName; exports.useReadClient = useReadClient; exports.useExplorerTxUrl = useExplorerTxUrl; exports.ChainCatalogProvider = ChainCatalogProvider; exports.useLatestRef = useLatestRef; exports.Button = Button; exports.Callout = Callout; exports.TokenIcon = TokenIcon; exports.currencyFormatter = currencyFormatter; exports.tokenFormatter = tokenFormatter; exports.isUnsupportedChainSwitchError = isUnsupportedChainSwitchError; exports.formatUserError = formatUserError; exports.resolveTokenDisplay = resolveTokenDisplay; exports.formatTokenAmount = formatTokenAmount; exports.tokenAmountToNumber = tokenAmountToNumber; exports.formatRawTokenAmount = formatRawTokenAmount; exports.isDisplayStablecoinSymbol = isDisplayStablecoinSymbol; exports.isRecognizedToken = isRecognizedToken; exports.estimateReceiveAmount = estimateReceiveAmount; exports.formatQuotedReceive = formatQuotedReceive; exports.formatReceiveEstimate = formatReceiveEstimate; exports.AnalyticsSession = AnalyticsSession; exports.useDepositAnalyticsEmitter = useDepositAnalyticsEmitter; exports.useWithdrawAnalyticsEmitter = useWithdrawAnalyticsEmitter; exports.useClaimAnalyticsEmitter = useClaimAnalyticsEmitter; exports.resolveThemeMode = resolveThemeMode; exports.followSystemAppearance = followSystemAppearance; exports.applyTheme = applyTheme; exports.checkBackendUrl = checkBackendUrl;