@deephaven/embed-widget 0.87.1-beta.4 → 0.87.1-beta.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/build/assets/{App-d0224948.js → App-25416603.js} +2 -2
  2. package/build/assets/{App-d0224948.js.map → App-25416603.js.map} +1 -1
  3. package/build/assets/Chart-0c4c3cef.js +2 -0
  4. package/build/assets/Chart-0c4c3cef.js.map +1 -0
  5. package/build/assets/{IrisGrid-b9a1a55b.js → IrisGrid-de573255.js} +3 -3
  6. package/build/assets/IrisGrid-de573255.js.map +1 -0
  7. package/build/assets/IrisGridThemeProvider-3d87a0df.js +11 -0
  8. package/build/assets/IrisGridThemeProvider-3d87a0df.js.map +1 -0
  9. package/build/assets/{LocalWorkspaceStorage-cfad086a.js → LocalWorkspaceStorage-b02a7be3.js} +2 -2
  10. package/build/assets/{LocalWorkspaceStorage-cfad086a.js.map → LocalWorkspaceStorage-b02a7be3.js.map} +1 -1
  11. package/build/assets/{LogPanel-c1d1de2f.js → LogPanel-f158dab6.js} +2 -2
  12. package/build/assets/{LogPanel-c1d1de2f.js.map → LogPanel-f158dab6.js.map} +1 -1
  13. package/build/assets/{MarkdownEditor-6a1f8c1d.js → MarkdownEditor-648a6ce5.js} +2 -2
  14. package/build/assets/{MarkdownEditor-6a1f8c1d.js.map → MarkdownEditor-648a6ce5.js.map} +1 -1
  15. package/build/assets/{MarkdownNotebook-537e3fe2.js → MarkdownNotebook-744a67b9.js} +2 -2
  16. package/build/assets/{MarkdownNotebook-537e3fe2.js.map → MarkdownNotebook-744a67b9.js.map} +1 -1
  17. package/build/assets/{index-c6e74b10.js → index-147ac7bf.js} +4 -4
  18. package/build/assets/{index-c6e74b10.js.map → index-147ac7bf.js.map} +1 -1
  19. package/build/assets/{index-b1733a72.js → index-6f5bbea5.js} +2 -2
  20. package/build/assets/{index-b1733a72.js.map → index-6f5bbea5.js.map} +1 -1
  21. package/build/assets/{index-b698ba94.js → index-e25009a5.js} +3 -3
  22. package/build/assets/index-e25009a5.js.map +1 -0
  23. package/build/assets/useMergeRef-fe9e8167.js +2 -0
  24. package/build/assets/useMergeRef-fe9e8167.js.map +1 -0
  25. package/build/index.html +1 -1
  26. package/package.json +17 -17
  27. package/build/assets/Chart-0d24d255.js +0 -2
  28. package/build/assets/Chart-0d24d255.js.map +0 -1
  29. package/build/assets/IrisGrid-b9a1a55b.js.map +0 -1
  30. package/build/assets/IrisGridThemeProvider-d41a7cc8.js +0 -11
  31. package/build/assets/IrisGridThemeProvider-d41a7cc8.js.map +0 -1
  32. package/build/assets/index-b698ba94.js.map +0 -1
