@saas-support/react 0.7.2 → 0.7.5

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