@saas-support/react 0.6.2 → 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.cjs CHANGED
@@ -1,8 +1,8 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),t=require("react"),U=require("./index.cjs"),vs=require("react-dom"),J=t.createContext(null);function E(){const a=t.useContext(J);if(!a)throw new Error("useSaaSContext must be used within a <SaaSProvider>");return a}function js({publishableKey:a,apiKey:r,baseUrl:e,appearance:o,children:n}){const[u]=t.useState(()=>new U.SaaSSupport({publishableKey:a,apiKey:r,baseUrl:e})),[l,c]=t.useState(null),[d,i]=t.useState(!1),[x,p]=t.useState(null);return t.useEffect(()=>{let g=!1;u.load().then(async()=>{if(g)return;const v=await u.auth.getUser(),b=await u.auth.getSettings();c(v),p(b),i(!0)});const f=u.auth.onAuthStateChange(v=>{g||c(v)});return()=>{g=!0,f(),u.destroy()}},[u]),s.jsx(J.Provider,{value:{client:u,user:l,isLoaded:d,appearance:o,settings:x},children:n})}const ws={colorPrimary:"#6366f1",colorPrimaryHover:"#4f46e5",colorBackground:"#ffffff",colorText:"#1a1a2e",colorTextSecondary:"#6b7280",colorInputBackground:"#f9fafb",colorInputBorder:"#d1d5db",colorError:"#ef4444",colorSuccess:"#22c55e",colorWarning:"#f59e0b",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',borderRadius:"8px",authPrimary:"#4648d4",authPrimaryContainer:"#6063ee",authOnPrimary:"#ffffff",authPrimaryFixed:"#e1e0ff",authSurface:"#fcf8ff",authSurfaceContainerLowest:"#ffffff",authSurfaceContainerLow:"#f5f2ff",authSurfaceContainer:"#efecff",authSurfaceContainerHigh:"#e8e5ff",authSurfaceContainerHighest:"#e2e0fc",authOnSurface:"#1a1a2e",authOnSurfaceVariant:"#464554",authOutline:"#767586",authOutlineVariant:"#c7c4d7",authError:"#ba1a1a",authErrorContainer:"#ffdad6",authSuccess:"#22c55e",authFontHeadline:"'Manrope', sans-serif",authFontBody:"'Inter', sans-serif"},Ss={colorPrimary:"#818cf8",colorPrimaryHover:"#6366f1",colorBackground:"#1e1e2e",colorText:"#e2e8f0",colorTextSecondary:"#94a3b8",colorInputBackground:"#2a2a3e",colorInputBorder:"#3f3f5e",colorError:"#f87171",colorSuccess:"#4ade80",colorWarning:"#fbbf24",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',borderRadius:"8px",authPrimary:"#818cf8",authPrimaryContainer:"#6063ee",authOnPrimary:"#ffffff",authPrimaryFixed:"#2a2a3e",authSurface:"#1e1e2e",authSurfaceContainerLowest:"#161623",authSurfaceContainerLow:"#27273a",authSurfaceContainer:"#2d2d44",authSurfaceContainerHigh:"#363654",authSurfaceContainerHighest:"#3f3f61",authOnSurface:"#e2e8f0",authOnSurfaceVariant:"#94a3b8",authOutline:"#464554",authOutlineVariant:"#44445a",authError:"#f87171",authErrorContainer:"#93000a",authSuccess:"#4ade80",authFontHeadline:"'Manrope', sans-serif",authFontBody:"'Inter', sans-serif"};function Y(a){const r=(a==null?void 0:a.baseTheme)==="dark"?Ss:ws,e=a==null?void 0:a.variables,o=(e==null?void 0:e.colorPrimary)??r.authPrimary;return{colorPrimary:(e==null?void 0:e.colorPrimary)??r.colorPrimary,colorPrimaryHover:e!=null&&e.colorPrimary?Ns(e.colorPrimary,10):r.colorPrimaryHover,colorBackground:(e==null?void 0:e.colorBackground)??r.colorBackground,colorText:(e==null?void 0:e.colorText)??r.colorText,colorTextSecondary:r.colorTextSecondary,colorInputBackground:(e==null?void 0:e.colorInputBackground)??r.colorInputBackground,colorInputBorder:(e==null?void 0:e.colorInputBorder)??r.colorInputBorder,colorError:(e==null?void 0:e.colorError)??r.colorError,colorSuccess:(e==null?void 0:e.colorSuccess)??r.colorSuccess,colorWarning:(e==null?void 0:e.colorWarning)??r.colorWarning,fontFamily:(e==null?void 0:e.fontFamily)??r.fontFamily,borderRadius:(e==null?void 0:e.borderRadius)??r.borderRadius,authPrimary:o,authPrimaryContainer:e!=null&&e.colorPrimary?ks(o,15):r.authPrimaryContainer,authOnPrimary:r.authOnPrimary,authPrimaryFixed:r.authPrimaryFixed,authSurface:(e==null?void 0:e.colorBackground)??r.authSurface,authSurfaceContainerLowest:r.authSurfaceContainerLowest,authSurfaceContainerLow:(e==null?void 0:e.colorInputBackground)??r.authSurfaceContainerLow,authSurfaceContainer:r.authSurfaceContainer,authSurfaceContainerHigh:r.authSurfaceContainerHigh,authSurfaceContainerHighest:r.authSurfaceContainerHighest,authOnSurface:(e==null?void 0:e.colorText)??r.authOnSurface,authOnSurfaceVariant:r.authOnSurfaceVariant,authOutline:r.authOutline,authOutlineVariant:(e==null?void 0:e.colorInputBorder)??r.authOutlineVariant,authError:(e==null?void 0:e.colorError)??r.authError,authErrorContainer:r.authErrorContainer,authSuccess:(e==null?void 0:e.colorSuccess)??r.authSuccess,authFontHeadline:(e==null?void 0:e.fontFamily)??r.authFontHeadline,authFontBody:(e==null?void 0:e.fontFamily)??r.authFontBody}}function Ns(a,r){const e=parseInt(a.replace("#",""),16),o=Math.max(0,(e>>16)-Math.round(2.55*r)),n=Math.max(0,(e>>8&255)-Math.round(2.55*r)),u=Math.max(0,(e&255)-Math.round(2.55*r));return`#${(o<<16|n<<8|u).toString(16).padStart(6,"0")}`}function ks(a,r){const e=parseInt(a.replace("#",""),16),o=Math.min(255,(e>>16)+Math.round(2.55*r)),n=Math.min(255,(e>>8&255)+Math.round(2.55*r)),u=Math.min(255,(e&255)+Math.round(2.55*r));return`#${(o<<16|n<<8|u).toString(16).padStart(6,"0")}`}function Q(a){return`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),r=require("react"),U=require("./index.cjs"),js=require("react-dom"),Z=r.createContext(null);function I(){const e=r.useContext(Z);if(!e)throw new Error("useSaaSContext must be used within a <SaaSProvider>");return e}function vs({publishableKey:e,apiKey:a,baseUrl:t,appearance:o,children:n}){const[u]=r.useState(()=>new U.SaaSSupport({publishableKey:e,apiKey:a,baseUrl:t})),[i,c]=r.useState(null),[d,l]=r.useState(!1),[g,p]=r.useState(null);return r.useEffect(()=>{let x=!1;u.load().then(async()=>{if(x)return;const v=await u.auth.getUser(),b=await u.auth.getSettings();c(v),p(b),l(!0)});const m=u.auth.onAuthStateChange(v=>{x||c(v)});return()=>{x=!0,m(),u.destroy()}},[u]),s.jsx(Z.Provider,{value:{client:u,user:i,isLoaded:d,appearance:o,settings:g},children:n})}const ws={colorPrimary:"#6366f1",colorPrimaryHover:"#4f46e5",colorBackground:"#ffffff",colorText:"#1a1a2e",colorTextSecondary:"#6b7280",colorInputBackground:"#f9fafb",colorInputBorder:"#d1d5db",colorError:"#ef4444",colorSuccess:"#22c55e",colorWarning:"#f59e0b",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',borderRadius:"8px",authPrimary:"#4648d4",authPrimaryContainer:"#6063ee",authOnPrimary:"#ffffff",authPrimaryFixed:"#e1e0ff",authSurface:"#fcf8ff",authSurfaceContainerLowest:"#ffffff",authSurfaceContainerLow:"#f5f2ff",authSurfaceContainer:"#efecff",authSurfaceContainerHigh:"#e8e5ff",authSurfaceContainerHighest:"#e2e0fc",authOnSurface:"#1a1a2e",authOnSurfaceVariant:"#464554",authOutline:"#767586",authOutlineVariant:"#c7c4d7",authError:"#ba1a1a",authErrorContainer:"#ffdad6",authSuccess:"#22c55e",authFontHeadline:"'Manrope', sans-serif",authFontBody:"'Inter', sans-serif"},Ss={colorPrimary:"#818cf8",colorPrimaryHover:"#6366f1",colorBackground:"#1e1e2e",colorText:"#e2e8f0",colorTextSecondary:"#94a3b8",colorInputBackground:"#2a2a3e",colorInputBorder:"#3f3f5e",colorError:"#f87171",colorSuccess:"#4ade80",colorWarning:"#fbbf24",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',borderRadius:"8px",authPrimary:"#818cf8",authPrimaryContainer:"#6063ee",authOnPrimary:"#ffffff",authPrimaryFixed:"#2a2a3e",authSurface:"#1e1e2e",authSurfaceContainerLowest:"#161623",authSurfaceContainerLow:"#27273a",authSurfaceContainer:"#2d2d44",authSurfaceContainerHigh:"#363654",authSurfaceContainerHighest:"#3f3f61",authOnSurface:"#e2e8f0",authOnSurfaceVariant:"#94a3b8",authOutline:"#464554",authOutlineVariant:"#44445a",authError:"#f87171",authErrorContainer:"#93000a",authSuccess:"#4ade80",authFontHeadline:"'Manrope', sans-serif",authFontBody:"'Inter', sans-serif"};function Q(e){const a=(e==null?void 0:e.baseTheme)==="dark"?Ss:ws,t=e==null?void 0:e.variables,o=(t==null?void 0:t.colorPrimary)??a.authPrimary;return{colorPrimary:(t==null?void 0:t.colorPrimary)??a.colorPrimary,colorPrimaryHover:t!=null&&t.colorPrimary?Ns(t.colorPrimary,10):a.colorPrimaryHover,colorBackground:(t==null?void 0:t.colorBackground)??a.colorBackground,colorText:(t==null?void 0:t.colorText)??a.colorText,colorTextSecondary:a.colorTextSecondary,colorInputBackground:(t==null?void 0:t.colorInputBackground)??a.colorInputBackground,colorInputBorder:(t==null?void 0:t.colorInputBorder)??a.colorInputBorder,colorError:(t==null?void 0:t.colorError)??a.colorError,colorSuccess:(t==null?void 0:t.colorSuccess)??a.colorSuccess,colorWarning:(t==null?void 0:t.colorWarning)??a.colorWarning,fontFamily:(t==null?void 0:t.fontFamily)??a.fontFamily,borderRadius:(t==null?void 0:t.borderRadius)??a.borderRadius,authPrimary:o,authPrimaryContainer:t!=null&&t.colorPrimary?ks(o,15):a.authPrimaryContainer,authOnPrimary:a.authOnPrimary,authPrimaryFixed:a.authPrimaryFixed,authSurface:(t==null?void 0:t.colorBackground)??a.authSurface,authSurfaceContainerLowest:a.authSurfaceContainerLowest,authSurfaceContainerLow:(t==null?void 0:t.colorInputBackground)??a.authSurfaceContainerLow,authSurfaceContainer:a.authSurfaceContainer,authSurfaceContainerHigh:a.authSurfaceContainerHigh,authSurfaceContainerHighest:a.authSurfaceContainerHighest,authOnSurface:(t==null?void 0:t.colorText)??a.authOnSurface,authOnSurfaceVariant:a.authOnSurfaceVariant,authOutline:a.authOutline,authOutlineVariant:(t==null?void 0:t.colorInputBorder)??a.authOutlineVariant,authError:(t==null?void 0:t.colorError)??a.authError,authErrorContainer:a.authErrorContainer,authSuccess:(t==null?void 0:t.colorSuccess)??a.authSuccess,authFontHeadline:(t==null?void 0:t.fontFamily)??a.authFontHeadline,authFontBody:(t==null?void 0:t.fontFamily)??a.authFontBody}}function Ns(e,a){const t=parseInt(e.replace("#",""),16),o=Math.max(0,(t>>16)-Math.round(2.55*a)),n=Math.max(0,(t>>8&255)-Math.round(2.55*a)),u=Math.max(0,(t&255)-Math.round(2.55*a));return`#${(o<<16|n<<8|u).toString(16).padStart(6,"0")}`}function ks(e,a){const t=parseInt(e.replace("#",""),16),o=Math.min(255,(t>>16)+Math.round(2.55*a)),n=Math.min(255,(t>>8&255)+Math.round(2.55*a)),u=Math.min(255,(t&255)+Math.round(2.55*a));return`#${(o<<16|n<<8|u).toString(16).padStart(6,"0")}`}function J(e){return`
2
2
  :host {
3
3
  all: initial;
4
- font-family: ${a.fontFamily};
5
- color: ${a.colorText};
4
+ font-family: ${e.fontFamily};
5
+ color: ${e.colorText};
6
6
  line-height: 1.5;
7
7
  -webkit-font-smoothing: antialiased;
8
8
  }
@@ -10,13 +10,13 @@
10
10
  * { box-sizing: border-box; margin: 0; padding: 0; }
11
11
 
12
12
  .ss-card {
13
- background: ${a.colorBackground};
14
- border-radius: ${a.borderRadius};
13
+ background: ${e.colorBackground};
14
+ border-radius: ${e.borderRadius};
15
15
  padding: 32px;
16
16
  width: 100%;
17
17
  max-width: 480px;
18
18
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
19
- border: 1px solid ${a.colorInputBorder};
19
+ border: 1px solid ${e.colorInputBorder};
20
20
  }
21
21
 
22
22
  .ss-card-wide { max-width: 640px; }
@@ -24,14 +24,14 @@
24
24
  .ss-title {
25
25
  font-size: 22px;
26
26
  font-weight: 700;
27
- color: ${a.colorText};
27
+ color: ${e.colorText};
28
28
  text-align: center;
29
29
  margin-bottom: 24px;
30
30
  }
31
31
 
32
32
  .ss-subtitle {
33
33
  font-size: 14px;
34
- color: ${a.colorTextSecondary};
34
+ color: ${e.colorTextSecondary};
35
35
  text-align: center;
36
36
  margin-top: -16px;
37
37
  margin-bottom: 24px;
@@ -43,7 +43,7 @@
43
43
  display: block;
44
44
  font-size: 14px;
45
45
  font-weight: 500;
46
- color: ${a.colorText};
46
+ color: ${e.colorText};
47
47
  margin-bottom: 6px;
48
48
  }
49
49
 
@@ -52,20 +52,20 @@
52
52
  padding: 10px 12px;
53
53
  font-size: 14px;
54
54
  font-family: inherit;
55
- border: 1px solid ${a.colorInputBorder};
56
- border-radius: calc(${a.borderRadius} - 2px);
57
- background: ${a.colorInputBackground};
58
- color: ${a.colorText};
55
+ border: 1px solid ${e.colorInputBorder};
56
+ border-radius: calc(${e.borderRadius} - 2px);
57
+ background: ${e.colorInputBackground};
58
+ color: ${e.colorText};
59
59
  outline: none;
60
60
  transition: border-color 0.15s;
61
61
  }
62
62
 
63
63
  .ss-input:focus {
64
- border-color: ${a.colorPrimary};
65
- box-shadow: 0 0 0 3px ${a.colorPrimary}22;
64
+ border-color: ${e.colorPrimary};
65
+ box-shadow: 0 0 0 3px ${e.colorPrimary}22;
66
66
  }
67
67
 
68
- .ss-input.ss-input-error { border-color: ${a.colorError}; }
68
+ .ss-input.ss-input-error { border-color: ${e.colorError}; }
69
69
 
70
70
  .ss-query-textarea {
71
71
  resize: vertical;
@@ -75,16 +75,16 @@
75
75
 
76
76
  .ss-error {
77
77
  font-size: 13px;
78
- color: ${a.colorError};
78
+ color: ${e.colorError};
79
79
  margin-top: 4px;
80
80
  }
81
81
 
82
82
  .ss-global-error {
83
83
  font-size: 13px;
84
- color: ${a.colorError};
85
- background: ${a.colorError}11;
86
- border: 1px solid ${a.colorError}33;
87
- border-radius: calc(${a.borderRadius} - 2px);
84
+ color: ${e.colorError};
85
+ background: ${e.colorError}11;
86
+ border: 1px solid ${e.colorError}33;
87
+ border-radius: calc(${e.borderRadius} - 2px);
88
88
  padding: 10px 12px;
89
89
  margin-bottom: 16px;
90
90
  text-align: center;
@@ -92,10 +92,10 @@
92
92
 
93
93
  .ss-success-msg {
94
94
  font-size: 13px;
95
- color: ${a.colorSuccess};
96
- background: ${a.colorSuccess}11;
97
- border: 1px solid ${a.colorSuccess}33;
98
- border-radius: calc(${a.borderRadius} - 2px);
95
+ color: ${e.colorSuccess};
96
+ background: ${e.colorSuccess}11;
97
+ border: 1px solid ${e.colorSuccess}33;
98
+ border-radius: calc(${e.borderRadius} - 2px);
99
99
  padding: 10px 12px;
100
100
  margin-bottom: 16px;
101
101
  text-align: center;
@@ -104,14 +104,14 @@
104
104
  .ss-loading {
105
105
  text-align: center;
106
106
  padding: 24px;
107
- color: ${a.colorTextSecondary};
107
+ color: ${e.colorTextSecondary};
108
108
  font-size: 14px;
109
109
  }
110
110
 
111
111
  .ss-empty {
112
112
  text-align: center;
113
113
  padding: 24px;
114
- color: ${a.colorTextSecondary};
114
+ color: ${e.colorTextSecondary};
115
115
  font-size: 14px;
116
116
  }
117
117
 
@@ -124,7 +124,7 @@
124
124
  font-weight: 600;
125
125
  font-family: inherit;
126
126
  border: none;
127
- border-radius: calc(${a.borderRadius} - 2px);
127
+ border-radius: calc(${e.borderRadius} - 2px);
128
128
  cursor: pointer;
129
129
  transition: background 0.15s, opacity 0.15s;
130
130
  }
@@ -132,23 +132,23 @@
132
132
  .ss-btn:disabled { opacity: 0.6; cursor: not-allowed; }
133
133
 
134
134
  .ss-btn-primary {
135
- background: ${a.colorPrimary};
135
+ background: ${e.colorPrimary};
136
136
  color: #fff;
137
137
  }
138
138
 
139
- .ss-btn-primary:hover:not(:disabled) { background: ${a.colorPrimaryHover}; }
139
+ .ss-btn-primary:hover:not(:disabled) { background: ${e.colorPrimaryHover}; }
140
140
 
141
141
  .ss-btn-danger {
142
- background: ${a.colorError};
142
+ background: ${e.colorError};
143
143
  color: #fff;
144
144
  }
145
145
 
146
146
  .ss-btn-danger:hover:not(:disabled) { opacity: 0.9; }
147
147
 
148
148
  .ss-btn-current {
149
- background: ${a.colorInputBackground};
150
- color: ${a.colorTextSecondary};
151
- border: 1px solid ${a.colorInputBorder};
149
+ background: ${e.colorInputBackground};
150
+ color: ${e.colorTextSecondary};
151
+ border: 1px solid ${e.colorInputBorder};
152
152
  }
153
153
 
154
154
  .ss-btn-sm {
@@ -169,13 +169,13 @@
169
169
  display: flex;
170
170
  align-items: center;
171
171
  gap: 8px;
172
- background: ${a.colorInputBackground};
173
- border: 1px solid ${a.colorInputBorder};
174
- color: ${a.colorText};
172
+ background: ${e.colorInputBackground};
173
+ border: 1px solid ${e.colorInputBorder};
174
+ color: ${e.colorText};
175
175
  padding: 8px 12px;
176
176
  font-size: 14px;
177
177
  font-family: inherit;
178
- border-radius: calc(${a.borderRadius} - 2px);
178
+ border-radius: calc(${e.borderRadius} - 2px);
179
179
  cursor: pointer;
180
180
  width: auto;
181
181
  }
@@ -192,16 +192,16 @@
192
192
  font-size: 14px;
193
193
  font-weight: 500;
194
194
  font-family: inherit;
195
- border: 1px solid ${a.colorInputBorder};
196
- border-radius: calc(${a.borderRadius} - 2px);
197
- background: ${a.colorInputBackground};
198
- color: ${a.colorText};
195
+ border: 1px solid ${e.colorInputBorder};
196
+ border-radius: calc(${e.borderRadius} - 2px);
197
+ background: ${e.colorInputBackground};
198
+ color: ${e.colorText};
199
199
  cursor: pointer;
200
200
  transition: background 0.15s;
201
201
  margin-bottom: 8px;
202
202
  }
203
203
 
204
- .ss-btn-social:hover:not(:disabled) { background: ${a.colorInputBorder}; }
204
+ .ss-btn-social:hover:not(:disabled) { background: ${e.colorInputBorder}; }
205
205
  .ss-btn-social:disabled { opacity: 0.6; cursor: not-allowed; }
206
206
  .ss-btn-social svg { width: 18px; height: 18px; flex-shrink: 0; }
207
207
 
@@ -210,7 +210,7 @@
210
210
  align-items: center;
211
211
  gap: 12px;
212
212
  margin: 20px 0;
213
- color: ${a.colorTextSecondary};
213
+ color: ${e.colorTextSecondary};
214
214
  font-size: 13px;
215
215
  }
216
216
 
@@ -219,18 +219,18 @@
219
219
  content: '';
220
220
  flex: 1;
221
221
  height: 1px;
222
- background: ${a.colorInputBorder};
222
+ background: ${e.colorInputBorder};
223
223
  }
224
224
 
225
225
  .ss-footer {
226
226
  text-align: center;
227
227
  margin-top: 20px;
228
228
  font-size: 14px;
229
- color: ${a.colorTextSecondary};
229
+ color: ${e.colorTextSecondary};
230
230
  }
231
231
 
232
232
  .ss-link {
233
- color: ${a.colorPrimary};
233
+ color: ${e.colorPrimary};
234
234
  text-decoration: none;
235
235
  cursor: pointer;
236
236
  font-weight: 500;
@@ -260,7 +260,7 @@
260
260
  width: 36px;
261
261
  height: 36px;
262
262
  border-radius: 50%;
263
- background: ${a.colorPrimary};
263
+ background: ${e.colorPrimary};
264
264
  color: #fff;
265
265
  display: flex;
266
266
  align-items: center;
@@ -273,15 +273,15 @@
273
273
  transition: box-shadow 0.15s;
274
274
  }
275
275
 
276
- .ss-avatar:hover { box-shadow: 0 0 0 3px ${a.colorPrimary}33; }
276
+ .ss-avatar:hover { box-shadow: 0 0 0 3px ${e.colorPrimary}33; }
277
277
 
278
278
  .ss-dropdown {
279
279
  position: absolute;
280
280
  top: calc(100% + 8px);
281
281
  right: 0;
282
- background: ${a.colorBackground};
283
- border: 1px solid ${a.colorInputBorder};
284
- border-radius: ${a.borderRadius};
282
+ background: ${e.colorBackground};
283
+ border: 1px solid ${e.colorInputBorder};
284
+ border-radius: ${e.borderRadius};
285
285
  padding: 8px 0;
286
286
  min-width: 200px;
287
287
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
@@ -292,13 +292,13 @@
292
292
 
293
293
  .ss-dropdown-header {
294
294
  padding: 8px 16px 12px;
295
- border-bottom: 1px solid ${a.colorInputBorder};
295
+ border-bottom: 1px solid ${e.colorInputBorder};
296
296
  margin-bottom: 4px;
297
297
  }
298
298
 
299
299
  .ss-dropdown-email {
300
300
  font-size: 13px;
301
- color: ${a.colorTextSecondary};
301
+ color: ${e.colorTextSecondary};
302
302
  word-break: break-all;
303
303
  }
304
304
 
@@ -308,7 +308,7 @@
308
308
  padding: 8px 16px;
309
309
  font-size: 14px;
310
310
  font-family: inherit;
311
- color: ${a.colorText};
311
+ color: ${e.colorText};
312
312
  background: none;
313
313
  border: none;
314
314
  text-align: left;
@@ -316,9 +316,9 @@
316
316
  transition: background 0.1s;
317
317
  }
318
318
 
319
- .ss-dropdown-item:hover { background: ${a.colorInputBackground}; }
320
- .ss-dropdown-item-danger { color: ${a.colorError}; }
321
- .ss-dropdown-item-active { font-weight: 600; color: ${a.colorPrimary}; }
319
+ .ss-dropdown-item:hover { background: ${e.colorInputBackground}; }
320
+ .ss-dropdown-item-danger { color: ${e.colorError}; }
321
+ .ss-dropdown-item-active { font-weight: 600; color: ${e.colorPrimary}; }
322
322
 
323
323
  .ss-dropdown-section-title {
324
324
  padding: 8px 16px 4px;
@@ -326,7 +326,7 @@
326
326
  font-weight: 600;
327
327
  text-transform: uppercase;
328
328
  letter-spacing: 0.5px;
329
- color: ${a.colorTextSecondary};
329
+ color: ${e.colorTextSecondary};
330
330
  }
331
331
 
332
332
  .ss-org-check {
@@ -337,7 +337,7 @@
337
337
  .ss-danger-zone {
338
338
  padding-top: 20px;
339
339
  margin-top: 20px;
340
- border-top: 2px solid ${a.colorError}33;
340
+ border-top: 2px solid ${e.colorError}33;
341
341
  }
342
342
 
343
343
  /* Badges */
@@ -350,21 +350,21 @@
350
350
  border-radius: 999px;
351
351
  text-transform: uppercase;
352
352
  letter-spacing: 0.3px;
353
- background: ${a.colorInputBackground};
354
- color: ${a.colorTextSecondary};
353
+ background: ${e.colorInputBackground};
354
+ color: ${e.colorTextSecondary};
355
355
  }
356
356
 
357
- .ss-badge-active { background: ${a.colorSuccess}22; color: ${a.colorSuccess}; }
358
- .ss-badge-trialing { background: ${a.colorPrimary}22; color: ${a.colorPrimary}; }
359
- .ss-badge-past-due { background: ${a.colorError}22; color: ${a.colorError}; }
360
- .ss-badge-paused { background: ${a.colorWarning}22; color: ${a.colorWarning}; }
361
- .ss-badge-canceled { background: ${a.colorTextSecondary}22; color: ${a.colorTextSecondary}; }
357
+ .ss-badge-active { background: ${e.colorSuccess}22; color: ${e.colorSuccess}; }
358
+ .ss-badge-trialing { background: ${e.colorPrimary}22; color: ${e.colorPrimary}; }
359
+ .ss-badge-past-due { background: ${e.colorError}22; color: ${e.colorError}; }
360
+ .ss-badge-paused { background: ${e.colorWarning}22; color: ${e.colorWarning}; }
361
+ .ss-badge-canceled { background: ${e.colorTextSecondary}22; color: ${e.colorTextSecondary}; }
362
362
 
363
363
  /* Tabs */
364
364
 
365
365
  .ss-tab-group {
366
366
  display: flex;
367
- border-bottom: 1px solid ${a.colorInputBorder};
367
+ border-bottom: 1px solid ${e.colorInputBorder};
368
368
  margin-bottom: 24px;
369
369
  }
370
370
 
@@ -375,7 +375,7 @@
375
375
  font-size: 14px;
376
376
  font-weight: 500;
377
377
  font-family: inherit;
378
- color: ${a.colorTextSecondary};
378
+ color: ${e.colorTextSecondary};
379
379
  background: none;
380
380
  border: none;
381
381
  border-bottom: 2px solid transparent;
@@ -383,11 +383,11 @@
383
383
  transition: color 0.15s, border-color 0.15s;
384
384
  }
385
385
 
386
- .ss-tab:hover { color: ${a.colorText}; }
386
+ .ss-tab:hover { color: ${e.colorText}; }
387
387
 
388
388
  .ss-tab-active {
389
- color: ${a.colorPrimary};
390
- border-bottom-color: ${a.colorPrimary};
389
+ color: ${e.colorPrimary};
390
+ border-bottom-color: ${e.colorPrimary};
391
391
  }
392
392
 
393
393
  .ss-tab-content .ss-card { box-shadow: none; border: none; padding: 0; }
@@ -406,30 +406,30 @@
406
406
  text-align: left;
407
407
  padding: 10px 12px;
408
408
  font-weight: 600;
409
- color: ${a.colorTextSecondary};
410
- border-bottom: 2px solid ${a.colorInputBorder};
409
+ color: ${e.colorTextSecondary};
410
+ border-bottom: 2px solid ${e.colorInputBorder};
411
411
  white-space: nowrap;
412
412
  }
413
413
 
414
414
  .ss-th-sortable { cursor: pointer; user-select: none; }
415
- .ss-th-sortable:hover { color: ${a.colorText}; }
415
+ .ss-th-sortable:hover { color: ${e.colorText}; }
416
416
 
417
417
  .ss-sort-indicator { font-size: 10px; }
418
- .ss-sorted-asc, .ss-sorted-desc { color: ${a.colorPrimary}; }
418
+ .ss-sorted-asc, .ss-sorted-desc { color: ${e.colorPrimary}; }
419
419
 
420
420
  .ss-td {
421
421
  padding: 10px 12px;
422
- border-bottom: 1px solid ${a.colorInputBorder};
423
- color: ${a.colorText};
422
+ border-bottom: 1px solid ${e.colorInputBorder};
423
+ color: ${e.colorText};
424
424
  }
425
425
 
426
- .ss-tr:hover .ss-td { background: ${a.colorInputBackground}; }
426
+ .ss-tr:hover .ss-td { background: ${e.colorInputBackground}; }
427
427
 
428
428
  .ss-table-footer {
429
429
  text-align: center;
430
430
  padding: 8px;
431
431
  font-size: 12px;
432
- color: ${a.colorTextSecondary};
432
+ color: ${e.colorTextSecondary};
433
433
  }
434
434
 
435
435
  /* Pricing */
@@ -441,15 +441,15 @@
441
441
  }
442
442
 
443
443
  .ss-pricing-card {
444
- background: ${a.colorBackground};
445
- border: 1px solid ${a.colorInputBorder};
446
- border-radius: ${a.borderRadius};
444
+ background: ${e.colorBackground};
445
+ border: 1px solid ${e.colorInputBorder};
446
+ border-radius: ${e.borderRadius};
447
447
  padding: 24px;
448
448
  display: flex;
449
449
  flex-direction: column;
450
450
  }
451
451
 
452
- .ss-pricing-card-current { border-color: ${a.colorPrimary}; }
452
+ .ss-pricing-card-current { border-color: ${e.colorPrimary}; }
453
453
 
454
454
  .ss-pricing-header {
455
455
  display: flex;
@@ -461,7 +461,7 @@
461
461
  .ss-pricing-name {
462
462
  font-size: 18px;
463
463
  font-weight: 600;
464
- color: ${a.colorText};
464
+ color: ${e.colorText};
465
465
  }
466
466
 
467
467
  .ss-pricing-price { margin-bottom: 12px; }
@@ -469,17 +469,17 @@
469
469
  .ss-pricing-amount {
470
470
  font-size: 32px;
471
471
  font-weight: 700;
472
- color: ${a.colorText};
472
+ color: ${e.colorText};
473
473
  }
474
474
 
475
475
  .ss-pricing-interval {
476
476
  font-size: 14px;
477
- color: ${a.colorTextSecondary};
477
+ color: ${e.colorTextSecondary};
478
478
  }
479
479
 
480
480
  .ss-pricing-desc {
481
481
  font-size: 14px;
482
- color: ${a.colorTextSecondary};
482
+ color: ${e.colorTextSecondary};
483
483
  margin-bottom: 16px;
484
484
  }
485
485
 
@@ -491,11 +491,11 @@
491
491
 
492
492
  .ss-pricing-feature {
493
493
  font-size: 14px;
494
- color: ${a.colorText};
494
+ color: ${e.colorText};
495
495
  padding: 4px 0;
496
496
  }
497
497
 
498
- .ss-check { color: ${a.colorSuccess}; margin-right: 6px; }
498
+ .ss-check { color: ${e.colorSuccess}; margin-right: 6px; }
499
499
 
500
500
  /* Usage / Progress */
501
501
 
@@ -510,30 +510,30 @@
510
510
  .ss-usage-metric {
511
511
  font-size: 14px;
512
512
  font-weight: 500;
513
- color: ${a.colorText};
513
+ color: ${e.colorText};
514
514
  }
515
515
 
516
516
  .ss-usage-value {
517
517
  font-size: 14px;
518
- color: ${a.colorTextSecondary};
518
+ color: ${e.colorTextSecondary};
519
519
  }
520
520
 
521
521
  .ss-progress-bar {
522
522
  width: 100%;
523
523
  height: 8px;
524
- background: ${a.colorInputBackground};
524
+ background: ${e.colorInputBackground};
525
525
  border-radius: 4px;
526
526
  overflow: hidden;
527
527
  }
528
528
 
529
529
  .ss-progress-fill {
530
530
  height: 100%;
531
- background: ${a.colorPrimary};
531
+ background: ${e.colorPrimary};
532
532
  border-radius: 4px;
533
533
  transition: width 0.3s;
534
534
  }
535
535
 
536
- .ss-progress-danger { background: ${a.colorError}; }
536
+ .ss-progress-danger { background: ${e.colorError}; }
537
537
 
538
538
  /* Chart */
539
539
 
@@ -542,7 +542,7 @@
542
542
  .ss-chart-title {
543
543
  font-size: 16px;
544
544
  font-weight: 600;
545
- color: ${a.colorText};
545
+ color: ${e.colorText};
546
546
  margin-bottom: 12px;
547
547
  }
548
548
 
@@ -555,16 +555,16 @@
555
555
  }
