@deephaven/embed-widget 0.85.3-beta.1 → 0.85.3-beta.3

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 (26) hide show
  1. package/build/assets/{App-ad85ef1e.js → App-1925702e.js} +2 -2
  2. package/build/assets/{App-ad85ef1e.js.map → App-1925702e.js.map} +1 -1
  3. package/build/assets/{Chart-0abf4434.js → Chart-3f4c77e4.js} +2 -2
  4. package/build/assets/{Chart-0abf4434.js.map → Chart-3f4c77e4.js.map} +1 -1
  5. package/build/assets/{IrisGrid-7b5676f7.js → IrisGrid-3c28a766.js} +2 -2
  6. package/build/assets/{IrisGrid-7b5676f7.js.map → IrisGrid-3c28a766.js.map} +1 -1
  7. package/build/assets/IrisGridThemeProvider-a33d80ee.js +11 -0
  8. package/build/assets/IrisGridThemeProvider-a33d80ee.js.map +1 -0
  9. package/build/assets/{LocalWorkspaceStorage-6282e8f1.js → LocalWorkspaceStorage-3d9e8ba8.js} +2 -2
  10. package/build/assets/{LocalWorkspaceStorage-6282e8f1.js.map → LocalWorkspaceStorage-3d9e8ba8.js.map} +1 -1
  11. package/build/assets/{LogPanel-c75e7132.js → LogPanel-1bda917b.js} +2 -2
  12. package/build/assets/{LogPanel-c75e7132.js.map → LogPanel-1bda917b.js.map} +1 -1
  13. package/build/assets/{MarkdownEditor-67690c12.js → MarkdownEditor-c29e651c.js} +2 -2
  14. package/build/assets/{MarkdownEditor-67690c12.js.map → MarkdownEditor-c29e651c.js.map} +1 -1
  15. package/build/assets/{MarkdownNotebook-95482961.js → MarkdownNotebook-8450c26a.js} +2 -2
  16. package/build/assets/{MarkdownNotebook-95482961.js.map → MarkdownNotebook-8450c26a.js.map} +1 -1
  17. package/build/assets/{index-ed3024e6.js → index-b63bcf2d.js} +2 -2
  18. package/build/assets/{index-ed3024e6.js.map → index-b63bcf2d.js.map} +1 -1
  19. package/build/assets/{index-c598d038.js → index-c4102b21.js} +4 -4
  20. package/build/assets/{index-c598d038.js.map → index-c4102b21.js.map} +1 -1
  21. package/build/assets/{index-c3a0788e.js → index-eef387d2.js} +2 -2
  22. package/build/assets/{index-c3a0788e.js.map → index-eef387d2.js.map} +1 -1
  23. package/build/index.html +1 -1
  24. package/package.json +17 -17
  25. package/build/assets/IrisGridThemeProvider-2e272069.js +0 -11
  26. package/build/assets/IrisGridThemeProvider-2e272069.js.map +0 -1
