@forge-connect/react 1.0.10 → 1.0.12

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.cjs CHANGED
@@ -16,8 +16,16 @@ var ForgeConnectApiError = class extends Error {
16
16
  this.code = code;
17
17
  }
18
18
  };
19
+ var clientCache = /* @__PURE__ */ new Map();
19
20
  function createApiClient(apiUrl) {
20
21
  const base = apiUrl.replace(/\/+$/, "");
22
+ const cached = clientCache.get(base);
23
+ if (cached) return cached;
24
+ const client = buildApiClient(base);
25
+ clientCache.set(base, client);
26
+ return client;
27
+ }
28
+ function buildApiClient(base) {
21
29
  const inflightRequests = /* @__PURE__ */ new Map();
22
30
  let inflightRefresh = null;
23
31
  async function request(path, options = {}) {
@@ -486,7 +494,7 @@ function ModalOverlay({ isOpen, onClose, children }) {
486
494
 
487
495
 
488
496
  // src/resolve-config.ts
489
- var OAUTH_PROVIDERS = /* @__PURE__ */ new Set(["google", "discord", "twitter", "apple", "telegram"]);
497
+ var OAUTH_PROVIDERS = /* @__PURE__ */ new Set(["google", "discord", "twitter", "apple", "telegram", "matrica"]);
490
498
  function isOAuthMethod(method) {
491
499
  return OAUTH_PROVIDERS.has(method);
492
500
  }
@@ -828,6 +836,103 @@ function EmailOtpForm() {
828
836
  // src/components/tabs/wallet-connect.tsx
829
837
 
830
838
 
839
+ // src/components/svg-icon.tsx
840
+
841
+
842
+ function SvgIcon({ svg, className }) {
843
+ const ref = _react.useRef.call(void 0, null);
844
+ _react.useEffect.call(void 0, () => {
845
+ if (!ref.current || !svg) return;
846
+ try {
847
+ const doc = new DOMParser().parseFromString(svg, "text/html");
848
+ const svgEl = doc.body.querySelector("svg");
849
+ if (!svgEl) {
850
+ ref.current.textContent = "";
851
+ return;
852
+ }
853
+ const dangerous = svgEl.querySelectorAll("script,iframe,object,embed,foreignObject");
854
+ dangerous.forEach((el) => el.remove());
855
+ const all = svgEl.querySelectorAll("*");
856
+ all.forEach((el) => {
857
+ for (const attr of Array.from(el.attributes)) {
858
+ if (attr.name.startsWith("on")) {
859
+ el.removeAttribute(attr.name);
860
+ }
861
+ }
862
+ });
863
+ ref.current.textContent = "";
864
+ ref.current.appendChild(svgEl);
865
+ } catch (e5) {
866
+ ref.current.textContent = "";
867
+ }
868
+ }, [svg]);
869
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { ref, className });
870
+ }
871
+
872
+ // src/components/tabs/oauth-buttons.tsx
873
+
874
+ var PROVIDER_INFO = {
875
+ google: {
876
+ label: "Google",
877
+ icon: '<svg viewBox="0 0 24 24" width="20" height="20"><path d="M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92a5.06 5.06 0 0 1-2.2 3.32v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.1z" fill="#4285F4"/><path d="M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z" fill="#34A853"/><path d="M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z" fill="#FBBC05"/><path d="M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z" fill="#EA4335"/></svg>'
878
+ },
879
+ discord: {
880
+ label: "Discord",
881
+ icon: '<svg viewBox="0 0 24 24" width="20" height="20"><path d="M20.317 4.37a19.791 19.791 0 0 0-4.885-1.515.074.074 0 0 0-.079.037c-.21.375-.444.864-.608 1.25a18.27 18.27 0 0 0-5.487 0 12.64 12.64 0 0 0-.617-1.25.077.077 0 0 0-.079-.037A19.736 19.736 0 0 0 3.677 4.37a.07.07 0 0 0-.032.027C.533 9.046-.32 13.58.099 18.057a.082.082 0 0 0 .031.057 19.9 19.9 0 0 0 5.993 3.03.078.078 0 0 0 .084-.028c.462-.63.874-1.295 1.226-1.994a.076.076 0 0 0-.041-.106 13.107 13.107 0 0 1-1.872-.892.077.077 0 0 1-.008-.128c.126-.094.252-.192.372-.292a.074.074 0 0 1 .077-.01c3.928 1.793 8.18 1.793 12.062 0a.074.074 0 0 1 .078.01c.12.098.246.198.373.292a.077.077 0 0 1-.006.127 12.299 12.299 0 0 1-1.873.892.077.077 0 0 0-.041.107c.36.698.772 1.362 1.225 1.993a.076.076 0 0 0 .084.028 19.839 19.839 0 0 0 6.002-3.03.077.077 0 0 0 .032-.054c.5-5.177-.838-9.674-3.549-13.66a.061.061 0 0 0-.031-.03z" fill="#5865F2"/></svg>'
882
+ },
883
+ twitter: {
884
+ label: "Twitter",
885
+ icon: '<svg viewBox="0 0 24 24" width="20" height="20"><path d="M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z" fill="currentColor"/></svg>'
886
+ },
887
+ apple: {
888
+ label: "Apple",
889
+ icon: '<svg viewBox="0 0 24 24" width="20" height="20"><path d="M17.05 20.28c-.98.95-2.05.88-3.08.4-1.09-.5-2.08-.52-3.23 0-1.44.64-2.2.45-3.06-.4C3.79 16.17 4.36 9.02 8.8 8.78c1.27.06 2.15.72 2.91.76.93-.19 1.82-.88 2.83-.8 1.21.1 2.12.58 2.72 1.49-2.46 1.48-1.88 4.73.52 5.64-.42 1.13-.98 2.24-1.73 3.41zM12.03 8.7c-.12-2.35 1.82-4.38 4.04-4.54.29 2.56-2.34 4.68-4.04 4.54z" fill="currentColor"/></svg>'
890
+ },
891
+ telegram: {
892
+ label: "Telegram",
893
+ icon: '<svg viewBox="0 0 24 24" width="20" height="20"><path d="M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.479.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z" fill="#2AABEE"/></svg>'
894
+ },
895
+ matrica: {
896
+ label: "Matrica",
897
+ icon: '<svg viewBox="2 1 26 26" width="20" height="20" xmlns="http://www.w3.org/2000/svg"><rect x="11.457" y="10.6387" width="7.00961" height="7.00962" fill="#4A99BF"/><path d="M12.6266 1.87695V5.08969H5.90903V23.1979H12.6266V26.4106H2.69629V1.87695H12.6266Z" fill="#4A99BF"/><path d="M17.2997 26.4106H27.2299V1.87695H17.2997V5.08969H24.0172V23.1979H17.2997V26.4106Z" fill="#4A99BF"/></svg>'
898
+ }
899
+ };
900
+ function OAuthButton({ provider }) {
901
+ const { loginWithOAuth } = useForgeConnect();
902
+ const info = PROVIDER_INFO[provider];
903
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
904
+ "button",
905
+ {
906
+ type: "button",
907
+ className: "fc-btn fc-btn-oauth",
908
+ onClick: () => loginWithOAuth(provider),
909
+ children: [
910
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, SvgIcon, { svg: info.icon, className: "fc-oauth-icon" }),
911
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "fc-btn-name", children: info.label })
912
+ ]
913
+ }
914
+ );
915
+ }
916
+
917
+ // src/components/tabs/wallet-connect.tsx
918
+
919
+ function MatricaWalletEntry() {
920
+ const { loginWithOAuth } = useForgeConnect();
921
+ const info = PROVIDER_INFO.matrica;
922
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
923
+ "button",
924
+ {
925
+ type: "button",
926
+ className: "fc-btn fc-btn-wallet",
927
+ onClick: () => loginWithOAuth("matrica"),
928
+ children: [
929
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, SvgIcon, { svg: info.icon, className: "fc-oauth-icon" }),
930
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "fc-wallet-name", children: info.label }),
931
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "fc-badge-preferred", children: "Brings wallets" })
932
+ ]
933
+ }
934
+ );
935
+ }
831
936
  var MOBILE_WALLETS = [
832
937
  {
833
938
  name: "Phantom",
@@ -893,21 +998,25 @@ function MobileWalletFlow() {
893
998
  const pageUrl = window.location.href;
894
999
  window.location.href = mw.buildUrl(pageUrl);
895
1000
  };
1001
+ const showMatrica = methods.includes("matrica");
896
1002
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "fc-tab", children: [
897
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "fc-wallet-list", children: walletsToShow.map((mw) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
898
- "button",
899
- {
900
- type: "button",
901
- className: "fc-btn fc-btn-wallet",
902
- onClick: () => handleOpen(mw),
903
- children: [
904
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { style: { position: "relative", display: "inline-flex" }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "img", { src: mw.icon, alt: "", className: "fc-wallet-icon" }) }),
905
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "fc-wallet-name", children: mw.name }),
906
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "fc-badge-preferred", children: "Open app" })
907
- ]
908
- },
909
- mw.name
910
- )) }),
1003
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "fc-wallet-list", children: [
1004
+ showMatrica && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, MatricaWalletEntry, {}),
1005
+ walletsToShow.map((mw) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
1006
+ "button",
1007
+ {
1008
+ type: "button",
1009
+ className: "fc-btn fc-btn-wallet",
1010
+ onClick: () => handleOpen(mw),
1011
+ children: [
1012
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { style: { position: "relative", display: "inline-flex" }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "img", { src: mw.icon, alt: "", className: "fc-wallet-icon" }) }),
1013
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "fc-wallet-name", children: mw.name }),
1014
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "fc-badge-preferred", children: "Open app" })
1015
+ ]
1016
+ },
1017
+ mw.name
1018
+ ))
1019
+ ] }),
911
1020
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "fc-text", style: { textAlign: "center", fontSize: 12, opacity: 0.6 }, children: "You'll be redirected to the wallet app to sign in." }),
912
1021
  showBack && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "fc-switch", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "button", { type: "button", className: "fc-link", onClick: () => setModalStep("method-select"), children: "Back" }) })