556
556
 
557
557
  .ss-widget {
558
- background: ${a.colorBackground};
559
- border: 1px solid ${a.colorInputBorder};
560
- border-radius: ${a.borderRadius};
558
+ background: ${e.colorBackground};
559
+ border: 1px solid ${e.colorInputBorder};
560
+ border-radius: ${e.borderRadius};
561
561
  padding: 16px;
562
562
  }
563
563
 
564
564
  .ss-widget-header {
565
565
  font-size: 14px;
566
566
  font-weight: 600;
567
- color: ${a.colorText};
567
+ color: ${e.colorText};
568
568
  margin-bottom: 12px;
569
569
  }
570
570
 
@@ -572,14 +572,14 @@
572
572
 
573
573
  .ss-saved-query-card {
574
574
  padding: 12px 16px;
575
- border: 1px solid ${a.colorInputBorder};
576
- border-radius: calc(${a.borderRadius} - 2px);
575
+ border: 1px solid ${e.colorInputBorder};
576
+ border-radius: calc(${e.borderRadius} - 2px);
577
577
  margin-bottom: 8px;
578
578
  cursor: pointer;
579
579
  transition: border-color 0.15s;
580
580
  }
581
581
 
582
- .ss-saved-query-card:hover { border-color: ${a.colorPrimary}; }
582
+ .ss-saved-query-card:hover { border-color: ${e.colorPrimary}; }
583
583
 
584
584
  .ss-saved-query-header {
585
585
  display: flex;
@@ -591,12 +591,12 @@
591
591
  .ss-saved-query-name {
592
592
  font-size: 14px;
593
593
  font-weight: 600;
594
- color: ${a.colorText};
594
+ color: ${e.colorText};
595
595
  }
596
596
 
597
597
  .ss-saved-query-desc {
598
598
  font-size: 13px;
599
- color: ${a.colorTextSecondary};
599
+ color: ${e.colorTextSecondary};
600
600
  margin-bottom: 8px;
601
601
  }
602
602
 
@@ -608,7 +608,7 @@
608
608
 
609
609
  .ss-saved-query-date {
610
610
  font-size: 12px;
611
- color: ${a.colorTextSecondary};
611
+ color: ${e.colorTextSecondary};
612
612
  }
613
613
 
614
614
  /* Modal Overlay */
@@ -633,15 +633,15 @@
633
633
  }
634
634
 
635
635
  .ss-modal {
636
- background: ${a.colorBackground};
637
- border-radius: ${a.borderRadius};
636
+ background: ${e.colorBackground};
637
+ border-radius: ${e.borderRadius};
638
638
  padding: 32px;
639
639
  width: 90%;
640
640
  max-width: 480px;
641
641
  max-height: 90vh;
642
642
  overflow-y: auto;
643
643
  box-shadow: 0 16px 64px rgba(0, 0, 0, 0.2);
644
- border: 1px solid ${a.colorInputBorder};
644
+ border: 1px solid ${e.colorInputBorder};
645
645
  animation: ss-scale-in 0.15s ease-out;
646
646
  }
647
647
 
@@ -660,14 +660,14 @@
660
660
  .ss-modal-title {
661
661
  font-size: 18px;
662
662
  font-weight: 700;
663
- color: ${a.colorText};
663
+ color: ${e.colorText};
664
664
  }
665
665
 
666
666
  .ss-modal-close {
667
667
  background: none;
668
668
  border: none;
669
669
  font-size: 20px;
670
- color: ${a.colorTextSecondary};
670
+ color: ${e.colorTextSecondary};
671
671
  cursor: pointer;
672
672
  padding: 4px;
673
673
  line-height: 1;
@@ -677,20 +677,20 @@
677
677
  }
678
678
 
679
679
  .ss-modal-close:hover {
680
- background: ${a.colorInputBackground};
681
- color: ${a.colorText};
680
+ background: ${e.colorInputBackground};
681
+ color: ${e.colorText};
682
682
  }
683
683
 
684
684
  .ss-modal-section {
685
685
  padding-top: 20px;
686
686
  margin-top: 20px;
687
- border-top: 1px solid ${a.colorInputBorder};
687
+ border-top: 1px solid ${e.colorInputBorder};
688
688
  }
689
689
 
690
690
  .ss-modal-section-title {
691
691
  font-size: 15px;
692
692
  font-weight: 600;
693
- color: ${a.colorText};
693
+ color: ${e.colorText};
694
694
  margin-bottom: 16px;
695
695
  }
696
696
 
@@ -698,7 +698,7 @@
698
698
  width: 64px;
699
699
  height: 64px;
700
700
  border-radius: 50%;
701
- background: ${a.colorPrimary};
701
+ background: ${e.colorPrimary};
702
702
  color: #fff;
703
703
  display: flex;
704
704
  align-items: center;
@@ -748,7 +748,7 @@
748
748
  }
749
749
 
750
750
  .ss-avatar-canvas {
751
- border-radius: ${a.borderRadius};
751
+ border-radius: ${e.borderRadius};
752
752
  background: #111;
753
753
  touch-action: none;
754
754
  max-width: 100%;
@@ -763,7 +763,7 @@
763
763
 
764
764
  .ss-avatar-zoom-label {
765
765
  font-size: 13px;
766
- color: ${a.colorTextSecondary};
766
+ color: ${e.colorTextSecondary};
767
767
  flex-shrink: 0;
768
768
  }
769
769
 
@@ -772,7 +772,7 @@
772
772
  height: 4px;
773
773
  -webkit-appearance: none;
774
774
  appearance: none;
775
- background: ${a.colorInputBorder};
775
+ background: ${e.colorInputBorder};
776
776
  border-radius: 2px;
777
777
  outline: none;
778
778
  }
@@ -782,7 +782,7 @@
782
782
  width: 16px;
783
783
  height: 16px;
784
784
  border-radius: 50%;
785
- background: ${a.colorPrimary};
785
+ background: ${e.colorPrimary};
786
786
  cursor: pointer;
787
787
  }
788
788
 
@@ -790,20 +790,20 @@
790
790
  width: 16px;
791
791
  height: 16px;
792
792
  border-radius: 50%;
793
- background: ${a.colorPrimary};
793
+ background: ${e.colorPrimary};
794
794
  cursor: pointer;
795
795
  border: none;
796
796
  }
797
797
 
798
798
  /* Dropzone */
799
799
  .ss-avatar-dropzone {
800
- border: 2px dashed ${a.colorInputBorder};
801
- border-radius: ${a.borderRadius};
800
+ border: 2px dashed ${e.colorInputBorder};
801
+ border-radius: ${e.borderRadius};
802
802
  padding: 40px 24px;
803
803
  text-align: center;
804
804
  cursor: pointer;
805
805
  transition: border-color 0.15s, background 0.15s;
806
- color: ${a.colorTextSecondary};
806
+ color: ${e.colorTextSecondary};
807
807
  display: flex;
808
808
  flex-direction: column;
809
809
  align-items: center;
@@ -812,8 +812,8 @@
812
812
 
813
813
  .ss-avatar-dropzone:hover,
814
814
  .ss-avatar-dropzone-active {
815
- border-color: ${a.colorPrimary};
816
- background: ${a.colorPrimary}08;
815
+ border-color: ${e.colorPrimary};
816
+ background: ${e.colorPrimary}08;
817
817
  }
818
818
 
819
819
  .ss-avatar-dropzone svg {
@@ -829,7 +829,7 @@
829
829
 
830
830
  .ss-dropdown-divider {
831
831
  height: 1px;
832
- background: ${a.colorInputBorder};
832
+ background: ${e.colorInputBorder};
833
833
  margin: 4px 0;
834
834
  }
835
835
 
@@ -874,9 +874,9 @@
874
874
 
875
875
  /* Auth Card */
876
876
  .ss-auth-card {
877
- background: ${a.authSurfaceContainerLowest};
877
+ background: ${e.authSurfaceContainerLowest};
878
878
  border-radius: 12px;
879
- border: 1px solid ${a.authOutlineVariant}26;
879
+ border: 1px solid ${e.authOutlineVariant}26;
880
880
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
881
881
  width: 100%;
882
882
  max-width: 520px;
@@ -900,12 +900,12 @@
900
900
  width: 48px;
901
901
  height: 48px;
902
902
  border-radius: 12px;
903
- background: ${a.authPrimary}1a;
903
+ background: ${e.authPrimary}1a;
904
904
  margin-bottom: 16px;
905
905
  }
906
906
 
907
907
  .ss-auth-brand-icon .material-symbols-outlined {
908
- color: ${a.authPrimary};
908
+ color: ${e.authPrimary};
909
909
  font-size: 28px;
910
910
  }
911
911
 
@@ -916,23 +916,23 @@
916
916
  width: 48px;
917
917
  height: 48px;
918
918
  border-radius: 12px;
919
- background: linear-gradient(135deg, ${a.authPrimary}, ${a.authPrimaryContainer});
920
- box-shadow: 0 8px 24px ${a.authPrimary}33;
919
+ background: linear-gradient(135deg, ${e.authPrimary}, ${e.authPrimaryContainer});
920
+ box-shadow: 0 8px 24px ${e.authPrimary}33;
921
921
  margin-bottom: 16px;
922
922
  }
923
923
 
924
924
  .ss-auth-brand-icon-gradient .material-symbols-outlined {
925
- color: ${a.authOnPrimary};
925
+ color: ${e.authOnPrimary};
926
926
  font-size: 24px;
927
927
  }
928
928
 
929
929
  /* Auth Typography */
930
930
  .ss-auth-title {
931
- font-family: ${a.authFontHeadline};
931
+ font-family: ${e.authFontHeadline};
932
932
  font-size: 24px;
933
933
  font-weight: 800;
934
934
  letter-spacing: -0.02em;
935
- color: ${a.authOnSurface};
935
+ color: ${e.authOnSurface};
936
936
  margin: 0;
937
937
  line-height: 1.2;
938
938
  }
@@ -940,20 +940,20 @@
940
940
  .ss-auth-title-lg { font-size: 28px; }
941
941
 
942
942
  .ss-auth-subtitle {
943
- font-family: ${a.authFontBody};
943
+ font-family: ${e.authFontBody};
944
944
  font-size: 14px;
945
- color: ${a.authOnSurfaceVariant};
945
+ color: ${e.authOnSurfaceVariant};
946
946
  margin-top: 8px;
947
947
  }
948
948
 
949
949
  .ss-auth-label {
950
950
  display: block;
951
- font-family: ${a.authFontHeadline};
951
+ font-family: ${e.authFontHeadline};
952
952
  font-size: 11px;
953
953
  font-weight: 700;
954
954
  text-transform: uppercase;
955
955
  letter-spacing: 0.1em;
956
- color: ${a.authOnSurfaceVariant};
956
+ color: ${e.authOnSurfaceVariant};
957
957
  margin-bottom: 6px;
958
958
  padding-left: 2px;
959
959
  }
@@ -963,29 +963,29 @@
963
963
  width: 100%;
964
964
  padding: 12px 16px;
965
965
  font-size: 14px;
966
- font-family: ${a.authFontBody};
967
- background: ${a.authSurfaceContainerLow};
966
+ font-family: ${e.authFontBody};
967
+ background: ${e.authSurfaceContainerLow};
968
968
  border: none;
969
969
  border-radius: 8px;
970
- color: ${a.authOnSurface};
970
+ color: ${e.authOnSurface};
971
971
  outline: none;
972
- box-shadow: 0 0 0 1px ${a.authOutlineVariant}4d;
972
+ box-shadow: 0 0 0 1px ${e.authOutlineVariant}4d;
973
973
  transition: box-shadow 0.15s, background 0.15s;
974
974
  }
975
975
 
976
- .ss-auth-input::placeholder { color: ${a.authOnSurfaceVariant}80; }
976
+ .ss-auth-input::placeholder { color: ${e.authOnSurfaceVariant}80; }
977
977
 
978
978
  .ss-auth-input:focus {
979
- box-shadow: 0 0 0 2px ${a.authPrimary};
979
+ box-shadow: 0 0 0 2px ${e.authPrimary};
980
980
  }
981
981
 
982
982
  .ss-auth-input-error {
983
- box-shadow: 0 0 0 1px ${a.authError};
983
+ box-shadow: 0 0 0 1px ${e.authError};
984
984
  }
985
985
 
986
986
  .ss-auth-input-readonly {
987
- background: ${a.authSurfaceContainer}80;
988
- color: ${a.authOnSurfaceVariant};
987
+ background: ${e.authSurfaceContainer}80;
988
+ color: ${e.authOnSurfaceVariant};
989
989
  cursor: not-allowed;
990
990
  }
991
991
 
@@ -1004,7 +1004,7 @@
1004
1004
  left: 12px;
1005
1005
  top: 50%;
1006
1006
  transform: translateY(-50%);
1007
- color: ${a.authOnSurfaceVariant};
1007
+ color: ${e.authOnSurfaceVariant};
1008
1008
  font-size: 18px;
1009
1009
  }
1010
1010
 
@@ -1015,14 +1015,14 @@
1015
1015
  transform: translateY(-50%);
1016
1016
  background: none;
1017
1017
  border: none;
1018
- color: ${a.authOnSurfaceVariant};
1018
+ color: ${e.authOnSurfaceVariant};
1019
1019
  cursor: pointer;
1020
1020
  padding: 0;
1021
1021
  display: flex;
1022
1022
  font-size: 20px;
1023
1023
  }
1024
1024
 
1025
- .ss-auth-visibility-toggle:hover { color: ${a.authOnSurface}; }
1025
+ .ss-auth-visibility-toggle:hover { color: ${e.authOnSurface}; }
1026
1026
 
1027
1027
  /* Auth Buttons */
1028
1028
  .ss-auth-btn-primary {
@@ -1030,13 +1030,13 @@
1030
1030
  padding: 14px 24px;
1031
1031
  font-size: 14px;
1032
1032
  font-weight: 700;
1033
- font-family: ${a.authFontHeadline};
1034
- color: ${a.authOnPrimary};
1035
- background: linear-gradient(135deg, ${a.authPrimary}, ${a.authPrimaryContainer});
1033
+ font-family: ${e.authFontHeadline};
1034
+ color: ${e.authOnPrimary};
1035
+ background: linear-gradient(135deg, ${e.authPrimary}, ${e.authPrimaryContainer});
1036
1036
  border: none;
1037
1037
  border-radius: 8px;
1038
1038
  cursor: pointer;
1039
- box-shadow: 0 4px 16px ${a.authPrimary}33;
1039
+ box-shadow: 0 4px 16px ${e.authPrimary}33;
1040
1040
  transition: box-shadow 0.2s, transform 0.1s, opacity 0.15s;
1041
1041
  display: flex;
1042
1042
  align-items: center;
@@ -1045,7 +1045,7 @@
1045
1045
  }
1046
1046
 
1047
1047
  .ss-auth-btn-primary:hover:not(:disabled) {
1048
- box-shadow: 0 6px 24px ${a.authPrimary}4d;
1048
+ box-shadow: 0 6px 24px ${e.authPrimary}4d;
1049
1049
  transform: translateY(-1px);
1050
1050
  }
1051
1051
 
@@ -1061,8 +1061,8 @@
1061
1061
  padding: 10px 24px;
1062
1062
  font-size: 14px;
1063
1063
  font-weight: 700;
1064
- font-family: ${a.authFontHeadline};
1065
- color: ${a.authOnSurfaceVariant};
1064
+ font-family: ${e.authFontHeadline};
1065
+ color: ${e.authOnSurfaceVariant};
1066
1066
  background: transparent;
1067
1067
  border: none;
1068
1068
  border-radius: 8px;
@@ -1070,14 +1070,14 @@
1070
1070
  transition: background 0.15s, color 0.15s;
1071
1071
  }
1072
1072
 
1073
- .ss-auth-btn-ghost:hover { background: ${a.authSurfaceContainer}; color: ${a.authOnSurface}; }
1073
+ .ss-auth-btn-ghost:hover { background: ${e.authSurfaceContainer}; color: ${e.authOnSurface}; }
1074
1074
 
1075
1075
  .ss-auth-btn-danger {
1076
1076
  padding: 10px 24px;
1077
1077
  font-size: 14px;
1078
1078
  font-weight: 700;
1079
- font-family: ${a.authFontHeadline};
1080
- color: ${a.authError};
1079
+ font-family: ${e.authFontHeadline};
1080
+ color: ${e.authError};
1081
1081
  background: transparent;
1082
1082
  border: none;
1083
1083
  border-radius: 8px;
@@ -1089,22 +1089,22 @@
1089
1089
  width: 100%;
1090
1090
  }
1091
1091
 
1092
- .ss-auth-btn-danger:hover { background: ${a.authErrorContainer}33; }
1092
+ .ss-auth-btn-danger:hover { background: ${e.authErrorContainer}33; }
1093
1093
 
1094
1094
  .ss-auth-btn-outline {
1095
1095
  padding: 10px 24px;
1096
1096
  font-size: 14px;
1097
1097
  font-weight: 700;
1098
- font-family: ${a.authFontHeadline};
1099
- color: ${a.authOnSurfaceVariant};
1098
+ font-family: ${e.authFontHeadline};
1099
+ color: ${e.authOnSurfaceVariant};
1100
1100
  background: transparent;
1101
- border: 1px solid ${a.authOutlineVariant}4d;
1101
+ border: 1px solid ${e.authOutlineVariant}4d;
1102
1102
  border-radius: 8px;
1103
1103
  cursor: pointer;
1104
1104
  transition: background 0.15s, color 0.15s;
1105
1105
  }
1106
1106
 
1107
- .ss-auth-btn-outline:hover { background: ${a.authSurfaceContainer}; color: ${a.authOnSurface}; }
1107
+ .ss-auth-btn-outline:hover { background: ${e.authSurfaceContainer}; color: ${e.authOnSurface}; }
1108
1108
 
1109
1109
  .ss-auth-btn-social {
1110
1110
  display: flex;
@@ -1114,19 +1114,19 @@
1114
1114
  padding: 10px 16px;
1115
1115
  font-size: 14px;
1116
1116
  font-weight: 600;
1117
- font-family: ${a.authFontBody};
1118
- color: ${a.authOnSurface};
1119
- background: ${a.authSurfaceContainerLow};
1120
- border: 1px solid ${a.authOutlineVariant}1a;
1117
+ font-family: ${e.authFontBody};
1118
+ color: ${e.authOnSurface};
1119
+ background: ${e.authSurfaceContainerLow};
1120
+ border: 1px solid ${e.authOutlineVariant}1a;
1121
1121
  border-radius: 8px;
1122
1122
  cursor: pointer;
1123
1123
  transition: background 0.15s;
1124
1124
  }
1125
1125
 
1126
- .ss-auth-btn-social:hover { background: ${a.authSurfaceContainerHigh}; }
1126
+ .ss-auth-btn-social:hover { background: ${e.authSurfaceContainerHigh}; }
1127
1127
  .ss-auth-btn-social:disabled { opacity: 0.6; cursor: not-allowed; }
1128
1128
  .ss-auth-btn-social svg { width: 20px; height: 20px; flex-shrink: 0; }
1129
- .ss-auth-btn-social svg path[fill="currentColor"] { fill: ${a.authOnSurface}; }
1129
+ .ss-auth-btn-social svg path[fill="currentColor"] { fill: ${e.authOnSurface}; }
1130
1130
 
1131
1131
  .ss-auth-btn-sm {
1132
1132
  width: auto;
@@ -1152,7 +1152,7 @@
1152
1152
  font-weight: 600;
1153
1153
  text-transform: uppercase;
1154
1154
  letter-spacing: 0.05em;
1155
- color: ${a.authOnSurfaceVariant};
1155
+ color: ${e.authOnSurfaceVariant};
1156
1156
  }
1157
1157
 
1158
1158
  .ss-auth-divider::before,
@@ -1160,21 +1160,21 @@
1160
1160
  content: '';
1161
1161
  flex: 1;
1162
1162
  height: 1px;
1163
- background: ${a.authOutlineVariant}33;
1163
+ background: ${e.authOutlineVariant}33;
1164
1164
  }
1165
1165
 
1166
1166
  /* Auth Error Message */
1167
1167
  .ss-auth-error {
1168
1168
  padding: 12px;
1169
- background: ${a.authError}1a;
1170
- border: 1px solid ${a.authError}33;
1169
+ background: ${e.authError}1a;
1170
+ border: 1px solid ${e.authError}33;
1171
1171
  border-radius: 8px;
1172
1172
  margin-bottom: 16px;
1173
1173
  display: flex;
1174
1174
  align-items: flex-start;
1175
1175
  gap: 8px;
1176
1176
  font-size: 13px;
1177
- color: ${a.authError};
1177
+ color: ${e.authError};
1178
1178
  }
1179
1179
 
1180
1180
  .ss-auth-error .material-symbols-outlined { font-size: 18px; flex-shrink: 0; margin-top: 1px; }
@@ -1192,23 +1192,23 @@
1192
1192
  text-align: center;
1193
1193
  font-size: 20px;
1194
1194
  font-weight: 700;
1195
- font-family: ${a.authFontBody};
1196
- background: ${a.authSurfaceContainerHigh};
1195
+ font-family: ${e.authFontBody};
1196
+ background: ${e.authSurfaceContainerHigh};
1197
1197
  border: none;
1198
1198
  border-radius: 8px;
1199
- color: ${a.authOnSurface};
1199
+ color: ${e.authOnSurface};
1200
1200
  outline: none;
1201
- box-shadow: 0 0 0 1px ${a.authOutlineVariant}1a;
1201
+ box-shadow: 0 0 0 1px ${e.authOutlineVariant}1a;
1202
1202
  transition: box-shadow 0.15s;
1203
1203
  }
1204
1204
 
1205
1205
  .ss-auth-mfa-digit:focus {
1206
- box-shadow: 0 0 0 2px ${a.authPrimary};
1206
+ box-shadow: 0 0 0 2px ${e.authPrimary};
1207
1207
  }
1208
1208
 
1209
1209
  .ss-auth-mfa-hint {
1210
1210
  font-size: 11px;
1211
- color: ${a.authOnSurfaceVariant}99;
1211
+ color: ${e.authOnSurfaceVariant}99;
1212
1212
  text-align: center;
1213
1213
  margin-top: 12px;
1214
1214
  }
@@ -1225,7 +1225,7 @@
1225
1225
  content: '';
1226
1226
  flex: 1;
1227
1227
  height: 1px;
1228
- background: ${a.authOutlineVariant}33;
1228
+ background: ${e.authOutlineVariant}33;
1229
1229
  }
1230
1230
 
1231
1231
  .ss-auth-mfa-divider span {
@@ -1233,7 +1233,7 @@
1233
1233
  font-weight: 700;
1234
1234
  text-transform: uppercase;
1235
1235
  letter-spacing: 0.2em;
1236
- color: ${a.authOutline};
1236
+ color: ${e.authOutline};
1237
1237
  }
1238
1238
 
1239
1239
  /* Footer Link */
@@ -1241,13 +1241,13 @@
1241
1241
  text-align: center;
1242
1242
  margin-top: 32px;
1243
1243
  font-size: 14px;
1244
- color: ${a.authOnSurfaceVariant};
1245
- font-family: ${a.authFontBody};
1244
+ color: ${e.authOnSurfaceVariant};
1245
+ font-family: ${e.authFontBody};
1246
1246
  }
1247
1247
 
1248
1248
  .ss-auth-footer a,
1249
1249
  .ss-auth-link {
1250
- color: ${a.authPrimary};
1250
+ color: ${e.authPrimary};
1251
1251
  text-decoration: none;
1252
1252
  font-weight: 600;
1253
1253
  cursor: pointer;
@@ -1260,34 +1260,58 @@
1260
1260
  .ss-auth-glass-panel {
1261
1261
  backdrop-filter: blur(20px);
1262
1262
  -webkit-backdrop-filter: blur(20px);
1263
- background: ${a.authSurfaceContainerLowest}e6;
1263
+ background: ${e.authSurfaceContainerLowest}e6;
1264
1264
  border-radius: 12px;
1265
1265
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
1266
- border: 1px solid ${a.authOutlineVariant}1a;
1266
+ border: 1px solid ${e.authOutlineVariant}1a;
1267
1267
  overflow: hidden;
1268
1268
  }
1269
1269
 
1270
+ /* User Trigger (avatar + org name pill) */
1271
+ .ss-auth-user-trigger {
1272
+ display: inline-flex;
1273
+ align-items: center;
1274
+ gap: 8px;
1275
+ padding: 4px 12px 4px 4px;
1276
+ border-radius: 999px;
1277
+ border: 1px solid ${e.authOutlineVariant}33;
1278
+ background: ${e.authSurfaceContainerLow};
1279
+ cursor: pointer;
1280
+ transition: background 0.15s, box-shadow 0.15s;
1281
+ font-family: ${e.authFontBody};
1282
+ }
1283
+
1284
+ .ss-auth-user-trigger:hover {
1285
+ background: ${e.authSurfaceContainer};
1286
+ box-shadow: 0 0 0 2px ${e.authPrimary}33;
1287
+ }
1288
+
1289
+ .ss-auth-user-trigger:active { transform: scale(0.98); }
1290
+
1291
+ .ss-auth-trigger-org-name {
1292
+ font-size: 13px;
1293
+ font-weight: 600;
1294
+ color: ${e.authOnSurface};
1295
+ max-width: 140px;
1296
+ overflow: hidden;
1297
+ text-overflow: ellipsis;
1298
+ white-space: nowrap;
1299
+ letter-spacing: -0.01em;
1300
+ }
1301
+
1270
1302
  /* Avatar Trigger */
1271
1303
  .ss-auth-avatar-trigger {
1272
1304
  width: 40px;
1273
1305
  height: 40px;
1274
1306
  border-radius: 50%;
1275
- border: 2px solid ${a.authPrimary};
1307
+ border: 2px solid ${e.authPrimary};
1276
1308
  overflow: hidden;
1277
- cursor: pointer;
1278
1309
  transition: transform 0.15s, box-shadow 0.15s;
1279
1310
  padding: 0;
1280
1311
  background: none;
1281
1312
  flex-shrink: 0;
1282
1313
  }
1283
1314
 
1284
- .ss-auth-avatar-trigger:hover {
1285
- transform: scale(1.05);
1286
- box-shadow: 0 0 0 3px ${a.authPrimary}33;
1287
- }
1288
-
1289
- .ss-auth-avatar-trigger:active { transform: scale(0.95); }
1290
-
1291
1315
  .ss-auth-avatar-trigger img {
1292
1316
  width: 100%;
1293
1317
  height: 100%;
@@ -1301,7 +1325,7 @@
1301
1325
  height: 128px;
1302
1326
  border-radius: 16px;
1303
1327
  overflow: hidden;
1304
- border: 4px solid ${a.authSurfaceContainer};
1328
+ border: 4px solid ${e.authSurfaceContainer};
1305
1329
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
1306
1330
  position: relative;
1307
1331
  cursor: pointer;
@@ -1320,7 +1344,7 @@
1320
1344
  .ss-auth-avatar-overlay {
1321
1345
  position: absolute;
1322
1346
  inset: 0;
1323
- background: ${a.authPrimary}99;
1347
+ background: ${e.authPrimary}99;
1324
1348
  display: flex;
1325
1349
  flex-direction: column;
1326
1350
  align-items: center;
@@ -1344,21 +1368,21 @@
1344
1368
  font-weight: 700;
1345
1369
  text-transform: uppercase;
1346
1370
  letter-spacing: 0.15em;
1347
- font-family: ${a.authFontHeadline};
1371
+ font-family: ${e.authFontHeadline};
1348
1372
  }
1349
1373
 
1350
1374
  /* Auth Sections */
1351
1375
  .ss-auth-section {
1352
1376
  padding-top: 32px;
1353
1377
  margin-top: 32px;
1354
- border-top: 1px solid ${a.authOutlineVariant}1a;
1378
+ border-top: 1px solid ${e.authOutlineVariant}1a;
1355
1379
  }
1356
1380
 
1357
1381
  .ss-auth-section-title {
1358
- font-family: ${a.authFontHeadline};
1382
+ font-family: ${e.authFontHeadline};
1359
1383
  font-size: 16px;
1360
1384
  font-weight: 700;
1361
- color: ${a.authOnSurface};
1385
+ color: ${e.authOnSurface};
1362
1386
  letter-spacing: -0.01em;
1363
1387
  display: flex;
1364
1388
  align-items: center;
@@ -1366,13 +1390,13 @@
1366
1390
  }
1367
1391
 
1368
1392
  .ss-auth-section-title .material-symbols-outlined {
1369
- color: ${a.authPrimary};
1393
+ color: ${e.authPrimary};
1370
1394
  font-size: 20px;
1371
1395
  }
1372
1396
 
1373
1397
  .ss-auth-section-desc {
1374
1398
  font-size: 12px;
1375
- color: ${a.authOnSurfaceVariant};
1399
+ color: ${e.authOnSurfaceVariant};
1376
1400
  margin-top: 4px;
1377
1401
  }
1378
1402
 
@@ -1381,14 +1405,14 @@
1381
1405
  font-weight: 800;
1382
1406
  text-transform: uppercase;
1383
1407
  letter-spacing: 0.15em;
1384
- color: ${a.authOnSurfaceVariant}99;
1408
+ color: ${e.authOnSurfaceVariant}99;
1385
1409
  padding: 8px 16px 4px;
1386
1410
  }
1387
1411
 
1388
1412
  /* Sign Out Section */
1389
1413
  .ss-auth-signout-section {
1390
- background: ${a.authError}0d;
1391
- border-top: 1px solid ${a.authOutlineVariant}1a;
1414
+ background: ${e.authError}0d;
1415
+ border-top: 1px solid ${e.authOutlineVariant}1a;
1392
1416
  padding: 8px;
1393
1417
  }
1394
1418
 
@@ -1404,25 +1428,25 @@
1404
1428
  background: none;
1405
1429
  border: none;
1406
1430
  width: 100%;
1407
- font-family: ${a.authFontBody};
1431
+ font-family: ${e.authFontBody};
1408
1432
  font-size: 14px;
1409
- color: ${a.authOnSurfaceVariant};
1433
+ color: ${e.authOnSurfaceVariant};
1410
1434
  text-align: left;
1411
1435
  }
1412
1436
 
1413
1437
  .ss-auth-org-item:hover {
1414
- background: ${a.authSurfaceContainerLow};
1415
- color: ${a.authOnSurface};
1438
+ background: ${e.authSurfaceContainerLow};
1439
+ color: ${e.authOnSurface};
1416
1440
  }
1417
1441
 
1418
1442
  .ss-auth-org-item-active {
1419
- background: ${a.authPrimaryFixed}4d;
1420
- color: ${a.authPrimary};
1443
+ background: ${e.authPrimaryFixed}4d;
1444
+ color: ${e.authPrimary};
1421
1445
  font-weight: 600;
1422
1446
  }
1423
1447
 
1424
1448
  .ss-auth-org-item-active:hover {
1425
- background: ${a.authPrimaryFixed}4d;
1449
+ background: ${e.authPrimaryFixed}4d;
1426
1450
  }
1427
1451
 
1428
1452
  .ss-auth-org-item-inner {
@@ -1435,8 +1459,8 @@
1435
1459
  width: 32px;
1436
1460
  height: 32px;
1437
1461
  border-radius: 6px;
1438
- background: linear-gradient(135deg, ${a.authPrimary}, ${a.authPrimaryContainer});
1439
- color: ${a.authOnPrimary};
1462
+ background: linear-gradient(135deg, ${e.authPrimary}, ${e.authPrimaryContainer});
1463
+ color: ${e.authOnPrimary};
1440
1464
  display: flex;
1441
1465
  align-items: center;
1442
1466
  justify-content: center;
@@ -1446,15 +1470,33 @@
1446
1470
  }
1447
1471
 
1448
1472
  .ss-auth-org-avatar-inactive {
1449
- background: ${a.authSurfaceContainerHigh};
1450
- color: ${a.authOnSurfaceVariant};
1473
+ background: ${e.authSurfaceContainerHigh};
1474
+ color: ${e.authOnSurfaceVariant};
1451
1475
  }
1452
1476
 
1453
1477
  .ss-auth-org-check {
1454
- color: ${a.authPrimary};
1478
+ color: ${e.authPrimary};
1455
1479
  font-variation-settings: 'FILL' 1;
1456
1480
  }
1457
1481
 
1482
+ /* Plan Badge */
1483
+ .ss-auth-plan-badge {
1484
+ display: inline-block;
1485
+ font-size: 10px;
1486
+ font-weight: 700;
1487
+ text-transform: uppercase;
1488
+ letter-spacing: 0.05em;
1489
+ padding: 2px 8px;
1490
+ border-radius: 999px;
1491
+ background: ${e.authPrimary}1a;
1492
+ color: ${e.authPrimary};
1493
+ border: 1px solid ${e.authPrimary}33;
1494
+ margin-left: auto;
1495
+ white-space: nowrap;
1496
+ flex-shrink: 0;
1497
+ font-family: ${e.authFontBody};
1498
+ }
1499
+
1458
1500
  /* Modal Overlay */
1459
1501
  .ss-auth-modal-overlay {
1460
1502
  position: fixed;
@@ -1479,7 +1521,7 @@
1479
1521
  }
1480
1522
 
1481
1523
  .ss-auth-modal {
1482
- background: ${a.authSurfaceContainer};
1524
+ background: ${e.authSurfaceContainer};
1483
1525
  border-radius: 12px;
1484
1526
  width: 100%;
1485
1527
  max-width: 560px;
@@ -1499,22 +1541,22 @@
1499
1541
  align-items: center;
1500
1542
  justify-content: space-between;
1501
1543
  padding: 24px 32px;
1502
- background: ${a.authSurfaceContainerHigh}80;
1544
+ background: ${e.authSurfaceContainerHigh}80;
1503
1545
  }
1504
1546
 
