@vuu-ui/vuu-shell 0.8.26 → 0.8.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/index.js +2 -2
- package/cjs/index.js.map +3 -3
- package/esm/index.js +2 -2
- package/esm/index.js.map +3 -3
- package/package.json +9 -9
package/cjs/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";var ia=Object.create;var _e=Object.defineProperty;var sa=Object.getOwnPropertyDescriptor;var ua=Object.getOwnPropertyNames;var la=Object.getPrototypeOf,ca=Object.prototype.hasOwnProperty;var da=(e,t)=>{for(var o in t)_e(e,o,{get:t[o],enumerable:!0})},Ot=(e,t,o,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of ua(t))!ca.call(e,n)&&n!==o&&_e(e,n,{get:()=>t[n],enumerable:!(a=sa(t,n))||a.enumerable});return e};var M=(e,t,o)=>(o=e!=null?ia(la(e)):{},Ot(t||!e||!e.__esModule?_e(o,"default",{value:e,enumerable:!0}):o,e)),pa=e=>Ot(_e({},"__esModule",{value:!0}),e);var zt=(e,t,o)=>{if(!t.has(e))throw TypeError("Cannot "+o)};var ft=(e,t,o)=>(zt(e,t,"read from private field"),o?o.call(e):t.get(e)),Ut=(e,t,o)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,o)},Zt=(e,t,o,a)=>(zt(e,t,"write to private field"),a?a.call(e,o):t.set(e,o),o);var En={};da(En,{AppHeader:()=>yt,ConnectionStatusIcon:()=>fa,ContextPanel:()=>Ht,Feature:()=>Re,FeatureList:()=>lt,LayoutList:()=>Dt,LayoutManagementContext:()=>Et,LayoutManagementProvider:()=>pn,LeftNav:()=>hn,LoginPanel:()=>ma,SaveLayoutPanel:()=>Pt,SessionEditingForm:()=>gn,Shell:()=>xn,ShellContextProvider:()=>Sn,SidePanel:()=>At,ThemeSwitch:()=>Mn,getAuthDetailsFromCookies:()=>Ve,getAuthModeFromCookies:()=>Wt,isTableSchema:()=>Cn,isWildcardSchema:()=>bn,logout:()=>vt,redirectToLogin:()=>Gt,useLayoutManager:()=>de,useShellContext:()=>Pn,useShellLayout:()=>Rt});module.exports=pa(En);var Qt=require("react"),Xt=require("@vuu-ui/vuu-ui-controls"),Kt=M(require("clsx"));var W=require("react"),ee=require("@salt-ds/core"),gt=require("@vuu-ui/vuu-ui-controls");var qt=require("react"),x=require("react/jsx-runtime"),Jt=()=>(0,qt.useMemo)(()=>(0,x.jsxs)("svg",{width:"184",height:"90",viewBox:"0 0 184 90",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,x.jsxs)("g",{clipPath:"url(#clip0_1173_59965)",children:[(0,x.jsx)("path",{d:"M77.0775 31.1019L69.4572 15.1795L66.3997 13.7093L47.6353 44.165L75.7224 61.2361L81.8124 51.2694L77.0775 31.1019Z",fill:"url(#paint0_linear_1173_59965)"}),(0,x.jsx)("path",{d:"M82.4101 49.7431C81.0488 51.8314 79.1993 53.648 76.8897 54.9809C74.2954 56.4792 71.4601 57.194 68.6623 57.194C63.3422 57.194 58.1597 54.6188 55.0209 49.971L30.5358 7.8193L30.5232 7.84116C25.8791 0.274825 16.0118 -2.26289 8.27258 2.21011C0.411306 6.74866 -2.26753 16.7872 2.28587 24.625L35.5054 81.8189C36.9856 84.3691 39.0542 86.3668 41.4358 87.7527C41.4545 87.7652 41.4733 87.7777 41.4921 87.7902C41.5015 87.7964 41.514 87.8027 41.5234 87.8089C42.6312 88.4457 43.8079 88.942 45.0253 89.3072C45.116 89.3353 45.2099 89.3634 45.3007 89.3883C45.7388 89.5101 46.1801 89.6193 46.6276 89.7067C46.7121 89.7223 46.7966 89.7317 46.8811 89.7473C47.241 89.8097 47.604 89.8628 47.967 89.9003C48.111 89.9159 48.2549 89.9315 48.3989 89.9408C48.8151 89.9752 49.2313 89.997 49.6507 90.0001C49.6726 90.0001 49.6945 90.0001 49.7132 90.0001C49.7195 90.0001 49.7226 90.0001 49.7289 90.0001C49.7352 90.0001 49.7383 90.0001 49.7445 90.0001C50.1983 90.0001 50.6552 89.9752 51.109 89.9377C51.2123 89.9283 51.3155 89.919 51.422 89.9065C51.8663 89.8597 52.3107 89.8004 52.7551 89.7192C52.7614 89.7192 52.7676 89.7192 52.7739 89.7192C53.2621 89.6287 53.7503 89.5101 54.2322 89.3727C54.2635 89.3634 54.2917 89.354 54.323 89.3446C55.024 89.1418 55.7156 88.8889 56.3978 88.5861C56.4104 88.5799 56.426 88.5736 56.4385 88.5674C56.958 88.3364 57.4712 88.0836 57.9751 87.7933C58.4852 87.4999 58.9703 87.1815 59.4334 86.8413C59.8371 86.5478 60.2252 86.2357 60.6039 85.9048C61.0639 85.499 61.4989 85.0745 61.9026 84.6282C62.2062 84.2942 62.4972 83.9446 62.7757 83.5825C62.8665 83.4639 62.951 83.3421 63.0355 83.2235C63.2264 82.9613 63.4079 82.6929 63.5831 82.4182C63.6739 82.2746 63.7646 82.1342 63.8523 81.9906C63.8867 81.9344 63.9242 81.8813 63.9555 81.8251L82.5854 49.7525H82.4039L82.4101 49.7431Z",fill:"url(#paint1_linear_1173_59965)"}),(0,x.jsx)("path",{d:"M82.8264 32.8436L81.4181 30.4464L75.3375 19.1687L72.5178 14.3929C71.9858 13.1225 70.7309 12.2266 69.26 12.2266C67.3104 12.2266 65.7331 13.8029 65.7331 15.7445C65.7331 16.4031 65.924 17.0086 66.2401 17.5362L66.2025 17.5611L77.1557 36.1617C78.4764 38.4372 78.83 41.0873 78.1509 43.6281C77.4718 46.169 75.8445 48.2915 73.5631 49.6119C72.0609 50.4797 70.3553 50.9385 68.6341 50.9385C65.1166 50.9385 61.84 49.0563 60.0812 46.0285L44.3368 19.2654H44.3681L37.7179 7.81917L37.7054 7.84102C37.5896 7.65061 37.455 7.47893 37.333 7.29477L37.1452 6.97326C37.1452 6.97326 37.1296 6.98262 37.1233 6.98887C34.0001 2.55332 29.0054 0.0780356 23.8512 0.0187285V0H15.3515V0.0436999C21.2881 -0.368328 27.2247 2.46593 30.5232 7.84102L30.5357 7.81917L55.0177 49.974C58.1566 54.6187 63.3422 57.197 68.6592 57.197C71.4569 57.197 74.2922 56.4853 76.8866 54.9839C79.1961 53.651 81.0425 51.8312 82.407 49.7461H82.5885L82.5259 49.8523C83.399 48.4695 84.0687 46.9462 84.5006 45.3231C85.6304 41.0904 85.042 36.6705 82.8201 32.8467L82.8264 32.8436Z",fill:"#F37880"}),(0,x.jsxs)("g",{opacity:"0.86",children:[(0,x.jsx)("path",{d:"M66.1994 17.5642L77.1526 36.1648C78.4732 38.4403 78.8269 41.0904 78.1478 43.6313C77.7347 45.1795 76.9648 46.5716 75.9133 47.7234C77.2903 46.4686 78.2823 44.8486 78.7737 43.007C79.4527 40.4661 79.0991 37.816 77.7785 35.5405L66.8253 16.94L66.8628 16.915C66.5467 16.3875 66.3558 15.7819 66.3558 15.1233C66.3558 14.3117 66.6344 13.5657 67.0975 12.9695C66.2651 13.6125 65.7299 14.6176 65.7299 15.7476C65.7299 16.4062 65.9208 17.0118 66.2369 17.5393L66.1994 17.5642Z",fill:"white"}),(0,x.jsx)("path",{d:"M82.5382 49.8335L82.5291 49.8487C82.5291 49.8487 82.5352 49.8365 82.5413 49.8304C82.5413 49.8304 82.5413 49.8304 82.5413 49.8335H82.5382Z",fill:"white"}),(0,x.jsx)("path",{d:"M77.5156 54.3596C74.9213 55.8579 72.0859 56.5727 69.2882 56.5727C63.9681 56.5727 58.7856 53.9975 55.6467 49.3497L31.1616 7.19488L31.1491 7.21673C28.9053 3.56154 25.4441 1.08626 21.5917 0H15.3515V0.0436999C21.2881 -0.368328 27.2247 2.46593 30.5232 7.84102L30.5357 7.81917L55.0177 49.974C58.1566 54.6187 63.3422 57.197 68.6592 57.197C71.4569 57.197 74.2922 56.4853 76.8866 54.9839C78.2698 54.1848 79.4809 53.2109 80.5293 52.1122C79.6311 52.9581 78.6266 53.7166 77.5125 54.3596H77.5156Z",fill:"white"})]})]}),(0,x.jsx)("path",{d:"M117.046 58.661C116.362 58.661 115.792 58.509 115.336 58.205C114.906 57.8757 114.551 57.3943 114.272 56.761L104.354 34.493C104.076 33.8597 104 33.3023 104.126 32.821C104.253 32.3397 104.519 31.9597 104.924 31.681C105.33 31.4023 105.811 31.263 106.368 31.263C107.103 31.263 107.648 31.4277 108.002 31.757C108.382 32.061 108.699 32.5297 108.952 33.163L117.958 54.025H116.324L125.292 33.125C125.571 32.517 125.9 32.061 126.28 31.757C126.66 31.4277 127.192 31.263 127.876 31.263C128.434 31.263 128.89 31.4023 129.244 31.681C129.624 31.9597 129.865 32.3397 129.966 32.821C130.068 33.3023 129.979 33.8597 129.7 34.493L119.782 56.761C119.504 57.3943 119.149 57.8757 118.718 58.205C118.313 58.509 117.756 58.661 117.046 58.661Z",fill:"white"}),(0,x.jsx)("path",{d:"M144.63 58.737C142.781 58.737 141.147 58.4963 139.728 58.015C138.335 57.5337 137.157 56.8243 136.194 55.887C135.232 54.9243 134.51 53.7337 134.028 52.315C133.547 50.8963 133.306 49.2497 133.306 47.375V33.733C133.306 32.897 133.509 32.2763 133.914 31.871C134.345 31.4657 134.953 31.263 135.738 31.263C136.524 31.263 137.119 31.4657 137.524 31.871C137.955 32.2763 138.17 32.897 138.17 33.733V47.337C138.17 49.7437 138.715 51.555 139.804 52.771C140.919 53.9617 142.528 54.557 144.63 54.557C146.733 54.557 148.329 53.9617 149.418 52.771C150.508 51.555 151.052 49.7437 151.052 47.337V33.733C151.052 32.897 151.255 32.2763 151.66 31.871C152.091 31.4657 152.699 31.263 153.484 31.263C154.244 31.263 154.827 31.4657 155.232 31.871C155.663 32.2763 155.878 32.897 155.878 33.733V47.375C155.878 49.8577 155.448 51.9477 154.586 53.645C153.75 55.3423 152.496 56.6217 150.824 57.483C149.152 58.319 147.088 58.737 144.63 58.737Z",fill:"white"}),(0,x.jsx)("path",{d:"M172.685 58.737C170.836 58.737 169.202 58.4963 167.783 58.015C166.39 57.5337 165.212 56.8243 164.249 55.887C163.286 54.9243 162.564 53.7337 162.083 52.315C161.602 50.8963 161.361 49.2497 161.361 47.375V33.733C161.361 32.897 161.564 32.2763 161.969 31.871C162.4 31.4657 163.008 31.263 163.793 31.263C164.578 31.263 165.174 31.4657 165.579 31.871C166.01 32.2763 166.225 32.897 166.225 33.733V47.337C166.225 49.7437 166.77 51.555 167.859 52.771C168.974 53.9617 170.582 54.557 172.685 54.557C174.788 54.557 176.384 53.9617 177.473 52.771C178.562 51.555 179.107 49.7437 179.107 47.337V33.733C179.107 32.897 179.31 32.2763 179.715 31.871C180.146 31.4657 180.754 31.263 181.539 31.263C182.299 31.263 182.882 31.4657 183.287 31.871C183.718 32.2763 183.933 32.897 183.933 33.733V47.375C183.933 49.8577 183.502 51.9477 182.641 53.645C181.805 55.3423 180.551 56.6217 178.879 57.483C177.207 58.319 175.142 58.737 172.685 58.737Z",fill:"white"}),(0,x.jsxs)("defs",{children:[(0,x.jsxs)("linearGradient",{id:"paint0_linear_1173_59965",x1:"47.6353",y1:"37.4727",x2:"81.8124",y2:"37.4727",gradientUnits:"userSpaceOnUse",children:[(0,x.jsx)("stop",{stopColor:"#4906A5"}),(0,x.jsx)("stop",{offset:"1",stopColor:"#D3423A"})]}),(0,x.jsxs)("linearGradient",{id:"paint1_linear_1173_59965",x1:"0.0670626",y1:"45.0017",x2:"82.5916",y2:"45.0017",gradientUnits:"userSpaceOnUse",children:[(0,x.jsx)("stop",{stopColor:"#7C06A5"}),(0,x.jsx)("stop",{offset:"1",stopColor:"#D3423A"})]}),(0,x.jsx)("clipPath",{id:"clip0_1173_59965",children:(0,x.jsx)("rect",{width:"85",height:"90",fill:"white",transform:"translate(0.0670471)"})})]})]}),[]);var _t=M(require("clsx"));var D=require("react/jsx-runtime"),re="vuuLoginPanel",ma=({appName:e="Demo App",className:t,requirePassword:o=!0,onSubmit:a,...n})=>{let[r,i]=(0,W.useState)(""),[s,u]=(0,W.useState)(""),c=(0,W.useRef)(null),d=()=>{a(r,s)},h=f=>{i(f.target.value)},b=f=>{u(f.target.value)},y=(0,W.useCallback)(()=>{o||a(r)},[a,o,r]),p=(0,W.useCallback)(()=>{r&&a(r,s)},[a,s,r]),l=r.trim()!==""&&(o===!1||s.trim()!=="");return(0,W.useEffect)(()=>{var f;console.log("inputRef",{input:c.current}),(f=c.current)==null||f.focus()},[]),(0,D.jsxs)("div",{...n,className:(0,_t.default)(re,t),children:[(0,D.jsxs)("div",{className:`${re}-branding`,children:[(0,D.jsx)(Jt,{}),(0,D.jsx)("div",{className:`${re}-appName`,children:e})]}),(0,D.jsxs)("div",{className:`${re}-form`,children:[(0,D.jsx)("div",{className:`${re}-title`,children:"Welcome Back"}),(0,D.jsxs)(ee.FormField,{children:[(0,D.jsx)(ee.FormFieldLabel,{children:"Username"}),(0,D.jsx)(gt.VuuInput,{value:r,id:"text-username",inputRef:c,onChange:h,onCommit:y})]}),o?(0,D.jsxs)(ee.FormField,{children:[(0,D.jsx)(ee.FormFieldLabel,{children:"Password"}),(0,D.jsx)(gt.VuuInput,{className:`${re}-password`,inputProps:{type:"password"},value:s,id:"text-password",onChange:b,onCommit:p,endAdornment:(0,D.jsx)("span",{"data-icon":"eye",style:{cursor:"pointer"}})})]}):null,(0,D.jsx)(ee.Button,{className:`${re}-login`,disabled:!l,onClick:d,variant:"cta",children:"Login"})]})]})};var We=require("@vuu-ui/vuu-utils"),Wt=()=>{let e=(0,We.getCookieValue)("vuu-auth-mode");return e!=null?e:""},Ve=()=>{let e=(0,We.getCookieValue)("vuu-username"),t=(0,We.getCookieValue)("vuu-auth-token");return[e,t]},ha=()=>Wt()==="login"?"login.html":"demo.html",Gt=(e=ha())=>{window.location.href=e},vt=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",Gt(e)};var He=require("@salt-ds/core");var Q=require("react/jsx-runtime"),Fe="vuuAppHeader",yt=({className:e,layoutId:t,loginUrl:o,onNavigate:a,onSwitchTheme:n,themeMode:r,user:i,...s})=>{let u=(0,Kt.default)(Fe,e),c=(0,Qt.useCallback)(()=>{vt(o)},[o]);return(0,Q.jsxs)(Xt.Toolbar,{alignItems:"end",className:u,showSeparators:!0,...s,children:[(0,Q.jsx)(He.Button,{className:`${Fe}-menuItem`,variant:"secondary",children:"Help"}),(0,Q.jsxs)(He.Button,{className:`${Fe}-menuItem`,variant:"secondary",children:["History ",(0,Q.jsx)("span",{"data-icon":"history"})]}),(0,Q.jsxs)(He.Button,{className:`${Fe}-menuItem`,variant:"secondary",children:["View ",(0,Q.jsx)("span",{"data-icon":"settings"})]}),(0,Q.jsx)(He.Button,{className:`${Fe}-menuItem`,onClick:c,variant:"secondary",children:"Log out"})]})};var xe=M(require("react")),Yt=M(require("clsx"));var ie=require("react/jsx-runtime"),fa=({connectionStatus:e,className:t,element:o="span",...a})=>{let[n,r]=(0,xe.useState)("vuuConnectingStatus");(0,xe.useEffect)(()=>{switch(e){case"connected":case"reconnected":r("vuuActiveStatus");break;case"connecting":r("vuuConnectingStatus");break;case"disconnected":r("vuuDisconnectedStatus");break;default:break}},[e]);let i=xe.default.createElement(o,{...a,className:(0,Yt.default)("vuuStatus vuuIcon",n,t)});return(0,ie.jsx)(ie.Fragment,{children:(0,ie.jsxs)("div",{className:"vuuStatus-container salt-theme",children:[i,(0,ie.jsxs)("div",{className:"vuuStatus-text",children:["Status: ",e.toUpperCase()]})]})})};var ue=M(require("react")),ao=require("@vuu-ui/vuu-layout");var jt=M(require("react")),se=require("react/jsx-runtime"),Ge=class extends jt.default.Component{constructor(t){super(t),this.state={errorMessage:null}}static getDerivedStateFromError(t){return{errorMessage:t.message}}componentDidCatch(t,o){console.log(`error creating component at ${this.props.url}`),console.log(t,o)}render(){return this.state.errorMessage?(0,se.jsxs)(se.Fragment,{children:[(0,se.jsx)("h1",{children:"An error occured while creating component."}),(0,se.jsx)("p",{children:this.state.errorMessage})]}):this.props.children}};var to=require("react/jsx-runtime"),eo=()=>(0,to.jsx)("div",{className:"hwLoader"});var oo=async e=>{let t=new CSSStyleSheet;return fetch(e).then(o=>o.text()).then(o=>t.replace(o))};var Ae=require("react/jsx-runtime"),Qe=new Map,ga=e=>{(0,ue.useEffect)(()=>()=>{Qe.delete(e)},[e]),Qe.has(e)||Qe.set(e,ue.default.lazy(()=>import(e)));let t=Qe.get(e);if(t)return t;throw Error(`Unable to load Lazy Feature at url ${e}`)};function va({url:e,css:t,ComponentProps:o,...a}){t&&oo(t).then(r=>{document.adoptedStyleSheets=[...document.adoptedStyleSheets,r]});let n=ga(e);return(0,Ae.jsx)(Ge,{url:e,children:(0,Ae.jsx)(ue.Suspense,{fallback:(0,Ae.jsx)(eo,{}),children:(0,Ae.jsx)(n,{...a,...o})})})}var Re=ue.default.memo(va);Re.displayName="Feature";(0,ao.registerComponent)("Feature",Re,"view");var Le=require("@vuu-ui/vuu-ui-controls");function no(e,t){if(e.match(/^[a-z]+:\/\//i))return e;if(e.match(/^\/\//))return window.location.protocol+e;if(e.match(/^[a-z]+:/i))return e;let o=document.implementation.createHTMLDocument(),a=o.createElement("base"),n=o.createElement("a");return o.head.appendChild(a),o.body.appendChild(n),t&&(a.href=t),n.href=e,n.href}var ro=(()=>{let e=0,t=()=>`0000${(Math.random()*36**4<<0).toString(36)}`.slice(-4);return()=>(e+=1,`u${t()}${e}`)})();function A(e){let t=[];for(let o=0,a=e.length;o<a;o++)t.push(e[o]);return t}function Xe(e,t){let a=(e.ownerDocument.defaultView||window).getComputedStyle(e).getPropertyValue(t);return a?parseFloat(a.replace("px","")):0}function ya(e){let t=Xe(e,"border-left-width"),o=Xe(e,"border-right-width");return e.clientWidth+t+o}function xa(e){let t=Xe(e,"border-top-width"),o=Xe(e,"border-bottom-width");return e.clientHeight+t+o}function xt(e,t={}){let o=t.width||ya(e),a=t.height||xa(e);return{width:o,height:a}}function io(){let e,t;try{t=process}catch{}let o=t&&t.env?t.env.devicePixelRatio:null;return o&&(e=parseInt(o,10),Number.isNaN(e)&&(e=1)),e||window.devicePixelRatio||1}var H=16384;function so(e){(e.width>H||e.height>H)&&(e.width>H&&e.height>H?e.width>e.height?(e.height*=H/e.width,e.width=H):(e.width*=H/e.height,e.height=H):e.width>H?(e.height*=H/e.width,e.width=H):(e.width*=H/e.height,e.height=H))}function be(e){return new Promise((t,o)=>{let a=new Image;a.decode=()=>t(a),a.onload=()=>t(a),a.onerror=o,a.crossOrigin="anonymous",a.decoding="async",a.src=e})}async function ba(e){return Promise.resolve().then(()=>new XMLSerializer().serializeToString(e)).then(encodeURIComponent).then(t=>`data:image/svg+xml;charset=utf-8,${t}`)}async function uo(e,t,o){let a="http://www.w3.org/2000/svg",n=document.createElementNS(a,"svg"),r=document.createElementNS(a,"foreignObject");return n.setAttribute("width",`${t}`),n.setAttribute("height",`${o}`),n.setAttribute("viewBox",`0 0 ${t} ${o}`),r.setAttribute("width","100%"),r.setAttribute("height","100%"),r.setAttribute("x","0"),r.setAttribute("y","0"),r.setAttribute("externalResourcesRequired","true"),n.appendChild(r),r.appendChild(e),ba(n)}var k=(e,t)=>{if(e instanceof t)return!0;let o=Object.getPrototypeOf(e);return o===null?!1:o.constructor.name===t.name||k(o,t)};function Ca(e){let t=e.getPropertyValue("content");return`${e.cssText} content: '${t.replace(/'|"/g,"")}';`}function wa(e){return A(e).map(t=>{let o=e.getPropertyValue(t),a=e.getPropertyPriority(t);return`${t}: ${o}${a?" !important":""};`}).join(" ")}function La(e,t,o){let a=`.${e}:${t}`,n=o.cssText?Ca(o):wa(o);return document.createTextNode(`${a}{${n}}`)}function lo(e,t,o){let a=window.getComputedStyle(e,o),n=a.getPropertyValue("content");if(n===""||n==="none")return;let r=ro();try{t.className=`${t.className} ${r}`}catch{return}let i=document.createElement("style");i.appendChild(La(r,o,a)),t.appendChild(i)}function co(e,t){lo(e,t,":before"),lo(e,t,":after")}var po="application/font-woff",mo="image/jpeg",Sa={woff:po,woff2:po,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:mo,jpeg:mo,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml",webp:"image/webp"};function Pa(e){let t=/\.([^./]*?)$/g.exec(e);return t?t[1]:""}function Ce(e){let t=Pa(e).toLowerCase();return Sa[t]||""}function Ta(e){return e.split(/,/)[1]}function Be(e){return e.search(/^(data:)/)!==-1}function Ct(e,t){return`data:${t};base64,${e}`}async function wt(e,t,o){let a=await fetch(e,t);if(a.status===404)throw new Error(`Resource "${a.url}" not found`);let n=await a.blob();return new Promise((r,i)=>{let s=new FileReader;s.onerror=i,s.onloadend=()=>{try{r(o({res:a,result:s.result}))}catch(u){i(u)}},s.readAsDataURL(n)})}var bt={};function Ma(e,t,o){let a=e.replace(/\?.*/,"");return o&&(a=e),/ttf|otf|eot|woff2?/i.test(a)&&(a=a.replace(/.*\//,"")),t?`[${t}]${a}`:a}async function we(e,t,o){let a=Ma(e,t,o.includeQueryParams);if(bt[a]!=null)return bt[a];o.cacheBust&&(e+=(/\?/.test(e)?"&":"?")+new Date().getTime());let n;try{let r=await wt(e,o.fetchRequestInit,({res:i,result:s})=>(t||(t=i.headers.get("Content-Type")||""),Ta(s)));n=Ct(r,t)}catch(r){n=o.imagePlaceholder||"";let i=`Failed to fetch resource: ${e}`;r&&(i=typeof r=="string"?r:r.message),i&&console.warn(i)}return bt[a]=n,n}async function Ea(e){let t=e.toDataURL();return t==="data:,"?e.cloneNode(!1):be(t)}async function Na(e,t){if(e.currentSrc){let r=document.createElement("canvas"),i=r.getContext("2d");r.width=e.clientWidth,r.height=e.clientHeight,i==null||i.drawImage(e,0,0,r.width,r.height);let s=r.toDataURL();return be(s)}let o=e.poster,a=Ce(o),n=await we(o,a,t);return be(n)}async function Da(e){var t;try{if(!((t=e==null?void 0:e.contentDocument)===null||t===void 0)&&t.body)return await $e(e.contentDocument.body,{},!0)}catch{}return e.cloneNode(!1)}async function ka(e,t){return k(e,HTMLCanvasElement)?Ea(e):k(e,HTMLVideoElement)?Na(e,t):k(e,HTMLIFrameElement)?Da(e):e.cloneNode(!1)}var Va=e=>e.tagName!=null&&e.tagName.toUpperCase()==="SLOT";async function Fa(e,t,o){var a,n;let r=[];return Va(e)&&e.assignedNodes?r=A(e.assignedNodes()):k(e,HTMLIFrameElement)&&(!((a=e.contentDocument)===null||a===void 0)&&a.body)?r=A(e.contentDocument.body.childNodes):r=A(((n=e.shadowRoot)!==null&&n!==void 0?n:e).childNodes),r.length===0||k(e,HTMLVideoElement)||await r.reduce((i,s)=>i.then(()=>$e(s,o)).then(u=>{u&&t.appendChild(u)}),Promise.resolve()),t}function Ha(e,t){let o=t.style;if(!o)return;let a=window.getComputedStyle(e);a.cssText?(o.cssText=a.cssText,o.transformOrigin=a.transformOrigin):A(a).forEach(n=>{let r=a.getPropertyValue(n);n==="font-size"&&r.endsWith("px")&&(r=`${Math.floor(parseFloat(r.substring(0,r.length-2)))-.1}px`),k(e,HTMLIFrameElement)&&n==="display"&&r==="inline"&&(r="block"),n==="d"&&t.getAttribute("d")&&(r=`path(${t.getAttribute("d")})`),o.setProperty(n,r,a.getPropertyPriority(n))})}function Aa(e,t){k(e,HTMLTextAreaElement)&&(t.innerHTML=e.value),k(e,HTMLInputElement)&&t.setAttribute("value",e.value)}function Ra(e,t){if(k(e,HTMLSelectElement)){let o=t,a=Array.from(o.children).find(n=>e.value===n.getAttribute("value"));a&&a.setAttribute("selected","")}}function Ba(e,t){return k(t,Element)&&(Ha(e,t),co(e,t),Aa(e,t),Ra(e,t)),t}async function $a(e,t){let o=e.querySelectorAll?e.querySelectorAll("use"):[];if(o.length===0)return e;let a={};for(let r=0;r<o.length;r++){let s=o[r].getAttribute("xlink:href");if(s){let u=e.querySelector(s),c=document.querySelector(s);!u&&c&&!a[s]&&(a[s]=await $e(c,t,!0))}}let n=Object.values(a);if(n.length){let r="http://www.w3.org/1999/xhtml",i=document.createElementNS(r,"svg");i.setAttribute("xmlns",r),i.style.position="absolute",i.style.width="0",i.style.height="0",i.style.overflow="hidden",i.style.display="none";let s=document.createElementNS(r,"defs");i.appendChild(s);for(let u=0;u<n.length;u++)s.appendChild(n[u]);e.appendChild(i)}return e}async function $e(e,t,o){return!o&&t.filter&&!t.filter(e)?null:Promise.resolve(e).then(a=>ka(a,t)).then(a=>Fa(e,a,t)).then(a=>Ba(e,a)).then(a=>$a(a,t))}var ho=/url\((['"]?)([^'"]+?)\1\)/g,Ia=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,Oa=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function za(e){let t=e.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1");return new RegExp(`(url\\(['"]?)(${t})(['"]?\\))`,"g")}function Ua(e){let t=[];return e.replace(ho,(o,a,n)=>(t.push(n),o)),t.filter(o=>!Be(o))}async function Za(e,t,o,a,n){try{let r=o?no(t,o):t,i=Ce(t),s;if(n){let u=await n(r);s=Ct(u,i)}else s=await we(r,i,a);return e.replace(za(t),`$1${s}$3`)}catch{}return e}function qa(e,{preferredFontFormat:t}){return t?e.replace(Oa,o=>{for(;;){let[a,,n]=Ia.exec(o)||[];if(!n)return"";if(n===t)return`src: ${a};`}}):e}function Lt(e){return e.search(ho)!==-1}async function Ke(e,t,o){if(!Lt(e))return e;let a=qa(e,o);return Ua(a).reduce((r,i)=>r.then(s=>Za(s,i,t,o)),Promise.resolve(a))}async function Ye(e,t,o){var a;let n=(a=t.style)===null||a===void 0?void 0:a.getPropertyValue(e);if(n){let r=await Ke(n,null,o);return t.style.setProperty(e,r,t.style.getPropertyPriority(e)),!0}return!1}async function Ja(e,t){await Ye("background",e,t)||await Ye("background-image",e,t),await Ye("mask",e,t)||await Ye("mask-image",e,t)}async function _a(e,t){let o=k(e,HTMLImageElement);if(!(o&&!Be(e.src))&&!(k(e,SVGImageElement)&&!Be(e.href.baseVal)))return;let a=o?e.src:e.href.baseVal,n=await we(a,Ce(a),t);await new Promise((r,i)=>{e.onload=r,e.onerror=i;let s=e;s.decode&&(s.decode=r),s.loading==="lazy"&&(s.loading="eager"),o?(e.srcset="",e.src=n):e.href.baseVal=n})}async function Wa(e,t){let a=A(e.childNodes).map(n=>St(n,t));await Promise.all(a).then(()=>e)}async function St(e,t){k(e,Element)&&(await Ja(e,t),await _a(e,t),await Wa(e,t))}function fo(e,t){let{style:o}=e;t.backgroundColor&&(o.backgroundColor=t.backgroundColor),t.width&&(o.width=`${t.width}px`),t.height&&(o.height=`${t.height}px`);let a=t.style;return a!=null&&Object.keys(a).forEach(n=>{o[n]=a[n]}),e}var go={};async function vo(e){let t=go[e];if(t!=null)return t;let a=await(await fetch(e)).text();return t={url:e,cssText:a},go[e]=t,t}async function yo(e,t){let o=e.cssText,a=/url\(["']?([^"')]+)["']?\)/g,r=(o.match(/url\([^)]+\)/g)||[]).map(async i=>{let s=i.replace(a,"$1");return s.startsWith("https://")||(s=new URL(s,e.url).href),wt(s,t.fetchRequestInit,({result:u})=>(o=o.replace(i,`url(${u})`),[i,u]))});return Promise.all(r).then(()=>o)}function xo(e){if(e==null)return[];let t=[],o=/(\/\*[\s\S]*?\*\/)/gi,a=e.replace(o,""),n=new RegExp("((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})","gi");for(;;){let u=n.exec(a);if(u===null)break;t.push(u[0])}a=a.replace(n,"");let r=/@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi,i="((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})",s=new RegExp(i,"gi");for(;;){let u=r.exec(a);if(u===null){if(u=s.exec(a),u===null)break;r.lastIndex=s.lastIndex}else s.lastIndex=r.lastIndex;t.push(u[0])}return t}async function Ga(e,t){let o=[],a=[];return e.forEach(n=>{if("cssRules"in n)try{A(n.cssRules||[]).forEach((r,i)=>{if(r.type===CSSRule.IMPORT_RULE){let s=i+1,u=r.href,c=vo(u).then(d=>yo(d,t)).then(d=>xo(d).forEach(h=>{try{n.insertRule(h,h.startsWith("@import")?s+=1:n.cssRules.length)}catch(b){console.error("Error inserting rule from remote css",{rule:h,error:b})}})).catch(d=>{console.error("Error loading remote css",d.toString())});a.push(c)}})}catch(r){let i=e.find(s=>s.href==null)||document.styleSheets[0];n.href!=null&&a.push(vo(n.href).then(s=>yo(s,t)).then(s=>xo(s).forEach(u=>{i.insertRule(u,n.cssRules.length)})).catch(s=>{console.error("Error loading remote stylesheet",s)})),console.error("Error inlining remote css file",r)}}),Promise.all(a).then(()=>(e.forEach(n=>{if("cssRules"in n)try{A(n.cssRules||[]).forEach(r=>{o.push(r)})}catch(r){console.error(`Error while reading CSS rules from ${n.href}`,r)}}),o))}function Qa(e){return e.filter(t=>t.type===CSSRule.FONT_FACE_RULE).filter(t=>Lt(t.style.getPropertyValue("src")))}async function Xa(e,t){if(e.ownerDocument==null)throw new Error("Provided element is not within a Document");let o=A(e.ownerDocument.styleSheets),a=await Ga(o,t);return Qa(a)}async function bo(e,t){let o=await Xa(e,t);return(await Promise.all(o.map(n=>{let r=n.parentStyleSheet?n.parentStyleSheet.href:null;return Ke(n.cssText,r,t)}))).join(`
|
|
2
|
-
`)}async function Co(e,t){let o=t.fontEmbedCSS!=null?t.fontEmbedCSS:t.skipFonts?null:await bo(e,t);if(o){let a=document.createElement("style"),n=document.createTextNode(o);a.appendChild(n),e.firstChild?e.insertBefore(a,e.firstChild):e.appendChild(a)}}async function Ka(e,t={}){let{width:o,height:a}=xt(e,t),n=await $e(e,t,!0);return await Co(n,t),await St(n,t),fo(n,t),await uo(n,o,a)}async function Ya(e,t={}){let{width:o,height:a}=xt(e,t),n=await Ka(e,t),r=await be(n),i=document.createElement("canvas"),s=i.getContext("2d"),u=t.pixelRatio||io(),c=t.canvasWidth||o,d=t.canvasHeight||a;return i.width=c*u,i.height=d*u,t.skipAutoScale||so(i),i.style.width=`${c}`,i.style.height=`${d}`,t.backgroundColor&&(s.fillStyle=t.backgroundColor,s.fillRect(0,0,i.width,i.height)),s.drawImage(r,0,0,i.width,i.height),i}async function wo(e,t={}){return(await Ya(e,t)).toDataURL()}var Lo=e=>new Promise((t,o)=>{wo(e,{cacheBust:!0}).then(a=>{a||o(new Error("No Screenshot available")),t(a)}).catch(a=>{console.error("the following error occurred while taking a screenshot of a DOMNode",a),o(new Error("Error taking screenshot"))})});var E=require("@salt-ds/core"),U=require("react");var v=require("react/jsx-runtime"),R="saveLayoutPanel",je=`${R}-formField`,ja=["Group 1","Group 2","Group 3","Group 4","Group 5"],en=["Value 1","Value 2","Value 3"],So=["Value 1","Value 2","Value 3"],Pt=e=>{let{defaultTitle:t="",onCancel:o,onSave:a,componentId:n}=e,[r,i]=(0,U.useState)(t),[s,u]=(0,U.useState)(""),[c,d]=(0,U.useState)([]),[h,b]=(0,U.useState)(So[0]),[y,p]=(0,U.useState)(),[l,f]=(0,U.useState)(),[P]=Ve();(0,U.useEffect)(()=>{n&&Lo(document.getElementById(n)).then(g=>{p(g)}).catch(g=>{f(g.message)})},[n]);let B=()=>{a({name:r,group:s,screenshot:y!=null?y:"",user:P})},V=(0,U.useMemo)(()=>y?(0,v.jsx)("img",{className:`${R}-screenshot`,src:y,alt:"screenshot of current layout"}):l?(0,v.jsx)(E.Text,{children:l}):(0,v.jsx)("div",{className:"spinner"}),[y,l]);return(0,v.jsxs)("div",{className:`${R}-panelContainer`,children:[(0,v.jsxs)("div",{className:`${R}-panelContent`,children:[(0,v.jsxs)("div",{className:`${R}-formContainer`,children:[(0,v.jsxs)(E.FormField,{className:je,children:[(0,v.jsx)(E.FormFieldLabel,{children:"Group"}),(0,v.jsx)(Le.ComboBox,{source:ja,allowFreeText:!0,InputProps:{inputProps:{className:`${R}-inputText`,placeholder:"Select Group or Enter New Name",onChange:g=>u(g.target.value)}},width:"100%",onSelectionChange:(g,F)=>u(F||"")})]}),(0,v.jsxs)(E.FormField,{className:je,children:[(0,v.jsx)(E.FormFieldLabel,{children:"Layout Name"}),(0,v.jsx)(E.Input,{inputProps:{className:`${R}-inputText`,placeholder:"Enter Layout Name"},onChange:g=>i(g.target.value),value:r})]}),(0,v.jsxs)(E.FormField,{className:je,children:[(0,v.jsx)(E.FormFieldLabel,{children:"Some Layout Setting"}),(0,v.jsx)("div",{className:`${R}-settingsGroup`,children:en.map((g,F)=>(0,v.jsx)(Le.Checkbox,{onToggle:()=>d(T=>T.includes(g)?T.filter($=>$!==g):[...T,g]),checked:c.includes(g),label:g},F))})]}),(0,v.jsxs)(E.FormField,{className:je,children:[(0,v.jsx)(E.FormFieldLabel,{children:"Some Layout Setting"}),(0,v.jsx)("div",{className:`${R}-settingsGroup`,children:So.map((g,F)=>(0,v.jsx)(Le.RadioButton,{onClick:()=>b(g),checked:h===g,label:g,groupName:"radioGroup"},F))})]})]}),(0,v.jsx)("div",{className:`${R}-screenshotContainer`,children:V})]}),(0,v.jsxs)("div",{className:`${R}-buttonsContainer`,children:[(0,v.jsx)(E.Button,{className:`${R}-cancelButton`,onClick:o,children:"Cancel"}),(0,v.jsx)(E.Button,{className:`${R}-saveButton`,onClick:B,disabled:r===""||s==="",children:"Save"})]})]})};var Uo=require("@vuu-ui/vuu-ui-controls");var C=M(require("react")),Ue=require("@vuu-ui/vuu-layout");var No=M(require("clsx")),Do=require("@vuu-ui/vuu-utils"),le=require("react");var et=require("@salt-ds/core"),Po=M(require("clsx"));var Ie=require("react/jsx-runtime"),tn="vuuDialogHeader",To=({hideCloseButton:e=!1,title:t,onClose:o,...a})=>(0,Ie.jsxs)("div",{...a,className:(0,Po.default)(tn,"vuuToolbarProxy"),children:[(0,Ie.jsx)(et.Text,{className:"dialogHeader",children:t}),!e&&(0,Ie.jsx)(et.Button,{onClick:o,"data-align":"end","data-icon":"close",variant:"secondary"},"close")]});var te=require("react");var Tt=(e,t,o,a,n,r)=>{let{bottom:i,height:s,left:u,right:c,top:d,width:h}=e.getBoundingClientRect();switch(t){case"below":return{left:u+o,top:i+a};case"right":return{left:c+o,top:d+a};case"below-center":return{left:u+h/2+o,top:i+a};case"below-right":return{left:u,minWidth:n,top:i+a};case"below-full-width":return{left:u+o,minWidth:n,top:i+a,width:h};case"center":return r?{left:h/2-r.width/2+o,top:s/2-r.height/2+a,visibility:"visible"}:{left:h/2+o,top:s/2+a,visibility:"hidden"};default:throw Error(`Popup getPositionRelativeToAnchor non-supported placement value ${t}`)}};var Mo=({anchorElement:e,minWidth:t,offsetLeft:o=0,offsetTop:a=0,placement:n,position:r})=>{let i=(0,te.useRef)(null),[s,u]=(0,te.useState)(r);(0,te.useLayoutEffect)(()=>{if(n==="absolute"&&r)u(r);else if(e.current&&n!=="auto"){let d=i.current===null?void 0:i.current.getBoundingClientRect(),h=Tt(e.current,n,o,a,t,d);u(h)}},[e,t,o,a,n,r]);let c=(0,te.useCallback)(d=>{if(i.current=d,d&&n==="center"&&e.current){let{height:h,width:b}=d.getBoundingClientRect();u(Tt(e.current,n,o,a,void 0,{height:h,width:b}))}},[e,o,a,n]);return{position:s,popupRef:n==="center"?c:void 0}};var Se=require("react/jsx-runtime"),Eo="vuuDialog",on={current:document.body},an={},ko=({PopupProps:e=an,children:t,className:o,isOpen:a=!1,onClose:n,style:r,title:i,hideCloseButton:s=!1,...u})=>{let{anchorElement:c=on,offsetLeft:d=0,offsetTop:h=0,placement:b="auto"}=e,y=(0,le.useRef)(null),p=(0,le.useRef)(null),[l,f,P]=(0,Do.useThemeAttributes)(),{position:B}=Mo({anchorElement:c,offsetLeft:d,offsetTop:h,placement:b}),V=(0,le.useCallback)(()=>{n==null||n()},[n]);return(0,le.useLayoutEffect)(()=>{if(y.current){if(a){y.current.showModal();let{left:g,top:F}=y.current.getBoundingClientRect();p.current&&(p.current.style.cssText=`left:-${g}px;position:absolute;top:-${F}px;`)}else y.current.close();if(b.endsWith("center")){let{width:g}=y.current.getBoundingClientRect();y.current.style.marginLeft=`-${g/2}px`}}},[a,b]),(0,Se.jsxs)("dialog",{...u,className:(0,No.default)(Eo,l),"data-mode":P,onClose:V,id:"vuu-dialog",ref:y,style:{...r,...B},children:[(0,Se.jsx)(To,{hideCloseButton:s,onClose:V,title:i}),(0,Se.jsx)("div",{className:`${Eo}-body`,children:t}),(0,Se.jsx)("div",{id:"vuu-dialog-portal-root",ref:p})]})};var tt=require("react");var Fo=require("react/jsx-runtime"),Vo=()=>{let[e,t]=(0,tt.useState)(),o=(0,tt.useCallback)(()=>{t(void 0)},[]);return{dialog:e?(0,Fo.jsx)(ko,{className:"vuDialog",isOpen:!0,onClose:o,style:{maxHeight:500},title:e.title,hideCloseButton:e.hideCloseButton,children:e.content}):null,setDialogState:t}};var Pe=require("react"),ot=require("react/jsx-runtime"),Ho=(0,Pe.createContext)(null),nn=({children:e,context:t,menuActionHandler:o,menuBuilder:a})=>{let n=(0,Pe.useMemo)(()=>t!=null&&t.menuBuilders&&a?t.menuBuilders.concat(a):a?[a]:(t==null?void 0:t.menuBuilders)||[],[t,a]),r=(0,Pe.useCallback)(i=>{var s;if(o!=null&&o(i)||(s=t==null?void 0:t.menuActionHandler)!=null&&s.call(t,i))return!0},[t,o]);return(0,ot.jsx)(Ho.Provider,{value:{menuActionHandler:r,menuBuilders:n},children:e})},Ao=({children:e,label:t,menuActionHandler:o,menuBuilder:a})=>(0,ot.jsx)(Ho.Consumer,{children:n=>(0,ot.jsx)(nn,{context:n,label:t,menuActionHandler:o,menuBuilder:a,children:e})});var ce=M(require("react")),rn=M(require("clsx")),sn=require("@vuu-ui/vuu-utils");var Bo=require("react/jsx-runtime");var un=ce.default.createContext({notify:()=>"have you forgotten to provide a NotificationProvider?"});var Ro=()=>(0,ce.useContext)(un);var at={layout:{type:"Component",id:"loading-main",props:{}}},nt={layout:{type:"Stack",id:"main-tabs",props:{className:"vuuShell-mainTabs",TabstripProps:{allowAddTab:!0,allowCloseTab:!0,allowRenameTab:!0,animateSelectionThumb:!1,location:"main-tab",variant:"primary"},preserve:!0,active:0},children:[{props:{id:"tab1",title:"Tab 1",className:"vuuShell-Placeholder"},type:"Placeholder"}]}};var oe=require("@vuu-ui/vuu-filters");var it=require("@vuu-ui/vuu-utils");var ln="layouts/metadata",cn="layouts/layouts",Te,rt=class{constructor(t){this.username=Ve()[0];this.metadataSaveLocation=`${ln}/${this.username}`;this.layoutsSaveLocation=`${cn}/${this.username}`;Ut(this,Te,`api/vui/${this.username}`);this.loadLayouts=()=>new Promise(t=>{let o=(0,oe.getLocalEntity)(this.layoutsSaveLocation);t(o||[])});this.saveLayoutsWithMetadata=(t,o)=>{(0,oe.saveLocalEntity)(this.layoutsSaveLocation,t),(0,oe.saveLocalEntity)(this.metadataSaveLocation,o)};this.validateIds=async t=>Promise.all([this.validateId(t,"metadata").catch(o=>o.message),this.validateId(t,"layout").catch(o=>o.message)]).then(o=>{let a=o.filter(n=>n!==void 0).join("; ");if(a)throw new Error(a)});this.validateId=(t,o)=>new Promise((a,n)=>{(o==="metadata"?()=>this.loadMetadata():()=>this.loadLayouts())().then(i=>{switch(i.filter(u=>u.id===t).length){case 1:{a();break}case 0:{n(new Error(`No ${o} with ID ${t}`));break}default:n(new Error(`Non-unique ${o} with ID ${t}`))}})});t&&Zt(this,Te,t)}createLayout(t,o){return new Promise(a=>{Promise.all([this.loadLayouts(),this.loadMetadata()]).then(([n,r])=>{let i=(0,it.getUniqueId)(),s={...t,id:i,created:(0,it.formatDate)({date:"dd.mm.yyyy"})(new Date)};this.saveLayoutsWithMetadata([...n,{id:i,json:o}],[...r,s]),a(s)})})}updateLayout(t,o,a){return new Promise((n,r)=>{this.validateIds(t).then(()=>Promise.all([this.loadLayouts(),this.loadMetadata()])).then(([i,s])=>{let u=i.map(d=>d.id===t?{...d,json:a}:d),c=s.map(d=>d.id===t?{...d,...o}:d);this.saveLayoutsWithMetadata(u,c),n()}).catch(i=>r(i))})}deleteLayout(t){return new Promise((o,a)=>{this.validateIds(t).then(()=>Promise.all([this.loadLayouts(),this.loadMetadata()])).then(([n,r])=>{let i=n.filter(u=>u.id!==t),s=r.filter(u=>u.id!==t);this.saveLayoutsWithMetadata(i,s),o()}).catch(n=>a(n))})}loadLayout(t){return new Promise((o,a)=>{this.validateId(t,"layout").then(()=>this.loadLayouts()).then(n=>{let r=n.find(i=>i.id===t);r?o(r.json):a(new Error(`no layout found matching id ${t}`))}).catch(n=>a(n))})}loadMetadata(){return new Promise(t=>{let o=(0,oe.getLocalEntity)(this.metadataSaveLocation);t(o||[])})}loadApplicationJSON(){return new Promise(t=>{let o=(0,oe.getLocalEntity)(ft(this,Te));t(o||nt)})}saveApplicationJSON(t){return new Promise((o,a)=>{(0,oe.saveLocalEntity)(ft(this,Te),t)?o():a(new Error("Application Json failed to save"))})}};Te=new WeakMap;var Oe=require("react");var Io=require("react/jsx-runtime"),$o=e=>{let{saveLayout:t}=de(),o=(0,Oe.useCallback)(()=>{e(void 0)},[e]),a=(0,Oe.useCallback)(i=>{t(i),e(void 0)},[t,e]),[n,r]=(0,Oe.useMemo)(()=>[(i,s)=>{let u=i.split(" "),c=[];return u.includes("main-tab")&&c.push({label:"Save Layout",action:"save-layout",options:s},{label:"Layout Settings",action:"layout-settings",options:s}),c},i=>{var s,u;return console.log("menu action",{action:i}),i.menuId==="save-layout"?(e({content:(0,Io.jsx)(Pt,{onCancel:o,onSave:a,componentId:(s=i.options)==null?void 0:s.controlledComponentId,defaultTitle:(u=i.options)==null?void 0:u.controlledComponentTitle}),title:"Save Layout",hideCloseButton:!0}),!0):!1}],[o,a,e]);return{buildMenuOptions:n,handleMenuAction:r}};var Oo=require("react/jsx-runtime"),Mt,ze=()=>(Mt===void 0&&(Mt=new rt),Mt),Et=C.default.createContext({getApplicationSettings:()=>{},layoutMetadata:[],saveLayout:()=>{},applicationJson:nt,saveApplicationLayout:()=>{},saveApplicationSettings:()=>{},loadLayoutById:()=>{}}),dn=(e,t)=>{var o;return((o=e.props)==null?void 0:o.title)!==void 0?e:{...e,props:{...e.props,title:t.name}}},pn=e=>{let[t,o]=(0,C.useState)([]),[,a]=(0,C.useState)({}),{notify:n}=Ro(),r=(0,C.useRef)(at),i=(0,C.useCallback)((p,l=!0)=>{r.current=p,l&&a({})},[]),s=(0,C.useCallback)((p,l=!0)=>{i({...r.current,layout:p},l)},[i]),u=(0,C.useCallback)(p=>{i({...r.current,settings:{...r.current.settings,...p}},!1)},[i]);(0,C.useEffect)(()=>{let p=ze();p.loadMetadata().then(l=>{o(l)}).catch(l=>{n({type:"error",header:"Failed to Load Layouts",body:"Could not load list of available layouts"}),console.error("Error occurred while retrieving metadata",l)}),p.loadApplicationJSON().then(l=>{i(l)}).catch(l=>{n({type:"error",header:"Failed to Load Layout",body:"Could not load your latest view"}),console.error("Error occurred while retrieving application layout",l)})},[n,i]);let c=(0,C.useCallback)(p=>{(0,Ue.isLayoutJSON)(p)?(s(p,!1),ze().saveApplicationJSON(r.current)):console.error("Tried to save invalid application layout",p)},[s]),d=(0,C.useCallback)(p=>{let l=(0,Ue.resolveJSONPath)(r.current.layout,"#main-tabs.ACTIVE_CHILD");l&&(0,Ue.isLayoutJSON)(l)?ze().createLayout(p,dn(l,p)).then(f=>{n({type:"success",header:"Layout Saved Successfully",body:`${f.name} saved successfully`}),o(P=>[...P,f])}).catch(f=>{n({type:"error",header:"Failed to Save Layout",body:`Failed to save layout ${p.name}`}),console.error("Error occurred while saving layout",f)}):(console.error("Tried to save invalid layout",l),n({type:"error",header:"Failed to Save Layout",body:"Cannot save invalid layout"}))},[n]),h=(0,C.useCallback)((p,l)=>{let{settings:f}=r.current;u(l?{...f,[l]:p}:p),ze().saveApplicationJSON(r.current)},[u]),b=(0,C.useCallback)(p=>{let{settings:l}=r.current;return p?l==null?void 0:l[p]:l},[]),y=(0,C.useCallback)(p=>{ze().loadLayout(p).then(l=>{var P,B;let{layout:f}=r.current;s({...f,children:(f.children||[]).concat(l),props:{...f.props,active:(B=(P=f.children)==null?void 0:P.length)!=null?B:0}})}).catch(l=>{n({type:"error",header:"Failed to Load Layout",body:"Failed to load the requested layout"}),console.error("Error occurred while loading layout",l)})},[n,s]);return(0,Oo.jsx)(Et.Provider,{value:{getApplicationSettings:b,layoutMetadata:t,saveLayout:d,applicationJson:r.current,saveApplicationLayout:c,saveApplicationSettings:h,loadLayoutById:y},children:e.children})},de=()=>(0,C.useContext)(Et);var X=require("react/jsx-runtime"),st="vuuLayoutTile",zo=e=>{let{metadata:t,handleLoadLayout:o}=e;return(0,X.jsx)("div",{role:"listitem",children:(0,X.jsxs)("div",{className:`${st}-layoutTile`,role:"button",onClick:()=>o(t==null?void 0:t.id),children:[(0,X.jsx)("img",{className:`${st}-screenshot`,src:t==null?void 0:t.screenshot}),(0,X.jsxs)("div",{children:[(0,X.jsx)("div",{className:`${st}-layoutName`,children:t==null?void 0:t.name}),(0,X.jsx)("div",{className:`${st}-layoutDetails`,children:(0,X.jsx)("div",{children:`${t==null?void 0:t.user}, ${t==null?void 0:t.created}`})})]})]},t==null?void 0:t.id)})};var Z=require("react/jsx-runtime"),Nt="vuuLayoutList",Dt=e=>{let{layoutMetadata:t,loadLayoutById:o}=de(),a=r=>{r&&o(r)},n=t.reduce((r,i)=>r[i.group]?{...r,[i.group]:[...r[i.group],i]}:{...r,[i.group]:[i]},{});return(0,Z.jsxs)("div",{className:Nt,...e,role:"listbox","aria-label":"my layouts",children:[(0,Z.jsx)("div",{className:`${Nt}-header`,children:"My Layouts"}),(0,Z.jsx)(Uo.List,{height:"auto",source:Object.entries(n),ListItem:({item:r})=>{if(!r)return(0,Z.jsx)(Z.Fragment,{});let[i,s]=r;return(0,Z.jsxs)("div",{role:"list","aria-label":i,children:[(0,Z.jsx)("div",{className:`${Nt}-groupName`,children:i}),s.map(u=>(0,Z.jsx)(zo,{metadata:u,handleLoadLayout:a},u.id))]})}})]})};var Zo=require("@vuu-ui/vuu-icons"),dt=require("@vuu-ui/vuu-layout"),pe=require("@vuu-ui/vuu-ui-controls"),qo=require("@vuu-ui/vuu-utils"),ct=M(require("clsx")),Ee=require("react");var ut=require("@vuu-ui/vuu-layout");var ae=require("react/jsx-runtime"),kt="vuuFeatureList",lt=({features:e,title:t="VUU TABLES",...o})=>{let a={},n={height:"100%"};return(0,ae.jsxs)("div",{...o,className:kt,children:[(0,ae.jsx)("div",{className:`${kt}-header`,children:t}),(0,ae.jsx)("div",{className:`${kt}-content`,children:(0,ae.jsx)(ut.Palette,{orientation:"vertical",ListProps:n,ViewProps:a,children:e.map((r,i)=>(0,ae.jsx)(ut.PaletteItem,{closeable:!0,label:r.title,resizeable:!0,resize:"defer",header:!0,children:(0,ae.jsx)(Re,{...r})},i))})})]})};var L=require("react/jsx-runtime"),Me="vuuLeftNav",mn=(e,t)=>e===0?t?"menu-full":"menu-icons":t?"menu-full-content":"menu-icons-content",hn=e=>{let t=(0,dt.useLayoutProviderDispatch)(),[o]=(0,qo.useThemeAttributes)(),{"data-path":a,defaultExpanded:n=!0,defaultActiveTabIndex:r=0,features:i,onActiveChange:s,onTogglePrimaryMenu:u,sizeCollapsed:c=80,sizeContent:d=300,sizeExpanded:h=240,style:b,tableFeatures:y,...p}=e,[l,f]=(0,Ee.useState)({activeTabIndex:r,expanded:n}),P=(0,Ee.useCallback)((T,$)=>T===0?$?h:c:$?h+d:c+d,[c,d,h]),B=(0,Ee.useCallback)(T=>{let{activeTabIndex:$,expanded:_}=l;if(f({activeTabIndex:T,expanded:_}),T===0||$===0){let w=P(T,_);t({type:"layout-resize",path:"#vuu-side-panel",size:w})}s==null||s(T)},[t,P,l,s]),V=mn(l.activeTabIndex,l.expanded),g=(0,Ee.useCallback)(()=>{let{activeTabIndex:T,expanded:$}=l,_=!$;f({activeTabIndex:T,expanded:_}),t({type:"layout-resize",path:"#vuu-side-panel",size:P(T,_)}),u==null||u(_)},[t,P,l,u]),F={...b,"--nav-menu-collapsed-width":`${c}px`,"--nav-menu-expanded-width":`${h}px`,"--nav-menu-content-width":`${d}px`};return(0,L.jsxs)("div",{...p,className:(0,ct.default)(Me,`${Me}-${V}`),style:F,children:[(0,L.jsxs)("div",{className:(0,ct.default)(`${Me}-menu-primary`,o),"data-mode":"dark",children:[(0,L.jsx)("div",{className:"vuuLeftNav-logo",children:(0,L.jsx)(Zo.VuuLogo,{})}),(0,L.jsx)("div",{className:`${Me}-main`,children:(0,L.jsxs)(pe.Tabstrip,{activeTabIndex:l.activeTabIndex,animateSelectionThumb:!1,className:`${Me}-Tabstrip`,onActiveChange:B,orientation:"vertical",children:[(0,L.jsx)(pe.Tab,{"data-icon":"demo",label:"DEMO"}),(0,L.jsx)(pe.Tab,{"data-icon":"features",label:"VUU FEATURES"}),(0,L.jsx)(pe.Tab,{"data-icon":"tables",label:"VUU TABLES"}),(0,L.jsx)(pe.Tab,{"data-icon":"layouts",label:"MY LAYOUTS"})]})}),(0,L.jsx)("div",{className:"vuuLeftNav-buttonBar",children:(0,L.jsx)("button",{className:(0,ct.default)("vuuLeftNav-toggleButton",{"vuuLeftNav-toggleButton-open":V.startsWith("menu-full"),"vuuLeftNav-toggleButton-closed":V.startsWith("menu-icons")}),"data-icon":V.startsWith("menu-full")?"chevron-left":"chevron-right",onClick:g})})]}),(0,L.jsxs)(dt.Stack,{active:l.activeTabIndex-1,className:`${Me}-menu-secondary`,showTabs:!1,children:[(0,L.jsx)(lt,{features:i,title:"VUU FEATURES"}),(0,L.jsx)(lt,{features:y,title:"VUU TABLES"}),(0,L.jsx)("div",{className:"vuuLeftNav-drawer",children:(0,L.jsx)(Dt,{})})]})]})};var Go=require("@vuu-ui/vuu-data-remote"),q=require("@vuu-ui/vuu-utils"),Ze=require("@salt-ds/core"),Vt=M(require("clsx")),S=require("react");var I=require("react/jsx-runtime"),K="vuuSessionEditingForm",Jo=(e,t)=>{let o=e.find(a=>a.name===t);if(o)return o;throw Error(`SessionEditingForm, no field '${t}' found`)},_o=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]},Y={uninitialised:0,unchanged:1,changed:2,invalid:3};function Wo(e,t,o=!1){switch(t){case"int":case"long":{let a=parseInt(e,10);if((0,q.isValidNumber)(a))return a;if(o)throw Error("SessionEditingForm getTypedValue");return}case"double":{let a=parseFloat(e);return(0,q.isValidNumber)(a)?a:void 0}case"boolean":return e==="true";default:return e}}var fn=(e,t)=>{if(e)return e;if(t)return new Go.VuuDataSource({bufferSize:0,table:t.table,columns:t.columns.map(o=>o.name)});throw Error("SessionEditingForm: either a DataSource or a TableSchema must be provided")},gn=({className:e,config:{fields:t,key:o},dataSource:a,id:n,onClose:r,schema:i,...s})=>{let[u,c]=(0,S.useState)(),[d,h]=(0,S.useState)(""),b=(0,S.useRef)(null),y=(0,S.useRef)(),p=(0,S.useRef)(Y.uninitialised),l=(0,S.useMemo)(()=>{let m=z=>{if(O){let N={};for(let ye of l.columns)N[ye]=z[O[ye]];p.current===Y.uninitialised&&(p.current=Y.unchanged,y.current=N),c(N)}},w=fn(a,i),O=(0,q.buildColumnMap)(w.columns);return w.subscribe({range:{from:0,to:5}},z=>{z.type==="viewport-update"&&z.rows&&(p.current===Y.uninitialised?m(z.rows[0]):console.log("what do we do with server updates"))}),w},[a,i]),f=(0,Ze.useIdMemo)(n),P=(0,S.useCallback)(m=>{let[w,O]=_o(m),{type:z}=Jo(t,w),N=Wo(O,z);c((ye={})=>{let It={...ye,[w]:N},ra=(0,q.shallowEquals)(It,y.current);return p.current=ra?Y.unchanged:N!==void 0?Y.changed:Y.invalid,It})},[t]),B=(0,S.useCallback)(m=>{let[w,O]=_o(m),{type:z}=Jo(t,w),N=u==null?void 0:u[o],ye=Wo(O,z,!0);typeof N=="string"&&l.menuRpcCall({rowKey:N,field:w,value:ye,type:"VP_EDIT_CELL_RPC"})},[l,t,o,u]),V=(0,S.useCallback)(m=>{typeof m=="object"&&m!==null&&"type"in m&&m.type==="CLOSE_DIALOG_ACTION"&&r()},[r]),g=(0,S.useCallback)(async()=>{let m=await l.menuRpcCall({type:"VP_EDIT_SUBMIT_FORM_RPC"});(0,q.isErrorResponse)(m)?h(m.error):(0,q.hasAction)(m)&&V(m.action)},[V,l]),F=(0,S.useCallback)(m=>{m.key==="Enter"&&p.current===Y.changed&&g()},[g]),T=(0,S.useCallback)(()=>{r()},[r]),$=m=>{var O;let w=String((O=u==null?void 0:u[m.name])!=null?O:"");return m.readonly||m.name===o?(0,I.jsx)("div",{className:`${K}-fieldValue vuuReadOnly`,children:w}):(0,I.jsx)("input",{className:`${K}-fieldValue`,"data-field":m.name,onBlur:B,onChange:P,type:"text",value:w,id:`${f}-input-${m.name}`})};(0,S.useEffect)(()=>{if(b.current){let m=b.current.querySelector("input");m&&setTimeout(()=>{m.focus(),m.select()},100)}},[]),(0,S.useEffect)(()=>()=>{l&&l.unsubscribe()},[l]);let _=p.current===Y.changed;return(0,I.jsxs)("div",{...s,className:(0,Vt.default)(K,e),children:[d?(0,I.jsx)("div",{className:`${K}-errorBanner`,"data-icon":"error",title:d,children:"Error, edit(s) not saved"}):void 0,(0,I.jsx)("div",{className:`${K}-content`,ref:b,onKeyDown:F,children:t.map(m=>{var w;return(0,I.jsxs)("div",{className:`${K}-field`,children:[(0,I.jsx)("label",{className:(0,Vt.default)(`${K}-fieldLabel`,{[`${K}-required`]:m.required}),htmlFor:`${f}-input-${m.name}`,children:(w=m==null?void 0:m.label)!=null?w:m.description}),$(m)]},m.name)})}),(0,I.jsxs)("div",{className:`${K}-buttonbar salt-theme salt-density-high`,children:[(0,I.jsx)(Ze.Button,{type:"submit",variant:"cta",disabled:!_,onClick:g,children:"Submit"}),(0,I.jsx)(Ze.Button,{variant:"secondary",onClick:T,children:"Cancel"})]})]})};var ta=require("@vuu-ui/vuu-data-remote"),De=require("@vuu-ui/vuu-layout");var ke=require("@vuu-ui/vuu-utils"),oa=M(require("clsx")),j=require("react");var Qo=require("@salt-ds/core"),Ft=M(require("clsx")),pt=require("react"),Ne=require("@vuu-ui/vuu-layout");var ne=require("react/jsx-runtime"),J="vuuContextPanel",Ht=({className:e,expanded:t=!1,content:o,overlay:a=!1,title:n})=>{let r=(0,Ne.useLayoutProviderDispatch)(),i=(0,pt.useCallback)(()=>{r({path:"#context-panel",propName:"expanded",propValue:!1,type:"set-prop"})},[r]),s=(0,Ft.default)(J,e,{[`${J}-expanded`]:t,[`${J}-inline`]:a!==!0,[`${J}-overlay`]:a}),u=(0,pt.useMemo)(()=>o&&t?(0,Ne.layoutFromJson)(o,"context-0"):null,[o,t]);return(0,ne.jsx)("div",{className:(0,Ft.default)(J,s,{[`${J}-expanded`]:t}),children:(0,ne.jsxs)(Ne.View,{className:`${J}-inner`,header:!1,id:"context-panel",children:[(0,ne.jsxs)("div",{className:`${J}-header`,children:[(0,ne.jsx)("h2",{className:`${J}-title`,children:n}),(0,ne.jsx)(Qo.Button,{className:`${J}-close`,"data-icon":"close",onClick:i,variant:"secondary"})]}),(0,ne.jsx)("div",{className:`${J}-content`,children:u})]})})};var qe=require("@vuu-ui/vuu-layout");var Xo=require("react"),Ko=M(require("clsx"));var Yo=require("react/jsx-runtime"),vn="vuuShellSidePanel",At=({children:e,open:t=!0,sizeClosed:o=90,sizeOpen:a=200,style:n,...r})=>{let i=(0,Xo.useMemo)(()=>({...n,"--shell-left-nav-size":t?`${a}px`:`${o}px`}),[t,o,a,n]);return(0,Yo.jsx)("div",{...r,className:(0,Ko.default)(vn),style:i,children:e})};var me=require("react/jsx-runtime"),jo=({appHeader:e,LeftSidePanelProps:t})=>(0,me.jsxs)(qe.Flexbox,{className:"App",style:{flexDirection:"row",height:"100%",width:"100%"},children:[(0,me.jsx)(At,{...t,id:"vuu-side-panel"}),(0,me.jsxs)(qe.Flexbox,{className:"vuuShell-content",style:{flex:1,flexDirection:"column"},children:[e,(0,me.jsx)(qe.DraggableLayout,{dropTarget:!0,style:{flex:1}},"main-content")]}),(0,me.jsx)(Ht,{id:"context-panel",overlay:!0})]});var G=require("@vuu-ui/vuu-layout"),fe=require("react"),he=require("react/jsx-runtime"),ea=({appHeader:e,LeftSidePanelProps:t})=>{let o=(0,fe.useRef)(null),[a,n]=(0,fe.useState)(!0),r=(0,fe.useCallback)(s=>{var c;let u=s.target;(c=o.current)!=null&&c.contains(u)||n(!a)},[a]),i=(0,fe.useCallback)(s=>{let u=[];return u.push((0,he.jsx)(G.Drawer,{onClick:r,open:a,position:"left",inline:!0,peekaboo:!0,sizeOpen:200,toggleButton:"end",children:(0,he.jsx)(G.View,{className:"vuuShell-palette",id:"vw-app-palette",ref:o,style:{height:"100%"},children:s},"app-palette")},"left-panel")),u},[r,a]);return(0,he.jsxs)(G.Flexbox,{className:"App",style:{flexDirection:"column",height:"100%",width:"100%"},children:[e,(0,he.jsx)(G.DockLayout,{style:{flex:1},children:i(t==null?void 0:t.children).concat((0,he.jsx)(G.DraggableLayout,{dropTarget:!0,style:{width:"100%",height:"100%"}},"main-content"))})]})};var Rt=({leftSidePanelLayout:e="inlay",...t})=>(e==="inlay"?ea:jo)(t);var ge=require("react/jsx-runtime");typeof De.StackLayout!="function"&&console.warn("StackLayout module not loaded, will be unsbale to deserialize from layout JSON");var{error:Bt}=(0,ke.logger)("Shell"),yn={},xn=({LayoutProps:e,LeftSidePanelProps:t=yn,children:o,className:a,leftSidePanelLayout:n,loginUrl:r,saveLocation:i,saveUrl:s,serverUrl:u,user:c,...d})=>{let h=(0,j.useRef)(null),{dialog:b,setDialogState:y}=Vo(),p=(0,j.useRef)("latest"),{applicationJson:l,saveApplicationLayout:f,loadLayoutById:P}=de(),{buildMenuOptions:B,handleMenuAction:V}=$o(y),g=(0,j.useCallback)(N=>{try{f(N)}catch{Bt==null||Bt("Failed to save layout")}},[f]),F=(0,j.useCallback)(N=>{h.current&&(h.current.dataset.mode=N)},[]),T=(0,j.useCallback)(N=>{p.current=N,P(N)},[P]);(0,j.useEffect)(()=>{u&&c.token&&(0,ta.connectToServer)({authToken:c.token,url:u,username:c.username})},[u,c.token,c.username]);let[$,_,m]=(0,ke.useThemeAttributes)(),w=(0,oa.default)("vuuShell",a,$,_),O=l===at,z=Rt({LeftSidePanelProps:t,leftSidePanelLayout:n,appHeader:(0,ge.jsx)(yt,{layoutId:p.current,loginUrl:r,user:c,onNavigate:T,onSwitchTheme:F})});return O?null:(0,ge.jsx)(ke.ThemeProvider,{children:(0,ge.jsxs)(Ao,{menuActionHandler:V,menuBuilder:B,children:[(0,ge.jsx)(De.LayoutProvider,{...e,layout:l.layout,onLayoutChange:g,children:(0,ge.jsx)(De.DraggableLayout,{className:w,"data-mode":m,ref:h,...d,children:z})}),o||b]})})};var bn=e=>e==="*",Cn=e=>typeof e=="object"&&typeof e.module=="string"&&typeof e.table=="string";var ht=require("react"),mt=require("react/jsx-runtime"),wn={},$t=(0,ht.createContext)(wn),Ln=({children:e,context:t,inheritedContext:o})=>{let a={...o,...t};return(0,mt.jsx)($t.Provider,{value:a,children:e})},Sn=({children:e,value:t})=>(0,mt.jsx)($t.Consumer,{children:o=>(0,mt.jsx)(Ln,{context:t,inheritedContext:o,children:e})}),Pn=()=>(0,ht.useContext)($t);var aa=M(require("clsx")),ve=require("@salt-ds/core"),na=require("react");var Je=require("react/jsx-runtime"),Tn="vuuThemeSwitch",Mn=({className:e,defaultMode:t,mode:o,onChange:a,...n})=>{let[r,i]=(0,ve.useControlled)({controlled:o,default:t!=null?t:"light",name:"ThemeSwitch",state:"mode"}),s=(0,na.useCallback)(c=>{let{value:d}=c.target;i(d),a(d)},[a,i]),u=(0,aa.default)(Tn,e);return(0,Je.jsxs)(ve.ToggleButtonGroup,{className:u,...n,onChange:s,value:r,children:[(0,Je.jsx)(ve.ToggleButton,{"aria-label":"alert","data-icon":"light",value:"light"}),(0,Je.jsx)(ve.ToggleButton,{"aria-label":"home","data-icon":"dark",value:"dark"})]})};
|
|
1
|
+
"use strict";var ia=Object.create;var We=Object.defineProperty;var sa=Object.getOwnPropertyDescriptor;var ua=Object.getOwnPropertyNames;var la=Object.getPrototypeOf,ca=Object.prototype.hasOwnProperty;var da=(e,t)=>{for(var o in t)We(e,o,{get:t[o],enumerable:!0})},Ot=(e,t,o,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of ua(t))!ca.call(e,n)&&n!==o&&We(e,n,{get:()=>t[n],enumerable:!(a=sa(t,n))||a.enumerable});return e};var M=(e,t,o)=>(o=e!=null?ia(la(e)):{},Ot(t||!e||!e.__esModule?We(o,"default",{value:e,enumerable:!0}):o,e)),pa=e=>Ot(We({},"__esModule",{value:!0}),e);var zt=(e,t,o)=>{if(!t.has(e))throw TypeError("Cannot "+o)};var ft=(e,t,o)=>(zt(e,t,"read from private field"),o?o.call(e):t.get(e)),Ut=(e,t,o)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,o)},Zt=(e,t,o,a)=>(zt(e,t,"write to private field"),a?a.call(e,o):t.set(e,o),o);var En={};da(En,{AppHeader:()=>xt,ConnectionStatusIcon:()=>ga,ContextPanel:()=>At,Feature:()=>Be,FeatureList:()=>ct,LayoutList:()=>kt,LayoutManagementContext:()=>Nt,LayoutManagementProvider:()=>pn,LeftNav:()=>hn,LoginPanel:()=>ma,SaveLayoutPanel:()=>Tt,SessionEditingForm:()=>fn,Shell:()=>xn,ShellContextProvider:()=>Sn,SidePanel:()=>Rt,ThemeSwitch:()=>Mn,getAuthDetailsFromCookies:()=>Fe,getAuthModeFromCookies:()=>Wt,isTableSchema:()=>Cn,isWildcardSchema:()=>bn,logout:()=>yt,redirectToLogin:()=>Gt,useLayoutManager:()=>me,useShellContext:()=>Pn,useShellLayout:()=>Bt});module.exports=pa(En);var Qt=require("react"),Xt=require("@vuu-ui/vuu-ui-controls"),Kt=M(require("clsx"));var Q=require("react"),oe=require("@salt-ds/core"),vt=require("@vuu-ui/vuu-ui-controls");var qt=require("react"),x=require("react/jsx-runtime"),Jt=()=>(0,qt.useMemo)(()=>(0,x.jsxs)("svg",{width:"184",height:"90",viewBox:"0 0 184 90",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,x.jsxs)("g",{clipPath:"url(#clip0_1173_59965)",children:[(0,x.jsx)("path",{d:"M77.0775 31.1019L69.4572 15.1795L66.3997 13.7093L47.6353 44.165L75.7224 61.2361L81.8124 51.2694L77.0775 31.1019Z",fill:"url(#paint0_linear_1173_59965)"}),(0,x.jsx)("path",{d:"M82.4101 49.7431C81.0488 51.8314 79.1993 53.648 76.8897 54.9809C74.2954 56.4792 71.4601 57.194 68.6623 57.194C63.3422 57.194 58.1597 54.6188 55.0209 49.971L30.5358 7.8193L30.5232 7.84116C25.8791 0.274825 16.0118 -2.26289 8.27258 2.21011C0.411306 6.74866 -2.26753 16.7872 2.28587 24.625L35.5054 81.8189C36.9856 84.3691 39.0542 86.3668 41.4358 87.7527C41.4545 87.7652 41.4733 87.7777 41.4921 87.7902C41.5015 87.7964 41.514 87.8027 41.5234 87.8089C42.6312 88.4457 43.8079 88.942 45.0253 89.3072C45.116 89.3353 45.2099 89.3634 45.3007 89.3883C45.7388 89.5101 46.1801 89.6193 46.6276 89.7067C46.7121 89.7223 46.7966 89.7317 46.8811 89.7473C47.241 89.8097 47.604 89.8628 47.967 89.9003C48.111 89.9159 48.2549 89.9315 48.3989 89.9408C48.8151 89.9752 49.2313 89.997 49.6507 90.0001C49.6726 90.0001 49.6945 90.0001 49.7132 90.0001C49.7195 90.0001 49.7226 90.0001 49.7289 90.0001C49.7352 90.0001 49.7383 90.0001 49.7445 90.0001C50.1983 90.0001 50.6552 89.9752 51.109 89.9377C51.2123 89.9283 51.3155 89.919 51.422 89.9065C51.8663 89.8597 52.3107 89.8004 52.7551 89.7192C52.7614 89.7192 52.7676 89.7192 52.7739 89.7192C53.2621 89.6287 53.7503 89.5101 54.2322 89.3727C54.2635 89.3634 54.2917 89.354 54.323 89.3446C55.024 89.1418 55.7156 88.8889 56.3978 88.5861C56.4104 88.5799 56.426 88.5736 56.4385 88.5674C56.958 88.3364 57.4712 88.0836 57.9751 87.7933C58.4852 87.4999 58.9703 87.1815 59.4334 86.8413C59.8371 86.5478 60.2252 86.2357 60.6039 85.9048C61.0639 85.499 61.4989 85.0745 61.9026 84.6282C62.2062 84.2942 62.4972 83.9446 62.7757 83.5825C62.8665 83.4639 62.951 83.3421 63.0355 83.2235C63.2264 82.9613 63.4079 82.6929 63.5831 82.4182C63.6739 82.2746 63.7646 82.1342 63.8523 81.9906C63.8867 81.9344 63.9242 81.8813 63.9555 81.8251L82.5854 49.7525H82.4039L82.4101 49.7431Z",fill:"url(#paint1_linear_1173_59965)"}),(0,x.jsx)("path",{d:"M82.8264 32.8436L81.4181 30.4464L75.3375 19.1687L72.5178 14.3929C71.9858 13.1225 70.7309 12.2266 69.26 12.2266C67.3104 12.2266 65.7331 13.8029 65.7331 15.7445C65.7331 16.4031 65.924 17.0086 66.2401 17.5362L66.2025 17.5611L77.1557 36.1617C78.4764 38.4372 78.83 41.0873 78.1509 43.6281C77.4718 46.169 75.8445 48.2915 73.5631 49.6119C72.0609 50.4797 70.3553 50.9385 68.6341 50.9385C65.1166 50.9385 61.84 49.0563 60.0812 46.0285L44.3368 19.2654H44.3681L37.7179 7.81917L37.7054 7.84102C37.5896 7.65061 37.455 7.47893 37.333 7.29477L37.1452 6.97326C37.1452 6.97326 37.1296 6.98262 37.1233 6.98887C34.0001 2.55332 29.0054 0.0780356 23.8512 0.0187285V0H15.3515V0.0436999C21.2881 -0.368328 27.2247 2.46593 30.5232 7.84102L30.5357 7.81917L55.0177 49.974C58.1566 54.6187 63.3422 57.197 68.6592 57.197C71.4569 57.197 74.2922 56.4853 76.8866 54.9839C79.1961 53.651 81.0425 51.8312 82.407 49.7461H82.5885L82.5259 49.8523C83.399 48.4695 84.0687 46.9462 84.5006 45.3231C85.6304 41.0904 85.042 36.6705 82.8201 32.8467L82.8264 32.8436Z",fill:"#F37880"}),(0,x.jsxs)("g",{opacity:"0.86",children:[(0,x.jsx)("path",{d:"M66.1994 17.5642L77.1526 36.1648C78.4732 38.4403 78.8269 41.0904 78.1478 43.6313C77.7347 45.1795 76.9648 46.5716 75.9133 47.7234C77.2903 46.4686 78.2823 44.8486 78.7737 43.007C79.4527 40.4661 79.0991 37.816 77.7785 35.5405L66.8253 16.94L66.8628 16.915C66.5467 16.3875 66.3558 15.7819 66.3558 15.1233C66.3558 14.3117 66.6344 13.5657 67.0975 12.9695C66.2651 13.6125 65.7299 14.6176 65.7299 15.7476C65.7299 16.4062 65.9208 17.0118 66.2369 17.5393L66.1994 17.5642Z",fill:"white"}),(0,x.jsx)("path",{d:"M82.5382 49.8335L82.5291 49.8487C82.5291 49.8487 82.5352 49.8365 82.5413 49.8304C82.5413 49.8304 82.5413 49.8304 82.5413 49.8335H82.5382Z",fill:"white"}),(0,x.jsx)("path",{d:"M77.5156 54.3596C74.9213 55.8579 72.0859 56.5727 69.2882 56.5727C63.9681 56.5727 58.7856 53.9975 55.6467 49.3497L31.1616 7.19488L31.1491 7.21673C28.9053 3.56154 25.4441 1.08626 21.5917 0H15.3515V0.0436999C21.2881 -0.368328 27.2247 2.46593 30.5232 7.84102L30.5357 7.81917L55.0177 49.974C58.1566 54.6187 63.3422 57.197 68.6592 57.197C71.4569 57.197 74.2922 56.4853 76.8866 54.9839C78.2698 54.1848 79.4809 53.2109 80.5293 52.1122C79.6311 52.9581 78.6266 53.7166 77.5125 54.3596H77.5156Z",fill:"white"})]})]}),(0,x.jsx)("path",{d:"M117.046 58.661C116.362 58.661 115.792 58.509 115.336 58.205C114.906 57.8757 114.551 57.3943 114.272 56.761L104.354 34.493C104.076 33.8597 104 33.3023 104.126 32.821C104.253 32.3397 104.519 31.9597 104.924 31.681C105.33 31.4023 105.811 31.263 106.368 31.263C107.103 31.263 107.648 31.4277 108.002 31.757C108.382 32.061 108.699 32.5297 108.952 33.163L117.958 54.025H116.324L125.292 33.125C125.571 32.517 125.9 32.061 126.28 31.757C126.66 31.4277 127.192 31.263 127.876 31.263C128.434 31.263 128.89 31.4023 129.244 31.681C129.624 31.9597 129.865 32.3397 129.966 32.821C130.068 33.3023 129.979 33.8597 129.7 34.493L119.782 56.761C119.504 57.3943 119.149 57.8757 118.718 58.205C118.313 58.509 117.756 58.661 117.046 58.661Z",fill:"white"}),(0,x.jsx)("path",{d:"M144.63 58.737C142.781 58.737 141.147 58.4963 139.728 58.015C138.335 57.5337 137.157 56.8243 136.194 55.887C135.232 54.9243 134.51 53.7337 134.028 52.315C133.547 50.8963 133.306 49.2497 133.306 47.375V33.733C133.306 32.897 133.509 32.2763 133.914 31.871C134.345 31.4657 134.953 31.263 135.738 31.263C136.524 31.263 137.119 31.4657 137.524 31.871C137.955 32.2763 138.17 32.897 138.17 33.733V47.337C138.17 49.7437 138.715 51.555 139.804 52.771C140.919 53.9617 142.528 54.557 144.63 54.557C146.733 54.557 148.329 53.9617 149.418 52.771C150.508 51.555 151.052 49.7437 151.052 47.337V33.733C151.052 32.897 151.255 32.2763 151.66 31.871C152.091 31.4657 152.699 31.263 153.484 31.263C154.244 31.263 154.827 31.4657 155.232 31.871C155.663 32.2763 155.878 32.897 155.878 33.733V47.375C155.878 49.8577 155.448 51.9477 154.586 53.645C153.75 55.3423 152.496 56.6217 150.824 57.483C149.152 58.319 147.088 58.737 144.63 58.737Z",fill:"white"}),(0,x.jsx)("path",{d:"M172.685 58.737C170.836 58.737 169.202 58.4963 167.783 58.015C166.39 57.5337 165.212 56.8243 164.249 55.887C163.286 54.9243 162.564 53.7337 162.083 52.315C161.602 50.8963 161.361 49.2497 161.361 47.375V33.733C161.361 32.897 161.564 32.2763 161.969 31.871C162.4 31.4657 163.008 31.263 163.793 31.263C164.578 31.263 165.174 31.4657 165.579 31.871C166.01 32.2763 166.225 32.897 166.225 33.733V47.337C166.225 49.7437 166.77 51.555 167.859 52.771C168.974 53.9617 170.582 54.557 172.685 54.557C174.788 54.557 176.384 53.9617 177.473 52.771C178.562 51.555 179.107 49.7437 179.107 47.337V33.733C179.107 32.897 179.31 32.2763 179.715 31.871C180.146 31.4657 180.754 31.263 181.539 31.263C182.299 31.263 182.882 31.4657 183.287 31.871C183.718 32.2763 183.933 32.897 183.933 33.733V47.375C183.933 49.8577 183.502 51.9477 182.641 53.645C181.805 55.3423 180.551 56.6217 178.879 57.483C177.207 58.319 175.142 58.737 172.685 58.737Z",fill:"white"}),(0,x.jsxs)("defs",{children:[(0,x.jsxs)("linearGradient",{id:"paint0_linear_1173_59965",x1:"47.6353",y1:"37.4727",x2:"81.8124",y2:"37.4727",gradientUnits:"userSpaceOnUse",children:[(0,x.jsx)("stop",{stopColor:"#4906A5"}),(0,x.jsx)("stop",{offset:"1",stopColor:"#D3423A"})]}),(0,x.jsxs)("linearGradient",{id:"paint1_linear_1173_59965",x1:"0.0670626",y1:"45.0017",x2:"82.5916",y2:"45.0017",gradientUnits:"userSpaceOnUse",children:[(0,x.jsx)("stop",{stopColor:"#7C06A5"}),(0,x.jsx)("stop",{offset:"1",stopColor:"#D3423A"})]}),(0,x.jsx)("clipPath",{id:"clip0_1173_59965",children:(0,x.jsx)("rect",{width:"85",height:"90",fill:"white",transform:"translate(0.0670471)"})})]})]}),[]);var _t=M(require("clsx"));var N=require("react/jsx-runtime"),se="vuuLoginPanel",ma=({appName:e="Demo App",className:t,requirePassword:o=!0,onSubmit:a,...n})=>{let[r,i]=(0,Q.useState)(""),[s,u]=(0,Q.useState)(""),c=(0,Q.useRef)(null),d=()=>{a(r,s)},h=g=>{i(g.target.value)},b=g=>{u(g.target.value)},y=(0,Q.useCallback)(()=>{o||a(r)},[a,o,r]),p=(0,Q.useCallback)(()=>{r&&a(r,s)},[a,s,r]),l=r.trim()!==""&&(o===!1||s.trim()!=="");return(0,Q.useEffect)(()=>{var g;console.log("inputRef",{input:c.current}),(g=c.current)==null||g.focus()},[]),(0,N.jsxs)("div",{...n,className:(0,_t.default)(se,t),children:[(0,N.jsxs)("div",{className:`${se}-branding`,children:[(0,N.jsx)(Jt,{}),(0,N.jsx)("div",{className:`${se}-appName`,children:e})]}),(0,N.jsxs)("div",{className:`${se}-form`,children:[(0,N.jsx)("div",{className:`${se}-title`,children:"Welcome Back"}),(0,N.jsxs)(oe.FormField,{children:[(0,N.jsx)(oe.FormFieldLabel,{children:"Username"}),(0,N.jsx)(vt.VuuInput,{value:r,id:"text-username",inputRef:c,onChange:h,onCommit:y})]}),o?(0,N.jsxs)(oe.FormField,{children:[(0,N.jsx)(oe.FormFieldLabel,{children:"Password"}),(0,N.jsx)(vt.VuuInput,{className:`${se}-password`,inputProps:{type:"password"},value:s,id:"text-password",onChange:b,onCommit:p,endAdornment:(0,N.jsx)("span",{"data-icon":"eye",style:{cursor:"pointer"}})})]}):null,(0,N.jsx)(oe.Button,{className:`${se}-login`,disabled:!l,onClick:d,variant:"cta",children:"Login"})]})]})};var Ge=require("@vuu-ui/vuu-utils"),Wt=()=>{let e=(0,Ge.getCookieValue)("vuu-auth-mode");return e!=null?e:""},Fe=()=>{let e=(0,Ge.getCookieValue)("vuu-username"),t=(0,Ge.getCookieValue)("vuu-auth-token");return[e,t]},ha=()=>Wt()==="login"?"login.html":"demo.html",Gt=(e=ha())=>{window.location.href=e},yt=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",Gt(e)};var Ae=require("@salt-ds/core");var K=require("react/jsx-runtime"),He="vuuAppHeader",xt=({className:e,layoutId:t,loginUrl:o,onNavigate:a,onSwitchTheme:n,themeMode:r,user:i,...s})=>{let u=(0,Kt.default)(He,e),c=(0,Qt.useCallback)(()=>{yt(o)},[o]);return(0,K.jsxs)(Xt.Toolbar,{alignItems:"end",className:u,showSeparators:!0,...s,children:[(0,K.jsx)(Ae.Button,{className:`${He}-menuItem`,variant:"secondary",children:"Help"}),(0,K.jsxs)(Ae.Button,{className:`${He}-menuItem`,variant:"secondary",children:["History ",(0,K.jsx)("span",{"data-icon":"history"})]}),(0,K.jsxs)(Ae.Button,{className:`${He}-menuItem`,variant:"secondary",children:["View ",(0,K.jsx)("span",{"data-icon":"settings"})]}),(0,K.jsx)(Ae.Button,{className:`${He}-menuItem`,onClick:c,variant:"secondary",children:"Log out"})]})};var be=M(require("react")),jt=M(require("clsx"));var ue=require("react/jsx-runtime"),ga=({connectionStatus:e,className:t,element:o="span",...a})=>{let[n,r]=(0,be.useState)("vuuConnectingStatus");(0,be.useEffect)(()=>{switch(e){case"connected":case"reconnected":r("vuuActiveStatus");break;case"connecting":r("vuuConnectingStatus");break;case"disconnected":r("vuuDisconnectedStatus");break;default:break}},[e]);let i=be.default.createElement(o,{...a,className:(0,jt.default)("vuuStatus vuuIcon",n,t)});return(0,ue.jsx)(ue.Fragment,{children:(0,ue.jsxs)("div",{className:"vuuStatus-container salt-theme",children:[i,(0,ue.jsxs)("div",{className:"vuuStatus-text",children:["Status: ",e.toUpperCase()]})]})})};var ce=M(require("react")),ao=require("@vuu-ui/vuu-layout");var Yt=M(require("react")),le=require("react/jsx-runtime"),Qe=class extends Yt.default.Component{constructor(t){super(t),this.state={errorMessage:null}}static getDerivedStateFromError(t){return{errorMessage:t.message}}componentDidCatch(t,o){console.log(`error creating component at ${this.props.url}`),console.log(t,o)}render(){return this.state.errorMessage?(0,le.jsxs)(le.Fragment,{children:[(0,le.jsx)("h1",{children:"An error occured while creating component."}),(0,le.jsx)("p",{children:this.state.errorMessage})]}):this.props.children}};var to=require("react/jsx-runtime"),eo=()=>(0,to.jsx)("div",{className:"hwLoader"});var oo=async e=>{let t=new CSSStyleSheet;return fetch(e).then(o=>o.text()).then(o=>t.replace(o))};var Re=require("react/jsx-runtime"),Xe=new Map,fa=e=>{(0,ce.useEffect)(()=>()=>{Xe.delete(e)},[e]),Xe.has(e)||Xe.set(e,ce.default.lazy(()=>import(e)));let t=Xe.get(e);if(t)return t;throw Error(`Unable to load Lazy Feature at url ${e}`)};function va({url:e,css:t,ComponentProps:o,...a}){t&&oo(t).then(r=>{document.adoptedStyleSheets=[...document.adoptedStyleSheets,r]});let n=fa(e);return(0,Re.jsx)(Qe,{url:e,children:(0,Re.jsx)(ce.Suspense,{fallback:(0,Re.jsx)(eo,{}),children:(0,Re.jsx)(n,{...a,...o})})})}var Be=ce.default.memo(va);Be.displayName="Feature";(0,ao.registerComponent)("Feature",Be,"view");var Se=require("@vuu-ui/vuu-ui-controls");function no(e,t){if(e.match(/^[a-z]+:\/\//i))return e;if(e.match(/^\/\//))return window.location.protocol+e;if(e.match(/^[a-z]+:/i))return e;let o=document.implementation.createHTMLDocument(),a=o.createElement("base"),n=o.createElement("a");return o.head.appendChild(a),o.body.appendChild(n),t&&(a.href=t),n.href=e,n.href}var ro=(()=>{let e=0,t=()=>`0000${(Math.random()*36**4<<0).toString(36)}`.slice(-4);return()=>(e+=1,`u${t()}${e}`)})();function H(e){let t=[];for(let o=0,a=e.length;o<a;o++)t.push(e[o]);return t}function Ke(e,t){let a=(e.ownerDocument.defaultView||window).getComputedStyle(e).getPropertyValue(t);return a?parseFloat(a.replace("px","")):0}function ya(e){let t=Ke(e,"border-left-width"),o=Ke(e,"border-right-width");return e.clientWidth+t+o}function xa(e){let t=Ke(e,"border-top-width"),o=Ke(e,"border-bottom-width");return e.clientHeight+t+o}function bt(e,t={}){let o=t.width||ya(e),a=t.height||xa(e);return{width:o,height:a}}function io(){let e,t;try{t=process}catch{}let o=t&&t.env?t.env.devicePixelRatio:null;return o&&(e=parseInt(o,10),Number.isNaN(e)&&(e=1)),e||window.devicePixelRatio||1}var F=16384;function so(e){(e.width>F||e.height>F)&&(e.width>F&&e.height>F?e.width>e.height?(e.height*=F/e.width,e.width=F):(e.width*=F/e.height,e.height=F):e.width>F?(e.height*=F/e.width,e.width=F):(e.width*=F/e.height,e.height=F))}function Ce(e){return new Promise((t,o)=>{let a=new Image;a.decode=()=>t(a),a.onload=()=>t(a),a.onerror=o,a.crossOrigin="anonymous",a.decoding="async",a.src=e})}async function ba(e){return Promise.resolve().then(()=>new XMLSerializer().serializeToString(e)).then(encodeURIComponent).then(t=>`data:image/svg+xml;charset=utf-8,${t}`)}async function uo(e,t,o){let a="http://www.w3.org/2000/svg",n=document.createElementNS(a,"svg"),r=document.createElementNS(a,"foreignObject");return n.setAttribute("width",`${t}`),n.setAttribute("height",`${o}`),n.setAttribute("viewBox",`0 0 ${t} ${o}`),r.setAttribute("width","100%"),r.setAttribute("height","100%"),r.setAttribute("x","0"),r.setAttribute("y","0"),r.setAttribute("externalResourcesRequired","true"),n.appendChild(r),r.appendChild(e),ba(n)}var D=(e,t)=>{if(e instanceof t)return!0;let o=Object.getPrototypeOf(e);return o===null?!1:o.constructor.name===t.name||D(o,t)};function Ca(e){let t=e.getPropertyValue("content");return`${e.cssText} content: '${t.replace(/'|"/g,"")}';`}function wa(e){return H(e).map(t=>{let o=e.getPropertyValue(t),a=e.getPropertyPriority(t);return`${t}: ${o}${a?" !important":""};`}).join(" ")}function La(e,t,o){let a=`.${e}:${t}`,n=o.cssText?Ca(o):wa(o);return document.createTextNode(`${a}{${n}}`)}function lo(e,t,o){let a=window.getComputedStyle(e,o),n=a.getPropertyValue("content");if(n===""||n==="none")return;let r=ro();try{t.className=`${t.className} ${r}`}catch{return}let i=document.createElement("style");i.appendChild(La(r,o,a)),t.appendChild(i)}function co(e,t){lo(e,t,":before"),lo(e,t,":after")}var po="application/font-woff",mo="image/jpeg",Sa={woff:po,woff2:po,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:mo,jpeg:mo,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml",webp:"image/webp"};function Pa(e){let t=/\.([^./]*?)$/g.exec(e);return t?t[1]:""}function we(e){let t=Pa(e).toLowerCase();return Sa[t]||""}function Ta(e){return e.split(/,/)[1]}function $e(e){return e.search(/^(data:)/)!==-1}function wt(e,t){return`data:${t};base64,${e}`}async function Lt(e,t,o){let a=await fetch(e,t);if(a.status===404)throw new Error(`Resource "${a.url}" not found`);let n=await a.blob();return new Promise((r,i)=>{let s=new FileReader;s.onerror=i,s.onloadend=()=>{try{r(o({res:a,result:s.result}))}catch(u){i(u)}},s.readAsDataURL(n)})}var Ct={};function Ma(e,t,o){let a=e.replace(/\?.*/,"");return o&&(a=e),/ttf|otf|eot|woff2?/i.test(a)&&(a=a.replace(/.*\//,"")),t?`[${t}]${a}`:a}async function Le(e,t,o){let a=Ma(e,t,o.includeQueryParams);if(Ct[a]!=null)return Ct[a];o.cacheBust&&(e+=(/\?/.test(e)?"&":"?")+new Date().getTime());let n;try{let r=await Lt(e,o.fetchRequestInit,({res:i,result:s})=>(t||(t=i.headers.get("Content-Type")||""),Ta(s)));n=wt(r,t)}catch(r){n=o.imagePlaceholder||"";let i=`Failed to fetch resource: ${e}`;r&&(i=typeof r=="string"?r:r.message),i&&console.warn(i)}return Ct[a]=n,n}async function Ea(e){let t=e.toDataURL();return t==="data:,"?e.cloneNode(!1):Ce(t)}async function Na(e,t){if(e.currentSrc){let r=document.createElement("canvas"),i=r.getContext("2d");r.width=e.clientWidth,r.height=e.clientHeight,i==null||i.drawImage(e,0,0,r.width,r.height);let s=r.toDataURL();return Ce(s)}let o=e.poster,a=we(o),n=await Le(o,a,t);return Ce(n)}async function Da(e){var t;try{if(!((t=e==null?void 0:e.contentDocument)===null||t===void 0)&&t.body)return await Ie(e.contentDocument.body,{},!0)}catch{}return e.cloneNode(!1)}async function ka(e,t){return D(e,HTMLCanvasElement)?Ea(e):D(e,HTMLVideoElement)?Na(e,t):D(e,HTMLIFrameElement)?Da(e):e.cloneNode(!1)}var Va=e=>e.tagName!=null&&e.tagName.toUpperCase()==="SLOT";async function Fa(e,t,o){var a,n;let r=[];return Va(e)&&e.assignedNodes?r=H(e.assignedNodes()):D(e,HTMLIFrameElement)&&(!((a=e.contentDocument)===null||a===void 0)&&a.body)?r=H(e.contentDocument.body.childNodes):r=H(((n=e.shadowRoot)!==null&&n!==void 0?n:e).childNodes),r.length===0||D(e,HTMLVideoElement)||await r.reduce((i,s)=>i.then(()=>Ie(s,o)).then(u=>{u&&t.appendChild(u)}),Promise.resolve()),t}function Ha(e,t){let o=t.style;if(!o)return;let a=window.getComputedStyle(e);a.cssText?(o.cssText=a.cssText,o.transformOrigin=a.transformOrigin):H(a).forEach(n=>{let r=a.getPropertyValue(n);n==="font-size"&&r.endsWith("px")&&(r=`${Math.floor(parseFloat(r.substring(0,r.length-2)))-.1}px`),D(e,HTMLIFrameElement)&&n==="display"&&r==="inline"&&(r="block"),n==="d"&&t.getAttribute("d")&&(r=`path(${t.getAttribute("d")})`),o.setProperty(n,r,a.getPropertyPriority(n))})}function Aa(e,t){D(e,HTMLTextAreaElement)&&(t.innerHTML=e.value),D(e,HTMLInputElement)&&t.setAttribute("value",e.value)}function Ra(e,t){if(D(e,HTMLSelectElement)){let o=t,a=Array.from(o.children).find(n=>e.value===n.getAttribute("value"));a&&a.setAttribute("selected","")}}function Ba(e,t){return D(t,Element)&&(Ha(e,t),co(e,t),Aa(e,t),Ra(e,t)),t}async function $a(e,t){let o=e.querySelectorAll?e.querySelectorAll("use"):[];if(o.length===0)return e;let a={};for(let r=0;r<o.length;r++){let s=o[r].getAttribute("xlink:href");if(s){let u=e.querySelector(s),c=document.querySelector(s);!u&&c&&!a[s]&&(a[s]=await Ie(c,t,!0))}}let n=Object.values(a);if(n.length){let r="http://www.w3.org/1999/xhtml",i=document.createElementNS(r,"svg");i.setAttribute("xmlns",r),i.style.position="absolute",i.style.width="0",i.style.height="0",i.style.overflow="hidden",i.style.display="none";let s=document.createElementNS(r,"defs");i.appendChild(s);for(let u=0;u<n.length;u++)s.appendChild(n[u]);e.appendChild(i)}return e}async function Ie(e,t,o){return!o&&t.filter&&!t.filter(e)?null:Promise.resolve(e).then(a=>ka(a,t)).then(a=>Fa(e,a,t)).then(a=>Ba(e,a)).then(a=>$a(a,t))}var ho=/url\((['"]?)([^'"]+?)\1\)/g,Ia=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,Oa=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function za(e){let t=e.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1");return new RegExp(`(url\\(['"]?)(${t})(['"]?\\))`,"g")}function Ua(e){let t=[];return e.replace(ho,(o,a,n)=>(t.push(n),o)),t.filter(o=>!$e(o))}async function Za(e,t,o,a,n){try{let r=o?no(t,o):t,i=we(t),s;if(n){let u=await n(r);s=wt(u,i)}else s=await Le(r,i,a);return e.replace(za(t),`$1${s}$3`)}catch{}return e}function qa(e,{preferredFontFormat:t}){return t?e.replace(Oa,o=>{for(;;){let[a,,n]=Ia.exec(o)||[];if(!n)return"";if(n===t)return`src: ${a};`}}):e}function St(e){return e.search(ho)!==-1}async function je(e,t,o){if(!St(e))return e;let a=qa(e,o);return Ua(a).reduce((r,i)=>r.then(s=>Za(s,i,t,o)),Promise.resolve(a))}async function Ye(e,t,o){var a;let n=(a=t.style)===null||a===void 0?void 0:a.getPropertyValue(e);if(n){let r=await je(n,null,o);return t.style.setProperty(e,r,t.style.getPropertyPriority(e)),!0}return!1}async function Ja(e,t){await Ye("background",e,t)||await Ye("background-image",e,t),await Ye("mask",e,t)||await Ye("mask-image",e,t)}async function _a(e,t){let o=D(e,HTMLImageElement);if(!(o&&!$e(e.src))&&!(D(e,SVGImageElement)&&!$e(e.href.baseVal)))return;let a=o?e.src:e.href.baseVal,n=await Le(a,we(a),t);await new Promise((r,i)=>{e.onload=r,e.onerror=i;let s=e;s.decode&&(s.decode=r),s.loading==="lazy"&&(s.loading="eager"),o?(e.srcset="",e.src=n):e.href.baseVal=n})}async function Wa(e,t){let a=H(e.childNodes).map(n=>Pt(n,t));await Promise.all(a).then(()=>e)}async function Pt(e,t){D(e,Element)&&(await Ja(e,t),await _a(e,t),await Wa(e,t))}function go(e,t){let{style:o}=e;t.backgroundColor&&(o.backgroundColor=t.backgroundColor),t.width&&(o.width=`${t.width}px`),t.height&&(o.height=`${t.height}px`);let a=t.style;return a!=null&&Object.keys(a).forEach(n=>{o[n]=a[n]}),e}var fo={};async function vo(e){let t=fo[e];if(t!=null)return t;let a=await(await fetch(e)).text();return t={url:e,cssText:a},fo[e]=t,t}async function yo(e,t){let o=e.cssText,a=/url\(["']?([^"')]+)["']?\)/g,r=(o.match(/url\([^)]+\)/g)||[]).map(async i=>{let s=i.replace(a,"$1");return s.startsWith("https://")||(s=new URL(s,e.url).href),Lt(s,t.fetchRequestInit,({result:u})=>(o=o.replace(i,`url(${u})`),[i,u]))});return Promise.all(r).then(()=>o)}function xo(e){if(e==null)return[];let t=[],o=/(\/\*[\s\S]*?\*\/)/gi,a=e.replace(o,""),n=new RegExp("((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})","gi");for(;;){let u=n.exec(a);if(u===null)break;t.push(u[0])}a=a.replace(n,"");let r=/@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi,i="((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})",s=new RegExp(i,"gi");for(;;){let u=r.exec(a);if(u===null){if(u=s.exec(a),u===null)break;r.lastIndex=s.lastIndex}else s.lastIndex=r.lastIndex;t.push(u[0])}return t}async function Ga(e,t){let o=[],a=[];return e.forEach(n=>{if("cssRules"in n)try{H(n.cssRules||[]).forEach((r,i)=>{if(r.type===CSSRule.IMPORT_RULE){let s=i+1,u=r.href,c=vo(u).then(d=>yo(d,t)).then(d=>xo(d).forEach(h=>{try{n.insertRule(h,h.startsWith("@import")?s+=1:n.cssRules.length)}catch(b){console.error("Error inserting rule from remote css",{rule:h,error:b})}})).catch(d=>{console.error("Error loading remote css",d.toString())});a.push(c)}})}catch(r){let i=e.find(s=>s.href==null)||document.styleSheets[0];n.href!=null&&a.push(vo(n.href).then(s=>yo(s,t)).then(s=>xo(s).forEach(u=>{i.insertRule(u,n.cssRules.length)})).catch(s=>{console.error("Error loading remote stylesheet",s)})),console.error("Error inlining remote css file",r)}}),Promise.all(a).then(()=>(e.forEach(n=>{if("cssRules"in n)try{H(n.cssRules||[]).forEach(r=>{o.push(r)})}catch(r){console.error(`Error while reading CSS rules from ${n.href}`,r)}}),o))}function Qa(e){return e.filter(t=>t.type===CSSRule.FONT_FACE_RULE).filter(t=>St(t.style.getPropertyValue("src")))}async function Xa(e,t){if(e.ownerDocument==null)throw new Error("Provided element is not within a Document");let o=H(e.ownerDocument.styleSheets),a=await Ga(o,t);return Qa(a)}async function bo(e,t){let o=await Xa(e,t);return(await Promise.all(o.map(n=>{let r=n.parentStyleSheet?n.parentStyleSheet.href:null;return je(n.cssText,r,t)}))).join(`
|
|
2
|
+
`)}async function Co(e,t){let o=t.fontEmbedCSS!=null?t.fontEmbedCSS:t.skipFonts?null:await bo(e,t);if(o){let a=document.createElement("style"),n=document.createTextNode(o);a.appendChild(n),e.firstChild?e.insertBefore(a,e.firstChild):e.appendChild(a)}}async function Ka(e,t={}){let{width:o,height:a}=bt(e,t),n=await Ie(e,t,!0);return await Co(n,t),await Pt(n,t),go(n,t),await uo(n,o,a)}async function ja(e,t={}){let{width:o,height:a}=bt(e,t),n=await Ka(e,t),r=await Ce(n),i=document.createElement("canvas"),s=i.getContext("2d"),u=t.pixelRatio||io(),c=t.canvasWidth||o,d=t.canvasHeight||a;return i.width=c*u,i.height=d*u,t.skipAutoScale||so(i),i.style.width=`${c}`,i.style.height=`${d}`,t.backgroundColor&&(s.fillStyle=t.backgroundColor,s.fillRect(0,0,i.width,i.height)),s.drawImage(r,0,0,i.width,i.height),i}async function wo(e,t={}){return(await ja(e,t)).toDataURL()}var Lo=e=>new Promise((t,o)=>{wo(e,{cacheBust:!0}).then(a=>{a||o(new Error("No Screenshot available")),t(a)}).catch(a=>{console.error("the following error occurred while taking a screenshot of a DOMNode",a),o(new Error("Error taking screenshot"))})});var E=require("@salt-ds/core"),Z=require("react");var v=require("react/jsx-runtime"),A="saveLayoutPanel",et=`${A}-formField`,Ya=["Group 1","Group 2","Group 3","Group 4","Group 5"],en=["Value 1","Value 2","Value 3"],So=["Value 1","Value 2","Value 3"],Tt=e=>{let{defaultTitle:t="",onCancel:o,onSave:a,componentId:n}=e,[r,i]=(0,Z.useState)(t),[s,u]=(0,Z.useState)(""),[c,d]=(0,Z.useState)([]),[h,b]=(0,Z.useState)(So[0]),[y,p]=(0,Z.useState)(),[l,g]=(0,Z.useState)(),[P]=Fe();(0,Z.useEffect)(()=>{n&&Lo(document.getElementById(n)).then(f=>{p(f)}).catch(f=>{g(f.message)})},[n]);let R=()=>{a({name:r,group:s,screenshot:y!=null?y:"",user:P})},k=(0,Z.useMemo)(()=>y?(0,v.jsx)("img",{className:`${A}-screenshot`,src:y,alt:"screenshot of current layout"}):l?(0,v.jsx)(E.Text,{children:l}):(0,v.jsx)("div",{className:"spinner"}),[y,l]);return(0,v.jsxs)("div",{className:`${A}-panelContainer`,children:[(0,v.jsxs)("div",{className:`${A}-panelContent`,children:[(0,v.jsxs)("div",{className:`${A}-formContainer`,children:[(0,v.jsxs)(E.FormField,{className:et,children:[(0,v.jsx)(E.FormFieldLabel,{children:"Group"}),(0,v.jsx)(Se.ComboBox,{source:Ya,allowFreeText:!0,InputProps:{inputProps:{className:`${A}-inputText`,placeholder:"Select Group or Enter New Name",onChange:f=>u(f.target.value)}},width:"100%",onSelectionChange:(f,V)=>u(V||"")})]}),(0,v.jsxs)(E.FormField,{className:et,children:[(0,v.jsx)(E.FormFieldLabel,{children:"Layout Name"}),(0,v.jsx)(E.Input,{inputProps:{className:`${A}-inputText`,placeholder:"Enter Layout Name"},onChange:f=>i(f.target.value),value:r})]}),(0,v.jsxs)(E.FormField,{className:et,children:[(0,v.jsx)(E.FormFieldLabel,{children:"Some Layout Setting"}),(0,v.jsx)("div",{className:`${A}-settingsGroup`,children:en.map((f,V)=>(0,v.jsx)(Se.Checkbox,{onToggle:()=>d(T=>T.includes(f)?T.filter(B=>B!==f):[...T,f]),checked:c.includes(f),label:f},V))})]}),(0,v.jsxs)(E.FormField,{className:et,children:[(0,v.jsx)(E.FormFieldLabel,{children:"Some Layout Setting"}),(0,v.jsx)("div",{className:`${A}-settingsGroup`,children:So.map((f,V)=>(0,v.jsx)(Se.RadioButton,{onClick:()=>b(f),checked:h===f,label:f,groupName:"radioGroup"},V))})]})]}),(0,v.jsx)("div",{className:`${A}-screenshotContainer`,children:k})]}),(0,v.jsxs)("div",{className:`${A}-buttonsContainer`,children:[(0,v.jsx)(E.Button,{className:`${A}-cancelButton`,onClick:o,children:"Cancel"}),(0,v.jsx)(E.Button,{className:`${A}-saveButton`,onClick:R,disabled:r===""||s==="",children:"Save"})]})]})};var Uo=require("@vuu-ui/vuu-ui-controls");var C=M(require("react")),Ze=require("@vuu-ui/vuu-layout");var No=M(require("clsx")),Do=require("@vuu-ui/vuu-utils"),de=require("react");var tt=require("@salt-ds/core"),Po=M(require("clsx"));var Oe=require("react/jsx-runtime"),tn="vuuDialogHeader",To=({hideCloseButton:e=!1,title:t,onClose:o,...a})=>(0,Oe.jsxs)("div",{...a,className:(0,Po.default)(tn,"vuuToolbarProxy"),children:[(0,Oe.jsx)(tt.Text,{className:"dialogHeader",children:t}),!e&&(0,Oe.jsx)(tt.Button,{onClick:o,"data-align":"end","data-icon":"close",variant:"secondary"},"close")]});var ae=require("react");var Mt=(e,t,o,a,n,r)=>{let{bottom:i,height:s,left:u,right:c,top:d,width:h}=e.getBoundingClientRect();switch(t){case"below":return{left:u+o,top:i+a};case"right":return{left:c+o,top:d+a};case"below-center":return{left:u+h/2+o,top:i+a};case"below-right":return{left:u,minWidth:n,top:i+a};case"below-full-width":return{left:u+o,minWidth:n,top:i+a,width:h};case"center":return r?{left:h/2-r.width/2+o,top:s/2-r.height/2+a,visibility:"visible"}:{left:h/2+o,top:s/2+a,visibility:"hidden"};default:throw Error(`Popup getPositionRelativeToAnchor non-supported placement value ${t}`)}};var Mo=({anchorElement:e,minWidth:t,offsetLeft:o=0,offsetTop:a=0,placement:n,position:r})=>{let i=(0,ae.useRef)(null),[s,u]=(0,ae.useState)(r);(0,ae.useLayoutEffect)(()=>{if(n==="absolute"&&r)u(r);else if(e.current&&n!=="auto"){let d=i.current===null?void 0:i.current.getBoundingClientRect(),h=Mt(e.current,n,o,a,t,d);u(h)}},[e,t,o,a,n,r]);let c=(0,ae.useCallback)(d=>{if(i.current=d,d&&n==="center"&&e.current){let{height:h,width:b}=d.getBoundingClientRect();u(Mt(e.current,n,o,a,void 0,{height:h,width:b}))}},[e,o,a,n]);return{position:s,popupRef:n==="center"?c:void 0}};var Pe=require("react/jsx-runtime"),Eo="vuuDialog",on={current:document.body},an={},ko=({PopupProps:e=an,children:t,className:o,isOpen:a=!1,onClose:n,style:r,title:i,hideCloseButton:s=!1,...u})=>{let{anchorElement:c=on,offsetLeft:d=0,offsetTop:h=0,placement:b="auto"}=e,y=(0,de.useRef)(null),p=(0,de.useRef)(null),[l,g,P]=(0,Do.useThemeAttributes)(),{position:R}=Mo({anchorElement:c,offsetLeft:d,offsetTop:h,placement:b}),k=(0,de.useCallback)(()=>{n==null||n()},[n]);return(0,de.useLayoutEffect)(()=>{if(y.current){if(a){y.current.showModal();let{left:f,top:V}=y.current.getBoundingClientRect();p.current&&(p.current.style.cssText=`left:-${f}px;position:absolute;top:-${V}px;`)}else y.current.close();if(b.endsWith("center")){let{width:f}=y.current.getBoundingClientRect();y.current.style.marginLeft=`-${f/2}px`}}},[a,b]),(0,Pe.jsxs)("dialog",{...u,className:(0,No.default)(Eo,l),"data-mode":P,onClose:k,id:"vuu-dialog",ref:y,style:{...r,...R},children:[(0,Pe.jsx)(To,{hideCloseButton:s,onClose:k,title:i}),(0,Pe.jsx)("div",{className:`${Eo}-body`,children:t}),(0,Pe.jsx)("div",{id:"vuu-dialog-portal-root",ref:p})]})};var ot=require("react");var Fo=require("react/jsx-runtime"),Vo=()=>{let[e,t]=(0,ot.useState)(),o=(0,ot.useCallback)(()=>{t(void 0)},[]);return{dialog:e?(0,Fo.jsx)(ko,{className:"vuDialog",isOpen:!0,onClose:o,style:{maxHeight:500},title:e.title,hideCloseButton:e.hideCloseButton,children:e.content}):null,setDialogState:t}};var Te=require("react"),at=require("react/jsx-runtime"),Ho=(0,Te.createContext)(null),nn=({children:e,context:t,menuActionHandler:o,menuBuilder:a})=>{let n=(0,Te.useMemo)(()=>t!=null&&t.menuBuilders&&a?t.menuBuilders.concat(a):a?[a]:(t==null?void 0:t.menuBuilders)||[],[t,a]),r=(0,Te.useCallback)(i=>{var s;if(o!=null&&o(i)||(s=t==null?void 0:t.menuActionHandler)!=null&&s.call(t,i))return!0},[t,o]);return(0,at.jsx)(Ho.Provider,{value:{menuActionHandler:r,menuBuilders:n},children:e})},Ao=({children:e,label:t,menuActionHandler:o,menuBuilder:a})=>(0,at.jsx)(Ho.Consumer,{children:n=>(0,at.jsx)(nn,{context:n,label:t,menuActionHandler:o,menuBuilder:a,children:e})});var pe=M(require("react")),rn=M(require("clsx")),sn=require("@vuu-ui/vuu-utils");var Bo=require("react/jsx-runtime");var un=pe.default.createContext({notify:()=>"have you forgotten to provide a NotificationProvider?"});var Ro=()=>(0,pe.useContext)(un);var nt={layout:{type:"Component",id:"loading-main",props:{}}},rt={layout:{type:"Stack",id:"main-tabs",props:{className:"vuuShell-mainTabs",TabstripProps:{allowAddTab:!0,allowCloseTab:!0,allowRenameTab:!0,animateSelectionThumb:!1,location:"main-tab",variant:"primary"},preserve:!0,active:0},children:[{props:{id:"tab1",title:"Tab 1",className:"vuuShell-Placeholder"},type:"Placeholder"}]}};var ne=require("@vuu-ui/vuu-filters");var st=require("@vuu-ui/vuu-utils");var ln="layouts/metadata",cn="layouts/layouts",Me,it=class{constructor(t){this.username=Fe()[0];this.metadataSaveLocation=`${ln}/${this.username}`;this.layoutsSaveLocation=`${cn}/${this.username}`;Ut(this,Me,`api/vui/${this.username}`);this.loadLayouts=()=>new Promise(t=>{let o=(0,ne.getLocalEntity)(this.layoutsSaveLocation);t(o||[])});this.saveLayoutsWithMetadata=(t,o)=>{(0,ne.saveLocalEntity)(this.layoutsSaveLocation,t),(0,ne.saveLocalEntity)(this.metadataSaveLocation,o)};this.validateIds=async t=>Promise.all([this.validateId(t,"metadata").catch(o=>o.message),this.validateId(t,"layout").catch(o=>o.message)]).then(o=>{let a=o.filter(n=>n!==void 0).join("; ");if(a)throw new Error(a)});this.validateId=(t,o)=>new Promise((a,n)=>{(o==="metadata"?()=>this.loadMetadata():()=>this.loadLayouts())().then(i=>{switch(i.filter(u=>u.id===t).length){case 1:{a();break}case 0:{n(new Error(`No ${o} with ID ${t}`));break}default:n(new Error(`Non-unique ${o} with ID ${t}`))}})});t&&Zt(this,Me,t)}createLayout(t,o){return new Promise(a=>{Promise.all([this.loadLayouts(),this.loadMetadata()]).then(([n,r])=>{let i=(0,st.getUniqueId)(),s={...t,id:i,created:(0,st.formatDate)({date:"dd.mm.yyyy"})(new Date)};this.saveLayoutsWithMetadata([...n,{id:i,json:o}],[...r,s]),a(s)})})}updateLayout(t,o,a){return new Promise((n,r)=>{this.validateIds(t).then(()=>Promise.all([this.loadLayouts(),this.loadMetadata()])).then(([i,s])=>{let u=i.map(d=>d.id===t?{...d,json:a}:d),c=s.map(d=>d.id===t?{...d,...o}:d);this.saveLayoutsWithMetadata(u,c),n()}).catch(i=>r(i))})}deleteLayout(t){return new Promise((o,a)=>{this.validateIds(t).then(()=>Promise.all([this.loadLayouts(),this.loadMetadata()])).then(([n,r])=>{let i=n.filter(u=>u.id!==t),s=r.filter(u=>u.id!==t);this.saveLayoutsWithMetadata(i,s),o()}).catch(n=>a(n))})}loadLayout(t){return new Promise((o,a)=>{this.validateId(t,"layout").then(()=>this.loadLayouts()).then(n=>{let r=n.find(i=>i.id===t);r?o(r.json):a(new Error(`no layout found matching id ${t}`))}).catch(n=>a(n))})}loadMetadata(){return new Promise(t=>{let o=(0,ne.getLocalEntity)(this.metadataSaveLocation);t(o||[])})}loadApplicationJSON(){return new Promise(t=>{let o=(0,ne.getLocalEntity)(ft(this,Me));t(o||rt)})}saveApplicationJSON(t){return new Promise((o,a)=>{(0,ne.saveLocalEntity)(ft(this,Me),t)?o():a(new Error("Application Json failed to save"))})}};Me=new WeakMap;var ze=require("react");var Io=require("react/jsx-runtime"),$o=e=>{let{saveLayout:t}=me(),o=(0,ze.useCallback)(()=>{e(void 0)},[e]),a=(0,ze.useCallback)(i=>{t(i),e(void 0)},[t,e]),[n,r]=(0,ze.useMemo)(()=>[(i,s)=>{let u=i.split(" "),c=[];return u.includes("main-tab")&&c.push({label:"Save Layout",action:"save-layout",options:s},{label:"Layout Settings",action:"layout-settings",options:s}),c},i=>{var s,u;return console.log("menu action",{action:i}),i.menuId==="save-layout"?(e({content:(0,Io.jsx)(Tt,{onCancel:o,onSave:a,componentId:(s=i.options)==null?void 0:s.controlledComponentId,defaultTitle:(u=i.options)==null?void 0:u.controlledComponentTitle}),title:"Save Layout",hideCloseButton:!0}),!0):!1}],[o,a,e]);return{buildMenuOptions:n,handleMenuAction:r}};var Oo=require("react/jsx-runtime"),Et,Ue=()=>(Et===void 0&&(Et=new it),Et),Nt=C.default.createContext({getApplicationSettings:()=>{},layoutMetadata:[],saveLayout:()=>{},applicationJson:rt,saveApplicationLayout:()=>{},saveApplicationSettings:()=>{},loadLayoutById:()=>{}}),dn=(e,t)=>{var o;return((o=e.props)==null?void 0:o.title)!==void 0?e:{...e,props:{...e.props,title:t.name}}},pn=e=>{let[t,o]=(0,C.useState)([]),[,a]=(0,C.useState)({}),{notify:n}=Ro(),r=(0,C.useRef)(nt),i=(0,C.useCallback)((p,l=!0)=>{r.current=p,l&&a({})},[]),s=(0,C.useCallback)((p,l=!0)=>{i({...r.current,layout:p},l)},[i]),u=(0,C.useCallback)(p=>{i({...r.current,settings:{...r.current.settings,...p}},!1)},[i]);(0,C.useEffect)(()=>{let p=Ue();p.loadMetadata().then(l=>{o(l)}).catch(l=>{n({type:"error",header:"Failed to Load Layouts",body:"Could not load list of available layouts"}),console.error("Error occurred while retrieving metadata",l)}),p.loadApplicationJSON().then(l=>{i(l)}).catch(l=>{n({type:"error",header:"Failed to Load Layout",body:"Could not load your latest view"}),console.error("Error occurred while retrieving application layout",l)})},[n,i]);let c=(0,C.useCallback)(p=>{(0,Ze.isLayoutJSON)(p)?(s(p,!1),Ue().saveApplicationJSON(r.current)):console.error("Tried to save invalid application layout",p)},[s]),d=(0,C.useCallback)(p=>{let l=(0,Ze.resolveJSONPath)(r.current.layout,"#main-tabs.ACTIVE_CHILD");l&&(0,Ze.isLayoutJSON)(l)?Ue().createLayout(p,dn(l,p)).then(g=>{n({type:"success",header:"Layout Saved Successfully",body:`${g.name} saved successfully`}),o(P=>[...P,g])}).catch(g=>{n({type:"error",header:"Failed to Save Layout",body:`Failed to save layout ${p.name}`}),console.error("Error occurred while saving layout",g)}):(console.error("Tried to save invalid layout",l),n({type:"error",header:"Failed to Save Layout",body:"Cannot save invalid layout"}))},[n]),h=(0,C.useCallback)((p,l)=>{let{settings:g}=r.current;u(l?{...g,[l]:p}:p),Ue().saveApplicationJSON(r.current)},[u]),b=(0,C.useCallback)(p=>{let{settings:l}=r.current;return p?l==null?void 0:l[p]:l},[]),y=(0,C.useCallback)(p=>{Ue().loadLayout(p).then(l=>{var P,R;let{layout:g}=r.current;s({...g,children:(g.children||[]).concat(l),props:{...g.props,active:(R=(P=g.children)==null?void 0:P.length)!=null?R:0}})}).catch(l=>{n({type:"error",header:"Failed to Load Layout",body:"Failed to load the requested layout"}),console.error("Error occurred while loading layout",l)})},[n,s]);return(0,Oo.jsx)(Nt.Provider,{value:{getApplicationSettings:b,layoutMetadata:t,saveLayout:d,applicationJson:r.current,saveApplicationLayout:c,saveApplicationSettings:h,loadLayoutById:y},children:e.children})},me=()=>(0,C.useContext)(Nt);var j=require("react/jsx-runtime"),ut="vuuLayoutTile",zo=e=>{let{metadata:t,handleLoadLayout:o}=e;return(0,j.jsx)("div",{role:"listitem",children:(0,j.jsxs)("div",{className:`${ut}-layoutTile`,role:"button",onClick:()=>o(t==null?void 0:t.id),children:[(0,j.jsx)("img",{className:`${ut}-screenshot`,src:t==null?void 0:t.screenshot}),(0,j.jsxs)("div",{children:[(0,j.jsx)("div",{className:`${ut}-layoutName`,children:t==null?void 0:t.name}),(0,j.jsx)("div",{className:`${ut}-layoutDetails`,children:(0,j.jsx)("div",{children:`${t==null?void 0:t.user}, ${t==null?void 0:t.created}`})})]})]},t==null?void 0:t.id)})};var q=require("react/jsx-runtime"),Dt="vuuLayoutList",kt=e=>{let{layoutMetadata:t,loadLayoutById:o}=me(),a=r=>{r&&o(r)},n=t.reduce((r,i)=>r[i.group]?{...r,[i.group]:[...r[i.group],i]}:{...r,[i.group]:[i]},{});return(0,q.jsxs)("div",{className:Dt,...e,role:"listbox","aria-label":"my layouts",children:[(0,q.jsx)("div",{className:`${Dt}-header`,children:"My Layouts"}),(0,q.jsx)(Uo.List,{height:"auto",source:Object.entries(n),ListItem:({item:r})=>{if(!r)return(0,q.jsx)(q.Fragment,{});let[i,s]=r;return(0,q.jsxs)("div",{role:"list","aria-label":i,children:[(0,q.jsx)("div",{className:`${Dt}-groupName`,children:i}),s.map(u=>(0,q.jsx)(zo,{metadata:u,handleLoadLayout:a},u.id))]})}})]})};var Zo=require("@vuu-ui/vuu-icons"),pt=require("@vuu-ui/vuu-layout"),he=require("@vuu-ui/vuu-ui-controls"),qo=require("@vuu-ui/vuu-utils"),dt=M(require("clsx")),Ne=require("react");var lt=require("@vuu-ui/vuu-layout");var re=require("react/jsx-runtime"),Vt="vuuFeatureList",ct=({features:e,title:t="VUU TABLES",...o})=>{let a={},n={height:"100%"};return(0,re.jsxs)("div",{...o,className:Vt,children:[(0,re.jsx)("div",{className:`${Vt}-header`,children:t}),(0,re.jsx)("div",{className:`${Vt}-content`,children:(0,re.jsx)(lt.Palette,{orientation:"vertical",ListProps:n,ViewProps:a,children:e.map((r,i)=>(0,re.jsx)(lt.PaletteItem,{closeable:!0,label:r.title,resizeable:!0,resize:"defer",header:!0,children:(0,re.jsx)(Be,{...r})},i))})})]})};var L=require("react/jsx-runtime"),Ee="vuuLeftNav",mn=(e,t)=>e===0?t?"menu-full":"menu-icons":t?"menu-full-content":"menu-icons-content",hn=e=>{let t=(0,pt.useLayoutProviderDispatch)(),[o]=(0,qo.useThemeAttributes)(),{"data-path":a,defaultExpanded:n=!0,defaultActiveTabIndex:r=0,features:i,onActiveChange:s,onTogglePrimaryMenu:u,sizeCollapsed:c=80,sizeContent:d=300,sizeExpanded:h=240,style:b,tableFeatures:y,...p}=e,[l,g]=(0,Ne.useState)({activeTabIndex:r,expanded:n}),P=(0,Ne.useCallback)((T,B)=>T===0?B?h:c:B?h+d:c+d,[c,d,h]),R=(0,Ne.useCallback)(T=>{let{activeTabIndex:B,expanded:G}=l;if(g({activeTabIndex:T,expanded:G}),T===0||B===0){let w=P(T,G);t({type:"layout-resize",path:"#vuu-side-panel",size:w})}s==null||s(T)},[t,P,l,s]),k=mn(l.activeTabIndex,l.expanded),f=(0,Ne.useCallback)(()=>{let{activeTabIndex:T,expanded:B}=l,G=!B;g({activeTabIndex:T,expanded:G}),t({type:"layout-resize",path:"#vuu-side-panel",size:P(T,G)}),u==null||u(G)},[t,P,l,u]),V={...b,"--nav-menu-collapsed-width":`${c}px`,"--nav-menu-expanded-width":`${h}px`,"--nav-menu-content-width":`${d}px`};return(0,L.jsxs)("div",{...p,className:(0,dt.default)(Ee,`${Ee}-${k}`),style:V,children:[(0,L.jsxs)("div",{className:(0,dt.default)(`${Ee}-menu-primary`,o),"data-mode":"dark",children:[(0,L.jsx)("div",{className:"vuuLeftNav-logo",children:(0,L.jsx)(Zo.VuuLogo,{})}),(0,L.jsx)("div",{className:`${Ee}-main`,children:(0,L.jsxs)(he.Tabstrip,{activeTabIndex:l.activeTabIndex,animateSelectionThumb:!1,className:`${Ee}-Tabstrip`,onActiveChange:R,orientation:"vertical",children:[(0,L.jsx)(he.Tab,{"data-icon":"demo",label:"DEMO"}),(0,L.jsx)(he.Tab,{"data-icon":"features",label:"VUU FEATURES"}),(0,L.jsx)(he.Tab,{"data-icon":"tables",label:"VUU TABLES"}),(0,L.jsx)(he.Tab,{"data-icon":"layouts",label:"MY LAYOUTS"})]})}),(0,L.jsx)("div",{className:"vuuLeftNav-buttonBar",children:(0,L.jsx)("button",{className:(0,dt.default)("vuuLeftNav-toggleButton",{"vuuLeftNav-toggleButton-open":k.startsWith("menu-full"),"vuuLeftNav-toggleButton-closed":k.startsWith("menu-icons")}),"data-icon":k.startsWith("menu-full")?"chevron-left":"chevron-right",onClick:f})})]}),(0,L.jsxs)(pt.Stack,{active:l.activeTabIndex-1,className:`${Ee}-menu-secondary`,showTabs:!1,children:[(0,L.jsx)(ct,{features:i,title:"VUU FEATURES"}),(0,L.jsx)(ct,{features:y,title:"VUU TABLES"}),(0,L.jsx)("div",{className:"vuuLeftNav-drawer",children:(0,L.jsx)(kt,{})})]})]})};var Go=require("@vuu-ui/vuu-data-remote"),J=require("@vuu-ui/vuu-utils"),qe=require("@salt-ds/core"),Ft=M(require("clsx")),S=require("react");var $=require("react/jsx-runtime"),Y="vuuSessionEditingForm",Jo=(e,t)=>{let o=e.find(a=>a.name===t);if(o)return o;throw Error(`SessionEditingForm, no field '${t}' found`)},_o=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]},ee={uninitialised:0,unchanged:1,changed:2,invalid:3};function Wo(e,t,o=!1){switch(t){case"int":case"long":{let a=parseInt(e,10);if((0,J.isValidNumber)(a))return a;if(o)throw Error("SessionEditingForm getTypedValue");return}case"double":{let a=parseFloat(e);return(0,J.isValidNumber)(a)?a:void 0}case"boolean":return e==="true";default:return e}}var gn=(e,t)=>{if(e)return e;if(t)return new Go.VuuDataSource({bufferSize:0,table:t.table,columns:t.columns.map(o=>o.name)});throw Error("SessionEditingForm: either a DataSource or a TableSchema must be provided")},fn=({className:e,config:{fields:t,key:o},dataSource:a,id:n,onClose:r,schema:i,...s})=>{let[u,c]=(0,S.useState)(),[d,h]=(0,S.useState)(""),b=(0,S.useRef)(null),y=(0,S.useRef)(),p=(0,S.useRef)(ee.uninitialised),l=(0,S.useMemo)(()=>{let m=O=>{if(I){let z={};for(let te of l.columns)z[te]=O[I[te]];p.current===ee.uninitialised&&(p.current=ee.unchanged,y.current=z),c(z)}},w=gn(a,i),I=(0,J.buildColumnMap)(w.columns);return w.subscribe({range:{from:0,to:5}},O=>{O.type==="viewport-update"&&O.rows&&(p.current===ee.uninitialised?m(O.rows[0]):console.log("what do we do with server updates"))}),w},[a,i]),g=(0,qe.useIdMemo)(n),P=(0,S.useCallback)(m=>{let[w,I]=_o(m),{type:O}=Jo(t,w),z=Wo(I,O);c((te={})=>{let U={...te,[w]:z},ra=(0,J.shallowEquals)(U,y.current);return p.current=ra?ee.unchanged:z!==void 0?ee.changed:ee.invalid,U})},[t]),R=(0,S.useCallback)(m=>{let[w,I]=_o(m),{type:O}=Jo(t,w),z=u==null?void 0:u[o],te=Wo(I,O,!0);typeof z=="string"&&l.menuRpcCall({rowKey:z,field:w,value:te,type:"VP_EDIT_CELL_RPC"})},[l,t,o,u]),k=(0,S.useCallback)(m=>{typeof m=="object"&&m!==null&&"type"in m&&m.type==="CLOSE_DIALOG_ACTION"&&r()},[r]),f=(0,S.useCallback)(async()=>{let m=await l.menuRpcCall({type:"VP_EDIT_SUBMIT_FORM_RPC"});(0,J.isErrorResponse)(m)?h(m.error):(0,J.hasAction)(m)&&k(m.action)},[k,l]),V=(0,S.useCallback)(m=>{m.key==="Enter"&&p.current===ee.changed&&f()},[f]),T=(0,S.useCallback)(()=>{r()},[r]),B=m=>{var I;let w=String((I=u==null?void 0:u[m.name])!=null?I:"");return m.readonly||m.name===o?(0,$.jsx)("div",{className:`${Y}-fieldValue vuuReadOnly`,children:w}):(0,$.jsx)("input",{className:`${Y}-fieldValue`,"data-field":m.name,onBlur:R,onChange:P,type:"text",value:w,id:`${g}-input-${m.name}`})};(0,S.useEffect)(()=>{if(b.current){let m=b.current.querySelector("input");m&&setTimeout(()=>{m.focus(),m.select()},100)}},[]),(0,S.useEffect)(()=>()=>{l&&l.unsubscribe()},[l]);let G=p.current===ee.changed;return(0,$.jsxs)("div",{...s,className:(0,Ft.default)(Y,e),children:[d?(0,$.jsx)("div",{className:`${Y}-errorBanner`,"data-icon":"error",title:d,children:"Error, edit(s) not saved"}):void 0,(0,$.jsx)("div",{className:`${Y}-content`,ref:b,onKeyDown:V,children:t.map(m=>{var w;return(0,$.jsxs)("div",{className:`${Y}-field`,children:[(0,$.jsx)("label",{className:(0,Ft.default)(`${Y}-fieldLabel`,{[`${Y}-required`]:m.required}),htmlFor:`${g}-input-${m.name}`,children:(w=m==null?void 0:m.label)!=null?w:m.description}),B(m)]},m.name)})}),(0,$.jsxs)("div",{className:`${Y}-buttonbar salt-theme salt-density-high`,children:[(0,$.jsx)(qe.Button,{type:"submit",variant:"cta",disabled:!G,onClick:f,children:"Submit"}),(0,$.jsx)(qe.Button,{variant:"secondary",onClick:T,children:"Cancel"})]})]})};var ta=require("@vuu-ui/vuu-data-remote"),ke=require("@vuu-ui/vuu-layout");var Ve=require("@vuu-ui/vuu-utils"),oa=M(require("clsx")),W=require("react");var Qo=require("@salt-ds/core"),Ht=M(require("clsx")),mt=require("react"),De=require("@vuu-ui/vuu-layout");var ie=require("react/jsx-runtime"),_="vuuContextPanel",At=({className:e,expanded:t=!1,content:o,overlay:a=!1,title:n})=>{let r=(0,De.useLayoutProviderDispatch)(),i=(0,mt.useCallback)(()=>{r({path:"#context-panel",propName:"expanded",propValue:!1,type:"set-prop"})},[r]),s=(0,Ht.default)(_,e,{[`${_}-expanded`]:t,[`${_}-inline`]:a!==!0,[`${_}-overlay`]:a}),u=(0,mt.useMemo)(()=>o&&t?(0,De.layoutFromJson)(o,"context-0"):null,[o,t]);return(0,ie.jsx)("div",{className:(0,Ht.default)(_,s,{[`${_}-expanded`]:t}),children:(0,ie.jsxs)(De.View,{className:`${_}-inner`,header:!1,id:"context-panel",children:[(0,ie.jsxs)("div",{className:`${_}-header`,children:[(0,ie.jsx)("h2",{className:`${_}-title`,children:n}),(0,ie.jsx)(Qo.Button,{className:`${_}-close`,"data-icon":"close",onClick:i,variant:"secondary"})]}),(0,ie.jsx)("div",{className:`${_}-content`,children:u})]})})};var Je=require("@vuu-ui/vuu-layout");var Xo=require("react"),Ko=M(require("clsx"));var jo=require("react/jsx-runtime"),vn="vuuShellSidePanel",Rt=({children:e,open:t=!0,sizeClosed:o=90,sizeOpen:a=200,style:n,...r})=>{let i=(0,Xo.useMemo)(()=>({...n,"--shell-left-nav-size":t?`${a}px`:`${o}px`}),[t,o,a,n]);return(0,jo.jsx)("div",{...r,className:(0,Ko.default)(vn),style:i,children:e})};var ge=require("react/jsx-runtime"),Yo=({appHeader:e,LeftSidePanelProps:t})=>(0,ge.jsxs)(Je.Flexbox,{className:"App",style:{flexDirection:"row",height:"100%",width:"100%"},children:[(0,ge.jsx)(Rt,{...t,id:"vuu-side-panel"}),(0,ge.jsxs)(Je.Flexbox,{className:"vuuShell-content",style:{flex:1,flexDirection:"column"},children:[e,(0,ge.jsx)(Je.DraggableLayout,{dropTarget:!0,style:{flex:1}},"main-content")]}),(0,ge.jsx)(At,{id:"context-panel",overlay:!0})]});var X=require("@vuu-ui/vuu-layout"),ve=require("react"),fe=require("react/jsx-runtime"),ea=({appHeader:e,LeftSidePanelProps:t})=>{let o=(0,ve.useRef)(null),[a,n]=(0,ve.useState)(!0),r=(0,ve.useCallback)(s=>{var c;let u=s.target;(c=o.current)!=null&&c.contains(u)||n(!a)},[a]),i=(0,ve.useCallback)(s=>{let u=[];return u.push((0,fe.jsx)(X.Drawer,{onClick:r,open:a,position:"left",inline:!0,peekaboo:!0,sizeOpen:200,toggleButton:"end",children:(0,fe.jsx)(X.View,{className:"vuuShell-palette",id:"vw-app-palette",ref:o,style:{height:"100%"},children:s},"app-palette")},"left-panel")),u},[r,a]);return(0,fe.jsxs)(X.Flexbox,{className:"App",style:{flexDirection:"column",height:"100%",width:"100%"},children:[e,(0,fe.jsx)(X.DockLayout,{style:{flex:1},children:i(t==null?void 0:t.children).concat((0,fe.jsx)(X.DraggableLayout,{dropTarget:!0,style:{width:"100%",height:"100%"}},"main-content"))})]})};var Bt=({leftSidePanelLayout:e="inlay",...t})=>(e==="inlay"?ea:Yo)(t);var ye=require("react/jsx-runtime");typeof ke.StackLayout!="function"&&console.warn("StackLayout module not loaded, will be unsbale to deserialize from layout JSON");var{error:$t}=(0,Ve.logger)("Shell"),yn={},xn=({LayoutProps:e,LeftSidePanelProps:t=yn,children:o,className:a,leftSidePanelLayout:n,loginUrl:r,saveLocation:i,saveUrl:s,serverUrl:u,user:c,...d})=>{let h=(0,W.useRef)(null),{dialog:b,setDialogState:y}=Vo(),p=(0,W.useRef)("latest"),{applicationJson:l,saveApplicationLayout:g,loadLayoutById:P}=me(),{buildMenuOptions:R,handleMenuAction:k}=$o(y),[f,V]=(0,W.useState)("connected"),T=(0,W.useCallback)(U=>{try{g(U)}catch{$t==null||$t("Failed to save layout")}},[g]),B=(0,W.useCallback)(U=>{h.current&&(h.current.dataset.mode=U)},[]),G=(0,W.useCallback)(U=>{p.current=U,P(U)},[P]);(0,W.useMemo)(async()=>{if(u&&c.token){let U=await(0,ta.connectToServer)({authToken:c.token,url:u,username:c.username});V(U)}},[u,c.token,c.username]);let[m,w,I]=(0,Ve.useThemeAttributes)(),O=(0,oa.default)("vuuShell",a,m,w),z=l===nt,te=Bt({LeftSidePanelProps:t,leftSidePanelLayout:n,appHeader:(0,ye.jsx)(xt,{layoutId:p.current,loginUrl:r,user:c,onNavigate:G,onSwitchTheme:B})});return f==="rejected"&&console.log("game over, no connection to server"),z?null:(0,ye.jsx)(Ve.ThemeProvider,{children:(0,ye.jsxs)(Ao,{menuActionHandler:k,menuBuilder:R,children:[(0,ye.jsx)(ke.LayoutProvider,{...e,layout:l.layout,onLayoutChange:T,children:(0,ye.jsx)(ke.DraggableLayout,{className:O,"data-mode":I,ref:h,...d,children:te})}),o||b]})})};var bn=e=>e==="*",Cn=e=>typeof e=="object"&&typeof e.module=="string"&&typeof e.table=="string";var gt=require("react"),ht=require("react/jsx-runtime"),wn={},It=(0,gt.createContext)(wn),Ln=({children:e,context:t,inheritedContext:o})=>{let a={...o,...t};return(0,ht.jsx)(It.Provider,{value:a,children:e})},Sn=({children:e,value:t})=>(0,ht.jsx)(It.Consumer,{children:o=>(0,ht.jsx)(Ln,{context:t,inheritedContext:o,children:e})}),Pn=()=>(0,gt.useContext)(It);var aa=M(require("clsx")),xe=require("@salt-ds/core"),na=require("react");var _e=require("react/jsx-runtime"),Tn="vuuThemeSwitch",Mn=({className:e,defaultMode:t,mode:o,onChange:a,...n})=>{let[r,i]=(0,xe.useControlled)({controlled:o,default:t!=null?t:"light",name:"ThemeSwitch",state:"mode"}),s=(0,na.useCallback)(c=>{let{value:d}=c.target;i(d),a(d)},[a,i]),u=(0,aa.default)(Tn,e);return(0,_e.jsxs)(xe.ToggleButtonGroup,{className:u,...n,onChange:s,value:r,children:[(0,_e.jsx)(xe.ToggleButton,{"aria-label":"alert","data-icon":"light",value:"light"}),(0,_e.jsx)(xe.ToggleButton,{"aria-label":"home","data-icon":"dark",value:"dark"})]})};
|
|
3
3
|
//# sourceMappingURL=index.js.map
|