913
1022
  ] });
@@ -1017,6 +1126,7 @@ function WalletAdapterFlow() {
1017
1126
  ] })
1018
1127
  ] }) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
1019
1128
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "fc-wallet-list", children: [
1129
+ methods.includes("matrica") && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, MatricaWalletEntry, {}),
1020
1130
  preferredWallets.map((w) => {
1021
1131
  const installed = w.readyState === "Installed";
1022
1132
  const isConnected = w.adapter.name === connectedWalletName;
@@ -1085,7 +1195,7 @@ function WalletAdapterFlow() {
1085
1195
  })
1086
1196
  ] }),
1087
1197
  preferredWallets.length === 0 && otherWallets.length === 0 && mobileExtraWallets.length === 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "fc-text", children: "No wallet found. Please install a Solana wallet (like Phantom) to continue." }),
1088
- _optionalChain([walletConfig, 'optionalAccess', _24 => _24.Transaction]) && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "label", { className: "fc-cold-wallet-toggle", children: [
1198
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "label", { className: "fc-cold-wallet-toggle", children: [
1089
1199
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1090
1200
  "input",
1091
1201
  {
@@ -1234,7 +1344,7 @@ function Verify2FAForm() {
1234
1344
  const inputRef = _react.useRef.call(void 0, null);
1235
1345
  const submittingRef = _react.useRef.call(void 0, false);
1236
1346
  _react.useEffect.call(void 0, () => {
1237
- _optionalChain([inputRef, 'access', _25 => _25.current, 'optionalAccess', _26 => _26.focus, 'call', _27 => _27()]);
1347
+ _optionalChain([inputRef, 'access', _24 => _24.current, 'optionalAccess', _25 => _25.focus, 'call', _26 => _26()]);
1238
1348
  }, [useRecovery]);
1239
1349
  const submitCode = _react.useCallback.call(void 0, async (codeValue, isRecovery) => {
1240
1350
  if (submittingRef.current || !codeValue.trim()) return;
@@ -1255,7 +1365,7 @@ function Verify2FAForm() {
1255
1365
  }
1256
1366
  }, [verify2FA, verifyRecoveryCode]);
1257
1367
  const handleSubmit = async (e) => {
1258
- _optionalChain([e, 'optionalAccess', _28 => _28.preventDefault, 'call', _29 => _29()]);
1368
+ _optionalChain([e, 'optionalAccess', _27 => _27.preventDefault, 'call', _28 => _28()]);
1259
1369
  await submitCode(code, useRecovery);
1260
1370
  };
1261
1371
  const handleCodeChange = (value) => {
@@ -1306,80 +1416,6 @@ function Verify2FAForm() {
1306
1416
  ] });
1307
1417
  }
1308
1418
 
1309
- // src/components/svg-icon.tsx
1310
-
1311
-
1312
- function SvgIcon({ svg, className }) {
1313
- const ref = _react.useRef.call(void 0, null);
1314
- _react.useEffect.call(void 0, () => {
1315
- if (!ref.current || !svg) return;
1316
- try {
1317
- const doc = new DOMParser().parseFromString(svg, "text/html");
1318
- const svgEl = doc.body.querySelector("svg");
1319
- if (!svgEl) {
1320
- ref.current.textContent = "";
1321
- return;
1322
- }
1323
- const dangerous = svgEl.querySelectorAll("script,iframe,object,embed,foreignObject");
1324
- dangerous.forEach((el) => el.remove());
1325
- const all = svgEl.querySelectorAll("*");
1326
- all.forEach((el) => {
1327
- for (const attr of Array.from(el.attributes)) {
1328
- if (attr.name.startsWith("on")) {
1329
- el.removeAttribute(attr.name);
1330
- }
1331
- }
1332
- });
1333
- ref.current.textContent = "";
1334
- ref.current.appendChild(svgEl);
1335
- } catch (e5) {
1336
- ref.current.textContent = "";
1337
- }
1338
- }, [svg]);
1339
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { ref, className });
1340
- }
1341
-
1342
- // src/components/tabs/oauth-buttons.tsx
1343
-
1344
- var PROVIDER_INFO = {
1345
- google: {
1346
- label: "Google",
1347
- icon: '<svg viewBox="0 0 24 24" width="20" height="20"><path d="M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92a5.06 5.06 0 0 1-2.2 3.32v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.1z" fill="#4285F4"/><path d="M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z" fill="#34A853"/><path d="M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z" fill="#FBBC05"/><path d="M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z" fill="#EA4335"/></svg>'
1348
- },
1349
- discord: {
1350
- label: "Discord",
1351
- icon: '<svg viewBox="0 0 24 24" width="20" height="20"><path d="M20.317 4.37a19.791 19.791 0 0 0-4.885-1.515.074.074 0 0 0-.079.037c-.21.375-.444.864-.608 1.25a18.27 18.27 0 0 0-5.487 0 12.64 12.64 0 0 0-.617-1.25.077.077 0 0 0-.079-.037A19.736 19.736 0 0 0 3.677 4.37a.07.07 0 0 0-.032.027C.533 9.046-.32 13.58.099 18.057a.082.082 0 0 0 .031.057 19.9 19.9 0 0 0 5.993 3.03.078.078 0 0 0 .084-.028c.462-.63.874-1.295 1.226-1.994a.076.076 0 0 0-.041-.106 13.107 13.107 0 0 1-1.872-.892.077.077 0 0 1-.008-.128c.126-.094.252-.192.372-.292a.074.074 0 0 1 .077-.01c3.928 1.793 8.18 1.793 12.062 0a.074.074 0 0 1 .078.01c.12.098.246.198.373.292a.077.077 0 0 1-.006.127 12.299 12.299 0 0 1-1.873.892.077.077 0 0 0-.041.107c.36.698.772 1.362 1.225 1.993a.076.076 0 0 0 .084.028 19.839 19.839 0 0 0 6.002-3.03.077.077 0 0 0 .032-.054c.5-5.177-.838-9.674-3.549-13.66a.061.061 0 0 0-.031-.03z" fill="#5865F2"/></svg>'
1352
- },
1353
- twitter: {
1354
- label: "Twitter",
1355
- icon: '<svg viewBox="0 0 24 24" width="20" height="20"><path d="M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z" fill="currentColor"/></svg>'
1356
- },
1357
- apple: {
1358
- label: "Apple",
1359
- icon: '<svg viewBox="0 0 24 24" width="20" height="20"><path d="M17.05 20.28c-.98.95-2.05.88-3.08.4-1.09-.5-2.08-.52-3.23 0-1.44.64-2.2.45-3.06-.4C3.79 16.17 4.36 9.02 8.8 8.78c1.27.06 2.15.72 2.91.76.93-.19 1.82-.88 2.83-.8 1.21.1 2.12.58 2.72 1.49-2.46 1.48-1.88 4.73.52 5.64-.42 1.13-.98 2.24-1.73 3.41zM12.03 8.7c-.12-2.35 1.82-4.38 4.04-4.54.29 2.56-2.34 4.68-4.04 4.54z" fill="currentColor"/></svg>'
1360
- },
1361
- telegram: {
1362
- label: "Telegram",
1363
- icon: '<svg viewBox="0 0 24 24" width="20" height="20"><path d="M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.479.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z" fill="#2AABEE"/></svg>'
1364
- }
1365
- };
1366
- function OAuthButton({ provider }) {
1367
- const { loginWithOAuth } = useForgeConnect();
1368
- const info = PROVIDER_INFO[provider];
1369
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
1370
- "button",
1371
- {
1372
- type: "button",
1373
- className: "fc-btn fc-btn-oauth",
1374
- onClick: () => loginWithOAuth(provider),
1375
- children: [
1376
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, SvgIcon, { svg: info.icon, className: "fc-oauth-icon" }),
1377
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "fc-btn-name", children: info.label })
1378
- ]
1379
- }
1380
- );
1381
- }
1382
-
1383
1419
  // src/components/login-modal.tsx
