@howone/sdk 0.6.0 → 0.7.0

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
@@ -164,7 +164,20 @@ function decodeJwtPayload(token) {
164
164
  if (pad === 2) base64 += "==";
165
165
  else if (pad === 3) base64 += "=";
166
166
  else if (pad !== 0) return null;
167
- const json = atob(base64);
167
+ const binary = atob(base64);
168
+ let json = binary;
169
+ try {
170
+ if (typeof TextDecoder !== "undefined") {
171
+ const bytes = Uint8Array.from(binary, (ch) => ch.charCodeAt(0));
172
+ json = new TextDecoder("utf-8", { fatal: false }).decode(bytes);
173
+ } else {
174
+ json = decodeURIComponent(
175
+ binary.split("").map((ch) => `%${ch.charCodeAt(0).toString(16).padStart(2, "0")}`).join("")
176
+ );
177
+ }
178
+ } catch {
179
+ json = binary;
180
+ }
168
181
  return JSON.parse(json);
169
182
  } catch {
170
183
  return null;
@@ -284,13 +297,13 @@ var index_exports = {};
284
297
  __export(index_exports, {
285
298
  AUTH_TOKEN_KEY: () => AUTH_TOKEN_KEY,
286
299
  ClayxButton: () => ClayxButton,
300
+ ClayxToast: () => ClayxToast,
287
301
  DefaultErrorFallback: () => DefaultErrorFallback,
288
302
  ElementSelector: () => ElementSelector,
289
303
  ElementSelectorProvider: () => ElementSelectorProvider,
290
304
  ErrorBoundary: () => ErrorBoundary,
291
305
  FloatingButton: () => FloatingButton,
292
306
  GlobalToastContainer: () => GlobalToastContainer,
293
- GoeyToast: () => GoeyToast,
294
307
  HowOneProvider: () => HowOneProvider,
295
308
  Loading: () => Loading,
296
309
  LoadingSpinner: () => LoadingSpinner,
@@ -1031,7 +1044,7 @@ var LoginForm = ({
1031
1044
  };
1032
1045
 
1033
1046
  // src/components/auth/HowoneProvider.tsx
1034
- var import_react9 = require("react");
1047
+ var import_react8 = require("react");
1035
1048
  init_auth();
1036
1049
 
1037
1050
  // src/components/theme/ThemeProvider.tsx
@@ -1088,68 +1101,33 @@ var useTheme = () => {
1088
1101
  };
1089
1102
 
1090
1103
  // src/components/ui/Toast/GlobalToastContainer.tsx
1091
- var import_goey_toast = require("goey-toast");
1092
- var import_styles = require("goey-toast/styles.css");
1093
-
1094
- // src/components/theme/ThemeToggle.tsx
1095
- var React2 = __toESM(require("react"));
1096
- var import_react5 = require("@iconify/react");
1104
+ var import_react_toastify = require("react-toastify");
1097
1105
  var import_jsx_runtime4 = require("react/jsx-runtime");
1098
- function ThemeToggle({ className }) {
1099
- const { setTheme, theme } = useTheme();
1100
- const [mounted, setMounted] = React2.useState(false);
1101
- React2.useEffect(() => {
1102
- setMounted(true);
1103
- }, []);
1104
- const handleToggle = () => {
1105
- if (theme === "dark") {
1106
- setTheme("light");
1107
- } else {
1108
- setTheme("dark");
1109
- }
1110
- };
1111
- if (!mounted) {
1112
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react5.Icon, { icon: "solar:sun-bold", width: 20, height: 20 });
1113
- }
1114
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1115
- "div",
1116
- {
1117
- className: `cursor-pointer ${className || ""}`,
1118
- onClick: handleToggle,
1119
- children: theme === "light" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react5.Icon, { icon: "solar:sun-bold", width: 20, height: 20 }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react5.Icon, { icon: "solar:moon-linear", width: 20, height: 20 })
1120
- }
1121
- );
1122
- }
1123
-
1124
- // src/components/ui/Toast/GlobalToastContainer.tsx
1125
- var import_jsx_runtime5 = require("react/jsx-runtime");
1126
1106
  function GlobalToastContainer() {
1127
- const { theme } = useTheme();
1128
- const resolvedTheme = theme === "dark" ? "dark" : "light";
1129
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1130
- import_goey_toast.GoeyToaster,
1107
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1108
+ import_react_toastify.ToastContainer,
1131
1109
  {
1132
- position: "bottom-right",
1133
- theme: resolvedTheme
1110
+ newestOnTop: false,
1111
+ closeButton: false
1134
1112
  }
1135
1113
  );
1136
1114
  }
1137
1115
 
1138
1116
  // src/components/ElementSelectorProvider.tsx
1139
- var import_react8 = require("react");
1117
+ var import_react7 = require("react");
1140
1118
 
1141
1119
  // src/components/ElementSelector.tsx
