@vuu-ui/vuu-shell 0.8.5 → 0.8.6

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 (84) hide show
  1. package/LICENSE +201 -0
  2. package/cjs/index.js +5 -2
  3. package/cjs/index.js.map +4 -4
  4. package/esm/index.js +5 -2
  5. package/esm/index.js.map +4 -4
  6. package/index.css +1 -1
  7. package/index.css.map +3 -3
  8. package/package.json +7 -7
  9. package/types/vuu-data-react/src/hooks/index.d.ts +6 -0
  10. package/types/vuu-data-react/src/hooks/useDataSource.d.ts +24 -0
  11. package/types/vuu-data-react/src/hooks/useServerConnectionQuality.d.ts +1 -0
  12. package/types/vuu-data-react/src/hooks/useServerConnectionStatus.d.ts +1 -0
  13. package/types/vuu-data-react/src/hooks/useTypeaheadSuggestions.d.ts +4 -0
  14. package/types/vuu-data-react/src/hooks/useVuuMenuActions.d.ts +57 -0
  15. package/types/vuu-data-react/src/hooks/useVuuTables.d.ts +2 -0
  16. package/types/vuu-data-react/src/index.d.ts +1 -0
  17. package/types/vuu-popups/src/dialog/Dialog.d.ts +7 -0
  18. package/types/vuu-popups/src/dialog/index.d.ts +1 -0
  19. package/types/vuu-popups/src/index.d.ts +5 -0
  20. package/types/vuu-popups/src/menu/ContextMenu.d.ts +15 -0
  21. package/types/vuu-popups/src/menu/MenuList.d.ts +43 -0
  22. package/types/vuu-popups/src/menu/context-menu-provider.d.ts +10 -0
  23. package/types/vuu-popups/src/menu/index.d.ts +4 -0
  24. package/types/vuu-popups/src/menu/key-code.d.ts +12 -0
  25. package/types/vuu-popups/src/menu/list-dom-utils.d.ts +4 -0
  26. package/types/vuu-popups/src/menu/use-cascade.d.ts +25 -0
  27. package/types/vuu-popups/src/menu/use-items-with-ids-next.d.ts +13 -0
  28. package/types/vuu-popups/src/menu/use-keyboard-navigation.d.ts +26 -0
  29. package/types/vuu-popups/src/menu/useContextMenu.d.ts +13 -0
  30. package/types/vuu-popups/src/menu/utils.d.ts +2 -0
  31. package/types/vuu-popups/src/popup/index.d.ts +1 -0
  32. package/types/vuu-popups/src/popup/popup-service.d.ts +55 -0
  33. package/types/vuu-popups/src/popup-menu/PopupMenu.d.ts +14 -0
  34. package/types/vuu-popups/src/popup-menu/index.d.ts +1 -0
  35. package/types/vuu-popups/src/portal/Portal.d.ts +8 -0
  36. package/types/vuu-popups/src/portal/index.d.ts +3 -0
  37. package/types/vuu-popups/src/portal/portal-utils.d.ts +1 -0
  38. package/types/vuu-popups/src/portal/render-portal.d.ts +10 -0
  39. package/types/{ShellContextProvider.d.ts → vuu-shell/src/ShellContextProvider.d.ts} +2 -2
  40. package/types/{index.d.ts → vuu-shell/src/index.d.ts} +3 -0
  41. package/types/vuu-shell/src/layout-management/SaveLayoutPanel.d.ts +3 -0
  42. package/types/vuu-shell/src/layout-management/index.d.ts +1 -0
  43. package/types/{left-nav → vuu-shell/src/left-nav}/LeftNav.d.ts +4 -1
  44. package/types/{shell-layouts → vuu-shell/src/shell-layouts}/index.d.ts +1 -0
  45. package/types/vuu-shell/src/shell-layouts/useFullHeightLeftPanel.d.ts +3 -0
  46. package/types/vuu-shell/src/shell-layouts/useInlayLeftPanel.d.ts +3 -0
  47. package/types/vuu-shell/src/shell-layouts/useShellLayout.d.ts +9 -0
  48. package/types/shell-layouts/useFullHeightLeftPanel.d.ts +0 -4
  49. package/types/shell-layouts/useInlayLeftPanel.d.ts +0 -5
  50. package/types/shell-layouts/useShellLayout.d.ts +0 -7
  51. package/types/{app-header → vuu-shell/src/app-header}/AppHeader.d.ts +0 -0
  52. package/types/{app-header → vuu-shell/src/app-header}/index.d.ts +0 -0
  53. package/types/{connection-status → vuu-shell/src/connection-status}/ConnectionStatusIcon.d.ts +0 -0
  54. package/types/{connection-status → vuu-shell/src/connection-status}/index.d.ts +0 -0
  55. package/types/{density-switch → vuu-shell/src/density-switch}/DensitySwitch.d.ts +0 -0
  56. package/types/{density-switch → vuu-shell/src/density-switch}/index.d.ts +0 -0
  57. package/types/{feature → vuu-shell/src/feature}/ErrorBoundary.d.ts +0 -0
  58. package/types/{feature → vuu-shell/src/feature}/Feature.d.ts +0 -0
  59. package/types/{feature → vuu-shell/src/feature}/Loader.d.ts +0 -0
  60. package/types/{feature → vuu-shell/src/feature}/css-module-loader.d.ts +0 -0
  61. package/types/{feature → vuu-shell/src/feature}/index.d.ts +0 -0
  62. package/types/{get-layout-history.d.ts → vuu-shell/src/get-layout-history.d.ts} +0 -0
  63. package/types/{layout-config → vuu-shell/src/layout-config}/index.d.ts +0 -0
  64. package/types/{layout-config → vuu-shell/src/layout-config}/local-config.d.ts +0 -0
  65. package/types/{layout-config → vuu-shell/src/layout-config}/remote-config.d.ts +0 -0
  66. package/types/{layout-config → vuu-shell/src/layout-config}/use-layout-config.d.ts +0 -0
  67. package/types/{left-nav → vuu-shell/src/left-nav}/index.d.ts +0 -0
  68. package/types/{login → vuu-shell/src/login}/LoginPanel.d.ts +0 -0
  69. package/types/{login → vuu-shell/src/login}/index.d.ts +0 -0
  70. package/types/{login → vuu-shell/src/login}/login-utils.d.ts +0 -0
  71. package/types/{session-editing-form → vuu-shell/src/session-editing-form}/SessionEditingForm.d.ts +0 -0
  72. package/types/{session-editing-form → vuu-shell/src/session-editing-form}/index.d.ts +0 -0
  73. package/types/{shell-layouts → vuu-shell/src/shell-layouts}/context-panel/ContextPanel.d.ts +0 -0
  74. package/types/{shell-layouts → vuu-shell/src/shell-layouts}/context-panel/index.d.ts +0 -0
  75. package/types/{shell.d.ts → vuu-shell/src/shell.d.ts} +0 -0
  76. package/types/{shellTypes.d.ts → vuu-shell/src/shellTypes.d.ts} +0 -0
  77. package/types/{theme-provider → vuu-shell/src/theme-provider}/ThemeProvider.d.ts +0 -0
  78. package/types/{theme-provider → vuu-shell/src/theme-provider}/index.d.ts +0 -0
  79. package/types/{theme-switch → vuu-shell/src/theme-switch}/ThemeSwitch.d.ts +1 -1
  80. /package/types/{theme-switch → vuu-shell/src/theme-switch}/index.d.ts +0 -0
  81. /package/types/{use-force-render.d.ts → vuu-shell/src/use-force-render.d.ts} +0 -0
  82. /package/types/{user-profile → vuu-shell/src/user-profile}/UserPanel.d.ts +0 -0
  83. /package/types/{user-profile → vuu-shell/src/user-profile}/UserProfile.d.ts +0 -0
  84. /package/types/{user-profile → vuu-shell/src/user-profile}/index.d.ts +0 -0
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2015 UBS
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/cjs/index.js CHANGED
@@ -1,4 +1,7 @@
1
- "use strict";var It=Object.create;var ae=Object.defineProperty;var At=Object.getOwnPropertyDescriptor;var $t=Object.getOwnPropertyNames;var Bt=Object.getPrototypeOf,_t=Object.prototype.hasOwnProperty;var Ot=(e,t)=>{for(var o in t)ae(e,o,{get:t[o],enumerable:!0})},ke=(e,t,o,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of $t(t))!_t.call(e,r)&&r!==o&&ae(e,r,{get:()=>t[r],enumerable:!(n=At(t,r))||n.enumerable});return e};var L=(e,t,o)=>(o=e!=null?It(Bt(e)):{},ke(t||!e||!e.__esModule?ae(o,"default",{value:e,enumerable:!0}):o,e)),Jt=e=>ke(ae({},"__esModule",{value:!0}),e);var ho={};Ot(ho,{ConnectionStatusIcon:()=>zt,DEFAULT_DENSITY:()=>xt,DEFAULT_THEME:()=>St,DEFAULT_THEME_MODE:()=>Tt,DensitySwitch:()=>Yt,Feature:()=>Se,LoginPanel:()=>Qt,SessionEditingForm:()=>to,Shell:()=>uo,ShellContextProvider:()=>po,ThemeContext:()=>ce,ThemeProvider:()=>me,ThemeSwitch:()=>Ee,getAuthDetailsFromCookies:()=>Xt,getAuthModeFromCookies:()=>qe,logout:()=>Ne,redirectToLogin:()=>Ye,useShellContext:()=>fo,useThemeAttributes:()=>De});module.exports=Jt(ho);var Z=L(require("react")),Ue=L(require("classnames"));var A=require("react/jsx-runtime"),zt=({connectionStatus:e,className:t,element:o="span",...n})=>{let[r,a]=(0,Z.useState)("vuuConnectingStatus");(0,Z.useEffect)(()=>{switch(e){case"connected":case"reconnected":a("vuuActiveStatus");break;case"connecting":a("vuuConnectingStatus");break;case"disconnected":a("vuuDisconnectedStatus");break;default:break}},[e]);let l=Z.default.createElement(o,{...n,className:(0,Ue.default)("vuuStatus vuuIcon",r,t)});return(0,A.jsx)(A.Fragment,{children:(0,A.jsxs)("div",{className:"vuuStatus-container salt-theme",children:[l,(0,A.jsxs)("div",{className:"vuuStatus-text",children:["Status: ",e.toUpperCase()]})]})})};var Ve=require("@heswell/salt-lab"),Ie=require("react"),Ae=L(require("classnames")),$e=require("react/jsx-runtime"),Gt="vuuDensitySwitch",Zt=["high","medium","low","touch"],qt="high",Yt=({className:e,defaultDensity:t=qt,onChange:o})=>{let n=(0,Ie.useCallback)((a,l)=>{o(l)},[o]),r=(0,Ae.default)(Gt,e);return(0,$e.jsx)(Ve.Dropdown,{className:r,source:Zt,defaultSelected:t,onSelectionChange:n})};var k=L(require("react")),ze=require("@vuu-ui/vuu-layout");var Be=L(require("react")),$=require("react/jsx-runtime"),se=class extends Be.default.Component{constructor(t){super(t),this.state={errorMessage:null}}static getDerivedStateFromError(t){return{errorMessage:t.message}}componentDidCatch(t,o){console.log(t,o)}render(){return this.state.errorMessage?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)("h1",{children:"Something went wrong."}),(0,$.jsx)("p",{children:this.state.errorMessage})]}):this.props.children}};var Oe=require("react/jsx-runtime"),_e=()=>(0,Oe.jsx)("div",{className:"hwLoader",children:"loading"});var Je=async e=>{let t=new CSSStyleSheet;return fetch(e).then(o=>o.text()).then(o=>t.replace(o))};var X=require("react/jsx-runtime"),ie=new Map,Kt=e=>((0,k.useEffect)(()=>()=>{ie.delete(e)},[e]),ie.has(e)||ie.set(e,k.default.lazy(()=>import(e))),ie.get(e));function Wt({url:e,css:t,params:o,...n}){console.log("Feature render",{css:t,url:e,props:n}),(0,k.useEffect)(()=>(console.log("%cFeature mount","color: green;"),()=>{console.log("%cFeature unmount","color:red;")}),[]),t&&Je(t).then(a=>{document.adoptedStyleSheets=[...document.adoptedStyleSheets,a]});let r=Kt(e);return(0,X.jsx)(se,{children:(0,X.jsx)(k.Suspense,{fallback:(0,X.jsx)(_e,{}),children:(0,X.jsx)(r,{...n,...o})})})}var Se=k.default.memo(Wt);Se.displayName="Feature";(0,ze.registerComponent)("Feature",Se,"view");var Te=require("react"),Ze=require("@salt-ds/core"),q=require("@heswell/salt-lab");var U=require("react/jsx-runtime"),Ge="vuuLoginPanel",Qt=({requirePassword:e=!0,onSubmit:t})=>{let[o,n]=(0,Te.useState)(""),[r,a]=(0,Te.useState)(""),l=()=>{t(o,r)},p=(h,d)=>{n(d)},u=(h,d)=>{a(d)},c=o.trim()!==""&&(e===!1||r.trim()!=="");return(0,U.jsxs)("div",{className:Ge,children:[(0,U.jsx)(q.FormField,{label:"Username",style:{width:200},children:(0,U.jsx)(q.Input,{value:o,id:"text-username",onChange:p})}),e?(0,U.jsx)(q.FormField,{label:"Password",style:{width:200},children:(0,U.jsx)(q.Input,{type:"password",value:r,id:"text-password",onChange:u})}):null,(0,U.jsx)(Ze.Button,{className:`${Ge}-login`,disabled:!c,onClick:l,variant:"cta",children:"Login"})]})};var le=require("@vuu-ui/vuu-utils"),qe=()=>{let e=(0,le.getCookieValue)("vuu-auth-mode");return e!=null?e:""},Xt=()=>{let e=(0,le.getCookieValue)("vuu-username"),t=(0,le.getCookieValue)("vuu-auth-token");return[e,t]},jt=()=>qe()==="login"?"login.html":"demo.html",Ye=(e=jt())=>{window.location.href=e},Ne=e=>{document.cookie="vuu-username= ; expires = Thu, 01 Jan 1970 00:00:00 GMT",document.cookie="vuu-auth-token= ; expires = Thu, 01 Jan 1970 00:00:00 GMT",Ye(e)};var f=require("react"),be=L(require("classnames")),Xe=require("@salt-ds/core"),we=require("@salt-ds/core"),Y=require("@vuu-ui/vuu-data"),B=require("@vuu-ui/vuu-utils");var x=require("react/jsx-runtime"),E="vuuSessionEditingForm",Ke=(e,t)=>{let o=e.find(n=>n.name===t);if(o)return o;throw Error(`SessionEditingForm, no field '${t}' found`)},We=e=>{let{dataset:{field:t},value:o}=e.target;if(t===void 0)throw Error("SessionEditingForm, form field has no field name");return[t,o]},D={uninitialised:0,unchanged:1,changed:2,invalid:3};function Qe(e,t,o=!1){switch(t){case"int":case"long":{let n=parseInt(e,10);if((0,B.isValidNumber)(n))return n;if(o)throw Error("SessionEditingForm getTypedValue");return}case"double":{let n=parseFloat(e);return(0,B.isValidNumber)(n)?n:void 0}case"boolean":return e==="true";default:return e}}var eo=(e,t)=>{if(e)return e;if(t)return new Y.RemoteDataSource({bufferSize:0,table:t.table,columns:t.columns.map(o=>o.name)});throw Error("SessionEditingForm: either a DataSource or a TableSchema must be provided")},to=({className:e,config:{fields:t,key:o},dataSource:n,id:r,onClose:a,schema:l,...p})=>{let[u,c]=(0,f.useState)(),[h,d]=(0,f.useState)(""),m=(0,f.useRef)(null),v=(0,f.useRef)(),g=(0,f.useRef)(D.uninitialised),C=(0,f.useMemo)(()=>{let s=b=>{if(N){let w={};for(let G of C.columns)w[G]=b[N[G]];g.current===D.uninitialised&&(g.current=D.unchanged,v.current=w),c(w)}},y=eo(n,l),N=(0,B.buildColumnMap)(y.columns);return y.subscribe({range:{from:0,to:5}},b=>{b.type==="viewport-update"&&b.rows&&(g.current===D.uninitialised?s(b.rows[0]):console.log("what do we do with server updates"))}),y},[n,l]),ne=(0,Xe.useIdMemo)(r),ye=(0,f.useCallback)(s=>{let[y,N]=We(s),{type:b}=Ke(t,y),w=Qe(N,b);c((G={})=>{let Fe={...G,[y]:w},Vt=(0,B.shallowEquals)(Fe,v.current);return g.current=Vt?D.unchanged:w!==void 0?D.changed:D.invalid,Fe})},[t]),Ce=(0,f.useCallback)(s=>{let[y,N]=We(s),{type:b}=Ke(t,y),w=u==null?void 0:u[o],G=Qe(N,b,!0);typeof w=="string"&&C.menuRpcCall({rowKey:w,field:y,value:G,type:"VP_EDIT_CELL_RPC"})},[C,t,o,u]),re=(0,f.useCallback)(s=>{typeof s=="object"&&s!==null&&"type"in s&&s.type==="CLOSE_DIALOG_ACTION"&&a()},[a]),Q=(0,f.useCallback)(async()=>{let s=await C.menuRpcCall({type:"VP_EDIT_SUBMIT_FORM_RPC"});(0,Y.isErrorResponse)(s)?d(s.error):(0,Y.hasAction)(s)&&re(s.action)},[re,C]),ve=(0,f.useCallback)(s=>{s.key==="Enter"&&g.current===D.changed&&Q()},[Q]),Le=(0,f.useCallback)(()=>{a()},[a]),xe=s=>{var N;let y=String((N=u==null?void 0:u[s.name])!=null?N:"");return s.readonly||s.name===o?(0,x.jsx)("div",{className:`${E}-fieldValue vuuReadOnly`,children:y}):(0,x.jsx)("input",{className:`${E}-fieldValue`,"data-field":s.name,onBlur:Ce,onChange:ye,type:"text",value:y,id:`${ne}-input-${s.name}`})};(0,f.useEffect)(()=>{if(m.current){let s=m.current.querySelector("input");s&&setTimeout(()=>{s.focus(),s.select()},100)}},[]),(0,f.useEffect)(()=>()=>{C&&C.unsubscribe()},[C]);let F=g.current===D.changed;return(0,x.jsxs)("div",{...p,className:(0,be.default)(E,e),children:[h?(0,x.jsx)("div",{className:`${E}-errorBanner`,"data-icon":"error",title:h,children:"Error, edit(s) not saved"}):void 0,(0,x.jsx)("div",{className:`${E}-content`,ref:m,onKeyDown:ve,children:t.map(s=>{var y;return(0,x.jsxs)("div",{className:`${E}-field`,children:[(0,x.jsx)("label",{className:(0,be.default)(`${E}-fieldLabel`,{[`${E}-required`]:s.required}),htmlFor:`${ne}-input-${s.name}`,children:(y=s==null?void 0:s.label)!=null?y:s.description}),xe(s)]},s.name)})}),(0,x.jsxs)("div",{className:`${E}-buttonbar salt-theme salt-density-high`,children:[(0,x.jsx)(we.Button,{type:"submit",variant:"cta",disabled:!F,onClick:Q,children:"Submit"}),(0,x.jsx)(we.Button,{variant:"secondary",onClick:Le,children:"Cancel"})]})]})};var Ft=require("@vuu-ui/vuu-data"),kt=L(require("classnames")),R=require("react");var V=require("react");var je=(e,t,o="latest")=>new Promise((n,r)=>{console.log(`load local config at ${e} for user ${t.username}, id ${o}`);let a=localStorage.getItem(e);if(a){let l=JSON.parse(a);n(l)}else r()}),et=(e,t,o)=>new Promise((n,r)=>{try{localStorage.setItem(e,JSON.stringify(o)),n(void 0)}catch{r()}});var tt=(e,t,o="latest")=>new Promise((n,r)=>{fetch(`${e}/${t.username}/${o}`,{}).then(a=>{a.ok?n(a.json()):r(void 0)}).catch(()=>{r(void 0)})}),ot=(e,t,o)=>new Promise((n,r)=>{fetch(`${e}/${t.username}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)}).then(a=>{a.ok?n(void 0):r()})});var nt=({saveLocation:e,saveUrl:t="api/vui",user:o,defaultLayout:n})=>{let[r,a]=(0,V.useState)(n),l=e==="remote",p=l?tt:je,u=l?ot:et,c=(0,V.useCallback)(async(m="latest")=>{try{let v=await p(t,o,m);a(v)}catch{a(n)}},[n,p,t,o]);(0,V.useEffect)(()=>{c()},[c]);let h=(0,V.useCallback)(m=>{u(t,o,m)},[u,t,o]),d=(0,V.useCallback)(m=>c(m),[c]);return[r,h,d]};var fe=require("@vuu-ui/vuu-layout");var yt=require("react");var ut=require("@salt-ds/core"),ct=require("@heswell/salt-lab"),mt=require("@salt-ds/icons");var at=require("@vuu-ui/vuu-utils"),ue=require("@heswell/salt-lab"),st=require("@salt-ds/core"),it=require("@salt-ds/icons"),P=require("react");var rt=async e=>await fetch(`api/vui/${e.username}`,{}).then(o=>o.ok?o.json():null).catch(()=>{console.log("error getting history")});var I=require("react/jsx-runtime"),oo=({lastUpdate:e},{lastUpdate:t})=>t===e?0:t<e?-1:1,no=e=>(0,I.jsx)(ue.ListItem,{...e}),lt=(0,P.forwardRef)(function({loginUrl:t,onNavigate:o,user:n,layoutId:r="latest"},a){let[l,p]=(0,P.useState)([]);(0,P.useEffect)(()=>{async function d(){let v=(await rt(n)).filter(g=>g.id!=="latest").sort(oo).map(({id:g,lastUpdate:C})=>({lastUpdate:C,id:g,label:`Saved at ${(0,at.formatDate)(new Date(C),"kk:mm:ss")}`}));console.log({sortedHistory:v}),p(v)}d()},[n]);let u=(0,P.useCallback)((d,m)=>{m&&o(m.id)},[o]),c=(0,P.useCallback)(()=>{Ne(t)},[t]),h=l.length===0?null:r==="latest"?l[0]:l.find(d=>d.id===r);return(0,I.jsxs)("div",{className:"vuuUserPanel",ref:a,children:[(0,I.jsx)(ue.List,{ListItem:no,className:"vuuUserPanel-history",onSelect:u,selected:h,source:l}),(0,I.jsx)("div",{className:"vuuUserPanel-buttonBar",children:(0,I.jsxs)(st.Button,{"aria-label":"logout",onClick:c,children:[(0,I.jsx)(it.ExportIcon,{})," Logout"]})})]})});var K=require("react/jsx-runtime"),dt=({layoutId:e,loginUrl:t,onNavigate:o,user:n})=>(0,K.jsxs)(ct.DropdownBase,{className:"vuuUserProfile",placement:"bottom-end",children:[(0,K.jsx)(ut.Button,{variant:"secondary",children:(0,K.jsx)(mt.UserSolidIcon,{})}),(0,K.jsx)(lt,{layoutId:e,loginUrl:t,onNavigate:a=>{o(a)},user:n})]});var j=require("@heswell/salt-lab"),ft=L(require("classnames")),ht=require("@salt-ds/core"),gt=require("react");var ee=require("react/jsx-runtime"),ro="vuuThemeSwitch",pt=["light","dark"],Ee=({className:e,defaultMode:t,mode:o,onChange:n,...r})=>{let[a,l]=(0,ht.useControlled)({controlled:o,default:t!=null?t:"light",name:"ThemeSwitch",state:"mode"}),p=pt.indexOf(a),u=(0,gt.useCallback)((h,d)=>{let m=pt[d];l(m),n(m)},[n,l]),c=(0,ft.default)(ro,e);return(0,ee.jsxs)(j.ToggleButtonGroup,{className:c,...r,onChange:u,selectedIndex:p,children:[(0,ee.jsx)(j.ToggleButton,{"aria-label":"alert",tooltipText:"Light Theme","data-icon":"light"}),(0,ee.jsx)(j.ToggleButton,{"aria-label":"home",tooltipText:"Dark Theme","data-icon":"dark"})]})};var Ct=L(require("classnames"));var te=require("react/jsx-runtime"),ao="vuuAppHeader",vt=({className:e,layoutId:t,loginUrl:o,onNavigate:n,onSwitchTheme:r,themeMode:a="light",user:l,...p})=>{let u=(0,Ct.default)(ao,e),c=(0,yt.useCallback)(h=>r==null?void 0:r(h),[r]);return(0,te.jsxs)("header",{className:u,...p,children:[(0,te.jsx)(Ee,{defaultMode:a,onChange:c}),(0,te.jsx)(dt,{layoutId:t,loginUrl:o,onNavigate:n,user:l})]})};var M=require("react"),Lt=L(require("classnames")),Nt=require("react/jsx-runtime"),xt="medium",St="salt-theme",Tt="light",ce=(0,M.createContext)({density:"high",theme:"salt",themeMode:"light"}),so=["salt","salt-density-high","light"],De=()=>{let e=(0,M.useContext)(ce);return e?[`${e.theme}-theme`,`salt-density-${e.density}`,e.themeMode]:so},io=(e,t,o,n)=>{var r;return(0,M.isValidElement)(e)?(0,M.cloneElement)(e,{className:(0,Lt.default)((r=e.props)==null?void 0:r.className,`${t}-theme`,`${t}-density-${n}`),"data-mode":o}):(console.warn(`
1
+ "use strict";var pa=Object.create;var Gt=Object.defineProperty;var fa=Object.getOwnPropertyDescriptor;var ga=Object.getOwnPropertyNames;var ha=Object.getPrototypeOf,ba=Object.prototype.hasOwnProperty;var ya=(e,t)=>{for(var o in t)Gt(e,o,{get:t[o],enumerable:!0})},tn=(e,t,o,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of ga(t))!ba.call(e,r)&&r!==o&&Gt(e,r,{get:()=>t[r],enumerable:!(n=fa(t,r))||n.enumerable});return e};var V=(e,t,o)=>(o=e!=null?pa(ha(e)):{},tn(t||!e||!e.__esModule?Gt(o,"default",{value:e,enumerable:!0}):o,e)),va=e=>tn(Gt({},"__esModule",{value:!0}),e);var vl={};ya(vl,{ConnectionStatusIcon:()=>Ta,ContextPanel:()=>Yo,DEFAULT_DENSITY:()=>Ls,DEFAULT_THEME:()=>Ds,DEFAULT_THEME_MODE:()=>ws,DensitySwitch:()=>Ca,Feature:()=>So,LeftNav:()=>nl,LoginPanel:()=>rl,SaveLayoutPanel:()=>Da,SessionEditingForm:()=>ll,Shell:()=>fl,ShellContextProvider:()=>bl,ThemeContext:()=>go,ThemeProvider:()=>ho,ThemeSwitch:()=>Jo,getAuthDetailsFromCookies:()=>sl,getAuthModeFromCookies:()=>Hs,logout:()=>qo,redirectToLogin:()=>Ps,useShellContext:()=>yl,useShellLayout:()=>jo,useThemeAttributes:()=>Ee});module.exports=va(vl);var mt=V(require("react")),on=V(require("classnames"));var qe=require("react/jsx-runtime"),Ta=({connectionStatus:e,className:t,element:o="span",...n})=>{let[r,a]=(0,mt.useState)("vuuConnectingStatus");(0,mt.useEffect)(()=>{switch(e){case"connected":case"reconnected":a("vuuActiveStatus");break;case"connecting":a("vuuConnectingStatus");break;case"disconnected":a("vuuDisconnectedStatus");break;default:break}},[e]);let l=mt.default.createElement(o,{...n,className:(0,on.default)("vuuStatus vuuIcon",r,t)});return(0,qe.jsx)(qe.Fragment,{children:(0,qe.jsxs)("div",{className:"vuuStatus-container salt-theme",children:[l,(0,qe.jsxs)("div",{className:"vuuStatus-text",children:["Status: ",e.toUpperCase()]})]})})};var nn=require("@salt-ds/lab"),rn=require("react"),sn=V(require("classnames")),an=require("react/jsx-runtime"),xa="vuuDensitySwitch",Ma=["high","medium","low","touch"],Ea="high",Ca=({className:e,defaultDensity:t=Ea,onChange:o})=>{let n=(0,rn.useCallback)((a,l)=>{o(l)},[o]),r=(0,sn.default)(xa,e);return(0,an.jsx)(nn.Dropdown,{className:r,source:Ma,defaultSelected:t,onSelectionChange:n})};var Oe=V(require("react")),mn=require("@vuu-ui/vuu-layout");var ln=V(require("react")),Ge=require("react/jsx-runtime"),Zt=class extends ln.default.Component{constructor(t){super(t),this.state={errorMessage:null}}static getDerivedStateFromError(t){return{errorMessage:t.message}}componentDidCatch(t,o){console.log(t,o)}render(){return this.state.errorMessage?(0,Ge.jsxs)(Ge.Fragment,{children:[(0,Ge.jsx)("h1",{children:"Something went wrong."}),(0,Ge.jsx)("p",{children:this.state.errorMessage})]}):this.props.children}};var un=require("react/jsx-runtime"),cn=()=>(0,un.jsx)("div",{className:"hwLoader",children:"loading"});var dn=async e=>{let t=new CSSStyleSheet;return fetch(e).then(o=>o.text()).then(o=>t.replace(o))};var Pt=require("react/jsx-runtime"),Jt=new Map,Sa=e=>((0,Oe.useEffect)(()=>()=>{Jt.delete(e)},[e]),Jt.has(e)||Jt.set(e,Oe.default.lazy(()=>import(e))),Jt.get(e));function La({url:e,css:t,params:o,...n}){console.log("Feature render",{css:t,url:e,props:n}),(0,Oe.useEffect)(()=>(console.log("%cFeature mount","color: green;"),()=>{console.log("%cFeature unmount","color:red;")}),[]),t&&dn(t).then(a=>{document.adoptedStyleSheets=[...document.adoptedStyleSheets,a]});let r=Sa(e);return(0,Pt.jsx)(Zt,{children:(0,Pt.jsx)(Oe.Suspense,{fallback:(0,Pt.jsx)(cn,{}),children:(0,Pt.jsx)(r,{...n,...o})})})}var So=Oe.default.memo(La);So.displayName="Feature";(0,mn.registerComponent)("Feature",So,"view");var pn=require("react/jsx-runtime"),Da=()=>(0,pn.jsx)("div",{className:"vuuSaveLayoutPanel",children:"save layout"});var fn=require("react"),j=require("react/jsx-runtime"),Lo=(0,fn.memo)(()=>(0,j.jsxs)("svg",{width:"44",height:"45",viewBox:"0 0 44 45",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,j.jsxs)("g",{clipPath:"url(#clip0_217_6990)",children:[(0,j.jsx)("path",{d:"M39.8642 15.5509L35.9196 7.58974L34.3369 6.85464L24.6235 22.0825L39.1628 30.618L42.3152 25.6347L39.8642 15.5509Z",fill:"url(#paint0_linear_217_6990)"}),(0,j.jsx)("path",{d:"M42.6246 24.8716C41.9199 25.9157 40.9625 26.824 39.767 27.4905C38.424 28.2396 36.9563 28.597 35.5081 28.597C32.7541 28.597 30.0715 27.3094 28.4466 24.9855L15.772 3.90967L15.7655 3.9206C13.3615 0.137431 8.25372 -1.13143 4.24754 1.10507C0.178173 3.37435 -1.20852 8.39359 1.14854 12.3125L18.3445 40.9095C19.1108 42.1846 20.1816 43.1834 21.4144 43.8764C21.4241 43.8826 21.4338 43.8889 21.4435 43.8951C21.4484 43.8982 21.4549 43.9013 21.4597 43.9045C22.0332 44.2228 22.6423 44.471 23.2725 44.6536C23.3194 44.6677 23.368 44.6817 23.415 44.6942C23.6418 44.7551 23.8702 44.8097 24.1019 44.8534C24.1456 44.8612 24.1894 44.8659 24.2331 44.8737C24.4194 44.9049 24.6073 44.9314 24.7952 44.9501C24.8698 44.9579 24.9443 44.9658 25.0188 44.9704C25.2342 44.9876 25.4497 44.9985 25.6668 45.0001C25.6781 45.0001 25.6895 45.0001 25.6992 45.0001C25.7024 45.0001 25.704 45.0001 25.7073 45.0001C25.7105 45.0001 25.7121 45.0001 25.7154 45.0001C25.9503 45.0001 26.1868 44.9876 26.4217 44.9689C26.4751 44.9642 26.5286 44.9595 26.5837 44.9533C26.8137 44.9299 27.0438 44.9002 27.2738 44.8596C27.277 44.8596 27.2803 44.8596 27.2835 44.8596C27.5362 44.8144 27.7889 44.7551 28.0384 44.6864C28.0546 44.6817 28.0692 44.677 28.0854 44.6723C28.4483 44.5709 28.8063 44.4445 29.1594 44.2931C29.1659 44.29 29.174 44.2868 29.1805 44.2837C29.4494 44.1682 29.7151 44.0418 29.9759 43.8967C30.24 43.75 30.491 43.5908 30.7308 43.4206C30.9398 43.2739 31.1407 43.1179 31.3367 42.9524C31.5748 42.7495 31.8 42.5373 32.009 42.3141C32.1661 42.1471 32.3168 41.9723 32.4609 41.7913C32.5079 41.732 32.5517 41.6711 32.5954 41.6118C32.6942 41.4807 32.7882 41.3465 32.8789 41.2091C32.9259 41.1373 32.9728 41.0671 33.0182 40.9953C33.036 40.9672 33.0555 40.9407 33.0717 40.9126L42.7153 24.8763H42.6214L42.6246 24.8716Z",fill:"url(#paint1_linear_217_6990)"}),(0,j.jsx)("path",{d:"M42.8402 16.4218L42.1112 15.2232L38.9636 9.58433L37.504 7.19644C37.2286 6.56123 36.579 6.11331 35.8176 6.11331C34.8083 6.11331 33.9919 6.90147 33.9919 7.87223C33.9919 8.20154 34.0907 8.50432 34.2543 8.76808L34.2349 8.78056L39.9048 18.0808C40.5884 19.2186 40.7715 20.5437 40.4199 21.8141C40.0684 23.0845 39.226 24.1458 38.045 24.806C37.2675 25.2398 36.3846 25.4693 35.4936 25.4693C33.6727 25.4693 31.9766 24.5281 31.0662 23.0143L22.9161 9.63271H22.9323L19.4899 3.90958L19.4834 3.92051C19.4235 3.8253 19.3538 3.73947 19.2907 3.64738L19.1935 3.48663C19.1935 3.48663 19.1854 3.49131 19.1821 3.49443C17.5654 1.27666 14.9799 0.0390178 12.3118 0.00936427V0H7.91199V0.02185C10.9851 -0.184164 14.0582 1.23296 15.7656 3.92051L15.7721 3.90958L28.4451 24.987C30.0699 27.3093 32.7542 28.5985 35.5066 28.5985C36.9548 28.5985 38.4225 28.2426 39.7655 27.4919C40.961 26.8255 41.9168 25.9156 42.6231 24.8731H42.717L42.6846 24.9261C43.1366 24.2347 43.4833 23.4731 43.7068 22.6615C44.2916 20.5452 43.9871 18.3352 42.8369 16.4234L42.8402 16.4218Z",fill:"#F37880"}),(0,j.jsxs)("g",{opacity:"0.86",children:[(0,j.jsx)("path",{d:"M34.2332 8.78212L39.9031 18.0824C40.5868 19.2202 40.7698 20.5452 40.4183 21.8156C40.2044 22.5897 39.8059 23.2858 39.2616 23.8617C39.9744 23.2343 40.4879 22.4243 40.7423 21.5035C41.0938 20.2331 40.9107 18.908 40.2271 17.7703L34.5572 8.46998L34.5767 8.4575C34.413 8.19374 34.3142 7.89096 34.3142 7.56165C34.3142 7.15586 34.4584 6.78285 34.6982 6.48476C34.2672 6.80626 33.9902 7.30881 33.9902 7.87379C33.9902 8.2031 34.0891 8.50588 34.2527 8.76964L34.2332 8.78212Z",fill:"white"}),(0,j.jsx)("path",{d:"M42.6917 24.9169L42.6863 24.9256C42.6863 24.9256 42.6899 24.9187 42.6935 24.9152C42.6935 24.9152 42.6935 24.9152 42.6935 24.9169H42.6917Z",fill:"white"}),(0,j.jsx)("path",{d:"M40.0911 27.1798C38.7481 27.9289 37.2804 28.2863 35.8322 28.2863C33.0782 28.2863 30.3955 26.9988 28.7707 24.6749L16.0961 3.59744L16.0896 3.60837C14.9281 1.78077 13.1364 0.543128 11.1422 0H7.91199V0.02185C10.9851 -0.184164 14.0582 1.23296 15.7656 3.92051L15.7721 3.90958L28.4451 24.987C30.0699 27.3093 32.7542 28.5985 35.5066 28.5985C36.9548 28.5985 38.4225 28.2426 39.7655 27.4919C40.4815 27.0924 41.1084 26.6055 41.6511 26.0561C41.1862 26.479 40.6662 26.8583 40.0894 27.1798H40.0911Z",fill:"white"})]})]}),(0,j.jsxs)("defs",{children:[(0,j.jsxs)("linearGradient",{id:"paint0_linear_217_6990",x1:"24.6235",y1:"18.7363",x2:"42.3152",y2:"18.7363",gradientUnits:"userSpaceOnUse",children:[(0,j.jsx)("stop",{stopColor:"#4906A5"}),(0,j.jsx)("stop",{offset:"1",stopColor:"#D3423A"})]}),(0,j.jsxs)("linearGradient",{id:"paint1_linear_217_6990",x1:"-2.35794e-05",y1:"22.5009",x2:"42.7186",y2:"22.5009",gradientUnits:"userSpaceOnUse",children:[(0,j.jsx)("stop",{stopColor:"#7C06A5"}),(0,j.jsx)("stop",{offset:"1",stopColor:"#D3423A"})]}),(0,j.jsx)("clipPath",{id:"clip0_217_6990",children:(0,j.jsx)("rect",{width:"44",height:"45",fill:"white"})})]})]}));Lo.displayName="VuuLogo";var ot=require("@vuu-ui/vuu-layout");var pt=require("react"),Ha=require("react/jsx-runtime"),wa={isDragSource:!1,isDropTarget:!1,register:()=>{}},Ia=()=>console.log("have you forgotten to provide a DragDrop Provider ?"),Na=(0,pt.createContext)({registerDragDropParty:Ia});var gn=e=>{var r,a;let{dragSources:t,dropTargets:o,registerDragDropParty:n}=(0,pt.useContext)(Na);if(e){let l=(r=t==null?void 0:t.has(e))!=null?r:!1,u=(a=o==null?void 0:o.has(e))!=null?a:!1;return{isDragSource:l,isDropTarget:u,register:n}}else return wa};var ne=require("react");var be=require("react");var Pa=["left","right"],Ra=["top","bottom"],Xt=":not(.wrapped)",hn=':not([aria-hidden="true"])',bn=e=>{let t=e.cloneNode(!0);return t.removeAttribute("id"),t.dataset.index="-1",t},ka=(e,t="width",o=!1)=>{let n=t==="width"?"left":"top",{[t]:r,[n]:a}=e.getBoundingClientRect(),{padEnd:l=!1,padStart:u=!1}=e.dataset,c=getComputedStyle(e),[s,d]=t==="width"?Pa:Ra,m=u&&!o?0:parseInt(c.getPropertyValue(`margin-${s}`),10),i=l&&!o?0:parseInt(c.getPropertyValue(`margin-${d}`),10),g=r;if(parseInt(c.getPropertyValue("flex-shrink"),10)>0){let p=parseInt(c.getPropertyValue("flex-basis"),10);!isNaN(p)&&p>0&&(g=p)}return[a,m+g+i]},Oa={horizontal:{CLIENT_POS:"clientX",CLIENT_SIZE:"clientWidth",CONTRA:"top",CONTRA_CLIENT_POS:"clientY",CONTRA_END:"bottom",CONTRA_POS:"y",DIMENSION:"width",END:"right",POS:"x",SCROLL_POS:"scrollLeft",SCROLL_SIZE:"scrollWidth",START:"left"},vertical:{CLIENT_POS:"clientY",CLIENT_SIZE:"clientHeight",CONTRA:"left",CONTRA_CLIENT_POS:"clientX",CONTRA_END:"right",CONTRA_POS:"x",DIMENSION:"height",END:"bottom",POS:"y",SCROLL_POS:"scrollTop",SCROLL_SIZE:"scrollHeight",START:"top"}},me=e=>Oa[e],yn=(e,t)=>{let o=e.find(n=>n.id===t);if(o)return o},vn=(e,t)=>{e.splice(t,1);for(let o=t;o<e.length;o++)e[o].currentIndex-=1},ft=(e,t,o,n,r)=>{var m;let a=[],{DIMENSION:l}=me(t),u=Array.from(o?e.querySelectorAll(o):e.children),c=u.length,s=typeof(n==null?void 0:n.from)=="number"?n.atEnd?Math.max(0,n.from-1):n.from:0,d=typeof(n==null?void 0:n.to)=="number"?Math.min(n.to+2,c-1):c-1;for(let i=s;i<=d;i++){let g=u[i],[f,p]=ka(g,l),h=i===c-1,C=g.id,S=parseInt((m=g.dataset.index)!=null?m:"-1");a.push({currentIndex:i,dataIndex:isNaN(S)?-1:S,id:C,index:i,isDraggedItem:r===C,isLast:h,isOverflowIndicator:g.dataset.index==="overflow",element:g,start:f,end:f+p,size:p,mid:f+p/2})}return a},Rt=e=>e.findIndex(t=>t.isDraggedItem),Do=(e,t)=>{let o=Rt(e),n=t==="fwd"?o+1:o-1;if(n<0||n>=e.length)throw Error("switchDropTargetPosition index out of range");let r=e.at(o),a=e.at(n),l=a.size-r.size;if(t==="fwd"){let u=a.start+l,c=a.end,s={...r,start:u,mid:Math.floor(u+(c-u)/2),end:c},d=r.start,m=r.end+l,i={...a,start:d,mid:Math.floor(d+(m-d)/2),end:m};e.splice(o,2,i,s)}else{let u=a.start,c=a.end-l,s={...r,start:u,mid:Math.floor(u+(c-u)/2),end:c},d=r.start-l,m=r.end,i={...a,start:d,mid:Math.floor(d+(m-d)/2),end:m};e.splice(n,2,s,i)}},gt=(e,t,o)=>{let n=e.length,r=Rt(e),a=e[r];if(o==="fwd"){let l=Math.round(t+a.size);for(let u=n-1;u>=0;u--){let c=e[u];if(l>c.mid)return u<r?a:c}}else{let l=Math.round(t);for(let u=0;u<n;u++){let c=e[u];if(l<c.mid)return u>r?a:c}}throw Error("no dropTraget identified")};function Tn(e,t){let{height:o,left:n,top:r,width:a}=e,{height:l,width:u}=t;return{height:Math.min(o,l),left:n,top:r,width:Math.min(a,u)}}var dr=require("@salt-ds/core");function xn(e){var t,o,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(o=xn(e[t]))&&(n&&(n+=" "),n+=o);else for(t in e)e[t]&&(n&&(n+=" "),n+=t);return n}function Yt(){for(var e,t,o=0,n="";o<arguments.length;)(e=arguments[o++])&&(t=xn(e))&&(n&&(n+=" "),n+=t);return n}var ro=require("react");var Fa=require("@salt-ds/lab"),Dn=require("@salt-ds/core"),Ka=V(require("classnames")),wo=require("react");var kt=require("react"),Sn=V(require("react-dom"));var Mn=V(require("react-dom")),En=V(require("classnames")),Aa=1,$a=({className:e,dataMode:t,x:o=0,y:n=0,win:r=window})=>{let a=r.document.createElement("div");return a.className=(0,En.default)(`vuuPopup ${Aa++}`,e),a.style.cssText=`left:${o}px; top:${n}px;`,t&&(a.dataset.mode=t),r.document.body.appendChild(a),a},Cn=e=>$a(e),jt=(e,t,o,n,r)=>{t.style.cssText=`left:${o}px; top:${n}px;position: absolute;`,Mn.render(e,t,r)};var Ln=V(require("classnames")),Ot=function({children:t,x:o=0,y:n=0,onRender:r}){let[a,l,u]=Ee(),c=(0,kt.useMemo)(()=>Cn({className:(0,Ln.default)(a,l),dataMode:u}),[u,l,a]);return(0,kt.useLayoutEffect)(()=>{jt(t,c,o,n,r)},[t,r,c,o,n]),(0,kt.useLayoutEffect)(()=>()=>{var s;c&&(Sn.unmountComponentAtNode(c),c.classList.contains("vuuPopup")&&((s=c.parentElement)==null||s.removeChild(c)))},[c]),null};var wn=require("react/jsx-runtime");var Je=require("react");var Se=V(require("react")),Ho=V(require("classnames")),Fn=require("@vuu-ui/vuu-layout");var ue=require("react");var In=e=>e.closest("[data-root='true']")!==null,Nn=(e,t)=>{var o;return e.ariaHasPopup==="true"&&((o=e.dataset)==null?void 0:o.idx)===`${t}`||e.querySelector(`:scope > [data-idx='${t}'][aria-haspopup='true']`)!==null};function Ba(e,...t){let o=new Set(e);for(let n of t)for(let r of n)o.add(r);return o}var Va="Enter";var Ua="Delete",za=new Set([Va,Ua]),_a=new Set(["Tab"]),Wa=new Set(["ArrowRight","ArrowLeft"]),Hn=new Set(["Home","End","ArrowDown","ArrowUp"]),Pn=new Set(["Home","End","ArrowRight","ArrowLeft"]),qa=new Set(["F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12"]),vc=Ba(za,Pn,Hn,Wa,qa,_a);var Rn=({key:e},t="vertical")=>(t==="vertical"?Hn:Pn).has(e);var kn=({autoHighlightFirstItem:e=!1,count:t,highlightedIndex:o,onActivate:n,onHighlight:r,onCloseMenu:a,onOpenMenu:l})=>{let u=(0,ue.useRef)((o!=null?o:e)?0:-1),[,c]=(0,ue.useState)(null),s=o!==void 0,d=(0,ue.useCallback)(T=>{u.current=T,r==null||r(T),c({})},[r]),m=(0,ue.useCallback)(T=>{T!==u.current&&(s||d(T))},[s,d]),i=(0,ue.useRef)(!0),g=(0,ue.useRef)(!1),f=T=>g.current=T,p=s?o:u.current,h=(0,ue.useCallback)(T=>{let b=Ga(t,T.key,u.current);b!==u.current&&m(b)},[t,m]),C=(0,ue.useCallback)(T=>{if(Rn(T))T.preventDefault(),T.stopPropagation(),i.current=!0,h(T);else if((T.key==="ArrowRight"||T.key==="Enter")&&Nn(T.target,p)){let w=T.target.querySelector(`:scope > [data-idx='${p}']`);w&&(l==null||l(w))}else T.key==="ArrowLeft"&&!In(T.target)?a(p):T.key==="Enter"?n&&n(p):T.key==="Tab"&&a(-1)},[p,h,n,a,l]),S=(0,ue.useMemo)(()=>({onFocus:()=>{p===-1&&d(0)},onKeyDown:C,onMouseDownCapture:()=>{i.current=!1,f(!0)},onMouseMove:()=>{i.current&&(i.current=!1)},onMouseLeave:()=>{i.current=!0,f(!1),m(-1)}}),[C,p,d,m]);return{focusVisible:i.current?p:-1,controlledHighlighting:s,highlightedIndex:p,setHighlightedIndex:m,listProps:S,setIgnoreFocus:f}};function Ga(e,t,o){return t==="ArrowUp"?o>0?o-1:o:o===null?0:o===e-1?o:o+1}var Ze=V(require("react"));var Io=e=>e.type===Qt||!!e.props["data-group"],Za=e=>{if(Array.isArray(e)&&No(e[0]))return e[0]},Ja=(e,t,o,n=!1)=>{let{props:{children:r}}=e;return{childWithId:Ze.default.cloneElement(e,{hasSeparator:n,id:`${t}`,key:t,children:o?Za(r):r}),grandChildren:o?r:void 0}},On=(e,t)=>{let o=(0,Ze.useCallback)(()=>{let a=(l,u=t,c={},s={})=>{let d=c[u]=[],m=0,i=!1;return Ze.default.Children.forEach(l,g=>{if(!No(g))if(g.type===An)i=!0;else{let f=Io(g),p=`${u}-${m}`,{props:{action:h,options:C}}=g,{childWithId:S,grandChildren:T}=Ja(g,p,f,i);d.push(S),T?a(T,p,c,s):s[p]={action:h,options:C},m+=1,i=!1}}),[c,s]};return a(e)},[t,e]),[n,r]=(0,Ze.useMemo)(()=>o(),[o]);return[n,r]};var Ce=require("react/jsx-runtime"),$n="vuuMenuList",An=()=>(0,Ce.jsx)("li",{className:"vuuMenuItem-divider"}),Qt=()=>null,eo=({children:e,idx:t,...o})=>(0,Ce.jsx)("div",{...o,children:e}),Kn=({children:e})=>(0,Ce.jsx)(Ce.Fragment,{children:e});Kn.displayName="MenuItemLabel";eo.Label=Kn;var Xa=e=>Se.default.isValidElement(e)&&typeof e.type!="string"&&"displayName"in e.type?e.type.displayName:void 0,No=e=>Xa(e)==="MenuItemLabel",Ya=e=>e.props["data-icon"],Bn=({activatedByKeyboard:e,childMenuShowing:t,children:o,className:n,highlightedIdx:r,id:a,isRoot:l,listItemProps:u,onHighlightMenuItem:c,onActivate:s,onCloseMenu:d,onOpenMenu:m,...i})=>{let g=(0,Fn.useId)(a),f=(0,Se.useRef)(null),p=(0,Se.useMemo)(()=>new Map,[]),h=x=>{var v;let E=(v=f.current)==null?void 0:v.querySelector(`:scope > [data-idx='${x}']`);E!=null&&E.id&&(s==null||s(E.id))},{focusVisible:C,highlightedIndex:S,listProps:T}=kn({count:Se.default.Children.count(o),highlightedIndex:r,onActivate:h,onHighlight:c,onOpenMenu:m,onCloseMenu:d}),b=t==null?C:-1;(0,Se.useLayoutEffect)(()=>{var x;t===void 0&&e&&((x=f.current)==null||x.focus())},[e,t]);let w=()=>S===void 0||S===-1?void 0:p.get(S);function M(){let x={...u,role:"menuitem"},E=(k,y,L)=>y?[(0,Ce.jsx)("span",{className:"vuuIconContainer","data-icon":L},"icon")].concat(k):k;function v(k,y,L,I){var Y;let{children:P,className:N,"data-icon":R,id:H,hasSeparator:$,label:O,...K}=y.props,z=Io(y),G=z&&t===H,_=G?`${g}-${H}`:void 0;k.push((0,Ce.jsx)(eo,{...K,...x,...ja(H,L,(Y=y.key)!=null?Y:H,S,b,N,$),"aria-controls":_,"aria-haspopup":z||void 0,"aria-expanded":G||void 0,children:E(z&&O!=null?O:P,I,R)}))}let D=[];if(o.length>0){let k=o.some(Ya);o.forEach((y,L)=>{v(D,y,L,k)})}return D}return(0,Ce.jsx)("div",{...i,...T,"aria-activedescendant":w(),className:(0,Ho.default)($n,n,{[`${$n}-childMenuShowing`]:t!==void 0}),"data-root":l||void 0,id:g,ref:f,role:"menu",children:M()})},ja=(e,t,o,n,r,a,l)=>({id:`menuitem-${e}`,key:o!=null?o:t,"data-idx":t,"data-highlighted":t===n||void 0,className:(0,Ho.default)("vuuMenuItem",a,{"vuuMenuItem-separator":l,focusVisible:r===t})});Bn.displayName="MenuList";var Vn=Bn;var X=require("react");var Po=e=>e==null?void 0:e.closest("[data-idx],[aria-posinset]");var zn=(e,t,o)=>e.map((n,r)=>r===e.length-1?{...n,[o]:n[o]-t}:n),Qa=(e,t)=>zn(e,t,"left"),ei=(e,t)=>zn(e,t,"top"),ti=(e,t)=>{let[o,n]=t.slice(-2),r=document.getElementById(`${e}-${n.id}`);if(r===null)throw Error(`useCascade.flipSides element with id ${n.id} not found`);let{width:a}=r.getBoundingClientRect();return t.map(l=>l===n?{...l,left:o.left-(a-2)}:l)},oi=(e,t)=>{let[{left:o,top:n}]=t.slice(-1),{offsetWidth:r,offsetTop:a}=e;return{left:o+r,top:a+n}},_n=(e,t)=>{let o=e.lastIndexOf("-");return o>-1?e.slice(9,o):t},ni=e=>e.slice(9),Un=({ariaExpanded:e,ariaHasPopup:t,id:o},n)=>{if(o.startsWith("menuitem"))return{hostMenuId:_n(o,n),targetMenuId:ni(o),menuItemId:o,isGroup:t==="true",isOpen:e==="true"};throw Error(`getMenuItemDetails #${o} is not a menuitem`)},Wn=({id:e,onActivate:t,onMouseEnterItem:o,position:{x:n,y:r}})=>{let[,a]=(0,X.useState)({}),l=(0,X.useRef)([{id:e,left:n,top:r}]),u=(0,X.useCallback)(M=>l.current.findIndex(x=>x.id===M)!==-1,[]),c=(0,X.useCallback)(M=>{let x=i.current[M];if(x===void 0)throw Error(`getOpenMenuState no entry for menu ${M}`);return x},[]),s=(0,X.useCallback)(M=>{l.current=M,a({})},[]),d=(0,X.useRef)(),m=(0,X.useRef)(),i=(0,X.useRef)({[e]:"no-popup"}),g=(0,X.useCallback)((M=e,x,E=null)=>{if(M===e&&E===null)s([{id:e,left:n,top:r}]);else{i.current[M]="popup-open";let v=document.getElementById(E);if(v!==null){let{left:D,top:k}=oi(v,l.current);s(l.current.concat({id:x,left:D,top:k}))}else throw Error(`openMenu no menuItem ${E}`)}},[e,n,r,s]),f=(0,X.useCallback)(M=>{if(M===e)s([]);else{let x=l.current.slice(),E=x.pop();i.current[E.id]="no-popup";let v=x.at(-1);v&&(i.current[v.id]="no-popup"),s(x)}},[e,s]),p=(0,X.useCallback)(M=>{let x=l.current.slice(),E=M.slice(9),{id:v}=x.at(-1);for(;x.length>1&&!E.startsWith(v);){let D=_n(v,e);x.pop(),i.current[v]="no-popup",i.current[D]="no-popup",{id:v}=x[x.length-1]}x.length<l.current.length&&s(x)},[e,s]),h=(0,X.useCallback)(()=>{d.current&&(clearTimeout(d.current),d.current=void 0)},[]),C=(0,X.useCallback)((M,x,E)=>{h(),d.current=window.setTimeout(()=>{console.log(`scheduleOpen<timeout> opening menu ${x} from menu ${M} via menuitem ${E}`),p(E),i.current[M]="popup-open",i.current[x]="no-popup",g(M,x,E)},400)},[h,p,g]),S=(0,X.useCallback)((M,x,E)=>{console.log(`scheduleClose openMenuId ${x} from parent menu ${M} itemId ${E}`),i.current[x]="pending-close",m.current=window.setTimeout(()=>{p(E)},400)},[p]),T=(0,X.useCallback)(()=>{let{current:M}=l,[x]=M.slice(-1),E=document.getElementById(x.id);if(console.log(`handle render ${JSON.stringify(x)} tabindex ${E==null?void 0:E.tabIndex}`),E){let{right:v,bottom:D}=E.getBoundingClientRect(),{clientHeight:k,clientWidth:y}=document.body;if(v>y){let L=M.length>1?ti(e,M):Qa(M,v-y);s(L)}else if(D>k){let L=ei(M,D-k);s(L)}typeof E.tabIndex=="number"&&(console.log(`focus el ${E.id}`),E.focus())}else console.log(`no element found with if ${x.id}`)},[e,s]),b=(0,X.useCallback)(M=>{let{hostMenuId:x,targetMenuId:E,menuItemId:v,isGroup:D,isOpen:k}=Un(M,e),{current:{[x]:y}}=i;if(console.log(`trigger child menu ${v}`),y==="no-popup"&&D)i.current[x]="popup-pending",C(x,E,v);else if(y==="popup-pending"&&!D)i.current[x]="no-popup",clearTimeout(d.current),d.current=void 0;else if(y==="popup-pending"&&D)clearTimeout(d.current),C(x,E,v);else if(y==="popup-open")if(u(E)){let L=c(E);switch(console.log({menuStatus:L}),p(v),L){case"pending-close":clearTimeout(m.current),m.current=void 0,i.current[E]="no-popup",h();break;default:}}else{let[L,I]=l.current.slice(-2);L.id===x&&i.current[I.id]!=="pending-close"?(S(x,I.id,v),D&&!k&&C(x,E,v)):L.id===x&&D&&v!==I.id&&i.current[I.id]==="pending-close"||D?C(x,E,v):i.current[I.id]!=="pending-close"&&p(v)}y==="pending-close"&&(h(),clearTimeout(m.current),m.current=void 0,i.current[x]="popup-open")},[h,p,c,u,e,S,C]),w=(0,X.useMemo)(()=>({onMouseEnter:M=>{let x=Po(M.target);b(x),o(M,x.id)},onClick:M=>{let x=Po(M.target),{isGroup:E,menuItemId:v}=Un(x,e);E?b(x):t(v)}}),[t,o,e,b]);return{closeMenu:f,handleRender:T,listItemProps:w,openMenu:b,openMenus:l.current}};var qn=require("@vuu-ui/vuu-layout"),At=require("react/jsx-runtime"),Gn=require("react"),ri=()=>{},Ro=({activatedByKeyboard:e,children:t,className:o,id:n,onClose:r=()=>{},position:a={x:0,y:0},style:l,...u})=>{let c=(0,Je.useRef)(r);c.current=r;let s=(0,qn.useId)(n),d=(0,Je.useRef)(ri),[m,i]=On(t,s),g=(0,Je.useRef)(e),f=(0,Je.useCallback)(()=>{g.current=!1},[]);console.log({actions:i,menus:m});let p=(0,Je.useCallback)(v=>{let D=v.slice(9),{action:k,options:y}=i[D];d.current(s),r({type:"menu-action",menuId:k,options:y})},[i,s,r]),{closeMenu:h,listItemProps:C,openMenu:S,openMenus:T,handleRender:b}=Wn({id:`${s}`,onActivate:p,onMouseEnterItem:f,position:a});d.current=h;let w=()=>{console.log("handleCloseMenu"),g.current=!0,h()},M=()=>{},x=T.length-1,E=v=>{if(!(v>=x)){let{id:D}=T[v+1];return D}};return(0,At.jsx)(At.Fragment,{children:T.map(({id:v,left:D,top:k},y,L)=>{let I=E(y);return(0,At.jsx)(Ot,{x:D,y:k,onRender:b,children:(0,Gn.createElement)(Vn,{...u,activatedByKeyboard:g.current,childMenuShowing:I,className:o,id:v,isRoot:y===0,key:y,listItemProps:C,onActivate:p,onHighlightMenuItem:M,onCloseMenu:w,onOpenMenu:S,style:l,tabIndex:y===L.length-1?0:void 0},m[v])},y)})})};Ro.displayName="ContextMenu";var to=require("react"),si=require("react/jsx-runtime"),Zn=(0,to.createContext)(null);var or=require("@vuu-ui/vuu-utils"),nr=V(require("classnames")),Ae=require("react");var Jn=V(require("classnames")),ht=V(require("react")),oo=V(require("react-dom"));var ko=!1,pe=[],Xn=e=>(e==null?void 0:e.type)==="menu-action",Yn=e=>(e==null?void 0:e.type)==="click-away";function jn(e){if(e.key==="Esc"){if(pe.length)er();else if(ko){let t=document.body.querySelector(".vuuDialog");t&&oo.default.unmountComponentAtNode(t)}}}function Qn(e){if(pe.length){console.log("Popup.outsideClickHandler ... ");let t=document.body.querySelectorAll(".vuuPopup");for(let o=0;o<t.length;o++)if(t[o].contains(e.target)){console.log(" ... its ok, he's one of us");return}console.log(" ... close all"),er({mouseEvt:e,type:"click-away"})}}function er(e){if(pe.length===1)J.hidePopup(e,"anon","all");else if(pe.length){let t=document.body.querySelectorAll(".vuuPopup");for(let o=0;o<t.length;o++)oo.default.unmountComponentAtNode(t[o]);tr("*")}}function ai(e){pe.indexOf(e)===-1&&(pe.push(e),ko===!1&&(window.addEventListener("keydown",jn,!0),window.addEventListener("click",Qn,!0)))}function tr(e){if(pe.length){if(e==="*")pe.length=0;else{let t=pe.indexOf(e);t!==-1&&pe.splice(t,1)}pe.length===0&&ko===!1&&(window.removeEventListener("keydown",jn,!0),window.removeEventListener("click",Qn,!0))}}var ii=({children:e,position:t,style:o})=>{let n=(0,Jn.default)("hwPopup","hwPopupContainer",t);return(0,ht.createElement)("div",{className:n,style:o},e)},li=1,J=class{static showPopup({group:t="all",name:o="anon",left:n=0,position:r="",right:a="auto",top:l=0,width:u="auto",component:c}){if(!c)throw Error("PopupService showPopup, no component supplied");typeof c.props.onClose=="function"?J.onClose=c.props.onClose:J.onClose=void 0,ai(o),document.addEventListener("keydown",J.escapeKeyListener,!0);let s=document.body.querySelector(".vuuPopup."+t);s===null&&(s=document.createElement("div"),s.className="vuuPopup "+t,document.body.appendChild(s));let d={width:u};jt((0,ht.createElement)(ii,{key:li++,position:r,style:d},c),s,n,l,()=>{J.keepWithinThePage(s,a)})}static escapeKeyListener(t){t.key==="Escape"&&(console.log("%cESC listener","color:green;font-weight:bold;"),J.hidePopup())}static hidePopup(t,o="anon",n="all"){var r;if(console.log("PopupService.hidePopup",{reason:t}),pe.indexOf(o)!==-1){tr(o);let a=document.body.querySelector(`.vuuPopup.${n}`);a&&oo.default.unmountComponentAtNode(a)}document.removeEventListener("keydown",J.escapeKeyListener,!0),console.log(`PopupService will call onClose if found ${typeof(J==null?void 0:J.onClose)}`),(r=J==null?void 0:J.onClose)==null||r.call(J,t)}static keepWithinThePage(t,o="auto"){let n=t.querySelector(".vuuPopupContainer > *");if(n){let{top:r,left:a,width:l,height:u,right:c}=n.getBoundingClientRect(),s=window.innerWidth,m=window.innerHeight-(r+u);m<0&&(n.style.top=Math.round(r)+m+"px");let i=s-(a+l);if(i<0&&(n.style.left=Math.round(a)+i+"px"),typeof o=="number"&&o!==c){let g=o-c;n.style.left=a+g+"px"}}}};var no=require("react/jsx-runtime"),rr=(e,t)=>{let o=(0,Ae.useContext)(Zn),[n,r,a]=Ee(),l=(0,Ae.useCallback)((s,d,m)=>{let i=[];for(let g of s)i=i.concat(g(d,m));return i},[]),u=(0,Ae.useCallback)((s,d,{ContextMenuProps:m,contextMenu:i,...g})=>{if(s.stopPropagation(),s.preventDefault(),i)return ui(s,i);let f=[];if(e&&f.push(e),o&&Array.isArray(o==null?void 0:o.menuBuilders)&&o.menuBuilders.length>0&&f.push(...o.menuBuilders),f.length>0){let p=l(f,d,g),h=C=>(t==null?void 0:t(C))===!0?!0:o==null?void 0:o.menuActionHandler(C);p.length&&h&&(console.log(`showContextMenu ${d}`,{options:g}),di(s,p,h,{...m,className:(0,nr.default)(m==null?void 0:m.className,n,r),"data-mode":a}))}else console.warn("useContextMenu, no menuBuilders configured. These should be supplied via the ContextMenuProvider(s)")},[l,o,a,r,t,e,n]),c=(0,Ae.useCallback)(()=>{console.log("hide comnytext menu")},[]);return[u,c]},ci={},ui=(e,t)=>{let o={x:e.clientX,y:e.clientY};J.showPopup({focus:!0,left:0,top:0,component:(0,Ae.cloneElement)(t,{position:o})})},di=(e,t,o,{position:n,...r}=ci)=>{let a=s=>{let d=(m,i)=>(0,or.isGroupMenuItemDescriptor)(m)?(0,no.jsx)(Qt,{label:m.label,children:m.children.map(d)},i):(0,no.jsx)(eo,{action:m.action,"data-icon":m.icon,options:m.options,children:m.label},i);return s.map(d)},l=s=>{var d;Xn(s)&&(o(s),J.hidePopup()),(d=r==null?void 0:r.onClose)==null||d.call(r,s)},u=n!=null?n:{x:e.clientX,y:e.clientY},c=(0,no.jsx)(Ro,{...r,onClose:l,position:u,children:a(t)});J.showPopup({left:0,top:0,component:c,focus:!0})};var $e=require("react");var ar=V(require("classnames")),ir=require("@salt-ds/core"),lr=require("@vuu-ui/vuu-layout");var ur=require("react/jsx-runtime"),sr="vuuPopupMenu",mi=e=>{if(e){let{bottom:t,left:o}=e.getBoundingClientRect();return{x:o,y:t+6}}},cr=({className:e,icon:t="more-vert",id:o,menuActionHandler:n,menuBuilder:r,menuLocation:a="header",menuOptions:l,onMenuClose:u,tabIndex:c=0,...s})=>{let d=(0,$e.useRef)(null),m=(0,$e.useRef)(!1),[i,g]=(0,$e.useState)(!1),f=(0,lr.useId)(o),[p]=rr(r,n),h=(0,$e.useCallback)(S=>{console.log("PopupMenu popup closed",{reason:S}),g(!1),Yn(S)?S.mouseEvt.target===d.current&&(m.current=!0):requestAnimationFrame(()=>{var T;u==null||u(),c!==-1&&((T=d.current)==null||T.focus())})},[u,c]),C=(0,$e.useCallback)(S=>{m.current?m.current=!1:(g(!0),p(S,a,{ContextMenuProps:{id:`${f}-menu`,onClose:h,position:mi(d.current)},...l}))},[h,f,a,l,p]);return(0,ur.jsx)(ir.Button,{...s,"aria-controls":`${f}-menu-root`,"aria-expanded":i,"aria-haspopup":"menu",className:(0,ar.default)(sr,e,{[`${sr}-open`]:i}),"data-icon":t,id:f,onClick:C,ref:d,tabIndex:c,variant:"secondary"})};var Oo=require("react/jsx-runtime"),pi=e=>e.split(" ").map(t=>`vuuDraggable-${t}`),so=(0,ro.forwardRef)(function({wrapperClassName:t,element:o,onTransitionEnd:n,style:r,scale:a=1},l){let u=(0,ro.useCallback)(s=>{s&&(s.innerHTML="",s.appendChild(o),a!==1&&(s.style.transform=`scale(${a},${a})`))},[o,a]),c=(0,dr.useForkRef)(l,u);return(0,Oo.jsx)(Ot,{children:(0,Oo.jsx)("div",{className:Yt("vuuDraggable",...pi(t)),ref:c,onTransitionEnd:n,style:r})})}),Ao=e=>{let t=document.createElement("div");return t.className="vuuDraggable-spacer",e&&t.addEventListener("transitionend",()=>{e.current=!1}),t},mr=()=>{let e=document.createElement("div");return e.className="vuuDraggable-dropIndicatorPosition",e},pr=e=>{let t=document.createElement("div");return t.className="vuuDraggable-dropIndicator",e&&t.addEventListener("transitionend",()=>{e.current=!1}),t};var fr=()=>{let e=(0,be.useRef)(0),t=(0,be.useRef)(!1),o=(0,be.useMemo)(()=>[Ao(t),Ao()],[]),n=(0,be.useCallback)(()=>o.forEach(c=>c.remove()),[o]),r=(0,be.useCallback)((c,s="width")=>{let[d,m]=o;e.current=requestAnimationFrame(()=>{t.current=!0,d.style.cssText=`${s}: 0px`,m.style.cssText=`${s}: ${c}px`,o[0]=m,o[1]=d})},[o]),a=(0,be.useCallback)(()=>{e.current&&(cancelAnimationFrame(e.current),e.current=0)},[]),l=(0,be.useCallback)((c,s,d,m=!1,i="static",g="horizontal")=>{if(s){let f=g==="horizontal"?"width":"height",[p,h]=o;if(a(),m)t.current?(n(),p.style.cssText=`${f}: ${d}px`,h.style.cssText=`${f}: 0px`,i==="fwd"?(s.element.before(p),s.element.after(h)):(s.element.after(p),s.element.before(h))):i==="fwd"?s.element.after(h):s.element.before(h),r(d,f);else if(i==="static")p.style.cssText=`${f}: ${d}px`,s.element.before(p);else throw Error("useDragDisplacers currently only supports noTransition for static displacement");i!=="static"&&Do(c,i)}},[r,a,n,o]),u=(0,be.useCallback)((c,s,d,m=!1,i="static",g="horizontal")=>{let f=g==="horizontal"?"width":"height",[p,h]=o;a(),m?(t.current?(n(),p.style.cssText=`${f}: ${d}px`,h.style.cssText=`${f}: 0px`,s.element.before(p),s.element.after(h)):i==="fwd"?s.element.after(h):s.element.before(h),r(d,f)):(p.style.cssText=`${f}: ${d}px`,s.element.after(p)),i!=="static"&&Do(c,i)},[r,a,n,o]);return{displaceItem:l,displaceLastItem:u,clearSpacers:n}};var gr=({draggableRef:e,onDrop:t,orientation:o="horizontal",containerRef:n,itemQuery:r="*",selected:a,viewportRange:l})=>{let u=(0,ne.useRef)(),c=(0,ne.useRef)(!1),s=(0,ne.useRef)(-1),d=(0,ne.useRef)([]),m=(0,ne.useRef)(!1),[i,g]=(0,ne.useState)(!1),{clearSpacers:f,displaceItem:p,displaceLastItem:h}=fr(),C=(0,ne.useRef)(),S=`:is(${r}${Xt}${hn},.vuuOverflowContainer-OverflowIndicator)`,T=y=>d.current.findIndex(L=>L.id===y.id),b=(0,ne.useRef)();b.current=l;let w=(0,ne.useCallback)(()=>{f()},[f]),M=(0,ne.useCallback)((y,L,I)=>{let{current:P}=n,{current:N}=C;if(P&&N){d.current=ft(P,o,S,b.current);let{size:R}=N,$=s.current+R/2,{current:O}=d,K=gt(O,$,"fwd");if(K){let G=T(K),_=O[G];I&&y==="fwd"?h(O,O[O.length-1],R,!1,"static",o):p(O,_,R,!0,"static",o)}}},[n,p,h,S,o]),x=(0,ne.useCallback)(y=>{let I=y.target.closest(r);I.ariaSelected&&Array.isArray(a)&&a.length>1&&console.log("its a selected element, and we have a multi select");let{current:P}=n;if(P&&I){let{SCROLL_SIZE:N,CLIENT_SIZE:R}=me(o),{id:H}=I,{[N]:$,[R]:O}=P;c.current=$>O;let K=d.current=ft(P,o,S,l,H);console.log({dropTargets:K});let z=Rt(K),G=K[z];G&&P&&(C.current=G,(G.isLast?h:p)(K,G,G.size,!1,"static",o))}},[n,p,h,S,r,o,a,l]),[E,v]=(0,ne.useMemo)(()=>{let y=!1;return[P=>{if(!y){y=!0;let N=P.element.querySelector(".vuuPopupMenu");if(N){let R=new MouseEvent("click",{view:window,bubbles:!0,cancelable:!0});N.dispatchEvent(R)}}},P=>{if(y){y=!1;let N=P.element.querySelector(".vuuPopupMenu");if(N){let R=new MouseEvent("click",{view:window,bubbles:!0,cancelable:!0});N.dispatchEvent(R)}}}]},[]),D=(0,ne.useCallback)((y,L)=>{let{current:I}=C;if(I&&e.current&&n.current){s.current=y;let{current:P}=d,N=gt(P,y,L);if(N&&!N.isDraggedItem)if(N.isOverflowIndicator)g(m.current=!0),E(N);else{let{size:R}=I;(T(N)===P.length-1?h:p)(P,N,R,!0,L,o);let O=P.at(-1);v(O),g(m.current=!1)}u.current=L}},[n,p,h,e,v,o,E]),k=(0,ne.useCallback)(()=>{var P;f();let{current:y}=d,L=Rt(y),I=y[L];if(I&&(u.current=void 0,m.current?t(I.index,-1):t(I.index,L)),g(!1),n.current){let N=(P=n.current)==null?void 0:P.scrollTop;L<y.length&&(n.current.scrollTop=N)}},[f,n,t]);return{beginDrag:x,drag:D,drop:k,handleScrollStart:w,handleScrollStop:M,revealOverflowedItems:i}};var Q=require("react");var $t=require("react");var hr=()=>{let e=(0,$t.useMemo)(()=>mr(),[]),t=(0,$t.useCallback)(()=>e.remove(),[e]);return{positionDropIndicator:(0,$t.useCallback)((n,r="end")=>(r==="end"?n.element.after(e):n.element.before(e),e),[e]),clearSpacer:t}};var yr=require("react/jsx-runtime"),fi=':not([data-overflowed="true"])',gi=':not([aria-hidden="true"])',br=({draggableRef:e,onDrop:t,orientation:o="horizontal",containerRef:n,itemQuery:r="*",selected:a,viewportRange:l})=>{let u=(0,Q.useRef)(),c=(0,Q.useRef)(null),s=(0,Q.useRef)(null),d=(0,Q.useRef)(""),m=(0,Q.useRef)(!1),i=(0,Q.useRef)(-1),g=(0,Q.useRef)([]),f=(0,Q.useRef)(!1),[p,h]=(0,Q.useState)(!1),[C,S]=(0,Q.useState)(),{clearSpacer:T,positionDropIndicator:b}=hr(),w=(0,Q.useRef)(),M=`:is(${r}${fi}${gi},[data-overflow-indicator])`,x=P=>g.current.findIndex(N=>N.id===P.id),E=(P,N,R)=>{P.start+=N,P.mid+=N,P.end+=N,typeof R=="number"&&(P.currentIndex+=R)},v=(0,Q.useRef)();v.current=l;let D=(0,Q.useCallback)(()=>{T()},[T]),k=(0,Q.useCallback)((P,N,R)=>{let{current:H}=n,{current:$}=w;if(H&&$){g.current=ft(H,o,M,v.current);let{size:O}=$,z=i.current+O/2,{current:G}=g,_=gt(G,z,"fwd");_&&b(R&&P==="fwd"?G[G.length-1]:_,"start")}},[n,b,M,o]),y=(0,Q.useCallback)(P=>{let R=P.target.closest(r);R.ariaSelected&&Array.isArray(a)&&a.length>1&&console.log("its a selected element, and we have a multi select");let{current:H}=n;if(H&&R){let{SCROLL_SIZE:$,CLIENT_SIZE:O}=me(o),{id:K}=R,{[$]:z,[O]:G}=H;m.current=z>G;let _=g.current=ft(H,o,M,l),Y=yn(_,K);if(Y&&H){let A=x(Y);vn(_,A),w.current=Y;let{current:F}=v;if(F!=null&&F.atEnd)for(let Z=0;Z<_.length;Z++)E(_[Z],Y.size);for(let Z=A;Z<_.length;Z++)E(_[Z],-Y.size,-1);let[W,le]=Y.isLast?[_[_.length-1],"end"]:[_[A],"start"];s.current=W,d.current=le;let ke=b(W,le),{top:B,left:q,width:ee}=ke.getBoundingClientRect(),te={top:Y.isLast?F!=null&&F.atEnd&&!F.atStart?B+Y.size-2:B-2:B-Y.size-2,left:q,width:ee,height:2};S((0,yr.jsx)(so,{wrapperClassName:"dropIndicatorContainer",style:te,ref:c,element:pr()}))}}},[r,a,n,o,M,l,b]),L=(0,Q.useCallback)((P,N)=>{let{current:R}=s,{current:H}=w;if(H&&e.current&&n.current){let $=o==="horizontal"?"left":"top";i.current=P;let{current:O}=g,K=gt(O,P,N);if(K&&K.index!==(R==null?void 0:R.index)){if(K.isOverflowIndicator)h(f.current=!0);else if(c.current){if(x(K)===O.length-1){let G=O[O.length-1],Y=b(G,"start").getBoundingClientRect();c.current.style[$]=`${Y.top}px`}else{let _=b(K,"start").getBoundingClientRect();c.current.style[$]=`${_.top}px`}h(f.current=!1)}s.current=K,u.current=N}}},[e,n,o,b]),I=(0,Q.useCallback)(()=>{T();let{current:P}=w,{current:N}=s,{current:R}=d,{current:H}=v;if(P&&H&&N){let{index:$}=P,O=R==="start",{index:K,currentIndex:z}=N;s.current=null,u.current=void 0,f.current?t($,-1):$<K?t($,O?z:z+1):t($,O?K:K+1),S(void 0)}h(!1)},[T,t]);return{beginDrag:y,drag:L,drop:I,dropIndicator:C,handleScrollStart:D,handleScrollStop:k,revealOverflowedItems:p}};var U=require("react");var Fe=require("react");var vr=({containerRef:e,onScrollingStopped:t,orientation:o="vertical"})=>{let n=(0,Fe.useRef)(null),r=(0,Fe.useRef)(!1),a=(0,Fe.useRef)(0),l=(0,Fe.useRef)("fwd"),u=(0,Fe.useCallback)((s=!1)=>{console.log("[useAutoScroll] stopScrolling"),n.current!==null&&(clearTimeout(n.current),n.current=null),r.current=!1,t==null||t(l.current,a.current,s)},[t]),c=(0,Fe.useCallback)((s,d,m=30)=>{let{current:i}=e;if(i){let{SCROLL_POS:g,SCROLL_SIZE:f,CLIENT_SIZE:p}=me(o),{[g]:h,[f]:C,[p]:S}=i,T=s==="fwd"?C-S-h:h,b=Math.min(T,m);s==="fwd"?(l.current="fwd",i[g]=a.current=h+b):(l.current="bwd",i[g]=a.current=h-b),b===T?u(!0):(r.current=!0,n.current=window.setTimeout(()=>{c(s,d,m)},100))}},[e,o,u]);return{isScrolling:r,startScrolling:c,stopScrolling:u}};var Mr=require("react/jsx-runtime"),hi={beginDrag:()=>{},drag:()=>{},draggableRef:{current:null},drop:()=>{},isDragging:!1,isScrolling:!1,handleScrollStart:()=>{},handleScrollStop:()=>{},revealOverflowedItems:!1},Tr={start:0,end:1e3,contraStart:0,contraEnd:1e3},bi=()=>hi,yi=3,vi=(e,t)=>e.closest(t),Ti=e=>e.dataset.index==="overflow"&&e.parentElement!==null&&e.parentElement.classList.contains("overflowed"),xi=(e,t)=>{let o=`:is(${t}${Xt},.vuuOverflowContainer-OverflowIndicator)`,r=Array.from(e.querySelectorAll(o)).pop();return[r,Ti(r)]},xr=({allowDragDrop:e,containerRef:t,draggableClassName:o,itemQuery:n="*",onDragStart:r,onDrop:a,onDropSettle:l,orientation:u,...c})=>{let s=(0,U.useRef)({start:0,end:0,contraStart:0,contraEnd:0}),[d,m]=(0,U.useState)({draggable:void 0,draggedItemIndex:-1,isDragging:!1}),i=(0,U.useRef)(null),g=(0,U.useRef)(),f=(0,U.useRef)(null),p=(0,U.useRef)(!1),h=(0,U.useRef)({x:0,y:0}),C=(0,U.useRef)({x:0,y:0}),S=(0,U.useRef)({x:0,y:0}),T=(0,U.useRef)(null),b=(0,U.useRef)(-1),w=(0,U.useRef)(-1),M=(0,U.useRef)(),{isDragSource:x,isDropTarget:E,register:v}=gn(c.id);c.id&&(x||E)&&v(c.id);let D=(0,U.useCallback)(()=>{var ee;let{current:B}=w,q=(ee=t.current)==null?void 0:ee.querySelector(`${n}[data-index="${B}"]`);q&&q.classList.remove("vuuDropTarget-settling"),w.current=-1,l==null||l(B),m(te=>({...te,draggable:void 0}))},[t,n,l]),k=(0,U.useCallback)(B=>{if(t.current){let{POS:q,SCROLL_POS:ee,SCROLL_SIZE:te,CLIENT_SIZE:Z}=me(u),{[ee]:he,[te]:It,[Z]:_e}=t.current,lt=It-_e,ct=he<lt,Nt=s.current.end,ut=he>0&&B-h.current[q]<=s.current.start,dt=ct&&B-h.current[q]>=Nt;return ut?"bwd":dt?"fwd":""}},[t,u]),y=e===!0||e==="natural-movement"?gr:e==="drop-indicator"?br:bi,L=(0,U.useCallback)((B,q,ee)=>{var te;(te=M.current)==null||te.call(M,B,q,ee)},[]),{isScrolling:I,startScrolling:P,stopScrolling:N}=vr({containerRef:t,onScrollingStopped:L,orientation:u}),R=(0,U.useCallback)((B,q)=>{b.current=q,a==null||a(B,q),w.current=q},[a]),{beginDrag:H,drag:$,drop:O,handleScrollStart:K,handleScrollStop:z,...G}=y({...c,containerRef:t,draggableRef:i,isDragSource:x,isDropTarget:E,itemQuery:n,onDrop:R,orientation:u});M.current=z;let _=(0,U.useCallback)(B=>{let{CLIENT_POS:q,CONTRA_CLIENT_POS:ee,CONTRA_POS:te,POS:Z}=me(u),{clientX:he,clientY:It}=B,{[q]:_e,[ee]:lt}=B,ct=C.current[Z],Nt=C.current[te],ut=Math.abs(ct-_e);if((x?Math.abs(Nt-lt):0)-ut>5&&(s.current=Tr),C.current.x=he,C.current.y=It,s.current===Tr&&i.current){let Ht=C.current.x-h.current.x,We=C.current.y-h.current.y;i.current.style.top=`${We}px`,i.current.style.left=`${Ht}px`}else if(ut>0&&i.current){let Ht=ct<_e?"fwd":"bwd",We=k(_e),Eo=C.current[Z]-h.current[Z];if(We&&p.current&&!I.current?(K(),P(We,1)):!We&&I.current&&N(),!I.current){let Wt=Math.round(Math.max(s.current.start,Math.min(s.current.end,Eo))),Me=u==="horizontal"?"left":"top";i.current.style[Me]=`${Wt}px`,$(Wt,Ht)}}},[$,i,k,K,x,I,u,P,N]),Y=(0,U.useCallback)(()=>{document.removeEventListener("mousemove",_,!1),document.removeEventListener("mouseup",Y,!1),T.current=i.current,O(),m(B=>({...B,draggedItemIndex:-1,isDragging:!1})),g.current=void 0},[_,i,O]),A=(0,U.useCallback)(B=>{let{clientX:q,clientY:ee,target:te}=B,Z=vi(te,n),{current:he}=t;if(he&&Z){let{CONTRA:It,CONTRA_END:_e,DIMENSION:lt,END:ct,SCROLL_SIZE:Nt,CLIENT_SIZE:ut,START:dt}=me(u);g.current=Z;let{[Nt]:Ht,[ut]:We}=he;p.current=Ht>We;let[Eo,Wt]=xi(he,n),Me=he.getBoundingClientRect(),qt=Z.getBoundingClientRect(),Co=qt[lt],{[dt]:ua,[ct]:da}=Eo.getBoundingClientRect();h.current.x=q-qt.left,h.current.y=ee-qt.top,s.current.start=Me[dt],s.current.end=Wt?Math.max(ua,Me.right-Co):p.current?Me[dt]+Me[lt]-Co:da-Co,s.current.contraStart=Me[It],s.current.contraEnd=Me[_e],H(B);let{dataset:{index:ma="-1"}}=Z;m({isDragging:!0,draggable:(0,Mr.jsx)(so,{element:bn(Z),onTransitionEnd:D,ref:i,style:Tn(qt,Me),wrapperClassName:o}),draggedItemIndex:parseInt(ma)}),r==null||r(),document.addEventListener("mousemove",_,!1),document.addEventListener("mouseup",Y,!1)}},[H,t,_,Y,o,i,n,r,u,D]),F=(0,U.useCallback)(B=>{let{CLIENT_POS:q,POS:ee}=me(u),{[q]:te}=B;Math.abs(te-S.current[ee])>yi&&t.current&&(f.current&&(window.clearTimeout(f.current),f.current=null),document.removeEventListener("mousemove",F),document.removeEventListener("mouseup",W,!1),A(B))},[t,H,u]),W=(0,U.useCallback)(()=>{f.current&&(window.clearTimeout(f.current),f.current=null),document.removeEventListener("mousemove",F,!1),document.removeEventListener("mouseup",W,!1)},[F]),le=(0,U.useCallback)(B=>{console.log("useDragDropNext onMouseDown");let{current:q}=t;if(q&&!B.defaultPrevented){let{clientX:ee,clientY:te}=B;C.current.x=S.current.x=ee,C.current.y=S.current.y=te,document.addEventListener("mousemove",F,!1),document.addEventListener("mouseup",W,!1),B.persist(),f.current=window.setTimeout(()=>{document.removeEventListener("mousemove",F,!1),document.removeEventListener("mouseup",W,!1),A(B.nativeEvent)},500)}},[t,A,F,W]),{current:ke}=T;return(0,U.useLayoutEffect)(()=>{if(ke&&t.current){let B=b.current,q=t.current.querySelector(`${n}[data-index="${B}"]`);q?(q.classList.add("vuuDropTarget-settling"),requestAnimationFrame(()=>{let{top:ee,left:te}=q.getBoundingClientRect(),{top:Z,left:he}=ke.getBoundingClientRect();he!==te||Z!==ee?(ke.classList.add("vuuDraggable-settling"),ke.style.top=`${ee}px`,ke.style.left=`${te}px`):D()})):console.log(`dont have the dropped item (at ${B})`),T.current=null}},[t,n,ke,D]),{...G,...d,isScrolling:I,onMouseDown:e?le:void 0}};var ye=require("react"),Ft=require("@salt-ds/core");var Fo=require("react/jsx-runtime"),$o="vuuEditableLabel",Er=(0,ye.forwardRef)(function({className:t,defaultEditing:o,defaultValue:n,editing:r,onChange:a,onEnterEditMode:l,onExitEditMode:u,value:c,...s},d){let m=(0,ye.useRef)(null),i=(0,ye.useRef)(!1),[g,f]=(0,Ft.useControlled)({controlled:c,default:n!=null?n:"",name:"EditableLabel",state:"value"}),[p,h]=(0,Ft.useControlled)({controlled:r,default:o!=null?o:!1,name:"EditableLabel",state:"editing"}),C=(0,ye.useCallback)(D=>{h(i.current=D)},[]),S=(0,ye.useRef)(g);(0,ye.useLayoutEffect)(()=>{p&&m.current!==null&&(m.current.select(),m.current.focus())},[p,m]);let T=(0,ye.useCallback)(()=>{C(!0),l&&l()},[l,C]),b=({cancelEdit:D=!1,allowDeactivation:k=!1}={})=>{C(!1);let y=S.current;y!==g&&(D?f(y):S.current=g),u&&u(y,g,k,D)},w=D=>{let{value:k}=D.target;f(k),a&&a(k)},M=()=>{T()},x=()=>{i.current&&b({allowDeactivation:!0})},E=D=>{p&&D.key==="Enter"?(D.stopPropagation(),b()):D.key==="ArrowRight"||D.key==="ArrowLeft"?D.stopPropagation():D.key==="Escape"&&b({cancelEdit:!0})},v=Yt($o,t,{[`${$o}-editing`]:p});return(0,Fo.jsx)("div",{...s,className:v,onDoubleClick:M,"data-text":g,ref:d,children:p?(0,Fo.jsx)(Ft.Input,{inputProps:{className:`${$o}-input`},value:g,onBlur:x,onChange:w,onKeyDown:E,inputRef:m,style:{padding:0},textAlign:"left",variant:"secondary"}):g})});var yt=require("@vuu-ui/vuu-layout"),Fr=require("@salt-ds/core"),Kr=V(require("classnames")),vt=V(require("react"));var ae=require("react");var Cr=e=>typeof e=="object"&&e!==null&&"tabIndex"in e&&typeof e.tabIndex=="number",Sr=e=>({label:"Close",location:"tab",action:"close-tab",options:e}),Lr=e=>({label:"Rename",location:"tab",action:"rename-tab",options:e});var Mi=e=>{if(e){let t=parseInt(e.dataset.index||"");if(!isNaN(t))return t}return-1},Dr=(e,t)=>{if(e){let o=e.querySelector(`[data-index]:has(${t})`);return Mi(o)}return-1},Ko=e=>Dr(e,'[aria-selected="true"]'),wr=e=>Dr(e,".vuuEditableLabel-editing");var bt=require("@vuu-ui/vuu-utils"),Le=require("react"),Ir=(e,t,o="horizontal")=>{let n=(0,Le.useRef)(!1),r=(0,Le.useCallback)(()=>{n.current=!0},[]),a=(0,Le.useCallback)(()=>{n.current=!1},[]),l=(0,Le.useCallback)(()=>{var c,s;(c=e.current)==null||c.style.setProperty("--tab-thumb-transition","none"),(s=e.current)==null||s.removeEventListener("transitionend",l)},[e]),u=(0,Le.useRef)(-1);return(0,Le.useMemo)(()=>{var d,m;let c=0,s=0;if(u.current!==-1){let i=(d=e.current)==null?void 0:d.querySelector(".vuuTab-selected"),g=(m=e.current)==null?void 0:m.querySelector(`[data-index="${t}"] .vuuTab`),{positionProp:f,sizeProp:p}=bt.MEASURES[o];if(i&&g&&!n.current){let{[f]:h,[p]:C}=i.getBoundingClientRect(),{[f]:S}=g.getBoundingClientRect();if((0,bt.isValidNumber)(h)&&(0,bt.isValidNumber)(S)&&(0,bt.isValidNumber)(C)){console.log({orientation:o,positionProp:f,oldPosition:h,newPosition:S}),c=h-S,s=C;let b=Math.abs(c/(o==="horizontal"?1100:700));requestAnimationFrame(()=>{var w,M,x,E;(w=e.current)==null||w.style.setProperty("--tab-thumb-offset","0px"),(M=e.current)==null||M.style.setProperty("--tab-thumb-size","100%"),(x=e.current)==null||x.style.setProperty("--tab-thumb-transition",`all ${b}s ease`),(E=e.current)==null||E.addEventListener("transitionend",l)})}}}return u.current=t,n.current?{containerStyle:{"--tab-thumb-offset":"0px","--tab-thumb-size":"100%"},resumeAnimation:a,suspendAnimation:r}:{containerStyle:{"--tab-thumb-offset":`${c}px`,"--tab-thumb-size":s?`${s}px`:void 0},resumeAnimation:a,suspendAnimation:r}},[t,e,o,l,a,r])};var Hr=require("@salt-ds/core"),Pr=require("@vuu-ui/vuu-utils"),re=require("react"),ie=require("@vuu-ui/vuu-utils");var Rr={horizontal:{[ie.Home]:"start",[ie.End]:"end",[ie.ArrowLeft]:"bwd",[ie.ArrowRight]:"fwd"},vertical:{[ie.Home]:"start",[ie.End]:"end",[ie.ArrowUp]:"bwd",[ie.ArrowDown]:"fwd"}},Ei=(e,t="horizontal")=>Rr[t][e]!==void 0,Ci=e=>e===ie.ArrowDown;function Nr(e,t,o){return t==="start"?0:t==="end"?e-1:t==="bwd"?o>0?o-1:o:o===null?0:o===e-1?o:o+1}var Si=e=>e!==null&&!e.classList.contains("wrapped"),ao=(e,t)=>e?e.querySelector(`[data-index="${t}"]`):null,kr=({containerRef:e,defaultHighlightedIdx:t=-1,highlightedIdx:o,keyBoardActivation:n,orientation:r,selectedIndex:a=0})=>{let l=n==="manual",u=(0,re.useRef)(!1),c=(0,re.useRef)(-1),[s,d]=(0,re.useState)(!1),[,m]=(0,re.useState)({}),[i,g]=(0,Hr.useControlled)({controlled:o,default:t,name:"UseKeyboardNavigation"}),f=(0,re.useCallback)(y=>{g(c.current=y)},[g]),p=(0,re.useRef)(!1),h=(0,re.useCallback)((y,L=!1,I,P=70)=>{f(y),I===!0&&!p.current&&(p.current=!0);let N=()=>{let R=ao(e.current,y);if(R){let H=(0,Pr.getFocusableElement)(R);H==null||H.focus()}};L?N():setTimeout(N,P)},[e,f]),C=y=>{if(c.current===-1&&y.target.tabIndex!==-1){let L=wr(e.current);L!==-1?requestAnimationFrame(()=>{f(L)}):setTimeout(()=>{c.current===-1&&a!==null&&f(a)},200)}},S=(0,re.useCallback)(()=>{var y,L;return(L=(y=e.current)==null?void 0:y.querySelectorAll("[data-index]").length)!=null?L:0},[e]),T=(0,re.useCallback)((y="fwd",L)=>{let I=S(),N=Nr(I,y,typeof L=="number"?L:I),R=y==="start"?"fwd":y==="end"?"bwd":y;for(;(R==="fwd"&&N<I||R==="bwd"&&N>0)&&!Si(ao(e.current,N));){let H=Nr(I,R,N);if(H===N)break;N=H}return N},[e,S]),b=(0,re.useCallback)((y,L=!1)=>{let I=Rr[r][y.key],P=T(I,i);P!==i?l&&h(P,!0):L&&m({})},[i,l,T,h,r]),w=(0,re.useCallback)(()=>{let y=ao(e.current,i);return y?y.querySelector(".vuuPopupMenu")!=null:!1},[e,i]),M=(0,re.useCallback)(()=>{let y=ao(e.current,i),L=y==null?void 0:y.querySelector(".vuuPopupMenu");if(L){let I=new MouseEvent("click",{view:window,bubbles:!0,cancelable:!0});L.dispatchEvent(I)}return!1},[e,i]),x=(0,re.useCallback)(y=>{S()>0&&Ei(y.key,r)?(y.preventDefault(),p.current?b(y):(p.current=!0,b(y,!0))):Ci(y.key)&&w()&&M()},[M,S,w,b,r]),E=(y,L)=>{f(L)},v=(0,re.useCallback)(()=>{s||(d(!0),u.current?u.current=!1:p.current=!0)},[s]),D=(0,re.useCallback)(()=>{s||(u.current=!0),p.current=!1},[s]);return{containerProps:{onBlur:y=>{let L=y.target.closest(".vuuTabstrip"),I=y.relatedTarget;L&&!(L!=null&&L.contains(I))&&(f(-1),d(!1))},onMouseDownCapture:D,onFocus:v,onMouseLeave:()=>{p.current=!0,f(-1),u.current=!1}},focusVisible:p.current?i:-1,focusIsWithinComponent:s,highlightedIdx:i,focusTab:h,onClick:E,onFocus:C,onKeyDown:x,setHighlightedIdx:f}};var Or=require("@salt-ds/core"),Kt=require("react"),Li=["Enter"," "],Di=e=>e&&e.matches('[class*="vuuTab "]'),Ar=({defaultSelected:e,highlightedIdx:t,onSelectionChange:o,selected:n})=>{let[r,a,l]=(0,Or.useControlled)({controlled:n,default:e!=null?e:0,name:"Tabstrip",state:"value"}),u=(0,Kt.useCallback)(m=>Li.includes(m.key),[]),c=(0,Kt.useCallback)(m=>{a(m),o==null||o(m)},[o,a]),s=(0,Kt.useCallback)(m=>{let i=m.target;u(m)&&t!==r&&Di(i)&&(m.stopPropagation(),m.preventDefault(),c(t))},[u,t,r,c]),d=(0,Kt.useCallback)((m,i)=>{i!==r&&c(i)},[c,r]);return{activateTab:c,isControlled:l,onClick:d,onKeyDown:s,selected:r}};var wi=new Set(["Enter"," "]),Ii=e=>wi.has(e),Ni=(e,t)=>e?e.querySelector(`[data-index="${t}"]`):null,$r=({activeTabIndex:e,allowDragDrop:t,animateSelectionThumb:o,containerRef:n,onActiveChange:r,onAddTab:a,onCloseTab:l,onExitEditMode:u,onMoveTab:c,orientation:s,keyBoardActivation:d})=>{let m=(0,ae.useRef)(e),{focusTab:i,highlightedIdx:g,onClick:f,onKeyDown:p,setHighlightedIdx:h,...C}=kr({containerRef:n,keyBoardActivation:d,orientation:s,selectedIndex:m.current}),{activateTab:S,onClick:T,onKeyDown:b,selected:w}=Ar({highlightedIdx:g,onSelectionChange:r,selected:e});m.current=w;let{containerStyle:M,resumeAnimation:x,suspendAnimation:E}=Ir(n,o?w:-1,s),v=(0,ae.useCallback)((A,F)=>{let{current:W}=m;console.log(`useTabstrip handleDrop ${A} - ${F} ${W}`),c==null||c(A,F);let le=-1;F!==-1&&(W===A?le=F:A>W&&F<=W?le=W+1:A<W&&F>=W&&(le=W-1),le!==-1&&(E(),S(le),requestAnimationFrame(x)),i(F,!1,!1,350))},[i,c,x,S,E]),{onMouseDown:D,...k}=xr({allowDragDrop:t,containerRef:n,draggableClassName:`tabstrip-${s}`,onDrop:v,orientation:"horizontal",itemQuery:".vuuOverflowContainer-item"}),y=(0,ae.useCallback)((A,F,W,le)=>{console.log(`handleExitEditMode ${A} ${F} ${W} ${le}`),u==null||u(A,F,W,le),W||i(le,!1,!0)},[i,u]),L=(0,ae.useCallback)((A,F)=>{f(A,F),T(A,F)},[f,T]),I=(0,ae.useCallback)((A=g)=>{let F=Ni(n.current,A);if(F)return F.querySelector(".vuuEditableLabel")},[n,g]),P=(0,ae.useCallback)((A=g)=>{let F=I(A);return F?F.classList.contains("vuuEditableLabel-editing"):!1},[I,g]),N=(0,ae.useCallback)((A=g)=>{let F=I(A);if(F){let W=new MouseEvent("dblclick",{view:window,bubbles:!0,cancelable:!0});F.dispatchEvent(W)}},[I,g]),R=(0,ae.useCallback)(A=>{p(A),A.defaultPrevented||b(A),!A.defaultPrevented&&Ii(A.key)&&N()},[N,p,b]),H=(0,ae.useCallback)(A=>{let F=Ko(n.current),W=F>A?F-1:F===A?0:F;return E(),l==null||l(A,W),setTimeout(()=>{x()},200),!0},[n,l,x,E]),$=(0,ae.useCallback)(A=>(N(A),!0),[N]),O=(0,ae.useCallback)(A=>{if(Cr(A.options))switch(A.menuId){case"close-tab":return H(A.options.tabIndex);case"rename-tab":return $(A.options.tabIndex);default:console.log(`tab menu action ${A.menuId}`)}return!1},[H,$]),K=(0,ae.useCallback)(()=>{P()?h(g):i(g)},[g,i,h,P]),z=(0,ae.useCallback)(A=>{let F=parseInt(A.index);isNaN(F)||S(F)},[S]),G={onFocus:C.onFocus,onKeyDown:R},_=(0,ae.useCallback)(()=>{a==null||a(),requestAnimationFrame(()=>{let A=Ko(n.current);A!==-1&&i(A)})},[n,i,a]),Y={onClick:L,onKeyDown:R,onExitEditMode:y,onMenuAction:O,onMenuClose:K,onMouseDown:D};return{activeTabIndex:w,containerStyle:M,focusVisible:C.focusVisible,containerProps:{...C.containerProps,onSwitchWrappedItemIntoView:z},navigationProps:G,onClickAddTab:_,tabProps:Y,...k}};var Tt=require("react/jsx-runtime"),Vr=require("react"),Bo="vuuTabstrip",Br=({activeTabIndex:e,allowAddTab:t,allowCloseTab:o,allowDragDrop:n=!1,allowRenameTab:r=!1,animateSelectionThumb:a=!1,children:l,className:u,id:c,keyBoardActivation:s="manual",location:d,onActiveChange:m,onAddTab:i,onCloseTab:g,onExitEditMode:f,onMoveTab:p,orientation:h="horizontal",showTabMenuButton:C,style:S,...T})=>{let b=(0,vt.useRef)(null),{activeTabIndex:w,focusVisible:M,containerStyle:x,draggedItemIndex:E,onClickAddTab:v,tabProps:D,...k}=$r({activeTabIndex:e,allowDragDrop:n,animateSelectionThumb:a,containerRef:b,keyBoardActivation:s,onActiveChange:m,onAddTab:i,onCloseTab:g,onExitEditMode:f,onMoveTab:p,orientation:h}),y=(0,yt.useId)(c),L=(0,Kr.default)(Bo,`${Bo}-${h}`,u),I=S||x?{...S,...x}:void 0,P=(0,vt.useMemo)(()=>(0,yt.asReactElements)(l).map((N,R)=>{let{id:H=`${y}-tab-${R}`,closeable:$=o,editable:O=r,showMenuButton:K=C}=N.props,z=R===w;return vt.default.cloneElement(N,{...D,...k.navigationProps,closeable:$,"data-overflow-priority":z?"1":void 0,dragging:E===R,editable:O,focusVisible:M===R,id:H,index:R,key:R,location:d,selected:z,showMenuButton:K,tabIndex:z?0:-1})}).concat(t?(0,Vr.createElement)(Fr.Button,{...k.navigationProps,"aria-label":"Create Tab",className:`${Bo}-addTabButton`,"data-icon":"add","data-overflow-priority":"1",key:"addButton",onClick:v,variant:"secondary",tabIndex:-1}):[]),[w,t,o,r,l,M,y,d,v,C,D,E,k.navigationProps]);return(0,Tt.jsxs)(Tt.Fragment,{children:[(0,Tt.jsx)(yt.OverflowContainer,{...T,...k.containerProps,className:L,height:28,id:y,orientation:h,overflowIcon:"more-horiz",ref:b,style:I,children:P}),k.draggable]})};var Gr=require("@salt-ds/core"),Zr=V(require("classnames")),je=require("react");var Ur=require("react"),zr=V(require("classnames"));var Wr=require("react/jsx-runtime"),Hi="vuuTabMenu",_r=({allowClose:e,allowRename:t,location:o,onMenuAction:n,onMenuClose:r,index:a})=>{let[l,u]=(0,Ur.useMemo)(()=>[(c,s)=>{let d=[];return t&&d.push(Lr(s)),e&&d.push(Sr(s)),d},{tabIndex:a}],[e,t,a]);return(0,Wr.jsx)(cr,{className:Hi,menuBuilder:l,menuActionHandler:n,menuLocation:(0,zr.default)("tab",o),menuOptions:u,onMenuClose:r,tabIndex:-1})};var Ye=require("react/jsx-runtime"),Xe="vuuTab",qr=()=>{},Bt=(0,je.forwardRef)(function({ariaControls:t,children:o,className:n,closeable:r=!1,dragging:a,editable:l=!1,editing:u,focusVisible:c,index:s=-1,label:d,location:m,onClick:i,onClose:g,onEnterEditMode:f=qr,onExitEditMode:p=qr,onFocus:h,onKeyUp:C,onMenuAction:S,onMenuClose:T,orientation:b,selected:w,showMenuButton:M=r||l,tabIndex:x,...E},v){if(M&&typeof S!="function")throw Error("Tab onMenuAction must be provided if showMenuButton is set");let D=(0,je.useRef)(null),k=(0,je.useRef)(null),y=(0,Gr.useForkRef)(v,D),L=(0,je.useCallback)(H=>{u||(H.preventDefault(),i==null||i(H,s))},[u,s,i]),I=(H="",$="",O=!0)=>p(H,$,O,s),P=H=>{switch(H.key){case"Backspace":case"Delete":r&&(H.stopPropagation(),g&&g(s));break;default:C&&C(H,s)}},N=()=>l?(0,Ye.jsx)(Er,{editing:u,defaultValue:d,onEnterEditMode:f,onExitEditMode:I,ref:k},d):d,R=H=>{if(k.current){let O=k.current.querySelector(".vuuEditableLabel-input");O==null||O.focus()}h==null||h(H)};return(0,Ye.jsxs)("div",{...E,"aria-controls":t,"aria-selected":w,className:(0,Zr.default)(Xe,{[`${Xe}-closeable`]:r,"vuuDraggable-dragAway":a,[`${Xe}-editing`]:u,[`${Xe}-selected`]:w||void 0,[`${Xe}-vertical`]:b==="vertical",vuuFocusVisible:c}),onClick:L,onFocus:R,onKeyUp:P,ref:y,role:"tab",tabIndex:x,children:[(0,Ye.jsx)("div",{className:`${Xe}-main`,children:(0,Ye.jsx)("span",{className:`${Xe}-text`,"data-text":l?void 0:d,children:o!=null?o:N()})}),M?(0,Ye.jsx)(_r,{allowClose:r,allowRename:l,location:m,onMenuAction:S,onMenuClose:T,index:s}):null]})});var po=require("@salt-ds/core"),mo=V(require("classnames")),fo=require("react");function Pi(e){var t;if(e){let o=e.dataset.idx;if(o)return parseInt(o,10);if(o=(t=e.ariaPosInSet)!=null?t:"-1")return parseInt(o,10)-1}}var Vo=e=>e.closest("[data-idx],[aria-posinset]");var Jr=e=>Pi(Vo(e));var xt=require("react"),Ri=new Set(["/","-","."]),ki=e=>Ri.has(e),Xr=(e,t)=>t.startsWith(e)&&ki(t[e.length]),Yr=(e,t="root",{collapsibleHeaders:o=void 0,defaultExpanded:n=!1,revealSelected:r=!1}={})=>{let a=(i,g,f)=>{if(i.childNodes)return i.childNodes.length;if(i.header){let p=f+1,h=0;for(;p<g.length&&!g[p].header;)h++,p++;return h}else return 0},l=(0,xt.useCallback)(i=>Array.isArray(r)?r.some(g=>Xr(i,g)):n,[n,r]),u=(0,xt.useCallback)((i,g,f=1,p="",h=[],C=[])=>{let S=0;return i.forEach((T,b,w)=>{var I;let M=T.header&&o,x=T.childNodes&&o===!1,E=!T.childNodes||T.childNodes.length===0,v=x||E&&!M,D=p?`${p}.${b}`:`${b}`,k=(I=T.id)!=null?I:`${t}-${D}`,y=v?void 0:l(k),L={...T,childNodes:void 0,id:k,count:!x&&y===void 0?0:a(T,w,b),expanded:y,index:g.index,level:f};if(h.push(L),C.push(i[b]),S+=1,g.index+=1,T.childNodes){let[P,N]=u(T.childNodes,g,f+1,D,[],C);L.childNodes=N,(y===!0||x)&&(S+=P)}}),[S,h,C]},[o,t,l]),[c,s,d]=(0,xt.useMemo)(()=>u(e,{index:0}),[u,e]),m=(0,xt.useCallback)((i,g=s)=>{let f=g.find(p=>{var h;return p.id===i||((h=p==null?void 0:p.childNodes)==null?void 0:h.length)&&Xr(p.id,i)});if((f==null?void 0:f.id)===i)return d[f.index];if(f)return m(i,f.childNodes)},[d,s]);return[c,s,m]};var Ke=require("react"),es=require("@salt-ds/core"),jr="single",Oi="checkbox",Ai="multi",$i="extended",Fi=["Enter"," "],Qr={},Ki=e=>e.expanded!==void 0,ts=e=>e&&e!=="none",os=({defaultSelected:e,highlightedIdx:t,treeNodes:o,onChange:n,selected:r,selection:a=jr,selectionKeys:l=Fi})=>{let u=a===jr,c=a===Ai||a.startsWith(Oi),s=a===$i,d=(0,Ke.useRef)(-1),m=(0,Ke.useCallback)(b=>l.includes(b.key),[l]),[i,g]=(0,es.useControlled)({controlled:r,default:e!=null?e:[],name:"selected"}),f=(0,Ke.useCallback)((b,w,M,x,E=!1)=>{let{current:v}=d,D=i==null?void 0:i.includes(M),y=u||s&&!E&&(!x||v===-1),L=c||s&&E&&!x,I=[];if(y&&D)I=[];else if(y)I=[M];else if(L&&D)I=i.filter(P=>P!==M);else if(L)I=i.concat(M);else if(s){let[P,N]=w>v?[v,w]:[w,v];I=i.slice();for(let R=P;R<=N;R++){let{id:H}=o[R];i.includes(H)||I.push(H)}}g(I),n&&n(b,I)},[s,o,c,n,i,g,u]),p=(0,Ke.useCallback)(b=>{if(~t&&m(b)){b.preventDefault();let w=o[t];f(b,t,w.id,!1,b.ctrlKey||b.metaKey),s&&(d.current=t)}},[s,t,o,m,f]),h=(0,Ke.useCallback)((b,w)=>{if(s&&b.shiftKey){let M=o[w];f(b,w,M.id,!0)}},[s,o,f]),C=a==="none"?Qr:{onKeyDown:p,onKeyboardNavigation:h},S=(0,Ke.useCallback)(b=>{if(t!==-1){let w=o[t];Ki(w)||(b.preventDefault(),b.stopPropagation(),f(b,t,w.id,b.shiftKey,b.ctrlKey||b.metaKey),s&&(d.current=t))}},[s,t,o,f]);return{listHandlers:C,listItemHandlers:a==="none"?Qr:{onClick:S},selected:i,setSelected:g}};var ce=require("react");var et=require("react");var Qe=new Map,rs=(e,t,o)=>{switch(o){case"height":return t.height;case"clientHeight":return e.clientHeight;case"clientWidth":return e.clientWidth;case"contentHeight":return t.contentHeight;case"contentWidth":return t.contentWidth;case"scrollHeight":return Math.ceil(e.scrollHeight);case"scrollWidth":return Math.ceil(e.scrollWidth);case"width":return t.width;default:return 0}};var ns=new ResizeObserver(e=>{for(let t of e){let{target:o,borderBoxSize:n,contentBoxSize:r}=t,a=Qe.get(o);if(a){let[{blockSize:l,inlineSize:u}]=n,[{blockSize:c,inlineSize:s}]=r,{onResize:d,measurements:m}=a,i=!1;for(let[g,f]of Object.entries(m)){let p=rs(o,{height:l,width:u,contentHeight:c,contentWidth:s},g);p!==f&&(i=!0,m[g]=p)}i&&d&&d(m)}}});function ss(e,t,o,n=!1){let r=(0,et.useRef)(t),a=(0,et.useCallback)(l=>{let{width:u,height:c}=l.getBoundingClientRect(),{clientWidth:s,clientHeight:d}=l;return r.current.reduce((m,i)=>(m[i]=rs(l,{width:u,height:c,contentHeight:d,contentWidth:s},i),m),{})},[]);(0,et.useEffect)(()=>{let l=e.current;async function u(){Qe.set(l,{measurements:{}}),await document.fonts.ready;let c=Qe.get(l);if(c){let s=a(l);c.measurements=s,ns.observe(l),n&&o(s)}else console.log("%cuseResizeObserver an target expected to be under observation wa snot found. This warrants investigation","font-weight:bold; color:red;")}if(l){if(Qe.has(l))throw Error("useResizeObserver attemping to observe same element twice");u()}return()=>{l&&Qe.has(l)&&(ns.unobserve(l),Qe.delete(l))}},[a,e]),(0,et.useEffect)(()=>{let l=e.current,u=Qe.get(l);if(u){if(r.current!==t){r.current=t;let c=a(l);u.measurements=c}u.onResize=o}},[t,a,e,o])}var Bi=["height","scrollHeight"],as=(e,t,o=!1)=>{let n=(0,ce.useRef)(0),r=(0,ce.useRef)(!1),a=(0,ce.useRef)(0),l=(0,ce.useRef)(0),u=(0,ce.useCallback)(d=>{let m=d.ariaExpanded?d.firstChild:d,i=o?30:0,g=m.offsetTop,f=m.offsetHeight,p=n.current+i,h=p+a.current-i;(g+f>h||g<p)&&(n.current=g+f>h?n.current+(g+f)-h:g-i,r.current=!0,e.current&&(e.current.scrollTop=n.current),setTimeout(()=>{r.current=!1}))},[e,o]),c=(0,ce.useCallback)(d=>{n.current=d.target.scrollTop},[]);(0,ce.useEffect)(()=>{let{current:d}=e;return d&&d.addEventListener("scroll",c),()=>{d&&d.removeEventListener("scroll",c)}},[e,c]),(0,ce.useLayoutEffect)(()=>{if(t!==-1&&l.current>a.current&&e.current){let d=e.current.querySelector(`
2
+ [data-idx='${t}'],
3
+ [aria-posinset='${t+1}']
4
+ `);d===null?console.log("[useViewportTracking], is this virtualised ? we're going to have to know rowHeight"):u(d)}},[t,e,u]),(0,ce.useEffect)(()=>{},[o]);let s=(0,ce.useCallback)(({height:d,scrollHeight:m})=>{a.current=d,l.current=m},[]);return ss(e,Bi,s,!0),r};var Vt=require("react");var fe=require("react");var is=({id:e})=>{let t=e.lastIndexOf("-");if(t!==-1){let n=e.slice(t+1).split(".");return n.length===1?null:(n.pop(),`${e.slice(0,t)}-${n.join(".")}`)}else if((t=e.lastIndexOf("/"))!==-1)return e.slice(0,t)},ls=e=>e.childNodes!==void 0;var Uo=e=>e.header===!0,Vi=new Set([".","/"]),cs=(e,t)=>t.startsWith(e.id)?Vi.has(t.charAt(e.id.length)):!1,tt=(e,t)=>{for(let o of e){if(o.id===t)return o;if(cs(o,t))return tt(o.childNodes,t)}},io=(e,t)=>{let o=typeof t=="string"?t:t.id;for(let n=0;n<e.length;n++)if(e[n].id===o)return n},lo=(e,t,o)=>{let n;return e.map(a=>a.id===t?{...a,...o}:cs(a,t)?(n=lo(a.childNodes,t,o),{...a,childNodes:n}):a)};var hs=require("@salt-ds/core");function Ui(e,...t){let o=new Set(e);for(let n of t)for(let r of n)o.add(r);return o}var zo="ArrowUp",us="ArrowDown",Mt="ArrowLeft";var ds="ArrowRight",co="Enter";var zi="Delete",_i=new Set([co,zi]),Wi=new Set(["Tab"]),qi=new Set(["ArrowRight","ArrowLeft"]),ms=new Set(["Home","End","ArrowDown","ArrowUp"]),ps=new Set(["Home","End","ArrowRight","ArrowLeft"]),Gi=new Set(["F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12"]),ep=Ui(_i,ps,ms,qi,Gi,Wi);var fs=({key:e},t="vertical")=>(t==="vertical"?ms:ps).has(e);function gs(e,t,o){return t===zo||t===Mt?o>0?o-1:o:o===null?0:o===e-1?o:o+1}var Zi=e=>!e.header&&!e.childNodes,Ji=e=>Zi(e)||e.expanded!==void 0,bs=({defaultHighlightedIdx:e=-1,highlightedIdx:t,treeNodes:o,onHighlight:n,onKeyboardNavigation:r,selected:a=[]})=>{let{bwd:l,fwd:u}=(0,fe.useMemo)(()=>({bwd:zo,fwd:us}),[]),[c,s,d]=(0,hs.useControlled)({controlled:t,default:e,name:"highlightedIdx"}),m=(0,fe.useCallback)(b=>{n==null||n(b),s(b)},[n,s]),i=(0,fe.useCallback)((b=u,w=b===u?-1:o.length)=>{let M=gs(o.length,b,w);for(;M!==-1&&(b===u&&M<o.length||b===l&&M>0)&&!Ji(o[M]);)M=gs(o.length,b,M);return M},[l,u,o]),g=(0,fe.useRef)(!0),f=(0,fe.useRef)(!1),p=b=>f.current=b,h=(0,fe.useCallback)(()=>{if(f.current)f.current=!1;else if(a.length>0){let b=tt(o,a[0]);if(b){let w=io(o,b);m(w)}}else m(i())},[o,i,a,m]),C=(0,fe.useCallback)(b=>{let w=i(b.key,c);w!==c&&(m(w),r==null||r(b,w))},[c,i,r,m]),S=(0,fe.useCallback)(b=>{o.length>0&&fs(b,"vertical")&&(b.preventDefault(),b.stopPropagation(),g.current=!0,C(b))},[o,C]),T=(0,fe.useMemo)(()=>({onBlur:()=>{m(-1)},onFocus:h,onKeyDown:S,onMouseDownCapture:()=>{g.current=!1,p(!0)},onMouseMove:()=>{g.current&&(g.current=!1)},onMouseLeave:()=>{g.current=!0,p(!1),m(-1)}}),[h,S,m]);return{focusVisible:g.current?c:-1,controlledHighlighting:d,highlightedIdx:c,hiliteItemAtIndex:m,keyBoardNavigation:g,listProps:T,setIgnoreFocus:p}};var Et=require("react");var uo=(e,t=[],o={value:0})=>{let n=!1;for(let r of e)n&&!Uo(r)||(t[o.value]=r,o.value+=1,n=!1,Uo(r)&&r.expanded===!1?n=!0:ls(r)&&_o(r)&&uo(r.childNodes,t,o));return t},ys=e=>{let t=(0,Et.useRef)(e),o=(0,Et.useRef)(e),n=(0,Et.useRef)(uo(e)),[,r]=(0,Et.useState)({});e!==t.current&&(t.current=e,o.current=e,n.current=uo(e));let a=l=>{o.current=l,n.current=uo(l),r({})};return{data:o.current,indexPositions:n.current,setData:a}};var De=require("react");var Xi={},Yi=e=>e&&e.hasAttribute("aria-expanded"),vs=({collapsibleHeaders:e,highlightedIdx:t,treeNodes:o,setVisibleData:n,source:r})=>{let a=(0,De.useRef)(r),l=(0,De.useRef)(a.current),u=(0,De.useCallback)(f=>{n(l.current=f)},[n]),c=(0,De.useCallback)((f,{id:p})=>lo(f,p,{expanded:!0}),[]),s=(0,De.useCallback)((f,{id:p})=>lo(f,p,{expanded:!1}),[]),d=(0,De.useCallback)(f=>{if(f.key===ds||f.key===co){let p=o[t];p&&p.expanded===!1&&(f.preventDefault(),u(c(l.current,p)))}if(f.key===Mt||f.key===co){let p=o[t];p&&p.expanded&&(f.preventDefault(),u(s(l.current,p)))}},[s,c,t,o,u]),m=e?{onKeyDown:d}:Xi,g={onClick:(0,De.useCallback)(f=>{let p=Vo(f.target);if(Yi(p)){f.stopPropagation(),f.preventDefault();let h=tt(r,p.id);(h==null?void 0:h.expanded)===!1?u(c(r,h)):(h==null?void 0:h.expanded)===!0&&u(s(r,h))}},[s,c,u,r])};return{listHandlers:m,listItemHandlers:g}};var Ts=require("react");var xs=({highlightedIdx:e,hiliteItemAtIndex:t,indexPositions:o,source:n})=>({listHandlers:{onKeyDown:(0,Ts.useCallback)(l=>{if(l.key===Mt){let u=o[e],c=is(u);if(c){l.preventDefault();let s=tt(n,c);if(s){let d=io(o,s);d!==void 0&&t(d)}}}},[e,t,o,n])}});var ji=[],Ms=({defaultSelected:e,sourceWithIds:t,onChange:o,onHighlight:n,selected:r,selection:a})=>{let l=(0,Vt.useRef)(ji),u=ys(t),c=(T,b)=>{var w,M;(M=(w=i.listHandlers).onKeyboardNavigation)==null||M.call(w,T,b)},{highlightedIdx:s,...d}=bs({treeNodes:u.indexPositions,onHighlight:n,onKeyboardNavigation:c,selected:l.current}),m=vs({collapsibleHeaders:!0,highlightedIdx:s,treeNodes:u.indexPositions,setVisibleData:u.setData,source:u.data}),i=os({defaultSelected:e,highlightedIdx:s,treeNodes:u.indexPositions,onChange:o,selected:r,selection:a}),g=xs({source:u.data,highlightedIdx:s,hiliteItemAtIndex:d.hiliteItemAtIndex,indexPositions:u.indexPositions}),f=(0,Vt.useCallback)(T=>{var b,w,M;(b=m.listItemHandlers)==null||b.onClick(T),T.defaultPrevented||(M=(w=i.listItemHandlers)==null?void 0:w.onClick)==null||M.call(w,T)},[m,i]),p=(0,Vt.useCallback)(T=>{var b,w,M,x,E,v,D,k;(w=(b=d.listProps).onKeyDown)==null||w.call(b,T),T.defaultPrevented||(x=(M=i.listHandlers).onKeyDown)==null||x.call(M,T),T.defaultPrevented||(v=(E=m.listHandlers).onKeyDown)==null||v.call(E,T),T.defaultPrevented||(k=(D=g.listHandlers).onKeyDown)==null||k.call(D,T)},[m.listHandlers,d.listProps,i.listHandlers,g.listHandlers]),h=()=>{var T;return s===void 0||s===-1||(T=u.indexPositions[s])==null?void 0:T.id};l.current=i.selected;let C={"aria-activedescendant":h(),onBlur:d.listProps.onBlur,onFocus:d.listProps.onFocus,onKeyDown:p,onMouseDownCapture:d.listProps.onMouseDownCapture,onMouseLeave:d.listProps.onMouseLeave,onMouseMove:d.listProps.onMouseMove},S={onClick:f};return{focusVisible:d.focusVisible,highlightedIdx:s,hiliteItemAtIndex:d.hiliteItemAtIndex,listProps:C,listItemHandlers:S,selected:i.selected,visibleData:u.data}};var de=require("react/jsx-runtime"),Cs=require("react"),Be="vuuTree",_o=e=>e.expanded===!0,Es=({children:e,idx:t,...o})=>(0,de.jsx)("li",{...o,children:e}),Qi=(0,fo.forwardRef)(function({allowDragDrop:t,className:o,defaultSelected:n,groupSelection:r="none",id:a,onHighlight:l,onSelectionChange:u,revealSelected:c,selected:s,selection:d="single",source:m,...i},g){var N;let f=(0,po.useIdMemo)(a),p=(0,fo.useRef)(null),[,h,C]=Yr(m,f,{revealSelected:c?(N=s!=null?s:n)!=null?N:!1:void 0}),S=(R,H)=>{if(u){let $=H.map(O=>C(O)).filter(O=>O!==void 0);u($)}},{focusVisible:T,highlightedIdx:b,hiliteItemAtIndex:w,listProps:M,listItemHandlers:x,selected:E,visibleData:v}=Ms({defaultSelected:n,groupSelection:r,onChange:S,onHighlight:l,selected:s,selection:d,sourceWithIds:h});as(p,b);let k={...{onMouseEnter:R=>{let H=R.target,$=Jr(H);w($)}},...x,role:"treeitem"},y=ts(r);function L(R,H,$){R.push((0,de.jsxs)(Es,{...k,...el(H,$,b,E,T),children:[H.icon?(0,de.jsx)("span",{className:`${Be}Node-icon`,"data-icon":H.icon}):null,(0,de.jsx)("span",{children:H.label})]})),$.value+=1}function I(R,H,$,O,K){let{value:z}=$;$.value+=1,R.push((0,Cs.createElement)(Es,{...x,"aria-expanded":H.expanded,"aria-level":H.level,"aria-selected":E.includes(O)||void 0,className:(0,mo.default)(`${Be}Node`,{focusVisible:T===z,[`${Be}Node-toggle`]:!y}),"data-idx":z,"data-highlighted":z===b||void 0,"data-selectable":!0,id:O,key:`header-${z}`},y?(0,de.jsxs)("div",{className:`${Be}Node-label`,children:[(0,de.jsx)("span",{className:`${Be}Node-toggle`}),K]}):(0,de.jsxs)("div",{className:`${Be}Node-label`,children:[H.icon?(0,de.jsx)("span",{className:`${Be}Node-icon`,"data-icon":H.icon}):null,(0,de.jsx)("span",{children:K})]}),(0,de.jsx)("ul",{role:"group",children:_o(H)?P(H.childNodes,$):""})))}function P(R,H={value:0}){if((R==null?void 0:R.length)>0){let $=[];for(let O of R)O.childNodes?I($,O,H,O.id,O.label):L($,O,H);return $}}return(0,de.jsx)("ul",{...i,...M,className:(0,mo.default)(Be,o),id:`Tree-${f}`,ref:(0,po.useForkRef)(p,g),role:"tree",tabIndex:0,children:P(v)})}),el=(e,t,o,n,r,a)=>({id:e.id,key:e.id,"aria-level":e.level,"aria-selected":n.includes(e.id)||void 0,"data-idx":t.value,"data-highlighted":t.value===o||void 0,className:(0,mo.default)("vuuTreeNode",a,{focusVisible:r===t.value})});Qi.displayName="Tree";var bo=V(require("classnames")),Ve=require("react");var we=require("react"),Ss=V(require("classnames")),Is=require("react/jsx-runtime"),Ls="medium",Ds="salt-theme",ws="light",go=(0,we.createContext)({density:"high",theme:"salt",themeMode:"light"}),tl=["salt","salt-density-high","light"],Ee=()=>{let e=(0,we.useContext)(go);return e?[`${e.theme}-theme`,`salt-density-${e.density}`,e.themeMode]:tl},ol=(e,t,o,n)=>{var r;return(0,we.isValidElement)(e)?(0,we.cloneElement)(e,{className:(0,Ss.default)((r=e.props)==null?void 0:r.className,`${t}-theme`,`${t}-density-${n}`),"data-mode":o}):(console.warn(`
2
5
  ThemeProvider can only apply CSS classes for theming to a single nested child element of the ThemeProvider.
3
- Wrap elements with a single container`),e)},me=({applyThemeClasses:e=!1,children:t,theme:o,themeMode:n,density:r})=>{var m,v,g;let{density:a,themeMode:l,theme:p}=(0,M.useContext)(ce),u=(m=r!=null?r:a)!=null?m:xt,c=(v=n!=null?n:l)!=null?v:Tt,h=(g=o!=null?o:p)!=null?g:St,d=e?io(t,h,c,u):t;return(0,Nt.jsx)(ce.Provider,{value:{themeMode:c,density:u,theme:h},children:d})};me.displayName="ThemeProvider";var Ut=require("@vuu-ui/vuu-utils");var oe=require("@vuu-ui/vuu-layout");var bt=require("@salt-ds/core"),Pe=L(require("classnames")),wt=require("react"),Et=require("@vuu-ui/vuu-layout");var _=require("react/jsx-runtime"),H="vuuContextPanel",Dt=({className:e,expanded:t=!1,overlay:o=!1,title:n})=>{let r=(0,Et.useLayoutProviderDispatch)(),a=(0,wt.useCallback)(()=>{r({path:"#context-panel",propName:"expanded",propValue:!1,type:"set-prop"})},[r]),l=(0,Pe.default)(H,e,{[`${H}-expanded`]:t,[`${H}-inline`]:o!==!0,[`${H}-overlay`]:o});return(0,_.jsx)("div",{className:(0,Pe.default)(H,l),children:(0,_.jsx)("div",{className:`${H}-inner`,children:(0,_.jsxs)("div",{className:`${H}-header`,children:[(0,_.jsx)("h2",{className:`${H}-title`,children:n}),(0,_.jsx)(bt.Button,{className:`${H}-close`,"data-icon":"close",onClick:a,variant:"secondary"})]})})})};var de=require("@vuu-ui/vuu-layout"),Me=L(require("classnames")),pe=require("react");var i=require("react/jsx-runtime"),S="vuuLeftNav",Pt=({"data-path":e,onResize:t,open:o=!0,...n})=>{let r=(0,de.useLayoutProviderDispatch)(),a=(0,pe.useRef)(o),l=(0,pe.useCallback)(()=>{a.current=!a.current,r({type:de.Action.LAYOUT_RESIZE,path:e,size:a.current?240:80})},[r,e]);return(0,i.jsxs)("div",{...n,className:S,children:[(0,i.jsxs)("div",{className:"vuuLeftNav-logo",children:[(0,i.jsxs)("svg",{width:"44",height:"45",viewBox:"0 0 44 45",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,i.jsxs)("g",{clipPath:"url(#clip0_217_6990)",children:[(0,i.jsx)("path",{d:"M39.8642 15.5509L35.9196 7.58974L34.3369 6.85464L24.6235 22.0825L39.1628 30.618L42.3152 25.6347L39.8642 15.5509Z",fill:"url(#paint0_linear_217_6990)"}),(0,i.jsx)("path",{d:"M42.6246 24.8716C41.9199 25.9157 40.9625 26.824 39.767 27.4905C38.424 28.2396 36.9563 28.597 35.5081 28.597C32.7541 28.597 30.0715 27.3094 28.4466 24.9855L15.772 3.90967L15.7655 3.9206C13.3615 0.137431 8.25372 -1.13143 4.24754 1.10507C0.178173 3.37435 -1.20852 8.39359 1.14854 12.3125L18.3445 40.9095C19.1108 42.1846 20.1816 43.1834 21.4144 43.8764C21.4241 43.8826 21.4338 43.8889 21.4435 43.8951C21.4484 43.8982 21.4549 43.9013 21.4597 43.9045C22.0332 44.2228 22.6423 44.471 23.2725 44.6536C23.3194 44.6677 23.368 44.6817 23.415 44.6942C23.6418 44.7551 23.8702 44.8097 24.1019 44.8534C24.1456 44.8612 24.1894 44.8659 24.2331 44.8737C24.4194 44.9049 24.6073 44.9314 24.7952 44.9501C24.8698 44.9579 24.9443 44.9658 25.0188 44.9704C25.2342 44.9876 25.4497 44.9985 25.6668 45.0001C25.6781 45.0001 25.6895 45.0001 25.6992 45.0001C25.7024 45.0001 25.704 45.0001 25.7073 45.0001C25.7105 45.0001 25.7121 45.0001 25.7154 45.0001C25.9503 45.0001 26.1868 44.9876 26.4217 44.9689C26.4751 44.9642 26.5286 44.9595 26.5837 44.9533C26.8137 44.9299 27.0438 44.9002 27.2738 44.8596C27.277 44.8596 27.2803 44.8596 27.2835 44.8596C27.5362 44.8144 27.7889 44.7551 28.0384 44.6864C28.0546 44.6817 28.0692 44.677 28.0854 44.6723C28.4483 44.5709 28.8063 44.4445 29.1594 44.2931C29.1659 44.29 29.174 44.2868 29.1805 44.2837C29.4494 44.1682 29.7151 44.0418 29.9759 43.8967C30.24 43.75 30.491 43.5908 30.7308 43.4206C30.9398 43.2739 31.1407 43.1179 31.3367 42.9524C31.5748 42.7495 31.8 42.5373 32.009 42.3141C32.1661 42.1471 32.3168 41.9723 32.4609 41.7913C32.5079 41.732 32.5517 41.6711 32.5954 41.6118C32.6942 41.4807 32.7882 41.3465 32.8789 41.2091C32.9259 41.1373 32.9728 41.0671 33.0182 40.9953C33.036 40.9672 33.0555 40.9407 33.0717 40.9126L42.7153 24.8763H42.6214L42.6246 24.8716Z",fill:"url(#paint1_linear_217_6990)"}),(0,i.jsx)("path",{d:"M42.8402 16.4218L42.1112 15.2232L38.9636 9.58433L37.504 7.19644C37.2286 6.56123 36.579 6.11331 35.8176 6.11331C34.8083 6.11331 33.9919 6.90147 33.9919 7.87223C33.9919 8.20154 34.0907 8.50432 34.2543 8.76808L34.2349 8.78056L39.9048 18.0808C40.5884 19.2186 40.7715 20.5437 40.4199 21.8141C40.0684 23.0845 39.226 24.1458 38.045 24.806C37.2675 25.2398 36.3846 25.4693 35.4936 25.4693C33.6727 25.4693 31.9766 24.5281 31.0662 23.0143L22.9161 9.63271H22.9323L19.4899 3.90958L19.4834 3.92051C19.4235 3.8253 19.3538 3.73947 19.2907 3.64738L19.1935 3.48663C19.1935 3.48663 19.1854 3.49131 19.1821 3.49443C17.5654 1.27666 14.9799 0.0390178 12.3118 0.00936427V0H7.91199V0.02185C10.9851 -0.184164 14.0582 1.23296 15.7656 3.92051L15.7721 3.90958L28.4451 24.987C30.0699 27.3093 32.7542 28.5985 35.5066 28.5985C36.9548 28.5985 38.4225 28.2426 39.7655 27.4919C40.961 26.8255 41.9168 25.9156 42.6231 24.8731H42.717L42.6846 24.9261C43.1366 24.2347 43.4833 23.4731 43.7068 22.6615C44.2916 20.5452 43.9871 18.3352 42.8369 16.4234L42.8402 16.4218Z",fill:"#F37880"}),(0,i.jsxs)("g",{opacity:"0.86",children:[(0,i.jsx)("path",{d:"M34.2332 8.78212L39.9031 18.0824C40.5868 19.2202 40.7698 20.5452 40.4183 21.8156C40.2044 22.5897 39.8059 23.2858 39.2616 23.8617C39.9744 23.2343 40.4879 22.4243 40.7423 21.5035C41.0938 20.2331 40.9107 18.908 40.2271 17.7703L34.5572 8.46998L34.5767 8.4575C34.413 8.19374 34.3142 7.89096 34.3142 7.56165C34.3142 7.15586 34.4584 6.78285 34.6982 6.48476C34.2672 6.80626 33.9902 7.30881 33.9902 7.87379C33.9902 8.2031 34.0891 8.50588 34.2527 8.76964L34.2332 8.78212Z",fill:"white"}),(0,i.jsx)("path",{d:"M42.6917 24.9169L42.6863 24.9256C42.6863 24.9256 42.6899 24.9187 42.6935 24.9152C42.6935 24.9152 42.6935 24.9152 42.6935 24.9169H42.6917Z",fill:"white"}),(0,i.jsx)("path",{d:"M40.0911 27.1798C38.7481 27.9289 37.2804 28.2863 35.8322 28.2863C33.0782 28.2863 30.3955 26.9988 28.7707 24.6749L16.0961 3.59744L16.0896 3.60837C14.9281 1.78077 13.1364 0.543128 11.1422 0H7.91199V0.02185C10.9851 -0.184164 14.0582 1.23296 15.7656 3.92051L15.7721 3.90958L28.4451 24.987C30.0699 27.3093 32.7542 28.5985 35.5066 28.5985C36.9548 28.5985 38.4225 28.2426 39.7655 27.4919C40.4815 27.0924 41.1084 26.6055 41.6511 26.0561C41.1862 26.479 40.6662 26.8583 40.0894 27.1798H40.0911Z",fill:"white"})]})]}),(0,i.jsxs)("defs",{children:[(0,i.jsxs)("linearGradient",{id:"paint0_linear_217_6990",x1:"24.6235",y1:"18.7363",x2:"42.3152",y2:"18.7363",gradientUnits:"userSpaceOnUse",children:[(0,i.jsx)("stop",{stopColor:"#4906A5"}),(0,i.jsx)("stop",{offset:"1",stopColor:"#D3423A"})]}),(0,i.jsxs)("linearGradient",{id:"paint1_linear_217_6990",x1:"-2.35794e-05",y1:"22.5009",x2:"42.7186",y2:"22.5009",gradientUnits:"userSpaceOnUse",children:[(0,i.jsx)("stop",{stopColor:"#7C06A5"}),(0,i.jsx)("stop",{offset:"1",stopColor:"#D3423A"})]}),(0,i.jsx)("clipPath",{id:"clip0_217_6990",children:(0,i.jsx)("rect",{width:"44",height:"45",fill:"white"})})]})]})," "]}),(0,i.jsx)("div",{className:`${S}-main`,children:(0,i.jsxs)("ul",{className:`${S}-menu`,children:[(0,i.jsx)("li",{className:(0,Me.default)(`${S}-menuitem`,`${S}-menuitem-active`),"data-icon":"demo",children:(0,i.jsx)("span",{className:`${S}-menuitem-label`,children:"DEMO"})}),(0,i.jsx)("li",{className:`${S}-menuitem`,"data-icon":"tables",children:(0,i.jsx)("span",{className:`${S}-menuitem-label`,children:"VUU TABLES"})}),(0,i.jsx)("li",{className:`${S}-menuitem`,"data-icon":"templates",children:(0,i.jsx)("span",{className:`${S}-menuitem-label`,children:"LAYOUT TEMPLATES"})}),(0,i.jsx)("li",{className:`${S}-menuitem`,"data-icon":"layouts",children:(0,i.jsx)("span",{className:`${S}-menuitem-label`,children:"MY LAYOUTS"})})]})}),(0,i.jsx)("div",{className:"vuuLeftNav-buttonBar",children:(0,i.jsx)("button",{className:(0,Me.default)("vuuLeftNav-toggleButton",{"vuuLeftNav-toggleButton-open":a.current,"vuuLeftNav-toggleButton-closed":!a.current}),"data-icon":a.current?"chevron-left":"chevron-right",onClick:l})})]})};var O=require("react/jsx-runtime"),Mt=({appHeader:e})=>(0,O.jsxs)(oe.Flexbox,{className:"App",style:{flexDirection:"row",height:"100%",width:"100%"},children:[(0,O.jsx)(Pt,{style:{width:240}}),(0,O.jsxs)(oe.Flexbox,{className:"vuuShell-content",style:{flexDirection:"column",flex:1,padding:8},children:[e,(0,O.jsx)(oe.DraggableLayout,{dropTarget:!0,style:{flex:1}},"main-content")]}),(0,O.jsx)(Dt,{id:"context-panel",overlay:!0,title:"Column Settings"})]});var T=require("@vuu-ui/vuu-layout"),z=require("react"),J=require("react/jsx-runtime"),Ht=({appHeader:e,leftSidePanel:t})=>{let o=(0,z.useRef)(null),[n,r]=(0,z.useState)(!0),a=(0,z.useCallback)(p=>{var c;let u=p.target;(c=o.current)!=null&&c.contains(u)||r(!n)},[n]),l=(0,z.useCallback)(p=>{let u=[];return u.push((0,J.jsx)(T.Drawer,{onClick:a,open:n,position:"left",inline:!0,peekaboo:!0,sizeOpen:200,toggleButton:"end",children:(0,J.jsx)(T.View,{className:"vuuShell-palette",id:"vw-app-palette",ref:o,style:{height:"100%"},children:p},"app-palette")},"left-panel")),u},[a,n]);return(0,J.jsxs)(T.Flexbox,{className:"App",style:{flexDirection:"column",height:"100%",width:"100%"},children:[e,(0,J.jsx)(T.DockLayout,{style:{flex:1},children:l(t).concat((0,J.jsx)(T.DraggableLayout,{dropTarget:!0,style:{width:"100%",height:"100%"}},"main-content"))})]})};var Rt=({leftSidePanelLayout:e="inlay",...t})=>(e==="inlay"?Ht:Mt)(t);var W=require("react/jsx-runtime"),{error:He}=(0,Ut.logger)("Shell"),lo={type:"View",props:{style:{height:"calc(100% - 6px)"}},children:[{props:{className:"vuuShell-warningPlaceholder"},type:"Placeholder"}]},uo=({children:e,className:t,defaultLayout:o=lo,leftSidePanel:n,leftSidePanelLayout:r,loginUrl:a,saveLocation:l="remote",saveUrl:p,serverUrl:u,user:c,...h})=>{let d=(0,R.useRef)(null),m=(0,R.useRef)("latest"),[v,g,C]=nt({defaultLayout:o,saveLocation:l,user:c}),ne=(0,R.useCallback)(F=>{try{g(F)}catch{He==null||He("Failed to save layout")}},[g]),ye=(0,R.useCallback)(F=>{d.current&&(d.current.dataset.mode=F)},[]),Ce=(0,R.useCallback)(F=>{m.current=F,C(F)},[C]);(0,R.useEffect)(()=>{u&&c.token&&(0,Ft.connectToServer)({authToken:c.token,url:u,username:c.username})},[u,c.token,c.username]);let[re,Q,ve]=De(),Le=(0,kt.default)("vuuShell",t,re,Q),xe=Rt({leftSidePanelLayout:r,appHeader:(0,W.jsx)(vt,{layoutId:m.current,loginUrl:a,user:c,onNavigate:Ce,onSwitchTheme:ye}),leftSidePanel:n});return(0,W.jsxs)(me,{children:[(0,W.jsx)(fe.LayoutProvider,{layout:v,onLayoutChange:ne,children:(0,W.jsx)(fe.DraggableLayout,{className:Le,"data-mode":ve,ref:d,...h,children:xe})}),e]})};var ge=require("react"),he=require("react/jsx-runtime"),co={},Re=(0,ge.createContext)(co),mo=({children:e,context:t,inheritedContext:o})=>{let n={...o,...t};return(0,he.jsx)(Re.Provider,{value:n,children:e})},po=({children:e,value:t})=>(0,he.jsx)(Re.Consumer,{children:o=>(0,he.jsx)(mo,{context:t,inheritedContext:o,children:e})}),fo=()=>(0,ge.useContext)(Re);
6
+ Wrap elements with a single container`),e)},ho=({applyThemeClasses:e=!1,children:t,theme:o,themeMode:n,density:r})=>{var i,g,f;let{density:a,themeMode:l,theme:u}=(0,we.useContext)(go),c=(i=r!=null?r:a)!=null?i:Ls,s=(g=n!=null?n:l)!=null?g:ws,d=(f=o!=null?o:u)!=null?f:Ds,m=e?ol(t,d,s,c):t;return(0,Is.jsx)(go.Provider,{value:{themeMode:s,density:c,theme:d},children:m})};ho.displayName="ThemeProvider";var se=require("react/jsx-runtime"),Ct="vuuLeftNav",nl=({"data-path":e,onResize:t,open:o=!0,sizeCollapsed:n=80,sizeContent:r=240,sizeExpanded:a=240,style:l,...u})=>{let c=(0,ot.useLayoutProviderDispatch)(),s=(0,Ve.useRef)(o),[d,m]=(0,Ve.useState)({activeTabIndex:0,navStatus:"menu-full"}),[i]=Ee(),g=(0,Ve.useCallback)((C,S)=>{switch(S){case 0:return C?[a,"menu-full"]:[n,"menu-icons"];default:return[n+r,"menu-content"]}},[n,r,a]),f=(0,Ve.useCallback)(C=>{let[S,T]=g(s.current,C);m({activeTabIndex:C,navStatus:T}),c({type:ot.Action.LAYOUT_RESIZE,path:e,size:S})},[c,g,e]),p=(0,Ve.useCallback)(()=>{s.current=!s.current,m(({activeTabIndex:C,navStatus:S})=>({activeTabIndex:C,navStatus:S==="menu-icons"?"menu-full":"menu-icons"})),c({type:ot.Action.LAYOUT_RESIZE,path:e,size:s.current?240:80})},[c,e]),h={...l,"--nav-menu-collapsed-width":`${n}px`,"--nav-menu-expanded-width":`${a}px`};return(0,se.jsxs)("div",{...u,className:(0,bo.default)(Ct,`${Ct}-${d.navStatus}`),style:h,children:[(0,se.jsxs)("div",{className:(0,bo.default)(`${Ct}-menu-primary`,i),"data-mode":"dark",children:[(0,se.jsx)("div",{className:"vuuLeftNav-logo",children:(0,se.jsx)(Lo,{})}),(0,se.jsx)("div",{className:`${Ct}-main`,children:(0,se.jsxs)(Br,{activeTabIndex:d.activeTabIndex,animateSelectionThumb:!1,className:`${Ct}-Tabstrip`,onActiveChange:f,orientation:"vertical",children:[(0,se.jsx)(Bt,{"data-icon":"demo",label:"DEMO"}),(0,se.jsx)(Bt,{"data-icon":"tables",label:"VUU TABLES"}),(0,se.jsx)(Bt,{"data-icon":"templates",label:"LAYOUT TEMPLATES"}),(0,se.jsx)(Bt,{"data-icon":"layouts",label:"MY LAYOUTS"})]})}),(0,se.jsx)("div",{className:"vuuLeftNav-buttonBar",children:(0,se.jsx)("button",{className:(0,bo.default)("vuuLeftNav-toggleButton",{"vuuLeftNav-toggleButton-open":s.current,"vuuLeftNav-toggleButton-closed":!s.current}),"data-icon":s.current?"chevron-left":"chevron-right",onClick:p})})]}),(0,se.jsxs)(ot.Stack,{active:d.activeTabIndex-1,className:`${Ct}-menu-secondary`,showTabs:!1,children:[(0,se.jsx)("div",{style:{background:"yellow",height:"100%"},children:"VUU Tables"}),(0,se.jsx)("div",{style:{background:"green",height:"100%"},children:"Layout Templates"}),(0,se.jsx)("div",{style:{background:"red",height:"100%"},children:"My Layouts"})]})]})};var Wo=require("react"),ve=require("@salt-ds/core");var Te=require("react/jsx-runtime"),Ns="vuuLoginPanel",rl=({requirePassword:e=!0,onSubmit:t})=>{let[o,n]=(0,Wo.useState)(""),[r,a]=(0,Wo.useState)(""),l=()=>{t(o,r)},u=d=>{n(d.target.value)},c=d=>{a(d.target.value)},s=o.trim()!==""&&(e===!1||r.trim()!=="");return(0,Te.jsxs)("div",{className:Ns,children:[(0,Te.jsxs)(ve.FormField,{style:{width:200},children:[(0,Te.jsx)(ve.FormFieldLabel,{children:"Username"}),(0,Te.jsx)(ve.Input,{value:o,id:"text-username",onChange:u})]}),e?(0,Te.jsxs)(ve.FormField,{style:{width:200},children:[(0,Te.jsx)(ve.FormFieldLabel,{children:"Password"}),(0,Te.jsx)(ve.Input,{inputProps:{type:"password"},value:r,id:"text-password",onChange:c})]}):null,(0,Te.jsx)(ve.Button,{className:`${Ns}-login`,disabled:!s,onClick:l,variant:"cta",children:"Login"})]})};var yo=require("@vuu-ui/vuu-utils"),Hs=()=>{let e=(0,yo.getCookieValue)("vuu-auth-mode");return e!=null?e:""},sl=()=>{let e=(0,yo.getCookieValue)("vuu-username"),t=(0,yo.getCookieValue)("vuu-auth-token");return[e,t]},al=()=>Hs()==="login"?"login.html":"demo.html",Ps=(e=al())=>{window.location.href=e},qo=e=>{document.cookie="vuu-username= ; expires = Thu, 01 Jan 1970 00:00:00 GMT",document.cookie="vuu-auth-token= ; expires = Thu, 01 Jan 1970 00:00:00 GMT",Ps(e)};var oe=require("react"),Go=V(require("classnames")),As=require("@salt-ds/core"),Zo=require("@salt-ds/core"),St=require("@vuu-ui/vuu-data"),nt=require("@vuu-ui/vuu-utils");var ge=require("react/jsx-runtime"),Ie="vuuSessionEditingForm",Rs=(e,t)=>{let o=e.find(n=>n.name===t);if(o)return o;throw Error(`SessionEditingForm, no field '${t}' found`)},ks=e=>{let{dataset:{field:t},value:o}=e.target;if(t===void 0)throw Error("SessionEditingForm, form field has no field name");return[t,o]},Ne={uninitialised:0,unchanged:1,changed:2,invalid:3};function Os(e,t,o=!1){switch(t){case"int":case"long":{let n=parseInt(e,10);if((0,nt.isValidNumber)(n))return n;if(o)throw Error("SessionEditingForm getTypedValue");return}case"double":{let n=parseFloat(e);return(0,nt.isValidNumber)(n)?n:void 0}case"boolean":return e==="true";default:return e}}var il=(e,t)=>{if(e)return e;if(t)return new St.RemoteDataSource({bufferSize:0,table:t.table,columns:t.columns.map(o=>o.name)});throw Error("SessionEditingForm: either a DataSource or a TableSchema must be provided")},ll=({className:e,config:{fields:t,key:o},dataSource:n,id:r,onClose:a,schema:l,...u})=>{let[c,s]=(0,oe.useState)(),[d,m]=(0,oe.useState)(""),i=(0,oe.useRef)(null),g=(0,oe.useRef)(),f=(0,oe.useRef)(Ne.uninitialised),p=(0,oe.useMemo)(()=>{let v=y=>{if(k){let L={};for(let I of p.columns)L[I]=y[k[I]];f.current===Ne.uninitialised&&(f.current=Ne.unchanged,g.current=L),s(L)}},D=il(n,l),k=(0,nt.buildColumnMap)(D.columns);return D.subscribe({range:{from:0,to:5}},y=>{y.type==="viewport-update"&&y.rows&&(f.current===Ne.uninitialised?v(y.rows[0]):console.log("what do we do with server updates"))}),D},[n,l]),h=(0,As.useIdMemo)(r),C=(0,oe.useCallback)(v=>{let[D,k]=ks(v),{type:y}=Rs(t,D),L=Os(k,y);s((I={})=>{let P={...I,[D]:L},N=(0,nt.shallowEquals)(P,g.current);return f.current=N?Ne.unchanged:L!==void 0?Ne.changed:Ne.invalid,P})},[t]),S=(0,oe.useCallback)(v=>{let[D,k]=ks(v),{type:y}=Rs(t,D),L=c==null?void 0:c[o],I=Os(k,y,!0);typeof L=="string"&&p.menuRpcCall({rowKey:L,field:D,value:I,type:"VP_EDIT_CELL_RPC"})},[p,t,o,c]),T=(0,oe.useCallback)(v=>{typeof v=="object"&&v!==null&&"type"in v&&v.type==="CLOSE_DIALOG_ACTION"&&a()},[a]),b=(0,oe.useCallback)(async()=>{let v=await p.menuRpcCall({type:"VP_EDIT_SUBMIT_FORM_RPC"});(0,St.isErrorResponse)(v)?m(v.error):(0,St.hasAction)(v)&&T(v.action)},[T,p]),w=(0,oe.useCallback)(v=>{v.key==="Enter"&&f.current===Ne.changed&&b()},[b]),M=(0,oe.useCallback)(()=>{a()},[a]),x=v=>{var k;let D=String((k=c==null?void 0:c[v.name])!=null?k:"");return v.readonly||v.name===o?(0,ge.jsx)("div",{className:`${Ie}-fieldValue vuuReadOnly`,children:D}):(0,ge.jsx)("input",{className:`${Ie}-fieldValue`,"data-field":v.name,onBlur:S,onChange:C,type:"text",value:D,id:`${h}-input-${v.name}`})};(0,oe.useEffect)(()=>{if(i.current){let v=i.current.querySelector("input");v&&setTimeout(()=>{v.focus(),v.select()},100)}},[]),(0,oe.useEffect)(()=>()=>{p&&p.unsubscribe()},[p]);let E=f.current===Ne.changed;return(0,ge.jsxs)("div",{...u,className:(0,Go.default)(Ie,e),children:[d?(0,ge.jsx)("div",{className:`${Ie}-errorBanner`,"data-icon":"error",title:d,children:"Error, edit(s) not saved"}):void 0,(0,ge.jsx)("div",{className:`${Ie}-content`,ref:i,onKeyDown:w,children:t.map(v=>{var D;return(0,ge.jsxs)("div",{className:`${Ie}-field`,children:[(0,ge.jsx)("label",{className:(0,Go.default)(`${Ie}-fieldLabel`,{[`${Ie}-required`]:v.required}),htmlFor:`${h}-input-${v.name}`,children:(D=v==null?void 0:v.label)!=null?D:v.description}),x(v)]},v.name)})}),(0,ge.jsxs)("div",{className:`${Ie}-buttonbar salt-theme salt-density-high`,children:[(0,ge.jsx)(Zo.Button,{type:"submit",variant:"cta",disabled:!E,onClick:b,children:"Submit"}),(0,ge.jsx)(Zo.Button,{variant:"secondary",onClick:M,children:"Cancel"})]})]})};var ia=require("@vuu-ui/vuu-data"),la=V(require("classnames")),Re=require("react");var Ue=require("react");var $s=(e,t,o="latest")=>new Promise((n,r)=>{console.log(`load local config at ${e} for user ${t.username}, id ${o}`);let a=localStorage.getItem(e);if(a){let l=JSON.parse(a);n(l)}else r()}),Fs=(e,t,o)=>new Promise((n,r)=>{try{localStorage.setItem(e,JSON.stringify(o)),n(void 0)}catch{r()}});var Ks=(e,t,o="latest")=>new Promise((n,r)=>{fetch(`${e}/${t.username}/${o}`,{}).then(a=>{a.ok?n(a.json()):r(void 0)}).catch(()=>{r(void 0)})}),Bs=(e,t,o)=>new Promise((n,r)=>{fetch(`${e}/${t.username}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)}).then(a=>{a.ok?n(void 0):r()})});var Vs=({saveLocation:e,saveUrl:t="api/vui",user:o,defaultLayout:n})=>{let[r,a]=(0,Ue.useState)(n),l=e==="remote",u=l?Ks:$s,c=l?Bs:Fs,s=(0,Ue.useCallback)(async(i="latest")=>{try{let g=await u(t,o,i);a(g)}catch{a(n)}},[n,u,t,o]);(0,Ue.useEffect)(()=>{s()},[s]);let d=(0,Ue.useCallback)(i=>{c(t,o,i)},[c,t,o]),m=(0,Ue.useCallback)(i=>s(i),[s]);return[r,d,m]};var To=require("@vuu-ui/vuu-layout");var Qs=require("react");var Gs=require("@salt-ds/core"),Zs=require("@salt-ds/lab"),Js=require("@salt-ds/icons");var zs=require("@vuu-ui/vuu-utils"),vo=require("@salt-ds/lab"),_s=require("@salt-ds/core"),Ws=require("@salt-ds/icons"),He=require("react");var Us=async e=>await fetch(`api/vui/${e.username}`,{}).then(o=>o.ok?o.json():null).catch(()=>{console.log("error getting history")});var ze=require("react/jsx-runtime"),cl=({lastUpdate:e},{lastUpdate:t})=>t===e?0:t<e?-1:1,ul=e=>(0,ze.jsx)(vo.ListItem,{...e}),qs=(0,He.forwardRef)(function({loginUrl:t,onNavigate:o,user:n,layoutId:r="latest"},a){let[l,u]=(0,He.useState)([]);(0,He.useEffect)(()=>{async function m(){let g=(await Us(n)).filter(f=>f.id!=="latest").sort(cl).map(({id:f,lastUpdate:p})=>({lastUpdate:p,id:f,label:`Saved at ${(0,zs.formatDate)(new Date(p),"kk:mm:ss")}`}));console.log({sortedHistory:g}),u(g)}m()},[n]);let c=(0,He.useCallback)((m,i)=>{i&&o(i.id)},[o]),s=(0,He.useCallback)(()=>{qo(t)},[t]),d=l.length===0?null:r==="latest"?l[0]:l.find(m=>m.id===r);return(0,ze.jsxs)("div",{className:"vuuUserPanel",ref:a,children:[(0,ze.jsx)(vo.List,{ListItem:ul,className:"vuuUserPanel-history",onSelect:c,selected:d,source:l}),(0,ze.jsx)("div",{className:"vuuUserPanel-buttonBar",children:(0,ze.jsxs)(_s.Button,{"aria-label":"logout",onClick:s,children:[(0,ze.jsx)(Ws.ExportIcon,{})," Logout"]})})]})});var Lt=require("react/jsx-runtime"),Xs=({layoutId:e,loginUrl:t,onNavigate:o,user:n})=>(0,Lt.jsxs)(Zs.DropdownBase,{className:"vuuUserProfile",placement:"bottom-end",children:[(0,Lt.jsx)(Gs.Button,{variant:"secondary",children:(0,Lt.jsx)(Js.UserSolidIcon,{})}),(0,Lt.jsx)(qs,{layoutId:e,loginUrl:t,onNavigate:a=>{o(a)},user:n})]});var Ys=V(require("classnames")),rt=require("@salt-ds/core"),js=require("react");var Ut=require("react/jsx-runtime"),dl="vuuThemeSwitch",Jo=({className:e,defaultMode:t,mode:o,onChange:n,...r})=>{let[a,l]=(0,rt.useControlled)({controlled:o,default:t!=null?t:"light",name:"ThemeSwitch",state:"mode"}),u=(0,js.useCallback)(s=>{let{value:d}=s.target;l(d),n(d)},[n,l]),c=(0,Ys.default)(dl,e);return(0,Ut.jsxs)(rt.ToggleButtonGroup,{className:c,...r,onChange:u,value:a,children:[(0,Ut.jsx)(rt.ToggleButton,{"aria-label":"alert","data-icon":"light",value:"dark"}),(0,Ut.jsx)(rt.ToggleButton,{"aria-label":"home","data-icon":"dark",value:"light"})]})};var ea=V(require("classnames"));var zt=require("react/jsx-runtime"),ml="vuuAppHeader",ta=({className:e,layoutId:t,loginUrl:o,onNavigate:n,onSwitchTheme:r,themeMode:a="light",user:l,...u})=>{let c=(0,ea.default)(ml,e),s=(0,Qs.useCallback)(d=>r==null?void 0:r(d),[r]);return(0,zt.jsxs)("header",{className:c,...u,children:[(0,zt.jsx)(Jo,{defaultMode:a,onChange:s}),(0,zt.jsx)(Xs,{layoutId:t,loginUrl:o,onNavigate:n,user:l})]})};var ca=require("@vuu-ui/vuu-utils");var oa=require("@salt-ds/core"),Xo=V(require("classnames")),na=require("react"),ra=require("@vuu-ui/vuu-layout");var st=require("react/jsx-runtime"),Pe="vuuContextPanel",Yo=({className:e,expanded:t=!1,overlay:o=!1,title:n})=>{let r=(0,ra.useLayoutProviderDispatch)(),a=(0,na.useCallback)(()=>{r({path:"#context-panel",propName:"expanded",propValue:!1,type:"set-prop"})},[r]),l=(0,Xo.default)(Pe,e,{[`${Pe}-expanded`]:t,[`${Pe}-inline`]:o!==!0,[`${Pe}-overlay`]:o});return(0,st.jsx)("div",{className:(0,Xo.default)(Pe,l),children:(0,st.jsx)("div",{className:`${Pe}-inner`,children:(0,st.jsxs)("div",{className:`${Pe}-header`,children:[(0,st.jsx)("h2",{className:`${Pe}-title`,children:n}),(0,st.jsx)(oa.Button,{className:`${Pe}-close`,"data-icon":"close",onClick:a,variant:"secondary"})]})})})};var _t=require("@vuu-ui/vuu-layout");var Dt=require("react/jsx-runtime"),sa=({appHeader:e,leftSidePanel:t})=>(0,Dt.jsxs)(_t.Flexbox,{className:"App",style:{flexDirection:"row",height:"100%",width:"100%"},children:[t,(0,Dt.jsxs)(_t.Flexbox,{className:"vuuShell-content",style:{flex:1,flexDirection:"column"},children:[e,(0,Dt.jsx)(_t.DraggableLayout,{dropTarget:!0,style:{flex:1}},"main-content")]}),(0,Dt.jsx)(Yo,{id:"context-panel",overlay:!0,title:"Column Settings"})]});var xe=require("@vuu-ui/vuu-layout"),it=require("react"),at=require("react/jsx-runtime"),aa=({appHeader:e,leftSidePanel:t})=>{let o=(0,it.useRef)(null),[n,r]=(0,it.useState)(!0),a=(0,it.useCallback)(u=>{var s;let c=u.target;(s=o.current)!=null&&s.contains(c)||r(!n)},[n]),l=(0,it.useCallback)(u=>{let c=[];return c.push((0,at.jsx)(xe.Drawer,{onClick:a,open:n,position:"left",inline:!0,peekaboo:!0,sizeOpen:200,toggleButton:"end",children:(0,at.jsx)(xe.View,{className:"vuuShell-palette",id:"vw-app-palette",ref:o,style:{height:"100%"},children:u},"app-palette")},"left-panel")),c},[a,n]);return(0,at.jsxs)(xe.Flexbox,{className:"App",style:{flexDirection:"column",height:"100%",width:"100%"},children:[e,(0,at.jsx)(xe.DockLayout,{style:{flex:1},children:l(t).concat((0,at.jsx)(xe.DraggableLayout,{dropTarget:!0,style:{width:"100%",height:"100%"}},"main-content"))})]})};var jo=({leftSidePanelLayout:e="inlay",...t})=>(e==="inlay"?aa:sa)(t);var wt=require("react/jsx-runtime"),{error:Qo}=(0,ca.logger)("Shell"),pl={type:"View",props:{style:{height:"calc(100% - 6px)"}},children:[{props:{className:"vuuShell-warningPlaceholder"},type:"Placeholder"}]},fl=({children:e,className:t,defaultLayout:o=pl,leftSidePanel:n,leftSidePanelLayout:r,loginUrl:a,saveLocation:l="remote",saveUrl:u,serverUrl:c,user:s,...d})=>{let m=(0,Re.useRef)(null),i=(0,Re.useRef)("latest"),[g,f,p]=Vs({defaultLayout:o,saveLocation:l,user:s}),h=(0,Re.useCallback)(E=>{try{f(E)}catch{Qo==null||Qo("Failed to save layout")}},[f]),C=(0,Re.useCallback)(E=>{m.current&&(m.current.dataset.mode=E)},[]),S=(0,Re.useCallback)(E=>{i.current=E,p(E)},[p]);(0,Re.useEffect)(()=>{c&&s.token&&(0,ia.connectToServer)({authToken:s.token,url:c,username:s.username})},[c,s.token,s.username]);let[T,b,w]=Ee(),M=(0,la.default)("vuuShell",t,T,b),x=jo({leftSidePanelLayout:r,appHeader:(0,wt.jsx)(ta,{layoutId:i.current,loginUrl:a,user:s,onNavigate:S,onSwitchTheme:C}),leftSidePanel:n});return(0,wt.jsxs)(ho,{children:[(0,wt.jsx)(To.LayoutProvider,{layout:g,onLayoutChange:h,children:(0,wt.jsx)(To.DraggableLayout,{className:M,"data-mode":w,ref:m,...d,children:x})}),e]})};var Mo=require("react"),xo=require("react/jsx-runtime"),gl={},en=(0,Mo.createContext)(gl),hl=({children:e,context:t,inheritedContext:o})=>{let n={...o,...t};return(0,xo.jsx)(en.Provider,{value:n,children:e})},bl=({children:e,value:t})=>(0,xo.jsx)(en.Consumer,{children:o=>(0,xo.jsx)(hl,{context:t,inheritedContext:o,children:e})}),yl=()=>(0,Mo.useContext)(en);
4
7
  //# sourceMappingURL=index.js.map