@@ -1,2 +1,2 @@
1
- import{r as d,M as _,I as c,K as W,Q as z,b4 as Oe,N as Ce}from"./vendor-5b2d9bf5.js";import{L as E,q as xe,a as k}from"./index-c3a0788e.js";import{z as P,a5 as Y,A as Ee,u as De,l as L,aX as ye,a6 as Te,ad as Ie,af as Z,as as _e,aY as Le,au as Ae,ax as je,aZ as Ne,aw as Fe,a_ as Re,aP as $e,a0 as Ue,$ as Ke,ay as Be,a$ as J,b0 as X,b1 as Q,b2 as V,a1 as ee,a2 as Ge,a3 as We}from"./LogPanel-c75e7132.js";function ze(t){var e=t;t instanceof CustomEvent&&(e=t.detail);var n="";if(e instanceof Error?n=e.message:e!=null&&(n="".concat(e)),n=n.trim(),n.length>0)return n}function ke(t,e){d.useEffect(()=>{if(t!=null){var n=new window.ResizeObserver(e);return n.observe(t),()=>{t!=null&&n.unobserve(t)}}},[t,e])}function te(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function He(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?te(Object(n),!0).forEach(function(r){w(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):te(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function w(t,e,n){return e=qe(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function qe(t){var e=Ye(t,"string");return typeof e=="symbol"?e:String(e)}function Ye(t,e){if(typeof t!="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var ne=E.module("ContextMenu");class x extends d.PureComponent{static handleContextMenu(e){e.metaKey||(e.stopPropagation(),e.preventDefault())}constructor(e){super(e),w(this,"container",void 0),w(this,"oldFocus",void 0),w(this,"activeSubMenuRef",void 0),w(this,"subMenuTimer",void 0),w(this,"rAF",void 0),w(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=_.createRef(),this.oldFocus=document.activeElement,this.activeSubMenuRef=_.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:n}=this.props;n(this)})}componentDidUpdate(e,n){var{actions:r}=this.props,{activeSubMenu:i}=this.state;if(i!==n.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:n}=this.state;return n}return this.getMouseIndex()}setKeyboardIndex(e){var{options:n}=this.props;n.separateKeyboardMouse!==void 0&&n.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,n=e.initialKeyboardIndex;n===void 0&&(n=-1);for(var{actions:r}=this.props,i=P.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:n,activeSubMenu:null,menuItems:P.sortActions(a)})}initMenuPromise(e){var n=Y.makeCancelable(e);this.setState(r=>({pendingItems:r.pendingItems.concat(n)})),n.then(r=>{this.setState(i=>{var a=i.pendingItems.indexOf(n);if(a>=0){var o=i.pendingItems.slice();return o.splice(a,1),{menuItems:P.sortActions(i.menuItems.concat(r)),pendingItems:o}}return null})},r=>{Y.isCanceled(r)||(this.setState(i=>{var a=i.pendingItems.indexOf(n);if(a>=0){var o=i.pendingItems.slice();return o.splice(a,1),{pendingItems:o}}return null}),ne.error(r))})}cancelPromises(){var{pendingItems:e}=this.state;e.map(n=>n.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,n,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:p,height:h}=(e=(n=this.container.current)===null||n===void 0?void 0:n.getBoundingClientRect())!==null&&e!==void 0?e:{width:0,height:0},S=((r=(i=this.container.current)===null||i===void 0?void 0:i.scrollHeight)!==null&&r!==void 0?r:0)>window.innerHeight;h===0||p===0||(f+h>window.innerHeight&&(f-h-u>0?f-=h-u:f=window.innerHeight-h),g+p>window.innerWidth&&(g=g-p-s),(v!==g||l!==f)&&(this.setState({hasOverflow:S}),o(f,g)))}}handleWindowResize(){this.container.current&&this.closeMenu(!0)}handleBlur(e){if(!this.container.current){ne.warn("Container is null!");return}if(!this.container.current.contains(e.relatedTarget)){for(var n=e.relatedTarget,r=!1;n&&!r;)r=n.hasAttribute("data-dh-context-menu"),n=n.parentElement;r||this.closeMenu(!0)}}isEscapeKey(e){var{left:n}=this.props;return e==="Escape"||n<0&&e==="ArrowRight"||e==="ArrowLeft"}handleKeyDown(e){var{menuItems:n}=this.state,r=this.getKeyboardIndex(),i=r,a=!1;if(e.key==="Enter"||e.key===" "){r>=0&&r<n.length&&this.handleMenuItemClick(n[r],e);return}if(e.key==="ArrowRight"?r>=0&&r<=n.length?a=!0:i=0:this.isEscapeKey(e.key)?i=null:e.key==="ArrowUp"||e.shiftKey&&e.key==="Tab"?i=P.getNextMenuItem(i,-1,n):(e.key==="ArrowDown"||e.key==="Tab")&&(i=P.getNextMenuItem(i,1,n)),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:n,activeSubMenu:r}=this.state,i=n[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:n,onMenuClosed:r}=this.props;cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{n(e),r(this)})}closeSubMenu(){this.setState({activeSubMenu:null})}handleCloseSubMenu(e){e?this.closeMenu(!0):this.closeSubMenu()}handleMenuItemClick(e,n){n.preventDefault(),n.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(n.nativeEvent),this.closeMenu(!0)))}handleMenuItemContextMenu(e,n){n.metaKey||this.handleMenuItemClick(e,n)}handleMenuItemMouseMove(e){var{menuItems:n}=this.state,r=n.indexOf(e);this.setMouseIndex(r),r>=0&&r<n.length&&(e.disabled===void 0||!e.disabled)&&this.openSubMenu(r)}handleMouseLeave(){this.setMouseIndex(-1)}render(){for(var e=[],{top:n,left:r}=this.props,{activeSubMenu:i,hasOverflow:a,keyboardIndex:o,menuItems:s,mouseIndex:u,pendingItems:l,subMenuTop:v,subMenuLeft:f,subMenuParentWidth:g,subMenuParentHeight:p}=this.state,h=0;h<s.length;h+=1){var S=s[h];h>0&&S.group!==s[h-1].group&&e.push(c.jsx("hr",{},"".concat(h,".separator")));var y=c.jsx(Ee,{ref:i===h?this.activeSubMenuRef:null,isKeyboardSelected:o===h,isMouseSelected:u===h,menuItem:S,closeMenu:this.handleCloseSubMenu,onMenuItemClick:this.handleMenuItemClick,onMenuItemMouseMove:this.handleMenuItemMouseMove,onMenuItemContextMenu:this.handleMenuItemContextMenu},h);e.push(y)}var O=null;l.length>0&&(O=c.jsx("div",{className:"loading",children:c.jsx(xe,{className:"loading-spinner-vertical-align"})}));var{menuStyle:j,"data-testid":q}=this.props,M=i!==null&&v!==null&&f!==null;return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:W({"has-overflow":a},"context-menu-container"),style:He({top:n,left:r},j),ref:this.container,"data-dh-context-menu":!0,onBlur:this.handleBlur,onKeyDown:this.handleKeyDown,onMouseLeave:this.handleMouseLeave,onContextMenu:x.handleContextMenu,role:"menuitem",tabIndex:0,"data-testid":q,children:[e,O]}),M&&i!==null&&v!==null&&f!==null&&c.jsx(x,{actions:s[i].actions||[],closeMenu:this.handleCloseSubMenu,top:v,left:f,updatePosition:(b,D)=>{this.setState({subMenuTop:b,subMenuLeft:D})},subMenuParentWidth:g,subMenuParentHeight:p},"sub-".concat(i))]})}}w(x,"defaultProps",{subMenuParentWidth:0,subMenuParentHeight:0,closeMenu(){},onMenuOpened(){},onMenuClosed(){},options:{},menuStyle:{},"data-testid":void 0});const Ze=x;function re(t,e,n){return e=Je(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Je(t){var e=Xe(t,"string");return typeof e=="symbol"?e:String(e)}function Xe(t,e){if(typeof t!="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}class Qe extends d.Component{constructor(e){super(e),re(this,"container",void 0),re(this,"openMenu",void 0),this.handleMenuClose=this.handleMenuClose.bind(this),this.handleContextMenu=this.handleContextMenu.bind(this),this.container=_.createRef(),this.openMenu=_.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 n=this.container.current.getBoundingClientRect(),r=e.clientY-n.top,i=e.clientX-n.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(P.isContextActionEvent(e)&&!(e.metaKey||e.ctrlKey)){var o=P.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":n}=this.props,{actions:r,top:i,left:a}=this.state;return r&&(e=c.jsx(Ze,{ref:this.openMenu,actions:r,onMenuClosed:this.handleMenuClose,top:i,left:a,updatePosition:(o,s)=>{this.setState({top:o,left:s})},"data-testid":n})),c.jsx("div",{className:W("context-menu-root",{active:r}),ref:this.container,children:e})}}const rn=Qe;function Ve(t,e){var n=De(),r=d.useMemo(()=>new n.CoreClient(t,e),[n,t,e]);return d.useEffect(()=>()=>{r.disconnect()},[r]),r}var be=d.createContext(null);function an(t){var{serverUrl:e,options:n,children:r}=t,i=Ve(e,n);return c.jsx(be.Provider,{value:i,children:r})}function et(){return L(be,"No Client available in useClient. Was code wrapped in ClientBootstrap or ClientContext.Provider?")}var tt=1e4;function on(t,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:tt;return new Promise((r,i)=>{var a,o=setTimeout(()=>{var u;(u=a)===null||u===void 0||u(),i(new ye("Timeout looking for variable ".concat(e)))},n);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=t.subscribeToFieldUpdates(s)})}function ie(t,e,n,r,i,a,o){try{var s=t[a](o),u=s.value}catch(l){n(l);return}s.done?e(u):Promise.resolve(u).then(r,i)}function nt(t){return function(){var e=this,n=arguments;return new Promise(function(r,i){var a=t.apply(e,n);function o(u){ie(a,r,i,o,s,"next",u)}function s(u){ie(a,r,i,o,s,"throw",u)}o(void 0)})}}var N=E.module("MessageUtils"),sn="io.deephaven.message.LoginOptions.request",rt="io.deephaven.message.SessionDetails.request",un="io.deephaven.broadcast",it="io.deephaven.broadcast.Login",at="io.deephaven.broadcast.Logout";function we(t){var e=t;return e!=null&&typeof e.id=="string"&&typeof e.message=="string"}function ln(t){return we(t)&&t.message===it}function cn(t){return we(t)&&t.message===at}function ot(t){var e=t;return e!=null&&typeof e.id=="string"}function st(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:z(),n=arguments.length>2?arguments[2]:void 0;return{message:t,id:e,payload:n}}function dn(t,e){return{id:t,payload:e}}function ut(){return window.opener!=null?window.opener:window.parent!=null&&window.parent!==window?window.parent:null}function lt(t){return R.apply(this,arguments)}function R(){return R=nt(function*(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:3e4,n=ut();if(n==null)throw new Error("window parent is null, unable to send request.");return new Promise((r,i)=>{var a,o=z(),s=u=>{var{data:l}=u;if(!ot(l)){N.debug("Ignoring non-deephaven response",l);return}if(N.debug("Received message",l),(l==null?void 0:l.id)!==o){N.debug("Ignore message, id doesn't match",l);return}window.clearTimeout(a),window.removeEventListener("message",s),r(l.payload)};window.addEventListener("message",s),a=window.setTimeout(()=>{window.removeEventListener("message",s),i(new ye("Request timed out"))},e),n.postMessage(st(t,o),"*")})}),R.apply(this,arguments)}function ct(t,e,n){return e=dt(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function dt(t){var e=ft(t,"string");return typeof e=="symbol"?e:String(e)}function ft(t,e){if(typeof t!="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}class ht extends Error{constructor(){super(...arguments),ct(this,"isNoConsolesError",!0)}}function vt(t){return t.isNoConsolesError}function ae(t,e,n,r,i,a,o){try{var s=t[a](o),u=s.value}catch(l){n(l);return}s.done?e(u):Promise.resolve(u).then(r,i)}function A(t){return function(){var e=this,n=arguments;return new Promise(function(r,i){var a=t.apply(e,n);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 C=E.module("SessionUtils");function fn(t,e){return C.info("Starting connection to '".concat(e,"'...")),new t.IdeConnection(e)}function pt(t,e,n){return $.apply(this,arguments)}function $(){return $=A(function*(t,e,n){C.info("Getting console types...");var r=yield e.getConsoleTypes();if(r.length===0)throw new ht("No console types available");C.info("Available types:",r);var i=r[0];C.info("Starting session with type",i);var a=yield e.startSession(i),o={type:i,id:z()};return C.info("Console session established",o),{session:a,config:o,connection:e,details:n,dh:t}}),$.apply(this,arguments)}function hn(t,e,n){return C.info("createCoreClient",e),new t.CoreClient(e,n)}function mt(t){return t!=null&&typeof t=="object"}function gt(){return U.apply(this,arguments)}function U(){return U=A(function*(){var t=yield lt(rt);if(!mt(t))throw new Error("Unexpected session details response: ".concat(t));return t}),U.apply(this,arguments)}function vn(){return K.apply(this,arguments)}function K(){return K=A(function*(){var t=new URLSearchParams(window.location.search);switch(t.get("authProvider")){case"parent":return gt()}return{}}),K.apply(this,arguments)}function pn(t,e,n){return B.apply(this,arguments)}function B(){return B=A(function*(t,e,n){var r;try{r=yield pt(t,e,n)}catch(i){if(!vt(i))throw i}return r}),B.apply(this,arguments)}function yt(t){var e=[...t.entries()].filter(n=>{var[,r]=n;return Ie(r)||Z(r)});return e.map(n=>{var[r,i]=n;if(Z(i)){var{DashboardPlugin:a}=i;return c.jsx(a,{},r)}var{component:o}=i;return c.jsx(o,{},r)})}function mn(){var t=Te(),e=d.useMemo(()=>yt(t),[t]);return e}var gn=d.createContext({}),yn=d.createContext({}),bt=d.createContext(null);function oe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function wt(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?oe(Object(n),!0).forEach(function(r){St(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):oe(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function St(t,e,n){return e=Mt(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Mt(t){var e=Pt(t,"string");return typeof e=="symbol"?e:String(e)}function Pt(t,e){if(typeof t!="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Ot=100,F=()=>{},Ct=Object.freeze({});function xt(t){var{id:e="default",children:n,emptyDashboard:r,layoutConfig:i,layoutSettings:a=Ct,onLayoutConfigChange:o=F,onGoldenLayoutChange:s=F,onLayoutInitialized:u=F,fallbackComponent:l=Ne,hydrate:v,dehydrate:f,panelWrapper:g}=t,p=d.useRef(null),[h,S]=d.useState(!1),[y,O]=d.useState();d.useEffect(function(){if(!p.current){O(void 0);return}var M=wt({},_e.makeDefaultLayout());M.settings===void 0&&(M.settings={}),Object.assign(M.settings,a),M.content=[];var b=new Le(M,p.current),D=()=>{b.off("initialised",D),S(!0)};return b.on("initialised",D),l!=null&&b.setFallbackComponent(l),b.init(),O(b),s(b),()=>{b.destroy()}},[a,l,s,S,O]);var j=d.useMemo(()=>Oe(()=>{y!=null&&y.isInitialised&&(y==null||y.updateSize())},Ot),[y]);return ke(p.current,j),c.jsxs("div",{className:"dashboard-container w-100 h-100",children:[c.jsx("div",{className:"w-100 h-100",ref:p}),h&&y&&c.jsx(Ae.Provider,{value:y,children:c.jsx(je,{emptyDashboard:r,id:e,layout:y,layoutConfig:i,onLayoutChange:o,onLayoutInitialized:u,hydrate:v,dehydrate:f,panelWrapper:g,children:n})})]})}var H="CREATE_DASHBOARD";function Et(t,e){try{t.off(H,e)}catch{}}function bn(t,e){return t.on(H,e),()=>Et(t,e)}function wn(t,e){t.emit(H,e)}var Dt=["id","isActive","plugins"];function se(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function ue(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?se(Object(n),!0).forEach(function(r){Tt(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):se(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Tt(t,e,n){return e=It(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function It(t){var e=_t(t,"string");return typeof e=="symbol"?e:String(e)}function _t(t,e){if(typeof t!="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Lt(t,e){if(t==null)return{};var n=At(t,e),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(i=0;i<a.length;i++)r=a[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function At(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,a;for(a=0;a<r.length;a++)i=r[a],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}function jt(t){var{id:e,isActive:n,plugins:r}=t,i=Lt(t,Dt),[a,o]=d.useState(n),s=Ce(),u=d.useCallback(l=>{s(e===Fe?Re({layoutConfig:l}):$e(e,{layoutConfig:l}))},[e,s]);return!a&&n&&o(!0),a?c.jsx(xt,ue(ue({id:e,onLayoutConfigChange:u},i),{},{children:r})):c.jsx(k,{})}var Nt=d.createContext(null);function le(t,e,n,r,i,a,o){try{var s=t[a](o),u=s.value}catch(l){n(l);return}s.done?e(u):Promise.resolve(u).then(r,i)}function Ft(t){return function(){var e=this,n=arguments;return new Promise(function(r,i){var a=t.apply(e,n);function o(u){le(a,r,i,o,s,"next",u)}function s(u){le(a,r,i,o,s,"throw",u)}o(void 0)})}}var Se=d.createContext(null);function Sn(t){var{children:e}=t,n=et(),[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=Ft(function*(){try{var g=yield n.getServerConfigValues();l||i(new Map(g))}catch(p){l||o(p)}}),f.apply(this,arguments)}return v(),()=>{l=!0}},[n]);var s=r==null;return s||a!=null?c.jsx(k,{isLoading:s&&a==null,errorMessage:ze(a)}):c.jsx(Se.Provider,{value:r,children:e})}function Mn(){return L(Se,"No server config available in useServerConfig. Was code wrapped in ServerConfigBootstrap or ServerConfigContext.Provider?")}function ce(t,e,n,r,i,a,o){try{var s=t[a](o),u=s.value}catch(l){n(l);return}s.done?e(u):Promise.resolve(u).then(r,i)}function Rt(t){return function(){var e=this,n=arguments;return new Promise(function(r,i){var a=t.apply(e,n);function o(u){ce(a,r,i,o,s,"next",u)}function s(u){ce(a,r,i,o,s,"throw",u)}o(void 0)})}}function de(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function fe(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?de(Object(n),!0).forEach(function(r){$t(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):de(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function $t(t,e,n){return e=Ut(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Ut(t){var e=Kt(t,"string");return typeof e=="symbol"?e:String(e)}function Kt(t,e){if(typeof t!="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Pn(t){var{dashboards:e,activeDashboard:n,onLayoutInitialized:r,onGoldenLayoutChange:i,plugins:a,emptyDashboard:o=c.jsx(k,{})}=t,s=Ue(),u=d.useCallback((l,v)=>{var{metadata:f}=l;try{if(f!=null){var g=Ke(f);return fe(fe({fetch:function(){var p=Rt(function*(){return s(g)});function h(){return p.apply(this,arguments)}return h}()},l),{},{localDashboardId:v})}}catch{}return Be.hydrate(l,v)},[s]);return c.jsx("div",{className:"tab-content",children:e.map(l=>c.jsx("div",{className:W("tab-pane",{active:l.id===n}),children:c.jsx(jt,{id:l.id,isActive:l.id===n,emptyDashboard:o,layoutConfig:l.layoutConfig,layoutSettings:l.layoutSettings,onLayoutInitialized:r,onGoldenLayoutChange:i,hydrate:u,plugins:a},l.key)},l.id))})}function On(){return L(Nt,"No IdeConnection available in useConnection. Was code wrapped in ConnectionContext.Provider?")}function Cn(){return L(bt,"No user available in useUser. Was code wrapped in UserBootstrap or UserContext.Provider?")}function he(t,e,n,r,i,a,o){try{var s=t[a](o),u=s.value}catch(l){n(l);return}s.done?e(u):Promise.resolve(u).then(r,i)}function ve(t){return function(){var e=this,n=arguments;return new Promise(function(r,i){var a=t.apply(e,n);function o(u){he(a,r,i,o,s,"next",u)}function s(u){he(a,r,i,o,s,"throw",u)}o(void 0)})}}function pe(t,e,n){return e=Bt(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Bt(t){var e=Gt(t,"string");return typeof e=="symbol"?e:String(e)}function Gt(t,e){if(typeof t!="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}class xn{constructor(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";pe(this,"storageService",void 0),pe(this,"root",void 0),this.storageService=e,this.root=n}getLayouts(){var e=this;return ve(function*(){var n=yield e.storageService.listItems(e.root,"*.json");return n.map(r=>r.basename)})()}getLayout(e){var n=this;return ve(function*(){var r=yield n.storageService.loadFile("".concat(n.root,"/").concat(e)),i=yield r.text();return JSON.parse(i)})()}}function Wt(t){return t.version===2}function zt(t){return Array.isArray(t)}function me(t,e,n,r,i,a,o){try{var s=t[a](o),u=s.value}catch(l){n(l);return}s.done?e(u):Promise.resolve(u).then(r,i)}function kt(t){return function(){var e=this,n=arguments;return new Promise(function(r,i){var a=t.apply(e,n);function o(u){me(a,r,i,o,s,"next",u)}function s(u){me(a,r,i,o,s,"throw",u)}o(void 0)})}}var T=E.module("UserLayoutUtils"),Ht={layoutConfig:[{type:"column",content:[{type:"row",height:40,content:[{type:"stack",content:[{type:"react-component",component:J.COMPONENT,title:J.TITLE,isClosable:!1},{type:"react-component",component:X.COMPONENT,title:X.TITLE,isClosable:!1}]},{type:"stack",width:25,content:[{type:"react-component",component:Q.COMPONENT,title:Q.TITLE,isClosable:!1},{type:"react-component",component:V.COMPONENT,title:V.TITLE,isClosable:!1}]}]},{type:"row",content:[{type:"stack",title:"Notebooks",content:[]}]}]}],links:[],filterSets:[],version:2},qt={layoutConfig:[],links:[],filterSets:[],version:2};function Me(t){if(Wt(t))return t;if(zt(t)){var e=t;return{layoutConfig:e,links:[],filterSets:[],version:2}}throw new Error("Unexpected layout import format: ".concat(t))}function Yt(t){return G.apply(this,arguments)}function G(){return G=kt(function*(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;try{var n=yield t.getLayouts();if(n.length>0)try{var r=yield t.getLayout(n[0]);return Me(r)}catch(i){T.error("Unable to load layout",n[0],":",i),T.warn("No valid layouts found, falling back to default layout")}}catch(i){T.error("Unable to fetch layout list",i),T.warn("Falling back to default layout")}return e?Ht:qt}),G.apply(this,arguments)}function Zt(t){var{filterSets:e,layoutConfig:n,links:r,pluginDataMap:i}=t,a={filterSets:e,layoutConfig:n,links:r,pluginDataMap:i,version:2};return a}const Jt={exportLayout:Zt,getDefaultLayout:Yt,normalizeLayout:Me};function ge(t,e,n,r,i,a,o){try{var s=t[a](o),u=s.value}catch(l){n(l);return}s.done?e(u):Promise.resolve(u).then(r,i)}function I(t){return function(){var e=this,n=arguments;return new Promise(function(r,i){var a=t.apply(e,n);function o(u){ge(a,r,i,o,s,"next",u)}function s(u){ge(a,r,i,o,s,"throw",u)}o(void 0)})}}function Pe(t,e,n){return e=Xt(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Xt(t){var e=Qt(t,"string");return typeof e=="symbol"?e:String(e)}function Qt(t,e){if(typeof t!="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Vt=E.module("LocalWorkspaceStorage");class m{static getBooleanServerConfig(e,n){var r,i;if((e==null||(r=e.get(n))===null||r===void 0?void 0:r.toLowerCase())==="true")return!0;if((e==null||(i=e.get(n))===null||i===void 0?void 0:i.toLowerCase())==="false")return!1}static makeDefaultWorkspaceSettings(e){for(var n={defaultDateTimeFormat:ee.DEFAULT_DATETIME_FORMAT_STRING,formatter:[],timeZone:ee.DEFAULT_TIME_ZONE_ID,showTimeZone:!1,showTSeparator:!0,disableMoveConfirmation:!1,defaultDecimalFormatOptions:{defaultFormatString:Ge.DEFAULT_FORMAT_STRING},defaultIntegerFormatOptions:{defaultFormatString:We.DEFAULT_FORMAT_STRING},truncateNumbersWithPound:!1,showEmptyStrings:!0,showNullStrings:!0,defaultNotebookSettings:{isMinimapEnabled:!1},webgl:!0,webglEditable:!0},r={defaultDateTimeFormat:e==null?void 0:e.get("dateTimeFormat"),formatter:[],timeZone:e==null?void 0:e.get("timeZone"),showTimeZone:m.getBooleanServerConfig(e,"showTimeZone"),showTSeparator:m.getBooleanServerConfig(e,"showTSeparator"),disableMoveConfirmation:m.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:m.getBooleanServerConfig(e,"truncateNumbersWithPound"),showEmptyStrings:m.getBooleanServerConfig(e,"showEmptyStrings"),showNullStrings:m.getBooleanServerConfig(e,"showNullStrings"),defaultNotebookSettings:(e==null?void 0:e.get("isMinimapEnabled"))!==void 0?{isMinimapEnabled:m.getBooleanServerConfig(e,"isMinimapEnabled")}:void 0,webgl:m.getBooleanServerConfig(e,"web.webgl"),webglEditable:m.getBooleanServerConfig(e,"web.webgl.editable")},i=Object.keys(r),a=0;a<i.length;a+=1){var o=i[a];r[o]!==void 0&&(n[o]=r[o])}return n}static makeWorkspaceData(e,n){return I(function*(){var{filterSets:r,links:i,layoutConfig:a,pluginDataMap:o={}}=yield Jt.getDefaultLayout(e,n==null?void 0:n.isConsoleAvailable);return{settings:{},layoutConfig:a,closed:[{}],links:i,filterSets:r,pluginDataMap:o}})()}static makeDefaultWorkspace(e,n){return I(function*(){return{data:yield m.makeWorkspaceData(e,n)}})()}constructor(e){Pe(this,"layoutStorage",void 0),this.layoutStorage=e}load(e){var n=this;return I(function*(){try{var r,i=JSON.parse((r=localStorage.getItem(m.STORAGE_KEY))!==null&&r!==void 0?r:"");return i}catch{return Vt.info("Unable to load workspace data, initializing to default data"),m.makeDefaultWorkspace(n.layoutStorage,e)}})()}save(e){return I(function*(){return localStorage.setItem(m.STORAGE_KEY,JSON.stringify(e)),e})()}}Pe(m,"STORAGE_KEY","deephaven.WorkspaceStorage");export{Yt as $,Pn as A,un as B,rn as C,dn as D,lt as E,tt as F,xn as G,yt as H,ze as I,bt as J,gn as K,m as L,xt as M,ht as N,H as O,jt as P,wn as Q,Nt as R,rt as S,Sn as T,yn as U,Jt as V,Wt as W,zt as X,Ht as Y,qt as Z,Me as _,et as a,Zt as a0,Cn as b,Mn as c,mn as d,pn as e,on as f,vn as g,ke as h,an as i,be as j,it as k,bn as l,at as m,sn as n,fn as o,hn as p,pt as q,ut as r,Et as s,ln as t,On as u,cn as v,we as w,vt as x,ot as y,st as z};
2
- //# sourceMappingURL=LocalWorkspaceStorage-6282e8f1.js.map
1
+ import{r as d,M as _,I as c,K as W,Q as z,b4 as Oe,N as Ce}from"./vendor-5b2d9bf5.js";import{L as E,q as xe,a as k}from"./index-eef387d2.js";import{z as P,a5 as Y,A as Ee,u as De,l as L,aX as ye,a6 as Te,ad as Ie,af as Z,as as _e,aY as Le,au as Ae,ax as je,aZ as Ne,aw as Fe,a_ as Re,aP as $e,a0 as Ue,$ as Ke,ay as Be,a$ as J,b0 as X,b1 as Q,b2 as V,a1 as ee,a2 as Ge,a3 as We}from"./LogPanel-1bda917b.js";function ze(t){var e=t;t instanceof CustomEvent&&(e=t.detail);var n="";if(e instanceof Error?n=e.message:e!=null&&(n="".concat(e)),n=n.trim(),n.length>0)return n}function ke(t,e){d.useEffect(()=>{if(t!=null){var n=new window.ResizeObserver(e);return n.observe(t),()=>{t!=null&&n.unobserve(t)}}},[t,e])}function te(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function He(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?te(Object(n),!0).forEach(function(r){w(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):te(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function w(t,e,n){return e=qe(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function qe(t){var e=Ye(t,"string");return typeof e=="symbol"?e:String(e)}function Ye(t,e){if(typeof t!="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var ne=E.module("ContextMenu");class x extends d.PureComponent{static handleContextMenu(e){e.metaKey||(e.stopPropagation(),e.preventDefault())}constructor(e){super(e),w(this,"container",void 0),w(this,"oldFocus",void 0),w(this,"activeSubMenuRef",void 0),w(this,"subMenuTimer",void 0),w(this,"rAF",void 0),w(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=_.createRef(),this.oldFocus=document.activeElement,this.activeSubMenuRef=_.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:n}=this.props;n(this)})}componentDidUpdate(e,n){var{actions:r}=this.props,{activeSubMenu:i}=this.state;if(i!==n.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:n}=this.state;return n}return this.getMouseIndex()}setKeyboardIndex(e){var{options:n}=this.props;n.separateKeyboardMouse!==void 0&&n.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,n=e.initialKeyboardIndex;n===void 0&&(n=-1);for(var{actions:r}=this.props,i=P.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:n,activeSubMenu:null,menuItems:P.sortActions(a)})}initMenuPromise(e){var n=Y.makeCancelable(e);this.setState(r=>({pendingItems:r.pendingItems.concat(n)})),n.then(r=>{this.setState(i=>{var a=i.pendingItems.indexOf(n);if(a>=0){var o=i.pendingItems.slice();return o.splice(a,1),{menuItems:P.sortActions(i.menuItems.concat(r)),pendingItems:o}}return null})},r=>{Y.isCanceled(r)||(this.setState(i=>{var a=i.pendingItems.indexOf(n);if(a>=0){var o=i.pendingItems.slice();return o.splice(a,1),{pendingItems:o}}return null}),ne.error(r))})}cancelPromises(){var{pendingItems:e}=this.state;e.map(n=>n.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,n,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:p,height:h}=(e=(n=this.container.current)===null||n===void 0?void 0:n.getBoundingClientRect())!==null&&e!==void 0?e:{width:0,height:0},S=((r=(i=this.container.current)===null||i===void 0?void 0:i.scrollHeight)!==null&&r!==void 0?r:0)>window.innerHeight;h===0||p===0||(f+h>window.innerHeight&&(f-h-u>0?f-=h-u:f=window.innerHeight-h),g+p>window.innerWidth&&(g=g-p-s),(v!==g||l!==f)&&(this.setState({hasOverflow:S}),o(f,g)))}}handleWindowResize(){this.container.current&&this.closeMenu(!0)}handleBlur(e){if(!this.container.current){ne.warn("Container is null!");return}if(!this.container.current.contains(e.relatedTarget)){for(var n=e.relatedTarget,r=!1;n&&!r;)r=n.hasAttribute("data-dh-context-menu"),n=n.parentElement;r||this.closeMenu(!0)}}isEscapeKey(e){var{left:n}=this.props;return e==="Escape"||n<0&&e==="ArrowRight"||e==="ArrowLeft"}handleKeyDown(e){var{menuItems:n}=this.state,r=this.getKeyboardIndex(),i=r,a=!1;if(e.key==="Enter"||e.key===" "){r>=0&&r<n.length&&this.handleMenuItemClick(n[r],e);return}if(e.key==="ArrowRight"?r>=0&&r<=n.length?a=!0:i=0:this.isEscapeKey(e.key)?i=null:e.key==="ArrowUp"||e.shiftKey&&e.key==="Tab"?i=P.getNextMenuItem(i,-1,n):(e.key==="ArrowDown"||e.key==="Tab")&&(i=P.getNextMenuItem(i,1,n)),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:n,activeSubMenu:r}=this.state,i=n[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:n,onMenuClosed:r}=this.props;cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{n(e),r(this)})}closeSubMenu(){this.setState({activeSubMenu:null})}handleCloseSubMenu(e){e?this.closeMenu(!0):this.closeSubMenu()}handleMenuItemClick(e,n){n.preventDefault(),n.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(n.nativeEvent),this.closeMenu(!0)))}handleMenuItemContextMenu(e,n){n.metaKey||this.handleMenuItemClick(e,n)}handleMenuItemMouseMove(e){var{menuItems:n}=this.state,r=n.indexOf(e);this.setMouseIndex(r),r>=0&&r<n.length&&(e.disabled===void 0||!e.disabled)&&this.openSubMenu(r)}handleMouseLeave(){this.setMouseIndex(-1)}render(){for(var e=[],{top:n,left:r}=this.props,{activeSubMenu:i,hasOverflow:a,keyboardIndex:o,menuItems:s,mouseIndex:u,pendingItems:l,subMenuTop:v,subMenuLeft:f,subMenuParentWidth:g,subMenuParentHeight:p}=this.state,h=0;h<s.length;h+=1){var S=s[h];h>0&&S.group!==s[h-1].group&&e.push(c.jsx("hr",{},"".concat(h,".separator")));var y=c.jsx(Ee,{ref:i===h?this.activeSubMenuRef:null,isKeyboardSelected:o===h,isMouseSelected:u===h,menuItem:S,closeMenu:this.handleCloseSubMenu,onMenuItemClick:this.handleMenuItemClick,onMenuItemMouseMove:this.handleMenuItemMouseMove,onMenuItemContextMenu:this.handleMenuItemContextMenu},h);e.push(y)}var O=null;l.length>0&&(O=c.jsx("div",{className:"loading",children:c.jsx(xe,{className:"loading-spinner-vertical-align"})}));var{menuStyle:j,"data-testid":q}=this.props,M=i!==null&&v!==null&&f!==null;return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:W({"has-overflow":a},"context-menu-container"),style:He({top:n,left:r},j),ref:this.container,"data-dh-context-menu":!0,onBlur:this.handleBlur,onKeyDown:this.handleKeyDown,onMouseLeave:this.handleMouseLeave,onContextMenu:x.handleContextMenu,role:"menuitem",tabIndex:0,"data-testid":q,children:[e,O]}),M&&i!==null&&v!==null&&f!==null&&c.jsx(x,{actions:s[i].actions||[],closeMenu:this.handleCloseSubMenu,top:v,left:f,updatePosition:(b,D)=>{this.setState({subMenuTop:b,subMenuLeft:D})},subMenuParentWidth:g,subMenuParentHeight:p},"sub-".concat(i))]})}}w(x,"defaultProps",{subMenuParentWidth:0,subMenuParentHeight:0,closeMenu(){},onMenuOpened(){},onMenuClosed(){},options:{},menuStyle:{},"data-testid":void 0});const Ze=x;function re(t,e,n){return e=Je(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Je(t){var e=Xe(t,"string");return typeof e=="symbol"?e:String(e)}function Xe(t,e){if(typeof t!="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}class Qe extends d.Component{constructor(e){super(e),re(this,"container",void 0),re(this,"openMenu",void 0),this.handleMenuClose=this.handleMenuClose.bind(this),this.handleContextMenu=this.handleContextMenu.bind(this),this.container=_.createRef(),this.openMenu=_.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 n=this.container.current.getBoundingClientRect(),r=e.clientY-n.top,i=e.clientX-n.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(P.isContextActionEvent(e)&&!(e.metaKey||e.ctrlKey)){var o=P.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":n}=this.props,{actions:r,top:i,left:a}=this.state;return r&&(e=c.jsx(Ze,{ref:this.openMenu,actions:r,onMenuClosed:this.handleMenuClose,top:i,left:a,updatePosition:(o,s)=>{this.setState({top:o,left:s})},"data-testid":n})),c.jsx("div",{className:W("context-menu-root",{active:r}),ref:this.container,children:e})}}const rn=Qe;function Ve(t,e){var n=De(),r=d.useMemo(()=>new n.CoreClient(t,e),[n,t,e]);return d.useEffect(()=>()=>{r.disconnect()},[r]),r}var be=d.createContext(null);function an(t){var{serverUrl:e,options:n,children:r}=t,i=Ve(e,n);return c.jsx(be.Provider,{value:i,children:r})}function et(){return L(be,"No Client available in useClient. Was code wrapped in ClientBootstrap or ClientContext.Provider?")}var tt=1e4;function on(t,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:tt;return new Promise((r,i)=>{var a,o=setTimeout(()=>{var u;(u=a)===null||u===void 0||u(),i(new ye("Timeout looking for variable ".concat(e)))},n);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=t.subscribeToFieldUpdates(s)})}function ie(t,e,n,r,i,a,o){try{var s=t[a](o),u=s.value}catch(l){n(l);return}s.done?e(u):Promise.resolve(u).then(r,i)}function nt(t){return function(){var e=this,n=arguments;return new Promise(function(r,i){var a=t.apply(e,n);function o(u){ie(a,r,i,o,s,"next",u)}function s(u){ie(a,r,i,o,s,"throw",u)}o(void 0)})}}var N=E.module("MessageUtils"),sn="io.deephaven.message.LoginOptions.request",rt="io.deephaven.message.SessionDetails.request",un="io.deephaven.broadcast",it="io.deephaven.broadcast.Login",at="io.deephaven.broadcast.Logout";function we(t){var e=t;return e!=null&&typeof e.id=="string"&&typeof e.message=="string"}function ln(t){return we(t)&&t.message===it}function cn(t){return we(t)&&t.message===at}function ot(t){var e=t;return e!=null&&typeof e.id=="string"}function st(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:z(),n=arguments.length>2?arguments[2]:void 0;return{message:t,id:e,payload:n}}function dn(t,e){return{id:t,payload:e}}function ut(){return window.opener!=null?window.opener:window.parent!=null&&window.parent!==window?window.parent:null}function lt(t){return R.apply(this,arguments)}function R(){return R=nt(function*(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:3e4,n=ut();if(n==null)throw new Error("window parent is null, unable to send request.");return new Promise((r,i)=>{var a,o=z(),s=u=>{var{data:l}=u;if(!ot(l)){N.debug("Ignoring non-deephaven response",l);return}if(N.debug("Received message",l),(l==null?void 0:l.id)!==o){N.debug("Ignore message, id doesn't match",l);return}window.clearTimeout(a),window.removeEventListener("message",s),r(l.payload)};window.addEventListener("message",s),a=window.setTimeout(()=>{window.removeEventListener("message",s),i(new ye("Request timed out"))},e),n.postMessage(st(t,o),"*")})}),R.apply(this,arguments)}function ct(t,e,n){return e=dt(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function dt(t){var e=ft(t,"string");return typeof e=="symbol"?e:String(e)}function ft(t,e){if(typeof t!="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}class ht extends Error{constructor(){super(...arguments),ct(this,"isNoConsolesError",!0)}}function vt(t){return t.isNoConsolesError}function ae(t,e,n,r,i,a,o){try{var s=t[a](o),u=s.value}catch(l){n(l);return}s.done?e(u):Promise.resolve(u).then(r,i)}function A(t){return function(){var e=this,n=arguments;return new Promise(function(r,i){var a=t.apply(e,n);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 C=E.module("SessionUtils");function fn(t,e){return C.info("Starting connection to '".concat(e,"'...")),new t.IdeConnection(e)}function pt(t,e,n){return $.apply(this,arguments)}function $(){return $=A(function*(t,e,n){C.info("Getting console types...");var r=yield e.getConsoleTypes();if(r.length===0)throw new ht("No console types available");C.info("Available types:",r);var i=r[0];C.info("Starting session with type",i);var a=yield e.startSession(i),o={type:i,id:z()};return C.info("Console session established",o),{session:a,config:o,connection:e,details:n,dh:t}}),$.apply(this,arguments)}function hn(t,e,n){return C.info("createCoreClient",e),new t.CoreClient(e,n)}function mt(t){return t!=null&&typeof t=="object"}function gt(){return U.apply(this,arguments)}function U(){return U=A(function*(){var t=yield lt(rt);if(!mt(t))throw new Error("Unexpected session details response: ".concat(t));return t}),U.apply(this,arguments)}function vn(){return K.apply(this,arguments)}function K(){return K=A(function*(){var t=new URLSearchParams(window.location.search);switch(t.get("authProvider")){case"parent":return gt()}return{}}),K.apply(this,arguments)}function pn(t,e,n){return B.apply(this,arguments)}function B(){return B=A(function*(t,e,n){var r;try{r=yield pt(t,e,n)}catch(i){if(!vt(i))throw i}return r}),B.apply(this,arguments)}function yt(t){var e=[...t.entries()].filter(n=>{var[,r]=n;return Ie(r)||Z(r)});return e.map(n=>{var[r,i]=n;if(Z(i)){var{DashboardPlugin:a}=i;return c.jsx(a,{},r)}var{component:o}=i;return c.jsx(o,{},r)})}function mn(){var t=Te(),e=d.useMemo(()=>yt(t),[t]);return e}var gn=d.createContext({}),yn=d.createContext({}),bt=d.createContext(null);function oe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function wt(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?oe(Object(n),!0).forEach(function(r){St(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):oe(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function St(t,e,n){return e=Mt(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Mt(t){var e=Pt(t,"string");return typeof e=="symbol"?e:String(e)}function Pt(t,e){if(typeof t!="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Ot=100,F=()=>{},Ct=Object.freeze({});function xt(t){var{id:e="default",children:n,emptyDashboard:r,layoutConfig:i,layoutSettings:a=Ct,onLayoutConfigChange:o=F,onGoldenLayoutChange:s=F,onLayoutInitialized:u=F,fallbackComponent:l=Ne,hydrate:v,dehydrate:f,panelWrapper:g}=t,p=d.useRef(null),[h,S]=d.useState(!1),[y,O]=d.useState();d.useEffect(function(){if(!p.current){O(void 0);return}var M=wt({},_e.makeDefaultLayout());M.settings===void 0&&(M.settings={}),Object.assign(M.settings,a),M.content=[];var b=new Le(M,p.current),D=()=>{b.off("initialised",D),S(!0)};return b.on("initialised",D),l!=null&&b.setFallbackComponent(l),b.init(),O(b),s(b),()=>{b.destroy()}},[a,l,s,S,O]);var j=d.useMemo(()=>Oe(()=>{y!=null&&y.isInitialised&&(y==null||y.updateSize())},Ot),[y]);return ke(p.current,j),c.jsxs("div",{className:"dashboard-container w-100 h-100",children:[c.jsx("div",{className:"w-100 h-100",ref:p}),h&&y&&c.jsx(Ae.Provider,{value:y,children:c.jsx(je,{emptyDashboard:r,id:e,layout:y,layoutConfig:i,onLayoutChange:o,onLayoutInitialized:u,hydrate:v,dehydrate:f,panelWrapper:g,children:n})})]})}var H="CREATE_DASHBOARD";function Et(t,e){try{t.off(H,e)}catch{}}function bn(t,e){return t.on(H,e),()=>Et(t,e)}function wn(t,e){t.emit(H,e)}var Dt=["id","isActive","plugins"];function se(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function ue(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?se(Object(n),!0).forEach(function(r){Tt(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):se(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Tt(t,e,n){return e=It(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function It(t){var e=_t(t,"string");return typeof e=="symbol"?e:String(e)}function _t(t,e){if(typeof t!="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Lt(t,e){if(t==null)return{};var n=At(t,e),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(i=0;i<a.length;i++)r=a[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function At(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,a;for(a=0;a<r.length;a++)i=r[a],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}function jt(t){var{id:e,isActive:n,plugins:r}=t,i=Lt(t,Dt),[a,o]=d.useState(n),s=Ce(),u=d.useCallback(l=>{s(e===Fe?Re({layoutConfig:l}):$e(e,{layoutConfig:l}))},[e,s]);return!a&&n&&o(!0),a?c.jsx(xt,ue(ue({id:e,onLayoutConfigChange:u},i),{},{children:r})):c.jsx(k,{})}var Nt=d.createContext(null);function le(t,e,n,r,i,a,o){try{var s=t[a](o),u=s.value}catch(l){n(l);return}s.done?e(u):Promise.resolve(u).then(r,i)}function Ft(t){return function(){var e=this,n=arguments;return new Promise(function(r,i){var a=t.apply(e,n);function o(u){le(a,r,i,o,s,"next",u)}function s(u){le(a,r,i,o,s,"throw",u)}o(void 0)})}}var Se=d.createContext(null);function Sn(t){var{children:e}=t,n=et(),[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=Ft(function*(){try{var g=yield n.getServerConfigValues();l||i(new Map(g))}catch(p){l||o(p)}}),f.apply(this,arguments)}return v(),()=>{l=!0}},[n]);var s=r==null;return s||a!=null?c.jsx(k,{isLoading:s&&a==null,errorMessage:ze(a)}):c.jsx(Se.Provider,{value:r,children:e})}function Mn(){return L(Se,"No server config available in useServerConfig. Was code wrapped in ServerConfigBootstrap or ServerConfigContext.Provider?")}function ce(t,e,n,r,i,a,o){try{var s=t[a](o),u=s.value}catch(l){n(l);return}s.done?e(u):Promise.resolve(u).then(r,i)}function Rt(t){return function(){var e=this,n=arguments;return new Promise(function(r,i){var a=t.apply(e,n);function o(u){ce(a,r,i,o,s,"next",u)}function s(u){ce(a,r,i,o,s,"throw",u)}o(void 0)})}}function de(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function fe(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?de(Object(n),!0).forEach(function(r){$t(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):de(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function $t(t,e,n){return e=Ut(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Ut(t){var e=Kt(t,"string");return typeof e=="symbol"?e:String(e)}function Kt(t,e){if(typeof t!="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Pn(t){var{dashboards:e,activeDashboard:n,onLayoutInitialized:r,onGoldenLayoutChange:i,plugins:a,emptyDashboard:o=c.jsx(k,{})}=t,s=Ue(),u=d.useCallback((l,v)=>{var{metadata:f}=l;try{if(f!=null){var g=Ke(f);return fe(fe({fetch:function(){var p=Rt(function*(){return s(g)});function h(){return p.apply(this,arguments)}return h}()},l),{},{localDashboardId:v})}}catch{}return Be.hydrate(l,v)},[s]);return c.jsx("div",{className:"tab-content",children:e.map(l=>c.jsx("div",{className:W("tab-pane",{active:l.id===n}),children:c.jsx(jt,{id:l.id,isActive:l.id===n,emptyDashboard:o,layoutConfig:l.layoutConfig,layoutSettings:l.layoutSettings,onLayoutInitialized:r,onGoldenLayoutChange:i,hydrate:u,plugins:a},l.key)},l.id))})}function On(){return L(Nt,"No IdeConnection available in useConnection. Was code wrapped in ConnectionContext.Provider?")}function Cn(){return L(bt,"No user available in useUser. Was code wrapped in UserBootstrap or UserContext.Provider?")}function he(t,e,n,r,i,a,o){try{var s=t[a](o),u=s.value}catch(l){n(l);return}s.done?e(u):Promise.resolve(u).then(r,i)}function ve(t){return function(){var e=this,n=arguments;return new Promise(function(r,i){var a=t.apply(e,n);function o(u){he(a,r,i,o,s,"next",u)}function s(u){he(a,r,i,o,s,"throw",u)}o(void 0)})}}function pe(t,e,n){return e=Bt(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Bt(t){var e=Gt(t,"string");return typeof e=="symbol"?e:String(e)}function Gt(t,e){if(typeof t!="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}class xn{constructor(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";pe(this,"storageService",void 0),pe(this,"root",void 0),this.storageService=e,this.root=n}getLayouts(){var e=this;return ve(function*(){var n=yield e.storageService.listItems(e.root,"*.json");return n.map(r=>r.basename)})()}getLayout(e){var n=this;return ve(function*(){var r=yield n.storageService.loadFile("".concat(n.root,"/").concat(e)),i=yield r.text();return JSON.parse(i)})()}}function Wt(t){return t.version===2}function zt(t){return Array.isArray(t)}function me(t,e,n,r,i,a,o){try{var s=t[a](o),u=s.value}catch(l){n(l);return}s.done?e(u):Promise.resolve(u).then(r,i)}function kt(t){return function(){var e=this,n=arguments;return new Promise(function(r,i){var a=t.apply(e,n);function o(u){me(a,r,i,o,s,"next",u)}function s(u){me(a,r,i,o,s,"throw",u)}o(void 0)})}}var T=E.module("UserLayoutUtils"),Ht={layoutConfig:[{type:"column",content:[{type:"row",height:40,content:[{type:"stack",content:[{type:"react-component",component:J.COMPONENT,title:J.TITLE,isClosable:!1},{type:"react-component",component:X.COMPONENT,title:X.TITLE,isClosable:!1}]},{type:"stack",width:25,content:[{type:"react-component",component:Q.COMPONENT,title:Q.TITLE,isClosable:!1},{type:"react-component",component:V.COMPONENT,title:V.TITLE,isClosable:!1}]}]},{type:"row",content:[{type:"stack",title:"Notebooks",content:[]}]}]}],links:[],filterSets:[],version:2},qt={layoutConfig:[],links:[],filterSets:[],version:2};function Me(t){if(Wt(t))return t;if(zt(t)){var e=t;return{layoutConfig:e,links:[],filterSets:[],version:2}}throw new Error("Unexpected layout import format: ".concat(t))}function Yt(t){return G.apply(this,arguments)}function G(){return G=kt(function*(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;try{var n=yield t.getLayouts();if(n.length>0)try{var r=yield t.getLayout(n[0]);return Me(r)}catch(i){T.error("Unable to load layout",n[0],":",i),T.warn("No valid layouts found, falling back to default layout")}}catch(i){T.error("Unable to fetch layout list",i),T.warn("Falling back to default layout")}return e?Ht:qt}),G.apply(this,arguments)}function Zt(t){var{filterSets:e,layoutConfig:n,links:r,pluginDataMap:i}=t,a={filterSets:e,layoutConfig:n,links:r,pluginDataMap:i,version:2};return a}const Jt={exportLayout:Zt,getDefaultLayout:Yt,normalizeLayout:Me};function ge(t,e,n,r,i,a,o){try{var s=t[a](o),u=s.value}catch(l){n(l);return}s.done?e(u):Promise.resolve(u).then(r,i)}function I(t){return function(){var e=this,n=arguments;return new Promise(function(r,i){var a=t.apply(e,n);function o(u){ge(a,r,i,o,s,"next",u)}function s(u){ge(a,r,i,o,s,"throw",u)}o(void 0)})}}function Pe(t,e,n){return e=Xt(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Xt(t){var e=Qt(t,"string");return typeof e=="symbol"?e:String(e)}function Qt(t,e){if(typeof t!="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Vt=E.module("LocalWorkspaceStorage");class m{static getBooleanServerConfig(e,n){var r,i;if((e==null||(r=e.get(n))===null||r===void 0?void 0:r.toLowerCase())==="true")return!0;if((e==null||(i=e.get(n))===null||i===void 0?void 0:i.toLowerCase())==="false")return!1}static makeDefaultWorkspaceSettings(e){for(var n={defaultDateTimeFormat:ee.DEFAULT_DATETIME_FORMAT_STRING,formatter:[],timeZone:ee.DEFAULT_TIME_ZONE_ID,showTimeZone:!1,showTSeparator:!0,disableMoveConfirmation:!1,defaultDecimalFormatOptions:{defaultFormatString:Ge.DEFAULT_FORMAT_STRING},defaultIntegerFormatOptions:{defaultFormatString:We.DEFAULT_FORMAT_STRING},truncateNumbersWithPound:!1,showEmptyStrings:!0,showNullStrings:!0,defaultNotebookSettings:{isMinimapEnabled:!1},webgl:!0,webglEditable:!0},r={defaultDateTimeFormat:e==null?void 0:e.get("dateTimeFormat"),formatter:[],timeZone:e==null?void 0:e.get("timeZone"),showTimeZone:m.getBooleanServerConfig(e,"showTimeZone"),showTSeparator:m.getBooleanServerConfig(e,"showTSeparator"),disableMoveConfirmation:m.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:m.getBooleanServerConfig(e,"truncateNumbersWithPound"),showEmptyStrings:m.getBooleanServerConfig(e,"showEmptyStrings"),showNullStrings:m.getBooleanServerConfig(e,"showNullStrings"),defaultNotebookSettings:(e==null?void 0:e.get("isMinimapEnabled"))!==void 0?{isMinimapEnabled:m.getBooleanServerConfig(e,"isMinimapEnabled")}:void 0,webgl:m.getBooleanServerConfig(e,"web.webgl"),webglEditable:m.getBooleanServerConfig(e,"web.webgl.editable")},i=Object.keys(r),a=0;a<i.length;a+=1){var o=i[a];r[o]!==void 0&&(n[o]=r[o])}return n}static makeWorkspaceData(e,n){return I(function*(){var{filterSets:r,links:i,layoutConfig:a,pluginDataMap:o={}}=yield Jt.getDefaultLayout(e,n==null?void 0:n.isConsoleAvailable);return{settings:{},layoutConfig:a,closed:[{}],links:i,filterSets:r,pluginDataMap:o}})()}static makeDefaultWorkspace(e,n){return I(function*(){return{data:yield m.makeWorkspaceData(e,n)}})()}constructor(e){Pe(this,"layoutStorage",void 0),this.layoutStorage=e}load(e){var n=this;return I(function*(){try{var r,i=JSON.parse((r=localStorage.getItem(m.STORAGE_KEY))!==null&&r!==void 0?r:"");return i}catch{return Vt.info("Unable to load workspace data, initializing to default data"),m.makeDefaultWorkspace(n.layoutStorage,e)}})()}save(e){return I(function*(){return localStorage.setItem(m.STORAGE_KEY,JSON.stringify(e)),e})()}}Pe(m,"STORAGE_KEY","deephaven.WorkspaceStorage");export{Yt as $,Pn as A,un as B,rn as C,dn as D,lt as E,tt as F,xn as G,yt as H,ze as I,bt as J,gn as K,m as L,xt as M,ht as N,H as O,jt as P,wn as Q,Nt as R,rt as S,Sn as T,yn as U,Jt as V,Wt as W,zt as X,Ht as Y,qt as Z,Me as _,et as a,Zt as a0,Cn as b,Mn as c,mn as d,pn as e,on as f,vn as g,ke as h,an as i,be as j,it as k,bn as l,at as m,sn as n,fn as o,hn as p,pt as q,ut as r,Et as s,ln as t,On as u,cn as v,we as w,vt as x,ot as y,st as z};
2
+ //# sourceMappingURL=LocalWorkspaceStorage-3d9e8ba8.js.map