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