@elevasis/ui 2.67.0 → 2.68.0

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.
Files changed (98) hide show
  1. package/dist/api/index.d.ts +1 -1
  2. package/dist/api/index.js +3 -3
  3. package/dist/app/index.d.ts +1 -6
  4. package/dist/app/index.js +15 -12
  5. package/dist/auth/index.js +10 -12
  6. package/dist/charts/index.js +10 -12
  7. package/dist/chunk-2MTP3H3A.js +425 -0
  8. package/dist/chunk-3KMDHCAR.js +52 -0
  9. package/dist/chunk-3MEXPLWT.js +265 -0
  10. package/dist/{chunk-XNW3O6QW.js → chunk-5NRJ2BLQ.js} +1 -1
  11. package/dist/chunk-75NOC536.js +2162 -0
  12. package/dist/chunk-76IVMVI3.js +1764 -0
  13. package/dist/chunk-AH52XQB7.js +1 -0
  14. package/dist/chunk-BZZCNLT6.js +12 -0
  15. package/dist/chunk-DLR4SDZW.js +51 -0
  16. package/dist/chunk-FK3K2VK2.js +2103 -0
  17. package/dist/chunk-GBXTRSAU.js +37 -0
  18. package/dist/chunk-HJVPVS57.js +1934 -0
  19. package/dist/{chunk-M535KHLW.js → chunk-JC5W55J3.js} +1 -1
  20. package/dist/{chunk-I7BZVVVU.js → chunk-L3HFJFYF.js} +89 -382
  21. package/dist/chunk-LGKLC5MG.js +44 -0
  22. package/dist/{chunk-4DV4ECMG.js → chunk-N7U24M2J.js} +4 -0
  23. package/dist/chunk-NDHMZT2G.js +383 -0
  24. package/dist/chunk-OOACTYRA.js +10 -0
  25. package/dist/chunk-PDHTXPSF.js +12 -0
  26. package/dist/chunk-QYI5BZKM.js +85 -0
  27. package/dist/{chunk-4OEVLV66.js → chunk-R6NMRXNO.js} +112 -147
  28. package/dist/chunk-SIVUCZXQ.js +1194 -0
  29. package/dist/{chunk-JFBZ6XDW.js → chunk-SNZDFCOQ.js} +3 -49
  30. package/dist/chunk-TGPJNKDU.js +1595 -0
  31. package/dist/chunk-TUMSNGTX.js +35 -0
  32. package/dist/chunk-TYKAKJGW.js +67 -0
  33. package/dist/chunk-UD657ICS.js +589 -0
  34. package/dist/chunk-WPIASV3H.js +194 -0
  35. package/dist/chunk-ZFISGKYW.js +39 -0
  36. package/dist/chunk-ZGCWTWBD.js +16127 -0
  37. package/dist/chunk-ZNKZMK2E.js +4528 -0
  38. package/dist/chunk-ZWS3TCQR.js +11032 -0
  39. package/dist/components/chat/index.js +2 -1
  40. package/dist/components/index.d.ts +23 -11
  41. package/dist/components/index.js +2773 -14
  42. package/dist/components/navigation/index.js +11 -12
  43. package/dist/features/auth/index.d.ts +0 -4
  44. package/dist/features/auth/index.js +12 -13
  45. package/dist/features/clients/index.js +14 -12
  46. package/dist/features/crm/index.d.ts +1371 -15
  47. package/dist/features/crm/index.js +15 -12
  48. package/dist/features/dashboard/index.d.ts +1 -2
  49. package/dist/features/dashboard/index.js +15 -12
  50. package/dist/features/delivery/index.d.ts +0 -4
  51. package/dist/features/delivery/index.js +15 -12
  52. package/dist/features/knowledge/index.js +10 -12
  53. package/dist/features/lead-gen/index.d.ts +35 -15
  54. package/dist/features/lead-gen/index.js +16 -12
  55. package/dist/features/monitoring/index.js +15 -12
  56. package/dist/features/monitoring/requests/index.js +13 -13
  57. package/dist/features/operations/index.d.ts +1 -2
  58. package/dist/features/operations/index.js +21 -12
  59. package/dist/features/public-agent-chat/index.js +2 -1
  60. package/dist/features/seo/index.js +2 -1
  61. package/dist/features/settings/index.d.ts +0 -4
  62. package/dist/features/settings/index.js +14 -12
  63. package/dist/hooks/access/index.js +10 -12
  64. package/dist/hooks/delivery/index.d.ts +0 -4
  65. package/dist/hooks/delivery/index.js +2 -23
  66. package/dist/hooks/index.d.ts +13 -7
  67. package/dist/hooks/index.js +10 -12
  68. package/dist/hooks/operations/command-view/utils/transformCommandViewData.d.ts +1 -2
  69. package/dist/hooks/published.d.ts +13 -7
  70. package/dist/hooks/published.js +10 -12
  71. package/dist/initialization/index.d.ts +1 -5
  72. package/dist/knowledge/index.d.ts +1 -2
  73. package/dist/knowledge/index.js +15 -13
  74. package/dist/layout/index.js +14 -12
  75. package/dist/organization/index.d.ts +3 -3
  76. package/dist/organization/index.js +1 -21
  77. package/dist/profile/index.d.ts +0 -4
  78. package/dist/provider/index.d.ts +2 -7
  79. package/dist/provider/index.js +10 -12
  80. package/dist/provider/published.d.ts +2 -7
  81. package/dist/provider/published.js +10 -12
  82. package/dist/supabase/index.d.ts +0 -8
  83. package/dist/test-utils/index.d.ts +5 -0
  84. package/dist/test-utils/index.js +5 -5
  85. package/dist/test-utils/setup-integration.js +1 -1
  86. package/dist/test-utils/setup.js +1 -1
  87. package/dist/theme/index.js +2 -1
  88. package/dist/typeform/index.js +2049 -1
  89. package/dist/types/index.d.ts +13 -7
  90. package/dist/utils/index.d.ts +1 -2
  91. package/dist/utils/index.js +1 -1
  92. package/package.json +4 -4
  93. package/dist/chunk-5TERYXOO.js +0 -51390
  94. package/dist/chunk-AUDNF2Q7.js +0 -2050
  95. package/dist/index.css +0 -659
  96. package/dist/index.d.ts +0 -17888
  97. package/dist/index.js +0 -30
  98. package/dist/{chunk-GMXGDO3I.js → chunk-MISHPEJX.js} +1 -1
