@vuu-ui/vuu-shell 0.13.7 → 0.13.9

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 (225) hide show
  1. package/cjs/index.js +2826 -77
  2. package/cjs/index.js.map +1 -1
  3. package/esm/index.js +2780 -27
  4. package/esm/index.js.map +1 -1
  5. package/package.json +13 -13
  6. package/cjs/ShellContextProvider.js +0 -25
  7. package/cjs/ShellContextProvider.js.map +0 -1
  8. package/cjs/app-header/AppHeader.css.js +0 -6
  9. package/cjs/app-header/AppHeader.css.js.map +0 -1
  10. package/cjs/app-header/AppHeader.js +0 -85
  11. package/cjs/app-header/AppHeader.js.map +0 -1
  12. package/cjs/app-status-bar/AppStatusBar.css.js +0 -6
  13. package/cjs/app-status-bar/AppStatusBar.css.js.map +0 -1
  14. package/cjs/app-status-bar/AppStatusBar.js +0 -47
  15. package/cjs/app-status-bar/AppStatusBar.js.map +0 -1
  16. package/cjs/application-provider/ApplicationContext.js +0 -18
  17. package/cjs/application-provider/ApplicationContext.js.map +0 -1
  18. package/cjs/application-provider/ApplicationProvider.js +0 -104
  19. package/cjs/application-provider/ApplicationProvider.js.map +0 -1
  20. package/cjs/connection-status/ConnectionRetryCountdown.js +0 -36
  21. package/cjs/connection-status/ConnectionRetryCountdown.js.map +0 -1
  22. package/cjs/connection-status/ConnectionStateDisplay.css.js +0 -6
  23. package/cjs/connection-status/ConnectionStateDisplay.css.js.map +0 -1
  24. package/cjs/connection-status/ConnectionStateDisplay.js +0 -65
  25. package/cjs/connection-status/ConnectionStateDisplay.js.map +0 -1
  26. package/cjs/connection-status/ConnectionStatusIndicator.css.js +0 -6
  27. package/cjs/connection-status/ConnectionStatusIndicator.css.js.map +0 -1
  28. package/cjs/connection-status/ConnectionStatusIndicator.js +0 -81
  29. package/cjs/connection-status/ConnectionStatusIndicator.js.map +0 -1
  30. package/cjs/feature/Feature.js +0 -55
  31. package/cjs/feature/Feature.js.map +0 -1
  32. package/cjs/feature/FeatureErrorBoundary.js +0 -30
  33. package/cjs/feature/FeatureErrorBoundary.js.map +0 -1
  34. package/cjs/feature/Loader.js +0 -8
  35. package/cjs/feature/Loader.js.map +0 -1
  36. package/cjs/feature-and-layout-provider/FeatureAndLayoutProvider.js +0 -60
  37. package/cjs/feature-and-layout-provider/FeatureAndLayoutProvider.js.map +0 -1
  38. package/cjs/feature-list/FeatureList.css.js +0 -6
  39. package/cjs/feature-list/FeatureList.css.js.map +0 -1
  40. package/cjs/feature-list/FeatureList.js +0 -97
  41. package/cjs/feature-list/FeatureList.js.map +0 -1
  42. package/cjs/left-nav/LeftNav.css.js +0 -6
  43. package/cjs/left-nav/LeftNav.css.js.map +0 -1
  44. package/cjs/left-nav/LeftNav.js +0 -199
  45. package/cjs/left-nav/LeftNav.js.map +0 -1
  46. package/cjs/login/LoginPanel.css.js +0 -6
  47. package/cjs/login/LoginPanel.css.js.map +0 -1
  48. package/cjs/login/LoginPanel.js +0 -108
  49. package/cjs/login/LoginPanel.js.map +0 -1
  50. package/cjs/login/VuuLogo.js +0 -134
  51. package/cjs/login/VuuLogo.js.map +0 -1
  52. package/cjs/login/login-utils.js +0 -31
  53. package/cjs/login/login-utils.js.map +0 -1
  54. package/cjs/persistence-manager/LocalPersistenceManager.js +0 -197
  55. package/cjs/persistence-manager/LocalPersistenceManager.js.map +0 -1
  56. package/cjs/persistence-manager/PersistenceProvider.js +0 -21
  57. package/cjs/persistence-manager/PersistenceProvider.js.map +0 -1
  58. package/cjs/persistence-manager/RemotePersistenceManager.js +0 -175
  59. package/cjs/persistence-manager/RemotePersistenceManager.js.map +0 -1
  60. package/cjs/persistence-manager/StaticPersistenceManager.js +0 -71
  61. package/cjs/persistence-manager/StaticPersistenceManager.js.map +0 -1
  62. package/cjs/shell-layout-templates/context-panel/ContextPanel.css.js +0 -6
  63. package/cjs/shell-layout-templates/context-panel/ContextPanel.css.js.map +0 -1
  64. package/cjs/shell-layout-templates/context-panel/ContextPanel.js +0 -94
  65. package/cjs/shell-layout-templates/context-panel/ContextPanel.js.map +0 -1
  66. package/cjs/shell-layout-templates/full-height-left-panel/useFullHeightLeftPanel.js +0 -53
  67. package/cjs/shell-layout-templates/full-height-left-panel/useFullHeightLeftPanel.js.map +0 -1
  68. package/cjs/shell-layout-templates/inlay-left-panel/useInlayLeftPanel.js +0 -83
  69. package/cjs/shell-layout-templates/inlay-left-panel/useInlayLeftPanel.js.map +0 -1
  70. package/cjs/shell-layout-templates/left-main-tabs/useLeftMainTabs.js +0 -46
  71. package/cjs/shell-layout-templates/left-main-tabs/useLeftMainTabs.js.map +0 -1
  72. package/cjs/shell-layout-templates/side-panel/SidePanel.css.js +0 -6
  73. package/cjs/shell-layout-templates/side-panel/SidePanel.css.js.map +0 -1
  74. package/cjs/shell-layout-templates/side-panel/SidePanel.js +0 -36
  75. package/cjs/shell-layout-templates/side-panel/SidePanel.js.map +0 -1
  76. package/cjs/shell-layout-templates/simple-content-pane/useSimpleContentPane.js +0 -48
  77. package/cjs/shell-layout-templates/simple-content-pane/useSimpleContentPane.js.map +0 -1
  78. package/cjs/shell-layout-templates/useShellLayout.js +0 -23
  79. package/cjs/shell-layout-templates/useShellLayout.js.map +0 -1
  80. package/cjs/shell.css.js +0 -6
  81. package/cjs/shell.css.js.map +0 -1
  82. package/cjs/shell.js +0 -161
  83. package/cjs/shell.js.map +0 -1
  84. package/cjs/theme-switch/ThemeSwitch.css.js +0 -6
  85. package/cjs/theme-switch/ThemeSwitch.css.js.map +0 -1
  86. package/cjs/theme-switch/ThemeSwitch.js +0 -56
  87. package/cjs/theme-switch/ThemeSwitch.js.map +0 -1
  88. package/cjs/user-settings/SettingsForm.css.js +0 -6
  89. package/cjs/user-settings/SettingsForm.css.js.map +0 -1
  90. package/cjs/user-settings/SettingsForm.js +0 -168
  91. package/cjs/user-settings/SettingsForm.js.map +0 -1
  92. package/cjs/user-settings/UserSettingsPanel.css.js +0 -6
  93. package/cjs/user-settings/UserSettingsPanel.css.js.map +0 -1
  94. package/cjs/user-settings/UserSettingsPanel.js +0 -42
  95. package/cjs/user-settings/UserSettingsPanel.js.map +0 -1
  96. package/cjs/workspace-management/LayoutList.css.js +0 -6
  97. package/cjs/workspace-management/LayoutList.css.js.map +0 -1
  98. package/cjs/workspace-management/LayoutList.js +0 -116
  99. package/cjs/workspace-management/LayoutList.js.map +0 -1
  100. package/cjs/workspace-management/LayoutTile.css.js +0 -6
  101. package/cjs/workspace-management/LayoutTile.css.js.map +0 -1
  102. package/cjs/workspace-management/LayoutTile.js +0 -41
  103. package/cjs/workspace-management/LayoutTile.js.map +0 -1
  104. package/cjs/workspace-management/SaveLayoutPanel.css.js +0 -6
  105. package/cjs/workspace-management/SaveLayoutPanel.css.js.map +0 -1
  106. package/cjs/workspace-management/SaveLayoutPanel.js +0 -129
  107. package/cjs/workspace-management/SaveLayoutPanel.js.map +0 -1
  108. package/cjs/workspace-management/WorkspaceProvider.js +0 -264
  109. package/cjs/workspace-management/WorkspaceProvider.js.map +0 -1
  110. package/cjs/workspace-management/defaultWorkspaceJSON.js +0 -101
  111. package/cjs/workspace-management/defaultWorkspaceJSON.js.map +0 -1
  112. package/cjs/workspace-management/screenshot-utils.js +0 -25
  113. package/cjs/workspace-management/screenshot-utils.js.map +0 -1
  114. package/cjs/workspace-management/useWorkspaceContextMenuItems.js +0 -72
  115. package/cjs/workspace-management/useWorkspaceContextMenuItems.js.map +0 -1
  116. package/esm/ShellContextProvider.js +0 -23
  117. package/esm/ShellContextProvider.js.map +0 -1
  118. package/esm/app-header/AppHeader.css.js +0 -4
  119. package/esm/app-header/AppHeader.css.js.map +0 -1
  120. package/esm/app-header/AppHeader.js +0 -83
  121. package/esm/app-header/AppHeader.js.map +0 -1
  122. package/esm/app-status-bar/AppStatusBar.css.js +0 -4
  123. package/esm/app-status-bar/AppStatusBar.css.js.map +0 -1
  124. package/esm/app-status-bar/AppStatusBar.js +0 -45
  125. package/esm/app-status-bar/AppStatusBar.js.map +0 -1
  126. package/esm/application-provider/ApplicationContext.js +0 -16
  127. package/esm/application-provider/ApplicationContext.js.map +0 -1
  128. package/esm/application-provider/ApplicationProvider.js +0 -98
  129. package/esm/application-provider/ApplicationProvider.js.map +0 -1
  130. package/esm/connection-status/ConnectionRetryCountdown.js +0 -34
  131. package/esm/connection-status/ConnectionRetryCountdown.js.map +0 -1
  132. package/esm/connection-status/ConnectionStateDisplay.css.js +0 -4
  133. package/esm/connection-status/ConnectionStateDisplay.css.js.map +0 -1
  134. package/esm/connection-status/ConnectionStateDisplay.js +0 -63
  135. package/esm/connection-status/ConnectionStateDisplay.js.map +0 -1
  136. package/esm/connection-status/ConnectionStatusIndicator.css.js +0 -4
  137. package/esm/connection-status/ConnectionStatusIndicator.css.js.map +0 -1
  138. package/esm/connection-status/ConnectionStatusIndicator.js +0 -79
  139. package/esm/connection-status/ConnectionStatusIndicator.js.map +0 -1
  140. package/esm/feature/Feature.js +0 -53
  141. package/esm/feature/Feature.js.map +0 -1
  142. package/esm/feature/FeatureErrorBoundary.js +0 -28
  143. package/esm/feature/FeatureErrorBoundary.js.map +0 -1
  144. package/esm/feature/Loader.js +0 -6
  145. package/esm/feature/Loader.js.map +0 -1
  146. package/esm/feature-and-layout-provider/FeatureAndLayoutProvider.js +0 -56
  147. package/esm/feature-and-layout-provider/FeatureAndLayoutProvider.js.map +0 -1
  148. package/esm/feature-list/FeatureList.css.js +0 -4
  149. package/esm/feature-list/FeatureList.css.js.map +0 -1
  150. package/esm/feature-list/FeatureList.js +0 -95
  151. package/esm/feature-list/FeatureList.js.map +0 -1
  152. package/esm/left-nav/LeftNav.css.js +0 -4
  153. package/esm/left-nav/LeftNav.css.js.map +0 -1
  154. package/esm/left-nav/LeftNav.js +0 -197
  155. package/esm/left-nav/LeftNav.js.map +0 -1
  156. package/esm/login/LoginPanel.css.js +0 -4
  157. package/esm/login/LoginPanel.css.js.map +0 -1
  158. package/esm/login/LoginPanel.js +0 -106
  159. package/esm/login/LoginPanel.js.map +0 -1
  160. package/esm/login/VuuLogo.js +0 -132
  161. package/esm/login/VuuLogo.js.map +0 -1
  162. package/esm/login/login-utils.js +0 -26
  163. package/esm/login/login-utils.js.map +0 -1
  164. package/esm/persistence-manager/LocalPersistenceManager.js +0 -195
  165. package/esm/persistence-manager/LocalPersistenceManager.js.map +0 -1
  166. package/esm/persistence-manager/PersistenceProvider.js +0 -17
  167. package/esm/persistence-manager/PersistenceProvider.js.map +0 -1
  168. package/esm/persistence-manager/RemotePersistenceManager.js +0 -173
  169. package/esm/persistence-manager/RemotePersistenceManager.js.map +0 -1
  170. package/esm/persistence-manager/StaticPersistenceManager.js +0 -69
  171. package/esm/persistence-manager/StaticPersistenceManager.js.map +0 -1
  172. package/esm/shell-layout-templates/context-panel/ContextPanel.css.js +0 -4
  173. package/esm/shell-layout-templates/context-panel/ContextPanel.css.js.map +0 -1
  174. package/esm/shell-layout-templates/context-panel/ContextPanel.js +0 -92
  175. package/esm/shell-layout-templates/context-panel/ContextPanel.js.map +0 -1
  176. package/esm/shell-layout-templates/full-height-left-panel/useFullHeightLeftPanel.js +0 -51
  177. package/esm/shell-layout-templates/full-height-left-panel/useFullHeightLeftPanel.js.map +0 -1
  178. package/esm/shell-layout-templates/inlay-left-panel/useInlayLeftPanel.js +0 -81
  179. package/esm/shell-layout-templates/inlay-left-panel/useInlayLeftPanel.js.map +0 -1
  180. package/esm/shell-layout-templates/left-main-tabs/useLeftMainTabs.js +0 -44
  181. package/esm/shell-layout-templates/left-main-tabs/useLeftMainTabs.js.map +0 -1
  182. package/esm/shell-layout-templates/side-panel/SidePanel.css.js +0 -4
  183. package/esm/shell-layout-templates/side-panel/SidePanel.css.js.map +0 -1
  184. package/esm/shell-layout-templates/side-panel/SidePanel.js +0 -34
  185. package/esm/shell-layout-templates/side-panel/SidePanel.js.map +0 -1
  186. package/esm/shell-layout-templates/simple-content-pane/useSimpleContentPane.js +0 -46
  187. package/esm/shell-layout-templates/simple-content-pane/useSimpleContentPane.js.map +0 -1
  188. package/esm/shell-layout-templates/useShellLayout.js +0 -21
  189. package/esm/shell-layout-templates/useShellLayout.js.map +0 -1
  190. package/esm/shell.css.js +0 -4
  191. package/esm/shell.css.js.map +0 -1
  192. package/esm/shell.js +0 -159
  193. package/esm/shell.js.map +0 -1
  194. package/esm/theme-switch/ThemeSwitch.css.js +0 -4
  195. package/esm/theme-switch/ThemeSwitch.css.js.map +0 -1
  196. package/esm/theme-switch/ThemeSwitch.js +0 -54
  197. package/esm/theme-switch/ThemeSwitch.js.map +0 -1
  198. package/esm/user-settings/SettingsForm.css.js +0 -4
  199. package/esm/user-settings/SettingsForm.css.js.map +0 -1
  200. package/esm/user-settings/SettingsForm.js +0 -162
  201. package/esm/user-settings/SettingsForm.js.map +0 -1
  202. package/esm/user-settings/UserSettingsPanel.css.js +0 -4
  203. package/esm/user-settings/UserSettingsPanel.css.js.map +0 -1
  204. package/esm/user-settings/UserSettingsPanel.js +0 -40
  205. package/esm/user-settings/UserSettingsPanel.js.map +0 -1
  206. package/esm/workspace-management/LayoutList.css.js +0 -4
  207. package/esm/workspace-management/LayoutList.css.js.map +0 -1
  208. package/esm/workspace-management/LayoutList.js +0 -114
  209. package/esm/workspace-management/LayoutList.js.map +0 -1
  210. package/esm/workspace-management/LayoutTile.css.js +0 -4
  211. package/esm/workspace-management/LayoutTile.css.js.map +0 -1
  212. package/esm/workspace-management/LayoutTile.js +0 -39
  213. package/esm/workspace-management/LayoutTile.js.map +0 -1
  214. package/esm/workspace-management/SaveLayoutPanel.css.js +0 -4
  215. package/esm/workspace-management/SaveLayoutPanel.css.js.map +0 -1
  216. package/esm/workspace-management/SaveLayoutPanel.js +0 -127
  217. package/esm/workspace-management/SaveLayoutPanel.js.map +0 -1
  218. package/esm/workspace-management/WorkspaceProvider.js +0 -261
  219. package/esm/workspace-management/WorkspaceProvider.js.map +0 -1
  220. package/esm/workspace-management/defaultWorkspaceJSON.js +0 -95
  221. package/esm/workspace-management/defaultWorkspaceJSON.js.map +0 -1
  222. package/esm/workspace-management/screenshot-utils.js +0 -23
  223. package/esm/workspace-management/screenshot-utils.js.map +0 -1
  224. package/esm/workspace-management/useWorkspaceContextMenuItems.js +0 -70
  225. package/esm/workspace-management/useWorkspaceContextMenuItems.js.map +0 -1
package/cjs/index.js CHANGED
@@ -1,80 +1,2829 @@
1
1
  'use strict';
2
2
 