@@ -1,2 +1,2 @@
1
- import{r as d,J as I,E as c,H as A,b1 as de,K as fe}from"./vendor-e852bd02.js";import{L as F,q as he,a as N}from"./index-b1733a72.js";import{z as S,a9 as K,A as ve,u as me,m as T,a4 as pe,aa as ge,ah as be,aj as U,aw as ye,a$ as Me,ay as Pe,aB as we,b0 as Se,aA as Oe,b1 as Ce,aR as xe,a3 as Ee,a2 as De,aC as Ie,b2 as B,b3 as z,b4 as G,b5 as k,a5 as W,a6 as Te,a7 as Le}from"./LogPanel-c1d1de2f.js";function je(n){var e=n;n instanceof CustomEvent&&(e=n.detail);var t="";if(e instanceof Error?t=e.message:e!=null&&(t="".concat(e)),t=t.trim(),t.length>0)return t}function _e(n,e){d.useEffect(()=>{if(n!=null){var t=new window.ResizeObserver(e);return t.observe(n),()=>{n!=null&&t.unobserve(n)}}},[n,e])}function H(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Ae(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?H(Object(t),!0).forEach(function(r){M(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):H(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function M(n,e,t){return e=Fe(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Fe(n){var e=Ne(n,"string");return typeof e=="symbol"?e:String(e)}function Ne(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Y=F.module("ContextMenu");class C extends d.PureComponent{static handleContextMenu(e){e.metaKey||(e.stopPropagation(),e.preventDefault())}constructor(e){super(e),M(this,"container",void 0),M(this,"oldFocus",void 0),M(this,"activeSubMenuRef",void 0),M(this,"subMenuTimer",void 0),M(this,"rAF",void 0),M(this,"initialPosition",void 0),this.handleBlur=this.handleBlur.bind(this),this.handleCloseSubMenu=this.handleCloseSubMenu.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleMenuItemClick=this.handleMenuItemClick.bind(this),this.handleMenuItemContextMenu=this.handleMenuItemContextMenu.bind(this),this.handleMenuItemMouseMove=this.handleMenuItemMouseMove.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.handleWindowResize=this.handleWindowResize.bind(this),this.container=I.createRef(),this.oldFocus=document.activeElement,this.activeSubMenuRef=I.createRef(),this.subMenuTimer=0,this.rAF=0,this.initialPosition={top:e.top,left:e.left},this.state={menuItems:[],pendingItems:[],activeSubMenu:null,hasOverflow:!1,subMenuTop:null,subMenuLeft:null,subMenuParentWidth:0,subMenuParentHeight:0,keyboardIndex:-1,mouseIndex:-1}}componentDidMount(){this.initMenu(),this.verifyPosition(),window.addEventListener("resize",this.handleWindowResize),this.rAF=window.requestAnimationFrame(()=>{var e;(e=this.container.current)===null||e===void 0||e.focus();var{onMenuOpened:t}=this.props;t(this)})}componentDidUpdate(e,t){var{actions:r}=this.props,{activeSubMenu:i}=this.state;if(i!==t.activeSubMenu)if(i==null){var a;(a=this.container.current)===null||a===void 0||a.focus()}else this.setActiveSubMenuPosition();if(e.actions!==r&&(this.initMenu(),this.container.current==null||!this.container.current.contains(document.activeElement))){var o;(o=this.container.current)===null||o===void 0||o.focus()}this.verifyPosition()}componentWillUnmount(){this.cancelPromises(),window.removeEventListener("resize",this.handleWindowResize),cancelAnimationFrame(this.rAF)}getKeyboardIndex(){var{options:e}=this.props;if(e.separateKeyboardMouse!==void 0&&e.separateKeyboardMouse){var{keyboardIndex:t}=this.state;return t}return this.getMouseIndex()}setKeyboardIndex(e){var{options:t}=this.props;t.separateKeyboardMouse!==void 0&&t.separateKeyboardMouse?this.setState({keyboardIndex:e}):this.setMouseIndex(e)}getMouseIndex(){var{mouseIndex:e}=this.state;return e}setMouseIndex(e){this.setState({mouseIndex:e})}initMenu(){this.cancelPromises(),cancelAnimationFrame(this.rAF);var{options:e}=this.props,t=e.initialKeyboardIndex;t===void 0&&(t=-1);for(var{actions:r}=this.props,i=S.getMenuItems(r),a=[],o=i.length-1;o>=0;o-=1){var s=i[o];s instanceof Promise?this.initMenuPromise(s):a.push(s)}this.setState({mouseIndex:-1,keyboardIndex:t,activeSubMenu:null,menuItems:S.sortActions(a)})}initMenuPromise(e){var t=K.makeCancelable(e);this.setState(r=>({pendingItems:r.pendingItems.concat(t)})),t.then(r=>{this.setState(i=>{var a=i.pendingItems.indexOf(t);if(a>=0){var o=i.pendingItems.slice();return o.splice(a,1),{menuItems:S.sortActions(i.menuItems.concat(r)),pendingItems:o}}return null})},r=>{K.isCanceled(r)||(this.setState(i=>{var a=i.pendingItems.indexOf(t);if(a>=0){var o=i.pendingItems.slice();return o.splice(a,1),{pendingItems:o}}return null}),Y.error(r))})}cancelPromises(){var{pendingItems:e}=this.state;e.map(t=>t.cancel())}setActiveSubMenuPosition(){if(this.activeSubMenuRef.current!==null){var e=this.activeSubMenuRef.current.getBoundingClientRect();this.setState({subMenuTop:e.top,subMenuLeft:e.right,subMenuParentHeight:e.height,subMenuParentWidth:e.width})}}verifyPosition(){var e,t,r,i,{options:a,updatePosition:o,subMenuParentWidth:s,subMenuParentHeight:u,top:l,left:v}=this.props;if(!(!this.container.current||a.doNotVerifyPosition!=null&&a.doNotVerifyPosition)){var{top:f,left:g}=this.initialPosition,{width:m,height:h}=(e=(t=this.container.current)===null||t===void 0?void 0:t.getBoundingClientRect())!==null&&e!==void 0?e:{width:0,height:0},P=((r=(i=this.container.current)===null||i===void 0?void 0:i.scrollHeight)!==null&&r!==void 0?r:0)>window.innerHeight;h===0||m===0||(f+h>window.innerHeight&&(f-h-u>0?f-=h-u:f=window.innerHeight-h),g+m>window.innerWidth&&(g=g-m-s),(v!==g||l!==f)&&(this.setState({hasOverflow:P}),o(f,g)))}}handleWindowResize(){this.container.current&&this.closeMenu(!0)}handleBlur(e){if(!this.container.current){Y.warn("Container is null!");return}if(!this.container.current.contains(e.relatedTarget)){for(var t=e.relatedTarget,r=!1;t&&!r;)r=t.hasAttribute("data-dh-context-menu"),t=t.parentElement;r||this.closeMenu(!0)}}isEscapeKey(e){var{left:t}=this.props;return e==="Escape"||t<0&&e==="ArrowRight"||e==="ArrowLeft"}handleKeyDown(e){var{menuItems:t}=this.state,r=this.getKeyboardIndex(),i=r,a=!1;if(e.key==="Enter"||e.key===" "){r>=0&&r<t.length&&this.handleMenuItemClick(t[r],e);return}if(e.key==="ArrowRight"?r>=0&&r<=t.length?a=!0:i=0:this.isEscapeKey(e.key)?i=null:e.key==="ArrowUp"||e.shiftKey&&e.key==="Tab"?i=S.getNextMenuItem(i,-1,t):(e.key==="ArrowDown"||e.key==="Tab")&&(i=S.getNextMenuItem(i,1,t)),a){this.openSubMenu(r),e.preventDefault(),e.stopPropagation();return}r!==i&&(i!==null?this.setKeyboardIndex(i):(this.closeMenu(),this.oldFocus instanceof HTMLElement&&this.oldFocus.focus()),e.preventDefault(),e.stopPropagation())}openSubMenu(e){var{menuItems:t,activeSubMenu:r}=this.state,i=t[e].actions?e:null;r!==i&&this.setState({activeSubMenu:i,subMenuTop:null,subMenuLeft:null})}closeMenu(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,{closeMenu:t,onMenuClosed:r}=this.props;cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{t(e),r(this)})}closeSubMenu(){this.setState({activeSubMenu:null})}handleCloseSubMenu(e){e?this.closeMenu(!0):this.closeSubMenu()}handleMenuItemClick(e,t){t.preventDefault(),t.stopPropagation();var{menuItems:r}=this.state;e!=null&&(e.disabled===void 0||!e.disabled)&&(e.actions!=null?this.openSubMenu(r.indexOf(e)):e.action!=null&&(e.action(t.nativeEvent),this.closeMenu(!0)))}handleMenuItemContextMenu(e,t){t.metaKey||this.handleMenuItemClick(e,t)}handleMenuItemMouseMove(e){var{menuItems:t}=this.state,r=t.indexOf(e);this.setMouseIndex(r),r>=0&&r<t.length&&(e.disabled===void 0||!e.disabled)&&this.openSubMenu(r)}handleMouseLeave(){this.setMouseIndex(-1)}render(){for(var e=[],{top:t,left:r}=this.props,{activeSubMenu:i,hasOverflow:a,keyboardIndex:o,menuItems:s,mouseIndex:u,pendingItems:l,subMenuTop:v,subMenuLeft:f,subMenuParentWidth:g,subMenuParentHeight:m}=this.state,h=0;h<s.length;h+=1){var P=s[h];h>0&&P.group!==s[h-1].group&&e.push(c.jsx("hr",{},"".concat(h,".separator")));var b=c.jsx(ve,{ref:i===h?this.activeSubMenuRef:null,isKeyboardSelected:o===h,isMouseSelected:u===h,menuItem:P,closeMenu:this.handleCloseSubMenu,onMenuItemClick:this.handleMenuItemClick,onMenuItemMouseMove:this.handleMenuItemMouseMove,onMenuItemContextMenu:this.handleMenuItemContextMenu},h);e.push(b)}var O=null;l.length>0&&(O=c.jsx("div",{className:"loading",children:c.jsx(he,{className:"loading-spinner-vertical-align"})}));var{menuStyle:L,"data-testid":$}=this.props,w=i!==null&&v!==null&&f!==null;return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:A({"has-overflow":a},"context-menu-container"),style:Ae({top:t,left:r},L),ref:this.container,"data-dh-context-menu":!0,onBlur:this.handleBlur,onKeyDown:this.handleKeyDown,onMouseLeave:this.handleMouseLeave,onContextMenu:C.handleContextMenu,role:"menuitem",tabIndex:0,"data-testid":$,children:[e,O]}),w&&i!==null&&v!==null&&f!==null&&c.jsx(C,{actions:s[i].actions||[],closeMenu:this.handleCloseSubMenu,top:v,left:f,updatePosition:(y,x)=>{this.setState({subMenuTop:y,subMenuLeft:x})},subMenuParentWidth:g,subMenuParentHeight:m},"sub-".concat(i))]})}}M(C,"defaultProps",{subMenuParentWidth:0,subMenuParentHeight:0,closeMenu(){},onMenuOpened(){},onMenuClosed(){},options:{},menuStyle:{},"data-testid":void 0});const Re=C;function Z(n,e,t){return e=$e(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function $e(n){var e=Ke(n,"string");return typeof e=="symbol"?e:String(e)}function Ke(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Ue extends d.Component{constructor(e){super(e),Z(this,"container",void 0),Z(this,"openMenu",void 0),this.handleMenuClose=this.handleMenuClose.bind(this),this.handleContextMenu=this.handleContextMenu.bind(this),this.container=I.createRef(),this.openMenu=I.createRef(),this.state={actions:null,left:0,top:0}}componentDidMount(){var e;(e=this.container.current)!==null&&e!==void 0&&e.parentElement&&this.container.current.parentElement.addEventListener("contextmenu",this.handleContextMenu)}componentWillUnmount(){var e;(e=this.container.current)!==null&&e!==void 0&&e.parentElement&&this.container.current.parentElement.removeEventListener("contextmenu",this.handleContextMenu)}handleContextMenu(e){if(this.container.current){var t=this.container.current.getBoundingClientRect(),r=e.clientY-t.top,i=e.clientX-t.left,{actions:a}=this.state;if(a!=null&&e.target===this.container.current){e.preventDefault(),this.setState({actions:null},()=>{var s=document.elementFromPoint(i,r),u=new MouseEvent("contextmenu",{clientX:e.clientX,clientY:e.clientY,bubbles:!0,cancelable:!0});s==null||s.dispatchEvent(u)});return}if(S.isContextActionEvent(e)&&!(e.metaKey||e.ctrlKey)){var o=S.getMenuItems(e.contextActions);o.length!==0&&(e.preventDefault(),this.setState({actions:o,top:r,left:i}))}}}handleMenuClose(e){e===this.openMenu.current&&this.setState({actions:null})}render(){var e=null,{"data-testid":t}=this.props,{actions:r,top:i,left:a}=this.state;return r&&(e=c.jsx(Re,{ref:this.openMenu,actions:r,onMenuClosed:this.handleMenuClose,top:i,left:a,updatePosition:(o,s)=>{this.setState({top:o,left:s})},"data-testid":t})),c.jsx("div",{className:A("context-menu-root",{active:r}),ref:this.container,children:e})}}const It=Ue;function Be(n,e){var t=me(),r=d.useMemo(()=>new t.CoreClient(n,e),[t,n,e]);return d.useEffect(()=>()=>{r.disconnect()},[r]),r}var se=d.createContext(null);function Tt(n){var{serverUrl:e,options:t,children:r}=n,i=Be(e,t);return c.jsx(se.Provider,{value:i,children:r})}function ze(){return T(se,"No Client available in useClient. Was code wrapped in ClientBootstrap or ClientContext.Provider?")}var Ge=1e4;function Lt(n,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Ge;return new Promise((r,i)=>{var a,o=setTimeout(()=>{var u;(u=a)===null||u===void 0||u(),i(new pe("Timeout looking for variable ".concat(e)))},t);function s(u){var l,v=u.created.find(f=>f.title===e);clearTimeout(o),(l=a)===null||l===void 0||l(),v!=null?r(v):i(new Error("Variable ".concat(e," not found")))}a=n.subscribeToFieldUpdates(s)})}function ke(n){var e=[...n.entries()].filter(t=>{var[,r]=t;return be(r)||U(r)});return e.map(t=>{var[r,i]=t;if(U(i)){var{DashboardPlugin:a}=i;return c.jsx(a,{},r)}var{component:o}=i;return c.jsx(o,{},r)})}function jt(){var n=ge(),e=d.useMemo(()=>ke(n),[n]);return e}var _t=d.createContext({}),At=d.createContext({}),We=d.createContext(null);function J(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function He(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?J(Object(t),!0).forEach(function(r){Ye(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):J(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Ye(n,e,t){return e=Ze(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Ze(n){var e=Je(n,"string");return typeof e=="symbol"?e:String(e)}function Je(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var qe=100,j=()=>{},Xe=Object.freeze({});function Qe(n){var{id:e="default",children:t,emptyDashboard:r,layoutConfig:i,layoutSettings:a=Xe,onLayoutConfigChange:o=j,onGoldenLayoutChange:s=j,onLayoutInitialized:u=j,fallbackComponent:l=Se,hydrate:v,dehydrate:f,panelWrapper:g}=n,m=d.useRef(null),[h,P]=d.useState(!1),[b,O]=d.useState();d.useEffect(function(){if(!m.current){O(void 0);return}var w=He({},ye.makeDefaultLayout());w.settings===void 0&&(w.settings={}),Object.assign(w.settings,a),w.content=[];var y=new Me(w,m.current),x=()=>{y.off("initialised",x),P(!0)};return y.on("initialised",x),l!=null&&y.setFallbackComponent(l),y.init(),O(y),s(y),()=>{y.destroy()}},[a,l,s,P,O]);var L=d.useMemo(()=>de(()=>{b!=null&&b.isInitialised&&(b==null||b.updateSize())},qe),[b]);return _e(m.current,L),c.jsxs("div",{className:"dashboard-container w-100 h-100",children:[c.jsx("div",{className:"w-100 h-100",ref:m}),h&&b&&c.jsx(Pe.Provider,{value:b,children:c.jsx(we,{emptyDashboard:r,id:e,layout:b,layoutConfig:i,onLayoutChange:o,onLayoutInitialized:u,hydrate:v,dehydrate:f,panelWrapper:g,children:t})})]})}var R="CREATE_DASHBOARD";function Ve(n,e){try{n.off(R,e)}catch{}}function Ft(n,e){return n.on(R,e),()=>Ve(n,e)}function Nt(n,e){n.emit(R,e)}var et=["id","isActive","plugins"];function q(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function X(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?q(Object(t),!0).forEach(function(r){tt(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):q(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function tt(n,e,t){return e=nt(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function nt(n){var e=rt(n,"string");return typeof e=="symbol"?e:String(e)}function rt(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function it(n,e){if(n==null)return{};var t=at(n,e),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(n);for(i=0;i<a.length;i++)r=a[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(n,r)&&(t[r]=n[r])}return t}function at(n,e){if(n==null)return{};var t={},r=Object.keys(n),i,a;for(a=0;a<r.length;a++)i=r[a],!(e.indexOf(i)>=0)&&(t[i]=n[i]);return t}function ot(n){var{id:e,isActive:t,plugins:r}=n,i=it(n,et),[a,o]=d.useState(t),s=fe(),u=d.useCallback(l=>{s(e===Oe?Ce({layoutConfig:l}):xe(e,{layoutConfig:l}))},[e,s]);return!a&&t&&o(!0),a?c.jsx(Qe,X(X({id:e,onLayoutConfigChange:u},i),{},{children:r})):c.jsx(N,{})}var st=d.createContext(null);function Q(n,e,t,r,i,a,o){try{var s=n[a](o),u=s.value}catch(l){t(l);return}s.done?e(u):Promise.resolve(u).then(r,i)}function ut(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function o(u){Q(a,r,i,o,s,"next",u)}function s(u){Q(a,r,i,o,s,"throw",u)}o(void 0)})}}var ue=d.createContext(null);function Rt(n){var{children:e}=n,t=ze(),[r,i]=d.useState(),[a,o]=d.useState();d.useEffect(function(){var l=!1;function v(){return f.apply(this,arguments)}function f(){return f=ut(function*(){try{var g=yield t.getServerConfigValues();l||i(new Map(g))}catch(m){l||o(m)}}),f.apply(this,arguments)}return v(),()=>{l=!0}},[t]);var s=r==null;return s||a!=null?c.jsx(N,{isLoading:s&&a==null,errorMessage:je(a)}):c.jsx(ue.Provider,{value:r,children:e})}function $t(){return T(ue,"No server config available in useServerConfig. Was code wrapped in ServerConfigBootstrap or ServerConfigContext.Provider?")}function V(n,e,t,r,i,a,o){try{var s=n[a](o),u=s.value}catch(l){t(l);return}s.done?e(u):Promise.resolve(u).then(r,i)}function lt(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function o(u){V(a,r,i,o,s,"next",u)}function s(u){V(a,r,i,o,s,"throw",u)}o(void 0)})}}function ee(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function te(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ee(Object(t),!0).forEach(function(r){ct(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):ee(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function ct(n,e,t){return e=dt(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function dt(n){var e=ft(n,"string");return typeof e=="symbol"?e:String(e)}function ft(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function Kt(n){var{dashboards:e,activeDashboard:t,onLayoutInitialized:r,onGoldenLayoutChange:i,plugins:a,emptyDashboard:o=c.jsx(N,{})}=n,s=Ee(),u=d.useCallback((l,v)=>{var{metadata:f}=l;try{if(f!=null){var g=De(f);return te(te({fetch:function(){var m=lt(function*(){return s(g)});function h(){return m.apply(this,arguments)}return h}()},l),{},{localDashboardId:v})}}catch{}return Ie.hydrate(l,v)},[s]);return c.jsx("div",{className:"tab-content",children:e.map(l=>c.jsx("div",{className:A("tab-pane",{active:l.id===t}),children:c.jsx(ot,{id:l.id,isActive:l.id===t,emptyDashboard:o,layoutConfig:l.layoutConfig,layoutSettings:l.layoutSettings,onLayoutInitialized:r,onGoldenLayoutChange:i,hydrate:u,plugins:a},l.key)},l.id))})}function Ut(){return T(st,"No IdeConnection available in useConnection. Was code wrapped in ConnectionContext.Provider?")}function Bt(){return T(We,"No user available in useUser. Was code wrapped in UserBootstrap or UserContext.Provider?")}function ne(n,e,t,r,i,a,o){try{var s=n[a](o),u=s.value}catch(l){t(l);return}s.done?e(u):Promise.resolve(u).then(r,i)}function re(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function o(u){ne(a,r,i,o,s,"next",u)}function s(u){ne(a,r,i,o,s,"throw",u)}o(void 0)})}}function ie(n,e,t){return e=ht(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function ht(n){var e=vt(n,"string");return typeof e=="symbol"?e:String(e)}function vt(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class zt{constructor(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";ie(this,"storageService",void 0),ie(this,"root",void 0),this.storageService=e,this.root=t}getLayouts(){var e=this;return re(function*(){var t=yield e.storageService.listItems(e.root,"*.json");return t.map(r=>r.basename)})()}getLayout(e){var t=this;return re(function*(){var r=yield t.storageService.loadFile("".concat(t.root,"/").concat(e)),i=yield r.text();return JSON.parse(i)})()}}function mt(n){return n.version===2}function pt(n){return Array.isArray(n)}function ae(n,e,t,r,i,a,o){try{var s=n[a](o),u=s.value}catch(l){t(l);return}s.done?e(u):Promise.resolve(u).then(r,i)}function gt(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function o(u){ae(a,r,i,o,s,"next",u)}function s(u){ae(a,r,i,o,s,"throw",u)}o(void 0)})}}var E=F.module("UserLayoutUtils"),bt={layoutConfig:[{type:"column",content:[{type:"row",height:40,content:[{type:"stack",content:[{type:"react-component",component:B.COMPONENT,title:B.TITLE,isClosable:!1},{type:"react-component",component:z.COMPONENT,title:z.TITLE,isClosable:!1}]},{type:"stack",width:25,content:[{type:"react-component",component:G.COMPONENT,title:G.TITLE,isClosable:!1},{type:"react-component",component:k.COMPONENT,title:k.TITLE,isClosable:!1}]}]},{type:"row",content:[{type:"stack",title:"Notebooks",content:[]}]}]}],links:[],filterSets:[],version:2},yt={layoutConfig:[],links:[],filterSets:[],version:2};function le(n){if(mt(n))return n;if(pt(n)){var e=n;return{layoutConfig:e,links:[],filterSets:[],version:2}}throw new Error("Unexpected layout import format: ".concat(n))}function Mt(n){return _.apply(this,arguments)}function _(){return _=gt(function*(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;try{var t=yield n.getLayouts();if(t.length>0)try{var r=yield n.getLayout(t[0]);return le(r)}catch(i){E.error("Unable to load layout",t[0],":",i),E.warn("No valid layouts found, falling back to default layout")}}catch(i){E.error("Unable to fetch layout list",i),E.warn("Falling back to default layout")}return e?bt:yt}),_.apply(this,arguments)}function Pt(n){var{filterSets:e,layoutConfig:t,links:r,pluginDataMap:i}=n,a={filterSets:e,layoutConfig:t,links:r,pluginDataMap:i,version:2};return a}const wt={exportLayout:Pt,getDefaultLayout:Mt,normalizeLayout:le};function oe(n,e,t,r,i,a,o){try{var s=n[a](o),u=s.value}catch(l){t(l);return}s.done?e(u):Promise.resolve(u).then(r,i)}function D(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function o(u){oe(a,r,i,o,s,"next",u)}function s(u){oe(a,r,i,o,s,"throw",u)}o(void 0)})}}function ce(n,e,t){return e=St(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function St(n){var e=Ot(n,"string");return typeof e=="symbol"?e:String(e)}function Ot(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Ct=F.module("LocalWorkspaceStorage");class p{static getBooleanServerConfig(e,t){var r,i;if((e==null||(r=e.get(t))===null||r===void 0?void 0:r.toLowerCase())==="true")return!0;if((e==null||(i=e.get(t))===null||i===void 0?void 0:i.toLowerCase())==="false")return!1}static makeDefaultWorkspaceSettings(e){for(var t={defaultDateTimeFormat:W.DEFAULT_DATETIME_FORMAT_STRING,formatter:[],timeZone:W.DEFAULT_TIME_ZONE_ID,showTimeZone:!1,showTSeparator:!0,disableMoveConfirmation:!1,defaultDecimalFormatOptions:{defaultFormatString:Te.DEFAULT_FORMAT_STRING},defaultIntegerFormatOptions:{defaultFormatString:Le.DEFAULT_FORMAT_STRING},truncateNumbersWithPound:!1,showEmptyStrings:!0,showNullStrings:!0,defaultNotebookSettings:{isMinimapEnabled:!1},webgl:!0,webglEditable:!0,gridDensity:"regular"},r={defaultDateTimeFormat:e==null?void 0:e.get("dateTimeFormat"),formatter:[],timeZone:e==null?void 0:e.get("timeZone"),showTimeZone:p.getBooleanServerConfig(e,"showTimeZone"),showTSeparator:p.getBooleanServerConfig(e,"showTSeparator"),disableMoveConfirmation:p.getBooleanServerConfig(e,"disableMoveConfirmation"),defaultDecimalFormatOptions:(e==null?void 0:e.get("decimalFormat"))!==void 0?{defaultFormatString:e==null?void 0:e.get("decimalFormat")}:void 0,defaultIntegerFormatOptions:(e==null?void 0:e.get("integerFormat"))!==void 0?{defaultFormatString:e==null?void 0:e.get("integerFormat")}:void 0,truncateNumbersWithPound:p.getBooleanServerConfig(e,"truncateNumbersWithPound"),showEmptyStrings:p.getBooleanServerConfig(e,"showEmptyStrings"),showNullStrings:p.getBooleanServerConfig(e,"showNullStrings"),defaultNotebookSettings:(e==null?void 0:e.get("isMinimapEnabled"))!==void 0?{isMinimapEnabled:p.getBooleanServerConfig(e,"isMinimapEnabled")}:void 0,webgl:p.getBooleanServerConfig(e,"web.webgl"),webglEditable:p.getBooleanServerConfig(e,"web.webgl.editable")},i=Object.keys(r),a=0;a<i.length;a+=1){var o=i[a];r[o]!==void 0&&(t[o]=r[o])}return t}static makeWorkspaceData(e,t){return D(function*(){var{filterSets:r,links:i,layoutConfig:a,pluginDataMap:o={}}=yield wt.getDefaultLayout(e,t==null?void 0:t.isConsoleAvailable);return{settings:{},layoutConfig:a,closed:[{}],links:i,filterSets:r,pluginDataMap:o}})()}static makeDefaultWorkspace(e,t){return D(function*(){return{data:yield p.makeWorkspaceData(e,t)}})()}constructor(e){ce(this,"layoutStorage",void 0),this.layoutStorage=e}load(e){var t=this;return D(function*(){try{var r,i=JSON.parse((r=localStorage.getItem(p.STORAGE_KEY))!==null&&r!==void 0?r:"");return i}catch{return Ct.info("Unable to load workspace data, initializing to default data"),p.makeDefaultWorkspace(t.layoutStorage,e)}})()}save(e){return D(function*(){return localStorage.setItem(p.STORAGE_KEY,JSON.stringify(e)),e})()}}ce(p,"STORAGE_KEY","deephaven.WorkspaceStorage");export{Kt as A,Pt as B,It as C,Qe as D,Ge as F,zt as G,p as L,Rt as S,At as U,ze as a,Bt as b,$t as c,jt as d,_e as e,Lt as f,Tt as g,se as h,ke as i,je as j,We as k,Ft as l,_t as m,R as n,ot as o,Nt as p,st as q,wt as r,Ve as s,mt as t,Ut as u,pt as v,bt as w,yt as x,le as y,Mt as z};
2
- //# sourceMappingURL=LocalWorkspaceStorage-cfad086a.js.map
1
+ import{r as d,J as I,E as c,H as A,b1 as de,K as fe}from"./vendor-e852bd02.js";import{L as F,q as he,a as N}from"./index-6f5bbea5.js";import{z as S,a9 as K,A as ve,u as me,m as T,a4 as pe,aa as ge,ah as be,aj as U,aw as ye,a$ as Me,ay as Pe,aB as we,b0 as Se,aA as Oe,b1 as Ce,aR as xe,a3 as Ee,a2 as De,aC as Ie,b2 as B,b3 as z,b4 as G,b5 as k,a5 as W,a6 as Te,a7 as Le}from"./LogPanel-f158dab6.js";function je(n){var e=n;n instanceof CustomEvent&&(e=n.detail);var t="";if(e instanceof Error?t=e.message:e!=null&&(t="".concat(e)),t=t.trim(),t.length>0)return t}function _e(n,e){d.useEffect(()=>{if(n!=null){var t=new window.ResizeObserver(e);return t.observe(n),()=>{n!=null&&t.unobserve(n)}}},[n,e])}function H(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Ae(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?H(Object(t),!0).forEach(function(r){M(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):H(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function M(n,e,t){return e=Fe(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Fe(n){var e=Ne(n,"string");return typeof e=="symbol"?e:String(e)}function Ne(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Y=F.module("ContextMenu");class C extends d.PureComponent{static handleContextMenu(e){e.metaKey||(e.stopPropagation(),e.preventDefault())}constructor(e){super(e),M(this,"container",void 0),M(this,"oldFocus",void 0),M(this,"activeSubMenuRef",void 0),M(this,"subMenuTimer",void 0),M(this,"rAF",void 0),M(this,"initialPosition",void 0),this.handleBlur=this.handleBlur.bind(this),this.handleCloseSubMenu=this.handleCloseSubMenu.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleMenuItemClick=this.handleMenuItemClick.bind(this),this.handleMenuItemContextMenu=this.handleMenuItemContextMenu.bind(this),this.handleMenuItemMouseMove=this.handleMenuItemMouseMove.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.handleWindowResize=this.handleWindowResize.bind(this),this.container=I.createRef(),this.oldFocus=document.activeElement,this.activeSubMenuRef=I.createRef(),this.subMenuTimer=0,this.rAF=0,this.initialPosition={top:e.top,left:e.left},this.state={menuItems:[],pendingItems:[],activeSubMenu:null,hasOverflow:!1,subMenuTop:null,subMenuLeft:null,subMenuParentWidth:0,subMenuParentHeight:0,keyboardIndex:-1,mouseIndex:-1}}componentDidMount(){this.initMenu(),this.verifyPosition(),window.addEventListener("resize",this.handleWindowResize),this.rAF=window.requestAnimationFrame(()=>{var e;(e=this.container.current)===null||e===void 0||e.focus();var{onMenuOpened:t}=this.props;t(this)})}componentDidUpdate(e,t){var{actions:r}=this.props,{activeSubMenu:i}=this.state;if(i!==t.activeSubMenu)if(i==null){var a;(a=this.container.current)===null||a===void 0||a.focus()}else this.setActiveSubMenuPosition();if(e.actions!==r&&(this.initMenu(),this.container.current==null||!this.container.current.contains(document.activeElement))){var o;(o=this.container.current)===null||o===void 0||o.focus()}this.verifyPosition()}componentWillUnmount(){this.cancelPromises(),window.removeEventListener("resize",this.handleWindowResize),cancelAnimationFrame(this.rAF)}getKeyboardIndex(){var{options:e}=this.props;if(e.separateKeyboardMouse!==void 0&&e.separateKeyboardMouse){var{keyboardIndex:t}=this.state;return t}return this.getMouseIndex()}setKeyboardIndex(e){var{options:t}=this.props;t.separateKeyboardMouse!==void 0&&t.separateKeyboardMouse?this.setState({keyboardIndex:e}):this.setMouseIndex(e)}getMouseIndex(){var{mouseIndex:e}=this.state;return e}setMouseIndex(e){this.setState({mouseIndex:e})}initMenu(){this.cancelPromises(),cancelAnimationFrame(this.rAF);var{options:e}=this.props,t=e.initialKeyboardIndex;t===void 0&&(t=-1);for(var{actions:r}=this.props,i=S.getMenuItems(r),a=[],o=i.length-1;o>=0;o-=1){var s=i[o];s instanceof Promise?this.initMenuPromise(s):a.push(s)}this.setState({mouseIndex:-1,keyboardIndex:t,activeSubMenu:null,menuItems:S.sortActions(a)})}initMenuPromise(e){var t=K.makeCancelable(e);this.setState(r=>({pendingItems:r.pendingItems.concat(t)})),t.then(r=>{this.setState(i=>{var a=i.pendingItems.indexOf(t);if(a>=0){var o=i.pendingItems.slice();return o.splice(a,1),{menuItems:S.sortActions(i.menuItems.concat(r)),pendingItems:o}}return null})},r=>{K.isCanceled(r)||(this.setState(i=>{var a=i.pendingItems.indexOf(t);if(a>=0){var o=i.pendingItems.slice();return o.splice(a,1),{pendingItems:o}}return null}),Y.error(r))})}cancelPromises(){var{pendingItems:e}=this.state;e.map(t=>t.cancel())}setActiveSubMenuPosition(){if(this.activeSubMenuRef.current!==null){var e=this.activeSubMenuRef.current.getBoundingClientRect();this.setState({subMenuTop:e.top,subMenuLeft:e.right,subMenuParentHeight:e.height,subMenuParentWidth:e.width})}}verifyPosition(){var e,t,r,i,{options:a,updatePosition:o,subMenuParentWidth:s,subMenuParentHeight:u,top:l,left:v}=this.props;if(!(!this.container.current||a.doNotVerifyPosition!=null&&a.doNotVerifyPosition)){var{top:f,left:g}=this.initialPosition,{width:m,height:h}=(e=(t=this.container.current)===null||t===void 0?void 0:t.getBoundingClientRect())!==null&&e!==void 0?e:{width:0,height:0},P=((r=(i=this.container.current)===null||i===void 0?void 0:i.scrollHeight)!==null&&r!==void 0?r:0)>window.innerHeight;h===0||m===0||(f+h>window.innerHeight&&(f-h-u>0?f-=h-u:f=window.innerHeight-h),g+m>window.innerWidth&&(g=g-m-s),(v!==g||l!==f)&&(this.setState({hasOverflow:P}),o(f,g)))}}handleWindowResize(){this.container.current&&this.closeMenu(!0)}handleBlur(e){if(!this.container.current){Y.warn("Container is null!");return}if(!this.container.current.contains(e.relatedTarget)){for(var t=e.relatedTarget,r=!1;t&&!r;)r=t.hasAttribute("data-dh-context-menu"),t=t.parentElement;r||this.closeMenu(!0)}}isEscapeKey(e){var{left:t}=this.props;return e==="Escape"||t<0&&e==="ArrowRight"||e==="ArrowLeft"}handleKeyDown(e){var{menuItems:t}=this.state,r=this.getKeyboardIndex(),i=r,a=!1;if(e.key==="Enter"||e.key===" "){r>=0&&r<t.length&&this.handleMenuItemClick(t[r],e);return}if(e.key==="ArrowRight"?r>=0&&r<=t.length?a=!0:i=0:this.isEscapeKey(e.key)?i=null:e.key==="ArrowUp"||e.shiftKey&&e.key==="Tab"?i=S.getNextMenuItem(i,-1,t):(e.key==="ArrowDown"||e.key==="Tab")&&(i=S.getNextMenuItem(i,1,t)),a){this.openSubMenu(r),e.preventDefault(),e.stopPropagation();return}r!==i&&(i!==null?this.setKeyboardIndex(i):(this.closeMenu(),this.oldFocus instanceof HTMLElement&&this.oldFocus.focus()),e.preventDefault(),e.stopPropagation())}openSubMenu(e){var{menuItems:t,activeSubMenu:r}=this.state,i=t[e].actions?e:null;r!==i&&this.setState({activeSubMenu:i,subMenuTop:null,subMenuLeft:null})}closeMenu(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,{closeMenu:t,onMenuClosed:r}=this.props;cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{t(e),r(this)})}closeSubMenu(){this.setState({activeSubMenu:null})}handleCloseSubMenu(e){e?this.closeMenu(!0):this.closeSubMenu()}handleMenuItemClick(e,t){t.preventDefault(),t.stopPropagation();var{menuItems:r}=this.state;e!=null&&(e.disabled===void 0||!e.disabled)&&(e.actions!=null?this.openSubMenu(r.indexOf(e)):e.action!=null&&(e.action(t.nativeEvent),this.closeMenu(!0)))}handleMenuItemContextMenu(e,t){t.metaKey||this.handleMenuItemClick(e,t)}handleMenuItemMouseMove(e){var{menuItems:t}=this.state,r=t.indexOf(e);this.setMouseIndex(r),r>=0&&r<t.length&&(e.disabled===void 0||!e.disabled)&&this.openSubMenu(r)}handleMouseLeave(){this.setMouseIndex(-1)}render(){for(var e=[],{top:t,left:r}=this.props,{activeSubMenu:i,hasOverflow:a,keyboardIndex:o,menuItems:s,mouseIndex:u,pendingItems:l,subMenuTop:v,subMenuLeft:f,subMenuParentWidth:g,subMenuParentHeight:m}=this.state,h=0;h<s.length;h+=1){var P=s[h];h>0&&P.group!==s[h-1].group&&e.push(c.jsx("hr",{},"".concat(h,".separator")));var b=c.jsx(ve,{ref:i===h?this.activeSubMenuRef:null,isKeyboardSelected:o===h,isMouseSelected:u===h,menuItem:P,closeMenu:this.handleCloseSubMenu,onMenuItemClick:this.handleMenuItemClick,onMenuItemMouseMove:this.handleMenuItemMouseMove,onMenuItemContextMenu:this.handleMenuItemContextMenu},h);e.push(b)}var O=null;l.length>0&&(O=c.jsx("div",{className:"loading",children:c.jsx(he,{className:"loading-spinner-vertical-align"})}));var{menuStyle:L,"data-testid":$}=this.props,w=i!==null&&v!==null&&f!==null;return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:A({"has-overflow":a},"context-menu-container"),style:Ae({top:t,left:r},L),ref:this.container,"data-dh-context-menu":!0,onBlur:this.handleBlur,onKeyDown:this.handleKeyDown,onMouseLeave:this.handleMouseLeave,onContextMenu:C.handleContextMenu,role:"menuitem",tabIndex:0,"data-testid":$,children:[e,O]}),w&&i!==null&&v!==null&&f!==null&&c.jsx(C,{actions:s[i].actions||[],closeMenu:this.handleCloseSubMenu,top:v,left:f,updatePosition:(y,x)=>{this.setState({subMenuTop:y,subMenuLeft:x})},subMenuParentWidth:g,subMenuParentHeight:m},"sub-".concat(i))]})}}M(C,"defaultProps",{subMenuParentWidth:0,subMenuParentHeight:0,closeMenu(){},onMenuOpened(){},onMenuClosed(){},options:{},menuStyle:{},"data-testid":void 0});const Re=C;function Z(n,e,t){return e=$e(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function $e(n){var e=Ke(n,"string");return typeof e=="symbol"?e:String(e)}function Ke(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Ue extends d.Component{constructor(e){super(e),Z(this,"container",void 0),Z(this,"openMenu",void 0),this.handleMenuClose=this.handleMenuClose.bind(this),this.handleContextMenu=this.handleContextMenu.bind(this),this.container=I.createRef(),this.openMenu=I.createRef(),this.state={actions:null,left:0,top:0}}componentDidMount(){var e;(e=this.container.current)!==null&&e!==void 0&&e.parentElement&&this.container.current.parentElement.addEventListener("contextmenu",this.handleContextMenu)}componentWillUnmount(){var e;(e=this.container.current)!==null&&e!==void 0&&e.parentElement&&this.container.current.parentElement.removeEventListener("contextmenu",this.handleContextMenu)}handleContextMenu(e){if(this.container.current){var t=this.container.current.getBoundingClientRect(),r=e.clientY-t.top,i=e.clientX-t.left,{actions:a}=this.state;if(a!=null&&e.target===this.container.current){e.preventDefault(),this.setState({actions:null},()=>{var s=document.elementFromPoint(i,r),u=new MouseEvent("contextmenu",{clientX:e.clientX,clientY:e.clientY,bubbles:!0,cancelable:!0});s==null||s.dispatchEvent(u)});return}if(S.isContextActionEvent(e)&&!(e.metaKey||e.ctrlKey)){var o=S.getMenuItems(e.contextActions);o.length!==0&&(e.preventDefault(),this.setState({actions:o,top:r,left:i}))}}}handleMenuClose(e){e===this.openMenu.current&&this.setState({actions:null})}render(){var e=null,{"data-testid":t}=this.props,{actions:r,top:i,left:a}=this.state;return r&&(e=c.jsx(Re,{ref:this.openMenu,actions:r,onMenuClosed:this.handleMenuClose,top:i,left:a,updatePosition:(o,s)=>{this.setState({top:o,left:s})},"data-testid":t})),c.jsx("div",{className:A("context-menu-root",{active:r}),ref:this.container,children:e})}}const It=Ue;function Be(n,e){var t=me(),r=d.useMemo(()=>new t.CoreClient(n,e),[t,n,e]);return d.useEffect(()=>()=>{r.disconnect()},[r]),r}var se=d.createContext(null);function Tt(n){var{serverUrl:e,options:t,children:r}=n,i=Be(e,t);return c.jsx(se.Provider,{value:i,children:r})}function ze(){return T(se,"No Client available in useClient. Was code wrapped in ClientBootstrap or ClientContext.Provider?")}var Ge=1e4;function Lt(n,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Ge;return new Promise((r,i)=>{var a,o=setTimeout(()=>{var u;(u=a)===null||u===void 0||u(),i(new pe("Timeout looking for variable ".concat(e)))},t);function s(u){var l,v=u.created.find(f=>f.title===e);clearTimeout(o),(l=a)===null||l===void 0||l(),v!=null?r(v):i(new Error("Variable ".concat(e," not found")))}a=n.subscribeToFieldUpdates(s)})}function ke(n){var e=[...n.entries()].filter(t=>{var[,r]=t;return be(r)||U(r)});return e.map(t=>{var[r,i]=t;if(U(i)){var{DashboardPlugin:a}=i;return c.jsx(a,{},r)}var{component:o}=i;return c.jsx(o,{},r)})}function jt(){var n=ge(),e=d.useMemo(()=>ke(n),[n]);return e}var _t=d.createContext({}),At=d.createContext({}),We=d.createContext(null);function J(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function He(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?J(Object(t),!0).forEach(function(r){Ye(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):J(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Ye(n,e,t){return e=Ze(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Ze(n){var e=Je(n,"string");return typeof e=="symbol"?e:String(e)}function Je(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var qe=100,j=()=>{},Xe=Object.freeze({});function Qe(n){var{id:e="default",children:t,emptyDashboard:r,layoutConfig:i,layoutSettings:a=Xe,onLayoutConfigChange:o=j,onGoldenLayoutChange:s=j,onLayoutInitialized:u=j,fallbackComponent:l=Se,hydrate:v,dehydrate:f,panelWrapper:g}=n,m=d.useRef(null),[h,P]=d.useState(!1),[b,O]=d.useState();d.useEffect(function(){if(!m.current){O(void 0);return}var w=He({},ye.makeDefaultLayout());w.settings===void 0&&(w.settings={}),Object.assign(w.settings,a),w.content=[];var y=new Me(w,m.current),x=()=>{y.off("initialised",x),P(!0)};return y.on("initialised",x),l!=null&&y.setFallbackComponent(l),y.init(),O(y),s(y),()=>{y.destroy()}},[a,l,s,P,O]);var L=d.useMemo(()=>de(()=>{b!=null&&b.isInitialised&&(b==null||b.updateSize())},qe),[b]);return _e(m.current,L),c.jsxs("div",{className:"dashboard-container w-100 h-100",children:[c.jsx("div",{className:"w-100 h-100",ref:m}),h&&b&&c.jsx(Pe.Provider,{value:b,children:c.jsx(we,{emptyDashboard:r,id:e,layout:b,layoutConfig:i,onLayoutChange:o,onLayoutInitialized:u,hydrate:v,dehydrate:f,panelWrapper:g,children:t})})]})}var R="CREATE_DASHBOARD";function Ve(n,e){try{n.off(R,e)}catch{}}function Ft(n,e){return n.on(R,e),()=>Ve(n,e)}function Nt(n,e){n.emit(R,e)}var et=["id","isActive","plugins"];function q(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function X(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?q(Object(t),!0).forEach(function(r){tt(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):q(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function tt(n,e,t){return e=nt(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function nt(n){var e=rt(n,"string");return typeof e=="symbol"?e:String(e)}function rt(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function it(n,e){if(n==null)return{};var t=at(n,e),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(n);for(i=0;i<a.length;i++)r=a[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(n,r)&&(t[r]=n[r])}return t}function at(n,e){if(n==null)return{};var t={},r=Object.keys(n),i,a;for(a=0;a<r.length;a++)i=r[a],!(e.indexOf(i)>=0)&&(t[i]=n[i]);return t}function ot(n){var{id:e,isActive:t,plugins:r}=n,i=it(n,et),[a,o]=d.useState(t),s=fe(),u=d.useCallback(l=>{s(e===Oe?Ce({layoutConfig:l}):xe(e,{layoutConfig:l}))},[e,s]);return!a&&t&&o(!0),a?c.jsx(Qe,X(X({id:e,onLayoutConfigChange:u},i),{},{children:r})):c.jsx(N,{})}var st=d.createContext(null);function Q(n,e,t,r,i,a,o){try{var s=n[a](o),u=s.value}catch(l){t(l);return}s.done?e(u):Promise.resolve(u).then(r,i)}function ut(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function o(u){Q(a,r,i,o,s,"next",u)}function s(u){Q(a,r,i,o,s,"throw",u)}o(void 0)})}}var ue=d.createContext(null);function Rt(n){var{children:e}=n,t=ze(),[r,i]=d.useState(),[a,o]=d.useState();d.useEffect(function(){var l=!1;function v(){return f.apply(this,arguments)}function f(){return f=ut(function*(){try{var g=yield t.getServerConfigValues();l||i(new Map(g))}catch(m){l||o(m)}}),f.apply(this,arguments)}return v(),()=>{l=!0}},[t]);var s=r==null;return s||a!=null?c.jsx(N,{isLoading:s&&a==null,errorMessage:je(a)}):c.jsx(ue.Provider,{value:r,children:e})}function $t(){return T(ue,"No server config available in useServerConfig. Was code wrapped in ServerConfigBootstrap or ServerConfigContext.Provider?")}function V(n,e,t,r,i,a,o){try{var s=n[a](o),u=s.value}catch(l){t(l);return}s.done?e(u):Promise.resolve(u).then(r,i)}function lt(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function o(u){V(a,r,i,o,s,"next",u)}function s(u){V(a,r,i,o,s,"throw",u)}o(void 0)})}}function ee(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function te(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ee(Object(t),!0).forEach(function(r){ct(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):ee(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function ct(n,e,t){return e=dt(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function dt(n){var e=ft(n,"string");return typeof e=="symbol"?e:String(e)}function ft(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function Kt(n){var{dashboards:e,activeDashboard:t,onLayoutInitialized:r,onGoldenLayoutChange:i,plugins:a,emptyDashboard:o=c.jsx(N,{})}=n,s=Ee(),u=d.useCallback((l,v)=>{var{metadata:f}=l;try{if(f!=null){var g=De(f);return te(te({fetch:function(){var m=lt(function*(){return s(g)});function h(){return m.apply(this,arguments)}return h}()},l),{},{localDashboardId:v})}}catch{}return Ie.hydrate(l,v)},[s]);return c.jsx("div",{className:"tab-content",children:e.map(l=>c.jsx("div",{className:A("tab-pane",{active:l.id===t}),children:c.jsx(ot,{id:l.id,isActive:l.id===t,emptyDashboard:o,layoutConfig:l.layoutConfig,layoutSettings:l.layoutSettings,onLayoutInitialized:r,onGoldenLayoutChange:i,hydrate:u,plugins:a},l.key)},l.id))})}function Ut(){return T(st,"No IdeConnection available in useConnection. Was code wrapped in ConnectionContext.Provider?")}function Bt(){return T(We,"No user available in useUser. Was code wrapped in UserBootstrap or UserContext.Provider?")}function ne(n,e,t,r,i,a,o){try{var s=n[a](o),u=s.value}catch(l){t(l);return}s.done?e(u):Promise.resolve(u).then(r,i)}function re(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function o(u){ne(a,r,i,o,s,"next",u)}function s(u){ne(a,r,i,o,s,"throw",u)}o(void 0)})}}function ie(n,e,t){return e=ht(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function ht(n){var e=vt(n,"string");return typeof e=="symbol"?e:String(e)}function vt(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class zt{constructor(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";ie(this,"storageService",void 0),ie(this,"root",void 0),this.storageService=e,this.root=t}getLayouts(){var e=this;return re(function*(){var t=yield e.storageService.listItems(e.root,"*.json");return t.map(r=>r.basename)})()}getLayout(e){var t=this;return re(function*(){var r=yield t.storageService.loadFile("".concat(t.root,"/").concat(e)),i=yield r.text();return JSON.parse(i)})()}}function mt(n){return n.version===2}function pt(n){return Array.isArray(n)}function ae(n,e,t,r,i,a,o){try{var s=n[a](o),u=s.value}catch(l){t(l);return}s.done?e(u):Promise.resolve(u).then(r,i)}function gt(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function o(u){ae(a,r,i,o,s,"next",u)}function s(u){ae(a,r,i,o,s,"throw",u)}o(void 0)})}}var E=F.module("UserLayoutUtils"),bt={layoutConfig:[{type:"column",content:[{type:"row",height:40,content:[{type:"stack",content:[{type:"react-component",component:B.COMPONENT,title:B.TITLE,isClosable:!1},{type:"react-component",component:z.COMPONENT,title:z.TITLE,isClosable:!1}]},{type:"stack",width:25,content:[{type:"react-component",component:G.COMPONENT,title:G.TITLE,isClosable:!1},{type:"react-component",component:k.COMPONENT,title:k.TITLE,isClosable:!1}]}]},{type:"row",content:[{type:"stack",title:"Notebooks",content:[]}]}]}],links:[],filterSets:[],version:2},yt={layoutConfig:[],links:[],filterSets:[],version:2};function le(n){if(mt(n))return n;if(pt(n)){var e=n;return{layoutConfig:e,links:[],filterSets:[],version:2}}throw new Error("Unexpected layout import format: ".concat(n))}function Mt(n){return _.apply(this,arguments)}function _(){return _=gt(function*(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;try{var t=yield n.getLayouts();if(t.length>0)try{var r=yield n.getLayout(t[0]);return le(r)}catch(i){E.error("Unable to load layout",t[0],":",i),E.warn("No valid layouts found, falling back to default layout")}}catch(i){E.error("Unable to fetch layout list",i),E.warn("Falling back to default layout")}return e?bt:yt}),_.apply(this,arguments)}function Pt(n){var{filterSets:e,layoutConfig:t,links:r,pluginDataMap:i}=n,a={filterSets:e,layoutConfig:t,links:r,pluginDataMap:i,version:2};return a}const wt={exportLayout:Pt,getDefaultLayout:Mt,normalizeLayout:le};function oe(n,e,t,r,i,a,o){try{var s=n[a](o),u=s.value}catch(l){t(l);return}s.done?e(u):Promise.resolve(u).then(r,i)}function D(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function o(u){oe(a,r,i,o,s,"next",u)}function s(u){oe(a,r,i,o,s,"throw",u)}o(void 0)})}}function ce(n,e,t){return e=St(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function St(n){var e=Ot(n,"string");return typeof e=="symbol"?e:String(e)}function Ot(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Ct=F.module("LocalWorkspaceStorage");class p{static getBooleanServerConfig(e,t){var r,i;if((e==null||(r=e.get(t))===null||r===void 0?void 0:r.toLowerCase())==="true")return!0;if((e==null||(i=e.get(t))===null||i===void 0?void 0:i.toLowerCase())==="false")return!1}static makeDefaultWorkspaceSettings(e){for(var t={defaultDateTimeFormat:W.DEFAULT_DATETIME_FORMAT_STRING,formatter:[],timeZone:W.DEFAULT_TIME_ZONE_ID,showTimeZone:!1,showTSeparator:!0,disableMoveConfirmation:!1,defaultDecimalFormatOptions:{defaultFormatString:Te.DEFAULT_FORMAT_STRING},defaultIntegerFormatOptions:{defaultFormatString:Le.DEFAULT_FORMAT_STRING},truncateNumbersWithPound:!1,showEmptyStrings:!0,showNullStrings:!0,defaultNotebookSettings:{isMinimapEnabled:!1},webgl:!0,webglEditable:!0,gridDensity:"regular"},r={defaultDateTimeFormat:e==null?void 0:e.get("dateTimeFormat"),formatter:[],timeZone:e==null?void 0:e.get("timeZone"),showTimeZone:p.getBooleanServerConfig(e,"showTimeZone"),showTSeparator:p.getBooleanServerConfig(e,"showTSeparator"),disableMoveConfirmation:p.getBooleanServerConfig(e,"disableMoveConfirmation"),defaultDecimalFormatOptions:(e==null?void 0:e.get("decimalFormat"))!==void 0?{defaultFormatString:e==null?void 0:e.get("decimalFormat")}:void 0,defaultIntegerFormatOptions:(e==null?void 0:e.get("integerFormat"))!==void 0?{defaultFormatString:e==null?void 0:e.get("integerFormat")}:void 0,truncateNumbersWithPound:p.getBooleanServerConfig(e,"truncateNumbersWithPound"),showEmptyStrings:p.getBooleanServerConfig(e,"showEmptyStrings"),showNullStrings:p.getBooleanServerConfig(e,"showNullStrings"),defaultNotebookSettings:(e==null?void 0:e.get("isMinimapEnabled"))!==void 0?{isMinimapEnabled:p.getBooleanServerConfig(e,"isMinimapEnabled")}:void 0,webgl:p.getBooleanServerConfig(e,"web.webgl"),webglEditable:p.getBooleanServerConfig(e,"web.webgl.editable")},i=Object.keys(r),a=0;a<i.length;a+=1){var o=i[a];r[o]!==void 0&&(t[o]=r[o])}return t}static makeWorkspaceData(e,t){return D(function*(){var{filterSets:r,links:i,layoutConfig:a,pluginDataMap:o={}}=yield wt.getDefaultLayout(e,t==null?void 0:t.isConsoleAvailable);return{settings:{},layoutConfig:a,closed:[{}],links:i,filterSets:r,pluginDataMap:o}})()}static makeDefaultWorkspace(e,t){return D(function*(){return{data:yield p.makeWorkspaceData(e,t)}})()}constructor(e){ce(this,"layoutStorage",void 0),this.layoutStorage=e}load(e){var t=this;return D(function*(){try{var r,i=JSON.parse((r=localStorage.getItem(p.STORAGE_KEY))!==null&&r!==void 0?r:"");return i}catch{return Ct.info("Unable to load workspace data, initializing to default data"),p.makeDefaultWorkspace(t.layoutStorage,e)}})()}save(e){return D(function*(){return localStorage.setItem(p.STORAGE_KEY,JSON.stringify(e)),e})()}}ce(p,"STORAGE_KEY","deephaven.WorkspaceStorage");export{Kt as A,Pt as B,It as C,Qe as D,Ge as F,zt as G,p as L,Rt as S,At as U,ze as a,Bt as b,$t as c,jt as d,_e as e,Lt as f,Tt as g,se as h,ke as i,je as j,We as k,Ft as l,_t as m,R as n,ot as o,Nt as p,st as q,wt as r,Ve as s,mt as t,Ut as u,pt as v,bt as w,yt as x,le as y,Mt as z};
2
+ //# sourceMappingURL=LocalWorkspaceStorage-b02a7be3.js.map