cilantro-react 0.1.6 → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -33,6 +33,7 @@ var index_exports = {};
33
33
  __export(index_exports, {
34
34
  AddPasskeyButton: () => AddPasskeyButton,
35
35
  AuthGuard: () => AuthGuard,
36
+ AuthShell: () => AuthShell,
36
37
  CilantroConnect: () => CilantroConnect,
37
38
  CilantroContextProvider: () => CilantroContextProvider,
38
39
  CilantroProvider: () => CilantroProvider,
@@ -44,6 +45,7 @@ __export(index_exports, {
44
45
  LoadingOverlay: () => LoadingOverlay,
45
46
  LoginForm: () => LoginForm,
46
47
  LogoutButton: () => LogoutButton,
48
+ RegisterForm: () => RegisterForm,
47
49
  SIGNER_TYPES: () => SIGNER_TYPES,
48
50
  SendSOLForm: () => SendSOLForm,
49
51
  SendSPLForm: () => SendSPLForm,
@@ -63,7 +65,9 @@ __export(index_exports, {
63
65
  extractErrorMessage: () => extractErrorMessage,
64
66
  extractResponseData: () => extractResponseData,
65
67
  getSignerPublicKey: () => getSignerPublicKey,
68
+ getWalletAddress: () => getWalletAddress,
66
69
  getWalletData: () => getWalletData,
70
+ getWalletId: () => getWalletId,
67
71
  isAuthError: () => isAuthError,
68
72
  isJwtExpired: () => isJwtExpired,
69
73
  normalizeSigner: () => normalizeSigner,
@@ -77,6 +81,7 @@ __export(index_exports, {
77
81
  useCilantroContext: () => useCilantroContext,
78
82
  useExternalWallet: () => useExternalWallet,
79
83
  usePasskey: () => usePasskey,
84
+ useReturnUrl: () => useReturnUrl,
80
85
  useSendTransaction: () => useSendTransaction,
81
86
  useSigners: () => useSigners,
82
87
  useWallet: () => useWallet,
@@ -308,6 +313,14 @@ function normalizeWallet(dto) {
308
313
  active: w.isActive
309
314
  };
310
315
  }
316
+ function getWalletId(wallet) {
317
+ if (!wallet) return "";
318
+ return wallet.id ?? wallet.walletId ?? "";
319
+ }
320
+ function getWalletAddress(wallet) {
321
+ if (!wallet) return "";
322
+ return wallet.address ?? wallet.walletAddress ?? "";
323
+ }
311
324
 
312
325
  // src/context/CilantroContext.tsx
313
326
  var import_jsx_runtime = require("react/jsx-runtime");
@@ -315,6 +328,17 @@ var DEFAULT_BASE_URL = "https://api.cilantro.gg";
315
328
  var DEFAULT_JWT_STORAGE_KEY = "cilantro_jwt";
316
329
  var DEFAULT_WALLET_STORAGE_KEY = "cilantro_selected_wallet_id";
317
330
  var CilantroContext = (0, import_react.createContext)(void 0);
331
+ var DEFAULT_JWT_COOKIE_NAME = "cilantro_jwt";
332
+ function setJwtCookie(name, token) {
333
+ if (typeof document === "undefined") return;
334
+ const value = token ?? "";
335
+ if (!value) {
336
+ document.cookie = `${name}=; path=/; SameSite=Lax; max-age=0`;
337
+ return;
338
+ }
339
+ const maxAge = 60 * 60 * 24 * 7;
340
+ document.cookie = `${name}=${encodeURIComponent(value)}; path=/; SameSite=Lax; max-age=${maxAge}`;
341
+ }
318
342
  function CilantroContextProvider({
319
343
  children,
320
344
  apiKey,
@@ -322,6 +346,8 @@ function CilantroContextProvider({
322
346
  storageAdapter = null,
323
347
  jwtStorageKey = DEFAULT_JWT_STORAGE_KEY,
324
348
  walletStorageKey = DEFAULT_WALLET_STORAGE_KEY,
349
+ syncJwtToCookie = false,
350
+ jwtCookieName = DEFAULT_JWT_COOKIE_NAME,
325
351
  onLoginSuccess,
326
352
  onLogout,
327
353
  onRegisterSuccess,
@@ -377,6 +403,11 @@ function CilantroContextProvider({
377
403
  }
378
404
  setAuthLoading(false);
379
405
  }, [apiKey, baseURL, jwtStorageKey]);
406
+ (0, import_react.useEffect)(() => {
407
+ if (syncJwtToCookie && typeof document !== "undefined") {
408
+ setJwtCookie(jwtCookieName, jwt);
409
+ }
410
+ }, [jwt, syncJwtToCookie, jwtCookieName]);
380
411
  const login = (0, import_react.useCallback)(
381
412
  async (params) => {
382
413
  const result = await (0, import_auth.login)(params);
@@ -388,6 +419,7 @@ function CilantroContextProvider({
388
419
  setSdkAuth(token);
389
420
  if (typeof window !== "undefined") {
390
421
  localStorage.setItem(jwtStorageKey, token);
422
+ if (syncJwtToCookie) setJwtCookie(jwtCookieName, token);
391
423
  }
392
424
  if (data?.user && typeof data.user === "object") {
393
425
  const u = data.user;
@@ -410,7 +442,7 @@ function CilantroContextProvider({
410
442
  }
411
443
  onLoginSuccess?.();
412
444
  },
413
- [jwtStorageKey, onLoginSuccess]
445
+ [jwtStorageKey, jwtCookieName, syncJwtToCookie, onLoginSuccess]
414
446
  );
415
447
  const logout = (0, import_react.useCallback)(() => {
416
448
  setUser(null);
@@ -418,6 +450,7 @@ function CilantroContextProvider({
418
450
  (0, import_cilantro_sdk2.clearAuth)();
419
451
  if (typeof window !== "undefined") {
420
452
  localStorage.removeItem(jwtStorageKey);
453
+ if (syncJwtToCookie) setJwtCookie(jwtCookieName, null);
421
454
  const keys = Object.keys(localStorage);
422
455
  keys.forEach((key) => {
423
456
  if (key.startsWith("delegated-key-")) localStorage.removeItem(key);
@@ -425,7 +458,7 @@ function CilantroContextProvider({
425
458
  }
426
459
  setSdkAuth(null);
427
460
  onLogout?.();
428
- }, [jwtStorageKey, onLogout]);
461
+ }, [jwtStorageKey, jwtCookieName, syncJwtToCookie, onLogout]);
429
462
  const register = (0, import_react.useCallback)(
430
463
  async (username, email, password, isActive = true) => {
431
464
  setSdkAuth(null);
@@ -444,6 +477,7 @@ function CilantroContextProvider({
444
477
  (0, import_cilantro_sdk2.clearAuth)();
445
478
  if (typeof window !== "undefined") {
446
479
  localStorage.removeItem(jwtStorageKey);
480
+ if (syncJwtToCookie) setJwtCookie(jwtCookieName, null);
447
481
  const keys = Object.keys(localStorage);
448
482
  keys.forEach((key) => {
449
483
  if (key.startsWith("delegated-key-")) localStorage.removeItem(key);
@@ -451,7 +485,7 @@ function CilantroContextProvider({
451
485
  }
452
486
  setSdkAuth(null);
453
487
  onSessionExpired?.();
454
- }, [jwtStorageKey, onSessionExpired]);
488
+ }, [jwtStorageKey, jwtCookieName, syncJwtToCookie, onSessionExpired]);
455
489
  const loadWallets = (0, import_react.useCallback)(async () => {
456
490
  if (!jwt) return;
457
491
  setWalletsLoading(true);
@@ -590,6 +624,8 @@ function CilantroProvider({
590
624
  apiUrl: apiUrl2,
591
625
  jwtStorageKey,
592
626
  walletStorageKey,
627
+ syncJwtToCookie,
628
+ jwtCookieName,
593
629
  onLoginSuccess,
594
630
  onLogout,
595
631
  onRegisterSuccess,
@@ -612,6 +648,8 @@ function CilantroProvider({
612
648
  storageAdapter: storageAdapter ?? void 0,
613
649
  jwtStorageKey,
614
650
  walletStorageKey,
651
+ syncJwtToCookie,
652
+ jwtCookieName,
615
653
  onLoginSuccess,
616
654
  onLogout,
617
655
  onRegisterSuccess,
@@ -626,6 +664,7 @@ function useCilantroAuth() {
626
664
  const ctx = useCilantroContext();
627
665
  return {
628
666
  user: ctx.user,
667
+ jwt: ctx.jwt,
629
668
  token: ctx.jwt,
630
669
  isAuthenticated: ctx.isAuthenticated,
631
670
  login: (usernameOrEmail, password) => ctx.login({ usernameOrEmail, password }),
@@ -639,8 +678,10 @@ function useCilantroAuth() {
639
678
  // src/providers/WalletProvider.tsx
640
679
  function useWallets() {
641
680
  const ctx = useCilantroContext();
681
+ const wallet = ctx.wallet;
642
682
  return {
643
- selectedWallet: ctx.wallet,
683
+ wallet,
684
+ selectedWallet: wallet,
644
685
  wallets: ctx.wallets,
645
686
  selectWallet: ctx.selectWallet,
646
687
  refreshWallets: ctx.refreshWallets,
@@ -667,37 +708,83 @@ function useAuth() {
667
708
  return {
668
709
  user: ctx.user,
669
710
  jwt: ctx.jwt,
711
+ token: ctx.jwt,
670
712
  isLoading: ctx.isLoading,
671
713
  isAuthenticated: ctx.isAuthenticated,
672
714
  login: ctx.login,
673
- logout: ctx.logout
715
+ register: ctx.register,
716
+ logout: ctx.logout,
717
+ clearSessionDueToAuthError: ctx.clearSessionDueToAuthError
674
718
  };
675
719
  }
676
720
 
677
- // src/hooks/useWallet.ts
721
+ // src/hooks/useReturnUrl.ts
678
722
  var import_react3 = require("react");
723
+ function useReturnUrl(options = {}) {
724
+ const {
725
+ param = "returnUrl",
726
+ defaultPath = "/",
727
+ allowRelativeOnly = true
728
+ } = options;
729
+ const rawReturnUrl = (0, import_react3.useMemo)(() => {
730
+ if (typeof window === "undefined") return null;
731
+ const params = new URLSearchParams(window.location.search);
732
+ return params.get(param);
733
+ }, [param]);
734
+ const returnPath = (0, import_react3.useMemo)(() => {
735
+ if (!rawReturnUrl) return defaultPath;
736
+ if (allowRelativeOnly) {
737
+ const trimmed = rawReturnUrl.trim();
738
+ if (trimmed.startsWith("//") || /^https?:\/\//i.test(trimmed)) {
739
+ return defaultPath;
740
+ }
741
+ if (trimmed.startsWith("/")) return trimmed;
742
+ return `/${trimmed}`;
743
+ }
744
+ return rawReturnUrl;
745
+ }, [rawReturnUrl, defaultPath, allowRelativeOnly]);
746
+ const redirect = (0, import_react3.useCallback)(
747
+ (customRedirect) => {
748
+ const path = returnPath;
749
+ if (customRedirect) {
750
+ customRedirect(path);
751
+ } else if (typeof window !== "undefined") {
752
+ window.location.href = path;
753
+ }
754
+ },
755
+ [returnPath]
756
+ );
757
+ return { returnPath, redirect, rawReturnUrl };
758
+ }
759
+
760
+ // src/hooks/useWallet.ts
761
+ var import_react4 = require("react");
679
762
  function useWallet(_walletId) {
680
763
  const ctx = useCilantroContext();
681
- return (0, import_react3.useMemo)(
764
+ return (0, import_react4.useMemo)(
682
765
  () => ({
683
766
  wallet: ctx.wallet,
684
767
  wallets: ctx.wallets,
685
768
  createWallet: ctx.createWallet,
686
769
  selectWallet: ctx.selectWallet,
687
- isLoading: ctx.walletsLoading
770
+ refreshWallets: ctx.refreshWallets,
771
+ isLoading: ctx.walletsLoading,
772
+ error: ctx.walletError
688
773
  }),
689
774
  [
690
775
  ctx.wallet,
691
776
  ctx.wallets,
692
777
  ctx.createWallet,
693
778
  ctx.selectWallet,
694
- ctx.walletsLoading
779
+ ctx.refreshWallets,
780
+ ctx.walletsLoading,
781
+ ctx.walletError
695
782
  ]
696
783
  );
697
784
  }
698
785
 
699
786
  // src/hooks/useSigners.ts
700
- var import_react4 = require("react");
787
+ var import_react5 = require("react");
701
788
 
702
789
  // src/core/signer-helpers.ts
703
790
  var import_helpers2 = require("cilantro-sdk/helpers");
@@ -892,10 +979,10 @@ var import_wallet4 = require("cilantro-sdk/wallet");
892
979
  function useSigners(walletIdOrOptions) {
893
980
  const walletIdOption = typeof walletIdOrOptions === "object" ? walletIdOrOptions?.walletId : walletIdOrOptions;
894
981
  const { jwt } = useCilantroContext();
895
- const [signers, setSigners] = (0, import_react4.useState)([]);
896
- const [isLoading, setIsLoading] = (0, import_react4.useState)(false);
897
- const [error, setError] = (0, import_react4.useState)(null);
898
- const load = (0, import_react4.useCallback)(
982
+ const [signers, setSigners] = (0, import_react5.useState)([]);
983
+ const [isLoading, setIsLoading] = (0, import_react5.useState)(false);
984
+ const [error, setError] = (0, import_react5.useState)(null);
985
+ const load = (0, import_react5.useCallback)(
899
986
  async (walletId) => {
900
987
  if (!walletId) {
901
988
  setSigners([]);
@@ -917,7 +1004,7 @@ function useSigners(walletIdOrOptions) {
917
1004
  },
918
1005
  [jwt]
919
1006
  );
920
- (0, import_react4.useEffect)(() => {
1007
+ (0, import_react5.useEffect)(() => {
921
1008
  const id = walletIdOption ?? void 0;
922
1009
  if (id) load(id);
923
1010
  else {
@@ -925,11 +1012,11 @@ function useSigners(walletIdOrOptions) {
925
1012
  setError(null);
926
1013
  }
927
1014
  }, [walletIdOption, load]);
928
- const refresh = (0, import_react4.useCallback)(async () => {
1015
+ const refresh = (0, import_react5.useCallback)(async () => {
929
1016
  const id = walletIdOption ?? void 0;
930
1017
  if (id) await load(id);
931
1018
  }, [walletIdOption, load]);
932
- const createEmailSigner = (0, import_react4.useCallback)(
1019
+ const createEmailSigner = (0, import_react5.useCallback)(
933
1020
  async (params) => {
934
1021
  const walletId = walletIdOption ?? void 0;
935
1022
  if (!walletId) throw new Error("walletId is required");
@@ -940,7 +1027,7 @@ function useSigners(walletIdOrOptions) {
940
1027
  },
941
1028
  [walletIdOption, jwt, refresh]
942
1029
  );
943
- const createPhoneSigner = (0, import_react4.useCallback)(
1030
+ const createPhoneSigner = (0, import_react5.useCallback)(
944
1031
  async (params) => {
945
1032
  const walletId = walletIdOption ?? void 0;
946
1033
  if (!walletId) throw new Error("walletId is required");
@@ -951,7 +1038,7 @@ function useSigners(walletIdOrOptions) {
951
1038
  },
952
1039
  [walletIdOption, jwt, refresh]
953
1040
  );
954
- const revokeSigner = (0, import_react4.useCallback)(
1041
+ const revokeSigner = (0, import_react5.useCallback)(
955
1042
  async (signerId) => {
956
1043
  const walletId = walletIdOption ?? void 0;
957
1044
  if (!walletId) throw new Error("walletId is required");
@@ -973,15 +1060,15 @@ function useSigners(walletIdOrOptions) {
973
1060
  }
974
1061
 
975
1062
  // src/hooks/usePasskey.ts
976
- var import_react5 = require("react");
1063
+ var import_react6 = require("react");
977
1064
  var import_helpers4 = require("cilantro-sdk/helpers");
978
1065
  var import_wallet5 = require("cilantro-sdk/wallet");
979
1066
  var import_helpers5 = require("cilantro-sdk/helpers");
980
1067
  function usePasskey(walletId) {
981
1068
  const { jwt } = useCilantroContext();
982
- const [isLoading, setIsLoading] = (0, import_react5.useState)(false);
1069
+ const [isLoading, setIsLoading] = (0, import_react6.useState)(false);
983
1070
  const isSupported = typeof window !== "undefined" && (0, import_helpers4.isWebAuthnSupported)();
984
- const register = (0, import_react5.useCallback)(async () => {
1071
+ const register = (0, import_react6.useCallback)(async () => {
985
1072
  if (!walletId) throw new Error("walletId is required");
986
1073
  if (!isSupported) throw new Error("WebAuthn is not supported in this browser");
987
1074
  setIsLoading(true);
@@ -992,7 +1079,7 @@ function usePasskey(walletId) {
992
1079
  setIsLoading(false);
993
1080
  }
994
1081
  }, [walletId, isSupported]);
995
- const authenticate = (0, import_react5.useCallback)(
1082
+ const authenticate = (0, import_react6.useCallback)(
996
1083
  async (signerId) => {
997
1084
  if (!walletId) throw new Error("walletId is required");
998
1085
  if (!isSupported) throw new Error("WebAuthn is not supported in this browser");
@@ -1022,7 +1109,7 @@ function usePasskey(walletId) {
1022
1109
  }
1023
1110
 
1024
1111
  // src/hooks/useExternalWallet.ts
1025
- var import_react6 = require("react");
1112
+ var import_react7 = require("react");
1026
1113
  function getDetectedWallets() {
1027
1114
  if (typeof window === "undefined") return [];
1028
1115
  const list = [];
@@ -1045,18 +1132,18 @@ function getDetectedWallets() {
1045
1132
  return list;
1046
1133
  }
1047
1134
  function useExternalWallet() {
1048
- const [wallets, setWallets] = (0, import_react6.useState)([]);
1049
- const [connectedWallet, setConnectedWallet] = (0, import_react6.useState)(null);
1050
- (0, import_react6.useEffect)(() => {
1135
+ const [wallets, setWallets] = (0, import_react7.useState)([]);
1136
+ const [connectedWallet, setConnectedWallet] = (0, import_react7.useState)(null);
1137
+ (0, import_react7.useEffect)(() => {
1051
1138
  setWallets(getDetectedWallets());
1052
1139
  }, []);
1053
- const connect = (0, import_react6.useCallback)(async (wallet) => {
1140
+ const connect = (0, import_react7.useCallback)(async (wallet) => {
1054
1141
  const res = await wallet.connect();
1055
1142
  const publicKey = res.publicKey.toString();
1056
1143
  setConnectedWallet(wallet);
1057
1144
  return publicKey;
1058
1145
  }, []);
1059
- const disconnect = (0, import_react6.useCallback)(async () => {
1146
+ const disconnect = (0, import_react7.useCallback)(async () => {
1060
1147
  if (connectedWallet?.disconnect) {
1061
1148
  await connectedWallet.disconnect();
1062
1149
  }
@@ -1066,13 +1153,13 @@ function useExternalWallet() {
1066
1153
  }
1067
1154
 
1068
1155
  // src/hooks/useSendTransaction.ts
1069
- var import_react7 = require("react");
1156
+ var import_react8 = require("react");
1070
1157
  var import_wallet6 = require("cilantro-sdk/wallet");
1071
1158
  function useSendTransaction(walletId, _signerId, _signerType) {
1072
1159
  const { jwt } = useCilantroContext();
1073
- const [isPending, setIsPending] = (0, import_react7.useState)(false);
1074
- const [error, setError] = (0, import_react7.useState)(null);
1075
- const sendSOL = (0, import_react7.useCallback)(
1160
+ const [isPending, setIsPending] = (0, import_react8.useState)(false);
1161
+ const [error, setError] = (0, import_react8.useState)(null);
1162
+ const sendSOL = (0, import_react8.useCallback)(
1076
1163
  async (params) => {
1077
1164
  if (!walletId) throw new Error("walletId is required");
1078
1165
  setError(null);
@@ -1099,7 +1186,7 @@ function useSendTransaction(walletId, _signerId, _signerType) {
1099
1186
  },
1100
1187
  [walletId, jwt]
1101
1188
  );
1102
- const sendSPL = (0, import_react7.useCallback)(
1189
+ const sendSPL = (0, import_react8.useCallback)(
1103
1190
  async (params) => {
1104
1191
  if (!walletId) throw new Error("walletId is required");
1105
1192
  setError(null);
@@ -1131,7 +1218,7 @@ function useSendTransaction(walletId, _signerId, _signerType) {
1131
1218
  }
1132
1219
 
1133
1220
  // src/components/auth/LoginForm.tsx
1134
- var import_react8 = require("react");
1221
+ var import_react9 = require("react");
1135
1222
 
1136
1223
  // src/ui/button.tsx
1137
1224
  var React = __toESM(require("react"));
@@ -1261,21 +1348,33 @@ function LoginForm({
1261
1348
  style,
1262
1349
  onSuccess,
1263
1350
  onError,
1351
+ redirectAfterSuccess,
1352
+ onRedirect,
1353
+ returnUrlParam = "returnUrl",
1264
1354
  submitLabel = "Sign in",
1265
1355
  title = "Sign in",
1266
1356
  description,
1267
1357
  renderSwitchToRegister
1268
1358
  }) {
1269
1359
  const { login, isLoading } = useCilantroAuth();
1270
- const [usernameOrEmail, setUsernameOrEmail] = (0, import_react8.useState)("");
1271
- const [password, setPassword] = (0, import_react8.useState)("");
1272
- const [error, setError] = (0, import_react8.useState)(null);
1360
+ const { returnPath } = useReturnUrl({ param: returnUrlParam, defaultPath: "/" });
1361
+ const [usernameOrEmail, setUsernameOrEmail] = (0, import_react9.useState)("");
1362
+ const [password, setPassword] = (0, import_react9.useState)("");
1363
+ const [error, setError] = (0, import_react9.useState)(null);
1364
+ const pathToRedirect = redirectAfterSuccess ?? returnPath;
1273
1365
  const handleSubmit = async (e) => {
1274
1366
  e.preventDefault();
1275
1367
  setError(null);
1276
1368
  try {
1277
1369
  await login(usernameOrEmail.trim(), password);
1278
1370
  onSuccess?.();
1371
+ if (pathToRedirect) {
1372
+ if (onRedirect) {
1373
+ onRedirect(pathToRedirect);
1374
+ } else if (typeof window !== "undefined") {
1375
+ window.location.href = pathToRedirect;
1376
+ }
1377
+ }
1279
1378
  } catch (err) {
1280
1379
  const message = err instanceof Error ? err.message : String(err);
1281
1380
  setError(message);
@@ -1348,16 +1447,142 @@ function LoginForm({
1348
1447
  ] });
1349
1448
  }
1350
1449
 
1450
+ // src/components/auth/RegisterForm.tsx
1451
+ var import_react10 = require("react");
1452
+ var import_jsx_runtime8 = require("react/jsx-runtime");
1453
+ function RegisterForm({
1454
+ className,
1455
+ classNames,
1456
+ style,
1457
+ onSuccess,
1458
+ onError,
1459
+ redirectAfterSuccess,
1460
+ onRedirect,
1461
+ returnUrlParam = "returnUrl",
1462
+ submitLabel = "Create account",
1463
+ title = "Create account",
1464
+ description,
1465
+ renderSwitchToLogin
1466
+ }) {
1467
+ const { register, isLoading } = useAuth();
1468
+ const { returnPath } = useReturnUrl({ param: returnUrlParam, defaultPath: "/" });
1469
+ const [username, setUsername] = (0, import_react10.useState)("");
1470
+ const [email, setEmail] = (0, import_react10.useState)("");
1471
+ const [password, setPassword] = (0, import_react10.useState)("");
1472
+ const [error, setError] = (0, import_react10.useState)(null);
1473
+ const pathToRedirect = redirectAfterSuccess ?? returnPath;
1474
+ const handleSubmit = async (e) => {
1475
+ e.preventDefault();
1476
+ setError(null);
1477
+ try {
1478
+ await register(username.trim(), email.trim(), password);
1479
+ onSuccess?.();
1480
+ if (pathToRedirect) {
1481
+ if (onRedirect) {
1482
+ onRedirect(pathToRedirect);
1483
+ } else if (typeof window !== "undefined") {
1484
+ window.location.href = pathToRedirect;
1485
+ }
1486
+ }
1487
+ } catch (err) {
1488
+ const message = err instanceof Error ? err.message : String(err);
1489
+ setError(message);
1490
+ onError?.(err instanceof Error ? err : new Error(message));
1491
+ }
1492
+ };
1493
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Card, { className: cn(className, classNames?.root), style, "data-cilantro-register-form": true, children: [
1494
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(CardHeader, { className: classNames?.header, children: [
1495
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(CardTitle, { className: classNames?.title, children: title }),
1496
+ description != null && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(CardDescription, { className: classNames?.description, children: description })
1497
+ ] }),
1498
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(CardContent, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("form", { onSubmit: handleSubmit, className: cn("space-y-4", classNames?.form), children: [
1499
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "space-y-2", children: [
1500
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Label, { htmlFor: "cilantro-register-username", className: classNames?.label, children: "Username" }),
1501
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1502
+ Input,
1503
+ {
1504
+ id: "cilantro-register-username",
1505
+ type: "text",
1506
+ autoComplete: "username",
1507
+ className: classNames?.input,
1508
+ value: username,
1509
+ onChange: (e) => setUsername(e.target.value),
1510
+ placeholder: "Username",
1511
+ required: true,
1512
+ disabled: isLoading
1513
+ }
1514
+ )
1515
+ ] }),
1516
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "space-y-2", children: [
1517
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Label, { htmlFor: "cilantro-register-email", className: classNames?.label, children: "Email" }),
1518
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1519
+ Input,
1520
+ {
1521
+ id: "cilantro-register-email",
1522
+ type: "email",
1523
+ autoComplete: "email",
1524
+ className: classNames?.input,
1525
+ value: email,
1526
+ onChange: (e) => setEmail(e.target.value),
1527
+ placeholder: "Email",
1528
+ required: true,
1529
+ disabled: isLoading
1530
+ }
1531
+ )
1532
+ ] }),
1533
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "space-y-2", children: [
1534
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Label, { htmlFor: "cilantro-register-password", className: classNames?.label, children: "Password" }),
1535
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1536
+ Input,
1537
+ {
1538
+ id: "cilantro-register-password",
1539
+ type: "password",
1540
+ autoComplete: "new-password",
1541
+ className: classNames?.input,
1542
+ value: password,
1543
+ onChange: (e) => setPassword(e.target.value),
1544
+ placeholder: "Password",
1545
+ required: true,
1546
+ disabled: isLoading
1547
+ }
1548
+ )
1549
+ ] }),
1550
+ error && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1551
+ "div",
1552
+ {
1553
+ className: cn(
1554
+ "rounded-md border border-destructive/50 bg-destructive/10 px-3 py-2 text-sm text-destructive",
1555
+ classNames?.error
1556
+ ),
1557
+ role: "alert",
1558
+ children: error
1559
+ }
1560
+ ),
1561
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1562
+ Button,
1563
+ {
1564
+ type: "submit",
1565
+ size: "touch",
1566
+ className: cn("w-full", classNames?.submitButton),
1567
+ disabled: isLoading || !username.trim() || !email.trim() || !password,
1568
+ children: isLoading ? "Creating account..." : submitLabel
1569
+ }
1570
+ ),
1571
+ renderSwitchToLogin && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "text-center text-sm text-muted-foreground", children: renderSwitchToLogin() })
1572
+ ] }) })
1573
+ ] });
1574
+ }
1575
+
1351
1576
  // src/components/auth/LogoutButton.tsx
1352
- var import_react9 = require("react");
1577
+ var import_react11 = require("react");
1353
1578
 
1354
1579
  // src/ui/dialog.tsx
1355
1580
  var React5 = __toESM(require("react"));
1356
1581
  var DialogPrimitive = __toESM(require("@radix-ui/react-dialog"));
1357
- var import_jsx_runtime8 = require("react/jsx-runtime");
1582
+ var import_jsx_runtime9 = require("react/jsx-runtime");
1358
1583
  var Dialog = DialogPrimitive.Root;
1359
1584
  var DialogPortal = DialogPrimitive.Portal;
1360
- var DialogOverlay = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1585
+ var DialogOverlay = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1361
1586
  DialogPrimitive.Overlay,
1362
1587
  {
1363
1588
  ref,
@@ -1369,9 +1594,9 @@ var DialogOverlay = React5.forwardRef(({ className, ...props }, ref) => /* @__PU
1369
1594
  }
1370
1595
  ));
1371
1596
  DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
1372
- var DialogContent = React5.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(DialogPortal, { children: [
1373
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DialogOverlay, {}),
1374
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1597
+ var DialogContent = React5.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(DialogPortal, { children: [
1598
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(DialogOverlay, {}),
1599
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1375
1600
  DialogPrimitive.Content,
1376
1601
  {
1377
1602
  ref,
@@ -1385,9 +1610,9 @@ var DialogContent = React5.forwardRef(({ className, children, ...props }, ref) =
1385
1610
  )
1386
1611
  ] }));
1387
1612
  DialogContent.displayName = DialogPrimitive.Content.displayName;
1388
- var DialogHeader = ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: cn("flex flex-col space-y-1.5 text-center sm:text-left", className), ...props });
1613
+ var DialogHeader = ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: cn("flex flex-col space-y-1.5 text-center sm:text-left", className), ...props });
1389
1614
  DialogHeader.displayName = "DialogHeader";
1390
- var DialogFooter = ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1615
+ var DialogFooter = ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1391
1616
  "div",
1392
1617
  {
1393
1618
  className: cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", className),
@@ -1395,7 +1620,7 @@ var DialogFooter = ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_r
1395
1620
  }
1396
1621
  );
1397
1622
  DialogFooter.displayName = "DialogFooter";
1398
- var DialogTitle = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1623
+ var DialogTitle = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1399
1624
  DialogPrimitive.Title,
1400
1625
  {
1401
1626
  ref,
@@ -1404,7 +1629,7 @@ var DialogTitle = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE
1404
1629
  }
1405
1630
  ));
1406
1631
  DialogTitle.displayName = DialogPrimitive.Title.displayName;
1407
- var DialogDescription = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1632
+ var DialogDescription = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1408
1633
  DialogPrimitive.Description,
1409
1634
  {
1410
1635
  ref,
@@ -1415,19 +1640,28 @@ var DialogDescription = React5.forwardRef(({ className, ...props }, ref) => /* @
1415
1640
  DialogDescription.displayName = DialogPrimitive.Description.displayName;
1416
1641
 
1417
1642
  // src/components/auth/LogoutButton.tsx
1418
- var import_jsx_runtime9 = require("react/jsx-runtime");
1643
+ var import_jsx_runtime10 = require("react/jsx-runtime");
1419
1644
  function LogoutButton({
1420
1645
  onLogout,
1646
+ redirectAfterLogout,
1647
+ onRedirect,
1421
1648
  confirmBeforeLogout = false,
1422
1649
  className,
1423
1650
  children
1424
1651
  }) {
1425
1652
  const { logout } = useAuth();
1426
- const [confirmOpen, setConfirmOpen] = (0, import_react9.useState)(false);
1653
+ const [confirmOpen, setConfirmOpen] = (0, import_react11.useState)(false);
1427
1654
  const handleLogout = () => {
1428
1655
  logout();
1429
1656
  setConfirmOpen(false);
1430
1657
  onLogout?.();
1658
+ if (redirectAfterLogout) {
1659
+ if (onRedirect) {
1660
+ onRedirect(redirectAfterLogout);
1661
+ } else if (typeof window !== "undefined") {
1662
+ window.location.href = redirectAfterLogout;
1663
+ }
1664
+ }
1431
1665
  };
1432
1666
  const handleClick = () => {
1433
1667
  if (confirmBeforeLogout) {
@@ -1436,8 +1670,8 @@ function LogoutButton({
1436
1670
  handleLogout();
1437
1671
  }
1438
1672
  };
1439
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
1440
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1673
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
1674
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1441
1675
  Button,
1442
1676
  {
1443
1677
  type: "button",
@@ -1448,24 +1682,27 @@ function LogoutButton({
1448
1682
  children: children ?? "Log out"
1449
1683
  }
1450
1684
  ),
1451
- confirmBeforeLogout && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Dialog, { open: confirmOpen, onOpenChange: setConfirmOpen, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(DialogContent, { children: [
1452
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(DialogHeader, { children: [
1453
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(DialogTitle, { children: "Log out?" }),
1454
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(DialogDescription, { children: "Are you sure you want to log out?" })
1685
+ confirmBeforeLogout && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Dialog, { open: confirmOpen, onOpenChange: setConfirmOpen, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(DialogContent, { children: [
1686
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(DialogHeader, { children: [
1687
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(DialogTitle, { children: "Log out?" }),
1688
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(DialogDescription, { children: "Are you sure you want to log out?" })
1455
1689
  ] }),
1456
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(DialogFooter, { children: [
1457
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Button, { variant: "outline", onClick: () => setConfirmOpen(false), children: "Cancel" }),
1458
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Button, { variant: "destructive", onClick: handleLogout, children: "Log out" })
1690
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(DialogFooter, { children: [
1691
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Button, { variant: "outline", onClick: () => setConfirmOpen(false), children: "Cancel" }),
1692
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Button, { variant: "destructive", onClick: handleLogout, children: "Log out" })
1459
1693
  ] })
1460
1694
  ] }) })
1461
1695
  ] });
1462
1696
  }
1463
1697
 
1698
+ // src/components/auth/AuthGuard.tsx
1699
+ var import_react12 = require("react");
1700
+
1464
1701
  // src/ui/skeleton.tsx
1465
1702
  var React6 = __toESM(require("react"));
1466
- var import_jsx_runtime10 = require("react/jsx-runtime");
1703
+ var import_jsx_runtime11 = require("react/jsx-runtime");
1467
1704
  var Skeleton = React6.forwardRef(
1468
- ({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1705
+ ({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1469
1706
  "div",
1470
1707
  {
1471
1708
  ref,
@@ -1477,47 +1714,166 @@ var Skeleton = React6.forwardRef(
1477
1714
  Skeleton.displayName = "Skeleton";
1478
1715
 
1479
1716
  // src/components/auth/AuthGuard.tsx
1480
- var import_jsx_runtime11 = require("react/jsx-runtime");
1717
+ var import_jsx_runtime12 = require("react/jsx-runtime");
1718
+ var LAYOUT_CLASSES = {
1719
+ inline: "",
1720
+ centered: "flex min-h-[280px] items-center justify-center p-6",
1721
+ fullscreen: "fixed inset-0 z-50 flex min-h-screen items-center justify-center bg-background p-4"
1722
+ };
1723
+ function getCurrentReturnPath(returnUrlParam) {
1724
+ if (typeof window === "undefined") return "/";
1725
+ const params = new URLSearchParams(window.location.search);
1726
+ const existing = params.get(returnUrlParam);
1727
+ if (existing && existing.startsWith("/")) return existing;
1728
+ const path = window.location.pathname + window.location.search;
1729
+ return path || "/";
1730
+ }
1481
1731
  function AuthGuard({
1482
1732
  children,
1483
1733
  fallback,
1484
1734
  redirectTo,
1735
+ onRedirect,
1736
+ returnUrlParam = "returnUrl",
1737
+ layout = "inline",
1485
1738
  className,
1486
1739
  classNames,
1487
1740
  showFallback = true,
1488
1741
  useSkeleton = false
1489
1742
  }) {
1490
1743
  const { isAuthenticated, isLoading } = useCilantroAuth();
1744
+ const redirectPath = (0, import_react12.useMemo)(() => {
1745
+ if (!redirectTo) return null;
1746
+ const returnPath = getCurrentReturnPath(returnUrlParam);
1747
+ const sep = redirectTo.includes("?") ? "&" : "?";
1748
+ return `${redirectTo}${sep}${returnUrlParam}=${encodeURIComponent(returnPath)}`;
1749
+ }, [redirectTo, returnUrlParam]);
1491
1750
  if (isLoading) {
1492
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1751
+ const loadingContent = useSkeleton ? /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: cn("rounded-lg border border-input p-6 space-y-4 w-full max-w-sm", classNames?.fallback), children: [
1752
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Skeleton, { className: cn("h-7 w-2/3 rounded", classNames?.skeleton) }),
1753
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Skeleton, { className: cn("h-4 w-full rounded", classNames?.skeleton) }),
1754
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Skeleton, { className: cn("h-10 w-full rounded", classNames?.skeleton) }),
1755
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Skeleton, { className: cn("h-10 w-full rounded", classNames?.skeleton) })
1756
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex flex-col items-center gap-3", children: [
1757
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1758
+ "div",
1759
+ {
1760
+ className: "h-8 w-8 animate-spin rounded-full border-2 border-primary border-t-transparent",
1761
+ "aria-hidden": true
1762
+ }
1763
+ ),
1764
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "text-sm text-muted-foreground", children: "Loading..." })
1765
+ ] });
1766
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1493
1767
  "div",
1494
1768
  {
1495
- className: cn(className, classNames?.root, classNames?.loading),
1769
+ className: cn(
1770
+ LAYOUT_CLASSES[layout],
1771
+ className,
1772
+ classNames?.root,
1773
+ classNames?.loading
1774
+ ),
1496
1775
  "data-cilantro-auth-guard": true,
1497
1776
  "aria-busy": "true",
1498
1777
  "aria-live": "polite",
1499
- children: useSkeleton ? /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: cn("rounded-lg border border-input p-4 space-y-3 w-full max-w-sm", classNames?.fallback), children: [
1500
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Skeleton, { className: cn("h-6 w-2/3 rounded", classNames?.skeleton) }),
1501
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Skeleton, { className: cn("h-4 w-full rounded", classNames?.skeleton) }),
1502
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Skeleton, { className: cn("h-4 w-[80%] rounded", classNames?.skeleton) })
1503
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: cn("text-sm text-muted-foreground", classNames?.fallback), children: "Loading..." })
1778
+ children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: cn(layout !== "inline" && "w-full max-w-sm", classNames?.layout), children: loadingContent })
1504
1779
  }
1505
1780
  );
1506
1781
  }
1507
1782
  if (!isAuthenticated) {
1783
+ if (!showFallback && redirectPath) {
1784
+ if (onRedirect) {
1785
+ onRedirect(redirectPath);
1786
+ } else if (typeof window !== "undefined") {
1787
+ window.location.href = redirectPath;
1788
+ }
1789
+ return null;
1790
+ }
1508
1791
  if (!showFallback) return null;
1509
- if (redirectTo && typeof window !== "undefined") {
1510
- window.location.href = redirectTo;
1792
+ if (redirectPath) {
1793
+ if (onRedirect) {
1794
+ onRedirect(redirectPath);
1795
+ } else if (typeof window !== "undefined") {
1796
+ window.location.href = redirectPath;
1797
+ }
1511
1798
  return null;
1512
1799
  }
1513
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: cn(className, classNames?.root), "data-cilantro-auth-guard": true, children: fallback ?? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(LoginForm, { className: classNames?.fallback }) });
1800
+ const returnPath = getCurrentReturnPath(returnUrlParam);
1801
+ const fallbackContent = fallback ?? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1802
+ LoginForm,
1803
+ {
1804
+ className: classNames?.fallback,
1805
+ redirectAfterSuccess: returnPath,
1806
+ returnUrlParam,
1807
+ onRedirect
1808
+ }
1809
+ );
1810
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1811
+ "div",
1812
+ {
1813
+ className: cn(
1814
+ LAYOUT_CLASSES[layout],
1815
+ className,
1816
+ classNames?.root
1817
+ ),
1818
+ "data-cilantro-auth-guard": true,
1819
+ children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: cn(layout !== "inline" && "w-full max-w-sm", classNames?.layout), children: fallbackContent })
1820
+ }
1821
+ );
1514
1822
  }
1515
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_jsx_runtime11.Fragment, { children });
1823
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_jsx_runtime12.Fragment, { children });
1824
+ }
1825
+
1826
+ // src/components/auth/AuthShell.tsx
1827
+ var import_jsx_runtime13 = require("react/jsx-runtime");
1828
+ var MAX_WIDTH_CLASSES = {
1829
+ sm: "max-w-sm",
1830
+ md: "max-w-md",
1831
+ lg: "max-w-lg"
1832
+ };
1833
+ function AuthShell({
1834
+ children,
1835
+ logo,
1836
+ maxWidth = "sm",
1837
+ className,
1838
+ classNames
1839
+ }) {
1840
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1841
+ "div",
1842
+ {
1843
+ className: cn(
1844
+ "flex min-h-screen flex-col items-center justify-center bg-background p-4 sm:p-6",
1845
+ className,
1846
+ classNames?.root
1847
+ ),
1848
+ "data-cilantro-auth-shell": true,
1849
+ children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
1850
+ "div",
1851
+ {
1852
+ className: cn(
1853
+ "w-full space-y-6",
1854
+ MAX_WIDTH_CLASSES[maxWidth],
1855
+ classNames?.inner
1856
+ ),
1857
+ children: [
1858
+ logo && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1859
+ "div",
1860
+ {
1861
+ className: cn("flex justify-center", classNames?.logo),
1862
+ "data-cilantro-auth-shell-logo": true,
1863
+ children: logo
1864
+ }
1865
+ ),
1866
+ children
1867
+ ]
1868
+ }
1869
+ )
1870
+ }
1871
+ );
1516
1872
  }
1517
1873
 
1518
1874
  // src/components/signers/CreateEmailSignerForm.tsx
1519
- var import_react10 = require("react");
1520
- var import_jsx_runtime12 = require("react/jsx-runtime");
1875
+ var import_react13 = require("react");
1876
+ var import_jsx_runtime14 = require("react/jsx-runtime");
1521
1877
  function CreateEmailSignerForm({
1522
1878
  walletId,
1523
1879
  onCreated,
@@ -1525,8 +1881,8 @@ function CreateEmailSignerForm({
1525
1881
  className
1526
1882
  }) {
1527
1883
  const { createEmailSigner, isLoading } = useSigners(walletId);
1528
- const [email, setEmail] = (0, import_react10.useState)("");
1529
- const [error, setError] = (0, import_react10.useState)(null);
1884
+ const [email, setEmail] = (0, import_react13.useState)("");
1885
+ const [error, setError] = (0, import_react13.useState)(null);
1530
1886
  const handleSubmit = async (e) => {
1531
1887
  e.preventDefault();
1532
1888
  setError(null);
@@ -1540,10 +1896,10 @@ function CreateEmailSignerForm({
1540
1896
  onError?.(err instanceof Error ? err : new Error(message));
1541
1897
  }
1542
1898
  };
1543
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("form", { onSubmit: handleSubmit, className: cn("space-y-4", className), "data-cilantro-create-email-signer": true, children: [
1544
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "space-y-2", children: [
1545
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Label, { htmlFor: "cilantro-email-signer-email", children: "Email" }),
1546
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1899
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("form", { onSubmit: handleSubmit, className: cn("space-y-4", className), "data-cilantro-create-email-signer": true, children: [
1900
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "space-y-2", children: [
1901
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Label, { htmlFor: "cilantro-email-signer-email", children: "Email" }),
1902
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1547
1903
  Input,
1548
1904
  {
1549
1905
  id: "cilantro-email-signer-email",
@@ -1557,14 +1913,14 @@ function CreateEmailSignerForm({
1557
1913
  }
1558
1914
  )
1559
1915
  ] }),
1560
- error && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "rounded-md border border-destructive/50 bg-destructive/10 px-3 py-2 text-sm text-destructive", role: "alert", children: error }),
1561
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Button, { type: "submit", disabled: isLoading || !email.trim(), children: isLoading ? "Creating..." : "Create email signer" })
1916
+ error && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "rounded-md border border-destructive/50 bg-destructive/10 px-3 py-2 text-sm text-destructive", role: "alert", children: error }),
1917
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Button, { type: "submit", disabled: isLoading || !email.trim(), children: isLoading ? "Creating..." : "Create email signer" })
1562
1918
  ] });
1563
1919
  }
1564
1920
 
1565
1921
  // src/components/signers/CreatePhoneSignerForm.tsx
1566
- var import_react11 = require("react");
1567
- var import_jsx_runtime13 = require("react/jsx-runtime");
1922
+ var import_react14 = require("react");
1923
+ var import_jsx_runtime15 = require("react/jsx-runtime");
1568
1924
  function CreatePhoneSignerForm({
1569
1925
  walletId,
1570
1926
  onCreated,
@@ -1572,8 +1928,8 @@ function CreatePhoneSignerForm({
1572
1928
  className
1573
1929
  }) {
1574
1930
  const { createPhoneSigner, isLoading } = useSigners(walletId);
1575
- const [phone, setPhone] = (0, import_react11.useState)("");
1576
- const [error, setError] = (0, import_react11.useState)(null);
1931
+ const [phone, setPhone] = (0, import_react14.useState)("");
1932
+ const [error, setError] = (0, import_react14.useState)(null);
1577
1933
  const handleSubmit = async (e) => {
1578
1934
  e.preventDefault();
1579
1935
  setError(null);
@@ -1587,10 +1943,10 @@ function CreatePhoneSignerForm({
1587
1943
  onError?.(err instanceof Error ? err : new Error(message));
1588
1944
  }
1589
1945
  };
1590
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("form", { onSubmit: handleSubmit, className: cn("space-y-4", className), "data-cilantro-create-phone-signer": true, children: [
1591
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "space-y-2", children: [
1592
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Label, { htmlFor: "cilantro-phone-signer-phone", children: "Phone number" }),
1593
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1946
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("form", { onSubmit: handleSubmit, className: cn("space-y-4", className), "data-cilantro-create-phone-signer": true, children: [
1947
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "space-y-2", children: [
1948
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Label, { htmlFor: "cilantro-phone-signer-phone", children: "Phone number" }),
1949
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1594
1950
  Input,
1595
1951
  {
1596
1952
  id: "cilantro-phone-signer-phone",
@@ -1604,14 +1960,14 @@ function CreatePhoneSignerForm({
1604
1960
  }
1605
1961
  )
1606
1962
  ] }),
1607
- error && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "rounded-md border border-destructive/50 bg-destructive/10 px-3 py-2 text-sm text-destructive", role: "alert", children: error }),
1608
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Button, { type: "submit", disabled: isLoading || !phone.trim(), children: isLoading ? "Creating..." : "Create phone signer" })
1963
+ error && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "rounded-md border border-destructive/50 bg-destructive/10 px-3 py-2 text-sm text-destructive", role: "alert", children: error }),
1964
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Button, { type: "submit", disabled: isLoading || !phone.trim(), children: isLoading ? "Creating..." : "Create phone signer" })
1609
1965
  ] });
1610
1966
  }
1611
1967
 
1612
1968
  // src/components/signers/AddPasskeyButton.tsx
1613
- var import_react12 = require("react");
1614
- var import_jsx_runtime14 = require("react/jsx-runtime");
1969
+ var import_react15 = require("react");
1970
+ var import_jsx_runtime16 = require("react/jsx-runtime");
1615
1971
  function AddPasskeyButton({
1616
1972
  walletId,
1617
1973
  onRegistered,
@@ -1620,7 +1976,7 @@ function AddPasskeyButton({
1620
1976
  children
1621
1977
  }) {
1622
1978
  const { isSupported, register, isLoading } = usePasskey(walletId);
1623
- const [error, setError] = (0, import_react12.useState)(null);
1979
+ const [error, setError] = (0, import_react15.useState)(null);
1624
1980
  const handleClick = async () => {
1625
1981
  setError(null);
1626
1982
  try {
@@ -1633,15 +1989,15 @@ function AddPasskeyButton({
1633
1989
  }
1634
1990
  };
1635
1991
  if (!isSupported) return null;
1636
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: cn(className), "data-cilantro-add-passkey": true, children: [
1637
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Button, { type: "button", variant: "outline", onClick: handleClick, disabled: isLoading, children: children ?? "Add Passkey" }),
1638
- error && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "mt-2 text-sm text-destructive", role: "alert", children: error })
1992
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: cn(className), "data-cilantro-add-passkey": true, children: [
1993
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Button, { type: "button", variant: "outline", onClick: handleClick, disabled: isLoading, children: children ?? "Add Passkey" }),
1994
+ error && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "mt-2 text-sm text-destructive", role: "alert", children: error })
1639
1995
  ] });
1640
1996
  }
1641
1997
 
1642
1998
  // src/components/signers/SignerList.tsx
1643
- var import_react13 = require("react");
1644
- var import_jsx_runtime15 = require("react/jsx-runtime");
1999
+ var import_react16 = require("react");
2000
+ var import_jsx_runtime17 = require("react/jsx-runtime");
1645
2001
  function SignerList({
1646
2002
  walletId,
1647
2003
  onRevoke,
@@ -1652,7 +2008,7 @@ function SignerList({
1652
2008
  children
1653
2009
  }) {
1654
2010
  const { signers, isLoading, error, refresh, revokeSigner } = useSigners(walletId);
1655
- const [addSignerOpen, setAddSignerOpen] = (0, import_react13.useState)(false);
2011
+ const [addSignerOpen, setAddSignerOpen] = (0, import_react16.useState)(false);
1656
2012
  const handleAddSuccess = () => {
1657
2013
  refresh();
1658
2014
  setAddSignerOpen(false);
@@ -1666,7 +2022,7 @@ function SignerList({
1666
2022
  }
1667
2023
  };
1668
2024
  if (children) {
1669
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
2025
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
1670
2026
  children({
1671
2027
  signers,
1672
2028
  isLoading,
@@ -1674,24 +2030,24 @@ function SignerList({
1674
2030
  refresh,
1675
2031
  openAddSigner: () => setAddSignerOpen(true)
1676
2032
  }),
1677
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Dialog, { open: addSignerOpen, onOpenChange: setAddSignerOpen, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(DialogContent, { children: [
1678
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(DialogHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(DialogTitle, { children: "Add signer" }) }),
1679
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "space-y-4", children: [
1680
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2033
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Dialog, { open: addSignerOpen, onOpenChange: setAddSignerOpen, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(DialogContent, { children: [
2034
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(DialogHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(DialogTitle, { children: "Add signer" }) }),
2035
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "space-y-4", children: [
2036
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
1681
2037
  CreateEmailSignerForm,
1682
2038
  {
1683
2039
  walletId,
1684
2040
  onCreated: handleAddSuccess
1685
2041
  }
1686
2042
  ),
1687
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2043
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
1688
2044
  CreatePhoneSignerForm,
1689
2045
  {
1690
2046
  walletId,
1691
2047
  onCreated: handleAddSuccess
1692
2048
  }
1693
2049
  ),
1694
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2050
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
1695
2051
  AddPasskeyButton,
1696
2052
  {
1697
2053
  walletId,
@@ -1703,12 +2059,12 @@ function SignerList({
1703
2059
  ] });
1704
2060
  }
1705
2061
  if (!walletId) {
1706
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: cn(className, classNames?.root), "data-cilantro-signer-list": true, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { className: cn("text-sm text-muted-foreground", classNames?.message), children: "Select a wallet first." }) });
2062
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: cn(className, classNames?.root), "data-cilantro-signer-list": true, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: cn("text-sm text-muted-foreground", classNames?.message), children: "Select a wallet first." }) });
1707
2063
  }
1708
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: cn(className, classNames?.root), "data-cilantro-signer-list": true, "aria-busy": isLoading, "aria-live": "polite", children: [
1709
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: cn("flex items-center justify-between gap-2 mb-2", classNames?.header), children: [
1710
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "text-sm font-medium", children: "Signers" }),
1711
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2064
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: cn(className, classNames?.root), "data-cilantro-signer-list": true, "aria-busy": isLoading, "aria-live": "polite", children: [
2065
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: cn("flex items-center justify-between gap-2 mb-2", classNames?.header), children: [
2066
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "text-sm font-medium", children: "Signers" }),
2067
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
1712
2068
  Button,
1713
2069
  {
1714
2070
  type: "button",
@@ -1722,13 +2078,13 @@ function SignerList({
1722
2078
  }
1723
2079
  )
1724
2080
  ] }),
1725
- isLoading && useSkeleton ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: cn("space-y-1", classNames?.loading), "aria-busy": "true", "aria-live": "polite", children: [1, 2, 3].map((i) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Skeleton, { className: cn("h-5 w-full rounded-md", classNames?.skeleton) }, i)) }) : isLoading ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { className: cn("text-sm text-muted-foreground", classNames?.message), children: "Loading signers..." }) : error ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: cn("rounded-md border border-destructive/50 bg-destructive/10 px-3 py-2", classNames?.message), role: "alert", children: [
1726
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { className: "text-sm text-destructive", children: error }),
1727
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Button, { type: "button", variant: "outline", size: "sm", className: "mt-2", onClick: () => refresh(), children: "Retry" })
1728
- ] }) : signers.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: cn("rounded-md border border-input bg-muted/30 px-4 py-3 text-sm text-muted-foreground", classNames?.message), children: [
1729
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { className: "font-medium text-foreground", children: "No signers" }),
1730
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { className: "mt-1", children: "Add a signer to authorize transactions for this wallet." }),
1731
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2081
+ isLoading && useSkeleton ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: cn("space-y-1", classNames?.loading), "aria-busy": "true", "aria-live": "polite", children: [1, 2, 3].map((i) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Skeleton, { className: cn("h-5 w-full rounded-md", classNames?.skeleton) }, i)) }) : isLoading ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: cn("text-sm text-muted-foreground", classNames?.message), children: "Loading signers..." }) : error ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: cn("rounded-md border border-destructive/50 bg-destructive/10 px-3 py-2", classNames?.message), role: "alert", children: [
2082
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "text-sm text-destructive", children: error }),
2083
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Button, { type: "button", variant: "outline", size: "sm", className: "mt-2", onClick: () => refresh(), children: "Retry" })
2084
+ ] }) : signers.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: cn("rounded-md border border-input bg-muted/30 px-4 py-3 text-sm text-muted-foreground", classNames?.message), children: [
2085
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "font-medium text-foreground", children: "No signers" }),
2086
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "mt-1", children: "Add a signer to authorize transactions for this wallet." }),
2087
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
1732
2088
  Button,
1733
2089
  {
1734
2090
  type: "button",
@@ -1740,14 +2096,14 @@ function SignerList({
1740
2096
  children: "Add signer"
1741
2097
  }
1742
2098
  )
1743
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("ul", { className: cn("space-y-1", classNames?.list), role: "list", children: signers.map((signer) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("li", { className: cn("flex items-center justify-between gap-2 text-sm", classNames?.item), children: [
1744
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { children: [
2099
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("ul", { className: cn("space-y-1", classNames?.list), role: "list", children: signers.map((signer) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("li", { className: cn("flex items-center justify-between gap-2 text-sm", classNames?.item), children: [
2100
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { children: [
1745
2101
  getSignerDisplayName(signer),
1746
2102
  " (",
1747
2103
  getSignerTypeLabel(signer.type || signer.signerType || ""),
1748
2104
  ")"
1749
2105
  ] }),
1750
- onRevoke && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2106
+ onRevoke && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
1751
2107
  Button,
1752
2108
  {
1753
2109
  type: "button",
@@ -1760,19 +2116,19 @@ function SignerList({
1760
2116
  }
1761
2117
  )
1762
2118
  ] }, signer.id)) }),
1763
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Dialog, { open: addSignerOpen, onOpenChange: setAddSignerOpen, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(DialogContent, { children: [
1764
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(DialogHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(DialogTitle, { children: "Add signer" }) }),
1765
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "space-y-4", children: [
1766
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(CreateEmailSignerForm, { walletId, onCreated: handleAddSuccess }),
1767
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(CreatePhoneSignerForm, { walletId, onCreated: handleAddSuccess }),
1768
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(AddPasskeyButton, { walletId, onRegistered: handleAddSuccess })
2119
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Dialog, { open: addSignerOpen, onOpenChange: setAddSignerOpen, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(DialogContent, { children: [
2120
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(DialogHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(DialogTitle, { children: "Add signer" }) }),
2121
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "space-y-4", children: [
2122
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(CreateEmailSignerForm, { walletId, onCreated: handleAddSuccess }),
2123
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(CreatePhoneSignerForm, { walletId, onCreated: handleAddSuccess }),
2124
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(AddPasskeyButton, { walletId, onRegistered: handleAddSuccess })
1769
2125
  ] })
1770
2126
  ] }) })
1771
2127
  ] });
1772
2128
  }
1773
2129
 
1774
2130
  // src/components/signers/SignerSelector.tsx
1775
- var import_jsx_runtime16 = require("react/jsx-runtime");
2131
+ var import_jsx_runtime18 = require("react/jsx-runtime");
1776
2132
  function SignerSelector({
1777
2133
  walletId,
1778
2134
  value,
@@ -1800,7 +2156,7 @@ function SignerSelector({
1800
2156
  };
1801
2157
  if (!walletId && !selectedWalletId) return null;
1802
2158
  if (children) {
1803
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_jsx_runtime16.Fragment, { children: children({
2159
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_jsx_runtime18.Fragment, { children: children({
1804
2160
  signers: availableSigners,
1805
2161
  selectedSigner,
1806
2162
  onSignerSelect: handleSelect,
@@ -1808,7 +2164,7 @@ function SignerSelector({
1808
2164
  }) });
1809
2165
  }
1810
2166
  if (renderList) {
1811
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: cn(className, classNames?.root), "data-cilantro-signer-selector": true, children: renderList({
2167
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: cn(className, classNames?.root), "data-cilantro-signer-selector": true, children: renderList({
1812
2168
  signers: availableSigners,
1813
2169
  selectedSigner: selectedSigner ?? null,
1814
2170
  onSelect: handleSelect,
@@ -1818,8 +2174,8 @@ function SignerSelector({
1818
2174
  getSignerUniqueId
1819
2175
  }) });
1820
2176
  }
1821
- const loadingContent = isLoadingSigners && useSkeleton ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: cn("space-y-1", classNames?.loading), "aria-busy": "true", "aria-live": "polite", children: [1, 2, 3].map((i) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Skeleton, { className: cn("h-8 w-full rounded-md", classNames?.skeleton) }, i)) }) : isLoadingSigners ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: cn("text-sm text-muted-foreground", classNames?.message), children: "Loading signers..." }) : null;
1822
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2177
+ const loadingContent = isLoadingSigners && useSkeleton ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: cn("space-y-1", classNames?.loading), "aria-busy": "true", "aria-live": "polite", children: [1, 2, 3].map((i) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Skeleton, { className: cn("h-8 w-full rounded-md", classNames?.skeleton) }, i)) }) : isLoadingSigners ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: cn("text-sm text-muted-foreground", classNames?.message), children: "Loading signers..." }) : null;
2178
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1823
2179
  "div",
1824
2180
  {
1825
2181
  className: cn(className, classNames?.root),
@@ -1828,7 +2184,7 @@ function SignerSelector({
1828
2184
  "aria-label": "Select signer",
1829
2185
  "aria-busy": isLoadingSigners,
1830
2186
  "aria-live": "polite",
1831
- children: loadingContent ?? (availableSigners.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: cn("text-sm text-muted-foreground", classNames?.message), children: "No signers for this wallet." }) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("ul", { className: cn("space-y-1", classNames?.list), children: availableSigners.map((signer) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
2187
+ children: loadingContent ?? (availableSigners.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: cn("text-sm text-muted-foreground", classNames?.message), children: "No signers for this wallet." }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("ul", { className: cn("space-y-1", classNames?.list), children: availableSigners.map((signer) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
1832
2188
  Button,
1833
2189
  {
1834
2190
  type: "button",
@@ -1850,8 +2206,8 @@ function SignerSelector({
1850
2206
  }
1851
2207
 
1852
2208
  // src/components/wallet/ConnectWalletButton.tsx
1853
- var import_react14 = require("react");
1854
- var import_jsx_runtime17 = require("react/jsx-runtime");
2209
+ var import_react17 = require("react");
2210
+ var import_jsx_runtime19 = require("react/jsx-runtime");
1855
2211
  function ConnectWalletButton({
1856
2212
  onConnect,
1857
2213
  onDisconnect,
@@ -1859,7 +2215,7 @@ function ConnectWalletButton({
1859
2215
  children
1860
2216
  }) {
1861
2217
  const { wallets, connectedWallet, connect, disconnect } = useExternalWallet();
1862
- const [loading, setLoading] = (0, import_react14.useState)(false);
2218
+ const [loading, setLoading] = (0, import_react17.useState)(false);
1863
2219
  const handleConnect = async (wallet) => {
1864
2220
  setLoading(true);
1865
2221
  try {
@@ -1879,7 +2235,7 @@ function ConnectWalletButton({
1879
2235
  }
1880
2236
  };
1881
2237
  if (connectedWallet) {
1882
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2238
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
1883
2239
  Button,
1884
2240
  {
1885
2241
  type: "button",
@@ -1893,9 +2249,9 @@ function ConnectWalletButton({
1893
2249
  );
1894
2250
  }
1895
2251
  if (wallets.length === 0) {
1896
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Button, { type: "button", variant: "outline", className: cn(className), disabled: true, "data-cilantro-connect-wallet": true, children: "No wallet detected" });
2252
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Button, { type: "button", variant: "outline", className: cn(className), disabled: true, "data-cilantro-connect-wallet": true, children: "No wallet detected" });
1897
2253
  }
1898
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2254
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
1899
2255
  Button,
1900
2256
  {
1901
2257
  type: "button",
@@ -1910,8 +2266,8 @@ function ConnectWalletButton({
1910
2266
  }
1911
2267
 
1912
2268
  // src/components/wallet/CreateWalletForm.tsx
1913
- var import_react15 = require("react");
1914
- var import_jsx_runtime18 = require("react/jsx-runtime");
2269
+ var import_react18 = require("react");
2270
+ var import_jsx_runtime20 = require("react/jsx-runtime");
1915
2271
  function CreateWalletForm({
1916
2272
  userId,
1917
2273
  onCreated,
@@ -1919,8 +2275,8 @@ function CreateWalletForm({
1919
2275
  className
1920
2276
  }) {
1921
2277
  const { createWallet, isLoading } = useWallet();
1922
- const [name, setName] = (0, import_react15.useState)("");
1923
- const [error, setError] = (0, import_react15.useState)(null);
2278
+ const [name, setName] = (0, import_react18.useState)("");
2279
+ const [error, setError] = (0, import_react18.useState)(null);
1924
2280
  const handleSubmit = async (e) => {
1925
2281
  e.preventDefault();
1926
2282
  setError(null);
@@ -1934,10 +2290,10 @@ function CreateWalletForm({
1934
2290
  onError?.(err instanceof Error ? err : new Error(message));
1935
2291
  }
1936
2292
  };
1937
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("form", { onSubmit: handleSubmit, className: cn("space-y-4", className), "data-cilantro-create-wallet": true, children: [
1938
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "space-y-2", children: [
1939
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Label, { htmlFor: "cilantro-wallet-name", children: "Wallet name" }),
1940
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2293
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("form", { onSubmit: handleSubmit, className: cn("space-y-4", className), "data-cilantro-create-wallet": true, children: [
2294
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "space-y-2", children: [
2295
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Label, { htmlFor: "cilantro-wallet-name", children: "Wallet name" }),
2296
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
1941
2297
  Input,
1942
2298
  {
1943
2299
  id: "cilantro-wallet-name",
@@ -1950,18 +2306,18 @@ function CreateWalletForm({
1950
2306
  }
1951
2307
  )
1952
2308
  ] }),
1953
- error && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "rounded-md border border-destructive/50 bg-destructive/10 px-3 py-2 text-sm text-destructive", role: "alert", children: error }),
1954
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Button, { type: "submit", disabled: isLoading || !name.trim(), children: isLoading ? "Creating..." : "Create wallet" })
2309
+ error && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "rounded-md border border-destructive/50 bg-destructive/10 px-3 py-2 text-sm text-destructive", role: "alert", children: error }),
2310
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Button, { type: "submit", disabled: isLoading || !name.trim(), children: isLoading ? "Creating..." : "Create wallet" })
1955
2311
  ] });
1956
2312
  }
1957
2313
 
1958
2314
  // src/ui/select.tsx
1959
2315
  var React7 = __toESM(require("react"));
1960
2316
  var SelectPrimitive = __toESM(require("@radix-ui/react-select"));
1961
- var import_jsx_runtime19 = require("react/jsx-runtime");
2317
+ var import_jsx_runtime21 = require("react/jsx-runtime");
1962
2318
  var Select = SelectPrimitive.Root;
1963
2319
  var SelectValue = SelectPrimitive.Value;
1964
- var SelectTrigger = React7.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
2320
+ var SelectTrigger = React7.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
1965
2321
  SelectPrimitive.Trigger,
1966
2322
  {
1967
2323
  ref,
@@ -1972,12 +2328,12 @@ var SelectTrigger = React7.forwardRef(({ className, children, ...props }, ref) =
1972
2328
  ...props,
1973
2329
  children: [
1974
2330
  children,
1975
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(SelectPrimitive.Icon, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "ml-2 h-4 w-4 shrink-0 opacity-50", children: "\u25BC" }) })
2331
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(SelectPrimitive.Icon, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "ml-2 h-4 w-4 shrink-0 opacity-50", children: "\u25BC" }) })
1976
2332
  ]
1977
2333
  }
1978
2334
  ));
1979
2335
  SelectTrigger.displayName = SelectPrimitive.Trigger.displayName;
1980
- var SelectContent = React7.forwardRef(({ className, children, position = "popper", ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(SelectPrimitive.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2336
+ var SelectContent = React7.forwardRef(({ className, children, position = "popper", ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(SelectPrimitive.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
1981
2337
  SelectPrimitive.Content,
1982
2338
  {
1983
2339
  ref,
@@ -1988,7 +2344,7 @@ var SelectContent = React7.forwardRef(({ className, children, position = "popper
1988
2344
  ),
1989
2345
  position,
1990
2346
  ...props,
1991
- children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2347
+ children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
1992
2348
  SelectPrimitive.Viewport,
1993
2349
  {
1994
2350
  className: cn(
@@ -2001,7 +2357,7 @@ var SelectContent = React7.forwardRef(({ className, children, position = "popper
2001
2357
  }
2002
2358
  ) }));
2003
2359
  SelectContent.displayName = SelectPrimitive.Content.displayName;
2004
- var SelectItem = React7.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
2360
+ var SelectItem = React7.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
2005
2361
  SelectPrimitive.Item,
2006
2362
  {
2007
2363
  ref,
@@ -2011,15 +2367,15 @@ var SelectItem = React7.forwardRef(({ className, children, ...props }, ref) => /
2011
2367
  ),
2012
2368
  ...props,
2013
2369
  children: [
2014
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "absolute right-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(SelectPrimitive.ItemIndicator, { children: "\u2713" }) }),
2015
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(SelectPrimitive.ItemText, { children })
2370
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "absolute right-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(SelectPrimitive.ItemIndicator, { children: "\u2713" }) }),
2371
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(SelectPrimitive.ItemText, { children })
2016
2372
  ]
2017
2373
  }
2018
2374
  ));
2019
2375
  SelectItem.displayName = SelectPrimitive.Item.displayName;
2020
2376
 
2021
2377
  // src/components/wallet/WalletSelector.tsx
2022
- var import_jsx_runtime20 = require("react/jsx-runtime");
2378
+ var import_jsx_runtime22 = require("react/jsx-runtime");
2023
2379
  function WalletSelector(props) {
2024
2380
  const {
2025
2381
  value,
@@ -2049,7 +2405,7 @@ function WalletSelector(props) {
2049
2405
  onWalletChange?.(id, wallets.find((w) => w.id === id || w.walletId === id) ?? null);
2050
2406
  };
2051
2407
  if (children) {
2052
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_jsx_runtime20.Fragment, { children: children({
2408
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_jsx_runtime22.Fragment, { children: children({
2053
2409
  wallets,
2054
2410
  selectedWallet: selected,
2055
2411
  selectWallet: (id) => {
@@ -2062,35 +2418,35 @@ function WalletSelector(props) {
2062
2418
  }) });
2063
2419
  }
2064
2420
  if (renderTrigger || renderList) {
2065
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: cn(className, classNames?.root), "data-cilantro-wallet-selector": true, children: [
2421
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: cn(className, classNames?.root), "data-cilantro-wallet-selector": true, children: [
2066
2422
  renderTrigger?.({ selectedWallet: selected, wallets, isLoading, open: false, setOpen: () => {
2067
2423
  } }),
2068
2424
  renderList?.({ wallets, selectedWallet: selected, onSelect: handleSelect, isLoading })
2069
2425
  ] });
2070
2426
  }
2071
2427
  if (isLoading && useSkeleton) {
2072
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2428
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2073
2429
  "div",
2074
2430
  {
2075
2431
  className: cn(className, classNames?.root, classNames?.loading),
2076
2432
  "data-cilantro-wallet-selector": true,
2077
2433
  "aria-busy": "true",
2078
2434
  "aria-live": "polite",
2079
- children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2435
+ children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2080
2436
  "div",
2081
2437
  {
2082
2438
  className: cn(
2083
2439
  "flex h-9 w-full items-center justify-between rounded-md border border-input bg-transparent px-3 py-2",
2084
2440
  classNames?.trigger
2085
2441
  ),
2086
- children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Skeleton, { className: cn("h-4 flex-1 rounded", classNames?.skeleton) })
2442
+ children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Skeleton, { className: cn("h-4 flex-1 rounded", classNames?.skeleton) })
2087
2443
  }
2088
2444
  )
2089
2445
  }
2090
2446
  );
2091
2447
  }
2092
2448
  if (isEmpty) {
2093
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
2449
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
2094
2450
  "div",
2095
2451
  {
2096
2452
  className: cn(
@@ -2100,24 +2456,24 @@ function WalletSelector(props) {
2100
2456
  ),
2101
2457
  "data-cilantro-wallet-selector": true,
2102
2458
  children: [
2103
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "font-medium text-foreground", children: "No wallets" }),
2104
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "mt-1", children: "Wallets are created by the platform when you sign in. If you just logged in, try refreshing." })
2459
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "font-medium text-foreground", children: "No wallets" }),
2460
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "mt-1", children: "Wallets are created by the platform when you sign in. If you just logged in, try refreshing." })
2105
2461
  ]
2106
2462
  }
2107
2463
  );
2108
2464
  }
2109
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: cn(className, classNames?.root), "data-cilantro-wallet-selector": true, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(Select, { value: effectiveValue || void 0, onValueChange: handleValueChange, disabled: isLoading, children: [
2110
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(SelectTrigger, { className: classNames?.trigger, "aria-label": "Select wallet", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(SelectValue, { placeholder: isLoading ? "Loading..." : placeholder }) }),
2111
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(SelectContent, { className: classNames?.content, children: wallets.map((w) => {
2465
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: cn(className, classNames?.root), "data-cilantro-wallet-selector": true, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Select, { value: effectiveValue || void 0, onValueChange: handleValueChange, disabled: isLoading, children: [
2466
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(SelectTrigger, { className: classNames?.trigger, "aria-label": "Select wallet", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(SelectValue, { placeholder: isLoading ? "Loading..." : placeholder }) }),
2467
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(SelectContent, { className: classNames?.content, children: wallets.map((w) => {
2112
2468
  const id = w.id ?? w.walletId;
2113
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(SelectItem, { value: id, className: classNames?.item, children: w.walletName || id }, id);
2469
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(SelectItem, { value: id, className: classNames?.item, children: w.walletName || id }, id);
2114
2470
  }) })
2115
2471
  ] }) });
2116
2472
  }
2117
2473
 
2118
2474
  // src/components/wallet/WalletAddress.tsx
2119
- var import_react16 = require("react");
2120
- var import_jsx_runtime21 = require("react/jsx-runtime");
2475
+ var import_react19 = require("react");
2476
+ var import_jsx_runtime23 = require("react/jsx-runtime");
2121
2477
  function truncateAddress(addr, chars = 4) {
2122
2478
  if (addr.length <= chars * 2 + 3) return addr;
2123
2479
  return `${addr.slice(0, chars)}...${addr.slice(-chars)}`;
@@ -2128,7 +2484,7 @@ function WalletAddress({
2128
2484
  copyable = false,
2129
2485
  className
2130
2486
  }) {
2131
- const [copied, setCopied] = (0, import_react16.useState)(false);
2487
+ const [copied, setCopied] = (0, import_react19.useState)(false);
2132
2488
  const display = short ? truncateAddress(address) : address;
2133
2489
  const handleCopy = async () => {
2134
2490
  try {
@@ -2138,9 +2494,9 @@ function WalletAddress({
2138
2494
  } catch {
2139
2495
  }
2140
2496
  };
2141
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { className: cn("inline-flex items-center gap-2", className), "data-cilantro-wallet-address": true, children: [
2142
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("code", { className: "text-sm font-mono", children: display }),
2143
- copyable && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2497
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { className: cn("inline-flex items-center gap-2", className), "data-cilantro-wallet-address": true, children: [
2498
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("code", { className: "text-sm font-mono", children: display }),
2499
+ copyable && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2144
2500
  Button,
2145
2501
  {
2146
2502
  type: "button",
@@ -2156,20 +2512,20 @@ function WalletAddress({
2156
2512
  }
2157
2513
 
2158
2514
  // src/components/wallet/WalletBalance.tsx
2159
- var import_react17 = require("react");
2515
+ var import_react20 = require("react");
2160
2516
  var import_wallet7 = require("cilantro-sdk/wallet");
2161
- var import_jsx_runtime22 = require("react/jsx-runtime");
2517
+ var import_jsx_runtime24 = require("react/jsx-runtime");
2162
2518
  function WalletBalance({
2163
2519
  walletId,
2164
2520
  showTokens = false,
2165
2521
  className
2166
2522
  }) {
2167
2523
  const { jwt } = useCilantroContext();
2168
- const [loading, setLoading] = (0, import_react17.useState)(true);
2169
- const [solBalance, setSolBalance] = (0, import_react17.useState)(null);
2170
- const [tokens, setTokens] = (0, import_react17.useState)([]);
2171
- const [error, setError] = (0, import_react17.useState)(null);
2172
- (0, import_react17.useEffect)(() => {
2524
+ const [loading, setLoading] = (0, import_react20.useState)(true);
2525
+ const [solBalance, setSolBalance] = (0, import_react20.useState)(null);
2526
+ const [tokens, setTokens] = (0, import_react20.useState)([]);
2527
+ const [error, setError] = (0, import_react20.useState)(null);
2528
+ (0, import_react20.useEffect)(() => {
2173
2529
  if (!walletId || !jwt) {
2174
2530
  setSolBalance(null);
2175
2531
  setTokens([]);
@@ -2206,15 +2562,15 @@ function WalletBalance({
2206
2562
  };
2207
2563
  }, [walletId, jwt, showTokens]);
2208
2564
  if (loading) {
2209
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: cn(className), "data-cilantro-wallet-balance": true, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Skeleton, { className: "h-5 w-24 rounded" }) });
2565
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: cn(className), "data-cilantro-wallet-balance": true, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Skeleton, { className: "h-5 w-24 rounded" }) });
2210
2566
  }
2211
2567
  if (error) {
2212
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: cn("text-sm text-destructive", className), "data-cilantro-wallet-balance": true, role: "alert", children: error });
2568
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: cn("text-sm text-destructive", className), "data-cilantro-wallet-balance": true, role: "alert", children: error });
2213
2569
  }
2214
2570
  const solDisplay = solBalance != null ? `${Number(solBalance) / 1e9} SOL` : "\u2014";
2215
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: cn("text-sm", className), "data-cilantro-wallet-balance": true, children: [
2216
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "font-medium", children: solDisplay }),
2217
- showTokens && tokens.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("ul", { className: "mt-1 space-y-0.5 text-muted-foreground", children: tokens.map((t, i) => /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("li", { children: [
2571
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: cn("text-sm", className), "data-cilantro-wallet-balance": true, children: [
2572
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "font-medium", children: solDisplay }),
2573
+ showTokens && tokens.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("ul", { className: "mt-1 space-y-0.5 text-muted-foreground", children: tokens.map((t, i) => /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("li", { children: [
2218
2574
  t.symbol ?? t.mint ?? "Token",
2219
2575
  ": ",
2220
2576
  t.balance ?? "\u2014"
@@ -2223,8 +2579,8 @@ function WalletBalance({
2223
2579
  }
2224
2580
 
2225
2581
  // src/components/transactions/SendSOLForm.tsx
2226
- var import_react18 = require("react");
2227
- var import_jsx_runtime23 = require("react/jsx-runtime");
2582
+ var import_react21 = require("react");
2583
+ var import_jsx_runtime25 = require("react/jsx-runtime");
2228
2584
  function SendSOLForm({
2229
2585
  walletId,
2230
2586
  signerId,
@@ -2234,9 +2590,9 @@ function SendSOLForm({
2234
2590
  className
2235
2591
  }) {
2236
2592
  const { sendSOL, isPending, error } = useSendTransaction(walletId, signerId, signerType);
2237
- const [recipientAddress, setRecipientAddress] = (0, import_react18.useState)("");
2238
- const [amountLamports, setAmountLamports] = (0, import_react18.useState)("");
2239
- const [submitError, setSubmitError] = (0, import_react18.useState)(null);
2593
+ const [recipientAddress, setRecipientAddress] = (0, import_react21.useState)("");
2594
+ const [amountLamports, setAmountLamports] = (0, import_react21.useState)("");
2595
+ const [submitError, setSubmitError] = (0, import_react21.useState)(null);
2240
2596
  const handleSubmit = async (e) => {
2241
2597
  e.preventDefault();
2242
2598
  setSubmitError(null);
@@ -2256,10 +2612,10 @@ function SendSOLForm({
2256
2612
  onError?.(err instanceof Error ? err : new Error(message));
2257
2613
  }
2258
2614
  };
2259
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("form", { onSubmit: handleSubmit, className: cn("space-y-4", className), "data-cilantro-send-sol": true, children: [
2260
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "space-y-2", children: [
2261
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Label, { htmlFor: "cilantro-send-sol-recipient", children: "Recipient address" }),
2262
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2615
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("form", { onSubmit: handleSubmit, className: cn("space-y-4", className), "data-cilantro-send-sol": true, children: [
2616
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "space-y-2", children: [
2617
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Label, { htmlFor: "cilantro-send-sol-recipient", children: "Recipient address" }),
2618
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
2263
2619
  Input,
2264
2620
  {
2265
2621
  id: "cilantro-send-sol-recipient",
@@ -2272,9 +2628,9 @@ function SendSOLForm({
2272
2628
  }
2273
2629
  )
2274
2630
  ] }),
2275
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "space-y-2", children: [
2276
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Label, { htmlFor: "cilantro-send-sol-amount", children: "Amount (lamports)" }),
2277
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2631
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "space-y-2", children: [
2632
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Label, { htmlFor: "cilantro-send-sol-amount", children: "Amount (lamports)" }),
2633
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
2278
2634
  Input,
2279
2635
  {
2280
2636
  id: "cilantro-send-sol-amount",
@@ -2288,14 +2644,14 @@ function SendSOLForm({
2288
2644
  }
2289
2645
  )
2290
2646
  ] }),
2291
- (error || submitError) && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "rounded-md border border-destructive/50 bg-destructive/10 px-3 py-2 text-sm text-destructive", role: "alert", children: submitError ?? error }),
2292
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Button, { type: "submit", disabled: isPending || !recipientAddress.trim() || !amountLamports, children: isPending ? "Sending..." : "Send SOL" })
2647
+ (error || submitError) && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "rounded-md border border-destructive/50 bg-destructive/10 px-3 py-2 text-sm text-destructive", role: "alert", children: submitError ?? error }),
2648
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Button, { type: "submit", disabled: isPending || !recipientAddress.trim() || !amountLamports, children: isPending ? "Sending..." : "Send SOL" })
2293
2649
  ] });
2294
2650
  }
2295
2651
 
2296
2652
  // src/components/transactions/SendSPLForm.tsx
2297
- var import_react19 = require("react");
2298
- var import_jsx_runtime24 = require("react/jsx-runtime");
2653
+ var import_react22 = require("react");
2654
+ var import_jsx_runtime26 = require("react/jsx-runtime");
2299
2655
  function SendSPLForm({
2300
2656
  walletId,
2301
2657
  signerId,
@@ -2306,10 +2662,10 @@ function SendSPLForm({
2306
2662
  className
2307
2663
  }) {
2308
2664
  const { sendSPL, isPending, error } = useSendTransaction(walletId, signerId, signerType);
2309
- const [mintAddress, setMintAddress] = (0, import_react19.useState)(initialMint ?? "");
2310
- const [recipientAddress, setRecipientAddress] = (0, import_react19.useState)("");
2311
- const [amount, setAmount] = (0, import_react19.useState)("");
2312
- const [submitError, setSubmitError] = (0, import_react19.useState)(null);
2665
+ const [mintAddress, setMintAddress] = (0, import_react22.useState)(initialMint ?? "");
2666
+ const [recipientAddress, setRecipientAddress] = (0, import_react22.useState)("");
2667
+ const [amount, setAmount] = (0, import_react22.useState)("");
2668
+ const [submitError, setSubmitError] = (0, import_react22.useState)(null);
2313
2669
  const handleSubmit = async (e) => {
2314
2670
  e.preventDefault();
2315
2671
  setSubmitError(null);
@@ -2333,10 +2689,10 @@ function SendSPLForm({
2333
2689
  onError?.(err instanceof Error ? err : new Error(message));
2334
2690
  }
2335
2691
  };
2336
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("form", { onSubmit: handleSubmit, className: cn("space-y-4", className), "data-cilantro-send-spl": true, children: [
2337
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "space-y-2", children: [
2338
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Label, { htmlFor: "cilantro-send-spl-mint", children: "Mint address" }),
2339
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2692
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("form", { onSubmit: handleSubmit, className: cn("space-y-4", className), "data-cilantro-send-spl": true, children: [
2693
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "space-y-2", children: [
2694
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Label, { htmlFor: "cilantro-send-spl-mint", children: "Mint address" }),
2695
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
2340
2696
  Input,
2341
2697
  {
2342
2698
  id: "cilantro-send-spl-mint",
@@ -2349,9 +2705,9 @@ function SendSPLForm({
2349
2705
  }
2350
2706
  )
2351
2707
  ] }),
2352
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "space-y-2", children: [
2353
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Label, { htmlFor: "cilantro-send-spl-recipient", children: "Recipient address" }),
2354
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2708
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "space-y-2", children: [
2709
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Label, { htmlFor: "cilantro-send-spl-recipient", children: "Recipient address" }),
2710
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
2355
2711
  Input,
2356
2712
  {
2357
2713
  id: "cilantro-send-spl-recipient",
@@ -2364,9 +2720,9 @@ function SendSPLForm({
2364
2720
  }
2365
2721
  )
2366
2722
  ] }),
2367
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "space-y-2", children: [
2368
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Label, { htmlFor: "cilantro-send-spl-amount", children: "Amount" }),
2369
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2723
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "space-y-2", children: [
2724
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Label, { htmlFor: "cilantro-send-spl-amount", children: "Amount" }),
2725
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
2370
2726
  Input,
2371
2727
  {
2372
2728
  id: "cilantro-send-spl-amount",
@@ -2381,13 +2737,13 @@ function SendSPLForm({
2381
2737
  }
2382
2738
  )
2383
2739
  ] }),
2384
- (error || submitError) && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "rounded-md border border-destructive/50 bg-destructive/10 px-3 py-2 text-sm text-destructive", role: "alert", children: submitError ?? error }),
2385
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Button, { type: "submit", disabled: isPending || !mintAddress.trim() || !recipientAddress.trim() || !amount, children: isPending ? "Sending..." : "Send SPL" })
2740
+ (error || submitError) && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "rounded-md border border-destructive/50 bg-destructive/10 px-3 py-2 text-sm text-destructive", role: "alert", children: submitError ?? error }),
2741
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Button, { type: "submit", disabled: isPending || !mintAddress.trim() || !recipientAddress.trim() || !amount, children: isPending ? "Sending..." : "Send SPL" })
2386
2742
  ] });
2387
2743
  }
2388
2744
 
2389
2745
  // src/components/transactions/TransactionStatus.tsx
2390
- var import_jsx_runtime25 = require("react/jsx-runtime");
2746
+ var import_jsx_runtime27 = require("react/jsx-runtime");
2391
2747
  var EXPLORER_URL = {
2392
2748
  "mainnet-beta": "https://explorer.solana.com",
2393
2749
  devnet: "https://explorer.solana.com/?cluster=devnet",
@@ -2400,9 +2756,9 @@ function TransactionStatus({
2400
2756
  }) {
2401
2757
  const base = EXPLORER_URL[cluster] ?? EXPLORER_URL["mainnet-beta"];
2402
2758
  const href = `${base}/tx/${signature}`;
2403
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: cn("text-sm", className), "data-cilantro-transaction-status": true, children: [
2404
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "text-muted-foreground", children: "Transaction: " }),
2405
- /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
2759
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: cn("text-sm", className), "data-cilantro-transaction-status": true, children: [
2760
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "text-muted-foreground", children: "Transaction: " }),
2761
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
2406
2762
  "a",
2407
2763
  {
2408
2764
  href,
@@ -2420,18 +2776,18 @@ function TransactionStatus({
2420
2776
  }
2421
2777
 
2422
2778
  // src/components/transactions/TransactionHistory.tsx
2423
- var import_react20 = require("react");
2424
- var import_jsx_runtime26 = require("react/jsx-runtime");
2779
+ var import_react23 = require("react");
2780
+ var import_jsx_runtime28 = require("react/jsx-runtime");
2425
2781
  function TransactionHistory({
2426
2782
  walletId,
2427
2783
  pageSize = 10,
2428
2784
  className
2429
2785
  }) {
2430
2786
  const { jwt } = useCilantroContext();
2431
- const [loading, setLoading] = (0, import_react20.useState)(true);
2432
- const [signatures, setSignatures] = (0, import_react20.useState)([]);
2433
- const [error, setError] = (0, import_react20.useState)(null);
2434
- (0, import_react20.useEffect)(() => {
2787
+ const [loading, setLoading] = (0, import_react23.useState)(true);
2788
+ const [signatures, setSignatures] = (0, import_react23.useState)([]);
2789
+ const [error, setError] = (0, import_react23.useState)(null);
2790
+ (0, import_react23.useEffect)(() => {
2435
2791
  if (!walletId || !jwt) {
2436
2792
  setSignatures([]);
2437
2793
  setLoading(false);
@@ -2458,20 +2814,20 @@ function TransactionHistory({
2458
2814
  };
2459
2815
  }, [walletId, jwt, pageSize]);
2460
2816
  if (loading) {
2461
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: cn("text-sm text-muted-foreground", className), "data-cilantro-transaction-history": true, children: "Loading..." });
2817
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: cn("text-sm text-muted-foreground", className), "data-cilantro-transaction-history": true, children: "Loading..." });
2462
2818
  }
2463
2819
  if (error) {
2464
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: cn("text-sm text-destructive", className), "data-cilantro-transaction-history": true, role: "alert", children: error });
2820
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: cn("text-sm text-destructive", className), "data-cilantro-transaction-history": true, role: "alert", children: error });
2465
2821
  }
2466
2822
  if (signatures.length === 0) {
2467
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: cn("text-sm text-muted-foreground", className), "data-cilantro-transaction-history": true, children: "No recent transactions." });
2823
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: cn("text-sm text-muted-foreground", className), "data-cilantro-transaction-history": true, children: "No recent transactions." });
2468
2824
  }
2469
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("ul", { className: cn("space-y-2", className), "data-cilantro-transaction-history": true, role: "list", children: signatures.map((sig) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(TransactionStatus, { signature: sig }) }, sig)) });
2825
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("ul", { className: cn("space-y-2", className), "data-cilantro-transaction-history": true, role: "list", children: signatures.map((sig) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(TransactionStatus, { signature: sig }) }, sig)) });
2470
2826
  }
2471
2827
 
2472
2828
  // src/components/layout/CilantroConnect.tsx
2473
- var import_react21 = require("react");
2474
- var import_jsx_runtime27 = require("react/jsx-runtime");
2829
+ var import_react24 = require("react");
2830
+ var import_jsx_runtime29 = require("react/jsx-runtime");
2475
2831
  function CilantroConnect({
2476
2832
  onConnect,
2477
2833
  onDisconnect,
@@ -2479,13 +2835,13 @@ function CilantroConnect({
2479
2835
  }) {
2480
2836
  const { isAuthenticated } = useAuth();
2481
2837
  const { wallet, wallets, createWallet, selectWallet, isLoading: walletLoading } = useWallet();
2482
- const [walletId, setWalletId] = (0, import_react21.useState)(null);
2483
- const [step, setStep] = (0, import_react21.useState)("auth");
2838
+ const [walletId, setWalletId] = (0, import_react24.useState)(null);
2839
+ const [step, setStep] = (0, import_react24.useState)("auth");
2484
2840
  if (!isAuthenticated) {
2485
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: cn(className), "data-cilantro-connect": true, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(LoginForm, { onSuccess: () => setStep("wallet") }) });
2841
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: cn(className), "data-cilantro-connect": true, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(LoginForm, { onSuccess: () => setStep("wallet") }) });
2486
2842
  }
2487
2843
  if (step === "wallet" && wallets.length === 0 && !walletLoading) {
2488
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: cn(className), "data-cilantro-connect": true, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
2844
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: cn(className), "data-cilantro-connect": true, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
2489
2845
  CreateWalletForm,
2490
2846
  {
2491
2847
  onCreated: (res) => {
@@ -2501,9 +2857,9 @@ function CilantroConnect({
2501
2857
  }
2502
2858
  if (step === "signer" && walletId) {
2503
2859
  const currentWallet = wallet ?? wallets.find((w) => (w.id ?? w.walletId) === walletId);
2504
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: cn("space-y-4", className), "data-cilantro-connect": true, children: [
2505
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { className: "text-sm text-muted-foreground", children: "Add a signer to your wallet" }),
2506
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
2860
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: cn("space-y-4", className), "data-cilantro-connect": true, children: [
2861
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("p", { className: "text-sm text-muted-foreground", children: "Add a signer to your wallet" }),
2862
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
2507
2863
  CreateEmailSignerForm,
2508
2864
  {
2509
2865
  walletId,
@@ -2516,7 +2872,7 @@ function CilantroConnect({
2516
2872
  }
2517
2873
  }
2518
2874
  ),
2519
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
2875
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
2520
2876
  AddPasskeyButton,
2521
2877
  {
2522
2878
  walletId,
@@ -2531,9 +2887,9 @@ function CilantroConnect({
2531
2887
  ] });
2532
2888
  }
2533
2889
  if (wallet && step === "done") {
2534
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: cn(className), "data-cilantro-connect": true, children: [
2535
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { className: "text-sm text-muted-foreground", children: "Connected" }),
2536
- onDisconnect && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
2890
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: cn(className), "data-cilantro-connect": true, children: [
2891
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("p", { className: "text-sm text-muted-foreground", children: "Connected" }),
2892
+ onDisconnect && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
2537
2893
  "button",
2538
2894
  {
2539
2895
  type: "button",
@@ -2549,11 +2905,11 @@ function CilantroConnect({
2549
2905
  ] });
2550
2906
  }
2551
2907
  if (walletLoading) {
2552
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: cn("text-sm text-muted-foreground", className), "data-cilantro-connect": true, children: "Loading..." });
2908
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: cn("text-sm text-muted-foreground", className), "data-cilantro-connect": true, children: "Loading..." });
2553
2909
  }
2554
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: cn(className), "data-cilantro-connect": true, children: [
2555
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { className: "text-sm text-muted-foreground", children: "Set up your wallet" }),
2556
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
2910
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: cn(className), "data-cilantro-connect": true, children: [
2911
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("p", { className: "text-sm text-muted-foreground", children: "Set up your wallet" }),
2912
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
2557
2913
  CreateWalletForm,
2558
2914
  {
2559
2915
  onCreated: (res) => {
@@ -2570,24 +2926,24 @@ function CilantroConnect({
2570
2926
  }
2571
2927
 
2572
2928
  // src/components/layout/LoadingOverlay.tsx
2573
- var import_jsx_runtime28 = require("react/jsx-runtime");
2929
+ var import_jsx_runtime30 = require("react/jsx-runtime");
2574
2930
  function LoadingOverlay({
2575
2931
  isLoading,
2576
2932
  message,
2577
2933
  children,
2578
2934
  className
2579
2935
  }) {
2580
- if (!isLoading) return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_jsx_runtime28.Fragment, { children });
2581
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: cn("relative", className), "data-cilantro-loading-overlay": true, children: [
2582
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
2936
+ if (!isLoading) return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_jsx_runtime30.Fragment, { children });
2937
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: cn("relative", className), "data-cilantro-loading-overlay": true, children: [
2938
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
2583
2939
  "div",
2584
2940
  {
2585
2941
  className: "absolute inset-0 z-10 flex items-center justify-center bg-background/80",
2586
2942
  "aria-busy": "true",
2587
2943
  "aria-live": "polite",
2588
- children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex flex-col items-center gap-2", children: [
2589
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "h-8 w-8 animate-spin rounded-full border-2 border-primary border-t-transparent" }),
2590
- message && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { className: "text-sm text-muted-foreground", children: message })
2944
+ children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex flex-col items-center gap-2", children: [
2945
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "h-8 w-8 animate-spin rounded-full border-2 border-primary border-t-transparent" }),
2946
+ message && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { className: "text-sm text-muted-foreground", children: message })
2591
2947
  ] })
2592
2948
  }
2593
2949
  ),
@@ -2596,9 +2952,9 @@ function LoadingOverlay({
2596
2952
  }
2597
2953
 
2598
2954
  // src/components/layout/ErrorBoundary.tsx
2599
- var import_react22 = require("react");
2600
- var import_jsx_runtime29 = require("react/jsx-runtime");
2601
- var ErrorBoundary = class extends import_react22.Component {
2955
+ var import_react25 = require("react");
2956
+ var import_jsx_runtime31 = require("react/jsx-runtime");
2957
+ var ErrorBoundary = class extends import_react25.Component {
2602
2958
  constructor() {
2603
2959
  super(...arguments);
2604
2960
  this.state = { hasError: false, error: null };
@@ -2618,16 +2974,16 @@ var ErrorBoundary = class extends import_react22.Component {
2618
2974
  if (this.props.fallback) {
2619
2975
  return this.props.fallback;
2620
2976
  }
2621
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
2977
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
2622
2978
  "div",
2623
2979
  {
2624
2980
  className: "rounded-md border border-destructive/50 bg-destructive/10 p-4 text-sm text-destructive",
2625
2981
  "data-cilantro-error-boundary": true,
2626
2982
  role: "alert",
2627
2983
  children: [
2628
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("p", { className: "font-medium", children: "Something went wrong" }),
2629
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("p", { className: "mt-1 text-muted-foreground", children: this.state.error.message }),
2630
- this.props.onRetry && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Button, { type: "button", variant: "outline", size: "sm", className: "mt-3", onClick: this.handleRetry, children: "Retry" })
2984
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("p", { className: "font-medium", children: "Something went wrong" }),
2985
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("p", { className: "mt-1 text-muted-foreground", children: this.state.error.message }),
2986
+ this.props.onRetry && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Button, { type: "button", variant: "outline", size: "sm", className: "mt-3", onClick: this.handleRetry, children: "Retry" })
2631
2987
  ]
2632
2988
  }
2633
2989
  );
@@ -2638,7 +2994,7 @@ var ErrorBoundary = class extends import_react22.Component {
2638
2994
 
2639
2995
  // src/ui/theme-provider.tsx
2640
2996
  var React8 = __toESM(require("react"));
2641
- var import_jsx_runtime30 = require("react/jsx-runtime");
2997
+ var import_jsx_runtime32 = require("react/jsx-runtime");
2642
2998
  var DEFAULT_THEME_CSS = `
2643
2999
  :root,[data-theme="light"]{--background:0 0% 100%;--foreground:222.2 84% 4.9%;--primary:222.2 47.4% 11.2%;--primary-foreground:210 40% 98%;--muted:210 40% 96.1%;--muted-foreground:215.4 16.3% 46.9%;--border:214.3 31.8% 91.4%;--input:214.3 31.8% 91.4%;--ring:222.2 84% 4.9%;--destructive:0 84.2% 60.2%;--destructive-foreground:210 40% 98%;--accent:210 40% 96.1%;--accent-foreground:222.2 47.4% 11.2%;--popover:0 0% 100%;--popover-foreground:222.2 84% 4.9%;--card:0 0% 100%;--card-foreground:222.2 84% 4.9%}
2644
3000
  [data-theme="dark"]{--background:222.2 84% 4.9%;--foreground:210 40% 98%;--primary:210 40% 98%;--primary-foreground:222.2 47.4% 11.2%;--muted:217.2 32.6% 17.5%;--muted-foreground:215 20.2% 65.1%;--border:217.2 32.6% 17.5%;--input:217.2 32.6% 17.5%;--ring:212.7 26.8% 83.9%;--destructive:0 62.8% 30.6%;--destructive-foreground:210 40% 98%;--accent:217.2 32.6% 17.5%;--accent-foreground:210 40% 98%;--popover:222.2 84% 4.9%;--popover-foreground:210 40% 98%;--card:222.2 84% 4.9%;--card-foreground:210 40% 98%}
@@ -2684,15 +3040,15 @@ function ThemeProvider({
2684
3040
  mql.addEventListener("change", listener);
2685
3041
  return () => mql.removeEventListener("change", listener);
2686
3042
  }, [theme, storageKey]);
2687
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
2688
- injectStyles && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
3043
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
3044
+ injectStyles && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
2689
3045
  "style",
2690
3046
  {
2691
3047
  dangerouslySetInnerHTML: { __html: DEFAULT_THEME_CSS },
2692
3048
  "data-cilantro-theme-styles": true
2693
3049
  }
2694
3050
  ),
2695
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
3051
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
2696
3052
  "div",
2697
3053
  {
2698
3054
  className: cn(className),
@@ -3167,6 +3523,7 @@ async function getWalletData(walletId) {
3167
3523
  0 && (module.exports = {
3168
3524
  AddPasskeyButton,
3169
3525
  AuthGuard,
3526
+ AuthShell,
3170
3527
  CilantroConnect,
3171
3528
  CilantroContextProvider,
3172
3529
  CilantroProvider,
@@ -3178,6 +3535,7 @@ async function getWalletData(walletId) {
3178
3535
  LoadingOverlay,
3179
3536
  LoginForm,
3180
3537
  LogoutButton,
3538
+ RegisterForm,
3181
3539
  SIGNER_TYPES,
3182
3540
  SendSOLForm,
3183
3541
  SendSPLForm,
@@ -3197,7 +3555,9 @@ async function getWalletData(walletId) {
3197
3555
  extractErrorMessage,
3198
3556
  extractResponseData,
3199
3557
  getSignerPublicKey,
3558
+ getWalletAddress,
3200
3559
  getWalletData,
3560
+ getWalletId,
3201
3561
  isAuthError,
3202
3562
  isJwtExpired,
3203
3563
  normalizeSigner,
@@ -3211,6 +3571,7 @@ async function getWalletData(walletId) {
3211
3571
  useCilantroContext,
3212
3572
  useExternalWallet,
3213
3573
  usePasskey,
3574
+ useReturnUrl,
3214
3575
  useSendTransaction,
3215
3576
  useSigners,
3216
3577
  useWallet,