1505
1547
  .ss-auth-modal-header h2 {
1506
- font-family: ${a.authFontHeadline};
1548
+ font-family: ${e.authFontHeadline};
1507
1549
  font-size: 20px;
1508
1550
  font-weight: 700;
1509
1551
  letter-spacing: -0.02em;
1510
- color: ${a.authOnSurface};
1552
+ color: ${e.authOnSurface};
1511
1553
  margin: 0;
1512
1554
  }
1513
1555
 
1514
1556
  .ss-auth-modal-close {
1515
1557
  background: none;
1516
1558
  border: none;
1517
- color: ${a.authOnSurfaceVariant};
1559
+ color: ${e.authOnSurfaceVariant};
1518
1560
  cursor: pointer;
1519
1561
  padding: 4px;
1520
1562
  border-radius: 50%;
@@ -1522,7 +1564,7 @@
1522
1564
  display: flex;
1523
1565
  }
1524
1566
 
1525
- .ss-auth-modal-close:hover { color: ${a.authOnSurface}; background: ${a.authSurfaceContainerHigh}; }
1567
+ .ss-auth-modal-close:hover { color: ${e.authOnSurface}; background: ${e.authSurfaceContainerHigh}; }
1526
1568
 
1527
1569
  .ss-auth-modal-body { padding: 32px; }
1528
1570
 
@@ -1532,7 +1574,7 @@
1532
1574
  justify-content: flex-end;
1533
1575
  gap: 12px;
1534
1576
  padding: 16px 32px;
1535
- border-top: 1px solid ${a.authOutlineVariant}4d;
1577
+ border-top: 1px solid ${e.authOutlineVariant}4d;
1536
1578
  }
1537
1579
 
1538
1580
  /* Profile Header (gradient bg) */
@@ -1543,24 +1585,24 @@
1543
1585
  flex-direction: row;
1544
1586
  align-items: center;
1545
1587
  gap: 32px;
1546
- border-bottom: 1px solid ${a.authOutlineVariant}1a;
1547
- background: linear-gradient(135deg, ${a.authSurfaceContainerHigh}, ${a.authSurface});
1588
+ border-bottom: 1px solid ${e.authOutlineVariant}1a;
1589
+ background: linear-gradient(135deg, ${e.authSurfaceContainerHigh}, ${e.authSurface});
1548
1590
  }
1549
1591
 
1550
1592
  .ss-auth-profile-info { flex: 1; }
1551
1593
 
1552
1594
  .ss-auth-profile-name {
1553
- font-family: ${a.authFontHeadline};
1595
+ font-family: ${e.authFontHeadline};
1554
1596
  font-size: 22px;
1555
1597
  font-weight: 800;
1556
- color: ${a.authOnSurface};
1598
+ color: ${e.authOnSurface};
1557
1599
  letter-spacing: -0.02em;
1558
1600
  margin: 0;
1559
1601
  }
1560
1602
 
1561
1603
  .ss-auth-profile-desc {
1562
1604
  font-size: 13px;
1563
- color: ${a.authOnSurfaceVariant};
1605
+ color: ${e.authOnSurfaceVariant};
1564
1606
  margin-top: 4px;
1565
1607
  line-height: 1.5;
1566
1608
  }
@@ -1576,17 +1618,17 @@
1576
1618
  font-weight: 700;
1577
1619
  text-transform: uppercase;
1578
1620
  letter-spacing: 0.1em;
1579
- background: ${a.authPrimary}33;
1580
- color: ${a.authPrimary};
1581
- border: 1px solid ${a.authPrimary}4d;
1621
+ background: ${e.authPrimary}33;
1622
+ color: ${e.authPrimary};
1623
+ border: 1px solid ${e.authPrimary}4d;
1582
1624
  margin-left: 8px;
1583
1625
  vertical-align: middle;
1584
1626
  }
1585
1627
 
1586
1628
  .ss-auth-badge-success {
1587
- background: ${a.authSuccess}1a;
1588
- color: ${a.authSuccess};
1589
- border-color: ${a.authSuccess}4d;
1629
+ background: ${e.authSuccess}1a;
1630
+ color: ${e.authSuccess};
1631
+ border-color: ${e.authSuccess}4d;
1590
1632
  }
1591
1633
 
1592
1634
  /* Profile Grid */
@@ -1607,21 +1649,21 @@
1607
1649
 
1608
1650
  /* Info Box */
1609
1651
  .ss-auth-info-box {
1610
- background: ${a.authSurfaceContainerLowest}66;
1652
+ background: ${e.authSurfaceContainerLowest}66;
1611
1653
  border-radius: 8px;
1612
1654
  padding: 12px 16px;
1613
- border: 1px solid ${a.authOutlineVariant}33;
1655
+ border: 1px solid ${e.authOutlineVariant}33;
1614
1656
  display: flex;
1615
1657
  align-items: flex-start;
1616
1658
  gap: 12px;
1617
1659
  font-size: 11px;
1618
1660
  line-height: 1.6;
1619
- color: ${a.authOnSurfaceVariant};
1661
+ color: ${e.authOnSurfaceVariant};
1620
1662
  }
1621
1663
 
1622
1664
  .ss-auth-info-box .material-symbols-outlined {
1623
1665
  font-size: 16px;
1624
- color: ${a.authPrimary};
1666
+ color: ${e.authPrimary};
1625
1667
  flex-shrink: 0;
1626
1668
  margin-top: 1px;
1627
1669
  }
@@ -1636,7 +1678,7 @@
1636
1678
 
1637
1679
  /* Dropzone */
1638
1680
  .ss-auth-dropzone {
1639
- border: 2px dashed ${a.authOutlineVariant};
1681
+ border: 2px dashed ${e.authOutlineVariant};
1640
1682
  border-radius: 12px;
1641
1683
  padding: 32px 24px;
1642
1684
  text-align: center;
@@ -1652,15 +1694,15 @@
1652
1694
 
1653
1695
  .ss-auth-dropzone:hover,
1654
1696
  .ss-auth-dropzone-active {
1655
- border-color: ${a.authPrimary};
1656
- background: ${a.authSurfaceContainerLow};
1697
+ border-color: ${e.authPrimary};
1698
+ background: ${e.authSurfaceContainerLow};
1657
1699
  }
1658
1700
 
1659
1701
  .ss-auth-dropzone-icon {
1660
1702
  width: 48px;
1661
1703
  height: 48px;
1662
1704
  border-radius: 50%;
1663
- background: ${a.authPrimaryContainer}33;
1705
+ background: ${e.authPrimaryContainer}33;
1664
1706
  display: flex;
1665
1707
  align-items: center;
1666
1708
  justify-content: center;
@@ -1671,20 +1713,20 @@
1671
1713
  .ss-auth-dropzone:hover .ss-auth-dropzone-icon { transform: scale(1.1); }
1672
1714
 
1673
1715
  .ss-auth-dropzone-icon .material-symbols-outlined {
1674
- color: ${a.authPrimary};
1716
+ color: ${e.authPrimary};
1675
1717
  font-size: 24px;
1676
1718
  }
1677
1719
 
1678
1720
  .ss-auth-dropzone-title {
1679
- font-family: ${a.authFontHeadline};
1721
+ font-family: ${e.authFontHeadline};
1680
1722
  font-size: 14px;
1681
1723
  font-weight: 700;
1682
- color: ${a.authOnSurface};
1724
+ color: ${e.authOnSurface};
1683
1725
  }
1684
1726
 
1685
1727
  .ss-auth-dropzone-desc {
1686
1728
  font-size: 12px;
1687
- color: ${a.authOnSurfaceVariant};
1729
+ color: ${e.authOnSurfaceVariant};
1688
1730
  line-height: 1.5;
1689
1731
  }
1690
1732
 
@@ -1693,8 +1735,8 @@
1693
1735
  padding: 8px 16px;
1694
1736
  font-size: 12px;
1695
1737
  font-weight: 600;
1696
- background: ${a.authSurfaceContainerHighest};
1697
- color: ${a.authOnSurfaceVariant};
1738
+ background: ${e.authSurfaceContainerHighest};
1739
+ color: ${e.authOnSurfaceVariant};
1698
1740
  border: none;
1699
1741
  border-radius: 8px;
1700
1742
  cursor: pointer;
@@ -1702,8 +1744,8 @@
1702
1744
  }
1703
1745
 
1704
1746
  .ss-auth-dropzone-btn:hover {
1705
- background: ${a.authPrimary};
1706
- color: ${a.authOnPrimary};
1747
+ background: ${e.authPrimary};
1748
+ color: ${e.authOnPrimary};
1707
1749
  }
1708
1750
 
1709
1751
  /* Zoom Controls */
@@ -1712,12 +1754,12 @@
1712
1754
  align-items: center;
1713
1755
  gap: 16px;
1714
1756
  padding: 16px;
1715
- background: ${a.authSurfaceContainer};
1757
+ background: ${e.authSurfaceContainer};
1716
1758
  border-radius: 8px;
1717
1759
  }
1718
1760
 
1719
1761
  .ss-auth-zoom-control .material-symbols-outlined {
1720
- color: ${a.authOnSurfaceVariant};
1762
+ color: ${e.authOnSurfaceVariant};
1721
1763
  font-size: 20px;
1722
1764
  }
1723
1765
 
@@ -1726,7 +1768,7 @@
1726
1768
  height: 6px;
1727
1769
  -webkit-appearance: none;
1728
1770
  appearance: none;
1729
- background: ${a.authOutlineVariant}4d;
1771
+ background: ${e.authOutlineVariant}4d;
1730
1772
  border-radius: 3px;
1731
1773
  outline: none;
1732
1774
  }
@@ -1736,9 +1778,9 @@
1736
1778
  width: 18px;
1737
1779
  height: 18px;
1738
1780
  border-radius: 50%;
1739
- background: ${a.authPrimary};
1781
+ background: ${e.authPrimary};
1740
1782
  cursor: pointer;
1741
- border: 2px solid ${a.authSurfaceContainerLowest};
1783
+ border: 2px solid ${e.authSurfaceContainerLowest};
1742
1784
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
1743
1785
  }
1744
1786
 
@@ -1746,9 +1788,9 @@
1746
1788
  width: 18px;
1747
1789
  height: 18px;
1748
1790
  border-radius: 50%;
1749
- background: ${a.authPrimary};
1791
+ background: ${e.authPrimary};
1750
1792
  cursor: pointer;
1751
- border: 2px solid ${a.authSurfaceContainerLowest};
1793
+ border: 2px solid ${e.authSurfaceContainerLowest};
1752
1794
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
1753
1795
  }
1754
1796
 
@@ -1757,7 +1799,7 @@
1757
1799
  width: 320px;
1758
1800
  max-width: 100%;
1759
1801
  aspect-ratio: 1;
1760
- background: ${a.authSurfaceContainerLowest};
1802
+ background: ${e.authSurfaceContainerLowest};
1761
1803
  border-radius: 8px;
1762
1804
  overflow: hidden;
1763
1805
  position: relative;
@@ -1768,14 +1810,14 @@
1768
1810
  position: absolute;
1769
1811
  bottom: 12px;
1770
1812
  left: 12px;
1771
- background: ${a.authSurfaceContainerHighest}cc;
1813
+ background: ${e.authSurfaceContainerHighest}cc;
1772
1814
  backdrop-filter: blur(8px);
1773
1815
  padding: 4px 12px;
1774
1816
  border-radius: 999px;
1775
- border: 1px solid ${a.authOutlineVariant}4d;
1817
+ border: 1px solid ${e.authOutlineVariant}4d;
1776
1818
  font-size: 11px;
1777
1819
  font-weight: 600;
1778
- color: ${a.authOnSurfaceVariant};
1820
+ color: ${e.authOnSurfaceVariant};
1779
1821
  }
1780
1822
 
1781
1823
  /* Dropdown for UserButton / OrgSwitcher */
@@ -1794,15 +1836,15 @@
1794
1836
  display: flex;
1795
1837
  align-items: center;
1796
1838
  gap: 16px;
1797
- border-bottom: 1px solid ${a.authOutlineVariant}1a;
1798
- background: ${a.authSurfaceContainerLow}80;
1839
+ border-bottom: 1px solid ${e.authOutlineVariant}1a;
1840
+ background: ${e.authSurfaceContainerLow}80;
1799
1841
  }
1800
1842
 
1801
1843
  .ss-auth-dropdown-avatar {
1802
1844
  width: 48px;
1803
1845
  height: 48px;
1804
1846
  border-radius: 50%;
1805
- border: 2px solid ${a.authPrimaryContainer};
1847
+ border: 2px solid ${e.authPrimaryContainer};
1806
1848
  overflow: hidden;
1807
1849
  flex-shrink: 0;
1808
1850
  }
@@ -1814,16 +1856,16 @@
1814
1856
  }
1815
1857
 
1816
1858
  .ss-auth-dropdown-name {
1817
- font-family: ${a.authFontHeadline};
1859
+ font-family: ${e.authFontHeadline};
1818
1860
  font-size: 14px;
1819
1861
  font-weight: 800;
1820
- color: ${a.authOnSurface};
1862
+ color: ${e.authOnSurface};
1821
1863
  letter-spacing: -0.01em;
1822
1864
  }
1823
1865
 
1824
1866
  .ss-auth-dropdown-email {
1825
1867
  font-size: 13px;
1826
- color: ${a.authOnSurfaceVariant};
1868
+ color: ${e.authOnSurfaceVariant};
1827
1869
  }
1828
1870
 
1829
1871
  .ss-auth-dropdown-action {
@@ -1837,18 +1879,18 @@
1837
1879
  background: none;
1838
1880
  border: none;
1839
1881
  width: 100%;
1840
- font-family: ${a.authFontBody};
1882
+ font-family: ${e.authFontBody};
1841
1883
  font-size: 14px;
1842
1884
  font-weight: 600;
1843
- color: ${a.authOnSurface};
1885
+ color: ${e.authOnSurface};
1844
1886
  text-align: left;
1845
1887
  text-decoration: none;
1846
1888
  }
1847
1889
 
1848
- .ss-auth-dropdown-action:hover { background: ${a.authSurfaceContainer}; }
1890
+ .ss-auth-dropdown-action:hover { background: ${e.authSurfaceContainer}; }
1849
1891
 
1850
1892
  .ss-auth-dropdown-action .material-symbols-outlined {
1851
- color: ${a.authPrimary};
1893
+ color: ${e.authPrimary};
1852
1894
  font-size: 20px;
1853
1895
  transition: transform 0.15s;
1854
1896
  }
@@ -1861,17 +1903,17 @@
1861
1903
  align-items: center;
1862
1904
  justify-content: space-between;
1863
1905
  padding: 12px 16px;
1864
- background: ${a.authSurfaceContainerLowest};
1906
+ background: ${e.authSurfaceContainerLowest};
1865
1907
  border: 1px solid transparent;
1866
1908
  border-radius: 8px;
1867
1909
  cursor: pointer;
1868
1910
  transition: border-color 0.15s, box-shadow 0.15s;
1869
1911
  width: 100%;
1870
- font-family: ${a.authFontBody};
1912
+ font-family: ${e.authFontBody};
1871
1913
  }
1872
1914
 
1873
1915
  .ss-auth-org-trigger:hover {
1874
- border-color: ${a.authOutlineVariant}4d;
1916
+ border-color: ${e.authOutlineVariant}4d;
1875
1917
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
1876
1918
  }
1877
1919
 
@@ -1884,29 +1926,29 @@
1884
1926
  .ss-auth-org-trigger-label {
1885
1927
  font-size: 11px;
1886
1928
  font-weight: 700;
1887
- color: ${a.authPrimary};
1929
+ color: ${e.authPrimary};
1888
1930
  text-transform: uppercase;
1889
1931
  letter-spacing: 0.05em;
1890
1932
  margin-bottom: 2px;
1891
1933
  }
1892
1934
 
1893
1935
  .ss-auth-org-trigger-name {
1894
- font-family: ${a.authFontHeadline};
1936
+ font-family: ${e.authFontHeadline};
1895
1937
  font-size: 14px;
1896
1938
  font-weight: 700;
1897
- color: ${a.authOnSurface};
1939
+ color: ${e.authOnSurface};
1898
1940
  }
1899
1941
 
1900
1942
  .ss-auth-org-trigger .material-symbols-outlined {
1901
- color: ${a.authOnSurfaceVariant};
1943
+ color: ${e.authOnSurfaceVariant};
1902
1944
  transition: color 0.15s;
1903
1945
  }
1904
1946
 
1905
- .ss-auth-org-trigger:hover .material-symbols-outlined { color: ${a.authPrimary}; }
1947
+ .ss-auth-org-trigger:hover .material-symbols-outlined { color: ${e.authPrimary}; }
1906
1948
 
1907
1949
  /* OrgSwitcher Create Section */
1908
1950
  .ss-auth-org-create {
1909
- background: ${a.authSurfaceContainerLow}80;
1951
+ background: ${e.authSurfaceContainerLow}80;
1910
1952
  padding: 16px;
1911
1953
  }
1912
1954
 
@@ -1919,11 +1961,11 @@
1919
1961
  font-weight: 700;
1920
1962
  text-transform: uppercase;
1921
1963
  letter-spacing: 0.05em;
1922
- color: ${a.authOnSurfaceVariant};
1964
+ color: ${e.authOnSurfaceVariant};
1923
1965
  }
1924
1966
 
1925
1967
  .ss-auth-org-create-header .material-symbols-outlined {
1926
- color: ${a.authPrimary};
1968
+ color: ${e.authPrimary};
1927
1969
  font-size: 16px;
1928
1970
  }
1929
1971
 
@@ -1938,14 +1980,14 @@
1938
1980
  top: 50%;
1939
1981
  transform: translateY(-50%);
1940
1982
  font-size: 12px;
1941
- color: ${a.authOutline};
1983
+ color: ${e.authOutline};
1942
1984
  font-weight: 500;
1943
1985
  }
1944
1986
 
1945
1987
  /* Inline Create (UserButton dropdown) */
1946
1988
  .ss-auth-inline-create {
1947
1989
  padding: 12px 16px;
1948
- border-top: 1px solid ${a.authOutlineVariant}1a;
1990
+ border-top: 1px solid ${e.authOutlineVariant}1a;
1949
1991
  }
1950
1992
 
1951
1993
  .ss-auth-inline-create-input {
@@ -1964,7 +2006,7 @@
1964
2006
  transform: translateY(-50%);
1965
2007
  background: none;
1966
2008
  border: none;
1967
- color: ${a.authPrimary};
2009
+ color: ${e.authPrimary};
1968
2010
  cursor: pointer;
1969
2011
  padding: 4px;
1970
2012
  border-radius: 6px;
@@ -1972,7 +2014,7 @@
1972
2014
  transition: background 0.15s;
1973
2015
  }
1974
2016
 
1975
- .ss-auth-inline-create-btn:hover { background: ${a.authPrimary}1a; }
2017
+ .ss-auth-inline-create-btn:hover { background: ${e.authPrimary}1a; }
1976
2018
 
1977
2019
  /* Signout row in profile */
1978
2020
  .ss-auth-signout-row {
@@ -1992,27 +2034,27 @@
1992
2034
  width: 40px;
1993
2035
  height: 40px;
1994
2036
  border-radius: 50%;
1995
- background: ${a.authError}1a;
2037
+ background: ${e.authError}1a;
1996
2038
  display: flex;
1997
2039
  align-items: center;
1998
2040
  justify-content: center;
1999
2041
  }
2000
2042
 
2001
2043
  .ss-auth-signout-icon .material-symbols-outlined {
2002
- color: ${a.authError};
2044
+ color: ${e.authError};
2003
2045
  font-size: 20px;
2004
2046
  }
2005
2047
 
2006
2048
  .ss-auth-signout-title {
2007
- font-family: ${a.authFontHeadline};
2049
+ font-family: ${e.authFontHeadline};
2008
2050
  font-size: 14px;
2009
2051
  font-weight: 700;
2010
- color: ${a.authOnSurface};
2052
+ color: ${e.authOnSurface};
2011
2053
  }
2012
2054
 
2013
2055
  .ss-auth-signout-desc {
2014
2056
  font-size: 12px;
2015
- color: ${a.authOnSurfaceVariant};
2057
+ color: ${e.authOnSurfaceVariant};
2016
2058
  }
2017
2059
 
2018
2060
  /* Auth Spinner */
@@ -2020,12 +2062,255 @@
2020
2062
  display: inline-block;
2021
2063
  width: 16px;
2022
2064
  height: 16px;
2023
- border: 2px solid ${a.authOnPrimary}4d;
2024
- border-top-color: ${a.authOnPrimary};
2065
+ border: 2px solid ${e.authOnPrimary}4d;
2066
+ border-top-color: ${e.authOnPrimary};
2025
2067
  border-radius: 50%;
2026
2068
  animation: ss-spin 0.6s linear infinite;
2027
2069
  }
2028
2070
 
2071
+ /* Settings Panel (full-page overlay) */
2072
+ .ss-auth-settings-page {
2073
+ width: 100%;
2074
+ height: 100%;
2075
+ display: flex;
2076
+ flex-direction: column;
2077
+ background: ${e.authSurface};
2078
+ animation: ss-auth-scale-in 0.2s ease-out;
2079
+ }
2080
+
2081
+ .ss-auth-settings-header {
2082
+ display: flex;
2083
+ align-items: center;
2084
+ justify-content: space-between;
2085
+ padding: 20px 32px;
2086
+ border-bottom: 1px solid ${e.authOutlineVariant}1a;
2087
+ background: ${e.authSurfaceContainerHigh}80;
2088
+ flex-shrink: 0;
2089
+ }
2090
+
2091
+ .ss-auth-settings-header h2 {
2092
+ font-family: ${e.authFontHeadline};
2093
+ font-size: 20px;
2094
+ font-weight: 700;
2095
+ letter-spacing: -0.02em;
2096
+ color: ${e.authOnSurface};
2097
+ margin: 0;
2098
+ }
2099
+
2100
+ .ss-auth-settings-layout {
2101
+ display: flex;
2102
+ flex: 1;
2103
+ overflow: hidden;
2104
+ }
2105
+
2106
+ .ss-auth-settings-nav {
2107
+ width: 220px;
2108
+ padding: 16px;
2109
+ border-right: 1px solid ${e.authOutlineVariant}1a;
2110
+ display: flex;
2111
+ flex-direction: column;
2112
+ gap: 4px;
2113
+ flex-shrink: 0;
2114
+ background: ${e.authSurfaceContainerLow};
2115
+ }
2116
+
2117
+ .ss-auth-settings-nav-item {
2118
+ display: flex;
2119
+ align-items: center;
2120
+ gap: 10px;
2121
+ padding: 10px 14px;
2122
+ border-radius: 8px;
2123
+ cursor: pointer;
2124
+ transition: background 0.15s, color 0.15s;
2125
+ background: none;
2126
+ border: none;
2127
+ width: 100%;
2128
+ font-family: ${e.authFontBody};
2129
+ font-size: 14px;
2130
+ font-weight: 500;
2131
+ color: ${e.authOnSurfaceVariant};
2132
+ text-align: left;
2133
+ }
2134
+
2135
+ .ss-auth-settings-nav-item:hover {
2136
+ background: ${e.authSurfaceContainer};
2137
+ color: ${e.authOnSurface};
2138
+ }
2139
+
2140
+ .ss-auth-settings-nav-item-active {
2141
+ background: ${e.authPrimaryFixed}4d;
2142
+ color: ${e.authPrimary};
2143
+ font-weight: 600;
2144
+ }
2145
+
2146
+ .ss-auth-settings-nav-item-active:hover {
2147
+ background: ${e.authPrimaryFixed}4d;
2148
+ }
2149
+
2150
+ .ss-auth-settings-nav-item .material-symbols-outlined {
2151
+ font-size: 20px;
2152
+ }
2153
+
2154
+ .ss-auth-settings-content {
2155
+ flex: 1;
2156
+ overflow-y: auto;
2157
+ padding: 32px;
2158
+ }
2159
+
2160
+ .ss-auth-settings-content h3 {
2161
+ font-family: ${e.authFontHeadline};
2162
+ font-size: 18px;
2163
+ font-weight: 700;
2164
+ color: ${e.authOnSurface};
2165
+ letter-spacing: -0.01em;
2166
+ margin: 0 0 24px 0;
2167
+ }
2168
+
2169
+ .ss-auth-settings-card {
2170
+ background: ${e.authSurfaceContainer};
2171
+ border: 1px solid ${e.authOutlineVariant}1a;
2172
+ border-radius: 12px;
2173
+ padding: 24px;
2174
+ margin-bottom: 24px;
2175
+ }
2176
+
2177
+ .ss-auth-settings-card h4 {
2178
+ font-family: ${e.authFontHeadline};
2179
+ font-size: 15px;
2180
+ font-weight: 700;
2181
+ color: ${e.authOnSurface};
2182
+ margin: 0 0 16px 0;
2183
+ display: flex;
2184
+ align-items: center;
2185
+ gap: 8px;
2186
+ }
2187
+
2188
+ .ss-auth-settings-card h4 .material-symbols-outlined {
2189
+ color: ${e.authPrimary};
2190
+ font-size: 20px;
2191
+ }
2192
+
2193
+ /* Settings Table */
2194
+ .ss-auth-settings-table {
2195
+ width: 100%;
2196
+ border-collapse: collapse;
2197
+ font-family: ${e.authFontBody};
2198
+ font-size: 14px;
2199
+ }
2200
+
2201
+ .ss-auth-settings-table th {
2202
+ text-align: left;
2203
+ padding: 8px 12px;
2204
+ font-size: 11px;
2205
+ font-weight: 700;
2206
+ text-transform: uppercase;
2207
+ letter-spacing: 0.08em;
2208
+ color: ${e.authOnSurfaceVariant};
2209
+ border-bottom: 1px solid ${e.authOutlineVariant}33;
2210
+ }
2211
+
2212
+ .ss-auth-settings-table td {
2213
+ padding: 10px 12px;
2214
+ color: ${e.authOnSurface};
2215
+ border-bottom: 1px solid ${e.authOutlineVariant}1a;
2216
+ }
2217
+
2218
+ .ss-auth-settings-table tr:last-child td {
2219
+ border-bottom: none;
2220
+ }
2221
+
2222
+ .ss-auth-settings-table tr:hover td {
2223
+ background: ${e.authSurfaceContainerLow};
2224
+ }
2225
+
2226
+ /* Settings Role Badges */
2227
+ .ss-auth-role-badge {
2228
+ display: inline-block;
2229
+ font-size: 10px;
2230
+ font-weight: 700;
2231
+ text-transform: uppercase;
2232
+ letter-spacing: 0.05em;
2233
+ padding: 2px 8px;
2234
+ border-radius: 999px;
2235
+ font-family: ${e.authFontBody};
2236
+ }
2237
+
2238
+ .ss-auth-role-badge-owner {
2239
+ background: #8b5cf633;
2240
+ color: #8b5cf6;
2241
+ border: 1px solid #8b5cf64d;
2242
+ }
2243
+
2244
+ .ss-auth-role-badge-admin {
2245
+ background: #3b82f633;
2246
+ color: #3b82f6;
2247
+ border: 1px solid #3b82f64d;
2248
+ }
2249
+
2250
+ .ss-auth-role-badge-member {
2251
+ background: ${e.authOnSurfaceVariant}1a;
2252
+ color: ${e.authOnSurfaceVariant};
2253
+ border: 1px solid ${e.authOutlineVariant}33;
2254
+ }
2255
+
2256
+ /* Settings icon buttons */
2257
+ .ss-auth-icon-btn {
2258
+ background: none;
2259
+ border: none;
2260
+ cursor: pointer;
2261
+ padding: 4px;
2262
+ border-radius: 6px;
2263
+ color: ${e.authOnSurfaceVariant};
2264
+ display: inline-flex;
2265
+ align-items: center;
2266
+ justify-content: center;
2267
+ transition: background 0.15s, color 0.15s;
2268
+ }
2269
+
2270
+ .ss-auth-icon-btn:hover {
2271
+ background: ${e.authSurfaceContainerHigh};
2272
+ color: ${e.authOnSurface};
2273
+ }
2274
+
2275
+ .ss-auth-icon-btn-danger:hover {
2276
+ background: ${e.authError}1a;
2277
+ color: ${e.authError};
2278
+ }
2279
+
2280
+ .ss-auth-icon-btn .material-symbols-outlined {
2281
+ font-size: 18px;
2282
+ }
2283
+
2284
+ /* Settings Empty State */
2285
+ .ss-auth-settings-empty {
2286
+ text-align: center;
2287
+ padding: 40px 20px;
2288
+ color: ${e.authOnSurfaceVariant};
2289
+ font-size: 14px;
2290
+ }
2291
+
2292
+ .ss-auth-settings-empty .material-symbols-outlined {
2293
+ font-size: 40px;
2294
+ margin-bottom: 12px;
2295
+ opacity: 0.4;
2296
+ }
2297
+
2298
+ /* Settings action row */
2299
+ .ss-auth-settings-actions {
2300
+ display: flex;
2301
+ align-items: center;
2302
+ gap: 8px;
2303
+ }
2304
+
2305
+ /* Settings Danger Card */
2306
+ .ss-auth-settings-danger {
2307
+ border-color: ${e.authError}33;
2308
+ }
2309
+
2310
+ .ss-auth-settings-danger h4 {
2311
+ color: ${e.authError};
2312
+ }
2313
+
2029
2314
  /* Responsive overrides */