1142
- var import_react6 = require("react");
1143
- var import_jsx_runtime6 = require("react/jsx-runtime");
1120
+ var import_react5 = require("react");
1121
+ var import_jsx_runtime5 = require("react/jsx-runtime");
1144
1122
  var ElementSelector = ({
1145
1123
  active,
1146
1124
  onSelect,
1147
1125
  onCancel
1148
1126
  }) => {
1149
- const [hoveredElement, setHoveredElement] = (0, import_react6.useState)(null);
1150
- const [highlightRect, setHighlightRect] = (0, import_react6.useState)(null);
1151
- const overlayRef = (0, import_react6.useRef)(null);
1152
- const getSourceLocation = (0, import_react6.useCallback)((element) => {
1127
+ const [hoveredElement, setHoveredElement] = (0, import_react5.useState)(null);
1128
+ const [highlightRect, setHighlightRect] = (0, import_react5.useState)(null);
1129
+ const overlayRef = (0, import_react5.useRef)(null);
1130
+ const getSourceLocation = (0, import_react5.useCallback)((element) => {
1153
1131
  let current = element;
1154
1132
  while (current && current !== document.body) {
1155
1133
  const sourceLocationAttr = current.getAttribute("data-source-location");
@@ -1164,7 +1142,7 @@ var ElementSelector = ({
1164
1142
  }
1165
1143
  return null;
1166
1144
  }, []);
1167
- const handleMouseMove = (0, import_react6.useCallback)((e) => {
1145
+ const handleMouseMove = (0, import_react5.useCallback)((e) => {
1168
1146
  if (!active) return;
1169
1147
  const elements = document.elementsFromPoint(e.clientX, e.clientY);
1170
1148
  const targetElement = elements.find(
@@ -1176,7 +1154,7 @@ var ElementSelector = ({
1176
1154
  setHighlightRect(rect);
1177
1155
  }
1178
1156
  }, [active, hoveredElement]);
1179
- const handleClick = (0, import_react6.useCallback)((e) => {
1157
+ const handleClick = (0, import_react5.useCallback)((e) => {
1180
1158
  if (!active || !hoveredElement) return;
1181
1159
  e.preventDefault();
1182
1160
  e.stopPropagation();
@@ -1204,7 +1182,7 @@ var ElementSelector = ({
1204
1182
  }
1205
1183
  }
1206
1184
  }, [active, hoveredElement, getSourceLocation, onSelect, onCancel]);
1207
- (0, import_react6.useEffect)(() => {
1185
+ (0, import_react5.useEffect)(() => {
1208
1186
  if (active) {
1209
1187
  document.addEventListener("mousemove", handleMouseMove);
1210
1188
  document.addEventListener("click", handleClick, true);
@@ -1220,8 +1198,8 @@ var ElementSelector = ({
1220
1198
  }
1221
1199
  }, [active, handleMouseMove, handleClick]);
1222
1200
  if (!active) return null;
1223
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
1224
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1201
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
1202
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1225
1203
  "div",
1226
1204
  {
1227
1205
  ref: overlayRef,
@@ -1238,7 +1216,7 @@ var ElementSelector = ({
1238
1216
  }
1239
1217
  }
1240
1218
  ),
1241
- highlightRect && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1219
+ highlightRect && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1242
1220
  "div",
1243
1221
  {
1244
1222
  style: {
@@ -1256,7 +1234,7 @@ var ElementSelector = ({
1256
1234
  }
1257
1235
  }
1258
1236
  ),
1259
- hoveredElement && highlightRect && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1237
+ hoveredElement && highlightRect && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1260
1238
  "div",
1261
1239
  {
1262
1240
  style: {
@@ -1282,17 +1260,17 @@ var ElementSelector = ({
1282
1260
  };
1283
1261
 
1284
1262
  // src/hooks/use-element-selector.ts
1285
- var import_react7 = require("react");
1263
+ var import_react6 = require("react");
1286
1264
  function useElementSelector() {
1287
- const [isSelecting, setIsSelecting] = (0, import_react7.useState)(false);
1288
- const [selectedElement, setSelectedElement] = (0, import_react7.useState)(null);
1289
- const startSelecting = (0, import_react7.useCallback)(() => {
1265
+ const [isSelecting, setIsSelecting] = (0, import_react6.useState)(false);
1266
+ const [selectedElement, setSelectedElement] = (0, import_react6.useState)(null);
1267
+ const startSelecting = (0, import_react6.useCallback)(() => {
1290
1268
  setIsSelecting(true);
1291
1269
  }, []);
1292
- const stopSelecting = (0, import_react7.useCallback)(() => {
1270
+ const stopSelecting = (0, import_react6.useCallback)(() => {
1293
1271
  setIsSelecting(false);
1294
1272
  }, []);
1295
- const clearSelection = (0, import_react7.useCallback)(() => {
1273
+ const clearSelection = (0, import_react6.useCallback)(() => {
1296
1274
  setSelectedElement(null);
1297
1275
  }, []);
1298
1276
  return {
@@ -1313,10 +1291,10 @@ function sendElementSelectionToParent(data) {
1313
1291
  }
1314
1292
 
1315
1293
  // src/components/ElementSelectorProvider.tsx
1316
- var import_jsx_runtime7 = require("react/jsx-runtime");
1294
+ var import_jsx_runtime6 = require("react/jsx-runtime");
1317
1295
  var ElementSelectorProvider = ({ children }) => {
1318
- const [isSelecting, setIsSelecting] = (0, import_react8.useState)(false);
1319
- const handleCancel = (0, import_react8.useCallback)(() => {
1296
+ const [isSelecting, setIsSelecting] = (0, import_react7.useState)(false);
1297
+ const handleCancel = (0, import_react7.useCallback)(() => {
1320
1298
  setIsSelecting(false);
1321
1299
  if (window.parent && window.parent !== window) {
1322
1300
  window.parent.postMessage({
@@ -1324,10 +1302,10 @@ var ElementSelectorProvider = ({ children }) => {
1324
1302
  }, "*");
1325
1303
  }
1326
1304
  }, []);
1327
- const handleSelect = (0, import_react8.useCallback)((data) => {
1305
+ const handleSelect = (0, import_react7.useCallback)((data) => {
1328
1306
  sendElementSelectionToParent(data);
1329
1307
  }, []);
1330
- (0, import_react8.useEffect)(() => {
1308
+ (0, import_react7.useEffect)(() => {
1331
1309
  const handleStartSelection = () => {
1332
1310
  setIsSelecting(true);
1333
1311
  };
@@ -1350,9 +1328,9 @@ var ElementSelectorProvider = ({ children }) => {
1350
1328
  window.removeEventListener("message", handleMessage);
1351
1329
  };
1352
1330
  }, [handleCancel]);
1353
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
1331
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
1354
1332
  children,
1355
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1333
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1356
1334
  ElementSelector,
1357
1335
  {
1358
1336
  active: isSelecting,
@@ -1365,8 +1343,8 @@ var ElementSelectorProvider = ({ children }) => {
1365
1343
 
1366
1344
  // src/components/auth/HowoneProvider.tsx
1367
1345
  init_config();
1368
- var import_jsx_runtime8 = require("react/jsx-runtime");
1369
- var HowoneContext = (0, import_react9.createContext)(null);
1346
+ var import_jsx_runtime7 = require("react/jsx-runtime");
1347
+ var HowoneContext = (0, import_react8.createContext)(null);
1370
1348
  var consumedTokenCache = /* @__PURE__ */ new Set();
1371
1349
  var redirectOverlayStylesInjected = false;
1372
1350
  var injectRedirectOverlayStyles = () => {
@@ -1427,15 +1405,15 @@ var HowOneProvider = ({
1427
1405
  forceDefaultTheme = false,
1428
1406
  redirectOnUnauthenticated = true
1429
1407
  }) => {
1430
- const [user, setUser] = (0, import_react9.useState)(() => parseUserFromToken(getToken()));
1431
- const [token, setTokenState] = (0, import_react9.useState)(() => getToken());
1432
- const [hasCheckedUrlToken, setHasCheckedUrlToken] = (0, import_react9.useState)(false);
1433
- const [pendingRedirect, setPendingRedirect] = (0, import_react9.useState)(false);
1434
- const authCookieRoot = (0, import_react9.useMemo)(() => {
1408
+ const [user, setUser] = (0, import_react8.useState)(() => parseUserFromToken(getToken()));
1409
+ const [token, setTokenState] = (0, import_react8.useState)(() => getToken());
1410
+ const [hasCheckedUrlToken, setHasCheckedUrlToken] = (0, import_react8.useState)(false);
1411
+ const [pendingRedirect, setPendingRedirect] = (0, import_react8.useState)(false);
1412
+ const authCookieRoot = (0, import_react8.useMemo)(() => {
1435
1413
  const env3 = getGlobalEnvironment() ?? "dev";
1436
1414
  return setEnvironment(env3).AUTH_COOKIE_ROOT_VALUE;
1437
1415
  }, []);
1438
- const consumeTokenToCookie = (0, import_react9.useCallback)(async (value2) => {
1416
+ const consumeTokenToCookie = (0, import_react8.useCallback)(async (value2) => {
1439
1417
  if (!value2) return;
1440
1418
  if (consumedTokenCache.has(value2)) return;
1441
1419
  consumedTokenCache.add(value2);
@@ -1462,7 +1440,7 @@ var HowOneProvider = ({
1462
1440
  console.warn("[HowOneProvider] Failed to consume token:", error);
1463
1441
  }
1464
1442
  }, [authCookieRoot]);
1465
- const logoutFromCookie = (0, import_react9.useCallback)(async () => {
1443
+ const logoutFromCookie = (0, import_react8.useCallback)(async () => {
1466
1444
  try {
1467
1445
  await fetch(`${authCookieRoot}/logout`, {
1468
1446
  method: "POST",
@@ -1472,7 +1450,7 @@ var HowOneProvider = ({
1472
1450
  console.warn("[HowOneProvider] Failed to logout from cookie:", error);
1473
1451
  }
1474
1452
  }, [authCookieRoot]);
1475
- const readAccessTokenCookie = (0, import_react9.useCallback)(() => {
1453
+ const readAccessTokenCookie = (0, import_react8.useCallback)(() => {
1476
1454
  if (typeof document === "undefined") return null;
1477
1455
  try {
1478
1456
  const parts = document.cookie.split("; ");
@@ -1488,7 +1466,7 @@ var HowOneProvider = ({
1488
1466
  }
1489
1467
  return null;
1490
1468
  }, []);
1491
- (0, import_react9.useEffect)(() => {
1469
+ (0, import_react8.useEffect)(() => {
1492
1470
  try {
1493
1471
  const params = new URLSearchParams(window.location.search);
1494
1472
  let urlToken = params.get("access_token") || params.get("token");
@@ -1522,7 +1500,7 @@ var HowOneProvider = ({
1522
1500
  setHasCheckedUrlToken(true);
1523
1501
  }
1524
1502
  }, [consumeTokenToCookie, readAccessTokenCookie]);
1525
- const resolvedAuthUrl = (0, import_react9.useMemo)(() => {
1503
+ const resolvedAuthUrl = (0, import_react8.useMemo)(() => {
1526
1504
  const env3 = getGlobalEnvironment() ?? "dev";
1527
1505
  switch (env3) {
1528
1506
  case "local":
@@ -1534,12 +1512,12 @@ var HowOneProvider = ({
1534
1512
  return "https://howone.dev/auth";
1535
1513
  }
1536
1514
  }, []);
1537
- (0, import_react9.useEffect)(() => {
1515
+ (0, import_react8.useEffect)(() => {
1538
1516
  if (pendingRedirect) {
1539
1517
  injectRedirectOverlayStyles();
1540
1518
  }
1541
1519
  }, [pendingRedirect]);
1542
- const redirectToAuth = (0, import_react9.useCallback)(() => {
1520
+ const redirectToAuth = (0, import_react8.useCallback)(() => {
1543
1521
  if (!redirectOnUnauthenticated || typeof window === "undefined") return;
1544
1522
  const activeProjectId = projectId ?? getDefaultProjectId();
1545
1523
  const navigateToResolvedAuth = () => {
@@ -1581,7 +1559,7 @@ var HowOneProvider = ({
1581
1559
  navigateToResolvedAuth();
1582
1560
  }
1583
1561
  }, [redirectOnUnauthenticated, resolvedAuthUrl, projectId]);
1584
- (0, import_react9.useEffect)(() => {
1562
+ (0, import_react8.useEffect)(() => {
1585
1563
  if (!hasCheckedUrlToken) return;
1586
1564
  if (!token && !user) {
1587
1565
  redirectToAuth();
@@ -1604,31 +1582,31 @@ var HowOneProvider = ({
1604
1582
  logout
1605
1583
  };
1606
1584
  if (!hasCheckedUrlToken) return null;
1607
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
1585
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
1608
1586
  ThemeProvider,
1609
1587
  {
1610
1588
  defaultTheme,
1611
1589
  storageKey: themeStorageKey,
1612
1590
  forceDefault: forceDefaultTheme,
1613
1591
  children: [
1614
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ElementSelectorProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(HowoneContext.Provider, { value, children: [
1592
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ElementSelectorProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(HowoneContext.Provider, { value, children: [
1615
1593
  children,
1616
- showHowOneFlag && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(FloatingButton, { onClick: () => window.open("https://howone.ai", "_blank") }),
1617
- pendingRedirect && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1594
+ showHowOneFlag && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(FloatingButton, { onClick: () => window.open("https://howone.ai", "_blank") }),
1595
+ pendingRedirect && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1618
1596
  "div",
1619
1597
  {
1620
1598
  "data-howone-auth-overlay-root": true,
1621
1599
  className: "fixed inset-0 z-[100000] h-full w-full flex flex-col items-center justify-center bg-black/65 backdrop-blur-sm text-white",
1622
- children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "relative mt-6 flex h-[220px] w-[220px] items-center justify-center", children: [
1623
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1600
+ children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "relative mt-6 flex h-[220px] w-[220px] items-center justify-center", children: [
1601
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1624
1602
  "div",
1625
1603
  {
1626
1604
  className: "absolute inset-0 rounded-full bg-white/20",
1627
1605
  style: { animation: "howone-glow-ring 2.4s ease-in-out infinite" }
1628
1606
  }
1629
1607
  ),
1630
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "absolute inset-0 rounded-full bg-gradient-to-br from-white/10 via-white/25 to-white/10 blur-2xl" }),
1631
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1608
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "absolute inset-0 rounded-full bg-gradient-to-br from-white/10 via-white/25 to-white/10 blur-2xl" }),
1609
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1632
1610
  "img",
1633
1611
  {
1634
1612
  style: { width: 250, animation: "howone-logo-pulse 2s ease-in-out infinite" },
@@ -1640,13 +1618,13 @@ var HowOneProvider = ({
1640
1618
  }
1641
1619
  )
1642
1620
  ] }) }),
1643
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(GlobalToastContainer, {})
1621
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(GlobalToastContainer, {})
1644
1622
  ]
1645
1623
  }
1646
1624
  );
1647
1625
  };
1648
1626
  function useHowoneContext() {
1649
- const ctx = (0, import_react9.useContext)(HowoneContext);
1627
+ const ctx = (0, import_react8.useContext)(HowoneContext);
1650
1628
  if (!ctx) {
1651
1629
  const t = getToken();
1652
1630
  return {
@@ -1750,7 +1728,7 @@ var howone = {
1750
1728
  var client_default = howone;
1751
1729
 
1752
1730
  // src/components/ui/Loading.tsx
1753
- var import_jsx_runtime9 = require("react/jsx-runtime");
1731
+ var import_jsx_runtime8 = require("react/jsx-runtime");
1754
1732
  var Loading = ({
1755
1733
  size = "md",
1756
1734
  text = "Loading...",
@@ -1763,14 +1741,14 @@ var Loading = ({
1763
1741
  lg: "h-12 w-12"
1764
1742
  };
1765
1743
  const containerClasses = fullScreen ? "fixed inset-0 flex items-center justify-center bg-white/80 backdrop-blur-sm z-50" : "flex items-center justify-center p-4";
1766
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: `${containerClasses} ${className}`, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "text-center", children: [
1767
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1744
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: `${containerClasses} ${className}`, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "text-center", children: [
1745
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1768
1746
  "div",
1769
1747
  {
1770
1748
  className: `animate-spin rounded-full border-2 border-gray-300 border-t-blue-600 mx-auto ${sizeClasses[size]}`
1771
1749
  }
1772
1750
  ),
1773
- text && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "mt-2 text-sm text-gray-600", children: text })
1751
+ text && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { className: "mt-2 text-sm text-gray-600", children: text })
1774
1752
  ] }) });
1775
1753
  };
1776
1754
  var LoadingSpinner = ({
@@ -1782,7 +1760,7 @@ var LoadingSpinner = ({
1782
1760
  md: "h-8 w-8",
1783
1761
  lg: "h-12 w-12"
1784
1762
  };
1785
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1763
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1786
1764
  "div",
1787
1765
  {
1788
1766
  className: `animate-spin rounded-full border-2 border-gray-300 border-t-blue-600 ${sizeClasses[size]} ${className}`
@@ -1791,9 +1769,9 @@ var LoadingSpinner = ({
1791
1769
  };
1792
1770
 
1793
1771
  // src/components/ui/ErrorBoundary.tsx
1794
- var import_react10 = require("react");
1795
- var import_jsx_runtime10 = require("react/jsx-runtime");
1796
- var ErrorBoundary = class extends import_react10.Component {
1772
+ var import_react9 = require("react");
1773
+ var import_jsx_runtime9 = require("react/jsx-runtime");
1774
+ var ErrorBoundary = class extends import_react9.Component {
1797
1775
  constructor(props) {
1798
1776
  super(props);
1799
1777
  this.handleRetry = () => {
@@ -1815,13 +1793,13 @@ var ErrorBoundary = class extends import_react10.Component {
1815
1793
  if (this.state.hasError) {
1816
1794
  if (this.props.fallback) {
1817
1795
  const FallbackComponent = this.props.fallback;
1818
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(FallbackComponent, { error: this.state.error, retry: this.handleRetry });
1796
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(FallbackComponent, { error: this.state.error, retry: this.handleRetry });
1819
1797
  }
1820
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "min-h-[400px] flex items-center justify-center p-4", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "text-center max-w-md", children: [
1821
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "text-red-500 text-6xl mb-4", children: "\u26A0\uFE0F" }),
1822
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("h2", { className: "text-xl font-semibold text-gray-900 mb-2", children: "Something went wrong" }),
1823
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "text-gray-600 mb-4", children: "An unexpected error occurred. Please try refreshing the page." }),
1824
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1798
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "min-h-[400px] flex items-center justify-center p-4", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "text-center max-w-md", children: [
1799
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "text-red-500 text-6xl mb-4", children: "\u26A0\uFE0F" }),
1800
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("h2", { className: "text-xl font-semibold text-gray-900 mb-2", children: "Something went wrong" }),
1801
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "text-gray-600 mb-4", children: "An unexpected error occurred. Please try refreshing the page." }),
1802
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1825
1803
  "button",
1826
1804
  {
1827
1805
  onClick: this.handleRetry,
@@ -1835,10 +1813,10 @@ var ErrorBoundary = class extends import_react10.Component {
1835
1813
  return this.props.children;
1836
1814
  }
1837
1815
  };
1838
- var DefaultErrorFallback = ({ retry }) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "min-h-[200px] flex items-center justify-center p-4", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "text-center", children: [
1839
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "text-red-500 text-4xl mb-2", children: "\u26A0\uFE0F" }),
1840
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "text-gray-600 mb-2", children: "Something went wrong" }),
1841
- retry && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1816
+ var DefaultErrorFallback = ({ retry }) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "min-h-[200px] flex items-center justify-center p-4", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "text-center", children: [
1817
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "text-red-500 text-4xl mb-2", children: "\u26A0\uFE0F" }),
1818
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "text-gray-600 mb-2", children: "Something went wrong" }),
1819
+ retry && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1842
1820
  "button",
1843
1821
  {
1844
1822
  onClick: retry,
@@ -1849,7 +1827,7 @@ var DefaultErrorFallback = ({ retry }) => /* @__PURE__ */ (0, import_jsx_runtime
1849
1827
  ] }) });
1850
1828
 
1851
1829
  // src/components/ui/ClayxButton.tsx
1852
- var import_jsx_runtime11 = require("react/jsx-runtime");
1830
+ var import_jsx_runtime10 = require("react/jsx-runtime");
1853
1831
  var getSizeClasses = (size, isIconOnly) => {
1854
1832
  if (isIconOnly) {
1855
1833
  switch (size) {
@@ -1905,7 +1883,7 @@ var ClayxButton = ({
1905
1883
  disabled:opacity-50 disabled:cursor-not-allowed disabled:pointer-events-none
1906
1884
  `.replace(/\s+/g, " ").trim();
1907
1885
  const combinedClasses = `${baseClasses} ${sizeClasses} ${variantClasses} ${className}`.trim();
1908
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1886
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1909
1887
  "button",
1910
1888
  {
1911
1889
  className: combinedClasses,
@@ -1917,38 +1895,320 @@ var ClayxButton = ({
1917
1895
  };
1918
1896
 
1919
1897
  // src/components/ui/LimitUpgradeToast.tsx
1898
+ var import_react13 = __toESM(require("react"));
1899
+ var import_react14 = require("@iconify/react");
1900
+
1901
+ // src/components/ui/Toast/ClayxToast.tsx
1920
1902
  var import_react11 = __toESM(require("react"));
1903
+ var import_react_toastify2 = require("react-toastify");
1921
1904
  var import_react12 = require("@iconify/react");
1922
1905
 
1923
- // src/components/ui/Toast/GoeyToast.tsx
1924
- var import_goey_toast2 = require("goey-toast");
1925
- var resolveDuration = (autoClose) => {
1926
- if (typeof autoClose === "number") return autoClose;
1927
- if (autoClose === false) return 24 * 60 * 60 * 1e3;
1928
- return void 0;
1906
+ // src/components/theme/ThemeToggle.tsx
1907
+ var React6 = __toESM(require("react"));
1908
+ var import_react10 = require("@iconify/react");
1909
+ var import_jsx_runtime11 = require("react/jsx-runtime");
1910
+ function ThemeToggle({ className }) {
1911
+ const { setTheme, theme } = useTheme();
1912
+ const [mounted, setMounted] = React6.useState(false);
1913
+ React6.useEffect(() => {
1914
+ setMounted(true);
1915
+ }, []);
1916
+ const handleToggle = () => {
1917
+ if (theme === "dark") {
1918
+ setTheme("light");
1919
+ } else {
1920
+ setTheme("dark");
1921
+ }
1922
+ };
1923
+ if (!mounted) {
1924
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react10.Icon, { icon: "solar:sun-bold", width: 20, height: 20 });
1925
+ }
1926
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1927
+ "div",
1928
+ {
1929
+ className: `cursor-pointer ${className || ""}`,
1930
+ onClick: handleToggle,
1931
+ children: theme === "light" ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react10.Icon, { icon: "solar:sun-bold", width: 20, height: 20 }) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react10.Icon, { icon: "solar:moon-linear", width: 20, height: 20 })
1932
+ }
1933
+ );
1934
+ }
1935
+
1936
+ // src/components/ui/Toast/ClayxToast.tsx
1937
+ var import_jsx_runtime12 = require("react/jsx-runtime");
1938
+ var TOAST_ICONS = {
1939
+ success: {
1940
+ icon: "mdi:success",
1941
+ color: "text-green-400",
1942
+ className: "text-green-400",
1943
+ dark: {
1944
+ bgGradient: "bg-[#14181d]",
1945
+ gradientColor: "#389726",
1946
+ borderGradient: "border-[#389726]",
1947
+ borderGradientColor: "#389726"
1948
+ },
1949
+ light: {
1950
+ bgGradient: "bg-[#fafafa]",
1951
+ gradientColor: "#22c55e",
1952
+ borderGradient: "border-[#22c55e]",
1953
+ borderGradientColor: "#22c55e"
1954
+ }
1955
+ },
1956
+ error: {
1957
+ icon: "ic:outline-close",
1958
+ color: "text-red-400",
1959
+ className: "text-red-400",
1960
+ dark: {
1961
+ bgGradient: "bg-[#14181d]",
1962
+ gradientColor: "#ef4444",
1963
+ borderGradient: "border-[#ef4444]",
1964
+ borderGradientColor: "#ef4444"
1965
+ },
1966
+ light: {
1967
+ bgGradient: "bg-[#fafafa]",
1968
+ gradientColor: "#f87171",
1969
+ borderGradient: "border-[#f87171]",
1970
+ borderGradientColor: "#f87171"
1971
+ }
1972
+ },
1973
+ warning: {
1974
+ icon: "mi:warning",
1975
+ color: "text-yellow-400",
1976
+ className: "text-yellow-400",
1977
+ dark: {
1978
+ bgGradient: "bg-[#14181d]",
1979
+ gradientColor: "#facc15",
1980
+ borderGradient: "border-[#facc15]",
1981
+ borderGradientColor: "#facc15"
1982
+ },
1983
+ light: {
1984
+ bgGradient: "bg-[#fafafa]",
1985
+ gradientColor: "#f59e0b",
1986
+ borderGradient: "border-[#f59e0b]",
1987
+ borderGradientColor: "#f59e0b"
1988
+ }
1989
+ },
1990
+ info: {
1991
+ icon: "ic:outline-info",
1992
+ color: "text-blue-400",
1993
+ className: "text-blue-400",
1994
+ dark: {
1995
+ bgGradient: "bg-[#14181d]",
1996
+ gradientColor: "#60a5fa",
1997
+ borderGradient: "border-[#60a5fa]",
1998
+ borderGradientColor: "#f0f0f0"
1999
+ },
2000
+ light: {
2001
+ bgGradient: "bg-[#fafafa]",
2002
+ gradientColor: "#3b82f6",
2003
+ borderGradient: "border-[#3b82f6]",
2004
+ borderGradientColor: "#3b82f6"
2005
+ }
2006
+ },
2007
+ default: {
2008
+ icon: "ic:round-notifications",
2009
+ color: "text-gray-400",
2010
+ className: "text-gray-400",
2011
+ dark: {
2012
+ bgGradient: "bg-[#14181d]",
2013
+ gradientColor: "#9ca3af",
2014
+ borderGradient: "border-[#9ca3af]",
2015
+ borderGradientColor: "#9ca3af"
2016
+ },
2017
+ light: {
2018
+ bgGradient: "bg-[#fafafa]",
2019
+ gradientColor: "#6b7280",
2020
+ borderGradient: "border-[#6b7280]",
2021
+ borderGradientColor: "#6b7280"
2022
+ }
2023
+ }
2024
+ };
2025
+ var CloseButton = import_react11.default.memo(({ closeToast }) => {
2026
+ const { theme } = useTheme();
2027
+ const handleClick = (0, import_react11.useCallback)((e) => {
2028
+ e.preventDefault();
2029
+ e.stopPropagation();
2030
+ closeToast?.();
2031
+ }, [closeToast]);
2032
+ const getCloseButtonColor = () => {
2033
+ const actualTheme = theme === "system" ? window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light" : theme;
2034
+ return actualTheme === "dark" ? "#b4b4b4" : "#6b7280";
2035
+ };
2036
+ const getCloseButtonHoverColor = () => {
2037
+ const actualTheme = theme === "system" ? window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light" : theme;
2038
+ return actualTheme === "dark" ? "white" : "#374151";
2039
+ };
2040
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2041
+ import_react12.Icon,
2042
+ {
2043
+ icon: "vaadin:close",
2044
+ className: "flex items-center justify-center rounded-full relative z-10 flex-shrink-0 cursor-pointer transition-colors duration-200 drop-shadow-sm",
2045
+ onClick: handleClick,
2046
+ width: 14,
2047
+ height: 14,
2048
+ style: {
2049
+ color: getCloseButtonColor()
2050
+ },
2051
+ onMouseEnter: (e) => {
2052
+ e.currentTarget.style.color = getCloseButtonHoverColor();
2053
+ },
2054
+ onMouseLeave: (e) => {
2055
+ e.currentTarget.style.color = getCloseButtonColor();
2056
+ }
2057
+ }
2058
+ );
2059
+ });
2060
+ CloseButton.displayName = "CloseButton";
2061
+ var ToastContent = ({ type, title, message, component, closeToast }) => {
2062
+ const iconConfig = TOAST_ICONS[type];
2063
+ const { theme } = useTheme();
2064
+ const handleClose = (0, import_react11.useCallback)(() => {
2065
+ closeToast?.();
2066
+ }, [closeToast]);
2067
+ const getTextColor = () => {
2068
+ const actualTheme = theme === "system" ? window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light" : theme;
2069
+ return actualTheme === "dark" ? "white" : "#1f2937";
2070
+ };
2071
+ const getThemeConfig = () => {
2072
+ const actualTheme = theme === "system" ? window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light" : theme;
2073
+ return actualTheme === "dark" ? iconConfig.dark : iconConfig.light;
2074
+ };
2075
+ const themeConfig = getThemeConfig();
2076
+ const lightBaseBackgroundByType = {
2077
+ success: "#f0fdf4",
2078
+ error: "#fef2f2",
2079
+ warning: "#fffbeb",
2080
+ info: "#eff6ff",
2081
+ default: "#f9fafb"
2082
+ };
2083
+ if (component) {
2084
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: `flex items-start gap-3 !min-h-[90px] w-full backdrop-blur-md p-4 shadow-2xl overflow-hidden ${themeConfig.bgGradient}`, children: [
2085
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "flex-1 relative z-10", children: component }),
2086
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "relative z-10", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(CloseButton, { closeToast: handleClose }) })
2087
+ ] });
2088
+ }
2089
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: `flex items-start gap-3 !min-h-[90px] w-full backdrop-blur-md p-4 shadow-2xl relative overflow-hidden ${themeConfig.bgGradient}`, children: [
2090
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2091
+ "div",
2092
+ {
2093
+ className: "absolute left-0 top-0 w-full h-full rounded-xl",
2094
+ style: {
2095
+ background: theme === "dark" || theme === "system" && window.matchMedia("(prefers-color-scheme: dark)").matches ? "#0f1419" : lightBaseBackgroundByType[type],
2096
+ zIndex: -2
2097
+ }
2098
+ }
2099
+ ),
2100
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2101
+ "div",
2102
+ {
2103
+ className: "absolute left-0 top-0 w-full h-full pointer-events-none rounded-xl",
2104
+ style: {
2105
+ background: theme === "dark" || theme === "system" && window.matchMedia("(prefers-color-scheme: dark)").matches ? `linear-gradient(135deg, ${themeConfig.gradientColor}30 0%, ${themeConfig.gradientColor}20 15%, #14181df2 30%)` : `linear-gradient(135deg, ${themeConfig.gradientColor}20 0%, ${themeConfig.gradientColor}12 15%, #ffffff 30%)`,
2106
+ zIndex: -1
2107
+ }
2108
+ }
2109
+ ),
2110
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2111
+ "div",
2112
+ {
2113
+ className: "absolute left-0 top-0 w-full h-full pointer-events-none rounded-xl",
2114
+ style: {
2115
+ border: "2px solid transparent",
2116
+ backgroundImage: theme === "dark" || theme === "system" && window.matchMedia("(prefers-color-scheme: dark)").matches ? `linear-gradient(135deg, ${themeConfig.borderGradientColor}60 0%, ${themeConfig.borderGradientColor}40 5%, transparent 22%)` : `linear-gradient(135deg, ${themeConfig.borderGradientColor}99 0%, ${themeConfig.borderGradientColor}66 5%, transparent 22%)`,
2117
+ backgroundOrigin: "border-box",
2118
+ backgroundClip: "border-box",
2119
+ WebkitMask: "linear-gradient(#ffffff 0 0) padding-box, linear-gradient(#ffffff 0 0)",
2120
+ WebkitMaskComposite: "xor",
2121
+ zIndex: 0
2122
+ }
2123
+ }
2124
+ ),
2125
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "flex-shrink-0 mt-0.5 relative z-10", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: `w-7 h-7 backdrop-blur-sm rounded-full flex items-center justify-center ${theme === "dark" || theme === "system" && window.matchMedia("(prefers-color-scheme: dark)").matches ? "bg-white/10" : "bg-black/5"}`, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2126
+ import_react12.Icon,
2127
+ {
2128
+ icon: iconConfig.icon,
2129
+ width: 16,
2130
+ height: 16,
2131
+ className: iconConfig.color,
2132
+ style: {
2133
+ color: themeConfig.gradientColor
2134
+ }
2135
+ }
2136
+ ) }) }),
2137
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex flex-col gap-1 flex-1 relative z-10", children: [
2138
+ title && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2139
+ "div",
2140
+ {
2141
+ className: "text-[16px] font-semibold leading-tight drop-shadow-sm",
2142
+ style: {
2143
+ color: getTextColor(),
2144
+ backgroundClip: "text"
2145
+ },
2146
+ children: title
2147
+ }
2148
+ ),
2149
+ message && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2150
+ "div",
2151
+ {
2152
+ className: "text-[13px] font-normal leading-relaxed drop-shadow-sm",
2153
+ style: {
2154
+ color: getTextColor(),
2155
+ backgroundClip: "text"
2156
+ },
2157
+ children: message
2158
+ }
2159
+ )
2160
+ ] }),
2161
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "relative z-10", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(CloseButton, { closeToast: handleClose }) })
2162
+ ] });
2163
+ };
2164
+ var defaultToastOptions = {
2165
+ position: "bottom-right",
2166
+ autoClose: 3e3,
2167
+ hideProgressBar: true,
2168
+ closeOnClick: false,
2169
+ pauseOnHover: true,
2170
+ draggable: true,
2171
+ pauseOnFocusLoss: false,
2172
+ transition: import_react_toastify2.Bounce
2173
+ };
2174
+ var getToastifyTheme = () => {
2175
+ if (typeof window !== "undefined") {
2176
+ const root = document.documentElement;
2177
+ if (root.classList.contains("dark")) return "dark";
2178
+ if (root.classList.contains("light")) return "light";
2179
+ return window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
2180
+ }
2181
+ return "light";
1929
2182
  };
1930
2183
  var createToast = (type) => {
1931
2184
  return (params) => {
1932
- const { autoClose, ...rawOptions } = params.options ?? {};
1933
- const id = params.options?.id ?? `goey-${Date.now()}-${Math.random()}`;
1934
- const closeToast = () => import_goey_toast2.goeyToast.dismiss(id);
1935
- const description = params.component ?? (params.render ? params.render(closeToast) : params.message);
1936
- const duration = resolveDuration(autoClose);
1937
- const goeyOptions = {
1938
- ...rawOptions,
1939
- id,
1940
- description,
1941
- ...duration !== void 0 ? { duration } : {}
1942
- };
1943
- const title = params.title ?? "";
1944
- if (type === "default") {
1945
- (0, import_goey_toast2.goeyToast)(title, goeyOptions);
1946
- return;
1947
- }
1948
- import_goey_toast2.goeyToast[type](title, goeyOptions);
2185
+ const { title, message, component, options } = params;
2186
+ (0, import_react_toastify2.toast)(
2187
+ ({ closeToast }) => {
2188
+ if (params.render) return params.render(closeToast ?? (() => {
2189
+ }));
2190
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2191
+ ToastContent,
2192
+ {
2193
+ type,
2194
+ title,
2195
+ message: message || "",
2196
+ component,
2197
+ closeToast
2198
+ }
2199
+ );
2200
+ },
2201
+ {
2202
+ ...defaultToastOptions,
2203
+ ...options,
2204
+ theme: getToastifyTheme(),
2205
+ className: "!p-0 !shadow-none !rounded-xl",
2206
+ style: { padding: 0, borderRadius: "0.75rem" }
2207
+ }
2208
+ );
1949
2209
  };
1950
2210
  };
1951
- var GoeyToast = {
2211
+ var ClayxToast = {
1952
2212
  success: createToast("success"),
1953
2213
  error: createToast("error"),
1954
2214
  warning: createToast("warning"),
@@ -1957,12 +2217,12 @@ var GoeyToast = {
1957
2217
  };
1958
2218
 
1959
2219
  // src/components/ui/LimitUpgradeToast.tsx
1960
- var import_jsx_runtime12 = require("react/jsx-runtime");
2220
+ var import_jsx_runtime13 = require("react/jsx-runtime");
1961
2221
  var LimitToastContainer = ({ message, onUpgrade, closeToast }) => {
1962
- const [hover, setHover] = import_react11.default.useState(false);
1963
- const [closeHover, setCloseHover] = import_react11.default.useState(false);
1964
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "relative w-full max-w-[420px] overflow-hidden rounded-md bg-gradient-to-br from-[#1A1A1A] via-[#151515] to-[#1A1A1A] shadow-[0_20px_60px_rgba(168,85,247,0.2)] backdrop-blur-sm", children: [
1965
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2222
+ const [hover, setHover] = import_react13.default.useState(false);
2223
+ const [closeHover, setCloseHover] = import_react13.default.useState(false);
2224
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "relative w-full max-w-[420px] overflow-hidden rounded-md bg-gradient-to-br from-[#1A1A1A] via-[#151515] to-[#1A1A1A] shadow-[0_20px_60px_rgba(168,85,247,0.2)] backdrop-blur-sm", children: [
2225
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1966
2226
  "div",
1967
2227
  {
1968
2228
  className: "absolute left-0 top-0 w-full h-full rounded-md",
@@ -1972,7 +2232,7 @@ var LimitToastContainer = ({ message, onUpgrade, closeToast }) => {
1972
2232
  }
1973
2233
  }
1974
2234
  ),
1975
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2235
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1976
2236
  "div",
1977
2237
  {
1978
2238
  className: "absolute left-0 top-0 w-full h-full pointer-events-none rounded-md",
@@ -1982,7 +2242,7 @@ var LimitToastContainer = ({ message, onUpgrade, closeToast }) => {
1982
2242
  }
1983
2243
  }
1984
2244
  ),
1985
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2245
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1986
2246
  "div",
1987
2247
  {
1988
2248
  className: "absolute left-0 top-0 w-full h-full pointer-events-none rounded-md",
@@ -1998,15 +2258,15 @@ var LimitToastContainer = ({ message, onUpgrade, closeToast }) => {
1998
2258
  }
1999
2259
  }
2000
2260
  ),
2001
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "absolute -top-16 -right-16 h-32 w-32 rounded-full bg-gradient-to-br from-purple-500/20 via-pink-500/10 to-transparent blur-3xl animate-pulse" }),
2002
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "absolute -bottom-16 -left-16 h-32 w-32 rounded-full bg-gradient-to-tr from-blue-500/10 to-transparent blur-2xl animate-pulse", style: { animationDelay: "1s" } }),
2003
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "relative z-10 flex items-start gap-4 p-4", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex flex-1 flex-col gap-3", children: [
2004
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center justify-between", children: [
2005
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center gap-2", children: [
2006
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "text-lg font-bold text-white", children: "Upgrade Required" }),
2007
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "px-2 py-0.5 text-xs font-bold bg-purple-500/20 text-purple-400 rounded-md border border-purple-500/30", children: "Premium" })
2261
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "absolute -top-16 -right-16 h-32 w-32 rounded-full bg-gradient-to-br from-purple-500/20 via-pink-500/10 to-transparent blur-3xl animate-pulse" }),
2262
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "absolute -bottom-16 -left-16 h-32 w-32 rounded-full bg-gradient-to-tr from-blue-500/10 to-transparent blur-2xl animate-pulse", style: { animationDelay: "1s" } }),
2263
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "relative z-10 flex items-start gap-4 p-4", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex flex-1 flex-col gap-3", children: [
2264
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex items-center justify-between", children: [
2265
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex items-center gap-2", children: [
2266
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "text-lg font-bold text-white", children: "Upgrade Required" }),
2267
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "px-2 py-0.5 text-xs font-bold bg-purple-500/20 text-purple-400 rounded-md border border-purple-500/30", children: "Premium" })
2008
2268
  ] }),
2009
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2269
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2010
2270
  ClayxButton,
2011
2271
  {
2012
2272
  onClick: closeToast,
@@ -2023,12 +2283,12 @@ var LimitToastContainer = ({ message, onUpgrade, closeToast }) => {
2023
2283
  transition: "background-color 150ms ease",
2024
2284
  cursor: "pointer"
2025
2285
  },
2026
- children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react12.Icon, { icon: "iconamoon:close", className: "w-4 h-4 text-gray-400" })
2286
+ children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react14.Icon, { icon: "iconamoon:close", className: "w-4 h-4 text-gray-400" })
2027
2287
  }
2028
2288
  )
2029
2289
  ] }),
2030
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "text-sm text-gray-300 leading-relaxed", children: message }),
2031
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "mt-1 flex items-center gap-3", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2290
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "text-sm text-gray-300 leading-relaxed", children: message }),
2291
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "mt-1 flex items-center gap-3", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2032
2292
  ClayxButton,
2033
2293
  {
2034
2294
  onClick: () => {
@@ -2046,8 +2306,8 @@ var LimitToastContainer = ({ message, onUpgrade, closeToast }) => {
2046
2306
  backgroundImage: hover ? "linear-gradient(to right, #9333ea, #db2777)" : "linear-gradient(to right, #a855f7, #ec4899)",
2047
2307
  boxShadow: hover ? "0 10px 15px -3px rgba(168,85,247,0.3), 0 4px 6px -2px rgba(168,85,247,0.3)" : "none"
2048
2308
  },
2049
- children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { className: "flex items-center gap-2", children: [
2050
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react12.Icon, { icon: "solar:rocket-2-bold", className: "w-4 h-4" }),
2309
+ children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { className: "flex items-center gap-2", children: [
2310
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react14.Icon, { icon: "solar:rocket-2-bold", className: "w-4 h-4" }),
2051
2311
  "Upgrade Now"
2052
2312
  ] })
2053
2313
  }
@@ -2056,8 +2316,8 @@ var LimitToastContainer = ({ message, onUpgrade, closeToast }) => {
2056
2316
  ] });
2057
2317
  };
2058
2318
  function showLimitUpgradeToast(message, onUpgrade) {
2059
- GoeyToast.default({
2060
- render: (closeToast) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(LimitToastContainer, { message, onUpgrade, closeToast }),
2319
+ ClayxToast.default({
2320
+ render: (closeToast) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(LimitToastContainer, { message, onUpgrade, closeToast }),
2061
2321
  options: {
2062
2322
  autoClose: false
2063
2323
  }
@@ -2512,7 +2772,7 @@ async function executeSSEWorkflow(request, options = {}) {
2512
2772
  if (errorData.log_type === "execution_display_error") {
2513
2773
  const errorContent = errorData.content;
2514
2774
  const displayMessage = errorContent || "Workflow execution failed";
2515
- GoeyToast.error({
2775
+ ClayxToast.error({
2516
2776
  title: "Execution Error",
2517
2777
  message: displayMessage
2518
2778
  });
@@ -3618,11 +3878,11 @@ function createClient(opts) {
3618
3878
  }
3619
3879
 
3620
3880
  // src/hooks/use-mobile.ts
3621
- var React8 = __toESM(require("react"));
3881
+ var React9 = __toESM(require("react"));
3622
3882
  var MOBILE_BREAKPOINT = 768;
3623
3883
  function useIsMobile() {
3624
- const [isMobile, setIsMobile] = React8.useState(void 0);
3625
- React8.useEffect(() => {
3884
+ const [isMobile, setIsMobile] = React9.useState(void 0);
3885
+ React9.useEffect(() => {
3626
3886
  const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);
3627
3887
  const onChange = () => {
3628
3888
  setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
@@ -3635,10 +3895,10 @@ function useIsMobile() {
3635
3895
  }
3636
3896
 
3637
3897
  // src/hooks/use-debounce.ts
3638
- var import_react13 = require("react");
3898
+ var import_react15 = require("react");
3639
3899
  function useDebounce(value, delay) {
3640
- const [debouncedValue, setDebouncedValue] = (0, import_react13.useState)(value);
3641
- (0, import_react13.useEffect)(() => {
3900
+ const [debouncedValue, setDebouncedValue] = (0, import_react15.useState)(value);
3901
+ (0, import_react15.useEffect)(() => {
3642
3902
  const handler = setTimeout(() => {
3643
3903
  setDebouncedValue(value);
3644
3904
  }, delay);
@@ -3650,9 +3910,9 @@ function useDebounce(value, delay) {
3650
3910
  }
3651
3911
 
3652
3912
  // src/hooks/use-workflow-stream.ts
3653
- var import_react14 = require("react");
3913
+ var import_react16 = require("react");
3654
3914
  function useWorkflowStream() {
3655
- const [state, setState] = (0, import_react14.useState)({
3915
+ const [state, setState] = (0, import_react16.useState)({
3656
3916
  loading: false,
3657
3917
  progress: 0,
3658
3918
  streamContent: "",
@@ -3660,8 +3920,8 @@ function useWorkflowStream() {
3660
3920
  result: null,
3661
3921
  error: null
3662
3922
  });
3663
- const abortControllerRef = (0, import_react14.useRef)(null);
3664
- const execute = (0, import_react14.useCallback)(async (executeWorkflowStream, workflowId, inputs) => {
3923
+ const abortControllerRef = (0, import_react16.useRef)(null);
3924
+ const execute = (0, import_react16.useCallback)(async (executeWorkflowStream, workflowId, inputs) => {
3665
3925
  setState({
3666
3926
  loading: true,
3667
3927
  progress: 0,
@@ -3714,7 +3974,7 @@ function useWorkflowStream() {
3714
3974
  throw error;
3715
3975
  }
3716
3976
  }, []);
3717
- const cancel = (0, import_react14.useCallback)(() => {
3977
+ const cancel = (0, import_react16.useCallback)(() => {
3718
3978
  if (abortControllerRef.current) {
3719
3979
  abortControllerRef.current.abort();
3720
3980
  setState((prev) => ({
@@ -3724,7 +3984,7 @@ function useWorkflowStream() {
3724
3984
  }));
3725
3985
  }
3726
3986
  }, []);
3727
- const reset = (0, import_react14.useCallback)(() => {
3987
+ const reset = (0, import_react16.useCallback)(() => {
3728
3988
  setState({
3729
3989
  loading: false,
3730
3990
  progress: 0,
@@ -4030,13 +4290,13 @@ var elementSelector = {
4030
4290
  0 && (module.exports = {
4031
4291
  AUTH_TOKEN_KEY,
4032
4292
  ClayxButton,
4293
+ ClayxToast,
4033
4294
  DefaultErrorFallback,
4034
4295
  ElementSelector,
4035
4296
  ElementSelectorProvider,
4036
4297
  ErrorBoundary,
4037
4298
  FloatingButton,
4038
4299
  GlobalToastContainer,
4039
- GoeyToast,
4040
4300
  HowOneProvider,
4041
4301
  Loading,
4042
4302
  LoadingSpinner,