1384
1420
 
1385
1421
  function LoginModal() {
@@ -1408,10 +1444,10 @@ function LoginModal() {
1408
1444
  }
1409
1445
  };
1410
1446
  const renderLogo = () => {
1411
- if (_optionalChain([config, 'access', _30 => _30.appearance, 'optionalAccess', _31 => _31.logoNode])) {
1447
+ if (_optionalChain([config, 'access', _29 => _29.appearance, 'optionalAccess', _30 => _30.logoNode])) {
1412
1448
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "fc-logo", children: config.appearance.logoNode });
1413
1449
  }
1414
- if (_optionalChain([config, 'access', _32 => _32.appearance, 'optionalAccess', _33 => _33.logo])) {
1450
+ if (_optionalChain([config, 'access', _31 => _31.appearance, 'optionalAccess', _32 => _32.logo])) {
1415
1451
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "img", { src: config.appearance.logo, alt: "", className: "fc-logo" });
1416
1452
  }
1417
1453
  return null;
@@ -1421,20 +1457,21 @@ function LoginModal() {
1421
1457
  {
1422
1458
  className: "fc-modal-content",
1423
1459
  style: {
1424
- "--fc-accent": _nullishCoalesce(_optionalChain([config, 'access', _34 => _34.appearance, 'optionalAccess', _35 => _35.accentColor]), () => ( "#8b5cf6"))
1460
+ "--fc-accent": _nullishCoalesce(_optionalChain([config, 'access', _33 => _33.appearance, 'optionalAccess', _34 => _34.accentColor]), () => ( "#8b5cf6"))
1425
1461
  },
1426
- "data-theme": _nullishCoalesce(_optionalChain([config, 'access', _36 => _36.appearance, 'optionalAccess', _37 => _37.theme]), () => ( "light")),
1462
+ "data-theme": _nullishCoalesce(_optionalChain([config, 'access', _35 => _35.appearance, 'optionalAccess', _36 => _36.theme]), () => ( "light")),
1427
1463
  children: modal.step === "success" || modal.step === "oauth" ? renderStep() : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
1428
1464
  renderLogo(),
1429
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h2", { className: "fc-modal-title", children: _nullishCoalesce(_optionalChain([config, 'access', _38 => _38.appearance, 'optionalAccess', _39 => _39.title]), () => ( "Log in or sign up")) }),
1465
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h2", { className: "fc-modal-title", children: _nullishCoalesce(_optionalChain([config, 'access', _37 => _37.appearance, 'optionalAccess', _38 => _38.title]), () => ( "Log in or sign up")) }),
1430
1466
  renderStep(),
1431
- (_optionalChain([config, 'access', _40 => _40.appearance, 'optionalAccess', _41 => _41.termsUrl]) || _optionalChain([config, 'access', _42 => _42.appearance, 'optionalAccess', _43 => _43.privacyUrl])) && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "fc-legal", children: [
1467
+ (_optionalChain([config, 'access', _39 => _39.appearance, 'optionalAccess', _40 => _40.termsUrl]) || _optionalChain([config, 'access', _41 => _41.appearance, 'optionalAccess', _42 => _42.privacyUrl])) && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "fc-legal", children: [
1432
1468
  "By continuing, you agree to our",
1433
1469
  " ",
1434
1470
  config.appearance.termsUrl && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "a", { href: config.appearance.termsUrl, target: "_blank", rel: "noopener noreferrer", className: "fc-legal-link", children: "Terms" }),
1435
1471
  config.appearance.termsUrl && config.appearance.privacyUrl && " and ",
1436
1472
  config.appearance.privacyUrl && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "a", { href: config.appearance.privacyUrl, target: "_blank", rel: "noopener noreferrer", className: "fc-legal-link", children: "Privacy Policy" })
1437
- ] })
1473
+ ] }),
1474
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, NomuPill, {})
1438
1475
  ] })
1439
1476
  }
1440
1477
  ) });
@@ -1551,6 +1588,22 @@ function OAuthLoadingView() {
1551
1588
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "button", { type: "button", className: "fc-btn fc-btn-secondary", style: { marginTop: "16px" }, onClick: () => setModalStep("method-select"), children: "Cancel" })
1552
1589
  ] });
1553
1590
  }