2030
2315
  @media (max-width: 640px) {
2031
2316
  .ss-auth-profile-header {
@@ -2039,5 +2324,10 @@
2039
2324
 
2040
2325
  .ss-auth-signout-row { flex-direction: column; text-align: center; }
2041
2326
  .ss-auth-signout-info { flex-direction: column; }
2327
+
2328
+ .ss-auth-settings-nav { width: 180px; padding: 12px; }
2329
+ .ss-auth-settings-content { padding: 24px; }
2330
+ .ss-auth-trigger-org-name { display: none; }
2331
+ .ss-auth-user-trigger { padding: 0; border: none; background: none; }
2042
2332
  }
2043
- `}function M({children:a,appearance:r}){const e=t.useRef(null),[o,n]=t.useState(null);t.useEffect(()=>{var x;if(!e.current||e.current.shadowRoot){n(((x=e.current)==null?void 0:x.shadowRoot)??null);return}const l=e.current.attachShadow({mode:"open"});if((r==null?void 0:r.fontUrl)!==null){const p=(r==null?void 0:r.fontUrl)??"https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&family=Inter:wght@400;500;600&family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200&display=swap";if(!document.querySelector(`link[href="${p}"]`)){const f=document.createElement("link");f.rel="stylesheet",f.href=p,document.head.appendChild(f)}const g=document.createElement("link");g.rel="stylesheet",g.href=p,l.appendChild(g)}const c=Y(r),d=document.createElement("style");d.textContent=Q(c),l.appendChild(d);const i=document.createElement("div");l.appendChild(i),n(l)},[]),t.useEffect(()=>{if(!o)return;const l=o.querySelector("style");if(l){const c=Y(r);l.textContent=Q(c)}},[r,o]);const u=(o==null?void 0:o.querySelector("div"))??null;return s.jsx("div",{ref:e,style:{display:"contents"},children:u&&vs.createPortal(a,u)})}function H(){const{client:a,user:r,isLoaded:e}=E();return{isLoaded:e,isSignedIn:!!r,user:r,signOut:t.useCallback(()=>a.auth.signOut(),[a]),getToken:t.useCallback(()=>a.auth.getToken(),[a])}}function $s(){const{user:a,isLoaded:r}=E();return{user:a,isLoaded:r}}function Z(){const{client:a}=E(),[r,e]=t.useState(!1),[o,n]=t.useState(null),u=t.useCallback(async(d,i)=>{e(!0),n(null);try{return await a.auth.signIn(d,i)}catch(x){return n(x instanceof Error?x.message:"Sign in failed"),null}finally{e(!1)}},[a]),l=t.useCallback(async d=>{e(!0),n(null);try{return await a.auth.signInWithOAuth(d)}catch(i){return n(i instanceof Error?i.message:"OAuth sign in failed"),null}finally{e(!1)}},[a]),c=t.useCallback(async(d,i)=>{e(!0),n(null);try{return await a.auth.submitMfaCode(d,i)}catch(x){return n(x instanceof Error?x.message:"MFA verification failed"),null}finally{e(!1)}},[a]);return{signIn:u,signInWithOAuth:l,submitMfaCode:c,isLoading:r,error:o,setError:n}}function as(){const{client:a}=E(),[r,e]=t.useState(!1),[o,n]=t.useState(null);return{signUp:t.useCallback(async(l,c)=>{e(!0),n(null);try{return await a.auth.signUp(l,c)}catch(d){return n(d instanceof Error?d.message:"Sign up failed"),null}finally{e(!1)}},[a]),isLoading:r,error:o,setError:n}}function K(){const{client:a}=E(),[r,e]=t.useState([]),[o,n]=t.useState(null),[u,l]=t.useState([]),[c,d]=t.useState([]),[i,x]=t.useState(!1),[p,g]=t.useState(null),f=t.useCallback(async()=>{x(!0),g(null);try{const w=await a.auth.listOrgs();e(w);const m=typeof window<"u"?localStorage.getItem("ss_selected_org"):null;if(m&&w.some(y=>y.id===m)&&!o){const y=w.find(C=>C.id===m);n(y);try{const C=await a.auth.listMembers(y.id);l(C)}catch{}}}catch(w){g(w instanceof Error?w.message:"Failed to load organizations")}finally{x(!1)}},[a,o]);t.useEffect(()=>{f()},[f]);const v=t.useCallback(async w=>{try{const m=await a.auth.getOrg(w);n(m),typeof window<"u"&&localStorage.setItem("ss_selected_org",w);const y=await a.auth.listMembers(w);l(y)}catch(m){g(m instanceof Error?m.message:"Failed to load organization")}},[a]),b=t.useCallback(async(w,m)=>{try{const y=await a.auth.createOrg(w,m);return e(C=>[...C,y]),y}catch(y){return g(y instanceof Error?y.message:"Failed to create organization"),null}},[a]),N=t.useCallback(async(w,m)=>{try{const y=await a.auth.updateOrg(w,m);return e(C=>C.map(B=>B.id===w?y:B)),(o==null?void 0:o.id)===w&&n(y),y}catch(y){return g(y instanceof Error?y.message:"Failed to update organization"),null}},[a,o]),h=t.useCallback(async w=>{try{return await a.auth.deleteOrg(w),e(m=>m.filter(y=>y.id!==w)),(o==null?void 0:o.id)===w&&(n(null),l([]),d([]),typeof window<"u"&&localStorage.removeItem("ss_selected_org")),!0}catch(m){return g(m instanceof Error?m.message:"Failed to delete organization"),!1}},[a,o]),j=t.useCallback(async(w,m,y)=>{try{return await a.auth.sendInvite(w,m,y)}catch(C){return g(C instanceof Error?C.message:"Failed to send invite"),null}},[a]),S=t.useCallback(async w=>{try{const m=await a.auth.listInvites(w);d(m)}catch(m){g(m instanceof Error?m.message:"Failed to load invites")}},[a]),k=t.useCallback(async(w,m)=>{try{return await a.auth.revokeInvite(w,m),d(y=>y.filter(C=>C.id!==m)),!0}catch(y){return g(y instanceof Error?y.message:"Failed to revoke invite"),!1}},[a]),P=t.useCallback(async(w,m,y)=>{try{return await a.auth.updateMemberRole(w,m,y),l(C=>C.map(B=>B.userId===m?{...B,role:y}:B)),!0}catch(C){return g(C instanceof Error?C.message:"Failed to update member role"),!1}},[a]),z=t.useCallback(async(w,m)=>{try{return await a.auth.removeMember(w,m),l(y=>y.filter(C=>C.userId!==m)),!0}catch(y){return g(y instanceof Error?y.message:"Failed to remove member"),!1}},[a]),F=t.useCallback(async w=>{try{const m=await a.auth.listMembers(w);l(m)}catch(m){g(m instanceof Error?m.message:"Failed to load members")}},[a]);return{orgs:r,selectedOrg:o,members:u,invites:c,isLoading:i,error:p,setError:g,refresh:f,selectOrg:v,createOrg:b,updateOrg:N,deleteOrg:h,sendInvite:j,refreshInvites:S,revokeInvite:k,updateMemberRole:P,removeMember:z,refreshMembers:F}}function es(){const{client:a}=E(),[r,e]=t.useState(!1),[o,n]=t.useState(null);return{deleteAccount:t.useCallback(async()=>{e(!0),n(null);try{return await a.auth.deleteAccount(),!0}catch(l){return n(l instanceof Error?l.message:"Failed to delete account"),!1}finally{e(!1)}},[a]),isLoading:r,error:o,setError:n}}function X(){const{client:a,user:r}=E(),[e,o]=t.useState(!1),[n,u]=t.useState(null),[l,c]=t.useState(null),d=t.useCallback(async p=>{o(!0),u(null),c(null);try{const g=await a.auth.updateProfile(p);return c("Profile updated"),g}catch(g){return u(g instanceof Error?g.message:"Failed to update profile"),null}finally{o(!1)}},[a]),i=t.useCallback(async(p,g)=>{o(!0),u(null),c(null);try{return await a.auth.changePassword(p,g),c("Password changed successfully"),!0}catch(f){return u(f instanceof Error?f.message:"Failed to change password"),!1}finally{o(!1)}},[a]),x=t.useCallback(async p=>{o(!0),u(null),c(null);try{const g=await a.auth.uploadAvatar(p);return c("Avatar updated"),g}catch(g){return u(g instanceof Error?g.message:"Failed to upload avatar"),null}finally{o(!1)}},[a]);return{user:r,updateProfile:d,uploadAvatar:x,changePassword:i,isLoading:e,error:n,success:l,setError:u,setSuccess:c}}const ts='<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>',rs='<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>',$={close:"close",person:"person",logout:"logout",checkCircle:"check_circle",unfoldMore:"unfold_more",cloudUpload:"cloud_upload",zoomIn:"zoom_in",zoomOut:"zoom_out",lock:"lock",visibility:"visibility",visibilityOff:"visibility_off",add:"add",addCircle:"add_circle",camera:"photo_camera",security:"security",errorOutline:"error_outline",info:"info",arrowForward:"arrow_forward",verified:"verified",token:"token",autoAwesome:"auto_awesome",corporateFare:"corporate_fare",cloudDone:"cloud_done",check:"check",image:"image"};function Cs({appearance:a,signUpUrl:r,onSignUp:e}){const{appearance:o,settings:n}=E(),{signIn:u,signInWithOAuth:l,submitMfaCode:c,isLoading:d,error:i,setError:x}=Z(),p=a??o,[g,f]=t.useState(""),[v,b]=t.useState(""),[N,h]=t.useState(!1),[j,S]=t.useState(!1),[k,P]=t.useState(""),[z,F]=t.useState(["","","","","",""]),w=t.useRef([]),m=t.useCallback(async L=>{if(L.preventDefault(),j){await c(k,z.join(""));return}const T=await u(g,v);T&&U.isMfaRequired(T)&&(P(T.mfaToken),S(!0),x(null))},[g,v,j,k,z,u,c,x]),y=t.useCallback(async L=>{await l(L)},[l]),C=t.useCallback((L,T)=>{var R;if(!/^\d*$/.test(T))return;const O=T.slice(-1);F(_=>{const q=[..._];return q[L]=O,q}),O&&L<5&&((R=w.current[L+1])==null||R.focus())},[]),B=t.useCallback((L,T)=>{var O;T.key==="Backspace"&&!z[L]&&L>0&&((O=w.current[L-1])==null||O.focus())},[z]),D=(n==null?void 0:n.googleEnabled)||(n==null?void 0:n.githubEnabled);return s.jsx(M,{appearance:p,children:s.jsx("div",{className:"ss-auth-card",children:s.jsxs("div",{className:"ss-auth-card-body",children:[s.jsxs("div",{className:"ss-auth-header",children:[s.jsx("div",{className:"ss-auth-brand-icon",children:s.jsx("span",{className:"material-symbols-outlined",children:$.token})}),s.jsx("h1",{className:"ss-auth-title",children:"Sign in to your account"}),s.jsx("p",{className:"ss-auth-subtitle",children:"Welcome back to your workspace"})]}),!j&&D&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"ss-auth-oauth-grid",children:[(n==null?void 0:n.googleEnabled)&&s.jsxs("button",{type:"button",className:"ss-auth-btn-social",onClick:()=>y("google"),disabled:d,children:[s.jsx("span",{dangerouslySetInnerHTML:{__html:ts}}),"Google"]}),(n==null?void 0:n.githubEnabled)&&s.jsxs("button",{type:"button",className:"ss-auth-btn-social",onClick:()=>y("github"),disabled:d,children:[s.jsx("span",{dangerouslySetInnerHTML:{__html:rs}}),"GitHub"]})]}),s.jsx("div",{className:"ss-auth-divider",children:"or continue with"})]}),i&&s.jsxs("div",{className:"ss-auth-error",children:[s.jsx("span",{className:"material-symbols-outlined",children:$.errorOutline}),s.jsx("span",{children:i})]}),s.jsxs("form",{onSubmit:m,children:[j?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"ss-auth-mfa-divider",children:s.jsx("span",{children:"Verification Required"})}),s.jsxs("div",{className:"ss-auth-field",children:[s.jsx("label",{className:"ss-auth-label",children:"6-Digit Code"}),s.jsx("div",{className:"ss-auth-mfa-group",children:z.map((L,T)=>s.jsx("input",{ref:O=>{w.current[T]=O},className:"ss-auth-mfa-digit",type:"text",inputMode:"numeric",maxLength:1,value:L,onChange:O=>C(T,O.target.value),onKeyDown:O=>B(T,O),autoFocus:T===0},T))}),s.jsx("p",{className:"ss-auth-mfa-hint",children:"We sent a 6-digit code to your registered email."})]})]}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"ss-auth-field",children:[s.jsx("label",{className:"ss-auth-label",htmlFor:"ss-email",children:"Email Address"}),s.jsx("input",{id:"ss-email",className:"ss-auth-input",type:"email",autoComplete:"email",placeholder:"name@company.com",value:g,onChange:L=>f(L.target.value),required:!0})]}),s.jsxs("div",{className:"ss-auth-field",children:[s.jsxs("div",{className:"ss-auth-field-row",children:[s.jsx("label",{className:"ss-auth-label",htmlFor:"ss-password",style:{marginBottom:0},children:"Password"}),s.jsx("span",{className:"ss-auth-link",style:{fontSize:"12px"},children:"Forgot?"})]}),s.jsxs("div",{style:{position:"relative"},children:[s.jsx("input",{id:"ss-password",className:"ss-auth-input",type:N?"text":"password",autoComplete:"current-password",placeholder:"••••••••",value:v,onChange:L=>b(L.target.value),required:!0}),s.jsx("button",{type:"button",className:"ss-auth-visibility-toggle",onClick:()=>h(!N),children:s.jsx("span",{className:"material-symbols-outlined",children:N?$.visibilityOff:$.visibility})})]})]})]}),s.jsxs("button",{type:"submit",className:"ss-auth-btn-primary",disabled:d,children:[d&&s.jsx("span",{className:"ss-auth-spinner"}),j?"Verify":"Sign in",!d&&s.jsx("span",{className:"material-symbols-outlined",children:$.arrowForward})]})]}),j?s.jsx("div",{className:"ss-auth-footer",children:s.jsx("span",{className:"ss-auth-link",onClick:()=>{S(!1),F(["","","","","",""]),x(null)},children:"Back to sign in"})}):s.jsxs("div",{className:"ss-auth-footer",children:["Don't have an account?"," ",e?s.jsx("span",{className:"ss-auth-link",onClick:e,children:"Sign up"}):r?s.jsx("a",{className:"ss-auth-link",href:r,children:"Sign up"}):s.jsx("span",{className:"ss-auth-link",children:"Sign up"})]})]})})})}function Ps({appearance:a,signInUrl:r,onSignIn:e}){const{appearance:o,settings:n}=E(),{signUp:u,isLoading:l,error:c,setError:d}=as(),{signInWithOAuth:i}=Z(),x=a??o,[p,g]=t.useState(""),[f,v]=t.useState(""),[b,N]=t.useState(""),[h,j]=t.useState(!1),[S,k]=t.useState(null),P=t.useCallback(async m=>{if(m.preventDefault(),k(null),f!==b){k("Passwords do not match");return}const y=(n==null?void 0:n.passwordMinLength)??8;if(f.length<y){k(`Password must be at least ${y} characters`);return}await u(p,f)},[p,f,b,n,u]),z=t.useCallback(async m=>{await i(m)},[i]),F=(n==null?void 0:n.googleEnabled)||(n==null?void 0:n.githubEnabled),w=S||c;return s.jsx(M,{appearance:x,children:s.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",width:"100%",maxWidth:"520px"},children:[s.jsxs("div",{className:"ss-auth-header",children:[s.jsx("div",{className:"ss-auth-brand-icon-gradient",children:s.jsx("span",{className:"material-symbols-outlined",children:$.autoAwesome})}),s.jsx("h1",{className:"ss-auth-title ss-auth-title-lg",children:"Create your account"}),s.jsx("p",{className:"ss-auth-subtitle",children:"Join the ecosystem"})]}),s.jsx("div",{className:"ss-auth-card",children:s.jsxs("div",{className:"ss-auth-card-body",children:[F&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"ss-auth-oauth-grid",children:[(n==null?void 0:n.googleEnabled)&&s.jsxs("button",{type:"button",className:"ss-auth-btn-social",onClick:()=>z("google"),disabled:l,children:[s.jsx("span",{dangerouslySetInnerHTML:{__html:ts}}),"Google"]}),(n==null?void 0:n.githubEnabled)&&s.jsxs("button",{type:"button",className:"ss-auth-btn-social",onClick:()=>z("github"),disabled:l,children:[s.jsx("span",{dangerouslySetInnerHTML:{__html:rs}}),"GitHub"]})]}),s.jsx("div",{className:"ss-auth-divider",children:"or sign up with email"})]}),w&&s.jsxs("div",{className:"ss-auth-error",children:[s.jsx("span",{className:"material-symbols-outlined",children:$.errorOutline}),s.jsx("span",{children:w})]}),s.jsxs("form",{onSubmit:P,children:[s.jsxs("div",{className:"ss-auth-field",children:[s.jsx("label",{className:"ss-auth-label",htmlFor:"ss-signup-email",children:"Email"}),s.jsx("input",{id:"ss-signup-email",className:"ss-auth-input",type:"email",autoComplete:"email",placeholder:"name@company.com",value:p,onChange:m=>g(m.target.value),required:!0})]}),s.jsxs("div",{className:"ss-auth-field",children:[s.jsx("label",{className:"ss-auth-label",htmlFor:"ss-signup-password",children:"Password"}),s.jsxs("div",{style:{position:"relative"},children:[s.jsx("input",{id:"ss-signup-password",className:"ss-auth-input",type:h?"text":"password",autoComplete:"new-password",placeholder:"••••••••",value:f,onChange:m=>{v(m.target.value),k(null)},required:!0}),s.jsx("button",{type:"button",className:"ss-auth-visibility-toggle",onClick:()=>j(!h),children:s.jsx("span",{className:"material-symbols-outlined",children:h?$.visibilityOff:$.visibility})})]})]}),s.jsxs("div",{className:"ss-auth-field",children:[s.jsx("label",{className:"ss-auth-label",htmlFor:"ss-signup-confirm",children:"Confirm Password"}),s.jsx("input",{id:"ss-signup-confirm",className:"ss-auth-input",type:"password",autoComplete:"new-password",placeholder:"••••••••",value:b,onChange:m=>{N(m.target.value),k(null)},required:!0})]}),s.jsxs("button",{type:"submit",className:"ss-auth-btn-primary",disabled:l,children:[l&&s.jsx("span",{className:"ss-auth-spinner"}),"Sign up",!l&&s.jsx("span",{className:"material-symbols-outlined",children:$.arrowForward})]})]}),s.jsxs("div",{className:"ss-auth-footer",children:["Already have an account?"," ",e?s.jsx("span",{className:"ss-auth-link",onClick:e,children:"Sign in"}):r?s.jsx("a",{className:"ss-auth-link",href:r,children:"Sign in"}):s.jsx("span",{className:"ss-auth-link",children:"Sign in"})]})]})})]})})}const I=320,V=128;function zs({file:a,onCrop:r,onCancel:e}){const o=t.useRef(null),n=t.useRef(null),[u,l]=t.useState(1),[c,d]=t.useState({x:0,y:0}),[i,x]=t.useState(!1),p=t.useRef({x:0,y:0,ox:0,oy:0}),[g,f]=t.useState(!1);t.useEffect(()=>{const h=new Image,j=URL.createObjectURL(a);return h.onload=()=>{n.current=h,f(!0),d({x:0,y:0}),l(1)},h.src=j,()=>URL.revokeObjectURL(j)},[a]),t.useEffect(()=>{if(!g||!n.current||!o.current)return;const h=o.current.getContext("2d");if(!h)return;const j=n.current;h.clearRect(0,0,I,I),h.fillStyle="#111",h.fillRect(0,0,I,I);const S=Math.max(I/j.width,I/j.height)*u,k=j.width*S,P=j.height*S,z=(I-k)/2+c.x,F=(I-P)/2+c.y;h.save(),h.beginPath(),h.arc(I/2,I/2,V,0,Math.PI*2),h.clip(),h.drawImage(j,z,F,k,P),h.restore(),h.save(),h.fillStyle="rgba(0, 0, 0, 0.6)",h.fillRect(0,0,I,I),h.globalCompositeOperation="destination-out",h.beginPath(),h.arc(I/2,I/2,V,0,Math.PI*2),h.fill(),h.restore(),h.save(),h.beginPath(),h.arc(I/2,I/2,V,0,Math.PI*2),h.clip(),h.drawImage(j,z,F,k,P),h.restore(),h.strokeStyle="rgba(255, 255, 255, 0.4)",h.lineWidth=2,h.beginPath(),h.arc(I/2,I/2,V,0,Math.PI*2),h.stroke()},[u,c,g]);const v=t.useCallback(h=>{x(!0),p.current={x:h.clientX,y:h.clientY,ox:c.x,oy:c.y},h.target.setPointerCapture(h.pointerId)},[c]),b=t.useCallback(h=>{i&&d({x:p.current.ox+(h.clientX-p.current.x),y:p.current.oy+(h.clientY-p.current.y)})},[i]),N=t.useCallback(()=>x(!1),[]);return t.useCallback(()=>{if(!n.current)return;const h=document.createElement("canvas"),j=V*2;h.width=j,h.height=j;const S=h.getContext("2d");if(!S)return;const k=n.current,P=Math.max(I/k.width,I/k.height)*u,z=k.width*P,F=k.height*P,w=(I-z)/2+c.x-(I/2-V),m=(I-F)/2+c.y-(I/2-V);S.beginPath(),S.arc(V,V,V,0,Math.PI*2),S.clip(),S.drawImage(k,w,m,z,F),h.toBlob(y=>{y&&r(y)},"image/png")},[u,c,r]),s.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"24px"},children:[s.jsxs("div",{className:"ss-auth-crop-area",children:[s.jsx("canvas",{ref:o,width:I,height:I,style:{cursor:i?"grabbing":"grab",width:"100%",height:"100%"},onPointerDown:v,onPointerMove:b,onPointerUp:N}),s.jsx("div",{className:"ss-auth-crop-size-badge",children:"256 x 256 px"})]}),s.jsxs("div",{className:"ss-auth-zoom-control",style:{width:"100%",maxWidth:"280px"},children:[s.jsx("span",{className:"material-symbols-outlined",children:$.zoomOut}),s.jsx("input",{type:"range",min:"1",max:"3",step:"0.01",value:u,onChange:h=>l(parseFloat(h.target.value)),className:"ss-auth-zoom-slider"}),s.jsx("span",{className:"material-symbols-outlined",children:$.zoomIn})]})]})}function ns({onUpload:a,onClose:r,isLoading:e}){const[o,n]=t.useState(null),[u,l]=t.useState(!1),[c,d]=t.useState(null),i=t.useRef(null),x=t.useCallback(f=>{if(!f.type.startsWith("image/")){d("Please select an image file");return}if(f.size>5*1024*1024){d("Image must be smaller than 5 MB");return}d(null),n(f)},[]),p=t.useCallback(f=>{f.preventDefault(),l(!1);const v=f.dataTransfer.files[0];v&&x(v)},[x]),g=t.useCallback(async f=>{await a(f)},[a]);return s.jsx("div",{className:"ss-auth-modal-overlay",onClick:f=>{f.target===f.currentTarget&&r()},children:s.jsxs("div",{className:"ss-auth-modal ss-auth-card-wide",children:[s.jsxs("div",{className:"ss-auth-modal-header",children:[s.jsx("h2",{children:"Upload avatar"}),s.jsx("button",{type:"button",className:"ss-auth-modal-close",onClick:r,children:s.jsx("span",{className:"material-symbols-outlined",children:$.close})})]}),s.jsxs("div",{className:"ss-auth-modal-body",children:[c&&s.jsxs("div",{className:"ss-auth-error",style:{marginBottom:"24px"},children:[s.jsx("span",{className:"material-symbols-outlined",children:$.errorOutline}),s.jsx("span",{children:c})]}),s.jsxs("div",{className:"ss-auth-upload-grid",children:[s.jsx("div",{children:o?s.jsx(zs,{file:o,onCrop:g,onCancel:()=>n(null)}):s.jsxs("div",{className:"ss-auth-crop-area",style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"8px",width:"100%",aspectRatio:"1"},children:[s.jsx("span",{className:"material-symbols-outlined",style:{fontSize:"48px",opacity:.3},children:$.image}),s.jsx("span",{style:{fontSize:"12px",opacity:.4},children:"No image selected"})]})}),s.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"16px"},children:[s.jsxs("div",{className:`ss-auth-dropzone${u?" ss-auth-dropzone-active":""}`,onDragOver:f=>{f.preventDefault(),l(!0)},onDragLeave:()=>l(!1),onDrop:p,onClick:()=>{var f;return(f=i.current)==null?void 0:f.click()},style:{minHeight:"180px"},children:[s.jsx("div",{className:"ss-auth-dropzone-icon",children:s.jsx("span",{className:"material-symbols-outlined",children:$.cloudUpload})}),s.jsx("span",{className:"ss-auth-dropzone-title",children:"Drag and drop"}),s.jsxs("span",{className:"ss-auth-dropzone-desc",children:["JPG, PNG or WEBP",s.jsx("br",{}),"Max file size 5 MB"]}),s.jsx("button",{type:"button",className:"ss-auth-dropzone-btn",children:"Choose File"}),s.jsx("input",{ref:i,type:"file",accept:"image/*",style:{display:"none"},onChange:f=>{var v;(v=f.target.files)!=null&&v[0]&&x(f.target.files[0])}})]}),s.jsxs("div",{className:"ss-auth-info-box",children:[s.jsx("span",{className:"material-symbols-outlined",children:$.info}),s.jsx("span",{children:"Your profile photo will be visible to all members of your organization."})]})]})]})]}),s.jsxs("div",{className:"ss-auth-modal-footer",children:[s.jsx("button",{type:"button",className:"ss-auth-btn-ghost",onClick:r,children:"Cancel"}),s.jsxs("button",{type:"button",className:"ss-auth-btn-primary ss-auth-btn-sm",onClick:()=>{},disabled:!o||e,style:{width:"auto"},children:[e&&s.jsx("span",{className:"ss-auth-spinner"}),"Save Profile",!e&&s.jsx("span",{className:"material-symbols-outlined",children:$.check})]})]})]})})}function Es({appearance:a,afterSignOutUrl:r,afterDeleteAccountUrl:e,showOrgSwitcher:o=!0,onOrgChange:n,onOrgSettingsClick:u}){const{appearance:l}=E(),{user:c,signOut:d}=H(),i=a??l,[x,p]=t.useState(!1),[g,f]=t.useState(!1),[v,b]=t.useState(""),[N,h]=t.useState(null),[j,S]=t.useState(!1),k=t.useRef(null),{orgs:P,selectedOrg:z,selectOrg:F,createOrg:w}=K(),m=t.useCallback(C=>{k.current&&!C.composedPath().includes(k.current)&&p(!1)},[]);t.useEffect(()=>{if(x){const C=setTimeout(()=>{document.addEventListener("click",m)},0);return()=>{clearTimeout(C),document.removeEventListener("click",m)}}},[x,m]);const y=t.useCallback(async C=>{C.preventDefault(),h(null),S(!0);const B=v.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"");try{const D=await w(v,B);D&&(await F(D.id),n==null||n(D),b(""),p(!1))}catch(D){h(D instanceof Error?D.message:"Failed to create organization")}finally{S(!1)}},[v,w,F,n]);return c?s.jsx(M,{appearance:i,children:s.jsxs("div",{style:{position:"relative",display:"inline-block"},ref:k,children:[s.jsx("button",{type:"button",className:"ss-auth-avatar-trigger",onClick:()=>p(!x),"aria-label":"User menu",children:c.avatarUrl?s.jsx("img",{src:c.avatarUrl,alt:""}):s.jsx("div",{style:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"16px",fontWeight:700},children:(c.name||c.email).charAt(0).toUpperCase()})}),x&&s.jsxs("div",{className:"ss-auth-dropdown ss-auth-glass-panel",style:{minWidth:"320px"},children:[s.jsxs("div",{className:"ss-auth-dropdown-header",children:[s.jsx("div",{className:"ss-auth-dropdown-avatar",children:c.avatarUrl?s.jsx("img",{src:c.avatarUrl,alt:""}):s.jsx("div",{style:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"20px",fontWeight:800},children:(c.name||c.email).charAt(0).toUpperCase()})}),s.jsxs("div",{children:[c.name&&s.jsx("div",{className:"ss-auth-dropdown-name",children:c.name}),s.jsx("div",{className:"ss-auth-dropdown-email",children:c.email})]})]}),s.jsx("div",{style:{padding:"4px 8px"},children:s.jsxs("button",{type:"button",className:"ss-auth-dropdown-action",onClick:()=>{p(!1),f(!0)},children:[s.jsx("span",{className:"material-symbols-outlined",children:$.person}),"Profile"]})}),o&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"ss-auth-section-label",children:"Organizations"}),s.jsx("div",{style:{padding:"0 8px 4px"},children:P.map(C=>{const B=(z==null?void 0:z.id)===C.id,D=C.name.split(" ").map(L=>L[0]).join("").slice(0,2).toUpperCase();return s.jsxs("button",{type:"button",className:`ss-auth-org-item${B?" ss-auth-org-item-active":""}`,onClick:async()=>{p(!1),await F(C.id),n==null||n(C)},children:[s.jsxs("div",{className:"ss-auth-org-item-inner",children:[s.jsx("div",{className:`ss-auth-org-avatar${B?"":" ss-auth-org-avatar-inactive"}`,children:D}),s.jsx("span",{style:{fontFamily:"'Manrope', sans-serif",letterSpacing:"-0.01em"},children:C.name})]}),B&&s.jsx("span",{className:"material-symbols-outlined ss-auth-org-check",style:{fontSize:"18px"},children:$.checkCircle})]},C.id)})}),s.jsxs("div",{className:"ss-auth-inline-create",children:[N&&s.jsx("div",{className:"ss-auth-error",style:{marginBottom:"8px",fontSize:"12px"},children:s.jsx("span",{children:N})}),s.jsx("form",{onSubmit:y,children:s.jsxs("div",{className:"ss-auth-inline-create-input",children:[s.jsx("input",{className:"ss-auth-input",type:"text",placeholder:"New organization name",value:v,onChange:C=>b(C.target.value),required:!0,style:{fontSize:"13px",padding:"10px 40px 10px 12px"}}),s.jsx("button",{type:"submit",className:"ss-auth-inline-create-btn",disabled:j||!v.trim(),children:s.jsx("span",{className:"material-symbols-outlined",style:{fontSize:"20px"},children:$.add})})]})})]}),z&&u&&s.jsx("div",{style:{padding:"0 8px 4px"},children:s.jsxs("button",{type:"button",className:"ss-auth-dropdown-action",onClick:()=>{p(!1),u(z)},children:[s.jsx("span",{className:"material-symbols-outlined",children:$.corporateFare}),"Org settings"]})})]}),s.jsx("div",{className:"ss-auth-signout-section",style:{padding:"8px"},children:s.jsxs("button",{type:"button",className:"ss-auth-dropdown-action",onClick:async()=>{p(!1),await d(),r&&(window.location.href=r)},style:{color:"inherit"},children:[s.jsx("span",{className:"material-symbols-outlined",style:{color:"inherit"},children:$.logout}),"Sign out"]})})]}),g&&s.jsx(Os,{onClose:()=>f(!1),afterDeleteAccountUrl:e})]})}):null}function Os({onClose:a,afterDeleteAccountUrl:r}){const{user:e,updateProfile:o,uploadAvatar:n,changePassword:u,isLoading:l,error:c,success:d,setError:i,setSuccess:x}=X(),{signOut:p}=H(),{deleteAccount:g,isLoading:f,error:v,setError:b}=es(),[N,h]=t.useState((e==null?void 0:e.name)??""),[j,S]=t.useState((e==null?void 0:e.avatarUrl)??""),[k,P]=t.useState(!1),[z,F]=t.useState(""),[w,m]=t.useState(""),[y,C]=t.useState(""),[B,D]=t.useState(null),[L,T]=t.useState(!1),[O,R]=t.useState(""),_=t.useCallback(async A=>{A.preventDefault(),i(null),x(null),await o({name:N,avatarUrl:j||void 0})},[N,j,o,i,x]),q=t.useCallback(async A=>{const G=await n(A);G&&(S(G.avatarUrl),P(!1))},[n]),gs=t.useCallback(async A=>{if(A.preventDefault(),D(null),i(null),x(null),w!==y){D("Passwords do not match");return}if(w.length<8){D("Password must be at least 8 characters");return}await u(z,w)&&(F(""),m(""),C(""))},[z,w,y,u,i,x]),fs=t.useCallback(async()=>{await g()&&(await p(),r&&(window.location.href=r))},[g,p,r]),ms=(e==null?void 0:e.provider)==="email",bs=O===(e==null?void 0:e.email),ys=((e==null?void 0:e.name)||(e==null?void 0:e.email)||"?").charAt(0).toUpperCase();return s.jsx("div",{className:"ss-auth-modal-overlay",onClick:A=>{A.target===A.currentTarget&&a()},children:s.jsxs("div",{className:"ss-auth-modal",style:{maxWidth:"640px"},children:[s.jsxs("div",{className:"ss-auth-modal-header",children:[s.jsx("h2",{children:"Profile"}),s.jsx("button",{type:"button",className:"ss-auth-modal-close",onClick:a,children:s.jsx("span",{className:"material-symbols-outlined",children:$.close})})]}),s.jsxs("div",{className:"ss-auth-profile-header",children:[s.jsxs("div",{className:"ss-auth-avatar-lg",onClick:()=>P(!0),children:[j?s.jsx("img",{src:j,alt:""}):s.jsx("div",{style:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"48px",fontWeight:800,opacity:.4},children:ys}),s.jsxs("div",{className:"ss-auth-avatar-overlay",children:[s.jsx("span",{className:"material-symbols-outlined",children:$.camera}),s.jsx("span",{children:"Edit"})]})]}),s.jsxs("div",{className:"ss-auth-profile-info",children:[s.jsxs("h2",{className:"ss-auth-profile-name",children:[(e==null?void 0:e.name)||"Unnamed User",(e==null?void 0:e.emailVerified)&&s.jsxs("span",{className:"ss-auth-badge ss-auth-badge-success",children:[s.jsx("span",{className:"material-symbols-outlined",style:{fontSize:"12px",fontVariationSettings:"'FILL' 1"},children:$.verified}),"Verified"]})]}),s.jsx("p",{className:"ss-auth-profile-desc",children:e==null?void 0:e.email})]})]}),s.jsxs("div",{className:"ss-auth-modal-body",children:[c&&s.jsxs("div",{className:"ss-auth-error",children:[s.jsx("span",{className:"material-symbols-outlined",children:$.errorOutline}),s.jsx("span",{children:c})]}),d&&s.jsxs("div",{className:"ss-auth-info-box",style:{marginBottom:"16px"},children:[s.jsx("span",{className:"material-symbols-outlined",children:$.check}),s.jsx("span",{children:d})]}),s.jsxs("form",{onSubmit:_,children:[s.jsxs("div",{className:"ss-auth-field",children:[s.jsx("label",{className:"ss-auth-label",children:"Full Name"}),s.jsx("input",{className:"ss-auth-input",type:"text",placeholder:"Your name",value:N,onChange:A=>h(A.target.value)})]}),s.jsxs("div",{className:"ss-auth-profile-grid",style:{marginBottom:"16px"},children:[s.jsxs("div",{children:[s.jsx("label",{className:"ss-auth-label",children:"Email Address"}),s.jsxs("div",{style:{position:"relative"},children:[s.jsx("input",{className:"ss-auth-input ss-auth-input-readonly",type:"email",value:(e==null?void 0:e.email)??"",readOnly:!0}),s.jsx("span",{className:"ss-auth-visibility-toggle",style:{cursor:"default"},children:s.jsx("span",{className:"material-symbols-outlined",style:{fontSize:"18px"},children:$.lock})})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"ss-auth-label",children:"Auth Provider"}),s.jsx("input",{className:"ss-auth-input ss-auth-input-readonly",type:"text",value:(e==null?void 0:e.provider)??"",readOnly:!0})]})]}),s.jsx("div",{style:{display:"flex",justifyContent:"flex-end"},children:s.jsxs("button",{type:"submit",className:"ss-auth-btn-primary ss-auth-btn-sm",disabled:l,style:{width:"auto"},children:[l&&s.jsx("span",{className:"ss-auth-spinner"}),"Save changes"]})})]}),ms&&s.jsxs("div",{className:"ss-auth-section",children:[s.jsxs("div",{className:"ss-auth-section-title",children:[s.jsx("span",{className:"material-symbols-outlined",children:$.security}),"Security Credentials"]}),B&&s.jsxs("div",{className:"ss-auth-error",style:{marginTop:"16px"},children:[s.jsx("span",{className:"material-symbols-outlined",children:$.errorOutline}),s.jsx("span",{children:B})]}),s.jsxs("form",{onSubmit:gs,style:{marginTop:"16px"},children:[s.jsxs("div",{className:"ss-auth-field",children:[s.jsx("label",{className:"ss-auth-label",children:"Current Password"}),s.jsx("input",{className:"ss-auth-input",type:"password",placeholder:"••••••••••••",value:z,onChange:A=>F(A.target.value),required:!0})]}),s.jsxs("div",{className:"ss-auth-profile-grid",style:{marginBottom:"16px"},children:[s.jsxs("div",{children:[s.jsx("label",{className:"ss-auth-label",children:"New Password"}),s.jsx("input",{className:"ss-auth-input",type:"password",placeholder:"Min. 8 characters",value:w,onChange:A=>m(A.target.value),required:!0})]}),s.jsxs("div",{children:[s.jsx("label",{className:"ss-auth-label",children:"Confirm New Password"}),s.jsx("input",{className:"ss-auth-input",type:"password",placeholder:"Repeat new password",value:y,onChange:A=>C(A.target.value),required:!0})]})]}),s.jsx("div",{style:{display:"flex",justifyContent:"flex-end"},children:s.jsx("button",{type:"submit",className:"ss-auth-btn-ghost",disabled:l,children:"Update Security"})})]})]}),s.jsxs("div",{className:"ss-auth-section",children:[s.jsx("div",{className:"ss-auth-section-title",style:{color:"inherit"},children:"Danger Zone"}),s.jsx("p",{className:"ss-auth-section-desc",style:{marginBottom:"16px"},children:"Deleting your account is permanent. All organizations you own will also be deleted."}),v&&s.jsxs("div",{className:"ss-auth-error",children:[s.jsx("span",{className:"material-symbols-outlined",children:$.errorOutline}),s.jsx("span",{children:v})]}),L?s.jsxs("div",{children:[s.jsxs("div",{className:"ss-auth-field",children:[s.jsx("label",{className:"ss-auth-label",children:"Type your email to confirm"}),s.jsx("input",{className:"ss-auth-input",type:"email",placeholder:e==null?void 0:e.email,value:O,onChange:A=>R(A.target.value),autoFocus:!0})]}),s.jsxs("div",{style:{display:"flex",gap:"8px",justifyContent:"flex-end"},children:[s.jsx("button",{type:"button",className:"ss-auth-btn-ghost",onClick:()=>{T(!1),R(""),b(null)},children:"Cancel"}),s.jsxs("button",{type:"button",className:"ss-auth-btn-primary ss-auth-btn-sm",style:{width:"auto",background:"linear-gradient(135deg, #ef4444, #dc2626)"},disabled:!bs||f,onClick:fs,children:[f&&s.jsx("span",{className:"ss-auth-spinner"}),"Delete account"]})]})]}):s.jsx("button",{type:"button",className:"ss-auth-btn-outline",style:{borderColor:"currentColor",width:"auto"},onClick:()=>T(!0),children:"Delete my account"})]})]}),k&&s.jsx(ns,{onUpload:q,onClose:()=>P(!1),isLoading:l})]})})}function Is({appearance:a}){const{appearance:r}=E(),{user:e,signOut:o}=H(),{updateProfile:n,uploadAvatar:u,changePassword:l,isLoading:c,error:d,success:i,setError:x,setSuccess:p}=X(),g=a??r,[f,v]=t.useState((e==null?void 0:e.name)??""),[b,N]=t.useState((e==null?void 0:e.avatarUrl)??""),[h,j]=t.useState(!1),[S,k]=t.useState(""),[P,z]=t.useState(""),[F,w]=t.useState(""),[m,y]=t.useState(null),C=t.useCallback(async O=>{O.preventDefault(),x(null),p(null),await n({name:f,avatarUrl:b||void 0})},[f,b,n,x,p]),B=t.useCallback(async O=>{const R=await u(O);R&&(N(R.avatarUrl),j(!1))},[u]),D=t.useCallback(async O=>{if(O.preventDefault(),y(null),x(null),p(null),P!==F){y("Passwords do not match");return}if(P.length<8){y("Password must be at least 8 characters");return}await l(S,P)&&(k(""),z(""),w(""))},[S,P,F,l,x,p]);if(!e)return null;const L=e.provider==="email",T=(e.name||e.email).charAt(0).toUpperCase();return s.jsx(M,{appearance:g,children:s.jsxs("div",{className:"ss-auth-card",style:{maxWidth:"640px"},children:[s.jsxs("div",{className:"ss-auth-profile-header",children:[s.jsxs("div",{className:"ss-auth-avatar-lg",onClick:()=>j(!0),children:[b?s.jsx("img",{src:b,alt:""}):s.jsx("div",{style:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"48px",fontWeight:800,opacity:.4},children:T}),s.jsxs("div",{className:"ss-auth-avatar-overlay",children:[s.jsx("span",{className:"material-symbols-outlined",children:$.camera}),s.jsx("span",{children:"Edit"})]})]}),s.jsxs("div",{className:"ss-auth-profile-info",children:[s.jsxs("h2",{className:"ss-auth-profile-name",children:[e.name||"Unnamed User",e.emailVerified&&s.jsxs("span",{className:"ss-auth-badge ss-auth-badge-success",children:[s.jsx("span",{className:"material-symbols-outlined",style:{fontSize:"12px",fontVariationSettings:"'FILL' 1"},children:$.verified}),"Verified"]})]}),s.jsx("p",{className:"ss-auth-profile-desc",children:e.email})]})]}),s.jsxs("div",{className:"ss-auth-card-body",children:[d&&s.jsxs("div",{className:"ss-auth-error",children:[s.jsx("span",{className:"material-symbols-outlined",children:$.errorOutline}),s.jsx("span",{children:d})]}),i&&s.jsxs("div",{className:"ss-auth-info-box",style:{marginBottom:"16px"},children:[s.jsx("span",{className:"material-symbols-outlined",children:$.check}),s.jsx("span",{children:i})]}),s.jsxs("form",{onSubmit:C,children:[s.jsxs("div",{className:"ss-auth-field",children:[s.jsx("label",{className:"ss-auth-label",children:"Full Name"}),s.jsx("input",{className:"ss-auth-input",type:"text",placeholder:"Your name",value:f,onChange:O=>v(O.target.value)})]}),s.jsxs("div",{className:"ss-auth-profile-grid",style:{marginBottom:"16px"},children:[s.jsxs("div",{children:[s.jsx("label",{className:"ss-auth-label",children:"Email Address"}),s.jsxs("div",{style:{position:"relative"},children:[s.jsx("input",{className:"ss-auth-input ss-auth-input-readonly",type:"email",value:e.email,readOnly:!0}),s.jsx("span",{className:"ss-auth-visibility-toggle",style:{cursor:"default"},children:s.jsx("span",{className:"material-symbols-outlined",style:{fontSize:"18px"},children:$.lock})})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"ss-auth-label",children:"Auth Provider"}),s.jsxs("div",{style:{position:"relative"},children:[s.jsx("input",{className:"ss-auth-input ss-auth-input-readonly",type:"text",value:e.provider,readOnly:!0}),s.jsx("span",{className:"ss-auth-visibility-toggle",style:{cursor:"default"},children:s.jsx("span",{className:"material-symbols-outlined",style:{fontSize:"18px"},children:$.cloudDone})})]})]})]}),s.jsx("div",{style:{display:"flex",justifyContent:"flex-end"},children:s.jsxs("button",{type:"submit",className:"ss-auth-btn-primary ss-auth-btn-sm",disabled:c,style:{width:"auto"},children:[c&&s.jsx("span",{className:"ss-auth-spinner"}),"Save changes"]})})]}),L&&s.jsxs("div",{className:"ss-auth-section",children:[s.jsxs("div",{className:"ss-auth-section-title",children:[s.jsx("span",{className:"material-symbols-outlined",children:$.security}),"Security Credentials"]}),s.jsx("p",{className:"ss-auth-section-desc",style:{marginBottom:"24px"},children:"Update your password to keep your account secure."}),m&&s.jsxs("div",{className:"ss-auth-error",children:[s.jsx("span",{className:"material-symbols-outlined",children:$.errorOutline}),s.jsx("span",{children:m})]}),s.jsxs("form",{onSubmit:D,children:[s.jsxs("div",{className:"ss-auth-field",children:[s.jsx("label",{className:"ss-auth-label",children:"Current Password"}),s.jsx("input",{className:"ss-auth-input",type:"password",placeholder:"••••••••••••",value:S,onChange:O=>k(O.target.value),required:!0})]}),s.jsxs("div",{className:"ss-auth-profile-grid",style:{marginBottom:"16px"},children:[s.jsxs("div",{children:[s.jsx("label",{className:"ss-auth-label",children:"New Password"}),s.jsx("input",{className:"ss-auth-input",type:"password",placeholder:"Min. 8 characters",value:P,onChange:O=>z(O.target.value),required:!0})]}),s.jsxs("div",{children:[s.jsx("label",{className:"ss-auth-label",children:"Confirm New Password"}),s.jsx("input",{className:"ss-auth-input",type:"password",placeholder:"Repeat new password",value:F,onChange:O=>w(O.target.value),required:!0})]})]}),s.jsxs("div",{className:"ss-auth-info-box",style:{marginBottom:"16px"},children:[s.jsx("span",{className:"material-symbols-outlined",children:$.info}),s.jsx("span",{children:"Password must be at least 8 characters long."})]}),s.jsx("div",{style:{display:"flex",justifyContent:"flex-end"},children:s.jsx("button",{type:"submit",className:"ss-auth-btn-ghost",disabled:c,children:"Update Security"})})]})]}),s.jsx("div",{className:"ss-auth-section",style:{borderTop:"none",paddingTop:0,marginTop:"24px"},children:s.jsx("div",{className:"ss-auth-signout-section",style:{borderRadius:"12px",padding:"16px 20px"},children:s.jsxs("div",{className:"ss-auth-signout-row",children:[s.jsxs("div",{className:"ss-auth-signout-info",children:[s.jsx("div",{className:"ss-auth-signout-icon",children:s.jsx("span",{className:"material-symbols-outlined",children:$.logout})}),s.jsxs("div",{children:[s.jsx("div",{className:"ss-auth-signout-title",children:"End Session"}),s.jsx("div",{className:"ss-auth-signout-desc",children:"Terminate your active session"})]})]}),s.jsx("button",{type:"button",className:"ss-auth-btn-outline",onClick:()=>o(),style:{width:"auto",flexShrink:0},children:"Sign out"})]})})})]}),h&&s.jsx(ns,{onUpload:B,onClose:()=>j(!1),isLoading:c})]})})}function Fs({appearance:a,onOrgChange:r}){const{appearance:e}=E(),{orgs:o,selectedOrg:n,selectOrg:u,createOrg:l,isLoading:c}=K(),d=a??e,[i,x]=t.useState(!1),[p,g]=t.useState(""),[f,v]=t.useState(""),[b,N]=t.useState(null),[h,j]=t.useState(!1),S=t.useRef(null),k=t.useCallback(m=>{S.current&&!m.composedPath().includes(S.current)&&x(!1)},[]);t.useEffect(()=>{if(i){const m=setTimeout(()=>{document.addEventListener("click",k)},0);return()=>{clearTimeout(m),document.removeEventListener("click",k)}}},[i,k]);const P=t.useCallback(m=>{g(m),v(m.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,""))},[]),z=t.useCallback(async m=>{m.preventDefault(),N(null),j(!0);try{const y=await l(p,f);y&&(await u(y.id),r==null||r(y),g(""),v(""),x(!1))}catch(y){N(y instanceof Error?y.message:"Failed to create organization")}finally{j(!1)}},[p,f,l,u,r]);if(c)return null;const F=(n==null?void 0:n.name)??(o.length===0?"No organization":"Select organization"),w=n?n.name.split(" ").map(m=>m[0]).join("").slice(0,2).toUpperCase():"--";return s.jsx(M,{appearance:d,children:s.jsxs("div",{style:{position:"relative",display:"inline-block",width:"100%",maxWidth:"360px"},ref:S,children:[s.jsxs("button",{type:"button",className:"ss-auth-org-trigger",onClick:()=>x(!i),children:[s.jsxs("div",{className:"ss-auth-org-trigger-inner",children:[s.jsx("div",{className:"ss-auth-org-avatar",children:w}),s.jsxs("div",{style:{textAlign:"left"},children:[s.jsx("div",{className:"ss-auth-org-trigger-label",children:"Current Organization"}),s.jsx("div",{className:"ss-auth-org-trigger-name",children:F})]})]}),s.jsx("span",{className:"material-symbols-outlined",children:$.unfoldMore})]}),i&&s.jsxs("div",{className:"ss-auth-dropdown ss-auth-dropdown-left ss-auth-glass-panel",style:{width:"100%"},children:[s.jsx("div",{className:"ss-auth-section-label",children:"Your Organizations"}),s.jsx("div",{style:{padding:"0 8px 4px"},children:o.map(m=>{const y=(n==null?void 0:n.id)===m.id,C=m.name.split(" ").map(B=>B[0]).join("").slice(0,2).toUpperCase();return s.jsxs("button",{type:"button",className:`ss-auth-org-item${y?" ss-auth-org-item-active":""}`,onClick:async()=>{x(!1),await u(m.id),r==null||r(m)},children:[s.jsxs("div",{className:"ss-auth-org-item-inner",children:[s.jsx("div",{className:`ss-auth-org-avatar${y?"":" ss-auth-org-avatar-inactive"}`,children:C}),s.jsx("span",{style:{fontFamily:"'Manrope', sans-serif",letterSpacing:"-0.01em"},children:m.name})]}),y&&s.jsx("span",{className:"material-symbols-outlined ss-auth-org-check",style:{fontSize:"18px"},children:$.checkCircle})]},m.id)})}),s.jsxs("div",{className:"ss-auth-org-create",children:[s.jsxs("div",{className:"ss-auth-org-create-header",children:[s.jsx("span",{className:"material-symbols-outlined",children:$.addCircle}),s.jsx("span",{children:"Create organization"})]}),b&&s.jsx("div",{className:"ss-auth-error",style:{marginBottom:"12px",fontSize:"12px"},children:s.jsx("span",{children:b})}),s.jsxs("form",{onSubmit:z,children:[s.jsxs("div",{className:"ss-auth-field",children:[s.jsx("label",{className:"ss-auth-label",style:{fontSize:"10px"},children:"Org Name"}),s.jsx("input",{className:"ss-auth-input",type:"text",placeholder:"e.g. Nexus Dynamics",value:p,onChange:m=>P(m.target.value),required:!0,style:{fontSize:"13px",padding:"10px 12px"}})]}),s.jsxs("div",{className:"ss-auth-field",children:[s.jsx("label",{className:"ss-auth-label",style:{fontSize:"10px"},children:"Workspace Slug"}),s.jsxs("div",{style:{position:"relative"},children:[s.jsx("span",{className:"ss-auth-org-slug-prefix",children:"/"}),s.jsx("input",{className:"ss-auth-input",type:"text",placeholder:"nexus-dynamics",value:f,onChange:m=>v(m.target.value),required:!0,style:{fontSize:"13px",padding:"10px 12px 10px 22px"}})]})]}),s.jsxs("button",{type:"submit",className:"ss-auth-btn-primary",disabled:h||!p.trim(),style:{marginTop:"8px"},children:[h&&s.jsx("span",{className:"ss-auth-spinner"}),"Initialize Organization"]})]})]})]})]})})}function Ls(a,r="USD"){return new Intl.NumberFormat("en-US",{style:"currency",currency:r,minimumFractionDigits:a%100===0?0:2}).format(a/100)}function Bs({plans:a,currentPlanId:r,onSelectPlan:e,interval:o,appearance:n}){const{appearance:u}=E(),l=n??u,c=o?a.filter(d=>d.interval===o||d.isFree):a;return s.jsx(M,{appearance:l,children:s.jsx("div",{className:"ss-pricing-grid",children:c.map(d=>{const i=d.id===r;return s.jsxs("div",{className:`ss-pricing-card ${i?"ss-pricing-card-current":""}`,children:[s.jsxs("div",{className:"ss-pricing-header",children:[s.jsx("h3",{className:"ss-pricing-name",children:d.name}),d.trialDays>0&&s.jsxs("span",{className:"ss-badge ss-badge-trialing",children:[d.trialDays,"-day trial"]}),d.isFree&&s.jsx("span",{className:"ss-badge ss-badge-active",children:"Free"})]}),s.jsx("div",{className:"ss-pricing-price",children:d.isFree?s.jsx("span",{className:"ss-pricing-amount",children:"Free"}):s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"ss-pricing-amount",children:Ls(d.amountCents,d.currency)}),s.jsxs("span",{className:"ss-pricing-interval",children:["/",d.interval]})]})}),d.description&&s.jsx("p",{className:"ss-pricing-desc",children:d.description}),d.features.length>0&&s.jsx("ul",{className:"ss-pricing-features",children:d.features.map((x,p)=>s.jsxs("li",{className:"ss-pricing-feature",children:[s.jsx("span",{className:"ss-check",children:"✓"})," ",x]},p))}),s.jsx("button",{type:"button",className:`ss-btn ${i?"ss-btn-current":"ss-btn-primary"}`,disabled:i,onClick:()=>e(d.id),children:i?"Current plan":"Select plan"})]},d.id)})})})}function Ts(){const{client:a}=E();return{billing:a.billing}}function W(a){const{client:r}=E();return t.useMemo(()=>{if(a){const e=new U.Transport("https://api.saas-support.com/v1",{type:"portalToken",token:a});return new U.BillingClient(e)}return r.billing},[r,a])}function os(a,r){const e=W(r),[o,n]=t.useState(null),[u,l]=t.useState(!0),[c,d]=t.useState(null),i=t.useCallback(async()=>{l(!0),d(null);try{const x=await e.getCustomer(a);n(x)}catch(x){d(x instanceof Error?x.message:"Failed to load subscription")}finally{l(!1)}},[e,a]);return t.useEffect(()=>{i()},[i]),{customer:o,isLoading:u,error:c,refresh:i}}function is(a,r){const e=W(r),[o,n]=t.useState([]),[u,l]=t.useState(!0),[c,d]=t.useState(null),i=t.useCallback(async()=>{l(!0),d(null);try{const x=await e.getInvoices(a);n(x)}catch(x){d(x instanceof Error?x.message:"Failed to load invoices")}finally{l(!1)}},[e,a]);return t.useEffect(()=>{i()},[i]),{invoices:o,isLoading:u,error:c,refresh:i}}function ls(a,r){const e=W(r),[o,n]=t.useState([]),[u,l]=t.useState(!0),[c,d]=t.useState(null),i=t.useCallback(async()=>{l(!0),d(null);try{const x=await e.getCurrentUsage(a);n(x)}catch(x){d(x instanceof Error?x.message:"Failed to load usage")}finally{l(!1)}},[e,a]);return t.useEffect(()=>{i()},[i]),{usage:o,isLoading:u,error:c,refresh:i}}const As={active:"ss-badge-active"};function cs({customerId:a,portalToken:r,onChangePlan:e,onCancel:o,appearance:n}){const{appearance:u}=E(),{customer:l,isLoading:c,error:d}=os(a,r),i=n??u;return s.jsx(M,{appearance:i,children:s.jsxs("div",{className:"ss-card",children:[s.jsx("h2",{className:"ss-title",children:"Subscription"}),c&&s.jsxs("div",{className:"ss-loading",children:[s.jsx("span",{className:"ss-spinner"})," Loading..."]}),d&&s.jsx("div",{className:"ss-global-error",children:d}),l&&!c&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"ss-field",children:[s.jsx("label",{className:"ss-label",children:"Customer"}),s.jsx("input",{className:"ss-input",value:l.name||l.email,disabled:!0,readOnly:!0})]}),s.jsxs("div",{className:"ss-field",children:[s.jsx("label",{className:"ss-label",children:"Status"}),s.jsx("div",{children:s.jsx("span",{className:`ss-badge ${As.active}`,children:"Active"})})]}),s.jsxs("div",{className:"ss-btn-group",children:[e&&s.jsx("button",{type:"button",className:"ss-btn ss-btn-primary",onClick:e,children:"Change plan"}),o&&s.jsx("button",{type:"button",className:"ss-btn ss-btn-danger",onClick:o,children:"Cancel subscription"})]})]})]})})}const Ds={paid:"ss-badge-active",open:"ss-badge-trialing",draft:"ss-badge-paused",void:"ss-badge-canceled",uncollectible:"ss-badge-past-due"};function Ms(a){return new Date(a).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"})}function Us(a){return new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:2}).format(a/100)}function ds({customerId:a,portalToken:r,appearance:e}){const{appearance:o}=E(),{invoices:n,isLoading:u,error:l}=is(a,r),c=e??o,d=[...n].sort((i,x)=>new Date(x.createdAt).getTime()-new Date(i.createdAt).getTime());return s.jsx(M,{appearance:c,children:s.jsxs("div",{className:"ss-card ss-card-wide",children:[s.jsx("h2",{className:"ss-title",children:"Invoices"}),u&&s.jsxs("div",{className:"ss-loading",children:[s.jsx("span",{className:"ss-spinner"})," Loading..."]}),l&&s.jsx("div",{className:"ss-global-error",children:l}),!u&&d.length===0&&s.jsx("p",{className:"ss-empty",children:"No invoices yet."}),!u&&d.length>0&&s.jsxs("table",{className:"ss-table",children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{className:"ss-th",children:"Date"}),s.jsx("th",{className:"ss-th",children:"Amount"}),s.jsx("th",{className:"ss-th",children:"Status"}),s.jsx("th",{className:"ss-th",children:"PDF"})]})}),s.jsx("tbody",{children:d.map(i=>s.jsxs("tr",{className:"ss-tr",children:[s.jsx("td",{className:"ss-td",children:Ms(i.createdAt)}),s.jsx("td",{className:"ss-td",children:Us(i.amountCents)}),s.jsx("td",{className:"ss-td",children:s.jsx("span",{className:`ss-badge ${Ds[i.status]||""}`,children:i.status})}),s.jsx("td",{className:"ss-td",children:i.pdfUrl?s.jsx("a",{className:"ss-link",href:i.pdfUrl,target:"_blank",rel:"noopener noreferrer",children:"Download"}):"—"})]},i.id))})]})]})})}function us({customerId:a,limits:r,portalToken:e,appearance:o}){const{appearance:n}=E(),{usage:u,isLoading:l,error:c}=ls(a,e),d=o??n;return s.jsx(M,{appearance:d,children:s.jsxs("div",{className:"ss-card",children:[s.jsx("h2",{className:"ss-title",children:"Usage"}),l&&s.jsxs("div",{className:"ss-loading",children:[s.jsx("span",{className:"ss-spinner"})," Loading..."]}),c&&s.jsx("div",{className:"ss-global-error",children:c}),!l&&u.length===0&&s.jsx("p",{className:"ss-empty",children:"No usage data."}),!l&&u.map(i=>{const x=r==null?void 0:r[i.metric],p=x?Math.min(100,i.total/x*100):null;return s.jsxs("div",{className:"ss-usage-item",children:[s.jsxs("div",{className:"ss-usage-header",children:[s.jsx("span",{className:"ss-usage-metric",children:i.metric}),s.jsxs("span",{className:"ss-usage-value",children:[i.total.toLocaleString(),x?` / ${x.toLocaleString()}`:""]})]}),p!==null&&s.jsx("div",{className:"ss-progress-bar",children:s.jsx("div",{className:`ss-progress-fill ${p>90?"ss-progress-danger":""}`,style:{width:`${p}%`}})})]},i.metric)})]})})}function Vs({customerId:a,portalToken:r,limits:e,onChangePlan:o,onCancel:n,appearance:u}){const{appearance:l}=E(),c=u??l,[d,i]=t.useState("subscription"),x=[{id:"subscription",label:"Subscription"},{id:"invoices",label:"Invoices"},{id:"usage",label:"Usage"}];return s.jsx(M,{appearance:c,children:s.jsxs("div",{className:"ss-card ss-card-wide",children:[s.jsx("h2",{className:"ss-title",children:"Billing"}),s.jsx("div",{className:"ss-tab-group",children:x.map(p=>s.jsx("button",{type:"button",className:`ss-tab ${d===p.id?"ss-tab-active":""}`,onClick:()=>i(p.id),children:p.label},p.id))}),s.jsxs("div",{className:"ss-tab-content",children:[d==="subscription"&&s.jsx(cs,{customerId:a,portalToken:r,onChangePlan:o,onCancel:n}),d==="invoices"&&s.jsx(ds,{customerId:a,portalToken:r}),d==="usage"&&s.jsx(us,{customerId:a,portalToken:r,limits:e})]})]})})}function Rs({customerId:a,portalToken:r,onApplied:e,appearance:o}){const{appearance:n}=E(),u=W(r),l=o??n,[c,d]=t.useState(""),[i,x]=t.useState(!1),[p,g]=t.useState(null),[f,v]=t.useState(null),b=t.useCallback(async N=>{if(N.preventDefault(),!!c.trim()){x(!0),g(null),v(null);try{const h=await u.applyCoupon(a,c.trim());v(`Coupon applied! ${h.discountType==="percent"?`${h.amount}% off`:`$${(h.amount/100).toFixed(2)} off`}`),d(""),e==null||e(h)}catch(h){g(h instanceof Error?h.message:"Invalid coupon code")}finally{x(!1)}}},[u,a,c,e]);return s.jsx(M,{appearance:l,children:s.jsxs("div",{className:"ss-card",children:[s.jsx("h2",{className:"ss-title",children:"Apply coupon"}),p&&s.jsx("div",{className:"ss-global-error",children:p}),f&&s.jsx("div",{className:"ss-success-msg",children:f}),s.jsxs("form",{onSubmit:b,children:[s.jsxs("div",{className:"ss-field",children:[s.jsx("label",{className:"ss-label",htmlFor:"ss-coupon-code",children:"Coupon code"}),s.jsx("input",{id:"ss-coupon-code",className:"ss-input",type:"text",placeholder:"Enter coupon code",value:c,onChange:N=>d(N.target.value),required:!0})]}),s.jsxs("button",{type:"submit",className:"ss-btn ss-btn-primary",disabled:i||!c.trim(),children:[i&&s.jsx("span",{className:"ss-spinner"}),"Apply"]})]})]})})}function qs(){const{client:a}=E();return{report:a.report}}function ss(){const{client:a}=E(),[r,e]=t.useState(null),[o,n]=t.useState(!1),[u,l]=t.useState(null),c=t.useCallback(async d=>{n(!0),l(null);try{const i=await a.report.executeQuery(d);return e(i),i}catch(i){return l(i instanceof Error?i.message:"Query failed"),null}finally{n(!1)}},[a]);return{result:r,execute:c,isLoading:o,error:u}}function ps(a){const{client:r}=E(),[e,o]=t.useState(null),[n,u]=t.useState(!0),[l,c]=t.useState(null),d=t.useCallback(async()=>{u(!0),c(null);try{const i=await r.report.listQueries(a);o(i)}catch(i){c(i instanceof Error?i.message:"Failed to load queries")}finally{u(!1)}},[r,a]);return t.useEffect(()=>{d()},[d]),{queries:(e==null?void 0:e.data)??[],meta:e==null?void 0:e.meta,isLoading:n,error:l,refresh:d}}function Hs(a){const{client:r}=E(),[e,o]=t.useState(null),[n,u]=t.useState(!0),[l,c]=t.useState(null),d=t.useCallback(async()=>{u(!0),c(null);try{const i=await r.report.getDashboard(a);o(i)}catch(i){c(i instanceof Error?i.message:"Failed to load dashboard")}finally{u(!1)}},[r,a]);return t.useEffect(()=>{d()},[d]),{dashboard:e,isLoading:n,error:l,refresh:d}}function Ws(a,r,e="https://api.saas-support.com/v1"){const o=t.useMemo(()=>{const p=new U.Transport(e,{type:"embedToken",token:a});return new U.ReportClient(p)},[a,e]),[n,u]=t.useState(null),[l,c]=t.useState(!0),[d,i]=t.useState(null),x=t.useCallback(async()=>{c(!0),i(null);try{const p=await o.getDashboard(r);u(p)}catch(p){i(p instanceof Error?p.message:"Failed to load dashboard")}finally{c(!1)}},[o,r]);return t.useEffect(()=>{x()},[x]),{dashboard:n,reportClient:o,isLoading:l,error:d,refresh:x}}function _s({onResult:a,mode:r="both",placeholder:e,appearance:o}){const{appearance:n}=E(),{execute:u,isLoading:l,error:c}=ss(),d=o??n,[i,x]=t.useState(""),[p,g]=t.useState(r==="sql"?"sql":"nl"),f=t.useCallback(async v=>{if(v.preventDefault(),!i.trim())return;const N=await u(p==="sql"?{sql:i}:{naturalLanguage:i});N&&(a==null||a(N))},[i,p,u,a]);return s.jsx(M,{appearance:d,children:s.jsxs("div",{className:"ss-card ss-card-wide",children:[r==="both"&&s.jsxs("div",{className:"ss-tab-group ss-tab-group-sm",children:[s.jsx("button",{type:"button",className:`ss-tab ${p==="nl"?"ss-tab-active":""}`,onClick:()=>g("nl"),children:"Natural Language"}),s.jsx("button",{type:"button",className:`ss-tab ${p==="sql"?"ss-tab-active":""}`,onClick:()=>g("sql"),children:"SQL"})]}),c&&s.jsx("div",{className:"ss-global-error",children:c}),s.jsxs("form",{onSubmit:f,children:[s.jsx("div",{className:"ss-field",children:s.jsx("textarea",{className:"ss-input ss-query-textarea",placeholder:e??(p==="sql"?"SELECT ...":"Ask a question about your data..."),value:i,onChange:v=>x(v.target.value),rows:3})}),s.jsxs("button",{type:"submit",className:"ss-btn ss-btn-primary",disabled:l||!i.trim(),children:[l&&s.jsx("span",{className:"ss-spinner"}),"Run query"]})]})]})})}function hs({columns:a,rows:r,sortable:e=!0,maxRows:o,appearance:n}){const{appearance:u}=E(),l=n??u,[c,d]=t.useState(null),[i,x]=t.useState("asc"),p=t.useMemo(()=>c?[...r].sort((b,N)=>{const h=b[c],j=N[c];if(h==null&&j==null)return 0;if(h==null)return 1;if(j==null)return-1;if(typeof h=="number"&&typeof j=="number")return i==="asc"?h-j:j-h;const S=String(h),k=String(j);return i==="asc"?S.localeCompare(k):k.localeCompare(S)}):r,[r,c,i]),g=o?p.slice(0,o):p,f=b=>{e&&(c===b?x(N=>N==="asc"?"desc":"asc"):(d(b),x("asc")))};function v(b){return b==null?"":typeof b=="object"?JSON.stringify(b):String(b)}return s.jsx(M,{appearance:l,children:s.jsxs("div",{className:"ss-table-container",children:[s.jsxs("table",{className:"ss-table",children:[s.jsx("thead",{children:s.jsx("tr",{children:a.map(b=>s.jsxs("th",{className:`ss-th ${e?"ss-th-sortable":""} ${c===b?i==="asc"?"ss-sorted-asc":"ss-sorted-desc":""}`,onClick:()=>f(b),children:[b,c===b&&s.jsx("span",{className:"ss-sort-indicator",children:i==="asc"?" ▲":" ▼"})]},b))})}),s.jsx("tbody",{children:g.map((b,N)=>s.jsx("tr",{className:"ss-tr",children:a.map(h=>s.jsx("td",{className:"ss-td",children:v(b[h])},h))},N))})]}),o&&r.length>o&&s.jsxs("div",{className:"ss-table-footer",children:["Showing ",o," of ",r.length," rows"]})]})})}function Gs(a,r="#6366f1"){const e=parseInt(r.replace("#","").slice(0,2),16),o=[];for(let n=0;n<a;n++){const u=(e+n*Math.floor(360/Math.max(a,1)))%360;o.push(`hsl(${u}, 65%, 55%)`)}return o}function Ys({labels:a,values:r,w:e,h:o,colors:n}){const u=Math.max(...r,1),l=40,c=e-l*2,d=o-l*2,i=Math.max(1,c/a.length-4);return s.jsxs("g",{children:[s.jsx("line",{x1:l,y1:o-l,x2:e-l,y2:o-l,stroke:"#ccc",strokeWidth:1}),r.map((x,p)=>{const g=x/u*d,f=l+c/a.length*p+2,v=o-l-g;return s.jsxs("g",{children:[s.jsx("rect",{x:f,y:v,width:i,height:g,fill:n[p%n.length],rx:2}),s.jsx("text",{x:f+i/2,y:o-l+14,textAnchor:"middle",fontSize:10,fill:"#666",children:a[p].length>8?a[p].slice(0,8)+"...":a[p]})]},p)})]})}function Qs({labels:a,values:r,w:e,h:o,colors:n}){const u=Math.max(...r,1),l=40,c=e-l*2,d=o-l*2,i=a.length>1?c/(a.length-1):0,x=r.map((p,g)=>{const f=l+i*g,v=o-l-p/u*d;return`${f},${v}`});return s.jsxs("g",{children:[[.25,.5,.75,1].map(p=>{const g=o-l-p*d;return s.jsx("line",{x1:l,y1:g,x2:e-l,y2:g,stroke:"#eee",strokeWidth:1},p)}),s.jsx("polyline",{points:x.join(" "),fill:"none",stroke:n[0],strokeWidth:2}),r.map((p,g)=>{const f=l+i*g,v=o-l-p/u*d;return s.jsx("circle",{cx:f,cy:v,r:4,fill:n[0]},g)})]})}function Js({labels:a,values:r,w:e,h:o,colors:n}){const u=r.reduce((g,f)=>g+f,0)||1,l=e/2,c=o/2-20,d=Math.min(e,o)/2-40,i=2*Math.PI*d;let x=0;const p=r.map((g,f)=>{const v=g/u,b=v*i,N={dash:b,offset:x,color:n[f%n.length],label:a[f],pct:v};return x+=b,N});return s.jsxs("g",{children:[p.map((g,f)=>s.jsx("circle",{cx:l,cy:c,r:d,fill:"none",stroke:g.color,strokeWidth:d*.6,strokeDasharray:`${g.dash} ${i-g.dash}`,strokeDashoffset:-g.offset,transform:`rotate(-90 ${l} ${c})`},f)),s.jsx("g",{transform:`translate(${l-a.length*30}, ${o-20})`,children:p.slice(0,6).map((g,f)=>s.jsxs("g",{transform:`translate(${f*60}, 0)`,children:[s.jsx("rect",{width:10,height:10,fill:g.color,rx:2}),s.jsx("text",{x:14,y:9,fontSize:9,fill:"#666",children:g.label.length>6?g.label.slice(0,6)+"..":g.label})]},f))})]})}function xs({type:a,data:r,title:e,width:o=400,height:n=300,appearance:u}){const{appearance:l}=E(),c=u??l,d=t.useMemo(()=>Gs(r.labels.length),[r.labels.length]);return s.jsx(M,{appearance:c,children:s.jsxs("div",{className:"ss-chart-container",children:[e&&s.jsx("h3",{className:"ss-chart-title",children:e}),s.jsxs("svg",{viewBox:`0 0 ${o} ${n}`,width:"100%",style:{maxWidth:o},children:[a==="bar"&&s.jsx(Ys,{labels:r.labels,values:r.values,w:o,h:n,colors:d}),a==="line"&&s.jsx(Qs,{labels:r.labels,values:r.values,w:o,h:n,colors:d}),a==="pie"&&s.jsx(Js,{labels:r.labels,values:r.values,w:o,h:n,colors:d})]})]})})}function Zs({dashboardId:a,embedToken:r,baseUrl:e,refreshInterval:o,appearance:n}){const u=E(),l=n??(u==null?void 0:u.appearance),c=t.useMemo(()=>{if(r){const h=e??"https://api.saas-support.com/v1",j=new U.Transport(h,{type:"embedToken",token:r});return new U.ReportClient(j)}return u.client.report},[r,e,u]),[d,i]=t.useState([]),[x,p]=t.useState({}),[g,f]=t.useState(!0),[v,b]=t.useState(null),N=t.useCallback(async()=>{f(!0),b(null);try{const h=await c.getDashboard(a),j=JSON.parse(h.layoutJson||"[]");i(j);const S={};for(const k of j)try{const P=await c.listQueries({search:k.queryId,perPage:1});if(P.data.length>0&&P.data[0].generatedSql){const z=await c.executeQuery({sql:P.data[0].generatedSql});S[k.queryId]=z}}catch{}p(S)}catch(h){b(h instanceof Error?h.message:"Failed to load dashboard")}finally{f(!1)}},[c,a]);return t.useEffect(()=>{N()},[N]),t.useEffect(()=>{if(!o||o<=0)return;const h=setInterval(N,o*1e3);return()=>clearInterval(h)},[o,N]),s.jsx(M,{appearance:l,children:s.jsxs("div",{className:"ss-dashboard-grid",children:[g&&s.jsxs("div",{className:"ss-loading",children:[s.jsx("span",{className:"ss-spinner"})," Loading dashboard..."]}),v&&s.jsx("div",{className:"ss-global-error",children:v}),!g&&d.map((h,j)=>{const S=x[h.queryId];if(!S)return null;const k=S.columns.length>=2?{labels:S.rows.map(P=>String(P[S.columns[0]]??"")),values:S.rows.map(P=>Number(P[S.columns[1]]??0))}:{labels:[],values:[]};return s.jsxs("div",{className:"ss-widget",children:[h.title&&s.jsx("h4",{className:"ss-widget-header",children:h.title}),h.chartType==="table"?s.jsx(hs,{columns:S.columns,rows:S.rows,maxRows:50}):s.jsx(xs,{type:h.chartType||"bar",data:k,width:h.w,height:h.h})]},j)})]})})}function Ks(a){return new Date(a).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"})}function Xs({onSelectQuery:a,onRunQuery:r,appearance:e}){const{appearance:o}=E(),{queries:n,isLoading:u,error:l}=ps(),{execute:c,isLoading:d}=ss(),i=e??o,x=t.useCallback(async p=>{if(!p.generatedSql)return;const g=await c({sql:p.generatedSql});g&&(r==null||r(g))},[c,r]);return s.jsx(M,{appearance:i,children:s.jsxs("div",{className:"ss-card ss-card-wide",children:[s.jsx("h2",{className:"ss-title",children:"Saved Queries"}),u&&s.jsxs("div",{className:"ss-loading",children:[s.jsx("span",{className:"ss-spinner"})," Loading..."]}),l&&s.jsx("div",{className:"ss-global-error",children:l}),!u&&n.length===0&&s.jsx("p",{className:"ss-empty",children:"No saved queries."}),!u&&n.map(p=>s.jsxs("div",{className:"ss-saved-query-card",onClick:()=>a==null?void 0:a(p),children:[s.jsxs("div",{className:"ss-saved-query-header",children:[s.jsx("span",{className:"ss-saved-query-name",children:p.name}),p.chartType&&s.jsx("span",{className:"ss-badge",children:p.chartType})]}),p.naturalLanguage&&s.jsx("p",{className:"ss-saved-query-desc",children:p.naturalLanguage}),s.jsxs("div",{className:"ss-saved-query-footer",children:[s.jsx("span",{className:"ss-saved-query-date",children:Ks(p.createdAt)}),s.jsx("button",{type:"button",className:"ss-btn ss-btn-sm ss-btn-primary",disabled:d||!p.generatedSql,onClick:g=>{g.stopPropagation(),x(p)},children:d?s.jsx("span",{className:"ss-spinner"}):"Run"})]})]},p.id))]})})}function sa({embedToken:a,dashboardId:r,baseUrl:e="https://api.saas-support.com/v1",refreshInterval:o,appearance:n}){const u=t.useMemo(()=>{const b=new U.Transport(e,{type:"embedToken",token:a});return new U.ReportClient(b)},[a,e]),[l,c]=t.useState([]),[d,i]=t.useState(!0),[x,p]=t.useState(null),g=t.useMemo(()=>Y(n),[n]),f=t.useMemo(()=>Q(g),[g]),v=t.useCallback(async()=>{i(!0),p(null);try{const b=await u.getDashboard(r),N=JSON.parse(b.layoutJson||"[]"),h=await Promise.all(N.map(async j=>{try{const S=await u.listQueries({search:j.queryId,perPage:1});if(S.data.length>0&&S.data[0].generatedSql){const k=await u.executeQuery({sql:S.data[0].generatedSql});return{...j,result:k}}}catch{}return j}));c(h)}catch(b){p(b instanceof Error?b.message:"Failed to load dashboard")}finally{i(!1)}},[u,r]);return t.useEffect(()=>{v()},[v]),t.useEffect(()=>{if(!o||o<=0)return;const b=setInterval(v,o*1e3);return()=>clearInterval(b)},[o,v]),s.jsx("div",{ref:b=>{if(!b||b.shadowRoot)return;const N=b.attachShadow({mode:"open"}),h=document.createElement("style");h.textContent=f,N.appendChild(h);const j=document.createElement("div");N.appendChild(j)},style:{display:"contents"},children:s.jsxs("div",{className:"ss-dashboard-grid",children:[d&&s.jsx("div",{className:"ss-loading",children:"Loading dashboard..."}),x&&s.jsx("div",{className:"ss-global-error",children:x}),!d&&l.map((b,N)=>{if(!b.result)return null;const{columns:h,rows:j}=b.result;return s.jsxs("div",{className:"ss-widget",children:[b.title&&s.jsx("h4",{className:"ss-widget-header",children:b.title}),s.jsxs("table",{className:"ss-table",children:[s.jsx("thead",{children:s.jsx("tr",{children:h.map(S=>s.jsx("th",{className:"ss-th",children:S},S))})}),s.jsx("tbody",{children:j.slice(0,50).map((S,k)=>s.jsx("tr",{className:"ss-tr",children:h.map(P=>s.jsx("td",{className:"ss-td",children:String(S[P]??"")},P))},k))})]})]},N)})]})})}exports.SaaSError=U.SaaSError;exports.SaaSSupport=U.SaaSSupport;exports.isMfaRequired=U.isMfaRequired;exports.Chart=xs;exports.CouponInput=Rs;exports.DashboardView=Zs;exports.DataTable=hs;exports.InvoiceHistory=ds;exports.OrgSwitcher=Fs;exports.PaymentPortal=Vs;exports.PricingTable=Bs;exports.QueryInput=_s;exports.ReportEmbed=sa;exports.SaaSContext=J;exports.SaaSProvider=js;exports.SavedQueryList=Xs;exports.SignIn=Cs;exports.SignUp=Ps;exports.SubscriptionStatus=cs;exports.UsageDisplay=us;exports.UserButton=Es;exports.UserProfile=Is;exports.useAuth=H;exports.useBilling=Ts;exports.useDashboard=Hs;exports.useDeleteAccount=es;exports.useEmbedDashboard=Ws;exports.useInvoices=is;exports.useOrg=K;exports.useProfile=X;exports.useQuery=ss;exports.useReport=qs;exports.useSaaSContext=E;exports.useSavedQueries=ps;exports.useSignIn=Z;exports.useSignUp=as;exports.useSubscription=os;exports.useUsage=ls;exports.useUser=$s;
2333
+ `}function M({children:e,appearance:a}){const t=r.useRef(null),[o,n]=r.useState(null);r.useEffect(()=>{var g;if(!t.current||t.current.shadowRoot){n(((g=t.current)==null?void 0:g.shadowRoot)??null);return}const i=t.current.attachShadow({mode:"open"});if((a==null?void 0:a.fontUrl)!==null){const p=(a==null?void 0:a.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";if(!document.querySelector(`link[href="${p}"]`)){const m=document.createElement("link");m.rel="stylesheet",m.href=p,document.head.appendChild(m)}const x=document.createElement("link");x.rel="stylesheet",x.href=p,i.appendChild(x)}const c=Q(a),d=document.createElement("style");d.textContent=J(c),i.appendChild(d);const l=document.createElement("div");i.appendChild(l),n(i)},[]),r.useEffect(()=>{if(!o)return;const i=o.querySelector("style");if(i){const c=Q(a);i.textContent=J(c)}},[a,o]);const u=(o==null?void 0:o.querySelector("div"))??null;return s.jsx("div",{ref:t,style:{display:"contents"},children:u&&js.createPortal(e,u)})}function W(){const{client:e,user:a,isLoaded:t}=I();return{isLoaded:t,isSignedIn:!!a,user:a,signOut:r.useCallback(()=>e.auth.signOut(),[e]),getToken:r.useCallback(()=>e.auth.getToken(),[e]),refreshUser:r.useCallback(()=>e.auth.refreshUser(),[e])}}function $s(){const{user:e,isLoaded:a}=I();return{user:e,isLoaded:a}}function K(){const{client:e}=I(),[a,t]=r.useState(!1),[o,n]=r.useState(null),u=r.useCallback(async(d,l)=>{t(!0),n(null);try{return await e.auth.signIn(d,l)}catch(g){return n(g instanceof Error?g.message:"Sign in failed"),null}finally{t(!1)}},[e]),i=r.useCallback(async d=>{t(!0),n(null);try{return await e.auth.signInWithOAuth(d)}catch(l){return n(l instanceof Error?l.message:"OAuth sign in failed"),null}finally{t(!1)}},[e]),c=r.useCallback(async(d,l)=>{t(!0),n(null);try{return await e.auth.submitMfaCode(d,l)}catch(g){return n(g instanceof Error?g.message:"MFA verification failed"),null}finally{t(!1)}},[e]);return{signIn:u,signInWithOAuth:i,submitMfaCode:c,isLoading:a,error:o,setError:n}}function es(){const{client:e}=I(),[a,t]=r.useState(!1),[o,n]=r.useState(null);return{signUp:r.useCallback(async(i,c)=>{t(!0),n(null);try{return await e.auth.signUp(i,c)}catch(d){return n(d instanceof Error?d.message:"Sign up failed"),null}finally{t(!1)}},[e]),isLoading:a,error:o,setError:n}}function H(){const{client:e}=I(),[a,t]=r.useState([]),[o,n]=r.useState(null),[u,i]=r.useState([]),[c,d]=r.useState([]),[l,g]=r.useState(!1),[p,x]=r.useState(null),m=r.useCallback(async()=>{g(!0),x(null);try{const N=await e.auth.listOrgs();t(N);const f=typeof window<"u"?localStorage.getItem("ss_selected_org"):null;if(f&&N.some(y=>y.id===f)&&!o){const y=N.find(z=>z.id===f);n(y);try{const z=await e.auth.listMembers(y.id);i(z)}catch{}}}catch(N){x(N instanceof Error?N.message:"Failed to load organizations")}finally{g(!1)}},[e,o]);r.useEffect(()=>{m()},[m]);const v=r.useCallback(async N=>{try{const f=await e.auth.getOrg(N);n(f),typeof window<"u"&&localStorage.setItem("ss_selected_org",N);const y=await e.auth.listMembers(N);i(y)}catch(f){x(f instanceof Error?f.message:"Failed to load organization")}},[e]),b=r.useCallback(async(N,f)=>{try{const y=await e.auth.createOrg(N,f);return t(z=>[...z,y]),y}catch(y){return x(y instanceof Error?y.message:"Failed to create organization"),null}},[e]),C=r.useCallback(async(N,f)=>{try{const y=await e.auth.updateOrg(N,f);return t(z=>z.map(D=>D.id===N?y:D)),(o==null?void 0:o.id)===N&&n(y),y}catch(y){return x(y instanceof Error?y.message:"Failed to update organization"),null}},[e,o]),h=r.useCallback(async N=>{try{return await e.auth.deleteOrg(N),t(f=>f.filter(y=>y.id!==N)),(o==null?void 0:o.id)===N&&(n(null),i([]),d([]),typeof window<"u"&&localStorage.removeItem("ss_selected_org")),!0}catch(f){return x(f instanceof Error?f.message:"Failed to delete organization"),!1}},[e,o]),w=r.useCallback(async(N,f,y)=>{try{return await e.auth.sendInvite(N,f,y)}catch(z){return x(z instanceof Error?z.message:"Failed to send invite"),null}},[e]),S=r.useCallback(async N=>{try{const f=await e.auth.listInvites(N);d(f)}catch(f){x(f instanceof Error?f.message:"Failed to load invites")}},[e]),$=r.useCallback(async(N,f)=>{try{return await e.auth.revokeInvite(N,f),d(y=>y.filter(z=>z.id!==f)),!0}catch(y){return x(y instanceof Error?y.message:"Failed to revoke invite"),!1}},[e]),P=r.useCallback(async(N,f,y)=>{try{return await e.auth.updateMemberRole(N,f,y),i(z=>z.map(D=>D.userId===f?{...D,role:y}:D)),!0}catch(z){return x(z instanceof Error?z.message:"Failed to update member role"),!1}},[e]),O=r.useCallback(async(N,f)=>{try{return await e.auth.removeMember(N,f),i(y=>y.filter(z=>z.userId!==f)),!0}catch(y){return x(y instanceof Error?y.message:"Failed to remove member"),!1}},[e]),E=r.useCallback(async N=>{try{const f=await e.auth.listMembers(N);i(f)}catch(f){x(f instanceof Error?f.message:"Failed to load members")}},[e]);return{orgs:a,selectedOrg:o,members:u,invites:c,isLoading:l,error:p,setError:x,refresh:m,selectOrg:v,createOrg:b,updateOrg:C,deleteOrg:h,sendInvite:w,refreshInvites:S,revokeInvite:$,updateMemberRole:P,removeMember:O,refreshMembers:E}}function as(){const{client:e}=I(),[a,t]=r.useState(!1),[o,n]=r.useState(null);return{deleteAccount:r.useCallback(async()=>{t(!0),n(null);try{return await e.auth.deleteAccount(),!0}catch(i){return n(i instanceof Error?i.message:"Failed to delete account"),!1}finally{t(!1)}},[e]),isLoading:a,error:o,setError:n}}function X(){const{client:e,user:a}=I(),[t,o]=r.useState(!1),[n,u]=r.useState(null),[i,c]=r.useState(null),d=r.useCallback(async p=>{o(!0),u(null),c(null);try{const x=await e.auth.updateProfile(p);return c("Profile updated"),x}catch(x){return u(x instanceof Error?x.message:"Failed to update profile"),null}finally{o(!1)}},[e]),l=r.useCallback(async(p,x)=>{o(!0),u(null),c(null);try{return await e.auth.changePassword(p,x),c("Password changed successfully"),!0}catch(m){return u(m instanceof Error?m.message:"Failed to change password"),!1}finally{o(!1)}},[e]),g=r.useCallback(async p=>{o(!0),u(null),c(null);try{const x=await e.auth.uploadAvatar(p);return c("Avatar updated"),x}catch(x){return u(x instanceof Error?x.message:"Failed to upload avatar"),null}finally{o(!1)}},[e]);return{user:a,updateProfile:d,uploadAvatar:g,changePassword:l,isLoading:t,error:n,success:i,setError:u,setSuccess:c}}const ts='<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>',rs='<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>',j={close:"close",person:"person",logout:"logout",checkCircle:"check_circle",unfoldMore:"unfold_more",cloudUpload:"cloud_upload",zoomIn:"zoom_in",zoomOut:"zoom_out",lock:"lock",visibility:"visibility",visibilityOff:"visibility_off",add:"add",addCircle:"add_circle",camera:"photo_camera",security:"security",errorOutline:"error_outline",info:"info",arrowForward:"arrow_forward",verified:"verified",token:"token",autoAwesome:"auto_awesome",corporateFare:"corporate_fare",cloudDone:"cloud_done",check:"check",image:"image",settings:"settings",group:"group",creditCard:"credit_card",edit:"edit",send:"send",personRemove:"person_remove"};function Cs({appearance:e,signUpUrl:a,onSignUp:t}){const{appearance:o,settings:n}=I(),{signIn:u,signInWithOAuth:i,submitMfaCode:c,isLoading:d,error:l,setError:g}=K(),p=e??o,[x,m]=r.useState(""),[v,b]=r.useState(""),[C,h]=r.useState(!1),[w,S]=r.useState(!1),[$,P]=r.useState(""),[O,E]=r.useState(["","","","","",""]),N=r.useRef([]),f=r.useCallback(async B=>{if(B.preventDefault(),w){await c($,O.join(""));return}const k=await u(x,v);k&&U.isMfaRequired(k)&&(P(k.mfaToken),S(!0),g(null))},[x,v,w,$,O,u,c,g]),y=r.useCallback(async B=>{await i(B)},[i]),z=r.useCallback((B,k)=>{var V;if(!/^\d*$/.test(k))return;const F=k.slice(-1);E(G=>{const q=[...G];return q[B]=F,q}),F&&B<5&&((V=N.current[B+1])==null||V.focus())},[]),D=r.useCallback((B,k)=>{var F;k.key==="Backspace"&&!O[B]&&B>0&&((F=N.current[B-1])==null||F.focus())},[O]),T=(n==null?void 0:n.googleEnabled)||(n==null?void 0:n.githubEnabled);return s.jsx(M,{appearance:p,children:s.jsx("div",{className:"ss-auth-card",children:s.jsxs("div",{className:"ss-auth-card-body",children:[s.jsxs("div",{className:"ss-auth-header",children:[s.jsx("div",{className:"ss-auth-brand-icon",children:s.jsx("span",{className:"material-symbols-outlined",children:j.token})}),s.jsx("h1",{className:"ss-auth-title",children:"Sign in to your account"}),s.jsx("p",{className:"ss-auth-subtitle",children:"Welcome back to your workspace"})]}),!w&&T&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"ss-auth-oauth-grid",children:[(n==null?void 0:n.googleEnabled)&&s.jsxs("button",{type:"button",className:"ss-auth-btn-social",onClick:()=>y("google"),disabled:d,children:[s.jsx("span",{dangerouslySetInnerHTML:{__html:ts}}),"Google"]}),(n==null?void 0:n.githubEnabled)&&s.jsxs("button",{type:"button",className:"ss-auth-btn-social",onClick:()=>y("github"),disabled:d,children:[s.jsx("span",{dangerouslySetInnerHTML:{__html:rs}}),"GitHub"]})]}),s.jsx("div",{className:"ss-auth-divider",children:"or continue with"})]}),l&&s.jsxs("div",{className:"ss-auth-error",children:[s.jsx("span",{className:"material-symbols-outlined",children:j.errorOutline}),s.jsx("span",{children:l})]}),s.jsxs("form",{onSubmit:f,children:[w?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"ss-auth-mfa-divider",children:s.jsx("span",{children:"Verification Required"})}),s.jsxs("div",{className:"ss-auth-field",children:[s.jsx("label",{className:"ss-auth-label",children:"6-Digit Code"}),s.jsx("div",{className:"ss-auth-mfa-group",children:O.map((B,k)=>s.jsx("input",{ref:F=>{N.current[k]=F},className:"ss-auth-mfa-digit",type:"text",inputMode:"numeric",maxLength:1,value:B,onChange:F=>z(k,F.target.value),onKeyDown:F=>D(k,F),autoFocus:k===0},k))}),s.jsx("p",{className:"ss-auth-mfa-hint",children:"We sent a 6-digit code to your registered email."})]})]}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"ss-auth-field",children:[s.jsx("label",{className:"ss-auth-label",htmlFor:"ss-email",children:"Email Address"}),s.jsx("input",{id:"ss-email",className:"ss-auth-input",type:"email",autoComplete:"email",placeholder:"name@company.com",value:x,onChange:B=>m(B.target.value),required:!0})]}),s.jsxs("div",{className:"ss-auth-field",children:[s.jsxs("div",{className:"ss-auth-field-row",children:[s.jsx("label",{className:"ss-auth-label",htmlFor:"ss-password",style:{marginBottom:0},children:"Password"}),s.jsx("span",{className:"ss-auth-link",style:{fontSize:"12px"},children:"Forgot?"})]}),s.jsxs("div",{style:{position:"relative"},children:[s.jsx("input",{id:"ss-password",className:"ss-auth-input",type:C?"text":"password",autoComplete:"current-password",placeholder:"••••••••",value:v,onChange:B=>b(B.target.value),required:!0}),s.jsx("button",{type:"button",className:"ss-auth-visibility-toggle",onClick:()=>h(!C),children:s.jsx("span",{className:"material-symbols-outlined",children:C?j.visibilityOff:j.visibility})})]})]})]}),s.jsxs("button",{type:"submit",className:"ss-auth-btn-primary",disabled:d,children:[d&&s.jsx("span",{className:"ss-auth-spinner"}),w?"Verify":"Sign in",!d&&s.jsx("span",{className:"material-symbols-outlined",children:j.arrowForward})]})]}),w?s.jsx("div",{className:"ss-auth-footer",children:s.jsx("span",{className:"ss-auth-link",onClick:()=>{S(!1),E(["","","","","",""]),g(null)},children:"Back to sign in"})}):s.jsxs("div",{className:"ss-auth-footer",children:["Don't have an account?"," ",t?s.jsx("span",{className:"ss-auth-link",onClick:t,children:"Sign up"}):a?s.jsx("a",{className:"ss-auth-link",href:a,children:"Sign up"}):s.jsx("span",{className:"ss-auth-link",children:"Sign up"})]})]})})})}function zs({appearance:e,signInUrl:a,onSignIn:t}){const{appearance:o,settings:n}=I(),{signUp:u,isLoading:i,error:c,setError:d}=es(),{signInWithOAuth:l}=K(),g=e??o,[p,x]=r.useState(""),[m,v]=r.useState(""),[b,C]=r.useState(""),[h,w]=r.useState(!1),[S,$]=r.useState(null),P=r.useCallback(async f=>{if(f.preventDefault(),$(null),m!==b){$("Passwords do not match");return}const y=(n==null?void 0:n.passwordMinLength)??8;if(m.length<y){$(`Password must be at least ${y} characters`);return}await u(p,m)},[p,m,b,n,u]),O=r.useCallback(async f=>{await l(f)},[l]),E=(n==null?void 0:n.googleEnabled)||(n==null?void 0:n.githubEnabled),N=S||c;return s.jsx(M,{appearance:g,children:s.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",width:"100%",maxWidth:"520px"},children:[s.jsxs("div",{className:"ss-auth-header",children:[s.jsx("div",{className:"ss-auth-brand-icon-gradient",children:s.jsx("span",{className:"material-symbols-outlined",children:j.autoAwesome})}),s.jsx("h1",{className:"ss-auth-title ss-auth-title-lg",children:"Create your account"}),s.jsx("p",{className:"ss-auth-subtitle",children:"Join the ecosystem"})]}),s.jsx("div",{className:"ss-auth-card",children:s.jsxs("div",{className:"ss-auth-card-body",children:[E&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"ss-auth-oauth-grid",children:[(n==null?void 0:n.googleEnabled)&&s.jsxs("button",{type:"button",className:"ss-auth-btn-social",onClick:()=>O("google"),disabled:i,children:[s.jsx("span",{dangerouslySetInnerHTML:{__html:ts}}),"Google"]}),(n==null?void 0:n.githubEnabled)&&s.jsxs("button",{type:"button",className:"ss-auth-btn-social",onClick:()=>O("github"),disabled:i,children:[s.jsx("span",{dangerouslySetInnerHTML:{__html:rs}}),"GitHub"]})]}),s.jsx("div",{className:"ss-auth-divider",children:"or sign up with email"})]}),N&&s.jsxs("div",{className:"ss-auth-error",children:[s.jsx("span",{className:"material-symbols-outlined",children:j.errorOutline}),s.jsx("span",{children:N})]}),s.jsxs("form",{onSubmit:P,children:[s.jsxs("div",{className:"ss-auth-field",children:[s.jsx("label",{className:"ss-auth-label",htmlFor:"ss-signup-email",children:"Email"}),s.jsx("input",{id:"ss-signup-email",className:"ss-auth-input",type:"email",autoComplete:"email",placeholder:"name@company.com",value:p,onChange:f=>x(f.target.value),required:!0})]}),s.jsxs("div",{className:"ss-auth-field",children:[s.jsx("label",{className:"ss-auth-label",htmlFor:"ss-signup-password",children:"Password"}),s.jsxs("div",{style:{position:"relative"},children:[s.jsx("input",{id:"ss-signup-password",className:"ss-auth-input",type:h?"text":"password",autoComplete:"new-password",placeholder:"••••••••",value:m,onChange:f=>{v(f.target.value),$(null)},required:!0}),s.jsx("button",{type:"button",className:"ss-auth-visibility-toggle",onClick:()=>w(!h),children:s.jsx("span",{className:"material-symbols-outlined",children:h?j.visibilityOff:j.visibility})})]})]}),s.jsxs("div",{className:"ss-auth-field",children:[s.jsx("label",{className:"ss-auth-label",htmlFor:"ss-signup-confirm",children:"Confirm Password"}),s.jsx("input",{id:"ss-signup-confirm",className:"ss-auth-input",type:"password",autoComplete:"new-password",placeholder:"••••••••",value:b,onChange:f=>{C(f.target.value),$(null)},required:!0})]}),s.jsxs("button",{type:"submit",className:"ss-auth-btn-primary",disabled:i,children:[i&&s.jsx("span",{className:"ss-auth-spinner"}),"Sign up",!i&&s.jsx("span",{className:"material-symbols-outlined",children:j.arrowForward})]})]}),s.jsxs("div",{className:"ss-auth-footer",children:["Already have an account?"," ",t?s.jsx("span",{className:"ss-auth-link",onClick:t,children:"Sign in"}):a?s.jsx("a",{className:"ss-auth-link",href:a,children:"Sign in"}):s.jsx("span",{className:"ss-auth-link",children:"Sign in"})]})]})})]})})}const L=320,R=128;function Ps({file:e,onCrop:a,onCancel:t}){const o=r.useRef(null),n=r.useRef(null),[u,i]=r.useState(1),[c,d]=r.useState({x:0,y:0}),[l,g]=r.useState(!1),p=r.useRef({x:0,y:0,ox:0,oy:0}),[x,m]=r.useState(!1);r.useEffect(()=>{const h=new Image,w=URL.createObjectURL(e);return h.onload=()=>{n.current=h,m(!0),d({x:0,y:0}),i(1)},h.src=w,()=>URL.revokeObjectURL(w)},[e]),r.useEffect(()=>{if(!x||!n.current||!o.current)return;const h=o.current.getContext("2d");if(!h)return;const w=n.current;h.clearRect(0,0,L,L),h.fillStyle="#111",h.fillRect(0,0,L,L);const S=Math.max(L/w.width,L/w.height)*u,$=w.width*S,P=w.height*S,O=(L-$)/2+c.x,E=(L-P)/2+c.y;h.save(),h.beginPath(),h.arc(L/2,L/2,R,0,Math.PI*2),h.clip(),h.drawImage(w,O,E,$,P),h.restore(),h.save(),h.fillStyle="rgba(0, 0, 0, 0.6)",h.fillRect(0,0,L,L),h.globalCompositeOperation="destination-out",h.beginPath(),h.arc(L/2,L/2,R,0,Math.PI*2),h.fill(),h.restore(),h.save(),h.beginPath(),h.arc(L/2,L/2,R,0,Math.PI*2),h.clip(),h.drawImage(w,O,E,$,P),h.restore(),h.strokeStyle="rgba(255, 255, 255, 0.4)",h.lineWidth=2,h.beginPath(),h.arc(L/2,L/2,R,0,Math.PI*2),h.stroke()},[u,c,x]);const v=r.useCallback(h=>{g(!0),p.current={x:h.clientX,y:h.clientY,ox:c.x,oy:c.y},h.target.setPointerCapture(h.pointerId)},[c]),b=r.useCallback(h=>{l&&d({x:p.current.ox+(h.clientX-p.current.x),y:p.current.oy+(h.clientY-p.current.y)})},[l]),C=r.useCallback(()=>g(!1),[]);return r.useCallback(()=>{if(!n.current)return;const h=document.createElement("canvas"),w=R*2;h.width=w,h.height=w;const S=h.getContext("2d");if(!S)return;const $=n.current,P=Math.max(L/$.width,L/$.height)*u,O=$.width*P,E=$.height*P,N=(L-O)/2+c.x-(L/2-R),f=(L-E)/2+c.y-(L/2-R);S.beginPath(),S.arc(R,R,R,0,Math.PI*2),S.clip(),S.drawImage($,N,f,O,E),h.toBlob(y=>{y&&a(y)},"image/png")},[u,c,a]),s.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"24px"},children:[s.jsxs("div",{className:"ss-auth-crop-area",children:[s.jsx("canvas",{ref:o,width:L,height:L,style:{cursor:l?"grabbing":"grab",width:"100%",height:"100%"},onPointerDown:v,onPointerMove:b,onPointerUp:C}),s.jsx("div",{className:"ss-auth-crop-size-badge",children:"256 x 256 px"})]}),s.jsxs("div",{className:"ss-auth-zoom-control",style:{width:"100%",maxWidth:"280px"},children:[s.jsx("span",{className:"material-symbols-outlined",children:j.zoomOut}),s.jsx("input",{type:"range",min:"1",max:"3",step:"0.01",value:u,onChange:h=>i(parseFloat(h.target.value)),className:"ss-auth-zoom-slider"}),s.jsx("span",{className:"material-symbols-outlined",children:j.zoomIn})]})]})}function ns({onUpload:e,onClose:a,isLoading:t}){const[o,n]=r.useState(null),[u,i]=r.useState(!1),[c,d]=r.useState(null),l=r.useRef(null),g=r.useCallback(m=>{if(!m.type.startsWith("image/")){d("Please select an image file");return}if(m.size>5*1024*1024){d("Image must be smaller than 5 MB");return}d(null),n(m)},[]),p=r.useCallback(m=>{m.preventDefault(),i(!1);const v=m.dataTransfer.files[0];v&&g(v)},[g]),x=r.useCallback(async m=>{await e(m)},[e]);return s.jsx("div",{className:"ss-auth-modal-overlay",onClick:m=>{m.target===m.currentTarget&&a()},children:s.jsxs("div",{className:"ss-auth-modal ss-auth-card-wide",children:[s.jsxs("div",{className:"ss-auth-modal-header",children:[s.jsx("h2",{children:"Upload avatar"}),s.jsx("button",{type:"button",className:"ss-auth-modal-close",onClick:a,children:s.jsx("span",{className:"material-symbols-outlined",children:j.close})})]}),s.jsxs("div",{className:"ss-auth-modal-body",children:[c&&s.jsxs("div",{className:"ss-auth-error",style:{marginBottom:"24px"},children:[s.jsx("span",{className:"material-symbols-outlined",children:j.errorOutline}),s.jsx("span",{children:c})]}),s.jsxs("div",{className:"ss-auth-upload-grid",children:[s.jsx("div",{children:o?s.jsx(Ps,{file:o,onCrop:x,onCancel:()=>n(null)}):s.jsxs("div",{className:"ss-auth-crop-area",style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"8px",width:"100%",aspectRatio:"1"},children:[s.jsx("span",{className:"material-symbols-outlined",style:{fontSize:"48px",opacity:.3},children:j.image}),s.jsx("span",{style:{fontSize:"12px",opacity:.4},children:"No image selected"})]})}),s.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"16px"},children:[s.jsxs("div",{className:`ss-auth-dropzone${u?" ss-auth-dropzone-active":""}`,onDragOver:m=>{m.preventDefault(),i(!0)},onDragLeave:()=>i(!1),onDrop:p,onClick:()=>{var m;return(m=l.current)==null?void 0:m.click()},style:{minHeight:"180px"},children:[s.jsx("div",{className:"ss-auth-dropzone-icon",children:s.jsx("span",{className:"material-symbols-outlined",children:j.cloudUpload})}),s.jsx("span",{className:"ss-auth-dropzone-title",children:"Drag and drop"}),s.jsxs("span",{className:"ss-auth-dropzone-desc",children:["JPG, PNG or WEBP",s.jsx("br",{}),"Max file size 5 MB"]}),s.jsx("button",{type:"button",className:"ss-auth-dropzone-btn",children:"Choose File"}),s.jsx("input",{ref:l,type:"file",accept:"image/*",style:{display:"none"},onChange:m=>{var v;(v=m.target.files)!=null&&v[0]&&g(m.target.files[0])}})]}),s.jsxs("div",{className:"ss-auth-info-box",children:[s.jsx("span",{className:"material-symbols-outlined",children:j.info}),s.jsx("span",{children:"Your profile photo will be visible to all members of your organization."})]})]})]})]}),s.jsxs("div",{className:"ss-auth-modal-footer",children:[s.jsx("button",{type:"button",className:"ss-auth-btn-ghost",onClick:a,children:"Cancel"}),s.jsxs("button",{type:"button",className:"ss-auth-btn-primary ss-auth-btn-sm",onClick:()=>{},disabled:!o||t,style:{width:"auto"},children:[t&&s.jsx("span",{className:"ss-auth-spinner"}),"Save Profile",!t&&s.jsx("span",{className:"material-symbols-outlined",children:j.check})]})]})]})})}function os({onClose:e,afterDeleteAccountUrl:a,defaultTab:t="profile"}){const[o,n]=r.useState(t),u=[{key:"profile",label:"Profile",icon:j.person},{key:"organization",label:"Organization",icon:j.corporateFare},{key:"people",label:"People",icon:j.group},{key:"billing",label:"Billing",icon:j.creditCard}];return s.jsx("div",{className:"ss-auth-modal-overlay",onClick:i=>{i.target===i.currentTarget&&e()},children:s.jsxs("div",{className:"ss-auth-settings-page",children:[s.jsxs("div",{className:"ss-auth-settings-header",children:[s.jsx("h2",{children:"Settings"}),s.jsx("button",{type:"button",className:"ss-auth-modal-close",onClick:e,children:s.jsx("span",{className:"material-symbols-outlined",children:j.close})})]}),s.jsxs("div",{className:"ss-auth-settings-layout",children:[s.jsx("nav",{className:"ss-auth-settings-nav",children:u.map(i=>s.jsxs("button",{type:"button",className:`ss-auth-settings-nav-item${o===i.key?" ss-auth-settings-nav-item-active":""}`,onClick:()=>n(i.key),children:[s.jsx("span",{className:"material-symbols-outlined",children:i.icon}),i.label]},i.key))}),s.jsxs("div",{className:"ss-auth-settings-content",children:[o==="profile"&&s.jsx(Os,{afterDeleteAccountUrl:a}),o==="organization"&&s.jsx(Es,{}),o==="people"&&s.jsx(Is,{}),o==="billing"&&s.jsx(Fs,{})]})]})]})})}function Os({afterDeleteAccountUrl:e}){const{user:a,updateProfile:t,uploadAvatar:o,changePassword:n,isLoading:u,error:i,success:c,setError:d,setSuccess:l}=X(),{signOut:g}=W(),{deleteAccount:p,isLoading:x,error:m,setError:v}=as(),[b,C]=r.useState((a==null?void 0:a.name)??""),[h,w]=r.useState((a==null?void 0:a.avatarUrl)??""),[S,$]=r.useState(!1),[P,O]=r.useState(""),[E,N]=r.useState(""),[f,y]=r.useState(""),[z,D]=r.useState(null),[T,B]=r.useState(!1),[k,F]=r.useState(""),V=r.useCallback(async A=>{A.preventDefault(),d(null),l(null),await t({name:b,avatarUrl:h||void 0})},[b,h,t,d,l]),G=r.useCallback(async A=>{const Y=await o(A);Y&&(w(Y.avatarUrl),$(!1))},[o]),q=r.useCallback(async A=>{if(A.preventDefault(),D(null),d(null),l(null),E!==f){D("Passwords do not match");return}if(E.length<8){D("Password must be at least 8 characters");return}await n(P,E)&&(O(""),N(""),y(""))},[P,E,f,n,d,l]),ms=r.useCallback(async()=>{await p()&&(await g(),e&&(window.location.href=e))},[p,g,e]),fs=(a==null?void 0:a.provider)==="email",bs=k===(a==null?void 0:a.email),ys=((a==null?void 0:a.name)||(a==null?void 0:a.email)||"?").charAt(0).toUpperCase();return s.jsxs(s.Fragment,{children:[s.jsx("h3",{children:"Profile"}),s.jsxs("div",{className:"ss-auth-settings-card",children:[s.jsxs("div",{className:"ss-auth-profile-header",style:{border:"none",background:"none",padding:0,marginBottom:16},children:[s.jsxs("div",{className:"ss-auth-avatar-lg",onClick:()=>$(!0),children:[h?s.jsx("img",{src:h,alt:""}):s.jsx("div",{style:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"48px",fontWeight:800,opacity:.4},children:ys}),s.jsxs("div",{className:"ss-auth-avatar-overlay",children:[s.jsx("span",{className:"material-symbols-outlined",children:j.camera}),s.jsx("span",{children:"Edit"})]})]}),s.jsxs("div",{className:"ss-auth-profile-info",children:[s.jsxs("h2",{className:"ss-auth-profile-name",children:[(a==null?void 0:a.name)||"Unnamed User",(a==null?void 0:a.emailVerified)&&s.jsxs("span",{className:"ss-auth-badge ss-auth-badge-success",children:[s.jsx("span",{className:"material-symbols-outlined",style:{fontSize:"12px",fontVariationSettings:"'FILL' 1"},children:j.verified}),"Verified"]})]}),s.jsx("p",{className:"ss-auth-profile-desc",children:a==null?void 0:a.email})]})]}),i&&s.jsxs("div",{className:"ss-auth-error",children:[s.jsx("span",{className:"material-symbols-outlined",children:j.errorOutline}),s.jsx("span",{children:i})]}),c&&s.jsxs("div",{className:"ss-auth-info-box",style:{marginBottom:"16px"},children:[s.jsx("span",{className:"material-symbols-outlined",children:j.check}),s.jsx("span",{children:c})]}),s.jsxs("form",{onSubmit:V,children:[s.jsxs("div",{className:"ss-auth-field",children:[s.jsx("label",{className:"ss-auth-label",children:"Full Name"}),s.jsx("input",{className:"ss-auth-input",type:"text",placeholder:"Your name",value:b,onChange:A=>C(A.target.value)})]}),s.jsxs("div",{className:"ss-auth-profile-grid",style:{marginBottom:"16px"},children:[s.jsxs("div",{children:[s.jsx("label",{className:"ss-auth-label",children:"Email Address"}),s.jsxs("div",{style:{position:"relative"},children:[s.jsx("input",{className:"ss-auth-input ss-auth-input-readonly",type:"email",value:(a==null?void 0:a.email)??"",readOnly:!0}),s.jsx("span",{className:"ss-auth-visibility-toggle",style:{cursor:"default"},children:s.jsx("span",{className:"material-symbols-outlined",style:{fontSize:"18px"},children:j.lock})})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"ss-auth-label",children:"Auth Provider"}),s.jsx("input",{className:"ss-auth-input ss-auth-input-readonly",type:"text",value:(a==null?void 0:a.provider)??"",readOnly:!0})]})]}),s.jsx("div",{style:{display:"flex",justifyContent:"flex-end"},children:s.jsxs("button",{type:"submit",className:"ss-auth-btn-primary ss-auth-btn-sm",disabled:u,style:{width:"auto"},children:[u&&s.jsx("span",{className:"ss-auth-spinner"}),"Save changes"]})})]})]}),fs&&s.jsxs("div",{className:"ss-auth-settings-card",children:[s.jsxs("h4",{children:[s.jsx("span",{className:"material-symbols-outlined",children:j.security}),"Security Credentials"]}),z&&s.jsxs("div",{className:"ss-auth-error",style:{marginBottom:"16px"},children:[s.jsx("span",{className:"material-symbols-outlined",children:j.errorOutline}),s.jsx("span",{children:z})]}),s.jsxs("form",{onSubmit:q,children:[s.jsxs("div",{className:"ss-auth-field",children:[s.jsx("label",{className:"ss-auth-label",children:"Current Password"}),s.jsx("input",{className:"ss-auth-input",type:"password",placeholder:"••••••••••••",value:P,onChange:A=>O(A.target.value),required:!0})]}),s.jsxs("div",{className:"ss-auth-profile-grid",style:{marginBottom:"16px"},children:[s.jsxs("div",{children:[s.jsx("label",{className:"ss-auth-label",children:"New Password"}),s.jsx("input",{className:"ss-auth-input",type:"password",placeholder:"Min. 8 characters",value:E,onChange:A=>N(A.target.value),required:!0})]}),s.jsxs("div",{children:[s.jsx("label",{className:"ss-auth-label",children:"Confirm New Password"}),s.jsx("input",{className:"ss-auth-input",type:"password",placeholder:"Repeat new password",value:f,onChange:A=>y(A.target.value),required:!0})]})]}),s.jsx("div",{style:{display:"flex",justifyContent:"flex-end"},children:s.jsx("button",{type:"submit",className:"ss-auth-btn-ghost",disabled:u,children:"Update Security"})})]})]}),s.jsxs("div",{className:"ss-auth-settings-card ss-auth-settings-danger",children:[s.jsx("h4",{children:"Danger Zone"}),s.jsx("p",{className:"ss-auth-section-desc",style:{marginBottom:"16px"},children:"Deleting your account is permanent. All organizations you own will also be deleted."}),m&&s.jsxs("div",{className:"ss-auth-error",children:[s.jsx("span",{className:"material-symbols-outlined",children:j.errorOutline}),s.jsx("span",{children:m})]}),T?s.jsxs("div",{children:[s.jsxs("div",{className:"ss-auth-field",children:[s.jsx("label",{className:"ss-auth-label",children:"Type your email to confirm"}),s.jsx("input",{className:"ss-auth-input",type:"email",placeholder:a==null?void 0:a.email,value:k,onChange:A=>F(A.target.value),autoFocus:!0})]}),s.jsxs("div",{style:{display:"flex",gap:"8px",justifyContent:"flex-end"},children:[s.jsx("button",{type:"button",className:"ss-auth-btn-ghost",onClick:()=>{B(!1),F(""),v(null)},children:"Cancel"}),s.jsxs("button",{type:"button",className:"ss-auth-btn-primary ss-auth-btn-sm",style:{width:"auto",background:"linear-gradient(135deg, #ef4444, #dc2626)"},disabled:!bs||x,onClick:ms,children:[x&&s.jsx("span",{className:"ss-auth-spinner"}),"Delete account"]})]})]}):s.jsx("button",{type:"button",className:"ss-auth-btn-outline",style:{borderColor:"currentColor",width:"auto"},onClick:()=>B(!0),children:"Delete my account"})]}),S&&s.jsx(ns,{onUpload:G,onClose:()=>$(!1),isLoading:u})]})}function Es(){const{selectedOrg:e,updateOrg:a,deleteOrg:t,isLoading:o,error:n,setError:u}=H(),[i,c]=r.useState((e==null?void 0:e.name)??""),[d,l]=r.useState(!1),[g,p]=r.useState(!1),[x,m]=r.useState(!1),[v,b]=r.useState("");if(r.useEffect(()=>{e&&c(e.name)},[e]),!e)return s.jsxs(s.Fragment,{children:[s.jsx("h3",{children:"Organization"}),s.jsxs("div",{className:"ss-auth-settings-empty",children:[s.jsx("span",{className:"material-symbols-outlined",children:j.corporateFare}),s.jsx("div",{children:"Select an organization from the user menu to manage its settings."})]})]});const C=async w=>{if(w.preventDefault(),!i.trim())return;l(!0),p(!1);const S=await a(e.id,{name:i.trim()});l(!1),S&&p(!0)},h=async()=>{await t(e.id)&&m(!1)};return s.jsxs(s.Fragment,{children:[s.jsx("h3",{children:"Organization"}),s.jsxs("div",{className:"ss-auth-settings-card",children:[s.jsxs("h4",{children:[s.jsx("span",{className:"material-symbols-outlined",children:j.corporateFare}),"General"]}),n&&s.jsxs("div",{className:"ss-auth-error",style:{marginBottom:"16px"},children:[s.jsx("span",{className:"material-symbols-outlined",children:j.errorOutline}),s.jsx("span",{children:n})]}),g&&s.jsxs("div",{className:"ss-auth-info-box",style:{marginBottom:"16px"},children:[s.jsx("span",{className:"material-symbols-outlined",children:j.check}),s.jsx("span",{children:"Organization updated"})]}),s.jsxs("form",{onSubmit:C,children:[s.jsxs("div",{className:"ss-auth-field",children:[s.jsx("label",{className:"ss-auth-label",children:"Organization Name"}),s.jsx("input",{className:"ss-auth-input",type:"text",value:i,onChange:w=>{c(w.target.value),p(!1)}})]}),s.jsxs("div",{className:"ss-auth-field",children:[s.jsx("label",{className:"ss-auth-label",children:"Slug"}),s.jsx("input",{className:"ss-auth-input ss-auth-input-readonly",type:"text",value:e.slug,readOnly:!0})]}),s.jsx("div",{style:{display:"flex",justifyContent:"flex-end"},children:s.jsxs("button",{type:"submit",className:"ss-auth-btn-primary ss-auth-btn-sm",disabled:d,style:{width:"auto"},children:[d&&s.jsx("span",{className:"ss-auth-spinner"}),"Save"]})})]})]}),s.jsxs("div",{className:"ss-auth-settings-card ss-auth-settings-danger",children:[s.jsx("h4",{children:"Danger Zone"}),s.jsx("p",{className:"ss-auth-section-desc",style:{marginBottom:"16px"},children:"Deleting this organization is permanent and will remove all members."}),x?s.jsxs("div",{children:[s.jsxs("div",{className:"ss-auth-field",children:[s.jsx("label",{className:"ss-auth-label",children:"Type the organization name to confirm"}),s.jsx("input",{className:"ss-auth-input",type:"text",placeholder:e.name,value:v,onChange:w=>b(w.target.value),autoFocus:!0})]}),s.jsxs("div",{style:{display:"flex",gap:"8px",justifyContent:"flex-end"},children:[s.jsx("button",{type:"button",className:"ss-auth-btn-ghost",onClick:()=>{m(!1),b("")},children:"Cancel"}),s.jsxs("button",{type:"button",className:"ss-auth-btn-primary ss-auth-btn-sm",style:{width:"auto",background:"linear-gradient(135deg, #ef4444, #dc2626)"},disabled:v!==e.name||o,onClick:h,children:[o&&s.jsx("span",{className:"ss-auth-spinner"}),"Delete organization"]})]})]}):s.jsx("button",{type:"button",className:"ss-auth-btn-outline",style:{borderColor:"currentColor",width:"auto"},onClick:()=>m(!0),children:"Delete this organization"})]})]})}function Is(){const{selectedOrg:e,members:a,invites:t,isLoading:o,error:n,setError:u,sendInvite:i,refreshInvites:c,revokeInvite:d,updateMemberRole:l,removeMember:g,refreshMembers:p}=H(),[x,m]=r.useState(""),[v,b]=r.useState("member"),[C,h]=r.useState(!1),[w,S]=r.useState(!1),[$,P]=r.useState(null),[O,E]=r.useState(""),[N,f]=r.useState(null);if(r.useEffect(()=>{e&&(p(e.id),c(e.id))},[e,p,c]),!e)return s.jsxs(s.Fragment,{children:[s.jsx("h3",{children:"People"}),s.jsxs("div",{className:"ss-auth-settings-empty",children:[s.jsx("span",{className:"material-symbols-outlined",children:j.group}),s.jsx("div",{children:"Select an organization from the user menu to manage members."})]})]});const y=async k=>{k.preventDefault(),S(!1),await i(e.id,x,v)&&(m(""),b("member"),S(!0),h(!1),c(e.id))},z=async()=>{if(!$)return;await l(e.id,$.userId,O)&&P(null)},D=async()=>{if(!N)return;await g(e.id,N.userId)&&f(null)},T=async k=>{await d(e.id,k)},B=k=>k==="owner"?"ss-auth-role-badge ss-auth-role-badge-owner":k==="admin"?"ss-auth-role-badge ss-auth-role-badge-admin":"ss-auth-role-badge ss-auth-role-badge-member";return s.jsxs(s.Fragment,{children:[s.jsx("h3",{children:"People"}),n&&s.jsxs("div",{className:"ss-auth-error",style:{marginBottom:"16px"},children:[s.jsx("span",{className:"material-symbols-outlined",children:j.errorOutline}),s.jsx("span",{children:n})]}),w&&s.jsxs("div",{className:"ss-auth-info-box",style:{marginBottom:"16px"},children:[s.jsx("span",{className:"material-symbols-outlined",children:j.check}),s.jsx("span",{children:"Invitation sent"})]}),s.jsxs("div",{className:"ss-auth-settings-card",children:[s.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"16px"},children:[s.jsxs("h4",{style:{margin:0},children:[s.jsx("span",{className:"material-symbols-outlined",children:j.group}),"Members"]}),s.jsxs("button",{type:"button",className:"ss-auth-btn-primary ss-auth-btn-sm",style:{width:"auto"},onClick:()=>h(!C),children:[s.jsx("span",{className:"material-symbols-outlined",style:{fontSize:"16px"},children:j.add}),"Invite"]})]}),C&&s.jsx("form",{onSubmit:y,style:{marginBottom:"16px",padding:"16px",background:"rgba(0,0,0,0.05)",borderRadius:"8px"},children:s.jsxs("div",{style:{display:"flex",gap:"8px",alignItems:"flex-end"},children:[s.jsxs("div",{style:{flex:1},children:[s.jsx("label",{className:"ss-auth-label",children:"Email"}),s.jsx("input",{className:"ss-auth-input",type:"email",placeholder:"member@example.com",value:x,onChange:k=>m(k.target.value),required:!0})]}),s.jsxs("div",{style:{width:"120px"},children:[s.jsx("label",{className:"ss-auth-label",children:"Role"}),s.jsxs("select",{className:"ss-auth-input",value:v,onChange:k=>b(k.target.value),style:{cursor:"pointer"},children:[s.jsx("option",{value:"admin",children:"Admin"}),s.jsx("option",{value:"member",children:"Member"})]})]}),s.jsx("button",{type:"submit",className:"ss-auth-btn-primary ss-auth-btn-sm",disabled:o,style:{width:"auto",marginBottom:"0"},children:"Send"})]})}),a.length===0?s.jsx("div",{className:"ss-auth-settings-empty",style:{padding:"20px"},children:s.jsx("div",{children:"No members yet."})}):s.jsxs("table",{className:"ss-auth-settings-table",children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{children:"Email"}),s.jsx("th",{children:"Role"}),s.jsx("th",{style:{width:"80px"},children:"Actions"})]})}),s.jsx("tbody",{children:a.map(k=>s.jsxs("tr",{children:[s.jsx("td",{children:k.email}),s.jsx("td",{children:s.jsx("span",{className:B(k.role),children:k.role})}),s.jsx("td",{children:k.role==="owner"?s.jsx("span",{style:{fontSize:"12px",opacity:.4},children:"—"}):s.jsxs("div",{className:"ss-auth-settings-actions",children:[s.jsx("button",{type:"button",className:"ss-auth-icon-btn",title:"Edit role",onClick:()=>{P(k),E(k.role)},children:s.jsx("span",{className:"material-symbols-outlined",children:j.edit})}),s.jsx("button",{type:"button",className:"ss-auth-icon-btn ss-auth-icon-btn-danger",title:"Remove member",onClick:()=>f(k),children:s.jsx("span",{className:"material-symbols-outlined",children:j.personRemove})})]})})]},k.userId))})]})]}),t.length>0&&s.jsxs("div",{className:"ss-auth-settings-card",children:[s.jsxs("h4",{children:[s.jsx("span",{className:"material-symbols-outlined",children:j.send}),"Pending Invites"]}),s.jsxs("table",{className:"ss-auth-settings-table",children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{children:"Email"}),s.jsx("th",{children:"Role"}),s.jsx("th",{style:{width:"80px"},children:"Actions"})]})}),s.jsx("tbody",{children:t.map(k=>s.jsxs("tr",{children:[s.jsx("td",{children:k.email}),s.jsx("td",{children:s.jsx("span",{className:B(k.role),children:k.role})}),s.jsx("td",{children:s.jsx("button",{type:"button",className:"ss-auth-icon-btn ss-auth-icon-btn-danger",title:"Revoke invite",onClick:()=>T(k.id),children:s.jsx("span",{className:"material-symbols-outlined",children:j.close})})})]},k.id))})]})]}),$&&s.jsx("div",{className:"ss-auth-modal-overlay",onClick:k=>{k.target===k.currentTarget&&P(null)},children:s.jsxs("div",{className:"ss-auth-modal",style:{maxWidth:"400px"},children:[s.jsxs("div",{className:"ss-auth-modal-header",children:[s.jsx("h2",{children:"Edit Role"}),s.jsx("button",{type:"button",className:"ss-auth-modal-close",onClick:()=>P(null),children:s.jsx("span",{className:"material-symbols-outlined",children:j.close})})]}),s.jsxs("div",{className:"ss-auth-modal-body",children:[s.jsxs("p",{style:{fontSize:"14px",marginBottom:"16px",margin:"0 0 16px 0"},children:["Change role for ",s.jsx("strong",{children:$.email})]}),s.jsxs("div",{className:"ss-auth-field",children:[s.jsx("label",{className:"ss-auth-label",children:"Role"}),s.jsxs("select",{className:"ss-auth-input",value:O,onChange:k=>E(k.target.value),style:{cursor:"pointer"},children:[s.jsx("option",{value:"admin",children:"Admin"}),s.jsx("option",{value:"member",children:"Member"})]})]}),s.jsxs("div",{style:{display:"flex",gap:"8px",justifyContent:"flex-end"},children:[s.jsx("button",{type:"button",className:"ss-auth-btn-ghost",onClick:()=>P(null),children:"Cancel"}),s.jsx("button",{type:"button",className:"ss-auth-btn-primary ss-auth-btn-sm",style:{width:"auto"},onClick:z,children:"Save"})]})]})]})}),N&&s.jsx("div",{className:"ss-auth-modal-overlay",onClick:k=>{k.target===k.currentTarget&&f(null)},children:s.jsxs("div",{className:"ss-auth-modal",style:{maxWidth:"400px"},children:[s.jsxs("div",{className:"ss-auth-modal-header",children:[s.jsx("h2",{children:"Remove Member"}),s.jsx("button",{type:"button",className:"ss-auth-modal-close",onClick:()=>f(null),children:s.jsx("span",{className:"material-symbols-outlined",children:j.close})})]}),s.jsxs("div",{className:"ss-auth-modal-body",children:[s.jsxs("p",{style:{fontSize:"14px",margin:"0 0 16px 0"},children:["Are you sure you want to remove ",s.jsx("strong",{children:N.email})," from the organization?"]}),s.jsxs("div",{style:{display:"flex",gap:"8px",justifyContent:"flex-end"},children:[s.jsx("button",{type:"button",className:"ss-auth-btn-ghost",onClick:()=>f(null),children:"Cancel"}),s.jsx("button",{type:"button",className:"ss-auth-btn-primary ss-auth-btn-sm",style:{width:"auto",background:"linear-gradient(135deg, #ef4444, #dc2626)"},onClick:D,children:"Remove"})]})]})]})})]})}function Fs(){const{selectedOrg:e}=H();return e?s.jsxs(s.Fragment,{children:[s.jsx("h3",{children:"Billing"}),s.jsxs("div",{className:"ss-auth-settings-card",children:[s.jsxs("h4",{children:[s.jsx("span",{className:"material-symbols-outlined",children:j.creditCard}),"Plan & Billing"]}),s.jsx("div",{className:"ss-auth-settings-empty",style:{padding:"20px"},children:s.jsx("div",{children:"No billing plan configured for this organization."})})]})]}):s.jsxs(s.Fragment,{children:[s.jsx("h3",{children:"Billing"}),s.jsxs("div",{className:"ss-auth-settings-empty",children:[s.jsx("span",{className:"material-symbols-outlined",children:j.creditCard}),s.jsx("div",{children:"Select an organization from the user menu to manage billing."})]})]})}function Bs({appearance:e,afterSignOutUrl:a,afterDeleteAccountUrl:t,showOrgSwitcher:o=!0,onOrgChange:n,onOrgSettingsClick:u}){const{appearance:i}=I(),{user:c,signOut:d}=W(),l=e??i,[g,p]=r.useState(!1),[x,m]=r.useState(!1),[v,b]=r.useState(""),[C,h]=r.useState(null),[w,S]=r.useState(!1),$=r.useRef(null),{orgs:P,selectedOrg:O,selectOrg:E,createOrg:N}=H(),f=r.useCallback(z=>{$.current&&!z.composedPath().includes($.current)&&p(!1)},[]);r.useEffect(()=>{if(g){const z=setTimeout(()=>{document.addEventListener("click",f)},0);return()=>{clearTimeout(z),document.removeEventListener("click",f)}}},[g,f]);const y=r.useCallback(async z=>{z.preventDefault(),h(null),S(!0);const D=v.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"");try{const T=await N(v,D);T&&(await E(T.id),n==null||n(T),b(""),p(!1))}catch(T){h(T instanceof Error?T.message:"Failed to create organization")}finally{S(!1)}},[v,N,E,n]);return c?s.jsx(M,{appearance:l,children:s.jsxs("div",{style:{position:"relative",display:"inline-block"},ref:$,children:[s.jsxs("button",{type:"button",className:"ss-auth-user-trigger",onClick:()=>p(!g),"aria-label":"User menu",children:[s.jsx("span",{className:"ss-auth-avatar-trigger",children:c.avatarUrl?s.jsx("img",{src:c.avatarUrl,alt:""}):s.jsx("div",{style:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"16px",fontWeight:700},children:(c.name||c.email).charAt(0).toUpperCase()})}),O&&s.jsx("span",{className:"ss-auth-trigger-org-name",children:O.name})]}),g&&s.jsxs("div",{className:"ss-auth-dropdown ss-auth-glass-panel",style:{minWidth:"320px"},children:[s.jsxs("div",{className:"ss-auth-dropdown-header",children:[s.jsx("div",{className:"ss-auth-dropdown-avatar",children:c.avatarUrl?s.jsx("img",{src:c.avatarUrl,alt:""}):s.jsx("div",{style:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"20px",fontWeight:800},children:(c.name||c.email).charAt(0).toUpperCase()})}),s.jsxs("div",{children:[c.name&&s.jsx("div",{className:"ss-auth-dropdown-name",children:c.name}),s.jsx("div",{className:"ss-auth-dropdown-email",children:c.email})]})]}),s.jsx("div",{style:{padding:"4px 8px"},children:s.jsxs("button",{type:"button",className:"ss-auth-dropdown-action",onClick:()=>{p(!1),m(!0)},children:[s.jsx("span",{className:"material-symbols-outlined",children:j.settings}),"Settings"]})}),o&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"ss-auth-section-label",children:"Organizations"}),s.jsx("div",{style:{padding:"0 8px 4px"},children:P.map(z=>{const D=(O==null?void 0:O.id)===z.id,T=z.name.split(" ").map(B=>B[0]).join("").slice(0,2).toUpperCase();return s.jsxs("button",{type:"button",className:`ss-auth-org-item${D?" ss-auth-org-item-active":""}`,onClick:async()=>{p(!1),await E(z.id),n==null||n(z)},children:[s.jsxs("div",{className:"ss-auth-org-item-inner",children:[s.jsx("div",{className:`ss-auth-org-avatar${D?"":" ss-auth-org-avatar-inactive"}`,children:T}),s.jsx("span",{style:{fontFamily:"'Manrope', sans-serif",letterSpacing:"-0.01em"},children:z.name}),z.planName&&s.jsx("span",{className:"ss-auth-plan-badge",children:z.planName})]}),D&&s.jsx("span",{className:"material-symbols-outlined ss-auth-org-check",style:{fontSize:"18px"},children:j.checkCircle})]},z.id)})}),s.jsxs("div",{className:"ss-auth-inline-create",children:[C&&s.jsx("div",{className:"ss-auth-error",style:{marginBottom:"8px",fontSize:"12px"},children:s.jsx("span",{children:C})}),s.jsx("form",{onSubmit:y,children:s.jsxs("div",{className:"ss-auth-inline-create-input",children:[s.jsx("input",{className:"ss-auth-input",type:"text",placeholder:"New organization name",value:v,onChange:z=>b(z.target.value),required:!0,style:{fontSize:"13px",padding:"10px 40px 10px 12px"}}),s.jsx("button",{type:"submit",className:"ss-auth-inline-create-btn",disabled:w||!v.trim(),children:s.jsx("span",{className:"material-symbols-outlined",style:{fontSize:"20px"},children:j.add})})]})})]}),O&&u&&s.jsx("div",{style:{padding:"0 8px 4px"},children:s.jsxs("button",{type:"button",className:"ss-auth-dropdown-action",onClick:()=>{p(!1),u(O)},children:[s.jsx("span",{className:"material-symbols-outlined",children:j.corporateFare}),"Org settings"]})})]}),s.jsx("div",{className:"ss-auth-signout-section",style:{padding:"8px"},children:s.jsxs("button",{type:"button",className:"ss-auth-dropdown-action",onClick:async()=>{p(!1),await d(),a&&(window.location.href=a)},style:{color:"inherit"},children:[s.jsx("span",{className:"material-symbols-outlined",style:{color:"inherit"},children:j.logout}),"Sign out"]})})]}),x&&s.jsx(os,{onClose:()=>m(!1),afterDeleteAccountUrl:t})]})}):null}function Ls({appearance:e}){const{appearance:a}=I(),{user:t,signOut:o}=W(),{updateProfile:n,uploadAvatar:u,changePassword:i,isLoading:c,error:d,success:l,setError:g,setSuccess:p}=X(),x=e??a,[m,v]=r.useState((t==null?void 0:t.name)??""),[b,C]=r.useState((t==null?void 0:t.avatarUrl)??""),[h,w]=r.useState(!1),[S,$]=r.useState(""),[P,O]=r.useState(""),[E,N]=r.useState(""),[f,y]=r.useState(null),z=r.useCallback(async F=>{F.preventDefault(),g(null),p(null),await n({name:m,avatarUrl:b||void 0})},[m,b,n,g,p]),D=r.useCallback(async F=>{const V=await u(F);V&&(C(V.avatarUrl),w(!1))},[u]),T=r.useCallback(async F=>{if(F.preventDefault(),y(null),g(null),p(null),P!==E){y("Passwords do not match");return}if(P.length<8){y("Password must be at least 8 characters");return}await i(S,P)&&($(""),O(""),N(""))},[S,P,E,i,g,p]);if(!t)return null;const B=t.provider==="email",k=(t.name||t.email).charAt(0).toUpperCase();return s.jsx(M,{appearance:x,children:s.jsxs("div",{className:"ss-auth-card",style:{maxWidth:"640px"},children:[s.jsxs("div",{className:"ss-auth-profile-header",children:[s.jsxs("div",{className:"ss-auth-avatar-lg",onClick:()=>w(!0),children:[b?s.jsx("img",{src:b,alt:""}):s.jsx("div",{style:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"48px",fontWeight:800,opacity:.4},children:k}),s.jsxs("div",{className:"ss-auth-avatar-overlay",children:[s.jsx("span",{className:"material-symbols-outlined",children:j.camera}),s.jsx("span",{children:"Edit"})]})]}),s.jsxs("div",{className:"ss-auth-profile-info",children:[s.jsxs("h2",{className:"ss-auth-profile-name",children:[t.name||"Unnamed User",t.emailVerified&&s.jsxs("span",{className:"ss-auth-badge ss-auth-badge-success",children:[s.jsx("span",{className:"material-symbols-outlined",style:{fontSize:"12px",fontVariationSettings:"'FILL' 1"},children:j.verified}),"Verified"]})]}),s.jsx("p",{className:"ss-auth-profile-desc",children:t.email})]})]}),s.jsxs("div",{className:"ss-auth-card-body",children:[d&&s.jsxs("div",{className:"ss-auth-error",children:[s.jsx("span",{className:"material-symbols-outlined",children:j.errorOutline}),s.jsx("span",{children:d})]}),l&&s.jsxs("div",{className:"ss-auth-info-box",style:{marginBottom:"16px"},children:[s.jsx("span",{className:"material-symbols-outlined",children:j.check}),s.jsx("span",{children:l})]}),s.jsxs("form",{onSubmit:z,children:[s.jsxs("div",{className:"ss-auth-field",children:[s.jsx("label",{className:"ss-auth-label",children:"Full Name"}),s.jsx("input",{className:"ss-auth-input",type:"text",placeholder:"Your name",value:m,onChange:F=>v(F.target.value)})]}),s.jsxs("div",{className:"ss-auth-profile-grid",style:{marginBottom:"16px"},children:[s.jsxs("div",{children:[s.jsx("label",{className:"ss-auth-label",children:"Email Address"}),s.jsxs("div",{style:{position:"relative"},children:[s.jsx("input",{className:"ss-auth-input ss-auth-input-readonly",type:"email",value:t.email,readOnly:!0}),s.jsx("span",{className:"ss-auth-visibility-toggle",style:{cursor:"default"},children:s.jsx("span",{className:"material-symbols-outlined",style:{fontSize:"18px"},children:j.lock})})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"ss-auth-label",children:"Auth Provider"}),s.jsxs("div",{style:{position:"relative"},children:[s.jsx("input",{className:"ss-auth-input ss-auth-input-readonly",type:"text",value:t.provider,readOnly:!0}),s.jsx("span",{className:"ss-auth-visibility-toggle",style:{cursor:"default"},children:s.jsx("span",{className:"material-symbols-outlined",style:{fontSize:"18px"},children:j.cloudDone})})]})]})]}),s.jsx("div",{style:{display:"flex",justifyContent:"flex-end"},children:s.jsxs("button",{type:"submit",className:"ss-auth-btn-primary ss-auth-btn-sm",disabled:c,style:{width:"auto"},children:[c&&s.jsx("span",{className:"ss-auth-spinner"}),"Save changes"]})})]}),B&&s.jsxs("div",{className:"ss-auth-section",children:[s.jsxs("div",{className:"ss-auth-section-title",children:[s.jsx("span",{className:"material-symbols-outlined",children:j.security}),"Security Credentials"]}),s.jsx("p",{className:"ss-auth-section-desc",style:{marginBottom:"24px"},children:"Update your password to keep your account secure."}),f&&s.jsxs("div",{className:"ss-auth-error",children:[s.jsx("span",{className:"material-symbols-outlined",children:j.errorOutline}),s.jsx("span",{children:f})]}),s.jsxs("form",{onSubmit:T,children:[s.jsxs("div",{className:"ss-auth-field",children:[s.jsx("label",{className:"ss-auth-label",children:"Current Password"}),s.jsx("input",{className:"ss-auth-input",type:"password",placeholder:"••••••••••••",value:S,onChange:F=>$(F.target.value),required:!0})]}),s.jsxs("div",{className:"ss-auth-profile-grid",style:{marginBottom:"16px"},children:[s.jsxs("div",{children:[s.jsx("label",{className:"ss-auth-label",children:"New Password"}),s.jsx("input",{className:"ss-auth-input",type:"password",placeholder:"Min. 8 characters",value:P,onChange:F=>O(F.target.value),required:!0})]}),s.jsxs("div",{children:[s.jsx("label",{className:"ss-auth-label",children:"Confirm New Password"}),s.jsx("input",{className:"ss-auth-input",type:"password",placeholder:"Repeat new password",value:E,onChange:F=>N(F.target.value),required:!0})]})]}),s.jsxs("div",{className:"ss-auth-info-box",style:{marginBottom:"16px"},children:[s.jsx("span",{className:"material-symbols-outlined",children:j.info}),s.jsx("span",{children:"Password must be at least 8 characters long."})]}),s.jsx("div",{style:{display:"flex",justifyContent:"flex-end"},children:s.jsx("button",{type:"submit",className:"ss-auth-btn-ghost",disabled:c,children:"Update Security"})})]})]}),s.jsx("div",{className:"ss-auth-section",style:{borderTop:"none",paddingTop:0,marginTop:"24px"},children:s.jsx("div",{className:"ss-auth-signout-section",style:{borderRadius:"12px",padding:"16px 20px"},children:s.jsxs("div",{className:"ss-auth-signout-row",children:[s.jsxs("div",{className:"ss-auth-signout-info",children:[s.jsx("div",{className:"ss-auth-signout-icon",children:s.jsx("span",{className:"material-symbols-outlined",children:j.logout})}),s.jsxs("div",{children:[s.jsx("div",{className:"ss-auth-signout-title",children:"End Session"}),s.jsx("div",{className:"ss-auth-signout-desc",children:"Terminate your active session"})]})]}),s.jsx("button",{type:"button",className:"ss-auth-btn-outline",onClick:()=>o(),style:{width:"auto",flexShrink:0},children:"Sign out"})]})})})]}),h&&s.jsx(ns,{onUpload:D,onClose:()=>w(!1),isLoading:c})]})})}function Ds({appearance:e,onOrgChange:a}){const{appearance:t}=I(),{orgs:o,selectedOrg:n,selectOrg:u,createOrg:i,isLoading:c}=H(),d=e??t,[l,g]=r.useState(!1),[p,x]=r.useState(""),[m,v]=r.useState(""),[b,C]=r.useState(null),[h,w]=r.useState(!1),S=r.useRef(null),$=r.useCallback(f=>{S.current&&!f.composedPath().includes(S.current)&&g(!1)},[]);r.useEffect(()=>{if(l){const f=setTimeout(()=>{document.addEventListener("click",$)},0);return()=>{clearTimeout(f),document.removeEventListener("click",$)}}},[l,$]);const P=r.useCallback(f=>{x(f),v(f.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,""))},[]),O=r.useCallback(async f=>{f.preventDefault(),C(null),w(!0);try{const y=await i(p,m);y&&(await u(y.id),a==null||a(y),x(""),v(""),g(!1))}catch(y){C(y instanceof Error?y.message:"Failed to create organization")}finally{w(!1)}},[p,m,i,u,a]);if(c)return null;const E=(n==null?void 0:n.name)??(o.length===0?"No organization":"Select organization"),N=n?n.name.split(" ").map(f=>f[0]).join("").slice(0,2).toUpperCase():"--";return s.jsx(M,{appearance:d,children:s.jsxs("div",{style:{position:"relative",display:"inline-block",width:"100%",maxWidth:"360px"},ref:S,children:[s.jsxs("button",{type:"button",className:"ss-auth-org-trigger",onClick:()=>g(!l),children:[s.jsxs("div",{className:"ss-auth-org-trigger-inner",children:[s.jsx("div",{className:"ss-auth-org-avatar",children:N}),s.jsxs("div",{style:{textAlign:"left"},children:[s.jsx("div",{className:"ss-auth-org-trigger-label",children:"Current Organization"}),s.jsx("div",{className:"ss-auth-org-trigger-name",children:E})]})]}),s.jsx("span",{className:"material-symbols-outlined",children:j.unfoldMore})]}),l&&s.jsxs("div",{className:"ss-auth-dropdown ss-auth-dropdown-left ss-auth-glass-panel",style:{width:"100%"},children:[s.jsx("div",{className:"ss-auth-section-label",children:"Your Organizations"}),s.jsx("div",{style:{padding:"0 8px 4px"},children:o.map(f=>{const y=(n==null?void 0:n.id)===f.id,z=f.name.split(" ").map(D=>D[0]).join("").slice(0,2).toUpperCase();return s.jsxs("button",{type:"button",className:`ss-auth-org-item${y?" ss-auth-org-item-active":""}`,onClick:async()=>{g(!1),await u(f.id),a==null||a(f)},children:[s.jsxs("div",{className:"ss-auth-org-item-inner",children:[s.jsx("div",{className:`ss-auth-org-avatar${y?"":" ss-auth-org-avatar-inactive"}`,children:z}),s.jsx("span",{style:{fontFamily:"'Manrope', sans-serif",letterSpacing:"-0.01em"},children:f.name})]}),y&&s.jsx("span",{className:"material-symbols-outlined ss-auth-org-check",style:{fontSize:"18px"},children:j.checkCircle})]},f.id)})}),s.jsxs("div",{className:"ss-auth-org-create",children:[s.jsxs("div",{className:"ss-auth-org-create-header",children:[s.jsx("span",{className:"material-symbols-outlined",children:j.addCircle}),s.jsx("span",{children:"Create organization"})]}),b&&s.jsx("div",{className:"ss-auth-error",style:{marginBottom:"12px",fontSize:"12px"},children:s.jsx("span",{children:b})}),s.jsxs("form",{onSubmit:O,children:[s.jsxs("div",{className:"ss-auth-field",children:[s.jsx("label",{className:"ss-auth-label",style:{fontSize:"10px"},children:"Org Name"}),s.jsx("input",{className:"ss-auth-input",type:"text",placeholder:"e.g. Nexus Dynamics",value:p,onChange:f=>P(f.target.value),required:!0,style:{fontSize:"13px",padding:"10px 12px"}})]}),s.jsxs("div",{className:"ss-auth-field",children:[s.jsx("label",{className:"ss-auth-label",style:{fontSize:"10px"},children:"Workspace Slug"}),s.jsxs("div",{style:{position:"relative"},children:[s.jsx("span",{className:"ss-auth-org-slug-prefix",children:"/"}),s.jsx("input",{className:"ss-auth-input",type:"text",placeholder:"nexus-dynamics",value:m,onChange:f=>v(f.target.value),required:!0,style:{fontSize:"13px",padding:"10px 12px 10px 22px"}})]})]}),s.jsxs("button",{type:"submit",className:"ss-auth-btn-primary",disabled:h||!p.trim(),style:{marginTop:"8px"},children:[h&&s.jsx("span",{className:"ss-auth-spinner"}),"Initialize Organization"]})]})]})]})]})})}function Ts(e,a="USD"){return new Intl.NumberFormat("en-US",{style:"currency",currency:a,minimumFractionDigits:e%100===0?0:2}).format(e/100)}function As({plans:e,currentPlanId:a,onSelectPlan:t,interval:o,appearance:n}){const{appearance:u}=I(),i=n??u,c=o?e.filter(d=>d.interval===o||d.isFree):e;return s.jsx(M,{appearance:i,children:s.jsx("div",{className:"ss-pricing-grid",children:c.map(d=>{const l=d.id===a;return s.jsxs("div",{className:`ss-pricing-card ${l?"ss-pricing-card-current":""}`,children:[s.jsxs("div",{className:"ss-pricing-header",children:[s.jsx("h3",{className:"ss-pricing-name",children:d.name}),d.trialDays>0&&s.jsxs("span",{className:"ss-badge ss-badge-trialing",children:[d.trialDays,"-day trial"]}),d.isFree&&s.jsx("span",{className:"ss-badge ss-badge-active",children:"Free"})]}),s.jsx("div",{className:"ss-pricing-price",children:d.isFree?s.jsx("span",{className:"ss-pricing-amount",children:"Free"}):s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"ss-pricing-amount",children:Ts(d.amountCents,d.currency)}),s.jsxs("span",{className:"ss-pricing-interval",children:["/",d.interval]})]})}),d.description&&s.jsx("p",{className:"ss-pricing-desc",children:d.description}),d.features.length>0&&s.jsx("ul",{className:"ss-pricing-features",children:d.features.map((g,p)=>s.jsxs("li",{className:"ss-pricing-feature",children:[s.jsx("span",{className:"ss-check",children:"✓"})," ",g]},p))}),s.jsx("button",{type:"button",className:`ss-btn ${l?"ss-btn-current":"ss-btn-primary"}`,disabled:l,onClick:()=>t(d.id),children:l?"Current plan":"Select plan"})]},d.id)})})})}function Ms(){const{client:e}=I();return{billing:e.billing}}function _(e){const{client:a}=I();return r.useMemo(()=>{if(e){const t=new U.Transport("https://api.saas-support.com/v1",{type:"portalToken",token:e});return new U.BillingClient(t)}return a.billing},[a,e])}function is(e,a){const t=_(a),[o,n]=r.useState(null),[u,i]=r.useState(!0),[c,d]=r.useState(null),l=r.useCallback(async()=>{i(!0),d(null);try{const g=await t.getCustomer(e);n(g)}catch(g){d(g instanceof Error?g.message:"Failed to load subscription")}finally{i(!1)}},[t,e]);return r.useEffect(()=>{l()},[l]),{customer:o,isLoading:u,error:c,refresh:l}}function ls(e,a){const t=_(a),[o,n]=r.useState([]),[u,i]=r.useState(!0),[c,d]=r.useState(null),l=r.useCallback(async()=>{i(!0),d(null);try{const g=await t.getInvoices(e);n(g)}catch(g){d(g instanceof Error?g.message:"Failed to load invoices")}finally{i(!1)}},[t,e]);return r.useEffect(()=>{l()},[l]),{invoices:o,isLoading:u,error:c,refresh:l}}function cs(e,a){const t=_(a),[o,n]=r.useState([]),[u,i]=r.useState(!0),[c,d]=r.useState(null),l=r.useCallback(async()=>{i(!0),d(null);try{const g=await t.getCurrentUsage(e);n(g)}catch(g){d(g instanceof Error?g.message:"Failed to load usage")}finally{i(!1)}},[t,e]);return r.useEffect(()=>{l()},[l]),{usage:o,isLoading:u,error:c,refresh:l}}const Us={active:"ss-badge-active"};function ds({customerId:e,portalToken:a,onChangePlan:t,onCancel:o,appearance:n}){const{appearance:u}=I(),{customer:i,isLoading:c,error:d}=is(e,a),l=n??u;return s.jsx(M,{appearance:l,children:s.jsxs("div",{className:"ss-card",children:[s.jsx("h2",{className:"ss-title",children:"Subscription"}),c&&s.jsxs("div",{className:"ss-loading",children:[s.jsx("span",{className:"ss-spinner"})," Loading..."]}),d&&s.jsx("div",{className:"ss-global-error",children:d}),i&&!c&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"ss-field",children:[s.jsx("label",{className:"ss-label",children:"Customer"}),s.jsx("input",{className:"ss-input",value:i.name||i.email,disabled:!0,readOnly:!0})]}),s.jsxs("div",{className:"ss-field",children:[s.jsx("label",{className:"ss-label",children:"Status"}),s.jsx("div",{children:s.jsx("span",{className:`ss-badge ${Us.active}`,children:"Active"})})]}),s.jsxs("div",{className:"ss-btn-group",children:[t&&s.jsx("button",{type:"button",className:"ss-btn ss-btn-primary",onClick:t,children:"Change plan"}),o&&s.jsx("button",{type:"button",className:"ss-btn ss-btn-danger",onClick:o,children:"Cancel subscription"})]})]})]})})}const Rs={paid:"ss-badge-active",open:"ss-badge-trialing",draft:"ss-badge-paused",void:"ss-badge-canceled",uncollectible:"ss-badge-past-due"};function Vs(e){return new Date(e).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"})}function Hs(e){return new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:2}).format(e/100)}function us({customerId:e,portalToken:a,appearance:t}){const{appearance:o}=I(),{invoices:n,isLoading:u,error:i}=ls(e,a),c=t??o,d=[...n].sort((l,g)=>new Date(g.createdAt).getTime()-new Date(l.createdAt).getTime());return s.jsx(M,{appearance:c,children:s.jsxs("div",{className:"ss-card ss-card-wide",children:[s.jsx("h2",{className:"ss-title",children:"Invoices"}),u&&s.jsxs("div",{className:"ss-loading",children:[s.jsx("span",{className:"ss-spinner"})," Loading..."]}),i&&s.jsx("div",{className:"ss-global-error",children:i}),!u&&d.length===0&&s.jsx("p",{className:"ss-empty",children:"No invoices yet."}),!u&&d.length>0&&s.jsxs("table",{className:"ss-table",children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{className:"ss-th",children:"Date"}),s.jsx("th",{className:"ss-th",children:"Amount"}),s.jsx("th",{className:"ss-th",children:"Status"}),s.jsx("th",{className:"ss-th",children:"PDF"})]})}),s.jsx("tbody",{children:d.map(l=>s.jsxs("tr",{className:"ss-tr",children:[s.jsx("td",{className:"ss-td",children:Vs(l.createdAt)}),s.jsx("td",{className:"ss-td",children:Hs(l.amountCents)}),s.jsx("td",{className:"ss-td",children:s.jsx("span",{className:`ss-badge ${Rs[l.status]||""}`,children:l.status})}),s.jsx("td",{className:"ss-td",children:l.pdfUrl?s.jsx("a",{className:"ss-link",href:l.pdfUrl,target:"_blank",rel:"noopener noreferrer",children:"Download"}):"—"})]},l.id))})]})]})})}function ps({customerId:e,limits:a,portalToken:t,appearance:o}){const{appearance:n}=I(),{usage:u,isLoading:i,error:c}=cs(e,t),d=o??n;return s.jsx(M,{appearance:d,children:s.jsxs("div",{className:"ss-card",children:[s.jsx("h2",{className:"ss-title",children:"Usage"}),i&&s.jsxs("div",{className:"ss-loading",children:[s.jsx("span",{className:"ss-spinner"})," Loading..."]}),c&&s.jsx("div",{className:"ss-global-error",children:c}),!i&&u.length===0&&s.jsx("p",{className:"ss-empty",children:"No usage data."}),!i&&u.map(l=>{const g=a==null?void 0:a[l.metric],p=g?Math.min(100,l.total/g*100):null;return s.jsxs("div",{className:"ss-usage-item",children:[s.jsxs("div",{className:"ss-usage-header",children:[s.jsx("span",{className:"ss-usage-metric",children:l.metric}),s.jsxs("span",{className:"ss-usage-value",children:[l.total.toLocaleString(),g?` / ${g.toLocaleString()}`:""]})]}),p!==null&&s.jsx("div",{className:"ss-progress-bar",children:s.jsx("div",{className:`ss-progress-fill ${p>90?"ss-progress-danger":""}`,style:{width:`${p}%`}})})]},l.metric)})]})})}function qs({customerId:e,portalToken:a,limits:t,onChangePlan:o,onCancel:n,appearance:u}){const{appearance:i}=I(),c=u??i,[d,l]=r.useState("subscription"),g=[{id:"subscription",label:"Subscription"},{id:"invoices",label:"Invoices"},{id:"usage",label:"Usage"}];return s.jsx(M,{appearance:c,children:s.jsxs("div",{className:"ss-card ss-card-wide",children:[s.jsx("h2",{className:"ss-title",children:"Billing"}),s.jsx("div",{className:"ss-tab-group",children:g.map(p=>s.jsx("button",{type:"button",className:`ss-tab ${d===p.id?"ss-tab-active":""}`,onClick:()=>l(p.id),children:p.label},p.id))}),s.jsxs("div",{className:"ss-tab-content",children:[d==="subscription"&&s.jsx(ds,{customerId:e,portalToken:a,onChangePlan:o,onCancel:n}),d==="invoices"&&s.jsx(us,{customerId:e,portalToken:a}),d==="usage"&&s.jsx(ps,{customerId:e,portalToken:a,limits:t})]})]})})}function Ws({customerId:e,portalToken:a,onApplied:t,appearance:o}){const{appearance:n}=I(),u=_(a),i=o??n,[c,d]=r.useState(""),[l,g]=r.useState(!1),[p,x]=r.useState(null),[m,v]=r.useState(null),b=r.useCallback(async C=>{if(C.preventDefault(),!!c.trim()){g(!0),x(null),v(null);try{const h=await u.applyCoupon(e,c.trim());v(`Coupon applied! ${h.discountType==="percent"?`${h.amount}% off`:`$${(h.amount/100).toFixed(2)} off`}`),d(""),t==null||t(h)}catch(h){x(h instanceof Error?h.message:"Invalid coupon code")}finally{g(!1)}}},[u,e,c,t]);return s.jsx(M,{appearance:i,children:s.jsxs("div",{className:"ss-card",children:[s.jsx("h2",{className:"ss-title",children:"Apply coupon"}),p&&s.jsx("div",{className:"ss-global-error",children:p}),m&&s.jsx("div",{className:"ss-success-msg",children:m}),s.jsxs("form",{onSubmit:b,children:[s.jsxs("div",{className:"ss-field",children:[s.jsx("label",{className:"ss-label",htmlFor:"ss-coupon-code",children:"Coupon code"}),s.jsx("input",{id:"ss-coupon-code",className:"ss-input",type:"text",placeholder:"Enter coupon code",value:c,onChange:C=>d(C.target.value),required:!0})]}),s.jsxs("button",{type:"submit",className:"ss-btn ss-btn-primary",disabled:l||!c.trim(),children:[l&&s.jsx("span",{className:"ss-spinner"}),"Apply"]})]})]})})}function _s(){const{client:e}=I();return{report:e.report}}function ss(){const{client:e}=I(),[a,t]=r.useState(null),[o,n]=r.useState(!1),[u,i]=r.useState(null),c=r.useCallback(async d=>{n(!0),i(null);try{const l=await e.report.executeQuery(d);return t(l),l}catch(l){return i(l instanceof Error?l.message:"Query failed"),null}finally{n(!1)}},[e]);return{result:a,execute:c,isLoading:o,error:u}}function hs(e){const{client:a}=I(),[t,o]=r.useState(null),[n,u]=r.useState(!0),[i,c]=r.useState(null),d=r.useCallback(async()=>{u(!0),c(null);try{const l=await a.report.listQueries(e);o(l)}catch(l){c(l instanceof Error?l.message:"Failed to load queries")}finally{u(!1)}},[a,e]);return r.useEffect(()=>{d()},[d]),{queries:(t==null?void 0:t.data)??[],meta:t==null?void 0:t.meta,isLoading:n,error:i,refresh:d}}function Gs(e){const{client:a}=I(),[t,o]=r.useState(null),[n,u]=r.useState(!0),[i,c]=r.useState(null),d=r.useCallback(async()=>{u(!0),c(null);try{const l=await a.report.getDashboard(e);o(l)}catch(l){c(l instanceof Error?l.message:"Failed to load dashboard")}finally{u(!1)}},[a,e]);return r.useEffect(()=>{d()},[d]),{dashboard:t,isLoading:n,error:i,refresh:d}}function Ys(e,a,t="https://api.saas-support.com/v1"){const o=r.useMemo(()=>{const p=new U.Transport(t,{type:"embedToken",token:e});return new U.ReportClient(p)},[e,t]),[n,u]=r.useState(null),[i,c]=r.useState(!0),[d,l]=r.useState(null),g=r.useCallback(async()=>{c(!0),l(null);try{const p=await o.getDashboard(a);u(p)}catch(p){l(p instanceof Error?p.message:"Failed to load dashboard")}finally{c(!1)}},[o,a]);return r.useEffect(()=>{g()},[g]),{dashboard:n,reportClient:o,isLoading:i,error:d,refresh:g}}function Qs({onResult:e,mode:a="both",placeholder:t,appearance:o}){const{appearance:n}=I(),{execute:u,isLoading:i,error:c}=ss(),d=o??n,[l,g]=r.useState(""),[p,x]=r.useState(a==="sql"?"sql":"nl"),m=r.useCallback(async v=>{if(v.preventDefault(),!l.trim())return;const C=await u(p==="sql"?{sql:l}:{naturalLanguage:l});C&&(e==null||e(C))},[l,p,u,e]);return s.jsx(M,{appearance:d,children:s.jsxs("div",{className:"ss-card ss-card-wide",children:[a==="both"&&s.jsxs("div",{className:"ss-tab-group ss-tab-group-sm",children:[s.jsx("button",{type:"button",className:`ss-tab ${p==="nl"?"ss-tab-active":""}`,onClick:()=>x("nl"),children:"Natural Language"}),s.jsx("button",{type:"button",className:`ss-tab ${p==="sql"?"ss-tab-active":""}`,onClick:()=>x("sql"),children:"SQL"})]}),c&&s.jsx("div",{className:"ss-global-error",children:c}),s.jsxs("form",{onSubmit:m,children:[s.jsx("div",{className:"ss-field",children:s.jsx("textarea",{className:"ss-input ss-query-textarea",placeholder:t??(p==="sql"?"SELECT ...":"Ask a question about your data..."),value:l,onChange:v=>g(v.target.value),rows:3})}),s.jsxs("button",{type:"submit",className:"ss-btn ss-btn-primary",disabled:i||!l.trim(),children:[i&&s.jsx("span",{className:"ss-spinner"}),"Run query"]})]})]})})}function xs({columns:e,rows:a,sortable:t=!0,maxRows:o,appearance:n}){const{appearance:u}=I(),i=n??u,[c,d]=r.useState(null),[l,g]=r.useState("asc"),p=r.useMemo(()=>c?[...a].sort((b,C)=>{const h=b[c],w=C[c];if(h==null&&w==null)return 0;if(h==null)return 1;if(w==null)return-1;if(typeof h=="number"&&typeof w=="number")return l==="asc"?h-w:w-h;const S=String(h),$=String(w);return l==="asc"?S.localeCompare($):$.localeCompare(S)}):a,[a,c,l]),x=o?p.slice(0,o):p,m=b=>{t&&(c===b?g(C=>C==="asc"?"desc":"asc"):(d(b),g("asc")))};function v(b){return b==null?"":typeof b=="object"?JSON.stringify(b):String(b)}return s.jsx(M,{appearance:i,children:s.jsxs("div",{className:"ss-table-container",children:[s.jsxs("table",{className:"ss-table",children:[s.jsx("thead",{children:s.jsx("tr",{children:e.map(b=>s.jsxs("th",{className:`ss-th ${t?"ss-th-sortable":""} ${c===b?l==="asc"?"ss-sorted-asc":"ss-sorted-desc":""}`,onClick:()=>m(b),children:[b,c===b&&s.jsx("span",{className:"ss-sort-indicator",children:l==="asc"?" ▲":" ▼"})]},b))})}),s.jsx("tbody",{children:x.map((b,C)=>s.jsx("tr",{className:"ss-tr",children:e.map(h=>s.jsx("td",{className:"ss-td",children:v(b[h])},h))},C))})]}),o&&a.length>o&&s.jsxs("div",{className:"ss-table-footer",children:["Showing ",o," of ",a.length," rows"]})]})})}function Js(e,a="#6366f1"){const t=parseInt(a.replace("#","").slice(0,2),16),o=[];for(let n=0;n<e;n++){const u=(t+n*Math.floor(360/Math.max(e,1)))%360;o.push(`hsl(${u}, 65%, 55%)`)}return o}function Zs({labels:e,values:a,w:t,h:o,colors:n}){const u=Math.max(...a,1),i=40,c=t-i*2,d=o-i*2,l=Math.max(1,c/e.length-4);return s.jsxs("g",{children:[s.jsx("line",{x1:i,y1:o-i,x2:t-i,y2:o-i,stroke:"#ccc",strokeWidth:1}),a.map((g,p)=>{const x=g/u*d,m=i+c/e.length*p+2,v=o-i-x;return s.jsxs("g",{children:[s.jsx("rect",{x:m,y:v,width:l,height:x,fill:n[p%n.length],rx:2}),s.jsx("text",{x:m+l/2,y:o-i+14,textAnchor:"middle",fontSize:10,fill:"#666",children:e[p].length>8?e[p].slice(0,8)+"...":e[p]})]},p)})]})}function Ks({labels:e,values:a,w:t,h:o,colors:n}){const u=Math.max(...a,1),i=40,c=t-i*2,d=o-i*2,l=e.length>1?c/(e.length-1):0,g=a.map((p,x)=>{const m=i+l*x,v=o-i-p/u*d;return`${m},${v}`});return s.jsxs("g",{children:[[.25,.5,.75,1].map(p=>{const x=o-i-p*d;return s.jsx("line",{x1:i,y1:x,x2:t-i,y2:x,stroke:"#eee",strokeWidth:1},p)}),s.jsx("polyline",{points:g.join(" "),fill:"none",stroke:n[0],strokeWidth:2}),a.map((p,x)=>{const m=i+l*x,v=o-i-p/u*d;return s.jsx("circle",{cx:m,cy:v,r:4,fill:n[0]},x)})]})}function Xs({labels:e,values:a,w:t,h:o,colors:n}){const u=a.reduce((x,m)=>x+m,0)||1,i=t/2,c=o/2-20,d=Math.min(t,o)/2-40,l=2*Math.PI*d;let g=0;const p=a.map((x,m)=>{const v=x/u,b=v*l,C={dash:b,offset:g,color:n[m%n.length],label:e[m],pct:v};return g+=b,C});return s.jsxs("g",{children:[p.map((x,m)=>s.jsx("circle",{cx:i,cy:c,r:d,fill:"none",stroke:x.color,strokeWidth:d*.6,strokeDasharray:`${x.dash} ${l-x.dash}`,strokeDashoffset:-x.offset,transform:`rotate(-90 ${i} ${c})`},m)),s.jsx("g",{transform:`translate(${i-e.length*30}, ${o-20})`,children:p.slice(0,6).map((x,m)=>s.jsxs("g",{transform:`translate(${m*60}, 0)`,children:[s.jsx("rect",{width:10,height:10,fill:x.color,rx:2}),s.jsx("text",{x:14,y:9,fontSize:9,fill:"#666",children:x.label.length>6?x.label.slice(0,6)+"..":x.label})]},m))})]})}function gs({type:e,data:a,title:t,width:o=400,height:n=300,appearance:u}){const{appearance:i}=I(),c=u??i,d=r.useMemo(()=>Js(a.labels.length),[a.labels.length]);return s.jsx(M,{appearance:c,children:s.jsxs("div",{className:"ss-chart-container",children:[t&&s.jsx("h3",{className:"ss-chart-title",children:t}),s.jsxs("svg",{viewBox:`0 0 ${o} ${n}`,width:"100%",style:{maxWidth:o},children:[e==="bar"&&s.jsx(Zs,{labels:a.labels,values:a.values,w:o,h:n,colors:d}),e==="line"&&s.jsx(Ks,{labels:a.labels,values:a.values,w:o,h:n,colors:d}),e==="pie"&&s.jsx(Xs,{labels:a.labels,values:a.values,w:o,h:n,colors:d})]})]})})}function se({dashboardId:e,embedToken:a,baseUrl:t,refreshInterval:o,appearance:n}){const u=I(),i=n??(u==null?void 0:u.appearance),c=r.useMemo(()=>{if(a){const h=t??"https://api.saas-support.com/v1",w=new U.Transport(h,{type:"embedToken",token:a});return new U.ReportClient(w)}return u.client.report},[a,t,u]),[d,l]=r.useState([]),[g,p]=r.useState({}),[x,m]=r.useState(!0),[v,b]=r.useState(null),C=r.useCallback(async()=>{m(!0),b(null);try{const h=await c.getDashboard(e),w=JSON.parse(h.layoutJson||"[]");l(w);const S={};for(const $ of w)try{const P=await c.listQueries({search:$.queryId,perPage:1});if(P.data.length>0&&P.data[0].generatedSql){const O=await c.executeQuery({sql:P.data[0].generatedSql});S[$.queryId]=O}}catch{}p(S)}catch(h){b(h instanceof Error?h.message:"Failed to load dashboard")}finally{m(!1)}},[c,e]);return r.useEffect(()=>{C()},[C]),r.useEffect(()=>{if(!o||o<=0)return;const h=setInterval(C,o*1e3);return()=>clearInterval(h)},[o,C]),s.jsx(M,{appearance:i,children:s.jsxs("div",{className:"ss-dashboard-grid",children:[x&&s.jsxs("div",{className:"ss-loading",children:[s.jsx("span",{className:"ss-spinner"})," Loading dashboard..."]}),v&&s.jsx("div",{className:"ss-global-error",children:v}),!x&&d.map((h,w)=>{const S=g[h.queryId];if(!S)return null;const $=S.columns.length>=2?{labels:S.rows.map(P=>String(P[S.columns[0]]??"")),values:S.rows.map(P=>Number(P[S.columns[1]]??0))}:{labels:[],values:[]};return s.jsxs("div",{className:"ss-widget",children:[h.title&&s.jsx("h4",{className:"ss-widget-header",children:h.title}),h.chartType==="table"?s.jsx(xs,{columns:S.columns,rows:S.rows,maxRows:50}):s.jsx(gs,{type:h.chartType||"bar",data:$,width:h.w,height:h.h})]},w)})]})})}function ee(e){return new Date(e).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"})}function ae({onSelectQuery:e,onRunQuery:a,appearance:t}){const{appearance:o}=I(),{queries:n,isLoading:u,error:i}=hs(),{execute:c,isLoading:d}=ss(),l=t??o,g=r.useCallback(async p=>{if(!p.generatedSql)return;const x=await c({sql:p.generatedSql});x&&(a==null||a(x))},[c,a]);return s.jsx(M,{appearance:l,children:s.jsxs("div",{className:"ss-card ss-card-wide",children:[s.jsx("h2",{className:"ss-title",children:"Saved Queries"}),u&&s.jsxs("div",{className:"ss-loading",children:[s.jsx("span",{className:"ss-spinner"})," Loading..."]}),i&&s.jsx("div",{className:"ss-global-error",children:i}),!u&&n.length===0&&s.jsx("p",{className:"ss-empty",children:"No saved queries."}),!u&&n.map(p=>s.jsxs("div",{className:"ss-saved-query-card",onClick:()=>e==null?void 0:e(p),children:[s.jsxs("div",{className:"ss-saved-query-header",children:[s.jsx("span",{className:"ss-saved-query-name",children:p.name}),p.chartType&&s.jsx("span",{className:"ss-badge",children:p.chartType})]}),p.naturalLanguage&&s.jsx("p",{className:"ss-saved-query-desc",children:p.naturalLanguage}),s.jsxs("div",{className:"ss-saved-query-footer",children:[s.jsx("span",{className:"ss-saved-query-date",children:ee(p.createdAt)}),s.jsx("button",{type:"button",className:"ss-btn ss-btn-sm ss-btn-primary",disabled:d||!p.generatedSql,onClick:x=>{x.stopPropagation(),g(p)},children:d?s.jsx("span",{className:"ss-spinner"}):"Run"})]})]},p.id))]})})}function te({embedToken:e,dashboardId:a,baseUrl:t="https://api.saas-support.com/v1",refreshInterval:o,appearance:n}){const u=r.useMemo(()=>{const b=new U.Transport(t,{type:"embedToken",token:e});return new U.ReportClient(b)},[e,t]),[i,c]=r.useState([]),[d,l]=r.useState(!0),[g,p]=r.useState(null),x=r.useMemo(()=>Q(n),[n]),m=r.useMemo(()=>J(x),[x]),v=r.useCallback(async()=>{l(!0),p(null);try{const b=await u.getDashboard(a),C=JSON.parse(b.layoutJson||"[]"),h=await Promise.all(C.map(async w=>{try{const S=await u.listQueries({search:w.queryId,perPage:1});if(S.data.length>0&&S.data[0].generatedSql){const $=await u.executeQuery({sql:S.data[0].generatedSql});return{...w,result:$}}}catch{}return w}));c(h)}catch(b){p(b instanceof Error?b.message:"Failed to load dashboard")}finally{l(!1)}},[u,a]);return r.useEffect(()=>{v()},[v]),r.useEffect(()=>{if(!o||o<=0)return;const b=setInterval(v,o*1e3);return()=>clearInterval(b)},[o,v]),s.jsx("div",{ref:b=>{if(!b||b.shadowRoot)return;const C=b.attachShadow({mode:"open"}),h=document.createElement("style");h.textContent=m,C.appendChild(h);const w=document.createElement("div");C.appendChild(w)},style:{display:"contents"},children:s.jsxs("div",{className:"ss-dashboard-grid",children:[d&&s.jsx("div",{className:"ss-loading",children:"Loading dashboard..."}),g&&s.jsx("div",{className:"ss-global-error",children:g}),!d&&i.map((b,C)=>{if(!b.result)return null;const{columns:h,rows:w}=b.result;return s.jsxs("div",{className:"ss-widget",children:[b.title&&s.jsx("h4",{className:"ss-widget-header",children:b.title}),s.jsxs("table",{className:"ss-table",children:[s.jsx("thead",{children:s.jsx("tr",{children:h.map(S=>s.jsx("th",{className:"ss-th",children:S},S))})}),s.jsx("tbody",{children:w.slice(0,50).map((S,$)=>s.jsx("tr",{className:"ss-tr",children:h.map(P=>s.jsx("td",{className:"ss-td",children:String(S[P]??"")},P))},$))})]})]},C)})]})})}exports.SaaSError=U.SaaSError;exports.SaaSSupport=U.SaaSSupport;exports.isMfaRequired=U.isMfaRequired;exports.Chart=gs;exports.CouponInput=Ws;exports.DashboardView=se;exports.DataTable=xs;exports.InvoiceHistory=us;exports.OrgSwitcher=Ds;exports.PaymentPortal=qs;exports.PricingTable=As;exports.QueryInput=Qs;exports.ReportEmbed=te;exports.SaaSContext=Z;exports.SaaSProvider=vs;exports.SavedQueryList=ae;exports.SettingsPanel=os;exports.SignIn=Cs;exports.SignUp=zs;exports.SubscriptionStatus=ds;exports.UsageDisplay=ps;exports.UserButton=Bs;exports.UserProfile=Ls;exports.useAuth=W;exports.useBilling=Ms;exports.useDashboard=Gs;exports.useDeleteAccount=as;exports.useEmbedDashboard=Ys;exports.useInvoices=ls;exports.useOrg=H;exports.useProfile=X;exports.useQuery=ss;exports.useReport=_s;exports.useSaaSContext=I;exports.useSavedQueries=hs;exports.useSignIn=K;exports.useSignUp=es;exports.useSubscription=is;exports.useUsage=cs;exports.useUser=$s;