@saas-support/react 0.7.3 → 0.7.6

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/react.js CHANGED
@@ -1,33 +1,33 @@
1
- import { jsx as e, jsxs as t, Fragment as j } from "react/jsx-runtime";
2
- import { createContext as ma, useContext as fa, useState as g, useEffect as V, useRef as _, useCallback as k, useMemo as G } from "react";
3
- import { SaaSSupport as ba, isMfaRequired as xa, BillingClient as ya, Transport as Q, ReportClient as ta } from "./index.js";
4
- import { SaaSError as Ne } from "./index.js";
5
- import { createPortal as va } from "react-dom";
6
- const ra = ma(null);
7
- function A() {
8
- const a = fa(ra);
1
+ import { jsx as e, jsxs as t, Fragment as R } from "react/jsx-runtime";
2
+ import { createContext as fa, useContext as ba, useState as g, useEffect as U, useRef as W, useCallback as k, forwardRef as xa, useImperativeHandle as ya, useMemo as G } from "react";
3
+ import { SaaSSupport as va, isMfaRequired as wa, BillingClient as Na, Transport as Q, ReportClient as ta } from "./index.js";
4
+ import { SaaSError as Ce } from "./index.js";
5
+ import { createPortal as Sa } from "react-dom";
6
+ const na = fa(null);
7
+ function M() {
8
+ const a = ba(na);
9
9
  if (!a)
10
10
  throw new Error("useSaaSContext must be used within a <SaaSProvider>");
11
11
  return a;
12
12
  }
13
- function te({ publishableKey: a, apiKey: s, baseUrl: r, appearance: o, children: n }) {
14
- const [u] = g(() => new ba({ publishableKey: a, apiKey: s, baseUrl: r })), [i, l] = g(null), [d, c] = g(!1), [f, p] = g(null);
15
- return V(() => {
16
- let m = !1;
13
+ function oe({ publishableKey: a, apiKey: r, baseUrl: s, appearance: i, children: n }) {
14
+ const [u] = g(() => new va({ publishableKey: a, apiKey: r, baseUrl: s })), [l, d] = g(null), [c, o] = g(!1), [m, p] = g(null);
15
+ return U(() => {
16
+ let h = !1;
17
17
  u.load().then(async () => {
18
- if (m) return;
19
- const w = await u.auth.getUser(), y = await u.auth.getSettings();
20
- l(w), p(y), c(!0);
18
+ if (h) return;
19
+ const x = await u.auth.getUser(), v = await u.auth.getSettings();
20
+ d(x), p(v), o(!0);
21
21
  });
22
- const b = u.auth.onAuthStateChange((w) => {
23
- m || l(w);
22
+ const y = u.auth.onAuthStateChange((x) => {
23
+ h || d(x);
24
24
  });
25
25
  return () => {
26
- m = !0, b(), u.destroy();
26
+ h = !0, y(), u.destroy();
27
27
  };
28
- }, [u]), /* @__PURE__ */ e(ra.Provider, { value: { client: u, user: i, isLoaded: d, appearance: o, settings: f }, children: n });
28
+ }, [u]), /* @__PURE__ */ e(na.Provider, { value: { client: u, user: l, isLoaded: c, appearance: i, settings: m }, children: n });
29
29
  }
30
- const wa = {
30
+ const $a = {
31
31
  // Legacy (unchanged)
32
32
  colorPrimary: "#6366f1",
33
33
  colorPrimaryHover: "#4f46e5",
@@ -61,7 +61,7 @@ const wa = {
61
61
  authSuccess: "#22c55e",
62
62
  authFontHeadline: "'Manrope', sans-serif",
63
63
  authFontBody: "'Inter', sans-serif"
64
- }, Na = {
64
+ }, ka = {
65
65
  // Legacy (unchanged)
66
66
  colorPrimary: "#818cf8",
67
67
  colorPrimaryHover: "#6366f1",
@@ -97,50 +97,50 @@ const wa = {
97
97
  authFontBody: "'Inter', sans-serif"
98
98
  };
99
99
  function aa(a) {
100
- const s = (a == null ? void 0 : a.baseTheme) === "dark" ? Na : wa, r = a == null ? void 0 : a.variables, o = (r == null ? void 0 : r.colorPrimary) ?? s.authPrimary;
100
+ const r = (a == null ? void 0 : a.baseTheme) === "dark" ? ka : $a, s = a == null ? void 0 : a.variables, i = (s == null ? void 0 : s.colorPrimary) ?? r.authPrimary;
101
101
  return {
102
102
  // Legacy
103
- colorPrimary: (r == null ? void 0 : r.colorPrimary) ?? s.colorPrimary,
104
- colorPrimaryHover: r != null && r.colorPrimary ? Sa(r.colorPrimary, 10) : s.colorPrimaryHover,
105
- colorBackground: (r == null ? void 0 : r.colorBackground) ?? s.colorBackground,
106
- colorText: (r == null ? void 0 : r.colorText) ?? s.colorText,
107
- colorTextSecondary: s.colorTextSecondary,
108
- colorInputBackground: (r == null ? void 0 : r.colorInputBackground) ?? s.colorInputBackground,
109
- colorInputBorder: (r == null ? void 0 : r.colorInputBorder) ?? s.colorInputBorder,
110
- colorError: (r == null ? void 0 : r.colorError) ?? s.colorError,
111
- colorSuccess: (r == null ? void 0 : r.colorSuccess) ?? s.colorSuccess,
112
- colorWarning: (r == null ? void 0 : r.colorWarning) ?? s.colorWarning,
113
- fontFamily: (r == null ? void 0 : r.fontFamily) ?? s.fontFamily,
114
- borderRadius: (r == null ? void 0 : r.borderRadius) ?? s.borderRadius,
103
+ colorPrimary: (s == null ? void 0 : s.colorPrimary) ?? r.colorPrimary,
104
+ colorPrimaryHover: s != null && s.colorPrimary ? Ca(s.colorPrimary, 10) : r.colorPrimaryHover,
105
+ colorBackground: (s == null ? void 0 : s.colorBackground) ?? r.colorBackground,
106
+ colorText: (s == null ? void 0 : s.colorText) ?? r.colorText,
107
+ colorTextSecondary: r.colorTextSecondary,
108
+ colorInputBackground: (s == null ? void 0 : s.colorInputBackground) ?? r.colorInputBackground,
109
+ colorInputBorder: (s == null ? void 0 : s.colorInputBorder) ?? r.colorInputBorder,
110
+ colorError: (s == null ? void 0 : s.colorError) ?? r.colorError,
111
+ colorSuccess: (s == null ? void 0 : s.colorSuccess) ?? r.colorSuccess,
112
+ colorWarning: (s == null ? void 0 : s.colorWarning) ?? r.colorWarning,
113
+ fontFamily: (s == null ? void 0 : s.fontFamily) ?? r.fontFamily,
114
+ borderRadius: (s == null ? void 0 : s.borderRadius) ?? r.borderRadius,
115
115
  // MD3 auth — derive from user overrides where applicable
116
- authPrimary: o,
117
- authPrimaryContainer: r != null && r.colorPrimary ? $a(o, 15) : s.authPrimaryContainer,
118
- authOnPrimary: s.authOnPrimary,
119
- authPrimaryFixed: s.authPrimaryFixed,
120
- authSurface: (r == null ? void 0 : r.colorBackground) ?? s.authSurface,
121
- authSurfaceContainerLowest: s.authSurfaceContainerLowest,
122
- authSurfaceContainerLow: (r == null ? void 0 : r.colorInputBackground) ?? s.authSurfaceContainerLow,
123
- authSurfaceContainer: s.authSurfaceContainer,
124
- authSurfaceContainerHigh: s.authSurfaceContainerHigh,
125
- authSurfaceContainerHighest: s.authSurfaceContainerHighest,
126
- authOnSurface: (r == null ? void 0 : r.colorText) ?? s.authOnSurface,
127
- authOnSurfaceVariant: s.authOnSurfaceVariant,
128
- authOutline: s.authOutline,
129
- authOutlineVariant: (r == null ? void 0 : r.colorInputBorder) ?? s.authOutlineVariant,
130
- authError: (r == null ? void 0 : r.colorError) ?? s.authError,
131
- authErrorContainer: s.authErrorContainer,
132
- authSuccess: (r == null ? void 0 : r.colorSuccess) ?? s.authSuccess,
133
- authFontHeadline: (r == null ? void 0 : r.fontFamily) ?? s.authFontHeadline,
134
- authFontBody: (r == null ? void 0 : r.fontFamily) ?? s.authFontBody
116
+ authPrimary: i,
117
+ authPrimaryContainer: s != null && s.colorPrimary ? za(i, 15) : r.authPrimaryContainer,
118
+ authOnPrimary: r.authOnPrimary,
119
+ authPrimaryFixed: r.authPrimaryFixed,
120
+ authSurface: (s == null ? void 0 : s.colorBackground) ?? r.authSurface,
121
+ authSurfaceContainerLowest: r.authSurfaceContainerLowest,
122
+ authSurfaceContainerLow: (s == null ? void 0 : s.colorInputBackground) ?? r.authSurfaceContainerLow,
123
+ authSurfaceContainer: r.authSurfaceContainer,
124
+ authSurfaceContainerHigh: r.authSurfaceContainerHigh,
125
+ authSurfaceContainerHighest: r.authSurfaceContainerHighest,
126
+ authOnSurface: (s == null ? void 0 : s.colorText) ?? r.authOnSurface,
127
+ authOnSurfaceVariant: r.authOnSurfaceVariant,
128
+ authOutline: r.authOutline,
129
+ authOutlineVariant: (s == null ? void 0 : s.colorInputBorder) ?? r.authOutlineVariant,
130
+ authError: (s == null ? void 0 : s.colorError) ?? r.authError,
131
+ authErrorContainer: r.authErrorContainer,
132
+ authSuccess: (s == null ? void 0 : s.colorSuccess) ?? r.authSuccess,
133
+ authFontHeadline: (s == null ? void 0 : s.fontFamily) ?? r.authFontHeadline,
134
+ authFontBody: (s == null ? void 0 : s.fontFamily) ?? r.authFontBody
135
135
  };
136
136
  }
137
- function Sa(a, s) {
138
- const r = parseInt(a.replace("#", ""), 16), o = Math.max(0, (r >> 16) - Math.round(2.55 * s)), n = Math.max(0, (r >> 8 & 255) - Math.round(2.55 * s)), u = Math.max(0, (r & 255) - Math.round(2.55 * s));
139
- return `#${(o << 16 | n << 8 | u).toString(16).padStart(6, "0")}`;
137
+ function Ca(a, r) {
138
+ const s = parseInt(a.replace("#", ""), 16), i = Math.max(0, (s >> 16) - Math.round(2.55 * r)), n = Math.max(0, (s >> 8 & 255) - Math.round(2.55 * r)), u = Math.max(0, (s & 255) - Math.round(2.55 * r));
139
+ return `#${(i << 16 | n << 8 | u).toString(16).padStart(6, "0")}`;
140
140
  }
141
- function $a(a, s) {
142
- const r = parseInt(a.replace("#", ""), 16), o = Math.min(255, (r >> 16) + Math.round(2.55 * s)), n = Math.min(255, (r >> 8 & 255) + Math.round(2.55 * s)), u = Math.min(255, (r & 255) + Math.round(2.55 * s));
143
- return `#${(o << 16 | n << 8 | u).toString(16).padStart(6, "0")}`;
141
+ function za(a, r) {
142
+ const s = parseInt(a.replace("#", ""), 16), i = Math.min(255, (s >> 16) + Math.round(2.55 * r)), n = Math.min(255, (s >> 8 & 255) + Math.round(2.55 * r)), u = Math.min(255, (s & 255) + Math.round(2.55 * r));
143
+ return `#${(i << 16 | n << 8 | u).toString(16).padStart(6, "0")}`;
144
144
  }
145
145
  function ea(a) {
146
146
  return `
@@ -1451,11 +1451,31 @@ function ea(a) {
1451
1451
  height: 40px;
1452
1452
  border-radius: 50%;
1453
1453
  border: 2px solid ${a.authPrimary};
1454
- overflow: hidden;
1454
+ overflow: visible;
1455
1455
  transition: transform 0.15s, box-shadow 0.15s;
1456
1456
  padding: 0;
1457
1457
  background: none;
1458
1458
  flex-shrink: 0;
1459
+ position: relative;
1460
+ }
1461
+
1462
+ .ss-auth-invite-badge {
1463
+ position: absolute;
1464
+ top: -4px;
1465
+ right: -4px;
1466
+ min-width: 18px;
1467
+ height: 18px;
1468
+ border-radius: 9px;
1469
+ font-size: 10px;
1470
+ font-weight: 700;
1471
+ display: flex;
1472
+ align-items: center;
1473
+ justify-content: center;
1474
+ background: ${a.authError || "#ef4444"};
1475
+ color: #fff;
1476
+ padding: 0 4px;
1477
+ line-height: 1;
1478
+ pointer-events: none;
1459
1479
  }
1460
1480
 
1461
1481
  .ss-auth-avatar-trigger img {
@@ -2501,280 +2521,311 @@ function ea(a) {
2501
2521
  }
2502
2522
  `;
2503
2523
  }
2504
- function H({ children: a, appearance: s }) {
2505
- const r = _(null), [o, n] = g(null);
2506
- V(() => {
2507
- var f;
2508
- if (!r.current || r.current.shadowRoot) {
2509
- n(((f = r.current) == null ? void 0 : f.shadowRoot) ?? null);
2524
+ function j({ children: a, appearance: r }) {
2525
+ const s = W(null), [i, n] = g(null);
2526
+ U(() => {
2527
+ var m;
2528
+ if (!s.current || s.current.shadowRoot) {
2529
+ n(((m = s.current) == null ? void 0 : m.shadowRoot) ?? null);
2510
2530
  return;
2511
2531
  }
2512
- const i = r.current.attachShadow({ mode: "open" });
2513
- if ((s == null ? void 0 : s.fontUrl) !== null) {
2514
- const p = (s == null ? void 0 : s.fontUrl) ?? "https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&family=Inter:wght@400;500;600&family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200&display=swap";
2532
+ const l = s.current.attachShadow({ mode: "open" });
2533
+ if ((r == null ? void 0 : r.fontUrl) !== null) {
2534
+ const p = (r == null ? void 0 : r.fontUrl) ?? "https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&family=Inter:wght@400;500;600&family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200&display=swap";
2515
2535
  if (!document.querySelector(`link[href="${p}"]`)) {
2516
- const b = document.createElement("link");
2517
- b.rel = "stylesheet", b.href = p, document.head.appendChild(b);
2536
+ const y = document.createElement("link");
2537
+ y.rel = "stylesheet", y.href = p, document.head.appendChild(y);
2518
2538
  }
2519
- const m = document.createElement("link");
2520
- m.rel = "stylesheet", m.href = p, i.appendChild(m);
2521
- }
2522
- const l = aa(s), d = document.createElement("style");
2523
- d.textContent = ea(l), i.appendChild(d);
2524
- const c = document.createElement("div");
2525
- i.appendChild(c), n(i);
2526
- }, []), V(() => {
2527
- if (!o) return;
2528
- const i = o.querySelector("style");
2529
- if (i) {
2530
- const l = aa(s);
2531
- i.textContent = ea(l);
2532
- }
2533
- }, [s, o]);
2534
- const u = (o == null ? void 0 : o.querySelector("div")) ?? null;
2535
- return /* @__PURE__ */ e("div", { ref: r, style: { display: "contents" }, children: u && va(a, u) });
2539
+ const h = document.createElement("link");
2540
+ h.rel = "stylesheet", h.href = p, l.appendChild(h);
2541
+ }
2542
+ const d = aa(r), c = document.createElement("style");
2543
+ c.textContent = ea(d), l.appendChild(c);
2544
+ const o = document.createElement("div");
2545
+ l.appendChild(o), n(l);
2546
+ }, []), U(() => {
2547
+ if (!i) return;
2548
+ const l = i.querySelector("style");
2549
+ if (l) {
2550
+ const d = aa(r);
2551
+ l.textContent = ea(d);
2552
+ }
2553
+ }, [r, i]);
2554
+ const u = (i == null ? void 0 : i.querySelector("div")) ?? null;
2555
+ return /* @__PURE__ */ e("div", { ref: s, style: { display: "contents" }, children: u && Sa(a, u) });
2536
2556
  }
2537
2557
  function sa() {
2538
- const { client: a, user: s, isLoaded: r } = A();
2558
+ const { client: a, user: r, isLoaded: s } = M();
2539
2559
  return {
2540
- isLoaded: r,
2541
- isSignedIn: !!s,
2542
- user: s,
2560
+ isLoaded: s,
2561
+ isSignedIn: !!r,
2562
+ user: r,
2543
2563
  signOut: k(() => a.auth.signOut(), [a]),
2544
2564
  getToken: k(() => a.auth.getToken(), [a]),
2545
2565
  refreshUser: k(() => a.auth.refreshUser(), [a])
2546
2566
  };
2547
2567
  }
2548
- function se() {
2549
- const { user: a, isLoaded: s } = A();
2550
- return { user: a, isLoaded: s };
2568
+ function ie() {
2569
+ const { user: a, isLoaded: r } = M();
2570
+ return { user: a, isLoaded: r };
2551
2571
  }
2552
- function na() {
2553
- const { client: a } = A(), [s, r] = g(!1), [o, n] = g(null), u = k(
2554
- async (d, c) => {
2555
- r(!0), n(null);
2572
+ function oa() {
2573
+ const { client: a } = M(), [r, s] = g(!1), [i, n] = g(null), u = k(
2574
+ async (c, o) => {
2575
+ s(!0), n(null);
2556
2576
  try {
2557
- return await a.auth.signIn(d, c);
2558
- } catch (f) {
2559
- return n(f instanceof Error ? f.message : "Sign in failed"), null;
2577
+ return await a.auth.signIn(c, o);
2578
+ } catch (m) {
2579
+ return n(m instanceof Error ? m.message : "Sign in failed"), null;
2560
2580
  } finally {
2561
- r(!1);
2581
+ s(!1);
2562
2582
  }
2563
2583
  },
2564
2584
  [a]
2565
- ), i = k(
2566
- async (d) => {
2567
- r(!0), n(null);
2585
+ ), l = k(
2586
+ async (c) => {
2587
+ s(!0), n(null);
2568
2588
  try {
2569
- return await a.auth.signInWithOAuth(d);
2570
- } catch (c) {
2571
- return n(c instanceof Error ? c.message : "OAuth sign in failed"), null;
2589
+ return await a.auth.signInWithOAuth(c);
2590
+ } catch (o) {
2591
+ return n(o instanceof Error ? o.message : "OAuth sign in failed"), null;
2572
2592
  } finally {
2573
- r(!1);
2593
+ s(!1);
2574
2594
  }
2575
2595
  },
2576
2596
  [a]
2577
- ), l = k(
2578
- async (d, c) => {
2579
- r(!0), n(null);
2597
+ ), d = k(
2598
+ async (c, o) => {
2599
+ s(!0), n(null);
2580
2600
  try {
2581
- return await a.auth.submitMfaCode(d, c);
2582
- } catch (f) {
2583
- return n(f instanceof Error ? f.message : "MFA verification failed"), null;
2601
+ return await a.auth.submitMfaCode(c, o);
2602
+ } catch (m) {
2603
+ return n(m instanceof Error ? m.message : "MFA verification failed"), null;
2584
2604
  } finally {
2585
- r(!1);
2605
+ s(!1);
2586
2606
  }
2587
2607
  },
2588
2608
  [a]
2589
2609
  );
2590
- return { signIn: u, signInWithOAuth: i, submitMfaCode: l, isLoading: s, error: o, setError: n };
2610
+ return { signIn: u, signInWithOAuth: l, submitMfaCode: d, isLoading: r, error: i, setError: n };
2591
2611
  }
2592
- function ka() {
2593
- const { client: a } = A(), [s, r] = g(!1), [o, n] = g(null);
2612
+ function Pa() {
2613
+ const { client: a } = M(), [r, s] = g(!1), [i, n] = g(null);
2594
2614
  return { signUp: k(
2595
- async (i, l) => {
2596
- r(!0), n(null);
2615
+ async (l, d) => {
2616
+ s(!0), n(null);
2597
2617
  try {
2598
- return await a.auth.signUp(i, l);
2599
- } catch (d) {
2600
- return n(d instanceof Error ? d.message : "Sign up failed"), null;
2618
+ return await a.auth.signUp(l, d);
2619
+ } catch (c) {
2620
+ return n(c instanceof Error ? c.message : "Sign up failed"), null;
2601
2621
  } finally {
2602
- r(!1);
2622
+ s(!1);
2603
2623
  }
2604
2624
  },
2605
2625
  [a]
2606
- ), isLoading: s, error: o, setError: n };
2626
+ ), isLoading: r, error: i, setError: n };
2607
2627
  }
2608
2628
  function Y() {
2609
- const { client: a } = A(), [s, r] = g([]), [o, n] = g(null), [u, i] = g([]), [l, d] = g([]), [c, f] = g(!1), [p, m] = g(null), b = k(async () => {
2610
- f(!0), m(null);
2629
+ const { client: a } = M(), [r, s] = g([]), [i, n] = g(null), [u, l] = g([]), [d, c] = g([]), [o, m] = g(!1), [p, h] = g(null), y = W(!1), x = k(async () => {
2630
+ m(!0), h(null);
2611
2631
  try {
2612
- const $ = await a.auth.listOrgs();
2613
- if (r($), !o && $.length > 0) {
2614
- const x = typeof window < "u" ? localStorage.getItem("ss_selected_org") : null, E = (x ? $.find((D) => D.id === x) : null) ?? ($.length === 1 ? $[0] : null);
2615
- if (E) {
2616
- n(E), typeof window < "u" && localStorage.setItem("ss_selected_org", E.id);
2632
+ const b = await a.auth.listOrgs();
2633
+ if (s(b), n((w) => w && (b.find((B) => B.id === w.id) ?? null)), !y.current && b.length > 0) {
2634
+ const w = typeof window < "u" ? localStorage.getItem("ss_selected_org") : null, B = (w ? b.find((F) => F.id === w) : null) ?? (b.length === 1 ? b[0] : null);
2635
+ if (B) {
2636
+ y.current = !0, n(B), typeof window < "u" && localStorage.setItem("ss_selected_org", B.id);
2617
2637
  try {
2618
- const D = await a.auth.listMembers(E.id);
2619
- i(D);
2638
+ const F = await a.auth.listMembers(B.id);
2639
+ l(F);
2620
2640
  } catch {
2621
2641
  }
2622
2642
  }
2623
2643
  }
2624
- } catch ($) {
2625
- m($ instanceof Error ? $.message : "Failed to load organizations");
2644
+ } catch (b) {
2645
+ h(b instanceof Error ? b.message : "Failed to load organizations");
2626
2646
  } finally {
2627
- f(!1);
2647
+ m(!1);
2628
2648
  }
2629
- }, [a, o]);
2630
- V(() => {
2631
- b();
2632
- }, [b]);
2633
- const w = k(async ($) => {
2649
+ }, [a]);
2650
+ U(() => {
2651
+ x();
2652
+ }, [x]);
2653
+ const v = k(async (b) => {
2634
2654
  try {
2635
- const x = await a.auth.getOrg($);
2636
- n(x), typeof window < "u" && localStorage.setItem("ss_selected_org", $);
2637
- const S = await a.auth.listMembers($);
2638
- i(S);
2639
- } catch (x) {
2640
- m(x instanceof Error ? x.message : "Failed to load organization");
2641
- }
2642
- }, [a]), y = k(async ($, x) => {
2655
+ const w = await a.auth.getOrg(b);
2656
+ n(w), typeof window < "u" && localStorage.setItem("ss_selected_org", b);
2657
+ const E = await a.auth.listMembers(b);
2658
+ l(E);
2659
+ } catch (w) {
2660
+ h(w instanceof Error ? w.message : "Failed to load organization");
2661
+ }
2662
+ }, [a]), z = k(async (b, w) => {
2643
2663
  try {
2644
- const S = await a.auth.createOrg($, x);
2645
- return r((E) => [...E, S]), S;
2646
- } catch (S) {
2647
- return m(S instanceof Error ? S.message : "Failed to create organization"), null;
2664
+ const E = await a.auth.createOrg(b, w);
2665
+ return s((B) => [...B, E]), E;
2666
+ } catch (E) {
2667
+ return h(E instanceof Error ? E.message : "Failed to create organization"), null;
2648
2668
  }
2649
- }, [a]), O = k(async ($, x) => {
2669
+ }, [a]), N = k(async (b, w) => {
2650
2670
  try {
2651
- const S = await a.auth.updateOrg($, x);
2652
- return r((E) => E.map((D) => D.id === $ ? S : D)), (o == null ? void 0 : o.id) === $ && n(S), S;
2653
- } catch (S) {
2654
- return m(S instanceof Error ? S.message : "Failed to update organization"), null;
2671
+ const E = await a.auth.updateOrg(b, w);
2672
+ return s((B) => B.map((F) => F.id === b ? E : F)), (i == null ? void 0 : i.id) === b && n(E), E;
2673
+ } catch (E) {
2674
+ return h(E instanceof Error ? E.message : "Failed to update organization"), null;
2655
2675
  }
2656
- }, [a, o]), h = k(async ($) => {
2676
+ }, [a, i]), O = k(async (b) => {
2657
2677
  try {
2658
- return await a.auth.deleteOrg($), r((x) => x.filter((S) => S.id !== $)), (o == null ? void 0 : o.id) === $ && (n(null), i([]), d([]), typeof window < "u" && localStorage.removeItem("ss_selected_org")), !0;
2659
- } catch (x) {
2660
- return m(x instanceof Error ? x.message : "Failed to delete organization"), !1;
2678
+ return await a.auth.deleteOrg(b), s((w) => w.filter((E) => E.id !== b)), (i == null ? void 0 : i.id) === b && (n(null), l([]), c([]), typeof window < "u" && localStorage.removeItem("ss_selected_org")), !0;
2679
+ } catch (w) {
2680
+ return h(w instanceof Error ? w.message : "Failed to delete organization"), !1;
2661
2681
  }
2662
- }, [a, o]), N = k(async ($, x, S) => {
2682
+ }, [a, i]), C = k(async (b, w, E) => {
2663
2683
  try {
2664
- return await a.auth.sendInvite($, x, S);
2665
- } catch (E) {
2666
- return m(E instanceof Error ? E.message : "Failed to send invite"), null;
2684
+ return await a.auth.sendInvite(b, w, E);
2685
+ } catch (B) {
2686
+ return h(B instanceof Error ? B.message : "Failed to send invite"), null;
2667
2687
  }
2668
- }, [a]), C = k(async ($) => {
2688
+ }, [a]), f = k(async (b) => {
2669
2689
  try {
2670
- const x = await a.auth.listInvites($);
2671
- d(x);
2672
- } catch (x) {
2673
- m(x instanceof Error ? x.message : "Failed to load invites");
2690
+ const w = await a.auth.listInvites(b);
2691
+ c(w);
2692
+ } catch (w) {
2693
+ h(w instanceof Error ? w.message : "Failed to load invites");
2674
2694
  }
2675
- }, [a]), P = k(async ($, x) => {
2695
+ }, [a]), P = k(async (b, w) => {
2676
2696
  try {
2677
- return await a.auth.revokeInvite($, x), d((S) => S.filter((E) => E.id !== x)), !0;
2678
- } catch (S) {
2679
- return m(S instanceof Error ? S.message : "Failed to revoke invite"), !1;
2697
+ return await a.auth.revokeInvite(b, w), c((E) => E.filter((B) => B.id !== w)), !0;
2698
+ } catch (E) {
2699
+ return h(E instanceof Error ? E.message : "Failed to revoke invite"), !1;
2680
2700
  }
2681
- }, [a]), I = k(async ($, x, S) => {
2701
+ }, [a]), I = k(async (b, w, E) => {
2682
2702
  try {
2683
- return await a.auth.updateMemberRole($, x, S), i((E) => E.map((D) => D.userId === x ? { ...D, role: S } : D)), !0;
2684
- } catch (E) {
2685
- return m(E instanceof Error ? E.message : "Failed to update member role"), !1;
2703
+ return await a.auth.updateMemberRole(b, w, E), l((B) => B.map((F) => F.userId === w ? { ...F, role: E } : F)), !0;
2704
+ } catch (B) {
2705
+ return h(B instanceof Error ? B.message : "Failed to update member role"), !1;
2686
2706
  }
2687
- }, [a]), B = k(async ($, x) => {
2707
+ }, [a]), L = k(async (b, w) => {
2688
2708
  try {
2689
- return await a.auth.removeMember($, x), i((S) => S.filter((E) => E.userId !== x)), !0;
2690
- } catch (S) {
2691
- return m(S instanceof Error ? S.message : "Failed to remove member"), !1;
2709
+ return await a.auth.removeMember(b, w), l((E) => E.filter((B) => B.userId !== w)), !0;
2710
+ } catch (E) {
2711
+ return h(E instanceof Error ? E.message : "Failed to remove member"), !1;
2692
2712
  }
2693
- }, [a]), F = k(async ($) => {
2713
+ }, [a]), A = k(async (b) => {
2694
2714
  try {
2695
- const x = await a.auth.listMembers($);
2696
- i(x);
2697
- } catch (x) {
2698
- m(x instanceof Error ? x.message : "Failed to load members");
2715
+ const w = await a.auth.listMembers(b);
2716
+ l(w);
2717
+ } catch (w) {
2718
+ h(w instanceof Error ? w.message : "Failed to load members");
2699
2719
  }
2700
2720
  }, [a]);
2701
2721
  return {
2702
- orgs: s,
2703
- selectedOrg: o,
2722
+ orgs: r,
2723
+ selectedOrg: i,
2704
2724
  members: u,
2705
- invites: l,
2706
- isLoading: c,
2725
+ invites: d,
2726
+ isLoading: o,
2707
2727
  error: p,
2708
- setError: m,
2709
- refresh: b,
2710
- selectOrg: w,
2711
- createOrg: y,
2712
- updateOrg: O,
2713
- deleteOrg: h,
2714
- sendInvite: N,
2715
- refreshInvites: C,
2728
+ setError: h,
2729
+ refresh: x,
2730
+ selectOrg: v,
2731
+ createOrg: z,
2732
+ updateOrg: N,
2733
+ deleteOrg: O,
2734
+ sendInvite: C,
2735
+ refreshInvites: f,
2716
2736
  revokeInvite: P,
2717
2737
  updateMemberRole: I,
2718
- removeMember: B,
2719
- refreshMembers: F
2738
+ removeMember: L,
2739
+ refreshMembers: A
2720
2740
  };
2721
2741
  }
2722
- function Ca() {
2723
- const { client: a } = A(), [s, r] = g(!1), [o, n] = g(null);
2742
+ function Oa() {
2743
+ const { client: a } = M(), [r, s] = g(!1), [i, n] = g(null);
2724
2744
  return { deleteAccount: k(async () => {
2725
- r(!0), n(null);
2745
+ s(!0), n(null);
2726
2746
  try {
2727
2747
  return await a.auth.deleteAccount(), !0;
2728
- } catch (i) {
2729
- return n(i instanceof Error ? i.message : "Failed to delete account"), !1;
2748
+ } catch (l) {
2749
+ return n(l instanceof Error ? l.message : "Failed to delete account"), !1;
2730
2750
  } finally {
2731
- r(!1);
2751
+ s(!1);
2732
2752
  }
2733
- }, [a]), isLoading: s, error: o, setError: n };
2753
+ }, [a]), isLoading: r, error: i, setError: n };
2734
2754
  }
2735
- function oa() {
2736
- const { client: a, user: s } = A(), [r, o] = g(!1), [n, u] = g(null), [i, l] = g(null), d = k(
2755
+ function ia() {
2756
+ const { client: a, user: r } = M(), [s, i] = g(!1), [n, u] = g(null), [l, d] = g(null), c = k(
2737
2757
  async (p) => {
2738
- o(!0), u(null), l(null);
2758
+ i(!0), u(null), d(null);
2739
2759
  try {
2740
- const m = await a.auth.updateProfile(p);
2741
- return l("Profile updated"), m;
2742
- } catch (m) {
2743
- return u(m instanceof Error ? m.message : "Failed to update profile"), null;
2760
+ const h = await a.auth.updateProfile(p);
2761
+ return d("Profile updated"), h;
2762
+ } catch (h) {
2763
+ return u(h instanceof Error ? h.message : "Failed to update profile"), null;
2744
2764
  } finally {
2745
- o(!1);
2765
+ i(!1);
2746
2766
  }
2747
2767
  },
2748
2768
  [a]
2749
- ), c = k(
2750
- async (p, m) => {
2751
- o(!0), u(null), l(null);
2769
+ ), o = k(
2770
+ async (p, h) => {
2771
+ i(!0), u(null), d(null);
2752
2772
  try {
2753
- return await a.auth.changePassword(p, m), l("Password changed successfully"), !0;
2754
- } catch (b) {
2755
- return u(b instanceof Error ? b.message : "Failed to change password"), !1;
2773
+ return await a.auth.changePassword(p, h), d("Password changed successfully"), !0;
2774
+ } catch (y) {
2775
+ return u(y instanceof Error ? y.message : "Failed to change password"), !1;
2756
2776
  } finally {
2757
- o(!1);
2777
+ i(!1);
2758
2778
  }
2759
2779
  },
2760
2780
  [a]
2761
- ), f = k(
2781
+ ), m = k(
2762
2782
  async (p) => {
2763
- o(!0), u(null), l(null);
2783
+ i(!0), u(null), d(null);
2764
2784
  try {
2765
- const m = await a.auth.uploadAvatar(p);
2766
- return l("Avatar updated"), m;
2767
- } catch (m) {
2768
- return u(m instanceof Error ? m.message : "Failed to upload avatar"), null;
2785
+ const h = await a.auth.uploadAvatar(p);
2786
+ return d("Avatar updated"), h;
2787
+ } catch (h) {
2788
+ return u(h instanceof Error ? h.message : "Failed to upload avatar"), null;
2769
2789
  } finally {
2770
- o(!1);
2790
+ i(!1);
2771
2791
  }
2772
2792
  },
2773
2793
  [a]
2774
2794
  );
2775
- return { user: s, updateProfile: d, uploadAvatar: f, changePassword: c, isLoading: r, error: n, success: i, setError: u, setSuccess: l };
2795
+ return { user: r, updateProfile: c, uploadAvatar: m, changePassword: o, isLoading: s, error: n, success: l, setError: u, setSuccess: d };
2776
2796
  }
2777
- const ia = '<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92a5.06 5.06 0 0 1-2.2 3.32v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.1z" fill="#4285F4"/><path d="M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z" fill="#34A853"/><path d="M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z" fill="#FBBC05"/><path d="M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z" fill="#EA4335"/></svg>', la = '<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0 0 24 12c0-6.63-5.37-12-12-12z" fill="currentColor"/></svg>', v = {
2797
+ function ra() {
2798
+ const { client: a } = M(), [r, s] = g([]), [i, n] = g(!1), [u, l] = g(null), d = k(async () => {
2799
+ n(!0), l(null);
2800
+ try {
2801
+ const m = await a.auth.listMyInvites();
2802
+ s(m);
2803
+ } catch (m) {
2804
+ l(m instanceof Error ? m.message : "Failed to load invites");
2805
+ } finally {
2806
+ n(!1);
2807
+ }
2808
+ }, [a]);
2809
+ U(() => {
2810
+ d();
2811
+ }, [d]);
2812
+ const c = k(async (m) => {
2813
+ try {
2814
+ const p = await a.auth.acceptInviteById(m);
2815
+ return s((h) => h.filter((y) => y.id !== m)), p;
2816
+ } catch (p) {
2817
+ return l(p instanceof Error ? p.message : "Failed to accept invite"), null;
2818
+ }
2819
+ }, [a]), o = k(async (m) => {
2820
+ try {
2821
+ return await a.auth.declineInvite(m), s((p) => p.filter((h) => h.id !== m)), !0;
2822
+ } catch (p) {
2823
+ return l(p instanceof Error ? p.message : "Failed to decline invite"), !1;
2824
+ }
2825
+ }, [a]);
2826
+ return { invites: r, isLoading: i, error: u, setError: l, refresh: d, accept: c, decline: o };
2827
+ }
2828
+ const la = '<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92a5.06 5.06 0 0 1-2.2 3.32v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.1z" fill="#4285F4"/><path d="M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z" fill="#34A853"/><path d="M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z" fill="#FBBC05"/><path d="M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z" fill="#EA4335"/></svg>', ca = '<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0 0 24 12c0-6.63-5.37-12-12-12z" fill="currentColor"/></svg>', S = {
2778
2829
  close: "close",
2779
2830
  person: "person",
2780
2831
  logout: "logout",
@@ -2798,6 +2849,7 @@ const ia = '<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d=
2798
2849
  token: "token",
2799
2850
  autoAwesome: "auto_awesome",
2800
2851
  corporateFare: "corporate_fare",
2852
+ mail: "mail",
2801
2853
  cloudDone: "cloud_done",
2802
2854
  check: "check",
2803
2855
  image: "image",
@@ -2808,51 +2860,51 @@ const ia = '<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d=
2808
2860
  send: "send",
2809
2861
  personRemove: "person_remove"
2810
2862
  };
2811
- function re({ appearance: a, signUpUrl: s, onSignUp: r }) {
2812
- const { appearance: o, settings: n } = A(), { signIn: u, signInWithOAuth: i, submitMfaCode: l, isLoading: d, error: c, setError: f } = na(), p = a ?? o, [m, b] = g(""), [w, y] = g(""), [O, h] = g(!1), [N, C] = g(!1), [P, I] = g(""), [B, F] = g(["", "", "", "", "", ""]), $ = _([]), x = k(
2813
- async (T) => {
2814
- if (T.preventDefault(), N) {
2815
- await l(P, B.join(""));
2863
+ function le({ appearance: a, signUpUrl: r, onSignUp: s }) {
2864
+ const { appearance: i, settings: n } = M(), { signIn: u, signInWithOAuth: l, submitMfaCode: d, isLoading: c, error: o, setError: m } = oa(), p = a ?? i, [h, y] = g(""), [x, v] = g(""), [z, N] = g(!1), [O, C] = g(!1), [f, P] = g(""), [I, L] = g(["", "", "", "", "", ""]), A = W([]), b = k(
2865
+ async (D) => {
2866
+ if (D.preventDefault(), O) {
2867
+ await d(f, I.join(""));
2816
2868
  return;
2817
2869
  }
2818
- const z = await u(m, w);
2819
- z && xa(z) && (I(z.mfaToken), C(!0), f(null));
2870
+ const $ = await u(h, x);
2871
+ $ && wa($) && (P($.mfaToken), C(!0), m(null));
2820
2872
  },
2821
- [m, w, N, P, B, u, l, f]
2822
- ), S = k(
2823
- async (T) => {
2824
- await i(T);
2873
+ [h, x, O, f, I, u, d, m]
2874
+ ), w = k(
2875
+ async (D) => {
2876
+ await l(D);
2825
2877
  },
2826
- [i]
2827
- ), E = k((T, z) => {
2828
- var W;
2829
- if (!/^\d*$/.test(z)) return;
2830
- const L = z.slice(-1);
2831
- F((K) => {
2878
+ [l]
2879
+ ), E = k((D, $) => {
2880
+ var _;
2881
+ if (!/^\d*$/.test($)) return;
2882
+ const T = $.slice(-1);
2883
+ L((K) => {
2832
2884
  const J = [...K];
2833
- return J[T] = L, J;
2834
- }), L && T < 5 && ((W = $.current[T + 1]) == null || W.focus());
2835
- }, []), D = k((T, z) => {
2836
- var L;
2837
- z.key === "Backspace" && !B[T] && T > 0 && ((L = $.current[T - 1]) == null || L.focus());
2838
- }, [B]), U = (n == null ? void 0 : n.googleEnabled) || (n == null ? void 0 : n.githubEnabled);
2839
- return /* @__PURE__ */ e(H, { appearance: p, children: /* @__PURE__ */ e("div", { className: "ss-auth-card", children: /* @__PURE__ */ t("div", { className: "ss-auth-card-body", children: [
2885
+ return J[D] = T, J;
2886
+ }), T && D < 5 && ((_ = A.current[D + 1]) == null || _.focus());
2887
+ }, []), B = k((D, $) => {
2888
+ var T;
2889
+ $.key === "Backspace" && !I[D] && D > 0 && ((T = A.current[D - 1]) == null || T.focus());
2890
+ }, [I]), F = (n == null ? void 0 : n.googleEnabled) || (n == null ? void 0 : n.githubEnabled);
2891
+ return /* @__PURE__ */ e(j, { appearance: p, children: /* @__PURE__ */ e("div", { className: "ss-auth-card", children: /* @__PURE__ */ t("div", { className: "ss-auth-card-body", children: [
2840
2892
  /* @__PURE__ */ t("div", { className: "ss-auth-header", children: [
2841
- /* @__PURE__ */ e("div", { className: "ss-auth-brand-icon", children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.token }) }),
2893
+ /* @__PURE__ */ e("div", { className: "ss-auth-brand-icon", children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: S.token }) }),
2842
2894
  /* @__PURE__ */ e("h1", { className: "ss-auth-title", children: "Sign in to your account" }),
2843
2895
  /* @__PURE__ */ e("p", { className: "ss-auth-subtitle", children: "Welcome back to your workspace" })
2844
2896
  ] }),
2845
- !N && U && /* @__PURE__ */ t(j, { children: [
2897
+ !O && F && /* @__PURE__ */ t(R, { children: [
2846
2898
  /* @__PURE__ */ t("div", { className: "ss-auth-oauth-grid", children: [
2847
2899
  (n == null ? void 0 : n.googleEnabled) && /* @__PURE__ */ t(
2848
2900
  "button",
2849
2901
  {
2850
2902
  type: "button",
2851
2903
  className: "ss-auth-btn-social",
2852
- onClick: () => S("google"),
2853
- disabled: d,
2904
+ onClick: () => w("google"),
2905
+ disabled: c,
2854
2906
  children: [
2855
- /* @__PURE__ */ e("span", { dangerouslySetInnerHTML: { __html: ia } }),
2907
+ /* @__PURE__ */ e("span", { dangerouslySetInnerHTML: { __html: la } }),
2856
2908
  "Google"
2857
2909
  ]
2858
2910
  }
@@ -2862,10 +2914,10 @@ function re({ appearance: a, signUpUrl: s, onSignUp: r }) {
2862
2914
  {
2863
2915
  type: "button",
2864
2916
  className: "ss-auth-btn-social",
2865
- onClick: () => S("github"),
2866
- disabled: d,
2917
+ onClick: () => w("github"),
2918
+ disabled: c,
2867
2919
  children: [
2868
- /* @__PURE__ */ e("span", { dangerouslySetInnerHTML: { __html: la } }),
2920
+ /* @__PURE__ */ e("span", { dangerouslySetInnerHTML: { __html: ca } }),
2869
2921
  "GitHub"
2870
2922
  ]
2871
2923
  }
@@ -2873,35 +2925,35 @@ function re({ appearance: a, signUpUrl: s, onSignUp: r }) {
2873
2925
  ] }),
2874
2926
  /* @__PURE__ */ e("div", { className: "ss-auth-divider", children: "or continue with" })
2875
2927
  ] }),
2876
- c && /* @__PURE__ */ t("div", { className: "ss-auth-error", children: [
2877
- /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.errorOutline }),
2878
- /* @__PURE__ */ e("span", { children: c })
2928
+ o && /* @__PURE__ */ t("div", { className: "ss-auth-error", children: [
2929
+ /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: S.errorOutline }),
2930
+ /* @__PURE__ */ e("span", { children: o })
2879
2931
  ] }),
2880
- /* @__PURE__ */ t("form", { onSubmit: x, children: [
2881
- N ? /* @__PURE__ */ t(j, { children: [
2932
+ /* @__PURE__ */ t("form", { onSubmit: b, children: [
2933
+ O ? /* @__PURE__ */ t(R, { children: [
2882
2934
  /* @__PURE__ */ e("div", { className: "ss-auth-mfa-divider", children: /* @__PURE__ */ e("span", { children: "Verification Required" }) }),
2883
2935
  /* @__PURE__ */ t("div", { className: "ss-auth-field", children: [
2884
2936
  /* @__PURE__ */ e("label", { className: "ss-auth-label", children: "6-Digit Code" }),
2885
- /* @__PURE__ */ e("div", { className: "ss-auth-mfa-group", children: B.map((T, z) => /* @__PURE__ */ e(
2937
+ /* @__PURE__ */ e("div", { className: "ss-auth-mfa-group", children: I.map((D, $) => /* @__PURE__ */ e(
2886
2938
  "input",
2887
2939
  {
2888
- ref: (L) => {
2889
- $.current[z] = L;
2940
+ ref: (T) => {
2941
+ A.current[$] = T;
2890
2942
  },
2891
2943
  className: "ss-auth-mfa-digit",
2892
2944
  type: "text",
2893
2945
  inputMode: "numeric",
2894
2946
  maxLength: 1,
2895
- value: T,
2896
- onChange: (L) => E(z, L.target.value),
2897
- onKeyDown: (L) => D(z, L),
2898
- autoFocus: z === 0
2947
+ value: D,
2948
+ onChange: (T) => E($, T.target.value),
2949
+ onKeyDown: (T) => B($, T),
2950
+ autoFocus: $ === 0
2899
2951
  },
2900
- z
2952
+ $
2901
2953
  )) }),
2902
2954
  /* @__PURE__ */ e("p", { className: "ss-auth-mfa-hint", children: "We sent a 6-digit code to your registered email." })
2903
2955
  ] })
2904
- ] }) : /* @__PURE__ */ t(j, { children: [
2956
+ ] }) : /* @__PURE__ */ t(R, { children: [
2905
2957
  /* @__PURE__ */ t("div", { className: "ss-auth-field", children: [
2906
2958
  /* @__PURE__ */ e("label", { className: "ss-auth-label", htmlFor: "ss-email", children: "Email Address" }),
2907
2959
  /* @__PURE__ */ e(
@@ -2912,8 +2964,8 @@ function re({ appearance: a, signUpUrl: s, onSignUp: r }) {
2912
2964
  type: "email",
2913
2965
  autoComplete: "email",
2914
2966
  placeholder: "name@company.com",
2915
- value: m,
2916
- onChange: (T) => b(T.target.value),
2967
+ value: h,
2968
+ onChange: (D) => y(D.target.value),
2917
2969
  required: !0
2918
2970
  }
2919
2971
  )
@@ -2929,11 +2981,11 @@ function re({ appearance: a, signUpUrl: s, onSignUp: r }) {
2929
2981
  {
2930
2982
  id: "ss-password",
2931
2983
  className: "ss-auth-input",
2932
- type: O ? "text" : "password",
2984
+ type: z ? "text" : "password",
2933
2985
  autoComplete: "current-password",
2934
2986
  placeholder: "••••••••",
2935
- value: w,
2936
- onChange: (T) => y(T.target.value),
2987
+ value: x,
2988
+ onChange: (D) => v(D.target.value),
2937
2989
  required: !0
2938
2990
  }
2939
2991
  ),
@@ -2942,74 +2994,74 @@ function re({ appearance: a, signUpUrl: s, onSignUp: r }) {
2942
2994
  {
2943
2995
  type: "button",
2944
2996
  className: "ss-auth-visibility-toggle",
2945
- onClick: () => h(!O),
2946
- children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: O ? v.visibilityOff : v.visibility })
2997
+ onClick: () => N(!z),
2998
+ children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: z ? S.visibilityOff : S.visibility })
2947
2999
  }
2948
3000
  )
2949
3001
  ] })
2950
3002
  ] })
2951
3003
  ] }),
2952
- /* @__PURE__ */ t("button", { type: "submit", className: "ss-auth-btn-primary", disabled: d, children: [
2953
- d && /* @__PURE__ */ e("span", { className: "ss-auth-spinner" }),
2954
- N ? "Verify" : "Sign in",
2955
- !d && /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.arrowForward })
3004
+ /* @__PURE__ */ t("button", { type: "submit", className: "ss-auth-btn-primary", disabled: c, children: [
3005
+ c && /* @__PURE__ */ e("span", { className: "ss-auth-spinner" }),
3006
+ O ? "Verify" : "Sign in",
3007
+ !c && /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: S.arrowForward })
2956
3008
  ] })
2957
3009
  ] }),
2958
- N ? /* @__PURE__ */ e("div", { className: "ss-auth-footer", children: /* @__PURE__ */ e(
3010
+ O ? /* @__PURE__ */ e("div", { className: "ss-auth-footer", children: /* @__PURE__ */ e(
2959
3011
  "span",
2960
3012
  {
2961
3013
  className: "ss-auth-link",
2962
3014
  onClick: () => {
2963
- C(!1), F(["", "", "", "", "", ""]), f(null);
3015
+ C(!1), L(["", "", "", "", "", ""]), m(null);
2964
3016
  },
2965
3017
  children: "Back to sign in"
2966
3018
  }
2967
3019
  ) }) : /* @__PURE__ */ t("div", { className: "ss-auth-footer", children: [
2968
3020
  "Don't have an account?",
2969
3021
  " ",
2970
- r ? /* @__PURE__ */ e("span", { className: "ss-auth-link", onClick: r, children: "Sign up" }) : s ? /* @__PURE__ */ e("a", { className: "ss-auth-link", href: s, children: "Sign up" }) : /* @__PURE__ */ e("span", { className: "ss-auth-link", children: "Sign up" })
3022
+ s ? /* @__PURE__ */ e("span", { className: "ss-auth-link", onClick: s, children: "Sign up" }) : r ? /* @__PURE__ */ e("a", { className: "ss-auth-link", href: r, children: "Sign up" }) : /* @__PURE__ */ e("span", { className: "ss-auth-link", children: "Sign up" })
2971
3023
  ] })
2972
3024
  ] }) }) });
2973
3025
  }
2974
- function ne({ appearance: a, signInUrl: s, onSignIn: r }) {
2975
- const { appearance: o, settings: n } = A(), { signUp: u, isLoading: i, error: l, setError: d } = ka(), { signInWithOAuth: c } = na(), f = a ?? o, [p, m] = g(""), [b, w] = g(""), [y, O] = g(""), [h, N] = g(!1), [C, P] = g(null), I = k(
2976
- async (x) => {
2977
- if (x.preventDefault(), P(null), b !== y) {
2978
- P("Passwords do not match");
3026
+ function ce({ appearance: a, signInUrl: r, onSignIn: s }) {
3027
+ const { appearance: i, settings: n } = M(), { signUp: u, isLoading: l, error: d, setError: c } = Pa(), { signInWithOAuth: o } = oa(), m = a ?? i, [p, h] = g(""), [y, x] = g(""), [v, z] = g(""), [N, O] = g(!1), [C, f] = g(null), P = k(
3028
+ async (b) => {
3029
+ if (b.preventDefault(), f(null), y !== v) {
3030
+ f("Passwords do not match");
2979
3031
  return;
2980
3032
  }
2981
- const S = (n == null ? void 0 : n.passwordMinLength) ?? 8;
2982
- if (b.length < S) {
2983
- P(`Password must be at least ${S} characters`);
3033
+ const w = (n == null ? void 0 : n.passwordMinLength) ?? 8;
3034
+ if (y.length < w) {
3035
+ f(`Password must be at least ${w} characters`);
2984
3036
  return;
2985
3037
  }
2986
- await u(p, b);
3038
+ await u(p, y);
2987
3039
  },
2988
- [p, b, y, n, u]
2989
- ), B = k(
2990
- async (x) => {
2991
- await c(x);
3040
+ [p, y, v, n, u]
3041
+ ), I = k(
3042
+ async (b) => {
3043
+ await o(b);
2992
3044
  },
2993
- [c]
2994
- ), F = (n == null ? void 0 : n.googleEnabled) || (n == null ? void 0 : n.githubEnabled), $ = C || l;
2995
- return /* @__PURE__ */ e(H, { appearance: f, children: /* @__PURE__ */ t("div", { style: { display: "flex", flexDirection: "column", alignItems: "center", width: "100%", maxWidth: "520px" }, children: [
3045
+ [o]
3046
+ ), L = (n == null ? void 0 : n.googleEnabled) || (n == null ? void 0 : n.githubEnabled), A = C || d;
3047
+ return /* @__PURE__ */ e(j, { appearance: m, children: /* @__PURE__ */ t("div", { style: { display: "flex", flexDirection: "column", alignItems: "center", width: "100%", maxWidth: "520px" }, children: [
2996
3048
  /* @__PURE__ */ t("div", { className: "ss-auth-header", children: [
2997
- /* @__PURE__ */ e("div", { className: "ss-auth-brand-icon-gradient", children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.autoAwesome }) }),
3049
+ /* @__PURE__ */ e("div", { className: "ss-auth-brand-icon-gradient", children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: S.autoAwesome }) }),
2998
3050
  /* @__PURE__ */ e("h1", { className: "ss-auth-title ss-auth-title-lg", children: "Create your account" }),
2999
3051
  /* @__PURE__ */ e("p", { className: "ss-auth-subtitle", children: "Join the ecosystem" })
3000
3052
  ] }),
3001
3053
  /* @__PURE__ */ e("div", { className: "ss-auth-card", children: /* @__PURE__ */ t("div", { className: "ss-auth-card-body", children: [
3002
- F && /* @__PURE__ */ t(j, { children: [
3054
+ L && /* @__PURE__ */ t(R, { children: [
3003
3055
  /* @__PURE__ */ t("div", { className: "ss-auth-oauth-grid", children: [
3004
3056
  (n == null ? void 0 : n.googleEnabled) && /* @__PURE__ */ t(
3005
3057
  "button",
3006
3058
  {
3007
3059
  type: "button",
3008
3060
  className: "ss-auth-btn-social",
3009
- onClick: () => B("google"),
3010
- disabled: i,
3061
+ onClick: () => I("google"),
3062
+ disabled: l,
3011
3063
  children: [
3012
- /* @__PURE__ */ e("span", { dangerouslySetInnerHTML: { __html: ia } }),
3064
+ /* @__PURE__ */ e("span", { dangerouslySetInnerHTML: { __html: la } }),
3013
3065
  "Google"
3014
3066
  ]
3015
3067
  }
@@ -3019,10 +3071,10 @@ function ne({ appearance: a, signInUrl: s, onSignIn: r }) {
3019
3071
  {
3020
3072
  type: "button",
3021
3073
  className: "ss-auth-btn-social",
3022
- onClick: () => B("github"),
3023
- disabled: i,
3074
+ onClick: () => I("github"),
3075
+ disabled: l,
3024
3076
  children: [
3025
- /* @__PURE__ */ e("span", { dangerouslySetInnerHTML: { __html: la } }),
3077
+ /* @__PURE__ */ e("span", { dangerouslySetInnerHTML: { __html: ca } }),
3026
3078
  "GitHub"
3027
3079
  ]
3028
3080
  }
@@ -3030,11 +3082,11 @@ function ne({ appearance: a, signInUrl: s, onSignIn: r }) {
3030
3082
  ] }),
3031
3083
  /* @__PURE__ */ e("div", { className: "ss-auth-divider", children: "or sign up with email" })
3032
3084
  ] }),
3033
- $ && /* @__PURE__ */ t("div", { className: "ss-auth-error", children: [
3034
- /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.errorOutline }),
3035
- /* @__PURE__ */ e("span", { children: $ })
3085
+ A && /* @__PURE__ */ t("div", { className: "ss-auth-error", children: [
3086
+ /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: S.errorOutline }),
3087
+ /* @__PURE__ */ e("span", { children: A })
3036
3088
  ] }),
3037
- /* @__PURE__ */ t("form", { onSubmit: I, children: [
3089
+ /* @__PURE__ */ t("form", { onSubmit: P, children: [
3038
3090
  /* @__PURE__ */ t("div", { className: "ss-auth-field", children: [
3039
3091
  /* @__PURE__ */ e("label", { className: "ss-auth-label", htmlFor: "ss-signup-email", children: "Email" }),
3040
3092
  /* @__PURE__ */ e(
@@ -3046,7 +3098,7 @@ function ne({ appearance: a, signInUrl: s, onSignIn: r }) {
3046
3098
  autoComplete: "email",
3047
3099
  placeholder: "name@company.com",
3048
3100
  value: p,
3049
- onChange: (x) => m(x.target.value),
3101
+ onChange: (b) => h(b.target.value),
3050
3102
  required: !0
3051
3103
  }
3052
3104
  )
@@ -3059,12 +3111,12 @@ function ne({ appearance: a, signInUrl: s, onSignIn: r }) {
3059
3111
  {
3060
3112
  id: "ss-signup-password",
3061
3113
  className: "ss-auth-input",
3062
- type: h ? "text" : "password",
3114
+ type: N ? "text" : "password",
3063
3115
  autoComplete: "new-password",
3064
3116
  placeholder: "••••••••",
3065
- value: b,
3066
- onChange: (x) => {
3067
- w(x.target.value), P(null);
3117
+ value: y,
3118
+ onChange: (b) => {
3119
+ x(b.target.value), f(null);
3068
3120
  },
3069
3121
  required: !0
3070
3122
  }
@@ -3074,8 +3126,8 @@ function ne({ appearance: a, signInUrl: s, onSignIn: r }) {
3074
3126
  {
3075
3127
  type: "button",
3076
3128
  className: "ss-auth-visibility-toggle",
3077
- onClick: () => N(!h),
3078
- children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: h ? v.visibilityOff : v.visibility })
3129
+ onClick: () => O(!N),
3130
+ children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: N ? S.visibilityOff : S.visibility })
3079
3131
  }
3080
3132
  )
3081
3133
  ] })
@@ -3090,87 +3142,86 @@ function ne({ appearance: a, signInUrl: s, onSignIn: r }) {
3090
3142
  type: "password",
3091
3143
  autoComplete: "new-password",
3092
3144
  placeholder: "••••••••",
3093
- value: y,
3094
- onChange: (x) => {
3095
- O(x.target.value), P(null);
3145
+ value: v,
3146
+ onChange: (b) => {
3147
+ z(b.target.value), f(null);
3096
3148
  },
3097
3149
  required: !0
3098
3150
  }
3099
3151
  )
3100
3152
  ] }),
3101
- /* @__PURE__ */ t("button", { type: "submit", className: "ss-auth-btn-primary", disabled: i, children: [
3102
- i && /* @__PURE__ */ e("span", { className: "ss-auth-spinner" }),
3153
+ /* @__PURE__ */ t("button", { type: "submit", className: "ss-auth-btn-primary", disabled: l, children: [
3154
+ l && /* @__PURE__ */ e("span", { className: "ss-auth-spinner" }),
3103
3155
  "Sign up",
3104
- !i && /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.arrowForward })
3156
+ !l && /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: S.arrowForward })
3105
3157
  ] })
3106
3158
  ] }),
3107
3159
  /* @__PURE__ */ t("div", { className: "ss-auth-footer", children: [
3108
3160
  "Already have an account?",
3109
3161
  " ",
3110
- r ? /* @__PURE__ */ e("span", { className: "ss-auth-link", onClick: r, children: "Sign in" }) : s ? /* @__PURE__ */ e("a", { className: "ss-auth-link", href: s, children: "Sign in" }) : /* @__PURE__ */ e("span", { className: "ss-auth-link", children: "Sign in" })
3162
+ s ? /* @__PURE__ */ e("span", { className: "ss-auth-link", onClick: s, children: "Sign in" }) : r ? /* @__PURE__ */ e("a", { className: "ss-auth-link", href: r, children: "Sign in" }) : /* @__PURE__ */ e("span", { className: "ss-auth-link", children: "Sign in" })
3111
3163
  ] })
3112
3164
  ] }) })
3113
3165
  ] }) });
3114
3166
  }
3115
- const M = 320, q = 128;
3116
- function za({ file: a, onCrop: s, onCancel: r }) {
3117
- const o = _(null), n = _(null), [u, i] = g(1), [l, d] = g({ x: 0, y: 0 }), [c, f] = g(!1), p = _({ x: 0, y: 0, ox: 0, oy: 0 }), [m, b] = g(!1);
3118
- V(() => {
3119
- const h = new Image(), N = URL.createObjectURL(a);
3120
- return h.onload = () => {
3121
- n.current = h, b(!0), d({ x: 0, y: 0 }), i(1);
3122
- }, h.src = N, () => URL.revokeObjectURL(N);
3123
- }, [a]), V(() => {
3124
- if (!m || !n.current || !o.current) return;
3125
- const h = o.current.getContext("2d");
3126
- if (!h) return;
3127
- const N = n.current;
3128
- h.clearRect(0, 0, M, M), h.fillStyle = "#111", h.fillRect(0, 0, M, M);
3129
- const C = Math.max(M / N.width, M / N.height) * u, P = N.width * C, I = N.height * C, B = (M - P) / 2 + l.x, F = (M - I) / 2 + l.y;
3130
- h.save(), h.beginPath(), h.arc(M / 2, M / 2, q, 0, Math.PI * 2), h.clip(), h.drawImage(N, B, F, P, I), h.restore(), h.save(), h.fillStyle = "rgba(0, 0, 0, 0.6)", h.fillRect(0, 0, M, M), h.globalCompositeOperation = "destination-out", h.beginPath(), h.arc(M / 2, M / 2, q, 0, Math.PI * 2), h.fill(), h.restore(), h.save(), h.beginPath(), h.arc(M / 2, M / 2, q, 0, Math.PI * 2), h.clip(), h.drawImage(N, B, F, P, I), h.restore(), h.strokeStyle = "rgba(255, 255, 255, 0.4)", h.lineWidth = 2, h.beginPath(), h.arc(M / 2, M / 2, q, 0, Math.PI * 2), h.stroke();
3131
- }, [u, l, m]);
3132
- const w = k(
3133
- (h) => {
3134
- f(!0), p.current = { x: h.clientX, y: h.clientY, ox: l.x, oy: l.y }, h.target.setPointerCapture(h.pointerId);
3167
+ const V = 320, q = 128, Ea = xa(function({ file: r, onCrop: s, onCancel: i }, n) {
3168
+ const u = W(null), l = W(null), [d, c] = g(1), [o, m] = g({ x: 0, y: 0 }), [p, h] = g(!1), y = W({ x: 0, y: 0, ox: 0, oy: 0 }), [x, v] = g(!1);
3169
+ U(() => {
3170
+ const f = new Image(), P = URL.createObjectURL(r);
3171
+ return f.onload = () => {
3172
+ l.current = f, v(!0), m({ x: 0, y: 0 }), c(1);
3173
+ }, f.src = P, () => URL.revokeObjectURL(P);
3174
+ }, [r]), U(() => {
3175
+ if (!x || !l.current || !u.current) return;
3176
+ const f = u.current.getContext("2d");
3177
+ if (!f) return;
3178
+ const P = l.current;
3179
+ f.clearRect(0, 0, V, V), f.fillStyle = "#111", f.fillRect(0, 0, V, V);
3180
+ const I = Math.max(V / P.width, V / P.height) * d, L = P.width * I, A = P.height * I, b = (V - L) / 2 + o.x, w = (V - A) / 2 + o.y;
3181
+ f.save(), f.beginPath(), f.arc(V / 2, V / 2, q, 0, Math.PI * 2), f.clip(), f.drawImage(P, b, w, L, A), f.restore(), f.save(), f.fillStyle = "rgba(0, 0, 0, 0.6)", f.fillRect(0, 0, V, V), f.globalCompositeOperation = "destination-out", f.beginPath(), f.arc(V / 2, V / 2, q, 0, Math.PI * 2), f.fill(), f.restore(), f.save(), f.beginPath(), f.arc(V / 2, V / 2, q, 0, Math.PI * 2), f.clip(), f.drawImage(P, b, w, L, A), f.restore(), f.strokeStyle = "rgba(255, 255, 255, 0.4)", f.lineWidth = 2, f.beginPath(), f.arc(V / 2, V / 2, q, 0, Math.PI * 2), f.stroke();
3182
+ }, [d, o, x]);
3183
+ const z = k(
3184
+ (f) => {
3185
+ h(!0), y.current = { x: f.clientX, y: f.clientY, ox: o.x, oy: o.y }, f.target.setPointerCapture(f.pointerId);
3135
3186
  },
3136
- [l]
3137
- ), y = k(
3138
- (h) => {
3139
- c && d({
3140
- x: p.current.ox + (h.clientX - p.current.x),
3141
- y: p.current.oy + (h.clientY - p.current.y)
3187
+ [o]
3188
+ ), N = k(
3189
+ (f) => {
3190
+ p && m({
3191
+ x: y.current.ox + (f.clientX - y.current.x),
3192
+ y: y.current.oy + (f.clientY - y.current.y)
3142
3193
  });
3143
3194
  },
3144
- [c]
3145
- ), O = k(() => f(!1), []);
3146
- return k(() => {
3147
- if (!n.current) return;
3148
- const h = document.createElement("canvas"), N = q * 2;
3149
- h.width = N, h.height = N;
3150
- const C = h.getContext("2d");
3151
- if (!C) return;
3152
- const P = n.current, I = Math.max(M / P.width, M / P.height) * u, B = P.width * I, F = P.height * I, $ = (M - B) / 2 + l.x - (M / 2 - q), x = (M - F) / 2 + l.y - (M / 2 - q);
3153
- C.beginPath(), C.arc(q, q, q, 0, Math.PI * 2), C.clip(), C.drawImage(P, $, x, B, F), h.toBlob((S) => {
3154
- S && s(S);
3195
+ [p]
3196
+ ), O = k(() => h(!1), []), C = k(() => {
3197
+ if (!l.current) return;
3198
+ const f = document.createElement("canvas"), P = q * 2;
3199
+ f.width = P, f.height = P;
3200
+ const I = f.getContext("2d");
3201
+ if (!I) return;
3202
+ const L = l.current, A = Math.max(V / L.width, V / L.height) * d, b = L.width * A, w = L.height * A, E = (V - b) / 2 + o.x - (V / 2 - q), B = (V - w) / 2 + o.y - (V / 2 - q);
3203
+ I.beginPath(), I.arc(q, q, q, 0, Math.PI * 2), I.clip(), I.drawImage(L, E, B, b, w), f.toBlob((F) => {
3204
+ F && s(F);
3155
3205
  }, "image/png");
3156
- }, [u, l, s]), /* @__PURE__ */ t("div", { style: { display: "flex", flexDirection: "column", alignItems: "center", gap: "24px" }, children: [
3206
+ }, [d, o, s]);
3207
+ return ya(n, () => ({ triggerCrop: () => C() }), [C]), /* @__PURE__ */ t("div", { style: { display: "flex", flexDirection: "column", alignItems: "center", gap: "24px" }, children: [
3157
3208
  /* @__PURE__ */ t("div", { className: "ss-auth-crop-area", children: [
3158
3209
  /* @__PURE__ */ e(
3159
3210
  "canvas",
3160
3211
  {
3161
- ref: o,
3162
- width: M,
3163
- height: M,
3164
- style: { cursor: c ? "grabbing" : "grab", width: "100%", height: "100%" },
3165
- onPointerDown: w,
3166
- onPointerMove: y,
3212
+ ref: u,
3213
+ width: V,
3214
+ height: V,
3215
+ style: { cursor: p ? "grabbing" : "grab", width: "100%", height: "100%" },
3216
+ onPointerDown: z,
3217
+ onPointerMove: N,
3167
3218
  onPointerUp: O
3168
3219
  }
3169
3220
  ),
3170
3221
  /* @__PURE__ */ e("div", { className: "ss-auth-crop-size-badge", children: "256 x 256 px" })
3171
3222
  ] }),
3172
3223
  /* @__PURE__ */ t("div", { className: "ss-auth-zoom-control", style: { width: "100%", maxWidth: "280px" }, children: [
3173
- /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.zoomOut }),
3224
+ /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: S.zoomOut }),
3174
3225
  /* @__PURE__ */ e(
3175
3226
  "input",
3176
3227
  {
@@ -3178,211 +3229,211 @@ function za({ file: a, onCrop: s, onCancel: r }) {
3178
3229
  min: "1",
3179
3230
  max: "3",
3180
3231
  step: "0.01",
3181
- value: u,
3182
- onChange: (h) => i(parseFloat(h.target.value)),
3232
+ value: d,
3233
+ onChange: (f) => c(parseFloat(f.target.value)),
3183
3234
  className: "ss-auth-zoom-slider"
3184
3235
  }
3185
3236
  ),
3186
- /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.zoomIn })
3237
+ /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: S.zoomIn })
3187
3238
  ] })
3188
3239
  ] });
3189
- }
3190
- function ca({ onUpload: a, onClose: s, isLoading: r }) {
3191
- const [o, n] = g(null), [u, i] = g(!1), [l, d] = g(null), c = _(null), f = k((b) => {
3192
- if (!b.type.startsWith("image/")) {
3193
- d("Please select an image file");
3240
+ });
3241
+ function da({ onUpload: a, onClose: r, isLoading: s }) {
3242
+ const [i, n] = g(null), [u, l] = g(!1), [d, c] = g(null), o = W(null), m = W(null), p = k((x) => {
3243
+ if (!x.type.startsWith("image/")) {
3244
+ c("Please select an image file");
3194
3245
  return;
3195
3246
  }
3196
- if (b.size > 5 * 1024 * 1024) {
3197
- d("Image must be smaller than 5 MB");
3247
+ if (x.size > 5 * 1024 * 1024) {
3248
+ c("Image must be smaller than 5 MB");
3198
3249
  return;
3199
3250
  }
3200
- d(null), n(b);
3201
- }, []), p = k(
3202
- (b) => {
3203
- b.preventDefault(), i(!1);
3204
- const w = b.dataTransfer.files[0];
3205
- w && f(w);
3251
+ c(null), n(x);
3252
+ }, []), h = k(
3253
+ (x) => {
3254
+ x.preventDefault(), l(!1);
3255
+ const v = x.dataTransfer.files[0];
3256
+ v && p(v);
3206
3257
  },
3207
- [f]
3208
- ), m = k(
3209
- async (b) => {
3210
- await a(b);
3258
+ [p]
3259
+ ), y = k(
3260
+ async (x) => {
3261
+ await a(x);
3211
3262
  },
3212
3263
  [a]
3213
3264
  );
3214
- return /* @__PURE__ */ e("div", { className: "ss-auth-modal-overlay", onClick: (b) => {
3215
- b.target === b.currentTarget && s();
3216
- }, children: /* @__PURE__ */ t("div", { className: "ss-auth-modal ss-auth-card-wide", children: [
3265
+ return /* @__PURE__ */ e("div", { className: "ss-auth-modal-overlay", onClick: (x) => {
3266
+ x.target === x.currentTarget && r();
3267
+ }, children: /* @__PURE__ */ t("div", { className: "ss-auth-modal", style: { maxWidth: "480px" }, children: [
3217
3268
  /* @__PURE__ */ t("div", { className: "ss-auth-modal-header", children: [
3218
3269
  /* @__PURE__ */ e("h2", { children: "Upload avatar" }),
3219
- /* @__PURE__ */ e("button", { type: "button", className: "ss-auth-modal-close", onClick: s, children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.close }) })
3270
+ /* @__PURE__ */ e("button", { type: "button", className: "ss-auth-modal-close", onClick: r, children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: S.close }) })
3220
3271
  ] }),
3221
3272
  /* @__PURE__ */ t("div", { className: "ss-auth-modal-body", children: [
3222
- l && /* @__PURE__ */ t("div", { className: "ss-auth-error", style: { marginBottom: "24px" }, children: [
3223
- /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.errorOutline }),
3224
- /* @__PURE__ */ e("span", { children: l })
3273
+ d && /* @__PURE__ */ t("div", { className: "ss-auth-error", style: { marginBottom: "16px" }, children: [
3274
+ /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: S.errorOutline }),
3275
+ /* @__PURE__ */ e("span", { children: d })
3225
3276
  ] }),
3226
- /* @__PURE__ */ t("div", { className: "ss-auth-upload-grid", children: [
3227
- /* @__PURE__ */ e("div", { children: o ? /* @__PURE__ */ e(za, { file: o, onCrop: m, onCancel: () => n(null) }) : /* @__PURE__ */ t(
3228
- "div",
3277
+ i ? /* @__PURE__ */ t(R, { children: [
3278
+ /* @__PURE__ */ e(Ea, { ref: m, file: i, onCrop: y, onCancel: () => n(null) }),
3279
+ /* @__PURE__ */ e("div", { style: { textAlign: "center", marginTop: "8px" }, children: /* @__PURE__ */ t(
3280
+ "button",
3229
3281
  {
3230
- className: "ss-auth-crop-area",
3231
- style: {
3232
- display: "flex",
3233
- flexDirection: "column",
3234
- alignItems: "center",
3235
- justifyContent: "center",
3236
- gap: "8px",
3237
- width: "100%",
3238
- aspectRatio: "1"
3282
+ type: "button",
3283
+ className: "ss-auth-btn-ghost",
3284
+ style: { fontSize: "13px" },
3285
+ onClick: () => {
3286
+ var x;
3287
+ return (x = o.current) == null ? void 0 : x.click();
3239
3288
  },
3240
3289
  children: [
3241
- /* @__PURE__ */ e("span", { className: "material-symbols-outlined", style: { fontSize: "48px", opacity: 0.3 }, children: v.image }),
3242
- /* @__PURE__ */ e("span", { style: { fontSize: "12px", opacity: 0.4 }, children: "No image selected" })
3290
+ /* @__PURE__ */ e("span", { className: "material-symbols-outlined", style: { fontSize: "16px" }, children: S.image }),
3291
+ "Change image"
3243
3292
  ]
3244
3293
  }
3245
- ) }),
3246
- /* @__PURE__ */ t("div", { style: { display: "flex", flexDirection: "column", gap: "16px" }, children: [
3247
- /* @__PURE__ */ t(
3248
- "div",
3249
- {
3250
- className: `ss-auth-dropzone${u ? " ss-auth-dropzone-active" : ""}`,
3251
- onDragOver: (b) => {
3252
- b.preventDefault(), i(!0);
3253
- },
3254
- onDragLeave: () => i(!1),
3255
- onDrop: p,
3256
- onClick: () => {
3257
- var b;
3258
- return (b = c.current) == null ? void 0 : b.click();
3259
- },
3260
- style: { minHeight: "180px" },
3261
- children: [
3262
- /* @__PURE__ */ e("div", { className: "ss-auth-dropzone-icon", children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.cloudUpload }) }),
3263
- /* @__PURE__ */ e("span", { className: "ss-auth-dropzone-title", children: "Drag and drop" }),
3264
- /* @__PURE__ */ t("span", { className: "ss-auth-dropzone-desc", children: [
3265
- "JPG, PNG or WEBP",
3266
- /* @__PURE__ */ e("br", {}),
3267
- "Max file size 5 MB"
3268
- ] }),
3269
- /* @__PURE__ */ e("button", { type: "button", className: "ss-auth-dropzone-btn", children: "Choose File" }),
3270
- /* @__PURE__ */ e(
3271
- "input",
3272
- {
3273
- ref: c,
3274
- type: "file",
3275
- accept: "image/*",
3276
- style: { display: "none" },
3277
- onChange: (b) => {
3278
- var w;
3279
- (w = b.target.files) != null && w[0] && f(b.target.files[0]);
3280
- }
3281
- }
3282
- )
3283
- ]
3284
- }
3285
- ),
3286
- /* @__PURE__ */ t("div", { className: "ss-auth-info-box", children: [
3287
- /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.info }),
3288
- /* @__PURE__ */ e("span", { children: "Your profile photo will be visible to all members of your organization." })
3289
- ] })
3290
- ] })
3294
+ ) })
3295
+ ] }) : /* @__PURE__ */ t(
3296
+ "div",
3297
+ {
3298
+ className: `ss-auth-dropzone${u ? " ss-auth-dropzone-active" : ""}`,
3299
+ onDragOver: (x) => {
3300
+ x.preventDefault(), l(!0);
3301
+ },
3302
+ onDragLeave: () => l(!1),
3303
+ onDrop: h,
3304
+ onClick: () => {
3305
+ var x;
3306
+ return (x = o.current) == null ? void 0 : x.click();
3307
+ },
3308
+ style: { minHeight: "240px" },
3309
+ children: [
3310
+ /* @__PURE__ */ e("div", { className: "ss-auth-dropzone-icon", children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: S.cloudUpload }) }),
3311
+ /* @__PURE__ */ e("span", { className: "ss-auth-dropzone-title", children: "Drag and drop" }),
3312
+ /* @__PURE__ */ t("span", { className: "ss-auth-dropzone-desc", children: [
3313
+ "JPG, PNG or WEBP",
3314
+ /* @__PURE__ */ e("br", {}),
3315
+ "Max file size 5 MB"
3316
+ ] }),
3317
+ /* @__PURE__ */ e("button", { type: "button", className: "ss-auth-dropzone-btn", children: "Choose File" })
3318
+ ]
3319
+ }
3320
+ ),
3321
+ /* @__PURE__ */ e(
3322
+ "input",
3323
+ {
3324
+ ref: o,
3325
+ type: "file",
3326
+ accept: "image/*",
3327
+ style: { display: "none" },
3328
+ onChange: (x) => {
3329
+ var v;
3330
+ (v = x.target.files) != null && v[0] && p(x.target.files[0]);
3331
+ }
3332
+ }
3333
+ ),
3334
+ /* @__PURE__ */ t("div", { className: "ss-auth-info-box", style: { marginTop: "16px" }, children: [
3335
+ /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: S.info }),
3336
+ /* @__PURE__ */ e("span", { children: "Your profile photo will be visible to all members of your organization." })
3291
3337
  ] })
3292
3338
  ] }),
3293
3339
  /* @__PURE__ */ t("div", { className: "ss-auth-modal-footer", children: [
3294
- /* @__PURE__ */ e("button", { type: "button", className: "ss-auth-btn-ghost", onClick: s, children: "Cancel" }),
3340
+ /* @__PURE__ */ e("button", { type: "button", className: "ss-auth-btn-ghost", onClick: r, children: "Cancel" }),
3295
3341
  /* @__PURE__ */ t(
3296
3342
  "button",
3297
3343
  {
3298
3344
  type: "button",
3299
3345
  className: "ss-auth-btn-primary ss-auth-btn-sm",
3300
3346
  onClick: () => {
3347
+ var x;
3348
+ return (x = m.current) == null ? void 0 : x.triggerCrop();
3301
3349
  },
3302
- disabled: !o || r,
3350
+ disabled: !i || s,
3303
3351
  style: { width: "auto" },
3304
3352
  children: [
3305
- r && /* @__PURE__ */ e("span", { className: "ss-auth-spinner" }),
3353
+ s && /* @__PURE__ */ e("span", { className: "ss-auth-spinner" }),
3306
3354
  "Save Profile",
3307
- !r && /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.check })
3355
+ !s && /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: S.check })
3308
3356
  ]
3309
3357
  }
3310
3358
  )
3311
3359
  ] })
3312
3360
  ] }) });
3313
3361
  }
3314
- function Pa({ onClose: a, afterDeleteAccountUrl: s, defaultTab: r = "profile" }) {
3315
- const [o, n] = g(r), u = [
3316
- { key: "profile", label: "Profile", icon: v.person },
3317
- { key: "organization", label: "Organization", icon: v.corporateFare },
3318
- { key: "people", label: "People", icon: v.group },
3319
- { key: "billing", label: "Billing", icon: v.creditCard }
3362
+ function Ia({ onClose: a, afterDeleteAccountUrl: r, defaultTab: s = "profile", onOrgDeleted: i, onOrgUpdated: n }) {
3363
+ const [u, l] = g(s), { invites: d } = ra(), c = [
3364
+ { key: "profile", label: "Profile", icon: S.person },
3365
+ { key: "organization", label: "Organization", icon: S.corporateFare },
3366
+ { key: "people", label: "People", icon: S.group },
3367
+ { key: "invites", label: "Invites", icon: S.mail, badge: d.length || void 0 },
3368
+ { key: "billing", label: "Billing", icon: S.creditCard }
3320
3369
  ];
3321
3370
  return /* @__PURE__ */ t("div", { className: "ss-auth-settings-page", children: [
3322
3371
  /* @__PURE__ */ t("div", { className: "ss-auth-settings-header", children: [
3323
3372
  /* @__PURE__ */ t("div", { style: { display: "flex", alignItems: "center", gap: "12px" }, children: [
3324
- /* @__PURE__ */ e("button", { type: "button", className: "ss-auth-settings-back", onClick: a, children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.arrowBack }) }),
3373
+ /* @__PURE__ */ e("button", { type: "button", className: "ss-auth-settings-back", onClick: a, children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: S.arrowBack }) }),
3325
3374
  /* @__PURE__ */ e("h2", { children: "Settings" })
3326
3375
  ] }),
3327
- /* @__PURE__ */ e("button", { type: "button", className: "ss-auth-modal-close", onClick: a, children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.close }) })
3376
+ /* @__PURE__ */ e("button", { type: "button", className: "ss-auth-modal-close", onClick: a, children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: S.close }) })
3328
3377
  ] }),
3329
3378
  /* @__PURE__ */ t("div", { className: "ss-auth-settings-layout", children: [
3330
- /* @__PURE__ */ e("nav", { className: "ss-auth-settings-nav", children: u.map((i) => /* @__PURE__ */ t(
3379
+ /* @__PURE__ */ e("nav", { className: "ss-auth-settings-nav", children: c.map((o) => /* @__PURE__ */ t(
3331
3380
  "button",
3332
3381
  {
3333
3382
  type: "button",
3334
- className: `ss-auth-settings-nav-item${o === i.key ? " ss-auth-settings-nav-item-active" : ""}`,
3335
- onClick: () => n(i.key),
3383
+ className: `ss-auth-settings-nav-item${u === o.key ? " ss-auth-settings-nav-item-active" : ""}`,
3384
+ onClick: () => l(o.key),
3336
3385
  children: [
3337
- /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: i.icon }),
3338
- i.label
3386
+ /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: o.icon }),
3387
+ o.label,
3388
+ o.badge != null && o.badge > 0 && /* @__PURE__ */ e("span", { className: "ss-auth-invite-badge", style: { position: "static", marginLeft: "6px" }, children: o.badge })
3339
3389
  ]
3340
3390
  },
3341
- i.key
3391
+ o.key
3342
3392
  )) }),
3343
3393
  /* @__PURE__ */ t("div", { className: "ss-auth-settings-content", children: [
3344
- o === "profile" && /* @__PURE__ */ e(Oa, { afterDeleteAccountUrl: s }),
3345
- o === "organization" && /* @__PURE__ */ e(Ea, {}),
3346
- o === "people" && /* @__PURE__ */ e(Ia, {}),
3347
- o === "billing" && /* @__PURE__ */ e(Ba, {})
3394
+ u === "profile" && /* @__PURE__ */ e(Ba, { afterDeleteAccountUrl: r }),
3395
+ u === "organization" && /* @__PURE__ */ e(Fa, { onOrgDeleted: i, onOrgUpdated: n }),
3396
+ u === "people" && /* @__PURE__ */ e(La, {}),
3397
+ u === "invites" && /* @__PURE__ */ e(Aa, {}),
3398
+ u === "billing" && /* @__PURE__ */ e(Da, {})
3348
3399
  ] })
3349
3400
  ] })
3350
3401
  ] });
3351
3402
  }
3352
- function Oa({ afterDeleteAccountUrl: a }) {
3353
- const { user: s, updateProfile: r, uploadAvatar: o, changePassword: n, isLoading: u, error: i, success: l, setError: d, setSuccess: c } = oa(), { signOut: f } = sa(), { deleteAccount: p, isLoading: m, error: b, setError: w } = Ca(), [y, O] = g((s == null ? void 0 : s.name) ?? ""), [h, N] = g((s == null ? void 0 : s.avatarUrl) ?? ""), [C, P] = g(!1), [I, B] = g(""), [F, $] = g(""), [x, S] = g(""), [E, D] = g(null), [U, T] = g(!1), [z, L] = g(""), W = k(
3354
- async (R) => {
3355
- R.preventDefault(), d(null), c(null), await r({ name: y, avatarUrl: h || void 0 });
3403
+ function Ba({ afterDeleteAccountUrl: a }) {
3404
+ const { user: r, updateProfile: s, uploadAvatar: i, changePassword: n, isLoading: u, error: l, success: d, setError: c, setSuccess: o } = ia(), { signOut: m } = sa(), { deleteAccount: p, isLoading: h, error: y, setError: x } = Oa(), [v, z] = g((r == null ? void 0 : r.name) ?? ""), [N, O] = g((r == null ? void 0 : r.avatarUrl) ?? ""), [C, f] = g(!1), [P, I] = g(""), [L, A] = g(""), [b, w] = g(""), [E, B] = g(null), [F, D] = g(!1), [$, T] = g(""), _ = k(
3405
+ async (H) => {
3406
+ H.preventDefault(), c(null), o(null), await s({ name: v, avatarUrl: N || void 0 });
3356
3407
  },
3357
- [y, h, r, d, c]
3408
+ [v, N, s, c, o]
3358
3409
  ), K = k(
3359
- async (R) => {
3360
- const X = await o(R);
3361
- X && (N(X.avatarUrl), P(!1));
3410
+ async (H) => {
3411
+ const X = await i(H);
3412
+ X && (O(X.avatarUrl), f(!1));
3362
3413
  },
3363
- [o]
3414
+ [i]
3364
3415
  ), J = k(
3365
- async (R) => {
3366
- if (R.preventDefault(), D(null), d(null), c(null), F !== x) {
3367
- D("Passwords do not match");
3416
+ async (H) => {
3417
+ if (H.preventDefault(), B(null), c(null), o(null), L !== b) {
3418
+ B("Passwords do not match");
3368
3419
  return;
3369
3420
  }
3370
- if (F.length < 8) {
3371
- D("Password must be at least 8 characters");
3421
+ if (L.length < 8) {
3422
+ B("Password must be at least 8 characters");
3372
3423
  return;
3373
3424
  }
3374
- await n(I, F) && (B(""), $(""), S(""));
3425
+ await n(P, L) && (I(""), A(""), w(""));
3375
3426
  },
3376
- [I, F, x, n, d, c]
3377
- ), ua = k(async () => {
3378
- await p() && (await f(), a && (window.location.href = a));
3379
- }, [p, f, a]), pa = (s == null ? void 0 : s.provider) === "email", ha = z === (s == null ? void 0 : s.email), ga = ((s == null ? void 0 : s.name) || (s == null ? void 0 : s.email) || "?").charAt(0).toUpperCase();
3380
- return /* @__PURE__ */ t(j, { children: [
3427
+ [P, L, b, n, c, o]
3428
+ ), pa = k(async () => {
3429
+ await p() && (await m(), a && (window.location.href = a));
3430
+ }, [p, m, a]), ha = (r == null ? void 0 : r.provider) === "email", ga = $ === (r == null ? void 0 : r.email), ma = ((r == null ? void 0 : r.name) || (r == null ? void 0 : r.email) || "?").charAt(0).toUpperCase();
3431
+ return /* @__PURE__ */ t(R, { children: [
3381
3432
  /* @__PURE__ */ e("h3", { children: "Profile" }),
3382
3433
  /* @__PURE__ */ t("div", { className: "ss-auth-settings-card", children: [
3383
3434
  /* @__PURE__ */ t("div", { className: "ss-auth-profile-header", style: { border: "none", background: "none", padding: 0, marginBottom: 16 }, children: [
3384
- /* @__PURE__ */ t("div", { className: "ss-auth-avatar-lg", onClick: () => P(!0), children: [
3385
- h ? /* @__PURE__ */ e("img", { src: h, alt: "" }) : /* @__PURE__ */ e("div", { style: {
3435
+ /* @__PURE__ */ t("div", { className: "ss-auth-avatar-lg", onClick: () => f(!0), children: [
3436
+ N ? /* @__PURE__ */ e("img", { src: N, alt: "" }) : /* @__PURE__ */ e("div", { style: {
3386
3437
  width: "100%",
3387
3438
  height: "100%",
3388
3439
  display: "flex",
@@ -3391,32 +3442,32 @@ function Oa({ afterDeleteAccountUrl: a }) {
3391
3442
  fontSize: "48px",
3392
3443
  fontWeight: 800,
3393
3444
  opacity: 0.4
3394
- }, children: ga }),
3445
+ }, children: ma }),
3395
3446
  /* @__PURE__ */ t("div", { className: "ss-auth-avatar-overlay", children: [
3396
- /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.camera }),
3447
+ /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: S.camera }),
3397
3448
  /* @__PURE__ */ e("span", { children: "Edit" })
3398
3449
  ] })
3399
3450
  ] }),
3400
3451
  /* @__PURE__ */ t("div", { className: "ss-auth-profile-info", children: [
3401
3452
  /* @__PURE__ */ t("h2", { className: "ss-auth-profile-name", children: [
3402
- (s == null ? void 0 : s.name) || "Unnamed User",
3403
- (s == null ? void 0 : s.emailVerified) && /* @__PURE__ */ t("span", { className: "ss-auth-badge ss-auth-badge-success", children: [
3404
- /* @__PURE__ */ e("span", { className: "material-symbols-outlined", style: { fontSize: "12px", fontVariationSettings: "'FILL' 1" }, children: v.verified }),
3453
+ (r == null ? void 0 : r.name) || "Unnamed User",
3454
+ (r == null ? void 0 : r.emailVerified) && /* @__PURE__ */ t("span", { className: "ss-auth-badge ss-auth-badge-success", children: [
3455
+ /* @__PURE__ */ e("span", { className: "material-symbols-outlined", style: { fontSize: "12px", fontVariationSettings: "'FILL' 1" }, children: S.verified }),
3405
3456
  "Verified"
3406
3457
  ] })
3407
3458
  ] }),
3408
- /* @__PURE__ */ e("p", { className: "ss-auth-profile-desc", children: s == null ? void 0 : s.email })
3459
+ /* @__PURE__ */ e("p", { className: "ss-auth-profile-desc", children: r == null ? void 0 : r.email })
3409
3460
  ] })
3410
3461
  ] }),
3411
- i && /* @__PURE__ */ t("div", { className: "ss-auth-error", children: [
3412
- /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.errorOutline }),
3413
- /* @__PURE__ */ e("span", { children: i })
3414
- ] }),
3415
- l && /* @__PURE__ */ t("div", { className: "ss-auth-info-box", style: { marginBottom: "16px" }, children: [
3416
- /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.check }),
3462
+ l && /* @__PURE__ */ t("div", { className: "ss-auth-error", children: [
3463
+ /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: S.errorOutline }),
3417
3464
  /* @__PURE__ */ e("span", { children: l })
3418
3465
  ] }),
3419
- /* @__PURE__ */ t("form", { onSubmit: W, children: [
3466
+ d && /* @__PURE__ */ t("div", { className: "ss-auth-info-box", style: { marginBottom: "16px" }, children: [
3467
+ /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: S.check }),
3468
+ /* @__PURE__ */ e("span", { children: d })
3469
+ ] }),
3470
+ /* @__PURE__ */ t("form", { onSubmit: _, children: [
3420
3471
  /* @__PURE__ */ t("div", { className: "ss-auth-field", children: [
3421
3472
  /* @__PURE__ */ e("label", { className: "ss-auth-label", children: "Full Name" }),
3422
3473
  /* @__PURE__ */ e(
@@ -3425,8 +3476,8 @@ function Oa({ afterDeleteAccountUrl: a }) {
3425
3476
  className: "ss-auth-input",
3426
3477
  type: "text",
3427
3478
  placeholder: "Your name",
3428
- value: y,
3429
- onChange: (R) => O(R.target.value)
3479
+ value: v,
3480
+ onChange: (H) => z(H.target.value)
3430
3481
  }
3431
3482
  )
3432
3483
  ] }),
@@ -3434,13 +3485,13 @@ function Oa({ afterDeleteAccountUrl: a }) {
3434
3485
  /* @__PURE__ */ t("div", { children: [
3435
3486
  /* @__PURE__ */ e("label", { className: "ss-auth-label", children: "Email Address" }),
3436
3487
  /* @__PURE__ */ t("div", { style: { position: "relative" }, children: [
3437
- /* @__PURE__ */ e("input", { className: "ss-auth-input ss-auth-input-readonly", type: "email", value: (s == null ? void 0 : s.email) ?? "", readOnly: !0 }),
3438
- /* @__PURE__ */ e("span", { className: "ss-auth-visibility-toggle", style: { cursor: "default" }, children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", style: { fontSize: "18px" }, children: v.lock }) })
3488
+ /* @__PURE__ */ e("input", { className: "ss-auth-input ss-auth-input-readonly", type: "email", value: (r == null ? void 0 : r.email) ?? "", readOnly: !0 }),
3489
+ /* @__PURE__ */ e("span", { className: "ss-auth-visibility-toggle", style: { cursor: "default" }, children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", style: { fontSize: "18px" }, children: S.lock }) })
3439
3490
  ] })
3440
3491
  ] }),
3441
3492
  /* @__PURE__ */ t("div", { children: [
3442
3493
  /* @__PURE__ */ e("label", { className: "ss-auth-label", children: "Auth Provider" }),
3443
- /* @__PURE__ */ e("input", { className: "ss-auth-input ss-auth-input-readonly", type: "text", value: (s == null ? void 0 : s.provider) ?? "", readOnly: !0 })
3494
+ /* @__PURE__ */ e("input", { className: "ss-auth-input ss-auth-input-readonly", type: "text", value: (r == null ? void 0 : r.provider) ?? "", readOnly: !0 })
3444
3495
  ] })
3445
3496
  ] }),
3446
3497
  /* @__PURE__ */ e("div", { style: { display: "flex", justifyContent: "flex-end" }, children: /* @__PURE__ */ t("button", { type: "submit", className: "ss-auth-btn-primary ss-auth-btn-sm", disabled: u, style: { width: "auto" }, children: [
@@ -3449,28 +3500,28 @@ function Oa({ afterDeleteAccountUrl: a }) {
3449
3500
  ] }) })
3450
3501
  ] })
3451
3502
  ] }),
3452
- pa && /* @__PURE__ */ t("div", { className: "ss-auth-settings-card", children: [
3503
+ ha && /* @__PURE__ */ t("div", { className: "ss-auth-settings-card", children: [
3453
3504
  /* @__PURE__ */ t("h4", { children: [
3454
- /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.security }),
3505
+ /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: S.security }),
3455
3506
  "Security Credentials"
3456
3507
  ] }),
3457
3508
  E && /* @__PURE__ */ t("div", { className: "ss-auth-error", style: { marginBottom: "16px" }, children: [
3458
- /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.errorOutline }),
3509
+ /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: S.errorOutline }),
3459
3510
  /* @__PURE__ */ e("span", { children: E })
3460
3511
  ] }),
3461
3512
  /* @__PURE__ */ t("form", { onSubmit: J, children: [
3462
3513
  /* @__PURE__ */ t("div", { className: "ss-auth-field", children: [
3463
3514
  /* @__PURE__ */ e("label", { className: "ss-auth-label", children: "Current Password" }),
3464
- /* @__PURE__ */ e("input", { className: "ss-auth-input", type: "password", placeholder: "••••••••••••", value: I, onChange: (R) => B(R.target.value), required: !0 })
3515
+ /* @__PURE__ */ e("input", { className: "ss-auth-input", type: "password", placeholder: "••••••••••••", value: P, onChange: (H) => I(H.target.value), required: !0 })
3465
3516
  ] }),
3466
3517
  /* @__PURE__ */ t("div", { className: "ss-auth-profile-grid", style: { marginBottom: "16px" }, children: [
3467
3518
  /* @__PURE__ */ t("div", { children: [
3468
3519
  /* @__PURE__ */ e("label", { className: "ss-auth-label", children: "New Password" }),
3469
- /* @__PURE__ */ e("input", { className: "ss-auth-input", type: "password", placeholder: "Min. 8 characters", value: F, onChange: (R) => $(R.target.value), required: !0 })
3520
+ /* @__PURE__ */ e("input", { className: "ss-auth-input", type: "password", placeholder: "Min. 8 characters", value: L, onChange: (H) => A(H.target.value), required: !0 })
3470
3521
  ] }),
3471
3522
  /* @__PURE__ */ t("div", { children: [
3472
3523
  /* @__PURE__ */ e("label", { className: "ss-auth-label", children: "Confirm New Password" }),
3473
- /* @__PURE__ */ e("input", { className: "ss-auth-input", type: "password", placeholder: "Repeat new password", value: x, onChange: (R) => S(R.target.value), required: !0 })
3524
+ /* @__PURE__ */ e("input", { className: "ss-auth-input", type: "password", placeholder: "Repeat new password", value: b, onChange: (H) => w(H.target.value), required: !0 })
3474
3525
  ] })
3475
3526
  ] }),
3476
3527
  /* @__PURE__ */ e("div", { style: { display: "flex", justifyContent: "flex-end" }, children: /* @__PURE__ */ e("button", { type: "submit", className: "ss-auth-btn-ghost", disabled: u, children: "Update Security" }) })
@@ -3479,11 +3530,11 @@ function Oa({ afterDeleteAccountUrl: a }) {
3479
3530
  /* @__PURE__ */ t("div", { className: "ss-auth-settings-card ss-auth-settings-danger", children: [
3480
3531
  /* @__PURE__ */ e("h4", { children: "Danger Zone" }),
3481
3532
  /* @__PURE__ */ e("p", { className: "ss-auth-section-desc", style: { marginBottom: "16px" }, children: "Deleting your account is permanent. All organizations you own will also be deleted." }),
3482
- b && /* @__PURE__ */ t("div", { className: "ss-auth-error", children: [
3483
- /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.errorOutline }),
3484
- /* @__PURE__ */ e("span", { children: b })
3533
+ y && /* @__PURE__ */ t("div", { className: "ss-auth-error", children: [
3534
+ /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: S.errorOutline }),
3535
+ /* @__PURE__ */ e("span", { children: y })
3485
3536
  ] }),
3486
- U ? /* @__PURE__ */ t("div", { children: [
3537
+ F ? /* @__PURE__ */ t("div", { children: [
3487
3538
  /* @__PURE__ */ t("div", { className: "ss-auth-field", children: [
3488
3539
  /* @__PURE__ */ e("label", { className: "ss-auth-label", children: "Type your email to confirm" }),
3489
3540
  /* @__PURE__ */ e(
@@ -3491,9 +3542,9 @@ function Oa({ afterDeleteAccountUrl: a }) {
3491
3542
  {
3492
3543
  className: "ss-auth-input",
3493
3544
  type: "email",
3494
- placeholder: s == null ? void 0 : s.email,
3495
- value: z,
3496
- onChange: (R) => L(R.target.value),
3545
+ placeholder: r == null ? void 0 : r.email,
3546
+ value: $,
3547
+ onChange: (H) => T(H.target.value),
3497
3548
  autoFocus: !0
3498
3549
  }
3499
3550
  )
@@ -3505,7 +3556,7 @@ function Oa({ afterDeleteAccountUrl: a }) {
3505
3556
  type: "button",
3506
3557
  className: "ss-auth-btn-ghost",
3507
3558
  onClick: () => {
3508
- T(!1), L(""), w(null);
3559
+ D(!1), T(""), x(null);
3509
3560
  },
3510
3561
  children: "Cancel"
3511
3562
  }
@@ -3516,10 +3567,10 @@ function Oa({ afterDeleteAccountUrl: a }) {
3516
3567
  type: "button",
3517
3568
  className: "ss-auth-btn-primary ss-auth-btn-sm",
3518
3569
  style: { width: "auto", background: "linear-gradient(135deg, #ef4444, #dc2626)" },
3519
- disabled: !ha || m,
3520
- onClick: ua,
3570
+ disabled: !ga || h,
3571
+ onClick: pa,
3521
3572
  children: [
3522
- m && /* @__PURE__ */ e("span", { className: "ss-auth-spinner" }),
3573
+ h && /* @__PURE__ */ e("span", { className: "ss-auth-spinner" }),
3523
3574
  "Delete account"
3524
3575
  ]
3525
3576
  }
@@ -3531,57 +3582,66 @@ function Oa({ afterDeleteAccountUrl: a }) {
3531
3582
  type: "button",
3532
3583
  className: "ss-auth-btn-outline",
3533
3584
  style: { borderColor: "currentColor", width: "auto" },
3534
- onClick: () => T(!0),
3585
+ onClick: () => D(!0),
3535
3586
  children: "Delete my account"
3536
3587
  }
3537
3588
  )
3538
3589
  ] }),
3539
3590
  C && /* @__PURE__ */ e(
3540
- ca,
3591
+ da,
3541
3592
  {
3542
3593
  onUpload: K,
3543
- onClose: () => P(!1),
3594
+ onClose: () => f(!1),
3544
3595
  isLoading: u
3545
3596
  }
3546
3597
  )
3547
3598
  ] });
3548
3599
  }
3549
- function Ea() {
3550
- const { selectedOrg: a, updateOrg: s, deleteOrg: r, isLoading: o, error: n, setError: u } = Y(), [i, l] = g((a == null ? void 0 : a.name) ?? ""), [d, c] = g(!1), [f, p] = g(!1), [m, b] = g(!1), [w, y] = g("");
3551
- if (V(() => {
3552
- a && l(a.name);
3553
- }, [a]), !a)
3554
- return /* @__PURE__ */ t(j, { children: [
3600
+ function Fa({ onOrgDeleted: a, onOrgUpdated: r }) {
3601
+ const { selectedOrg: s, updateOrg: i, deleteOrg: n, isLoading: u, error: l, setError: d } = Y(), [c, o] = g((s == null ? void 0 : s.name) ?? ""), [m, p] = g(!1), [h, y] = g(!1), [x, v] = g(!1), [z, N] = g(!1), [O, C] = g("");
3602
+ if (U(() => {
3603
+ s && (o(s.name), v(!1));
3604
+ }, [s]), x)
3605
+ return /* @__PURE__ */ t(R, { children: [
3606
+ /* @__PURE__ */ e("h3", { children: "Organization" }),
3607
+ /* @__PURE__ */ t("div", { className: "ss-auth-settings-card", style: { textAlign: "center", padding: "48px 24px" }, children: [
3608
+ /* @__PURE__ */ e("span", { className: "material-symbols-outlined", style: { fontSize: "48px", opacity: 0.4, marginBottom: "16px", display: "block" }, children: S.check }),
3609
+ /* @__PURE__ */ e("h4", { style: { margin: "0 0 8px" }, children: "Organization deleted" }),
3610
+ /* @__PURE__ */ e("p", { className: "ss-auth-section-desc", children: "The organization has been permanently deleted." })
3611
+ ] })
3612
+ ] });
3613
+ if (!s)
3614
+ return /* @__PURE__ */ t(R, { children: [
3555
3615
  /* @__PURE__ */ e("h3", { children: "Organization" }),
3556
3616
  /* @__PURE__ */ t("div", { className: "ss-auth-settings-empty", children: [
3557
- /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.corporateFare }),
3617
+ /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: S.corporateFare }),
3558
3618
  /* @__PURE__ */ e("div", { children: "Select an organization from the user menu to manage its settings." })
3559
3619
  ] })
3560
3620
  ] });
3561
- const O = async (N) => {
3562
- if (N.preventDefault(), !i.trim()) return;
3563
- c(!0), p(!1);
3564
- const C = await s(a.id, { name: i.trim() });
3565
- c(!1), C && p(!0);
3566
- }, h = async () => {
3567
- await r(a.id) && b(!1);
3621
+ const f = async (I) => {
3622
+ if (I.preventDefault(), !c.trim()) return;
3623
+ p(!0), y(!1);
3624
+ const L = await i(s.id, { name: c.trim() });
3625
+ p(!1), L && (y(!0), r == null || r());
3626
+ }, P = async () => {
3627
+ await n(s.id) && (N(!1), v(!0), a == null || a());
3568
3628
  };
3569
- return /* @__PURE__ */ t(j, { children: [
3629
+ return /* @__PURE__ */ t(R, { children: [
3570
3630
  /* @__PURE__ */ e("h3", { children: "Organization" }),
3571
3631
  /* @__PURE__ */ t("div", { className: "ss-auth-settings-card", children: [
3572
3632
  /* @__PURE__ */ t("h4", { children: [
3573
- /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.corporateFare }),
3633
+ /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: S.corporateFare }),
3574
3634
  "General"
3575
3635
  ] }),
3576
- n && /* @__PURE__ */ t("div", { className: "ss-auth-error", style: { marginBottom: "16px" }, children: [
3577
- /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.errorOutline }),
3578
- /* @__PURE__ */ e("span", { children: n })
3636
+ l && /* @__PURE__ */ t("div", { className: "ss-auth-error", style: { marginBottom: "16px" }, children: [
3637
+ /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: S.errorOutline }),
3638
+ /* @__PURE__ */ e("span", { children: l })
3579
3639
  ] }),
3580
- f && /* @__PURE__ */ t("div", { className: "ss-auth-info-box", style: { marginBottom: "16px" }, children: [
3581
- /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.check }),
3640
+ h && /* @__PURE__ */ t("div", { className: "ss-auth-info-box", style: { marginBottom: "16px" }, children: [
3641
+ /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: S.check }),
3582
3642
  /* @__PURE__ */ e("span", { children: "Organization updated" })
3583
3643
  ] }),
3584
- /* @__PURE__ */ t("form", { onSubmit: O, children: [
3644
+ /* @__PURE__ */ t("form", { onSubmit: f, children: [
3585
3645
  /* @__PURE__ */ t("div", { className: "ss-auth-field", children: [
3586
3646
  /* @__PURE__ */ e("label", { className: "ss-auth-label", children: "Organization Name" }),
3587
3647
  /* @__PURE__ */ e(
@@ -3589,19 +3649,19 @@ function Ea() {
3589
3649
  {
3590
3650
  className: "ss-auth-input",
3591
3651
  type: "text",
3592
- value: i,
3593
- onChange: (N) => {
3594
- l(N.target.value), p(!1);
3652
+ value: c,
3653
+ onChange: (I) => {
3654
+ o(I.target.value), y(!1);
3595
3655
  }
3596
3656
  }
3597
3657
  )
3598
3658
  ] }),
3599
3659
  /* @__PURE__ */ t("div", { className: "ss-auth-field", children: [
3600
3660
  /* @__PURE__ */ e("label", { className: "ss-auth-label", children: "Slug" }),
3601
- /* @__PURE__ */ e("input", { className: "ss-auth-input ss-auth-input-readonly", type: "text", value: a.slug, readOnly: !0 })
3661
+ /* @__PURE__ */ e("input", { className: "ss-auth-input ss-auth-input-readonly", type: "text", value: s.slug, readOnly: !0 })
3602
3662
  ] }),
3603
- /* @__PURE__ */ e("div", { style: { display: "flex", justifyContent: "flex-end" }, children: /* @__PURE__ */ t("button", { type: "submit", className: "ss-auth-btn-primary ss-auth-btn-sm", disabled: d, style: { width: "auto" }, children: [
3604
- d && /* @__PURE__ */ e("span", { className: "ss-auth-spinner" }),
3663
+ /* @__PURE__ */ e("div", { style: { display: "flex", justifyContent: "flex-end" }, children: /* @__PURE__ */ t("button", { type: "submit", className: "ss-auth-btn-primary ss-auth-btn-sm", disabled: m, style: { width: "auto" }, children: [
3664
+ m && /* @__PURE__ */ e("span", { className: "ss-auth-spinner" }),
3605
3665
  "Save"
3606
3666
  ] }) })
3607
3667
  ] })
@@ -3609,7 +3669,7 @@ function Ea() {
3609
3669
  /* @__PURE__ */ t("div", { className: "ss-auth-settings-card ss-auth-settings-danger", children: [
3610
3670
  /* @__PURE__ */ e("h4", { children: "Danger Zone" }),
3611
3671
  /* @__PURE__ */ e("p", { className: "ss-auth-section-desc", style: { marginBottom: "16px" }, children: "Deleting this organization is permanent and will remove all members." }),
3612
- m ? /* @__PURE__ */ t("div", { children: [
3672
+ z ? /* @__PURE__ */ t("div", { children: [
3613
3673
  /* @__PURE__ */ t("div", { className: "ss-auth-field", children: [
3614
3674
  /* @__PURE__ */ e("label", { className: "ss-auth-label", children: "Type the organization name to confirm" }),
3615
3675
  /* @__PURE__ */ e(
@@ -3617,16 +3677,16 @@ function Ea() {
3617
3677
  {
3618
3678
  className: "ss-auth-input",
3619
3679
  type: "text",
3620
- placeholder: a.name,
3621
- value: w,
3622
- onChange: (N) => y(N.target.value),
3680
+ placeholder: s.name,
3681
+ value: O,
3682
+ onChange: (I) => C(I.target.value),
3623
3683
  autoFocus: !0
3624
3684
  }
3625
3685
  )
3626
3686
  ] }),
3627
3687
  /* @__PURE__ */ t("div", { style: { display: "flex", gap: "8px", justifyContent: "flex-end" }, children: [
3628
3688
  /* @__PURE__ */ e("button", { type: "button", className: "ss-auth-btn-ghost", onClick: () => {
3629
- b(!1), y("");
3689
+ N(!1), C("");
3630
3690
  }, children: "Cancel" }),
3631
3691
  /* @__PURE__ */ t(
3632
3692
  "button",
@@ -3634,10 +3694,10 @@ function Ea() {
3634
3694
  type: "button",
3635
3695
  className: "ss-auth-btn-primary ss-auth-btn-sm",
3636
3696
  style: { width: "auto", background: "linear-gradient(135deg, #ef4444, #dc2626)" },
3637
- disabled: w !== a.name || o,
3638
- onClick: h,
3697
+ disabled: O !== s.name || u,
3698
+ onClick: P,
3639
3699
  children: [
3640
- o && /* @__PURE__ */ e("span", { className: "ss-auth-spinner" }),
3700
+ u && /* @__PURE__ */ e("span", { className: "ss-auth-spinner" }),
3641
3701
  "Delete organization"
3642
3702
  ]
3643
3703
  }
@@ -3649,63 +3709,63 @@ function Ea() {
3649
3709
  type: "button",
3650
3710
  className: "ss-auth-btn-outline",
3651
3711
  style: { borderColor: "currentColor", width: "auto" },
3652
- onClick: () => b(!0),
3712
+ onClick: () => N(!0),
3653
3713
  children: "Delete this organization"
3654
3714
  }
3655
3715
  )
3656
3716
  ] })
3657
3717
  ] });
3658
3718
  }
3659
- function Ia() {
3719
+ function La() {
3660
3720
  const {
3661
3721
  selectedOrg: a,
3662
- members: s,
3663
- invites: r,
3664
- isLoading: o,
3722
+ members: r,
3723
+ invites: s,
3724
+ isLoading: i,
3665
3725
  error: n,
3666
3726
  setError: u,
3667
- sendInvite: i,
3668
- refreshInvites: l,
3669
- revokeInvite: d,
3670
- updateMemberRole: c,
3671
- removeMember: f,
3727
+ sendInvite: l,
3728
+ refreshInvites: d,
3729
+ revokeInvite: c,
3730
+ updateMemberRole: o,
3731
+ removeMember: m,
3672
3732
  refreshMembers: p
3673
- } = Y(), [m, b] = g(""), [w, y] = g("member"), [O, h] = g(!1), [N, C] = g(!1), [P, I] = g(null), [B, F] = g(""), [$, x] = g(null);
3674
- if (V(() => {
3675
- a && (p(a.id), l(a.id));
3676
- }, [a, p, l]), !a)
3677
- return /* @__PURE__ */ t(j, { children: [
3733
+ } = Y(), [h, y] = g(""), [x, v] = g("member"), [z, N] = g(!1), [O, C] = g(!1), [f, P] = g(null), [I, L] = g(""), [A, b] = g(null);
3734
+ if (U(() => {
3735
+ a && (p(a.id), d(a.id));
3736
+ }, [a, p, d]), !a)
3737
+ return /* @__PURE__ */ t(R, { children: [
3678
3738
  /* @__PURE__ */ e("h3", { children: "People" }),
3679
3739
  /* @__PURE__ */ t("div", { className: "ss-auth-settings-empty", children: [
3680
- /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.group }),
3740
+ /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: S.group }),
3681
3741
  /* @__PURE__ */ e("div", { children: "Select an organization from the user menu to manage members." })
3682
3742
  ] })
3683
3743
  ] });
3684
- const S = async (z) => {
3685
- z.preventDefault(), C(!1), await i(a.id, m, w) && (b(""), y("member"), C(!0), h(!1), l(a.id));
3744
+ const w = async ($) => {
3745
+ $.preventDefault(), C(!1), await l(a.id, h, x) && (y(""), v("member"), C(!0), N(!1), d(a.id));
3686
3746
  }, E = async () => {
3687
- if (!P) return;
3688
- await c(a.id, P.userId, B) && I(null);
3689
- }, D = async () => {
3690
- if (!$) return;
3691
- await f(a.id, $.userId) && x(null);
3692
- }, U = async (z) => {
3693
- await d(a.id, z);
3694
- }, T = (z) => z === "owner" ? "ss-auth-role-badge ss-auth-role-badge-owner" : z === "admin" ? "ss-auth-role-badge ss-auth-role-badge-admin" : "ss-auth-role-badge ss-auth-role-badge-member";
3695
- return /* @__PURE__ */ t(j, { children: [
3747
+ if (!f) return;
3748
+ await o(a.id, f.userId, I) && P(null);
3749
+ }, B = async () => {
3750
+ if (!A) return;
3751
+ await m(a.id, A.userId) && b(null);
3752
+ }, F = async ($) => {
3753
+ await c(a.id, $);
3754
+ }, D = ($) => $ === "owner" ? "ss-auth-role-badge ss-auth-role-badge-owner" : $ === "admin" ? "ss-auth-role-badge ss-auth-role-badge-admin" : "ss-auth-role-badge ss-auth-role-badge-member";
3755
+ return /* @__PURE__ */ t(R, { children: [
3696
3756
  /* @__PURE__ */ e("h3", { children: "People" }),
3697
3757
  n && /* @__PURE__ */ t("div", { className: "ss-auth-error", style: { marginBottom: "16px" }, children: [
3698
- /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.errorOutline }),
3758
+ /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: S.errorOutline }),
3699
3759
  /* @__PURE__ */ e("span", { children: n })
3700
3760
  ] }),
3701
- N && /* @__PURE__ */ t("div", { className: "ss-auth-info-box", style: { marginBottom: "16px" }, children: [
3702
- /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.check }),
3761
+ O && /* @__PURE__ */ t("div", { className: "ss-auth-info-box", style: { marginBottom: "16px" }, children: [
3762
+ /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: S.check }),
3703
3763
  /* @__PURE__ */ e("span", { children: "Invitation sent" })
3704
3764
  ] }),
3705
3765
  /* @__PURE__ */ t("div", { className: "ss-auth-settings-card", children: [
3706
3766
  /* @__PURE__ */ t("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", marginBottom: "16px" }, children: [
3707
3767
  /* @__PURE__ */ t("h4", { style: { margin: 0 }, children: [
3708
- /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.group }),
3768
+ /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: S.group }),
3709
3769
  "Members"
3710
3770
  ] }),
3711
3771
  /* @__PURE__ */ t(
@@ -3714,15 +3774,15 @@ function Ia() {
3714
3774
  type: "button",
3715
3775
  className: "ss-auth-btn-primary ss-auth-btn-sm",
3716
3776
  style: { width: "auto" },
3717
- onClick: () => h(!O),
3777
+ onClick: () => N(!z),
3718
3778
  children: [
3719
- /* @__PURE__ */ e("span", { className: "material-symbols-outlined", style: { fontSize: "16px" }, children: v.add }),
3779
+ /* @__PURE__ */ e("span", { className: "material-symbols-outlined", style: { fontSize: "16px" }, children: S.add }),
3720
3780
  "Invite"
3721
3781
  ]
3722
3782
  }
3723
3783
  )
3724
3784
  ] }),
3725
- O && /* @__PURE__ */ e("form", { onSubmit: S, style: { marginBottom: "16px", padding: "16px", background: "rgba(0,0,0,0.05)", borderRadius: "8px" }, children: /* @__PURE__ */ t("div", { style: { display: "flex", gap: "8px", alignItems: "flex-end" }, children: [
3785
+ z && /* @__PURE__ */ e("form", { onSubmit: w, style: { marginBottom: "16px", padding: "16px", background: "rgba(0,0,0,0.05)", borderRadius: "8px" }, children: /* @__PURE__ */ t("div", { style: { display: "flex", gap: "8px", alignItems: "flex-end" }, children: [
3726
3786
  /* @__PURE__ */ t("div", { style: { flex: 1 }, children: [
3727
3787
  /* @__PURE__ */ e("label", { className: "ss-auth-label", children: "Email" }),
3728
3788
  /* @__PURE__ */ e(
@@ -3731,8 +3791,8 @@ function Ia() {
3731
3791
  className: "ss-auth-input",
3732
3792
  type: "email",
3733
3793
  placeholder: "member@example.com",
3734
- value: m,
3735
- onChange: (z) => b(z.target.value),
3794
+ value: h,
3795
+ onChange: ($) => y($.target.value),
3736
3796
  required: !0
3737
3797
  }
3738
3798
  )
@@ -3743,8 +3803,8 @@ function Ia() {
3743
3803
  "select",
3744
3804
  {
3745
3805
  className: "ss-auth-input",
3746
- value: w,
3747
- onChange: (z) => y(z.target.value),
3806
+ value: x,
3807
+ onChange: ($) => v($.target.value),
3748
3808
  style: { cursor: "pointer" },
3749
3809
  children: [
3750
3810
  /* @__PURE__ */ e("option", { value: "admin", children: "Admin" }),
@@ -3753,18 +3813,18 @@ function Ia() {
3753
3813
  }
3754
3814
  )
3755
3815
  ] }),
3756
- /* @__PURE__ */ e("button", { type: "submit", className: "ss-auth-btn-primary ss-auth-btn-sm", disabled: o, style: { width: "auto", marginBottom: "0" }, children: "Send" })
3816
+ /* @__PURE__ */ e("button", { type: "submit", className: "ss-auth-btn-primary ss-auth-btn-sm", disabled: i, style: { width: "auto", marginBottom: "0" }, children: "Send" })
3757
3817
  ] }) }),
3758
- s.length === 0 ? /* @__PURE__ */ e("div", { className: "ss-auth-settings-empty", style: { padding: "20px" }, children: /* @__PURE__ */ e("div", { children: "No members yet." }) }) : /* @__PURE__ */ t("table", { className: "ss-auth-settings-table", children: [
3818
+ r.length === 0 ? /* @__PURE__ */ e("div", { className: "ss-auth-settings-empty", style: { padding: "20px" }, children: /* @__PURE__ */ e("div", { children: "No members yet." }) }) : /* @__PURE__ */ t("table", { className: "ss-auth-settings-table", children: [
3759
3819
  /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ t("tr", { children: [
3760
3820
  /* @__PURE__ */ e("th", { children: "Email" }),
3761
3821
  /* @__PURE__ */ e("th", { children: "Role" }),
3762
3822
  /* @__PURE__ */ e("th", { style: { width: "80px" }, children: "Actions" })
3763
3823
  ] }) }),
3764
- /* @__PURE__ */ e("tbody", { children: s.map((z) => /* @__PURE__ */ t("tr", { children: [
3765
- /* @__PURE__ */ e("td", { children: z.email }),
3766
- /* @__PURE__ */ e("td", { children: /* @__PURE__ */ e("span", { className: T(z.role), children: z.role }) }),
3767
- /* @__PURE__ */ e("td", { children: z.role === "owner" ? /* @__PURE__ */ e("span", { style: { fontSize: "12px", opacity: 0.4 }, children: "—" }) : /* @__PURE__ */ t("div", { className: "ss-auth-settings-actions", children: [
3824
+ /* @__PURE__ */ e("tbody", { children: r.map(($) => /* @__PURE__ */ t("tr", { children: [
3825
+ /* @__PURE__ */ e("td", { children: $.email }),
3826
+ /* @__PURE__ */ e("td", { children: /* @__PURE__ */ e("span", { className: D($.role), children: $.role }) }),
3827
+ /* @__PURE__ */ e("td", { children: $.role === "owner" ? /* @__PURE__ */ e("span", { style: { fontSize: "12px", opacity: 0.4 }, children: "—" }) : /* @__PURE__ */ t("div", { className: "ss-auth-settings-actions", children: [
3768
3828
  /* @__PURE__ */ e(
3769
3829
  "button",
3770
3830
  {
@@ -3772,9 +3832,9 @@ function Ia() {
3772
3832
  className: "ss-auth-icon-btn",
3773
3833
  title: "Edit role",
3774
3834
  onClick: () => {
3775
- I(z), F(z.role);
3835
+ P($), L($.role);
3776
3836
  },
3777
- children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.edit })
3837
+ children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: S.edit })
3778
3838
  }
3779
3839
  ),
3780
3840
  /* @__PURE__ */ e(
@@ -3783,17 +3843,17 @@ function Ia() {
3783
3843
  type: "button",
3784
3844
  className: "ss-auth-icon-btn ss-auth-icon-btn-danger",
3785
3845
  title: "Remove member",
3786
- onClick: () => x(z),
3787
- children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.personRemove })
3846
+ onClick: () => b($),
3847
+ children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: S.personRemove })
3788
3848
  }
3789
3849
  )
3790
3850
  ] }) })
3791
- ] }, z.userId)) })
3851
+ ] }, $.userId)) })
3792
3852
  ] })
3793
3853
  ] }),
3794
- r.length > 0 && /* @__PURE__ */ t("div", { className: "ss-auth-settings-card", children: [
3854
+ s.length > 0 && /* @__PURE__ */ t("div", { className: "ss-auth-settings-card", children: [
3795
3855
  /* @__PURE__ */ t("h4", { children: [
3796
- /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.send }),
3856
+ /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: S.send }),
3797
3857
  "Pending Invites"
3798
3858
  ] }),
3799
3859
  /* @__PURE__ */ t("table", { className: "ss-auth-settings-table", children: [
@@ -3802,33 +3862,33 @@ function Ia() {
3802
3862
  /* @__PURE__ */ e("th", { children: "Role" }),
3803
3863
  /* @__PURE__ */ e("th", { style: { width: "80px" }, children: "Actions" })
3804
3864
  ] }) }),
3805
- /* @__PURE__ */ e("tbody", { children: r.map((z) => /* @__PURE__ */ t("tr", { children: [
3806
- /* @__PURE__ */ e("td", { children: z.email }),
3807
- /* @__PURE__ */ e("td", { children: /* @__PURE__ */ e("span", { className: T(z.role), children: z.role }) }),
3865
+ /* @__PURE__ */ e("tbody", { children: s.map(($) => /* @__PURE__ */ t("tr", { children: [
3866
+ /* @__PURE__ */ e("td", { children: $.email }),
3867
+ /* @__PURE__ */ e("td", { children: /* @__PURE__ */ e("span", { className: D($.role), children: $.role }) }),
3808
3868
  /* @__PURE__ */ e("td", { children: /* @__PURE__ */ e(
3809
3869
  "button",
3810
3870
  {
3811
3871
  type: "button",
3812
3872
  className: "ss-auth-icon-btn ss-auth-icon-btn-danger",
3813
3873
  title: "Revoke invite",
3814
- onClick: () => U(z.id),
3815
- children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.close })
3874
+ onClick: () => F($.id),
3875
+ children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: S.close })
3816
3876
  }
3817
3877
  ) })
3818
- ] }, z.id)) })
3878
+ ] }, $.id)) })
3819
3879
  ] })
3820
3880
  ] }),
3821
- P && /* @__PURE__ */ e("div", { className: "ss-auth-modal-overlay", onClick: (z) => {
3822
- z.target === z.currentTarget && I(null);
3881
+ f && /* @__PURE__ */ e("div", { className: "ss-auth-modal-overlay", onClick: ($) => {
3882
+ $.target === $.currentTarget && P(null);
3823
3883
  }, children: /* @__PURE__ */ t("div", { className: "ss-auth-modal", style: { maxWidth: "400px" }, children: [
3824
3884
  /* @__PURE__ */ t("div", { className: "ss-auth-modal-header", children: [
3825
3885
  /* @__PURE__ */ e("h2", { children: "Edit Role" }),
3826
- /* @__PURE__ */ e("button", { type: "button", className: "ss-auth-modal-close", onClick: () => I(null), children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.close }) })
3886
+ /* @__PURE__ */ e("button", { type: "button", className: "ss-auth-modal-close", onClick: () => P(null), children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: S.close }) })
3827
3887
  ] }),
3828
3888
  /* @__PURE__ */ t("div", { className: "ss-auth-modal-body", children: [
3829
3889
  /* @__PURE__ */ t("p", { style: { fontSize: "14px", marginBottom: "16px", margin: "0 0 16px 0" }, children: [
3830
3890
  "Change role for ",
3831
- /* @__PURE__ */ e("strong", { children: P.email })
3891
+ /* @__PURE__ */ e("strong", { children: f.email })
3832
3892
  ] }),
3833
3893
  /* @__PURE__ */ t("div", { className: "ss-auth-field", children: [
3834
3894
  /* @__PURE__ */ e("label", { className: "ss-auth-label", children: "Role" }),
@@ -3836,8 +3896,8 @@ function Ia() {
3836
3896
  "select",
3837
3897
  {
3838
3898
  className: "ss-auth-input",
3839
- value: B,
3840
- onChange: (z) => F(z.target.value),
3899
+ value: I,
3900
+ onChange: ($) => L($.target.value),
3841
3901
  style: { cursor: "pointer" },
3842
3902
  children: [
3843
3903
  /* @__PURE__ */ e("option", { value: "admin", children: "Admin" }),
@@ -3847,33 +3907,33 @@ function Ia() {
3847
3907
  )
3848
3908
  ] }),
3849
3909
  /* @__PURE__ */ t("div", { style: { display: "flex", gap: "8px", justifyContent: "flex-end" }, children: [
3850
- /* @__PURE__ */ e("button", { type: "button", className: "ss-auth-btn-ghost", onClick: () => I(null), children: "Cancel" }),
3910
+ /* @__PURE__ */ e("button", { type: "button", className: "ss-auth-btn-ghost", onClick: () => P(null), children: "Cancel" }),
3851
3911
  /* @__PURE__ */ e("button", { type: "button", className: "ss-auth-btn-primary ss-auth-btn-sm", style: { width: "auto" }, onClick: E, children: "Save" })
3852
3912
  ] })
3853
3913
  ] })
3854
3914
  ] }) }),
3855
- $ && /* @__PURE__ */ e("div", { className: "ss-auth-modal-overlay", onClick: (z) => {
3856
- z.target === z.currentTarget && x(null);
3915
+ A && /* @__PURE__ */ e("div", { className: "ss-auth-modal-overlay", onClick: ($) => {
3916
+ $.target === $.currentTarget && b(null);
3857
3917
  }, children: /* @__PURE__ */ t("div", { className: "ss-auth-modal", style: { maxWidth: "400px" }, children: [
3858
3918
  /* @__PURE__ */ t("div", { className: "ss-auth-modal-header", children: [
3859
3919
  /* @__PURE__ */ e("h2", { children: "Remove Member" }),
3860
- /* @__PURE__ */ e("button", { type: "button", className: "ss-auth-modal-close", onClick: () => x(null), children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.close }) })
3920
+ /* @__PURE__ */ e("button", { type: "button", className: "ss-auth-modal-close", onClick: () => b(null), children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: S.close }) })
3861
3921
  ] }),
3862
3922
  /* @__PURE__ */ t("div", { className: "ss-auth-modal-body", children: [
3863
3923
  /* @__PURE__ */ t("p", { style: { fontSize: "14px", margin: "0 0 16px 0" }, children: [
3864
3924
  "Are you sure you want to remove ",
3865
- /* @__PURE__ */ e("strong", { children: $.email }),
3925
+ /* @__PURE__ */ e("strong", { children: A.email }),
3866
3926
  " from the organization?"
3867
3927
  ] }),
3868
3928
  /* @__PURE__ */ t("div", { style: { display: "flex", gap: "8px", justifyContent: "flex-end" }, children: [
3869
- /* @__PURE__ */ e("button", { type: "button", className: "ss-auth-btn-ghost", onClick: () => x(null), children: "Cancel" }),
3929
+ /* @__PURE__ */ e("button", { type: "button", className: "ss-auth-btn-ghost", onClick: () => b(null), children: "Cancel" }),
3870
3930
  /* @__PURE__ */ e(
3871
3931
  "button",
3872
3932
  {
3873
3933
  type: "button",
3874
3934
  className: "ss-auth-btn-primary ss-auth-btn-sm",
3875
3935
  style: { width: "auto", background: "linear-gradient(135deg, #ef4444, #dc2626)" },
3876
- onClick: D,
3936
+ onClick: B,
3877
3937
  children: "Remove"
3878
3938
  }
3879
3939
  )
@@ -3882,86 +3942,150 @@ function Ia() {
3882
3942
  ] }) })
3883
3943
  ] });
3884
3944
  }
3885
- function Ba() {
3945
+ function Aa() {
3946
+ const { invites: a, isLoading: r, error: s, setError: i, accept: n, decline: u, refresh: l } = ra(), { refresh: d } = Y(), [c, o] = g(null), m = async (h) => {
3947
+ o(h), i(null);
3948
+ const y = await n(h);
3949
+ o(null), y && d();
3950
+ }, p = async (h) => {
3951
+ o(h), i(null), await u(h), o(null);
3952
+ };
3953
+ return /* @__PURE__ */ t(R, { children: [
3954
+ /* @__PURE__ */ e("h3", { children: "Invites" }),
3955
+ s && /* @__PURE__ */ t("div", { className: "ss-auth-error", style: { marginBottom: "16px" }, children: [
3956
+ /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: S.errorOutline }),
3957
+ /* @__PURE__ */ e("span", { children: s })
3958
+ ] }),
3959
+ r ? /* @__PURE__ */ e("div", { className: "ss-auth-settings-empty", style: { padding: "40px" }, children: /* @__PURE__ */ e("span", { className: "ss-auth-spinner" }) }) : a.length === 0 ? /* @__PURE__ */ t("div", { className: "ss-auth-settings-empty", children: [
3960
+ /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: S.mail }),
3961
+ /* @__PURE__ */ e("div", { children: "No pending invitations" })
3962
+ ] }) : /* @__PURE__ */ e("div", { style: { display: "flex", flexDirection: "column", gap: "12px" }, children: a.map((h) => /* @__PURE__ */ e("div", { className: "ss-auth-settings-card", style: { marginBottom: 0 }, children: /* @__PURE__ */ t("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: "16px", flexWrap: "wrap" }, children: [
3963
+ /* @__PURE__ */ t("div", { style: { display: "flex", alignItems: "center", gap: "12px", flex: 1, minWidth: 0 }, children: [
3964
+ /* @__PURE__ */ e("div", { className: "ss-auth-org-avatar", style: { width: "40px", height: "40px", fontSize: "14px", flexShrink: 0 }, children: h.orgName.split(" ").map((y) => y[0]).join("").slice(0, 2).toUpperCase() }),
3965
+ /* @__PURE__ */ t("div", { style: { minWidth: 0 }, children: [
3966
+ /* @__PURE__ */ e("div", { style: { fontWeight: 600, fontSize: "14px", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: h.orgName }),
3967
+ /* @__PURE__ */ t("div", { style: { fontSize: "12px", opacity: 0.6, display: "flex", gap: "8px", alignItems: "center" }, children: [
3968
+ /* @__PURE__ */ e("span", { className: "ss-auth-role-badge ss-auth-role-badge-member", children: h.role }),
3969
+ /* @__PURE__ */ t("span", { children: [
3970
+ "Expires ",
3971
+ new Date(h.expiresAt).toLocaleDateString()
3972
+ ] })
3973
+ ] })
3974
+ ] })
3975
+ ] }),
3976
+ /* @__PURE__ */ t("div", { style: { display: "flex", gap: "8px", flexShrink: 0 }, children: [
3977
+ /* @__PURE__ */ e(
3978
+ "button",
3979
+ {
3980
+ type: "button",
3981
+ className: "ss-auth-btn-ghost",
3982
+ style: { padding: "6px 12px", fontSize: "13px" },
3983
+ onClick: () => p(h.id),
3984
+ disabled: c === h.id,
3985
+ children: "Decline"
3986
+ }
3987
+ ),
3988
+ /* @__PURE__ */ t(
3989
+ "button",
3990
+ {
3991
+ type: "button",
3992
+ className: "ss-auth-btn-primary ss-auth-btn-sm",
3993
+ style: { width: "auto", padding: "6px 16px", fontSize: "13px" },
3994
+ onClick: () => m(h.id),
3995
+ disabled: c === h.id,
3996
+ children: [
3997
+ c === h.id && /* @__PURE__ */ e("span", { className: "ss-auth-spinner" }),
3998
+ "Accept"
3999
+ ]
4000
+ }
4001
+ )
4002
+ ] })
4003
+ ] }) }, h.id)) })
4004
+ ] });
4005
+ }
4006
+ function Da() {
3886
4007
  const { selectedOrg: a } = Y();
3887
- return a ? /* @__PURE__ */ t(j, { children: [
4008
+ return a ? /* @__PURE__ */ t(R, { children: [
3888
4009
  /* @__PURE__ */ e("h3", { children: "Billing" }),
3889
4010
  /* @__PURE__ */ t("div", { className: "ss-auth-settings-card", children: [
3890
4011
  /* @__PURE__ */ t("h4", { children: [
3891
- /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.creditCard }),
4012
+ /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: S.creditCard }),
3892
4013
  "Plan & Billing"
3893
4014
  ] }),
3894
4015
  /* @__PURE__ */ e("div", { className: "ss-auth-settings-empty", style: { padding: "20px" }, children: /* @__PURE__ */ e("div", { children: "No billing plan configured for this organization." }) })
3895
4016
  ] })
3896
- ] }) : /* @__PURE__ */ t(j, { children: [
4017
+ ] }) : /* @__PURE__ */ t(R, { children: [
3897
4018
  /* @__PURE__ */ e("h3", { children: "Billing" }),
3898
4019
  /* @__PURE__ */ t("div", { className: "ss-auth-settings-empty", children: [
3899
- /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.creditCard }),
4020
+ /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: S.creditCard }),
3900
4021
  /* @__PURE__ */ e("div", { children: "Select an organization from the user menu to manage billing." })
3901
4022
  ] })
3902
4023
  ] });
3903
4024
  }
3904
- function oe({
4025
+ function de({
3905
4026
  appearance: a,
3906
- afterSignOutUrl: s,
3907
- afterDeleteAccountUrl: r,
3908
- showOrgSwitcher: o = !0,
4027
+ afterSignOutUrl: r,
4028
+ afterDeleteAccountUrl: s,
4029
+ showOrgSwitcher: i = !0,
3909
4030
  onOrgChange: n,
3910
4031
  onOrgSettingsClick: u
3911
4032
  }) {
3912
- const { appearance: i } = A(), { user: l, signOut: d } = sa(), c = a ?? i, [f, p] = g(!1), [m, b] = g(!1), [w, y] = g(""), [O, h] = g(null), [N, C] = g(!1), P = _(null), { orgs: I, selectedOrg: B, selectOrg: F, createOrg: $ } = Y(), x = k((E) => {
3913
- P.current && !E.composedPath().includes(P.current) && p(!1);
4033
+ const { appearance: l } = M(), { user: d, signOut: c } = sa(), o = a ?? l, [m, p] = g(!1), [h, y] = g(!1), [x, v] = g(""), [z, N] = g(null), [O, C] = g(!1), f = W(null), { orgs: P, selectedOrg: I, selectOrg: L, createOrg: A, refresh: b } = Y(), { invites: w } = ra(), E = k((F) => {
4034
+ f.current && !F.composedPath().includes(f.current) && p(!1);
3914
4035
  }, []);
3915
- V(() => {
3916
- if (f) {
3917
- const E = setTimeout(() => {
3918
- document.addEventListener("click", x);
4036
+ U(() => {
4037
+ if (m) {
4038
+ const F = setTimeout(() => {
4039
+ document.addEventListener("click", E);
3919
4040
  }, 0);
3920
4041
  return () => {
3921
- clearTimeout(E), document.removeEventListener("click", x);
4042
+ clearTimeout(F), document.removeEventListener("click", E);
3922
4043
  };
3923
4044
  }
3924
- }, [f, x]);
3925
- const S = k(
3926
- async (E) => {
3927
- E.preventDefault(), h(null), C(!0);
3928
- const D = w.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
4045
+ }, [m, E]);
4046
+ const B = k(
4047
+ async (F) => {
4048
+ F.preventDefault(), N(null), C(!0);
4049
+ const D = x.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
3929
4050
  try {
3930
- const U = await $(w, D);
3931
- U && (await F(U.id), n == null || n(U), y(""), p(!1));
3932
- } catch (U) {
3933
- h(U instanceof Error ? U.message : "Failed to create organization");
4051
+ const $ = await A(x, D);
4052
+ $ && (await L($.id), n == null || n($), v(""), p(!1));
4053
+ } catch ($) {
4054
+ N($ instanceof Error ? $.message : "Failed to create organization");
3934
4055
  } finally {
3935
4056
  C(!1);
3936
4057
  }
3937
4058
  },
3938
- [w, $, F, n]
4059
+ [x, A, L, n]
3939
4060
  );
3940
- return l ? /* @__PURE__ */ e(H, { appearance: c, children: /* @__PURE__ */ t("div", { style: { position: "relative", display: "inline-block" }, ref: P, children: [
4061
+ return d ? /* @__PURE__ */ e(j, { appearance: o, children: /* @__PURE__ */ t("div", { style: { position: "relative", display: "inline-block" }, ref: f, children: [
3941
4062
  /* @__PURE__ */ t(
3942
4063
  "button",
3943
4064
  {
3944
4065
  type: "button",
3945
4066
  className: "ss-auth-user-trigger",
3946
- onClick: () => p(!f),
4067
+ onClick: () => p(!m),
3947
4068
  "aria-label": "User menu",
3948
4069
  children: [
3949
- /* @__PURE__ */ e("span", { className: "ss-auth-avatar-trigger", children: l.avatarUrl ? /* @__PURE__ */ e("img", { src: l.avatarUrl, alt: "" }) : /* @__PURE__ */ e("div", { style: {
3950
- width: "100%",
3951
- height: "100%",
3952
- display: "flex",
3953
- alignItems: "center",
3954
- justifyContent: "center",
3955
- fontSize: "16px",
3956
- fontWeight: 700
3957
- }, children: (l.name || l.email).charAt(0).toUpperCase() }) }),
3958
- B && /* @__PURE__ */ e("span", { className: "ss-auth-trigger-org-name", children: B.name })
4070
+ /* @__PURE__ */ t("span", { className: "ss-auth-avatar-trigger", children: [
4071
+ d.avatarUrl ? /* @__PURE__ */ e("img", { src: d.avatarUrl, alt: "" }) : /* @__PURE__ */ e("div", { style: {
4072
+ width: "100%",
4073
+ height: "100%",
4074
+ display: "flex",
4075
+ alignItems: "center",
4076
+ justifyContent: "center",
4077
+ fontSize: "16px",
4078
+ fontWeight: 700
4079
+ }, children: (d.name || d.email).charAt(0).toUpperCase() }),
4080
+ w.length > 0 && /* @__PURE__ */ e("span", { className: "ss-auth-invite-badge", children: w.length })
4081
+ ] }),
4082
+ I && /* @__PURE__ */ e("span", { className: "ss-auth-trigger-org-name", children: I.name })
3959
4083
  ]
3960
4084
  }
3961
4085
  ),
3962
- f && /* @__PURE__ */ t("div", { className: "ss-auth-dropdown ss-auth-glass-panel", style: { minWidth: "320px" }, children: [
4086
+ m && /* @__PURE__ */ t("div", { className: "ss-auth-dropdown ss-auth-glass-panel", style: { minWidth: "320px" }, children: [
3963
4087
  /* @__PURE__ */ t("div", { className: "ss-auth-dropdown-header", children: [
3964
- /* @__PURE__ */ e("div", { className: "ss-auth-dropdown-avatar", children: l.avatarUrl ? /* @__PURE__ */ e("img", { src: l.avatarUrl, alt: "" }) : /* @__PURE__ */ e("div", { style: {
4088
+ /* @__PURE__ */ e("div", { className: "ss-auth-dropdown-avatar", children: d.avatarUrl ? /* @__PURE__ */ e("img", { src: d.avatarUrl, alt: "" }) : /* @__PURE__ */ e("div", { style: {
3965
4089
  width: "100%",
3966
4090
  height: "100%",
3967
4091
  display: "flex",
@@ -3969,10 +4093,10 @@ function oe({
3969
4093
  justifyContent: "center",
3970
4094
  fontSize: "20px",
3971
4095
  fontWeight: 800
3972
- }, children: (l.name || l.email).charAt(0).toUpperCase() }) }),
4096
+ }, children: (d.name || d.email).charAt(0).toUpperCase() }) }),
3973
4097
  /* @__PURE__ */ t("div", { children: [
3974
- l.name && /* @__PURE__ */ e("div", { className: "ss-auth-dropdown-name", children: l.name }),
3975
- /* @__PURE__ */ e("div", { className: "ss-auth-dropdown-email", children: l.email })
4098
+ d.name && /* @__PURE__ */ e("div", { className: "ss-auth-dropdown-name", children: d.name }),
4099
+ /* @__PURE__ */ e("div", { className: "ss-auth-dropdown-email", children: d.email })
3976
4100
  ] })
3977
4101
  ] }),
3978
4102
  /* @__PURE__ */ e("div", { style: { padding: "4px 8px" }, children: /* @__PURE__ */ t(
@@ -3981,49 +4105,49 @@ function oe({
3981
4105
  type: "button",
3982
4106
  className: "ss-auth-dropdown-action",
3983
4107
  onClick: () => {
3984
- p(!1), b(!0);
4108
+ p(!1), y(!0);
3985
4109
  },
3986
4110
  children: [
3987
- /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.settings }),
4111
+ /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: S.settings }),
3988
4112
  "Settings"
3989
4113
  ]
3990
4114
  }
3991
4115
  ) }),
3992
- o && /* @__PURE__ */ t(j, { children: [
4116
+ i && /* @__PURE__ */ t(R, { children: [
3993
4117
  /* @__PURE__ */ e("div", { className: "ss-auth-section-label", children: "Organizations" }),
3994
- /* @__PURE__ */ e("div", { style: { padding: "0 8px 4px" }, children: I.map((E) => {
3995
- const D = (B == null ? void 0 : B.id) === E.id, U = E.name.split(" ").map((T) => T[0]).join("").slice(0, 2).toUpperCase();
4118
+ /* @__PURE__ */ e("div", { style: { padding: "0 8px 4px" }, children: P.map((F) => {
4119
+ const D = (I == null ? void 0 : I.id) === F.id, $ = F.name.split(" ").map((T) => T[0]).join("").slice(0, 2).toUpperCase();
3996
4120
  return /* @__PURE__ */ t(
3997
4121
  "button",
3998
4122
  {
3999
4123
  type: "button",
4000
4124
  className: `ss-auth-org-item${D ? " ss-auth-org-item-active" : ""}`,
4001
4125
  onClick: async () => {
4002
- p(!1), await F(E.id), n == null || n(E);
4126
+ p(!1), await L(F.id), n == null || n(F);
4003
4127
  },
4004
4128
  children: [
4005
4129
  /* @__PURE__ */ t("div", { className: "ss-auth-org-item-inner", children: [
4006
- /* @__PURE__ */ e("div", { className: `ss-auth-org-avatar${D ? "" : " ss-auth-org-avatar-inactive"}`, children: U }),
4007
- /* @__PURE__ */ e("span", { style: { fontFamily: "'Manrope', sans-serif", letterSpacing: "-0.01em" }, children: E.name }),
4008
- E.planName && /* @__PURE__ */ e("span", { className: "ss-auth-plan-badge", children: E.planName })
4130
+ /* @__PURE__ */ e("div", { className: `ss-auth-org-avatar${D ? "" : " ss-auth-org-avatar-inactive"}`, children: $ }),
4131
+ /* @__PURE__ */ e("span", { style: { fontFamily: "'Manrope', sans-serif", letterSpacing: "-0.01em" }, children: F.name }),
4132
+ F.planName && /* @__PURE__ */ e("span", { className: "ss-auth-plan-badge", children: F.planName })
4009
4133
  ] }),
4010
- D && /* @__PURE__ */ e("span", { className: "material-symbols-outlined ss-auth-org-check", style: { fontSize: "18px" }, children: v.checkCircle })
4134
+ D && /* @__PURE__ */ e("span", { className: "material-symbols-outlined ss-auth-org-check", style: { fontSize: "18px" }, children: S.checkCircle })
4011
4135
  ]
4012
4136
  },
4013
- E.id
4137
+ F.id
4014
4138
  );
4015
4139
  }) }),
4016
4140
  /* @__PURE__ */ t("div", { className: "ss-auth-inline-create", children: [
4017
- O && /* @__PURE__ */ e("div", { className: "ss-auth-error", style: { marginBottom: "8px", fontSize: "12px" }, children: /* @__PURE__ */ e("span", { children: O }) }),
4018
- /* @__PURE__ */ e("form", { onSubmit: S, children: /* @__PURE__ */ t("div", { className: "ss-auth-inline-create-input", children: [
4141
+ z && /* @__PURE__ */ e("div", { className: "ss-auth-error", style: { marginBottom: "8px", fontSize: "12px" }, children: /* @__PURE__ */ e("span", { children: z }) }),
4142
+ /* @__PURE__ */ e("form", { onSubmit: B, children: /* @__PURE__ */ t("div", { className: "ss-auth-inline-create-input", children: [
4019
4143
  /* @__PURE__ */ e(
4020
4144
  "input",
4021
4145
  {
4022
4146
  className: "ss-auth-input",
4023
4147
  type: "text",
4024
4148
  placeholder: "New organization name",
4025
- value: w,
4026
- onChange: (E) => y(E.target.value),
4149
+ value: x,
4150
+ onChange: (F) => v(F.target.value),
4027
4151
  required: !0,
4028
4152
  style: { fontSize: "13px", padding: "10px 40px 10px 12px" }
4029
4153
  }
@@ -4033,22 +4157,22 @@ function oe({
4033
4157
  {
4034
4158
  type: "submit",
4035
4159
  className: "ss-auth-inline-create-btn",
4036
- disabled: N || !w.trim(),
4037
- children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", style: { fontSize: "20px" }, children: v.add })
4160
+ disabled: O || !x.trim(),
4161
+ children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", style: { fontSize: "20px" }, children: S.add })
4038
4162
  }
4039
4163
  )
4040
4164
  ] }) })
4041
4165
  ] }),
4042
- B && u && /* @__PURE__ */ e("div", { style: { padding: "0 8px 4px" }, children: /* @__PURE__ */ t(
4166
+ I && u && /* @__PURE__ */ e("div", { style: { padding: "0 8px 4px" }, children: /* @__PURE__ */ t(
4043
4167
  "button",
4044
4168
  {
4045
4169
  type: "button",
4046
4170
  className: "ss-auth-dropdown-action",
4047
4171
  onClick: () => {
4048
- p(!1), u(B);
4172
+ p(!1), u(I);
4049
4173
  },
4050
4174
  children: [
4051
- /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.corporateFare }),
4175
+ /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: S.corporateFare }),
4052
4176
  "Org settings"
4053
4177
  ]
4054
4178
  }
@@ -4060,57 +4184,59 @@ function oe({
4060
4184
  type: "button",
4061
4185
  className: "ss-auth-dropdown-action",
4062
4186
  onClick: async () => {
4063
- p(!1), await d(), s && (window.location.href = s);
4187
+ p(!1), await c(), r && (window.location.href = r);
4064
4188
  },
4065
4189
  style: { color: "inherit" },
4066
4190
  children: [
4067
- /* @__PURE__ */ e("span", { className: "material-symbols-outlined", style: { color: "inherit" }, children: v.logout }),
4191
+ /* @__PURE__ */ e("span", { className: "material-symbols-outlined", style: { color: "inherit" }, children: S.logout }),
4068
4192
  "Sign out"
4069
4193
  ]
4070
4194
  }
4071
4195
  ) })
4072
4196
  ] }),
4073
- m && /* @__PURE__ */ e(
4074
- Pa,
4197
+ h && /* @__PURE__ */ e(
4198
+ Ia,
4075
4199
  {
4076
- onClose: () => b(!1),
4077
- afterDeleteAccountUrl: r
4200
+ onClose: () => y(!1),
4201
+ afterDeleteAccountUrl: s,
4202
+ onOrgDeleted: b,
4203
+ onOrgUpdated: b
4078
4204
  }
4079
4205
  )
4080
4206
  ] }) }) : null;
4081
4207
  }
4082
- function ie({ appearance: a }) {
4083
- const { appearance: s } = A(), { user: r, signOut: o } = sa(), { updateProfile: n, uploadAvatar: u, changePassword: i, isLoading: l, error: d, success: c, setError: f, setSuccess: p } = oa(), m = a ?? s, [b, w] = g((r == null ? void 0 : r.name) ?? ""), [y, O] = g((r == null ? void 0 : r.avatarUrl) ?? ""), [h, N] = g(!1), [C, P] = g(""), [I, B] = g(""), [F, $] = g(""), [x, S] = g(null), E = k(
4084
- async (L) => {
4085
- L.preventDefault(), f(null), p(null), await n({ name: b, avatarUrl: y || void 0 });
4208
+ function ue({ appearance: a }) {
4209
+ const { appearance: r } = M(), { user: s, signOut: i } = sa(), { updateProfile: n, uploadAvatar: u, changePassword: l, isLoading: d, error: c, success: o, setError: m, setSuccess: p } = ia(), h = a ?? r, [y, x] = g((s == null ? void 0 : s.name) ?? ""), [v, z] = g((s == null ? void 0 : s.avatarUrl) ?? ""), [N, O] = g(!1), [C, f] = g(""), [P, I] = g(""), [L, A] = g(""), [b, w] = g(null), E = k(
4210
+ async (T) => {
4211
+ T.preventDefault(), m(null), p(null), await n({ name: y, avatarUrl: v || void 0 });
4086
4212
  },
4087
- [b, y, n, f, p]
4088
- ), D = k(
4089
- async (L) => {
4090
- const W = await u(L);
4091
- W && (O(W.avatarUrl), N(!1));
4213
+ [y, v, n, m, p]
4214
+ ), B = k(
4215
+ async (T) => {
4216
+ const _ = await u(T);
4217
+ _ && (z(_.avatarUrl), O(!1));
4092
4218
  },
4093
4219
  [u]
4094
- ), U = k(
4095
- async (L) => {
4096
- if (L.preventDefault(), S(null), f(null), p(null), I !== F) {
4097
- S("Passwords do not match");
4220
+ ), F = k(
4221
+ async (T) => {
4222
+ if (T.preventDefault(), w(null), m(null), p(null), P !== L) {
4223
+ w("Passwords do not match");
4098
4224
  return;
4099
4225
  }
4100
- if (I.length < 8) {
4101
- S("Password must be at least 8 characters");
4226
+ if (P.length < 8) {
4227
+ w("Password must be at least 8 characters");
4102
4228
  return;
4103
4229
  }
4104
- await i(C, I) && (P(""), B(""), $(""));
4230
+ await l(C, P) && (f(""), I(""), A(""));
4105
4231
  },
4106
- [C, I, F, i, f, p]
4232
+ [C, P, L, l, m, p]
4107
4233
  );
4108
- if (!r) return null;
4109
- const T = r.provider === "email", z = (r.name || r.email).charAt(0).toUpperCase();
4110
- return /* @__PURE__ */ e(H, { appearance: m, children: /* @__PURE__ */ t("div", { className: "ss-auth-card", style: { maxWidth: "640px" }, children: [
4234
+ if (!s) return null;
4235
+ const D = s.provider === "email", $ = (s.name || s.email).charAt(0).toUpperCase();
4236
+ return /* @__PURE__ */ e(j, { appearance: h, children: /* @__PURE__ */ t("div", { className: "ss-auth-card", style: { maxWidth: "640px" }, children: [
4111
4237
  /* @__PURE__ */ t("div", { className: "ss-auth-profile-header", children: [
4112
- /* @__PURE__ */ t("div", { className: "ss-auth-avatar-lg", onClick: () => N(!0), children: [
4113
- y ? /* @__PURE__ */ e("img", { src: y, alt: "" }) : /* @__PURE__ */ e("div", { style: {
4238
+ /* @__PURE__ */ t("div", { className: "ss-auth-avatar-lg", onClick: () => O(!0), children: [
4239
+ v ? /* @__PURE__ */ e("img", { src: v, alt: "" }) : /* @__PURE__ */ e("div", { style: {
4114
4240
  width: "100%",
4115
4241
  height: "100%",
4116
4242
  display: "flex",
@@ -4119,32 +4245,32 @@ function ie({ appearance: a }) {
4119
4245
  fontSize: "48px",
4120
4246
  fontWeight: 800,
4121
4247
  opacity: 0.4
4122
- }, children: z }),
4248
+ }, children: $ }),
4123
4249
  /* @__PURE__ */ t("div", { className: "ss-auth-avatar-overlay", children: [
4124
- /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.camera }),
4250
+ /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: S.camera }),
4125
4251
  /* @__PURE__ */ e("span", { children: "Edit" })
4126
4252
  ] })
4127
4253
  ] }),
4128
4254
  /* @__PURE__ */ t("div", { className: "ss-auth-profile-info", children: [
4129
4255
  /* @__PURE__ */ t("h2", { className: "ss-auth-profile-name", children: [
4130
- r.name || "Unnamed User",
4131
- r.emailVerified && /* @__PURE__ */ t("span", { className: "ss-auth-badge ss-auth-badge-success", children: [
4132
- /* @__PURE__ */ e("span", { className: "material-symbols-outlined", style: { fontSize: "12px", fontVariationSettings: "'FILL' 1" }, children: v.verified }),
4256
+ s.name || "Unnamed User",
4257
+ s.emailVerified && /* @__PURE__ */ t("span", { className: "ss-auth-badge ss-auth-badge-success", children: [
4258
+ /* @__PURE__ */ e("span", { className: "material-symbols-outlined", style: { fontSize: "12px", fontVariationSettings: "'FILL' 1" }, children: S.verified }),
4133
4259
  "Verified"
4134
4260
  ] })
4135
4261
  ] }),
4136
- /* @__PURE__ */ e("p", { className: "ss-auth-profile-desc", children: r.email })
4262
+ /* @__PURE__ */ e("p", { className: "ss-auth-profile-desc", children: s.email })
4137
4263
  ] })
4138
4264
  ] }),
4139
4265
  /* @__PURE__ */ t("div", { className: "ss-auth-card-body", children: [
4140
- d && /* @__PURE__ */ t("div", { className: "ss-auth-error", children: [
4141
- /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.errorOutline }),
4142
- /* @__PURE__ */ e("span", { children: d })
4143
- ] }),
4144
- c && /* @__PURE__ */ t("div", { className: "ss-auth-info-box", style: { marginBottom: "16px" }, children: [
4145
- /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.check }),
4266
+ c && /* @__PURE__ */ t("div", { className: "ss-auth-error", children: [
4267
+ /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: S.errorOutline }),
4146
4268
  /* @__PURE__ */ e("span", { children: c })
4147
4269
  ] }),
4270
+ o && /* @__PURE__ */ t("div", { className: "ss-auth-info-box", style: { marginBottom: "16px" }, children: [
4271
+ /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: S.check }),
4272
+ /* @__PURE__ */ e("span", { children: o })
4273
+ ] }),
4148
4274
  /* @__PURE__ */ t("form", { onSubmit: E, children: [
4149
4275
  /* @__PURE__ */ t("div", { className: "ss-auth-field", children: [
4150
4276
  /* @__PURE__ */ e("label", { className: "ss-auth-label", children: "Full Name" }),
@@ -4154,8 +4280,8 @@ function ie({ appearance: a }) {
4154
4280
  className: "ss-auth-input",
4155
4281
  type: "text",
4156
4282
  placeholder: "Your name",
4157
- value: b,
4158
- onChange: (L) => w(L.target.value)
4283
+ value: y,
4284
+ onChange: (T) => x(T.target.value)
4159
4285
  }
4160
4286
  )
4161
4287
  ] }),
@@ -4163,34 +4289,34 @@ function ie({ appearance: a }) {
4163
4289
  /* @__PURE__ */ t("div", { children: [
4164
4290
  /* @__PURE__ */ e("label", { className: "ss-auth-label", children: "Email Address" }),
4165
4291
  /* @__PURE__ */ t("div", { style: { position: "relative" }, children: [
4166
- /* @__PURE__ */ e("input", { className: "ss-auth-input ss-auth-input-readonly", type: "email", value: r.email, readOnly: !0 }),
4167
- /* @__PURE__ */ e("span", { className: "ss-auth-visibility-toggle", style: { cursor: "default" }, children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", style: { fontSize: "18px" }, children: v.lock }) })
4292
+ /* @__PURE__ */ e("input", { className: "ss-auth-input ss-auth-input-readonly", type: "email", value: s.email, readOnly: !0 }),
4293
+ /* @__PURE__ */ e("span", { className: "ss-auth-visibility-toggle", style: { cursor: "default" }, children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", style: { fontSize: "18px" }, children: S.lock }) })
4168
4294
  ] })
4169
4295
  ] }),
4170
4296
  /* @__PURE__ */ t("div", { children: [
4171
4297
  /* @__PURE__ */ e("label", { className: "ss-auth-label", children: "Auth Provider" }),
4172
4298
  /* @__PURE__ */ t("div", { style: { position: "relative" }, children: [
4173
- /* @__PURE__ */ e("input", { className: "ss-auth-input ss-auth-input-readonly", type: "text", value: r.provider, readOnly: !0 }),
4174
- /* @__PURE__ */ e("span", { className: "ss-auth-visibility-toggle", style: { cursor: "default" }, children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", style: { fontSize: "18px" }, children: v.cloudDone }) })
4299
+ /* @__PURE__ */ e("input", { className: "ss-auth-input ss-auth-input-readonly", type: "text", value: s.provider, readOnly: !0 }),
4300
+ /* @__PURE__ */ e("span", { className: "ss-auth-visibility-toggle", style: { cursor: "default" }, children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", style: { fontSize: "18px" }, children: S.cloudDone }) })
4175
4301
  ] })
4176
4302
  ] })
4177
4303
  ] }),
4178
- /* @__PURE__ */ e("div", { style: { display: "flex", justifyContent: "flex-end" }, children: /* @__PURE__ */ t("button", { type: "submit", className: "ss-auth-btn-primary ss-auth-btn-sm", disabled: l, style: { width: "auto" }, children: [
4179
- l && /* @__PURE__ */ e("span", { className: "ss-auth-spinner" }),
4304
+ /* @__PURE__ */ e("div", { style: { display: "flex", justifyContent: "flex-end" }, children: /* @__PURE__ */ t("button", { type: "submit", className: "ss-auth-btn-primary ss-auth-btn-sm", disabled: d, style: { width: "auto" }, children: [
4305
+ d && /* @__PURE__ */ e("span", { className: "ss-auth-spinner" }),
4180
4306
  "Save changes"
4181
4307
  ] }) })
4182
4308
  ] }),
4183
- T && /* @__PURE__ */ t("div", { className: "ss-auth-section", children: [
4309
+ D && /* @__PURE__ */ t("div", { className: "ss-auth-section", children: [
4184
4310
  /* @__PURE__ */ t("div", { className: "ss-auth-section-title", children: [
4185
- /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.security }),
4311
+ /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: S.security }),
4186
4312
  "Security Credentials"
4187
4313
  ] }),
4188
4314
  /* @__PURE__ */ e("p", { className: "ss-auth-section-desc", style: { marginBottom: "24px" }, children: "Update your password to keep your account secure." }),
4189
- x && /* @__PURE__ */ t("div", { className: "ss-auth-error", children: [
4190
- /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.errorOutline }),
4191
- /* @__PURE__ */ e("span", { children: x })
4315
+ b && /* @__PURE__ */ t("div", { className: "ss-auth-error", children: [
4316
+ /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: S.errorOutline }),
4317
+ /* @__PURE__ */ e("span", { children: b })
4192
4318
  ] }),
4193
- /* @__PURE__ */ t("form", { onSubmit: U, children: [
4319
+ /* @__PURE__ */ t("form", { onSubmit: F, children: [
4194
4320
  /* @__PURE__ */ t("div", { className: "ss-auth-field", children: [
4195
4321
  /* @__PURE__ */ e("label", { className: "ss-auth-label", children: "Current Password" }),
4196
4322
  /* @__PURE__ */ e(
@@ -4200,7 +4326,7 @@ function ie({ appearance: a }) {
4200
4326
  type: "password",
4201
4327
  placeholder: "••••••••••••",
4202
4328
  value: C,
4203
- onChange: (L) => P(L.target.value),
4329
+ onChange: (T) => f(T.target.value),
4204
4330
  required: !0
4205
4331
  }
4206
4332
  )
@@ -4214,8 +4340,8 @@ function ie({ appearance: a }) {
4214
4340
  className: "ss-auth-input",
4215
4341
  type: "password",
4216
4342
  placeholder: "Min. 8 characters",
4217
- value: I,
4218
- onChange: (L) => B(L.target.value),
4343
+ value: P,
4344
+ onChange: (T) => I(T.target.value),
4219
4345
  required: !0
4220
4346
  }
4221
4347
  )
@@ -4228,23 +4354,23 @@ function ie({ appearance: a }) {
4228
4354
  className: "ss-auth-input",
4229
4355
  type: "password",
4230
4356
  placeholder: "Repeat new password",
4231
- value: F,
4232
- onChange: (L) => $(L.target.value),
4357
+ value: L,
4358
+ onChange: (T) => A(T.target.value),
4233
4359
  required: !0
4234
4360
  }
4235
4361
  )
4236
4362
  ] })
4237
4363
  ] }),
4238
4364
  /* @__PURE__ */ t("div", { className: "ss-auth-info-box", style: { marginBottom: "16px" }, children: [
4239
- /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.info }),
4365
+ /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: S.info }),
4240
4366
  /* @__PURE__ */ e("span", { children: "Password must be at least 8 characters long." })
4241
4367
  ] }),
4242
- /* @__PURE__ */ e("div", { style: { display: "flex", justifyContent: "flex-end" }, children: /* @__PURE__ */ e("button", { type: "submit", className: "ss-auth-btn-ghost", disabled: l, children: "Update Security" }) })
4368
+ /* @__PURE__ */ e("div", { style: { display: "flex", justifyContent: "flex-end" }, children: /* @__PURE__ */ e("button", { type: "submit", className: "ss-auth-btn-ghost", disabled: d, children: "Update Security" }) })
4243
4369
  ] })
4244
4370
  ] }),
4245
4371
  /* @__PURE__ */ e("div", { className: "ss-auth-section", style: { borderTop: "none", paddingTop: 0, marginTop: "24px" }, children: /* @__PURE__ */ e("div", { className: "ss-auth-signout-section", style: { borderRadius: "12px", padding: "16px 20px" }, children: /* @__PURE__ */ t("div", { className: "ss-auth-signout-row", children: [
4246
4372
  /* @__PURE__ */ t("div", { className: "ss-auth-signout-info", children: [
4247
- /* @__PURE__ */ e("div", { className: "ss-auth-signout-icon", children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.logout }) }),
4373
+ /* @__PURE__ */ e("div", { className: "ss-auth-signout-icon", children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: S.logout }) }),
4248
4374
  /* @__PURE__ */ t("div", { children: [
4249
4375
  /* @__PURE__ */ e("div", { className: "ss-auth-signout-title", children: "End Session" }),
4250
4376
  /* @__PURE__ */ e("div", { className: "ss-auth-signout-desc", children: "Terminate your active session" })
@@ -4255,104 +4381,104 @@ function ie({ appearance: a }) {
4255
4381
  {
4256
4382
  type: "button",
4257
4383
  className: "ss-auth-btn-outline",
4258
- onClick: () => o(),
4384
+ onClick: () => i(),
4259
4385
  style: { width: "auto", flexShrink: 0 },
4260
4386
  children: "Sign out"
4261
4387
  }
4262
4388
  )
4263
4389
  ] }) }) })
4264
4390
  ] }),
4265
- h && /* @__PURE__ */ e(
4266
- ca,
4391
+ N && /* @__PURE__ */ e(
4392
+ da,
4267
4393
  {
4268
- onUpload: D,
4269
- onClose: () => N(!1),
4270
- isLoading: l
4394
+ onUpload: B,
4395
+ onClose: () => O(!1),
4396
+ isLoading: d
4271
4397
  }
4272
4398
  )
4273
4399
  ] }) });
4274
4400
  }
4275
- function le({ appearance: a, onOrgChange: s }) {
4276
- const { appearance: r } = A(), { orgs: o, selectedOrg: n, selectOrg: u, createOrg: i, isLoading: l } = Y(), d = a ?? r, [c, f] = g(!1), [p, m] = g(""), [b, w] = g(""), [y, O] = g(null), [h, N] = g(!1), C = _(null), P = k((x) => {
4277
- C.current && !x.composedPath().includes(C.current) && f(!1);
4401
+ function pe({ appearance: a, onOrgChange: r }) {
4402
+ const { appearance: s } = M(), { orgs: i, selectedOrg: n, selectOrg: u, createOrg: l, isLoading: d } = Y(), c = a ?? s, [o, m] = g(!1), [p, h] = g(""), [y, x] = g(""), [v, z] = g(null), [N, O] = g(!1), C = W(null), f = k((b) => {
4403
+ C.current && !b.composedPath().includes(C.current) && m(!1);
4278
4404
  }, []);
4279
- V(() => {
4280
- if (c) {
4281
- const x = setTimeout(() => {
4282
- document.addEventListener("click", P);
4405
+ U(() => {
4406
+ if (o) {
4407
+ const b = setTimeout(() => {
4408
+ document.addEventListener("click", f);
4283
4409
  }, 0);
4284
4410
  return () => {
4285
- clearTimeout(x), document.removeEventListener("click", P);
4411
+ clearTimeout(b), document.removeEventListener("click", f);
4286
4412
  };
4287
4413
  }
4288
- }, [c, P]);
4289
- const I = k((x) => {
4290
- m(x), w(x.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, ""));
4291
- }, []), B = k(
4292
- async (x) => {
4293
- x.preventDefault(), O(null), N(!0);
4414
+ }, [o, f]);
4415
+ const P = k((b) => {
4416
+ h(b), x(b.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, ""));
4417
+ }, []), I = k(
4418
+ async (b) => {
4419
+ b.preventDefault(), z(null), O(!0);
4294
4420
  try {
4295
- const S = await i(p, b);
4296
- S && (await u(S.id), s == null || s(S), m(""), w(""), f(!1));
4297
- } catch (S) {
4298
- O(S instanceof Error ? S.message : "Failed to create organization");
4421
+ const w = await l(p, y);
4422
+ w && (await u(w.id), r == null || r(w), h(""), x(""), m(!1));
4423
+ } catch (w) {
4424
+ z(w instanceof Error ? w.message : "Failed to create organization");
4299
4425
  } finally {
4300
- N(!1);
4426
+ O(!1);
4301
4427
  }
4302
4428
  },
4303
- [p, b, i, u, s]
4429
+ [p, y, l, u, r]
4304
4430
  );
4305
- if (l) return null;
4306
- const F = (n == null ? void 0 : n.name) ?? (o.length === 0 ? "No organization" : "Select organization"), $ = n ? n.name.split(" ").map((x) => x[0]).join("").slice(0, 2).toUpperCase() : "--";
4307
- return /* @__PURE__ */ e(H, { appearance: d, children: /* @__PURE__ */ t("div", { style: { position: "relative", display: "inline-block", width: "100%", maxWidth: "360px" }, ref: C, children: [
4431
+ if (d) return null;
4432
+ const L = (n == null ? void 0 : n.name) ?? (i.length === 0 ? "No organization" : "Select organization"), A = n ? n.name.split(" ").map((b) => b[0]).join("").slice(0, 2).toUpperCase() : "--";
4433
+ return /* @__PURE__ */ e(j, { appearance: c, children: /* @__PURE__ */ t("div", { style: { position: "relative", display: "inline-block", width: "100%", maxWidth: "360px" }, ref: C, children: [
4308
4434
  /* @__PURE__ */ t(
4309
4435
  "button",
4310
4436
  {
4311
4437
  type: "button",
4312
4438
  className: "ss-auth-org-trigger",
4313
- onClick: () => f(!c),
4439
+ onClick: () => m(!o),
4314
4440
  children: [
4315
4441
  /* @__PURE__ */ t("div", { className: "ss-auth-org-trigger-inner", children: [
4316
- /* @__PURE__ */ e("div", { className: "ss-auth-org-avatar", children: $ }),
4442
+ /* @__PURE__ */ e("div", { className: "ss-auth-org-avatar", children: A }),
4317
4443
  /* @__PURE__ */ t("div", { style: { textAlign: "left" }, children: [
4318
4444
  /* @__PURE__ */ e("div", { className: "ss-auth-org-trigger-label", children: "Current Organization" }),
4319
- /* @__PURE__ */ e("div", { className: "ss-auth-org-trigger-name", children: F })
4445
+ /* @__PURE__ */ e("div", { className: "ss-auth-org-trigger-name", children: L })
4320
4446
  ] })
4321
4447
  ] }),
4322
- /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.unfoldMore })
4448
+ /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: S.unfoldMore })
4323
4449
  ]
4324
4450
  }
4325
4451
  ),
4326
- c && /* @__PURE__ */ t("div", { className: "ss-auth-dropdown ss-auth-dropdown-left ss-auth-glass-panel", style: { width: "100%" }, children: [
4452
+ o && /* @__PURE__ */ t("div", { className: "ss-auth-dropdown ss-auth-dropdown-left ss-auth-glass-panel", style: { width: "100%" }, children: [
4327
4453
  /* @__PURE__ */ e("div", { className: "ss-auth-section-label", children: "Your Organizations" }),
4328
- /* @__PURE__ */ e("div", { style: { padding: "0 8px 4px" }, children: o.map((x) => {
4329
- const S = (n == null ? void 0 : n.id) === x.id, E = x.name.split(" ").map((D) => D[0]).join("").slice(0, 2).toUpperCase();
4454
+ /* @__PURE__ */ e("div", { style: { padding: "0 8px 4px" }, children: i.map((b) => {
4455
+ const w = (n == null ? void 0 : n.id) === b.id, E = b.name.split(" ").map((B) => B[0]).join("").slice(0, 2).toUpperCase();
4330
4456
  return /* @__PURE__ */ t(
4331
4457
  "button",
4332
4458
  {
4333
4459
  type: "button",
4334
- className: `ss-auth-org-item${S ? " ss-auth-org-item-active" : ""}`,
4460
+ className: `ss-auth-org-item${w ? " ss-auth-org-item-active" : ""}`,
4335
4461
  onClick: async () => {
4336
- f(!1), await u(x.id), s == null || s(x);
4462
+ m(!1), await u(b.id), r == null || r(b);
4337
4463
  },
4338
4464
  children: [
4339
4465
  /* @__PURE__ */ t("div", { className: "ss-auth-org-item-inner", children: [
4340
- /* @__PURE__ */ e("div", { className: `ss-auth-org-avatar${S ? "" : " ss-auth-org-avatar-inactive"}`, children: E }),
4341
- /* @__PURE__ */ e("span", { style: { fontFamily: "'Manrope', sans-serif", letterSpacing: "-0.01em" }, children: x.name })
4466
+ /* @__PURE__ */ e("div", { className: `ss-auth-org-avatar${w ? "" : " ss-auth-org-avatar-inactive"}`, children: E }),
4467
+ /* @__PURE__ */ e("span", { style: { fontFamily: "'Manrope', sans-serif", letterSpacing: "-0.01em" }, children: b.name })
4342
4468
  ] }),
4343
- S && /* @__PURE__ */ e("span", { className: "material-symbols-outlined ss-auth-org-check", style: { fontSize: "18px" }, children: v.checkCircle })
4469
+ w && /* @__PURE__ */ e("span", { className: "material-symbols-outlined ss-auth-org-check", style: { fontSize: "18px" }, children: S.checkCircle })
4344
4470
  ]
4345
4471
  },
4346
- x.id
4472
+ b.id
4347
4473
  );
4348
4474
  }) }),
4349
4475
  /* @__PURE__ */ t("div", { className: "ss-auth-org-create", children: [
4350
4476
  /* @__PURE__ */ t("div", { className: "ss-auth-org-create-header", children: [
4351
- /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.addCircle }),
4477
+ /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: S.addCircle }),
4352
4478
  /* @__PURE__ */ e("span", { children: "Create organization" })
4353
4479
  ] }),
4354
- y && /* @__PURE__ */ e("div", { className: "ss-auth-error", style: { marginBottom: "12px", fontSize: "12px" }, children: /* @__PURE__ */ e("span", { children: y }) }),
4355
- /* @__PURE__ */ t("form", { onSubmit: B, children: [
4480
+ v && /* @__PURE__ */ e("div", { className: "ss-auth-error", style: { marginBottom: "12px", fontSize: "12px" }, children: /* @__PURE__ */ e("span", { children: v }) }),
4481
+ /* @__PURE__ */ t("form", { onSubmit: I, children: [
4356
4482
  /* @__PURE__ */ t("div", { className: "ss-auth-field", children: [
4357
4483
  /* @__PURE__ */ e("label", { className: "ss-auth-label", style: { fontSize: "10px" }, children: "Org Name" }),
4358
4484
  /* @__PURE__ */ e(
@@ -4362,7 +4488,7 @@ function le({ appearance: a, onOrgChange: s }) {
4362
4488
  type: "text",
4363
4489
  placeholder: "e.g. Nexus Dynamics",
4364
4490
  value: p,
4365
- onChange: (x) => I(x.target.value),
4491
+ onChange: (b) => P(b.target.value),
4366
4492
  required: !0,
4367
4493
  style: { fontSize: "13px", padding: "10px 12px" }
4368
4494
  }
@@ -4378,8 +4504,8 @@ function le({ appearance: a, onOrgChange: s }) {
4378
4504
  className: "ss-auth-input",
4379
4505
  type: "text",
4380
4506
  placeholder: "nexus-dynamics",
4381
- value: b,
4382
- onChange: (x) => w(x.target.value),
4507
+ value: y,
4508
+ onChange: (b) => x(b.target.value),
4383
4509
  required: !0,
4384
4510
  style: { fontSize: "13px", padding: "10px 12px 10px 22px" }
4385
4511
  }
@@ -4391,10 +4517,10 @@ function le({ appearance: a, onOrgChange: s }) {
4391
4517
  {
4392
4518
  type: "submit",
4393
4519
  className: "ss-auth-btn-primary",
4394
- disabled: h || !p.trim(),
4520
+ disabled: N || !p.trim(),
4395
4521
  style: { marginTop: "8px" },
4396
4522
  children: [
4397
- h && /* @__PURE__ */ e("span", { className: "ss-auth-spinner" }),
4523
+ N && /* @__PURE__ */ e("span", { className: "ss-auth-spinner" }),
4398
4524
  "Initialize Organization"
4399
4525
  ]
4400
4526
  }
@@ -4404,205 +4530,205 @@ function le({ appearance: a, onOrgChange: s }) {
4404
4530
  ] })
4405
4531
  ] }) });
4406
4532
  }
4407
- function Fa(a, s = "USD") {
4533
+ function Ta(a, r = "USD") {
4408
4534
  return new Intl.NumberFormat("en-US", {
4409
4535
  style: "currency",
4410
- currency: s,
4536
+ currency: r,
4411
4537
  minimumFractionDigits: a % 100 === 0 ? 0 : 2
4412
4538
  }).format(a / 100);
4413
4539
  }
4414
- function ce({ plans: a, currentPlanId: s, onSelectPlan: r, interval: o, appearance: n }) {
4415
- const { appearance: u } = A(), i = n ?? u, l = o ? a.filter((d) => d.interval === o || d.isFree) : a;
4416
- return /* @__PURE__ */ e(H, { appearance: i, children: /* @__PURE__ */ e("div", { className: "ss-pricing-grid", children: l.map((d) => {
4417
- const c = d.id === s;
4418
- return /* @__PURE__ */ t("div", { className: `ss-pricing-card ${c ? "ss-pricing-card-current" : ""}`, children: [
4540
+ function he({ plans: a, currentPlanId: r, onSelectPlan: s, interval: i, appearance: n }) {
4541
+ const { appearance: u } = M(), l = n ?? u, d = i ? a.filter((c) => c.interval === i || c.isFree) : a;
4542
+ return /* @__PURE__ */ e(j, { appearance: l, children: /* @__PURE__ */ e("div", { className: "ss-pricing-grid", children: d.map((c) => {
4543
+ const o = c.id === r;
4544
+ return /* @__PURE__ */ t("div", { className: `ss-pricing-card ${o ? "ss-pricing-card-current" : ""}`, children: [
4419
4545
  /* @__PURE__ */ t("div", { className: "ss-pricing-header", children: [
4420
- /* @__PURE__ */ e("h3", { className: "ss-pricing-name", children: d.name }),
4421
- d.trialDays > 0 && /* @__PURE__ */ t("span", { className: "ss-badge ss-badge-trialing", children: [
4422
- d.trialDays,
4546
+ /* @__PURE__ */ e("h3", { className: "ss-pricing-name", children: c.name }),
4547
+ c.trialDays > 0 && /* @__PURE__ */ t("span", { className: "ss-badge ss-badge-trialing", children: [
4548
+ c.trialDays,
4423
4549
  "-day trial"
4424
4550
  ] }),
4425
- d.isFree && /* @__PURE__ */ e("span", { className: "ss-badge ss-badge-active", children: "Free" })
4551
+ c.isFree && /* @__PURE__ */ e("span", { className: "ss-badge ss-badge-active", children: "Free" })
4426
4552
  ] }),
4427
- /* @__PURE__ */ e("div", { className: "ss-pricing-price", children: d.isFree ? /* @__PURE__ */ e("span", { className: "ss-pricing-amount", children: "Free" }) : /* @__PURE__ */ t(j, { children: [
4428
- /* @__PURE__ */ e("span", { className: "ss-pricing-amount", children: Fa(d.amountCents, d.currency) }),
4553
+ /* @__PURE__ */ e("div", { className: "ss-pricing-price", children: c.isFree ? /* @__PURE__ */ e("span", { className: "ss-pricing-amount", children: "Free" }) : /* @__PURE__ */ t(R, { children: [
4554
+ /* @__PURE__ */ e("span", { className: "ss-pricing-amount", children: Ta(c.amountCents, c.currency) }),
4429
4555
  /* @__PURE__ */ t("span", { className: "ss-pricing-interval", children: [
4430
4556
  "/",
4431
- d.interval
4557
+ c.interval
4432
4558
  ] })
4433
4559
  ] }) }),
4434
- d.description && /* @__PURE__ */ e("p", { className: "ss-pricing-desc", children: d.description }),
4435
- d.features.length > 0 && /* @__PURE__ */ e("ul", { className: "ss-pricing-features", children: d.features.map((f, p) => /* @__PURE__ */ t("li", { className: "ss-pricing-feature", children: [
4560
+ c.description && /* @__PURE__ */ e("p", { className: "ss-pricing-desc", children: c.description }),
4561
+ c.features.length > 0 && /* @__PURE__ */ e("ul", { className: "ss-pricing-features", children: c.features.map((m, p) => /* @__PURE__ */ t("li", { className: "ss-pricing-feature", children: [
4436
4562
  /* @__PURE__ */ e("span", { className: "ss-check", children: "✓" }),
4437
4563
  " ",
4438
- f
4564
+ m
4439
4565
  ] }, p)) }),
4440
4566
  /* @__PURE__ */ e(
4441
4567
  "button",
4442
4568
  {
4443
4569
  type: "button",
4444
- className: `ss-btn ${c ? "ss-btn-current" : "ss-btn-primary"}`,
4445
- disabled: c,
4446
- onClick: () => r(d.id),
4447
- children: c ? "Current plan" : "Select plan"
4570
+ className: `ss-btn ${o ? "ss-btn-current" : "ss-btn-primary"}`,
4571
+ disabled: o,
4572
+ onClick: () => s(c.id),
4573
+ children: o ? "Current plan" : "Select plan"
4448
4574
  }
4449
4575
  )
4450
- ] }, d.id);
4576
+ ] }, c.id);
4451
4577
  }) }) });
4452
4578
  }
4453
- function de() {
4454
- const { client: a } = A();
4579
+ function ge() {
4580
+ const { client: a } = M();
4455
4581
  return { billing: a.billing };
4456
4582
  }
4457
4583
  function Z(a) {
4458
- const { client: s } = A();
4584
+ const { client: r } = M();
4459
4585
  return G(() => {
4460
4586
  if (a) {
4461
- const r = new Q("https://api.saas-support.com/v1", { type: "portalToken", token: a });
4462
- return new ya(r);
4587
+ const s = new Q("https://api.saas-support.com/v1", { type: "portalToken", token: a });
4588
+ return new Na(s);
4463
4589
  }
4464
- return s.billing;
4465
- }, [s, a]);
4590
+ return r.billing;
4591
+ }, [r, a]);
4466
4592
  }
4467
- function La(a, s) {
4468
- const r = Z(s), [o, n] = g(null), [u, i] = g(!0), [l, d] = g(null), c = k(async () => {
4469
- i(!0), d(null);
4593
+ function Ma(a, r) {
4594
+ const s = Z(r), [i, n] = g(null), [u, l] = g(!0), [d, c] = g(null), o = k(async () => {
4595
+ l(!0), c(null);
4470
4596
  try {
4471
- const f = await r.getCustomer(a);
4472
- n(f);
4473
- } catch (f) {
4474
- d(f instanceof Error ? f.message : "Failed to load subscription");
4597
+ const m = await s.getCustomer(a);
4598
+ n(m);
4599
+ } catch (m) {
4600
+ c(m instanceof Error ? m.message : "Failed to load subscription");
4475
4601
  } finally {
4476
- i(!1);
4602
+ l(!1);
4477
4603
  }
4478
- }, [r, a]);
4479
- return V(() => {
4480
- c();
4481
- }, [c]), { customer: o, isLoading: u, error: l, refresh: c };
4604
+ }, [s, a]);
4605
+ return U(() => {
4606
+ o();
4607
+ }, [o]), { customer: i, isLoading: u, error: d, refresh: o };
4482
4608
  }
4483
- function Aa(a, s) {
4484
- const r = Z(s), [o, n] = g([]), [u, i] = g(!0), [l, d] = g(null), c = k(async () => {
4485
- i(!0), d(null);
4609
+ function Va(a, r) {
4610
+ const s = Z(r), [i, n] = g([]), [u, l] = g(!0), [d, c] = g(null), o = k(async () => {
4611
+ l(!0), c(null);
4486
4612
  try {
4487
- const f = await r.getInvoices(a);
4488
- n(f);
4489
- } catch (f) {
4490
- d(f instanceof Error ? f.message : "Failed to load invoices");
4613
+ const m = await s.getInvoices(a);
4614
+ n(m);
4615
+ } catch (m) {
4616
+ c(m instanceof Error ? m.message : "Failed to load invoices");
4491
4617
  } finally {
4492
- i(!1);
4618
+ l(!1);
4493
4619
  }
4494
- }, [r, a]);
4495
- return V(() => {
4496
- c();
4497
- }, [c]), { invoices: o, isLoading: u, error: l, refresh: c };
4620
+ }, [s, a]);
4621
+ return U(() => {
4622
+ o();
4623
+ }, [o]), { invoices: i, isLoading: u, error: d, refresh: o };
4498
4624
  }
4499
- function Da(a, s) {
4500
- const r = Z(s), [o, n] = g([]), [u, i] = g(!0), [l, d] = g(null), c = k(async () => {
4501
- i(!0), d(null);
4625
+ function Ua(a, r) {
4626
+ const s = Z(r), [i, n] = g([]), [u, l] = g(!0), [d, c] = g(null), o = k(async () => {
4627
+ l(!0), c(null);
4502
4628
  try {
4503
- const f = await r.getCurrentUsage(a);
4504
- n(f);
4505
- } catch (f) {
4506
- d(f instanceof Error ? f.message : "Failed to load usage");
4629
+ const m = await s.getCurrentUsage(a);
4630
+ n(m);
4631
+ } catch (m) {
4632
+ c(m instanceof Error ? m.message : "Failed to load usage");
4507
4633
  } finally {
4508
- i(!1);
4634
+ l(!1);
4509
4635
  }
4510
- }, [r, a]);
4511
- return V(() => {
4512
- c();
4513
- }, [c]), { usage: o, isLoading: u, error: l, refresh: c };
4636
+ }, [s, a]);
4637
+ return U(() => {
4638
+ o();
4639
+ }, [o]), { usage: i, isLoading: u, error: d, refresh: o };
4514
4640
  }
4515
- const Ta = {
4641
+ const Ra = {
4516
4642
  active: "ss-badge-active"
4517
4643
  };
4518
- function Ma({
4644
+ function Ha({
4519
4645
  customerId: a,
4520
- portalToken: s,
4521
- onChangePlan: r,
4522
- onCancel: o,
4646
+ portalToken: r,
4647
+ onChangePlan: s,
4648
+ onCancel: i,
4523
4649
  appearance: n
4524
4650
  }) {
4525
- const { appearance: u } = A(), { customer: i, isLoading: l, error: d } = La(a, s);
4526
- return /* @__PURE__ */ e(H, { appearance: n ?? u, children: /* @__PURE__ */ t("div", { className: "ss-card", children: [
4651
+ const { appearance: u } = M(), { customer: l, isLoading: d, error: c } = Ma(a, r);
4652
+ return /* @__PURE__ */ e(j, { appearance: n ?? u, children: /* @__PURE__ */ t("div", { className: "ss-card", children: [
4527
4653
  /* @__PURE__ */ e("h2", { className: "ss-title", children: "Subscription" }),
4528
- l && /* @__PURE__ */ t("div", { className: "ss-loading", children: [
4654
+ d && /* @__PURE__ */ t("div", { className: "ss-loading", children: [
4529
4655
  /* @__PURE__ */ e("span", { className: "ss-spinner" }),
4530
4656
  " Loading..."
4531
4657
  ] }),
4532
- d && /* @__PURE__ */ e("div", { className: "ss-global-error", children: d }),
4533
- i && !l && /* @__PURE__ */ t(j, { children: [
4658
+ c && /* @__PURE__ */ e("div", { className: "ss-global-error", children: c }),
4659
+ l && !d && /* @__PURE__ */ t(R, { children: [
4534
4660
  /* @__PURE__ */ t("div", { className: "ss-field", children: [
4535
4661
  /* @__PURE__ */ e("label", { className: "ss-label", children: "Customer" }),
4536
- /* @__PURE__ */ e("input", { className: "ss-input", value: i.name || i.email, disabled: !0, readOnly: !0 })
4662
+ /* @__PURE__ */ e("input", { className: "ss-input", value: l.name || l.email, disabled: !0, readOnly: !0 })
4537
4663
  ] }),
4538
4664
  /* @__PURE__ */ t("div", { className: "ss-field", children: [
4539
4665
  /* @__PURE__ */ e("label", { className: "ss-label", children: "Status" }),
4540
- /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e("span", { className: `ss-badge ${Ta.active}`, children: "Active" }) })
4666
+ /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e("span", { className: `ss-badge ${Ra.active}`, children: "Active" }) })
4541
4667
  ] }),
4542
4668
  /* @__PURE__ */ t("div", { className: "ss-btn-group", children: [
4543
- r && /* @__PURE__ */ e("button", { type: "button", className: "ss-btn ss-btn-primary", onClick: r, children: "Change plan" }),
4544
- o && /* @__PURE__ */ e("button", { type: "button", className: "ss-btn ss-btn-danger", onClick: o, children: "Cancel subscription" })
4669
+ s && /* @__PURE__ */ e("button", { type: "button", className: "ss-btn ss-btn-primary", onClick: s, children: "Change plan" }),
4670
+ i && /* @__PURE__ */ e("button", { type: "button", className: "ss-btn ss-btn-danger", onClick: i, children: "Cancel subscription" })
4545
4671
  ] })
4546
4672
  ] })
4547
4673
  ] }) });
4548
4674
  }
4549
- const Va = {
4675
+ const ja = {
4550
4676
  paid: "ss-badge-active",
4551
4677
  open: "ss-badge-trialing",
4552
4678
  draft: "ss-badge-paused",
4553
4679
  void: "ss-badge-canceled",
4554
4680
  uncollectible: "ss-badge-past-due"
4555
4681
  };
4556
- function Ua(a) {
4682
+ function qa(a) {
4557
4683
  return new Date(a).toLocaleDateString("en-US", { year: "numeric", month: "short", day: "numeric" });
4558
4684
  }
4559
- function Ra(a) {
4685
+ function Wa(a) {
4560
4686
  return new Intl.NumberFormat("en-US", { style: "currency", currency: "USD", minimumFractionDigits: 2 }).format(a / 100);
4561
4687
  }
4562
- function Ha({ customerId: a, portalToken: s, appearance: r }) {
4563
- const { appearance: o } = A(), { invoices: n, isLoading: u, error: i } = Aa(a, s), l = r ?? o, d = [...n].sort((c, f) => new Date(f.createdAt).getTime() - new Date(c.createdAt).getTime());
4564
- return /* @__PURE__ */ e(H, { appearance: l, children: /* @__PURE__ */ t("div", { className: "ss-card ss-card-wide", children: [
4688
+ function _a({ customerId: a, portalToken: r, appearance: s }) {
4689
+ const { appearance: i } = M(), { invoices: n, isLoading: u, error: l } = Va(a, r), d = s ?? i, c = [...n].sort((o, m) => new Date(m.createdAt).getTime() - new Date(o.createdAt).getTime());
4690
+ return /* @__PURE__ */ e(j, { appearance: d, children: /* @__PURE__ */ t("div", { className: "ss-card ss-card-wide", children: [
4565
4691
  /* @__PURE__ */ e("h2", { className: "ss-title", children: "Invoices" }),
4566
4692
  u && /* @__PURE__ */ t("div", { className: "ss-loading", children: [
4567
4693
  /* @__PURE__ */ e("span", { className: "ss-spinner" }),
4568
4694
  " Loading..."
4569
4695
  ] }),
4570
- i && /* @__PURE__ */ e("div", { className: "ss-global-error", children: i }),
4571
- !u && d.length === 0 && /* @__PURE__ */ e("p", { className: "ss-empty", children: "No invoices yet." }),
4572
- !u && d.length > 0 && /* @__PURE__ */ t("table", { className: "ss-table", children: [
4696
+ l && /* @__PURE__ */ e("div", { className: "ss-global-error", children: l }),
4697
+ !u && c.length === 0 && /* @__PURE__ */ e("p", { className: "ss-empty", children: "No invoices yet." }),
4698
+ !u && c.length > 0 && /* @__PURE__ */ t("table", { className: "ss-table", children: [
4573
4699
  /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ t("tr", { children: [
4574
4700
  /* @__PURE__ */ e("th", { className: "ss-th", children: "Date" }),
4575
4701
  /* @__PURE__ */ e("th", { className: "ss-th", children: "Amount" }),
4576
4702
  /* @__PURE__ */ e("th", { className: "ss-th", children: "Status" }),
4577
4703
  /* @__PURE__ */ e("th", { className: "ss-th", children: "PDF" })
4578
4704
  ] }) }),
4579
- /* @__PURE__ */ e("tbody", { children: d.map((c) => /* @__PURE__ */ t("tr", { className: "ss-tr", children: [
4580
- /* @__PURE__ */ e("td", { className: "ss-td", children: Ua(c.createdAt) }),
4581
- /* @__PURE__ */ e("td", { className: "ss-td", children: Ra(c.amountCents) }),
4582
- /* @__PURE__ */ e("td", { className: "ss-td", children: /* @__PURE__ */ e("span", { className: `ss-badge ${Va[c.status] || ""}`, children: c.status }) }),
4583
- /* @__PURE__ */ e("td", { className: "ss-td", children: c.pdfUrl ? /* @__PURE__ */ e("a", { className: "ss-link", href: c.pdfUrl, target: "_blank", rel: "noopener noreferrer", children: "Download" }) : "—" })
4584
- ] }, c.id)) })
4705
+ /* @__PURE__ */ e("tbody", { children: c.map((o) => /* @__PURE__ */ t("tr", { className: "ss-tr", children: [
4706
+ /* @__PURE__ */ e("td", { className: "ss-td", children: qa(o.createdAt) }),
4707
+ /* @__PURE__ */ e("td", { className: "ss-td", children: Wa(o.amountCents) }),
4708
+ /* @__PURE__ */ e("td", { className: "ss-td", children: /* @__PURE__ */ e("span", { className: `ss-badge ${ja[o.status] || ""}`, children: o.status }) }),
4709
+ /* @__PURE__ */ e("td", { className: "ss-td", children: o.pdfUrl ? /* @__PURE__ */ e("a", { className: "ss-link", href: o.pdfUrl, target: "_blank", rel: "noopener noreferrer", children: "Download" }) : "—" })
4710
+ ] }, o.id)) })
4585
4711
  ] })
4586
4712
  ] }) });
4587
4713
  }
4588
- function ja({ customerId: a, limits: s, portalToken: r, appearance: o }) {
4589
- const { appearance: n } = A(), { usage: u, isLoading: i, error: l } = Da(a, r);
4590
- return /* @__PURE__ */ e(H, { appearance: o ?? n, children: /* @__PURE__ */ t("div", { className: "ss-card", children: [
4714
+ function Ga({ customerId: a, limits: r, portalToken: s, appearance: i }) {
4715
+ const { appearance: n } = M(), { usage: u, isLoading: l, error: d } = Ua(a, s);
4716
+ return /* @__PURE__ */ e(j, { appearance: i ?? n, children: /* @__PURE__ */ t("div", { className: "ss-card", children: [
4591
4717
  /* @__PURE__ */ e("h2", { className: "ss-title", children: "Usage" }),
4592
- i && /* @__PURE__ */ t("div", { className: "ss-loading", children: [
4718
+ l && /* @__PURE__ */ t("div", { className: "ss-loading", children: [
4593
4719
  /* @__PURE__ */ e("span", { className: "ss-spinner" }),
4594
4720
  " Loading..."
4595
4721
  ] }),
4596
- l && /* @__PURE__ */ e("div", { className: "ss-global-error", children: l }),
4597
- !i && u.length === 0 && /* @__PURE__ */ e("p", { className: "ss-empty", children: "No usage data." }),
4598
- !i && u.map((c) => {
4599
- const f = s == null ? void 0 : s[c.metric], p = f ? Math.min(100, c.total / f * 100) : null;
4722
+ d && /* @__PURE__ */ e("div", { className: "ss-global-error", children: d }),
4723
+ !l && u.length === 0 && /* @__PURE__ */ e("p", { className: "ss-empty", children: "No usage data." }),
4724
+ !l && u.map((o) => {
4725
+ const m = r == null ? void 0 : r[o.metric], p = m ? Math.min(100, o.total / m * 100) : null;
4600
4726
  return /* @__PURE__ */ t("div", { className: "ss-usage-item", children: [
4601
4727
  /* @__PURE__ */ t("div", { className: "ss-usage-header", children: [
4602
- /* @__PURE__ */ e("span", { className: "ss-usage-metric", children: c.metric }),
4728
+ /* @__PURE__ */ e("span", { className: "ss-usage-metric", children: o.metric }),
4603
4729
  /* @__PURE__ */ t("span", { className: "ss-usage-value", children: [
4604
- c.total.toLocaleString(),
4605
- f ? ` / ${f.toLocaleString()}` : ""
4730
+ o.total.toLocaleString(),
4731
+ m ? ` / ${m.toLocaleString()}` : ""
4606
4732
  ] })
4607
4733
  ] }),
4608
4734
  p !== null && /* @__PURE__ */ e("div", { className: "ss-progress-bar", children: /* @__PURE__ */ e(
@@ -4612,20 +4738,20 @@ function ja({ customerId: a, limits: s, portalToken: r, appearance: o }) {
4612
4738
  style: { width: `${p}%` }
4613
4739
  }
4614
4740
  ) })
4615
- ] }, c.metric);
4741
+ ] }, o.metric);
4616
4742
  })
4617
4743
  ] }) });
4618
4744
  }
4619
- function ue({
4745
+ function me({
4620
4746
  customerId: a,
4621
- portalToken: s,
4622
- limits: r,
4623
- onChangePlan: o,
4747
+ portalToken: r,
4748
+ limits: s,
4749
+ onChangePlan: i,
4624
4750
  onCancel: n,
4625
4751
  appearance: u
4626
4752
  }) {
4627
- const { appearance: i } = A(), l = u ?? i, [d, c] = g("subscription");
4628
- return /* @__PURE__ */ e(H, { appearance: l, children: /* @__PURE__ */ t("div", { className: "ss-card ss-card-wide", children: [
4753
+ const { appearance: l } = M(), d = u ?? l, [c, o] = g("subscription");
4754
+ return /* @__PURE__ */ e(j, { appearance: d, children: /* @__PURE__ */ t("div", { className: "ss-card ss-card-wide", children: [
4629
4755
  /* @__PURE__ */ e("h2", { className: "ss-title", children: "Billing" }),
4630
4756
  /* @__PURE__ */ e("div", { className: "ss-tab-group", children: [
4631
4757
  { id: "subscription", label: "Subscription" },
@@ -4635,46 +4761,46 @@ function ue({
4635
4761
  "button",
4636
4762
  {
4637
4763
  type: "button",
4638
- className: `ss-tab ${d === p.id ? "ss-tab-active" : ""}`,
4639
- onClick: () => c(p.id),
4764
+ className: `ss-tab ${c === p.id ? "ss-tab-active" : ""}`,
4765
+ onClick: () => o(p.id),
4640
4766
  children: p.label
4641
4767
  },
4642
4768
  p.id
4643
4769
  )) }),
4644
4770
  /* @__PURE__ */ t("div", { className: "ss-tab-content", children: [
4645
- d === "subscription" && /* @__PURE__ */ e(
4646
- Ma,
4771
+ c === "subscription" && /* @__PURE__ */ e(
4772
+ Ha,
4647
4773
  {
4648
4774
  customerId: a,
4649
- portalToken: s,
4650
- onChangePlan: o,
4775
+ portalToken: r,
4776
+ onChangePlan: i,
4651
4777
  onCancel: n
4652
4778
  }
4653
4779
  ),
4654
- d === "invoices" && /* @__PURE__ */ e(Ha, { customerId: a, portalToken: s }),
4655
- d === "usage" && /* @__PURE__ */ e(ja, { customerId: a, portalToken: s, limits: r })
4780
+ c === "invoices" && /* @__PURE__ */ e(_a, { customerId: a, portalToken: r }),
4781
+ c === "usage" && /* @__PURE__ */ e(Ga, { customerId: a, portalToken: r, limits: s })
4656
4782
  ] })
4657
4783
  ] }) });
4658
4784
  }
4659
- function pe({ customerId: a, portalToken: s, onApplied: r, appearance: o }) {
4660
- const { appearance: n } = A(), u = Z(s), i = o ?? n, [l, d] = g(""), [c, f] = g(!1), [p, m] = g(null), [b, w] = g(null), y = k(async (O) => {
4661
- if (O.preventDefault(), !!l.trim()) {
4662
- f(!0), m(null), w(null);
4785
+ function fe({ customerId: a, portalToken: r, onApplied: s, appearance: i }) {
4786
+ const { appearance: n } = M(), u = Z(r), l = i ?? n, [d, c] = g(""), [o, m] = g(!1), [p, h] = g(null), [y, x] = g(null), v = k(async (z) => {
4787
+ if (z.preventDefault(), !!d.trim()) {
4788
+ m(!0), h(null), x(null);
4663
4789
  try {
4664
- const h = await u.applyCoupon(a, l.trim());
4665
- w(`Coupon applied! ${h.discountType === "percent" ? `${h.amount}% off` : `$${(h.amount / 100).toFixed(2)} off`}`), d(""), r == null || r(h);
4666
- } catch (h) {
4667
- m(h instanceof Error ? h.message : "Invalid coupon code");
4790
+ const N = await u.applyCoupon(a, d.trim());
4791
+ x(`Coupon applied! ${N.discountType === "percent" ? `${N.amount}% off` : `$${(N.amount / 100).toFixed(2)} off`}`), c(""), s == null || s(N);
4792
+ } catch (N) {
4793
+ h(N instanceof Error ? N.message : "Invalid coupon code");
4668
4794
  } finally {
4669
- f(!1);
4795
+ m(!1);
4670
4796
  }
4671
4797
  }
4672
- }, [u, a, l, r]);
4673
- return /* @__PURE__ */ e(H, { appearance: i, children: /* @__PURE__ */ t("div", { className: "ss-card", children: [
4798
+ }, [u, a, d, s]);
4799
+ return /* @__PURE__ */ e(j, { appearance: l, children: /* @__PURE__ */ t("div", { className: "ss-card", children: [
4674
4800
  /* @__PURE__ */ e("h2", { className: "ss-title", children: "Apply coupon" }),
4675
4801
  p && /* @__PURE__ */ e("div", { className: "ss-global-error", children: p }),
4676
- b && /* @__PURE__ */ e("div", { className: "ss-success-msg", children: b }),
4677
- /* @__PURE__ */ t("form", { onSubmit: y, children: [
4802
+ y && /* @__PURE__ */ e("div", { className: "ss-success-msg", children: y }),
4803
+ /* @__PURE__ */ t("form", { onSubmit: v, children: [
4678
4804
  /* @__PURE__ */ t("div", { className: "ss-field", children: [
4679
4805
  /* @__PURE__ */ e("label", { className: "ss-label", htmlFor: "ss-coupon-code", children: "Coupon code" }),
4680
4806
  /* @__PURE__ */ e(
@@ -4684,102 +4810,102 @@ function pe({ customerId: a, portalToken: s, onApplied: r, appearance: o }) {
4684
4810
  className: "ss-input",
4685
4811
  type: "text",
4686
4812
  placeholder: "Enter coupon code",
4687
- value: l,
4688
- onChange: (O) => d(O.target.value),
4813
+ value: d,
4814
+ onChange: (z) => c(z.target.value),
4689
4815
  required: !0
4690
4816
  }
4691
4817
  )
4692
4818
  ] }),
4693
- /* @__PURE__ */ t("button", { type: "submit", className: "ss-btn ss-btn-primary", disabled: c || !l.trim(), children: [
4694
- c && /* @__PURE__ */ e("span", { className: "ss-spinner" }),
4819
+ /* @__PURE__ */ t("button", { type: "submit", className: "ss-btn ss-btn-primary", disabled: o || !d.trim(), children: [
4820
+ o && /* @__PURE__ */ e("span", { className: "ss-spinner" }),
4695
4821
  "Apply"
4696
4822
  ] })
4697
4823
  ] })
4698
4824
  ] }) });
4699
4825
  }
4700
- function he() {
4701
- const { client: a } = A();
4826
+ function be() {
4827
+ const { client: a } = M();
4702
4828
  return { report: a.report };
4703
4829
  }
4704
- function da() {
4705
- const { client: a } = A(), [s, r] = g(null), [o, n] = g(!1), [u, i] = g(null), l = k(async (d) => {
4706
- n(!0), i(null);
4830
+ function ua() {
4831
+ const { client: a } = M(), [r, s] = g(null), [i, n] = g(!1), [u, l] = g(null), d = k(async (c) => {
4832
+ n(!0), l(null);
4707
4833
  try {
4708
- const c = await a.report.executeQuery(d);
4709
- return r(c), c;
4710
- } catch (c) {
4711
- return i(c instanceof Error ? c.message : "Query failed"), null;
4834
+ const o = await a.report.executeQuery(c);
4835
+ return s(o), o;
4836
+ } catch (o) {
4837
+ return l(o instanceof Error ? o.message : "Query failed"), null;
4712
4838
  } finally {
4713
4839
  n(!1);
4714
4840
  }
4715
4841
  }, [a]);
4716
- return { result: s, execute: l, isLoading: o, error: u };
4842
+ return { result: r, execute: d, isLoading: i, error: u };
4717
4843
  }
4718
- function qa(a) {
4719
- const { client: s } = A(), [r, o] = g(null), [n, u] = g(!0), [i, l] = g(null), d = k(async () => {
4720
- u(!0), l(null);
4844
+ function Ya(a) {
4845
+ const { client: r } = M(), [s, i] = g(null), [n, u] = g(!0), [l, d] = g(null), c = k(async () => {
4846
+ u(!0), d(null);
4721
4847
  try {
4722
- const c = await s.report.listQueries(a);
4723
- o(c);
4724
- } catch (c) {
4725
- l(c instanceof Error ? c.message : "Failed to load queries");
4848
+ const o = await r.report.listQueries(a);
4849
+ i(o);
4850
+ } catch (o) {
4851
+ d(o instanceof Error ? o.message : "Failed to load queries");
4726
4852
  } finally {
4727
4853
  u(!1);
4728
4854
  }
4729
- }, [s, a]);
4730
- return V(() => {
4731
- d();
4732
- }, [d]), { queries: (r == null ? void 0 : r.data) ?? [], meta: r == null ? void 0 : r.meta, isLoading: n, error: i, refresh: d };
4855
+ }, [r, a]);
4856
+ return U(() => {
4857
+ c();
4858
+ }, [c]), { queries: (s == null ? void 0 : s.data) ?? [], meta: s == null ? void 0 : s.meta, isLoading: n, error: l, refresh: c };
4733
4859
  }
4734
- function ge(a) {
4735
- const { client: s } = A(), [r, o] = g(null), [n, u] = g(!0), [i, l] = g(null), d = k(async () => {
4736
- u(!0), l(null);
4860
+ function xe(a) {
4861
+ const { client: r } = M(), [s, i] = g(null), [n, u] = g(!0), [l, d] = g(null), c = k(async () => {
4862
+ u(!0), d(null);
4737
4863
  try {
4738
- const c = await s.report.getDashboard(a);
4739
- o(c);
4740
- } catch (c) {
4741
- l(c instanceof Error ? c.message : "Failed to load dashboard");
4864
+ const o = await r.report.getDashboard(a);
4865
+ i(o);
4866
+ } catch (o) {
4867
+ d(o instanceof Error ? o.message : "Failed to load dashboard");
4742
4868
  } finally {
4743
4869
  u(!1);
4744
4870
  }
4745
- }, [s, a]);
4746
- return V(() => {
4747
- d();
4748
- }, [d]), { dashboard: r, isLoading: n, error: i, refresh: d };
4871
+ }, [r, a]);
4872
+ return U(() => {
4873
+ c();
4874
+ }, [c]), { dashboard: s, isLoading: n, error: l, refresh: c };
4749
4875
  }
4750
- function me(a, s, r = "https://api.saas-support.com/v1") {
4751
- const o = G(() => {
4752
- const p = new Q(r, { type: "embedToken", token: a });
4876
+ function ye(a, r, s = "https://api.saas-support.com/v1") {
4877
+ const i = G(() => {
4878
+ const p = new Q(s, { type: "embedToken", token: a });
4753
4879
  return new ta(p);
4754
- }, [a, r]), [n, u] = g(null), [i, l] = g(!0), [d, c] = g(null), f = k(async () => {
4755
- l(!0), c(null);
4880
+ }, [a, s]), [n, u] = g(null), [l, d] = g(!0), [c, o] = g(null), m = k(async () => {
4881
+ d(!0), o(null);
4756
4882
  try {
4757
- const p = await o.getDashboard(s);
4883
+ const p = await i.getDashboard(r);
4758
4884
  u(p);
4759
4885
  } catch (p) {
4760
- c(p instanceof Error ? p.message : "Failed to load dashboard");
4886
+ o(p instanceof Error ? p.message : "Failed to load dashboard");
4761
4887
  } finally {
4762
- l(!1);
4888
+ d(!1);
4763
4889
  }
4764
- }, [o, s]);
4765
- return V(() => {
4766
- f();
4767
- }, [f]), { dashboard: n, reportClient: o, isLoading: i, error: d, refresh: f };
4890
+ }, [i, r]);
4891
+ return U(() => {
4892
+ m();
4893
+ }, [m]), { dashboard: n, reportClient: i, isLoading: l, error: c, refresh: m };
4768
4894
  }
4769
- function fe({ onResult: a, mode: s = "both", placeholder: r, appearance: o }) {
4770
- const { appearance: n } = A(), { execute: u, isLoading: i, error: l } = da(), d = o ?? n, [c, f] = g(""), [p, m] = g(s === "sql" ? "sql" : "nl"), b = k(async (w) => {
4771
- if (w.preventDefault(), !c.trim()) return;
4772
- const O = await u(p === "sql" ? { sql: c } : { naturalLanguage: c });
4773
- O && (a == null || a(O));
4774
- }, [c, p, u, a]);
4775
- return /* @__PURE__ */ e(H, { appearance: d, children: /* @__PURE__ */ t("div", { className: "ss-card ss-card-wide", children: [
4776
- s === "both" && /* @__PURE__ */ t("div", { className: "ss-tab-group ss-tab-group-sm", children: [
4895
+ function ve({ onResult: a, mode: r = "both", placeholder: s, appearance: i }) {
4896
+ const { appearance: n } = M(), { execute: u, isLoading: l, error: d } = ua(), c = i ?? n, [o, m] = g(""), [p, h] = g(r === "sql" ? "sql" : "nl"), y = k(async (x) => {
4897
+ if (x.preventDefault(), !o.trim()) return;
4898
+ const z = await u(p === "sql" ? { sql: o } : { naturalLanguage: o });
4899
+ z && (a == null || a(z));
4900
+ }, [o, p, u, a]);
4901
+ return /* @__PURE__ */ e(j, { appearance: c, children: /* @__PURE__ */ t("div", { className: "ss-card ss-card-wide", children: [
4902
+ r === "both" && /* @__PURE__ */ t("div", { className: "ss-tab-group ss-tab-group-sm", children: [
4777
4903
  /* @__PURE__ */ e(
4778
4904
  "button",
4779
4905
  {
4780
4906
  type: "button",
4781
4907
  className: `ss-tab ${p === "nl" ? "ss-tab-active" : ""}`,
4782
- onClick: () => m("nl"),
4908
+ onClick: () => h("nl"),
4783
4909
  children: "Natural Language"
4784
4910
  }
4785
4911
  ),
@@ -4788,228 +4914,228 @@ function fe({ onResult: a, mode: s = "both", placeholder: r, appearance: o }) {
4788
4914
  {
4789
4915
  type: "button",
4790
4916
  className: `ss-tab ${p === "sql" ? "ss-tab-active" : ""}`,
4791
- onClick: () => m("sql"),
4917
+ onClick: () => h("sql"),
4792
4918
  children: "SQL"
4793
4919
  }
4794
4920
  )
4795
4921
  ] }),
4796
- l && /* @__PURE__ */ e("div", { className: "ss-global-error", children: l }),
4797
- /* @__PURE__ */ t("form", { onSubmit: b, children: [
4922
+ d && /* @__PURE__ */ e("div", { className: "ss-global-error", children: d }),
4923
+ /* @__PURE__ */ t("form", { onSubmit: y, children: [
4798
4924
  /* @__PURE__ */ e("div", { className: "ss-field", children: /* @__PURE__ */ e(
4799
4925
  "textarea",
4800
4926
  {
4801
4927
  className: "ss-input ss-query-textarea",
4802
- placeholder: r ?? (p === "sql" ? "SELECT ..." : "Ask a question about your data..."),
4803
- value: c,
4804
- onChange: (w) => f(w.target.value),
4928
+ placeholder: s ?? (p === "sql" ? "SELECT ..." : "Ask a question about your data..."),
4929
+ value: o,
4930
+ onChange: (x) => m(x.target.value),
4805
4931
  rows: 3
4806
4932
  }
4807
4933
  ) }),
4808
- /* @__PURE__ */ t("button", { type: "submit", className: "ss-btn ss-btn-primary", disabled: i || !c.trim(), children: [
4809
- i && /* @__PURE__ */ e("span", { className: "ss-spinner" }),
4934
+ /* @__PURE__ */ t("button", { type: "submit", className: "ss-btn ss-btn-primary", disabled: l || !o.trim(), children: [
4935
+ l && /* @__PURE__ */ e("span", { className: "ss-spinner" }),
4810
4936
  "Run query"
4811
4937
  ] })
4812
4938
  ] })
4813
4939
  ] }) });
4814
4940
  }
4815
- function Wa({ columns: a, rows: s, sortable: r = !0, maxRows: o, appearance: n }) {
4816
- const { appearance: u } = A(), i = n ?? u, [l, d] = g(null), [c, f] = g("asc"), p = G(() => l ? [...s].sort((y, O) => {
4817
- const h = y[l], N = O[l];
4818
- if (h == null && N == null) return 0;
4819
- if (h == null) return 1;
4820
- if (N == null) return -1;
4821
- if (typeof h == "number" && typeof N == "number")
4822
- return c === "asc" ? h - N : N - h;
4823
- const C = String(h), P = String(N);
4824
- return c === "asc" ? C.localeCompare(P) : P.localeCompare(C);
4825
- }) : s, [s, l, c]), m = o ? p.slice(0, o) : p, b = (y) => {
4826
- r && (l === y ? f((O) => O === "asc" ? "desc" : "asc") : (d(y), f("asc")));
4941
+ function Ja({ columns: a, rows: r, sortable: s = !0, maxRows: i, appearance: n }) {
4942
+ const { appearance: u } = M(), l = n ?? u, [d, c] = g(null), [o, m] = g("asc"), p = G(() => d ? [...r].sort((v, z) => {
4943
+ const N = v[d], O = z[d];
4944
+ if (N == null && O == null) return 0;
4945
+ if (N == null) return 1;
4946
+ if (O == null) return -1;
4947
+ if (typeof N == "number" && typeof O == "number")
4948
+ return o === "asc" ? N - O : O - N;
4949
+ const C = String(N), f = String(O);
4950
+ return o === "asc" ? C.localeCompare(f) : f.localeCompare(C);
4951
+ }) : r, [r, d, o]), h = i ? p.slice(0, i) : p, y = (v) => {
4952
+ s && (d === v ? m((z) => z === "asc" ? "desc" : "asc") : (c(v), m("asc")));
4827
4953
  };
4828
- function w(y) {
4829
- return y == null ? "" : typeof y == "object" ? JSON.stringify(y) : String(y);
4954
+ function x(v) {
4955
+ return v == null ? "" : typeof v == "object" ? JSON.stringify(v) : String(v);
4830
4956
  }
4831
- return /* @__PURE__ */ e(H, { appearance: i, children: /* @__PURE__ */ t("div", { className: "ss-table-container", children: [
4957
+ return /* @__PURE__ */ e(j, { appearance: l, children: /* @__PURE__ */ t("div", { className: "ss-table-container", children: [
4832
4958
  /* @__PURE__ */ t("table", { className: "ss-table", children: [
4833
- /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ e("tr", { children: a.map((y) => /* @__PURE__ */ t(
4959
+ /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ e("tr", { children: a.map((v) => /* @__PURE__ */ t(
4834
4960
  "th",
4835
4961
  {
4836
- className: `ss-th ${r ? "ss-th-sortable" : ""} ${l === y ? c === "asc" ? "ss-sorted-asc" : "ss-sorted-desc" : ""}`,
4837
- onClick: () => b(y),
4962
+ className: `ss-th ${s ? "ss-th-sortable" : ""} ${d === v ? o === "asc" ? "ss-sorted-asc" : "ss-sorted-desc" : ""}`,
4963
+ onClick: () => y(v),
4838
4964
  children: [
4839
- y,
4840
- l === y && /* @__PURE__ */ e("span", { className: "ss-sort-indicator", children: c === "asc" ? " ▲" : " ▼" })
4965
+ v,
4966
+ d === v && /* @__PURE__ */ e("span", { className: "ss-sort-indicator", children: o === "asc" ? " ▲" : " ▼" })
4841
4967
  ]
4842
4968
  },
4843
- y
4969
+ v
4844
4970
  )) }) }),
4845
- /* @__PURE__ */ e("tbody", { children: m.map((y, O) => /* @__PURE__ */ e("tr", { className: "ss-tr", children: a.map((h) => /* @__PURE__ */ e("td", { className: "ss-td", children: w(y[h]) }, h)) }, O)) })
4971
+ /* @__PURE__ */ e("tbody", { children: h.map((v, z) => /* @__PURE__ */ e("tr", { className: "ss-tr", children: a.map((N) => /* @__PURE__ */ e("td", { className: "ss-td", children: x(v[N]) }, N)) }, z)) })
4846
4972
  ] }),
4847
- o && s.length > o && /* @__PURE__ */ t("div", { className: "ss-table-footer", children: [
4973
+ i && r.length > i && /* @__PURE__ */ t("div", { className: "ss-table-footer", children: [
4848
4974
  "Showing ",
4849
- o,
4975
+ i,
4850
4976
  " of ",
4851
- s.length,
4977
+ r.length,
4852
4978
  " rows"
4853
4979
  ] })
4854
4980
  ] }) });
4855
4981
  }
4856
- function _a(a, s = "#6366f1") {
4857
- const r = parseInt(s.replace("#", "").slice(0, 2), 16), o = [];
4982
+ function Qa(a, r = "#6366f1") {
4983
+ const s = parseInt(r.replace("#", "").slice(0, 2), 16), i = [];
4858
4984
  for (let n = 0; n < a; n++) {
4859
- const u = (r + n * Math.floor(360 / Math.max(a, 1))) % 360;
4860
- o.push(`hsl(${u}, 65%, 55%)`);
4985
+ const u = (s + n * Math.floor(360 / Math.max(a, 1))) % 360;
4986
+ i.push(`hsl(${u}, 65%, 55%)`);
4861
4987
  }
4862
- return o;
4988
+ return i;
4863
4989
  }
4864
- function Ga({ labels: a, values: s, w: r, h: o, colors: n }) {
4865
- const u = Math.max(...s, 1), i = 40, l = r - i * 2, d = o - i * 2, c = Math.max(1, l / a.length - 4);
4990
+ function Za({ labels: a, values: r, w: s, h: i, colors: n }) {
4991
+ const u = Math.max(...r, 1), l = 40, d = s - l * 2, c = i - l * 2, o = Math.max(1, d / a.length - 4);
4866
4992
  return /* @__PURE__ */ t("g", { children: [
4867
- /* @__PURE__ */ e("line", { x1: i, y1: o - i, x2: r - i, y2: o - i, stroke: "#ccc", strokeWidth: 1 }),
4868
- s.map((f, p) => {
4869
- const m = f / u * d, b = i + l / a.length * p + 2, w = o - i - m;
4993
+ /* @__PURE__ */ e("line", { x1: l, y1: i - l, x2: s - l, y2: i - l, stroke: "#ccc", strokeWidth: 1 }),
4994
+ r.map((m, p) => {
4995
+ const h = m / u * c, y = l + d / a.length * p + 2, x = i - l - h;
4870
4996
  return /* @__PURE__ */ t("g", { children: [
4871
- /* @__PURE__ */ e("rect", { x: b, y: w, width: c, height: m, fill: n[p % n.length], rx: 2 }),
4872
- /* @__PURE__ */ e("text", { x: b + c / 2, y: o - i + 14, textAnchor: "middle", fontSize: 10, fill: "#666", children: a[p].length > 8 ? a[p].slice(0, 8) + "..." : a[p] })
4997
+ /* @__PURE__ */ e("rect", { x: y, y: x, width: o, height: h, fill: n[p % n.length], rx: 2 }),
4998
+ /* @__PURE__ */ e("text", { x: y + o / 2, y: i - l + 14, textAnchor: "middle", fontSize: 10, fill: "#666", children: a[p].length > 8 ? a[p].slice(0, 8) + "..." : a[p] })
4873
4999
  ] }, p);
4874
5000
  })
4875
5001
  ] });
4876
5002
  }
4877
- function Ya({ labels: a, values: s, w: r, h: o, colors: n }) {
4878
- const u = Math.max(...s, 1), i = 40, l = r - i * 2, d = o - i * 2, c = a.length > 1 ? l / (a.length - 1) : 0, f = s.map((p, m) => {
4879
- const b = i + c * m, w = o - i - p / u * d;
4880
- return `${b},${w}`;
5003
+ function Ka({ labels: a, values: r, w: s, h: i, colors: n }) {
5004
+ const u = Math.max(...r, 1), l = 40, d = s - l * 2, c = i - l * 2, o = a.length > 1 ? d / (a.length - 1) : 0, m = r.map((p, h) => {
5005
+ const y = l + o * h, x = i - l - p / u * c;
5006
+ return `${y},${x}`;
4881
5007
  });
4882
5008
  return /* @__PURE__ */ t("g", { children: [
4883
5009
  [0.25, 0.5, 0.75, 1].map((p) => {
4884
- const m = o - i - p * d;
4885
- return /* @__PURE__ */ e("line", { x1: i, y1: m, x2: r - i, y2: m, stroke: "#eee", strokeWidth: 1 }, p);
5010
+ const h = i - l - p * c;
5011
+ return /* @__PURE__ */ e("line", { x1: l, y1: h, x2: s - l, y2: h, stroke: "#eee", strokeWidth: 1 }, p);
4886
5012
  }),
4887
- /* @__PURE__ */ e("polyline", { points: f.join(" "), fill: "none", stroke: n[0], strokeWidth: 2 }),
4888
- s.map((p, m) => {
4889
- const b = i + c * m, w = o - i - p / u * d;
4890
- return /* @__PURE__ */ e("circle", { cx: b, cy: w, r: 4, fill: n[0] }, m);
5013
+ /* @__PURE__ */ e("polyline", { points: m.join(" "), fill: "none", stroke: n[0], strokeWidth: 2 }),
5014
+ r.map((p, h) => {
5015
+ const y = l + o * h, x = i - l - p / u * c;
5016
+ return /* @__PURE__ */ e("circle", { cx: y, cy: x, r: 4, fill: n[0] }, h);
4891
5017
  })
4892
5018
  ] });
4893
5019
  }
4894
- function Ja({ labels: a, values: s, w: r, h: o, colors: n }) {
4895
- const u = s.reduce((m, b) => m + b, 0) || 1, i = r / 2, l = o / 2 - 20, d = Math.min(r, o) / 2 - 40, c = 2 * Math.PI * d;
4896
- let f = 0;
4897
- const p = s.map((m, b) => {
4898
- const w = m / u, y = w * c, O = { dash: y, offset: f, color: n[b % n.length], label: a[b], pct: w };
4899
- return f += y, O;
5020
+ function Xa({ labels: a, values: r, w: s, h: i, colors: n }) {
5021
+ const u = r.reduce((h, y) => h + y, 0) || 1, l = s / 2, d = i / 2 - 20, c = Math.min(s, i) / 2 - 40, o = 2 * Math.PI * c;
5022
+ let m = 0;
5023
+ const p = r.map((h, y) => {
5024
+ const x = h / u, v = x * o, z = { dash: v, offset: m, color: n[y % n.length], label: a[y], pct: x };
5025
+ return m += v, z;
4900
5026
  });
4901
5027
  return /* @__PURE__ */ t("g", { children: [
4902
- p.map((m, b) => /* @__PURE__ */ e(
5028
+ p.map((h, y) => /* @__PURE__ */ e(
4903
5029
  "circle",
4904
5030
  {
4905
- cx: i,
4906
- cy: l,
4907
- r: d,
5031
+ cx: l,
5032
+ cy: d,
5033
+ r: c,
4908
5034
  fill: "none",
4909
- stroke: m.color,
4910
- strokeWidth: d * 0.6,
4911
- strokeDasharray: `${m.dash} ${c - m.dash}`,
4912
- strokeDashoffset: -m.offset,
4913
- transform: `rotate(-90 ${i} ${l})`
5035
+ stroke: h.color,
5036
+ strokeWidth: c * 0.6,
5037
+ strokeDasharray: `${h.dash} ${o - h.dash}`,
5038
+ strokeDashoffset: -h.offset,
5039
+ transform: `rotate(-90 ${l} ${d})`
4914
5040
  },
4915
- b
5041
+ y
4916
5042
  )),
4917
- /* @__PURE__ */ e("g", { transform: `translate(${i - a.length * 30}, ${o - 20})`, children: p.slice(0, 6).map((m, b) => /* @__PURE__ */ t("g", { transform: `translate(${b * 60}, 0)`, children: [
4918
- /* @__PURE__ */ e("rect", { width: 10, height: 10, fill: m.color, rx: 2 }),
4919
- /* @__PURE__ */ e("text", { x: 14, y: 9, fontSize: 9, fill: "#666", children: m.label.length > 6 ? m.label.slice(0, 6) + ".." : m.label })
4920
- ] }, b)) })
5043
+ /* @__PURE__ */ e("g", { transform: `translate(${l - a.length * 30}, ${i - 20})`, children: p.slice(0, 6).map((h, y) => /* @__PURE__ */ t("g", { transform: `translate(${y * 60}, 0)`, children: [
5044
+ /* @__PURE__ */ e("rect", { width: 10, height: 10, fill: h.color, rx: 2 }),
5045
+ /* @__PURE__ */ e("text", { x: 14, y: 9, fontSize: 9, fill: "#666", children: h.label.length > 6 ? h.label.slice(0, 6) + ".." : h.label })
5046
+ ] }, y)) })
4921
5047
  ] });
4922
5048
  }
4923
- function Qa({ type: a, data: s, title: r, width: o = 400, height: n = 300, appearance: u }) {
4924
- const { appearance: i } = A(), l = u ?? i, d = G(() => _a(s.labels.length), [s.labels.length]);
4925
- return /* @__PURE__ */ e(H, { appearance: l, children: /* @__PURE__ */ t("div", { className: "ss-chart-container", children: [
4926
- r && /* @__PURE__ */ e("h3", { className: "ss-chart-title", children: r }),
4927
- /* @__PURE__ */ t("svg", { viewBox: `0 0 ${o} ${n}`, width: "100%", style: { maxWidth: o }, children: [
4928
- a === "bar" && /* @__PURE__ */ e(Ga, { labels: s.labels, values: s.values, w: o, h: n, colors: d }),
4929
- a === "line" && /* @__PURE__ */ e(Ya, { labels: s.labels, values: s.values, w: o, h: n, colors: d }),
4930
- a === "pie" && /* @__PURE__ */ e(Ja, { labels: s.labels, values: s.values, w: o, h: n, colors: d })
5049
+ function ae({ type: a, data: r, title: s, width: i = 400, height: n = 300, appearance: u }) {
5050
+ const { appearance: l } = M(), d = u ?? l, c = G(() => Qa(r.labels.length), [r.labels.length]);
5051
+ return /* @__PURE__ */ e(j, { appearance: d, children: /* @__PURE__ */ t("div", { className: "ss-chart-container", children: [
5052
+ s && /* @__PURE__ */ e("h3", { className: "ss-chart-title", children: s }),
5053
+ /* @__PURE__ */ t("svg", { viewBox: `0 0 ${i} ${n}`, width: "100%", style: { maxWidth: i }, children: [
5054
+ a === "bar" && /* @__PURE__ */ e(Za, { labels: r.labels, values: r.values, w: i, h: n, colors: c }),
5055
+ a === "line" && /* @__PURE__ */ e(Ka, { labels: r.labels, values: r.values, w: i, h: n, colors: c }),
5056
+ a === "pie" && /* @__PURE__ */ e(Xa, { labels: r.labels, values: r.values, w: i, h: n, colors: c })
4931
5057
  ] })
4932
5058
  ] }) });
4933
5059
  }
4934
- function be({ dashboardId: a, embedToken: s, baseUrl: r, refreshInterval: o, appearance: n }) {
4935
- const u = A(), i = n ?? (u == null ? void 0 : u.appearance), l = G(() => {
4936
- if (s) {
4937
- const h = r ?? "https://api.saas-support.com/v1", N = new Q(h, { type: "embedToken", token: s });
4938
- return new ta(N);
5060
+ function we({ dashboardId: a, embedToken: r, baseUrl: s, refreshInterval: i, appearance: n }) {
5061
+ const u = M(), l = n ?? (u == null ? void 0 : u.appearance), d = G(() => {
5062
+ if (r) {
5063
+ const N = s ?? "https://api.saas-support.com/v1", O = new Q(N, { type: "embedToken", token: r });
5064
+ return new ta(O);
4939
5065
  }
4940
5066
  return u.client.report;
4941
- }, [s, r, u]), [d, c] = g([]), [f, p] = g({}), [m, b] = g(!0), [w, y] = g(null), O = k(async () => {
4942
- b(!0), y(null);
5067
+ }, [r, s, u]), [c, o] = g([]), [m, p] = g({}), [h, y] = g(!0), [x, v] = g(null), z = k(async () => {
5068
+ y(!0), v(null);
4943
5069
  try {
4944
- const h = await l.getDashboard(a), N = JSON.parse(h.layoutJson || "[]");
4945
- c(N);
5070
+ const N = await d.getDashboard(a), O = JSON.parse(N.layoutJson || "[]");
5071
+ o(O);
4946
5072
  const C = {};
4947
- for (const P of N)
5073
+ for (const f of O)
4948
5074
  try {
4949
- const I = await l.listQueries({ search: P.queryId, perPage: 1 });
4950
- if (I.data.length > 0 && I.data[0].generatedSql) {
4951
- const B = await l.executeQuery({ sql: I.data[0].generatedSql });
4952
- C[P.queryId] = B;
5075
+ const P = await d.listQueries({ search: f.queryId, perPage: 1 });
5076
+ if (P.data.length > 0 && P.data[0].generatedSql) {
5077
+ const I = await d.executeQuery({ sql: P.data[0].generatedSql });
5078
+ C[f.queryId] = I;
4953
5079
  }
4954
5080
  } catch {
4955
5081
  }
4956
5082
  p(C);
4957
- } catch (h) {
4958
- y(h instanceof Error ? h.message : "Failed to load dashboard");
5083
+ } catch (N) {
5084
+ v(N instanceof Error ? N.message : "Failed to load dashboard");
4959
5085
  } finally {
4960
- b(!1);
4961
- }
4962
- }, [l, a]);
4963
- return V(() => {
4964
- O();
4965
- }, [O]), V(() => {
4966
- if (!o || o <= 0) return;
4967
- const h = setInterval(O, o * 1e3);
4968
- return () => clearInterval(h);
4969
- }, [o, O]), /* @__PURE__ */ e(H, { appearance: i, children: /* @__PURE__ */ t("div", { className: "ss-dashboard-grid", children: [
4970
- m && /* @__PURE__ */ t("div", { className: "ss-loading", children: [
5086
+ y(!1);
5087
+ }
5088
+ }, [d, a]);
5089
+ return U(() => {
5090
+ z();
5091
+ }, [z]), U(() => {
5092
+ if (!i || i <= 0) return;
5093
+ const N = setInterval(z, i * 1e3);
5094
+ return () => clearInterval(N);
5095
+ }, [i, z]), /* @__PURE__ */ e(j, { appearance: l, children: /* @__PURE__ */ t("div", { className: "ss-dashboard-grid", children: [
5096
+ h && /* @__PURE__ */ t("div", { className: "ss-loading", children: [
4971
5097
  /* @__PURE__ */ e("span", { className: "ss-spinner" }),
4972
5098
  " Loading dashboard..."
4973
5099
  ] }),
4974
- w && /* @__PURE__ */ e("div", { className: "ss-global-error", children: w }),
4975
- !m && d.map((h, N) => {
4976
- const C = f[h.queryId];
5100
+ x && /* @__PURE__ */ e("div", { className: "ss-global-error", children: x }),
5101
+ !h && c.map((N, O) => {
5102
+ const C = m[N.queryId];
4977
5103
  if (!C) return null;
4978
- const P = C.columns.length >= 2 ? {
4979
- labels: C.rows.map((I) => String(I[C.columns[0]] ?? "")),
4980
- values: C.rows.map((I) => Number(I[C.columns[1]] ?? 0))
5104
+ const f = C.columns.length >= 2 ? {
5105
+ labels: C.rows.map((P) => String(P[C.columns[0]] ?? "")),
5106
+ values: C.rows.map((P) => Number(P[C.columns[1]] ?? 0))
4981
5107
  } : { labels: [], values: [] };
4982
5108
  return /* @__PURE__ */ t("div", { className: "ss-widget", children: [
4983
- h.title && /* @__PURE__ */ e("h4", { className: "ss-widget-header", children: h.title }),
4984
- h.chartType === "table" ? /* @__PURE__ */ e(Wa, { columns: C.columns, rows: C.rows, maxRows: 50 }) : /* @__PURE__ */ e(
4985
- Qa,
5109
+ N.title && /* @__PURE__ */ e("h4", { className: "ss-widget-header", children: N.title }),
5110
+ N.chartType === "table" ? /* @__PURE__ */ e(Ja, { columns: C.columns, rows: C.rows, maxRows: 50 }) : /* @__PURE__ */ e(
5111
+ ae,
4986
5112
  {
4987
- type: h.chartType || "bar",
4988
- data: P,
4989
- width: h.w,
4990
- height: h.h
5113
+ type: N.chartType || "bar",
5114
+ data: f,
5115
+ width: N.w,
5116
+ height: N.h
4991
5117
  }
4992
5118
  )
4993
- ] }, N);
5119
+ ] }, O);
4994
5120
  })
4995
5121
  ] }) });
4996
5122
  }
4997
- function Za(a) {
5123
+ function ee(a) {
4998
5124
  return new Date(a).toLocaleDateString("en-US", { year: "numeric", month: "short", day: "numeric" });
4999
5125
  }
5000
- function xe({ onSelectQuery: a, onRunQuery: s, appearance: r }) {
5001
- const { appearance: o } = A(), { queries: n, isLoading: u, error: i } = qa(), { execute: l, isLoading: d } = da(), c = r ?? o, f = k(async (p) => {
5126
+ function Ne({ onSelectQuery: a, onRunQuery: r, appearance: s }) {
5127
+ const { appearance: i } = M(), { queries: n, isLoading: u, error: l } = Ya(), { execute: d, isLoading: c } = ua(), o = s ?? i, m = k(async (p) => {
5002
5128
  if (!p.generatedSql) return;
5003
- const m = await l({ sql: p.generatedSql });
5004
- m && (s == null || s(m));
5005
- }, [l, s]);
5006
- return /* @__PURE__ */ e(H, { appearance: c, children: /* @__PURE__ */ t("div", { className: "ss-card ss-card-wide", children: [
5129
+ const h = await d({ sql: p.generatedSql });
5130
+ h && (r == null || r(h));
5131
+ }, [d, r]);
5132
+ return /* @__PURE__ */ e(j, { appearance: o, children: /* @__PURE__ */ t("div", { className: "ss-card ss-card-wide", children: [
5007
5133
  /* @__PURE__ */ e("h2", { className: "ss-title", children: "Saved Queries" }),
5008
5134
  u && /* @__PURE__ */ t("div", { className: "ss-loading", children: [
5009
5135
  /* @__PURE__ */ e("span", { className: "ss-spinner" }),
5010
5136
  " Loading..."
5011
5137
  ] }),
5012
- i && /* @__PURE__ */ e("div", { className: "ss-global-error", children: i }),
5138
+ l && /* @__PURE__ */ e("div", { className: "ss-global-error", children: l }),
5013
5139
  !u && n.length === 0 && /* @__PURE__ */ e("p", { className: "ss-empty", children: "No saved queries." }),
5014
5140
  !u && n.map((p) => /* @__PURE__ */ t(
5015
5141
  "div",
@@ -5023,17 +5149,17 @@ function xe({ onSelectQuery: a, onRunQuery: s, appearance: r }) {
5023
5149
  ] }),
5024
5150
  p.naturalLanguage && /* @__PURE__ */ e("p", { className: "ss-saved-query-desc", children: p.naturalLanguage }),
5025
5151
  /* @__PURE__ */ t("div", { className: "ss-saved-query-footer", children: [
5026
- /* @__PURE__ */ e("span", { className: "ss-saved-query-date", children: Za(p.createdAt) }),
5152
+ /* @__PURE__ */ e("span", { className: "ss-saved-query-date", children: ee(p.createdAt) }),
5027
5153
  /* @__PURE__ */ e(
5028
5154
  "button",
5029
5155
  {
5030
5156
  type: "button",
5031
5157
  className: "ss-btn ss-btn-sm ss-btn-primary",
5032
- disabled: d || !p.generatedSql,
5033
- onClick: (m) => {
5034
- m.stopPropagation(), f(p);
5158
+ disabled: c || !p.generatedSql,
5159
+ onClick: (h) => {
5160
+ h.stopPropagation(), m(p);
5035
5161
  },
5036
- children: d ? /* @__PURE__ */ e("span", { className: "ss-spinner" }) : "Run"
5162
+ children: c ? /* @__PURE__ */ e("span", { className: "ss-spinner" }) : "Run"
5037
5163
  }
5038
5164
  )
5039
5165
  ] })
@@ -5043,107 +5169,108 @@ function xe({ onSelectQuery: a, onRunQuery: s, appearance: r }) {
5043
5169
  ))
5044
5170
  ] }) });
5045
5171
  }
5046
- function ye({ embedToken: a, dashboardId: s, baseUrl: r = "https://api.saas-support.com/v1", refreshInterval: o, appearance: n }) {
5172
+ function Se({ embedToken: a, dashboardId: r, baseUrl: s = "https://api.saas-support.com/v1", refreshInterval: i, appearance: n }) {
5047
5173
  const u = G(() => {
5048
- const y = new Q(r, { type: "embedToken", token: a });
5049
- return new ta(y);
5050
- }, [a, r]), [i, l] = g([]), [d, c] = g(!0), [f, p] = g(null), m = G(() => aa(n), [n]), b = G(() => ea(m), [m]), w = k(async () => {
5051
- c(!0), p(null);
5174
+ const v = new Q(s, { type: "embedToken", token: a });
5175
+ return new ta(v);
5176
+ }, [a, s]), [l, d] = g([]), [c, o] = g(!0), [m, p] = g(null), h = G(() => aa(n), [n]), y = G(() => ea(h), [h]), x = k(async () => {
5177
+ o(!0), p(null);
5052
5178
  try {
5053
- const y = await u.getDashboard(s), O = JSON.parse(y.layoutJson || "[]"), h = await Promise.all(
5054
- O.map(async (N) => {
5179
+ const v = await u.getDashboard(r), z = JSON.parse(v.layoutJson || "[]"), N = await Promise.all(
5180
+ z.map(async (O) => {
5055
5181
  try {
5056
- const C = await u.listQueries({ search: N.queryId, perPage: 1 });
5182
+ const C = await u.listQueries({ search: O.queryId, perPage: 1 });
5057
5183
  if (C.data.length > 0 && C.data[0].generatedSql) {
5058
- const P = await u.executeQuery({ sql: C.data[0].generatedSql });
5059
- return { ...N, result: P };
5184
+ const f = await u.executeQuery({ sql: C.data[0].generatedSql });
5185
+ return { ...O, result: f };
5060
5186
  }
5061
5187
  } catch {
5062
5188
  }
5063
- return N;
5189
+ return O;
5064
5190
  })
5065
5191
  );
5066
- l(h);
5067
- } catch (y) {
5068
- p(y instanceof Error ? y.message : "Failed to load dashboard");
5192
+ d(N);
5193
+ } catch (v) {
5194
+ p(v instanceof Error ? v.message : "Failed to load dashboard");
5069
5195
  } finally {
5070
- c(!1);
5071
- }
5072
- }, [u, s]);
5073
- return V(() => {
5074
- w();
5075
- }, [w]), V(() => {
5076
- if (!o || o <= 0) return;
5077
- const y = setInterval(w, o * 1e3);
5078
- return () => clearInterval(y);
5079
- }, [o, w]), /* @__PURE__ */ e(
5196
+ o(!1);
5197
+ }
5198
+ }, [u, r]);
5199
+ return U(() => {
5200
+ x();
5201
+ }, [x]), U(() => {
5202
+ if (!i || i <= 0) return;
5203
+ const v = setInterval(x, i * 1e3);
5204
+ return () => clearInterval(v);
5205
+ }, [i, x]), /* @__PURE__ */ e(
5080
5206
  "div",
5081
5207
  {
5082
- ref: (y) => {
5083
- if (!y || y.shadowRoot) return;
5084
- const O = y.attachShadow({ mode: "open" }), h = document.createElement("style");
5085
- h.textContent = b, O.appendChild(h);
5086
- const N = document.createElement("div");
5087
- O.appendChild(N);
5208
+ ref: (v) => {
5209
+ if (!v || v.shadowRoot) return;
5210
+ const z = v.attachShadow({ mode: "open" }), N = document.createElement("style");
5211
+ N.textContent = y, z.appendChild(N);
5212
+ const O = document.createElement("div");
5213
+ z.appendChild(O);
5088
5214
  },
5089
5215
  style: { display: "contents" },
5090
5216
  children: /* @__PURE__ */ t("div", { className: "ss-dashboard-grid", children: [
5091
- d && /* @__PURE__ */ e("div", { className: "ss-loading", children: "Loading dashboard..." }),
5092
- f && /* @__PURE__ */ e("div", { className: "ss-global-error", children: f }),
5093
- !d && i.map((y, O) => {
5094
- if (!y.result) return null;
5095
- const { columns: h, rows: N } = y.result;
5217
+ c && /* @__PURE__ */ e("div", { className: "ss-loading", children: "Loading dashboard..." }),
5218
+ m && /* @__PURE__ */ e("div", { className: "ss-global-error", children: m }),
5219
+ !c && l.map((v, z) => {
5220
+ if (!v.result) return null;
5221
+ const { columns: N, rows: O } = v.result;
5096
5222
  return /* @__PURE__ */ t("div", { className: "ss-widget", children: [
5097
- y.title && /* @__PURE__ */ e("h4", { className: "ss-widget-header", children: y.title }),
5223
+ v.title && /* @__PURE__ */ e("h4", { className: "ss-widget-header", children: v.title }),
5098
5224
  /* @__PURE__ */ t("table", { className: "ss-table", children: [
5099
- /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ e("tr", { children: h.map((C) => /* @__PURE__ */ e("th", { className: "ss-th", children: C }, C)) }) }),
5100
- /* @__PURE__ */ e("tbody", { children: N.slice(0, 50).map((C, P) => /* @__PURE__ */ e("tr", { className: "ss-tr", children: h.map((I) => /* @__PURE__ */ e("td", { className: "ss-td", children: String(C[I] ?? "") }, I)) }, P)) })
5225
+ /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ e("tr", { children: N.map((C) => /* @__PURE__ */ e("th", { className: "ss-th", children: C }, C)) }) }),
5226
+ /* @__PURE__ */ e("tbody", { children: O.slice(0, 50).map((C, f) => /* @__PURE__ */ e("tr", { className: "ss-tr", children: N.map((P) => /* @__PURE__ */ e("td", { className: "ss-td", children: String(C[P] ?? "") }, P)) }, f)) })
5101
5227
  ] })
5102
- ] }, O);
5228
+ ] }, z);
5103
5229
  })
5104
5230
  ] })
5105
5231
  }
5106
5232
  );
5107
5233
  }
5108
5234
  export {
5109
- Qa as Chart,
5110
- pe as CouponInput,
5111
- be as DashboardView,
5112
- Wa as DataTable,
5113
- Ha as InvoiceHistory,
5114
- le as OrgSwitcher,
5115
- ue as PaymentPortal,
5116
- ce as PricingTable,
5117
- fe as QueryInput,
5118
- ye as ReportEmbed,
5119
- ra as SaaSContext,
5120
- Ne as SaaSError,
5121
- te as SaaSProvider,
5122
- ba as SaaSSupport,
5123
- xe as SavedQueryList,
5124
- Pa as SettingsPanel,
5125
- re as SignIn,
5126
- ne as SignUp,
5127
- Ma as SubscriptionStatus,
5128
- ja as UsageDisplay,
5129
- oe as UserButton,
5130
- ie as UserProfile,
5131
- xa as isMfaRequired,
5235
+ ae as Chart,
5236
+ fe as CouponInput,
5237
+ we as DashboardView,
5238
+ Ja as DataTable,
5239
+ _a as InvoiceHistory,
5240
+ pe as OrgSwitcher,
5241
+ me as PaymentPortal,
5242
+ he as PricingTable,
5243
+ ve as QueryInput,
5244
+ Se as ReportEmbed,
5245
+ na as SaaSContext,
5246
+ Ce as SaaSError,
5247
+ oe as SaaSProvider,
5248
+ va as SaaSSupport,
5249
+ Ne as SavedQueryList,
5250
+ Ia as SettingsPanel,
5251
+ le as SignIn,
5252
+ ce as SignUp,
5253
+ Ha as SubscriptionStatus,
5254
+ Ga as UsageDisplay,
5255
+ de as UserButton,
5256
+ ue as UserProfile,
5257
+ wa as isMfaRequired,
5132
5258
  sa as useAuth,
5133
- de as useBilling,
5134
- ge as useDashboard,
5135
- Ca as useDeleteAccount,
5136
- me as useEmbedDashboard,
5137
- Aa as useInvoices,
5259
+ ge as useBilling,
5260
+ xe as useDashboard,
5261
+ Oa as useDeleteAccount,
5262
+ ye as useEmbedDashboard,
5263
+ ra as useInvites,
5264
+ Va as useInvoices,
5138
5265
  Y as useOrg,
5139
- oa as useProfile,
5140
- da as useQuery,
5141
- he as useReport,
5142
- A as useSaaSContext,
5143
- qa as useSavedQueries,
5144
- na as useSignIn,
5145
- ka as useSignUp,
5146
- La as useSubscription,
5147
- Da as useUsage,
5148
- se as useUser
5266
+ ia as useProfile,
5267
+ ua as useQuery,
5268
+ be as useReport,
5269
+ M as useSaaSContext,
5270
+ Ya as useSavedQueries,
5271
+ oa as useSignIn,
5272
+ Pa as useSignUp,
5273
+ Ma as useSubscription,
5274
+ Ua as useUsage,
5275
+ ie as useUser
5149
5276
  };