@@ -0,0 +1,1194 @@
1
+ import { NavigationButton, useAppearance, useElevasisSystems } from './chunk-ZGCWTWBD.js';
2
+ import { sidebarItemGap, sidebarSubLinkPaddingY, sidebarSubLinkPaddingX, sidebarSubLinkIndent, sidebarHoverDelay, sidebarTransitionDuration, sidebarCollapsedWidth, sidebarWidth, topbarHeight, sidebarToggleIconSize, sidebarSectionPadding, sidebarGroupChevronSize, sidebarIconInnerSize, SubshellNavItem } from './chunk-MISHPEJX.js';
3
+ import { useRouterContext } from './chunk-Q7DJKLEN.js';
4
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
5
+ import { createContext, memo, useEffect, useRef, createElement, useContext, useLayoutEffect, useState, Fragment as Fragment$1 } from 'react';
6
+ import { Collapse, HoverCard, Stack, Group, Text, UnstyledButton, Tooltip, ScrollArea, Menu, Avatar, Box, useMantineColorScheme, Switch, Code } from '@mantine/core';
7
+ import { IconLayoutSidebarLeftExpand, IconLayoutSidebarLeftCollapse, IconUser, IconLogout, IconChevronDown, IconChevronRight, IconMoonStars, IconSun } from '@tabler/icons-react';
8
+
9
+ var randRange = (min, max) => min + Math.random() * (max - min);
10
+ var FLUX_SPARKS = Array.from({ length: 30 }, () => {
11
+ const duration = randRange(12, 70);
12
+ const pulse = randRange(0.8, 2.2);
13
+ return {
14
+ left: randRange(0, 100),
15
+ size: randRange(1.5, 4.2),
16
+ duration,
17
+ delay: -randRange(0, duration),
18
+ drift: randRange(-35, 35),
19
+ peak: randRange(0.18, 0.5),
20
+ pulse,
21
+ pulseDelay: -randRange(0, pulse)
22
+ };
23
+ });
24
+ var FLUX_MOTES = Array.from({ length: 18 }, () => {
25
+ const duration = randRange(18, 90);
26
+ const pulse = randRange(1.6, 4);
27
+ return {
28
+ left: randRange(-2, 102),
29
+ size: randRange(3.5, 10),
30
+ duration,
31
+ delay: -randRange(0, duration),
32
+ drift: randRange(-55, 55),
33
+ blur: randRange(1.5, 5),
34
+ peak: randRange(0.22, 0.55),
35
+ pulse,
36
+ pulseDelay: -randRange(0, pulse)
37
+ };
38
+ });
39
+ var FLUX_GLOWS = Array.from({ length: 10 }, () => {
40
+ const duration = randRange(25, 130);
41
+ const pulse = randRange(3.5, 7);
42
+ return {
43
+ left: randRange(-5, 105),
44
+ size: randRange(3, 22),
45
+ duration,
46
+ delay: -randRange(0, duration),
47
+ drift: randRange(-80, 80),
48
+ blur: randRange(6, 16),
49
+ opacity: randRange(0.18, 0.42),
50
+ pulse,
51
+ pulseDelay: -randRange(0, pulse)
52
+ };
53
+ });
54
+ var KEYFRAMES = `
55
+ @keyframes elevasis-cyber-spark-rise {
56
+ 0% { transform: translate3d(0, 0, 0); opacity: 0; }
57
+ 10% { opacity: var(--cy-peak, 1); }
58
+ 85% { opacity: calc(var(--cy-peak, 1) * 0.9); }
59
+ 100% { transform: translate3d(var(--cy-drift, 0px), -112vh, 0); opacity: 0; }
60
+ }
61
+ @keyframes elevasis-cyber-spark-pulse {
62
+ 0%, 100% { filter: brightness(0.55); transform: scale(0.8); }
63
+ 50% { filter: brightness(1.7); transform: scale(1.25); }
64
+ }
65
+ @keyframes elevasis-cyber-glow-pulse {
66
+ 0%, 100% { transform: scale(0.85); }
67
+ 50% { transform: scale(1.2); }
68
+ }
69
+ @media (prefers-reduced-motion: reduce) {
70
+ .elevasis-cyber-spark,
71
+ .elevasis-cyber-spark-inner,
72
+ .elevasis-cyber-glow,
73
+ .elevasis-cyber-glow-inner {
74
+ animation: none !important;
75
+ }
76
+ .elevasis-cyber-spark,
77
+ .elevasis-cyber-glow {
78
+ opacity: 0 !important;
79
+ }
80
+ }
81
+ `;
82
+ function FluxGlows() {
83
+ return /* @__PURE__ */ jsx(Fragment, { children: FLUX_GLOWS.map((g, i) => /* @__PURE__ */ jsx(
84
+ "div",
85
+ {
86
+ className: "elevasis-cyber-glow",
87
+ style: {
88
+ position: "absolute",
89
+ bottom: "-5%",
90
+ left: `${g.left}%`,
91
+ width: `${g.size}px`,
92
+ height: `${g.size}px`,
93
+ filter: `blur(${g.blur}px)`,
94
+ animation: `elevasis-cyber-spark-rise ${g.duration}s linear infinite`,
95
+ animationDelay: `${g.delay}s`,
96
+ ["--cy-drift"]: `${g.drift}px`,
97
+ ["--cy-peak"]: `${g.opacity}`,
98
+ willChange: "transform, opacity"
99
+ },
100
+ children: /* @__PURE__ */ jsx(
101
+ "div",
102
+ {
103
+ className: "elevasis-cyber-glow-inner",
104
+ style: {
105
+ width: "100%",
106
+ height: "100%",
107
+ borderRadius: "50%",
108
+ background: `radial-gradient(circle, var(--color-primary) 0%, color-mix(in srgb, var(--color-primary) 60%, transparent) 45%, transparent 75%)`,
109
+ animation: `elevasis-cyber-glow-pulse ${g.pulse}s ease-in-out infinite`,
110
+ animationDelay: `${g.pulseDelay}s`,
111
+ willChange: "transform"
112
+ }
113
+ }
114
+ )
115
+ },
116
+ i
117
+ )) });
118
+ }
119
+ function FluxMotes() {
120
+ return /* @__PURE__ */ jsx(Fragment, { children: FLUX_MOTES.map((m, i) => /* @__PURE__ */ jsx(
121
+ "div",
122
+ {
123
+ className: "elevasis-cyber-spark",
124
+ style: {
125
+ position: "absolute",
126
+ bottom: "-3%",
127
+ left: `${m.left}%`,
128
+ width: `${m.size}px`,
129
+ height: `${m.size}px`,
130
+ filter: `blur(${m.blur}px)`,
131
+ animation: `elevasis-cyber-spark-rise ${m.duration}s linear infinite`,
132
+ animationDelay: `${m.delay}s`,
133
+ ["--cy-drift"]: `${m.drift}px`,
134
+ ["--cy-peak"]: `${m.peak}`,
135
+ willChange: "transform, opacity"
136
+ },
137
+ children: /* @__PURE__ */ jsx(
138
+ "div",
139
+ {
140
+ className: "elevasis-cyber-spark-inner",
141
+ style: {
142
+ width: "100%",
143
+ height: "100%",
144
+ borderRadius: "50%",
145
+ background: `radial-gradient(circle, var(--color-primary) 0%, color-mix(in srgb, var(--color-primary) 70%, transparent) 55%, transparent 90%)`,
146
+ boxShadow: `0 0 ${m.size * 1.2}px color-mix(in srgb, var(--color-primary) 40%, transparent)`,
147
+ animation: `elevasis-cyber-spark-pulse ${m.pulse}s ease-in-out infinite`,
148
+ animationDelay: `${m.pulseDelay}s`,
149
+ willChange: "transform, filter"
150
+ }
151
+ }
152
+ )
153
+ },
154
+ i
155
+ )) });
156
+ }
157
+ function FluxSparks() {
158
+ return /* @__PURE__ */ jsx(Fragment, { children: FLUX_SPARKS.map((s, i) => /* @__PURE__ */ jsx(
159
+ "div",
160
+ {
161
+ className: "elevasis-cyber-spark",
162
+ style: {
163
+ position: "absolute",
164
+ bottom: "-2%",
165
+ left: `${s.left}%`,
166
+ width: `${s.size}px`,
167
+ height: `${s.size}px`,
168
+ animation: `elevasis-cyber-spark-rise ${s.duration}s linear infinite`,
169
+ animationDelay: `${s.delay}s`,
170
+ ["--cy-drift"]: `${s.drift}px`,
171
+ ["--cy-peak"]: `${s.peak}`,
172
+ willChange: "transform, opacity"
173
+ },
174
+ children: /* @__PURE__ */ jsx(
175
+ "div",
176
+ {
177
+ className: "elevasis-cyber-spark-inner",
178
+ style: {
179
+ width: "100%",
180
+ height: "100%",
181
+ borderRadius: "50%",
182
+ background: "var(--color-primary)",
183
+ boxShadow: `0 0 ${s.size * 2.5}px var(--color-primary), 0 0 ${s.size * 5}px color-mix(in srgb, var(--color-primary) 50%, transparent)`,
184
+ animation: `elevasis-cyber-spark-pulse ${s.pulse}s ease-in-out infinite`,
185
+ animationDelay: `${s.pulseDelay}s`,
186
+ willChange: "transform, filter"
187
+ }
188
+ }
189
+ )
190
+ },
191
+ i
192
+ )) });
193
+ }
194
+ function CyberParticles({ variant: _variant, className }) {
195
+ return /* @__PURE__ */ jsxs(
196
+ "div",
197
+ {
198
+ className,
199
+ "aria-hidden": "true",
200
+ style: {
201
+ position: "absolute",
202
+ inset: 0,
203
+ pointerEvents: "none",
204
+ overflow: "hidden"
205
+ },
206
+ children: [
207
+ /* @__PURE__ */ jsx("style", { children: KEYFRAMES }),
208
+ /* @__PURE__ */ jsx(FluxGlows, {}),
209
+ /* @__PURE__ */ jsx(FluxMotes, {}),
210
+ /* @__PURE__ */ jsx(FluxSparks, {})
211
+ ]
212
+ }
213
+ );
214
+ }
215
+ function Vignette({ strength = 0.35, className }) {
216
+ return /* @__PURE__ */ jsx(
217
+ "div",
218
+ {
219
+ className,
220
+ style: {
221
+ position: "absolute",
222
+ inset: 0,
223
+ pointerEvents: "none",
224
+ background: `radial-gradient(ellipse 80% 70% at 50% 50%, transparent 50%, rgba(0, 0, 0, ${strength}) 100%)`
225
+ }
226
+ }
227
+ );
228
+ }
229
+ var AppShellContainer = ({ children }) => {
230
+ const { background } = useAppearance();
231
+ return /* @__PURE__ */ jsxs(
232
+ "div",
233
+ {
234
+ style: {
235
+ height: "100vh",
236
+ display: "flex",
237
+ backgroundColor: "var(--color-background)",
238
+ position: "relative"
239
+ },
240
+ children: [
241
+ background,
242
+ children
243
+ ]
244
+ }
245
+ );
246
+ };
247
+ var AppShellRightSideContainer = ({ children }) => {
248
+ return /* @__PURE__ */ jsx(
249
+ "main",
250
+ {
251
+ style: {
252
+ flex: 1,
253
+ minWidth: 0,
254
+ color: "var(--color-text)",
255
+ display: "flex",
256
+ flexDirection: "column",
257
+ minHeight: "100vh"
258
+ },
259
+ children
260
+ }
261
+ );
262
+ };
263
+ var AppShellRightSideOuterContainer = ({ children }) => {
264
+ return /* @__PURE__ */ jsx(
265
+ "div",
266
+ {
267
+ style: {
268
+ flex: 1,
269
+ overflow: "auto",
270
+ minWidth: 0,
271
+ minHeight: "100vh"
272
+ },
273
+ children
274
+ }
275
+ );
276
+ };
277
+ var AppShellContentContainer = ({ children }) => {
278
+ return /* @__PURE__ */ jsx(
279
+ "div",
280
+ {
281
+ style: {
282
+ height: "100%",
283
+ padding: "var(--mantine-spacing-md)"
284
+ },
285
+ children
286
+ }
287
+ );
288
+ };
289
+ var AppTopbarAdjusterWrapper = ({ children }) => {
290
+ const padding = `${topbarHeight}px`;
291
+ return /* @__PURE__ */ jsx("div", { style: { paddingTop: padding }, children });
292
+ };
293
+ var SidebarContext = createContext(void 0);
294
+ var SIDEBAR_COLLAPSED_KEY = "sidebar-collapsed";
295
+ var SidebarProvider = ({ children }) => {
296
+ const [expandedGroups, setExpandedGroups] = useState({});
297
+ const [isInitialized, setIsInitialized] = useState(false);
298
+ const [isCollapsed, setIsCollapsed] = useState(() => {
299
+ if (typeof window !== "undefined" && window.innerWidth < 1024) {
300
+ return true;
301
+ }
302
+ const stored = localStorage.getItem(SIDEBAR_COLLAPSED_KEY);
303
+ return stored === "true";
304
+ });
305
+ const toggleGroup = (groupLabel) => {
306
+ setExpandedGroups((prev) => ({
307
+ ...prev,
308
+ [groupLabel]: !prev[groupLabel]
309
+ }));
310
+ };
311
+ const initializeGroups = (groups) => {
312
+ if (!isInitialized) {
313
+ const initialState = {};
314
+ groups.forEach((group) => {
315
+ initialState[group.label] = group.initiallyOpened || false;
316
+ });
317
+ setExpandedGroups(initialState);
318
+ setIsInitialized(true);
319
+ }
320
+ };
321
+ const toggleCollapsed = () => {
322
+ setIsCollapsed((prev) => {
323
+ const newValue = !prev;
324
+ localStorage.setItem(SIDEBAR_COLLAPSED_KEY, String(newValue));
325
+ return newValue;
326
+ });
327
+ };
328
+ const setCollapsed = (value) => {
329
+ setIsCollapsed(value);
330
+ localStorage.setItem(SIDEBAR_COLLAPSED_KEY, String(value));
331
+ };
332
+ useEffect(() => {
333
+ const handleStorageChange = (e) => {
334
+ if (e.key === SIDEBAR_COLLAPSED_KEY && e.newValue !== null) {
335
+ setIsCollapsed(e.newValue === "true");
336
+ }
337
+ };
338
+ window.addEventListener("storage", handleStorageChange);
339
+ return () => window.removeEventListener("storage", handleStorageChange);
340
+ }, []);
341
+ return /* @__PURE__ */ jsx(
342
+ SidebarContext.Provider,
343
+ {
344
+ value: {
345
+ expandedGroups,
346
+ toggleGroup,
347
+ initializeGroups,
348
+ isCollapsed,
349
+ toggleCollapsed,
350
+ setCollapsed
351
+ },
352
+ children
353
+ }
354
+ );
355
+ };
356
+ var useSidebar = () => {
357
+ const context = useContext(SidebarContext);
358
+ if (context === void 0) {
359
+ throw new Error("useSidebar must be used within a SidebarProvider");
360
+ }
361
+ return context;
362
+ };
363
+
364
+ // src/components/layout/sidebar/components/link-group-components/utils.ts
365
+ var isPathActive = (linkPath, currentPath) => {
366
+ if (!currentPath || !linkPath) return false;
367
+ if (currentPath === linkPath) return true;
368
+ const linkSegments = linkPath.split("/").filter(Boolean);
369
+ const currentSegments = currentPath.split("/").filter(Boolean);
370
+ if (currentSegments.length < linkSegments.length) return false;
371
+ for (let i = 0; i < linkSegments.length; i++) {
372
+ if (linkSegments[i] !== currentSegments[i]) return false;
373
+ }
374
+ return true;
375
+ };
376
+ var isOverviewLink = (label, link) => {
377
+ return label === "Overview" && (link === "/admin" || link === "/operations" || link === "/monitoring" || link === "/settings" || link === "/execution-engine" || link === "/acquisition");
378
+ };
379
+ var isLinkItemActive = (linkItem, currentPath) => {
380
+ const isKnowledgeBaseActive = linkItem.link === "/knowledge" && currentPath.startsWith("/knowledge") && !currentPath.startsWith("/knowledge/command-view");
381
+ const matchesExtraPath = linkItem.activeMatchPaths?.some((path) => isPathActive(path, currentPath)) ?? false;
382
+ if (isKnowledgeBaseActive) return true;
383
+ if (linkItem.exact || isOverviewLink(linkItem.label, linkItem.link)) {
384
+ return currentPath === linkItem.link || matchesExtraPath;
385
+ }
386
+ return isPathActive(linkItem.link, currentPath) || matchesExtraPath;
387
+ };
388
+ var SubLinkItem = ({ linkItem, currentPath }) => {
389
+ const { Link } = useRouterContext();
390
+ const isActive = isLinkItemActive(linkItem, currentPath);
391
+ const activeColor2 = "var(--color-primary)";
392
+ const activeColorBg = "color-mix(in srgb, var(--color-primary) 10%, transparent)";
393
+ const defaultColor = "var(--color-text-subtle)";
394
+ const hoverColor = "var(--color-text)";
395
+ return /* @__PURE__ */ jsx(
396
+ Link,
397
+ {
398
+ to: linkItem.link,
399
+ onClick: linkItem.onClick,
400
+ "data-onboarding-tour-id": linkItem.dataOnboardingTourId,
401
+ style: {
402
+ display: "block",
403
+ textDecoration: "none",
404
+ fontFamily: "var(--elevasis-font-family-subtitle)",
405
+ fontSize: "var(--mantine-font-size-sm)",
406
+ color: isActive ? activeColor2 : defaultColor,
407
+ backgroundColor: isActive ? activeColorBg : "transparent",
408
+ padding: `${sidebarSubLinkPaddingY}px ${sidebarSubLinkPaddingX}px ${sidebarSubLinkPaddingY}px ${sidebarSubLinkIndent}px`,
409
+ borderRadius: "var(--mantine-radius-default)",
410
+ transition: `all var(--duration-fast) var(--easing)`,
411
+ fontWeight: isActive ? 600 : 400
412
+ },
413
+ onMouseEnter: (e) => {
414
+ if (!isActive) {
415
+ e.currentTarget.style.backgroundColor = "var(--color-surface-hover)";
416
+ e.currentTarget.style.color = hoverColor;
417
+ }
418
+ },
419
+ onMouseLeave: (e) => {
420
+ if (!isActive) {
421
+ e.currentTarget.style.backgroundColor = "transparent";
422
+ e.currentTarget.style.color = defaultColor;
423
+ }
424
+ },
425
+ children: linkItem.label
426
+ }
427
+ );
428
+ };
429
+ var MainButton = ({
430
+ icon,
431
+ label,
432
+ isCollapsed,
433
+ hasLinks,
434
+ opened,
435
+ isIconTextActive,
436
+ isBackgroundActive,
437
+ onClick,
438
+ link,
439
+ noWrapper = false
440
+ }) => {
441
+ const { Link } = useRouterContext();
442
+ const button = /* @__PURE__ */ jsx(
443
+ NavigationButton,
444
+ {
445
+ icon,
446
+ label,
447
+ isCollapsed,
448
+ hasSubItems: hasLinks,
449
+ isExpanded: opened,
450
+ isActive: isIconTextActive,
451
+ hasActiveBackground: isBackgroundActive,
452
+ onClick,
453
+ transitionDuration: sidebarTransitionDuration
454
+ }
455
+ );
456
+ const wrapperStyle = { marginBottom: `${sidebarItemGap}px` };
457
+ if (noWrapper) {
458
+ return button;
459
+ }
460
+ if (!hasLinks && link) {
461
+ return /* @__PURE__ */ jsx("div", { style: wrapperStyle, children: /* @__PURE__ */ jsx(Link, { to: link, style: { textDecoration: "none" }, children: button }) });
462
+ }
463
+ return /* @__PURE__ */ jsx("div", { style: wrapperStyle, children: button });
464
+ };
465
+ var CollapsedWithTooltip = ({ label, children }) => {
466
+ return /* @__PURE__ */ jsx(Tooltip, { label, position: "right", offset: 12, children });
467
+ };
468
+ var CollapsedWithHoverCard = ({
469
+ label,
470
+ icon: Icon,
471
+ links,
472
+ currentPath,
473
+ children
474
+ }) => {
475
+ const { Link } = useRouterContext();
476
+ return /* @__PURE__ */ jsxs(
477
+ HoverCard,
478
+ {
479
+ width: 200,
480
+ position: "right-start",
481
+ shadow: "md",
482
+ withinPortal: true,
483
+ offset: 12,
484
+ openDelay: sidebarHoverDelay,
485
+ closeDelay: 150,
486
+ zIndex: 9999,
487
+ children: [
488
+ /* @__PURE__ */ jsx(HoverCard.Target, { children: /* @__PURE__ */ jsx("div", { style: { display: "inline-block", width: "100%" }, children }) }),
489
+ /* @__PURE__ */ jsx(
490
+ HoverCard.Dropdown,
491
+ {
492
+ style: {
493
+ padding: "var(--mantine-spacing-sm)",
494
+ background: "var(--glass-background)",
495
+ backdropFilter: "var(--glass-blur)"
496
+ },
497
+ children: /* @__PURE__ */ jsxs(Stack, { gap: 4, children: [
498
+ /* @__PURE__ */ jsxs(
499
+ Group,
500
+ {
501
+ gap: "xs",
502
+ style: {
503
+ paddingBottom: "8px",
504
+ borderBottom: "1px solid var(--color-border)",
505
+ marginBottom: "4px"
506
+ },
507
+ children: [
508
+ Icon && /* @__PURE__ */ jsx(Icon, { size: 16, stroke: 2 }),
509
+ /* @__PURE__ */ jsx(
510
+ Text,
511
+ {
512
+ size: "sm",
513
+ fw: 600,
514
+ c: "var(--color-text)",
515
+ style: { fontFamily: "var(--mantine-font-family-headings)" },
516
+ children: label
517
+ }
518
+ )
519
+ ]
520
+ }
521
+ ),
522
+ links.map((linkItem) => {
523
+ const isActive = currentPath === linkItem.link;
524
+ return /* @__PURE__ */ jsx(Link, { to: linkItem.link, style: { textDecoration: "none" }, onClick: () => {
525
+ }, children: /* @__PURE__ */ jsx(
526
+ UnstyledButton,
527
+ {
528
+ style: {
529
+ width: "100%",
530
+ padding: "8px 12px",
531
+ borderRadius: "var(--mantine-radius-default)",
532
+ backgroundColor: isActive ? "color-mix(in srgb, var(--color-primary) 10%, transparent)" : "transparent",
533
+ color: isActive ? "var(--color-primary)" : "var(--color-text)",
534
+ transition: "all var(--duration-fast) var(--easing)"
535
+ },
536
+ onMouseEnter: (e) => {
537
+ if (!isActive) {
538
+ e.currentTarget.style.backgroundColor = "var(--color-surface-hover)";
539
+ }
540
+ },
541
+ onMouseLeave: (e) => {
542
+ e.currentTarget.style.backgroundColor = isActive ? "color-mix(in srgb, var(--color-primary) 10%, transparent)" : "transparent";
543
+ },
544
+ children: /* @__PURE__ */ jsx(Text, { size: "sm", style: { lineHeight: 1.2 }, children: linkItem.label })
545
+ }
546
+ ) }, linkItem.link);
547
+ })
548
+ ] })
549
+ }
550
+ )
551
+ ]
552
+ }
553
+ );
554
+ };
555
+ var LinksGroup = memo(function LinksGroup2({
556
+ icon: Icon,
557
+ label,
558
+ links = [],
559
+ link,
560
+ onClick,
561
+ currentPath = "",
562
+ opened = false,
563
+ onToggle
564
+ }) {
565
+ const hasLinks = links.length > 0;
566
+ const { navigate } = useRouterContext();
567
+ const { isCollapsed } = useSidebar();
568
+ useEffect(() => {
569
+ if (isCollapsed && opened && onToggle) {
570
+ onToggle();
571
+ }
572
+ }, [isCollapsed, opened, onToggle]);
573
+ const hasActiveChild = hasLinks && links.some((item) => isLinkItemActive(item, currentPath));
574
+ const isParentActive = !hasLinks && (link === "/" ? currentPath === "/" : isPathActive(link || "", currentPath));
575
+ const isIconTextActive = isParentActive || hasActiveChild;
576
+ const isBackgroundActive = isParentActive || hasActiveChild && !opened;
577
+ const prevPathRef = useRef(null);
578
+ useEffect(() => {
579
+ const pathChanged = prevPathRef.current !== currentPath;
580
+ prevPathRef.current = currentPath;
581
+ if (pathChanged && !isCollapsed && hasActiveChild && !opened && onToggle) {
582
+ onToggle();
583
+ }
584
+ }, [currentPath, hasActiveChild, isCollapsed, opened, onToggle]);
585
+ const handleMainClick = () => {
586
+ if (hasLinks && !isCollapsed) {
587
+ onToggle?.();
588
+ } else if (!hasLinks) {
589
+ if (link) {
590
+ navigate(link);
591
+ }
592
+ onClick?.();
593
+ }
594
+ };
595
+ const items = links.map((item) => /* @__PURE__ */ jsx(SubLinkItem, { linkItem: item, currentPath }, item.label));
596
+ const mainButton = /* @__PURE__ */ jsx(
597
+ MainButton,
598
+ {
599
+ icon: Icon,
600
+ label,
601
+ isCollapsed,
602
+ hasLinks,
603
+ opened,
604
+ isIconTextActive,
605
+ isBackgroundActive,
606
+ onClick: handleMainClick,
607
+ link
608
+ }
609
+ );
610
+ if (isCollapsed && hasLinks) {
611
+ const mainButtonNoWrapper = /* @__PURE__ */ jsx(
612
+ MainButton,
613
+ {
614
+ icon: Icon,
615
+ label,
616
+ isCollapsed,
617
+ hasLinks,
618
+ opened,
619
+ isIconTextActive,
620
+ isBackgroundActive,
621
+ onClick: handleMainClick,
622
+ link,
623
+ noWrapper: true
624
+ }
625
+ );
626
+ return /* @__PURE__ */ jsx("div", { style: { marginBottom: `${sidebarItemGap}px` }, children: /* @__PURE__ */ jsx(CollapsedWithHoverCard, { label, icon: Icon, links, currentPath, children: mainButtonNoWrapper }) });
627
+ }
628
+ if (isCollapsed && !hasLinks) {
629
+ const mainButtonNoWrapper = /* @__PURE__ */ jsx(
630
+ MainButton,
631
+ {
632
+ icon: Icon,
633
+ label,
634
+ isCollapsed,
635
+ hasLinks,
636
+ opened,
637
+ isIconTextActive,
638
+ isBackgroundActive,
639
+ onClick: handleMainClick,
640
+ link,
641
+ noWrapper: true
642
+ }
643
+ );
644
+ return /* @__PURE__ */ jsx("div", { style: { marginBottom: `${sidebarItemGap}px` }, children: /* @__PURE__ */ jsx(CollapsedWithTooltip, { label, children: mainButtonNoWrapper }) });
645
+ }
646
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
647
+ mainButton,
648
+ hasLinks && /* @__PURE__ */ jsx(Collapse, { in: opened && !isCollapsed, children: /* @__PURE__ */ jsx("div", { style: { paddingLeft: "0px" }, children: items }) })
649
+ ] });
650
+ });
651
+ var useSidebarCollapse = () => {
652
+ const { isCollapsed, toggleCollapsed, setCollapsed } = useSidebar();
653
+ useEffect(() => {
654
+ const handleKeyDown = (e) => {
655
+ if ((e.metaKey || e.ctrlKey) && e.key === "b") {
656
+ e.preventDefault();
657
+ toggleCollapsed();
658
+ }
659
+ };
660
+ window.addEventListener("keydown", handleKeyDown);
661
+ return () => window.removeEventListener("keydown", handleKeyDown);
662
+ }, [toggleCollapsed]);
663
+ useEffect(() => {
664
+ const handleResize = () => {
665
+ if (window.innerWidth < 1024) {
666
+ setCollapsed(true);
667
+ }
668
+ };
669
+ handleResize();
670
+ window.addEventListener("resize", handleResize);
671
+ return () => window.removeEventListener("resize", handleResize);
672
+ }, [setCollapsed]);
673
+ return {
674
+ isCollapsed,
675
+ toggleCollapsed,
676
+ setCollapsed
677
+ };
678
+ };
679
+ var SidebarContainer = ({ children, className }) => {
680
+ const { isCollapsed } = useSidebar();
681
+ return /* @__PURE__ */ jsx(
682
+ "nav",
683
+ {
684
+ className,
685
+ style: {
686
+ height: "100vh",
687
+ width: isCollapsed ? `${sidebarCollapsedWidth}px` : `${sidebarWidth}px`,
688
+ flexShrink: 0,
689
+ display: "flex",
690
+ flexDirection: "column",
691
+ backgroundColor: "var(--glass-background)",
692
+ backdropFilter: "var(--glass-blur)",
693
+ WebkitBackdropFilter: "var(--glass-blur)",
694
+ borderRight: "1px solid var(--color-border)",
695
+ boxShadow: "var(--card-shadow)",
696
+ transition: `width ${sidebarTransitionDuration}ms var(--easing)`,
697
+ overflow: "hidden",
698
+ position: "relative",
699
+ fontFamily: "var(--mantine-font-family-headings)"
700
+ },
701
+ children
702
+ }
703
+ );
704
+ };
705
+ var SidebarTopSection = ({ logo }) => {
706
+ const { isCollapsed, toggleCollapsed } = useSidebar();
707
+ return /* @__PURE__ */ jsxs(
708
+ "div",
709
+ {
710
+ style: {
711
+ padding: "var(--mantine-spacing-sm)",
712
+ borderBottom: "1px solid var(--color-border)",
713
+ height: `${topbarHeight}px`,
714
+ display: "flex",
715
+ alignItems: "center",
716
+ justifyContent: "space-between"
717
+ },
718
+ children: [
719
+ !isCollapsed && logo ? /* @__PURE__ */ jsx(
720
+ "img",
721
+ {
722
+ src: logo,
723
+ alt: "Logo",
724
+ style: {
725
+ marginLeft: 12,
726
+ width: "auto",
727
+ height: "30px",
728
+ transition: `opacity ${sidebarTransitionDuration}ms var(--easing)`,
729
+ opacity: isCollapsed ? 0 : 1
730
+ }
731
+ }
732
+ ) : /* @__PURE__ */ jsx("div", {}),
733
+ /* @__PURE__ */ jsx(
734
+ UnstyledButton,
735
+ {
736
+ onClick: toggleCollapsed,
737
+ style: {
738
+ padding: "6px",
739
+ display: "flex",
740
+ alignItems: "center",
741
+ justifyContent: "center",
742
+ color: "var(--color-text-subtle)",
743
+ paddingRight: 6,
744
+ marginRight: isCollapsed ? 6 : 0,
745
+ transition: "all var(--duration-fast) var(--easing)",
746
+ ":hover": {
747
+ backgroundColor: "var(--color-surface-hover)",
748
+ color: "var(--color-text)"
749
+ }
750
+ },
751
+ onMouseEnter: (e) => {
752
+ e.currentTarget.style.backgroundColor = "var(--color-surface-hover)";
753
+ e.currentTarget.style.color = "var(--color-text)";
754
+ },
755
+ onMouseLeave: (e) => {
756
+ e.currentTarget.style.backgroundColor = "transparent";
757
+ e.currentTarget.style.color = "var(--color-text-subtle)";
758
+ },
759
+ children: isCollapsed ? /* @__PURE__ */ jsx(
760
+ IconLayoutSidebarLeftExpand,
761
+ {
762
+ size: sidebarToggleIconSize,
763
+ stroke: 1.5,
764
+ style: {
765
+ transition: `transform ${sidebarTransitionDuration}ms var(--easing)`
766
+ }
767
+ }
768
+ ) : /* @__PURE__ */ jsx(
769
+ IconLayoutSidebarLeftCollapse,
770
+ {
771
+ size: sidebarToggleIconSize,
772
+ stroke: 1.5,
773
+ style: {
774
+ transition: `transform ${sidebarTransitionDuration}ms var(--easing)`
775
+ }
776
+ }
777
+ )
778
+ }
779
+ )
780
+ ]
781
+ }
782
+ );
783
+ };
784
+ var BOTTOM_SECTION_HEIGHT_VAR = "--elevasis-sidebar-bottom-section-height";
785
+ var SidebarBottomSection = ({ user, onLogout, onAccountClick }) => {
786
+ const { isCollapsed } = useSidebar();
787
+ const rootRef = useRef(null);
788
+ useLayoutEffect(() => {
789
+ const el = rootRef.current;
790
+ if (!el) return;
791
+ const update = () => {
792
+ document.documentElement.style.setProperty(BOTTOM_SECTION_HEIGHT_VAR, `${el.offsetHeight}px`);
793
+ };
794
+ update();
795
+ const observer = new ResizeObserver(update);
796
+ observer.observe(el);
797
+ return () => {
798
+ observer.disconnect();
799
+ document.documentElement.style.removeProperty(BOTTOM_SECTION_HEIGHT_VAR);
800
+ };
801
+ }, [user]);
802
+ if (!user) {
803
+ return null;
804
+ }
805
+ return /* @__PURE__ */ jsx(
806
+ "div",
807
+ {
808
+ ref: rootRef,
809
+ style: {
810
+ padding: "var(--mantine-spacing-sm)",
811
+ borderTop: "1px solid var(--color-border)",
812
+ transition: `padding ${sidebarTransitionDuration}ms var(--easing)`
813
+ },
814
+ children: /* @__PURE__ */ jsxs(Menu, { shadow: "md", width: 200, position: "top-start", offset: 8, children: [
815
+ /* @__PURE__ */ jsx(Menu.Target, { children: /* @__PURE__ */ jsx(
816
+ "div",
817
+ {
818
+ style: {
819
+ borderRadius: "var(--mantine-radius-xs)",
820
+ padding: "4px",
821
+ transition: "background-color var(--duration-fast)",
822
+ display: "flex",
823
+ justifyContent: "flex-start",
824
+ cursor: "pointer"
825
+ },
826
+ onMouseEnter: (e) => {
827
+ e.currentTarget.style.backgroundColor = "var(--color-surface-hover)";
828
+ },
829
+ onMouseLeave: (e) => {
830
+ e.currentTarget.style.backgroundColor = "transparent";
831
+ },
832
+ children: /* @__PURE__ */ jsxs(Group, { gap: "sm", wrap: "nowrap", children: [
833
+ /* @__PURE__ */ jsx(
834
+ Tooltip,
835
+ {
836
+ label: isCollapsed ? /* @__PURE__ */ jsxs("div", { style: { textAlign: "center" }, children: [
837
+ /* @__PURE__ */ jsx("div", { style: { fontWeight: 500 }, children: [user.firstName, user.lastName].filter(Boolean).join(" ") || user.email }),
838
+ /* @__PURE__ */ jsx("div", { style: { fontSize: "11px", opacity: 0.8 }, children: user.email })
839
+ ] }) : null,
840
+ position: "right",
841
+ offset: 12,
842
+ disabled: !isCollapsed,
843
+ children: /* @__PURE__ */ jsx(
844
+ Avatar,
845
+ {
846
+ src: user.profilePictureUrl || void 0,
847
+ radius: "xl",
848
+ size: isCollapsed ? "sm" : "md",
849
+ alt: `${user.firstName || ""} ${user.lastName || ""}`.trim(),
850
+ style: {
851
+ marginLeft: isCollapsed ? 8 : 0,
852
+ transition: `all ${sidebarTransitionDuration}ms var(--easing)`,
853
+ cursor: "pointer"
854
+ },
855
+ children: (user.firstName || user.email).charAt(0).toUpperCase()
856
+ }
857
+ )
858
+ }
859
+ ),
860
+ /* @__PURE__ */ jsxs(
861
+ Stack,
862
+ {
863
+ gap: 2,
864
+ style: {
865
+ flex: 1,
866
+ minWidth: 0,
867
+ opacity: isCollapsed ? 0 : 1,
868
+ width: isCollapsed ? 0 : "auto",
869
+ overflow: "hidden",
870
+ transition: `opacity ${sidebarTransitionDuration}ms var(--easing), width ${sidebarTransitionDuration}ms var(--easing)`
871
+ },
872
+ children: [
873
+ /* @__PURE__ */ jsx(
874
+ Text,
875
+ {
876
+ size: "sm",
877
+ fw: 500,
878
+ style: {
879
+ color: "var(--color-text)",
880
+ lineHeight: 1.2,
881
+ overflow: "hidden",
882
+ textOverflow: "ellipsis",
883
+ whiteSpace: "nowrap"
884
+ },
885
+ children: [user.firstName, user.lastName].filter(Boolean).join(" ") || user.email
886
+ }
887
+ ),
888
+ /* @__PURE__ */ jsx(
889
+ Text,
890
+ {
891
+ size: "xs",
892
+ style: {
893
+ color: "var(--color-text-subtle)",
894
+ lineHeight: 1.2,
895
+ overflow: "hidden",
896
+ textOverflow: "ellipsis",
897
+ whiteSpace: "nowrap"
898
+ },
899
+ children: user.email
900
+ }
901
+ )
902
+ ]
903
+ }
904
+ )
905
+ ] })
906
+ }
907
+ ) }),
908
+ /* @__PURE__ */ jsxs(
909
+ Menu.Dropdown,
910
+ {
911
+ style: {
912
+ background: "var(--glass-background)",
913
+ backdropFilter: "var(--glass-blur)",
914
+ WebkitBackdropFilter: "var(--glass-blur)"
915
+ },
916
+ children: [
917
+ /* @__PURE__ */ jsx(Menu.Item, { leftSection: /* @__PURE__ */ jsx(IconUser, { size: 14 }), onClick: onAccountClick, children: "Account" }),
918
+ onLogout && /* @__PURE__ */ jsx(Menu.Item, { leftSection: /* @__PURE__ */ jsx(IconLogout, { size: 14 }), onClick: onLogout, children: "Logout" })
919
+ ]
920
+ }
921
+ )
922
+ ] })
923
+ }
924
+ );
925
+ };
926
+ var SidebarMiddleSection = ({ linkElements }) => {
927
+ return /* @__PURE__ */ jsx(
928
+ ScrollArea,
929
+ {
930
+ style: {
931
+ flex: 1,
932
+ padding: sidebarSectionPadding,
933
+ transition: `padding ${sidebarTransitionDuration}ms var(--easing)`
934
+ },
935
+ children: /* @__PURE__ */ jsx("div", { style: { paddingBottom: "var(--mantine-spacing-sm)" }, children: linkElements })
936
+ }
937
+ );
938
+ };
939
+ var Sidebar = memo(function Sidebar2({
940
+ links = [],
941
+ user,
942
+ onLogout,
943
+ onAccountClick,
944
+ className = "",
945
+ logo
946
+ }) {
947
+ const { currentPath } = useRouterContext();
948
+ const { expandedGroups, toggleGroup, initializeGroups } = useSidebar();
949
+ useSidebarCollapse();
950
+ useEffect(() => {
951
+ initializeGroups(links);
952
+ }, [links, initializeGroups]);
953
+ const linkElements = links.map((item) => {
954
+ const isOpened = expandedGroups[item.label] || false;
955
+ const linkGroup = /* @__PURE__ */ createElement(
956
+ LinksGroup,
957
+ {
958
+ ...item,
959
+ key: item.label,
960
+ currentPath,
961
+ opened: isOpened,
962
+ onToggle: () => toggleGroup(item.label)
963
+ }
964
+ );
965
+ if (item.dataOnboardingTourId) {
966
+ return /* @__PURE__ */ jsx("div", { "data-onboarding-tour-id": item.dataOnboardingTourId, children: linkGroup }, item.label);
967
+ }
968
+ return linkGroup;
969
+ });
970
+ return /* @__PURE__ */ jsxs(SidebarContainer, { className, children: [
971
+ /* @__PURE__ */ jsx(SidebarTopSection, { logo }),
972
+ /* @__PURE__ */ jsx(SidebarMiddleSection, { linkElements }),
973
+ /* @__PURE__ */ jsx(SidebarBottomSection, { user, onLogout, onAccountClick })
974
+ ] });
975
+ });
976
+ var activeColor = "var(--color-primary)";
977
+ var defaultTextColor = "var(--color-text)";
978
+ var subtleColor = "var(--color-text-subtle)";
979
+ var activeBg = `color-mix(in srgb, ${activeColor} 10%, transparent)`;
980
+ var CollapsibleSidebarGroup = ({
981
+ icon: Icon,
982
+ label,
983
+ isExpanded,
984
+ onToggle,
985
+ isActive = false,
986
+ badge,
987
+ children,
988
+ onLabelClick,
989
+ emptyMessage = "No items",
990
+ isEmpty = false,
991
+ isLoading = false,
992
+ loadingComponent
993
+ }) => {
994
+ const showActiveStyle = !isExpanded && isActive;
995
+ const iconColor = showActiveStyle ? activeColor : subtleColor;
996
+ const textColor = showActiveStyle ? activeColor : defaultTextColor;
997
+ const fontWeight = showActiveStyle ? 600 : 500;
998
+ const handleLabelClick = (e) => {
999
+ if (onLabelClick) {
1000
+ e.stopPropagation();
1001
+ onLabelClick();
1002
+ }
1003
+ };
1004
+ return /* @__PURE__ */ jsxs(Box, { children: [
1005
+ /* @__PURE__ */ jsx(
1006
+ UnstyledButton,
1007
+ {
1008
+ onClick: onToggle,
1009
+ style: {
1010
+ display: "flex",
1011
+ alignItems: "center",
1012
+ width: "100%",
1013
+ padding: "var(--mantine-spacing-xs)",
1014
+ color: textColor,
1015
+ backgroundColor: showActiveStyle ? activeBg : "transparent",
1016
+ transition: `all var(--duration-fast) var(--easing)`,
1017
+ cursor: "pointer",
1018
+ overflow: "hidden"
1019
+ },
1020
+ onMouseEnter: (e) => {
1021
+ if (!showActiveStyle) {
1022
+ e.currentTarget.style.backgroundColor = "var(--color-surface-hover)";
1023
+ }
1024
+ },
1025
+ onMouseLeave: (e) => {
1026
+ if (!showActiveStyle) {
1027
+ e.currentTarget.style.backgroundColor = "transparent";
1028
+ }
1029
+ },
1030
+ children: /* @__PURE__ */ jsxs(Group, { gap: "xs", wrap: "nowrap", style: { width: "100%" }, children: [
1031
+ /* @__PURE__ */ jsx(Box, { style: { flexShrink: 0, color: iconColor }, children: isExpanded ? /* @__PURE__ */ jsx(IconChevronDown, { size: sidebarGroupChevronSize }) : /* @__PURE__ */ jsx(IconChevronRight, { size: sidebarGroupChevronSize }) }),
1032
+ /* @__PURE__ */ jsx(
1033
+ Box,
1034
+ {
1035
+ style: { flexShrink: 0, color: iconColor, cursor: onLabelClick ? "pointer" : "inherit" },
1036
+ onClick: onLabelClick ? handleLabelClick : void 0,
1037
+ children: /* @__PURE__ */ jsx(Icon, { size: sidebarIconInnerSize, color: activeColor })
1038
+ }
1039
+ ),
1040
+ /* @__PURE__ */ jsx(
1041
+ Text,
1042
+ {
1043
+ size: "sm",
1044
+ fw: fontWeight,
1045
+ style: {
1046
+ fontFamily: "var(--elevasis-font-family-subtitle)",
1047
+ color: textColor,
1048
+ transition: `color var(--duration-fast) var(--easing)`,
1049
+ overflow: "hidden",
1050
+ textOverflow: "ellipsis",
1051
+ whiteSpace: "nowrap",
1052
+ flex: 1,
1053
+ cursor: onLabelClick ? "pointer" : "inherit"
1054
+ },
1055
+ onClick: onLabelClick ? handleLabelClick : void 0,
1056
+ children: label
1057
+ }
1058
+ ),
1059
+ badge && /* @__PURE__ */ jsx(Box, { style: { flexShrink: 0 }, children: badge })
1060
+ ] })
1061
+ }
1062
+ ),
1063
+ /* @__PURE__ */ jsx(Collapse, { in: isExpanded, children: /* @__PURE__ */ jsx(
1064
+ Stack,
1065
+ {
1066
+ gap: 0,
1067
+ mt: "xs",
1068
+ ml: "xs",
1069
+ style: {
1070
+ borderLeft: `1px solid color-mix(in srgb, var(--color-primary) 40%, transparent)`,
1071
+ marginLeft: "calc(var(--mantine-spacing-xs) + 6px)",
1072
+ paddingLeft: "calc(var(--mantine-spacing-xs) - 2px)"
1073
+ },
1074
+ children: isLoading ? loadingComponent : isEmpty ? /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", style: { padding: "6px 8px" }, children: emptyMessage }) : children
1075
+ }
1076
+ ) })
1077
+ ] });
1078
+ };
1079
+ var SubshellNavList = ({ items }) => {
1080
+ const { currentPath, navigate } = useRouterContext();
1081
+ return /* @__PURE__ */ jsx(Fragment, { children: items.map((item) => {
1082
+ const isActive = item.exact ? currentPath === item.to || currentPath === `${item.to}/` : currentPath.startsWith(item.to);
1083
+ return /* @__PURE__ */ jsx(
1084
+ SubshellNavItem,
1085
+ {
1086
+ icon: item.icon,
1087
+ label: item.label,
1088
+ isActive,
1089
+ href: item.to,
1090
+ onClick: () => navigate(item.to)
1091
+ },
1092
+ item.to
1093
+ );
1094
+ }) });
1095
+ };
1096
+
1097
+ // src/components/layout/sub-shell/constants.ts
1098
+ var subsidebarWidth = 200;
1099
+ var TopbarContainer = ({ children }) => {
1100
+ const { isCollapsed } = useSidebar();
1101
+ const actualSidebarWidth = isCollapsed ? sidebarCollapsedWidth : sidebarWidth;
1102
+ return /* @__PURE__ */ jsx(
1103
+ "div",
1104
+ {
1105
+ style: {
1106
+ position: "fixed",
1107
+ top: 0,
1108
+ left: `${actualSidebarWidth}px`,
1109
+ height: `${topbarHeight}px`,
1110
+ width: `calc(100% - ${actualSidebarWidth}px)`,
1111
+ backgroundColor: "var(--glass-background)",
1112
+ backdropFilter: "var(--glass-blur)",
1113
+ WebkitBackdropFilter: "var(--glass-blur)",
1114
+ borderBottom: "1px solid var(--color-border)",
1115
+ boxShadow: "var(--card-shadow)",
1116
+ clipPath: "inset(-100px -100px -100px 0)",
1117
+ padding: "var(--mantine-spacing-sm)",
1118
+ display: "flex",
1119
+ alignItems: "center",
1120
+ justifyContent: "space-between",
1121
+ zIndex: 100,
1122
+ // Add transition to match sidebar animation
1123
+ transition: `left ${sidebarTransitionDuration}ms var(--easing), width ${sidebarTransitionDuration}ms var(--easing)`
1124
+ },
1125
+ children
1126
+ }
1127
+ );
1128
+ };
1129
+ var Topbar = ({ version, leftContent, children }) => {
1130
+ const { colorScheme, toggleColorScheme } = useMantineColorScheme();
1131
+ const isDark = colorScheme === "dark";
1132
+ const [switchChecked, setSwitchChecked] = useState(isDark);
1133
+ const [isToggling, setIsToggling] = useState(false);
1134
+ useEffect(() => {
1135
+ if (!isToggling) {
1136
+ setSwitchChecked(isDark);
1137
+ }
1138
+ }, [isDark, isToggling]);
1139
+ const handleSwitchToggle = (event) => {
1140
+ const checked = event.currentTarget.checked;
1141
+ setIsToggling(true);
1142
+ toggleColorScheme();
1143
+ setTimeout(() => {
1144
+ setSwitchChecked(checked);
1145
+ setTimeout(() => {
1146
+ setIsToggling(false);
1147
+ }, 200);
1148
+ }, 10);
1149
+ };
1150
+ return /* @__PURE__ */ jsxs(TopbarContainer, { children: [
1151
+ leftContent,
1152
+ /* @__PURE__ */ jsxs(Group, { gap: "sm", children: [
1153
+ children,
1154
+ /* @__PURE__ */ jsx(
1155
+ Switch,
1156
+ {
1157
+ size: "md",
1158
+ checked: switchChecked,
1159
+ onChange: handleSwitchToggle,
1160
+ onLabel: /* @__PURE__ */ jsx(IconSun, { size: 16, stroke: 2.5, color: "var(--mantine-color-yellow-4)" }),
1161
+ offLabel: /* @__PURE__ */ jsx(IconMoonStars, { size: 16, stroke: 2.5, color: "var(--mantine-color-blue-6)" }),
1162
+ styles: {
1163
+ track: {
1164
+ backgroundColor: "var(--color-surface-hover)",
1165
+ borderColor: "var(--color-border)"
1166
+ }
1167
+ }
1168
+ }
1169
+ ),
1170
+ /* @__PURE__ */ jsx(
1171
+ Code,
1172
+ {
1173
+ style: {
1174
+ backgroundColor: "var(--color-surface)",
1175
+ color: "var(--color-text)",
1176
+ fontSize: "var(--mantine-font-size-xs)",
1177
+ fontWeight: 700,
1178
+ padding: "2px 6px",
1179
+ borderRadius: "var(--mantine-radius-xs)",
1180
+ border: "1px solid var(--color-border)"
1181
+ },
1182
+ children: version
1183
+ }
1184
+ )
1185
+ ] })
1186
+ ] });
1187
+ };
1188
+ function TopbarActions({ isPlatformAdmin, isDev }) {
1189
+ const { getTopbarActions } = useElevasisSystems();
1190
+ const actions = getTopbarActions({ isPlatformAdmin, isDev });
1191
+ return /* @__PURE__ */ jsx(Fragment, { children: actions.map(({ node, render }) => /* @__PURE__ */ jsx(Fragment$1, { children: render({ node }) }, node.id)) });
1192
+ }
1193
+
1194
+ export { AppShellContainer, AppShellContentContainer, AppShellRightSideContainer, AppShellRightSideOuterContainer, AppTopbarAdjusterWrapper, CollapsibleSidebarGroup, CyberParticles, LinksGroup, Sidebar, SidebarContext, SidebarProvider, SubshellNavList, Topbar, TopbarActions, TopbarContainer, Vignette, subsidebarWidth, useSidebar, useSidebarCollapse };