1591
+ var NOMU_LOGO = '<svg viewBox="0 0 466 115" fill="currentColor" xmlns="http://www.w3.org/2000/svg" aria-label="Nomu"><path d="M86.1037 1.64399C89.2226 2.96692 92.9067 6.05804 94.8954 8.90299C101.195 17.9195 103.263 31.5362 105.652 42.3487C108.921 57.1343 113.078 73.2835 111.843 88.981C111.25 96.5118 107.934 104.178 100.485 106.907C78.5857 114.928 68.4753 94.3605 55.5778 81.0755C54.0151 79.4657 49.9264 75.4498 48.017 74.7242C45.1699 73.6431 46.4243 77.2266 46.9038 78.6202C48.9075 84.4342 52.7842 89.1608 55.1111 94.4333C58.2322 101.506 56.3335 109.491 48.9353 112.563C38.6837 116.818 24.7051 108.932 18.1076 100.994C9.79754 90.9975 3.49328 72.2174 1.14497 59.3049C-1.5908 44.2668 -0.458383 24.9194 16.2003 18.5938C32.7091 12.3216 46.9723 35.7212 56.8964 45.2451C58.5169 46.8013 61.9677 50.9392 63.3912 46.949C64.6285 43.4833 63.6652 36.0102 63.4983 32.0543C62.9845 19.8418 61.3918 -1.3144 79.4334 0.0641835C81.3279 0.209749 84.3483 0.899043 86.1015 1.64399H86.1037Z"/><path d="M198.265 10.0303C208.463 15.8037 214.843 26.2244 217.82 37.2467C220.237 46.1968 221.048 56.7482 219.807 66.1799C216.628 90.3223 200.149 109.849 174.493 110.988C157.695 111.733 139.746 105.682 131.472 90.1896C118.984 66.8071 137.597 43.8678 152.329 27.1128C164.501 13.2691 178.368 -1.23604 198.265 10.0303ZM175.364 41.9176C169.771 38.1072 164.25 44.1996 162.46 49.0803C159.339 57.5916 160.988 72.0346 172.766 71.1591C180.16 70.609 181.427 61.1108 181.02 55.2047C180.752 51.3451 178.7 44.1867 175.364 41.9155V41.9176Z"/><path d="M324.975 3.83292C329.706 5.77236 335.978 13.6051 338.509 17.8479C348.347 34.3438 351.002 53.6547 350.321 73.0085C349.884 85.4008 348.086 102.122 337.415 109.993C321.938 121.407 304.25 107.993 308.199 89.9711C308.681 87.7705 309.725 85.6213 310.52 83.5555C311.913 79.9293 311.83 74.2415 310.92 70.2556C310.903 70.1807 310.614 69.4079 310.483 68.9476C309.62 65.8737 307.548 61.6908 303.712 63.5468C302.409 64.1783 300.839 66.2162 299.022 67.096C292.491 70.2577 283.616 65.5697 280.37 59.4559C279.444 57.707 277.958 52.7728 276.322 51.9444C274.342 50.9425 273.617 52.8948 273.09 54.4382C271.587 58.8437 271.701 66.5394 273.096 71.2232C273.957 74.1088 275.809 76.866 276.92 79.6103C281.115 89.9733 285.647 107.621 270.934 111.791C262.391 114.212 256.003 109.961 250.756 103.888C231.165 81.2072 230.598 47.9049 244.878 21.7289C250.014 12.3142 256.371 6.06777 268.012 6.30967C275.396 6.4638 279.829 10.469 283.241 16.5442C285.532 20.62 287.7 25.1582 290.905 28.7995C293.204 31.4111 296.462 34.0398 299.778 31.2077C303.727 27.8362 305.846 18.0876 308.505 13.2219C311.802 7.18948 317.203 0.649749 324.973 3.83292H324.975Z"/><path d="M452.977 13.4681C459.921 19.2693 464.095 29.0907 465.288 37.8695C468.466 61.282 454.854 98.4611 432.55 109.468C421.31 115.015 406.192 112.904 394.569 109.445C375.919 103.894 364.978 87.4109 363.803 68.2841C362.775 51.5612 371.925 30.2787 381.817 17.15C388.977 7.64763 404.21 11.5072 408.836 21.3243C411.705 27.4124 409.059 30.8824 406.488 36.0436C430.727 62.0334 432.463 57.1377 431.208 47.5453C429.772 36.5723 421.213 13.8256 437.17 9.58065C442.973 8.03724 448.492 9.72193 452.977 13.4681Z"/></svg>';
1592
+ function NomuPill() {
1593
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "fc-nomu-wrap", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
1594
+ "a",
1595
+ {
1596
+ href: "https://www.nomu.dev/",
1597
+ target: "_blank",
1598
+ rel: "noopener noreferrer",
1599
+ className: "fc-nomu-pill",
1600
+ children: [
1601
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Powered by" }),
1602
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, SvgIcon, { svg: NOMU_LOGO, className: "fc-nomu-logo" })
1603
+ ]
1604
+ }
1605
+ ) });
1606
+ }
1554
1607
  function SuccessView() {
1555
1608
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "fc-success", children: [
1556
1609
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "fc-success-icon", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "svg", { viewBox: "0 0 52 52", className: "fc-success-check", children: [
@@ -1645,7 +1698,7 @@ function useUser() {
1645
1698
  _react.useEffect.call(void 0, () => {
1646
1699
  const handleMessage = (event) => {
1647
1700
  if (event.origin !== window.location.origin) return;
1648
- if (_optionalChain([event, 'access', _44 => _44.data, 'optionalAccess', _45 => _45.type]) === "fc_oauth_link_success" && pendingRefreshRef.current) {
1701
+ if (_optionalChain([event, 'access', _43 => _43.data, 'optionalAccess', _44 => _44.type]) === "fc_oauth_link_success" && pendingRefreshRef.current) {
1649
1702
  pendingRefreshRef.current = false;
1650
1703
  fetchAuthMethods().catch(() => {
1651
1704
  });
@@ -1817,7 +1870,7 @@ function useSessions() {
1817
1870
 
1818
1871
  function TwoFactorModal({ isOpen, onClose, initialEnabled, onStatusChange }) {
1819
1872
  const { api, getAccessToken, config } = useForgeConnect();
1820
- const theme = _nullishCoalesce(_optionalChain([config, 'access', _46 => _46.appearance, 'optionalAccess', _47 => _47.theme]), () => ( "light"));
1873
+ const theme = _nullishCoalesce(_optionalChain([config, 'access', _45 => _45.appearance, 'optionalAccess', _46 => _46.theme]), () => ( "light"));
1821
1874
  const [step, setStep] = _react.useState.call(void 0, initialEnabled ? "manage" : "setup");
1822
1875
  const [setupData, setSetupData] = _react.useState.call(void 0, null);
1823
1876
  const [code, setCode] = _react.useState.call(void 0, "");
@@ -1910,7 +1963,7 @@ function TwoFactorModal({ isOpen, onClose, initialEnabled, onStatusChange }) {
1910
1963
  "div",
1911
1964
  {
1912
1965
  className: "fc-modal-content",
1913
- style: { "--fc-accent": _nullishCoalesce(_optionalChain([config, 'access', _48 => _48.appearance, 'optionalAccess', _49 => _49.accentColor]), () => ( "#8b5cf6")) },
1966
+ style: { "--fc-accent": _nullishCoalesce(_optionalChain([config, 'access', _47 => _47.appearance, 'optionalAccess', _48 => _48.accentColor]), () => ( "#8b5cf6")) },
1914
1967
  "data-theme": theme,
1915
1968
  children: [
1916
1969
  step === "setup" && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
@@ -2118,7 +2171,7 @@ function base64URLStringToBuffer(base64URLString) {
2118
2171
 
2119
2172
  // ../../node_modules/.pnpm/@simplewebauthn+browser@13.2.2/node_modules/@simplewebauthn/browser/esm/helpers/browserSupportsWebAuthn.js
2120
2173
  function browserSupportsWebAuthn() {
2121
- return _browserSupportsWebAuthnInternals.stubThis(_optionalChain([globalThis, 'optionalAccess', _50 => _50.PublicKeyCredential]) !== void 0 && typeof globalThis.PublicKeyCredential === "function");
2174
+ return _browserSupportsWebAuthnInternals.stubThis(_optionalChain([globalThis, 'optionalAccess', _49 => _49.PublicKeyCredential]) !== void 0 && typeof globalThis.PublicKeyCredential === "function");
2122
2175
  }
2123
2176
  var _browserSupportsWebAuthnInternals = {
2124
2177
  stubThis: (value) => value
@@ -2177,7 +2230,7 @@ function identifyRegistrationError({ error, options }) {
2177
2230
  });
2178
2231
  }
2179
2232
  } else if (error.name === "ConstraintError") {
2180
- if (_optionalChain([publicKey, 'access', _51 => _51.authenticatorSelection, 'optionalAccess', _52 => _52.requireResidentKey]) === true) {
2233
+ if (_optionalChain([publicKey, 'access', _50 => _50.authenticatorSelection, 'optionalAccess', _51 => _51.requireResidentKey]) === true) {
2181
2234
  return new WebAuthnError({
2182
2235
  message: "Discoverable credentials were required but no available authenticator supported it",
2183
2236
  code: "ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",
@@ -2185,14 +2238,14 @@ function identifyRegistrationError({ error, options }) {
2185
2238
  });
2186
2239
  } else if (
2187
2240
  // @ts-ignore: `mediation` doesn't yet exist on CredentialCreationOptions but it's possible as of Sept 2024
2188
- options.mediation === "conditional" && _optionalChain([publicKey, 'access', _53 => _53.authenticatorSelection, 'optionalAccess', _54 => _54.userVerification]) === "required"
2241
+ options.mediation === "conditional" && _optionalChain([publicKey, 'access', _52 => _52.authenticatorSelection, 'optionalAccess', _53 => _53.userVerification]) === "required"
2189
2242
  ) {
2190
2243
  return new WebAuthnError({
2191
2244
  message: "User verification was required during automatic registration but it could not be performed",
2192
2245
  code: "ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",
2193
2246
  cause: error
2194
2247
  });
2195
- } else if (_optionalChain([publicKey, 'access', _55 => _55.authenticatorSelection, 'optionalAccess', _56 => _56.userVerification]) === "required") {
2248
+ } else if (_optionalChain([publicKey, 'access', _54 => _54.authenticatorSelection, 'optionalAccess', _55 => _55.userVerification]) === "required") {
2196
2249
  return new WebAuthnError({
2197
2250
  message: "User verification was required but no available authenticator supported it",
2198
2251
  code: "ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",
@@ -2318,7 +2371,7 @@ async function startRegistration(options) {
2318
2371
  ...optionsJSON.user,
2319
2372
  id: base64URLStringToBuffer(optionsJSON.user.id)
2320
2373
  },
2321
- excludeCredentials: _optionalChain([optionsJSON, 'access', _57 => _57.excludeCredentials, 'optionalAccess', _58 => _58.map, 'call', _59 => _59(toPublicKeyCredentialDescriptor)])
2374
+ excludeCredentials: _optionalChain([optionsJSON, 'access', _56 => _56.excludeCredentials, 'optionalAccess', _57 => _57.map, 'call', _58 => _58(toPublicKeyCredentialDescriptor)])
2322
2375
  };
2323
2376
  const createOptions = {};
2324
2377
  if (useAutoRegister) {
@@ -2394,7 +2447,7 @@ function browserSupportsWebAuthnAutofill() {
2394
2447
  return _browserSupportsWebAuthnAutofillInternals.stubThis(new Promise((resolve) => resolve(false)));
2395
2448
  }
2396
2449
  const globalPublicKeyCredential = globalThis.PublicKeyCredential;
2397
- if (_optionalChain([globalPublicKeyCredential, 'optionalAccess', _60 => _60.isConditionalMediationAvailable]) === void 0) {
2450
+ if (_optionalChain([globalPublicKeyCredential, 'optionalAccess', _59 => _59.isConditionalMediationAvailable]) === void 0) {
2398
2451
  return _browserSupportsWebAuthnAutofillInternals.stubThis(new Promise((resolve) => resolve(false)));
2399
2452
  }
2400
2453
  return _browserSupportsWebAuthnAutofillInternals.stubThis(globalPublicKeyCredential.isConditionalMediationAvailable());
@@ -2459,8 +2512,8 @@ async function startAuthentication(options) {
2459
2512
  throw new Error("WebAuthn is not supported in this browser");
2460
2513
  }
2461
2514
  let allowCredentials;
2462
- if (_optionalChain([optionsJSON, 'access', _61 => _61.allowCredentials, 'optionalAccess', _62 => _62.length]) !== 0) {
2463
- allowCredentials = _optionalChain([optionsJSON, 'access', _63 => _63.allowCredentials, 'optionalAccess', _64 => _64.map, 'call', _65 => _65(toPublicKeyCredentialDescriptor)]);
2515
+ if (_optionalChain([optionsJSON, 'access', _60 => _60.allowCredentials, 'optionalAccess', _61 => _61.length]) !== 0) {
2516
+ allowCredentials = _optionalChain([optionsJSON, 'access', _62 => _62.allowCredentials, 'optionalAccess', _63 => _63.map, 'call', _64 => _64(toPublicKeyCredentialDescriptor)]);
2464
2517
  }
2465
2518
  const publicKey = {
2466
2519
  ...optionsJSON,
@@ -2514,7 +2567,7 @@ async function startAuthentication(options) {
2514
2567
 
2515
2568
  function PasskeysModal({ isOpen, onClose, onCountChange }) {
2516
2569
  const { api, getAccessToken, config } = useForgeConnect();
2517
- const theme = _nullishCoalesce(_optionalChain([config, 'access', _66 => _66.appearance, 'optionalAccess', _67 => _67.theme]), () => ( "light"));
2570
+ const theme = _nullishCoalesce(_optionalChain([config, 'access', _65 => _65.appearance, 'optionalAccess', _66 => _66.theme]), () => ( "light"));
2518
2571
  const [passkeys, setPasskeys] = _react.useState.call(void 0, []);
2519
2572
  const [loading, setLoading] = _react.useState.call(void 0, false);
2520
2573
  const [addLoading, setAddLoading] = _react.useState.call(void 0, false);
@@ -2574,7 +2627,7 @@ function PasskeysModal({ isOpen, onClose, onCountChange }) {
2574
2627
  "div",
2575
2628
  {
2576
2629
  className: "fc-modal-content",
2577
- style: { "--fc-accent": _nullishCoalesce(_optionalChain([config, 'access', _68 => _68.appearance, 'optionalAccess', _69 => _69.accentColor]), () => ( "#8b5cf6")) },
2630
+ style: { "--fc-accent": _nullishCoalesce(_optionalChain([config, 'access', _67 => _67.appearance, 'optionalAccess', _68 => _68.accentColor]), () => ( "#8b5cf6")) },
2578
2631
  "data-theme": theme,
2579
2632
  children: [
2580
2633
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h2", { className: "fc-modal-title", children: "Passkeys" }),
@@ -2648,7 +2701,7 @@ function ErrorView({
2648
2701
 
2649
2702
  function PasswordModal({ isOpen, onClose, hasPassword }) {
2650
2703
  const { api, getAccessToken, config } = useForgeConnect();
2651
- const theme = _nullishCoalesce(_optionalChain([config, 'access', _70 => _70.appearance, 'optionalAccess', _71 => _71.theme]), () => ( "light"));
2704
+ const theme = _nullishCoalesce(_optionalChain([config, 'access', _69 => _69.appearance, 'optionalAccess', _70 => _70.theme]), () => ( "light"));
2652
2705
  const [step, setStep] = _react.useState.call(void 0, "form");
2653
2706
  const [currentPassword, setCurrentPassword] = _react.useState.call(void 0, "");
2654
2707
  const [newPassword, setNewPassword] = _react.useState.call(void 0, "");
@@ -2685,7 +2738,7 @@ function PasswordModal({ isOpen, onClose, hasPassword }) {
2685
2738
  "div",
2686
2739
  {
2687
2740
  className: "fc-modal-content",
2688
- style: { "--fc-accent": _nullishCoalesce(_optionalChain([config, 'access', _72 => _72.appearance, 'optionalAccess', _73 => _73.accentColor]), () => ( "#8b5cf6")) },
2741
+ style: { "--fc-accent": _nullishCoalesce(_optionalChain([config, 'access', _71 => _71.appearance, 'optionalAccess', _72 => _72.accentColor]), () => ( "#8b5cf6")) },
2689
2742
  "data-theme": theme,
2690
2743
  children: step === "done" ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "fc-tab", style: { textAlign: "center", padding: "24px 0" }, children: [
2691
2744
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "fc-success", children: [
@@ -2754,7 +2807,7 @@ function PasswordModal({ isOpen, onClose, hasPassword }) {
2754
2807
 
2755
2808
  function DeleteAccountModal({ isOpen, onClose, onDeleted }) {
2756
2809
  const { api, getAccessToken, config, logout } = useForgeConnect();
2757
- const theme = _nullishCoalesce(_optionalChain([config, 'access', _74 => _74.appearance, 'optionalAccess', _75 => _75.theme]), () => ( "light"));
2810
+ const theme = _nullishCoalesce(_optionalChain([config, 'access', _73 => _73.appearance, 'optionalAccess', _74 => _74.theme]), () => ( "light"));
2758
2811
  const [step, setStep] = _react.useState.call(void 0, "confirm");
2759
2812
  const [code, setCode] = _react.useState.call(void 0, "");
2760
2813
  const [loading, setLoading] = _react.useState.call(void 0, false);
@@ -2814,7 +2867,7 @@ function DeleteAccountModal({ isOpen, onClose, onDeleted }) {
2814
2867
  "div",
2815
2868
  {
2816
2869
  className: "fc-modal-content",
2817
- style: { "--fc-accent": _nullishCoalesce(_optionalChain([config, 'access', _76 => _76.appearance, 'optionalAccess', _77 => _77.accentColor]), () => ( "#8b5cf6")) },
2870
+ style: { "--fc-accent": _nullishCoalesce(_optionalChain([config, 'access', _75 => _75.appearance, 'optionalAccess', _76 => _76.accentColor]), () => ( "#8b5cf6")) },
2818
2871
  "data-theme": theme,
2819
2872
  children: [
2820
2873
  step === "confirm" && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
@@ -2941,20 +2994,20 @@ function AccountModal() {
2941
2994
  prevLinkOpen.current = linkModal.isOpen;
2942
2995
  }, [linkModal.isOpen]);
2943
2996
  if (!accountModal.isOpen) return null;
2944
- const theme = _nullishCoalesce(_optionalChain([config, 'access', _78 => _78.appearance, 'optionalAccess', _79 => _79.theme]), () => ( "light"));
2945
- const initial = (_nullishCoalesce(_nullishCoalesce(_optionalChain([user, 'optionalAccess', _80 => _80.displayName]), () => ( _optionalChain([user, 'optionalAccess', _81 => _81.primaryEmail]))), () => ( "?"))).charAt(0).toUpperCase();
2997
+ const theme = _nullishCoalesce(_optionalChain([config, 'access', _77 => _77.appearance, 'optionalAccess', _78 => _78.theme]), () => ( "light"));
2998
+ const initial = (_nullishCoalesce(_nullishCoalesce(_optionalChain([user, 'optionalAccess', _79 => _79.displayName]), () => ( _optionalChain([user, 'optionalAccess', _80 => _80.primaryEmail]))), () => ( "?"))).charAt(0).toUpperCase();
2946
2999
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ModalOverlay, { isOpen: accountModal.isOpen, onClose: closeAccountModal, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
2947
3000
  "div",
2948
3001
  {
2949
3002
  className: "fc-modal-content",
2950
- style: { "--fc-accent": _nullishCoalesce(_optionalChain([config, 'access', _82 => _82.appearance, 'optionalAccess', _83 => _83.accentColor]), () => ( "#8b5cf6")) },
3003
+ style: { "--fc-accent": _nullishCoalesce(_optionalChain([config, 'access', _81 => _81.appearance, 'optionalAccess', _82 => _82.accentColor]), () => ( "#8b5cf6")) },
2951
3004
  "data-theme": theme,
2952
3005
  children: [
2953
3006
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "fc-account-hero", children: [
2954
- _optionalChain([user, 'optionalAccess', _84 => _84.avatarUrl]) ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "img", { src: user.avatarUrl, alt: "", className: "fc-account-hero-avatar" }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "fc-account-hero-avatar fc-account-hero-avatar-placeholder", children: initial }),
3007
+ _optionalChain([user, 'optionalAccess', _83 => _83.avatarUrl]) ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "img", { src: user.avatarUrl, alt: "", className: "fc-account-hero-avatar" }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "fc-account-hero-avatar fc-account-hero-avatar-placeholder", children: initial }),
2955
3008
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "fc-account-hero-info", children: [
2956
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "fc-account-hero-name", children: _nullishCoalesce(_optionalChain([user, 'optionalAccess', _85 => _85.displayName]), () => ( "Your account")) }),
2957
- _optionalChain([user, 'optionalAccess', _86 => _86.primaryEmail]) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "fc-account-hero-email", children: user.primaryEmail })
3009
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "fc-account-hero-name", children: _nullishCoalesce(_optionalChain([user, 'optionalAccess', _84 => _84.displayName]), () => ( "Your account")) }),
3010
+ _optionalChain([user, 'optionalAccess', _85 => _85.primaryEmail]) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "fc-account-hero-email", children: user.primaryEmail })
2958
3011
  ] })
2959
3012
  ] }),
2960
3013
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "fc-account-tabs", children: TABS.map((tab) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
@@ -2992,13 +3045,13 @@ function AccountModal() {
2992
3045
  }
2993
3046
  function ProfileTab() {
2994
3047
  const { user, updateProfile } = useUser();
2995
- const [displayName, setDisplayName] = _react.useState.call(void 0, _nullishCoalesce(_optionalChain([user, 'optionalAccess', _87 => _87.displayName]), () => ( "")));
2996
- const [avatarUrl, setAvatarUrl] = _react.useState.call(void 0, _nullishCoalesce(_optionalChain([user, 'optionalAccess', _88 => _88.avatarUrl]), () => ( "")));
3048
+ const [displayName, setDisplayName] = _react.useState.call(void 0, _nullishCoalesce(_optionalChain([user, 'optionalAccess', _86 => _86.displayName]), () => ( "")));
3049
+ const [avatarUrl, setAvatarUrl] = _react.useState.call(void 0, _nullishCoalesce(_optionalChain([user, 'optionalAccess', _87 => _87.avatarUrl]), () => ( "")));
2997
3050
  const [loading, setLoading] = _react.useState.call(void 0, false);
2998
3051
  const [msg, setMsg] = _react.useState.call(void 0, null);
2999
3052
  _react.useEffect.call(void 0, () => {
3000
- setDisplayName(_nullishCoalesce(_optionalChain([user, 'optionalAccess', _89 => _89.displayName]), () => ( "")));
3001
- setAvatarUrl(_nullishCoalesce(_optionalChain([user, 'optionalAccess', _90 => _90.avatarUrl]), () => ( "")));
3053
+ setDisplayName(_nullishCoalesce(_optionalChain([user, 'optionalAccess', _88 => _88.displayName]), () => ( "")));
3054
+ setAvatarUrl(_nullishCoalesce(_optionalChain([user, 'optionalAccess', _89 => _89.avatarUrl]), () => ( "")));
3002
3055
  }, [user]);
3003
3056
  const handleSave = async () => {
3004
3057
  setLoading(true);
@@ -3063,7 +3116,7 @@ function LoginsTab({ onLink, refreshKey }) {
3063
3116
  msg && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "fc-error", children: msg }),
3064
3117
  loading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "fc-text", children: "Loading..." }),
3065
3118
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "fc-account-section-desc", children: "Ways you can sign in to your account." }),
3066
- _optionalChain([authMethods, 'optionalAccess', _91 => _91.map, 'call', _92 => _92((m) => {
3119
+ _optionalChain([authMethods, 'optionalAccess', _90 => _90.map, 'call', _91 => _91((m) => {
3067
3120
  const display = getMethodDisplay(m.provider);
3068
3121
  const detail = m.provider === "email" ? m.providerId : m.provider.endsWith("_wallet") ? truncate(m.providerId) : m.providerId;
3069
3122
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "fc-account-item", children: [
@@ -3078,7 +3131,7 @@ function LoginsTab({ onLink, refreshKey }) {
3078
3131
  ] })
3079
3132
  ] }, m.id);
3080
3133
  })]),
3081
- _optionalChain([authMethods, 'optionalAccess', _93 => _93.length]) === 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "fc-account-empty", children: "No login methods yet" }),
3134
+ _optionalChain([authMethods, 'optionalAccess', _92 => _92.length]) === 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "fc-account-empty", children: "No login methods yet" }),
3082
3135
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "button", { type: "button", className: "fc-btn fc-btn-secondary", onClick: onLink, style: { marginTop: 8 }, children: "+ Add login method" })
3083
3136
  ] });
3084
3137
  }
@@ -3101,8 +3154,8 @@ function WalletsTab({ onLink, refreshKey }) {
3101
3154
  msg && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "fc-error", children: msg }),
3102
3155
  loading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "fc-text", children: "Loading..." }),
3103
3156
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "fc-account-section-desc", children: "Crypto wallets connected to your account." }),
3104
- _optionalChain([wallets, 'optionalAccess', _94 => _94.map, 'call', _95 => _95((w) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "fc-account-item", children: [
3105
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, SvgIcon, { svg: _nullishCoalesce(_optionalChain([METHOD_DISPLAY, 'access', _96 => _96[`${w.chain}_wallet`], 'optionalAccess', _97 => _97.iconHtml]), () => ( "")), className: "fc-account-item-icon" }),
3157
+ _optionalChain([wallets, 'optionalAccess', _93 => _93.map, 'call', _94 => _94((w) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "fc-account-item", children: [
3158
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, SvgIcon, { svg: _nullishCoalesce(_optionalChain([METHOD_DISPLAY, 'access', _95 => _95[`${w.chain}_wallet`], 'optionalAccess', _96 => _96.iconHtml]), () => ( "")), className: "fc-account-item-icon" }),
3106
3159
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "fc-account-item-info", children: [
3107
3160
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "fc-account-item-label", children: [
3108
3161
  w.chain.charAt(0).toUpperCase() + w.chain.slice(1),
@@ -3112,7 +3165,7 @@ function WalletsTab({ onLink, refreshKey }) {
3112
3165
  ] }),
3113
3166
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "fc-account-item-actions", children: !w.isPrimary && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "button", { type: "button", className: "fc-btn-primary-sm", onClick: () => handleSetPrimary(w.id), children: "Make primary" }) })
3114
3167
  ] }, w.id))]),
3115
- _optionalChain([wallets, 'optionalAccess', _98 => _98.length]) === 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "fc-account-empty", children: "No wallets connected" }),
3168
+ _optionalChain([wallets, 'optionalAccess', _97 => _97.length]) === 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "fc-account-empty", children: "No wallets connected" }),
3116
3169
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "button", { type: "button", className: "fc-btn fc-btn-secondary", onClick: onLink, style: { marginTop: 8 }, children: "+ Connect wallet" })
3117
3170
  ] });
