@saas-support/react 0.7.5 → 0.8.1

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