3
- var ApplicationProvider = require('./application-provider/ApplicationProvider.js');
4
- var AppHeader = require('./app-header/AppHeader.js');
5
- var ConnectionStateDisplay = require('./connection-status/ConnectionStateDisplay.js');
6
- var ConnectionStatusIndicator = require('./connection-status/ConnectionStatusIndicator.js');
7
- var Feature = require('./feature/Feature.js');
8
- var FeatureAndLayoutProvider = require('./feature-and-layout-provider/FeatureAndLayoutProvider.js');
9
- var LeftNav = require('./left-nav/LeftNav.js');
10
- var LoginPanel = require('./login/LoginPanel.js');
11
- var loginUtils = require('./login/login-utils.js');
12
- var PersistenceProvider = require('./persistence-manager/PersistenceProvider.js');
13
- var LocalPersistenceManager = require('./persistence-manager/LocalPersistenceManager.js');
14
- var RemotePersistenceManager = require('./persistence-manager/RemotePersistenceManager.js');
15
- var StaticPersistenceManager = require('./persistence-manager/StaticPersistenceManager.js');
16
- var shell = require('./shell.js');
17
- var ContextPanel = require('./shell-layout-templates/context-panel/ContextPanel.js');
18
- var useShellLayout = require('./shell-layout-templates/useShellLayout.js');
19
- var SidePanel = require('./shell-layout-templates/side-panel/SidePanel.js');
20
- var ShellContextProvider = require('./ShellContextProvider.js');
21
- var FeatureList = require('./feature-list/FeatureList.js');
22
- var ThemeSwitch = require('./theme-switch/ThemeSwitch.js');
23
- var UserSettingsPanel = require('./user-settings/UserSettingsPanel.js');
24
- var SettingsForm = require('./user-settings/SettingsForm.js');
25
- var SaveLayoutPanel = require('./workspace-management/SaveLayoutPanel.js');
26
- var LayoutList = require('./workspace-management/LayoutList.js');
27
- var WorkspaceProvider = require('./workspace-management/WorkspaceProvider.js');
28
- var defaultWorkspaceJSON = require('./workspace-management/defaultWorkspaceJSON.js');
29
- var useWorkspaceContextMenuItems = require('./workspace-management/useWorkspaceContextMenuItems.js');
30
-
31
-
32
-
33
- exports.ApplicationProvider = ApplicationProvider.ApplicationProvider;
34
- exports.useApplicationSettings = ApplicationProvider.useApplicationSettings;
35
- exports.useApplicationUser = ApplicationProvider.useApplicationUser;
36
- exports.useLoginUrl = ApplicationProvider.useLoginUrl;
37
- exports.useUserSetting = ApplicationProvider.useUserSetting;
38
- exports.AppHeader = AppHeader.AppHeader;
39
- exports.ConnectionStateDisplay = ConnectionStateDisplay.ConnectionStateDisplay;
40
- exports.ConnectionStatusIndicator = ConnectionStatusIndicator.ConnectionStatusIndicator;
41
- exports.Feature = Feature.Feature;
42
- exports.FeatureAndLayoutProvider = FeatureAndLayoutProvider.FeatureAndLayoutProvider;
43
- exports.useFeatures = FeatureAndLayoutProvider.useFeatures;
44
- exports.useLayouts = FeatureAndLayoutProvider.useLayouts;
45
- exports.LeftNav = LeftNav.LeftNav;
46
- exports.LoginPanel = LoginPanel.LoginPanel;
47
- exports.getAuthDetailsFromCookies = loginUtils.getAuthDetailsFromCookies;
48
- exports.getAuthModeFromCookies = loginUtils.getAuthModeFromCookies;
49
- exports.logout = loginUtils.logout;
50
- exports.redirectToLogin = loginUtils.redirectToLogin;
51
- exports.PersistenceContext = PersistenceProvider.PersistenceContext;
52
- exports.PersistenceProvider = PersistenceProvider.PersistenceProvider;
53
- exports.usePersistenceManager = PersistenceProvider.usePersistenceManager;
54
- exports.LocalPersistenceManager = LocalPersistenceManager.LocalPersistenceManager;
55
- exports.RemotePersistenceManager = RemotePersistenceManager.RemotePersistenceManager;
56
- exports.StaticPersistenceManager = StaticPersistenceManager.StaticPersistenceManager;
57
- exports.Shell = shell.Shell;
58
- exports.ContextPanel = ContextPanel.ContextPanel;
59
- exports.useShellLayout = useShellLayout.useShellLayout;
60
- exports.SidePanel = SidePanel.SidePanel;
61
- exports.ShellContextProvider = ShellContextProvider.ShellContextProvider;
62
- exports.FeatureList = FeatureList.FeatureList;
63
- exports.ThemeSwitch = ThemeSwitch.ThemeSwitch;
64
- exports.UserSettingsPanel = UserSettingsPanel.UserSettingsPanel;
65
- exports.FormControl = SettingsForm.FormControl;
66
- exports.SettingsForm = SettingsForm.SettingsForm;
67
- exports.isBooleanProperty = SettingsForm.isBooleanProperty;
68
- exports.isOption = SettingsForm.isOption;
69
- exports.isStringOrNumber = SettingsForm.isStringOrNumber;
70
- exports.SaveLayoutPanel = SaveLayoutPanel.SaveLayoutPanel;
71
- exports.LayoutList = LayoutList.LayoutList;
72
- exports.WorkspaceProvider = WorkspaceProvider.WorkspaceProvider;
73
- exports.useWorkspace = WorkspaceProvider.useWorkspace;
74
- exports.defaultWorkspaceJSON = defaultWorkspaceJSON.defaultWorkspaceJSON;
75
- exports.getStackWorkspaceJSON = defaultWorkspaceJSON.getStackWorkspaceJSON;
76
- exports.getWorkspaceWithLayoutJSON = defaultWorkspaceJSON.getWorkspaceWithLayoutJSON;
77
- exports.loadingJSON = defaultWorkspaceJSON.loadingJSON;
78
- exports.warningLayout = defaultWorkspaceJSON.warningLayout;
79
- exports.useWorkspaceContextMenuItems = useWorkspaceContextMenuItems.useWorkspaceContextMenuItems;
3
+ var jsxRuntime = require('react/jsx-runtime');
4
+ var core = require('@salt-ds/core');
5
+ var React = require('react');
6
+ var vuuUtils = require('@vuu-ui/vuu-utils');
7
+ var vuuUiControls = require('@vuu-ui/vuu-ui-controls');
8
+ var styles = require('@salt-ds/styles');
9
+ var window$1 = require('@salt-ds/window');
10
+ var cx = require('clsx');
11
+ var vuuLayout = require('@vuu-ui/vuu-layout');
12
+ var vuuDataRemote = require('@vuu-ui/vuu-data-remote');
13
+ var vuuDataReact = require('@vuu-ui/vuu-data-react');
14
+ var vuuIcons = require('@vuu-ui/vuu-icons');
15
+ var htmlToImage = require('html-to-image');
16
+ var vuuPopups = require('@vuu-ui/vuu-popups');
17
+ var vuuContextMenu = require('@vuu-ui/vuu-context-menu');
18
+
19
+ const Guest = {
20
+ username: "unknown",
21
+ token: ""
22
+ };
23
+ const ApplicationContext = React.createContext({
24
+ onUserSettingChanged: (propertyName) => console.warn(
25
+ `Cannot change setting '${propertyName}'.
26
+ Did you forget to declare an ApplicationProvider ?`
27
+ ),
28
+ user: Guest
29
+ });
30
+
31
+ const PersistenceContext = React.createContext({});
32
+ const PersistenceProvider = ({
33
+ children,
34
+ persistenceManager
35
+ }) => {
36
+ return /* @__PURE__ */ jsxRuntime.jsx(PersistenceContext.Provider, { value: { persistenceManager }, children });
37
+ };
38
+ const usePersistenceManager = () => {
39
+ const { persistenceManager } = React.useContext(PersistenceContext);
40
+ return persistenceManager;
41
+ };
42
+
43
+ const VuuLogo = () => {
44
+ const logo = React.useMemo(
45
+ () => /* @__PURE__ */ jsxRuntime.jsxs(
46
+ "svg",
47
+ {
48
+ width: "184",
49
+ height: "90",
50
+ viewBox: "0 0 184 90",
51
+ fill: "none",
52
+ xmlns: "http://www.w3.org/2000/svg",
53
+ children: [
54
+ /* @__PURE__ */ jsxRuntime.jsxs("g", { clipPath: "url(#clip0_1173_59965)", children: [
55
+ /* @__PURE__ */ jsxRuntime.jsx(
56
+ "path",
57
+ {
58
+ d: "M77.0775 31.1019L69.4572 15.1795L66.3997 13.7093L47.6353 44.165L75.7224 61.2361L81.8124 51.2694L77.0775 31.1019Z",
59
+ fill: "url(#paint0_linear_1173_59965)"
60
+ }
61
+ ),
62
+ /* @__PURE__ */ jsxRuntime.jsx(
63
+ "path",
64
+ {
65
+ d: "M82.4101 49.7431C81.0488 51.8314 79.1993 53.648 76.8897 54.9809C74.2954 56.4792 71.4601 57.194 68.6623 57.194C63.3422 57.194 58.1597 54.6188 55.0209 49.971L30.5358 7.8193L30.5232 7.84116C25.8791 0.274825 16.0118 -2.26289 8.27258 2.21011C0.411306 6.74866 -2.26753 16.7872 2.28587 24.625L35.5054 81.8189C36.9856 84.3691 39.0542 86.3668 41.4358 87.7527C41.4545 87.7652 41.4733 87.7777 41.4921 87.7902C41.5015 87.7964 41.514 87.8027 41.5234 87.8089C42.6312 88.4457 43.8079 88.942 45.0253 89.3072C45.116 89.3353 45.2099 89.3634 45.3007 89.3883C45.7388 89.5101 46.1801 89.6193 46.6276 89.7067C46.7121 89.7223 46.7966 89.7317 46.8811 89.7473C47.241 89.8097 47.604 89.8628 47.967 89.9003C48.111 89.9159 48.2549 89.9315 48.3989 89.9408C48.8151 89.9752 49.2313 89.997 49.6507 90.0001C49.6726 90.0001 49.6945 90.0001 49.7132 90.0001C49.7195 90.0001 49.7226 90.0001 49.7289 90.0001C49.7352 90.0001 49.7383 90.0001 49.7445 90.0001C50.1983 90.0001 50.6552 89.9752 51.109 89.9377C51.2123 89.9283 51.3155 89.919 51.422 89.9065C51.8663 89.8597 52.3107 89.8004 52.7551 89.7192C52.7614 89.7192 52.7676 89.7192 52.7739 89.7192C53.2621 89.6287 53.7503 89.5101 54.2322 89.3727C54.2635 89.3634 54.2917 89.354 54.323 89.3446C55.024 89.1418 55.7156 88.8889 56.3978 88.5861C56.4104 88.5799 56.426 88.5736 56.4385 88.5674C56.958 88.3364 57.4712 88.0836 57.9751 87.7933C58.4852 87.4999 58.9703 87.1815 59.4334 86.8413C59.8371 86.5478 60.2252 86.2357 60.6039 85.9048C61.0639 85.499 61.4989 85.0745 61.9026 84.6282C62.2062 84.2942 62.4972 83.9446 62.7757 83.5825C62.8665 83.4639 62.951 83.3421 63.0355 83.2235C63.2264 82.9613 63.4079 82.6929 63.5831 82.4182C63.6739 82.2746 63.7646 82.1342 63.8523 81.9906C63.8867 81.9344 63.9242 81.8813 63.9555 81.8251L82.5854 49.7525H82.4039L82.4101 49.7431Z",
66
+ fill: "url(#paint1_linear_1173_59965)"
67
+ }
68
+ ),
69
+ /* @__PURE__ */ jsxRuntime.jsx(
70
+ "path",
71
+ {
72
+ d: "M82.8264 32.8436L81.4181 30.4464L75.3375 19.1687L72.5178 14.3929C71.9858 13.1225 70.7309 12.2266 69.26 12.2266C67.3104 12.2266 65.7331 13.8029 65.7331 15.7445C65.7331 16.4031 65.924 17.0086 66.2401 17.5362L66.2025 17.5611L77.1557 36.1617C78.4764 38.4372 78.83 41.0873 78.1509 43.6281C77.4718 46.169 75.8445 48.2915 73.5631 49.6119C72.0609 50.4797 70.3553 50.9385 68.6341 50.9385C65.1166 50.9385 61.84 49.0563 60.0812 46.0285L44.3368 19.2654H44.3681L37.7179 7.81917L37.7054 7.84102C37.5896 7.65061 37.455 7.47893 37.333 7.29477L37.1452 6.97326C37.1452 6.97326 37.1296 6.98262 37.1233 6.98887C34.0001 2.55332 29.0054 0.0780356 23.8512 0.0187285V0H15.3515V0.0436999C21.2881 -0.368328 27.2247 2.46593 30.5232 7.84102L30.5357 7.81917L55.0177 49.974C58.1566 54.6187 63.3422 57.197 68.6592 57.197C71.4569 57.197 74.2922 56.4853 76.8866 54.9839C79.1961 53.651 81.0425 51.8312 82.407 49.7461H82.5885L82.5259 49.8523C83.399 48.4695 84.0687 46.9462 84.5006 45.3231C85.6304 41.0904 85.042 36.6705 82.8201 32.8467L82.8264 32.8436Z",
73
+ fill: "#F37880"
74
+ }
75
+ ),
76
+ /* @__PURE__ */ jsxRuntime.jsxs("g", { opacity: "0.86", children: [
77
+ /* @__PURE__ */ jsxRuntime.jsx(
78
+ "path",
79
+ {
80
+ d: "M66.1994 17.5642L77.1526 36.1648C78.4732 38.4403 78.8269 41.0904 78.1478 43.6313C77.7347 45.1795 76.9648 46.5716 75.9133 47.7234C77.2903 46.4686 78.2823 44.8486 78.7737 43.007C79.4527 40.4661 79.0991 37.816 77.7785 35.5405L66.8253 16.94L66.8628 16.915C66.5467 16.3875 66.3558 15.7819 66.3558 15.1233C66.3558 14.3117 66.6344 13.5657 67.0975 12.9695C66.2651 13.6125 65.7299 14.6176 65.7299 15.7476C65.7299 16.4062 65.9208 17.0118 66.2369 17.5393L66.1994 17.5642Z",
81
+ fill: "white"
82
+ }
83
+ ),
84
+ /* @__PURE__ */ jsxRuntime.jsx(
85
+ "path",
86
+ {
87
+ d: "M82.5382 49.8335L82.5291 49.8487C82.5291 49.8487 82.5352 49.8365 82.5413 49.8304C82.5413 49.8304 82.5413 49.8304 82.5413 49.8335H82.5382Z",
88
+ fill: "white"
89
+ }
90
+ ),
91
+ /* @__PURE__ */ jsxRuntime.jsx(
92
+ "path",
93
+ {
94
+ d: "M77.5156 54.3596C74.9213 55.8579 72.0859 56.5727 69.2882 56.5727C63.9681 56.5727 58.7856 53.9975 55.6467 49.3497L31.1616 7.19488L31.1491 7.21673C28.9053 3.56154 25.4441 1.08626 21.5917 0H15.3515V0.0436999C21.2881 -0.368328 27.2247 2.46593 30.5232 7.84102L30.5357 7.81917L55.0177 49.974C58.1566 54.6187 63.3422 57.197 68.6592 57.197C71.4569 57.197 74.2922 56.4853 76.8866 54.9839C78.2698 54.1848 79.4809 53.2109 80.5293 52.1122C79.6311 52.9581 78.6266 53.7166 77.5125 54.3596H77.5156Z",
95
+ fill: "white"
96
+ }
97
+ )
98
+ ] })
99
+ ] }),
100
+ /* @__PURE__ */ jsxRuntime.jsx(
101
+ "path",
102
+ {
103
+ d: "M117.046 58.661C116.362 58.661 115.792 58.509 115.336 58.205C114.906 57.8757 114.551 57.3943 114.272 56.761L104.354 34.493C104.076 33.8597 104 33.3023 104.126 32.821C104.253 32.3397 104.519 31.9597 104.924 31.681C105.33 31.4023 105.811 31.263 106.368 31.263C107.103 31.263 107.648 31.4277 108.002 31.757C108.382 32.061 108.699 32.5297 108.952 33.163L117.958 54.025H116.324L125.292 33.125C125.571 32.517 125.9 32.061 126.28 31.757C126.66 31.4277 127.192 31.263 127.876 31.263C128.434 31.263 128.89 31.4023 129.244 31.681C129.624 31.9597 129.865 32.3397 129.966 32.821C130.068 33.3023 129.979 33.8597 129.7 34.493L119.782 56.761C119.504 57.3943 119.149 57.8757 118.718 58.205C118.313 58.509 117.756 58.661 117.046 58.661Z",
104
+ fill: "white"
105
+ }
106
+ ),
107
+ /* @__PURE__ */ jsxRuntime.jsx(
108
+ "path",
109
+ {
110
+ d: "M144.63 58.737C142.781 58.737 141.147 58.4963 139.728 58.015C138.335 57.5337 137.157 56.8243 136.194 55.887C135.232 54.9243 134.51 53.7337 134.028 52.315C133.547 50.8963 133.306 49.2497 133.306 47.375V33.733C133.306 32.897 133.509 32.2763 133.914 31.871C134.345 31.4657 134.953 31.263 135.738 31.263C136.524 31.263 137.119 31.4657 137.524 31.871C137.955 32.2763 138.17 32.897 138.17 33.733V47.337C138.17 49.7437 138.715 51.555 139.804 52.771C140.919 53.9617 142.528 54.557 144.63 54.557C146.733 54.557 148.329 53.9617 149.418 52.771C150.508 51.555 151.052 49.7437 151.052 47.337V33.733C151.052 32.897 151.255 32.2763 151.66 31.871C152.091 31.4657 152.699 31.263 153.484 31.263C154.244 31.263 154.827 31.4657 155.232 31.871C155.663 32.2763 155.878 32.897 155.878 33.733V47.375C155.878 49.8577 155.448 51.9477 154.586 53.645C153.75 55.3423 152.496 56.6217 150.824 57.483C149.152 58.319 147.088 58.737 144.63 58.737Z",
111
+ fill: "white"
112
+ }
113
+ ),
114
+ /* @__PURE__ */ jsxRuntime.jsx(
115
+ "path",
116
+ {
117
+ d: "M172.685 58.737C170.836 58.737 169.202 58.4963 167.783 58.015C166.39 57.5337 165.212 56.8243 164.249 55.887C163.286 54.9243 162.564 53.7337 162.083 52.315C161.602 50.8963 161.361 49.2497 161.361 47.375V33.733C161.361 32.897 161.564 32.2763 161.969 31.871C162.4 31.4657 163.008 31.263 163.793 31.263C164.578 31.263 165.174 31.4657 165.579 31.871C166.01 32.2763 166.225 32.897 166.225 33.733V47.337C166.225 49.7437 166.77 51.555 167.859 52.771C168.974 53.9617 170.582 54.557 172.685 54.557C174.788 54.557 176.384 53.9617 177.473 52.771C178.562 51.555 179.107 49.7437 179.107 47.337V33.733C179.107 32.897 179.31 32.2763 179.715 31.871C180.146 31.4657 180.754 31.263 181.539 31.263C182.299 31.263 182.882 31.4657 183.287 31.871C183.718 32.2763 183.933 32.897 183.933 33.733V47.375C183.933 49.8577 183.502 51.9477 182.641 53.645C181.805 55.3423 180.551 56.6217 178.879 57.483C177.207 58.319 175.142 58.737 172.685 58.737Z",
118
+ fill: "white"
119
+ }
120
+ ),
121
+ /* @__PURE__ */ jsxRuntime.jsxs("defs", { children: [
122
+ /* @__PURE__ */ jsxRuntime.jsxs(
123
+ "linearGradient",
124
+ {
125
+ id: "paint0_linear_1173_59965",
126
+ x1: "47.6353",
127
+ y1: "37.4727",
128
+ x2: "81.8124",
129
+ y2: "37.4727",
130
+ gradientUnits: "userSpaceOnUse",
131
+ children: [
132
+ /* @__PURE__ */ jsxRuntime.jsx("stop", { stopColor: "#4906A5" }),
133
+ /* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "1", stopColor: "#D3423A" })
134
+ ]
135
+ }
136
+ ),
137
+ /* @__PURE__ */ jsxRuntime.jsxs(
138
+ "linearGradient",
139
+ {
140
+ id: "paint1_linear_1173_59965",
141
+ x1: "0.0670626",
142
+ y1: "45.0017",
143
+ x2: "82.5916",
144
+ y2: "45.0017",
145
+ gradientUnits: "userSpaceOnUse",
146
+ children: [
147
+ /* @__PURE__ */ jsxRuntime.jsx("stop", { stopColor: "#7C06A5" }),
148
+ /* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "1", stopColor: "#D3423A" })
149
+ ]
150
+ }
151
+ ),
152
+ /* @__PURE__ */ jsxRuntime.jsx("clipPath", { id: "clip0_1173_59965", children: /* @__PURE__ */ jsxRuntime.jsx(
153
+ "rect",
154
+ {
155
+ width: "85",
156
+ height: "90",
157
+ fill: "white",
158
+ transform: "translate(0.0670471)"
159
+ }
160
+ ) })
161
+ ] })
162
+ ]
163
+ }
164
+ ),
165
+ []
166
+ );
167
+ return logo;
168
+ };
169
+
170
+ var loginPanelCss = ".vuuLoginPanel {\n --saltInput-paddingLeft: 8px;\n --login-width: 856px;\n --login-height: 550px;\n --hwTextInput-border: solid 1px #ccc;\n --hwTextInput-height: 28px;\n --hwTextInput-padding: 0 12px;\n --hwTextInput-width: 100%;\n --login-row-height: 60px;\n border-radius: 16px;\n box-shadow: 0px 24px 44px 0px rgba(0, 0, 0, 0.25);\n display: flex;\n height: var(--login-height);\n margin: 0 auto;\n width: var(--login-width);\n}\n\n.vuuLoginPanel .saltInput-primary {\n--saltInput-height: 36px;\n}\n\n.vuuLoginPanel-title {\n justify-content: center;\nfont-size: 28px;\nfont-weight: 400;\ndisplay: flex;\n}\n\n\n.vuuLoginPanel-branding {\n align-items: center;\n background-color: var(--vuu-color-purple-50);\n border-radius: 16px 0 0 16px;\n display: flex;\n flex: 0 0 368px;\n flex-direction: column;\n gap: 40px;\n justify-content: center;\n padding: 40px 100px;\n}\n\n.vuuLoginPanel-form {\n background-color: white;\n border-radius: 0 16px 16px 0px;\n display: flex;\n flex: 1 1 auto;\n flex-direction: column;\n gap: 32px;\n justify-content: center;\n padding: 0 40px;\n}\n\n.vuuLoginPanel-password {\n --vuu-icon-size: 16px;\n}\n\n.vuuLoginPanel-appName {\n color: white;\n font-size: 18px;\n font-weight: 700;\n text-transform: uppercase;\n}\n\n.vuuLoginPanel-login {\n --saltButton-height: 36px;\n --saltButton-borderRadius: 6px;\n width: 100%\n}\n\n\n";
171
+
172
+ const classBase$f = "vuuLoginPanel";
173
+ const LoginPanel = ({
174
+ appName = "Demo App",
175
+ className,
176
+ requirePassword = true,
177
+ onSubmit,
178
+ ...htmlAttributes
179
+ }) => {
180
+ const targetWindow = window$1.useWindow();
181
+ styles.useComponentCssInjection({
182
+ testId: "vuu-login-panel",
183
+ css: loginPanelCss,
184
+ window: targetWindow
185
+ });
186
+ const [username, setUserName] = React.useState("");
187
+ const [password, setPassword] = React.useState("");
188
+ const inputRef = React.useRef(null);
189
+ const login = () => {
190
+ onSubmit(username, password);
191
+ };
192
+ const handleUsername = (evt) => {
193
+ setUserName(evt.target.value);
194
+ };
195
+ const handlePassword = (evt) => {
196
+ setPassword(evt.target.value);
197
+ };
198
+ const handleCommitName = React.useCallback(() => {
199
+ if (!requirePassword) {
200
+ onSubmit(username);
201
+ }
202
+ }, [onSubmit, requirePassword, username]);
203
+ const handleCommitPassword = React.useCallback(() => {
204
+ if (username) {
205
+ onSubmit(username, password);
206
+ }
207
+ }, [onSubmit, password, username]);
208
+ const dataIsValid = username.trim() !== "" && (requirePassword === false || password.trim() !== "");
209
+ React.useEffect(() => {
210
+ console.log(`inputRef`, {
211
+ input: inputRef.current
212
+ });
213
+ inputRef.current?.focus();
214
+ }, []);
215
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { ...htmlAttributes, className: cx(classBase$f, className), children: [
216
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `${classBase$f}-branding`, children: [
217
+ /* @__PURE__ */ jsxRuntime.jsx(VuuLogo, {}),
218
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: `${classBase$f}-appName`, children: appName })
219
+ ] }),
220
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `${classBase$f}-form`, children: [
221
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: `${classBase$f}-title`, children: "Welcome Back" }),
222
+ /* @__PURE__ */ jsxRuntime.jsxs(core.FormField, { children: [
223
+ /* @__PURE__ */ jsxRuntime.jsx(core.FormFieldLabel, { children: "Username" }),
224
+ /* @__PURE__ */ jsxRuntime.jsx(
225
+ vuuUiControls.VuuInput,
226
+ {
227
+ value: username,
228
+ id: "text-username",
229
+ inputRef,
230
+ onChange: handleUsername,
231
+ onCommit: handleCommitName
232
+ }
233
+ )
234
+ ] }),
235
+ requirePassword ? /* @__PURE__ */ jsxRuntime.jsxs(core.FormField, { children: [
236
+ /* @__PURE__ */ jsxRuntime.jsx(core.FormFieldLabel, { children: "Password" }),
237
+ /* @__PURE__ */ jsxRuntime.jsx(
238
+ vuuUiControls.VuuInput,
239
+ {
240
+ className: `${classBase$f}-password`,
241
+ inputProps: {
242
+ type: "password"
243
+ },
244
+ value: password,
245
+ id: "text-password",
246
+ onChange: handlePassword,
247
+ onCommit: handleCommitPassword,
248
+ endAdornment: /* @__PURE__ */ jsxRuntime.jsx("span", { "data-icon": "eye", style: { cursor: "pointer" } })
249
+ }
250
+ )
251
+ ] }) : null,
252
+ /* @__PURE__ */ jsxRuntime.jsx(
253
+ core.Button,
254
+ {
255
+ className: `${classBase$f}-login`,
256
+ disabled: !dataIsValid,
257
+ onClick: login,
258
+ variant: "cta",
259
+ children: "Login"
260
+ }
261
+ )
262
+ ] })
263
+ ] });
264
+ };
265
+
266
+ const getAuthModeFromCookies = () => {
267
+ const mode = vuuUtils.getCookieValue("vuu-auth-mode");
268
+ return mode ?? "";
269
+ };
270
+ const getAuthDetailsFromCookies = () => {
271
+ const username = vuuUtils.getCookieValue("vuu-username");
272
+ const token = vuuUtils.getCookieValue("vuu-auth-token");
273
+ return [username, token];
274
+ };
275
+ const getDefaultLoginUrl = () => {
276
+ const authMode = getAuthModeFromCookies();
277
+ return authMode === "login" ? "login.html" : "demo.html";
278
+ };
279
+ const redirectToLogin = (loginUrl = getDefaultLoginUrl()) => {
280
+ window.location.href = loginUrl;
281
+ };
282
+ const logout = (loginUrl) => {
283
+ document.cookie = "vuu-username= ; expires = Thu, 01 Jan 1970 00:00:00 GMT";
284
+ document.cookie = "vuu-auth-token= ; expires = Thu, 01 Jan 1970 00:00:00 GMT";
285
+ redirectToLogin(loginUrl);
286
+ };
287
+
288
+ var __defProp$1 = Object.defineProperty;
289
+ var __typeError$1 = (msg) => {
290
+ throw TypeError(msg);
291
+ };
292
+ var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
293
+ var __publicField$1 = (obj, key, value) => __defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
294
+ var __accessCheck$1 = (obj, member, msg) => member.has(obj) || __typeError$1("Cannot " + msg);
295
+ var __privateGet$1 = (obj, member, getter) => (__accessCheck$1(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
296
+ var __privateAdd$1 = (obj, member, value) => member.has(obj) ? __typeError$1("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
297
+ var __privateSet$1 = (obj, member, value, setter) => (__accessCheck$1(obj, member, "write to private field"), member.set(obj, value), value);
298
+ var _username, _urlKey, _applicationJSON$1;
299
+ const baseMetadataSaveLocation = "layouts/metadata";
300
+ const baseLayoutsSaveLocation = "layouts/layouts";
301
+ class LocalPersistenceManager {
302
+ constructor(urlKey) {
303
+ __privateAdd$1(this, _username, getAuthDetailsFromCookies()[0]);
304
+ __publicField$1(this, "metadataSaveLocation", `${baseMetadataSaveLocation}/${__privateGet$1(this, _username)}`);
305
+ __publicField$1(this, "layoutsSaveLocation", `${baseLayoutsSaveLocation}/${__privateGet$1(this, _username)}`);
306
+ __privateAdd$1(this, _urlKey, `api/vui/${__privateGet$1(this, _username)}`);
307
+ __privateAdd$1(this, _applicationJSON$1);
308
+ __publicField$1(this, "loadLayouts", () => {
309
+ return new Promise((resolve) => {
310
+ const layouts = vuuUtils.getLocalEntity(this.layoutsSaveLocation);
311
+ resolve(layouts || []);
312
+ });
313
+ });
314
+ __publicField$1(this, "saveLayoutsWithMetadata", (layouts, metadata) => {
315
+ vuuUtils.saveLocalEntity(this.layoutsSaveLocation, layouts);
316
+ vuuUtils.saveLocalEntity(this.metadataSaveLocation, metadata);
317
+ });
318
+ // Ensures that there is exactly one Layout entry and exactly one Metadata
319
+ // entry in local storage corresponding to the provided ID.
320
+ __publicField$1(this, "validateIds", async (id) => {
321
+ return Promise.all([
322
+ this.validateId(id, "metadata").catch((error) => error.message),
323
+ this.validateId(id, "layout").catch((error) => error.message)
324
+ ]).then((errorMessages) => {
325
+ const combinedMessage = errorMessages.filter((msg) => msg !== void 0).join("; ");
326
+ if (combinedMessage) {
327
+ throw new Error(combinedMessage);
328
+ }
329
+ });
330
+ });
331
+ // Ensures that there is exactly one element (Layout or Metadata) in local
332
+ // storage corresponding to the provided ID.
333
+ __publicField$1(this, "validateId", (id, dataType) => {
334
+ return new Promise((resolve, reject) => {
335
+ const loadFunc = dataType === "metadata" ? () => this.loadMetadata() : () => this.loadLayouts();
336
+ loadFunc().then((array) => {
337
+ const count = array.filter((element) => element.id === id).length;
338
+ switch (count) {
339
+ case 1: {
340
+ resolve();
341
+ break;
342
+ }
343
+ case 0: {
344
+ reject(new Error(`No ${dataType} with ID ${id}`));
345
+ break;
346
+ }
347
+ default:
348
+ reject(new Error(`Non-unique ${dataType} with ID ${id}`));
349
+ }
350
+ });
351
+ });
352
+ });
353
+ if (urlKey) {
354
+ __privateSet$1(this, _urlKey, urlKey);
355
+ }
356
+ }
357
+ createLayout(metadata, layout) {
358
+ return new Promise((resolve) => {
359
+ Promise.all([this.loadLayouts(), this.loadMetadata()]).then(
360
+ ([existingLayouts, existingMetadata]) => {
361
+ const id = vuuUtils.getUniqueId();
362
+ const newMetadata = {
363
+ ...metadata,
364
+ id,
365
+ created: vuuUtils.formatDate({ date: "dd.mm.yyyy" })(/* @__PURE__ */ new Date())
366
+ };
367
+ this.saveLayoutsWithMetadata(
368
+ [...existingLayouts, { id, json: layout }],
369
+ [...existingMetadata, newMetadata]
370
+ );
371
+ resolve(newMetadata);
372
+ }
373
+ );
374
+ });
375
+ }
376
+ updateLayout(id, newMetadata, newLayout) {
377
+ return new Promise((resolve, reject) => {
378
+ this.validateIds(id).then(() => Promise.all([this.loadLayouts(), this.loadMetadata()])).then(([existingLayouts, existingMetadata]) => {
379
+ const updatedLayouts = existingLayouts.map(
380
+ (layout) => layout.id === id ? { ...layout, json: newLayout } : layout
381
+ );
382
+ const updatedMetadata = existingMetadata.map(
383
+ (metadata) => metadata.id === id ? { ...metadata, ...newMetadata } : metadata
384
+ );
385
+ this.saveLayoutsWithMetadata(updatedLayouts, updatedMetadata);
386
+ resolve();
387
+ }).catch((e) => reject(e));
388
+ });
389
+ }
390
+ deleteLayout(id) {
391
+ return new Promise((resolve, reject) => {
392
+ this.validateIds(id).then(() => Promise.all([this.loadLayouts(), this.loadMetadata()])).then(([existingLayouts, existingMetadata]) => {
393
+ const layouts = existingLayouts.filter((layout) => layout.id !== id);
394
+ const metadata = existingMetadata.filter(
395
+ (metadata2) => metadata2.id !== id
396
+ );
397
+ this.saveLayoutsWithMetadata(layouts, metadata);
398
+ resolve();
399
+ }).catch((e) => reject(e));
400
+ });
401
+ }
402
+ loadLayout(id) {
403
+ return new Promise((resolve, reject) => {
404
+ this.validateId(id, "layout").then(() => this.loadLayouts()).then((existingLayouts) => {
405
+ const foundLayout = existingLayouts.find(
406
+ (layout) => layout.id === id
407
+ );
408
+ if (foundLayout) {
409
+ resolve(foundLayout.json);
410
+ } else {
411
+ reject(new Error(`no layout found matching id ${id}`));
412
+ }
413
+ }).catch((e) => reject(e));
414
+ });
415
+ }
416
+ loadMetadata() {
417
+ return new Promise((resolve) => {
418
+ const metadata = vuuUtils.getLocalEntity(
419
+ this.metadataSaveLocation
420
+ );
421
+ resolve(metadata || []);
422
+ });
423
+ }
424
+ async loadApplicationJSON() {
425
+ return __privateGet$1(this, _applicationJSON$1) || new Promise((resolve) => {
426
+ const applicationJSON = vuuUtils.getLocalEntity(__privateGet$1(this, _urlKey));
427
+ if (applicationJSON) {
428
+ __privateSet$1(this, _applicationJSON$1, applicationJSON);
429
+ }
430
+ resolve(applicationJSON);
431
+ });
432
+ }
433
+ saveApplicationJSON(applicationJSON) {
434
+ return new Promise((resolve, reject) => {
435
+ const savedLayout = vuuUtils.saveLocalEntity(
436
+ __privateGet$1(this, _urlKey),
437
+ applicationJSON
438
+ );
439
+ if (savedLayout) {
440
+ __privateSet$1(this, _applicationJSON$1, applicationJSON);
441
+ resolve();
442
+ } else {
443
+ reject(new Error("Application Json failed to save"));
444
+ }
445
+ });
446
+ }
447
+ async getUserSettings() {
448
+ if (__privateGet$1(this, _applicationJSON$1)) {
449
+ return __privateGet$1(this, _applicationJSON$1).userSettings ?? {};
450
+ }
451
+ try {
452
+ const applicationJSON = await this.loadApplicationJSON();
453
+ return applicationJSON?.userSettings ?? {};
454
+ } catch (e) {
455
+ return {};
456
+ }
457
+ }
458
+ saveUserSettings(userSettings) {
459
+ if (__privateGet$1(this, _applicationJSON$1)) {
460
+ this.saveApplicationJSON({
461
+ ...__privateGet$1(this, _applicationJSON$1),
462
+ userSettings
463
+ });
464
+ }
465
+ }
466
+ }
467
+ _username = new WeakMap();
468
+ _urlKey = new WeakMap();
469
+ _applicationJSON$1 = new WeakMap();
470
+
471
+ var __defProp = Object.defineProperty;
472
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
473
+ var __publicField = (obj, key, value) => __defNormalProp(obj, key + "" , value);
474
+ const baseURL = "/api";
475
+ const metadataSaveLocation = "layouts/metadata";
476
+ const layoutsSaveLocation = "layouts";
477
+ const applicationLayoutsSaveLocation = "application-layouts";
478
+ class RemotePersistenceManager {
479
+ constructor() {
480
+ __publicField(this, "username", getAuthDetailsFromCookies()[0]);
481
+ }
482
+ createLayout(metadata, layout) {
483
+ return new Promise(
484
+ (resolve, reject) => fetch(`${baseURL}/${layoutsSaveLocation}`, {
485
+ headers: {
486
+ "Content-Type": "application/json"
487
+ },
488
+ method: "POST",
489
+ body: JSON.stringify({
490
+ metadata,
491
+ definition: layout
492
+ })
493
+ }).then((response) => {
494
+ if (!response.ok) {
495
+ reject(new Error(response.statusText));
496
+ }
497
+ response.json().then(({ metadata: metadata2 }) => {
498
+ if (!metadata2) {
499
+ reject(new Error("Response did not contain valid metadata"));
500
+ }
501
+ resolve(metadata2);
502
+ });
503
+ }).catch((error) => {
504
+ reject(error);
505
+ })
506
+ );
507
+ }
508
+ updateLayout(id, metadata, newLayoutJson) {
509
+ return new Promise(
510
+ (resolve, reject) => fetch(`${baseURL}/${layoutsSaveLocation}/${id}`, {
511
+ method: "PUT",
512
+ body: JSON.stringify({
513
+ metadata,
514
+ layout: newLayoutJson
515
+ })
516
+ }).then((response) => {
517
+ if (!response.ok) {
518
+ reject(new Error(response.statusText));
519
+ }
520
+ resolve();
521
+ }).catch((error) => {
522
+ reject(error);
523
+ })
524
+ );
525
+ }
526
+ deleteLayout(id) {
527
+ return new Promise(
528
+ (resolve, reject) => fetch(`${baseURL}/${layoutsSaveLocation}/${id}`, {
529
+ method: "DELETE"
530
+ }).then((response) => {
531
+ if (!response.ok) {
532
+ reject(new Error(response.statusText));
533
+ }
534
+ resolve();
535
+ }).catch((error) => {
536
+ reject(error);
537
+ })
538
+ );
539
+ }
540
+ loadLayout(id) {
541
+ return new Promise((resolve, reject) => {
542
+ fetch(`${baseURL}/${layoutsSaveLocation}/${id}`, {
543
+ method: "GET"
544
+ }).then((response) => {
545
+ if (!response.ok) {
546
+ reject(new Error(response.statusText));
547
+ }
548
+ response.json().then(({ definition }) => {
549
+ if (!definition) {
550
+ reject(new Error("Response did not contain a valid layout"));
551
+ }
552
+ resolve(definition);
553
+ });
554
+ }).catch((error) => {
555
+ reject(error);
556
+ });
557
+ });
558
+ }
559
+ loadMetadata() {
560
+ return new Promise(
561
+ (resolve, reject) => fetch(`${baseURL}/${metadataSaveLocation}`, {
562
+ method: "GET"
563
+ }).then((response) => {
564
+ if (!response.ok) {
565
+ reject(new Error(response.statusText));
566
+ }
567
+ response.json().then((metadata) => {
568
+ if (!metadata) {
569
+ reject(new Error("Response did not contain valid metadata"));
570
+ }
571
+ resolve(metadata);
572
+ });
573
+ }).catch((error) => {
574
+ reject(error);
575
+ })
576
+ );
577
+ }
578
+ saveApplicationJSON(applicationJSON) {
579
+ return new Promise(
580
+ (resolve, reject) => fetch(`${baseURL}/${applicationLayoutsSaveLocation}`, {
581
+ method: "PUT",
582
+ headers: {
583
+ "Content-Type": "application/json",
584
+ username: this.username
585
+ },
586
+ body: JSON.stringify(applicationJSON)
587
+ }).then((response) => {
588
+ if (!response.ok) {
589
+ reject(new Error(response.statusText));
590
+ }
591
+ resolve();
592
+ }).catch((error) => {
593
+ reject(error);
594
+ })
595
+ );
596
+ }
597
+ loadApplicationJSON() {
598
+ return new Promise(
599
+ (resolve, reject) => fetch(`${baseURL}/${applicationLayoutsSaveLocation}`, {
600
+ method: "GET",
601
+ headers: {
602
+ username: this.username
603
+ }
604
+ }).then((response) => {
605
+ if (!response.ok) {
606
+ reject(new Error(response.statusText));
607
+ }
608
+ response.json().then((applicationJSON) => {
609
+ if (!applicationJSON) {
610
+ reject(
611
+ new Error(
612
+ "Response did not contain valid application layout information"
613
+ )
614
+ );
615
+ }
616
+ resolve(applicationJSON.definition);
617
+ });
618
+ }).catch((error) => {
619
+ reject(error);
620
+ })
621
+ );
622
+ }
623
+ async getUserSettings() {
624
+ return {};
625
+ }
626
+ saveUserSettings(userSettings) {
627
+ console.log("saveUserSettings not implemented", {
628
+ userSettings
629
+ });
630
+ }
631
+ }
632
+
633
+ var __typeError = (msg) => {
634
+ throw TypeError(msg);
635
+ };
636
+ var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
637
+ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
638
+ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
639
+ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), member.set(obj, value), value);
640
+ var _applicationLoadDelay, _applicationJSON, _layoutMetaData;
641
+ function unsupported() {
642
+ return new Promise((_, reject) => {
643
+ reject("not supported");
644
+ });
645
+ }
646
+ class StaticPersistenceManager {
647
+ constructor({
648
+ applicationJSON,
649
+ applicationLoadDelay = 0,
650
+ layoutMetadata = []
651
+ }) {
652
+ __privateAdd(this, _applicationLoadDelay);
653
+ __privateAdd(this, _applicationJSON);
654
+ __privateAdd(this, _layoutMetaData);
655
+ __privateSet(this, _applicationJSON, applicationJSON);
656
+ __privateSet(this, _applicationLoadDelay, applicationLoadDelay);
657
+ __privateSet(this, _layoutMetaData, layoutMetadata);
658
+ }
659
+ createLayout() {
660
+ return unsupported();
661
+ }
662
+ updateLayout() {
663
+ return unsupported();
664
+ }
665
+ deleteLayout() {
666
+ return unsupported();
667
+ }
668
+ loadLayout(id) {
669
+ console.log(`load layout #${id}`);
670
+ return unsupported();
671
+ }
672
+ loadMetadata() {
673
+ return Promise.resolve(__privateGet(this, _layoutMetaData));
674
+ }
675
+ loadApplicationJSON() {
676
+ return new Promise((resolve) => {
677
+ setTimeout(() => {
678
+ resolve(__privateGet(this, _applicationJSON));
679
+ }, __privateGet(this, _applicationLoadDelay));
680
+ });
681
+ }
682
+ async saveApplicationJSON(applicationJson) {
683
+ console.log(`save application json `, {
684
+ applicationJson
685
+ });
686
+ }
687
+ async getUserSettings() {
688
+ return __privateGet(this, _applicationJSON)?.userSettings ?? {};
689
+ }
690
+ saveUserSettings(userSettings) {
691
+ console.log("saveUserSettings not implemented", {
692
+ userSettings
693
+ });
694
+ }
695
+ }
696
+ _applicationLoadDelay = new WeakMap();
697
+ _applicationJSON = new WeakMap();
698
+ _layoutMetaData = new WeakMap();
699
+
700
+ const getThemeMode = (mode = "light", userSettings) => {
701
+ const themeMode = userSettings?.themeMode;
702
+ if (themeMode === "light" || themeMode === "dark") {
703
+ return themeMode;
704
+ }
705
+ return mode;
706
+ };
707
+ const ApplicationProvider = ({
708
+ children,
709
+ density: densityProp,
710
+ loginUrl,
711
+ mode,
712
+ theme,
713
+ userSettingsSchema,
714
+ user
715
+ }) => {
716
+ const { mode: inheritedMode, theme: inheritedTheme } = core.useTheme();
717
+ const density = core.useDensity(densityProp);
718
+ const persistenceManager = usePersistenceManager();
719
+ const context = React.useContext(ApplicationContext);
720
+ const [userSettings, setSettings] = React.useState();
721
+ React.useMemo(async () => {
722
+ if (persistenceManager) {
723
+ const userSettings2 = await persistenceManager.getUserSettings();
724
+ setSettings(userSettings2);
725
+ } else {
726
+ setSettings({});
727
+ }
728
+ }, [persistenceManager]);
729
+ const onUserSettingChanged = React.useCallback(
730
+ (propertyName, value) => {
731
+ setSettings((currentSettings) => {
732
+ const newSettings = { ...currentSettings, [propertyName]: value };
733
+ persistenceManager?.saveUserSettings(newSettings);
734
+ return newSettings;
735
+ });
736
+ },
737
+ [persistenceManager]
738
+ );
739
+ return userSettings ? /* @__PURE__ */ jsxRuntime.jsx(
740
+ ApplicationContext.Provider,
741
+ {
742
+ value: {
743
+ ...context,
744
+ loginUrl,
745
+ onUserSettingChanged,
746
+ userSettings,
747
+ userSettingsSchema,
748
+ user: user ?? context.user
749
+ },
750
+ children: /* @__PURE__ */ jsxRuntime.jsx(
751
+ core.SaltProvider,
752
+ {
753
+ theme: theme ?? inheritedTheme ?? "vuu-theme",
754
+ density,
755
+ mode: getThemeMode(mode ?? inheritedMode, userSettings),
756
+ children
757
+ }
758
+ )
759
+ }
760
+ ) : null;
761
+ };
762
+ const useApplicationUser = () => {
763
+ const { user } = React.useContext(ApplicationContext);
764
+ return user;
765
+ };
766
+ const useLoginUrl = () => {
767
+ const { loginUrl } = React.useContext(ApplicationContext);
768
+ return loginUrl;
769
+ };
770
+ const useApplicationSettings = () => {
771
+ const { onUserSettingChanged, userSettings, userSettingsSchema } = React.useContext(ApplicationContext);
772
+ return {
773
+ onUserSettingChanged,
774
+ userSettings,
775
+ userSettingsSchema
776
+ };
777
+ };
778
+ const useUserSetting = () => {
779
+ const { userSettings } = React.useContext(ApplicationContext);
780
+ return userSettings;
781
+ };
782
+
783
+ var appHeaderCss = ".vuuAppHeader {\n --saltButton-borderRadius: 6px;\n --saltButton-text-color: var(--vuu-color-gray-50);\n --saltButton-padding: 12px;\n --vuuToolbarItem-height: 26px;\n --vuuOverflowContainer-gap: 8px;\n --vuu-icon-color: var(--vuu-color-gray-45);\n --vuu-icon-size: 16px;\n --vuuToolbar-borderWidth: 1px;\n --vuuToolbar-borderStyle: solid;\n --vuuToolbar-borderColor: var(--salt-separable-primary-borderColor);\n\n align-items: center;\n display: flex;\n justify-content: flex-end;\n}\n\n.vuu-theme .vuuAppHeader {\n border-radius: 8px;\n\n margin-bottom: 8px;\n}\n";
784
+
785
+ const classBase$e = "vuuAppHeader";
786
+ const AppHeader = ({
787
+ className: classNameProp,
788
+ themeMode: _,
789
+ ...htmlAttributes
790
+ }) => {
791
+ const targetWindow = window$1.useWindow();
792
+ styles.useComponentCssInjection({
793
+ testId: "vuu-app-header",
794
+ css: appHeaderCss,
795
+ window: targetWindow
796
+ });
797
+ const settingsButtonRef = React.useRef(null);
798
+ const className = cx(classBase$e, classNameProp);
799
+ const loginUrl = useLoginUrl();
800
+ const { showComponentInContextPanel } = vuuLayout.useLayoutOperation();
801
+ const handleLogout = React.useCallback(() => {
802
+ logout(loginUrl);
803
+ }, [loginUrl]);
804
+ const handleShowSettings = React.useCallback(() => {
805
+ showComponentInContextPanel(
806
+ {
807
+ type: "ApplicationSettings"
808
+ },
809
+ "Settings",
810
+ () => settingsButtonRef.current?.focus()
811
+ );
812
+ }, [showComponentInContextPanel]);
813
+ return /* @__PURE__ */ jsxRuntime.jsxs(
814
+ vuuUiControls.Toolbar,
815
+ {
816
+ alignItems: "end",
817
+ className,
818
+ role: "banner",
819
+ showSeparators: true,
820
+ ...htmlAttributes,
821
+ children: [
822
+ /* @__PURE__ */ jsxRuntime.jsx(core.Button, { className: `${classBase$e}-menuItem`, variant: "secondary", children: "Help" }),
823
+ /* @__PURE__ */ jsxRuntime.jsxs(core.Button, { className: `${classBase$e}-menuItem`, variant: "secondary", children: [
824
+ "History ",
825
+ /* @__PURE__ */ jsxRuntime.jsx("span", { "data-icon": "history" })
826
+ ] }),
827
+ /* @__PURE__ */ jsxRuntime.jsxs(
828
+ core.Button,
829
+ {
830
+ className: `${classBase$e}-menuItem`,
831
+ onClick: handleShowSettings,
832
+ ref: settingsButtonRef,
833
+ variant: "secondary",
834
+ children: [
835
+ "Settings ",
836
+ /* @__PURE__ */ jsxRuntime.jsx("span", { "data-icon": "settings" })
837
+ ]
838
+ }
839
+ ),
840
+ /* @__PURE__ */ jsxRuntime.jsx(
841
+ core.Button,
842
+ {
843
+ className: `${classBase$e}-menuItem`,
844
+ onClick: handleLogout,
845
+ variant: "secondary",
846
+ children: "Log out"
847
+ }
848
+ )
849
+ ]
850
+ }
851
+ );
852
+ };
853
+
854
+ const classBase$d = "vuuConnectionRetryCountdown";
855
+ const ConnectionRetryCountdown = ({
856
+ seconds: secondsProp
857
+ }) => {
858
+ const secondsRemainingRef = React.useRef(secondsProp);
859
+ const [seconds, setSeconds] = React.useState(secondsRemainingRef.current);
860
+ const countDown = React.useCallback(() => {
861
+ secondsRemainingRef.current -= 1;
862
+ setSeconds(secondsRemainingRef.current);
863
+ if (secondsRemainingRef.current > 0) {
864
+ setTimeout(countDown, 1e3);
865
+ }
866
+ }, []);
867
+ React.useEffect(() => {
868
+ if (secondsProp !== secondsRemainingRef.current) {
869
+ secondsRemainingRef.current = secondsProp;
870
+ countDown();
871
+ }
872
+ }, [countDown, secondsProp]);
873
+ React.useMemo(() => {
874
+ setTimeout(countDown, 1e3);
875
+ }, [countDown]);
876
+ return seconds === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: classBase$d, children: /* @__PURE__ */ jsxRuntime.jsx("span", { children: "connecting" }) }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: classBase$d, children: /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
877
+ "retry in ",
878
+ seconds,
879
+ " seconds"
880
+ ] }) });
881
+ };
882
+
883
+ var connectionStatusIndicatorCss = "@keyframes squeeze {\n 0% {\n transform: scale(1);\n }\n\n 50% {\n transform: scale(0.85);\n }\n\n 100% {\n transform: scale(1);\n }\n}\n\n.ConnectionStatusIndicator {\n --ball-size-large: 20px;\n --ball-size-small: 14px;\n --ballbox-padding: 4px;\n --retry-count: 0;\n --height: var(\n --ballbox-height,\n calc(var(--ball-size-large) + var(--salt-spacing-100))\n );\n height: var(--height);\n padding: 0 4px;\n position: relative;\n width: calc(\n var(--ball-size-large) + var(--salt-spacing-400) +\n (var(--ball-size-small) + var(--salt-spacing-100)) * var(--retry-count)\n );\n\n &.expanded {\n transition-delay: 1s;\n .Ball.large {\n animation-duration: 0.8s;\n animation-name: squeeze;\n transform-origin: center;\n }\n .Ball.small {\n transform: translateX(calc(var(--ball-size-large) * var(--i)));\n }\n }\n}\n\n.ConnectionStatusIndicator-inactive {\n --ball-color: lightgray;\n}\n\n.ConnectionStatusIndicator-closed {\n --ball-color: red;\n opacity: 0.8;\n .Ball.large {\n transition: background-color 1s linear;\n }\n}\n\n.ConnectionStatusIndicator-connected {\n --ball-color: green;\n}\n\n.ConnectionStatusIndicator-disconnected {\n --ball-color: red;\n}\n\n.Ball.large {\n background-color: var(--ball-color);\n border-radius: calc(var(--ball-size-large) / 2);\n height: var(--ball-size-large);\n right: var(--ballbox-padding);\n top: calc(var(--height) / 2 - (var(--ball-size-large) / 2));\n position: absolute;\n transition: transform 0.8s linear;\n\n width: var(--ball-size-large);\n z-index: 1;\n}\n\n.Ball.small {\n background-color: var(--ball-color);\n border-radius: calc(var(--ball-size-small) / 2);\n height: var(--ball-size-small);\n position: absolute;\n right: calc(\n var(--ballbox-padding) + (var(--ball-size-large) - var(--ball-size-small)) /\n 2\n );\n top: calc(var(--height) / 2 - (var(--ball-size-small) / 2));\n width: var(--ball-size-small);\n\n transition: transform 0.4s ease-out;\n transition-delay: 0.1s;\n}\n";
884
+
885
+ const classBase$c = "ConnectionStatusIndicator";
886
+ const Ball = React.memo(({ background, i = 0, large = false }) => {
887
+ if (large) {
888
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "Ball large", style: { background } }, i);
889
+ } else {
890
+ return /* @__PURE__ */ jsxRuntime.jsx(
891
+ "div",
892
+ {
893
+ className: "Ball small",
894
+ style: { "--i": -(i + 1), background }
895
+ },
896
+ i
897
+ );
898
+ }
899
+ });
900
+ Ball.displayName = "Ball";
901
+ const ConnectionStatusIndicator = ({
902
+ connectionState
903
+ }) => {
904
+ const targetWindow = window$1.useWindow();
905
+ styles.useComponentCssInjection({
906
+ testId: "vuu-connection-status-indicator",
907
+ css: connectionStatusIndicatorCss,
908
+ window: targetWindow
909
+ });
910
+ const ballbox = React.useRef(null);
911
+ const expandedRef = React.useRef(false);
912
+ const { connectionStatus, retryAttemptsRemaining, retryAttemptsTotal } = connectionState;
913
+ if (connectionStatus === "disconnected") {
914
+ expandedRef.current = true;
915
+ }
916
+ const finalState = connectionStatus === "connected" || connectionStatus === "closed";
917
+ React.useMemo(() => {
918
+ if (finalState) {
919
+ expandedRef.current = false;
920
+ }
921
+ }, [finalState]);
922
+ const getSmallBalls = () => {
923
+ const colors = Array(retryAttemptsTotal).fill("lightgray");
924
+ const index = retryAttemptsTotal - retryAttemptsRemaining;
925
+ if (retryAttemptsRemaining) {
926
+ colors[index] = "orange";
927
+ for (let i = 0; i < index; i++) {
928
+ colors[i] = "red";
929
+ }
930
+ } else {
931
+ colors.fill("red");
932
+ }
933
+ colors.reverse();
934
+ return colors.map((background, i) => /* @__PURE__ */ jsxRuntime.jsx(Ball, { i, background }, i));
935
+ };
936
+ const balls = getSmallBalls();
937
+ const displayState = connectionStatus;
938
+ const retryCount = connectionStatus === "disconnected" ? retryAttemptsTotal : 0;
939
+ return /* @__PURE__ */ jsxRuntime.jsxs(
940
+ "div",
941
+ {
942
+ className: cx(classBase$c, `${classBase$c}-${displayState}`, {
943
+ expanded: expandedRef.current
944
+ }),
945
+ ref: ballbox,
946
+ style: { "--retry-count": retryCount },
947
+ children: [
948
+ /* @__PURE__ */ jsxRuntime.jsx(Ball, { large: true }),
949
+ balls
950
+ ]
951
+ }
952
+ );
953
+ };
954
+
955
+ var connectionStateDisplayCss = ".vuuConnectionStateDisplay {\n --ballbox-height: 24px;\n --message-height: 14px;\n --row-gap: 3px;\n --top-row: calc(var(--ballbox-height) + var(--message-height));\n --bottom-row: 0px;\n\n align-items: center;\n background: var(--salt-container-secondary-background);\n column-gap: var(--salt-spacing-200);\n display: grid;\n grid-template-columns: auto 1fr;\n grid-template-rows: var(--top-row) var(--bottom-row);\n justify-items: end;\n height: calc(var(--ballbox-height) + var(--message-height) + var(--row-gap));\n padding: 0 var(--salt-spacing-200);\n transition: grid-template-rows 0.4s linear;\n row-gap: var(--row-gap);\n width: max-content;\n\n .vuuTrafficLightControl {\n grid-area: 1/2/2/3;\n padding-left: 20px;\n }\n\n &.vuuConnectionStateDisplay-disconnected {\n --top-row: var(--ballbox-height);\n --bottom-row: var(--message-height);\n }\n\n .vuuConnectionRetryCountdown {\n color: var(--salt-content-secondary-foreground);\n grid-area: 2/2/3/3;\n font-size: 11px;\n text-align: end;\n width: 100%;\n }\n}\n\n.vuuConnectionStateDisplay-text {\n grid-area: 1/1/2/2;\n text-transform: capitalize;\n}\n";
956
+
957
+ const classBase$b = "vuuConnectionStateDisplay";
958
+ const DefaultConnectionState = {
959
+ connectionPhase: "connecting",
960
+ connectionStatus: "closed",
961
+ secondsToNextRetry: -1,
962
+ retryAttemptsRemaining: 0,
963
+ retryAttemptsTotal: 1
964
+ };
965
+ const getDisplayText = (connectionState) => {
966
+ switch (connectionState.connectionStatus) {
967
+ case "closed":
968
+ return "Unable to connect to data service";
969
+ case "failed":
970
+ return connectionState.connectionPhase === "connecting" ? "Failed to connect" : "Failed to re-connect";
971
+ case "disconnected":
972
+ return connectionState.connectionPhase === "connecting" ? "Attempting to connect to data service" : "Attempting to reconnect to data service";
973
+ }
974
+ };
975
+ const ConnectionStateDisplay = ({
976
+ connectionState: connectionStateProp,
977
+ showText = true,
978
+ ...htmlAttributes
979
+ }) => {
980
+ const targetWindow = window$1.useWindow();
981
+ styles.useComponentCssInjection({
982
+ testId: "vuu-connection-status-indicator",
983
+ css: connectionStateDisplayCss,
984
+ window: targetWindow
985
+ });
986
+ const [connectionState, setConnectionState] = React.useState(DefaultConnectionState);
987
+ React.useMemo(() => {
988
+ vuuDataRemote.ConnectionManager.on("connection-status", setConnectionState);
989
+ if (connectionStateProp) {
990
+ setConnectionState(connectionStateProp);
991
+ }
992
+ }, [connectionStateProp]);
993
+ const { connectionStatus, secondsToNextRetry } = connectionState;
994
+ return /* @__PURE__ */ jsxRuntime.jsxs(
995
+ "div",
996
+ {
997
+ ...htmlAttributes,
998
+ className: cx(classBase$b, `${classBase$b}-${connectionStatus}`),
999
+ children: [
1000
+ showText ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: `${classBase$b}-text`, children: getDisplayText(connectionState) }) : null,
1001
+ connectionStatus === "disconnected" && secondsToNextRetry > 0 ? /* @__PURE__ */ jsxRuntime.jsx(ConnectionRetryCountdown, { seconds: secondsToNextRetry }) : null,
1002
+ /* @__PURE__ */ jsxRuntime.jsx(ConnectionStatusIndicator, { connectionState })
1003
+ ]
1004
+ }
1005
+ );
1006
+ };
1007
+
1008
+ class FeatureErrorBoundary extends React.Component {
1009
+ constructor(props) {
1010
+ super(props);
1011
+ this.state = { errorMessage: null };
1012
+ }
1013
+ static getDerivedStateFromError(error) {
1014
+ return { errorMessage: error.message };
1015
+ }
1016
+ componentDidCatch(error, errorInfo) {
1017
+ console.log(`error creating component at ${this.props.url}`);
1018
+ console.log(error, errorInfo);
1019
+ }
1020
+ render() {
1021
+ if (this.state.errorMessage) {
1022
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1023
+ /* @__PURE__ */ jsxRuntime.jsx("h1", { children: "An error occured while creating component." }),
1024
+ /* @__PURE__ */ jsxRuntime.jsx("p", { children: this.state.errorMessage })
1025
+ ] });
1026
+ }
1027
+ return this.props.children;
1028
+ }
1029
+ }
1030
+
1031
+ const Loader = () => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "hwLoader" });
1032
+
1033
+ const componentsMap = /* @__PURE__ */ new Map();
1034
+ const useCachedFeature = (url) => {
1035
+ React.useEffect(
1036
+ () => () => {
1037
+ componentsMap.delete(url);
1038
+ },
1039
+ [url]
1040
+ );
1041
+ if (!componentsMap.has(url)) {
1042
+ componentsMap.set(
1043
+ url,
1044
+ React.lazy(() => import(
1045
+ /* @vite-ignore */
1046
+ url
1047
+ ))
1048
+ );
1049
+ }
1050
+ const lazyFeature = componentsMap.get(url);
1051
+ if (!lazyFeature) {
1052
+ throw Error(`Unable to load Lazy Feature at url ${url}`);
1053
+ } else {
1054
+ return lazyFeature;
1055
+ }
1056
+ };
1057
+ function RawFeature({
1058
+ url,
1059
+ css,
1060
+ ComponentProps: params,
1061
+ ...props
1062
+ }) {
1063
+ if (css) {
1064
+ vuuUtils.importCSS(css).then((styleSheet) => {
1065
+ document.adoptedStyleSheets = [
1066
+ ...document.adoptedStyleSheets,
1067
+ styleSheet
1068
+ ];
1069
+ });
1070
+ }
1071
+ const LazyFeature = useCachedFeature(url);
1072
+ return /* @__PURE__ */ jsxRuntime.jsx(FeatureErrorBoundary, { url, children: /* @__PURE__ */ jsxRuntime.jsx(React.Suspense, { fallback: /* @__PURE__ */ jsxRuntime.jsx(Loader, {}), children: /* @__PURE__ */ jsxRuntime.jsx(LazyFeature, { ...props, ...params }) }) });
1073
+ }
1074
+ const Feature = React.memo(RawFeature);
1075
+ Feature.displayName = "Feature";
1076
+ vuuUtils.registerComponent("Feature", Feature, "view");
1077
+
1078
+ const NO_FEATURES = [];
1079
+ const NO_STATICFEATURES = [];
1080
+ const NO_SYSTEMLAYOUTS = [];
1081
+ const NO_FEATURES_VUU = {
1082
+ dynamicFeatures: NO_FEATURES,
1083
+ tableFeatures: NO_FEATURES
1084
+ };
1085
+ const FeatureContext = React.createContext({
1086
+ dynamicFeatures: NO_FEATURES,
1087
+ tableFeatures: NO_FEATURES,
1088
+ staticFeatures: NO_STATICFEATURES
1089
+ });
1090
+ const LayoutContext = React.createContext({
1091
+ systemLayouts: NO_SYSTEMLAYOUTS
1092
+ });
1093
+ const FeatureAndLayoutProvider = ({
1094
+ children,
1095
+ dynamicFeatures: dynamicFeaturesProp = [],
1096
+ staticFeatures,
1097
+ systemLayouts
1098
+ }) => {
1099
+ const tableSchemas = vuuDataReact.useVuuTables();
1100
+ const { dynamicFeatures, tableFeatures } = React.useMemo(
1101
+ () => tableSchemas ? vuuUtils.getCustomAndTableFeatures(dynamicFeaturesProp, tableSchemas) : NO_FEATURES_VUU,
1102
+ [dynamicFeaturesProp, tableSchemas]
1103
+ );
1104
+ return /* @__PURE__ */ jsxRuntime.jsx(
1105
+ FeatureContext.Provider,
1106
+ {
1107
+ value: {
1108
+ dynamicFeatures,
1109
+ tableFeatures,
1110
+ staticFeatures
1111
+ },
1112
+ children: /* @__PURE__ */ jsxRuntime.jsx(
1113
+ LayoutContext.Provider,
1114
+ {
1115
+ value: {
1116
+ systemLayouts
1117
+ },
1118
+ children
1119
+ }
1120
+ )
1121
+ }
1122
+ );
1123
+ };
1124
+ const useFeatures = () => React.useContext(FeatureContext);
1125
+ const useLayouts = () => React.useContext(LayoutContext);
1126
+
1127
+ var featureListCss = ".vuuFeatureList {\n --vuuListItem-padding: var(--salt-spacing-200);\n background: var(\n --vuuFeatureList-background,\n var(--salt-container-primary-background)\n );\n display: flex;\n flex-direction: column;\n height: 100%;\n padding: 0 var(--vuuFeatureList-padding, 0);\n}\n\n.vuuFeatureList-header {\n align-items: center;\n display: flex;\n flex: 0 0 48px;\n font-weight: 700;\n line-height: 2;\n}\n\n.vuuFeatureList-content {\n display: flex;\n flex: 1 1 auto;\n flex-direction: column;\n font-size: 12px;\n font-weight: 700;\n overflow: auto;\n}\n\n.vuuFeatureList-standalone {\n margin-top: 24px;\n}\n\n.vuuFeatureList-group {\n --vuuMeasuredContainer-flex: 0 0 auto;\n\n display: flex;\n flex-direction: column;\n\n .vuuFeatureList-groupHeader {\n flex: 0 0 32px;\n padding: 8px 0;\n }\n\n .vuuPalette {\n flex: 1 1 auto;\n height: auto;\n }\n}\n\n.vuuFeatureList-group:first-child {\n margin-top: 12px;\n}\n\n.vuuFeatureList-group + .vuuFeatureList-group {\n margin-top: 24px;\n}\n\n.vuuFeatureList-itemName {\n font-weight: 700;\n}\n";
1128
+
1129
+ const classBase$a = "vuuFeatureList";
1130
+ const FeatureList = ({
1131
+ features,
1132
+ title = "VUU TABLES",
1133
+ ...htmlAttributes
1134
+ }) => {
1135
+ const targetWindow = window$1.useWindow();
1136
+ styles.useComponentCssInjection({
1137
+ testId: "vuu-feature-list",
1138
+ css: featureListCss,
1139
+ window: targetWindow
1140
+ });
1141
+ const content = React.useMemo(() => {
1142
+ if (vuuUtils.isStaticFeatures(features)) {
1143
+ return features.map(({ label, type }, idx) => {
1144
+ return /* @__PURE__ */ jsxRuntime.jsxs(
1145
+ vuuLayout.PaletteItem,
1146
+ {
1147
+ closeable: true,
1148
+ component: vuuUtils.featureFromJson({ type }),
1149
+ value: label,
1150
+ resizeable: true,
1151
+ resize: "defer",
1152
+ header: true,
1153
+ children: [
1154
+ /* @__PURE__ */ jsxRuntime.jsx(vuuUiControls.Icon, { name: "draggable", size: 18 }),
1155
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: `${classBase$a}-itemName`, children: label })
1156
+ ]
1157
+ },
1158
+ idx
1159
+ );
1160
+ });
1161
+ }
1162
+ if (Array.isArray(features)) {
1163
+ return [
1164
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: `${classBase$a}-standalone`, children: /* @__PURE__ */ jsxRuntime.jsx(vuuLayout.Palette, { orientation: "vertical", children: features.map((featureProps, i) => /* @__PURE__ */ jsxRuntime.jsxs(
1165
+ vuuLayout.PaletteItem,
1166
+ {
1167
+ closeable: true,
1168
+ component: /* @__PURE__ */ jsxRuntime.jsx(Feature, { ...featureProps }),
1169
+ value: featureProps.title,
1170
+ resizeable: true,
1171
+ resize: "defer",
1172
+ header: true,
1173
+ children: [
1174
+ /* @__PURE__ */ jsxRuntime.jsx(vuuUiControls.Icon, { name: "draggable", size: 18 }),
1175
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: `${classBase$a}-itemName`, children: featureProps.title })
1176
+ ]
1177
+ },
1178
+ i
1179
+ )) }, "0") }, 0)
1180
+ ];
1181
+ } else {
1182
+ return Object.entries(features).map(([heading, featureList], index) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `${classBase$a}-group`, children: [
1183
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: `${classBase$a}-groupHeader`, children: heading }),
1184
+ /* @__PURE__ */ jsxRuntime.jsx(vuuLayout.Palette, { orientation: "vertical", children: featureList.map(
1185
+ (featureProps, i) => /* @__PURE__ */ jsxRuntime.jsxs(
1186
+ vuuLayout.PaletteItem,
1187
+ {
1188
+ closeable: true,
1189
+ component: /* @__PURE__ */ jsxRuntime.jsx(Feature, { ...featureProps }),
1190
+ value: featureProps.title,
1191
+ resizeable: true,
1192
+ resize: "defer",
1193
+ header: true,
1194
+ children: [
1195
+ /* @__PURE__ */ jsxRuntime.jsx(vuuUiControls.Icon, { name: "draggable", size: 18 }),
1196
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: `${classBase$a}-itemName`, children: featureProps.title })
1197
+ ]
1198
+ },
1199
+ i
1200
+ )
1201
+ ) })
1202
+ ] }, index));
1203
+ }
1204
+ }, [features]);
1205
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { ...htmlAttributes, className: cx(classBase$a, "vuuScrollable"), children: [
1206
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: `${classBase$a}-header`, children: title }),
1207
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: `${classBase$a}-content`, children: content })
1208
+ ] });
1209
+ };
1210
+
1211
+ const takeScreenshot = (node) => {
1212
+ return new Promise((resolve, reject) => {
1213
+ htmlToImage.toPng(node, {
1214
+ cacheBust: true
1215
+ }).then((screenshot) => {
1216
+ if (!screenshot) {
1217
+ reject(new Error("No Screenshot available"));
1218
+ }
1219
+ resolve(screenshot);
1220
+ }).catch((error) => {
1221
+ console.error(
1222
+ "the following error occurred while taking a screenshot of a DOMNode",
1223
+ error
1224
+ );
1225
+ reject(new Error("Error taking screenshot"));
1226
+ });
1227
+ });
1228
+ };
1229
+
1230
+ var saveLayoutPanelCss = ".vuuSaveLayoutPanel {\n --salt-selectable-foreground-hover: #6d18bdc3;\n --salt-selectable-foreground-selected: #6d18bd;\n --salt-selectable-borderColor-selected: #6d18bd;\n --saltInputLegacy-fontSize: 12px;\n --salt-text-label-fontSize: 10px;\n --saltFormFieldLegacy-label-paddingLeft: 0;\n --saltFormField-label-fontWeight: 400;\n --saltText-color: var(--text-secondary-foreground, #606477);\n\n align-items: flex-start;\n display: flex;\n flex-direction: column;\n\n .saltFormField {\n border: solid 1px var(--salt-editable-borderColor);\n padding: var(--salt-spacing-50) var(--salt-spacing-200);\n }\n\n .saltComboBox {\n .saltPillInput-endAdornmentContainer {\n .saltButton {\n border: none;\n width: 18px;\n transform: rotate(90deg);\n }\n .saltButton:after {\n content: \"\";\n background-color: var(--salt-content-secondary-foreground);\n left: auto;\n height: 20px;\n mask: var(--vuu-svg-triangle-right) center center/20px 20px;\n mask-repeat: no-repeat;\n position: absolute;\n top: var(--vuu-icon-top, auto);\n transform: var(--vuu-icon-transform, none);\n width: 20px;\n }\n }\n .saltPillInput-activationIndicator {\n display: none;\n }\n }\n}\n\n.spinner {\n width: 100px;\n height: 100px;\n background-image: var(--svg-spinner);\n}\n\n.vuuSaveLayoutPanel-panelContent {\n display: grid;\n gap: 32px;\n margin-top: var(--salt-spacing-200);\n}\n\n.vuuSaveLayoutPanel-inputText {\n border: none;\n color: var(--light-text-primary, #15171b);\n font-size: 12px;\n font-weight: 400;\n line-height: 16px;\n padding-left: 4px;\n width: 100%;\n outline: none;\n}\n\n.vuuSaveLayoutPanel-settingsGroup {\n display: flex;\n flex-wrap: wrap;\n align-items: flex-end;\n gap: 10px;\n width: 100%;\n line-height: 16px;\n}\n\n.vuuSaveLayoutPanel-screenshotContainer {\n display: flex;\n width: 304px;\n height: 208px;\n padding: 11px 15.5px;\n justify-content: center;\n align-items: center;\n border: 1px solid #e8e8e8;\n background: var(--dark-text-primary, #fff);\n}\n\n.vuuSaveLayoutPanel-screenshot {\n background: lightgray 50% / cover no-repeat;\n width: 273px;\n height: 186px;\n}\n\n.vuuSaveLayoutPanel-buttonsContainer {\n display: flex;\n justify-content: flex-end;\n align-items: flex-start;\n align-self: stretch;\n padding-top: 24px;\n gap: 8px;\n}\n\n.vuuSaveLayoutPanel-cancelButton,\n.vuuSaveLayoutPanel-saveButton {\n display: flex;\n height: fit-content;\n padding: 4px 8px;\n align-items: flex-start;\n gap: 8px;\n border-radius: 6px;\n font-size: 12px;\n font-style: normal;\n font-weight: 700;\n line-height: 133.333%;\n letter-spacing: 0.48px;\n text-transform: uppercase;\n}\n";
1231
+
1232
+ const classBase$9 = "vuuSaveLayoutPanel";
1233
+ const groups = ["Group 1", "Group 2", "Group 3", "Group 4", "Group 5"];
1234
+ const SaveLayoutPanel = (props) => {
1235
+ const { defaultTitle = "", onCancel, onSave, componentId } = props;
1236
+ const targetWindow = window$1.useWindow();
1237
+ styles.useComponentCssInjection({
1238
+ testId: "vuu-save-layout-panel",
1239
+ css: saveLayoutPanelCss,
1240
+ window: targetWindow
1241
+ });
1242
+ const [layoutName, setLayoutName] = React.useState(defaultTitle);
1243
+ const [group, setGroup] = React.useState("");
1244
+ const [screenshot, setScreenshot] = React.useState();
1245
+ const [screenshotErrorMessage, setScreenshotErrorMessage] = React.useState();
1246
+ const [username] = getAuthDetailsFromCookies();
1247
+ React.useEffect(() => {
1248
+ if (componentId) {
1249
+ takeScreenshot(document.getElementById(componentId)).then((screenshot2) => {
1250
+ setScreenshot(screenshot2);
1251
+ }).catch((error) => {
1252
+ setScreenshotErrorMessage(error.message);
1253
+ });
1254
+ }
1255
+ }, [componentId]);
1256
+ const handleSubmit = () => {
1257
+ onSave({
1258
+ name: layoutName,
1259
+ group,
1260
+ screenshot: screenshot ?? "",
1261
+ user: username
1262
+ });
1263
+ };
1264
+ const screenshotContent = React.useMemo(() => {
1265
+ if (screenshot) {
1266
+ return /* @__PURE__ */ jsxRuntime.jsx(
1267
+ "img",
1268
+ {
1269
+ className: `${classBase$9}-screenshot`,
1270
+ src: screenshot,
1271
+ alt: "screenshot of current layout"
1272
+ }
1273
+ );
1274
+ }
1275
+ if (screenshotErrorMessage) {
1276
+ return /* @__PURE__ */ jsxRuntime.jsx(core.Text, { children: screenshotErrorMessage });
1277
+ }
1278
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "spinner" });
1279
+ }, [screenshot, screenshotErrorMessage]);
1280
+ const handleSelectionChange = React.useCallback(
1281
+ (e, [selectedValue]) => {
1282
+ if (e.key === "Tab" && !selectedValue.toLowerCase().startsWith(group.toLowerCase())) ; else {
1283
+ setGroup(selectedValue || "");
1284
+ }
1285
+ },
1286
+ [group]
1287
+ );
1288
+ const handleChange = React.useCallback((e) => {
1289
+ setGroup(e.target.value);
1290
+ }, []);
1291
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `${classBase$9}`, children: [
1292
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `${classBase$9}-panelContent`, children: [
1293
+ /* @__PURE__ */ jsxRuntime.jsxs(core.FormField, { children: [
1294
+ /* @__PURE__ */ jsxRuntime.jsx(core.FormFieldLabel, { children: "Group" }),
1295
+ /* @__PURE__ */ jsxRuntime.jsx(
1296
+ core.ComboBox,
1297
+ {
1298
+ "data-embedded": true,
1299
+ inputProps: {
1300
+ autoComplete: "off",
1301
+ className: `${classBase$9}-inputText`,
1302
+ placeholder: "Select Group or Enter New Name"
1303
+ // onChange: (event: ChangeEvent<HTMLInputElement>) =>
1304
+ // setGroup(event.target.value),
1305
+ },
1306
+ onChange: handleChange,
1307
+ onSelectionChange: handleSelectionChange,
1308
+ value: group,
1309
+ children: groups.map((group2, i) => /* @__PURE__ */ jsxRuntime.jsx(core.Option, { value: group2 }, i))
1310
+ }
1311
+ )
1312
+ ] }),
1313
+ /* @__PURE__ */ jsxRuntime.jsxs(core.FormField, { children: [
1314
+ /* @__PURE__ */ jsxRuntime.jsx(core.FormFieldLabel, { children: "Layout Name" }),
1315
+ /* @__PURE__ */ jsxRuntime.jsx(
1316
+ core.Input,
1317
+ {
1318
+ "data-embedded": true,
1319
+ inputProps: {
1320
+ className: `${classBase$9}-inputText`,
1321
+ placeholder: "Enter Layout Name"
1322
+ },
1323
+ onChange: (event) => setLayoutName(event.target.value),
1324
+ value: layoutName
1325
+ }
1326
+ )
1327
+ ] }),
1328
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: `${classBase$9}-screenshotContainer`, children: screenshotContent })
1329
+ ] }),
1330
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `${classBase$9}-buttonsContainer`, children: [
1331
+ /* @__PURE__ */ jsxRuntime.jsx(core.Button, { className: `${classBase$9}-cancelButton`, onClick: onCancel, children: "Cancel" }),
1332
+ /* @__PURE__ */ jsxRuntime.jsx(
1333
+ core.Button,
1334
+ {
1335
+ className: `${classBase$9}-saveButton`,
1336
+ onClick: handleSubmit,
1337
+ disabled: layoutName === "" || group === "",
1338
+ variant: "cta",
1339
+ children: "Save"
1340
+ }
1341
+ )
1342
+ ] })
1343
+ ] });
1344
+ };
1345
+
1346
+ var layoutTileCss = ".vuuLayoutTile-layoutTile {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 8px 0px;\n flex: 1 1 auto;\n cursor: pointer;\n}\n\n.vuuLayoutTile-layoutName {\n font-weight: 600;\n text-transform: uppercase;\n}\n\n.vuuLayoutTile-screenshot {\n width: 60px;\n height: 45.6px;\n border: 1px solid #d6d7da;\n}\n\n.vuuLayoutTile-layoutDetails {\n color: var(--salt-content-secondary-foreground);\n font-size: 10px;\n font-weight: 600;\n line-height: 150%;\n}\n";
1347
+
1348
+ const classBase$8 = "vuuLayoutTile";
1349
+ const LayoutTile = ({
1350
+ metadata,
1351
+ onLoadLayout,
1352
+ ...htmlAttributes
1353
+ }) => {
1354
+ const targetWindow = window$1.useWindow();
1355
+ styles.useComponentCssInjection({
1356
+ testId: "vuu-layout-tile",
1357
+ css: layoutTileCss,
1358
+ window: targetWindow
1359
+ });
1360
+ return /* @__PURE__ */ React.createElement(
1361
+ "div",
1362
+ {
1363
+ ...htmlAttributes,
1364
+ className: `${classBase$8}-layoutTile`,
1365
+ key: metadata?.id,
1366
+ onClick: () => onLoadLayout(
1367
+ metadata?.id,
1368
+ metadata.layoutJSON
1369
+ )
1370
+ },
1371
+ /* @__PURE__ */ jsxRuntime.jsx("img", { className: `${classBase$8}-screenshot`, src: metadata?.screenshot }),
1372
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
1373
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: `${classBase$8}-layoutName`, children: metadata?.name }),
1374
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: `${classBase$8}-layoutDetails`, children: /* @__PURE__ */ jsxRuntime.jsx("div", { children: `${metadata?.created}` }) })
1375
+ ] })
1376
+ );
1377
+ };
1378
+
1379
+ const warningLayout = {
1380
+ type: "View",
1381
+ props: {
1382
+ style: { height: "calc(100% - 6px)" }
1383
+ },
1384
+ children: [
1385
+ {
1386
+ props: {
1387
+ className: "vuuShell-warningPlaceholder"
1388
+ },
1389
+ type: "Placeholder"
1390
+ }
1391
+ ]
1392
+ };
1393
+ const loadingJSON = {
1394
+ type: "Component",
1395
+ id: "loading-main",
1396
+ props: {}
1397
+ };
1398
+ const defaultWorkspaceJSON = {
1399
+ type: "Stack",
1400
+ id: vuuUtils.VuuShellLocation.Workspace,
1401
+ props: {
1402
+ className: `${vuuUtils.VuuShellLocation.Workspace}-tabs`,
1403
+ TabstripProps: {
1404
+ allowAddTab: true,
1405
+ allowCloseTab: true,
1406
+ allowRenameTab: true,
1407
+ animateSelectionThumb: false,
1408
+ "aria-label": "Workspace Tabs",
1409
+ location: "workspace-tab",
1410
+ variant: "primary"
1411
+ },
1412
+ preserve: true
1413
+ }
1414
+ };
1415
+ const getStackWorkspaceJSON = (activeLayoutIndex) => ({
1416
+ ...defaultWorkspaceJSON,
1417
+ active: activeLayoutIndex ?? 0
1418
+ });
1419
+ const placeholderLayout = {
1420
+ props: {
1421
+ id: "tab1",
1422
+ title: "Tab 1",
1423
+ className: "vuuShell-Placeholder"
1424
+ },
1425
+ type: "Placeholder"
1426
+ };
1427
+ const getWorkspaceWithLayoutJSON = (customWorkspaceJSON, layoutJSON = placeholderLayout, activeLayoutIndex, stackProps) => {
1428
+ const stackWorkspace = getStackWorkspaceJSON(activeLayoutIndex);
1429
+ if (Array.isArray(customWorkspaceJSON)) {
1430
+ const workspace = customWorkspaceJSON.find(
1431
+ (layout) => layout.id === vuuUtils.VuuShellLocation.Workspace
1432
+ );
1433
+ if (workspace) {
1434
+ return customWorkspaceJSON.map((ws) => {
1435
+ if (ws.id === vuuUtils.VuuShellLocation.Workspace) {
1436
+ return {
1437
+ ...ws,
1438
+ children: Array.isArray(layoutJSON) ? layoutJSON : [layoutJSON]
1439
+ };
1440
+ } else {
1441
+ return ws;
1442
+ }
1443
+ });
1444
+ } else {
1445
+ throw Error(
1446
+ "Multiple workspaces have been provided but none has the workspace id"
1447
+ );
1448
+ }
1449
+ } else if (customWorkspaceJSON) {
1450
+ return {
1451
+ ...customWorkspaceJSON,
1452
+ children: Array.isArray(layoutJSON) ? layoutJSON : [layoutJSON]
1453
+ };
1454
+ } else {
1455
+ return {
1456
+ ...stackWorkspace,
1457
+ props: {
1458
+ ...stackWorkspace.props,
1459
+ ...stackProps,
1460
+ TabstripProps: {
1461
+ ...stackWorkspace.props?.TabstripProps,
1462
+ ...stackProps?.TabstripProps
1463
+ }
1464
+ },
1465
+ children: Array.isArray(layoutJSON) ? layoutJSON : [layoutJSON]
1466
+ };
1467
+ }
1468
+ };
1469
+
1470
+ const { info } = vuuUtils.logger("useLayoutManager");
1471
+ const ensureLayoutHasTitle = (layout, layoutMetadata) => {
1472
+ if (layout.props?.title !== void 0) {
1473
+ return layout;
1474
+ } else {
1475
+ return {
1476
+ ...layout,
1477
+ props: {
1478
+ ...layout.props,
1479
+ title: layoutMetadata.name
1480
+ }
1481
+ };
1482
+ }
1483
+ };
1484
+ const loadingApplicationJSON = {
1485
+ workspaceJSON: loadingJSON
1486
+ };
1487
+ const WorkspaceProvider = ({
1488
+ TabstripProps,
1489
+ children,
1490
+ layoutJSON,
1491
+ activeLayoutIndex,
1492
+ layoutPlaceholderJSON,
1493
+ showTabs,
1494
+ workspaceJSON: customWorkspaceJSON
1495
+ }) => {
1496
+ const [layoutMetadata, setLayoutMetadata] = React.useState([]);
1497
+ const [, forceRefresh] = React.useState({});
1498
+ const notify = vuuPopups.useNotifications();
1499
+ const persistenceManager = usePersistenceManager();
1500
+ const applicationJSONRef = React.useRef(loadingApplicationJSON);
1501
+ const setApplicationJSON = React.useCallback(
1502
+ (applicationJSON, rerender = true) => {
1503
+ applicationJSONRef.current = applicationJSON;
1504
+ if (rerender) {
1505
+ forceRefresh({});
1506
+ }
1507
+ },
1508
+ []
1509
+ );
1510
+ const setWorkspaceJSON = React.useCallback(
1511
+ (workspaceJSON, rerender = true) => {
1512
+ setApplicationJSON(
1513
+ {
1514
+ ...applicationJSONRef.current,
1515
+ workspaceJSON
1516
+ },
1517
+ rerender
1518
+ );
1519
+ },
1520
+ [setApplicationJSON]
1521
+ );
1522
+ const setApplicationSettings = React.useCallback(
1523
+ (settings) => {
1524
+ setApplicationJSON(
1525
+ {
1526
+ ...applicationJSONRef.current,
1527
+ settings: {
1528
+ ...applicationJSONRef.current.settings,
1529
+ ...settings
1530
+ }
1531
+ },
1532
+ false
1533
+ );
1534
+ },
1535
+ [setApplicationJSON]
1536
+ );
1537
+ React.useEffect(() => {
1538
+ persistenceManager?.loadMetadata().then((metadata) => {
1539
+ setLayoutMetadata(metadata);
1540
+ }).catch((error) => {
1541
+ notify({
1542
+ type: "error",
1543
+ header: "Failed to Load Layouts",
1544
+ body: "Could not load list of available layouts"
1545
+ });
1546
+ console.error("Error occurred while retrieving metadata", error);
1547
+ });
1548
+ persistenceManager?.loadApplicationJSON().then((applicationJSON) => {
1549
+ if (applicationJSON) {
1550
+ info?.("applicationJSON loaded successfully");
1551
+ setApplicationJSON(applicationJSON);
1552
+ } else {
1553
+ const workspaceJSON = getWorkspaceWithLayoutJSON(
1554
+ customWorkspaceJSON,
1555
+ layoutJSON,
1556
+ activeLayoutIndex,
1557
+ { TabstripProps, showTabs }
1558
+ );
1559
+ info?.(`applicationJSON not found, getting defaultWorkspaceJSON,
1560
+ ${JSON.stringify(workspaceJSON, null, 2)}
1561
+ `);
1562
+ setApplicationJSON({
1563
+ workspaceJSON
1564
+ });
1565
+ }
1566
+ }).catch((error) => {
1567
+ notify({
1568
+ type: "error",
1569
+ header: "Failed to Load Layout",
1570
+ body: "Could not load your latest view"
1571
+ });
1572
+ console.error(
1573
+ "Error occurred while retrieving application layout",
1574
+ error
1575
+ );
1576
+ });
1577
+ }, [
1578
+ TabstripProps,
1579
+ activeLayoutIndex,
1580
+ customWorkspaceJSON,
1581
+ layoutJSON,
1582
+ notify,
1583
+ persistenceManager,
1584
+ setApplicationJSON,
1585
+ showTabs
1586
+ ]);
1587
+ const saveApplicationLayout = React.useCallback(
1588
+ (layout) => {
1589
+ if (vuuLayout.isLayoutJSON(layout)) {
1590
+ setWorkspaceJSON(layout, false);
1591
+ persistenceManager?.saveApplicationJSON(applicationJSONRef.current);
1592
+ } else {
1593
+ console.error("Tried to save invalid application layout", layout);
1594
+ }
1595
+ },
1596
+ [persistenceManager, setWorkspaceJSON]
1597
+ );
1598
+ const saveLayout = React.useCallback(
1599
+ (metadata) => {
1600
+ let layoutToSave;
1601
+ try {
1602
+ const { workspaceJSON } = applicationJSONRef.current;
1603
+ if (Array.isArray(workspaceJSON)) {
1604
+ console.log("how do we identify the right thing to save");
1605
+ } else {
1606
+ layoutToSave = vuuLayout.resolveJSONPath(
1607
+ workspaceJSON,
1608
+ `#${vuuUtils.VuuShellLocation.Workspace}.ACTIVE_CHILD`
1609
+ );
1610
+ }
1611
+ } catch (e) {
1612
+ }
1613
+ if (layoutToSave && vuuLayout.isLayoutJSON(layoutToSave)) {
1614
+ persistenceManager?.createLayout(metadata, ensureLayoutHasTitle(layoutToSave, metadata)).then((metadata2) => {
1615
+ notify({
1616
+ type: "success",
1617
+ header: "Layout Saved Successfully",
1618
+ body: `${metadata2.name} saved successfully`
1619
+ });
1620
+ setLayoutMetadata((prev) => [...prev, metadata2]);
1621
+ }).catch((error) => {
1622
+ notify({
1623
+ type: "error",
1624
+ header: "Failed to Save Layout",
1625
+ body: `Failed to save layout ${metadata.name}`
1626
+ });
1627
+ console.error("Error occurred while saving layout", error);
1628
+ });
1629
+ } else {
1630
+ console.error("Tried to save invalid layout", layoutToSave);
1631
+ notify({
1632
+ type: "error",
1633
+ header: "Failed to Save Layout",
1634
+ body: "Cannot save invalid layout"
1635
+ });
1636
+ }
1637
+ },
1638
+ [notify, persistenceManager]
1639
+ );
1640
+ const saveApplicationSettings = React.useCallback(
1641
+ (settings, key) => {
1642
+ const { settings: applicationSettings } = applicationJSONRef.current;
1643
+ if (key) {
1644
+ setApplicationSettings({
1645
+ ...applicationSettings,
1646
+ [key]: settings
1647
+ });
1648
+ } else {
1649
+ setApplicationSettings(settings);
1650
+ }
1651
+ persistenceManager?.saveApplicationJSON(applicationJSONRef.current);
1652
+ },
1653
+ [persistenceManager, setApplicationSettings]
1654
+ );
1655
+ const getApplicationSettings = React.useCallback(
1656
+ (key) => {
1657
+ const { settings } = applicationJSONRef.current;
1658
+ return key ? settings?.[key] : settings;
1659
+ },
1660
+ []
1661
+ );
1662
+ const loadLayoutById = React.useCallback(
1663
+ (id) => {
1664
+ persistenceManager?.loadLayout(id).then((layoutJson) => {
1665
+ const { workspaceJSON: currentLayout } = applicationJSONRef.current;
1666
+ if (Array.isArray(currentLayout)) {
1667
+ console.log("how do we deal witha amulti layoput");
1668
+ } else {
1669
+ setWorkspaceJSON({
1670
+ ...currentLayout,
1671
+ children: (currentLayout.children || []).concat(layoutJson),
1672
+ props: {
1673
+ ...currentLayout.props,
1674
+ active: currentLayout.children?.length ?? 0
1675
+ }
1676
+ });
1677
+ }
1678
+ }).catch((error) => {
1679
+ notify({
1680
+ type: "error",
1681
+ header: "Failed to Load Layout",
1682
+ body: "Failed to load the requested layout"
1683
+ });
1684
+ console.error("Error occurred while loading layout", error);
1685
+ });
1686
+ },
1687
+ [notify, persistenceManager, setWorkspaceJSON]
1688
+ );
1689
+ return /* @__PURE__ */ jsxRuntime.jsx(
1690
+ vuuUtils.WorkspaceContext.Provider,
1691
+ {
1692
+ value: {
1693
+ getApplicationSettings,
1694
+ layoutMetadata,
1695
+ layoutPlaceholderJSON,
1696
+ saveLayout,
1697
+ workspaceJSON: applicationJSONRef.current.workspaceJSON,
1698
+ saveApplicationLayout,
1699
+ saveApplicationSettings,
1700
+ loadLayoutById
1701
+ },
1702
+ children
1703
+ }
1704
+ );
1705
+ };
1706
+ const useWorkspace = () => {
1707
+ const { workspaceJSON = getWorkspaceWithLayoutJSON(), ...contextProps } = React.useContext(vuuUtils.WorkspaceContext);
1708
+ return {
1709
+ ...contextProps,
1710
+ workspaceJSON
1711
+ };
1712
+ };
1713
+
1714
+ var layoutListCss = ".vuuLayoutList {\n --vuuMeasuredContainer-flex: 1 1 1px;\n --vuuList-borderStyle: none;\n --vuuListItem-separator-color: transparent;\n\n background: var(\n --vuuLayoutList-background,\n var(--salt-container-primary-background)\n );\n display: flex;\n flex-direction: column;\n height: 100%;\n padding: 0 var(--vuuLayoutList-padding, 0);\n\n .vuuListItem {\n border-bottom: none;\n justify-content: space-between;\n }\n}\n\n.vuuLayoutList-header {\n align-items: center;\n display: flex;\n flex: 0 0 48px;\n font-weight: 700;\n line-height: 2;\n}\n\n.vuuLayoutList-content {\n display: flex;\n flex: 1 1 auto;\n flex-direction: column;\n font-size: 12px;\n font-weight: 700;\n overflow: auto;\n}\n\n.vuuLayoutList-group {\n --vuuMeasuredContainer-flex: 0 0 auto;\n\n display: flex;\n flex-direction: column;\n\n .vuuLayoutList-groupHeader {\n flex: 0 0 32px;\n padding: 8px 0;\n }\n\n .vuuPalette {\n flex: 1 1 auto;\n height: auto;\n }\n}\n\n.vuuLayoutList-group:first-child {\n margin-top: 12px;\n}\n\n.vuuLayoutList-group + .vuuLayoutList-group {\n margin-top: 24px;\n}\n\n/* .vuuLayoutList-groupName {\n display: flex;\n padding-top: 24px;\n width: var(--vuuLayoutList-width);\n font-feature-settings: \"ss02\" on, \"ss01\" on, \"salt\" on, \"liga\" off;\n font-size: 12px;\n font-style: normal;\n font-weight: 700;\n line-height: 200%;\n letter-spacing: 0.48px;\n text-transform: uppercase;\n} */\n\n.vuuLayoutList-screenshot {\n width: 60px;\n height: 45.6px;\n border: 1px solid #d6d7da;\n}\n\n.vuuLayoutList-layoutDetails {\n color: var(--light-text-secondary, #606477);\n font-size: 10px;\n font-weight: 600;\n line-height: 150%;\n}\n";
1715
+
1716
+ const classBase$7 = "vuuLayoutList";
1717
+ const NO_SELECTION = [];
1718
+ const LayoutList = ({
1719
+ className,
1720
+ title,
1721
+ ...htmlAttributes
1722
+ }) => {
1723
+ const targetWindow = window$1.useWindow();
1724
+ styles.useComponentCssInjection({
1725
+ testId: "vuu-layout-list",
1726
+ css: layoutListCss,
1727
+ window: targetWindow
1728
+ });
1729
+ const { layoutMetadata, loadLayoutById } = useWorkspace();
1730
+ const { systemLayouts } = useLayouts();
1731
+ const handleLoadLayout = React.useCallback(
1732
+ (layoutId) => {
1733
+ if (layoutId) {
1734
+ loadLayoutById(layoutId);
1735
+ }
1736
+ },
1737
+ [loadLayoutById]
1738
+ );
1739
+ const dispatch = vuuLayout.useLayoutProviderDispatch();
1740
+ const handleLoadSysLayout = (layoutId, layoutJSON) => {
1741
+ if (layoutJSON) {
1742
+ dispatch({
1743
+ type: "add",
1744
+ path: `#${vuuUtils.VuuShellLocation.Workspace}`,
1745
+ component: vuuLayout.layoutFromJson(layoutJSON, "0")
1746
+ });
1747
+ } else {
1748
+ throw Error("layoutJSON is required for system layouts");
1749
+ }
1750
+ };
1751
+ const layoutsByGroup = layoutMetadata.reduce((acc, cur) => {
1752
+ if (acc[cur.group]) {
1753
+ return {
1754
+ ...acc,
1755
+ [cur.group]: [...acc[cur.group], cur]
1756
+ };
1757
+ }
1758
+ return {
1759
+ ...acc,
1760
+ [cur.group]: [cur]
1761
+ };
1762
+ }, {});
1763
+ let sysContent = [];
1764
+ if (systemLayouts) {
1765
+ sysContent = [
1766
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `${classBase$7}-group`, children: [
1767
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: `${classBase$7}-groupHeader`, children: "System Layout" }),
1768
+ /* @__PURE__ */ jsxRuntime.jsx(core.ListBox, { selected: NO_SELECTION, children: systemLayouts.map((layout) => /* @__PURE__ */ jsxRuntime.jsx(core.Option, { value: layout, children: /* @__PURE__ */ React.createElement(
1769
+ LayoutTile,
1770
+ {
1771
+ ...htmlAttributes,
1772
+ key: layout.id,
1773
+ metadata: layout,
1774
+ onLoadLayout: handleLoadSysLayout
1775
+ }
1776
+ ) }, layout.id)) })
1777
+ ] }, 0)
1778
+ ];
1779
+ }
1780
+ const content = React.useMemo(() => {
1781
+ return Object.entries(layoutsByGroup).map(
1782
+ ([heading, layoutMetadata2], index) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `${classBase$7}-group`, children: [
1783
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: `${classBase$7}-groupHeader`, children: heading }),
1784
+ /* @__PURE__ */ jsxRuntime.jsx(core.ListBox, { selected: NO_SELECTION, children: layoutMetadata2.map((layout) => /* @__PURE__ */ jsxRuntime.jsxs(core.Option, { value: layout, children: [
1785
+ /* @__PURE__ */ React.createElement(
1786
+ LayoutTile,
1787
+ {
1788
+ ...htmlAttributes,
1789
+ key: layout.id,
1790
+ metadata: layout,
1791
+ onLoadLayout: handleLoadLayout
1792
+ }
1793
+ ),
1794
+ /* @__PURE__ */ jsxRuntime.jsx(
1795
+ vuuUiControls.IconButton,
1796
+ {
1797
+ className: `${classBase$7}-menu`,
1798
+ "data-embedded": true,
1799
+ icon: "more-vert",
1800
+ appearance: "transparent",
1801
+ sentiment: "neutral"
1802
+ }
1803
+ )
1804
+ ] }, layout.id)) })
1805
+ ] }, index)
1806
+ );
1807
+ }, [handleLoadLayout, htmlAttributes, layoutsByGroup]);
1808
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { ...htmlAttributes, className: cx(classBase$7, "vuuScrollable"), children: [
1809
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: `${classBase$7}-header`, children: title }),
1810
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: `${classBase$7}-content`, children: [sysContent, ...content] })
1811
+ ] });
1812
+ };
1813
+
1814
+ const useWorkspaceContextMenuItems = () => {
1815
+ const { saveLayout } = useWorkspace();
1816
+ const { showDialog, closeDialog } = vuuPopups.useDialogContext();
1817
+ const handleCloseDialog = React.useCallback(() => {
1818
+ closeDialog();
1819
+ }, [closeDialog]);
1820
+ const handleSave = React.useCallback(
1821
+ (layoutMetadata) => {
1822
+ saveLayout(layoutMetadata);
1823
+ closeDialog();
1824
+ },
1825
+ [saveLayout, closeDialog]
1826
+ );
1827
+ const [buildMenuOptions, handleMenuAction] = React.useMemo(() => {
1828
+ return [
1829
+ (location, options) => {
1830
+ const locations = location.split(" ");
1831
+ const menuDescriptors = [];
1832
+ if (locations.includes("workspace-tab")) {
1833
+ menuDescriptors.push(
1834
+ {
1835
+ label: "Save Layout",
1836
+ id: "save-layout",
1837
+ options
1838
+ },
1839
+ {
1840
+ label: "Layout Settings",
1841
+ id: "layout-settings",
1842
+ options
1843
+ }
1844
+ );
1845
+ }
1846
+ return menuDescriptors;
1847
+ },
1848
+ (menuItemId, options) => {
1849
+ if (menuItemId === "save-layout") {
1850
+ showDialog(
1851
+ /* @__PURE__ */ jsxRuntime.jsx(
1852
+ SaveLayoutPanel,
1853
+ {
1854
+ onCancel: handleCloseDialog,
1855
+ onSave: handleSave,
1856
+ componentId: options?.controlledComponentId,
1857
+ defaultTitle: options?.controlledComponentTitle
1858
+ }
1859
+ ),
1860
+ "Save Layout",
1861
+ [],
1862
+ true
1863
+ );
1864
+ return true;
1865
+ }
1866
+ return false;
1867
+ }
1868
+ ];
1869
+ }, [handleCloseDialog, handleSave, showDialog]);
1870
+ return {
1871
+ buildMenuOptions,
1872
+ handleMenuAction
1873
+ };
1874
+ };
1875
+
1876
+ var leftNavCss = ".vuuLeftNav {\n --vuuOverflowContainer-height: auto;\n --vuuFeatureList-padding: 195px 32px 16px 24px;\n --salt-navigable-fontWeight-active: 700;\n --vuuTab-background-selected: rgba(255, 255, 255, 0.1);\n --vuuTab-hover-background: rgba(255, 255, 255, 0.1);\n --vuuTab-before-content: none;\n --vuuTab-borderRadius: 6px;\n --vuuTab-height: 40px;\n --vuuTabstrip-fontWeight: 700;\n --vuuTabstrip-width: 100%;\n --svg-demo: url('data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\"><path d=\"M11.3333 11C11.52 11 11.6667 10.8533 11.6667 10.6667C11.6667 10.48 11.52 10.3333 11.3333 10.3333C11.1467 10.3333 11 10.48 11 10.6667C11 10.8533 11.1467 11 11.3333 11Z\"/><path d=\"M5.99999 8.66667C6.36818 8.66667 6.66666 8.36819 6.66666 8C6.66666 7.63181 6.36818 7.33334 5.99999 7.33334C5.63181 7.33334 5.33333 7.63181 5.33333 8C5.33333 8.36819 5.63181 8.66667 5.99999 8.66667Z\"/><path d=\"M8.66667 6C9.03486 6 9.33333 5.70152 9.33333 5.33333C9.33333 4.96514 9.03486 4.66667 8.66667 4.66667C8.29848 4.66667 8 4.96514 8 5.33333C8 5.70152 8.29848 6 8.66667 6Z\"/><path d=\"M8.66667 11.3333C9.03486 11.3333 9.33333 11.0349 9.33333 10.6667C9.33333 10.2985 9.03486 10 8.66667 10C8.29848 10 8 10.2985 8 10.6667C8 11.0349 8.29848 11.3333 8.66667 11.3333Z\"/><path d=\"M11.3333 8.33333C11.52 8.33333 11.6667 8.18666 11.6667 8C11.6667 7.81333 11.52 7.66666 11.3333 7.66666C11.1467 7.66666 11 7.81333 11 8C11 8.18666 11.1467 8.33333 11.3333 8.33333Z\"/><path d=\"M8.66667 8.66667C9.03486 8.66667 9.33333 8.36819 9.33333 8C9.33333 7.63181 9.03486 7.33334 8.66667 7.33334C8.29848 7.33334 8 7.63181 8 8C8 8.36819 8.29848 8.66667 8.66667 8.66667Z\"/><path d=\"M2 2H14V3.33333H2V2Z\"/><path d=\"M3.33333 6.33333C3.88561 6.33333 4.33333 5.88562 4.33333 5.33333C4.33333 4.78105 3.88561 4.33333 3.33333 4.33333C2.78104 4.33333 2.33333 4.78105 2.33333 5.33333C2.33333 5.88562 2.78104 6.33333 3.33333 6.33333Z\"/><path d=\"M3.33333 9C3.88561 9 4.33333 8.55228 4.33333 8C4.33333 7.44772 3.88561 7 3.33333 7C2.78104 7 2.33333 7.44772 2.33333 8C2.33333 8.55228 2.78104 9 3.33333 9Z\"/><path d=\"M3.33333 11.6667C3.88561 11.6667 4.33333 11.2189 4.33333 10.6667C4.33333 10.1144 3.88561 9.66666 3.33333 9.66666C2.78104 9.66666 2.33333 10.1144 2.33333 10.6667C2.33333 11.2189 2.78104 11.6667 3.33333 11.6667Z\"/><path d=\"M11.3333 5.66667C11.52 5.66667 11.6667 5.52 11.6667 5.33333C11.6667 5.14667 11.52 5 11.3333 5C11.1467 5 11 5.14667 11 5.33333C11 5.52 11.1467 5.66667 11.3333 5.66667Z\"/><path d=\"M5.99999 11.3333C6.36818 11.3333 6.66666 11.0349 6.66666 10.6667C6.66666 10.2985 6.36818 10 5.99999 10C5.63181 10 5.33333 10.2985 5.33333 10.6667C5.33333 11.0349 5.63181 11.3333 5.99999 11.3333Z\"/><path d=\"M5.99999 6C6.36818 6 6.66666 5.70152 6.66666 5.33333C6.66666 4.96514 6.36818 4.66667 5.99999 4.66667C5.63181 4.66667 5.33333 4.96514 5.33333 5.33333C5.33333 5.70152 5.63181 6 5.99999 6Z\"/><path d=\"M2 12.6667H14V14H2V12.6667Z\"/></svg>');\n --svg-features: url('data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\"><path d=\"M15.3333 12.6667H14L14 3.33334H15.3333L15.3333 12.6667ZM12.6667 12.6667H11.3333L11.3333 3.33334H12.6667L12.6667 12.6667ZM1.33333 12.6667L9.33333 12.6667C9.69999 12.6667 9.99999 12.3667 9.99999 12V4.00001C9.99999 3.63334 9.69999 3.33334 9.33333 3.33334L1.33333 3.33334C0.966661 3.33334 0.666661 3.63334 0.666661 4.00001L0.666661 12C0.666661 12.3667 0.966661 12.6667 1.33333 12.6667ZM1.99999 4.66667L8.66666 4.66667V11.3333L1.99999 11.3333L1.99999 4.66667Z\"/></svg>');\n --svg-tables: url('data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\"><path d=\"M2 6H4.66667V3.33334H3.33333C2.6 3.33334 2 3.93334 2 4.66667V6ZM2 9.33334H4.66667V6.66667H2V9.33334ZM5.33333 9.33334H8V6.66667H5.33333V9.33334ZM8.66667 9.33334H11.3333V6.66667H8.66667V9.33334ZM5.33333 6H8V3.33334H5.33333V6ZM8.66667 3.33334V6H11.3333V3.33334H8.66667ZM12 9.33334H14.6667V6.66667H12V9.33334ZM3.33333 12.6667H4.66667V10H2V11.3333C2 12.0667 2.6 12.6667 3.33333 12.6667ZM5.33333 12.6667H8V10H5.33333V12.6667ZM8.66667 12.6667H11.3333V10H8.66667V12.6667ZM12 12.6667H13.3333C14.0667 12.6667 14.6667 12.0667 14.6667 11.3333V10H12V12.6667ZM12 3.33334V6H14.6667V4.66667C14.6667 3.93334 14.0667 3.33334 13.3333 3.33334H12Z\"/></svg>');\n --svg-layouts: url('data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\"><path d=\"M15.3333 10H14V11.3333H15.3333V10ZM15.3333 12.6667H14V14H15.3333V12.6667ZM15.3333 7.33333H14V8.66667H15.3333V7.33333ZM10 2H8.66667V3.33333H10V2ZM15.3333 4.66667H14V6H15.3333V4.66667ZM0.666672 14H7.33334V10H0.666672V14ZM2.00001 4.66667H0.666672V6H2.00001V4.66667ZM10 12.6667H8.66667V14H10V12.6667ZM12.6667 2H11.3333V3.33333H12.6667V2ZM15.3333 2H14V3.33333H15.3333V2ZM12.6667 12.6667H11.3333V14H12.6667V12.6667ZM2.00001 7.33333H0.666672V8.66667H2.00001V7.33333ZM7.33334 2H6.00001V3.33333H7.33334V2ZM4.66667 2H3.33334V3.33333H4.66667V2ZM2.00001 2H0.666672V3.33333H2.00001V2Z\"/></svg>');\n --vuu-light-text-primary: #15171b;\n\n --menu-level-2-width: 0px;\n\n box-shadow: 3px 4px 4px 0 rgba(0, 0, 0, 0.15);\n display: flex;\n height: calc(100% - 4px);\n margin-bottom: 4px;\n overflow: hidden;\n position: relative;\n transition: width 0.2s ease-out;\n z-index: 0;\n /* width: calc(var(--menu-width) + var(--menu-level-2-width)); */\n /* width: 100%; */\n}\n\n.vuuLeftNav-menu-full {\n --menu-width: var(--nav-menu-expanded-width);\n}\n\n.vuuLeftNav-menu-icons {\n --menu-width: var(--nav-menu-collapsed-width);\n}\n\n.vuuLeftNav-menu-icons-content {\n --menu-width: var(--nav-menu-collapsed-width);\n --menu-level-2-width: var(--nav-menu-content-width);\n}\n\n.vuuLeftNav-menu-full-content {\n --menu-width: var(--nav-menu-expanded-width);\n --menu-level-2-width: var(--nav-menu-content-width);\n}\n\n.vuuLeftNav-menu-icons-content .vuuLeftNav-menu-secondary,\n.vuuLeftNav-menu-full-content .vuuLeftNav-menu-secondary {\n display: flex;\n}\n\n.vuuLeftNav-menu-primary {\n background-color: #2a015f;\n container-type: inline-size;\n display: flex;\n flex-direction: column;\n height: 100%;\n padding: 32px 16px;\n transition: flex-basis ease-out 0.2s;\n flex-grow: 0;\n flex-shrink: 0;\n flex-basis: var(--menu-width);\n}\n\n.vuuLeftNav-menu-secondary {\n flex: 1 1 auto;\n display: none;\n /* position: absolute; */\n top: 0;\n right: 0;\n flex-grow: 0;\n flex-shrink: 0;\n flex-basis: var(--nav-menu-content-width, 240px);\n z-index: -1;\n\n .vuuTabs-tabPanel {\n background: var(--salt-container-primary-background);\n height: 100%;\n padding: 34px 32px 8px 24px;\n }\n}\n\n.vuuLeftNav .vuuTabstrip {\n margin-top: 102px;\n}\n\n.vuuLeftNav .vuuTab {\n --vuuTab-focusVisible-color: pink;\n --vuu-icon-color: white;\n --vuu-icon-left: 12px;\n --vuu-icon-size: 16px;\n border-left: solid 4px transparent;\n padding: 0 0 0 48px;\n}\n\n.vuuLeftNav .vuuTab-selected {\n --vuu-icon-color: var(--salt-navigable-indicator-active);\n border-left: solid 4px var(--salt-navigable-indicator-active);\n}\n\n.vuuLeftNav-logo {\n display: flex;\n flex: 0 0 auto;\n justify-content: center;\n}\n\n.vuuLeftNav-main {\n flex: 1 1 auto;\n}\n\n.vuuLeftNav-menu {\n color: white;\n margin-top: 102px;\n padding: 0;\n}\n\n.vuuLeftNav [data-icon=\"demo\"] {\n --vuu-icon-svg: var(--svg-demo);\n}\n\n.vuuLeftNav [data-icon=\"tables\"] {\n --vuu-icon-svg: var(--svg-tables);\n}\n\n.vuuLeftNav [data-icon=\"features\"] {\n --vuu-icon-svg: var(--svg-features);\n}\n\n.vuuLeftNav [data-icon=\"layouts\"] {\n --vuu-icon-svg: var(--svg-layouts);\n}\n\n@container (max-width: 100px) {\n .vuuTab {\n /* --vuu-icon-left: 12px !important; */\n --vuuTab-padding: 0 0 0 42px;\n }\n\n .vuuTab-main {\n display: none !important;\n }\n}\n\n.vuuLeftNav-buttonBar {\n align-items: center;\n display: flex;\n flex: 0 0 100px;\n justify-content: center;\n}\n\n.vuuLeftNav-toggleButton {\n --vuu-icon-color: var(--vuu-light-text-primary);\n --vuu-icon-left: 11px;\n --vuu-icon-top: 10px;\n --vuu-icon-size: 16px;\n background-color: var(--salt-navigable-indicator-active);\n border-width: 0;\n border-radius: 18px;\n height: 36px;\n position: relative;\n width: 36px;\n}\n\n.vuuLeftNav-toggleButton-open {\n --vuu-icon-left: 9px;\n}\n\n.vuuLeftNav-drawer {\n display: flex;\n padding: 0 0 0 24px;\n flex-direction: column;\n align-items: flex-start;\n flex-shrink: 0;\n align-self: stretch;\n background: #fff;\n box-shadow: 3px 4px 4px 0 rgba(0, 0, 0, 0.15);\n height: 100%;\n}\n";
1877
+
1878
+ const classBase$6 = "vuuLeftNav";
1879
+ const getDisplayStatus = (activeTabIndex, expanded) => {
1880
+ if (activeTabIndex === 0) {
1881
+ return expanded ? "menu-full" : "menu-icons";
1882
+ } else {
1883
+ return expanded ? "menu-full-content" : "menu-icons-content";
1884
+ }
1885
+ };
1886
+ const byModule = (f1, f2) => {
1887
+ const t1 = f1.ComponentProps?.tableSchema.table;
1888
+ const t2 = f2.ComponentProps?.tableSchema.table;
1889
+ if (t1 && t2) {
1890
+ const m1 = t1.module.toLowerCase();
1891
+ const m2 = t2.module.toLowerCase();
1892
+ if (m1 < m2) {
1893
+ return -1;
1894
+ } else if (m1 > m2) {
1895
+ return 1;
1896
+ } else if (t1.table < t2.table) {
1897
+ return -1;
1898
+ } else if (t1.table > t2.table) {
1899
+ return 1;
1900
+ } else {
1901
+ return 0;
1902
+ }
1903
+ } else {
1904
+ throw Error("Invalid tableFeature");
1905
+ }
1906
+ };
1907
+ const LeftNav = (props) => {
1908
+ const dispatch = vuuLayout.useLayoutProviderDispatch();
1909
+ const {
1910
+ "data-path": path,
1911
+ defaultExpanded = true,
1912
+ defaultActiveTabIndex = 0,
1913
+ onActiveChange,
1914
+ onTogglePrimaryMenu,
1915
+ sizeCollapsed = 80,
1916
+ sizeContent = 300,
1917
+ sizeExpanded = 240,
1918
+ style: styleProp,
1919
+ ...htmlAttributes
1920
+ } = props;
1921
+ const targetWindow = window$1.useWindow();
1922
+ styles.useComponentCssInjection({
1923
+ testId: "vuu-left-nav",
1924
+ css: leftNavCss,
1925
+ window: targetWindow
1926
+ });
1927
+ const { dynamicFeatures = [], tableFeatures = [] } = useFeatures();
1928
+ const [navState, setNavState] = React.useState({
1929
+ activeTabIndex: defaultActiveTabIndex,
1930
+ expanded: defaultExpanded
1931
+ });
1932
+ const tableFeaturesByGroup = React.useMemo(
1933
+ () => tableFeatures?.sort(byModule).reduce((acc, filterTableFeature) => {
1934
+ if (vuuUtils.hasFilterTableFeatureProps(filterTableFeature)) {
1935
+ const { table } = filterTableFeature.ComponentProps.tableSchema;
1936
+ const key = `${table.module} Tables`;
1937
+ if (!acc[key]) {
1938
+ acc[key] = [];
1939
+ }
1940
+ return {
1941
+ ...acc,
1942
+ [key]: acc[key].concat(filterTableFeature)
1943
+ };
1944
+ } else {
1945
+ return acc;
1946
+ }
1947
+ }, {}),
1948
+ [tableFeatures]
1949
+ );
1950
+ const getFullWidth = React.useCallback(
1951
+ (tabIndex, expanded) => {
1952
+ if (tabIndex === 0) {
1953
+ return expanded ? sizeExpanded : sizeCollapsed;
1954
+ } else {
1955
+ return expanded ? sizeExpanded + sizeContent : sizeCollapsed + sizeContent;
1956
+ }
1957
+ },
1958
+ [sizeCollapsed, sizeContent, sizeExpanded]
1959
+ );
1960
+ const handleTabSelection = React.useCallback(
1961
+ (activeTabIndex) => {
1962
+ const { activeTabIndex: currentIndex, expanded } = navState;
1963
+ const newState = { activeTabIndex, expanded };
1964
+ setNavState(newState);
1965
+ if (activeTabIndex === 0 || currentIndex === 0) {
1966
+ const width = getFullWidth(activeTabIndex, expanded);
1967
+ dispatch({
1968
+ type: "layout-resize",
1969
+ path: "#vuu-side-panel",
1970
+ size: width
1971
+ });
1972
+ }
1973
+ onActiveChange?.(activeTabIndex);
1974
+ },
1975
+ [dispatch, getFullWidth, navState, onActiveChange]
1976
+ );
1977
+ const displayStatus = getDisplayStatus(
1978
+ navState.activeTabIndex,
1979
+ navState.expanded
1980
+ );
1981
+ const toggleExpanded = React.useCallback(() => {
1982
+ const { activeTabIndex, expanded } = navState;
1983
+ const primaryMenuExpanded = !expanded;
1984
+ const newState = { activeTabIndex, expanded: primaryMenuExpanded };
1985
+ setNavState(newState);
1986
+ dispatch({
1987
+ type: "layout-resize",
1988
+ path: "#vuu-side-panel",
1989
+ size: getFullWidth(activeTabIndex, primaryMenuExpanded)
1990
+ });
1991
+ onTogglePrimaryMenu?.(primaryMenuExpanded);
1992
+ }, [dispatch, getFullWidth, navState, onTogglePrimaryMenu]);
1993
+ const style = {
1994
+ ...styleProp,
1995
+ "--nav-menu-collapsed-width": `${sizeCollapsed}px`,
1996
+ "--nav-menu-expanded-width": `${sizeExpanded}px`,
1997
+ "--nav-menu-content-width": `${sizeContent}px`
1998
+ };
1999
+ return /* @__PURE__ */ jsxRuntime.jsxs(
2000
+ "div",
2001
+ {
2002
+ ...htmlAttributes,
2003
+ className: cx(classBase$6, `${classBase$6}-${displayStatus}`),
2004
+ style,
2005
+ children: [
2006
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cx(`${classBase$6}-menu-primary`), "data-mode": "dark", children: [
2007
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "vuuLeftNav-logo", children: /* @__PURE__ */ jsxRuntime.jsx(vuuIcons.VuuLogo, {}) }),
2008
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: `${classBase$6}-main`, children: /* @__PURE__ */ jsxRuntime.jsxs(
2009
+ vuuUiControls.Tabstrip,
2010
+ {
2011
+ activeTabIndex: navState.activeTabIndex,
2012
+ animateSelectionThumb: false,
2013
+ className: `${classBase$6}-Tabstrip`,
2014
+ onActiveChange: handleTabSelection,
2015
+ orientation: "vertical",
2016
+ children: [
2017
+ /* @__PURE__ */ jsxRuntime.jsx(vuuUiControls.Tab, { "data-icon": "demo", label: "DEMO" }),
2018
+ /* @__PURE__ */ jsxRuntime.jsx(vuuUiControls.Tab, { "data-icon": "features", label: "VUU FEATURES" }),
2019
+ /* @__PURE__ */ jsxRuntime.jsx(vuuUiControls.Tab, { "data-icon": "tables", label: "VUU TABLES" }),
2020
+ /* @__PURE__ */ jsxRuntime.jsx(vuuUiControls.Tab, { "data-icon": "layouts", label: "MY LAYOUTS" })
2021
+ ]
2022
+ }
2023
+ ) }),
2024
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "vuuLeftNav-buttonBar", children: /* @__PURE__ */ jsxRuntime.jsx(
2025
+ "button",
2026
+ {
2027
+ className: cx("vuuLeftNav-toggleButton", {
2028
+ "vuuLeftNav-toggleButton-open": displayStatus.startsWith("menu-full"),
2029
+ "vuuLeftNav-toggleButton-closed": displayStatus.startsWith("menu-icons")
2030
+ }),
2031
+ "data-icon": displayStatus.startsWith("menu-full") ? "chevron-left" : "chevron-right",
2032
+ onClick: toggleExpanded
2033
+ }
2034
+ ) })
2035
+ ] }),
2036
+ /* @__PURE__ */ jsxRuntime.jsxs(
2037
+ vuuLayout.Stack,
2038
+ {
2039
+ active: navState.activeTabIndex - 1,
2040
+ className: `${classBase$6}-menu-secondary`,
2041
+ showTabs: false,
2042
+ children: [
2043
+ /* @__PURE__ */ jsxRuntime.jsx(FeatureList, { features: dynamicFeatures, title: "VUU FEATURES" }),
2044
+ /* @__PURE__ */ jsxRuntime.jsx(FeatureList, { features: tableFeaturesByGroup, title: "VUU TABLES" }),
2045
+ /* @__PURE__ */ jsxRuntime.jsx(LayoutList, { title: "MY LAYOUTS" })
2046
+ ]
2047
+ }
2048
+ )
2049
+ ]
2050
+ }
2051
+ );
2052
+ };
2053
+
2054
+ var contextPanelCss = ".vuuContextPanel {\n position: relative;\n transition: width 0.3s ease-in-out;\n width: var(--vuu-side-panel-width, 0px) !important;\n z-index: 1;\n}\n\n.vuuContextPanel-expanded {\n --vuu-side-panel-width: var(--vuuContextPanel-width, 300px) !important;\n --vuu-side-panel-shadow: -4px 4px 4px rgba(0, 0, 0, 0.1);\n --vuu-side-panel-padding: var(--vuuContextPanel-padding, 24px);\n}\n\n.vuuContextPanel-overlay {\n width: 0px !important;\n}\n\n.vuuContextPanel-inner {\n background-color: var(--salt-container-primary-background);\n box-shadow: var(--vuu-side-panel-shadow, none);\n display: flex;\n flex-direction: column;\n height: 100%;\n min-width: 0 !important;\n overflow: auto;\n padding-bottom: 24px;\n padding-top: 24px;\n padding: var(--vuu-side-panel-padding);\n position: absolute !important;\n right: 0;\n top: 0;\n transition-property: padding-left, padding-right, width;\n transition-duration: 0.3s;\n transition-timing-function: ease-in-out;\n width: var(--vuu-side-panel-width, 0px);\n}\n\n.vuuContextPanel-header {\n align-items: center;\n display: flex;\n flex-wrap: nowrap;\n flex: 0 0 27px !important;\n height: var(--vuuContextPanel-header-height, 48px);\n justify-content: space-between;\n}\n\n.vuuContextPanel-title {\n font-size: 20px;\n font-weight: 700;\n white-space: nowrap;\n}\n\n.vuuContextPanel-content {\n flex: 1 1 auto;\n overflow-y: auto;\n width: 100%;\n}\n";
2055
+
2056
+ const classBase$5 = "vuuContextPanel";
2057
+ const ContextPanel = ({
2058
+ className: classNameProp,
2059
+ expanded = false,
2060
+ content: contentProp,
2061
+ id,
2062
+ onClose,
2063
+ overlay = false,
2064
+ title
2065
+ }) => {
2066
+ const targetWindow = window$1.useWindow();
2067
+ styles.useComponentCssInjection({
2068
+ testId: "vuu-context-panel",
2069
+ css: contextPanelCss,
2070
+ window: targetWindow
2071
+ });
2072
+ const closeButtonRef = React.useRef(null);
2073
+ const dispatchLayoutAction = vuuLayout.useLayoutProviderDispatch();
2074
+ const handleClose = React.useCallback(() => {
2075
+ dispatchLayoutAction({
2076
+ path: `#${vuuUtils.VuuShellLocation.ContextPanel}`,
2077
+ propName: "expanded",
2078
+ propValue: false,
2079
+ type: "set-prop"
2080
+ });
2081
+ }, [dispatchLayoutAction]);
2082
+ const handleKeyDown = React.useCallback(
2083
+ (e) => {
2084
+ if (e.key === "Escape") {
2085
+ handleClose();
2086
+ }
2087
+ },
2088
+ [handleClose]
2089
+ );
2090
+ const className = cx(classBase$5, classNameProp, {
2091
+ [`${classBase$5}-expanded`]: expanded,
2092
+ [`${classBase$5}-inline`]: overlay !== true,
2093
+ [`${classBase$5}-overlay`]: overlay
2094
+ });
2095
+ const content = React.useMemo(
2096
+ () => contentProp && expanded ? vuuLayout.layoutFromJson(contentProp, "context-0") : null,
2097
+ [contentProp, expanded]
2098
+ );
2099
+ React.useLayoutEffect(() => {
2100
+ if (expanded) {
2101
+ closeButtonRef.current?.focus();
2102
+ } else {
2103
+ onClose?.();
2104
+ }
2105
+ }, [expanded, onClose]);
2106
+ return /* @__PURE__ */ jsxRuntime.jsx(
2107
+ "div",
2108
+ {
2109
+ className: cx(classBase$5, className, "vuuScrollable", {
2110
+ [`${classBase$5}-expanded`]: expanded
2111
+ }),
2112
+ id,
2113
+ children: /* @__PURE__ */ jsxRuntime.jsxs(vuuLayout.View, { className: `${classBase$5}-inner`, header: false, id, children: [
2114
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `${classBase$5}-header`, children: [
2115
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { className: `${classBase$5}-title`, children: title }),
2116
+ /* @__PURE__ */ jsxRuntime.jsx(
2117
+ vuuUiControls.IconButton,
2118
+ {
2119
+ className: `${classBase$5}-close`,
2120
+ "data-embedded": true,
2121
+ icon: "close",
2122
+ onClick: handleClose,
2123
+ onKeyDown: handleKeyDown,
2124
+ ref: closeButtonRef,
2125
+ size: 16,
2126
+ variant: "secondary"
2127
+ }
2128
+ )
2129
+ ] }),
2130
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: `${classBase$5}-content`, children: content })
2131
+ ] })
2132
+ }
2133
+ );
2134
+ };
2135
+
2136
+ var sidePanelCss = ".vuuShellSidePanel {\n transition: width .2s ease-out;\n width: var(--shell-left-nav-size);\n}";
2137
+
2138
+ const classBase$4 = "vuuShellSidePanel";
2139
+ const SidePanel = ({
2140
+ children,
2141
+ open = true,
2142
+ sizeClosed = 90,
2143
+ sizeOpen = 200,
2144
+ style: styleProp,
2145
+ ...htmlAttributes
2146
+ }) => {
2147
+ const targetWindow = window$1.useWindow();
2148
+ styles.useComponentCssInjection({
2149
+ testId: "vuu-side-panel",
2150
+ css: sidePanelCss,
2151
+ window: targetWindow
2152
+ });
2153
+ const style = React.useMemo(
2154
+ () => ({
2155
+ ...styleProp,
2156
+ "--shell-left-nav-size": open ? `${sizeOpen}px` : `${sizeClosed}px`
2157
+ }),
2158
+ [open, sizeClosed, sizeOpen, styleProp]
2159
+ );
2160
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { ...htmlAttributes, className: cx(classBase$4), style, children });
2161
+ };
2162
+
2163
+ var appStatusBarCss = ".vuuAppStatusBar {\n align-items: center;\n background-color: var(--salt-container-secondary-background);\n display: flex;\n height: 36px;\n justify-content: flex-end;\n}\n.vuuAppStatusBar-hidden {\n display: none;\n}\n";
2164
+
2165
+ const classBase$3 = "vuuAppStatusBar";
2166
+ const shouldShowStatusBar = (connected, settings) => {
2167
+ if (settings && "showAppStatusBar" in settings) {
2168
+ return settings.showAppStatusBar === true || connected === false;
2169
+ } else {
2170
+ return connected === false;
2171
+ }
2172
+ };
2173
+ const ApplicationStatusBar = () => {
2174
+ const targetWindow = window$1.useWindow();
2175
+ styles.useComponentCssInjection({
2176
+ testId: "vuu-settings-form",
2177
+ css: appStatusBarCss,
2178
+ window: targetWindow
2179
+ });
2180
+ const [connected, setConnected] = React.useState(true);
2181
+ const settings = useUserSetting();
2182
+ React.useEffect(() => {
2183
+ vuuDataRemote.ConnectionManager.on("connection-status", ({ connectionStatus }) => {
2184
+ if (connectionStatus === "disconnected") {
2185
+ setConnected(false);
2186
+ } else if (connectionStatus.endsWith("connected")) {
2187
+ setConnected(true);
2188
+ }
2189
+ });
2190
+ }, []);
2191
+ if (!shouldShowStatusBar(connected, settings)) {
2192
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cx(classBase$3, `${classBase$3}-hidden`) });
2193
+ }
2194
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: classBase$3, children: /* @__PURE__ */ jsxRuntime.jsx(ConnectionStateDisplay, {}) });
2195
+ };
2196
+
2197
+ const useFullHeightLeftPanel = ({
2198
+ appHeader,
2199
+ SidePanelProps: LeftSidePanelProps,
2200
+ htmlAttributes
2201
+ }) => React.useMemo(
2202
+ () => /* @__PURE__ */ jsxRuntime.jsxs(
2203
+ vuuLayout.Flexbox,
2204
+ {
2205
+ ...htmlAttributes,
2206
+ style: {
2207
+ ...htmlAttributes?.style,
2208
+ flexDirection: "row"
2209
+ },
2210
+ children: [
2211
+ /* @__PURE__ */ jsxRuntime.jsx(SidePanel, { ...LeftSidePanelProps, id: vuuUtils.VuuShellLocation.SidePanel }),
2212
+ /* @__PURE__ */ jsxRuntime.jsxs(
2213
+ vuuLayout.Flexbox,
2214
+ {
2215
+ className: "vuuShell-content",
2216
+ style: { flex: 1, flexDirection: "column" },
2217
+ children: [
2218
+ appHeader,
2219
+ /* @__PURE__ */ jsxRuntime.jsx(
2220
+ vuuLayout.LayoutContainer,
2221
+ {
2222
+ id: vuuUtils.VuuShellLocation.WorkspaceContainer,
2223
+ style: { flex: 1 }
2224
+ },
2225
+ "main-content"
2226
+ ),
2227
+ /* @__PURE__ */ jsxRuntime.jsx(ApplicationStatusBar, {})
2228
+ ]
2229
+ }
2230
+ ),
2231
+ /* @__PURE__ */ jsxRuntime.jsx(ContextPanel, { id: vuuUtils.VuuShellLocation.ContextPanel, overlay: true })
2232
+ ]
2233
+ }
2234
+ ),
2235
+ [LeftSidePanelProps, appHeader, htmlAttributes]
2236
+ );
2237
+
2238
+ const useInlayLeftPanel = ({
2239
+ SidePanelProps: LeftSidePanelProps,
2240
+ appHeader,
2241
+ htmlAttributes
2242
+ }) => {
2243
+ const paletteView = React.useRef(null);
2244
+ const [open, setOpen] = React.useState(true);
2245
+ const handleDrawerClick = React.useCallback(
2246
+ (e) => {
2247
+ const target = e.target;
2248
+ if (!paletteView.current?.contains(target)) {
2249
+ setOpen(!open);
2250
+ }
2251
+ },
2252
+ [open]
2253
+ );
2254
+ return React.useMemo(() => {
2255
+ const getDrawers = (leftSidePanel) => {
2256
+ const drawers = [];
2257
+ drawers.push(
2258
+ /* @__PURE__ */ jsxRuntime.jsx(
2259
+ vuuLayout.Drawer,
2260
+ {
2261
+ onClick: handleDrawerClick,
2262
+ open,
2263
+ position: "left",
2264
+ inline: true,
2265
+ peekaboo: true,
2266
+ sizeOpen: 200,
2267
+ toggleButton: "end",
2268
+ children: /* @__PURE__ */ jsxRuntime.jsx(
2269
+ vuuLayout.View,
2270
+ {
2271
+ className: "vuuShell-palette",
2272
+ id: "vw-app-palette",
2273
+ ref: paletteView,
2274
+ style: { height: "100%" },
2275
+ children: leftSidePanel
2276
+ },
2277
+ "app-palette"
2278
+ )
2279
+ },
2280
+ "left-panel"
2281
+ )
2282
+ );
2283
+ return drawers;
2284
+ };
2285
+ return /* @__PURE__ */ jsxRuntime.jsxs(
2286
+ vuuLayout.Flexbox,
2287
+ {
2288
+ ...htmlAttributes,
2289
+ style: {
2290
+ ...htmlAttributes?.style,
2291
+ flexDirection: "column"
2292
+ },
2293
+ children: [
2294
+ appHeader,
2295
+ /* @__PURE__ */ jsxRuntime.jsx(vuuLayout.DockLayout, { style: { flex: 1 }, children: getDrawers(LeftSidePanelProps?.children).concat(
2296
+ /* @__PURE__ */ jsxRuntime.jsx(
2297
+ vuuLayout.LayoutContainer,
2298
+ {
2299
+ dropTarget: true,
2300
+ id: vuuUtils.VuuShellLocation.WorkspaceContainer,
2301
+ style: { width: "100%", height: "100%" }
2302
+ },
2303
+ "main-content"
2304
+ )
2305
+ ) })
2306
+ ]
2307
+ }
2308
+ );
2309
+ }, [LeftSidePanelProps, appHeader, handleDrawerClick, htmlAttributes, open]);
2310
+ };
2311
+
2312
+ const useLeftMainTabs = ({
2313
+ appHeader,
2314
+ htmlAttributes,
2315
+ ToolbarProps
2316
+ }) => {
2317
+ if (ToolbarProps === void 0) {
2318
+ throw Error("LeftMainTabs layout requires ToolbarProps");
2319
+ }
2320
+ return React.useMemo(() => {
2321
+ return /* @__PURE__ */ jsxRuntime.jsxs(
2322
+ vuuLayout.Flexbox,
2323
+ {
2324
+ ...htmlAttributes,
2325
+ style: {
2326
+ ...htmlAttributes?.style,
2327
+ flexDirection: "column"
2328
+ },
2329
+ children: [
2330
+ appHeader,
2331
+ /* @__PURE__ */ jsxRuntime.jsx(
2332
+ vuuLayout.StackLayout,
2333
+ {
2334
+ TabstripProps: {
2335
+ className: `${vuuUtils.VuuShellLocation.MultiWorkspaceContainer}-tabs`
2336
+ },
2337
+ active: 0,
2338
+ showTabs: "left",
2339
+ style: { flex: 1 },
2340
+ id: vuuUtils.VuuShellLocation.MultiWorkspaceContainer
2341
+ }
2342
+ )
2343
+ ]
2344
+ }
2345
+ );
2346
+ }, [appHeader, htmlAttributes]);
2347
+ };
2348
+
2349
+ const useSimpleContentPane = ({
2350
+ appHeader,
2351
+ htmlAttributes
2352
+ }) => React.useMemo(
2353
+ () => /* @__PURE__ */ jsxRuntime.jsxs(
2354
+ vuuLayout.Flexbox,
2355
+ {
2356
+ ...htmlAttributes,
2357
+ style: {
2358
+ ...htmlAttributes?.style,
2359
+ flexDirection: "row"
2360
+ },
2361
+ children: [
2362
+ /* @__PURE__ */ jsxRuntime.jsxs(
2363
+ vuuLayout.Flexbox,
2364
+ {
2365
+ className: "vuuShell-content",
2366
+ style: { flex: 1, flexDirection: "column" },
2367
+ children: [
2368
+ appHeader,
2369
+ /* @__PURE__ */ jsxRuntime.jsx(
2370
+ vuuLayout.LayoutContainer,
2371
+ {
2372
+ id: vuuUtils.VuuShellLocation.WorkspaceContainer,
2373
+ style: { flex: 1 }
2374
+ },
2375
+ "main-content"
2376
+ )
2377
+ ]
2378
+ }
2379
+ ),
2380
+ /* @__PURE__ */ jsxRuntime.jsx(ContextPanel, { id: vuuUtils.VuuShellLocation.ContextPanel, overlay: true })
2381
+ ]
2382
+ }
2383
+ ),
2384
+ [appHeader, htmlAttributes]
2385
+ );
2386
+
2387
+ const LayoutHook = {
2388
+ "full-height": useFullHeightLeftPanel,
2389
+ inlay: useInlayLeftPanel,
2390
+ "left-main-tabs": useLeftMainTabs,
2391
+ "simple-content-pane": useSimpleContentPane
2392
+ };
2393
+ const useShellLayout = ({
2394
+ layoutTemplateId = "simple-content-pane",
2395
+ ...props
2396
+ }) => {
2397
+ const useLayoutHook = LayoutHook[layoutTemplateId];
2398
+ return useLayoutHook(props);
2399
+ };
2400
+
2401
+ var settingsFormCss = ".vuuSettingsForm {\n display: flex;\n flex-direction: column;\n gap: var(--salt-spacing-200);\n}\n";
2402
+
2403
+ const isOption = (value) => typeof value === "object" && "label" in value && "label" in value;
2404
+ const isBooleanProperty = (property) => property.type === "boolean";
2405
+ const isStringOrNumber = (value) => typeof value === "string" || typeof value === "number";
2406
+ const getValueAndLabel = (value) => isOption(value) ? [value.value, value.label] : [value, value];
2407
+ const defaultPropertyValue = {
2408
+ boolean: false,
2409
+ number: 0,
2410
+ string: ""
2411
+ };
2412
+ const classBase$2 = "vuuSettingsForm";
2413
+ function FormControl({
2414
+ property,
2415
+ changeHandler,
2416
+ selectHandler,
2417
+ inputHandler,
2418
+ currentValue = property.defaultValue ?? defaultPropertyValue[property.type]
2419
+ }) {
2420
+ const [value, setValue] = React.useState(currentValue);
2421
+ if (isBooleanProperty(property)) {
2422
+ const checked = typeof currentValue === "boolean" ? currentValue : property.defaultValue ?? false;
2423
+ return /* @__PURE__ */ jsxRuntime.jsx(core.Switch, { checked, onChange: changeHandler });
2424
+ }
2425
+ if (Array.isArray(property.values)) {
2426
+ if (property.values.length <= 2) {
2427
+ return /* @__PURE__ */ jsxRuntime.jsx(
2428
+ core.ToggleButtonGroup,
2429
+ {
2430
+ value: currentValue,
2431
+ onChange: changeHandler,
2432
+ children: property.values.map((valueOrOption) => {
2433
+ const [value2, label] = getValueAndLabel(valueOrOption);
2434
+ return /* @__PURE__ */ jsxRuntime.jsx(core.ToggleButton, { value: value2, children: label }, value2);
2435
+ })
2436
+ }
2437
+ );
2438
+ } else if (property.values.length > 2) {
2439
+ return /* @__PURE__ */ jsxRuntime.jsx(
2440
+ core.Dropdown,
2441
+ {
2442
+ value: currentValue,
2443
+ onSelectionChange: selectHandler,
2444
+ children: property.values.map((valueOrOption) => {
2445
+ const [value2, label] = getValueAndLabel(valueOrOption);
2446
+ return /* @__PURE__ */ jsxRuntime.jsx(
2447
+ core.Option,
2448
+ {
2449
+ value: label,
2450
+ "data-field": property.name
2451
+ },
2452
+ value2
2453
+ );
2454
+ })
2455
+ }
2456
+ );
2457
+ }
2458
+ } else {
2459
+ const valid = isValidInput(currentValue, property.type);
2460
+ const errorMessage = getTooltipContent(property.type, valid);
2461
+ return /* @__PURE__ */ jsxRuntime.jsx(
2462
+ vuuUiControls.VuuInput,
2463
+ {
2464
+ errorMessage,
2465
+ onCommit: inputHandler,
2466
+ onChange: (e) => setValue(e.target.value),
2467
+ value
2468
+ },
2469
+ property.name
2470
+ );
2471
+ }
2472
+ return null;
2473
+ }
2474
+ const isValidInput = (value, type) => {
2475
+ if (value === "") {
2476
+ return void 0;
2477
+ }
2478
+ if (type === "string") {
2479
+ return "success";
2480
+ } else if (type === "number") {
2481
+ if (Number.isNaN(Number(value))) {
2482
+ return "error";
2483
+ }
2484
+ return "success";
2485
+ }
2486
+ };
2487
+ function getTooltipContent(type, valid) {
2488
+ if (valid === "error") {
2489
+ if (type === "number") {
2490
+ return /* @__PURE__ */ jsxRuntime.jsx("p", { children: "Field is expecting a number" });
2491
+ } else if (type === "string") {
2492
+ return /* @__PURE__ */ jsxRuntime.jsx("p", { children: "Field is expecting a string" });
2493
+ } else {
2494
+ return /* @__PURE__ */ jsxRuntime.jsx("p", { children: "Please contact Admin for more information on expected type" });
2495
+ }
2496
+ } else {
2497
+ return void 0;
2498
+ }
2499
+ }
2500
+ const SettingsForm = ({
2501
+ className,
2502
+ settingsSchema,
2503
+ settings,
2504
+ onSettingChanged,
2505
+ ...htmlAttributes
2506
+ }) => {
2507
+ const targetWindow = window$1.useWindow();
2508
+ styles.useComponentCssInjection({
2509
+ testId: "vuu-settings-form",
2510
+ css: settingsFormCss,
2511
+ window: targetWindow
2512
+ });
2513
+ const changeHandler = React.useCallback(
2514
+ (event) => {
2515
+ const fieldName = vuuUtils.getFieldName(event.target);
2516
+ const { checked, value } = event.target;
2517
+ onSettingChanged(fieldName, checked ?? value);
2518
+ },
2519
+ [onSettingChanged]
2520
+ );
2521
+ const selectHandler = React.useCallback(
2522
+ (event, [selected]) => {
2523
+ const fieldName = vuuUtils.getFieldName(event.target);
2524
+ onSettingChanged(fieldName, selected);
2525
+ },
2526
+ [onSettingChanged]
2527
+ );
2528
+ const inputHandler = React.useCallback(
2529
+ (event) => {
2530
+ const fieldName = vuuUtils.getFieldName(event.target);
2531
+ const { value } = event.target;
2532
+ if (!Number.isNaN(Number(value)) && value != "") {
2533
+ const numValue = Number(value);
2534
+ onSettingChanged(fieldName, numValue);
2535
+ } else {
2536
+ onSettingChanged(fieldName, value);
2537
+ }
2538
+ },
2539
+ [onSettingChanged]
2540
+ );
2541
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { ...htmlAttributes, className: cx(classBase$2, className), children: settingsSchema.properties.map((property) => /* @__PURE__ */ jsxRuntime.jsxs(core.FormField, { "data-field": property.name, children: [
2542
+ /* @__PURE__ */ jsxRuntime.jsx(core.FormFieldLabel, { children: property.label }),
2543
+ FormControl({
2544
+ property,
2545
+ changeHandler,
2546
+ selectHandler,
2547
+ inputHandler,
2548
+ currentValue: settings[property.name]
2549
+ })
2550
+ ] }, property.name)) });
2551
+ };
2552
+
2553
+ var userSettingsPanelCss = ".vuuUserSettingsPanel {\n height: 100%;\n overflow: auto;\n}\n";
2554
+
2555
+ const classBase$1 = "vuuUserSettingsPanel";
2556
+ const UserSettingsPanel = ({
2557
+ ...htmlAttributes
2558
+ }) => {
2559
+ const targetWindow = window$1.useWindow();
2560
+ styles.useComponentCssInjection({
2561
+ testId: "vuu-user-settings-panel",
2562
+ css: userSettingsPanelCss,
2563
+ window: targetWindow
2564
+ });
2565
+ const {
2566
+ onUserSettingChanged,
2567
+ userSettings = {},
2568
+ userSettingsSchema
2569
+ } = useApplicationSettings();
2570
+ if (userSettingsSchema) {
2571
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { ...htmlAttributes, className: cx(classBase$1, "vuuScrollable"), children: /* @__PURE__ */ jsxRuntime.jsx(
2572
+ SettingsForm,
2573
+ {
2574
+ settings: userSettings,
2575
+ settingsSchema: userSettingsSchema,
2576
+ onSettingChanged: onUserSettingChanged
2577
+ }
2578
+ ) });
2579
+ } else {
2580
+ console.log("no settingsSchema provided to UserSettingsPanel");
2581
+ return null;
2582
+ }
2583
+ };
2584
+
2585
+ var shellCss = ".vuuShell {\n background-color: var(\n --vuuShell-background,\n var(--salt-container-primary-background)\n );\n height: var(--vuuShell-height, 100vh);\n width: var(--vuuShell-width, 100vw);\n\n .left-main-tabs {\n --vuuOverflowContainer-width: 48px;\n }\n}\n\n.vuu-workspace-tabs {\n background: var(\n --vuuWorkspace-background,\n var(--salt-container-primary-background)\n );\n}\n\n.vuuShell-palette {\n --vuuView-border: none;\n --vuuView-margin: 0;\n}\n\n.vuuShell-warningPlaceholder {\n background-color: var(--salt-container-background-high);\n height: 100%;\n}\n\n/* until we reinstat5e the toolbar */\n.vuuToolbarProxy {\n background: var(--salt-container-primary-background);\n}\n\n.vuu-workspace-tabs > .vuuTabstrip > .vuuOverflowContainer-wrapContainer {\n background: var(--vuuShell-background, var(--vuu-color-gray-25));\n}\n\n.vuu-workspace-tabs {\n --vuuTab-height: 28px;\n border: solid 1px var(--salt-separable-primary-borderColor);\n border-top: none !important;\n border-radius: 6px;\n height: 100%;\n padding: 36px 8px 8px 8px;\n position: relative;\n width: 100%;\n}\n\n.vuu-workspace-tabs > .vuuTabstrip {\n left: 0px;\n padding-bottom: 7px;\n position: absolute !important;\n right: 0px;\n top: 0;\n}\n\n.vuuShell-content {\n padding: var(--vuuShell-content-padding, 8px);\n}\n";
2586
+
2587
+ vuuUtils.registerComponent("ApplicationSettings", UserSettingsPanel, "view");
2588
+ if (process.env.NODE_ENV === "production") {
2589
+ if (typeof vuuLayout.StackLayout !== "function") {
2590
+ console.warn(
2591
+ "StackLayout module not loaded, will be unable to deserialize from layout JSON"
2592
+ );
2593
+ }
2594
+ }
2595
+ const { error } = vuuUtils.logger("Shell");
2596
+ const defaultAppHeader = /* @__PURE__ */ jsxRuntime.jsx(AppHeader, {});
2597
+ const getAppHeader = (shellLayoutProps) => shellLayoutProps?.appHeader ?? defaultAppHeader;
2598
+ const defaultHTMLAttributes = {
2599
+ className: "vuuShell"
2600
+ };
2601
+ const getHTMLAttributes = (props) => {
2602
+ if (props?.htmlAttributes) {
2603
+ return {
2604
+ ...defaultHTMLAttributes,
2605
+ ...props.htmlAttributes
2606
+ };
2607
+ } else {
2608
+ return defaultHTMLAttributes;
2609
+ }
2610
+ };
2611
+ const VuuApplication = ({
2612
+ shellLayoutProps: ShellLayoutProps2,
2613
+ children,
2614
+ // loginUrl, // need to make this available to app header
2615
+ serverUrl,
2616
+ user
2617
+ }) => {
2618
+ const targetWindow = window$1.useWindow();
2619
+ styles.useComponentCssInjection({
2620
+ testId: "vuu-shell",
2621
+ css: shellCss,
2622
+ window: targetWindow
2623
+ });
2624
+ const notify = vuuPopups.useNotifications();
2625
+ const { workspaceJSON, saveApplicationLayout } = useWorkspace();
2626
+ const { buildMenuOptions, handleMenuAction } = useWorkspaceContextMenuItems();
2627
+ const handleLayoutChange = React.useCallback(
2628
+ (layout) => {
2629
+ try {
2630
+ saveApplicationLayout(layout);
2631
+ } catch {
2632
+ error?.("Failed to save layout");
2633
+ }
2634
+ },
2635
+ [saveApplicationLayout]
2636
+ );
2637
+ React.useMemo(async () => {
2638
+ if (serverUrl && user.token) {
2639
+ const connectionResult = await vuuDataRemote.ConnectionManager.connect({
2640
+ token: user.token,
2641
+ url: serverUrl,
2642
+ username: user.username
2643
+ });
2644
+ if (connectionResult === "rejected") {
2645
+ notify({
2646
+ type: "error",
2647
+ body: "Unable to connect to VUU Server",
2648
+ header: "Error"
2649
+ });
2650
+ }
2651
+ } else {
2652
+ console.warn(
2653
+ `Shell: serverUrl: '${serverUrl}', token: '${Array(user.token.length).fill("#").join("")}'
2654
+ `
2655
+ );
2656
+ }
2657
+ }, [notify, serverUrl, user.token, user.username]);
2658
+ const isLayoutLoading = workspaceJSON === loadingJSON;
2659
+ const initialLayout = useShellLayout({
2660
+ ...ShellLayoutProps2,
2661
+ appHeader: getAppHeader(ShellLayoutProps2),
2662
+ htmlAttributes: getHTMLAttributes(ShellLayoutProps2)
2663
+ });
2664
+ return isLayoutLoading ? null : /* @__PURE__ */ jsxRuntime.jsxs(
2665
+ vuuContextMenu.ContextMenuProvider,
2666
+ {
2667
+ menuActionHandler: handleMenuAction,
2668
+ menuBuilder: buildMenuOptions,
2669
+ children: [
2670
+ /* @__PURE__ */ jsxRuntime.jsx(
2671
+ vuuLayout.LayoutProvider,
2672
+ {
2673
+ workspaceJSON,
2674
+ onLayoutChange: handleLayoutChange,
2675
+ children: initialLayout
2676
+ }
2677
+ ),
2678
+ children
2679
+ ]
2680
+ }
2681
+ );
2682
+ };
2683
+ const Shell = ({
2684
+ loginUrl,
2685
+ user,
2686
+ userSettingsSchema,
2687
+ workspaceProps,
2688
+ ...props
2689
+ }) => {
2690
+ const persistenceManager = usePersistenceManager();
2691
+ const localPersistenceManager = React.useMemo(() => {
2692
+ if (persistenceManager) {
2693
+ return void 0;
2694
+ }
2695
+ console.log(
2696
+ `No Persistence Manager, configuration data will be persisted to Local Storage, key: 'vuu/${user.username}'`
2697
+ );
2698
+ return new LocalPersistenceManager(`vuu/${user.username}`);
2699
+ }, [persistenceManager, user.username]);
2700
+ const shellProviders = /* @__PURE__ */ jsxRuntime.jsx(
2701
+ ApplicationProvider,
2702
+ {
2703
+ density: "high",
2704
+ loginUrl,
2705
+ theme: "vuu-theme",
2706
+ user,
2707
+ userSettingsSchema,
2708
+ children: /* @__PURE__ */ jsxRuntime.jsx(WorkspaceProvider, { ...workspaceProps, children: /* @__PURE__ */ jsxRuntime.jsx(vuuPopups.DialogProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(vuuPopups.NotificationsProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(VuuApplication, { ...props, user }) }) }) })
2709
+ }
2710
+ );
2711
+ if (persistenceManager) {
2712
+ return shellProviders;
2713
+ } else {
2714
+ return /* @__PURE__ */ jsxRuntime.jsx(PersistenceProvider, { persistenceManager: localPersistenceManager, children: shellProviders });
2715
+ }
2716
+ };
2717
+
2718
+ const Provider = ({
2719
+ children,
2720
+ context,
2721
+ inheritedContext
2722
+ }) => {
2723
+ const mergedContext = {
2724
+ ...inheritedContext,
2725
+ ...context
2726
+ };
2727
+ return /* @__PURE__ */ jsxRuntime.jsx(vuuUtils.ShellContext.Provider, { value: mergedContext, children });
2728
+ };
2729
+ const ShellContextProvider = ({
2730
+ children,
2731
+ value
2732
+ }) => {
2733
+ return /* @__PURE__ */ jsxRuntime.jsx(vuuUtils.ShellContext.Consumer, { children: (context) => /* @__PURE__ */ jsxRuntime.jsx(Provider, { context: value, inheritedContext: context, children }) });
2734
+ };
2735
+
2736
+ var themeSwitchCss = "\n.vuuThemeSwitch {\n --saltButton-minWidth: 22px;\n --svg-light: url('data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 48 48\"><path d=\"M24 31q2.9 0 4.95-2.05Q31 26.9 31 24q0-2.9-2.05-4.95Q26.9 17 24 17q-2.9 0-4.95 2.05Q17 21.1 17 24q0 2.9 2.05 4.95Q21.1 31 24 31Zm0 3q-4.15 0-7.075-2.925T14 24q0-4.15 2.925-7.075T24 14q4.15 0 7.075 2.925T34 24q0 4.15-2.925 7.075T24 34ZM3.5 25.5q-.65 0-1.075-.425Q2 24.65 2 24q0-.65.425-1.075Q2.85 22.5 3.5 22.5h5q.65 0 1.075.425Q10 23.35 10 24q0 .65-.425 1.075-.425.425-1.075.425Zm36 0q-.65 0-1.075-.425Q38 24.65 38 24q0-.65.425-1.075.425-.425 1.075-.425h5q.65 0 1.075.425Q46 23.35 46 24q0 .65-.425 1.075-.425.425-1.075.425ZM24 10q-.65 0-1.075-.425Q22.5 9.15 22.5 8.5v-5q0-.65.425-1.075Q23.35 2 24 2q.65 0 1.075.425.425.425.425 1.075v5q0 .65-.425 1.075Q24.65 10 24 10Zm0 36q-.65 0-1.075-.425-.425-.425-.425-1.075v-5q0-.65.425-1.075Q23.35 38 24 38q.65 0 1.075.425.425.425.425 1.075v5q0 .65-.425 1.075Q24.65 46 24 46ZM12 14.1l-2.85-2.8q-.45-.45-.425-1.075.025-.625.425-1.075.45-.45 1.075-.45t1.075.45L14.1 12q.4.45.4 1.05 0 .6-.4 1-.4.45-1.025.45-.625 0-1.075-.4Zm24.7 24.75L33.9 36q-.4-.45-.4-1.075t.45-1.025q.4-.45 1-.45t1.05.45l2.85 2.8q.45.45.425 1.075-.025.625-.425 1.075-.45.45-1.075.45t-1.075-.45ZM33.9 14.1q-.45-.45-.45-1.05 0-.6.45-1.05l2.8-2.85q.45-.45 1.075-.425.625.025 1.075.425.45.45.45 1.075t-.45 1.075L36 14.1q-.4.4-1.025.4-.625 0-1.075-.4ZM9.15 38.85q-.45-.45-.45-1.075t.45-1.075L12 33.9q.45-.45 1.05-.45.6 0 1.05.45.45.45.45 1.05 0 .6-.45 1.05l-2.8 2.85q-.45.45-1.075.425-.625-.025-1.075-.425ZM24 24Z\"/></svg>');\n --svg-dark: url('data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 48 48\"><path d=\"M24 42q-7.5 0-12.75-5.25T6 24q0-7.5 5.25-12.75T24 6q.4 0 .85.025.45.025 1.15.075-1.8 1.6-2.8 3.95-1 2.35-1 4.95 0 4.5 3.15 7.65Q28.5 25.8 33 25.8q2.6 0 4.95-.925T41.9 22.3q.05.6.075.975Q42 23.65 42 24q0 7.5-5.25 12.75T24 42Zm0-3q5.45 0 9.5-3.375t5.05-7.925q-1.25.55-2.675.825Q34.45 28.8 33 28.8q-5.75 0-9.775-4.025T19.2 15q0-1.2.25-2.575.25-1.375.9-3.125-4.9 1.35-8.125 5.475Q9 18.9 9 24q0 6.25 4.375 10.625T24 39Zm-.2-14.85Z\"/></svg>');\n padding: 2px;\n}\n\n.salt-density-high .vuuThemeSwitch {\n --saltButton-minWidth: 16px;\n --saltButton-width: 18px;\n --vuuThemeSwitch-iconSize: 16px;\n}\n\n.vuuThemeSwitch [data-icon] {\n --vuu-icon-size: var(--vuuThemeSwitch-iconSize,18px);\n}\n\n.vuuThemeSwitch [data-icon='light'] {\n --vuu-icon-svg: var(--svg-light);\n}\n.vuuThemeSwitch [data-icon='dark'] {\n --vuu-icon-svg: var(--svg-dark);\n}\n\n.vuuThemeSwitch .saltToggleButton {\n height: 20px;\n width: 20px;\n}\n\n";
2737
+
2738
+ const classBase = "vuuThemeSwitch";
2739
+ const ThemeSwitch = ({
2740
+ className: classNameProp,
2741
+ defaultMode: defaultModeProp,
2742
+ mode: modeProp,
2743
+ onChange,
2744
+ ...htmlAttributes
2745
+ }) => {
2746
+ const targetWindow = window$1.useWindow();
2747
+ styles.useComponentCssInjection({
2748
+ testId: "vuu-theme-switch",
2749
+ css: themeSwitchCss,
2750
+ window: targetWindow
2751
+ });
2752
+ const [mode, setMode] = core.useControlled({
2753
+ controlled: modeProp,
2754
+ default: defaultModeProp ?? "light",
2755
+ name: "ThemeSwitch",
2756
+ state: "mode"
2757
+ });
2758
+ const handleChangeSecondary = React.useCallback(
2759
+ (evt) => {
2760
+ const { value } = evt.target;
2761
+ setMode(value);
2762
+ onChange(value);
2763
+ },
2764
+ [onChange, setMode]
2765
+ );
2766
+ const className = cx(classBase, classNameProp);
2767
+ return /* @__PURE__ */ jsxRuntime.jsxs(
2768
+ core.ToggleButtonGroup,
2769
+ {
2770
+ className,
2771
+ ...htmlAttributes,
2772
+ onChange: handleChangeSecondary,
2773
+ value: mode,
2774
+ children: [
2775
+ /* @__PURE__ */ jsxRuntime.jsx(core.ToggleButton, { "aria-label": "alert", "data-icon": "light", value: "light" }),
2776
+ /* @__PURE__ */ jsxRuntime.jsx(core.ToggleButton, { "aria-label": "home", "data-icon": "dark", value: "dark" })
2777
+ ]
2778
+ }
2779
+ );
2780
+ };
2781
+
2782
+ exports.AppHeader = AppHeader;
2783
+ exports.ApplicationProvider = ApplicationProvider;
2784
+ exports.ConnectionStateDisplay = ConnectionStateDisplay;
2785
+ exports.ConnectionStatusIndicator = ConnectionStatusIndicator;
2786
+ exports.ContextPanel = ContextPanel;
2787
+ exports.Feature = Feature;
2788
+ exports.FeatureAndLayoutProvider = FeatureAndLayoutProvider;
2789
+ exports.FeatureList = FeatureList;
2790
+ exports.FormControl = FormControl;
2791
+ exports.LayoutList = LayoutList;
2792
+ exports.LeftNav = LeftNav;
2793
+ exports.LocalPersistenceManager = LocalPersistenceManager;
2794
+ exports.LoginPanel = LoginPanel;
2795
+ exports.PersistenceContext = PersistenceContext;
2796
+ exports.PersistenceProvider = PersistenceProvider;
2797
+ exports.RemotePersistenceManager = RemotePersistenceManager;
2798
+ exports.SaveLayoutPanel = SaveLayoutPanel;
2799
+ exports.SettingsForm = SettingsForm;
2800
+ exports.Shell = Shell;
2801
+ exports.ShellContextProvider = ShellContextProvider;
2802
+ exports.SidePanel = SidePanel;
2803
+ exports.StaticPersistenceManager = StaticPersistenceManager;
2804
+ exports.ThemeSwitch = ThemeSwitch;
2805
+ exports.UserSettingsPanel = UserSettingsPanel;
2806
+ exports.WorkspaceProvider = WorkspaceProvider;
2807
+ exports.defaultWorkspaceJSON = defaultWorkspaceJSON;
2808
+ exports.getAuthDetailsFromCookies = getAuthDetailsFromCookies;
2809
+ exports.getAuthModeFromCookies = getAuthModeFromCookies;
2810
+ exports.getStackWorkspaceJSON = getStackWorkspaceJSON;
2811
+ exports.getWorkspaceWithLayoutJSON = getWorkspaceWithLayoutJSON;
2812
+ exports.isBooleanProperty = isBooleanProperty;
2813
+ exports.isOption = isOption;
2814
+ exports.isStringOrNumber = isStringOrNumber;
2815
+ exports.loadingJSON = loadingJSON;
2816
+ exports.logout = logout;
2817
+ exports.redirectToLogin = redirectToLogin;
2818
+ exports.useApplicationSettings = useApplicationSettings;
2819
+ exports.useApplicationUser = useApplicationUser;
2820
+ exports.useFeatures = useFeatures;
2821
+ exports.useLayouts = useLayouts;
2822
+ exports.useLoginUrl = useLoginUrl;
2823
+ exports.usePersistenceManager = usePersistenceManager;
2824
+ exports.useShellLayout = useShellLayout;
2825
+ exports.useUserSetting = useUserSetting;
2826
+ exports.useWorkspace = useWorkspace;
2827
+ exports.useWorkspaceContextMenuItems = useWorkspaceContextMenuItems;
2828
+ exports.warningLayout = warningLayout;
80
2829
  //# sourceMappingURL=index.js.map