3118
3171
  }
@@ -3147,7 +3200,7 @@ function SecurityTab() {
3147
3200
  refreshStatus();
3148
3201
  refreshPasskeyCount();
3149
3202
  }, [fetchSessions, fetchAuthMethods, refreshStatus, refreshPasskeyCount]);
3150
- const hasPassword = _optionalChain([userAuthMethods, 'optionalAccess', _99 => _99.some, 'call', _100 => _100((m) => m.provider === "email")]);
3203
+ const hasPassword = _optionalChain([userAuthMethods, 'optionalAccess', _98 => _98.some, 'call', _99 => _99((m) => m.provider === "email")]);
3151
3204
  const handleRevoke = async (id) => {
3152
3205
  setMsg("");
3153
3206
  try {
@@ -3181,7 +3234,7 @@ function SecurityTab() {
3181
3234
  ] }),
3182
3235
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ChevronRight, {})
3183
3236
  ] }),
3184
- _optionalChain([user, 'optionalAccess', _101 => _101.primaryEmail]) && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
3237
+ _optionalChain([user, 'optionalAccess', _100 => _100.primaryEmail]) && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
3185
3238
  "button",
3186
3239
  {
3187
3240
  type: "button",
@@ -3202,7 +3255,7 @@ function SecurityTab() {
3202
3255
  ),
3203
3256
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "fc-divider", style: { margin: "16px 0" }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "active sessions" }) }),
3204
3257
  loading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "fc-text", children: "Loading..." }),
3205
- _optionalChain([sessions, 'optionalAccess', _102 => _102.map, 'call', _103 => _103((s) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "fc-account-item", children: [
3258
+ _optionalChain([sessions, 'optionalAccess', _101 => _101.map, 'call', _102 => _102((s) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "fc-account-item", children: [
3206
3259
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "fc-account-item-icon", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "svg", { width: "16", height: "16", viewBox: "0 0 20 20", fill: "none", children: [
3207
3260
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "rect", { x: "2", y: "3", width: "16", height: "11", rx: "2", stroke: "currentColor", strokeWidth: "1.5" }),
3208
3261
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { d: "M7 17h6M10 14v3", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })
@@ -3218,7 +3271,7 @@ function SecurityTab() {
3218
3271
  ] }),
3219
3272
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "fc-account-item-actions", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "button", { type: "button", className: "fc-btn-danger-sm", onClick: () => handleRevoke(s.id), children: "Sign out" }) })
3220
3273
  ] }, s.id))]),
3221
- _optionalChain([sessions, 'optionalAccess', _104 => _104.length]) === 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "fc-account-empty", children: "No active sessions" }),
3274
+ _optionalChain([sessions, 'optionalAccess', _103 => _103.length]) === 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "fc-account-empty", children: "No active sessions" }),
3222
3275
  sessions && sessions.length > 1 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3223
3276
  "button",
3224
3277
  {
@@ -3265,7 +3318,7 @@ function SecurityTab() {
3265
3318
  onCountChange: (count) => setPasskeyCount(count)
3266
3319
  }
3267
3320
  ),
3268
- _optionalChain([user, 'optionalAccess', _105 => _105.primaryEmail]) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3321
+ _optionalChain([user, 'optionalAccess', _104 => _104.primaryEmail]) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3269
3322
  PasswordModal,
3270
3323
  {
3271
3324
  isOpen: showPasswordModal,
@@ -3310,7 +3363,7 @@ function LinkAuthModal() {
3310
3363
  if (!linkModal.isOpen) return;
3311
3364
  const handleMessage = (event) => {
3312
3365
  if (event.origin !== window.location.origin) return;
3313
- if (_optionalChain([event, 'access', _106 => _106.data, 'optionalAccess', _107 => _107.type]) === "fc_oauth_link_success") {
3366
+ if (_optionalChain([event, 'access', _105 => _105.data, 'optionalAccess', _106 => _106.type]) === "fc_oauth_link_success") {
3314
3367
  setStep("success");
3315
3368
  setTimeout(() => {
3316
3369
  handleClose();
@@ -3321,7 +3374,7 @@ function LinkAuthModal() {
3321
3374
  return () => window.removeEventListener("message", handleMessage);
3322
3375
  }, [linkModal.isOpen]);
3323
3376
  if (!linkModal.isOpen) return null;
3324
- const theme = _nullishCoalesce(_optionalChain([config, 'access', _108 => _108.appearance, 'optionalAccess', _109 => _109.theme]), () => ( "light"));
3377
+ const theme = _nullishCoalesce(_optionalChain([config, 'access', _107 => _107.appearance, 'optionalAccess', _108 => _108.theme]), () => ( "light"));
3325
3378
  const handleClose = () => {
3326
3379
  setStep("method-select");
3327
3380
  closeLinkModal();
@@ -3344,7 +3397,7 @@ function LinkAuthModal() {
3344
3397
  "div",
3345
3398
  {
3346
3399
  className: "fc-modal-content",
3347
- style: { "--fc-accent": _nullishCoalesce(_optionalChain([config, 'access', _110 => _110.appearance, 'optionalAccess', _111 => _111.accentColor]), () => ( "#8b5cf6")) },
3400
+ style: { "--fc-accent": _nullishCoalesce(_optionalChain([config, 'access', _109 => _109.appearance, 'optionalAccess', _110 => _110.accentColor]), () => ( "#8b5cf6")) },
3348
3401
  "data-theme": theme,
3349
3402
  children: step === "success" ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, SuccessView2, {}) : step === "error" ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3350
3403
  ErrorView,
@@ -3360,7 +3413,7 @@ function LinkAuthModal() {
3360
3413
  AuthMethodSelectStep,
3361
3414
  {
3362
3415
  config,
3363
- connectedProviders: _nullishCoalesce(_optionalChain([authMethods, 'optionalAccess', _112 => _112.map, 'call', _113 => _113((m) => m.provider)]), () => ( [])),
3416
+ connectedProviders: _nullishCoalesce(_optionalChain([authMethods, 'optionalAccess', _111 => _111.map, 'call', _112 => _112((m) => m.provider)]), () => ( [])),
3364
3417
  onSelectEmail: () => setStep("email"),
3365
3418
  onSelectOtp: () => setStep("otp"),
3366
3419
  onOAuth: handleOAuthDirect
@@ -3579,13 +3632,13 @@ function WalletLinkStep({ onBack, onSuccess, onFatalError }) {
3579
3632
  const [coldWallet, setColdWallet] = _react.useState.call(void 0, false);
3580
3633
  const mobile = _react.useMemo.call(void 0, () => isMobile(), []);
3581
3634
  const walletConfig = config.walletConfig;
3582
- const preferred = _nullishCoalesce(_optionalChain([walletConfig, 'optionalAccess', _114 => _114.preferredWallets]), () => ( []));
3583
- const onlyPreferred = _nullishCoalesce(_optionalChain([walletConfig, 'optionalAccess', _115 => _115.onlyPreferred]), () => ( false));
3635
+ const preferred = _nullishCoalesce(_optionalChain([walletConfig, 'optionalAccess', _113 => _113.preferredWallets]), () => ( []));
3636
+ const onlyPreferred = _nullishCoalesce(_optionalChain([walletConfig, 'optionalAccess', _114 => _114.onlyPreferred]), () => ( false));
3584
3637
  const coldWalletRef = _react.useRef.call(void 0, coldWallet);
3585
3638
  coldWalletRef.current = coldWallet;
3586
3639
  const buildSignTxFnForAdapter = _react.useCallback.call(void 0, (adapter) => {
3587
3640
  if (!adapter.signTransaction) return void 0;
3588
- const TxClass = _optionalChain([walletConfig, 'optionalAccess', _116 => _116.Transaction]);
3641
+ const TxClass = _optionalChain([walletConfig, 'optionalAccess', _115 => _115.Transaction]);
3589
3642
  if (!TxClass) return void 0;
3590
3643
  return async (txBase64) => {
3591
3644
  const bytes = Uint8Array.from(atob(txBase64), (c) => c.charCodeAt(0));
@@ -3593,7 +3646,7 @@ function WalletLinkStep({ onBack, onSuccess, onFatalError }) {
3593
3646
  const signedTx = await adapter.signTransaction(tx);
3594
3647
  return btoa(String.fromCharCode(...new Uint8Array(signedTx.serialize())));
3595
3648
  };
3596
- }, [_optionalChain([walletConfig, 'optionalAccess', _117 => _117.Transaction])]);
3649
+ }, [_optionalChain([walletConfig, 'optionalAccess', _116 => _116.Transaction])]);
3597
3650
  const wallet = walletAdapter;
3598
3651
  const handleConnect = async (w) => {
3599
3652
  if (w.readyState !== "Installed") {
@@ -3636,12 +3689,12 @@ function WalletLinkStep({ onBack, onSuccess, onFatalError }) {
3636
3689
  const prefSet = new Set(preferred);
3637
3690
  const others = all.filter((w) => !prefSet.has(w.adapter.name) && w.readyState === "Installed");
3638
3691
  return { preferredWallets: prefList, otherWallets: others };
3639
- }, [_optionalChain([walletAdapter, 'optionalAccess', _118 => _118.wallets]), walletConfig]);
3692
+ }, [_optionalChain([walletAdapter, 'optionalAccess', _117 => _117.wallets]), walletConfig]);
3640
3693
  const mobileExtraWallets = _react.useMemo.call(void 0, () => {
3641
3694
  if (!mobile || !walletAdapter) return [];
3642
3695
  const adapterNames = new Set(walletAdapter.wallets.map((w) => w.adapter.name));
3643
3696
  return MOBILE_WALLETS.filter((mw) => !adapterNames.has(mw.name));
3644
- }, [mobile, _optionalChain([walletAdapter, 'optionalAccess', _119 => _119.wallets])]);
3697
+ }, [mobile, _optionalChain([walletAdapter, 'optionalAccess', _118 => _118.wallets])]);
3645
3698
  if (!walletAdapter && mobile) {
3646
3699
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "fc-tab", children: [
3647
3700
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "fc-wallet-list", children: MOBILE_WALLETS.map((mw) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
@@ -3737,7 +3790,7 @@ function WalletLinkStep({ onBack, onSuccess, onFatalError }) {
3737
3790
  ] }, w.adapter.name))
3738
3791
  ] }),
3739
3792
  preferredWallets.length === 0 && otherWallets.length === 0 && mobileExtraWallets.length === 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "fc-text", children: "No wallet found. Please install a Solana wallet (like Phantom) to continue." }),
3740
- _optionalChain([walletConfig, 'optionalAccess', _120 => _120.Transaction]) && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "label", { className: "fc-cold-wallet-toggle", children: [
3793
+ _optionalChain([walletConfig, 'optionalAccess', _119 => _119.Transaction]) && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "label", { className: "fc-cold-wallet-toggle", children: [
3741
3794
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3742
3795
  "input",
3743
3796
  {
@@ -3769,6 +3822,7 @@ function SuccessView2() {
3769
3822
 
3770
3823
  // src/provider.tsx
3771
3824
 
3825
+ var oauthExchangeCache = /* @__PURE__ */ new Map();
3772
3826
  function ForgeConnectProvider({ config, children, onLogin, onLogout, walletAdapter }) {
3773
3827
  const [auth, setAuth] = _react.useState.call(void 0, {
3774
3828
  status: "loading",
@@ -3827,42 +3881,81 @@ function ForgeConnectProvider({ config, children, onLogin, onLogout, walletAdapt
3827
3881
  return;
3828
3882
  }
3829
3883
  const authCode = params.get("fc_code");
3830
- if (authCode && window.opener) {
3831
- window.opener.postMessage(
3832
- { type: "fc_oauth_code", code: authCode },
3833
- window.location.origin
3834
- );
3884
+ if (authCode) {
3885
+ try {
3886
+ localStorage.setItem("fc_oauth_code_pending", authCode);
3887
+ } catch (e9) {
3888
+ }
3889
+ if (window.opener) {
3890
+ window.opener.postMessage(
3891
+ { type: "fc_oauth_code", code: authCode },
3892
+ window.location.origin
3893
+ );
3894
+ }
3835
3895
  window.close();
3836
3896
  return;
3837
3897
  }
3838
3898
  }
3839
- const handleMessage = async (event) => {
3899
+ const handleCode = async (code) => {
3900
+ let exchangePromise = oauthExchangeCache.get(code);
3901
+ if (!exchangePromise) {
3902
+ try {
3903
+ localStorage.removeItem("fc_oauth_code_pending");
3904
+ } catch (e10) {
3905
+ }
3906
+ exchangePromise = (async () => {
3907
+ try {
3908
+ const result = await api.exchangeOAuthCode(code);
3909
+ if (result.requires2FA && result.challengeToken) {
3910
+ return { kind: "requires2FA", challengeToken: result.challengeToken };
3911
+ }
3912
+ const token = result.accessToken;
3913
+ if (!token) return null;
3914
+ const user = await api.getMe(token);
3915
+ return { kind: "authenticated", accessToken: token, user };
3916
+ } catch (e11) {
3917
+ return null;
3918
+ }
3919
+ })();
3920
+ oauthExchangeCache.set(code, exchangePromise);
3921
+ }
3922
+ const outcome = await exchangePromise;
3923
+ if (!outcome) return;
3924
+ if (outcome.kind === "requires2FA") {
3925
+ setChallengeToken(outcome.challengeToken);
3926
+ setModal({ isOpen: true, step: "verify-2fa" });
3927
+ return;
3928
+ }
3929
+ setModal({ isOpen: true, step: "success" });
3930
+ setAuth({ status: "authenticated", user: outcome.user, accessToken: outcome.accessToken });
3931
+ scheduleRefresh(outcome.accessToken);
3932
+ _optionalChain([onLogin, 'optionalCall', _120 => _120(outcome.user)]);
3933
+ setTimeout(() => {
3934
+ setModal({ isOpen: false, step: "method-select" });
3935
+ }, 1500);
3936
+ };
3937
+ const handleMessage = (event) => {
3840
3938
  if (event.origin !== window.location.origin) return;
3841
3939
  if (_optionalChain([event, 'access', _121 => _121.data, 'optionalAccess', _122 => _122.type]) !== "fc_oauth_code") return;
3842
3940
  const code = event.data.code;
3843
3941
  if (!code) return;
3844
- try {
3845
- const result = await api.exchangeOAuthCode(code);
3846
- if (result.requires2FA && result.challengeToken) {
3847
- setChallengeToken(result.challengeToken);
3848
- setModal({ isOpen: true, step: "verify-2fa" });
3849
- return;
3850
- }
3851
- const token = result.accessToken;
3852
- if (!token) return;
3853
- setModal({ isOpen: true, step: "success" });
3854
- const user = await api.getMe(token);
3855
- setAuth({ status: "authenticated", user, accessToken: token });
3856
- scheduleRefresh(token);
3857
- _optionalChain([onLogin, 'optionalCall', _123 => _123(user)]);
3858
- setTimeout(() => {
3859
- setModal({ isOpen: false, step: "method-select" });
3860
- }, 1500);
3861
- } catch (e9) {
3862
- }
3942
+ void handleCode(code);
3943
+ };
3944
+ const handleStorage = (event) => {
3945
+ if (event.key !== "fc_oauth_code_pending" || !event.newValue) return;
3946
+ void handleCode(event.newValue);
3863
3947
  };
3948
+ try {
3949
+ const pending = localStorage.getItem("fc_oauth_code_pending");
3950
+ if (pending) void handleCode(pending);
3951
+ } catch (e12) {
3952
+ }
3864
3953
  window.addEventListener("message", handleMessage);
3865
- return () => window.removeEventListener("message", handleMessage);
3954
+ window.addEventListener("storage", handleStorage);
3955
+ return () => {
3956
+ window.removeEventListener("message", handleMessage);
3957
+ window.removeEventListener("storage", handleStorage);
3958
+ };
3866
3959
  }, [api, config.apiUrl, scheduleRefresh, onLogin]);
3867
3960
  _react.useEffect.call(void 0, () => {
3868
3961
  if (config.loginMethods && config.loginMethods.length > 0) {
@@ -3880,7 +3973,7 @@ function ForgeConnectProvider({ config, children, onLogin, onLogout, walletAdapt
3880
3973
  setAuth({ status: "authenticated", user, accessToken: token });
3881
3974
  scheduleRefresh(token);
3882
3975
  setModal({ isOpen: true, step: "success" });
3883
- _optionalChain([onLogin, 'optionalCall', _124 => _124(user)]);
3976
+ _optionalChain([onLogin, 'optionalCall', _123 => _123(user)]);
3884
3977
  setTimeout(() => {
3885
3978
  setModal({ isOpen: false, step: "method-select" });
3886
3979
  }, 1500);
@@ -3980,11 +4073,11 @@ function ForgeConnectProvider({ config, children, onLogin, onLogout, walletAdapt
3980
4073
  const token = auth.accessToken;
3981
4074
  if (refreshTimerRef.current) clearTimeout(refreshTimerRef.current);
3982
4075
  setAuth({ status: "unauthenticated", user: null, accessToken: null });
3983
- _optionalChain([onLogout, 'optionalCall', _125 => _125()]);
4076
+ _optionalChain([onLogout, 'optionalCall', _124 => _124()]);
3984
4077
  if (token) {
3985
4078
  try {
3986
4079
  await api.logout(token);
3987
- } catch (e10) {
4080
+ } catch (e13) {
3988
4081
  }
3989
4082
  }
3990
4083
  }, [auth.accessToken, api, onLogout]);
@@ -4034,11 +4127,11 @@ function ForgeConnectProvider({ config, children, onLogin, onLogout, walletAdapt
4034
4127
  const token = auth.accessToken;
4035
4128
  if (refreshTimerRef.current) clearTimeout(refreshTimerRef.current);
4036
4129
  setAuth({ status: "unauthenticated", user: null, accessToken: null });
4037
- _optionalChain([onLogout, 'optionalCall', _126 => _126()]);
4130
+ _optionalChain([onLogout, 'optionalCall', _125 => _125()]);
4038
4131
  if (token) {
4039
4132
  try {
4040
4133
  await api.logoutAll(token);
4041
- } catch (e11) {
4134
+ } catch (e14) {
4042
4135
  }
4043
4136
  }
4044
4137
  }, [auth.accessToken, api, onLogout]);
@@ -4219,11 +4312,11 @@ function useAdmin() {
4219
4312
  const token = getAccessToken();
4220
4313
  if (!token) throw new Error("Please sign in to continue.");
4221
4314
  await api.adminUpdateUserStatus(token, id, status);
4222
- if (_optionalChain([selectedUser, 'optionalAccess', _127 => _127.id]) === id) {
4315
+ if (_optionalChain([selectedUser, 'optionalAccess', _126 => _126.id]) === id) {
4223
4316
  await getUser(id);
4224
4317
  }
4225
4318
  },
4226
- [api, getAccessToken, _optionalChain([selectedUser, 'optionalAccess', _128 => _128.id]), getUser]
4319
+ [api, getAccessToken, _optionalChain([selectedUser, 'optionalAccess', _127 => _127.id]), getUser]
4227
4320
  );
4228
4321
  const getUserSessions = _react.useCallback.call(void 0,
4229
4322
  async (id) => {
@@ -4340,9 +4433,9 @@ function useRoles() {
4340
4433
  const token = getAccessToken();
4341
4434
  if (!token) throw new Error("Please sign in to continue.");
4342
4435
  await api.adminDeleteRole(token, id);
4343
- if (_optionalChain([selectedRole, 'optionalAccess', _129 => _129.id]) === id) setSelectedRole(null);
4436
+ if (_optionalChain([selectedRole, 'optionalAccess', _128 => _128.id]) === id) setSelectedRole(null);
4344
4437
  },
4345
- [api, getAccessToken, _optionalChain([selectedRole, 'optionalAccess', _130 => _130.id])]
4438
+ [api, getAccessToken, _optionalChain([selectedRole, 'optionalAccess', _129 => _129.id])]
4346
4439
  );
4347
4440
  const getPermissions = _react.useCallback.call(void 0,
4348
4441
  async () => {