@deephaven/code-studio 0.37.1-beta.0 → 0.37.2

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.
@@ -1,4 +1,4 @@
1
- import{A as b,B as M,H as ee,P as Km,C as l,D as Ct,F as U,R as Eo,G as Z,I as je,J as me,K as Xe,L as qm,M as Ym,N as xl,O as sr,Q as Xm,E as Rl,S as Zm,T as il,U as pe,V as ol,W as ks,X as Fh,Y as ot,Z as Il,_ as Qm,$ as Jm,a0 as eg,a1 as tg,a2 as ue,a3 as Hc,a4 as Dl,a5 as ng,a6 as sg,a7 as Nh,a8 as Ve,a9 as al,aa as ir,ab as ig,ac as Ln,ad as og,ae as ag,af as rg,ag as lg,ah as rl,ai as cg,aj as dg,ak as hg,al as Vc,am as ug,an as Bc,ao as mg,ap as gg,aq as pg,ar as fg,as as Cg,at as Sg,au as St,av as Mh,aw as bg,ax as kh,ay as wg,az as Ah,aA as vg,aB as Tg,aC as Eg,aD as yg,aE as $c,aF as xg}from"./vendor-ef910ebc.js";import{e as Qn,l as On,K as dn,a as Uc,R as Rg,b as Is,W as Ig}from"./monaco-a26f85af.js";import{T as qe,L as X,M as Bi,a as $i,b as Do,v as Oh,c as En,d as Lh,e as Pn,f as Dg,g as Fg,h as Fo,i as Ng,j as Ui,k as Fl,l as Mg,m as ll,n as kg,o as Ph,p as Nl,q as _h,r as Wc,s as Ag,t as Og,u as Lg,w as Pg,x as Jt,y as Ms,z as jh,A as Jn,B as or,C as ji,D as _g,E as jg,F as Gc,G as Ia,H as zc,I as Hh,J as Hg,K as No,N as Vh,O as Vg,P as Bg,Q as Ml,R as kl,S as Da,U as $n,V as $g,W as Ug,X as Wg,Y as Gg,Z as zg,_ as Al,$ as As,a0 as Kc,a1 as Mo,a2 as Ol,a3 as Ll,a4 as Kg,a5 as qg,a6 as Fa,a7 as Yg,a8 as Pl,a9 as Bh,aa as ti,ab as Xg,ac as Zg,ad as Qg,ae as Jg,af as ep,ag as tp,ah as qc,ai as Lr,aj as np,ak as sp,al as ip,am as op,an as ap,ao as $h,ap as rp,aq as lp,ar as cp,as as Uh,at as dp,au as hp,av as up,aw as mp,ax as gp,ay as pp,az as fp,aA as Cp,aB as Sp,aC as bp,aD as wp,aE as vp,aF as Wh,aG as Tp,aH as cl,aI as dl,aJ as Ep,aK as yp,aL as xp,aM as Rp,aN as Ip,aO as Dp,aP as Fp,aQ as Np,aR as Mp,aS as kp,aT as Ap,aU as Yc,aV as Op,aW as Lp,aX as Pp}from"./index-b0951362.js";import{T as Gh,r as _p,S as jp,g as Xc,l as Hp,u as Vp,a as Bp,b as $p}from"./useConnection-554f7596.js";import{P as Na,b as Up,h as Wp,p as Gp,o as zp,s as Kp,t as qp,c as Pr}from"./plotly-d53ecbd5.js";import"./helpers-042e6b4d.js";class Yp extends b.Component{static propTypes={children:M.node.isRequired,options:M.shape({}),className:M.string,timeout:M.number,onEntered:M.func,onExited:M.func,isShown:M.bool,closeOnBlur:M.bool,interactive:M.bool,referenceObject:M.shape({}),"data-testid":M.string};static defaultProps={options:{},className:"",timeout:qe.transitionMs,onEntered(){},onExited(){},isShown:!1,interactive:!1,closeOnBlur:!1,referenceObject:null,"data-testid":void 0};constructor(e){super(e),this.handleEnter=this.handleEnter.bind(this),this.handleExit=this.handleExit.bind(this),this.handleBlur=this.handleBlur.bind(this),this.element=document.createElement("div"),this.element.className="popper-container",this.container=ee.createRef(),this.rAF=0;const{isShown:t}=this.props;this.state={show:t,popper:null}}componentDidUpdate(e){const{isShown:t}=this.props;e.isShown!==t&&(t?(cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{this.show()})):this.hide())}componentWillUnmount(){this.destroyPopper(!1)}element;container;rAF;getVisibleElement(e){return e==null||e.clientHeight>0||e.clientWidth>0?e:this.getVisibleElement(e.parentElement)}initPopper(){let{popper:e}=this.state;const{closeOnBlur:t,referenceObject:n}=this.props;if(e||this.container.current===null)return;let{options:s}=this.props;s={placement:"auto",modifiers:{preventOverflow:{boundariesElement:"viewport"}},...s},document.body.appendChild(this.element);let i=this.getVisibleElement(this.container.current);i==null&&(i=this.container.current),e=new Km(n||i,this.element,s),e.scheduleUpdate(),cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{if(t&&!this.element.contains(document.activeElement)){const o=this.element.firstElementChild;o instanceof HTMLElement&&o.focus()}}),this.setState({popper:e})}destroyPopper(e=!0){cancelAnimationFrame(this.rAF);const{popper:t}=this.state;t&&(t.destroy(),document.body.contains(this.element)&&document.body.removeChild(this.element),e&&this.setState({popper:null}))}show(){this.initPopper(),this.setState({show:!0})}hide(){this.setState({show:!1})}scheduleUpdate(){const{popper:e}=this.state;e&&e.scheduleUpdate()}handleBlur(e){e.relatedTarget instanceof HTMLElement&&(this.element.contains(e.relatedTarget)||this.hide())}handleEnter(){const{onEntered:e}=this.props;e()}handleExit(){const{onExited:e}=this.props,{show:t}=this.state;t||this.destroyPopper(),e()}renderContent(){const{className:e,children:t,timeout:n,interactive:s,closeOnBlur:i}=this.props,{show:o}=this.state;return l.jsx(Ct,{in:o,timeout:n,classNames:"popper-transition",onEntered:this.handleEnter,onExited:this.handleExit,children:l.jsx("div",{onClick:a=>{a.stopPropagation()},onKeyDown:a=>{a.key==="Escape"&&this.hide()},className:U("popper",{interactive:s},e),onBlur:i?this.handleBlur:void 0,tabIndex:i?-1:void 0,role:"presentation",children:l.jsxs("div",{className:"popper-content",children:[t,l.jsx("div",{className:"popper-arrow","x-arrow":""})]})})})}render(){const{popper:e}=this.state,{"data-testid":t}=this.props;return l.jsx("div",{className:"popper-parent-container",ref:this.container,style:{display:"none"},"data-testid":t,children:e&&Eo.createPortal(this.renderContent(),this.element)})}}const ci=Yp,Xp=X.module("Tooltip");class _t extends b.Component{static defaultTimeout=500;static defaultReshowTimeout=100;static triggerReshowThreshold=300;static shownTooltipCount=0;static lastHiddenTime=Date.now();static defaultProps={interactive:!1,options:{},popperClassName:"",reshowTimeout:_t.defaultReshowTimeout,timeout:_t.defaultTimeout,onEntered:()=>{},onExited:()=>{},"data-testid":void 0};static handleHidden(){_t.shownTooltipCount-=1,_t.shownTooltipCount===0&&(_t.lastHiddenTime=Date.now())}static handleShown(){_t.shownTooltipCount+=1}constructor(e){super(e),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.handleWindowMouseMove=this.handleWindowMouseMove.bind(this),this.handleWheel=this.handleWheel.bind(this),this.handleTimeout=this.handleTimeout.bind(this),this.handleExited=this.handleExited.bind(this),this.stopShowingTooltip=this.stopShowingTooltip.bind(this),this.container=ee.createRef(),this.popper=ee.createRef(),this.parent=null,this.timer=null,this.state={isShown:!1}}componentDidMount(){this.startListening();const{timeout:e}=this.props;e===0&&this.show()}componentDidUpdate(e,t){const{isShown:n}=t,{isShown:s}=this.state;s!==n&&(s?_t.handleShown():_t.handleHidden())}componentWillUnmount(){this.stopListening(),this.stopListeningWindow(),this.stopTimer();const{isShown:e}=this.state;e&&_t.handleHidden()}container;popper;parent;timer;startListening(){if(!this.container.current||!this.container.current.parentElement){Xp.error("Tooltip doesn't have a container or a parent set!");return}this.parent=this.container.current.parentElement,this.parent.addEventListener("mousemove",this.handleMouseMove),this.parent.addEventListener("mouseleave",this.handleMouseLeave),this.parent.addEventListener("mousedown",this.stopShowingTooltip)}stopListening(){this.parent&&(this.parent.removeEventListener("mousemove",this.handleMouseMove),this.parent.removeEventListener("mouseleave",this.handleMouseLeave),this.parent.removeEventListener("mousedown",this.stopShowingTooltip))}startListeningWindow(){window.addEventListener("mousemove",this.handleWindowMouseMove,!0),window.addEventListener("contextmenu",this.stopShowingTooltip,!0),window.addEventListener("wheel",this.handleWheel)}stopListeningWindow(){window.removeEventListener("mousemove",this.handleWindowMouseMove,!0),window.removeEventListener("contextmenu",this.stopShowingTooltip,!0),window.removeEventListener("wheel",this.handleWheel)}handleMouseMove(){this.startTimer()}handleWheel(){const{isShown:e}=this.state;this.popper.current&&this.parent&&e&&!this.popper.current.element.matches(":hover")&&!this.parent.matches(":hover")&&(this.stopTimer(),this.hide())}handleMouseLeave(){const{isShown:e}=this.state;this.stopTimer();const{interactive:t}=this.props;!t&&e&&this.hide()}handleTimeout(){this.show()}handleWindowMouseMove(e){const t=e.clientX,n=e.clientY,{isShown:s}=this.state;if(!this.popper.current||!this.parent)return;const i=this.popper.current.element.getBoundingClientRect(),o=this.parent.getBoundingClientRect();t>=i.left&&t<=i.left+i.width&&n>=i.top&&n<=i.top+i.height?this.handleMouseMove():t>=o.left&&t<=o.left+o.width&&n>=o.top&&n<=o.top+o.height?this.handleMouseMove():s&&(this.stopTimer(),this.hide())}startTimer(){this.stopTimer();const{timeout:e,reshowTimeout:t}=this.props;let n=e;(_t.shownTooltipCount>0||Date.now()-_t.lastHiddenTime<_t.triggerReshowThreshold)&&(n=t),this.timer=window.setTimeout(this.handleTimeout,n)}stopTimer(){this.timer!=null&&(clearTimeout(this.timer),this.timer=null)}show(){const{isShown:e}=this.state;if(this.stopTimer(),!e){this.popper.current?.show(),this.setState({isShown:!0});const{interactive:t}=this.props;t&&this.startListeningWindow()}}hide(){this.popper.current?.hide(),this.stopListeningWindow()}update(){this.popper.current?.scheduleUpdate()}handleExited(){this.setState({isShown:!1});const{onExited:e}=this.props;e()}stopShowingTooltip(){const{isShown:e}=this.state;this.stopTimer(),e&&this.hide()}render(){const{interactive:e,children:t,referenceObject:n,popperClassName:s,"data-testid":i,onEntered:o}=this.props,{isShown:a}=this.state;let{options:r}=this.props;return r={placement:"bottom",...r},l.jsx("div",{ref:this.container,style:{display:"none"},"data-testid":i,children:l.jsx(ci,{className:U(s),options:r,ref:this.popper,onEntered:o,onExited:this.handleExited,interactive:e,referenceObject:n,children:l.jsxs("div",{className:"tooltip-content",children:[" ",a&&t]})})})}}const tt=_t;function ar(d){const{children:e,className:t,style:n,"data-testid":s}=d;return l.jsx("div",{className:U("btn-group",t),style:n,role:"group","data-testid":s,children:e})}ar.displayName="ButtonGroup";ar.propTypes={children:M.node.isRequired,className:M.string,style:M.object,"data-testid":M.string};ar.defaultProps={className:null,style:{},"data-testid":void 0};const Zp=["primary","secondary","tertiary","success","danger","inline","ghost"],Qp=["group-end"];function Jp(d,e){switch(d){case"primary":return"btn-primary";case"secondary":return"btn-outline-primary";case"tertiary":return"btn-secondary";case"success":return"btn-success";case"danger":return"btn-danger";case"inline":return"btn-inline";case"ghost":return U("btn-link",{"btn-link-icon":e,"btn-link-icon-only":e})}}function ef(d){switch(d){case"group-end":return U("pl-2","pr-3")}}const rr=ee.forwardRef((d,e)=>{const{kind:t,variant:n,type:s,tooltip:i,icon:o,disabled:a=!1,active:r,onClick:c,onContextMenu:h,onMouseDown:u,onMouseUp:m,onMouseEnter:g,onMouseLeave:p,onKeyDown:C,className:f,style:S,children:v,tabIndex:w,"data-testid":T,"aria-label":y}=d,E=Boolean(o&&v==null),I=Jp(t,E);let D;n&&(D=ef(n));let F;o&&(F=ee.isValidElement(o)?o:l.jsx(Z,{icon:o}));let _;i!==void 0&&(_=typeof i=="string"?l.jsx(tt,{children:i}):i);let P=y;y===void 0&&E&&i!=null&&typeof i=="string"&&(P=i);const $=l.jsxs("button",{"data-testid":T,ref:e,type:s,className:U("btn",I,D,{active:r},f),onClick:c,onContextMenu:h,onMouseUp:m,onMouseDown:u,onMouseEnter:g,onMouseLeave:p,onKeyDown:C,style:S,disabled:a,tabIndex:w,"aria-label":P,children:[o&&F,v,i!=null&&!a&&_]});return a?l.jsxs("span",{className:"btn-disabled-wrapper",children:[$,i!==void 0&&_]}):$});rr.displayName="Button";rr.propTypes={kind:M.oneOf(Zp).isRequired,variant:M.oneOf(Qp),type:M.oneOf(["submit","reset","button"]),tooltip(d){const{tooltip:e,icon:t,children:n}=d;return e===void 0&&t!=null&&n==null?new Error("Tooltip is required for icon only buttons"):null},icon(d){const{children:e,icon:t}=d;return t==null&&e==null?new Error("Icon is required if no children are provided"):e==null&&!ee.isValidElement(t)&&(t==null||t.iconName===""||t.iconName==null)?new Error("Icon must be react element or fontawesome IconDefinition"):null},disabled:M.bool,active:M.bool,onClick(d){const{onClick:e,type:t}=d;return t==="button"&&typeof e!="function"?new Error("type button requires an onClick function"):e!==void 0&&typeof e!="function"?new Error("onClick must be a function"):null},onContextMenu:M.func,onMouseUp:M.func,onMouseDown:M.func,onMouseEnter:M.func,onMouseLeave:M.func,onKeyDown:M.func,tabIndex:M.number,children:M.node,className:M.string,style:M.object,"data-testid":M.string};rr.defaultProps={type:"button",onClick:void 0,onContextMenu:void 0,onMouseUp:void 0,onMouseDown:void 0,onMouseEnter:void 0,onMouseLeave:void 0,onKeyDown:void 0,variant:void 0,tooltip:void 0,icon:void 0,disabled:!1,active:void 0,tabIndex:void 0,children:void 0,className:void 0,style:{},"data-testid":void 0};const B=rr;function tf({className:d,icon:e,isOpen:t,subtitle:n,title:s}){return l.jsx(Bi,{isOpen:t,className:d,children:l.jsx($i,{children:l.jsxs("div",{className:"info-modal",children:[e!=null&&l.jsx("div",{className:"message-icon",children:l.jsx(Z,{icon:e})}),l.jsx("div",{className:"message-header",children:s}),n!=null&&l.jsx("div",{className:"message-content",children:n})]})})})}function _l({className:d="modal-footer",children:e,"data-testid":t}){return l.jsx("div",{className:d,"data-testid":t,children:e})}function ri(d){const{isOpen:e,headerText:t,bodyText:n,onCancel:s,onConfirm:i,onDiscard:o,onModalDisable:a,cancelButtonText:r="Cancel",confirmButtonText:c="Okay",discardButtonText:h="Discard",isConfirmDanger:u=!1,children:m,"data-testid":g}=d,p=b.useRef(null),C=b.useRef(null),f=b.useCallback(()=>{C.current!==null&&C.current.checked&&a&&a(),i()},[i,a]),S=b.useCallback(()=>{p.current?.focus()},[]);let v="";return e&&(v=typeof n=="function"?n():n),l.jsxs(Bi,{isOpen:e,className:"theme-bg-light",onOpened:S,children:[l.jsx(Do,{closeButton:!1,children:t}),l.jsx($i,{children:v}),l.jsxs(_l,{children:[a&&l.jsxs("div",{className:"custom-control custom-checkbox form-group mr-auto",children:[l.jsx("input",{type:"checkbox",className:"custom-control-input",id:"move-confirmation-checkbox",defaultChecked:!1,ref:C,"data-testid":g!==void 0?`${g}-checkbox-confirm`:void 0}),l.jsx("label",{className:"custom-control-label",htmlFor:"move-confirmation-checkbox",children:"Don't ask me again"})]}),o&&l.jsx(B,{kind:"secondary",className:"mr-auto","data-dismiss":"modal",onClick:o,"data-testid":g!==void 0?`${g}-btn-discard`:void 0,children:h}),s&&l.jsx(B,{kind:"secondary","data-dismiss":"modal",onClick:s,"data-testid":g!==void 0?`${g}-btn-cancel`:void 0,children:r}),l.jsxs(ar,{children:[l.jsx(B,{kind:u?"danger":"primary",onClick:f,ref:p,"data-testid":g!==void 0?`${g}-btn-confirm`:void 0,children:c}),m]})]})]})}ri.propTypes={isOpen:M.bool.isRequired,headerText:M.string.isRequired,bodyText:M.oneOfType([M.string,M.func]).isRequired,onCancel:M.func,onConfirm:M.func.isRequired,onDiscard:M.func,onModalDisable:M.func,cancelButtonText:M.string,confirmButtonText:M.string,discardButtonText:M.string,children:M.node,"data-testid":M.string};ri.defaultProps={children:void 0,cancelButtonText:"Cancel",confirmButtonText:"Okay",discardButtonText:"Discard",onCancel:void 0,onDiscard:void 0,onModalDisable:void 0,"data-testid":void 0};const lr=ee.forwardRef((d,e)=>{const{children:t,className:n,disabled:s,onClick:i,style:o,id:a}=d;return l.jsx("button",{ref:e,type:"button",className:U("btn",n),onClick:i,style:o,disabled:s,id:a,children:t})});lr.displayName="Button";lr.propTypes={children:M.node,className:M.string,disabled:M.bool,onClick:M.func,style:M.shape({}),id:M.string};lr.defaultProps={children:null,className:"",disabled:!1,onClick:()=>null,style:{},id:""};const Zc=lr;function jl({className:d,isFlipped:e,children:t,"data-testid":n}){const s=r=>{if(t.length!==2)throw new Error("CardFlip requires 2 children to function");return t[r]},i=b.useRef(null),o=b.useCallback(r=>{r.target===r.currentTarget&&document.body.classList.add("card-flip--is-flipping")},[]),a=b.useCallback(r=>{r.target===r.currentTarget&&document.body.classList.remove("card-flip--is-flipping")},[]);return b.useEffect(function(){if(!i.current)throw Error("ref undefined");i.current.addEventListener("transitionstart",o);const c=i.current;return function(){if(c!=null)return c.removeEventListener("transitionstart",o)}},[o]),l.jsxs("div",{className:U(d,{"card-flip--show-front":e,"card-flip--show-back":!e}),"data-testid":n,children:[l.jsx("div",{className:"card-flip--back",children:s(0)}),l.jsx("div",{ref:i,className:"card-flip--front",onTransitionEnd:a,children:s(1)})]})}function _r(d){return d.then!==void 0}class qs{static actionsDisabled=!1;static disableAllActions(){qs.actionsDisabled=!0}static enableAllActions(){qs.actionsDisabled=!1}static isContextActionEvent(e){return Array.isArray(e.contextActions)}static compareActions(e,t){return e.group!==t.group?(e.group??0)>(t.group??0)?1:-1:e.order!==t.order?(e.order??0)>(t.order??0)?1:-1:e.title!==t.title?(e.title??"")>(t.title??"")?1:-1:e!==t?e>t?1:-1:0}static sortActions(e){if(e==null||!Array.isArray(e))return[];const t=e.slice();return t.sort(qs.compareActions),t}static isMacPlatform(){const{platform:e}=window.navigator;return e.startsWith("Mac")}static getModifierKey(){return qs.isMacPlatform()?"metaKey":"ctrlKey"}static isModifierKeyDown(e){const t=qs.getModifierKey();return e[t]}static getMenuItems(e,t=!0){let n=[],s=e;Array.isArray(s)||(s=[s]);for(let i=0;i<s.length;i+=1){const o=s[i];let a;typeof o=="function"?a=o():a=o,a!=null&&(a instanceof Promise?t&&n.push(a):Array.isArray(a)?n=n.concat(a):n.push(a))}return n=n.filter(i=>i.title!==void 0||i.then!=null||i.menuElement),n}static getNextMenuItem(e,t,n){let s=e;s<0&&t<0&&(s=n.length);for(let i=1;i<n.length+1;i+=1){const o=(s+t*i+n.length)%n.length,a=n[o];if(!(a instanceof Promise)&&a.disabled!==!0)return o}return e}}const Be=qs,Qc=X.module("GlobalContextAction");class nf extends b.Component{constructor(e){super(e),this.handleContextMenu=this.handleContextMenu.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this)}componentDidMount(){document.body.addEventListener("contextmenu",this.handleContextMenu),document.body.addEventListener("keydown",this.handleKeyDown)}componentWillUnmount(){document.body.removeEventListener("contextmenu",this.handleContextMenu),document.body.removeEventListener("keydown",this.handleKeyDown)}handleContextMenu(e){const t=e;t.contextActions==null&&(t.contextActions=[]);const{action:n}=this.props;n.title==null&&!n.menuElement||(t.contextActions==null&&(t.contextActions=[]),t.contextActions.push(n),Qc.debug("Received context menu event at global action! Menu items are now: ",t.contextActions))}handleKeyDown(e){const{action:t}=this.props;!Be.actionsDisabled&&t.shortcut!==void 0&&t.shortcut.matchesEvent(e)&&(Qc.debug("Global hotkey matched!",e),t.action?.(e),e.preventDefault(),e.stopPropagation())}render(){return null}}const sf=nf;class of extends b.Component{render(){const{actions:e,"data-testid":t}=this.props,n=[];for(let s=0;s<e.length;s+=1){const i=e[s],{shortcut:o}=i;if(i.title!=null||i.menuElement||o){const a=l.jsx(sf,{action:i,"data-testid":t},`${i.title}.${o?.id}`);n.push(a)}}return n}}const af=of;const ea=X.module("ContextActions");class rf extends b.Component{static groups={default:null,high:100,medium:5e3,low:1e4,global:1e5,edit:100};static triggerMenu(e,t,n,s){if(s.length===0)return;const i=new MouseEvent("contextmenu",{clientX:t,clientY:n,bubbles:!0,cancelable:!0});i.contextActions=s,e.dispatchEvent(i)}constructor(e){super(e),this.handleContextMenu=this.handleContextMenu.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.container=ee.createRef(),this.state={globalActions:[],keyboardActions:[]}}static getDerivedStateFromProps(e){if(e.actions==null||!Array.isArray(e.actions))return{globalActions:[],keyboardActions:[]};const t=e.actions.filter(s=>!_r(s)&&typeof s!="function"&&s.isGlobal),n=e.actions.filter(s=>!_r(s)&&typeof s!="function"&&(s.isGlobal===void 0||!s.isGlobal)&&s.shortcut!=null);return{globalActions:t,keyboardActions:n}}componentDidMount(){this.container.current?.parentElement&&(this.container.current.parentElement.addEventListener("contextmenu",this.handleContextMenu),this.container.current.parentElement.addEventListener("keydown",this.handleKeyDown))}componentWillUnmount(){this.container.current?.parentElement&&(this.container.current.parentElement.removeEventListener("contextmenu",this.handleContextMenu),this.container.current.parentElement.removeEventListener("keydown",this.handleKeyDown))}container;handleContextMenu(e){const{ignoreClassNames:t=[]}=this.props;if(t.length>0){let s=e.target;for(;s!=null;){const{classList:i}=s,o=t.find(a=>i.contains(a));if(o!==void 0){ea.debug2(`Contextmenu event ignored based on the target className "${o}"`);return}s=s.parentElement}}if(Be.isContextActionEvent(e)||(e.contextActions=[]),!Be.isContextActionEvent(e))return;const{actions:n}=this.props;if(n!=null){let s=n;Array.isArray(s)&&(s=s.filter(i=>_r(i)||typeof i=="function"||i.isGlobal===void 0||!i.isGlobal)),e.contextActions=e.contextActions.concat(s)}ea.debug("Received context menu event! Menu items are now: ",e.contextActions)}handleKeyDown(e){const{keyboardActions:t}=this.state;for(let n=0;n<t.length;n+=1){const s=t[n];!Be.actionsDisabled&&s.shortcut!=null&&s.shortcut.matchesEvent(e)&&(ea.debug("Context hotkey matched!",e),s.action?.(e),e.stopPropagation(),e.preventDefault(),ea.debug2("Matched hotkey returned false, key event not consumed"))}}render(){const{"data-testid":e}=this.props,{globalActions:t}=this.state;return l.jsx("div",{className:"context-actions-listener",ref:this.container,"data-testid":e,children:l.jsx(af,{actions:t})})}}const ie=rf,Hl=ee.forwardRef((d,e)=>{function t(f){const{menuItem:S,onMenuItemClick:v}=d;v(S,f)}function n(f){const{menuItem:S,onMenuItemMouseMove:v}=d;v(S,f)}function s(f){const{menuItem:S,onMenuItemContextMenu:v}=d;v(S,f)}function i(f,S,v){if(typeof f.type=="string")return f;const{closeMenu:w,menuItem:T,isKeyboardSelected:y,isMouseSelected:E,"data-testid":I}=d,D={menuItem:T,closeMenu:w,isKeyboardSelected:y,isMouseSelected:E,iconElement:S,displayShortcut:v,"data-testid":I};return ee.cloneElement(f,{forwardedProps:D})}const{children:o,menuItem:a,isKeyboardSelected:r=!1,isMouseSelected:c=!1,"data-testid":h}=d,u=a.shortcut?.getDisplayText();let m=null;if(a.icon){const f=a.icon;if(ee.isValidElement(f))m=f;else{let S;a.iconColor!=null&&(a.disabled===void 0||!a.disabled)&&(S={color:a.iconColor}),m=l.jsx(Z,{icon:f,style:S})}}let g=null;const p=Boolean(o);a.actions&&(g=l.jsx(Z,{icon:Oh}));let C=null;if(a.menuElement)C=l.jsx("div",{className:"custom-menu-item",onMouseMove:n,children:i(a.menuElement,m,u)});else{const f=a.disabled,S=a.iconOutline;C=l.jsx("button",{type:"button",className:U("btn-context-menu",{disabled:f},{active:(p||c)&&(f===void 0||!f)},{"keyboard-active":r&&(f===void 0||!f)}),onClick:t,onMouseMove:n,onContextMenu:s,title:a.description??"",children:l.jsxs("div",{className:"btn-context-menu-wrapper",children:[l.jsx("span",{className:U("icon",{outline:S}),children:m}),l.jsx("span",{className:"title",children:a.title}),u!==void 0&&l.jsx("span",{className:"shortcut",children:u}),g&&l.jsx("span",{className:U("submenu-indicator",{disabled:f}),children:g})]})})}return l.jsxs("div",{className:"context-menu-item",ref:e,"data-testid":h,children:[o,C]})});Hl.displayName="ContextMenuItem";Hl.defaultProps={children:null,isKeyboardSelected:!1,isMouseSelected:!1,"data-testid":void 0};const zh=Hl,Ne=Object.freeze([]),qn=new Map;class lf extends Error{isCanceled=!0}const Hi=lf;class Vl{static isDark(e){const t=document.createElement("div");t.style.display="none",t.style.color=e;const n=getComputedStyle(document.body.appendChild(t)).color,s=n.match(/\d+/g);let i=[];if(s)i=s.map(a=>parseInt(a,10));else throw new Error(`Invalid color received. Got ${n}`);return document.body.removeChild(t),Vl.getBrightness(i)<125}static getBrightness(e){return Math.round((e[0]*299+e[1]*587+e[2]*114)/1e3)}}const Kh=Vl;async function Wi(d){const{clipboard:e}=navigator;if(e!==void 0)try{return navigator.clipboard.writeText(d)}catch{return Jc(d)}Jc(d)}function Jc(d){const e=document.activeElement,t=document.createElement("textarea");t.value=d,document.body.appendChild(t),t.focus(),t.select();const n=document.execCommand("copy");if(document.body.removeChild(t),e instanceof HTMLElement&&e.focus(),!n)throw new Error("Unable to execute copy command")}const cf="table_",ed="column_",df=new Set(["in","not","i","ii","k"]),hf=new Set(["abstract","continue","for","new","switch","assert","default","if","package","synchronized","boolean","do","goto","private","this","break","double","implements","protected","throw","byte","else","import","public","throws","case","enum","instanceof","return","transient","catch","extends","int","short","try","char","final","interface","static","void","class","finally","long","strictfp","volatile","const","float","native","super","while","null","true","false"]),uf=/[^a-zA-Z0-9_$+@-]/g,mf=/[^A-Za-z0-9_$]/g;class Ys{static legalize=(e,t,n,s,i)=>{let o=e.trim().replace(/[- ]/g,"_");return s&&(df.has(o)||hf.has(o))&&(o=t+o),o=o.replace(n,""),o||(o=t+i),Number.isNaN(Number(o.charAt(0)))||(o=t+o),o};static legalizeTableName=e=>Ys.legalize(e,cf,uf,!1,0);static legalizeColumnNames=e=>{const t=[];return e.forEach((n,s)=>{let i=Ys.legalizeColumnName(n,s);t.includes(i)&&(i=ed+s),t.push(i)}),t};static legalizeColumnName=(e,t=0)=>Ys.legalize(e,ed,mf,!0,t);static isValidTableName=e=>Ys.legalizeTableName(e)===e;static isValidColumnName=e=>Ys.legalizeColumnName(e)===e}const Gi=Ys;function gf(d,e){return d?d.closest(`.${e}`):null}const pf={getClosestByClassName:gf};class Ue extends CustomEvent{constructor(e,t){super(e,t)}}class we{static makeCancelable(e,t){let n=!1,s,i;const o=new Promise((a,r)=>{i=r,Promise.resolve(e).then(c=>{n?t&&t(c):(s=c,a(c))}).catch(c=>r(c))});return o.cancel=()=>{n=!0,i(new Hi),s!=null&&t&&t(s)},o}static isCanceled(e){return e instanceof Hi}static isTimedOut(e){return e instanceof Gh}static withTimeout(e,t){return new Promise((n,s)=>{setTimeout(()=>{try{n(t())}catch(i){s(i)}},e)})}}class ff{pending=[];resolved=[];add(e,t){const n=we.makeCancelable(e,t);return this.pending.push(n),n.then(()=>{this.resolve(n)},()=>{this.resolve(n)}),n}remove(e){for(let t=0;t<this.pending.length;t+=1)if(this.pending[t]===e){this.pending.splice(t,1);return}}resolve(e){this.remove(e),this.resolved.push(e)}cancel(){const e=[...this.pending,...this.resolved];for(let t=0;t<e.length;t+=1)e[t].cancel();this.pending=[],this.resolved=[]}}const is=ff;function N(d){if(d==null)throw new Error("Value is null or undefined")}function L(d,e,t=void 0){const n=d.get(e)??t;if(n!==void 0)return n;throw new Error(`Missing value for key ${e}`)}class Bl{static isValidRange(e){return e!=null&&e.length===2&&Number.isInteger(e[0])&&Number.isInteger(e[1])&&e[0]<=e[1]}static validateRange(e){if(!Bl.isValidRange(e))throw new Error(`Invalid range! ${e}`)}static isSelected(e,t){for(let n=0;n<e.length;n+=1){const s=e[n],i=s[0],o=s[1];if(i<=t&&t<=o)return!0}return!1}static selectRange(e,t){let[n,s]=t;const i=[...e];for(let o=i.length-1;o>=0;o-=1){const a=i[o],r=a[0],c=a[1];if(r<=n&&s<=c)return i;n<=c&&r<=s&&(n=Math.min(n,r),s=Math.max(s,c),i.splice(o,1))}return i.push([n,s]),i}static deselectRange(e,t){const[n,s]=t,i=[...e];for(let o=i.length-1;o>=0;o-=1){const a=i[o],r=a[0],c=a[1];if(!(s<r||c<n))if(r<n&&s<c){i[o]=[r,n-1],i.splice(o+1,0,[s+1,c]);break}else n<=r&&c<=s?i.splice(o,1):r<n?i[o]=[r,n-1]:i[o]=[s+1,c]}return i}static count(e){return e.reduce((t,n)=>t+(n[1]-n[0]+1),0)}static getItemsInRanges(e,t){return t.reduce((n,s)=>{const i=[...n];for(let o=s[0];o<=s[1];o+=1)i.push(e[o]);return i},[])}}const An=Bl;class Cf{static join(e,t="and"){if(e==null||e.length===0)return"";if(e.length===1)return e[0];if(e.length===2)return`${e[0]} ${t} ${e[1]}`;const n=e.slice(0,e.length-1).join(", "),s=e[e.length-1];return`${n}, ${t} ${s}`}static toLower(e,t=!0){if(e==null){if(t)return"";throw new Error("Null string passed in to TextUtils.toLower")}return e.toLowerCase()}static sort(e,t,n=!0){return e<t?n?-1:1:e>t?n?1:-1:0}}const zt=Cf;class $l{static TIME_PATTERN="([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]";static TIME_ZONES=Object.freeze([{label:"Tokyo UTC+9 No DST",value:"Asia/Tokyo"},{label:"Seoul UTC+9 No DST",value:"Asia/Seoul"},{label:"Hong Kong UTC+8 No DST",value:"Asia/Hong_Kong"},{label:"Singapore UTC+8 No DST",value:"Asia/Singapore"},{label:"Kolkata UTC+5:30 No DST",value:"Asia/Kolkata"},{label:"Berlin UTC+1",value:"Europe/Berlin"},{label:"UTC UTC±0 No DST",value:"UTC"},{label:"London UTC±0",value:"Europe/London"},{label:"Sao Paulo UTC-2",value:"America/Sao_Paulo"},{label:"Newfoundland UTC-3:30",value:"America/St_Johns"},{label:"Halifax UTC-4",value:"America/Halifax"},{label:"New York UTC−5",value:"America/New_York"},{label:"Chicago UTC-6",value:"America/Chicago"},{label:"Denver UTC-7",value:"America/Denver"},{label:"Los Angeles UTC-8",value:"America/Los_Angeles"},{label:"Anchorage UTC-9",value:"America/Anchorage"},{label:"Honolulu UTC-10 No DST",value:"Pacific/Honolulu"},{label:"Zurich UTC+1",value:"Europe/Zurich"},{label:"Amsterdam UTC+1",value:"Europe/Amsterdam"},{label:"Taipei UTC+8 No DST",value:"Asia/Taipei"},{label:"Sydney UTC+10",value:"Australia/Sydney"}]);static formatElapsedTime(e){if(typeof e!="number"||!Number.isInteger(e))throw new Error(`${e} is not a number that can be expressed as a formatted time`);const t=Math.floor(e/3600),n=Math.floor(e%3600/60),s=e%60;return`${t>0?`${t}h `:""}${n>0||t>0?`${n}m `:""}${e>=60?`${s}s`.padStart(3,"0"):`${s}s`}`}static formatTime(e){if(typeof e!="number"||!Number.isInteger(e)||e<0)throw new Error(`${e} is not a number that can be expressed as a formatted time`);const t=String(Math.floor(e/(60*60))).padStart(2,"0"),n=e%(60*60),s=String(Math.floor(n/60)).padStart(2,"0"),i=n%60,o=String(Math.ceil(i)).padStart(2,"0");return`${t}:${s}:${o}`}static isTimeString(e){return new RegExp($l.TIME_PATTERN).test(e)}static parseTime(e){if(e==null||typeof e!="string")throw new Error(`${e} is not a valid string`);const t=e.split(":");if(t.length!==3)throw new Error(`${e} is not a time string that can be parsed`);return Number(t[0])*60*60+Number(t[1])*60+Number(t[2])}}const cr=$l;class Sf extends Error{isInvalid=!0}const Li=Sf,td=X.module("ContextMenu");class Ma extends b.PureComponent{static defaultProps={subMenuParentWidth:0,subMenuParentHeight:0,closeMenu(){},onMenuOpened(){},onMenuClosed(){},options:{},menuStyle:{},"data-testid":void 0};static handleContextMenu(e){e.metaKey||(e.stopPropagation(),e.preventDefault())}constructor(e){super(e),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=ee.createRef(),this.oldFocus=document.activeElement,this.activeSubMenuRef=ee.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(()=>{this.container.current?.focus();const{onMenuOpened:e}=this.props;e(this)})}componentDidUpdate(e,t){const{actions:n}=this.props,{activeSubMenu:s}=this.state;s!==t.activeSubMenu&&(s==null?this.container.current?.focus():this.setActiveSubMenuPosition()),e.actions!==n&&(this.initMenu(),(this.container.current==null||!this.container.current.contains(document.activeElement))&&this.container.current?.focus()),this.verifyPosition()}componentWillUnmount(){this.cancelPromises(),window.removeEventListener("resize",this.handleWindowResize),cancelAnimationFrame(this.rAF)}container;oldFocus;activeSubMenuRef;subMenuTimer;rAF;initialPosition;getKeyboardIndex(){const{options:e}=this.props;if(e.separateKeyboardMouse!==void 0&&e.separateKeyboardMouse){const{keyboardIndex:t}=this.state;return t}return this.getMouseIndex()}setKeyboardIndex(e){const{options:t}=this.props;t.separateKeyboardMouse!==void 0&&t.separateKeyboardMouse?this.setState({keyboardIndex:e}):this.setMouseIndex(e)}getMouseIndex(){const{mouseIndex:e}=this.state;return e}setMouseIndex(e){this.setState({mouseIndex:e})}initMenu(){this.cancelPromises(),cancelAnimationFrame(this.rAF);const{options:e}=this.props;let t=e.initialKeyboardIndex;t===void 0&&(t=-1);const{actions:n}=this.props,s=Be.getMenuItems(n),i=[];for(let o=s.length-1;o>=0;o-=1){const a=s[o];a instanceof Promise?this.initMenuPromise(a):i.push(a)}this.setState({mouseIndex:-1,keyboardIndex:t,activeSubMenu:null,menuItems:Be.sortActions(i)})}initMenuPromise(e){const t=we.makeCancelable(e);this.setState(n=>({pendingItems:n.pendingItems.concat(t)})),t.then(n=>{this.setState(s=>{const i=s.pendingItems.indexOf(t);if(i>=0){const o=s.pendingItems.slice();return o.splice(i,1),{menuItems:Be.sortActions(s.menuItems.concat(n)),pendingItems:o}}return null})},n=>{we.isCanceled(n)||(this.setState(s=>{const i=s.pendingItems.indexOf(t);if(i>=0){const o=s.pendingItems.slice();return o.splice(i,1),{pendingItems:o}}return null}),td.error(n))})}cancelPromises(){const{pendingItems:e}=this.state;e.map(t=>t.cancel())}setActiveSubMenuPosition(){if(this.activeSubMenuRef.current===null)return;const e=this.activeSubMenuRef.current.getBoundingClientRect();this.setState({subMenuTop:e.top,subMenuLeft:e.right,subMenuParentHeight:e.height,subMenuParentWidth:e.width})}verifyPosition(){const{options:e,updatePosition:t,subMenuParentWidth:n,subMenuParentHeight:s,top:i,left:o}=this.props;if(!this.container.current||e.doNotVerifyPosition!=null&&e.doNotVerifyPosition)return;let{top:a,left:r}=this.initialPosition;const{width:c,height:h}=this.container.current?.getBoundingClientRect()??{width:0,height:0},u=(this.container.current?.scrollHeight??0)>window.innerHeight;h===0||c===0||(a+h>window.innerHeight&&(a-h-s>0?a-=h-s:a=window.innerHeight-h),r+c>window.innerWidth&&(r=r-c-n),(o!==r||i!==a)&&(this.setState({hasOverflow:u}),t(a,r)))}handleWindowResize(){this.container.current&&this.closeMenu(!0)}handleBlur(e){if(!this.container.current){td.warn("Container is null!");return}if(!this.container.current.contains(e.relatedTarget)){let t=e.relatedTarget,n=!1;for(;t&&!n;)n=t.hasAttribute("data-dh-context-menu"),t=t.parentElement;n||this.closeMenu(!0)}}isEscapeKey(e){const{left:t}=this.props;return e==="Escape"||t<0&&e==="ArrowRight"||e==="ArrowLeft"}handleKeyDown(e){const{menuItems:t}=this.state,n=this.getKeyboardIndex();let s=n,i=!1;if(e.key==="Enter"||e.key===" "){n>=0&&n<t.length&&this.handleMenuItemClick(t[n],e);return}if(e.key==="ArrowRight"?n>=0&&n<=t.length?i=!0:s=0:this.isEscapeKey(e.key)?s=null:e.key==="ArrowUp"||e.shiftKey&&e.key==="Tab"?s=Be.getNextMenuItem(s,-1,t):(e.key==="ArrowDown"||e.key==="Tab")&&(s=Be.getNextMenuItem(s,1,t)),i){this.openSubMenu(n),e.preventDefault(),e.stopPropagation();return}n!==s&&(s!==null?this.setKeyboardIndex(s):(this.closeMenu(),this.oldFocus instanceof HTMLElement&&this.oldFocus.focus()),e.preventDefault(),e.stopPropagation())}openSubMenu(e){const{menuItems:t,activeSubMenu:n}=this.state,s=t[e].actions?e:null;n!==s&&this.setState({activeSubMenu:s,subMenuTop:null,subMenuLeft:null})}closeMenu(e=!1){const{closeMenu:t,onMenuClosed:n}=this.props;cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{t(e),n(this)})}closeSubMenu(){this.setState({activeSubMenu:null})}handleCloseSubMenu(e){e?this.closeMenu(!0):this.closeSubMenu()}handleMenuItemClick(e,t){t.preventDefault(),t.stopPropagation();const{menuItems:n}=this.state;e!=null&&(e.disabled===void 0||!e.disabled)&&(e.actions!=null?this.openSubMenu(n.indexOf(e)):e.action!=null&&(e.action(),this.closeMenu(!0)))}handleMenuItemContextMenu(e,t){t.metaKey||this.handleMenuItemClick(e,t)}handleMenuItemMouseMove(e){const{menuItems:t}=this.state,n=t.indexOf(e);this.setMouseIndex(n),n>=0&&n<t.length&&(e.disabled===void 0||!e.disabled)&&this.openSubMenu(n)}handleMouseLeave(){this.setMouseIndex(-1)}render(){const e=[],{top:t,left:n}=this.props,{activeSubMenu:s,hasOverflow:i,keyboardIndex:o,menuItems:a,mouseIndex:r,pendingItems:c,subMenuTop:h,subMenuLeft:u,subMenuParentWidth:m,subMenuParentHeight:g}=this.state;for(let v=0;v<a.length;v+=1){const w=a[v];v>0&&w.group!==a[v-1].group&&e.push(l.jsx("hr",{},`${v}.separator`));const T=l.jsx(zh,{ref:s===v?this.activeSubMenuRef:null,isKeyboardSelected:o===v,isMouseSelected:r===v,menuItem:w,closeMenu:this.handleCloseSubMenu,onMenuItemClick:this.handleMenuItemClick,onMenuItemMouseMove:this.handleMenuItemMouseMove,onMenuItemContextMenu:this.handleMenuItemContextMenu},v);e.push(T)}let p=null;c.length>0&&(p=l.jsx("div",{className:"loading",children:l.jsx(En,{})}));const{menuStyle:C,"data-testid":f}=this.props,S=s!==null&&h!==null&&u!==null;return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:U({"has-overflow":i},"context-menu-container"),style:{top:t,left:n,...C},ref:this.container,"data-dh-context-menu":!0,onBlur:this.handleBlur,onKeyDown:this.handleKeyDown,onMouseLeave:this.handleMouseLeave,onContextMenu:Ma.handleContextMenu,role:"menuitem",tabIndex:0,"data-testid":f,children:[e,p]}),S&&s!==null&&h!==null&&u!==null&&l.jsx(Ma,{actions:a[s].actions||[],closeMenu:this.handleCloseSubMenu,top:h,left:u,updatePosition:(v,w)=>{this.setState({subMenuTop:v,subMenuLeft:w})},subMenuParentWidth:m,subMenuParentHeight:g},`sub-${s}`)]})}}const bf=Ma;class wf extends b.Component{constructor(e){super(e),this.handleMenuClose=this.handleMenuClose.bind(this),this.handleContextMenu=this.handleContextMenu.bind(this),this.container=ee.createRef(),this.openMenu=ee.createRef(),this.state={actions:null,left:0,top:0}}componentDidMount(){this.container.current?.parentElement&&this.container.current.parentElement.addEventListener("contextmenu",this.handleContextMenu)}componentWillUnmount(){this.container.current?.parentElement&&this.container.current.parentElement.removeEventListener("contextmenu",this.handleContextMenu)}container;openMenu;handleContextMenu(e){if(!Be.isContextActionEvent(e)||!this.container.current||e.metaKey||e.ctrlKey)return;const t=Be.getMenuItems(e.contextActions),n=this.container.current.getBoundingClientRect(),s=e.clientY-n.top,i=e.clientX-n.left;if(t.length===0){if(e.target===this.container.current){e.preventDefault(),this.setState({actions:null},()=>{const o=document.elementFromPoint(i,s),a=new MouseEvent("contextmenu",{clientX:e.clientX,clientY:e.clientY,bubbles:!0,cancelable:!0});o?.dispatchEvent(a)});return}return}e.preventDefault(),this.setState({actions:t,top:s,left:i})}handleMenuClose(e){e===this.openMenu.current&&this.setState({actions:null})}render(){let e=null;const{"data-testid":t}=this.props,{actions:n,top:s,left:i}=this.state;return n&&(e=l.jsx(bf,{ref:this.openMenu,actions:n,onMenuClosed:this.handleMenuClose,top:s,left:i,updatePosition:(o,a)=>{this.setState({top:o,left:a})},"data-testid":t})),l.jsx("div",{className:U("context-menu-root",{active:n}),ref:this.container,children:e})}}const qh=wf;class vs extends b.Component{static propTypes={className:M.string,in:M.bool.isRequired,children:M.node.isRequired,autoFocusOnShow:M.bool,"data-testid":M.string};static defaultProps={className:"",autoFocusOnShow:!1,"data-testid":void 0};static handleEnter(e){const t=e;t.style.height="0"}static handleEntering(e){const t=e;t.style.height=`${vs.getHeight(t)}px`}static handleExiting(e){const t=e;t.style.height="0"}static handleExit(e){const t=e;t.style.height=`${vs.getHeight(t)}px`}static getHeight(e){const t=e.scrollWidth-e.clientWidth;return e.scrollHeight-t}constructor(e){super(e),this.handleEntered=this.handleEntered.bind(this)}handleEntered(e){const t=e;t.style.height="";const{autoFocusOnShow:n}=this.props;if(n!==void 0&&n){const s=t.querySelector("input, select, textarea");s?.focus()}}render(){const{children:e,className:t,in:n,"data-testid":s}=this.props;return l.jsx(Ct,{in:n,classNames:{enterActive:"collapsing",enterDone:"collapse show",exitActive:"collapsing",exitDone:"collapse"},onEnter:vs.handleEnter,onEntering:vs.handleEntering,onEntered:this.handleEntered,onExit:vs.handleExit,onExiting:vs.handleExiting,timeout:350,children:i=>l.jsx("div",{className:U({collapse:i==="exited"},t),"data-testid":s,children:e})})}}const vf=vs;function dr(d){const e=b.useRef();return b.useEffect(function(){e.current=d}),e.current}function Yh(d){const e=b.useRef(null);return b.useEffect(function(){d&&(typeof d=="function"?d(e.current):d.current=e.current)}),e}const Tf=3500,Ef=X.module("useCopyToClipboard");function yf(){const[d,e]=b.useState(!1),t=b.useRef(null),n=b.useCallback(s=>{Wi(s).then(()=>{e(!0)}).catch(i=>Ef.error(`Unable to copy ${s}`,`
1
+ import{A as b,B as M,H as ee,P as Km,C as l,D as Ct,F as U,R as Eo,G as Z,I as je,J as me,K as Xe,L as qm,M as Ym,N as xl,O as sr,Q as Xm,E as Rl,S as Zm,T as il,U as pe,V as ol,W as ks,X as Fh,Y as ot,Z as Il,_ as Qm,$ as Jm,a0 as eg,a1 as tg,a2 as ue,a3 as Hc,a4 as Dl,a5 as ng,a6 as sg,a7 as Nh,a8 as Ve,a9 as al,aa as ir,ab as ig,ac as Ln,ad as og,ae as ag,af as rg,ag as lg,ah as rl,ai as cg,aj as dg,ak as hg,al as Vc,am as ug,an as Bc,ao as mg,ap as gg,aq as pg,ar as fg,as as Cg,at as Sg,au as St,av as Mh,aw as bg,ax as kh,ay as wg,az as Ah,aA as vg,aB as Tg,aC as Eg,aD as yg,aE as $c,aF as xg}from"./vendor-ef910ebc.js";import{e as Qn,l as On,K as dn,a as Uc,R as Rg,b as Is,W as Ig}from"./monaco-a26f85af.js";import{T as qe,L as X,M as Bi,a as $i,b as Do,v as Oh,c as En,d as Lh,e as Pn,f as Dg,g as Fg,h as Fo,i as Ng,j as Ui,k as Fl,l as Mg,m as ll,n as kg,o as Ph,p as Nl,q as _h,r as Wc,s as Ag,t as Og,u as Lg,w as Pg,x as Jt,y as Ms,z as jh,A as Jn,B as or,C as ji,D as _g,E as jg,F as Gc,G as Ia,H as zc,I as Hh,J as Hg,K as No,N as Vh,O as Vg,P as Bg,Q as Ml,R as kl,S as Da,U as $n,V as $g,W as Ug,X as Wg,Y as Gg,Z as zg,_ as Al,$ as As,a0 as Kc,a1 as Mo,a2 as Ol,a3 as Ll,a4 as Kg,a5 as qg,a6 as Fa,a7 as Yg,a8 as Pl,a9 as Bh,aa as ti,ab as Xg,ac as Zg,ad as Qg,ae as Jg,af as ep,ag as tp,ah as qc,ai as Lr,aj as np,ak as sp,al as ip,am as op,an as ap,ao as $h,ap as rp,aq as lp,ar as cp,as as Uh,at as dp,au as hp,av as up,aw as mp,ax as gp,ay as pp,az as fp,aA as Cp,aB as Sp,aC as bp,aD as wp,aE as vp,aF as Wh,aG as Tp,aH as cl,aI as dl,aJ as Ep,aK as yp,aL as xp,aM as Rp,aN as Ip,aO as Dp,aP as Fp,aQ as Np,aR as Mp,aS as kp,aT as Ap,aU as Yc,aV as Op,aW as Lp,aX as Pp}from"./index-6cd53800.js";import{T as Gh,r as _p,S as jp,g as Xc,l as Hp,u as Vp,a as Bp,b as $p}from"./useConnection-04dd3639.js";import{P as Na,b as Up,h as Wp,p as Gp,o as zp,s as Kp,t as qp,c as Pr}from"./plotly-d53ecbd5.js";import"./helpers-042e6b4d.js";class Yp extends b.Component{static propTypes={children:M.node.isRequired,options:M.shape({}),className:M.string,timeout:M.number,onEntered:M.func,onExited:M.func,isShown:M.bool,closeOnBlur:M.bool,interactive:M.bool,referenceObject:M.shape({}),"data-testid":M.string};static defaultProps={options:{},className:"",timeout:qe.transitionMs,onEntered(){},onExited(){},isShown:!1,interactive:!1,closeOnBlur:!1,referenceObject:null,"data-testid":void 0};constructor(e){super(e),this.handleEnter=this.handleEnter.bind(this),this.handleExit=this.handleExit.bind(this),this.handleBlur=this.handleBlur.bind(this),this.element=document.createElement("div"),this.element.className="popper-container",this.container=ee.createRef(),this.rAF=0;const{isShown:t}=this.props;this.state={show:t,popper:null}}componentDidUpdate(e){const{isShown:t}=this.props;e.isShown!==t&&(t?(cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{this.show()})):this.hide())}componentWillUnmount(){this.destroyPopper(!1)}element;container;rAF;getVisibleElement(e){return e==null||e.clientHeight>0||e.clientWidth>0?e:this.getVisibleElement(e.parentElement)}initPopper(){let{popper:e}=this.state;const{closeOnBlur:t,referenceObject:n}=this.props;if(e||this.container.current===null)return;let{options:s}=this.props;s={placement:"auto",modifiers:{preventOverflow:{boundariesElement:"viewport"}},...s},document.body.appendChild(this.element);let i=this.getVisibleElement(this.container.current);i==null&&(i=this.container.current),e=new Km(n||i,this.element,s),e.scheduleUpdate(),cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{if(t&&!this.element.contains(document.activeElement)){const o=this.element.firstElementChild;o instanceof HTMLElement&&o.focus()}}),this.setState({popper:e})}destroyPopper(e=!0){cancelAnimationFrame(this.rAF);const{popper:t}=this.state;t&&(t.destroy(),document.body.contains(this.element)&&document.body.removeChild(this.element),e&&this.setState({popper:null}))}show(){this.initPopper(),this.setState({show:!0})}hide(){this.setState({show:!1})}scheduleUpdate(){const{popper:e}=this.state;e&&e.scheduleUpdate()}handleBlur(e){e.relatedTarget instanceof HTMLElement&&(this.element.contains(e.relatedTarget)||this.hide())}handleEnter(){const{onEntered:e}=this.props;e()}handleExit(){const{onExited:e}=this.props,{show:t}=this.state;t||this.destroyPopper(),e()}renderContent(){const{className:e,children:t,timeout:n,interactive:s,closeOnBlur:i}=this.props,{show:o}=this.state;return l.jsx(Ct,{in:o,timeout:n,classNames:"popper-transition",onEntered:this.handleEnter,onExited:this.handleExit,children:l.jsx("div",{onClick:a=>{a.stopPropagation()},onKeyDown:a=>{a.key==="Escape"&&this.hide()},className:U("popper",{interactive:s},e),onBlur:i?this.handleBlur:void 0,tabIndex:i?-1:void 0,role:"presentation",children:l.jsxs("div",{className:"popper-content",children:[t,l.jsx("div",{className:"popper-arrow","x-arrow":""})]})})})}render(){const{popper:e}=this.state,{"data-testid":t}=this.props;return l.jsx("div",{className:"popper-parent-container",ref:this.container,style:{display:"none"},"data-testid":t,children:e&&Eo.createPortal(this.renderContent(),this.element)})}}const ci=Yp,Xp=X.module("Tooltip");class _t extends b.Component{static defaultTimeout=500;static defaultReshowTimeout=100;static triggerReshowThreshold=300;static shownTooltipCount=0;static lastHiddenTime=Date.now();static defaultProps={interactive:!1,options:{},popperClassName:"",reshowTimeout:_t.defaultReshowTimeout,timeout:_t.defaultTimeout,onEntered:()=>{},onExited:()=>{},"data-testid":void 0};static handleHidden(){_t.shownTooltipCount-=1,_t.shownTooltipCount===0&&(_t.lastHiddenTime=Date.now())}static handleShown(){_t.shownTooltipCount+=1}constructor(e){super(e),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.handleWindowMouseMove=this.handleWindowMouseMove.bind(this),this.handleWheel=this.handleWheel.bind(this),this.handleTimeout=this.handleTimeout.bind(this),this.handleExited=this.handleExited.bind(this),this.stopShowingTooltip=this.stopShowingTooltip.bind(this),this.container=ee.createRef(),this.popper=ee.createRef(),this.parent=null,this.timer=null,this.state={isShown:!1}}componentDidMount(){this.startListening();const{timeout:e}=this.props;e===0&&this.show()}componentDidUpdate(e,t){const{isShown:n}=t,{isShown:s}=this.state;s!==n&&(s?_t.handleShown():_t.handleHidden())}componentWillUnmount(){this.stopListening(),this.stopListeningWindow(),this.stopTimer();const{isShown:e}=this.state;e&&_t.handleHidden()}container;popper;parent;timer;startListening(){if(!this.container.current||!this.container.current.parentElement){Xp.error("Tooltip doesn't have a container or a parent set!");return}this.parent=this.container.current.parentElement,this.parent.addEventListener("mousemove",this.handleMouseMove),this.parent.addEventListener("mouseleave",this.handleMouseLeave),this.parent.addEventListener("mousedown",this.stopShowingTooltip)}stopListening(){this.parent&&(this.parent.removeEventListener("mousemove",this.handleMouseMove),this.parent.removeEventListener("mouseleave",this.handleMouseLeave),this.parent.removeEventListener("mousedown",this.stopShowingTooltip))}startListeningWindow(){window.addEventListener("mousemove",this.handleWindowMouseMove,!0),window.addEventListener("contextmenu",this.stopShowingTooltip,!0),window.addEventListener("wheel",this.handleWheel)}stopListeningWindow(){window.removeEventListener("mousemove",this.handleWindowMouseMove,!0),window.removeEventListener("contextmenu",this.stopShowingTooltip,!0),window.removeEventListener("wheel",this.handleWheel)}handleMouseMove(){this.startTimer()}handleWheel(){const{isShown:e}=this.state;this.popper.current&&this.parent&&e&&!this.popper.current.element.matches(":hover")&&!this.parent.matches(":hover")&&(this.stopTimer(),this.hide())}handleMouseLeave(){const{isShown:e}=this.state;this.stopTimer();const{interactive:t}=this.props;!t&&e&&this.hide()}handleTimeout(){this.show()}handleWindowMouseMove(e){const t=e.clientX,n=e.clientY,{isShown:s}=this.state;if(!this.popper.current||!this.parent)return;const i=this.popper.current.element.getBoundingClientRect(),o=this.parent.getBoundingClientRect();t>=i.left&&t<=i.left+i.width&&n>=i.top&&n<=i.top+i.height?this.handleMouseMove():t>=o.left&&t<=o.left+o.width&&n>=o.top&&n<=o.top+o.height?this.handleMouseMove():s&&(this.stopTimer(),this.hide())}startTimer(){this.stopTimer();const{timeout:e,reshowTimeout:t}=this.props;let n=e;(_t.shownTooltipCount>0||Date.now()-_t.lastHiddenTime<_t.triggerReshowThreshold)&&(n=t),this.timer=window.setTimeout(this.handleTimeout,n)}stopTimer(){this.timer!=null&&(clearTimeout(this.timer),this.timer=null)}show(){const{isShown:e}=this.state;if(this.stopTimer(),!e){this.popper.current?.show(),this.setState({isShown:!0});const{interactive:t}=this.props;t&&this.startListeningWindow()}}hide(){this.popper.current?.hide(),this.stopListeningWindow()}update(){this.popper.current?.scheduleUpdate()}handleExited(){this.setState({isShown:!1});const{onExited:e}=this.props;e()}stopShowingTooltip(){const{isShown:e}=this.state;this.stopTimer(),e&&this.hide()}render(){const{interactive:e,children:t,referenceObject:n,popperClassName:s,"data-testid":i,onEntered:o}=this.props,{isShown:a}=this.state;let{options:r}=this.props;return r={placement:"bottom",...r},l.jsx("div",{ref:this.container,style:{display:"none"},"data-testid":i,children:l.jsx(ci,{className:U(s),options:r,ref:this.popper,onEntered:o,onExited:this.handleExited,interactive:e,referenceObject:n,children:l.jsxs("div",{className:"tooltip-content",children:[" ",a&&t]})})})}}const tt=_t;function ar(d){const{children:e,className:t,style:n,"data-testid":s}=d;return l.jsx("div",{className:U("btn-group",t),style:n,role:"group","data-testid":s,children:e})}ar.displayName="ButtonGroup";ar.propTypes={children:M.node.isRequired,className:M.string,style:M.object,"data-testid":M.string};ar.defaultProps={className:null,style:{},"data-testid":void 0};const Zp=["primary","secondary","tertiary","success","danger","inline","ghost"],Qp=["group-end"];function Jp(d,e){switch(d){case"primary":return"btn-primary";case"secondary":return"btn-outline-primary";case"tertiary":return"btn-secondary";case"success":return"btn-success";case"danger":return"btn-danger";case"inline":return"btn-inline";case"ghost":return U("btn-link",{"btn-link-icon":e,"btn-link-icon-only":e})}}function ef(d){switch(d){case"group-end":return U("pl-2","pr-3")}}const rr=ee.forwardRef((d,e)=>{const{kind:t,variant:n,type:s,tooltip:i,icon:o,disabled:a=!1,active:r,onClick:c,onContextMenu:h,onMouseDown:u,onMouseUp:m,onMouseEnter:g,onMouseLeave:p,onKeyDown:C,className:f,style:S,children:v,tabIndex:w,"data-testid":T,"aria-label":y}=d,E=Boolean(o&&v==null),I=Jp(t,E);let D;n&&(D=ef(n));let F;o&&(F=ee.isValidElement(o)?o:l.jsx(Z,{icon:o}));let _;i!==void 0&&(_=typeof i=="string"?l.jsx(tt,{children:i}):i);let P=y;y===void 0&&E&&i!=null&&typeof i=="string"&&(P=i);const $=l.jsxs("button",{"data-testid":T,ref:e,type:s,className:U("btn",I,D,{active:r},f),onClick:c,onContextMenu:h,onMouseUp:m,onMouseDown:u,onMouseEnter:g,onMouseLeave:p,onKeyDown:C,style:S,disabled:a,tabIndex:w,"aria-label":P,children:[o&&F,v,i!=null&&!a&&_]});return a?l.jsxs("span",{className:"btn-disabled-wrapper",children:[$,i!==void 0&&_]}):$});rr.displayName="Button";rr.propTypes={kind:M.oneOf(Zp).isRequired,variant:M.oneOf(Qp),type:M.oneOf(["submit","reset","button"]),tooltip(d){const{tooltip:e,icon:t,children:n}=d;return e===void 0&&t!=null&&n==null?new Error("Tooltip is required for icon only buttons"):null},icon(d){const{children:e,icon:t}=d;return t==null&&e==null?new Error("Icon is required if no children are provided"):e==null&&!ee.isValidElement(t)&&(t==null||t.iconName===""||t.iconName==null)?new Error("Icon must be react element or fontawesome IconDefinition"):null},disabled:M.bool,active:M.bool,onClick(d){const{onClick:e,type:t}=d;return t==="button"&&typeof e!="function"?new Error("type button requires an onClick function"):e!==void 0&&typeof e!="function"?new Error("onClick must be a function"):null},onContextMenu:M.func,onMouseUp:M.func,onMouseDown:M.func,onMouseEnter:M.func,onMouseLeave:M.func,onKeyDown:M.func,tabIndex:M.number,children:M.node,className:M.string,style:M.object,"data-testid":M.string};rr.defaultProps={type:"button",onClick:void 0,onContextMenu:void 0,onMouseUp:void 0,onMouseDown:void 0,onMouseEnter:void 0,onMouseLeave:void 0,onKeyDown:void 0,variant:void 0,tooltip:void 0,icon:void 0,disabled:!1,active:void 0,tabIndex:void 0,children:void 0,className:void 0,style:{},"data-testid":void 0};const B=rr;function tf({className:d,icon:e,isOpen:t,subtitle:n,title:s}){return l.jsx(Bi,{isOpen:t,className:d,children:l.jsx($i,{children:l.jsxs("div",{className:"info-modal",children:[e!=null&&l.jsx("div",{className:"message-icon",children:l.jsx(Z,{icon:e})}),l.jsx("div",{className:"message-header",children:s}),n!=null&&l.jsx("div",{className:"message-content",children:n})]})})})}function _l({className:d="modal-footer",children:e,"data-testid":t}){return l.jsx("div",{className:d,"data-testid":t,children:e})}function ri(d){const{isOpen:e,headerText:t,bodyText:n,onCancel:s,onConfirm:i,onDiscard:o,onModalDisable:a,cancelButtonText:r="Cancel",confirmButtonText:c="Okay",discardButtonText:h="Discard",isConfirmDanger:u=!1,children:m,"data-testid":g}=d,p=b.useRef(null),C=b.useRef(null),f=b.useCallback(()=>{C.current!==null&&C.current.checked&&a&&a(),i()},[i,a]),S=b.useCallback(()=>{p.current?.focus()},[]);let v="";return e&&(v=typeof n=="function"?n():n),l.jsxs(Bi,{isOpen:e,className:"theme-bg-light",onOpened:S,children:[l.jsx(Do,{closeButton:!1,children:t}),l.jsx($i,{children:v}),l.jsxs(_l,{children:[a&&l.jsxs("div",{className:"custom-control custom-checkbox form-group mr-auto",children:[l.jsx("input",{type:"checkbox",className:"custom-control-input",id:"move-confirmation-checkbox",defaultChecked:!1,ref:C,"data-testid":g!==void 0?`${g}-checkbox-confirm`:void 0}),l.jsx("label",{className:"custom-control-label",htmlFor:"move-confirmation-checkbox",children:"Don't ask me again"})]}),o&&l.jsx(B,{kind:"secondary",className:"mr-auto","data-dismiss":"modal",onClick:o,"data-testid":g!==void 0?`${g}-btn-discard`:void 0,children:h}),s&&l.jsx(B,{kind:"secondary","data-dismiss":"modal",onClick:s,"data-testid":g!==void 0?`${g}-btn-cancel`:void 0,children:r}),l.jsxs(ar,{children:[l.jsx(B,{kind:u?"danger":"primary",onClick:f,ref:p,"data-testid":g!==void 0?`${g}-btn-confirm`:void 0,children:c}),m]})]})]})}ri.propTypes={isOpen:M.bool.isRequired,headerText:M.string.isRequired,bodyText:M.oneOfType([M.string,M.func]).isRequired,onCancel:M.func,onConfirm:M.func.isRequired,onDiscard:M.func,onModalDisable:M.func,cancelButtonText:M.string,confirmButtonText:M.string,discardButtonText:M.string,children:M.node,"data-testid":M.string};ri.defaultProps={children:void 0,cancelButtonText:"Cancel",confirmButtonText:"Okay",discardButtonText:"Discard",onCancel:void 0,onDiscard:void 0,onModalDisable:void 0,"data-testid":void 0};const lr=ee.forwardRef((d,e)=>{const{children:t,className:n,disabled:s,onClick:i,style:o,id:a}=d;return l.jsx("button",{ref:e,type:"button",className:U("btn",n),onClick:i,style:o,disabled:s,id:a,children:t})});lr.displayName="Button";lr.propTypes={children:M.node,className:M.string,disabled:M.bool,onClick:M.func,style:M.shape({}),id:M.string};lr.defaultProps={children:null,className:"",disabled:!1,onClick:()=>null,style:{},id:""};const Zc=lr;function jl({className:d,isFlipped:e,children:t,"data-testid":n}){const s=r=>{if(t.length!==2)throw new Error("CardFlip requires 2 children to function");return t[r]},i=b.useRef(null),o=b.useCallback(r=>{r.target===r.currentTarget&&document.body.classList.add("card-flip--is-flipping")},[]),a=b.useCallback(r=>{r.target===r.currentTarget&&document.body.classList.remove("card-flip--is-flipping")},[]);return b.useEffect(function(){if(!i.current)throw Error("ref undefined");i.current.addEventListener("transitionstart",o);const c=i.current;return function(){if(c!=null)return c.removeEventListener("transitionstart",o)}},[o]),l.jsxs("div",{className:U(d,{"card-flip--show-front":e,"card-flip--show-back":!e}),"data-testid":n,children:[l.jsx("div",{className:"card-flip--back",children:s(0)}),l.jsx("div",{ref:i,className:"card-flip--front",onTransitionEnd:a,children:s(1)})]})}function _r(d){return d.then!==void 0}class qs{static actionsDisabled=!1;static disableAllActions(){qs.actionsDisabled=!0}static enableAllActions(){qs.actionsDisabled=!1}static isContextActionEvent(e){return Array.isArray(e.contextActions)}static compareActions(e,t){return e.group!==t.group?(e.group??0)>(t.group??0)?1:-1:e.order!==t.order?(e.order??0)>(t.order??0)?1:-1:e.title!==t.title?(e.title??"")>(t.title??"")?1:-1:e!==t?e>t?1:-1:0}static sortActions(e){if(e==null||!Array.isArray(e))return[];const t=e.slice();return t.sort(qs.compareActions),t}static isMacPlatform(){const{platform:e}=window.navigator;return e.startsWith("Mac")}static getModifierKey(){return qs.isMacPlatform()?"metaKey":"ctrlKey"}static isModifierKeyDown(e){const t=qs.getModifierKey();return e[t]}static getMenuItems(e,t=!0){let n=[],s=e;Array.isArray(s)||(s=[s]);for(let i=0;i<s.length;i+=1){const o=s[i];let a;typeof o=="function"?a=o():a=o,a!=null&&(a instanceof Promise?t&&n.push(a):Array.isArray(a)?n=n.concat(a):n.push(a))}return n=n.filter(i=>i.title!==void 0||i.then!=null||i.menuElement),n}static getNextMenuItem(e,t,n){let s=e;s<0&&t<0&&(s=n.length);for(let i=1;i<n.length+1;i+=1){const o=(s+t*i+n.length)%n.length,a=n[o];if(!(a instanceof Promise)&&a.disabled!==!0)return o}return e}}const Be=qs,Qc=X.module("GlobalContextAction");class nf extends b.Component{constructor(e){super(e),this.handleContextMenu=this.handleContextMenu.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this)}componentDidMount(){document.body.addEventListener("contextmenu",this.handleContextMenu),document.body.addEventListener("keydown",this.handleKeyDown)}componentWillUnmount(){document.body.removeEventListener("contextmenu",this.handleContextMenu),document.body.removeEventListener("keydown",this.handleKeyDown)}handleContextMenu(e){const t=e;t.contextActions==null&&(t.contextActions=[]);const{action:n}=this.props;n.title==null&&!n.menuElement||(t.contextActions==null&&(t.contextActions=[]),t.contextActions.push(n),Qc.debug("Received context menu event at global action! Menu items are now: ",t.contextActions))}handleKeyDown(e){const{action:t}=this.props;!Be.actionsDisabled&&t.shortcut!==void 0&&t.shortcut.matchesEvent(e)&&(Qc.debug("Global hotkey matched!",e),t.action?.(e),e.preventDefault(),e.stopPropagation())}render(){return null}}const sf=nf;class of extends b.Component{render(){const{actions:e,"data-testid":t}=this.props,n=[];for(let s=0;s<e.length;s+=1){const i=e[s],{shortcut:o}=i;if(i.title!=null||i.menuElement||o){const a=l.jsx(sf,{action:i,"data-testid":t},`${i.title}.${o?.id}`);n.push(a)}}return n}}const af=of;const ea=X.module("ContextActions");class rf extends b.Component{static groups={default:null,high:100,medium:5e3,low:1e4,global:1e5,edit:100};static triggerMenu(e,t,n,s){if(s.length===0)return;const i=new MouseEvent("contextmenu",{clientX:t,clientY:n,bubbles:!0,cancelable:!0});i.contextActions=s,e.dispatchEvent(i)}constructor(e){super(e),this.handleContextMenu=this.handleContextMenu.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.container=ee.createRef(),this.state={globalActions:[],keyboardActions:[]}}static getDerivedStateFromProps(e){if(e.actions==null||!Array.isArray(e.actions))return{globalActions:[],keyboardActions:[]};const t=e.actions.filter(s=>!_r(s)&&typeof s!="function"&&s.isGlobal),n=e.actions.filter(s=>!_r(s)&&typeof s!="function"&&(s.isGlobal===void 0||!s.isGlobal)&&s.shortcut!=null);return{globalActions:t,keyboardActions:n}}componentDidMount(){this.container.current?.parentElement&&(this.container.current.parentElement.addEventListener("contextmenu",this.handleContextMenu),this.container.current.parentElement.addEventListener("keydown",this.handleKeyDown))}componentWillUnmount(){this.container.current?.parentElement&&(this.container.current.parentElement.removeEventListener("contextmenu",this.handleContextMenu),this.container.current.parentElement.removeEventListener("keydown",this.handleKeyDown))}container;handleContextMenu(e){const{ignoreClassNames:t=[]}=this.props;if(t.length>0){let s=e.target;for(;s!=null;){const{classList:i}=s,o=t.find(a=>i.contains(a));if(o!==void 0){ea.debug2(`Contextmenu event ignored based on the target className "${o}"`);return}s=s.parentElement}}if(Be.isContextActionEvent(e)||(e.contextActions=[]),!Be.isContextActionEvent(e))return;const{actions:n}=this.props;if(n!=null){let s=n;Array.isArray(s)&&(s=s.filter(i=>_r(i)||typeof i=="function"||i.isGlobal===void 0||!i.isGlobal)),e.contextActions=e.contextActions.concat(s)}ea.debug("Received context menu event! Menu items are now: ",e.contextActions)}handleKeyDown(e){const{keyboardActions:t}=this.state;for(let n=0;n<t.length;n+=1){const s=t[n];!Be.actionsDisabled&&s.shortcut!=null&&s.shortcut.matchesEvent(e)&&(ea.debug("Context hotkey matched!",e),s.action?.(e),e.stopPropagation(),e.preventDefault(),ea.debug2("Matched hotkey returned false, key event not consumed"))}}render(){const{"data-testid":e}=this.props,{globalActions:t}=this.state;return l.jsx("div",{className:"context-actions-listener",ref:this.container,"data-testid":e,children:l.jsx(af,{actions:t})})}}const ie=rf,Hl=ee.forwardRef((d,e)=>{function t(f){const{menuItem:S,onMenuItemClick:v}=d;v(S,f)}function n(f){const{menuItem:S,onMenuItemMouseMove:v}=d;v(S,f)}function s(f){const{menuItem:S,onMenuItemContextMenu:v}=d;v(S,f)}function i(f,S,v){if(typeof f.type=="string")return f;const{closeMenu:w,menuItem:T,isKeyboardSelected:y,isMouseSelected:E,"data-testid":I}=d,D={menuItem:T,closeMenu:w,isKeyboardSelected:y,isMouseSelected:E,iconElement:S,displayShortcut:v,"data-testid":I};return ee.cloneElement(f,{forwardedProps:D})}const{children:o,menuItem:a,isKeyboardSelected:r=!1,isMouseSelected:c=!1,"data-testid":h}=d,u=a.shortcut?.getDisplayText();let m=null;if(a.icon){const f=a.icon;if(ee.isValidElement(f))m=f;else{let S;a.iconColor!=null&&(a.disabled===void 0||!a.disabled)&&(S={color:a.iconColor}),m=l.jsx(Z,{icon:f,style:S})}}let g=null;const p=Boolean(o);a.actions&&(g=l.jsx(Z,{icon:Oh}));let C=null;if(a.menuElement)C=l.jsx("div",{className:"custom-menu-item",onMouseMove:n,children:i(a.menuElement,m,u)});else{const f=a.disabled,S=a.iconOutline;C=l.jsx("button",{type:"button",className:U("btn-context-menu",{disabled:f},{active:(p||c)&&(f===void 0||!f)},{"keyboard-active":r&&(f===void 0||!f)}),onClick:t,onMouseMove:n,onContextMenu:s,title:a.description??"",children:l.jsxs("div",{className:"btn-context-menu-wrapper",children:[l.jsx("span",{className:U("icon",{outline:S}),children:m}),l.jsx("span",{className:"title",children:a.title}),u!==void 0&&l.jsx("span",{className:"shortcut",children:u}),g&&l.jsx("span",{className:U("submenu-indicator",{disabled:f}),children:g})]})})}return l.jsxs("div",{className:"context-menu-item",ref:e,"data-testid":h,children:[o,C]})});Hl.displayName="ContextMenuItem";Hl.defaultProps={children:null,isKeyboardSelected:!1,isMouseSelected:!1,"data-testid":void 0};const zh=Hl,Ne=Object.freeze([]),qn=new Map;class lf extends Error{isCanceled=!0}const Hi=lf;class Vl{static isDark(e){const t=document.createElement("div");t.style.display="none",t.style.color=e;const n=getComputedStyle(document.body.appendChild(t)).color,s=n.match(/\d+/g);let i=[];if(s)i=s.map(a=>parseInt(a,10));else throw new Error(`Invalid color received. Got ${n}`);return document.body.removeChild(t),Vl.getBrightness(i)<125}static getBrightness(e){return Math.round((e[0]*299+e[1]*587+e[2]*114)/1e3)}}const Kh=Vl;async function Wi(d){const{clipboard:e}=navigator;if(e!==void 0)try{return navigator.clipboard.writeText(d)}catch{return Jc(d)}Jc(d)}function Jc(d){const e=document.activeElement,t=document.createElement("textarea");t.value=d,document.body.appendChild(t),t.focus(),t.select();const n=document.execCommand("copy");if(document.body.removeChild(t),e instanceof HTMLElement&&e.focus(),!n)throw new Error("Unable to execute copy command")}const cf="table_",ed="column_",df=new Set(["in","not","i","ii","k"]),hf=new Set(["abstract","continue","for","new","switch","assert","default","if","package","synchronized","boolean","do","goto","private","this","break","double","implements","protected","throw","byte","else","import","public","throws","case","enum","instanceof","return","transient","catch","extends","int","short","try","char","final","interface","static","void","class","finally","long","strictfp","volatile","const","float","native","super","while","null","true","false"]),uf=/[^a-zA-Z0-9_$+@-]/g,mf=/[^A-Za-z0-9_$]/g;class Ys{static legalize=(e,t,n,s,i)=>{let o=e.trim().replace(/[- ]/g,"_");return s&&(df.has(o)||hf.has(o))&&(o=t+o),o=o.replace(n,""),o||(o=t+i),Number.isNaN(Number(o.charAt(0)))||(o=t+o),o};static legalizeTableName=e=>Ys.legalize(e,cf,uf,!1,0);static legalizeColumnNames=e=>{const t=[];return e.forEach((n,s)=>{let i=Ys.legalizeColumnName(n,s);t.includes(i)&&(i=ed+s),t.push(i)}),t};static legalizeColumnName=(e,t=0)=>Ys.legalize(e,ed,mf,!0,t);static isValidTableName=e=>Ys.legalizeTableName(e)===e;static isValidColumnName=e=>Ys.legalizeColumnName(e)===e}const Gi=Ys;function gf(d,e){return d?d.closest(`.${e}`):null}const pf={getClosestByClassName:gf};class Ue extends CustomEvent{constructor(e,t){super(e,t)}}class we{static makeCancelable(e,t){let n=!1,s,i;const o=new Promise((a,r)=>{i=r,Promise.resolve(e).then(c=>{n?t&&t(c):(s=c,a(c))}).catch(c=>r(c))});return o.cancel=()=>{n=!0,i(new Hi),s!=null&&t&&t(s)},o}static isCanceled(e){return e instanceof Hi}static isTimedOut(e){return e instanceof Gh}static withTimeout(e,t){return new Promise((n,s)=>{setTimeout(()=>{try{n(t())}catch(i){s(i)}},e)})}}class ff{pending=[];resolved=[];add(e,t){const n=we.makeCancelable(e,t);return this.pending.push(n),n.then(()=>{this.resolve(n)},()=>{this.resolve(n)}),n}remove(e){for(let t=0;t<this.pending.length;t+=1)if(this.pending[t]===e){this.pending.splice(t,1);return}}resolve(e){this.remove(e),this.resolved.push(e)}cancel(){const e=[...this.pending,...this.resolved];for(let t=0;t<e.length;t+=1)e[t].cancel();this.pending=[],this.resolved=[]}}const is=ff;function N(d){if(d==null)throw new Error("Value is null or undefined")}function L(d,e,t=void 0){const n=d.get(e)??t;if(n!==void 0)return n;throw new Error(`Missing value for key ${e}`)}class Bl{static isValidRange(e){return e!=null&&e.length===2&&Number.isInteger(e[0])&&Number.isInteger(e[1])&&e[0]<=e[1]}static validateRange(e){if(!Bl.isValidRange(e))throw new Error(`Invalid range! ${e}`)}static isSelected(e,t){for(let n=0;n<e.length;n+=1){const s=e[n],i=s[0],o=s[1];if(i<=t&&t<=o)return!0}return!1}static selectRange(e,t){let[n,s]=t;const i=[...e];for(let o=i.length-1;o>=0;o-=1){const a=i[o],r=a[0],c=a[1];if(r<=n&&s<=c)return i;n<=c&&r<=s&&(n=Math.min(n,r),s=Math.max(s,c),i.splice(o,1))}return i.push([n,s]),i}static deselectRange(e,t){const[n,s]=t,i=[...e];for(let o=i.length-1;o>=0;o-=1){const a=i[o],r=a[0],c=a[1];if(!(s<r||c<n))if(r<n&&s<c){i[o]=[r,n-1],i.splice(o+1,0,[s+1,c]);break}else n<=r&&c<=s?i.splice(o,1):r<n?i[o]=[r,n-1]:i[o]=[s+1,c]}return i}static count(e){return e.reduce((t,n)=>t+(n[1]-n[0]+1),0)}static getItemsInRanges(e,t){return t.reduce((n,s)=>{const i=[...n];for(let o=s[0];o<=s[1];o+=1)i.push(e[o]);return i},[])}}const An=Bl;class Cf{static join(e,t="and"){if(e==null||e.length===0)return"";if(e.length===1)return e[0];if(e.length===2)return`${e[0]} ${t} ${e[1]}`;const n=e.slice(0,e.length-1).join(", "),s=e[e.length-1];return`${n}, ${t} ${s}`}static toLower(e,t=!0){if(e==null){if(t)return"";throw new Error("Null string passed in to TextUtils.toLower")}return e.toLowerCase()}static sort(e,t,n=!0){return e<t?n?-1:1:e>t?n?1:-1:0}}const zt=Cf;class $l{static TIME_PATTERN="([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]";static TIME_ZONES=Object.freeze([{label:"Tokyo UTC+9 No DST",value:"Asia/Tokyo"},{label:"Seoul UTC+9 No DST",value:"Asia/Seoul"},{label:"Hong Kong UTC+8 No DST",value:"Asia/Hong_Kong"},{label:"Singapore UTC+8 No DST",value:"Asia/Singapore"},{label:"Kolkata UTC+5:30 No DST",value:"Asia/Kolkata"},{label:"Berlin UTC+1",value:"Europe/Berlin"},{label:"UTC UTC±0 No DST",value:"UTC"},{label:"London UTC±0",value:"Europe/London"},{label:"Sao Paulo UTC-2",value:"America/Sao_Paulo"},{label:"Newfoundland UTC-3:30",value:"America/St_Johns"},{label:"Halifax UTC-4",value:"America/Halifax"},{label:"New York UTC−5",value:"America/New_York"},{label:"Chicago UTC-6",value:"America/Chicago"},{label:"Denver UTC-7",value:"America/Denver"},{label:"Los Angeles UTC-8",value:"America/Los_Angeles"},{label:"Anchorage UTC-9",value:"America/Anchorage"},{label:"Honolulu UTC-10 No DST",value:"Pacific/Honolulu"},{label:"Zurich UTC+1",value:"Europe/Zurich"},{label:"Amsterdam UTC+1",value:"Europe/Amsterdam"},{label:"Taipei UTC+8 No DST",value:"Asia/Taipei"},{label:"Sydney UTC+10",value:"Australia/Sydney"}]);static formatElapsedTime(e){if(typeof e!="number"||!Number.isInteger(e))throw new Error(`${e} is not a number that can be expressed as a formatted time`);const t=Math.floor(e/3600),n=Math.floor(e%3600/60),s=e%60;return`${t>0?`${t}h `:""}${n>0||t>0?`${n}m `:""}${e>=60?`${s}s`.padStart(3,"0"):`${s}s`}`}static formatTime(e){if(typeof e!="number"||!Number.isInteger(e)||e<0)throw new Error(`${e} is not a number that can be expressed as a formatted time`);const t=String(Math.floor(e/(60*60))).padStart(2,"0"),n=e%(60*60),s=String(Math.floor(n/60)).padStart(2,"0"),i=n%60,o=String(Math.ceil(i)).padStart(2,"0");return`${t}:${s}:${o}`}static isTimeString(e){return new RegExp($l.TIME_PATTERN).test(e)}static parseTime(e){if(e==null||typeof e!="string")throw new Error(`${e} is not a valid string`);const t=e.split(":");if(t.length!==3)throw new Error(`${e} is not a time string that can be parsed`);return Number(t[0])*60*60+Number(t[1])*60+Number(t[2])}}const cr=$l;class Sf extends Error{isInvalid=!0}const Li=Sf,td=X.module("ContextMenu");class Ma extends b.PureComponent{static defaultProps={subMenuParentWidth:0,subMenuParentHeight:0,closeMenu(){},onMenuOpened(){},onMenuClosed(){},options:{},menuStyle:{},"data-testid":void 0};static handleContextMenu(e){e.metaKey||(e.stopPropagation(),e.preventDefault())}constructor(e){super(e),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=ee.createRef(),this.oldFocus=document.activeElement,this.activeSubMenuRef=ee.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(()=>{this.container.current?.focus();const{onMenuOpened:e}=this.props;e(this)})}componentDidUpdate(e,t){const{actions:n}=this.props,{activeSubMenu:s}=this.state;s!==t.activeSubMenu&&(s==null?this.container.current?.focus():this.setActiveSubMenuPosition()),e.actions!==n&&(this.initMenu(),(this.container.current==null||!this.container.current.contains(document.activeElement))&&this.container.current?.focus()),this.verifyPosition()}componentWillUnmount(){this.cancelPromises(),window.removeEventListener("resize",this.handleWindowResize),cancelAnimationFrame(this.rAF)}container;oldFocus;activeSubMenuRef;subMenuTimer;rAF;initialPosition;getKeyboardIndex(){const{options:e}=this.props;if(e.separateKeyboardMouse!==void 0&&e.separateKeyboardMouse){const{keyboardIndex:t}=this.state;return t}return this.getMouseIndex()}setKeyboardIndex(e){const{options:t}=this.props;t.separateKeyboardMouse!==void 0&&t.separateKeyboardMouse?this.setState({keyboardIndex:e}):this.setMouseIndex(e)}getMouseIndex(){const{mouseIndex:e}=this.state;return e}setMouseIndex(e){this.setState({mouseIndex:e})}initMenu(){this.cancelPromises(),cancelAnimationFrame(this.rAF);const{options:e}=this.props;let t=e.initialKeyboardIndex;t===void 0&&(t=-1);const{actions:n}=this.props,s=Be.getMenuItems(n),i=[];for(let o=s.length-1;o>=0;o-=1){const a=s[o];a instanceof Promise?this.initMenuPromise(a):i.push(a)}this.setState({mouseIndex:-1,keyboardIndex:t,activeSubMenu:null,menuItems:Be.sortActions(i)})}initMenuPromise(e){const t=we.makeCancelable(e);this.setState(n=>({pendingItems:n.pendingItems.concat(t)})),t.then(n=>{this.setState(s=>{const i=s.pendingItems.indexOf(t);if(i>=0){const o=s.pendingItems.slice();return o.splice(i,1),{menuItems:Be.sortActions(s.menuItems.concat(n)),pendingItems:o}}return null})},n=>{we.isCanceled(n)||(this.setState(s=>{const i=s.pendingItems.indexOf(t);if(i>=0){const o=s.pendingItems.slice();return o.splice(i,1),{pendingItems:o}}return null}),td.error(n))})}cancelPromises(){const{pendingItems:e}=this.state;e.map(t=>t.cancel())}setActiveSubMenuPosition(){if(this.activeSubMenuRef.current===null)return;const e=this.activeSubMenuRef.current.getBoundingClientRect();this.setState({subMenuTop:e.top,subMenuLeft:e.right,subMenuParentHeight:e.height,subMenuParentWidth:e.width})}verifyPosition(){const{options:e,updatePosition:t,subMenuParentWidth:n,subMenuParentHeight:s,top:i,left:o}=this.props;if(!this.container.current||e.doNotVerifyPosition!=null&&e.doNotVerifyPosition)return;let{top:a,left:r}=this.initialPosition;const{width:c,height:h}=this.container.current?.getBoundingClientRect()??{width:0,height:0},u=(this.container.current?.scrollHeight??0)>window.innerHeight;h===0||c===0||(a+h>window.innerHeight&&(a-h-s>0?a-=h-s:a=window.innerHeight-h),r+c>window.innerWidth&&(r=r-c-n),(o!==r||i!==a)&&(this.setState({hasOverflow:u}),t(a,r)))}handleWindowResize(){this.container.current&&this.closeMenu(!0)}handleBlur(e){if(!this.container.current){td.warn("Container is null!");return}if(!this.container.current.contains(e.relatedTarget)){let t=e.relatedTarget,n=!1;for(;t&&!n;)n=t.hasAttribute("data-dh-context-menu"),t=t.parentElement;n||this.closeMenu(!0)}}isEscapeKey(e){const{left:t}=this.props;return e==="Escape"||t<0&&e==="ArrowRight"||e==="ArrowLeft"}handleKeyDown(e){const{menuItems:t}=this.state,n=this.getKeyboardIndex();let s=n,i=!1;if(e.key==="Enter"||e.key===" "){n>=0&&n<t.length&&this.handleMenuItemClick(t[n],e);return}if(e.key==="ArrowRight"?n>=0&&n<=t.length?i=!0:s=0:this.isEscapeKey(e.key)?s=null:e.key==="ArrowUp"||e.shiftKey&&e.key==="Tab"?s=Be.getNextMenuItem(s,-1,t):(e.key==="ArrowDown"||e.key==="Tab")&&(s=Be.getNextMenuItem(s,1,t)),i){this.openSubMenu(n),e.preventDefault(),e.stopPropagation();return}n!==s&&(s!==null?this.setKeyboardIndex(s):(this.closeMenu(),this.oldFocus instanceof HTMLElement&&this.oldFocus.focus()),e.preventDefault(),e.stopPropagation())}openSubMenu(e){const{menuItems:t,activeSubMenu:n}=this.state,s=t[e].actions?e:null;n!==s&&this.setState({activeSubMenu:s,subMenuTop:null,subMenuLeft:null})}closeMenu(e=!1){const{closeMenu:t,onMenuClosed:n}=this.props;cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{t(e),n(this)})}closeSubMenu(){this.setState({activeSubMenu:null})}handleCloseSubMenu(e){e?this.closeMenu(!0):this.closeSubMenu()}handleMenuItemClick(e,t){t.preventDefault(),t.stopPropagation();const{menuItems:n}=this.state;e!=null&&(e.disabled===void 0||!e.disabled)&&(e.actions!=null?this.openSubMenu(n.indexOf(e)):e.action!=null&&(e.action(),this.closeMenu(!0)))}handleMenuItemContextMenu(e,t){t.metaKey||this.handleMenuItemClick(e,t)}handleMenuItemMouseMove(e){const{menuItems:t}=this.state,n=t.indexOf(e);this.setMouseIndex(n),n>=0&&n<t.length&&(e.disabled===void 0||!e.disabled)&&this.openSubMenu(n)}handleMouseLeave(){this.setMouseIndex(-1)}render(){const e=[],{top:t,left:n}=this.props,{activeSubMenu:s,hasOverflow:i,keyboardIndex:o,menuItems:a,mouseIndex:r,pendingItems:c,subMenuTop:h,subMenuLeft:u,subMenuParentWidth:m,subMenuParentHeight:g}=this.state;for(let v=0;v<a.length;v+=1){const w=a[v];v>0&&w.group!==a[v-1].group&&e.push(l.jsx("hr",{},`${v}.separator`));const T=l.jsx(zh,{ref:s===v?this.activeSubMenuRef:null,isKeyboardSelected:o===v,isMouseSelected:r===v,menuItem:w,closeMenu:this.handleCloseSubMenu,onMenuItemClick:this.handleMenuItemClick,onMenuItemMouseMove:this.handleMenuItemMouseMove,onMenuItemContextMenu:this.handleMenuItemContextMenu},v);e.push(T)}let p=null;c.length>0&&(p=l.jsx("div",{className:"loading",children:l.jsx(En,{})}));const{menuStyle:C,"data-testid":f}=this.props,S=s!==null&&h!==null&&u!==null;return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:U({"has-overflow":i},"context-menu-container"),style:{top:t,left:n,...C},ref:this.container,"data-dh-context-menu":!0,onBlur:this.handleBlur,onKeyDown:this.handleKeyDown,onMouseLeave:this.handleMouseLeave,onContextMenu:Ma.handleContextMenu,role:"menuitem",tabIndex:0,"data-testid":f,children:[e,p]}),S&&s!==null&&h!==null&&u!==null&&l.jsx(Ma,{actions:a[s].actions||[],closeMenu:this.handleCloseSubMenu,top:h,left:u,updatePosition:(v,w)=>{this.setState({subMenuTop:v,subMenuLeft:w})},subMenuParentWidth:m,subMenuParentHeight:g},`sub-${s}`)]})}}const bf=Ma;class wf extends b.Component{constructor(e){super(e),this.handleMenuClose=this.handleMenuClose.bind(this),this.handleContextMenu=this.handleContextMenu.bind(this),this.container=ee.createRef(),this.openMenu=ee.createRef(),this.state={actions:null,left:0,top:0}}componentDidMount(){this.container.current?.parentElement&&this.container.current.parentElement.addEventListener("contextmenu",this.handleContextMenu)}componentWillUnmount(){this.container.current?.parentElement&&this.container.current.parentElement.removeEventListener("contextmenu",this.handleContextMenu)}container;openMenu;handleContextMenu(e){if(!Be.isContextActionEvent(e)||!this.container.current||e.metaKey||e.ctrlKey)return;const t=Be.getMenuItems(e.contextActions),n=this.container.current.getBoundingClientRect(),s=e.clientY-n.top,i=e.clientX-n.left;if(t.length===0){if(e.target===this.container.current){e.preventDefault(),this.setState({actions:null},()=>{const o=document.elementFromPoint(i,s),a=new MouseEvent("contextmenu",{clientX:e.clientX,clientY:e.clientY,bubbles:!0,cancelable:!0});o?.dispatchEvent(a)});return}return}e.preventDefault(),this.setState({actions:t,top:s,left:i})}handleMenuClose(e){e===this.openMenu.current&&this.setState({actions:null})}render(){let e=null;const{"data-testid":t}=this.props,{actions:n,top:s,left:i}=this.state;return n&&(e=l.jsx(bf,{ref:this.openMenu,actions:n,onMenuClosed:this.handleMenuClose,top:s,left:i,updatePosition:(o,a)=>{this.setState({top:o,left:a})},"data-testid":t})),l.jsx("div",{className:U("context-menu-root",{active:n}),ref:this.container,children:e})}}const qh=wf;class vs extends b.Component{static propTypes={className:M.string,in:M.bool.isRequired,children:M.node.isRequired,autoFocusOnShow:M.bool,"data-testid":M.string};static defaultProps={className:"",autoFocusOnShow:!1,"data-testid":void 0};static handleEnter(e){const t=e;t.style.height="0"}static handleEntering(e){const t=e;t.style.height=`${vs.getHeight(t)}px`}static handleExiting(e){const t=e;t.style.height="0"}static handleExit(e){const t=e;t.style.height=`${vs.getHeight(t)}px`}static getHeight(e){const t=e.scrollWidth-e.clientWidth;return e.scrollHeight-t}constructor(e){super(e),this.handleEntered=this.handleEntered.bind(this)}handleEntered(e){const t=e;t.style.height="";const{autoFocusOnShow:n}=this.props;if(n!==void 0&&n){const s=t.querySelector("input, select, textarea");s?.focus()}}render(){const{children:e,className:t,in:n,"data-testid":s}=this.props;return l.jsx(Ct,{in:n,classNames:{enterActive:"collapsing",enterDone:"collapse show",exitActive:"collapsing",exitDone:"collapse"},onEnter:vs.handleEnter,onEntering:vs.handleEntering,onEntered:this.handleEntered,onExit:vs.handleExit,onExiting:vs.handleExiting,timeout:350,children:i=>l.jsx("div",{className:U({collapse:i==="exited"},t),"data-testid":s,children:e})})}}const vf=vs;function dr(d){const e=b.useRef();return b.useEffect(function(){e.current=d}),e.current}function Yh(d){const e=b.useRef(null);return b.useEffect(function(){d&&(typeof d=="function"?d(e.current):d.current=e.current)}),e}const Tf=3500,Ef=X.module("useCopyToClipboard");function yf(){const[d,e]=b.useState(!1),t=b.useRef(null),n=b.useCallback(s=>{Wi(s).then(()=>{e(!0)}).catch(i=>Ef.error(`Unable to copy ${s}`,`
2
2
  `,i))},[]);return b.useEffect(()=>(t.current&&clearTimeout(t.current),d&&(t.current=setTimeout(()=>{e(!1)},Tf)),()=>{t.current&&clearTimeout(t.current)}),[d]),[d,n]}const hr=ee.forwardRef((d,e)=>{const{checked:t=!1,children:n,className:s,disabled:i,inputClassName:o,isInvalid:a,labelClassName:r,name:c,onChange:h,"data-testid":u}=d,[m]=b.useState(je()),g=Yh(e);b.useEffect(function(){g.current&&(g.current.indeterminate=t===null)},[g,t]);const p=b.useCallback(C=>{g.current&&(g.current.indeterminate=t===null),h&&h(C)},[g,t,h]);return l.jsxs("div",{className:U("custom-control custom-checkbox",s),children:[l.jsx("input",{type:"checkbox",ref:g,checked:t??!1,className:U("custom-control-input",o,{"is-invalid":a}),disabled:i,id:m,name:c,onChange:p,"data-testid":u}),l.jsx("label",{className:U("custom-control-label",r),htmlFor:m,children:n})]})});hr.displayName="Checkbox";hr.propTypes={checked:(d,e)=>{const{[e]:t}=d;return t!==null&&typeof t!="boolean"?new Error("Checked must be a boolean or null for indeterminate"):null},children:M.node.isRequired,className:M.string,disabled:M.bool,inputClassName:M.string,isInvalid:M.bool,labelClassName:M.string,name:M.string,onChange:M.func,"data-testid":M.string};hr.defaultProps={checked:!1,className:"",disabled:!1,inputClassName:"",isInvalid:!1,labelClassName:"",name:void 0,onChange:void 0,"data-testid":void 0};const Zt=hr;class xf extends b.PureComponent{static defaultProps={placeholder:"Search",className:"",matchCount:null,onKeyDown(){},id:"","data-testid":void 0};constructor(e){super(e),this.inputField=ee.createRef()}inputField;focus(){this.inputField.current?.focus()}render(){const{value:e,placeholder:t,onBlur:n,onChange:s,className:i,disabled:o,matchCount:a,id:r,onKeyDown:c,"data-testid":h}=this.props;return l.jsxs("div",{className:U("search-group",i),children:[l.jsx("input",{type:"search",value:e,onBlur:n,onChange:s,onKeyDown:c,className:"form-control",disabled:o,placeholder:t,ref:this.inputField,id:r,"data-testid":h}),a!=null&&l.jsx("span",{className:"search-match",children:a}),l.jsx("span",{className:"search-icon",children:l.jsx(Z,{icon:Lh})})]})}}const Os=xf;var Xh=(d=>(d.UP="UP",d.DOWN="DOWN",d))(Xh||{});class Ri extends b.Component{static MENU_NAVIGATION_DIRECTION=Xh;static DROP_DOWN_MENU_HEIGHT=200;static propTypes={options:M.arrayOf(M.shape({title:M.string.isRequired,value:M.string.isRequired})).isRequired,popperOptions:M.shape({title:M.string.isRequired,value:M.string.isRequired}),onChange:M.func,inputPlaceholder:M.string,searchPlaceholder:M.string,disabled:M.bool,className:M.string,defaultValue:M.string,spellCheck:M.bool,onEnter:M.func,"data-testid":M.string};static defaultProps={onChange(){},inputPlaceholder:"",searchPlaceholder:"Search",disabled:!1,className:"",defaultValue:"",popperOptions:null,spellCheck:!0,onEnter(){},"data-testid":void 0};constructor(e){super(e),this.state={value:"",filter:"",filteredOptions:e.options,keyboardOptionIndex:-1,menuIsOpen:!1,inputWidth:100},this.toggleMenu=this.toggleMenu.bind(this),this.handleMenuKeyDown=this.handleMenuKeyDown.bind(this),this.handleMenuBlur=this.handleMenuBlur.bind(this),this.closeMenu=this.closeMenu.bind(this),this.handleInputChange=this.handleInputChange.bind(this),this.handleInputKeyDown=this.handleInputKeyDown.bind(this),this.handleInputBlur=this.handleInputBlur.bind(this),this.handleFilterChange=this.handleFilterChange.bind(this),this.handleOptionClick=this.handleOptionClick.bind(this),this.handleOptionFocus=this.handleOptionFocus.bind(this),this.handleMenuOpened=this.handleMenuOpened.bind(this),this.handleMenuExited=this.handleMenuExited.bind(this),this.popper=ee.createRef(),this.cbContainer=ee.createRef(),this.toggleButton=ee.createRef(),this.menuContainer=ee.createRef(),this.input=ee.createRef(),this.searchInput=ee.createRef()}componentDidUpdate(){const{menuIsOpen:e,keyboardOptionIndex:t}=this.state;e&&t>=0&&this.scrollOptionIntoView()}popper;cbContainer;toggleButton;menuContainer;input;searchInput;setInputWidth(){this.cbContainer.current&&this.setState({inputWidth:this.cbContainer.current.getBoundingClientRect().width})}getCachedFilteredOptions=me((e,t)=>e.filter(n=>n.title.toLowerCase().indexOf(t.toLowerCase())>=0||n.value.toLowerCase().indexOf(t.toLowerCase())>=0));focus(){this.input.current?.focus()}resetValue(){this.setState({value:""})}updateInputValue(e){const{onChange:t}=this.props;this.setState({value:e}),t(e)}handleResize(){this.setInputWidth()}handleMenuKeyDown(e){const{filter:t,filteredOptions:n,keyboardOptionIndex:s}=this.state,{options:i}=this.props,o=t?n:i;switch(e.key){case"Enter":o[s]?.value!=null&&this.updateInputValue(o[s].value),this.closeMenu(),this.input.current?.focus(),e.stopPropagation(),e.preventDefault();break;case"ArrowUp":this.handleMenuNavigation(Ri.MENU_NAVIGATION_DIRECTION.UP),e.stopPropagation(),e.preventDefault();break;case"ArrowDown":this.handleMenuNavigation(Ri.MENU_NAVIGATION_DIRECTION.DOWN),e.stopPropagation(),e.preventDefault();break;case"Escape":t!==""?(this.setState({filter:""}),e.stopPropagation()):this.closeMenu();break;case"Tab":!e.shiftKey&&s===o.length-1&&this.closeMenu();break}}handleMenuNavigation(e){const{filter:t,filteredOptions:n,keyboardOptionIndex:s}=this.state,{options:i}=this.props,a=(t?n:i).length;let r=0;switch(e){case Ri.MENU_NAVIGATION_DIRECTION.UP:r=-1;break;case Ri.MENU_NAVIGATION_DIRECTION.DOWN:r=1;break}r!==0&&this.setState({keyboardOptionIndex:(s+r+a)%a})}handleInputKeyDown(e){const{onEnter:t}=this.props,{menuIsOpen:n}=this.state;e.key==="ArrowDown"||e.key==="ArrowUp"?n||this.openMenu():e.key==="Enter"&&t()}handleInputChange(e){this.updateInputValue(e.target.value)}handleOptionClick(e){const t=Number(e.currentTarget.value),{filter:n,filteredOptions:s}=this.state,{options:i}=this.props,o=n?s:i;this.updateInputValue(o[t].value),this.closeMenu(),this.input.current?.focus()}handleOptionFocus(e){this.setState({keyboardOptionIndex:Number(e.target.value)})}handleFilterChange(e){const{options:t}=this.props,n=e.target.value,s=this.getCachedFilteredOptions(t,n);this.setState({filter:n,filteredOptions:s,keyboardOptionIndex:0}),this.popper.current?.scheduleUpdate()}handleMenuBlur(e){e.relatedTarget instanceof Element&&this.popper.current!=null&&this.popper.current.element.contains(e.relatedTarget)||e.relatedTarget===this.toggleButton.current||this.closeMenu(!1)}handleInputBlur(e){const{menuIsOpen:t}=this.state;t&&e.relatedTarget instanceof Element&&this.popper.current!=null&&this.popper.current.element.contains(e.relatedTarget)||this.closeMenu(!1)}handleMenuOpened(){this.scrollOptionIntoView(),this.searchInput.current?.focus()}handleMenuExited(){const{menuIsOpen:e}=this.state;e&&(this.setState({menuIsOpen:!1}),this.popper.current?.hide()),this.setState({filter:""})}toggleMenu(e){const{menuIsOpen:t}=this.state;t?this.closeMenu():this.openMenu(),e.stopPropagation()}openMenu(){this.updateKeyboardIndex(),this.setInputWidth(),this.setState({menuIsOpen:!0}),window.requestAnimationFrame(()=>{this.popper.current?.show()})}closeMenu(e=!0){this.setState({menuIsOpen:!1}),e&&this.input.current?.focus(),this.popper.current?.hide()}updateKeyboardIndex(){const{value:e,filter:t,filteredOptions:n}=this.state,{options:s}=this.props,o=(t?n:s).findIndex(a=>a.value===e);this.setState({keyboardOptionIndex:o})}scrollOptionIntoView(){const e=this.menuContainer.current?.querySelector(".cb-option-btn.keyboard-active");e instanceof HTMLElement&&e.scrollIntoView({block:"nearest",inline:"nearest"})}renderMenuElement(){const{searchPlaceholder:e}=this.props,{filter:t,inputWidth:n}=this.state;return l.jsxs("div",{className:"cb-menu-container",ref:this.menuContainer,role:"presentation",onKeyDown:this.handleMenuKeyDown,onClick:s=>{s.stopPropagation()},style:{width:n},onBlur:this.handleMenuBlur,children:[l.jsx("div",{className:"cb-search-input-container",children:l.jsx(Os,{value:t,ref:this.searchInput,onChange:this.handleFilterChange,className:"cb-search-input",placeholder:e})}),l.jsx("div",{className:"cb-options-container",children:l.jsx("div",{className:"cb-options",children:this.renderOptions()})})]})}renderOptions(){const{options:e}=this.props,{keyboardOptionIndex:t,filter:n,filteredOptions:s}=this.state;return(n?s:e).map((o,a)=>{const r=`option-${a}-${o.value}`;return l.jsx("button",{type:"button",value:a,className:U("cb-option-btn",{"keyboard-active":t===a}),onClick:this.handleOptionClick,onFocus:this.handleOptionFocus,children:o.title},r)})}render(){const{options:e,inputPlaceholder:t,disabled:n,className:s,defaultValue:i,spellCheck:o,"data-testid":a}=this.props,{value:r}=this.state;let{popperOptions:c}=this.props;return c={placement:"bottom-end",modifiers:{preventOverflow:{enabled:!1}},...c},l.jsxs("div",{className:"input-group cb-container",ref:this.cbContainer,children:[l.jsx("input",{value:r||i,className:U("form-control",s,"cb-input"),ref:this.input,onChange:this.handleInputChange,placeholder:t||(e[0]!=null?e[0].title:void 0),disabled:n,onBlur:this.handleInputBlur,onKeyDown:this.handleInputKeyDown,spellCheck:o,"data-testid":a!==void 0?`${a}-input`:void 0}),l.jsx("div",{className:"input-group-append cb-dropdown",children:l.jsxs("button",{type:"button",className:"btn cb-btn form-control",ref:this.toggleButton,onClick:this.toggleMenu,onKeyDown:this.handleInputKeyDown,disabled:n,"data-testid":a!==void 0?`${a}-btn`:void 0,children:[l.jsx(Z,{icon:Pn}),l.jsx(ci,{ref:this.popper,options:c,className:U("combobox interactive"),onEntered:this.handleMenuOpened,onExited:this.handleMenuExited,children:this.renderMenuElement()})]})})]})}}const Zh=Ri;function ur({copy:d,kind:e="ghost",tooltip:t="Copy",className:n,"data-testid":s,children:i}){const[o,a]=yf();return l.jsx(B,{kind:e,className:n,"data-testid":s,icon:o?Dg:Fg,tooltip:o?"Copied":t,onClick:()=>{a(typeof d=="function"?d():d)},children:i})}function Qh(d,e,t){return d.substring(0,e)+t+d.substring(e+1)}function Rf(d,e,t){return d.length<t?`${d}${e.substring(d.length,t)}`:d}function nd(d,e){let{length:t}=d;for(let n=d.length-1;n>=0&&e[n]===d[n];n-=1)t=n;return d.substring(0,t)}const hn=X.module("MaskedInput"),wi={FORWARD:"forward",BACKWARD:"backward",NONE:"none"},ta=" ",Jh=ee.forwardRef((d,e)=>{const{className:t,example:n,getNextSegmentValue:s=(k,j,A)=>A,getPreferredReplacementString:i=Qh,onChange:o=()=>!1,onSelect:a=()=>!1,onSubmit:r,pattern:c,placeholder:h,selection:u,value:m,onFocus:g=()=>!1,onBlur:p=()=>!1,"data-testid":C}=d,f=Yh(e),S=b.useMemo(()=>Array.isArray(n)?n:[n],[n]),v=b.useMemo(()=>S[0].replace(/[a-zA-Z0-9]/g,ta),[S]);b.useEffect(function(){if(u!=null){hn.debug("setting selection...",u);const{selectionStart:j,selectionEnd:A,selectionDirection:O}=u;f.current?.setSelectionRange(j,A,O),hn.debug("selection set!")}},[u,f]);const w=b.useCallback(k=>{let j=k,A=k;const O=S.length>0?S[0]:m;for(let G=j-1;G>=0&&/[a-zA-Z0-9]/g.test(O.charAt(G));G-=1)j=G;for(let G=A;G<O.length&&/[a-zA-Z0-9]/g.test(O.charAt(G));G+=1)A=G+1;const H=j===A?wi.NONE:wi.BACKWARD;return{selectionStart:j,selectionEnd:A,selectionDirection:H}},[S,m]);function T(k,j,A=k.length){let O="";for(let H=0;H<A;H+=1)k.charAt(H)!==ta?O=O.concat(k[H]):O=O.concat(j[H]);return O=O.concat(j.substring(A)),O}function y(k,j=k.length){const A=new RegExp(`^${c}$`);if(A.test(k))return!0;for(let O=0;O<S.length;O+=1){const H=T(k,S[O],j);if(A.test(H))return!0}return!1}function E(k){const j=w(k),A=j.selectionEnd+1;return A>=m.length?j:w(A)}function I(k){const j=w(k),A=j.selectionStart-1;return A<=0?j:w(A)}function D(k,j){const A=w(k),O=m.substring(A.selectionStart,A.selectionEnd),H=s(A,j,O,m),G=m.substring(0,A.selectionStart)+H+m.substring(A.selectionEnd);y(G,A.selectionEnd)&&(o(G),a(A))}const F=b.useCallback(k=>{const{selectionStart:j=0,selectionEnd:A=0,selectionDirection:O="none"}=k.target;if(j===null||A===null||O===null){hn.error("Selection attempted on non-text input element",k.target);return}if(hn.debug2("handleSelect",j,A,O),!(u!=null&&j===u.selectionStart&&A===u.selectionEnd)){if(u!=null&&j===m.length&&A===m.length&&k.nativeEvent.type!=="mouseup"){a({...u});return}if(j===A){const H=w(j);hn.debug("Selection segment from ",j,A,"=>",H),a(H)}else a({selectionStart:j,selectionEnd:A,selectionDirection:O})}},[w,a,u,m]),_=b.useCallback(k=>{if(!f.current)return;hn.debug("handleSelectCapture",k);const j=f.current.selectionStart??0;j===m.length&&u!=null&&j!==u.selectionStart&&(k.preventDefault(),k.stopPropagation())},[f,u,m]);function P(k){if(k.preventDefault(),k.stopPropagation(),!f.current)return;const{key:j}=k,{selectionStart:A=0,selectionEnd:O=0}=f.current;if(A===null||O===null){hn.error("Selection arrow nvaigation attempted on non-text input element",k.target);return}j==="ArrowLeft"?a(I(A)):j==="ArrowRight"?a(E(O)):j==="ArrowUp"?D(A,-1):j==="ArrowDown"&&D(A,1)}function $(k){if(!f.current)return;hn.debug("handleKeyDown",k);const{key:j}=k,{selectionStart:A=0,selectionEnd:O=0}=f.current;if(A===null||O===null){hn.error("Selection key event on non-text input element",k.target);return}if(j==="Enter"){r?.(k);return}if(j.startsWith("Arrow")){P(k);return}if(j==="Delete"||j==="Backspace"){if(k.preventDefault(),k.stopPropagation(),O>=nd(m,v).length){const G=m.substring(0,A===O?A-1:A),z=nd(G,v);z!==m&&(o(z),a({selectionStart:z.length,selectionEnd:z.length,selectionDirection:wi.NONE}));return}if(A!==O){const G=m.substring(0,A)+m.substring(A,O).replace(/[a-zA-Z0-9]/g,ta)+m.substring(O);hn.debug("Range ",A,O,"deleted, setting value",G),o(G),a({selectionStart:A,selectionEnd:A,selectionDirection:wi.NONE})}else if(A>0)for(let G=A-1;G>=0;G-=1){const z=m.substring(0,G)+m.substring(G,A).replace(/[a-zA-Z0-9]/g,ta)+m.substring(A);if(z!==m){o(z),a({selectionStart:G,selectionEnd:G,selectionDirection:wi.NONE});return}}return}if(k.altKey||k.metaKey||k.ctrlKey||j.length>1)return;k.preventDefault(),k.stopPropagation();const H=Array.from(new Set([j,j.toUpperCase(),j.toLowerCase()]));for(let G=0;G<H.length;G+=1){const z=H[G],oe=/[a-zA-Z0-9]/g.test(z)?S[0].length-1:A;for(let W=A;W<=oe;W+=1){const Y=Rf(m,S[0],W+1),te=i(Y,W,z,A,O);if(y(te,W+1)){const re=w(W),ce=W+1;let J={selectionStart:ce,selectionEnd:ce,selectionDirection:wi.NONE};if(ce>=re.selectionEnd){const ae=E(W);ae.selectionStart!==re.selectionStart&&(J=ae)}hn.debug("handleKeyDown",j,"=>",te,J),o(te),a(J);return}}}}return l.jsx("input",{ref:f,className:U("form-control masked-input",t),type:"text",pattern:c,placeholder:h,value:m,onChange:()=>{},onKeyDown:$,onSelect:F,onSelectCapture:_,onFocus:g,onBlur:p,"data-testid":C})});Jh.defaultProps={className:"",placeholder:void 0,onChange(){},onSelect(){},getNextSegmentValue:(d,e,t)=>t,getPreferredReplacementString:Qh,selection:void 0,onFocus(){},onBlur(){},"data-testid":void 0};const If=Jh;let Df=class extends b.PureComponent{static defaultProps={closeMenu(){},onMenuOpened(){},onMenuClosed(){},options:{},menuStyle:{},"data-testid":void 0};constructor(e){super(e),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleMenuItemClick=this.handleMenuItemClick.bind(this),this.handleMenuItemMouseMove=this.handleMenuItemMouseMove.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.handleCloseMenu=this.handleCloseMenu.bind(this),this.container=ee.createRef(),this.oldFocus=document.activeElement,this.rAF=0;const{options:t}=e,n=t.initialKeyboardIndex??-1;this.state={menuItems:[],keyboardIndex:n,mouseIndex:-1}}componentDidMount(){this.initMenu(),this.rAF=window.requestAnimationFrame(()=>{this.container.current?.focus();const{onMenuOpened:e}=this.props;e(this)})}componentDidUpdate(e){const{actions:t}=this.props;e.actions!==t&&this.initMenu()}componentWillUnmount(){cancelAnimationFrame(this.rAF)}container;oldFocus;rAF;getKeyboardIndex(){const{options:e}=this.props;if(e.separateKeyboardMouse!==void 0&&e.separateKeyboardMouse){const{keyboardIndex:t}=this.state;return t}return this.getMouseIndex()}setKeyboardIndex(e){const{options:t}=this.props;t.separateKeyboardMouse!==void 0&&t.separateKeyboardMouse?this.setState({keyboardIndex:e}):this.setMouseIndex(e)}getMouseIndex(){const{mouseIndex:e}=this.state;return e}setMouseIndex(e){this.setState({mouseIndex:e})}initMenu(){cancelAnimationFrame(this.rAF),this.setState({menuItems:[]});const{actions:e}=this.props,t=Be.getMenuItems(e,!1);t.length>0&&this.setState(n=>({menuItems:Be.sortActions(n.menuItems.concat(t))}))}handleKeyDown(e){const{menuItems:t}=this.state,n=this.getKeyboardIndex();let s=n;if(e.key==="Enter"||e.key===" "){n!=null&&n>=0&&n<t.length&&this.handleMenuItemClick(t[n],e);return}e.key==="Escape"?s=null:e.key==="ArrowUp"||e.key==="Tab"&&e.shiftKey===!0?s=Be.getNextMenuItem(s??0,-1,t):(e.key==="ArrowDown"||e.key==="Tab"&&e.shiftKey===!1)&&(s=Be.getNextMenuItem(s??0,1,t)),n!==s&&(s!==null?this.setKeyboardIndex(s):(this.closeMenu(),this.oldFocus instanceof HTMLElement&&this.oldFocus.focus()),e.preventDefault(),e.stopPropagation())}closeMenu(e=!1){const{closeMenu:t,onMenuClosed:n}=this.props;cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{t(e),n(this)})}handleCloseMenu(){this.closeMenu()}handleMenuItemClick(e,t){t.preventDefault(),t.stopPropagation(),e!=null&&(e.disabled===void 0||!e.disabled)&&e.action!=null&&(e.action(),this.closeMenu(!0))}handleMenuItemMouseMove(e){const{menuItems:t}=this.state,n=t.indexOf(e);this.setMouseIndex(n)}handleMouseLeave(){this.setMouseIndex(-1)}render(){const e=[],{"data-testid":t}=this.props,{keyboardIndex:n,menuItems:s,mouseIndex:i}=this.state;for(let a=0;a<s.length;a+=1){const r=s[a];a>0&&r.group!==s[a-1].group&&e.push(l.jsx("hr",{},`${a}.separator`));const c=l.jsx(zh,{isKeyboardSelected:n===a,isMouseSelected:i===a,menuItem:r,closeMenu:this.handleCloseMenu,onMenuItemClick:this.handleMenuItemClick,onMenuItemMouseMove:this.handleMenuItemMouseMove,onMenuItemContextMenu:()=>!1},a);e.push(c)}const{menuStyle:o}=this.props;return l.jsx("div",{className:"context-menu-container",style:{...o},ref:this.container,onKeyDown:this.handleKeyDown,onMouseLeave:this.handleMouseLeave,role:"menuitem",tabIndex:0,"data-testid":t,children:e})}};const Ff=Df;class Nf extends b.PureComponent{static defaultProps={isShown:null,onMenuClosed(){},onMenuOpened(){},options:{},popperOptions:{},popperClassName:"",menuStyle:{},"data-testid":void 0};constructor(e){super(e),this.handleClick=this.handleClick.bind(this),this.handleCloseMenu=this.handleCloseMenu.bind(this),this.handleExited=this.handleExited.bind(this),this.container=ee.createRef(),this.parent=null,this.popper=ee.createRef(),this.isOpen=!1}componentDidMount(){const{isShown:e}=this.props;e===null?this.container.current?.parentElement&&(this.parent=this.container.current.parentElement,this.parent.addEventListener("click",this.handleClick)):e&&this.openMenu()}componentDidUpdate(e){const{isShown:t}=this.props;e.isShown!==t&&(t!==null&&t?window.requestAnimationFrame(()=>{this.openMenu()}):this.closeMenu())}componentWillUnmount(){this.parent&&this.parent.removeEventListener("click",this.handleClick)}container;parent;popper;isOpen;closeMenu(){this.popper.current?.hide()}openMenu(){this.popper.current&&!this.isOpen&&(this.popper.current.show(),this.isOpen=!0)}scheduleUpdate(){this.popper.current?.scheduleUpdate()}handleClick(e){e.preventDefault(),e.stopPropagation(),this.openMenu()}handleCloseMenu(){this.closeMenu()}handleExited(){this.isOpen=!1;const{onMenuClosed:e}=this.props;e()}render(){const{actions:e,onMenuOpened:t,popperClassName:n,"data-testid":s}=this.props,{menuStyle:i}=this.props;let{options:o,popperOptions:a}=this.props;return a={placement:"bottom",...a},o={separateKeyboardMouse:!0,...o},l.jsx("div",{className:"menu-actions-listener",ref:this.container,"data-testid":s,children:l.jsx(ci,{ref:this.popper,options:a,className:U("menu-popper",n),onExited:this.handleExited,closeOnBlur:!0,interactive:!0,children:l.jsx(Ff,{actions:e,closeMenu:this.handleCloseMenu,onMenuOpened:t,options:o,menuStyle:i})})})}}const es=Nf;function vi(d,e,t,n,s){const i=n-t+1;return`${((parseInt(e,10)-d-t)%i+i)%i+t}`.padStart(s,"0")}function Mf(d,e,t){const{selectionStart:n}=d;return n===0?vi(e,t,1900,2099,4):n===5?vi(e,t,1,12,2):n===8?vi(e,t,1,31,2):n===11?vi(e,t,0,23,2):n===17||n===14?vi(e,t,0,59,2):n===20||n===24||n===28?vi(e,t,0,999,3):t}function hl(d){const e=d.substring(0,23),t=d.substring(23,26),n=d.substring(26);return[e,t,n].filter(s=>s!=="").join("​")}const kf=X.module("DateTimeInput"),Af="[12][0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])",Of="([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]\\.[0-9]{3}​[0-9]{3}​[0-9]{3}",Lf=`${Af} ${Of}`,Ta="2022-01-01",eu=`${Ta} 00:00:00.000000000`,Pf="YYYY-MM-DD HH:MM:SS.SSSSSSSSS";function sd(d){return d!=null&&d.length>=Ta.length?`${d.substring(0,Ta.length)}${d.substring(Ta.length).replace(/\u2007/g,"0")}${eu.substring(d.length)}`:d}function id(d){return d.replace(/\u200B/g,"")}const _f=[hl(eu)],Ul=ee.forwardRef((d,e)=>{const{className:t="",onChange:n=()=>{},defaultValue:s="",onFocus:i=()=>{},onBlur:o=()=>{},onSubmit:a,"data-testid":r}=d,[c,h]=b.useState(s.length>0?hl(s):""),[u,m]=b.useState(),g=b.useCallback(C=>{kf.debug("handleChange",C),h(C),n(sd(id(C)))},[n]),p=b.useCallback(()=>{const C=id(c),f=sd(C);f!==C&&h(hl(f)),o()},[c,o]);return l.jsx("div",{className:"d-flex flex-row align-items-center",children:l.jsx(If,{ref:e,className:U(t),example:_f,getNextSegmentValue:Mf,onChange:g,onSelect:m,onSubmit:a,pattern:Lf,placeholder:Pf,selection:u,value:c,onFocus:i,onBlur:p,"data-testid":r})})});Ul.displayName="DateTimeInput";Ul.defaultProps={className:"",onChange:()=>{},defaultValue:"",onFocus:()=>{},onBlur:()=>{},"data-testid":void 0};const jf=Ul;class Hf extends b.PureComponent{static defaultProps={placeholder:"Search",className:"",matchCount:null,debounceMs:250,id:"","data-testid":void 0};constructor(e){super(e),this.searchInput=ee.createRef(),this.handleChange=this.handleChange.bind(this),this.sendUpdate=Xe(this.sendUpdate.bind(this),e.debounceMs),this.state={value:e.value}}componentDidUpdate(e){const{value:t}=this.props;e.value!==t&&this.setState({value:t})}searchInput;focus(){this.searchInput.current?.focus()}handleChange(e){this.setState({value:e.target.value},this.sendUpdate)}sendUpdate(){const{onChange:e}=this.props,{value:t}=this.state;e(t)}render(){const{placeholder:e,className:t,matchCount:n,id:s,"data-testid":i}=this.props,{value:o}=this.state;return l.jsx(Os,{value:o,placeholder:e,onChange:this.handleChange,className:t,matchCount:n,ref:this.searchInput,id:s,"data-testid":i})}}const Vf=Hf;const Bf=X.module("ItemListItem");class Wl extends b.Component{static defaultProps={children:null,isDraggable:!1,isFocused:!1,isSelected:!1,itemIndex:0,"data-testid":void 0,onBlur(){},onClick(){},onContextMenu(){},onDragStart(){},onDrag(){},onDragOver(){},onDragEnd(){},onDrop(){},onDoubleClick(){},onFocus(){},onMouseDown(){},onMouseMove(){},onMouseUp(){},style:{}};static handleKeyDown(){return Bf.log("ItemListItem.handleKeyDown false"),!1}constructor(e){super(e),this.handleBlur=this.handleBlur.bind(this),this.handleFocus=this.handleFocus.bind(this),this.handleClick=this.handleClick.bind(this),this.handleContextMenu=this.handleContextMenu.bind(this),this.handleDragStart=this.handleDragStart.bind(this),this.handleDrag=this.handleDrag.bind(this),this.handleDragOver=this.handleDragOver.bind(this),this.handleDragEnd=this.handleDragEnd.bind(this),this.handleDrop=this.handleDrop.bind(this),this.handleDoubleClick=this.handleDoubleClick.bind(this),this.handleMouseDown=this.handleMouseDown.bind(this),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleMouseUp=this.handleMouseUp.bind(this),this.itemRef=ee.createRef()}itemRef;handleBlur(e){const{itemIndex:t,onBlur:n}=this.props;n(t,e)}handleFocus(e){const{itemIndex:t,onFocus:n}=this.props;n(t,e)}handleClick(e){const{itemIndex:t,onClick:n}=this.props;n(t,e)}handleContextMenu(e){const{itemIndex:t,onContextMenu:n}=this.props;n(t,e)}handleDragStart(e){const{itemIndex:t,onDragStart:n}=this.props;n(t,e)}handleDrag(e){const{itemIndex:t,onDrag:n}=this.props;n(t,e)}handleDragOver(e){e.preventDefault();const{itemIndex:t,onDragOver:n}=this.props;n(t,e)}handleDragEnd(e){const{itemIndex:t,onDragEnd:n}=this.props;n(t,e)}handleDrop(e){const{itemIndex:t,onDrop:n}=this.props;n(t,e)}handleDoubleClick(e){const{itemIndex:t,onDoubleClick:n}=this.props;n(t,e)}handleMouseMove(e){const{itemIndex:t,onMouseMove:n}=this.props;n(t,e)}handleMouseDown(e){const{itemIndex:t,onMouseDown:n}=this.props;n(t,e)}handleMouseUp(e){const{itemIndex:t,onMouseUp:n}=this.props;n(t,e)}render(){const{isDraggable:e,isFocused:t,isSelected:n,style:s,children:i,"data-testid":o}=this.props;return l.jsx("div",{className:U("item-list-item",{active:n},{"is-focused":t},{"is-draggable":e}),onKeyDown:Wl.handleKeyDown,onContextMenuCapture:this.handleContextMenu,onClick:this.handleClick,onDrag:this.handleDrag,onDragStart:this.handleDragStart,onDragOver:this.handleDragOver,onDragEnd:this.handleDragEnd,onDrop:this.handleDrop,onDoubleClick:this.handleDoubleClick,onMouseDown:this.handleMouseDown,onMouseMove:this.handleMouseMove,onMouseUp:this.handleMouseUp,tabIndex:-1,ref:this.itemRef,role:"listitem",style:s,onFocus:this.handleFocus,onBlur:this.handleBlur,draggable:e,"data-testid":o,children:i})}}const $f=Wl;const od=X.module("ItemList"),ad=5;class Ut extends b.PureComponent{static CACHE_SIZE=1e3;static DEFAULT_ROW_HEIGHT=20;static DEFAULT_OVERSCAN=10;static defaultProps={offset:0,items:[],rowHeight:Ut.DEFAULT_ROW_HEIGHT,isDeselectOnClick:!0,isDoubleClickSelect:!1,isDragSelect:!0,isMultiSelect:!1,isStickyBottom:!1,disableSelect:!1,onFocusChange(){},onSelect(){},onSelectionChange(){},onViewportChange(){},overscanCount:Ut.DEFAULT_OVERSCAN,renderItem:Ut.renderItem,selectedRanges:[],focusSelector:".item-list-item","data-testid":void 0};static renderItem({item:e}){return l.jsx("div",{className:"item-list-item-content",children:e!=null&&(e.displayValue??e.value??`${e}`)})}constructor(e){super(e),this.handleItemBlur=this.handleItemBlur.bind(this),this.handleItemContextMenu=this.handleItemContextMenu.bind(this),this.handleItemFocus=this.handleItemFocus.bind(this),this.handleItemDoubleClick=this.handleItemDoubleClick.bind(this),this.handleItemMouseDown=this.handleItemMouseDown.bind(this),this.handleItemMouseMove=this.handleItemMouseMove.bind(this),this.handleItemMouseUp=this.handleItemMouseUp.bind(this),this.handleItemsRendered=this.handleItemsRendered.bind(this),this.handleWindowMouseUp=this.handleWindowMouseUp.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.handleScroll=this.handleScroll.bind(this),this.handleResize=this.handleResize.bind(this),this.renderInnerElement=this.renderInnerElement.bind(this),this.list=ee.createRef(),this.listContainer=ee.createRef();const{isStickyBottom:t,selectedRanges:n}=e;this.state={focusIndex:null,mouseDownIndex:null,selectedRanges:n,overscanStartIndex:0,height:null,isDragging:!1,isStuckToBottom:t,scrollOffset:null,mouseX:null,mouseY:null}}componentDidUpdate(e,t){const{selectedRanges:n,itemCount:s}=this.props,{focusIndex:i,isStuckToBottom:o,scrollOffset:a,height:r,selectedRanges:c}=this.state;if(o&&!this.isListAtBottom()&&s>0&&this.scrollToBottom(),(a!==t.scrollOffset||r!==t.height)&&this.sendViewportUpdate(),n!==e.selectedRanges&&n!==c)this.setSelectedRanges(n);else if(c!==t.selectedRanges){const{onSelectionChange:h}=this.props;h(c)}if(i!==t.focusIndex){const{onFocusChange:h}=this.props;h(i)}}componentWillUnmount(){window.removeEventListener("mouseup",this.handleWindowMouseUp)}list;listContainer;getItemSelected=me((e,t)=>An.isSelected(t,e),{max:Ut.CACHE_SIZE});getCachedItem=me((e,t,n,s,i,o,a,r)=>{const c=o({item:n,itemIndex:e,isFocused:s,isSelected:i,style:a});return l.jsx($f,{onContextMenu:this.handleItemContextMenu,onDoubleClick:this.handleItemDoubleClick,onMouseDown:this.handleItemMouseDown,onFocus:this.handleItemFocus,onBlur:this.handleItemBlur,disableSelect:r,onMouseMove:this.handleItemMouseMove,onMouseUp:this.handleItemMouseUp,isFocused:s,isSelected:i,itemIndex:e,style:a,children:c},t)},{max:Ut.CACHE_SIZE});getOuterElement=me(e=>{const t=ee.forwardRef((n,s)=>l.jsx("div",{ref:s,tabIndex:-1,onKeyDown:e,role:"presentation",...n}));return t.displayName="ItemListOuterElement",t});getInnerElement=me(()=>{const e=ee.forwardRef((t,n)=>l.jsx("div",{className:"item-list-inner-element",ref:n,...t}));return e.displayName="ItemListInnerElement",e});getItemData=me((e,t,n)=>({items:e,selectedRanges:t,renderItem:n}));focus(){this.listContainer.current?.focus()}restoreScrollPosition(){const{scrollOffset:e}=this.state;e!=null&&this.listContainer.current?.scrollTo(0,e)}getElement(e){if(this.listContainer.current==null)return null;const{focusSelector:t}=this.props,{overscanStartIndex:n}=this.state,s=this.listContainer.current.querySelectorAll(t),i=e-n;return s[i]}focusItem(e){const{disableSelect:t}=this.props;if(t)return;this.setState({focusIndex:e});const n=this.getElement(e);n instanceof HTMLElement&&n.focus()}scrollToItem(e){const t=this.getElement(e);t?.scrollIntoView({block:"center"})}handleItemContextMenu(e,t){const{selectedRanges:n}=this.state,i=An.isSelected(n,e)||Be.isModifierKeyDown(t);this.toggleSelect(e,t.shiftKey,i,!1)}handleItemDoubleClick(e,t){const{isDoubleClickSelect:n,onSelect:s}=this.props;n&&this.setState(({selectedRanges:i})=>({selectedRanges:An.selectRange(i,[e,e])}),()=>{s(e,t)})}handleItemMouseDown(e,t){const{selectedRanges:n}=this.state;if(!(t.target instanceof HTMLElement&&["button","select","input","textarea"].indexOf(t.target.tagName.toLowerCase())!==-1)){if(t.button===2&&n.length===0){this.focusItem(e),this.selectItem(e);return}t.button!=null&&t.button!==0||(this.setState({mouseDownIndex:e,mouseX:t.clientX,mouseY:t.clientY}),window.addEventListener("mouseup",this.handleWindowMouseUp))}}handleItemBlur(e,t){od.debug2("item blur",e,t.currentTarget,t.relatedTarget),(!t.relatedTarget||this.listContainer.current&&t.relatedTarget instanceof HTMLElement&&!this.listContainer.current.contains(t.relatedTarget))&&this.setState({focusIndex:null})}handleItemFocus(e,t){od.debug2("item focus",e,t.target),this.setState(n=>{const{focusIndex:s}=n;return s!==e?{focusIndex:e}:null})}handleItemMouseMove(e,t){const{isDragSelect:n,isMultiSelect:s,disableSelect:i}=this.props,{mouseDownIndex:o,selectedRanges:a,mouseX:r,mouseY:c}=this.state;if(o==null||i)return;const h=Math.abs(t.clientX-(r??0)),u=Math.abs(t.clientY-(c??0));h>ad&&u>ad&&this.setState({isDragging:!0}),(n||o===e)&&(this.focusItem(e),s?(!n&&!this.getItemSelected(e,a)&&!Be.isModifierKeyDown(t)&&this.deselectAll(),this.selectRange([Math.min(o,e),Math.max(o,e)])):this.toggleSelect(e,t.shiftKey,Be.isModifierKeyDown(t),!1))}handleItemMouseUp(e,t){const{isDeselectOnClick:n,isDoubleClickSelect:s,onSelect:i}=this.props,{mouseDownIndex:o,isDragging:a}=this.state;if(!(t.target instanceof HTMLElement&&["button","select","input","textarea"].indexOf(t.target.tagName.toLowerCase())!==-1)){if(o===e&&!a){const r=t.shiftKey,c=Be.isModifierKeyDown(t);this.focusItem(e),this.toggleSelect(e,r,c,n),!s&&!r&&!c&&i(e,t)}this.resetMouseState()}}handleItemsRendered({overscanStartIndex:e}){this.setState({overscanStartIndex:e})}handleResize({height:e}){this.setState({height:e})}handleMouseLeave(){this.setState({mouseDownIndex:null})}handleWindowMouseUp(){this.resetMouseState(),window.removeEventListener("mouseup",this.handleWindowMouseUp)}handleKeyDown(e){const{isMultiSelect:t,itemCount:n,onSelect:s}=this.props,{focusIndex:i}=this.state;let o=i;if(e.key==="Enter"||e.key===" "){!t&&o!=null&&this.setState({selectedRanges:[[o,o]]},()=>{o!=null&&s(o,e)});return}if(e.key==="ArrowUp")o!=null&&o>=0?o=Math.max(0,o-1):o=n-1;else if(e.key==="ArrowDown")o!=null&&o>=0?o=Math.min(o+1,n-1):o=0;else return;if(i!==o){e.stopPropagation(),e.preventDefault(),this.focusItem(o);const{selectedRanges:a}=this.state;if(e.shiftKey&&a.length>0){const r=a[a.length-1];this.selectRange([Math.min(o,r[0]),Math.max(o,r[1])])}else this.deselectAll(),o!==null?this.selectItem(o):this.listContainer.current?.focus();this.scrollIntoView(o)}}handleScroll({scrollUpdateWasRequested:e,scrollOffset:t}){this.setState(n=>{if(e)return{scrollOffset:t};const{isStickyBottom:s}=this.props,{height:i}=n;return{isStuckToBottom:s&&this.isListAtBottom({scrollOffset:t,height:i}),scrollOffset:t}})}resetMouseState(){this.setState({mouseDownIndex:null,isDragging:!1})}scrollToBottom(){const{itemCount:e}=this.props;this.list.current&&this.list.current.scrollToItem(e)}scrollIntoView(e){this.list.current&&this.list.current.scrollToItem(e)}toggleSelect(e,t,n,s=!0){const{isMultiSelect:i}=this.props,{selectedRanges:o}=this.state;if(i&&t&&o.length>0){const a=o[o.length-1];this.selectRange([Math.min(a[0],e),Math.max(e,a[1])])}else i&&o.length===1&&o[0][0]===e&&o[0][1]===e?s&&this.deselectItem(e):i&&n?this.getItemSelected(e,o)?s&&this.deselectItem(e):this.selectItem(e):(this.deselectAll(),this.selectItem(e))}deselectAll(){const{itemCount:e}=this.props;this.deselectRange([0,e])}deselectItem(e){this.deselectRange([e,e])}deselectRange(e){An.validateRange(e),this.setState(({selectedRanges:t})=>({selectedRanges:An.deselectRange(t,e)}))}selectItem(e){const{disableSelect:t}=this.props;t||this.selectRange([e,e])}selectRange(e){An.validateRange(e),this.setState(({selectedRanges:t})=>({selectedRanges:An.selectRange(t,e)}))}setSelectedRanges(e){this.setState({selectedRanges:e})}sendViewportUpdate(){const{scrollOffset:e,height:t}=this.state;if(e!=null&&t!=null){const{onViewportChange:n,rowHeight:s}=this.props,i=Math.floor(e/s),o=i+Math.ceil(t/s);n(i,o)}}isListAtBottom({scrollOffset:e,height:t}=this.state){if(t==null||e==null)return!1;const{itemCount:n,rowHeight:s}=this.props;return e+t>=n*s}renderInnerElement({index:e,style:t}){const{items:n,offset:s,renderItem:i,disableSelect:o}=this.props,{focusIndex:a,selectedRanges:r}=this.state;if(e<s||e>=s+n.length)return null;const c=n[e-s];return this.getCachedItem(e,e,c,e===a&&!o,this.getItemSelected(e,r),i,t,o)}render(){const{items:e,itemCount:t,overscanCount:n,renderItem:s,rowHeight:i,"data-testid":o}=this.props,{selectedRanges:a,isStuckToBottom:r}=this.state;return l.jsx(qm,{className:"item-list-auto-sizer",onResize:this.handleResize,children:({width:c,height:h})=>l.jsx(Ym,{className:"item-list-scroll-pane",height:h,width:c,initialScrollOffset:r?t*i:0,itemCount:t,itemSize:i,itemData:this.getItemData(e,a,s),onScroll:this.handleScroll,onItemsRendered:this.handleItemsRendered,ref:this.list,outerElementType:this.getOuterElement(this.handleKeyDown),outerRef:this.listContainer,innerElementType:this.getInnerElement(),overscanCount:n,"data-testid":o,children:this.renderInnerElement})})}}class Ts extends b.PureComponent{static DEFAULT_ROW_HEIGHT=30;static defaultProps={className:"",draggingItemClassName:"",offset:0,items:[],rowHeight:Ts.DEFAULT_ROW_HEIGHT,isDeselectOnClick:!0,isDoubleClickSelect:!0,isDropDisabled:!1,isDragDisabled:!1,isMultiSelect:!1,isStickyBottom:!1,disableSelect:!1,style:null,onFocusChange(){},onSelect(){},onSelectionChange(){},onViewportChange(){},renderItem:Ts.renderItem,selectedRanges:[],draggablePrefix:"draggable-item",droppableId:"droppable-item-list","data-testid":void 0};static renderHandle(){return l.jsxs("div",{children:[l.jsx(tt,{children:"Drag to re-order"}),l.jsx(Z,{icon:Fo})]})}static renderBadge({text:e}){return e!=null&&e.length>0?l.jsx("span",{className:"number-badge",children:e}):null}static renderTextItem({text:e,badgeText:t="",className:n=""}){return l.jsxs("div",{className:U("item-list-item-content","draggable-item-list-item-content",n),children:[l.jsx("span",{className:"title",children:e}),Ts.renderBadge({text:t}),Ts.renderHandle()]})}static renderItem({item:e,isClone:t,selectedCount:n}){const s=e!=null?e.displayValue??e.value??`${e}`:"",i=t!==void 0&&t?`${n}`:"",o=t!==void 0&&t?"item-list-item-clone":"";return Ts.renderTextItem({text:s,badgeText:i,className:o})}static getDraggableId(e,t){return`${e}/${t}`}static getDraggableIndex(e){const t=e.split("/").pop();return parseInt(t!==void 0?t:"",10)}constructor(e){super(e),this.handleSelectionChange=this.handleSelectionChange.bind(this),this.itemList=ee.createRef(),this.state={selectedCount:0}}itemList;selectItem(e){this.itemList.current?.selectItem(e)}focusItem(e){this.itemList.current?.focusItem(e)}scrollToItem(e){this.itemList.current?.scrollToItem(e)}getCachedDraggableItem=me((e,t,n,s,i,o,a,r)=>l.jsx(xl,{draggableId:Ts.getDraggableId(e,s),index:s,isDragDisabled:a,children:c=>l.jsx("div",{role:"menuitem",className:"draggable-item-list-item",ref:c.innerRef,tabIndex:-1,...c.draggableProps,...c.dragHandleProps,children:t({item:n,itemIndex:s,isFocused:i,isSelected:o,style:r,isClone:!1})})},s),{max:Ut.CACHE_SIZE});handleSelectionChange(e){this.setState({selectedCount:An.count(e)});const{onSelectionChange:t}=this.props;t(e)}getCachedRenderDraggableItem=me((e,t,n)=>({item:s,itemIndex:i,isFocused:o,isSelected:a,style:r})=>this.getCachedDraggableItem(e,n,s,i,o,a,t,r),{max:1});getCachedRenderClone=me((e,t,n,s)=>(i,o,a)=>{const{selectedCount:r}=this.state,{draggableProps:c,dragHandleProps:h,innerRef:u}=i,{index:m}=a.source,g=t[m-n];return l.jsx("div",{className:U("draggable-item-list-dragging-item-container",e),...c,...h,ref:u,children:l.jsx("div",{className:U("draggable-item-list-dragging-item",{"two-dragged":r===2},{"multiple-dragged":r>2}),children:s({item:g,itemIndex:m,isFocused:!1,isSelected:!0,style:{},isClone:!0,selectedCount:r})})})},{max:1});render(){const{className:e,draggablePrefix:t,draggingItemClassName:n,droppableId:s,isDoubleClickSelect:i,isDragDisabled:o,isDropDisabled:a,isMultiSelect:r,isStickyBottom:c,itemCount:h,items:u,offset:m,onFocusChange:g,onSelect:p,onViewportChange:C,renderItem:f,rowHeight:S,selectedRanges:v,style:w,"data-testid":T}=this.props;return l.jsx(sr,{isDropDisabled:a,droppableId:s,mode:"virtual",renderClone:this.getCachedRenderClone(n,u,m,f),"data-testid":T,children:(y,E)=>l.jsx("div",{role:"menu",className:U("draggable-item-list",e,{"is-drop-disabled":a,"is-drag-disabled":o,"is-dragging-from-this":E.draggingFromThisWith,"is-dragging-over":E.isDraggingOver,"is-dropping":E.draggingOverWith}),style:w,ref:y.innerRef,...y.droppableProps,children:l.jsx(Ut,{focusSelector:".draggable-item-list-item",isDoubleClickSelect:i,isDragSelect:!1,isMultiSelect:r,isStickyBottom:c,itemCount:h,items:u,onFocusChange:g,onSelect:p,onSelectionChange:this.handleSelectionChange,onViewportChange:C,offset:m,ref:this.itemList,renderItem:this.getCachedRenderDraggableItem(t,o,f),rowHeight:S,selectedRanges:v})})})}}const pn=Ts;class ka{static reorder(e,t,n,s){const i=e===n?ka.adjustDestinationIndex(s,t):s,o=ka.removeItems(e,t);return n.splice(i,0,...o),o}static removeItems(e,t){const n=[],s=t.map((i,o)=>({range:i,index:o})).sort((i,o)=>o.range[0]-i.range[0]);for(let i=0;i<s.length;i+=1){const{range:o,index:a}=s[i],[r,c]=o;n[a]=e.splice(r,c-r+1)}return Xm(n)}static adjustDestinationIndex(e,t){let n=e;for(let s=0;s<t.length;s+=1){const[i,o]=t[s];if(i>e)break;n-=Math.min(o,e-1)-i+1}return n}static startDragging(){document.documentElement.classList.add("drag-pointer-events-none")}static stopDragging(){document.documentElement.classList.remove("drag-pointer-events-none")}}const bn=ka;function tu({on:d,id:e,className:t,isInvalid:n,disabled:s=!1,onClick:i,"data-testid":o}){return l.jsx("button",{type:"button",className:U("btn","btn-switch",t,{active:d},{"is-invalid":n}),id:e,onClick:i,disabled:s,"data-testid":o,children:l.jsx("div",{className:"handle"})})}function rd(d){return d.isOn!==void 0}function Uf({item:d,onSelect:e=()=>{},"data-testid":t}){const{icon:n,subtitle:s,title:i}=d,o=b.useMemo(()=>rd(d)?()=>{d.onChange(!d.isOn)}:e,[d,e]);return l.jsxs("div",{className:"btn btn-navigation-menu-item","data-testid":`menu-item-${i}`,onClick:o,onKeyDown:a=>{(a.key==="Enter"||a.key===" ")&&o()},tabIndex:0,role:"menuitem",children:[n!==void 0&&l.jsx("div",{className:"icon",children:l.jsx(Z,{icon:n})}),l.jsx("div",{className:"title",children:i}),s!==void 0&&l.jsx("div",{className:"shortcut",children:s}),l.jsx("div",{className:"accessory","data-testid":t,children:rd(d)?l.jsx(tu,{on:d.isOn,onClick:a=>{a.stopPropagation(),o()}}):l.jsx(Z,{icon:Oh})})]})}function nu({items:d,onSelect:e=()=>{},"data-testid":t}){return l.jsx("div",{className:"navigation-menu-view","data-testid":t,children:l.jsx("ul",{className:"navigation-menu-list",children:d.map((n,s)=>l.jsx("li",{children:l.jsx(Uf,{item:n,onSelect:()=>{e(s)}})},n.title))})})}function ld({children:d,onBack:e,onClose:t,title:n,"data-testid":s}){return l.jsxs("div",{className:"navigation-page","data-testid":s,children:[l.jsxs("div",{className:"navigation-title-bar",children:[l.jsx("div",{className:"navigation-left-buttons",children:e!==void 0&&l.jsx(B,{kind:"ghost",className:"btn-back","data-testid":"btn-page-back",onClick:e,icon:Ng,children:"Back"})}),l.jsx("div",{className:"navigation-title",children:n}),l.jsx("div",{className:"navigation-right-buttons",children:t!==void 0&&l.jsx(B,{kind:"ghost",className:"btn-close px-2 m-1","data-testid":"btn-page-close",onClick:t,icon:Ui,tooltip:"Close"})})]}),l.jsx("div",{className:"navigation-content",children:d})]})}function Wf({children:d,"data-testid":e}){const t=b.useMemo(()=>ee.Children.toArray(d),[d]),n=dr(t),[s,i]=b.useState(t[t.length-1]),[o,a]=b.useState(null),[r,c]=b.useState(null);b.useEffect(function(){if(n===void 0||t===n)return;const g=t[t.length-1];t.length===n.length||n.length===0||o!==null||r!==null?o!==null&&g!==o?a(g):g!==r&&g!==s&&i(g):t.length>n.length?a(g):t.length<n.length&&(i(g),c(n[n.length-1]))},[t,n,o,r,s]);const h=b.useCallback(()=>{i(o),a(null)},[o]),u=b.useCallback(()=>{c(null)},[]);return l.jsxs("div",{className:"navigation-stack",children:[l.jsx("div",{className:"main-view","data-testid":e,children:s}),l.jsx(Ct,{in:r!=null,timeout:qe.transitionMidMs,classNames:"slide-right",onEntered:u,children:l.jsx(l.Fragment,{children:r!=null&&l.jsx("div",{className:"popping-view",children:r})})}),l.jsx(Ct,{in:o!=null,timeout:qe.transitionMidMs,classNames:"slide-left",onEntered:h,children:l.jsx(l.Fragment,{children:o!=null&&l.jsx("div",{className:"pushing-view",children:o})})})]})}function Gf({children:d,disabled:e,value:t,"data-testid":n}){return l.jsx("option",{value:t,disabled:e,"data-testid":n,children:d})}function mr(d){const{children:e,disabled:t=!1,name:n,onChange:s,value:i="","data-testid":o}=d,[a]=b.useState(n??je());return l.jsx(l.Fragment,{children:ee.Children.map(e,r=>r?ee.cloneElement(r,{name:a,onChange:r.props.onChange??s,checked:i===r.props.value,disabled:r.props.disabled??t,"data-testid":o}):null)})}const Gl=ee.forwardRef((d,e)=>{const{checked:t,children:n,className:s="",disabled:i=!1,inputClassName:o="",isInvalid:a=!1,labelClassName:r="",name:c,onChange:h,value:u,"data-testid":m}=d,[g]=b.useState(je());return l.jsxs("div",{className:U("custom-control custom-radio",s),children:[l.jsx("input",{type:"radio",id:g,"data-testid":m,name:c,ref:e,className:U("custom-control-input",o,{"is-invalid":a}),checked:t,disabled:i,value:u,onChange:h}),l.jsx("label",{className:U("custom-control-label",r),htmlFor:g,children:n})]})});Gl.displayName="RadioItem";Gl.defaultProps={checked:void 0,className:"",disabled:!1,inputClassName:"",isInvalid:!1,labelClassName:"",name:void 0,onChange:void 0,"data-testid":void 0};const ts=Gl;function zf({children:d,onBlur:e,onChange:t,className:n,defaultValue:s,name:i,value:o,disabled:a,"data-testid":r}){const c=b.useCallback(h=>{t(h.target.value)},[t]);return l.jsx("select",{className:U("custom-select",n),onBlur:e,onChange:c,defaultValue:s,value:o,name:i,disabled:a,"data-testid":r,children:d})}class Kf extends b.PureComponent{static defaultProps={disabled:!1,rowHeight:21,onBlur:()=>{},"data-testid":void 0};constructor(e){super(e),this.handleBlur=this.handleBlur.bind(this),this.handleScroll=this.handleScroll.bind(this),this.handleSelect=this.handleSelect.bind(this),this.list=ee.createRef(),this.topRow=null,this.bottomRow=null}componentDidMount(){this.sendViewportUpdate()}componentDidUpdate(){this.sendViewportUpdate()}list;topRow;bottomRow;getCachedItem=me((e,t,n,s,i,o,a)=>{const r={height:i},c=s??n;return l.jsx("li",{className:"value-list-item",style:r,tabIndex:-1,children:l.jsx(Zt,{checked:o,disabled:a,onChange:()=>this.handleSelect(e),children:c})},t)},{max:1e3});getCachedItems=me((e,t,n,s)=>{const i=[];for(let o=0;o<e.length;o+=1){const a=e[o],{value:r,displayValue:c,isSelected:h}=a,u=n+o,m=u,g=this.getCachedItem(u,m,r,c,t,h,s);i.push(g)}return i},{max:1});handleBlur(e){if(!e.relatedTarget||this.list.current&&e.relatedTarget instanceof HTMLElement&&!this.list.current.contains(e.relatedTarget)){const{onBlur:t}=this.props;t?.(e)}}handleScroll(){this.sendViewportUpdate()}handleSelect(e){const{items:t,offset:n,onSelect:s}=this.props,i=e-n;if(i>=0&&i<t.length){const o=t[i],{value:a}=o;s(e,a)}else s(e,null)}sendViewportUpdate(){if(!this.list.current||this.list.current.clientHeight===0)return;const{onViewportChange:e,rowHeight:t}=this.props,n=this.list.current.scrollTop,s=n+this.list.current.clientHeight,i=Math.floor(n/t),o=Math.ceil(s/t);(this.topRow!==i||this.bottomRow!==o)&&(this.topRow=i,this.bottomRow=o,e(i,o))}getElement(e){return this.list.current==null?null:this.list.current.querySelectorAll(".value-list-item")[e]}scrollIntoView(e){this.getElement(e)?.scrollIntoView({block:"center"})}render(){const{className:e,disabled:t,isInvalid:n,items:s,itemCount:i,offset:o,rowHeight:a,"data-testid":r}=this.props,c=this.getCachedItems(s,a,o,t);return l.jsx("div",{className:U("select-value-list-scroll-pane h-100 w-100",{"is-invalid":n},e),onBlur:this.handleBlur,onScroll:this.handleScroll,ref:this.list,"data-testid":r,children:l.jsx("div",{className:"select-value-list",style:{height:i*a},children:l.jsx("ol",{className:"select-value-list-content",style:{position:"absolute",height:s.length*a,top:o*a,left:0},children:c})})})}}const qf=Kf,cd=X.module("Shortcut");var de=(d=>(d.CTRL="MODIFIER_CTRL",d.CMD="MODIFIER_CMD",d.ALT="MODIFIER_ALT",d.OPTION="MODIFIER_OPTION",d.SHIFT="MODIFIER_SHIFT",d))(de||{}),he=(d=>(d.A="A",d.B="B",d.C="C",d.D="D",d.E="E",d.F="F",d.G="G",d.H="H",d.I="I",d.J="J",d.K="K",d.L="L",d.M="M",d.N="N",d.O="O",d.P="P",d.Q="Q",d.R="R",d.S="S",d.T="T",d.U="U",d.V="V",d.W="W",d.X="X",d.Y="Y",d.Z="Z",d.ZERO="0",d.ONE="1",d.TWO="2",d.THREE="3",d.FOUR="4",d.FIVE="5",d.SIX="6",d.SEVEN="7",d.EIGHT="8",d.NINE="9",d.BACKSPACE="Backspace",d.ESCAPE="Escape",d.ENTER="Enter",d.DELETE="Delete",d.SLASH="/",d.QUESTION_MARK="?",d.BACKSLASH="\\",d.PIPE="|",d.MINUS="-",d.UNDERSCORE="_",d.EQUALS="=",d.PLUS="+",d.BACKTICK="`",d.TILDE="~",d.COMMA=",",d.LEFT_CHEVRON="<",d.PERIOD=".",d.RIGHT_CHEVRON=">",d.SEMICOLON=";",d.COLON=":",d.SINGLE_QUOTE="'",d.DOUBLE_QUOTE='"',d.LEFT_BRACKET="[",d.RIGHT_BRACKET="]",d.LEFT_CURLY="{",d.RIGHT_CURLY="}",d.F1="F1",d.F2="F2",d.F3="F3",d.F4="F4",d.F5="F5",d.F6="F6",d.F7="F7",d.F8="F8",d.F9="F9",d.F10="F10",d.F11="F11",d.F12="F12",d))(he||{});const Yf=new Set(["Enter","Delete","F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12"]);class Le extends Rl{id;name;tooltip;isEditable;defaultKeyState;keyState;static NULL_KEY_STATE={metaKey:!1,shiftKey:!1,altKey:!1,ctrlKey:!1,keyValue:null};static isAllowedKey(e){return Object.values(he).includes(e)}static isValidKeyState(e){const{keyValue:t}=e;return t===null?!0:!Le.isMacPlatform&&e.metaKey||!Le.isAllowedKey(t)?!1:!(!e.altKey&&!e.ctrlKey&&!e.metaKey&&!e.shiftKey)||Yf.has(t)}static isMacPlatform=Be.isMacPlatform();static createKeyState(e){const t={altKey:!1,ctrlKey:!1,metaKey:!1,shiftKey:!1,keyValue:e[e.length-1]};return e.forEach(n=>{switch(n){case"MODIFIER_CTRL":t.ctrlKey=!0;break;case"MODIFIER_ALT":case"MODIFIER_OPTION":t.altKey=!0;break;case"MODIFIER_CMD":t.metaKey=!0;break;case"MODIFIER_SHIFT":t.shiftKey=!0;break}}),t}static getKeyStateFromEvent(e){const{key:t,keyCode:n}=e;let s="";return t==="Shift"||t==="Meta"||t==="Control"||t==="Alt"?s="":!Le.isAllowedKey(t)&&Le.isAllowedKey(String.fromCharCode(n))?s=String.fromCharCode(n):s=t,{keyValue:s,altKey:e.altKey,ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey}}static getWindowsDisplayText(e){let t="";return e.ctrlKey&&(t+="Ctrl+"),e.altKey&&(t+="Alt+"),e.shiftKey&&(t+="Shift+"),e.keyValue==="Escape"?t+="Esc":e.keyValue!==null&&(t+=e.keyValue),t}static getMacDisplayText(e){let t="";switch(e.ctrlKey&&(t+="⌃"),e.altKey&&(t+="⌥"),e.shiftKey&&(t+="⇧"),e.metaKey&&(t+="⌘"),e.keyValue){case"Enter":t+="⏎";break;case"Escape":t+="⎋";break;case"Backspace":t+="⌫";break;case"Delete":t+="⌦";break;case null:break;default:t+=e.keyValue}return t}static doKeyStatesMatch(e,t){return e.keyValue?.toUpperCase()===t.keyValue?.toUpperCase()&&e.altKey===t.altKey&&e.ctrlKey===t.ctrlKey&&e.metaKey===t.metaKey&&e.shiftKey===t.shiftKey}static getDisplayText(e){return e.keyValue===null?"":Le.isMacPlatform?Le.getMacDisplayText(e):Le.getWindowsDisplayText(e)}constructor({id:e,shortcut:t,macShortcut:n,isEditable:s=!0,name:i,tooltip:o}){super(),this.id=e,this.name=i,this.tooltip=o,this.isEditable=s;const r=Le.isMacPlatform?n:t;this.defaultKeyState=Le.createKeyState(r),this.keyState=this.defaultKeyState}getDisplayText(){return Le.getDisplayText(this.keyState)}getKeyState(){return this.keyState}setKeyState(e){Le.isValidKeyState(e)?(cd.debug2(`Shortcut ${this.id} updated to ${JSON.stringify(e)}`),this.keyState=e,this.dispatchEvent(new Ue("onUpdate",{detail:this}))):cd.debug2(`Shortcut ${this.id} tried to update to invalid keyState ${JSON.stringify(e)}`)}getDefaultKeyState(){return this.defaultKeyState}isDefault(){return Le.doKeyStatesMatch(this.getDefaultKeyState(),this.getKeyState())}setToNull(){this.setKeyState(Le.NULL_KEY_STATE)}isNull(){return Le.doKeyStatesMatch(this.keyState,Le.NULL_KEY_STATE)}setToDefault(){this.setKeyState(this.defaultKeyState)}matchesKeyState(e){return Le.doKeyStatesMatch(e,this.keyState)}matchesEvent(e){return this.matchesKeyState(Le.getKeyStateFromEvent(e))}}const dd=X.module("ShortcutRegistry");class Xf extends Rl{shortcutMap=new Map;shortcutsByCategory=new Map;createAndAdd(e){const t=new Le(e);return this.add(t)}add(e){const t=this.shortcutMap.get(e.id);if(t)return dd.warn(`Skipping attempt to add duplicate shortcut ID to registry: ${e.id}`),t;dd.debug2(`Adding shortcut to registry: ${e.id}`),e.addEventListener("onUpdate",({detail:s})=>this.dispatchEvent(new Ue("onUpdate",{detail:s})));const n=e.id.split(".")[0];return this.shortcutMap.set(e.id,e),this.shortcutsByCategory.has(n)?this.shortcutsByCategory.get(n)?.push(e):this.shortcutsByCategory.set(n,[e]),e}get(e){return this.shortcutMap.get(e)}getConflictingShortcuts(e){return Array.from(this.shortcutMap.values()).filter(t=>!t.isNull()&&t.matchesKeyState(e))}}const Zf=Object.freeze(new Xf),Me=Zf,Qf={COPY:Me.createAndAdd({id:"GLOBAL.COPY",name:"Copy",shortcut:[de.CTRL,he.C],macShortcut:[de.CMD,he.C],isEditable:!1}),PASTE:Me.createAndAdd({id:"GLOBAL.PASTE",name:"Paste",shortcut:[de.CTRL,he.V],macShortcut:[de.CMD,he.V],isEditable:!1}),SAVE:Me.createAndAdd({id:"GLOBAL.SAVE",name:"Save",shortcut:[de.CTRL,he.S],macShortcut:[de.CMD,he.S],isEditable:!1}),SELECT_ALL:Me.createAndAdd({id:"GLOBAL.SELECT_ALL",name:"Select All",shortcut:[de.CTRL,he.A],macShortcut:[de.CMD,he.A],isEditable:!1}),LINKER:Me.createAndAdd({id:"GLOBAL.LINKER",name:"Linker",shortcut:[de.CTRL,he.L],macShortcut:[de.CMD,he.L]}),LINKER_CLOSE:Me.createAndAdd({id:"GLOBAL.LINKER_CLOSE",name:"Close Linker Overlay",shortcut:[he.ESCAPE],macShortcut:[he.ESCAPE],isEditable:!1})},ss=Qf;const zl=ee.forwardRef((d,e)=>{const{children:t,className:n,disabled:s,id:i,isLinked:o,isLinkedSource:a,isInvalid:r,onClick:c,onMouseEnter:h,onMouseLeave:u,style:m,"data-testid":g}=d;return l.jsxs("button",{ref:e,type:"button",className:U("btn-socketed",{"btn-socketed-linked":o!==void 0&&o||a},{"btn-socketed-linked-source":a},{"is-invalid":r},n),id:i,onClick:c,onMouseEnter:h,onMouseLeave:u,style:m,disabled:s,"data-testid":g,children:[t,l.jsx(Z,{icon:Fl,className:"linked btn-socketed-icon",transform:"down-1"}),l.jsx(Z,{icon:Mg,className:"is-invalid btn-socketed-icon"})]})});zl.displayName="SocketedButton";zl.defaultProps={children:void 0,className:"",disabled:!1,id:void 0,isLinked:!1,isLinkedSource:!1,isInvalid:!1,onClick:void 0,onMouseEnter:void 0,onMouseLeave:void 0,style:void 0,"data-testid":void 0};const su=zl,{dh:Jf}=globalThis,x=Jf;function iu({type:d}){switch(d){case x.VariableType.TABLE:case x.VariableType.TABLEMAP:case x.VariableType.TREETABLE:case x.VariableType.HIERARCHICALTABLE:return l.jsx(Z,{icon:Nl});case x.VariableType.FIGURE:return l.jsx(Z,{icon:Ph});case x.VariableType.PANDAS:return l.jsx(Z,{icon:kg});default:return l.jsx(Z,{icon:ll})}}class eC extends b.Component{constructor(e){super(e),this.container=null}componentDidMount(){this.colorize()}container;colorize(){const{children:e}=this.props;this.container&&e!=null&&Qn.colorizeElement(this.container,{theme:"dh-dark"})}render(){const{children:e,language:t}=this.props;return l.jsx("div",{children:l.jsx("div",{"data-lang":t,ref:n=>{this.container=n},style:{pointerEvents:"none"},children:e})})}}const gr=eC;class tC{static get LANGUAGE_MAP(){return new Map([["python","Python"],["groovy","Groovy"],["scala","Scala"]])}}const ou=tC;class Aa{static hasComment(e){return e.comment!==void 0}static hasPattern(e){return e.pattern!==void 0}static hasOp(e){return e.op!==void 0}static parseArguments(e){return e==null||!(typeof e=="string"||e instanceof String)?[]:Zm.parse(e).filter(t=>!this.hasComment(t)).map(t=>this.hasPattern(t)?t.pattern:this.hasOp(t)?t.op:`${t}`)}static formatTimestamp(e){if(e==null||!(e instanceof Date))return null;const t=`${e.getHours()}`.padStart(2,"0"),n=`${e.getMinutes()}`.padStart(2,"0"),s=`${e.getSeconds()}`.padStart(2,"0"),i=`${e.getMilliseconds()}`.padStart(3,"0");return`${t}:${n}:${s}.${i}`}static isTableType(e){return e===x.VariableType.TABLE||e===x.VariableType.TREETABLE||e===x.VariableType.HIERARCHICALTABLE}static isWidgetType(e){return e===x.VariableType.FIGURE||e===x.VariableType.OTHERWIDGET||e===x.VariableType.PANDAS}static isOpenableType(e){return Aa.isTableType(e)||Aa.isWidgetType(e)}static isFigureType(e){return e===x.VariableType.FIGURE}static isPandas(e){return e===x.VariableType.PANDAS}}const ul=Aa;function au({children:d}){return l.jsxs("div",{className:"console-history-item-result",children:[l.jsx("div",{className:"console-history-gutter",children:"-"}),l.jsx("div",{className:"console-history-content",children:d})]})}au.propTypes={children:M.node.isRequired};class nC extends b.Component{static defaultProps={disabled:!1};constructor(e){super(e),this.updateElapsed=this.updateElapsed.bind(this),this.startTime=Date.now(),this.state={elapsed:0}}componentDidMount(){this.timer=setInterval(this.updateElapsed,1e3)}componentWillUnmount(){this.timer&&clearInterval(this.timer),this.timer=void 0}timer;startTime;updateElapsed(){this.setState({elapsed:Math.round((Date.now()-this.startTime)/1e3)})}render(){const{disabled:e,onCancelClick:t}=this.props,{elapsed:n}=this.state;return l.jsx("div",{className:U("console-history-result-in-progress",{disabled:e}),children:l.jsxs("span",{className:"badge",children:[l.jsx(En,{})," Running... ",cr.formatElapsedTime(n)," ",l.jsx(B,{className:"console-history-result-in-progress-cancel",kind:"ghost",icon:Ui,tooltip:"Cancel",onClick:t,disabled:e})]})})}}const sC=nC;class Oa extends b.PureComponent{static defaultProps={message:""};static mouseDragThreshold=5;constructor(e){super(e),this.handleKeyPress=this.handleKeyPress.bind(this),this.handleMouseDown=this.handleMouseDown.bind(this),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleMouseUp=this.handleMouseUp.bind(this),this.handleToggleError=this.handleToggleError.bind(this),this.handleMouseEnter=this.handleMouseEnter.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.mouseX=null,this.mouseY=null,this.isClicking=!1,this.state={isExpanded:!1,isTriggerHovered:!1}}mouseX;mouseY;isClicking;handleKeyPress(e){switch(e.key){case"Enter":case" ":this.handleToggleError(),e.stopPropagation(),e.preventDefault();break}}handleMouseDown(e){this.mouseX=e.clientX,this.mouseY=e.clientY,this.isClicking=!0}handleMouseMove(e){this.mouseX!=null&&this.mouseY!=null?(Math.abs(e.clientX-this.mouseX)>=Oa.mouseDragThreshold||Math.abs(e.clientY-this.mouseY)>=Oa.mouseDragThreshold)&&(this.isClicking=!1):this.isClicking&&(this.isClicking=!1)}handleMouseUp(e){this.isClicking&&!e.shiftKey&&!e.metaKey&&!e.altKey&&this.handleToggleError(),this.mouseX=null,this.mouseY=null,this.isClicking=!1}handleToggleError(){this.setState(e=>({isExpanded:!e.isExpanded}))}handleMouseEnter(){this.setState({isTriggerHovered:!0})}handleMouseLeave(){this.setState({isTriggerHovered:!1})}render(){const{isExpanded:e,isTriggerHovered:t}=this.state,{message:n}=this.props;N(n);const s=n.indexOf(`
3
3
  `),i=s>-1;let o=n;i&&(o=n.slice(0,s));const a=n.slice(s),r=t?"error-btn-link error-btn-link--active":"error-btn-link";return l.jsxs("div",{className:U("error-message",{expanded:e}),children:[i&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"error-gutter",children:l.jsx("button",{type:"button",onClick:this.handleToggleError,className:r,tabIndex:-1,children:l.jsx(Z,{icon:e?Pn:_h,transform:"left-3"})})}),l.jsxs("div",{className:"error-content",children:[l.jsx("div",{className:"console-error-text-trigger",role:"button",tabIndex:0,onKeyPress:this.handleKeyPress,onMouseDown:this.handleMouseDown,onMouseMove:this.handleMouseMove,onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave,onMouseUp:this.handleMouseUp,children:o}),e?a:""]})]}),!i&&l.jsx("div",{className:"error-content",children:l.jsx("div",{className:"console-error-text",children:o})})]},"error")}}const iC=Oa;const hd=X.module("ConsoleHistoryItem");class oC extends b.PureComponent{static defaultProps={disabled:!1};constructor(e){super(e),this.handleCancelClick=this.handleCancelClick.bind(this),this.handleObjectClick=this.handleObjectClick.bind(this)}handleObjectClick(e){hd.debug("handleObjectClick",e);const{openObject:t}=this.props;t(e)}handleCancelClick(){const{item:e}=this.props;e!=null&&e.cancelResult&&(hd.debug(`Cancelling command: ${e.command}`),e.cancelResult())}render(){const{disabled:e,item:t,language:n}=this.props,{disabledObjects:s,result:i}=t;let o=null;t.command!=null&&t.command!==""&&(o=l.jsxs("div",{className:"console-history-item-command",children:[l.jsx("div",{className:"console-history-gutter",children:">"}),l.jsx("div",{className:"console-history-content",children:l.jsx(gr,{language:n,children:t.command})})]}));const a=[];let r=!1;if(i){const{error:h,message:u,changes:m}=i;if(m){const{created:g,updated:p}=m;[...g,...p].forEach(C=>{r=!0;const{title:f}=C,S=`${f}`,v=e===void 0||e||(s??[]).indexOf(S)>=0,w=l.jsx(B,{kind:"primary",onClick:()=>this.handleObjectClick(C),className:"btn-console-object",disabled:v,icon:l.jsx(iu,{type:C.type}),children:f},S);a.push(w)})}if(h!=null&&t.command==null){let g=`${h.message??h}`;g||(g=h);const p=l.jsx(iC,{message:g},"result-error");a.push(p)}if(u!==void 0&&u!==""){const g=l.jsx("div",{className:"log-message",children:u},"log-message");a.push(g)}}else{r=!0;const h=l.jsx(sC,{onCancelClick:this.handleCancelClick,disabled:e},"in_progress");a.push(h)}let c=null;return a.length>0&&(c=l.jsx(au,{children:a})),l.jsxs("div",{className:U("console-command-result",{"console-result-buttons":r}),children:[o,c]})}}const aC=oC;class Kl extends b.Component{static defaultProps={disabled:!1};static itemKey(e,t){return`${e}.${t.command}.${t.result&&t.result.message}.${t.result&&t.result.error}`}render(){const{disabled:e,items:t,language:n,openObject:s}=this.props,i=[];for(let o=0;o<t.length;o+=1){const a=t[o],r=l.jsx(aC,{disabled:e,item:a,openObject:s,language:n},Kl.itemKey(o,a));i.push(r)}return l.jsx("div",{className:"container-fluid console-history",children:i})}}const rC=Kl,lC={name:"Console",CLEAR:Me.createAndAdd({id:"CONSOLE.CLEAR",name:"Clear",shortcut:[de.CTRL,he.L],macShortcut:[de.CTRL,he.C]}),FOCUS_HISTORY:Me.createAndAdd({id:"CONSOLE.FOCUS_HISTORY",name:"Focus History",shortcut:[de.CTRL,he.H],macShortcut:[de.CTRL,de.OPTION,he.H]})},cC={name:"Command History",FOCUS_HISTORY:Me.createAndAdd({id:"COMMAND_HISTORY.FOCUS_HISTORY",name:"Focus History Search",shortcut:[de.CTRL,he.H],macShortcut:[de.CTRL,de.OPTION,he.H]}),SEND_TO_CONSOLE:Me.createAndAdd({id:"COMMAND_HISTORY.SEND_TO_CONSOLE",name:"Send to Console",shortcut:[he.ENTER],macShortcut:[he.ENTER]}),SEND_TO_NOTEBOOK:Me.createAndAdd({id:"COMMAND_HISTORY.SEND_TO_NOTEBOOK",name:"Send to Notebook",shortcut:[de.CTRL,he.ENTER],macShortcut:[de.CMD,he.ENTER]}),RUN:Me.createAndAdd({id:"COMMAND_HISTORY.RUN",name:"Run",shortcut:[de.ALT,he.R],macShortcut:[de.OPTION,he.R]})},dC={name:"Notebook",RUN:Me.createAndAdd({id:"NOTEBOOK.RUN",name:"Run",shortcut:[de.ALT,he.R],macShortcut:[de.OPTION,he.R]}),RUN_SELECTED:Me.createAndAdd({id:"NOTEBOOK.RUN_SELECTED",name:"Run Selected",shortcut:[de.ALT,de.SHIFT,he.R],macShortcut:[de.OPTION,de.SHIFT,he.R]}),FIND:Me.createAndAdd({id:"NOTEBOOK.FIND",name:"Find",shortcut:[de.CTRL,he.F],macShortcut:[de.CMD,he.F],isEditable:!1}),MINIMAP:Me.createAndAdd({id:"NOTEBOOK.MINIMAP",name:"Show Minimap",shortcut:[de.ALT,he.M],macShortcut:[de.OPTION,he.M]}),WORDWRAP:Me.createAndAdd({id:"NOTEBOOK.WORDWRAP",name:"Word Wrap",shortcut:[de.ALT,he.Z],macShortcut:[de.OPTION,he.Z]})},hC={CONSOLE:lC,COMMAND_HISTORY:cC,NOTEBOOK:dC},kt=hC,pt=Object.freeze({FATAL:"FATAL",STDERR:"STDERR",ERROR:"ERROR",WARN:"WARN",STDOUT:"STDOUT",INFO:"INFO",DEBUG:"DEBUG",TRACE:"TRACE"}),uC="#2d2a2e",mC="#fcfcfa",gC="#fcd65b",pC="#b2b1b2",fC="#9edc6f",CC="#76d9e4",SC="#f95d84",bC="#aa9af4",wC="#f95d84",vC="#fcfcfa",TC="#7c7b7c",fe={"error-foreground":"#f95d84",background:uC,foreground:mC,"line-height":"19px",string:gC,"string-delim":"#929192",delimiter:pC,predefined:fC,keyword:CC,storage:SC,number:bC,operator:wC,identifier:vC,"namespace-identifier":"#f95d84","identifier-js":"#fcd65b",comment:TC,"input-option-active-border":"#929192","focus-border":"rgba(72, 120, 234, 0.85)","input-background":"#555356","input-foreground":"#f0f0ee","input-border":"#929192","editor-line-number-foreground":"#929192","editor-selection-background":"#676368","editor-line-highlight-bg":"#373438","context-menu-background":"#555356","context-menu-foreground":"#f0f0ee","menu-selection-background":"#4878ea","log-date":"#929192","log-error":"#f95d84","log-info":"#76d9e4","log-stdout":"#f0f0ee","log-warn":"#fcd65b","log-debug":"#aa9af4","log-trace":"#9edc6f","editor-find-match-background":"#3c5595","editor-find-match-highlight-background":"#343e5d","editor-widget-background":"#403e41","input-option-active-background":"#4878ea","input-option-active-foreground":"#f0f0ee","editor-suggest-widget-background":"#403e41","editor-suggest-widget-border":"#5b5a5c","editor-suggest-widget-foreground":"#f0f0ee","editor-suggest-widget-selected-background":"#41475a","editor-suggest-widget-highlightForeground":"#4878ea","list-hover-background":"#555356","text-link-foreground":"#929192","text-link-active-foreground":"#f0f0ee","editor-link-active-foreground":"#f0f0ee"},EC="python",yC={comments:{lineComment:"#",blockComment:["'''","'''"]},brackets:[["{","}"],["[","]"],["(",")"]],autoClosingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"',notIn:["string"]},{open:"'",close:"'",notIn:["string","comment"]}],surroundingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}],onEnterRules:[{beforeText:/^\s*(?:def|class|for|if|elif|else|while|try|with|finally|except|async).*?:\s*$/,action:{indentAction:1}}],folding:{offSide:!0,markers:{start:/^\s*#region\b/,end:/^\s*#endregion\b/}}},xC={keywords:["and","del","from","not","while","as","elif","global","or","with","assert","else","if","pass","yield","break","except","import","print","exec","in","raise","continue","finally","is","return","for","try",":","=","isinstance","__debug__"],storage:["class","def","async","lambda"],operators:["+","-","*","**","/","//","%","<<",">>","&","|","^","~","<",">","<=",">=","==","!=","<>","+=","-=","*=","/","//=","%=","&=","|=","^=",">>=","<<=","**="],brackets:[{open:"{",close:"}",token:"delimiter.curly"},{open:"[",close:"]",token:"delimiter.square"},{open:"(",close:")",token:"delimiter.parenthesis"}],symbols:/[=><!~&|+\-*/^%]+/,delimiters:/[;=.@:,`]/,escapes:/\\(?:[abfnrtv\\"'\n\r]|x[0-9A-Fa-f]{2}|[0-7]{3}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8}|N\{\w+\})/,rawpre:/(?:[rR]|ur|Ur|uR|UR|br|Br|bR|BR)/,strpre:/(?:[buBU])/,tokenizer:{root:[[/@strpre?("""|''')/,{token:"string.delim",bracket:"@open",next:"@mstring.$1"}],[/@strpre?"([^"\\]|\\.)*$/,"string.invalid"],[/@strpre?'([^'\\]|\\.)*$/,"string.invalid"],[/@strpre?(["])/,{token:"string.delim",bracket:"@open",next:"@sstring.$1",nextEmbedded:"deephavenDb"}],[/@strpre?(["'])/,{token:"string.delim",bracket:"@open",next:"@string.$1"}],[/@rawpre("""|''')/,{token:"string.delim",bracket:"@open",next:"@mrawstring.$1"}],[/@rawpre"([^"\\]|\\.)*$/,"string.invalid"],[/@rawpre'([^'\\]|\\.)*$/,"string.invalid"],[/@rawpre(["'])/,{token:"string.delim",bracket:"@open",next:"@rawstring.$1"}],[/__[\w$]*/,"predefined"],[/[a-z_$][\w$]*/,{cases:{"@keywords":"keyword","@storage":"storage","@default":"identifier"}}],[/[A-Z][\w]*/,{cases:{"~[A-Z0-9_]+":"constructor.identifier","@default":"namespace.identifier"}}],{include:"@whitespace"},[/[{}()[\]]/,"@brackets"],[/@symbols/,{cases:{"@keywords":"keyword","@operators":"operator","@default":""}}],[/\d*\.\d+([eE][-+]?\d+)?/,"number.float"],[/0[xX][0-9a-fA-F]+[lL]?/,"number.hex"],[/0[bB][0-1]+[lL]?/,"number.binary"],[/(0[oO][0-7]+|0[0-7]+)[lL]?/,"number.octal"],[/(0|[1-9]\d*)[lL]?/,"number"],[":",{token:"keyword",bracket:"@open"}],[/@delimiters/,{cases:{"@keywords":"keyword","@default":"delimiter"}}]],comment:[[/[^/*]+/,"comment"],[/\/\*/,"comment","@push"],["\\*/","comment","@pop"],[/[/*]/,"comment"]],mstring:[{include:"@strcontent"},[/"""|'''/,{cases:{"$#==$S2":{token:"string.delim",bracket:"@close",next:"@pop"},"@default":{token:"string"}}}],[/["']/,"string"],[/./,"string.invalid"]],sstring:[{include:"@strcontent"},[/["]/,{token:"string.delim",bracket:"@close",next:"@pop",nextEmbedded:"@pop"}],[/./,"string.invalid"]],string:[{include:"@strcontent"},[/[']/,{token:"string.delim",bracket:"@close",next:"@pop"}],[/./,"string.invalid"]],strcontent:[[/[^\\"']+/,"string"],[/\\$/,"string.escape"],[/@escapes/,"string.escape"],[/\\./,"string.escape.invalid"]],mrawstring:[{include:"@rawstrcontent"},[/"""|'''/,{cases:{"$#==$S2":{token:"string.delim",bracket:"@close",next:"@pop"},"@default":{token:"string"}}}],[/["']/,"string"],[/./,"string.invalid"]],rawstring:[{include:"@rawstrcontent"},[/["']/,{cases:{"$#==$S2":{token:"string.delim",bracket:"@close",next:"@pop"},"@default":{token:"string"}}}],[/./,"string.invalid"]],rawstrcontent:[[/[^\\"']+/,"string"],[/\\["']/,"string"],[/\\u[0-9A-Fa-f]{4}/,"string.escape"],[/\\/,"string"]],whitespace:[[/\s+/,"white"],[/(^#.*$)/,"comment"],[/'''/,"string","@endDocString"],[/"""/,"string","@endDblDocString"]],endDocString:[[/[^']+/,"string"],[/\\'/,"string"],[/'''/,"string","@popall"],[/'/,"string"]],endDblDocString:[[/[^"]+/,"string"],[/\\"/,"string"],[/"""/,"string","@popall"],[/"/,"string"]]}},RC={id:EC,conf:yC,language:xC},IC=RC,DC="groovy",FC={comments:{lineComment:"//",blockComment:["/*","*/"]},brackets:[["{","}"],["[","]"],["(",")"]],autoClosingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"',notIn:["string"]},{open:"'",close:"'",notIn:["string","comment"]}],surroundingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}],onEnterRules:[{beforeText:/^\s*(?:def|class|for|if|elif|else|while|try|with|finally|except|async).*?:\s*$/,action:{indentAction:1}}],folding:{offSide:!0,markers:{start:/^\s*#region\b/,end:/^\s*#endregion\b/}}},NC={keywords:["and","del","from","not","while","as","elif","global","or","with","assert","else","if","pass","yield","break","except","import","print","println","class","exec","in","raise","continue","finally","is","return","def","for","lambda","try",":","=","isinstance","__debug__"],operators:["+","-","*","**","/","//","%","<<",">>","&","|","^","~","<",">","<=",">=","==","!=","<>","+=","-=","*=","/","//=","%=","&=","|=","^=",">>=","<<=","**="],brackets:[{open:"{",close:"}",token:"delimiter.curly"},{open:"[",close:"]",token:"delimiter.square"},{open:"(",close:")",token:"delimiter.parenthesis"}],symbols:/[=><!~&|+\-*/^%]+/,delimiters:/[;=.@:,`]/,escapes:/\\(?:[abfnrtv\\"'\n\r]|x[0-9A-Fa-f]{2}|[0-7]{3}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8}|N\{\w+\})/,rawpre:/(?:[rR]|ur|Ur|uR|UR|br|Br|bR|BR)/,strpre:/(?:[buBU])/,tokenizer:{root:[[/@strpre?("""|''')/,{token:"string.delim",bracket:"@open",next:"@mstring.$1"}],[/@strpre?"([^"\\]|\\.)*$/,"string.invalid"],[/@strpre?'([^'\\]|\\.)*$/,"string.invalid"],[/@strpre?(["])/,{token:"string.delim",bracket:"@open",next:"@sstring.$1",nextEmbedded:"deephavenDb"}],[/@strpre?(["'])/,{token:"string.delim",bracket:"@open",next:"@string.$1"}],[/@rawpre("""|''')/,{token:"string.delim",bracket:"@open",next:"@mrawstring.$1"}],[/@rawpre"([^"\\]|\\.)*$/,"string.invalid"],[/@rawpre'([^'\\]|\\.)*$/,"string.invalid"],[/@rawpre(["'])/,{token:"string.delim",bracket:"@open",next:"@rawstring.$1"}],[/__[\w$]*/,"predefined"],[/[a-z_$][\w$]*/,{cases:{"@keywords":"keyword","@default":"identifier"}}],[/[A-Z][\w]*/,{cases:{"~[A-Z0-9_]+":"constructor.identifier","@default":"namespace.identifier"}}],{include:"@whitespace"},[/[{}()[\]]/,"@brackets"],[/@symbols/,{cases:{"@keywords":"keyword","@operators":"operator","@default":""}}],[/\d*\.\d+([eE][-+]?\d+)?/,"number.float"],[/0[xX][0-9a-fA-F]+[lL]?/,"number.hex"],[/0[bB][0-1]+[lL]?/,"number.binary"],[/(0[oO][0-7]+|0[0-7]+)[lL]?/,"number.octal"],[/(0|[1-9]\d*)[lL]?/,"number"],[":",{token:"keyword",bracket:"@open"}],[/@delimiters/,{cases:{"@keywords":"keyword","@default":"delimiter"}}]],mstring:[{include:"@strcontent"},[/"""|'''/,{cases:{"$#==$S2":{token:"string.delim",bracket:"@close",next:"@pop"},"@default":{token:"string"}}}],[/["']/,"string"],[/./,"string.invalid"]],sstring:[{include:"@strcontent"},[/["]/,{token:"string.delim",bracket:"@close",next:"@pop",nextEmbedded:"@pop"}],[/./,"string.invalid"]],string:[{include:"@strcontent"},[/[']/,{token:"string.delim",bracket:"@close",next:"@pop"}],[/./,"string.invalid"]],strcontent:[[/[^\\"']+/,"string"],[/\\$/,"string.escape"],[/@escapes/,"string.escape"],[/\\./,"string.escape.invalid"]],mrawstring:[{include:"@rawstrcontent"},[/"""|'''/,{cases:{"$#==$S2":{token:"string.delim",bracket:"@close",next:"@pop"},"@default":{token:"string"}}}],[/["']/,"string"],[/./,"string.invalid"]],rawstring:[{include:"@rawstrcontent"},[/["']/,{cases:{"$#==$S2":{token:"string.delim",bracket:"@close",next:"@pop"},"@default":{token:"string"}}}],[/./,"string.invalid"]],rawstrcontent:[[/[^\\"']+/,"string"],[/\\["']/,"string"],[/\\u[0-9A-Fa-f]{4}/,"string.escape"],[/\\/,"string"]],whitespace:[[/[ \t\r\n]+/,""],[/\/\*\*(?!\/)/,"comment.doc","@doccomment"],[/\/\*/,"comment","@comment"],[/\/\/.*$/,"comment"]],comment:[[/[^/*]+/,"comment"],[/\*\//,"comment","@pop"],[/[/*]/,"comment"]],doccomment:[[/[^/*]+/,"comment.doc"],[/\*\//,"comment.doc","@pop"],[/[/*]/,"comment.doc"]]}},MC={id:DC,conf:FC,language:NC},kC=MC,AC="scala",OC={wordPattern:/(unary_[@~!#%^&*()\-=+\\|:<>/?]+)|([a-zA-Z_$][\w$]*?_=)|(`[^`]+`)|([a-zA-Z_$][\w$]*)/g,comments:{lineComment:"//",blockComment:["/*","*/"]},brackets:[["{","}"],["[","]"],["(",")"]],autoClosingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}],surroundingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}],folding:{markers:{start:/^\s*\/\/\s*(?:(?:#?region\b)|(?:<editor-fold\b))/,end:/^\s*\/\/\s*(?:(?:#?endregion\b)|(?:<\/editor-fold>))/}}},LC={keywords:["asInstanceOf","catch","class","classOf","def","do","else","extends","finally","for","foreach","forSome","if","import","isInstanceOf","macro","match","new","object","package","return","throw","trait","try","type","until","val","var","while","with","yield","given","enum","then"],softKeywords:["as","export","extension","end","derives","on"],constants:["true","false","null","this","super"],modifiers:["abstract","final","implicit","lazy","override","private","protected","sealed"],softModifiers:["inline","opaque","open","transparent","using"],name:/(?:[a-z_$][\w$]*|`[^`]+`)/,type:/(?:[A-Z][\w$]*)/,symbols:/[=><!~?:&|+\-*/^\\%@#]+/,digits:/\d+(_+\d+)*/,hexdigits:/[[0-9a-fA-F]+(_+[0-9a-fA-F]+)*/,escapes:/\\(?:[btnfr\\"']|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/,fstring_conv:/[bBhHsScCdoxXeEfgGaAt]|[Tn](?:[HIklMSLNpzZsQ]|[BbhAaCYyjmde]|[RTrDFC])/,tokenizer:{root:[[/\braw"""/,{token:"string.quote",bracket:"@open",next:"@rawstringt"}],[/\braw"/,{token:"string.quote",bracket:"@open",next:"@rawstring"}],[/\bs"""/,{token:"string.quote",bracket:"@open",next:"@sstringt"}],[/\bs"/,{token:"string.quote",bracket:"@open",next:"@sstring"}],[/\bf""""/,{token:"string.quote",bracket:"@open",next:"@fstringt"}],[/\bf"/,{token:"string.quote",bracket:"@open",next:"@fstring"}],[/"""/,{token:"string.quote",bracket:"@open",next:"@stringt"}],[/"/,{token:"string.quote",bracket:"@open",next:"@string"}],[/(@digits)[eE]([-+]?(@digits))?[fFdD]?/,"number.float","@allowMethod"],[/(@digits)\.(@digits)([eE][-+]?(@digits))?[fFdD]?/,"number.float","@allowMethod"],[/0[xX](@hexdigits)[Ll]?/,"number.hex","@allowMethod"],[/(@digits)[fFdD]/,"number.float","@allowMethod"],[/(@digits)[lL]?/,"number","@allowMethod"],[/\b_\*/,"key"],[/\b(_)\b/,"keyword","@allowMethod"],[/\bimport\b/,"keyword","@import"],[/\b(case)([ \t]+)(class)\b/,["keyword.modifier","white","keyword"]],[/\bcase\b/,"keyword","@case"],[/\bva[lr]\b/,"keyword","@vardef"],[/\b(def)([ \t]+)((?:unary_)?@symbols|@name(?:_=)|@name)/,["keyword","white","identifier"]],[/@name(?=[ \t]*:(?!:))/,"variable"],[/(\.)(@name|@symbols)/,[{token:"operator"},{token:"@rematch",next:"@allowMethod"}]],[/([{(])(\s*)(@name(?=\s*=>))/,["@brackets","white","variable"]],[/@name/,{cases:{"@keywords":"keyword","@softKeywords":"keyword","@modifiers":"keyword.modifier","@softModifiers":"keyword.modifier","@constants":{token:"constant",next:"@allowMethod"},"@default":{token:"identifier",next:"@allowMethod"}}}],[/@type/,"type","@allowMethod"],{include:"@whitespace"},[/@[a-zA-Z_$][\w$]*(?:\.[a-zA-Z_$][\w$]*)*/,"annotation"],[/[{(]/,"@brackets"],[/[})]/,"@brackets","@allowMethod"],[/\[/,"operator.square"],[/](?!\s*(?:va[rl]|def|type)\b)/,"operator.square","@allowMethod"],[/]/,"operator.square"],[/([=-]>|<-|>:|<:|:>|<%)(?=[\s\w()[\]{},."'`])/,"keyword"],[/@symbols/,"operator"],[/[;,.]/,"delimiter"],[/'[a-zA-Z$][\w$]*(?!')/,"attribute.name"],[/'[^\\']'/,"string","@allowMethod"],[/(')(@escapes)(')/,[{token:"string"},{token:"string.escape"},{token:"string",next:"@allowMethod"}]],[/'/,"string.invalid"]],import:[[/;/,"delimiter","@pop"],[/^|$/,"","@pop"],[/[ \t]+/,"white"],[/[\n\r]+/,"white","@pop"],[/\/\*/,"comment","@comment"],[/@name|@type/,"type"],[/[(){}]/,"@brackets"],[/[[\]]/,"operator.square"],[/[.,]/,"delimiter"]],allowMethod:[[/^|$/,"","@pop"],[/[ \t]+/,"white"],[/[\n\r]+/,"white","@pop"],[/\/\*/,"comment","@comment"],[/(?==>[\s\w([{])/,"keyword","@pop"],[/(@name|@symbols)(?=[ \t]*[[({"'`]|[ \t]+(?:[+-]?\.?\d|\w))/,{cases:{"@keywords":{token:"keyword",next:"@pop"},"->|<-|>:|<:|<%":{token:"keyword",next:"@pop"},"@default":{token:"@rematch",next:"@pop"}}}],["","","@pop"]],comment:[[/[^/*]+/,"comment"],[/\/\*/,"comment","@push"],[/\*\//,"comment","@pop"],[/[/*]/,"comment"]],case:[[/\b_\*/,"key"],[/\b(_|true|false|null|this|super)\b/,"keyword","@allowMethod"],[/\bif\b|=>/,"keyword","@pop"],[/`[^`]+`/,"identifier","@allowMethod"],[/@name/,"variable","@allowMethod"],[/:::?|\||@(?![a-z_$])/,"keyword"],{include:"@root"}],vardef:[[/\b_\*/,"key"],[/\b(_|true|false|null|this|super)\b/,"keyword"],[/@name/,"variable"],[/:::?|\||@(?![a-z_$])/,"keyword"],[/=|:(?!:)/,"operator","@pop"],[/$/,"white","@pop"],{include:"@root"}],string:[[/[^\\"\n\r]+/,"string"],[/@escapes/,"string.escape"],[/\\./,"string.escape.invalid"],[/"/,{token:"string.quote",bracket:"@close",switchTo:"@allowMethod"}]],stringt:[[/[^\\"\n\r]+/,"string"],[/@escapes/,"string.escape"],[/\\./,"string.escape.invalid"],[/"(?=""")/,"string"],[/"""/,{token:"string.quote",bracket:"@close",switchTo:"@allowMethod"}],[/"/,"string"]],fstring:[[/@escapes/,"string.escape"],[/"/,{token:"string.quote",bracket:"@close",switchTo:"@allowMethod"}],[/\$\$/,"string"],[/(\$)([a-z_]\w*)/,["operator","identifier"]],[/\$\{/,"operator","@interp"],[/%%/,"string"],[/(%)([-#+ 0,(])(\d+|\.\d+|\d+\.\d+)(@fstring_conv)/,["metatag","keyword.modifier","number","metatag"]],[/(%)(\d+|\.\d+|\d+\.\d+)(@fstring_conv)/,["metatag","number","metatag"]],[/(%)([-#+ 0,(])(@fstring_conv)/,["metatag","keyword.modifier","metatag"]],[/(%)(@fstring_conv)/,["metatag","metatag"]],[/./,"string"]],fstringt:[[/@escapes/,"string.escape"],[/"(?=""")/,"string"],[/"""/,{token:"string.quote",bracket:"@close",switchTo:"@allowMethod"}],[/\$\$/,"string"],[/(\$)([a-z_]\w*)/,["operator","identifier"]],[/\$\{/,"operator","@interp"],[/%%/,"string"],[/(%)([-#+ 0,(])(\d+|\.\d+|\d+\.\d+)(@fstring_conv)/,["metatag","keyword.modifier","number","metatag"]],[/(%)(\d+|\.\d+|\d+\.\d+)(@fstring_conv)/,["metatag","number","metatag"]],[/(%)([-#+ 0,(])(@fstring_conv)/,["metatag","keyword.modifier","metatag"]],[/(%)(@fstring_conv)/,["metatag","metatag"]],[/./,"string"]],sstring:[[/@escapes/,"string.escape"],[/"/,{token:"string.quote",bracket:"@close",switchTo:"@allowMethod"}],[/\$\$/,"string"],[/(\$)([a-z_]\w*)/,["operator","identifier"]],[/\$\{/,"operator","@interp"],[/./,"string"]],sstringt:[[/@escapes/,"string.escape"],[/"(?=""")/,"string"],[/"""/,{token:"string.quote",bracket:"@close",switchTo:"@allowMethod"}],[/\$\$/,"string"],[/(\$)([a-z_]\w*)/,["operator","identifier"]],[/\$\{/,"operator","@interp"],[/./,"string"]],interp:[[/{/,"operator","@push"],[/}/,"operator","@pop"],{include:"@root"}],rawstring:[[/[^"]/,"string"],[/"/,{token:"string.quote",bracket:"@close",switchTo:"@allowMethod"}]],rawstringt:[[/[^"]/,"string"],[/"(?=""")/,"string"],[/"""/,{token:"string.quote",bracket:"@close",switchTo:"@allowMethod"}],[/"/,"string"]],whitespace:[[/[ \t\r\n]+/,"white"],[/\/\*/,"comment","@comment"],[/\/\/.*$/,"comment"]]}},PC={id:AC,conf:OC,language:LC},_C=PC,jC="deephavenDb",HC={comments:{lineComment:"#",blockComment:["'''","'''"]},brackets:[["{","}"],["[","]"],["(",")"]],autoClosingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"',notIn:["string"]},{open:"'",close:"'",notIn:["string","comment"]}],surroundingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}],onEnterRules:[{beforeText:/^\s*(?:def|class|for|if|elif|else|while|try|with|finally|except|async).*?:\s*$/,action:{indentAction:1}}],folding:{offSide:!0,markers:{start:/^\s*#region\b/,end:/^\s*#endregion\b/}}},VC={tokenPostfix:".js",keywords:["boolean","break","byte","case","catch","char","class","const","continue","debugger","default","delete","do","double","else","enum","export","extends","false","final","finally","float","for","function","goto","if","implements","import","in","instanceof","int","interface","long","native","new","null","package","private","protected","public","return","short","static","super","switch","synchronized","this","throw","throws","transient","true","try","typeof","var","void","volatile","while","with"],builtins:["define","require","window","document","undefined"],operators:["=",">","<","!","~","?",":","==","<=",">=","!=","&&","||","++","--","+","-","*","/","&","|","^","%","<<",">>",">>>","+=","-=","*=","/=","&=","|=","^=","%=","<<=",">>=",">>>="],brackets:[{open:"{",close:"}",token:"delimiter.curly"},{open:"[",close:"]",token:"delimiter.bracket"},{open:"(",close:")",token:"delimiter.parenthesis"}],symbols:/[~!@#%\^&*-+=|\\:`<>.?\/]+/,escapes:/\\(?:[btnfr\\"']|[0-7][0-7]?|[0-3][0-7]{2})/,exponent:/[eE][\-+]?[0-9]+/,regexpctl:/[(){}\[\]\$\^|\-*+?\.]/,regexpesc:/\\(?:[bBdDfnrstvwWn0\\\/]|@regexpctl|c[A-Z]|x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4})/,tokenizer:{root:[[/([a-zA-Z_\$][\w\$]*)(\s*)(:?)/,{cases:{"$1@keywords":["keyword","white","delimiter"],$3:["key.identifier","white","delimiter"],"$1@builtins":["predefined.identifier","white","delimiter"],"@default":["identifier","white","delimiter"]}}],{include:"@whitespace"},[/\/(?=([^\\\/]|\\.)+\/)/,{token:"regexp.slash",bracket:"@open",next:"@regexp"}],[/[{}()\[\]]/,"@brackets"],[/[;,.]/,"delimiter"],[/@symbols/,{cases:{"@operators":"operator","@default":""}}],[/\d+\.\d*(@exponent)?/,"number.float"],[/\.\d+(@exponent)?/,"number.float"],[/\d+@exponent/,"number.float"],[/0[xX][\da-fA-F]+/,"number.hex"],[/0[0-7]+/,"number.octal"],[/\d+/,"number"],[/"([^"\\]|\\.)*$/,"string.invalid"],[/'([^'\\]|\\.)*$/,"string.invalid"],[/"/,"string",'@string."'],[/'/,"string","@string.'"]],whitespace:[[/[ \t\r\n]+/,"white"],[/\/\*/,"comment","@comment"],[/\/\/.*$/,"comment"]],comment:[[/[^\/*]+/,"comment"],[/\/\*/,"comment.invalid"],["\\*/","comment","@pop"],[/[\/*]/,"comment"]],string:[[/[^\\"']+/,"string"],[/@escapes/,"string.escape"],[/\\./,"string.escape.invalid"],[/["']/,{cases:{"$#==$S2":{token:"string",next:"@pop"},"@default":"string"}}]],regexp:[[/(\{)(\d+(?:,\d*)?)(\})/,["@brackets.regexp.escape.control","regexp.escape.control","@brackets.regexp.escape.control"]],[/(\[)(\^?)(?=(?:[^\]\\\/]|\\.)+)/,[{token:"@brackets.regexp.escape.control"},{token:"regexp.escape.control",next:"@regexrange"}]],[/(\()(\?:|\?=|\?!)/,["@brackets.regexp.escape.control","regexp.escape.control"]],[/[()]/,"@brackets.regexp.escape.control"],[/@regexpctl/,"regexp.escape.control"],[/[^\\\/]/,"regexp"],[/@regexpesc/,"regexp.escape"],[/\\\./,"regexp.invalid"],["/",{token:"regexp.slash",bracket:"@close"},"@pop"]],regexrange:[[/-/,"regexp.escape.control"],[/\^/,"regexp.invalid"],[/@regexpesc/,"regexp.escape"],[/[^\]]/,"regexp"],[/\]/,"@brackets.regexp.escape.control","@pop"]]}},BC={id:jC,conf:HC,language:VC},$C=BC,UC="log",WC={},GC={tokenizer:{root:[[/ FATAL[\s\S]*/,{token:"error",next:"@error"}],[/ ERROR[\s\S]*/,{token:"error",next:"@error"}],[/ STDERR[\s\S]*/,{token:"error",next:"@error"}],[/ STDOUT.*/,{token:"stdout",next:"@stdout"}],[/ INFO[\s\S]*/,{token:"info",next:"@info"}],[/ WARN.*/,{token:"warn",next:"@warn"}],[/ TRACE[\s\S]*/,{token:"trace",next:"@trace"}],[/ DEBUG[.\s\S]*/,{token:"debug",next:"@debug"}],[/^\d{2}:\d{2}:\d{2}.\d{3}/,"date"]],error:[{include:"@body"}],info:[{include:"@body"}],warn:[{include:"@body"}],stdout:[{include:"@body"}],trace:[{include:"@body"}],debug:[{include:"@body"}],body:[[/^\d{2}:\d{2}:\d{2}.\d{3}/,{token:"date",next:"@pop"}],[/[\s\S]*/,{token:"$S0"}]]}},zC={id:UC,conf:WC,language:GC},KC=zC,Rn=X.module("MonacoUtils");class Fn{static init({getWorker:e}={}){Rn.debug("Initializing Monaco..."),e!==void 0&&Fn.registerGetWorker(e);const{registerLanguages:t,removeHashtag:n}=Fn,s=[{token:"",foreground:n(fe.foreground)},{token:"string",foreground:n(fe.string)},{token:"string.delim",foreground:n(fe["string-delim"])},{token:"keyword",foreground:n(fe.keyword)},{token:"identifier.js",foreground:n(fe["identifier-js"])},{token:"delimiter",foreground:n(fe.delimiter)},{token:"comment",foreground:n(fe.comment)},{token:"number",foreground:n(fe.number)},{token:"storage",foreground:n(fe.storage)},{token:"identifier",foreground:n(fe.identifier)},{token:"namespace.identifier",foreground:n(fe["namespace-identifier"])},{token:"operator",foreground:n(fe.operator)},{token:"predefined",foreground:n(fe.predefined)},{token:"error.log",foreground:fe["log-error"].substring(1)},{token:"warn.log",foreground:n(fe["log-warn"])},{token:"info.log",foreground:n(fe["log-info"])},{token:"stdout.log",foreground:n(fe["log-stdout"])},{token:"trace.log",foreground:n(fe["log-trace"])},{token:"debug.log",foreground:n(fe["log-debug"])},{token:"date.log",foreground:n(fe["log-date"])}],i={errorForeground:fe["error-foreground"],"inputOption.activeBorder":fe["input-option-active-border"],"editor.background":fe.background,"editor.foreground":fe.foreground,"editor.lineHighlightBackground":fe["editor-line-highlight-bg"],"editorLineNumber.foreground":fe["editor-line-number-foreground"],"editor.selectionBackground":fe["editor-selection-background"],"editor.findMatchBackground":fe["editor-find-match-background"],"editor.findMatchHighlightBackground":fe["editor-find-match-highlight-background"],"editorSuggestWidget.background":fe["editor-suggest-widget-background"],"editorSuggestWidget.border":fe["editor-suggest-widget-border"],"editorSuggestWidget.foreground":fe["editor-suggest-widget-foreground"],"editorSuggestWidget.selectedBackground":fe["editor-suggest-widget-selected-background"],"editorSuggestWidget.highlightForeground":fe["editor-suggest-widget-highlightForeground"],"list.hoverBackground":fe["list-hover-background"],"dropdown.background":fe["context-menu-background"],"dropdown.foreground":fe["context-menu-foreground"],"menu.selectionBackground":fe["menu-selection-background"],"list.focusBackground":fe["menu-selection-background"],"editorWidget.background":fe["editor-widget-background"],"inputOption.activeBackground":fe["input-option-active-background"],"inputOption.activeForeground":fe["input-option-active-foreground"],focusBorder:fe["focus-border"],"input.background":fe["input-background"],"input.foreground":fe["input-foreground"],"input.border":fe["input-border"],"textLink.foreground":fe["text-link-foreground"],"textLink.activeForeground":fe["text-link-active-foreground"],"editorLink.activeForeground":fe["editor-link-active-foreground"]};Qn.defineTheme("dh-dark",{base:"vs-dark",inherit:!0,rules:s,colors:i}),Rn.debug2("monaco theme: ",fe),Qn.setTheme("dh-dark"),t([$C,IC,kC,KC,_C]),Rn.debug("Monaco initialized.")}static registerGetWorker(e){window.MonacoEnvironment={...window.MonacoEnvironment,getWorker:e}}static removeHashtag(e){return e.substring(1)}static registerLanguages(e){const t=e.map(({id:n})=>n);On.getLanguages().filter(({id:n})=>t.includes(n)).forEach(n=>{const s=n;Rn.debug2("Overriding default language loader:",s.id)}),e.forEach(n=>{Fn.registerLanguage(n)})}static registerLanguage(e){Rn.debug2("Registering language: ",e.id),On.register(e),On.onLanguage(e.id,()=>{On.setLanguageConfiguration(e.id,e.conf),On.setMonarchTokensProvider(e.id,e.language)})}static setEOL(e,t=Qn.EndOfLineSequence.LF){e.getModel()?.setEOL(t)}static openDocument(e,t){const n=e.getModel();N(n);const s={textDocument:{uri:`${n.uri}`,languageId:n.getLanguageId(),version:n.getVersionId(),text:n.getValue()}};return Rn.debug2("didOpenDocumentParams: ",s),t.openDocument(s),e.onDidChangeModelContent(o=>{const{changes:a,versionId:r}=o,c=[];for(let h=0;h<a.length;h+=1){const u=a[h],{range:m,rangeLength:g,text:p}=u,C={range:{start:{line:m.startLineNumber-1,character:m.startColumn-1},end:{line:m.endLineNumber-1,character:m.endColumn-1}},rangeLength:g,text:p};c.push(C)}if(c.length>0){const h={textDocument:{version:r,uri:`${n.uri}`},contentChanges:c};Rn.debug2("didChangeDocumentParams",h),t.changeDocument(h)}})}static closeDocument(e,t){const n=e.getModel();N(n);const s={textDocument:{uri:`${n.uri}`}};t.closeDocument(s)}static registerPasteHandler(e){e.onDidPaste(t=>{const n=/“|”/g,s=/\u200b/g,i=/\u00A0/g,o=e.getModel();N(o);const a=o.getValueInRange(t.range);(n.test(a)||s.test(a)||i.test(a))&&o.applyEdits([{range:t.range,text:a.replace(n,'"').replace(s,"").replace(i," ")}])})}static isMacPlatform(){const{platform:e}=window.navigator;return e.startsWith("Mac")}static removeConflictingKeybindings(e){const t=[{windows:"ctrl+D",mac:"meta+D"},{windows:"ctrl+H"}];try{t.forEach(n=>{Fn.isMacPlatform()&&n.mac===""||!Fn.isMacPlatform()&&n.windows===""||Fn.removeKeybinding(e,Fn.isMacPlatform()?n.mac:n.windows)})}catch(n){Rn.error(n)}}static removeKeybinding(e,t){if(t===void 0)return;const n=e._standaloneKeybindingService._getResolver()._map.get(t);n!=null?n.forEach(s=>{Rn.debug2(`Removing Monaco keybinding ${t} for ${s.command}`),e._standaloneKeybindingService.addDynamicKeybinding(`-${s.command}`,null,()=>{})}):Rn.warn(`Did not find any keybindings to remove for ${t}`)}static getMonacoKeyCodeFromShortcut(e){const{keyState:t}=e,{keyValue:n}=t;return n===null?0:Fn.isMacPlatform()?(t.metaKey?dn.CtrlCmd:0)|(t.shiftKey?dn.Shift:0)|(t.altKey?dn.Alt:0)|(t.ctrlKey?dn.WinCtrl:0)|Uc.fromString(n):(t.ctrlKey?dn.CtrlCmd:0)|(t.shiftKey?dn.Shift:0)|(t.altKey?dn.Alt:0)|(t.metaKey?dn.WinCtrl:0)|Uc.fromString(n)}static provideLinks(e){const t=[];for(let n=1;n<=e.getLineCount();n+=1){const s=e.getLineContent(n);il(s).forEach(o=>{t.push({url:o.href,range:new Rg(n,o.start+1,n,o.end+1)})})}return{links:t}}}const Bt=Fn,Un=X.module("MonacoCompletionProvider");class Xs extends b.PureComponent{static lspToMonacoKind(e){const t=On.CompletionItemKind;switch(e){case 1:return t.Text;case 2:return t.Method;case 3:return t.Function;case 4:return t.Constructor;case 5:return t.Field;case 6:return t.Variable;case 7:return t.Class;case 8:return t.Interface;case 9:return t.Module;case 10:return t.Property;case 11:return t.Unit;case 12:return t.Value;case 13:return t.Enum;case 14:return t.Keyword;case 15:return t.Snippet;case 16:return t.Color;case 17:return t.File;case 18:return t.Reference;case 19:return t.Folder;case 20:return t.EnumMember;case 21:return t.Constant;case 22:return t.Struct;case 23:return t.Event;case 24:return t.Operator;case 25:return t.TypeParameter;default:return t.Variable}}static lspToMonacoRange(e){const{start:t,end:n}=e;return{startLineNumber:t.line+1,startColumn:t.character+1,endLineNumber:n.line+1,endColumn:n.character+1}}static monacoToLspPosition(e){return{line:e.lineNumber-1,character:e.column-1}}constructor(e){super(e),this.handleCompletionRequest=this.handleCompletionRequest.bind(this),this.handleSignatureRequest=this.handleSignatureRequest.bind(this),this.handleHoverRequest=this.handleHoverRequest.bind(this)}componentDidMount(){const{language:e,session:t}=this.props;this.registeredCompletionProvider=On.registerCompletionItemProvider(e,{provideCompletionItems:this.handleCompletionRequest,triggerCharacters:[".",'"',"'"]}),t.getSignatureHelp&&(this.registeredSignatureProvider=On.registerSignatureHelpProvider(e,{provideSignatureHelp:this.handleSignatureRequest,signatureHelpTriggerCharacters:["(",","]})),t.getHover&&(this.registeredHoverProvider=On.registerHoverProvider(e,{provideHover:this.handleHoverRequest}))}componentWillUnmount(){this.registeredCompletionProvider?.dispose(),this.registeredSignatureProvider?.dispose(),this.registeredHoverProvider?.dispose()}registeredCompletionProvider;registeredSignatureProvider;registeredHoverProvider;handleCompletionRequest(e,t,n){const{model:s,session:i}=this.props;if(e!==s)return null;const o={textDocument:{uri:`${e.uri}`,version:e.getVersionId()},position:Xs.monacoToLspPosition(t),context:n},a=i.getCompletionItems(o);return Un.debug("Requested completion items",o),a.then(c=>(Un.debug("Completion items received: ",o,c),{incomplete:!0,suggestions:c.map(u=>{const{label:m,kind:g,detail:p,documentation:C,sortText:f,filterText:S,textEdit:v,insertTextFormat:w}=u;return{label:m,kind:Xs.lspToMonacoKind(g),detail:p,documentation:C?.kind==="markdown"?C:C?.value,sortText:f,filterText:S,insertText:v.text,insertTextRules:w===2?4:w,range:Xs.lspToMonacoRange(v.range)}})})).catch(c=>(Un.error("There was an error retrieving completion items",c),{suggestions:[]}))}handleSignatureRequest(e,t,n,s){const i={value:{signatures:[],activeSignature:0,activeParameter:0},dispose:()=>{}},{model:o,session:a}=this.props;if(e!==o||!a.getSignatureHelp)return null;const r={textDocument:{uri:`${e.uri}`,version:e.getVersionId()},position:Xs.monacoToLspPosition(t),context:s},c=a.getSignatureHelp(r);return Un.debug("Requested signature help",r),c.then(u=>{Un.debug("Signatures received: ",r,c);const m=u.map(p=>{const{label:C,documentation:f,parameters:S}=p;return{documentation:f?.kind==="markdown"?f:f?.value,label:C,parameters:S??[]}});if(m.length===0)return i;const g=0;return{value:{signatures:m,activeSignature:g,activeParameter:u[g].activeParameter},dispose:()=>{}}}).catch(u=>(Un.error("There was an error retrieving completion items",u),i))}handleHoverRequest(e,t){const{model:n,session:s}=this.props;if(e!==n||!s.getHover)return null;const i={textDocument:{uri:`${e.uri}`,version:e.getVersionId()},position:Xs.monacoToLspPosition(t)},o=s.getHover(i);return Un.debug("Requested hover",i),o.then(r=>{Un.debug("Hover received: ",i,r);const{contents:c}=r;return{contents:c?[c]:[]}}).catch(r=>(Un.error("There was an error retrieving hover",r),{contents:[]}))}render(){return null}}const ru=Xs;const jr=X.module("ConsoleInput"),Ea=parseInt(fe["line-height"],10),lu=6,cu=6,qC=Ea+lu+cu,Hr=100;class ql extends b.PureComponent{static defaultProps={maxHeight:Ea*10,scope:null,disabled:!1};static INPUT_CLASS_NAME="console-input";constructor(e){super(e),this.handleWindowResize=this.handleWindowResize.bind(this),this.commandContainer=ee.createRef(),this.commandHistoryIndex=null,this.timestamp=Date.now(),this.bufferIndex=0,this.history=[],this.modifiedCommands=new Map,this.state={commandEditorHeight:Ea,isFocused:!1,model:null}}componentDidMount(){this.initCommandEditor(),window.addEventListener("resize",this.handleWindowResize),this.loadMoreHistory()}componentDidUpdate(){this.layoutEditor()}componentWillUnmount(){window.removeEventListener("resize",this.handleWindowResize),this.loadingPromise!=null&&this.loadingPromise.cancel(),this.destroyCommandEditor()}cancelListener;commandContainer;commandEditor;commandHistoryIndex;commandSuggestionContainer;loadingPromise;timestamp;bufferIndex;history;modifiedCommands;setConsoleText(e,t=!0,n=!1){e&&(jr.debug("Command received: ",e),n||(this.commandHistoryIndex=null,this.commandEditor?.setValue(e)),t&&this.focusEnd(),this.updateDimensions(),n&&this.processCommand(e))}initCommandEditor(){const{language:e,session:t}=this.props,n={copyWithSyntaxHighlighting:!1,cursorStyle:"block",fixedOverflowWidgets:!0,folding:!1,fontFamily:"Fira Mono",glyphMargin:!1,language:e,lineHeight:Ea,lineDecorationsWidth:3,lineNumbers:"off",minimap:{enabled:!1},renderLineHighlight:"none",scrollBeyondLastLine:!1,scrollbar:{arrowSize:0,horizontal:"hidden",horizontalScrollbarSize:0},padding:{top:lu,bottom:cu},tabCompletion:"on",value:"",wordWrap:"on"},s=this.commandContainer.current;N(s),this.commandEditor=Qn.create(s,n),Bt.setEOL(this.commandEditor),Bt.openDocument(this.commandEditor,t),this.commandEditor.onDidChangeModelContent(()=>{const i=this.commandEditor?.getValue();this.modifiedCommands.set(this.commandHistoryIndex,i??null),this.updateDimensions()}),this.commandEditor.onDidFocusEditorText(()=>{this.setState({isFocused:!0})}),this.commandEditor.onDidBlurEditorText(()=>{this.setState({isFocused:!1})}),this.commandEditor.onKeyDown(i=>{const{commandEditor:o,commandHistoryIndex:a}=this,r=o?.getPosition();N(r);const{lineNumber:c}=r,h=o?.getModel();if(i.code==="ArrowUp"&&!this.isSuggestionMenuPopulated()&&c===1){a!=null?this.loadCommand(a+1):this.loadCommand(0),this.focusStart(),i.stopPropagation(),i.preventDefault();return}if(i.code==="ArrowDown"&&!this.isSuggestionMenuPopulated()&&c===h?.getLineCount()){a!=null&&a>0?this.loadCommand(a-1):this.loadCommand(null),this.focusEnd(),i.stopPropagation(),i.preventDefault();return}if(!i.altKey&&!i.shiftKey&&!i.metaKey)if(i.keyCode===Is.Enter){if(!this.isSuggestionMenuPopulated()){i.stopPropagation(),i.preventDefault();const u=this.commandEditor?.getValue().trim();u!==void 0&&(this.processCommand(u),this.commandEditor?.setValue(""))}}else i.keyCode===Is.Tab&&(this.isSuggestionMenuActive()?this.isSuggestionMenuPopulated()||(i.stopPropagation(),i.preventDefault()):(i.stopPropagation(),i.preventDefault(),this.commandEditor?.trigger("Tab key trigger suggestions","editor.action.triggerSuggest",{})))}),this.commandEditor.addCommand(dn.CtrlCmd|Is.KeyF,()=>{}),Bt.removeConflictingKeybindings(this.commandEditor),Bt.registerPasteHandler(this.commandEditor),this.commandEditor.focus(),this.updateDimensions(),this.setState({model:this.commandEditor.getModel()})}destroyCommandEditor(){const{session:e}=this.props;this.commandEditor&&(Bt.closeDocument(this.commandEditor,e),this.commandEditor.dispose(),this.commandEditor=void 0)}handleWindowResize(){this.updateDimensions()}isSuggestionMenuActive(){return this.commandSuggestionContainer||(this.commandSuggestionContainer=this.commandEditor?.getDomNode()?.querySelector(".suggest-widget")),(this.commandSuggestionContainer&&this.commandSuggestionContainer.classList.contains("visible"))??!1}isSuggestionMenuPopulated(){return this.isSuggestionMenuActive()&&(this.commandSuggestionContainer?.querySelector(".monaco-list-rows")?.childElementCount??0)>0}focus(){this.commandEditor?.focus()}focusStart(){const e=this.commandEditor?.getModel();N(e);const t=e.getLineLength(1)+1,n=this.commandEditor?.getTopForPosition(1,t);N(n),this.commandEditor?.setPosition({lineNumber:1,column:t}),this.commandEditor?.setScrollTop(n),this.commandEditor?.focus()}focusEnd(){const e=this.commandEditor?.getModel();N(e);const t=e.getLineCount(),n=e.getLineLength(t)+1,s=this.commandEditor?.getTopForPosition(t,n);N(s),this.commandEditor?.setPosition({lineNumber:t,column:n}),this.commandEditor?.setScrollTop(s),this.commandEditor?.focus()}clear(){this.commandEditor?.focus(),this.commandEditor?.getModel()?.setValue(""),this.commandHistoryIndex=null}layoutEditor(){this.commandEditor&&this.commandEditor.layout()}loadCommand(e){if(e!==null&&e>=this.history.length)return;const t=this.modifiedCommands.get(e),n=e===null?"":this.history[this.history.length-e-1];this.commandHistoryIndex=e,this.commandEditor?.getModel()?.setValue(t??n),e!==null&&e>this.history.length-Hr&&this.loadMoreHistory()}async loadMoreHistory(){try{if(this.loadingPromise!=null||this.bufferIndex==null)return;const{commandHistoryStorage:e,language:t,scope:n}=this.props;this.loadingPromise=we.makeCancelable(e.getTable(t,n??"",this.timestamp),o=>o.close());const s=await this.loadingPromise;s.setReversed(!0),s.setViewport({top:this.bufferIndex,bottom:this.bufferIndex+Hr-1}),this.loadingPromise=we.makeCancelable(s.getViewportData(),()=>s.close());const i=await this.loadingPromise;this.bufferIndex+=Hr,this.bufferIndex>=s.size&&(this.bufferIndex=null),this.history=[...i.items.filter(({name:o},a,r)=>a===0||o!==r[a-1].name).map(({name:o})=>o).reverse(),...this.history],this.loadingPromise=void 0,s.close()}catch(e){if(this.loadingPromise=void 0,we.isCanceled(e)){jr.debug2("Promise canceled, not loading history");return}jr.error("Error fetching history",e)}}processCommand(e){this.commandHistoryIndex=null,this.modifiedCommands.clear(),N(e),e!==""&&(this.history.length===0||e!==this.history[this.history.length-1])&&this.history.push(e),this.updateDimensions();const{onSubmit:t}=this.props;t(e)}updateDimensions(){if(!this.commandEditor)return;const{maxHeight:e}=this.props;N(e);const t=this.commandEditor.getContentHeight(),n=Math.max(Math.min(t,e),qC),i={overviewRulerLanes:t>n?void 0:0};this.setState({commandEditorHeight:n},()=>{this.commandEditor?.updateOptions(i),this.commandEditor?.layout()})}render(){const{disabled:e,language:t,session:n}=this.props,{commandEditorHeight:s,isFocused:i,model:o}=this.state;return l.jsx("div",{className:U("console-input-wrapper",{disabled:e}),children:l.jsxs("div",{className:U("console-input-inner-wrapper",{focus:i}),children:[l.jsx("div",{className:ql.INPUT_CLASS_NAME,ref:this.commandContainer,style:{height:s}}),o&&l.jsx(ru,{model:o,language:t,session:n})]})})}}const ud=ql;const md="pasted values",YC=[/^audio.*/,/^font.*/,/^image.*/,/^video.*/],Vr=[".csv",".tsv",".tab",".psv",".dsv",".txt"],gd=[".zip"];class Zs extends b.Component{static defaultProps={allowZip:!1,dragError:null};static MULTIPLE_FILE_ERROR="Please select only one file";static FILE_TYPE_ERROR="Filetype not supported.";static isValidDropItem(e){return e!=null&&e.kind==="file"&&!YC.find(t=>t.test(e.type))}static isValidExtension(e,t=!1){return Vr.some(n=>e.endsWith(n))||t&&gd.some(n=>e.endsWith(n))}static handleDragOver(e){e.preventDefault(),e.stopPropagation()}static getIcon(e){return e===md?Wc:e.endsWith(".csv")?Ag:e.endsWith(".zip")?Og:Lg}constructor(e){super(e),this.handleSelectFile=this.handleSelectFile.bind(this),this.handleFiles=this.handleFiles.bind(this),this.handleDrop=this.handleDrop.bind(this),this.unstageFile=this.unstageFile.bind(this),this.handleMenuPaste=this.handleMenuPaste.bind(this),this.handlePasteEvent=this.handlePasteEvent.bind(this),this.fileElem=ee.createRef(),this.divElem=ee.createRef(),this.state={selectedFileName:""}}componentDidMount(){this.divElem.current?.addEventListener("paste",this.handlePasteEvent),this.divElem.current?.focus()}componentWillUnmount(){this.divElem.current?.removeEventListener("paste",this.handlePasteEvent)}fileElem;divElem;handleSelectFile(){this.fileElem.current&&(this.fileElem.current.value="",this.fileElem.current?.click())}handleFiles(e){e.stopPropagation(),e.preventDefault();const{files:t}=e.target;t!=null&&this.handleFile(t[0])}handleDrop(e){const{allowZip:t,clearDragError:n,dragError:s}=this.props;if(e.preventDefault(),e.stopPropagation(),s!=null){n();return}if(e.dataTransfer==null||e.dataTransfer.items==null||e.dataTransfer.items.length===0)return;const i=e.dataTransfer.items[0].getAsFile();N(i),Zs.isValidExtension(i.name,t)?this.handleFile(i):this.setState({dropError:Zs.FILE_TYPE_ERROR})}unstageFile(e){const{onCancel:t}=this.props;e.stopPropagation(),e.preventDefault(),t(),this.setState({selectedFileName:"",dropError:void 0})}handleFile(e){const{onFileOpened:t}=this.props;t(e),this.setState({selectedFileName:e.name,dropError:void 0})}handleMenuPaste(){const{onPaste:e,onError:t,uploadInProgress:n}=this.props;n||navigator.clipboard.readText().then(s=>{e(s),this.setState({selectedFileName:md,dropError:void 0})}).catch(s=>t(s))}handlePasteEvent(e){e.stopPropagation(),e.preventDefault(),this.handleMenuPaste()}makeContextMenuItems(){const{uploadInProgress:e}=this.props;return[{title:"Paste",icon:Wc,action:this.handleMenuPaste,shortcut:ss.PASTE,disabled:e}]}getValidExtensions=pe(e=>e?[...Vr,...gd]:[...Vr]);getAcceptString=pe(e=>this.getValidExtensions(e).join(", "));getFileTypeErrorString=pe(e=>zt.join(this.getValidExtensions(e),"or"));render(){const{allowZip:e,dragError:t,uploadInProgress:n}=this.props,{selectedFileName:s,dropError:i}=this.state,o=t??i,a=this.makeContextMenuItems();return l.jsxs("div",{ref:this.divElem,className:"csv-overlay fill-parent-absolute",onDragOver:Zs.handleDragOver,onDrop:this.handleDrop,tabIndex:-1,children:[l.jsx(ie,{actions:a}),l.jsx("input",{ref:this.fileElem,type:"file",id:"fileElem",accept:this.getAcceptString(e),style:{display:"none"},onChange:this.handleFiles,"data-testid":"fileElem"}),!s&&(o===void 0||o==="")&&l.jsxs("div",{className:"message-content",children:[l.jsx("div",{className:"message-icon",children:l.jsx(Z,{icon:Pg})}),l.jsx("label",{children:"Drop file (or paste values) here to import"}),l.jsx("div",{className:"message-small",children:l.jsx("label",{children:"or"})}),l.jsx(B,{kind:"primary",onClick:this.handleSelectFile,children:"Select File..."})]}),s&&(o===void 0||o==="")&&l.jsxs("div",{className:"selected-content",children:[l.jsx("div",{className:"selected-icon",children:l.jsx(Z,{icon:Zs.getIcon(s)})}),l.jsxs("div",{className:"selected-text",children:[l.jsx("label",{children:"Selected File"}),l.jsxs("label",{className:"selected-name",children:[s,!n&&l.jsx(B,{kind:"ghost",className:"ml-2",onClick:this.unstageFile,icon:Jt,tooltip:"Remove"})]})]})]}),Boolean(o)&&l.jsxs("div",{className:"message-content",children:[l.jsx("div",{className:"message-icon",children:l.jsx(Z,{icon:Ms})}),l.jsx("label",{children:o}),o===Zs.FILE_TYPE_ERROR&&l.jsx("div",{className:"message-small",children:l.jsx("label",{children:this.getFileTypeErrorString(e)})})]})]})}}const xi=Zs;class XC{static INTEGER="int";static LONG="long";static DOUBLE="double";static BOOLEAN="bool";static STRING="string";static DATE_TIME="datetime";static LOCAL_TIME="localtime"}const Pe=XC,pd="unknown",ZC=2147483647,QC=-2147483648,fd=/^[0-9]{4}-[0-1][0-9]-[0-3][0-9][ T][0-2][0-9]:[0-5][0-9]:[0-6][0-9](?:\.[0-9]{1,9})?(?: [a-zA-Z]+)?$/,Cd=/^([0-9]+T)?([0-9]+):([0-9]+)(:[0-9]+)?(?:\.[0-9]{1,9})?$/;class yt{static determineType(e,t,n){if(!e||e===n)return t;switch(t){case Pe.STRING:return Pe.STRING;case Pe.INTEGER:return yt.checkInteger(e);case Pe.LONG:return yt.checkLong(e);case Pe.DOUBLE:return yt.checkDouble(e);case Pe.BOOLEAN:return yt.checkBoolean(e);case Pe.DATE_TIME:return yt.checkDateTime(e);case Pe.LOCAL_TIME:return yt.checkLocalTime(e);default:return yt.getTypeFromUnknown(e)}}static isNotParsableNumber(e){return isNaN(e)||e==="Infinity"||e==="-Infinity"}static checkInteger(e){const t=e.replace(/,/g,"");return yt.isNotParsableNumber(t)?Pe.STRING:yt.getNumberType(t)}static checkLong(e){const t=e.replace(/,/g,"");return yt.isNotParsableNumber(t)?Pe.STRING:t.includes(".")?Pe.DOUBLE:Pe.LONG}static checkDouble(e){const t=e.replace(/,/g,"");return yt.isNotParsableNumber(t)?Pe.STRING:Pe.DOUBLE}static checkBoolean(e){const t=e.toLowerCase();return t==="true"||t==="false"?Pe.BOOLEAN:Pe.STRING}static checkDateTime(e){return fd.test(e)?Pe.DATE_TIME:Pe.STRING}static checkLocalTime(e){return Cd.test(e)?Pe.LOCAL_TIME:Pe.STRING}static getTypeFromUnknown(e){const t=e.replace(/,/g,"");if(yt.isNotParsableNumber(t)){const n=e.toLowerCase();return n==="true"||n==="false"?Pe.BOOLEAN:fd.test(e)&&e.includes(":")?Pe.DATE_TIME:Cd.test(e)?Pe.LOCAL_TIME:Pe.STRING}return yt.getNumberType(t)}static getNumberType(e){if(e.includes("."))return Pe.DOUBLE;const t=e.startsWith("-")?11:10;if(e.length>t)return Pe.LONG;const n=parseInt(e,10);return n>ZC||n<QC?Pe.LONG:Pe.INTEGER}constructor(e,t,n,s,i,o,a,r,c,h){this.onFileCompleted=e,this.file=t,this.readHeaders=n,this.nullString=i,this.onProgress=o,this.onError=a,this.chunks=0,this.totalChunks=r,this.isZip=c,this.shouldTrim=h,this.zipProgress=0,this.handleChunk=this.handleChunk.bind(this),this.handleComplete=this.handleComplete.bind(this),this.handleError=this.handleError.bind(this),this.handleNodeUpdate=this.handleNodeUpdate.bind(this),this.config={...s,error:this.handleError,chunk:this.handleChunk,complete:this.handleComplete}}onFileCompleted;file;readHeaders;nullString;onProgress;onError;types;chunks;totalChunks;isZip;shouldTrim;zipProgress;config;parse(){const e=this.isZip?this.file.nodeStream("nodebuffer",this.handleNodeUpdate):this.file;ol.parse(e,this.config)}handleChunk(e,t){let{data:n}=e;if(!this.types){if(n==null||n.length===0){t.abort(),this.onError("Error parsing CSV: no data in file.");return}this.types=new Array(n[0].length).fill(pd),this.readHeaders&&(n=n.slice(1))}N(this.types);const s=[...this.types];n.forEach(a=>{if(a.length>=s.length){for(let r=0;r<s.length;r+=1)s[r]=yt.determineType(this.shouldTrim?a[r].trim():a[r],s[r],this.nullString);this.types=s}else t.abort(),this.onError(`Error parsing CSV: Insufficient data in row.
4
4
  Expected length ${s.length} but found ${a.length}.
@@ -35,9 +35,9 @@ ${a} does not exist yet.`}if(s){const{widgetName:o}=this.props;return`${o} is un
35
35
  ${vo.makeCirclePath(s,i,vh)}
36
36
  ${vo.makeCirclePath(o,a,vh)}`,D=`link-select-clip-${r}`,F=Math.atan2(a-y,o-T),_=F-wh+Math.PI,P=F+wh+Math.PI,$=o+Math.cos(F)*bh,k=a+Math.sin(F)*bh,j=$+Math.cos(_)*ba,A=k+Math.sin(_)*ba,O=$+Math.cos(P)*ba,H=k+Math.sin(P)*ba,G=`${$},${k} ${j},${A} ${O},${H}`,z=.25*s+.5*T+.25*o,oe=.25*i+.5*y+.25*a,W=T-s+(o-T),te=(y-i+(a-y))/W;let ce=20/Math.sqrt(1+te**2),J=ce*te,ae=ce*-1,ve=J*-1;Number.isFinite(te)?te>0?(ce*=-1,J*=-1,ae*=-1,ve*=-1,ae-=50-10*(Math.abs(g)%ws),ve+=10*(Math.abs(g)%ws),ce-=50-10*(Math.abs(g)%ws),J+=10*(Math.abs(g)%ws)):te<0?(ae+=10*(Math.abs(g)%ws),ve+=10*(Math.abs(g)%ws),ce+=10*(Math.abs(g)%ws),J+=10*(Math.abs(g)%ws)):(ae=15,ve=10,ce=-25,J=10):(ae=10,ve=5,ce=10,J=-35);let Re="";t!==void 0&&(t==="startsWith"?Re="a*":t==="endsWith"?Re="*z":Re=R.getFilterOperatorString(t));const Ie=h!=="chartLink"&&h!=="filterSource";return l.jsxs(l.Fragment,{children:[l.jsxs("svg",{className:U(e,{hovering:u}),children:[l.jsx("clipPath",{id:D,children:l.jsx("path",{d:I,clipRule:"evenodd"})}),l.jsx("path",{className:"link-select",d:E,onClick:this.handleClick,onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave,clipPath:`url(#${D})`,"data-testid":"link-select"}),l.jsx("path",{className:"link-background",d:E}),l.jsx("path",{className:"link-foreground",d:E}),l.jsx("circle",{className:"link-dot",cx:s,cy:i,r:"5"}),l.jsx("polygon",{className:"link-triangle",points:G})]}),c!=null&&n&&l.jsxs(l.Fragment,{children:[Ie&&l.jsx(B,{kind:"primary",className:"btn-fab btn-operator",style:{top:oe+(te>=0?J:ve),left:z+(te>=0?ce:ae)},onClick:()=>{},icon:l.jsxs("div",{className:"fa-md fa-layers",children:[l.jsx("b",{children:Re}),l.jsx(Z,{icon:Pn,transform:"right-8 down-9 shrink-5"})]}),tooltip:"Change comparison operator",children:l.jsx(es,{actions:this.getDropdownActions,popperOptions:{placement:"bottom-start"}})}),l.jsx(B,{kind:"primary",className:"btn-fab btn-delete",style:{top:oe+(te<0?J:ve),left:z+(te<0?ce:ae)},onClick:this.handleDelete,icon:Jt,tooltip:"Delete"})]})]})}}const NI=vo;const el=X.module("LinkerOverlayContent");class MI extends b.Component{static defaultProps={disabled:"false"};constructor(e){super(e),this.handleBlur=this.handleBlur.bind(this),this.handleResize=this.handleResize.bind(this),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleMouseDown=this.handleMouseDown.bind(this),this.handleMouseUp=this.handleMouseUp.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleKeyUp=this.handleKeyUp.bind(this),this.handleEscapePressed=this.handleEscapePressed.bind(this),this.handleOperatorChanged=this.handleOperatorChanged.bind(this),this.dialogRef=ee.createRef(),this.state={mouse:void 0,dialog:void 0,offset:{x:0,y:0},isDragging:!1,mode:"select"}}componentDidMount(){window.addEventListener("blur",this.handleBlur,!0),window.addEventListener("mousemove",this.handleMouseMove,!0),window.addEventListener("mouseup",this.handleMouseUp,!0),window.addEventListener("keydown",this.handleKeyDown,!0),window.addEventListener("keyup",this.handleKeyUp,!0),window.addEventListener("resize",this.handleResize,!0)}componentDidCatch(e,t){el.error("componentDidCatch",e,t)}componentWillUnmount(){window.removeEventListener("blur",this.handleBlur,!0),window.removeEventListener("mousemove",this.handleMouseMove,!0),window.removeEventListener("mouseup",this.handleMouseUp,!0),window.removeEventListener("keydown",this.handleKeyDown,!0),window.removeEventListener("keyup",this.handleKeyUp,!0),window.removeEventListener("resize",this.handleResize,!0)}dialogRef;getPointFromLinkPoint(e){const{panelManager:t}=this.props,{panelId:n,columnName:s}=e,i=t.getOpenedPanelById(n);if(i!=null){if(!Om(i))throw new Error(`Panel does not have getCoordinateForColumn method: ${n}`);try{const a=i.getCoordinateForColumn(s);if(a!=null)return a}catch{el.error("Could not get coordinate for column",s,i)}}const o=t.getContainerByPanelId(n);if(o==null)throw new Error(`Unable to find panel container for id: ${n}`);return K.getTabPoint(o)}handleOperatorChanged(e,t){const{links:n,onLinksUpdated:s}=this.props,i=n.map(o=>o.id===e?{...o,operator:t}:o);s(i)}handleBlur(){this.setState({mode:"select"})}handleResize(){const{dialog:e}=this.state;if(e&&this.dialogRef.current){const t=this.dialogRef.current.getBoundingClientRect(),n=Ve(e.x,0,window.innerWidth-t.width),s=Ve(e.y,0,window.innerHeight-t.height);this.setState({dialog:{x:n,y:s}})}}handleMouseMove(e){const{offset:t,isDragging:n}=this.state;if(this.setState({mouse:{x:e.clientX,y:e.clientY}}),n&&this.dialogRef.current){const s=this.dialogRef.current.getBoundingClientRect(),i=Ve(window.innerWidth-(e.clientX+s.width+t.x),0,window.innerWidth-s.width),o=Ve(window.innerHeight-(e.clientY+s.height+t.y),0,window.innerHeight-s.height);this.setState({dialog:{x:i,y:o}})}}handleMouseDown(e){const t={x:0,y:0};if(this.dialogRef.current){const n=this.dialogRef.current.getBoundingClientRect();t.x=n.right-(n.width+e.clientX),t.y=n.bottom-(n.height+e.clientY)}this.setState({isDragging:!0,offset:t})}handleMouseUp(){this.setState({isDragging:!1})}handleKeyDown(e){if(e.key==="Alt")e.preventDefault(),this.setState({mode:"delete"});else if(e.key==="Delete"||e.key==="Backspace"){const{selectedIds:t,onLinkDeleted:n}=this.props;e.preventDefault(),t.forEach(s=>n(s))}}handleKeyUp(e){e.key==="Alt"&&(e.preventDefault(),this.setState({mode:"select"}))}handleEscapePressed(){const{onCancel:e}=this.props;e()}render(){const{disabled:e,links:t,selectedIds:n,messageText:s,onLinkSelected:i,onLinkDeleted:o,onAllLinksDeleted:a,onDone:r}=this.props,{mouse:c,dialog:h,isDragging:u,mode:m}=this.state,g=t.map(p=>{try{const{id:C,type:f,isReversed:S,start:v,end:w,operator:T}=p,y=v.columnType;let[E,I]=this.getPointFromLinkPoint(v),D=c?.x??E,F=c?.y??I;if(w!=null&&([D,F]=this.getPointFromLinkPoint(w)),S!=null&&S){const[P,$]=[E,I];[E,I]=[D,F],[D,F]=[P,$]}const _=U("linker-link",{disabled:e},{"link-filter-source":f==="filterSource"},{"link-invalid":f==="invalid"},{interactive:p.end==null},{"link-is-selected":n.has(C)},{"danger-delete":m==="delete"});return{x1:E,y1:I,x2:D,y2:F,id:C,className:_,operator:T,startColumnType:y,type:f}}catch(C){return el.warn("Unable to get point for link",p,C),null}}).filter(p=>p!=null);return l.jsxs("div",{className:U("linker-overlay",{"danger-delete":m==="delete"}),children:[g.map(({x1:p,y1:C,x2:f,y2:S,id:v,className:w,operator:T,startColumnType:y,type:E})=>l.jsx(NI,{className:w,id:v,x1:p,y1:C,x2:f,y2:S,onClick:i,onDelete:o,isSelected:n.has(v),operator:T,startColumnType:y,type:E,onOperatorChanged:this.handleOperatorChanged},v)),l.jsxs("div",{className:U("linker-toast-dialog",{dragging:u}),ref:this.dialogRef,style:{bottom:h?.y,right:h?.x},"data-testid":"linker-toast-dialog",children:[l.jsx(B,{draggable:!0,kind:"inline",className:"btn-drag-handle",icon:Fo,onClick:()=>{},onMouseDown:this.handleMouseDown,children:!u&&l.jsx(tt,{children:"Drag to reposition"})}),l.jsx("div",{className:"toast-body",children:s}),l.jsxs("div",{className:"toast-footer",children:[l.jsx(B,{kind:"secondary",onClick:a,children:"Clear All"}),l.jsx(B,{kind:"primary",onClick:r,children:"Done"})]})]}),l.jsx(ie,{actions:[{action:this.handleEscapePressed,shortcut:ss.LINKER_CLOSE,isGlobal:!0}]})]})}}const kI=MI,gt=X.module("Linker"),AI=(d,e)=>({activeTool:fr(d),isolatedLinkerPanelId:xc(d,e.localDashboardId),links:Ki(d,e.localDashboardId),timeZone:ko(d)}),OI=St(AI,{setActiveTool:Sr,setDashboardLinks:Ic,addDashboardLinks:lR,deleteDashboardLinks:cR,setDashboardIsolatedLinkerPanelId:Fm,setDashboardColumnSelectionValidator:dR});class LI extends b.Component{constructor(e){super(e),this.handleCancel=this.handleCancel.bind(this),this.handleDone=this.handleDone.bind(this),this.handlePanelCloned=this.handlePanelCloned.bind(this),this.handleFilterColumnSelect=this.handleFilterColumnSelect.bind(this),this.handleColumnsChanged=this.handleColumnsChanged.bind(this),this.handlePanelClosed=this.handlePanelClosed.bind(this),this.handleLayoutStateChanged=this.handleLayoutStateChanged.bind(this),this.handleAllLinksDeleted=this.handleAllLinksDeleted.bind(this),this.handleLinkDeleted=this.handleLinkDeleted.bind(this),this.handleLinksUpdated=this.handleLinksUpdated.bind(this),this.handleChartColumnSelect=this.handleChartColumnSelect.bind(this),this.handleGridColumnSelect=this.handleGridColumnSelect.bind(this),this.handleUpdateValues=this.handleUpdateValues.bind(this),this.handleStateChange=this.handleStateChange.bind(this),this.handleExited=this.handleExited.bind(this),this.handleLinkSelected=this.handleLinkSelected.bind(this),this.handlePanelDragging=this.handlePanelDragging.bind(this),this.handlePanelDropped=this.handlePanelDropped.bind(this),this.isColumnSelectionValid=this.isColumnSelectionValid.bind(this),this.state={linkInProgress:void 0,selectedIds:new Set,isDraggingPanel:!1}}componentDidMount(){const{layout:e}=this.props;this.startListening(e),this.updateSelectionValidators()}componentDidUpdate(e){const{activeTool:t,layout:n}=this.props;n!==e.layout&&(this.stopListening(e.layout),this.startListening(n)),t!==e.activeTool&&(this.updateSelectionValidators(),t===$t.DEFAULT&&this.reset())}componentDidCatch(e,t){gt.error("componentDidCatch",e,t)}componentWillUnmount(){const{layout:e}=this.props;this.stopListening(e)}startListening(e){e.on("stateChanged",this.handleLayoutStateChanged);const{eventHub:t}=e;t.on(Cn.COLUMN_SELECTED,this.handleGridColumnSelect),t.on(Cn.DATA_SELECTED,this.handleUpdateValues),t.on(Cn.STATE_CHANGED,this.handleStateChange),t.on(wl.COLUMN_SELECTED,this.handleChartColumnSelect),t.on(Ee.CLONED,this.handlePanelCloned),t.on(Je.COLUMN_SELECTED,this.handleFilterColumnSelect),t.on(Je.COLUMNS_CHANGED,this.handleColumnsChanged),t.on(Ee.CLOSE,this.handlePanelClosed),t.on(Ee.CLOSED,this.handlePanelClosed),t.on(Ee.DRAGGING,this.handlePanelDragging),t.on(Ee.DROPPED,this.handlePanelDropped)}stopListening(e){e.off("stateChanged",this.handleLayoutStateChanged);const{eventHub:t}=e;t.off(Cn.COLUMN_SELECTED,this.handleGridColumnSelect),t.off(Cn.DATA_SELECTED,this.handleUpdateValues),t.off(Cn.STATE_CHANGED,this.handleStateChange),t.off(wl.COLUMN_SELECTED,this.handleChartColumnSelect),t.off(Ee.CLONED,this.handlePanelCloned),t.off(Je.COLUMN_SELECTED,this.handleFilterColumnSelect),t.off(Je.COLUMNS_CHANGED,this.handleColumnsChanged),t.off(Ee.CLOSE,this.handlePanelClosed),t.off(Ee.CLOSED,this.handlePanelClosed),t.off(Ee.DRAGGING,this.handlePanelDragging),t.off(Ee.DROPPED,this.handlePanelDropped)}reset(){this.setState({linkInProgress:void 0,selectedIds:new Set})}handleCancel(){const{linkInProgress:e}=this.state;if(e==null){const{setActiveTool:t}=this.props;t($t.DEFAULT)}this.setState({linkInProgress:void 0})}handleDone(){const{setActiveTool:e}=this.props;e($t.DEFAULT)}handleChartColumnSelect(e,t){this.columnSelected(e,t,!0)}handleFilterColumnSelect(e,t){gt.debug("handleFilterColumnSelect",this.isOverlayShown());const{links:n,localDashboardId:s,setActiveTool:i,setDashboardIsolatedLinkerPanelId:o}=this.props,a=K.getIdFromPanel(e),r=n.filter(c=>c.start?.panelId===a||c.end?.panelId===a);if(!this.isOverlayShown()&&a!=null){i($t.LINKER),o(s,a),r.length===0&&this.columnSelected(e,t,!0,a);return}this.columnSelected(e,t,!0)}handleColumnsChanged(e,t){gt.debug("handleColumnsChanged",e,t);const{links:n}=this.props,s=K.getIdFromPanel(e);if(s==null){gt.error("Invalid panelId",e);return}const i=n.filter(({start:o,end:a})=>o.panelId===s&&yi.findColumn(t,o)==null||a!=null&&a.panelId===s&&yi.findColumn(t,a)==null);this.deleteLinks(i)}handleGridColumnSelect(e,t){if(!fh(t)){gt.debug2("Column is not filterable");return}this.columnSelected(e,t)}columnSelected(e,t,n=!1,s){if(s===void 0&&!this.isOverlayShown())return;const{isolatedLinkerPanelId:i}=this.props,{linkInProgress:o}=this.state,a=K.getIdFromPanel(e);if(a==null)return;const r=K.getComponentNameFromPanel(e),{name:c,type:h}=t;if(o==null||o.start==null){const u={id:je.generate(),start:{panelId:a,panelComponent:r,columnName:c,columnType:h},type:"invalid",isReversed:n};gt.debug("starting link",u),this.setState({linkInProgress:u})}else{const{links:u}=this.props,{start:m,id:g,isReversed:p}=o,C={panelId:a,panelComponent:r,columnName:c,columnType:h},f=yi.getLinkType(p!==void 0&&p?C:m,p!==void 0&&p?m:C,s??i);switch(f){case"invalid":gt.debug("Ignore invalid link connection",o,C);return;case"filterSource":{const v=p!==void 0&&p?m.panelId:C.panelId,w=u.filter(({end:T})=>T?.panelId===v);this.deleteLinks(w);break}case"chartLink":{const v=p===!0?m:C,w=p===!0?C:m;gt.debug("creating chartlink",{existingLinkEnd:v,start:m,end:C});const T=u.filter(({end:y,start:E})=>E?.panelId===w.panelId&&y?.panelId===v.panelId&&y?.columnName===v.columnName&&y?.columnType===v.columnType);this.deleteLinks(T);break}}const S={start:p!==void 0&&p?C:m,end:p!==void 0&&p?m:C,id:g,type:f,operator:q.eq};gt.info("creating link",S),this.setState({linkInProgress:void 0,selectedIds:new Set([g])},()=>{this.addLinks([S])})}}unsetFilterValueForLink(e){const{panelManager:t}=this.props;if(e.end){const{end:n}=e,{panelId:s,columnName:i,columnType:o}=n,a=t.getOpenedPanelById(s);a?ph(a)?a.unsetFilterValue(i,o):gt.debug("endPanel.unsetFilterValue not implemented",a):gt.debug("endPanel no longer exists, ignoring unsetFilterValue",s)}}setPanelFilterMap(e,t){gt.debug("Set filter data for panel:",e,t);const{panelManager:n}=this.props,s=n.getOpenedPanelById(e);s?ph(s)?s.setFilterMap(t):gt.debug("panel.setFilterMap not implemented",e,s):gt.debug("panel no longer exists, ignoring setFilterMap",e)}addLinks(e){const{addDashboardLinks:t,localDashboardId:n}=this.props;t(n,e)}deleteLinks(e,t=!1){const{localDashboardId:n}=this.props;if(e.forEach(s=>this.unsetFilterValueForLink(s)),t){const{setDashboardLinks:s}=this.props;s(n,[])}else if(e.length>0){const{deleteDashboardLinks:s}=this.props;s(n,e.map(({id:i})=>i))}}handleAllLinksDeleted(){const{links:e,isolatedLinkerPanelId:t}=this.props;if(t===void 0)this.deleteLinks(e,!0);else{const n=e.filter(s=>s?.start?.panelId===t||s?.end?.panelId===t);this.deleteLinks(n)}this.reset()}handleLinkDeleted(e){const{links:t}=this.props,n=t.find(s=>s.id===e);n?this.deleteLinks([n]):gt.error("Unable to find link to delete",e)}handleUpdateValues(e,t){const n=K.getIdFromPanel(e),{links:s,timeZone:i}=this.props,o=new Map;for(let a=0;a<s.length;a+=1){const{start:r,end:c,operator:h}=s[a];if(r.panelId===n&&c!=null){const{panelId:u,columnName:m,columnType:g}=c,p=o.has(u)?o.get(u):new Map,C=p.has(m)===!0?p.get(m).filterList:[],{visibleIndex:f,isExpandable:S,isGrouped:v}=t[r.columnName];let{value:w}=t[r.columnName],T=`${w}`;w===null&&S&&v&&(w=void 0),g!=null&&R.isDateType(g)&&(T=new He({timeZone:i,showTimeZone:!1,showTSeparator:!0,defaultDateTimeFormatString:it.FULL_DATE_FORMAT}).format(w));const y={operator:h,text:T,value:w,startColumnIndex:f};C.push(y),p.set(m,{columnType:g,filterList:C}),o.set(u,p)}}o.forEach((a,r)=>{this.setPanelFilterMap(r,a)})}handlePanelCloned(e,t){const{links:n}=this.props,s=K.getIdFromPanel(e),i=t.id;if(s!=null){const o=yi.cloneLinksForPanel(n,s,i);this.addLinks(o)}}handlePanelDragging(e){const{links:t}=this.props;for(let n=0;n<t.length;n+=1){const s=t[n],{start:i,end:o}=s;if(i.panelId===e||o?.panelId===e){this.setState({isDraggingPanel:!0});return}}}handlePanelDropped(){this.setState({isDraggingPanel:!1})}handlePanelClosed(e){gt.debug(`Panel ${e} closed, deleting links.`),this.deleteLinksForPanelId(e)}handleLinkSelected(e){this.setState({selectedIds:new Set([e])})}handleLinksUpdated(e){const{localDashboardId:t,setDashboardLinks:n}=this.props;n(t,e)}handleLayoutStateChanged(){this.forceUpdate()}handleStateChange(){this.forceUpdate()}handleExited(){const{localDashboardId:e,setDashboardIsolatedLinkerPanelId:t}=this.props;t(e,void 0)}deleteLinksForPanelId(e){const{links:t}=this.props;for(let n=0;n<t.length;n+=1){const s=t[n],{start:i,end:o,id:a}=s;(i.panelId===e||o?.panelId===e)&&this.handleLinkDeleted(a)}}getCachedLinks=pe((e,t,n)=>{const s=[...e];return t!=null&&t.start!=null&&s.push(t),n!==void 0?s.filter(i=>i?.start?.panelId===n||i?.end?.panelId===n||i?.end==null):s});isOverlayShown(){const{activeTool:e}=this.props;return e===$t.LINKER}updateSelectionValidators(){const{activeTool:e,setDashboardColumnSelectionValidator:t,localDashboardId:n}=this.props;switch(e){case $t.LINKER:t(n,this.isColumnSelectionValid);break;default:t(n,void 0);break}}updateLinkInProgressType(e="invalid"){this.setState(({linkInProgress:t})=>t!==void 0?{linkInProgress:{...t,type:e}}:null)}isColumnSelectionValid(e,t){const{linkInProgress:n}=this.state,{isolatedLinkerPanelId:s}=this.props;if(t==null)return n?.start!=null&&this.updateLinkInProgressType(),!1;if(!fh(t))return gt.debug2("Column is not filterable",t.description),n?.start!=null&&this.updateLinkInProgressType("invalid"),!1;if(n?.start==null)return!0;const{isReversed:i,start:o}=n,a=K.getIdFromPanel(e);if(a==null)return!1;const r={panelId:a,panelComponent:K.getComponentNameFromPanel(e),columnName:t.name,columnType:t.type},c=i!==void 0&&i?yi.getLinkType(r,o,s):yi.getLinkType(o,r,s);return this.updateLinkInProgressType(c),c!=="invalid"}render(){const{links:e,isolatedLinkerPanelId:t,panelManager:n}=this.props,{linkInProgress:s,selectedIds:i,isDraggingPanel:o}=this.state,a=this.isOverlayShown(),r=s!=null&&s.start!=null,c=t===void 0?"Click a column source, then click a column target to create a filter link. The filter comparison operator used by a selected link can be changed. Delete a filter link by clicking the delete button or with alt+click. Click done when finished.":"Create a link between the source column button and a table column by clicking on one, then the other. Delete a filter link by clicking the delete button or with alt+click. Click done when finished.";return o?null:l.jsx(Ct,{in:a,timeout:qe.transitionMs,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,onExited:this.handleExited,children:l.jsx(kI,{disabled:r,panelManager:n,links:this.getCachedLinks(e,s,t),selectedIds:i,messageText:c,onLinkSelected:this.handleLinkSelected,onLinkDeleted:this.handleLinkDeleted,onAllLinksDeleted:this.handleAllLinksDeleted,onLinksUpdated:this.handleLinksUpdated,onDone:this.handleDone,onCancel:this.handleCancel})})}}const PI=OI(LI),_I=PI;function jI(d){Ls(d);const{id:e,layout:t,panelManager:n}=d;return l.jsx(_I,{layout:t,localDashboardId:e,panelManager:n})}class tr{static DEFAULT_TITLE="Note";static DEFAULT_CONTENT=`# Markdown Note
37
37
 
38
- This note can be edited using **markdown** for styling.`;static getNewMarkdownTitle(e){let t=`${tr.DEFAULT_TITLE}`,n=0;for(;e.indexOf(t)>=0;)n+=1,t=`${tr.DEFAULT_TITLE}-${n}`;return t}}const tl=tr;function HI(d){Ls(d);const{id:e,layout:t,panelManager:n,registerComponent:s}=d,i=b.useCallback(a=>{const{title:r,componentState:c,props:h}=a;let{panelState:u=null}=h;return c!=null&&({panelState:u=null}=c),r==null||u==null||u.content==null||u.content.length===0||u.content===tl.DEFAULT_CONTENT?null:ac(a)},[]),o=b.useCallback(({title:a="",metadata:r={},id:c=je.generate(),focusElement:h=K.DEFAULT_FOCUS_SELECTOR,createNewStack:u=!1,dragEvent:m=null}={})=>{const g=n.getOpenedPanelConfigsOfType(ro.COMPONENT),p=n.getClosedPanelConfigsOfType(ro.COMPONENT),C=g.map(T=>T.title??""),f=a!=null&&a!==""?a:tl.getNewMarkdownTitle(C),S=p.length>0?null:tl.DEFAULT_CONTENT,v={type:"react-component",component:ro.COMPONENT,props:{id:c,metadata:r,panelState:{content:S},localDashboardId:e},title:f,id:c},{root:w}=t;K.openComponent({root:w,config:v,focusElement:h,createNewStack:u,dragEvent:m})},[e,t,n]);return b.useEffect(function(){const r=[s(ro.COMPONENT,ro,rc,i)];return()=>{r.forEach(c=>c())}},[i,s]),Ge(t.eventHub,Im.OPEN,o),null}function VI(d){Ls(d);const{hydrate:e,id:t,layout:n,registerComponent:s}=d,i=b.useCallback(({dragEvent:o,fetch:a,panelId:r=je.generate(),widget:c})=>{const{name:h,type:u}=c;if(u!==dh.VariableType.PANDAS)return;const m={name:h,table:h},g=()=>a().then(f=>vc.makeModel(f)),p={type:"react-component",component:Jr.COMPONENT,props:{localDashboardId:t,id:r,metadata:m,makeModel:g},title:h,id:r},{root:C}=n;K.openComponent({root:C,config:p,dragEvent:o})},[t,n]);return b.useEffect(function(){const a=[s(Jr.COMPONENT,Jr,e)];return()=>{a.forEach(r=>r())}},[e,s]),Ge(n.eventHub,Ee.OPEN,i),null}class BI{static DROPDOWN_FILTER="ControlType.DROPDOWN_FILTER";static INPUT_FILTER="ControlType.INPUT_FILTER";static MARKDOWN="ControlType.MARKDOWN";static FILTER_SET_MANAGER="ControlType.FILTER_SET_MANAGER"}const Fs=BI;class Th{static makeSortConfig(e,t){return{column:e,direction:t}}static makeFilterConfig(e){const t=[],n=[];return e.forEach((s,i)=>{t.push(s),i>0&&n.push(Sn.and)}),{filterItems:t,filterOperators:n}}static combineFilterConfigs(e,t,n=Sn.and){return{filterItems:[...e.filterItems,...t.filterItems],filterOperators:[...e.filterOperators,n,...t.filterOperators]}}static makeFilterItem(e,t,n){return{columnName:e,type:t,value:n}}}function $I(d,e,t){if(d.length>e){const n=d.length-t;return{toKeep:d.slice(n),toPrune:d.slice(0,n)}}return{toKeep:d,toPrune:[]}}const nl=X.module("PouchStorageTable"),UI="Deephaven.";kh.plugin(wg);function WI(d,e){switch(d){case q.in:case q.contains:return{$regex:new RegExp(`${e}`)};case q.inIgnoreCase:return{$regex:new RegExp(`${e}`,"i")};case q.eq:return{$eq:e};case q.notEq:return{$neq:e};case q.greaterThan:return{$gt:e};case q.greaterThanOrEqualTo:return{$gte:e};case q.lessThan:return{$lt:e};case q.lessThanOrEqualTo:return{$lte:e};case q.startsWith:return{$regex:new RegExp(`^(?${e}).*`)};default:throw new Error(`Unsupported type: ${d}`)}}function GI(d){const{filterItems:e,filterOperators:t}=d;let n=null;for(let s=0;s<e.length;s+=1){const i=e[s],{columnName:o,type:a,value:r}=i,c={[o]:WI(a,r)};if(s===0)n=c;else if(n!==null&&s-1<t.length){const h=t[s-1];if(h===Sn.and)n={$and:[n,c]};else if(h===Sn.or)n={$or:[n,c]};else throw new Error(`Unexpected filter operator ${h}, ${c}`)}}if(n==null)throw new Error(`Invalid filter config ${d}`);return n}function sl(d=[]){return{$and:[...d.map(e=>GI(e)),{name:{$gt:null}},{id:{$gt:null}}]}}function zI(d,e=!1){return[{id:e?"desc":"asc"},...d?.map(t=>({[t.column]:t.direction}))??[]]}class KI{db;changes;listeners=[];itemListeners=new Map;currentSize=0;currentViewport;currentReverse=!1;currentFilter=null;currentSort=null;infoUpdatePromise;viewportUpdatePromise;currentViewportData;constructor(e,t){this.db=new kh(`${UI}${e}`,t),this.db._remote=!1,this.listenForChanges(),this.db.createIndex({index:{fields:["id","name"]}}),this.refreshInfo()}listenForChanges(){this.changes=this.db.changes({live:!0,since:"now",include_docs:!0}).on("change",this.dbUpdate.bind(this))}onUpdate(e){return this.listeners=[...this.listeners,e],()=>{this.listeners=this.listeners.filter(t=>t!==e)}}onItemUpdate(e,t){return this.itemListeners.has(e)||this.itemListeners.set(e,[]),this.itemListeners.set(e,[...this.itemListeners.get(e),t]),this.refreshItem(e),()=>{this.itemListeners.set(e,this.itemListeners.get(e).filter(n=>n!==t))}}close(){this.listeners=[]}get size(){return this.currentSize}get viewport(){return this.currentViewport}setReversed(e){this.currentReverse=e,this.currentViewportData=void 0,this.refreshData()}setViewport(e){this.currentViewport=e,this.refreshInfo(),this.refreshData()}setSorts(e){this.currentSort=e,this.currentViewportData=void 0,this.refreshData()}setFilters(e){this.currentFilter=e,this.currentViewportData=void 0,this.refreshInfo(),this.refreshData()}get data(){return this.currentViewportData}async getViewportData(){return this.viewportUpdatePromise||this.refreshData(),this.viewportUpdatePromise??Promise.resolve({items:[],offset:0})}async put(e){const t={...e,_id:e.id};return await this.db.put(t),t}sendUpdate(){const{listeners:e}=this,t=this.currentViewportData??{items:[],offset:0};for(let n=0;n<e.length;n+=1)e[n](t)}sendItemUpdate(e){const t=this.itemListeners.get(e.id);if(t!==void 0)for(let n=0;n<t.length;n+=1)t[n](e)}dbUpdate(e){nl.debug("Update received",e),this.refreshInfo(),e.doc!==void 0&&this.sendItemUpdate(e.doc),this.refreshData()}async fetchInfo(e){return this.db.find({selector:e,fields:[]})}async refreshInfo(){try{this.infoUpdatePromise?.cancel(),this.infoUpdatePromise=we.makeCancelable(this.fetchInfo(sl(this.currentFilter??[])));const e=await this.infoUpdatePromise;this.currentSize=e.docs.length,this.sendUpdate()}catch(e){if(!we.isCanceled(e))throw nl.error("Unable to refreshInfo",e),e}}async fetchViewportData(e,t,n){return this.db.find({selector:t,skip:e.top,limit:e.bottom-e.top+1,sort:n,fields:["id","name"]}).then(s=>({items:s.docs,offset:e.top}))}async refreshData(){if(this.currentViewport)try{const e=sl(this.currentFilter??[]),t=zI(this.currentSort,this.currentReverse);this.viewportUpdatePromise?.cancel(),this.viewportUpdatePromise=we.makeCancelable(this.fetchViewportData(this.currentViewport,e,t));const n=await this.viewportUpdatePromise;return this.currentViewportData=n,this.sendUpdate(),n}catch(e){if(!we.isCanceled(e))throw nl.error("Unable to refreshData",e),e}}async refreshItem(e){const n=(await this.db.find({selector:{id:e},limit:1})).docs[0];return n!==void 0&&this.sendItemUpdate(n),n}async getSnapshot(e){const t=new Map,n=[{id:this.currentReverse?"desc":"asc"}];return await Promise.all(e.map(async([s,i])=>{const o=i-s+1;return this.db.find({selector:sl(this.currentFilter??[]),skip:s,limit:o,sort:n,fields:["id","name"]}).then(a=>{for(let r=0;r<o;r+=1){const c=s+r;t.set(c,a.docs[r])}})})),t}}const qI=KI,YI=2500,XI=2e3,rn=X.module("PouchCommandHistoryTable");class ZI extends qI{constructor(e,t){super(`CommandHistoryStorage.${e}`,{auto_compaction:!0,revs_limit:1}),this.cache=t,this.cache.tableRegistry.has(this.cacheKey)||this.cache.tableRegistry.set(this.cacheKey,new Set),rn.debug("Adding table to registry",this.cacheKey),this.cache.tableRegistry.get(this.cacheKey)?.add(this)}searchText;get cacheKey(){return this.db.name}setSearch(e){rn.debug("Setting search filters",e),this.searchText=e.trim().toLowerCase(),this.setFilters(e?[Th.makeFilterConfig([Th.makeFilterItem("name",q.contains,e)])]:[])}dbUpdate(e){rn.debug("Clearing cache and refreshing data",e),this.cache.response.delete(this.cacheKey),super.dbUpdate(e)}async fetchData(e){return we.withTimeout(0,async()=>{this.cache.response.has(this.cacheKey)?rn.debug("Fetching from cache",this.searchText,this.viewport):(rn.debug("Fetching from PouchDB",this.searchText,this.viewport),this.cache.response.set(this.cacheKey,this.db.allDocs({include_docs:!0}).then(n=>{const s=n.rows.map(a=>a.doc).filter(({name:a})=>a);rn.debug(`Fetched ${s.length} command history items`);const{toKeep:i,toPrune:o}=$I(s,YI,XI);return o.length&&this.pruneItems(o),{docs:i}})));const t=this.cache.response.get(this.cacheKey);return this.searchText==null||this.searchText===""?t:{...t,docs:(await t).docs.filter(({name:n})=>n.toLowerCase().includes(this.searchText))}})}async fetchInfo(e){return this.fetchData(e)}async fetchViewportData(e,t,n){const s=await this.fetchData(t);return rn.debug("Fetching viewport data",e.top,e.bottom+1,n,s),{items:(typeof n[0]=="object"&&n[0].id==="desc"?s.docs.slice(0).reverse():s.docs).slice(e.top,e.bottom+1),offset:e.top}}async pruneItems(e){if(this.cache.isPruning.get(this.cacheKey)===!0){rn.debug("Pruning already in progress. Skipping.");return}try{rn.debug(`Pruning ${e.length} command history items`);const t=this.cache.pauseChangeListeners(this.cacheKey);this.cache.isPruning.set(this.cacheKey,!0),await this.db.bulkDocs(e.map(n=>({...n,_deleted:!0}))),this.cache.isPruning.set(this.cacheKey,!1),t(),rn.debug("Finished pruning command history items")}catch(t){rn.error("An error occurred while pruning db",t)}}close(){rn.debug("Closing table",this,this.cache.tableRegistry.get(this.cacheKey)?.size),this.cache.tableRegistry.get(this.cacheKey)?.delete(this),this.changes?.cancel(),super.close()}}const Eh=ZI,yh=X.module("PouchCommandHistoryCache");class QI{constructor(){this.isPruning=new Map,this.response=new Map,this.tableRegistry=new Map}isPruning;response;tableRegistry;pauseChangeListeners(e){const t=[];return this.tableRegistry.get(e)?.forEach(n=>{n.changes&&(yh.debug(`Pausing event listeners on '${e}' table`,n),n.changes.cancel(),t.push(n))}),()=>{t.forEach(n=>{(this.tableRegistry.get(e)?.has(n)??!1)&&(yh.debug(`Resuming event listeners on '${e}' table`,n),n.listenForChanges())})}}}const JI=QI,xh=X.module("PouchCommandHistoryStorage");class eD{cache=new JI;updateTableMap=new Map;getUpdateTable(e){return this.updateTableMap.has(e)||this.updateTableMap.set(e,new Eh(e,this.cache)),this.updateTableMap.get(e)}async getTable(e){return new Eh(e,this.cache)}async addItem(e,t,n,s){return this.updateItem(e,{id:`${new Date().getTime()}`,name:n,data:s})}async updateItem(e,t){const n=this.getUpdateTable(e),i={...await n.refreshItem(t.id)??{},...t};return xh.debug("Updating item",i),await n.put(i),xh.debug("Update saved"),t}listenItem(e,t,n){return this.getUpdateTable(e).onItemUpdate(t,n)}}const _m="SET_LAYOUT_STORAGE",tD=d=>({type:_m,payload:d}),jm="/ide/assets/community-wordmark-app-d2c5c1eb.svg";const nD=X.module("FormattingSectionContent");function sD(d){return d.formatString!=null}function yl(d){const e=d?.querySelector("input, select, textarea");e&&e.focus()}function Hm(d,e){return d.defaultFormatString===e.defaultFormatString}function iD(d,e){return Hm(d,e)}function oD(d,e){return Hm(d,e)}function Vm(d){return d!==""&&Gi.isValidColumnName(d)}function Ns(d,e){if(!d||e.formatString==null||!sD(e))return!1;switch(d){case"datetime":return He.isValid(e);case"decimal":return xe.isValid(e);case"int":return Ke.isValid(e);default:return nD.warn("Trying to validate format of unknown type"),!0}}function Bm(d){const{id:e,isNewRule:t,...n}=d;return n}function $m(d){return Vm(d.columnName)&&Ns(d.columnType,d.format)}function Um(d){const{timestamp:e,timeZone:t,showTimeZone:n,showTSeparator:s,isGlobalOptions:i,legacyGlobalFormat:o}=d,a=new Qt([],{timeZone:t,showTimeZone:n,showTSeparator:s}),r=i?He.getGlobalFormats(n,s):He.getFormats(n,s);return o!=null&&!r.includes(o)&&r.unshift(o),l.jsx(l.Fragment,{children:r.map(c=>{const h=He.makeFormat("",c,He.TYPE_GLOBAL);return l.jsx("option",{value:c,"data-testid":"time-format",children:a.getFormattedString(e,R.dataType.DATETIME,"",h)},c)})})}function aD(){return l.jsx(l.Fragment,{children:cr.TIME_ZONES.map(d=>{const{label:e,value:t}=d;return l.jsx("option",{value:t,children:e},t)})})}const Ks=X.module("FormattingSectionContent");class Oc extends b.PureComponent{static defaultProps={scrollTo:()=>{},defaults:{defaultDateTimeFormat:He.DEFAULT_DATETIME_FORMAT_STRING,defaultDecimalFormatOptions:{defaultFormatString:xe.DEFAULT_FORMAT_STRING},defaultIntegerFormatOptions:{defaultFormatString:Ke.DEFAULT_FORMAT_STRING},showTimeZone:!1,showTSeparator:!0,timeZone:He.DEFAULT_TIME_ZONE_ID}};static inputDebounceTime=250;constructor(e){super(e),this.debouncedCommitChanges=Xe(this.commitChanges.bind(this),Oc.inputDebounceTime),this.handleDefaultDateTimeFormatChange=this.handleDefaultDateTimeFormatChange.bind(this),this.handleDefaultDecimalFormatChange=this.handleDefaultDecimalFormatChange.bind(this),this.handleDefaultIntegerFormatChange=this.handleDefaultIntegerFormatChange.bind(this),this.handleShowTimeZoneChange=this.handleShowTimeZoneChange.bind(this),this.handleShowTSeparatorChange=this.handleShowTSeparatorChange.bind(this),this.handleTimeZoneChange=this.handleTimeZoneChange.bind(this),this.handleResetDateTimeFormat=this.handleResetDateTimeFormat.bind(this),this.handleResetDecimalFormat=this.handleResetDecimalFormat.bind(this),this.handleResetIntegerFormat=this.handleResetIntegerFormat.bind(this),this.handleResetTimeZone=this.handleResetTimeZone.bind(this),this.handleTruncateNumbersWithPoundChange=this.handleTruncateNumbersWithPoundChange.bind(this);const{formatter:t,defaultDateTimeFormat:n,defaultDecimalFormatOptions:s,defaultIntegerFormatOptions:i,showTimeZone:o,showTSeparator:a,timeZone:r,truncateNumbersWithPound:c}=e,h=t.map((u,m)=>({...u,id:m}));this.containerRef=ee.createRef(),this.state={formatSettings:h,showTimeZone:o,showTSeparator:a,timeZone:r,defaultDateTimeFormat:n,defaultDecimalFormatOptions:s,defaultIntegerFormatOptions:i,truncateNumbersWithPound:c,timestampAtMenuOpen:new Date}}componentDidMount(){yl(this.containerRef.current)}componentWillUnmount(){this.debouncedCommitChanges.flush()}debouncedCommitChanges;containerRef;getCachedDateTimeFormatOptions=me((e,t,n,s=!1,i)=>{const{timestampAtMenuOpen:o}=this.state;return l.jsx(Um,{timestamp:o,timeZone:e,showTimeZone:t,showTSeparator:n,isGlobalOptions:s,legacyGlobalFormat:i})});handleDefaultDateTimeFormatChange(e){Ks.debug("handleDefaultDateTimeFormatChange",e.target.value),this.setState({defaultDateTimeFormat:e.target.value},()=>{this.debouncedCommitChanges()})}handleDefaultDecimalFormatChange(e){Ks.debug("handleDefaultDecimalFormatChange",e.target.value),this.setState({defaultDecimalFormatOptions:{defaultFormatString:e.target.value}},()=>{this.debouncedCommitChanges()})}handleDefaultIntegerFormatChange(e){Ks.debug("handleDefaultIntegerFormatChange",e.target.value),this.setState({defaultIntegerFormatOptions:{defaultFormatString:e.target.value}},()=>{this.debouncedCommitChanges()})}handleShowTimeZoneChange(){this.setState(e=>({showTimeZone:!e.showTimeZone}),()=>{this.debouncedCommitChanges()})}handleShowTSeparatorChange(){this.setState(e=>({showTSeparator:!e.showTSeparator}),()=>{this.debouncedCommitChanges()})}handleTimeZoneChange(e){this.setState({timeZone:e.target.value},()=>{this.debouncedCommitChanges()})}handleResetDateTimeFormat(){const{defaults:e}=this.props,{defaultDateTimeFormat:t,showTimeZone:n,showTSeparator:s}=e;Ks.debug("handleResetDateTimeFormat"),this.setState({defaultDateTimeFormat:t,showTimeZone:n,showTSeparator:s},()=>{this.debouncedCommitChanges()})}handleResetTimeZone(){const{defaults:e}=this.props,{timeZone:t}=e;Ks.debug("handleResetTimeZone"),this.setState({timeZone:t},()=>{this.debouncedCommitChanges()})}handleResetDecimalFormat(){const{defaults:e}=this.props,{defaultDecimalFormatOptions:t}=e;Ks.debug("handleResetDecimalFormat"),this.setState({defaultDecimalFormatOptions:t},()=>{this.debouncedCommitChanges()})}handleResetIntegerFormat(){const{defaults:e}=this.props,{defaultIntegerFormatOptions:t}=e;Ks.debug("handleResetIntegerFormat"),this.setState({defaultIntegerFormatOptions:t},()=>{this.debouncedCommitChanges()})}handleTruncateNumbersWithPoundChange(){this.setState(e=>({truncateNumbersWithPound:!e.truncateNumbersWithPound}),()=>{this.debouncedCommitChanges()})}commitChanges(){const{formatSettings:e,defaultDateTimeFormat:t,showTimeZone:n,showTSeparator:s,timeZone:i,defaultDecimalFormatOptions:o,defaultIntegerFormatOptions:a,truncateNumbersWithPound:r}=this.state,c=e.filter($m).map(Bm)??[],{settings:h,saveSettings:u}=this.props,m={...h,formatter:c,defaultDateTimeFormat:t,showTimeZone:n,showTSeparator:s,timeZone:i,truncateNumbersWithPound:r};Ns(R.dataType.DECIMAL,xe.makeCustomFormat(o.defaultFormatString))&&(m.defaultDecimalFormatOptions=o),Ns(R.dataType.INT,Ke.makeCustomFormat(a.defaultFormatString))&&(m.defaultIntegerFormatOptions=a),u(m)}render(){const{defaults:e}=this.props,{defaultDateTimeFormat:t,defaultDecimalFormatOptions:n,defaultIntegerFormatOptions:s,timeZone:i,showTimeZone:o,showTSeparator:a,truncateNumbersWithPound:r}=this.state,{defaultFormatString:c=xe.DEFAULT_FORMAT_STRING}=n??{},{defaultFormatString:h=Ke.DEFAULT_FORMAT_STRING}=s??{},u=i===e.timeZone,m=a===e.showTSeparator&&o===e.showTimeZone&&t===e.defaultDateTimeFormat,g=iD(n,e.defaultDecimalFormatOptions),p=oD(s,e.defaultIntegerFormatOptions);return l.jsx("div",{className:"app-settings-formatting-section",ref:this.containerRef,children:l.jsxs("div",{className:"container-fluid p-0",children:[l.jsx("div",{className:"app-settings-menu-description mb-3",children:"Choose the default formatting rule to apply to all table columns based on their type."}),l.jsxs("div",{className:"form-row mb-2",children:[l.jsx("label",{className:"col-form-label col-3",htmlFor:"select-reset-timezone",children:"Time zone"}),l.jsx("div",{className:"col pr-0",children:l.jsx("select",{className:"custom-select",value:i,onChange:this.handleTimeZoneChange,id:"select-reset-timezone",children:l.jsx(aD,{})})}),l.jsx("div",{className:"col-1 btn-col",children:l.jsx(B,{kind:"ghost",icon:ti,onClick:this.handleResetTimeZone,tooltip:"Reset Time Zone",className:U("btn-reset","btn-reset-time-zone",{hidden:u})})})]}),l.jsxs("div",{className:"form-row mb-2",children:[l.jsx("label",{className:"col-form-label col-3",htmlFor:"select-default-time-format",children:"DateTime"}),l.jsx("div",{className:"col pr-0",children:l.jsx("select",{className:"custom-select",value:t,onChange:this.handleDefaultDateTimeFormatChange,id:"select-default-time-format",children:this.getCachedDateTimeFormatOptions(i,o,a,!0,t)})}),l.jsx("div",{className:"col-1 btn-col",children:l.jsx(B,{kind:"ghost",icon:ti,onClick:this.handleResetDateTimeFormat,tooltip:"Reset DateTime Options",className:U("btn-reset","btn-reset-date-time",{hidden:m})})})]}),l.jsx("div",{className:"form-row",children:l.jsx("div",{className:"offset-3 col-9",children:l.jsx(Zt,{checked:o??null,onChange:this.handleShowTimeZoneChange,children:"Show time zone in dates"})})}),l.jsx("div",{className:"form-row mb-3",children:l.jsx("div",{className:"offset-3 col-9",children:l.jsx(Zt,{checked:a??null,onChange:this.handleShowTSeparatorChange,children:"Show 'T' separator"})})}),l.jsxs("div",{className:"form-row mb-2",children:[l.jsx("label",{className:"col-form-label col-3",htmlFor:"default-decimal-format-input",children:"Decimal"}),l.jsx("div",{className:"col pr-0",children:l.jsx("input",{className:U("form-control","flex-grow-1","default-decimal-format-input",{"is-invalid":!Ns(R.dataType.DECIMAL,xe.makeCustomFormat(c))}),"data-lpignore":!0,placeholder:xe.DEFAULT_FORMAT_STRING,type:"text",id:"default-decimal-format-input",value:c,onChange:this.handleDefaultDecimalFormatChange})}),l.jsx("div",{className:"col-1 btn-col",children:l.jsx(B,{kind:"ghost",icon:ti,onClick:this.handleResetDecimalFormat,tooltip:"Reset Decimal Formatting",className:U("btn-reset","btn-reset-decimal",{hidden:g}),"data-testid":"btn-reset-decimal"})})]}),l.jsxs("div",{className:"form-row mb-2",children:[l.jsx("label",{className:"col-form-label col-3",htmlFor:"default-integer-format-input",children:"Integer"}),l.jsx("div",{className:"col pr-0",children:l.jsx("input",{className:U("form-control","flex-grow-1","default-integer-format-input",{"is-invalid":!Ns(R.dataType.INT,Ke.makeCustomFormat(h))}),"data-lpignore":!0,placeholder:Ke.DEFAULT_FORMAT_STRING,type:"text",id:"default-integer-format-input",value:h,onChange:this.handleDefaultIntegerFormatChange})}),l.jsx("div",{className:"col-1 btn-col",children:l.jsx(B,{kind:"ghost",icon:ti,onClick:this.handleResetIntegerFormat,tooltip:"Reset Integer Formatting",className:U("btn-reset","btn-reset-integer",{hidden:p}),"data-testid":"btn-reset-integer"})})]}),l.jsx("div",{className:"form-row mb-3",children:l.jsx("div",{className:"offset-3 col-9",children:l.jsx(Zt,{checked:r??null,onChange:this.handleTruncateNumbersWithPoundChange,children:"Truncate numbers with #"})})})]})})}}const rD=d=>({formatter:vu(d),defaultDateTimeFormat:Su(d),defaultDecimalFormatOptions:bu(d),defaultIntegerFormatOptions:wu(d),showTimeZone:Tu(d),showTSeparator:Eu(d),truncateNumbersWithPound:yu(d),timeZone:ko(d),settings:bt(d)}),lD=St(rD,{saveSettings:Cr})(Oc);function cD(){const[d,e]=b.useState(!1),t=()=>{e(!d)};return l.jsxs(B,{kind:"ghost",onClick:t,icon:xp,children:["Legal Notices",l.jsxs(Bi,{isOpen:d,toggle:t,className:"theme-bg-light",children:[l.jsx(Do,{toggle:t,children:"Legal Notice"}),l.jsxs($i,{children:[l.jsx("p",{children:"Deephaven software is protected by U.S. Patent Nos. 9,612,959; 9,613,018; 9,613,109; 9,619,210; 9,633,060; 9,639,570; 9,672,238; 9,679,006; 9,690,821; 9,710,511; 9,760,591; 9,805,084; 9,836,495; 9,836,494; 9,886,469; 9,898,496; 9,934,266; 10,002,153; 10,002,154; 10,002,155; 10,003,673; 10,019,138; 10,069,943; 10,176,211; 10,198,465; 10,198,466; 10,198,469; 10,212,257; 10,241,960; 10,241,965; 10,242,040; 10,242,041; 10,353,893; 10,346,394; 10,452,649; 10,496,639; 10,540,351; 10,552,412; 10,565,194; 10,565,206; 10,572,474; 10,621,168; 10,642,829; 10,657,184; 10,678,787; 10,691,686; and 10,783,191. Other patents pending."}),l.jsxs("p",{children:["© 2016-",new Date().getFullYear()," Deephaven Data Labs LLC. Patent Pending."]})]})]})]})}function To(d){const{children:e,isExpanded:t,sectionKey:n,title:s,onToggle:i}=d;return l.jsxs(l.Fragment,{children:[l.jsx("div",{children:l.jsxs(B,{kind:"ghost",className:"btn-collapse-trigger",onClick:()=>i(n),children:[l.jsx("div",{className:"flex-grow-1",children:s}),l.jsx("div",{className:"flex-shrink-0",children:l.jsx(Z,{transform:t?"flip-v":"",icon:Pn})})]})}),l.jsx(vf,{in:t,autoFocusOnShow:!0,children:e})]})}To.propTypes={children:M.node,isExpanded:M.bool.isRequired,sectionKey:M.string.isRequired,title:M.node.isRequired,onToggle:M.func};To.defaultProps={children:null,onToggle:()=>{}};function dD({shortcut:d,displayText:e,categoryName:t,onChange:n}){const[s,i]=b.useState(e),[o,a]=b.useState(d.getKeyState()),[r,c]=b.useState(!1),[h,u]=b.useState("");b.useEffect(function(){i(e),a(d.getKeyState())},[e,d]),b.useEffect(function(){i(Le.getDisplayText(o)),d.matchesKeyState(o)&&c(!1)},[o,d]),b.useEffect(function(){if(r){if(!Le.isValidKeyState(o)){Le.isAllowedKey(o.keyValue)?u("Must contain a modifier key"):u("Must contain an allowed action key");return}const T=Me.getConflictingShortcuts(o).filter(y=>y.id.startsWith(t)&&y!==d).map(y=>y.name);if(T.length){u(`Conflicts with ${T.join(", ")}`);return}u("")}else u("")},[r,o,t,d]);function m(w){if(w.stopPropagation(),w.preventDefault(),d.isEditable&&!w.repeat){const T=Le.getKeyStateFromEvent(w),y=Le.createKeyState([he.BACKSPACE]);Le.doKeyStatesMatch(T,y)?a(Le.NULL_KEY_STATE):a(T)}}function g(w){w.stopPropagation(),w.preventDefault(),d.matchesKeyState(o)||c(!0)}function p(){Be.disableAllActions()}function C(){Be.enableAllActions()}function f(){d.setKeyState(o),c(!1),n(d)}function S(){const w=d.getKeyState();a(w),c(!1)}function v(){c(!0),a(d.getDefaultKeyState())}return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"shortcut-item-container",children:[l.jsxs("label",{className:"shortcut-item-name",children:[d.name,d.tooltip!==void 0&&l.jsx(tt,{children:d.tooltip})]}),l.jsxs("div",{className:"shortcut-item-input-container",children:[l.jsx("input",{className:U("form-control",{"is-invalid":h}),onKeyDown:m,onKeyUp:g,onFocus:p,onBlur:C,disabled:!d.isEditable,value:s,readOnly:!0}),!Le.doKeyStatesMatch(o,d.getDefaultKeyState())&&!h&&l.jsx(B,{className:"reset-to-default-button",kind:"ghost",icon:l.jsx(Z,{icon:ti,transform:{rotate:90,flipX:!0}}),tooltip:"Reset to default",onClick:v})]})]}),r&&l.jsxs("div",{className:U("shortcut-item-message-container",{"is-invalid":h}),children:[l.jsx("div",{className:"shortcut-item-message",children:h}),l.jsxs("div",{className:"shortcut-item-message-buttons",children:[Le.isValidKeyState(o)&&l.jsx(B,{kind:"ghost",onClick:f,children:"Confirm"}),l.jsx(B,{kind:"ghost",onClick:S,children:"Undo"})]})]})]})}function hD({shortcutOverrides:d={},settings:e,saveSettings:t}){const n=b.useCallback(a=>{const r=Le.isMacPlatform,c={mac:{...d.mac},windows:{...d.windows}},h=r?c.mac:c.windows;a.forEach(u=>{u.isDefault()?delete h[u.id]:h[u.id]=u.getKeyState()}),t({...e,shortcutOverrides:c})},[e,t,d]);let s=Array.from(Me.shortcutsByCategory.entries()).map(([a,r])=>({name:a,shortcuts:r}));const i=s.findIndex(a=>a.name.toUpperCase()==="GLOBAL"),o=s.splice(i,1);return s=s.concat(o),l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"app-settings-menu-description",children:"Customize shortcuts below. To prevent unexpected results, avoid conflicting shortcuts with the browser or IDE editor."}),s.map(a=>l.jsx(uD,{name:a.name,shortcuts:a.shortcuts,saveShortcutOverrides:n},a.name))]})}function uD({name:d,shortcuts:e,saveShortcutOverrides:t}){function n(r){return r.split("_").map(c=>`${c[0].toUpperCase()}${c.slice(1).toLowerCase()}`).join(" ")}const[s,i]=b.useState(e);function o(r){const c=s.filter(u=>u!==r&&!u.isNull()&&u.matchesKeyState(r.getKeyState()));c.forEach(u=>u.setToNull());const h=[r,...c];t(h),i(u=>[...u])}const a=b.useMemo(()=>s.map(r=>r.getDisplayText()),[s]);return l.jsxs("div",{className:"mt-3",children:[l.jsx("div",{className:"font-weight-bold",children:n(d)}),s.map((r,c)=>l.jsx(dD,{shortcut:r,displayText:a[c],categoryName:d,onChange:o},r.id))]})}const mD=d=>({settings:bt(d),shortcutOverrides:db(d)}),gD={saveSettings:Cr},pD=St(mD,gD)(hD),fD="yyyy-MM-dd-HHmmss";function Wm(d,e="root",t=new Map([[d,""]])){const n={};return Object.entries(d).forEach(([s,i])=>{try{JSON.stringify(i),n[s]=i}catch{const a=i;if(typeof i=="bigint")n[s]=i.toString();else if(t.has(a))n[s]=`Circular ref to ${t.get(a)}`;else{const r=`${e}.${s}`;t.set(a,r),n[s]=Wm(i,r,t)}}}),n}function CD(){const d=tc.getState();return JSON.stringify(Wm(d),null,2)}function SD(d){const e={uiVersion:"0.37.0",userAgent:navigator.userAgent,...d};return JSON.stringify(e,null,2)}async function bD(d=`${x.i18n.DateTimeFormat.format(fD,new Date)}_support_logs`,e){const t=new Ah,n=t.folder(d);n.file("console.txt",Rp.getFormattedHistory()),n.file("redux.json",CD()),n.file("metadata.json",SD(e));const s=await t.generateAsync({type:"blob"}),i=document.createElement("a");i.href=URL.createObjectURL(s),i.download=`${d}.zip`,i.click()}const wD=[{value:R.dataType.DATETIME,label:"DateTime"},{value:R.dataType.DECIMAL,label:"Decimal"},{value:R.dataType.INT,label:"Integer"}];function vD(){const d=wD.map(e=>l.jsx("option",{value:e.value,children:e.label},`key-columnType-${e.value}`));return l.jsxs(l.Fragment,{children:[l.jsx("option",{disabled:!0,value:"",children:"Select Type"},"key-columnType-placeholder"),d]})}class Lc extends b.PureComponent{static defaultProps={scrollTo:()=>{},defaults:{defaultDateTimeFormat:He.DEFAULT_DATETIME_FORMAT_STRING,defaultDecimalFormatOptions:{defaultFormatString:xe.DEFAULT_FORMAT_STRING},defaultIntegerFormatOptions:{defaultFormatString:Ke.DEFAULT_FORMAT_STRING},showTimeZone:!1,showTSeparator:!0,timeZone:He.DEFAULT_TIME_ZONE_ID}};static inputDebounceTime=250;constructor(e){super(e),this.debouncedCommitChanges=Xe(this.commitChanges.bind(this),Lc.inputDebounceTime),this.handleFormatRuleEntered=this.handleFormatRuleEntered.bind(this),this.handleFormatRuleChange=this.handleFormatRuleChange.bind(this),this.handleFormatRuleCreate=this.handleFormatRuleCreate.bind(this),this.handleFormatRuleDelete=this.handleFormatRuleDelete.bind(this);const{formatter:t,defaultDateTimeFormat:n,defaultDecimalFormatOptions:s,defaultIntegerFormatOptions:i,showTimeZone:o,showTSeparator:a,timeZone:r,truncateNumbersWithPound:c}=e,h=t.map((u,m)=>({...u,id:m}));this.containerRef=ee.createRef(),this.addFormatRuleButtonRef=ee.createRef(),this.lastFormatRuleIndex=h.length,this.state={formatSettings:h,formatRulesChanged:!1,showTimeZone:o,showTSeparator:a,timeZone:r,defaultDateTimeFormat:n,defaultDecimalFormatOptions:s,defaultIntegerFormatOptions:i,truncateNumbersWithPound:c,timestampAtMenuOpen:new Date}}componentDidMount(){yl(this.containerRef.current)}componentWillUnmount(){this.debouncedCommitChanges.flush()}debouncedCommitChanges;containerRef;addFormatRuleButtonRef;lastFormatRuleIndex;isDuplicateRule(e){const{formatSettings:t}=this.state;return t.some(n=>n.id!==e.id&&n.columnName===e.columnName&&n.columnType===e.columnType)??!1}getAutoIncrementFormatRuleIndex(){const{lastFormatRuleIndex:e}=this;return this.lastFormatRuleIndex+=1,e}getCachedColumnTypeOptions=me(()=>l.jsx(vD,{}));getCachedDateTimeFormatOptions=me((e,t,n,s=!1,i)=>{const{timestampAtMenuOpen:o}=this.state;return l.jsx(Um,{timestamp:o,timeZone:e,showTimeZone:t,showTSeparator:n,isGlobalOptions:s,legacyGlobalFormat:i})});handleFormatRuleChange(e,t,n){this.setState(s=>{const{formatSettings:i}=s;N(i);const o=[...i];let a={};t==="columnType"&&(a={format:""});const r={...o[e],...a,[t]:n};return o[e]=r,{formatSettings:o}},()=>{this.debouncedCommitChanges()})}handleFormatRuleCreate(){this.setState(e=>{const{formatSettings:t}=e,n={columnType:R.dataType.DATETIME,columnName:"",format:{},id:this.getAutoIncrementFormatRuleIndex(),isNewRule:!0};return{formatSettings:[...t,n],formatRulesChanged:!0}})}handleFormatRuleDelete(e){this.setState(t=>{const{formatSettings:n}=t;return{formatSettings:n.filter((i,o)=>o!==e),formatRulesChanged:!0}},()=>{this.debouncedCommitChanges()})}handleFormatRuleEntered(e){this.scrollToFormatBlockBottom(),yl(e)}commitChanges(){const{formatSettings:e,defaultDateTimeFormat:t,showTimeZone:n,showTSeparator:s,timeZone:i,defaultDecimalFormatOptions:o,defaultIntegerFormatOptions:a,truncateNumbersWithPound:r}=this.state,c=e.filter($m).map(Bm)??[],{settings:h,saveSettings:u}=this.props,m={...h,formatter:c,defaultDateTimeFormat:t,showTimeZone:n,showTSeparator:s,timeZone:i,truncateNumbersWithPound:r};Ns(R.dataType.DECIMAL,xe.makeCustomFormat(o.defaultFormatString))&&(m.defaultDecimalFormatOptions=o),Ns(R.dataType.INT,Ke.makeCustomFormat(a.defaultFormatString))&&(m.defaultIntegerFormatOptions=a),u(m)}scrollToFormatBlockBottom(){const{scrollTo:e}=this.props;e(0,(this.addFormatRuleButtonRef.current?.offsetHeight??0)+(this.addFormatRuleButtonRef.current?.offsetTop??0))}getRuleError(e){const t={hasColumnNameError:!1,hasFormatError:!1,message:""},n=[];return e.isNewRule!==void 0&&e.isNewRule||(this.isDuplicateRule(e)&&(t.hasColumnNameError=!0,n.push("Duplicate column name/type combo.")),Vm(e.columnName)||(t.hasColumnNameError=!0,n.push("Column names must start with a letter or underscore and contain only alphanumeric characters or underscores.")),e.format.formatString!==void 0&&e.format.formatString.length===0?(t.hasFormatError=!0,n.push("Empty formatting rule.")):Ns(e.columnType,e.format)||(t.hasFormatError=!0,n.push("Invalid formatting rule.")),t.message=n.join(`
39
- `)),t}renderFormatRule(e,t){const n=`input-${e}-columnName`,s=`input-${e}-columnType`,i=`input-${e}-format`,o=this.getCachedColumnTypeOptions(),a=u=>this.handleFormatRuleChange(e,"columnName",u.target.value),r=()=>this.handleFormatRuleChange(e,"isNewRule",!1),c=u=>this.handleFormatRuleChange(e,"columnType",u.target.value),h=this.getRuleError(t);return l.jsxs("fieldset",{className:"container-fluid format-rule-container",children:[l.jsxs("div",{className:"form-row",children:[l.jsxs("div",{className:"form-group col-7 mb-2",children:[l.jsx("label",{htmlFor:n,children:"Column Name"}),l.jsx("input",{id:n,className:U("form-control",{"is-invalid":h.hasColumnNameError}),"data-lpignore":!0,type:"text",value:t.columnName,onChange:a,onBlur:r})]}),l.jsxs("div",{className:"form-group col mb-2",children:[l.jsx(B,{kind:"ghost",className:"btn-delete-format-rule float-right",tabIndex:-1,onClick:()=>this.handleFormatRuleDelete(e),icon:Jt,tooltip:"Delete","aria-label":"Delete Format Rule"}),l.jsx("label",{htmlFor:s,children:"Column Type"}),l.jsx("select",{id:s,className:"custom-select",value:t.columnType,onChange:c,children:o})]})]}),l.jsx("div",{className:"form-row",children:l.jsxs("div",{className:"form-group col-12 d-flex mb-2",children:[l.jsx("label",{className:"flex-shrink-0 col-form-label mr-3",htmlFor:i,children:"Formatting Rule"}),this.renderFormatRuleInput(e,t.columnType,i,t.format,h.hasFormatError)]})}),l.jsx("div",{className:"form-row",children:l.jsx("div",{className:"form-group col-12 d-flex mb-2",children:h.message&&l.jsx("p",{className:"text-danger",children:h.message})})})]},e)}renderFormatRuleInput(e,t,n,s,i){switch(R.getNormalizedType(t)){case R.dataType.DATETIME:return this.renderDateTimeFormatRuleInput(e,n,s,i);case R.dataType.DECIMAL:return this.renderDecimalFormatRuleInput(e,n,s,i);case R.dataType.INT:return this.renderIntegerFormatRuleInput(e,n,s,i);default:throw new Error(`Unrecognized column type: ${t}`)}}renderDateTimeFormatRuleInput(e,t,n,s){const{showTimeZone:i,showTSeparator:o,timeZone:a}=this.state,r=n.formatString??"";return l.jsxs("select",{className:U("custom-select",{"is-invalid":s}),value:r,id:t,onChange:c=>{const h=He.makeFormat("",c.target.value,He.TYPE_GLOBAL);this.handleFormatRuleChange(e,"format",h)},children:[l.jsx("option",{value:"",disabled:!0,children:"Select format"},"default"),this.getCachedDateTimeFormatOptions(a,i,o)]})}renderIntegerFormatRuleInput(e,t,n,s){const i=n.formatString??"";return l.jsx("input",{className:U("form-control","flex-grow-1",{"is-invalid":s}),"data-lpignore":!0,id:t,placeholder:Ke.DEFAULT_FORMAT_STRING,type:"text",value:i,onChange:o=>{const a=Ke.makeFormat("",o.target.value,Ke.TYPE_GLOBAL,void 0);this.handleFormatRuleChange(e,"format",a)}})}renderDecimalFormatRuleInput(e,t,n,s){const i=n.formatString??"";return l.jsx("input",{className:U("form-control","flex-grow-1",{"is-invalid":s}),"data-lpignore":!0,id:t,placeholder:xe.DEFAULT_FORMAT_STRING,type:"text",value:i,onChange:o=>{const a=xe.makeFormat("",o.target.value,xe.TYPE_GLOBAL,void 0);this.handleFormatRuleChange(e,"format",a)}})}render(){const{formatRulesChanged:e,formatSettings:t}=this.state,n=t.map((i,o)=>l.jsx(Ct,{classNames:"fade",timeout:qe.transitionMs,onEnter:this.handleFormatRuleEntered,children:this.renderFormatRule(o,i)},i.id)),s=l.jsx(B,{kind:"ghost",className:"mb-3",onClick:this.handleFormatRuleCreate,ref:this.addFormatRuleButtonRef,icon:As,children:"Add New Rule"});return l.jsxs("div",{className:"app-settings-formatting-section",ref:this.containerRef,children:[l.jsx("div",{className:"app-settings-menu-description mb-3",children:"Customize the formatting of table columns by applying rules based on matching both a column name and column type."}),l.jsx(vg,{appear:e,enter:e,exit:e,children:n}),s]})}}const TD=d=>({formatter:vu(d),defaultDateTimeFormat:Su(d),defaultDecimalFormatOptions:bu(d),defaultIntegerFormatOptions:wu(d),showTimeZone:Tu(d),showTSeparator:Eu(d),truncateNumbersWithPound:yu(d),timeZone:ko(d),settings:bt(d)}),ED=St(TD,{saveSettings:Cr})(Lc);class kn extends b.Component{static defaultProps={onDone:()=>{}};static FORMATTING_SECTION_KEY="SettingsMenu.formatting";static COLUMN_SPECIFIC_SECTION_KEY="SettingsMenu.columnFormatting";static APPLICATION_SECTION_KEY="ApplicationMenu.settings";static SHORTCUT_SECTION_KEY="SettingsMenu.shortcuts";static focusFirstInputInContainer(e){const t=e?.querySelector("input, select, textarea");t&&t.focus()}constructor(e){super(e),this.handleClose=this.handleClose.bind(this),this.handleScrollTo=this.handleScrollTo.bind(this),this.handleSectionToggle=this.handleSectionToggle.bind(this),this.handleExportSupportLogs=this.handleExportSupportLogs.bind(this),this.menuContentRef=ee.createRef(),this.state={expandedSectionKey:kn.FORMATTING_SECTION_KEY}}componentDidMount(){kn.focusFirstInputInContainer(this.menuContentRef.current)}menuContentRef;isSectionExpanded(e){const{expandedSectionKey:t}=this.state;return t===e}handleScrollTo(e,t){this.menuContentRef.current?.scrollTo(e,t)}handleSectionToggle(e){this.setState(t=>({expandedSectionKey:t.expandedSectionKey===e?void 0:e}))}handleClose(){const{onDone:e}=this.props;e()}handleExportSupportLogs(){const{serverConfigValues:e}=this.props;bD(void 0,Object.fromEntries(e))}render(){const e="0.37.0",t="https://github.com/deephaven/web-client-ui/",n="https://deephaven.io/core/docs/",{serverConfigValues:s}=this.props,i=s.get("barrage.version"),o=s.get("java.version"),a=s.get("deephaven.version"),r=(c,h)=>l.jsxs(l.Fragment,{children:[l.jsx("div",{children:c}),l.jsx("div",{children:h})]});return l.jsxs("div",{className:"app-settings-menu",children:[l.jsxs("header",{className:"app-settings-menu-header",children:[l.jsx("div",{className:"flex-spacer"}),l.jsx(B,{kind:"ghost",className:"btn-close-settings-menu",onClick:this.handleClose,icon:l.jsx(Z,{icon:Ui,transform:"grow-4"}),tooltip:"Close"})]}),l.jsxs("div",{className:"app-settings-menu-content",ref:this.menuContentRef,children:[l.jsx("h5",{children:"Settings"}),l.jsx("hr",{className:"my-0"}),l.jsx(To,{sectionKey:kn.FORMATTING_SECTION_KEY,isExpanded:this.isSectionExpanded(kn.FORMATTING_SECTION_KEY),title:l.jsxs(l.Fragment,{children:[l.jsx(Z,{icon:Ip,transform:"grow-4",className:"mr-2"}),"Default Format & Time zone"]}),onToggle:this.handleSectionToggle,children:l.jsx(lD,{})}),l.jsx(To,{sectionKey:kn.COLUMN_SPECIFIC_SECTION_KEY,isExpanded:this.isSectionExpanded(kn.COLUMN_SPECIFIC_SECTION_KEY),title:l.jsxs(l.Fragment,{children:[l.jsx(Z,{icon:Dp,transform:"grow-4",className:"mr-2"}),"Format by Column Name & Type"]}),onToggle:this.handleSectionToggle,children:l.jsx(ED,{scrollTo:this.handleScrollTo})}),l.jsx(To,{sectionKey:kn.SHORTCUT_SECTION_KEY,isExpanded:this.isSectionExpanded(kn.SHORTCUT_SECTION_KEY),title:l.jsxs(l.Fragment,{children:[l.jsx(Z,{icon:Fp,transform:"grow-2"})," ","Keyboard Shortcuts"]}),onToggle:this.handleSectionToggle,children:l.jsx(pD,{})}),l.jsxs("div",{className:"app-settings-footer",children:[l.jsxs("div",{className:"app-settings-footer-section",children:[l.jsxs("div",{className:"app-settings-footer-item",children:[l.jsx("div",{className:"font-weight-bold",children:"Support"}),l.jsxs("div",{children:["GitHub: ",l.jsx("a",{href:t,className:"custom-link",target:"_blank",rel:"noopener noreferrer",children:t})]}),l.jsx(B,{kind:"tertiary",className:"mt-2 py-2",onClick:this.handleExportSupportLogs,children:"Export Logs"})]}),l.jsxs("div",{className:"app-settings-footer-item",children:[l.jsx("div",{className:"font-weight-bold",children:"Documentation"}),l.jsx("a",{target:"_blank",rel:"noreferrer noopener",href:n,className:"custom-link",children:n})]}),l.jsxs("div",{className:"app-settings-footer-item",children:[l.jsx("div",{className:"font-weight-bold",children:"Version"}),l.jsxs("span",{className:"d-inline-block text-muted",children:[a," ",l.jsx(Z,{icon:Np}),l.jsxs(tt,{interactive:!0,children:[l.jsxs("div",{className:"detailed-server-config",children:[r("Engine Version",a),r("Web UI Version",e),r("Java Version",o),r("Barrage Version",i)]}),l.jsx(ur,{tooltip:"Copy version numbers",copy:`Engine Version: ${a}
38
+ This note can be edited using **markdown** for styling.`;static getNewMarkdownTitle(e){let t=`${tr.DEFAULT_TITLE}`,n=0;for(;e.indexOf(t)>=0;)n+=1,t=`${tr.DEFAULT_TITLE}-${n}`;return t}}const tl=tr;function HI(d){Ls(d);const{id:e,layout:t,panelManager:n,registerComponent:s}=d,i=b.useCallback(a=>{const{title:r,componentState:c,props:h}=a;let{panelState:u=null}=h;return c!=null&&({panelState:u=null}=c),r==null||u==null||u.content==null||u.content.length===0||u.content===tl.DEFAULT_CONTENT?null:ac(a)},[]),o=b.useCallback(({title:a="",metadata:r={},id:c=je.generate(),focusElement:h=K.DEFAULT_FOCUS_SELECTOR,createNewStack:u=!1,dragEvent:m=null}={})=>{const g=n.getOpenedPanelConfigsOfType(ro.COMPONENT),p=n.getClosedPanelConfigsOfType(ro.COMPONENT),C=g.map(T=>T.title??""),f=a!=null&&a!==""?a:tl.getNewMarkdownTitle(C),S=p.length>0?null:tl.DEFAULT_CONTENT,v={type:"react-component",component:ro.COMPONENT,props:{id:c,metadata:r,panelState:{content:S},localDashboardId:e},title:f,id:c},{root:w}=t;K.openComponent({root:w,config:v,focusElement:h,createNewStack:u,dragEvent:m})},[e,t,n]);return b.useEffect(function(){const r=[s(ro.COMPONENT,ro,rc,i)];return()=>{r.forEach(c=>c())}},[i,s]),Ge(t.eventHub,Im.OPEN,o),null}function VI(d){Ls(d);const{hydrate:e,id:t,layout:n,registerComponent:s}=d,i=b.useCallback(({dragEvent:o,fetch:a,panelId:r=je.generate(),widget:c})=>{const{name:h,type:u}=c;if(u!==dh.VariableType.PANDAS)return;const m={name:h,table:h},g=()=>a().then(f=>vc.makeModel(f)),p={type:"react-component",component:Jr.COMPONENT,props:{localDashboardId:t,id:r,metadata:m,makeModel:g},title:h,id:r},{root:C}=n;K.openComponent({root:C,config:p,dragEvent:o})},[t,n]);return b.useEffect(function(){const a=[s(Jr.COMPONENT,Jr,e)];return()=>{a.forEach(r=>r())}},[e,s]),Ge(n.eventHub,Ee.OPEN,i),null}class BI{static DROPDOWN_FILTER="ControlType.DROPDOWN_FILTER";static INPUT_FILTER="ControlType.INPUT_FILTER";static MARKDOWN="ControlType.MARKDOWN";static FILTER_SET_MANAGER="ControlType.FILTER_SET_MANAGER"}const Fs=BI;class Th{static makeSortConfig(e,t){return{column:e,direction:t}}static makeFilterConfig(e){const t=[],n=[];return e.forEach((s,i)=>{t.push(s),i>0&&n.push(Sn.and)}),{filterItems:t,filterOperators:n}}static combineFilterConfigs(e,t,n=Sn.and){return{filterItems:[...e.filterItems,...t.filterItems],filterOperators:[...e.filterOperators,n,...t.filterOperators]}}static makeFilterItem(e,t,n){return{columnName:e,type:t,value:n}}}function $I(d,e,t){if(d.length>e){const n=d.length-t;return{toKeep:d.slice(n),toPrune:d.slice(0,n)}}return{toKeep:d,toPrune:[]}}const nl=X.module("PouchStorageTable"),UI="Deephaven.";kh.plugin(wg);function WI(d,e){switch(d){case q.in:case q.contains:return{$regex:new RegExp(`${e}`)};case q.inIgnoreCase:return{$regex:new RegExp(`${e}`,"i")};case q.eq:return{$eq:e};case q.notEq:return{$neq:e};case q.greaterThan:return{$gt:e};case q.greaterThanOrEqualTo:return{$gte:e};case q.lessThan:return{$lt:e};case q.lessThanOrEqualTo:return{$lte:e};case q.startsWith:return{$regex:new RegExp(`^(?${e}).*`)};default:throw new Error(`Unsupported type: ${d}`)}}function GI(d){const{filterItems:e,filterOperators:t}=d;let n=null;for(let s=0;s<e.length;s+=1){const i=e[s],{columnName:o,type:a,value:r}=i,c={[o]:WI(a,r)};if(s===0)n=c;else if(n!==null&&s-1<t.length){const h=t[s-1];if(h===Sn.and)n={$and:[n,c]};else if(h===Sn.or)n={$or:[n,c]};else throw new Error(`Unexpected filter operator ${h}, ${c}`)}}if(n==null)throw new Error(`Invalid filter config ${d}`);return n}function sl(d=[]){return{$and:[...d.map(e=>GI(e)),{name:{$gt:null}},{id:{$gt:null}}]}}function zI(d,e=!1){return[{id:e?"desc":"asc"},...d?.map(t=>({[t.column]:t.direction}))??[]]}class KI{db;changes;listeners=[];itemListeners=new Map;currentSize=0;currentViewport;currentReverse=!1;currentFilter=null;currentSort=null;infoUpdatePromise;viewportUpdatePromise;currentViewportData;constructor(e,t){this.db=new kh(`${UI}${e}`,t),this.db._remote=!1,this.listenForChanges(),this.db.createIndex({index:{fields:["id","name"]}}),this.refreshInfo()}listenForChanges(){this.changes=this.db.changes({live:!0,since:"now",include_docs:!0}).on("change",this.dbUpdate.bind(this))}onUpdate(e){return this.listeners=[...this.listeners,e],()=>{this.listeners=this.listeners.filter(t=>t!==e)}}onItemUpdate(e,t){return this.itemListeners.has(e)||this.itemListeners.set(e,[]),this.itemListeners.set(e,[...this.itemListeners.get(e),t]),this.refreshItem(e),()=>{this.itemListeners.set(e,this.itemListeners.get(e).filter(n=>n!==t))}}close(){this.listeners=[]}get size(){return this.currentSize}get viewport(){return this.currentViewport}setReversed(e){this.currentReverse=e,this.currentViewportData=void 0,this.refreshData()}setViewport(e){this.currentViewport=e,this.refreshInfo(),this.refreshData()}setSorts(e){this.currentSort=e,this.currentViewportData=void 0,this.refreshData()}setFilters(e){this.currentFilter=e,this.currentViewportData=void 0,this.refreshInfo(),this.refreshData()}get data(){return this.currentViewportData}async getViewportData(){return this.viewportUpdatePromise||this.refreshData(),this.viewportUpdatePromise??Promise.resolve({items:[],offset:0})}async put(e){const t={...e,_id:e.id};return await this.db.put(t),t}sendUpdate(){const{listeners:e}=this,t=this.currentViewportData??{items:[],offset:0};for(let n=0;n<e.length;n+=1)e[n](t)}sendItemUpdate(e){const t=this.itemListeners.get(e.id);if(t!==void 0)for(let n=0;n<t.length;n+=1)t[n](e)}dbUpdate(e){nl.debug("Update received",e),this.refreshInfo(),e.doc!==void 0&&this.sendItemUpdate(e.doc),this.refreshData()}async fetchInfo(e){return this.db.find({selector:e,fields:[]})}async refreshInfo(){try{this.infoUpdatePromise?.cancel(),this.infoUpdatePromise=we.makeCancelable(this.fetchInfo(sl(this.currentFilter??[])));const e=await this.infoUpdatePromise;this.currentSize=e.docs.length,this.sendUpdate()}catch(e){if(!we.isCanceled(e))throw nl.error("Unable to refreshInfo",e),e}}async fetchViewportData(e,t,n){return this.db.find({selector:t,skip:e.top,limit:e.bottom-e.top+1,sort:n,fields:["id","name"]}).then(s=>({items:s.docs,offset:e.top}))}async refreshData(){if(this.currentViewport)try{const e=sl(this.currentFilter??[]),t=zI(this.currentSort,this.currentReverse);this.viewportUpdatePromise?.cancel(),this.viewportUpdatePromise=we.makeCancelable(this.fetchViewportData(this.currentViewport,e,t));const n=await this.viewportUpdatePromise;return this.currentViewportData=n,this.sendUpdate(),n}catch(e){if(!we.isCanceled(e))throw nl.error("Unable to refreshData",e),e}}async refreshItem(e){const n=(await this.db.find({selector:{id:e},limit:1})).docs[0];return n!==void 0&&this.sendItemUpdate(n),n}async getSnapshot(e){const t=new Map,n=[{id:this.currentReverse?"desc":"asc"}];return await Promise.all(e.map(async([s,i])=>{const o=i-s+1;return this.db.find({selector:sl(this.currentFilter??[]),skip:s,limit:o,sort:n,fields:["id","name"]}).then(a=>{for(let r=0;r<o;r+=1){const c=s+r;t.set(c,a.docs[r])}})})),t}}const qI=KI,YI=2500,XI=2e3,rn=X.module("PouchCommandHistoryTable");class ZI extends qI{constructor(e,t){super(`CommandHistoryStorage.${e}`,{auto_compaction:!0,revs_limit:1}),this.cache=t,this.cache.tableRegistry.has(this.cacheKey)||this.cache.tableRegistry.set(this.cacheKey,new Set),rn.debug("Adding table to registry",this.cacheKey),this.cache.tableRegistry.get(this.cacheKey)?.add(this)}searchText;get cacheKey(){return this.db.name}setSearch(e){rn.debug("Setting search filters",e),this.searchText=e.trim().toLowerCase(),this.setFilters(e?[Th.makeFilterConfig([Th.makeFilterItem("name",q.contains,e)])]:[])}dbUpdate(e){rn.debug("Clearing cache and refreshing data",e),this.cache.response.delete(this.cacheKey),super.dbUpdate(e)}async fetchData(e){return we.withTimeout(0,async()=>{this.cache.response.has(this.cacheKey)?rn.debug("Fetching from cache",this.searchText,this.viewport):(rn.debug("Fetching from PouchDB",this.searchText,this.viewport),this.cache.response.set(this.cacheKey,this.db.allDocs({include_docs:!0}).then(n=>{const s=n.rows.map(a=>a.doc).filter(({name:a})=>a);rn.debug(`Fetched ${s.length} command history items`);const{toKeep:i,toPrune:o}=$I(s,YI,XI);return o.length&&this.pruneItems(o),{docs:i}})));const t=this.cache.response.get(this.cacheKey);return this.searchText==null||this.searchText===""?t:{...t,docs:(await t).docs.filter(({name:n})=>n.toLowerCase().includes(this.searchText))}})}async fetchInfo(e){return this.fetchData(e)}async fetchViewportData(e,t,n){const s=await this.fetchData(t);return rn.debug("Fetching viewport data",e.top,e.bottom+1,n,s),{items:(typeof n[0]=="object"&&n[0].id==="desc"?s.docs.slice(0).reverse():s.docs).slice(e.top,e.bottom+1),offset:e.top}}async pruneItems(e){if(this.cache.isPruning.get(this.cacheKey)===!0){rn.debug("Pruning already in progress. Skipping.");return}try{rn.debug(`Pruning ${e.length} command history items`);const t=this.cache.pauseChangeListeners(this.cacheKey);this.cache.isPruning.set(this.cacheKey,!0),await this.db.bulkDocs(e.map(n=>({...n,_deleted:!0}))),this.cache.isPruning.set(this.cacheKey,!1),t(),rn.debug("Finished pruning command history items")}catch(t){rn.error("An error occurred while pruning db",t)}}close(){rn.debug("Closing table",this,this.cache.tableRegistry.get(this.cacheKey)?.size),this.cache.tableRegistry.get(this.cacheKey)?.delete(this),this.changes?.cancel(),super.close()}}const Eh=ZI,yh=X.module("PouchCommandHistoryCache");class QI{constructor(){this.isPruning=new Map,this.response=new Map,this.tableRegistry=new Map}isPruning;response;tableRegistry;pauseChangeListeners(e){const t=[];return this.tableRegistry.get(e)?.forEach(n=>{n.changes&&(yh.debug(`Pausing event listeners on '${e}' table`,n),n.changes.cancel(),t.push(n))}),()=>{t.forEach(n=>{(this.tableRegistry.get(e)?.has(n)??!1)&&(yh.debug(`Resuming event listeners on '${e}' table`,n),n.listenForChanges())})}}}const JI=QI,xh=X.module("PouchCommandHistoryStorage");class eD{cache=new JI;updateTableMap=new Map;getUpdateTable(e){return this.updateTableMap.has(e)||this.updateTableMap.set(e,new Eh(e,this.cache)),this.updateTableMap.get(e)}async getTable(e){return new Eh(e,this.cache)}async addItem(e,t,n,s){return this.updateItem(e,{id:`${new Date().getTime()}`,name:n,data:s})}async updateItem(e,t){const n=this.getUpdateTable(e),i={...await n.refreshItem(t.id)??{},...t};return xh.debug("Updating item",i),await n.put(i),xh.debug("Update saved"),t}listenItem(e,t,n){return this.getUpdateTable(e).onItemUpdate(t,n)}}const _m="SET_LAYOUT_STORAGE",tD=d=>({type:_m,payload:d}),jm="/ide/assets/community-wordmark-app-d2c5c1eb.svg";const nD=X.module("FormattingSectionContent");function sD(d){return d.formatString!=null}function yl(d){const e=d?.querySelector("input, select, textarea");e&&e.focus()}function Hm(d,e){return d.defaultFormatString===e.defaultFormatString}function iD(d,e){return Hm(d,e)}function oD(d,e){return Hm(d,e)}function Vm(d){return d!==""&&Gi.isValidColumnName(d)}function Ns(d,e){if(!d||e.formatString==null||!sD(e))return!1;switch(d){case"datetime":return He.isValid(e);case"decimal":return xe.isValid(e);case"int":return Ke.isValid(e);default:return nD.warn("Trying to validate format of unknown type"),!0}}function Bm(d){const{id:e,isNewRule:t,...n}=d;return n}function $m(d){return Vm(d.columnName)&&Ns(d.columnType,d.format)}function Um(d){const{timestamp:e,timeZone:t,showTimeZone:n,showTSeparator:s,isGlobalOptions:i,legacyGlobalFormat:o}=d,a=new Qt([],{timeZone:t,showTimeZone:n,showTSeparator:s}),r=i?He.getGlobalFormats(n,s):He.getFormats(n,s);return o!=null&&!r.includes(o)&&r.unshift(o),l.jsx(l.Fragment,{children:r.map(c=>{const h=He.makeFormat("",c,He.TYPE_GLOBAL);return l.jsx("option",{value:c,"data-testid":"time-format",children:a.getFormattedString(e,R.dataType.DATETIME,"",h)},c)})})}function aD(){return l.jsx(l.Fragment,{children:cr.TIME_ZONES.map(d=>{const{label:e,value:t}=d;return l.jsx("option",{value:t,children:e},t)})})}const Ks=X.module("FormattingSectionContent");class Oc extends b.PureComponent{static defaultProps={scrollTo:()=>{},defaults:{defaultDateTimeFormat:He.DEFAULT_DATETIME_FORMAT_STRING,defaultDecimalFormatOptions:{defaultFormatString:xe.DEFAULT_FORMAT_STRING},defaultIntegerFormatOptions:{defaultFormatString:Ke.DEFAULT_FORMAT_STRING},showTimeZone:!1,showTSeparator:!0,timeZone:He.DEFAULT_TIME_ZONE_ID}};static inputDebounceTime=250;constructor(e){super(e),this.debouncedCommitChanges=Xe(this.commitChanges.bind(this),Oc.inputDebounceTime),this.handleDefaultDateTimeFormatChange=this.handleDefaultDateTimeFormatChange.bind(this),this.handleDefaultDecimalFormatChange=this.handleDefaultDecimalFormatChange.bind(this),this.handleDefaultIntegerFormatChange=this.handleDefaultIntegerFormatChange.bind(this),this.handleShowTimeZoneChange=this.handleShowTimeZoneChange.bind(this),this.handleShowTSeparatorChange=this.handleShowTSeparatorChange.bind(this),this.handleTimeZoneChange=this.handleTimeZoneChange.bind(this),this.handleResetDateTimeFormat=this.handleResetDateTimeFormat.bind(this),this.handleResetDecimalFormat=this.handleResetDecimalFormat.bind(this),this.handleResetIntegerFormat=this.handleResetIntegerFormat.bind(this),this.handleResetTimeZone=this.handleResetTimeZone.bind(this),this.handleTruncateNumbersWithPoundChange=this.handleTruncateNumbersWithPoundChange.bind(this);const{formatter:t,defaultDateTimeFormat:n,defaultDecimalFormatOptions:s,defaultIntegerFormatOptions:i,showTimeZone:o,showTSeparator:a,timeZone:r,truncateNumbersWithPound:c}=e,h=t.map((u,m)=>({...u,id:m}));this.containerRef=ee.createRef(),this.state={formatSettings:h,showTimeZone:o,showTSeparator:a,timeZone:r,defaultDateTimeFormat:n,defaultDecimalFormatOptions:s,defaultIntegerFormatOptions:i,truncateNumbersWithPound:c,timestampAtMenuOpen:new Date}}componentDidMount(){yl(this.containerRef.current)}componentWillUnmount(){this.debouncedCommitChanges.flush()}debouncedCommitChanges;containerRef;getCachedDateTimeFormatOptions=me((e,t,n,s=!1,i)=>{const{timestampAtMenuOpen:o}=this.state;return l.jsx(Um,{timestamp:o,timeZone:e,showTimeZone:t,showTSeparator:n,isGlobalOptions:s,legacyGlobalFormat:i})});handleDefaultDateTimeFormatChange(e){Ks.debug("handleDefaultDateTimeFormatChange",e.target.value),this.setState({defaultDateTimeFormat:e.target.value},()=>{this.debouncedCommitChanges()})}handleDefaultDecimalFormatChange(e){Ks.debug("handleDefaultDecimalFormatChange",e.target.value),this.setState({defaultDecimalFormatOptions:{defaultFormatString:e.target.value}},()=>{this.debouncedCommitChanges()})}handleDefaultIntegerFormatChange(e){Ks.debug("handleDefaultIntegerFormatChange",e.target.value),this.setState({defaultIntegerFormatOptions:{defaultFormatString:e.target.value}},()=>{this.debouncedCommitChanges()})}handleShowTimeZoneChange(){this.setState(e=>({showTimeZone:!e.showTimeZone}),()=>{this.debouncedCommitChanges()})}handleShowTSeparatorChange(){this.setState(e=>({showTSeparator:!e.showTSeparator}),()=>{this.debouncedCommitChanges()})}handleTimeZoneChange(e){this.setState({timeZone:e.target.value},()=>{this.debouncedCommitChanges()})}handleResetDateTimeFormat(){const{defaults:e}=this.props,{defaultDateTimeFormat:t,showTimeZone:n,showTSeparator:s}=e;Ks.debug("handleResetDateTimeFormat"),this.setState({defaultDateTimeFormat:t,showTimeZone:n,showTSeparator:s},()=>{this.debouncedCommitChanges()})}handleResetTimeZone(){const{defaults:e}=this.props,{timeZone:t}=e;Ks.debug("handleResetTimeZone"),this.setState({timeZone:t},()=>{this.debouncedCommitChanges()})}handleResetDecimalFormat(){const{defaults:e}=this.props,{defaultDecimalFormatOptions:t}=e;Ks.debug("handleResetDecimalFormat"),this.setState({defaultDecimalFormatOptions:t},()=>{this.debouncedCommitChanges()})}handleResetIntegerFormat(){const{defaults:e}=this.props,{defaultIntegerFormatOptions:t}=e;Ks.debug("handleResetIntegerFormat"),this.setState({defaultIntegerFormatOptions:t},()=>{this.debouncedCommitChanges()})}handleTruncateNumbersWithPoundChange(){this.setState(e=>({truncateNumbersWithPound:!e.truncateNumbersWithPound}),()=>{this.debouncedCommitChanges()})}commitChanges(){const{formatSettings:e,defaultDateTimeFormat:t,showTimeZone:n,showTSeparator:s,timeZone:i,defaultDecimalFormatOptions:o,defaultIntegerFormatOptions:a,truncateNumbersWithPound:r}=this.state,c=e.filter($m).map(Bm)??[],{settings:h,saveSettings:u}=this.props,m={...h,formatter:c,defaultDateTimeFormat:t,showTimeZone:n,showTSeparator:s,timeZone:i,truncateNumbersWithPound:r};Ns(R.dataType.DECIMAL,xe.makeCustomFormat(o.defaultFormatString))&&(m.defaultDecimalFormatOptions=o),Ns(R.dataType.INT,Ke.makeCustomFormat(a.defaultFormatString))&&(m.defaultIntegerFormatOptions=a),u(m)}render(){const{defaults:e}=this.props,{defaultDateTimeFormat:t,defaultDecimalFormatOptions:n,defaultIntegerFormatOptions:s,timeZone:i,showTimeZone:o,showTSeparator:a,truncateNumbersWithPound:r}=this.state,{defaultFormatString:c=xe.DEFAULT_FORMAT_STRING}=n??{},{defaultFormatString:h=Ke.DEFAULT_FORMAT_STRING}=s??{},u=i===e.timeZone,m=a===e.showTSeparator&&o===e.showTimeZone&&t===e.defaultDateTimeFormat,g=iD(n,e.defaultDecimalFormatOptions),p=oD(s,e.defaultIntegerFormatOptions);return l.jsx("div",{className:"app-settings-formatting-section",ref:this.containerRef,children:l.jsxs("div",{className:"container-fluid p-0",children:[l.jsx("div",{className:"app-settings-menu-description mb-3",children:"Choose the default formatting rule to apply to all table columns based on their type."}),l.jsxs("div",{className:"form-row mb-2",children:[l.jsx("label",{className:"col-form-label col-3",htmlFor:"select-reset-timezone",children:"Time zone"}),l.jsx("div",{className:"col pr-0",children:l.jsx("select",{className:"custom-select",value:i,onChange:this.handleTimeZoneChange,id:"select-reset-timezone",children:l.jsx(aD,{})})}),l.jsx("div",{className:"col-1 btn-col",children:l.jsx(B,{kind:"ghost",icon:ti,onClick:this.handleResetTimeZone,tooltip:"Reset Time Zone",className:U("btn-reset","btn-reset-time-zone",{hidden:u})})})]}),l.jsxs("div",{className:"form-row mb-2",children:[l.jsx("label",{className:"col-form-label col-3",htmlFor:"select-default-time-format",children:"DateTime"}),l.jsx("div",{className:"col pr-0",children:l.jsx("select",{className:"custom-select",value:t,onChange:this.handleDefaultDateTimeFormatChange,id:"select-default-time-format",children:this.getCachedDateTimeFormatOptions(i,o,a,!0,t)})}),l.jsx("div",{className:"col-1 btn-col",children:l.jsx(B,{kind:"ghost",icon:ti,onClick:this.handleResetDateTimeFormat,tooltip:"Reset DateTime Options",className:U("btn-reset","btn-reset-date-time",{hidden:m})})})]}),l.jsx("div",{className:"form-row",children:l.jsx("div",{className:"offset-3 col-9",children:l.jsx(Zt,{checked:o??null,onChange:this.handleShowTimeZoneChange,children:"Show time zone in dates"})})}),l.jsx("div",{className:"form-row mb-3",children:l.jsx("div",{className:"offset-3 col-9",children:l.jsx(Zt,{checked:a??null,onChange:this.handleShowTSeparatorChange,children:"Show 'T' separator"})})}),l.jsxs("div",{className:"form-row mb-2",children:[l.jsx("label",{className:"col-form-label col-3",htmlFor:"default-decimal-format-input",children:"Decimal"}),l.jsx("div",{className:"col pr-0",children:l.jsx("input",{className:U("form-control","flex-grow-1","default-decimal-format-input",{"is-invalid":!Ns(R.dataType.DECIMAL,xe.makeCustomFormat(c))}),"data-lpignore":!0,placeholder:xe.DEFAULT_FORMAT_STRING,type:"text",id:"default-decimal-format-input",value:c,onChange:this.handleDefaultDecimalFormatChange})}),l.jsx("div",{className:"col-1 btn-col",children:l.jsx(B,{kind:"ghost",icon:ti,onClick:this.handleResetDecimalFormat,tooltip:"Reset Decimal Formatting",className:U("btn-reset","btn-reset-decimal",{hidden:g}),"data-testid":"btn-reset-decimal"})})]}),l.jsxs("div",{className:"form-row mb-2",children:[l.jsx("label",{className:"col-form-label col-3",htmlFor:"default-integer-format-input",children:"Integer"}),l.jsx("div",{className:"col pr-0",children:l.jsx("input",{className:U("form-control","flex-grow-1","default-integer-format-input",{"is-invalid":!Ns(R.dataType.INT,Ke.makeCustomFormat(h))}),"data-lpignore":!0,placeholder:Ke.DEFAULT_FORMAT_STRING,type:"text",id:"default-integer-format-input",value:h,onChange:this.handleDefaultIntegerFormatChange})}),l.jsx("div",{className:"col-1 btn-col",children:l.jsx(B,{kind:"ghost",icon:ti,onClick:this.handleResetIntegerFormat,tooltip:"Reset Integer Formatting",className:U("btn-reset","btn-reset-integer",{hidden:p}),"data-testid":"btn-reset-integer"})})]}),l.jsx("div",{className:"form-row mb-3",children:l.jsx("div",{className:"offset-3 col-9",children:l.jsx(Zt,{checked:r??null,onChange:this.handleTruncateNumbersWithPoundChange,children:"Truncate numbers with #"})})})]})})}}const rD=d=>({formatter:vu(d),defaultDateTimeFormat:Su(d),defaultDecimalFormatOptions:bu(d),defaultIntegerFormatOptions:wu(d),showTimeZone:Tu(d),showTSeparator:Eu(d),truncateNumbersWithPound:yu(d),timeZone:ko(d),settings:bt(d)}),lD=St(rD,{saveSettings:Cr})(Oc);function cD(){const[d,e]=b.useState(!1),t=()=>{e(!d)};return l.jsxs(B,{kind:"ghost",onClick:t,icon:xp,children:["Legal Notices",l.jsxs(Bi,{isOpen:d,toggle:t,className:"theme-bg-light",children:[l.jsx(Do,{toggle:t,children:"Legal Notice"}),l.jsxs($i,{children:[l.jsx("p",{children:"Deephaven software is protected by U.S. Patent Nos. 9,612,959; 9,613,018; 9,613,109; 9,619,210; 9,633,060; 9,639,570; 9,672,238; 9,679,006; 9,690,821; 9,710,511; 9,760,591; 9,805,084; 9,836,495; 9,836,494; 9,886,469; 9,898,496; 9,934,266; 10,002,153; 10,002,154; 10,002,155; 10,003,673; 10,019,138; 10,069,943; 10,176,211; 10,198,465; 10,198,466; 10,198,469; 10,212,257; 10,241,960; 10,241,965; 10,242,040; 10,242,041; 10,353,893; 10,346,394; 10,452,649; 10,496,639; 10,540,351; 10,552,412; 10,565,194; 10,565,206; 10,572,474; 10,621,168; 10,642,829; 10,657,184; 10,678,787; 10,691,686; and 10,783,191. Other patents pending."}),l.jsxs("p",{children:["© 2016-",new Date().getFullYear()," Deephaven Data Labs LLC. Patent Pending."]})]})]})]})}function To(d){const{children:e,isExpanded:t,sectionKey:n,title:s,onToggle:i}=d;return l.jsxs(l.Fragment,{children:[l.jsx("div",{children:l.jsxs(B,{kind:"ghost",className:"btn-collapse-trigger",onClick:()=>i(n),children:[l.jsx("div",{className:"flex-grow-1",children:s}),l.jsx("div",{className:"flex-shrink-0",children:l.jsx(Z,{transform:t?"flip-v":"",icon:Pn})})]})}),l.jsx(vf,{in:t,autoFocusOnShow:!0,children:e})]})}To.propTypes={children:M.node,isExpanded:M.bool.isRequired,sectionKey:M.string.isRequired,title:M.node.isRequired,onToggle:M.func};To.defaultProps={children:null,onToggle:()=>{}};function dD({shortcut:d,displayText:e,categoryName:t,onChange:n}){const[s,i]=b.useState(e),[o,a]=b.useState(d.getKeyState()),[r,c]=b.useState(!1),[h,u]=b.useState("");b.useEffect(function(){i(e),a(d.getKeyState())},[e,d]),b.useEffect(function(){i(Le.getDisplayText(o)),d.matchesKeyState(o)&&c(!1)},[o,d]),b.useEffect(function(){if(r){if(!Le.isValidKeyState(o)){Le.isAllowedKey(o.keyValue)?u("Must contain a modifier key"):u("Must contain an allowed action key");return}const T=Me.getConflictingShortcuts(o).filter(y=>y.id.startsWith(t)&&y!==d).map(y=>y.name);if(T.length){u(`Conflicts with ${T.join(", ")}`);return}u("")}else u("")},[r,o,t,d]);function m(w){if(w.stopPropagation(),w.preventDefault(),d.isEditable&&!w.repeat){const T=Le.getKeyStateFromEvent(w),y=Le.createKeyState([he.BACKSPACE]);Le.doKeyStatesMatch(T,y)?a(Le.NULL_KEY_STATE):a(T)}}function g(w){w.stopPropagation(),w.preventDefault(),d.matchesKeyState(o)||c(!0)}function p(){Be.disableAllActions()}function C(){Be.enableAllActions()}function f(){d.setKeyState(o),c(!1),n(d)}function S(){const w=d.getKeyState();a(w),c(!1)}function v(){c(!0),a(d.getDefaultKeyState())}return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"shortcut-item-container",children:[l.jsxs("label",{className:"shortcut-item-name",children:[d.name,d.tooltip!==void 0&&l.jsx(tt,{children:d.tooltip})]}),l.jsxs("div",{className:"shortcut-item-input-container",children:[l.jsx("input",{className:U("form-control",{"is-invalid":h}),onKeyDown:m,onKeyUp:g,onFocus:p,onBlur:C,disabled:!d.isEditable,value:s,readOnly:!0}),!Le.doKeyStatesMatch(o,d.getDefaultKeyState())&&!h&&l.jsx(B,{className:"reset-to-default-button",kind:"ghost",icon:l.jsx(Z,{icon:ti,transform:{rotate:90,flipX:!0}}),tooltip:"Reset to default",onClick:v})]})]}),r&&l.jsxs("div",{className:U("shortcut-item-message-container",{"is-invalid":h}),children:[l.jsx("div",{className:"shortcut-item-message",children:h}),l.jsxs("div",{className:"shortcut-item-message-buttons",children:[Le.isValidKeyState(o)&&l.jsx(B,{kind:"ghost",onClick:f,children:"Confirm"}),l.jsx(B,{kind:"ghost",onClick:S,children:"Undo"})]})]})]})}function hD({shortcutOverrides:d={},settings:e,saveSettings:t}){const n=b.useCallback(a=>{const r=Le.isMacPlatform,c={mac:{...d.mac},windows:{...d.windows}},h=r?c.mac:c.windows;a.forEach(u=>{u.isDefault()?delete h[u.id]:h[u.id]=u.getKeyState()}),t({...e,shortcutOverrides:c})},[e,t,d]);let s=Array.from(Me.shortcutsByCategory.entries()).map(([a,r])=>({name:a,shortcuts:r}));const i=s.findIndex(a=>a.name.toUpperCase()==="GLOBAL"),o=s.splice(i,1);return s=s.concat(o),l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"app-settings-menu-description",children:"Customize shortcuts below. To prevent unexpected results, avoid conflicting shortcuts with the browser or IDE editor."}),s.map(a=>l.jsx(uD,{name:a.name,shortcuts:a.shortcuts,saveShortcutOverrides:n},a.name))]})}function uD({name:d,shortcuts:e,saveShortcutOverrides:t}){function n(r){return r.split("_").map(c=>`${c[0].toUpperCase()}${c.slice(1).toLowerCase()}`).join(" ")}const[s,i]=b.useState(e);function o(r){const c=s.filter(u=>u!==r&&!u.isNull()&&u.matchesKeyState(r.getKeyState()));c.forEach(u=>u.setToNull());const h=[r,...c];t(h),i(u=>[...u])}const a=b.useMemo(()=>s.map(r=>r.getDisplayText()),[s]);return l.jsxs("div",{className:"mt-3",children:[l.jsx("div",{className:"font-weight-bold",children:n(d)}),s.map((r,c)=>l.jsx(dD,{shortcut:r,displayText:a[c],categoryName:d,onChange:o},r.id))]})}const mD=d=>({settings:bt(d),shortcutOverrides:db(d)}),gD={saveSettings:Cr},pD=St(mD,gD)(hD),fD="yyyy-MM-dd-HHmmss";function Wm(d,e="root",t=new Map([[d,""]])){const n={};return Object.entries(d).forEach(([s,i])=>{try{JSON.stringify(i),n[s]=i}catch{const a=i;if(typeof i=="bigint")n[s]=i.toString();else if(t.has(a))n[s]=`Circular ref to ${t.get(a)}`;else{const r=`${e}.${s}`;t.set(a,r),n[s]=Wm(i,r,t)}}}),n}function CD(){const d=tc.getState();return JSON.stringify(Wm(d),null,2)}function SD(d){const e={uiVersion:"0.37.2",userAgent:navigator.userAgent,...d};return JSON.stringify(e,null,2)}async function bD(d=`${x.i18n.DateTimeFormat.format(fD,new Date)}_support_logs`,e){const t=new Ah,n=t.folder(d);n.file("console.txt",Rp.getFormattedHistory()),n.file("redux.json",CD()),n.file("metadata.json",SD(e));const s=await t.generateAsync({type:"blob"}),i=document.createElement("a");i.href=URL.createObjectURL(s),i.download=`${d}.zip`,i.click()}const wD=[{value:R.dataType.DATETIME,label:"DateTime"},{value:R.dataType.DECIMAL,label:"Decimal"},{value:R.dataType.INT,label:"Integer"}];function vD(){const d=wD.map(e=>l.jsx("option",{value:e.value,children:e.label},`key-columnType-${e.value}`));return l.jsxs(l.Fragment,{children:[l.jsx("option",{disabled:!0,value:"",children:"Select Type"},"key-columnType-placeholder"),d]})}class Lc extends b.PureComponent{static defaultProps={scrollTo:()=>{},defaults:{defaultDateTimeFormat:He.DEFAULT_DATETIME_FORMAT_STRING,defaultDecimalFormatOptions:{defaultFormatString:xe.DEFAULT_FORMAT_STRING},defaultIntegerFormatOptions:{defaultFormatString:Ke.DEFAULT_FORMAT_STRING},showTimeZone:!1,showTSeparator:!0,timeZone:He.DEFAULT_TIME_ZONE_ID}};static inputDebounceTime=250;constructor(e){super(e),this.debouncedCommitChanges=Xe(this.commitChanges.bind(this),Lc.inputDebounceTime),this.handleFormatRuleEntered=this.handleFormatRuleEntered.bind(this),this.handleFormatRuleChange=this.handleFormatRuleChange.bind(this),this.handleFormatRuleCreate=this.handleFormatRuleCreate.bind(this),this.handleFormatRuleDelete=this.handleFormatRuleDelete.bind(this);const{formatter:t,defaultDateTimeFormat:n,defaultDecimalFormatOptions:s,defaultIntegerFormatOptions:i,showTimeZone:o,showTSeparator:a,timeZone:r,truncateNumbersWithPound:c}=e,h=t.map((u,m)=>({...u,id:m}));this.containerRef=ee.createRef(),this.addFormatRuleButtonRef=ee.createRef(),this.lastFormatRuleIndex=h.length,this.state={formatSettings:h,formatRulesChanged:!1,showTimeZone:o,showTSeparator:a,timeZone:r,defaultDateTimeFormat:n,defaultDecimalFormatOptions:s,defaultIntegerFormatOptions:i,truncateNumbersWithPound:c,timestampAtMenuOpen:new Date}}componentDidMount(){yl(this.containerRef.current)}componentWillUnmount(){this.debouncedCommitChanges.flush()}debouncedCommitChanges;containerRef;addFormatRuleButtonRef;lastFormatRuleIndex;isDuplicateRule(e){const{formatSettings:t}=this.state;return t.some(n=>n.id!==e.id&&n.columnName===e.columnName&&n.columnType===e.columnType)??!1}getAutoIncrementFormatRuleIndex(){const{lastFormatRuleIndex:e}=this;return this.lastFormatRuleIndex+=1,e}getCachedColumnTypeOptions=me(()=>l.jsx(vD,{}));getCachedDateTimeFormatOptions=me((e,t,n,s=!1,i)=>{const{timestampAtMenuOpen:o}=this.state;return l.jsx(Um,{timestamp:o,timeZone:e,showTimeZone:t,showTSeparator:n,isGlobalOptions:s,legacyGlobalFormat:i})});handleFormatRuleChange(e,t,n){this.setState(s=>{const{formatSettings:i}=s;N(i);const o=[...i];let a={};t==="columnType"&&(a={format:""});const r={...o[e],...a,[t]:n};return o[e]=r,{formatSettings:o}},()=>{this.debouncedCommitChanges()})}handleFormatRuleCreate(){this.setState(e=>{const{formatSettings:t}=e,n={columnType:R.dataType.DATETIME,columnName:"",format:{},id:this.getAutoIncrementFormatRuleIndex(),isNewRule:!0};return{formatSettings:[...t,n],formatRulesChanged:!0}})}handleFormatRuleDelete(e){this.setState(t=>{const{formatSettings:n}=t;return{formatSettings:n.filter((i,o)=>o!==e),formatRulesChanged:!0}},()=>{this.debouncedCommitChanges()})}handleFormatRuleEntered(e){this.scrollToFormatBlockBottom(),yl(e)}commitChanges(){const{formatSettings:e,defaultDateTimeFormat:t,showTimeZone:n,showTSeparator:s,timeZone:i,defaultDecimalFormatOptions:o,defaultIntegerFormatOptions:a,truncateNumbersWithPound:r}=this.state,c=e.filter($m).map(Bm)??[],{settings:h,saveSettings:u}=this.props,m={...h,formatter:c,defaultDateTimeFormat:t,showTimeZone:n,showTSeparator:s,timeZone:i,truncateNumbersWithPound:r};Ns(R.dataType.DECIMAL,xe.makeCustomFormat(o.defaultFormatString))&&(m.defaultDecimalFormatOptions=o),Ns(R.dataType.INT,Ke.makeCustomFormat(a.defaultFormatString))&&(m.defaultIntegerFormatOptions=a),u(m)}scrollToFormatBlockBottom(){const{scrollTo:e}=this.props;e(0,(this.addFormatRuleButtonRef.current?.offsetHeight??0)+(this.addFormatRuleButtonRef.current?.offsetTop??0))}getRuleError(e){const t={hasColumnNameError:!1,hasFormatError:!1,message:""},n=[];return e.isNewRule!==void 0&&e.isNewRule||(this.isDuplicateRule(e)&&(t.hasColumnNameError=!0,n.push("Duplicate column name/type combo.")),Vm(e.columnName)||(t.hasColumnNameError=!0,n.push("Column names must start with a letter or underscore and contain only alphanumeric characters or underscores.")),e.format.formatString!==void 0&&e.format.formatString.length===0?(t.hasFormatError=!0,n.push("Empty formatting rule.")):Ns(e.columnType,e.format)||(t.hasFormatError=!0,n.push("Invalid formatting rule.")),t.message=n.join(`
39
+ `)),t}renderFormatRule(e,t){const n=`input-${e}-columnName`,s=`input-${e}-columnType`,i=`input-${e}-format`,o=this.getCachedColumnTypeOptions(),a=u=>this.handleFormatRuleChange(e,"columnName",u.target.value),r=()=>this.handleFormatRuleChange(e,"isNewRule",!1),c=u=>this.handleFormatRuleChange(e,"columnType",u.target.value),h=this.getRuleError(t);return l.jsxs("fieldset",{className:"container-fluid format-rule-container",children:[l.jsxs("div",{className:"form-row",children:[l.jsxs("div",{className:"form-group col-7 mb-2",children:[l.jsx("label",{htmlFor:n,children:"Column Name"}),l.jsx("input",{id:n,className:U("form-control",{"is-invalid":h.hasColumnNameError}),"data-lpignore":!0,type:"text",value:t.columnName,onChange:a,onBlur:r})]}),l.jsxs("div",{className:"form-group col mb-2",children:[l.jsx(B,{kind:"ghost",className:"btn-delete-format-rule float-right",tabIndex:-1,onClick:()=>this.handleFormatRuleDelete(e),icon:Jt,tooltip:"Delete","aria-label":"Delete Format Rule"}),l.jsx("label",{htmlFor:s,children:"Column Type"}),l.jsx("select",{id:s,className:"custom-select",value:t.columnType,onChange:c,children:o})]})]}),l.jsx("div",{className:"form-row",children:l.jsxs("div",{className:"form-group col-12 d-flex mb-2",children:[l.jsx("label",{className:"flex-shrink-0 col-form-label mr-3",htmlFor:i,children:"Formatting Rule"}),this.renderFormatRuleInput(e,t.columnType,i,t.format,h.hasFormatError)]})}),l.jsx("div",{className:"form-row",children:l.jsx("div",{className:"form-group col-12 d-flex mb-2",children:h.message&&l.jsx("p",{className:"text-danger",children:h.message})})})]},e)}renderFormatRuleInput(e,t,n,s,i){switch(R.getNormalizedType(t)){case R.dataType.DATETIME:return this.renderDateTimeFormatRuleInput(e,n,s,i);case R.dataType.DECIMAL:return this.renderDecimalFormatRuleInput(e,n,s,i);case R.dataType.INT:return this.renderIntegerFormatRuleInput(e,n,s,i);default:throw new Error(`Unrecognized column type: ${t}`)}}renderDateTimeFormatRuleInput(e,t,n,s){const{showTimeZone:i,showTSeparator:o,timeZone:a}=this.state,r=n.formatString??"";return l.jsxs("select",{className:U("custom-select",{"is-invalid":s}),value:r,id:t,onChange:c=>{const h=He.makeFormat("",c.target.value,He.TYPE_GLOBAL);this.handleFormatRuleChange(e,"format",h)},children:[l.jsx("option",{value:"",disabled:!0,children:"Select format"},"default"),this.getCachedDateTimeFormatOptions(a,i,o)]})}renderIntegerFormatRuleInput(e,t,n,s){const i=n.formatString??"";return l.jsx("input",{className:U("form-control","flex-grow-1",{"is-invalid":s}),"data-lpignore":!0,id:t,placeholder:Ke.DEFAULT_FORMAT_STRING,type:"text",value:i,onChange:o=>{const a=Ke.makeFormat("",o.target.value,Ke.TYPE_GLOBAL,void 0);this.handleFormatRuleChange(e,"format",a)}})}renderDecimalFormatRuleInput(e,t,n,s){const i=n.formatString??"";return l.jsx("input",{className:U("form-control","flex-grow-1",{"is-invalid":s}),"data-lpignore":!0,id:t,placeholder:xe.DEFAULT_FORMAT_STRING,type:"text",value:i,onChange:o=>{const a=xe.makeFormat("",o.target.value,xe.TYPE_GLOBAL,void 0);this.handleFormatRuleChange(e,"format",a)}})}render(){const{formatRulesChanged:e,formatSettings:t}=this.state,n=t.map((i,o)=>l.jsx(Ct,{classNames:"fade",timeout:qe.transitionMs,onEnter:this.handleFormatRuleEntered,children:this.renderFormatRule(o,i)},i.id)),s=l.jsx(B,{kind:"ghost",className:"mb-3",onClick:this.handleFormatRuleCreate,ref:this.addFormatRuleButtonRef,icon:As,children:"Add New Rule"});return l.jsxs("div",{className:"app-settings-formatting-section",ref:this.containerRef,children:[l.jsx("div",{className:"app-settings-menu-description mb-3",children:"Customize the formatting of table columns by applying rules based on matching both a column name and column type."}),l.jsx(vg,{appear:e,enter:e,exit:e,children:n}),s]})}}const TD=d=>({formatter:vu(d),defaultDateTimeFormat:Su(d),defaultDecimalFormatOptions:bu(d),defaultIntegerFormatOptions:wu(d),showTimeZone:Tu(d),showTSeparator:Eu(d),truncateNumbersWithPound:yu(d),timeZone:ko(d),settings:bt(d)}),ED=St(TD,{saveSettings:Cr})(Lc);class kn extends b.Component{static defaultProps={onDone:()=>{}};static FORMATTING_SECTION_KEY="SettingsMenu.formatting";static COLUMN_SPECIFIC_SECTION_KEY="SettingsMenu.columnFormatting";static APPLICATION_SECTION_KEY="ApplicationMenu.settings";static SHORTCUT_SECTION_KEY="SettingsMenu.shortcuts";static focusFirstInputInContainer(e){const t=e?.querySelector("input, select, textarea");t&&t.focus()}constructor(e){super(e),this.handleClose=this.handleClose.bind(this),this.handleScrollTo=this.handleScrollTo.bind(this),this.handleSectionToggle=this.handleSectionToggle.bind(this),this.handleExportSupportLogs=this.handleExportSupportLogs.bind(this),this.menuContentRef=ee.createRef(),this.state={expandedSectionKey:kn.FORMATTING_SECTION_KEY}}componentDidMount(){kn.focusFirstInputInContainer(this.menuContentRef.current)}menuContentRef;isSectionExpanded(e){const{expandedSectionKey:t}=this.state;return t===e}handleScrollTo(e,t){this.menuContentRef.current?.scrollTo(e,t)}handleSectionToggle(e){this.setState(t=>({expandedSectionKey:t.expandedSectionKey===e?void 0:e}))}handleClose(){const{onDone:e}=this.props;e()}handleExportSupportLogs(){const{serverConfigValues:e}=this.props;bD(void 0,Object.fromEntries(e))}render(){const e="0.37.2",t="https://github.com/deephaven/web-client-ui/",n="https://deephaven.io/core/docs/",{serverConfigValues:s}=this.props,i=s.get("barrage.version"),o=s.get("java.version"),a=s.get("deephaven.version"),r=(c,h)=>l.jsxs(l.Fragment,{children:[l.jsx("div",{children:c}),l.jsx("div",{children:h})]});return l.jsxs("div",{className:"app-settings-menu",children:[l.jsxs("header",{className:"app-settings-menu-header",children:[l.jsx("div",{className:"flex-spacer"}),l.jsx(B,{kind:"ghost",className:"btn-close-settings-menu",onClick:this.handleClose,icon:l.jsx(Z,{icon:Ui,transform:"grow-4"}),tooltip:"Close"})]}),l.jsxs("div",{className:"app-settings-menu-content",ref:this.menuContentRef,children:[l.jsx("h5",{children:"Settings"}),l.jsx("hr",{className:"my-0"}),l.jsx(To,{sectionKey:kn.FORMATTING_SECTION_KEY,isExpanded:this.isSectionExpanded(kn.FORMATTING_SECTION_KEY),title:l.jsxs(l.Fragment,{children:[l.jsx(Z,{icon:Ip,transform:"grow-4",className:"mr-2"}),"Default Format & Time zone"]}),onToggle:this.handleSectionToggle,children:l.jsx(lD,{})}),l.jsx(To,{sectionKey:kn.COLUMN_SPECIFIC_SECTION_KEY,isExpanded:this.isSectionExpanded(kn.COLUMN_SPECIFIC_SECTION_KEY),title:l.jsxs(l.Fragment,{children:[l.jsx(Z,{icon:Dp,transform:"grow-4",className:"mr-2"}),"Format by Column Name & Type"]}),onToggle:this.handleSectionToggle,children:l.jsx(ED,{scrollTo:this.handleScrollTo})}),l.jsx(To,{sectionKey:kn.SHORTCUT_SECTION_KEY,isExpanded:this.isSectionExpanded(kn.SHORTCUT_SECTION_KEY),title:l.jsxs(l.Fragment,{children:[l.jsx(Z,{icon:Fp,transform:"grow-2"})," ","Keyboard Shortcuts"]}),onToggle:this.handleSectionToggle,children:l.jsx(pD,{})}),l.jsxs("div",{className:"app-settings-footer",children:[l.jsxs("div",{className:"app-settings-footer-section",children:[l.jsxs("div",{className:"app-settings-footer-item",children:[l.jsx("div",{className:"font-weight-bold",children:"Support"}),l.jsxs("div",{children:["GitHub: ",l.jsx("a",{href:t,className:"custom-link",target:"_blank",rel:"noopener noreferrer",children:t})]}),l.jsx(B,{kind:"tertiary",className:"mt-2 py-2",onClick:this.handleExportSupportLogs,children:"Export Logs"})]}),l.jsxs("div",{className:"app-settings-footer-item",children:[l.jsx("div",{className:"font-weight-bold",children:"Documentation"}),l.jsx("a",{target:"_blank",rel:"noreferrer noopener",href:n,className:"custom-link",children:n})]}),l.jsxs("div",{className:"app-settings-footer-item",children:[l.jsx("div",{className:"font-weight-bold",children:"Version"}),l.jsxs("span",{className:"d-inline-block text-muted",children:[a," ",l.jsx(Z,{icon:Np}),l.jsxs(tt,{interactive:!0,children:[l.jsxs("div",{className:"detailed-server-config",children:[r("Engine Version",a),r("Web UI Version",e),r("Java Version",o),r("Barrage Version",i)]}),l.jsx(ur,{tooltip:"Copy version numbers",copy:`Engine Version: ${a}
40
40
  Web UI Version: ${e}
41
41
  Java Version: ${o}
42
42
  Barrage Version: ${i}`,children:"Copy Versions"})]})]})]}),l.jsx("div",{className:"app-settings-footer-item",children:l.jsx(cD,{})})]}),l.jsx("div",{className:"app-settings-footer-section",children:l.jsx("div",{className:"logo",children:l.jsx("a",{target:"_blank",rel:"noreferrer noopener",href:"https://deephaven.io",className:"d-inline-block custom-link p-1",children:l.jsx("img",{src:jm,alt:"Deephaven Data Labs",width:"230px"})})})})]})]})]})}}const Rh=10;function ki(d){const{forwardedProps:{menuItem:{action:e,title:t,disabled:n},iconElement:s,displayShortcut:i,isMouseSelected:o,isKeyboardSelected:a,closeMenu:r}}=d,c=b.useRef(),h=b.useRef(),u=b.useRef(null),[m,g]=b.useState(!1),p=b.useCallback(S=>{c.current!=null&&h.current!=null&&u.current&&(Math.abs(c.current-S.clientX)>=Rh||Math.abs(h.current-S.clientY)>=Rh)&&(g(!0),window.removeEventListener("mousemove",p),r(),e(S),u.current=null)},[e,r]);function C(S){c.current=S.clientX,h.current=S.clientY,u.current=S.target,window.addEventListener("mousemove",p)}function f(S){u.current===S.target&&(g(!0),r(),e(),window.removeEventListener("mousemove",p)),u.current=null}return b.useEffect(function(){return function(){return window.removeEventListener("mousemove",p)}},[p]),l.jsxs("button",{type:"button",className:U("btn-context-menu",{disabled:n},{active:o&&!n},{"keyboard-active":a&&!n}),onMouseDown:C,onMouseUp:f,disabled:m,children:[l.jsx("span",{className:U("icon"),children:s}),l.jsx("span",{className:"title",children:t}),l.jsx("span",{className:"shortcut",children:i})]})}function Pc(d){const{handleControlSelect:e,handleToolSelect:t,onClearFilter:n}=d,s=b.useMemo(()=>[{title:"Input Filter",icon:Mp,menuElement:l.jsx(ki,{}),action:i=>{e(Fs.INPUT_FILTER,i)},order:10},{title:"Dropdown Filter",icon:Uh,menuElement:l.jsx(ki,{}),action:i=>{e(Fs.DROPDOWN_FILTER,i)},order:15},{title:"Markdown Widget",icon:kp,menuElement:l.jsx(ki,{}),action:i=>{e(Fs.MARKDOWN,i)},order:20},{title:"Filter Sets",icon:cl,menuElement:l.jsx(ki,{}),action:i=>{e(Fs.FILTER_SET_MANAGER,i)},order:25},{disabled:!0,menuElement:l.jsx("div",{className:"context-menu-group-header",children:"Tools"}),order:30},{title:"Linker",icon:Fl,action:()=>{t($t.LINKER)},order:40,shortcut:ss.LINKER},{disabled:!0,menuElement:l.jsx("div",{className:"context-menu-group-header",children:"Actions"}),order:50},{title:"Clear All Filters",icon:Ap,action:()=>{n()},order:60,shortcut:qt.TABLE.CLEAR_ALL_FILTERS}],[e,t,n]);return l.jsx(es,{popperClassName:"controls-menu-popper",actions:s})}Pc.propTypes={handleControlSelect:M.func,handleToolSelect:M.func,onClearFilter:M.func};Pc.defaultProps={handleControlSelect:()=>{},handleToolSelect:()=>{},onClearFilter:()=>{}};ki.propTypes={forwardedProps:M.shape({iconElement:M.node,displayShortcut:M.string,isMouseSelected:M.bool.isRequired,isKeyboardSelected:M.bool.isRequired,closeMenu:M.func.isRequired,menuItem:M.shape({action:M.func,title:M.string,disabled:M.bool}).isRequired})};ki.defaultProps={forwardedProps:null};const yD=di(_m,null),xD={layoutStorage:yD},RD=d=>d.layoutStorage,ID=d=>d.serverConfigValues;Object.entries(xD).map(([d,e])=>Ao.register(d,e));const Ih=10;function DD(d){const{onExportLayout:e,onImportLayout:t,onResetLayout:n,onSelect:s,widgets:i=[]}=d,[o,a]=b.useState(!1),[r,c]=b.useState(""),h=b.useRef(null),u=b.useRef(),m=b.useCallback((T,y)=>{T!=null&&s(T,y)},[s]),g=b.useCallback(T=>{c(T.target.value)},[]),p=b.useCallback(T=>{u.current!=null&&(Math.abs(u.current.x-T.clientX)>=Ih||Math.abs(u.current.y-T.clientY)>=Ih)&&(a(!0),window.removeEventListener("mousemove",p),m(u.current.widget,T),u.current=void 0)},[u,m]),C=b.useCallback((T,y)=>{u.current={x:T.clientX,y:T.clientY,widget:y},window.addEventListener("mousemove",p)},[p]),f=b.useCallback((T,y)=>{window.removeEventListener("mousemove",p),u.current?.widget===y&&(a(!0),m(y)),u.current=void 0},[p,u,m]),S=b.useMemo(()=>i.filter(T=>r?T.name?.toLowerCase().includes(r.toLowerCase()):!0),[r,i]).sort((T,y)=>T.name?.localeCompare(y.name??"")??0),v=b.useMemo(()=>S.map(T=>l.jsx("li",{children:l.jsxs(B,{kind:"ghost","data-testid":`panel-list-item-${T.name??""}-button`,onMouseDown:y=>{C(y,T)},onMouseUp:y=>{f(y,T)},onKeyDown:y=>{(y.key==="Enter"||y.key===" ")&&m(T)},disabled:o,onClick:()=>{},children:[l.jsx(iu,{type:T.type})," ",T.name??""]})},T.name)),[S,o,C,f,m]),w=b.useMemo(()=>v.length===0?l.jsx("span",{children:"No bound variables found."}):null,[v]);return l.jsxs("div",{className:"widget-list-container d-flex flex-column",children:[l.jsx("div",{className:"widget-list-header",children:l.jsx(Os,{value:r,placeholder:"Find Table, Plot or Widget",onChange:g,ref:h})}),l.jsxs("ul",{className:"widget-list flex-grow-1",children:[w&&l.jsx("li",{className:"widget-list-message",children:w}),!w&&v]}),l.jsx("div",{children:l.jsx("hr",{})}),l.jsxs("div",{className:"widget-list-footer",children:[l.jsxs(B,{kind:"ghost",onClick:e,children:[l.jsxs("div",{className:"fa-md fa-layers",children:[l.jsx(Z,{mask:ll,icon:Yc,transform:"right-5 down-5"}),l.jsx(Z,{icon:Yc,transform:"right-8 down-6"})]}),"Export Layout"]}),l.jsxs(B,{kind:"ghost",onClick:t,children:[l.jsxs("div",{className:"fa-md fa-layers",children:[l.jsx(Z,{mask:ll,icon:dl,transform:"right-5 down-5"}),l.jsx(Z,{icon:dl,transform:"right-8 down-6"})]}),"Import Layout"]}),l.jsx(B,{kind:"ghost",icon:ti,onClick:n,tooltip:"Reset Layout"})]})]})}const FD=async(d,e,t)=>{let n,s,i,o;if(ya(e)?(n=e.settings,s=e.table,i=void 0,o=e.tableSettings):(n={},s="",i=e.figure,o={}),t!==void 0&&(t.tableSettings!=null&&(o=t.tableSettings),t.table!=null&&(s=t.table),t.figure!=null&&(i=t.figure),t.settings!=null&&(n={...n,...t.settings})),i!==void 0){const c={title:i,name:i,type:x.VariableType.FIGURE},h=await d.getObject(c);return _a.makeModel(n,h)}const a={title:i,name:s,type:x.VariableType.TABLE},r=await d.getObject(a);return be.applyTableSettings(r,o,ko(tc.getState())),_a.makeModelFromSettings(n,r)},ND=async(d,e,t=x.VariableType.TABLE)=>{const{table:n}=e,s={title:n,name:n,type:t},i=await d.getObject(s);return vc.makeModel(i)};function MD({onAutoFillClick:d=()=>{}}){return l.jsxs("div",{className:"empty-dashboard-container",children:[l.jsxs("div",{className:"hint-container",children:[l.jsx(Z,{icon:$h})," ",l.jsx("br",{}),"Use the panel list to add objects from a query."]}),l.jsxs("div",{className:"empty-dashboard",children:[l.jsx("div",{className:"add-panels-hint",children:"Drag Panels Here"}),l.jsx(B,{kind:"tertiary",onClick:d,children:"Auto fill objects"})]})]})}function kD(d){return d.version===2}function AD(d){return Array.isArray(d)}const wa=X.module("UserLayoutUtils"),OD={layoutConfig:[{type:"column",content:[{type:"row",height:40,content:[{type:"stack",content:[{type:"react-component",component:Mi.COMPONENT,title:Mi.TITLE,isClosable:!1},{type:"react-component",component:er.COMPONENT,title:er.TITLE,isClosable:!1}]},{type:"stack",width:25,content:[{type:"react-component",component:qa.COMPONENT,title:qa.TITLE,isClosable:!1},{type:"react-component",component:Xa.COMPONENT,title:Xa.TITLE,isClosable:!1}]}]},{type:"row",content:[{type:"stack",title:"Notebooks",content:[]}]}]}],links:[],filterSets:[],version:2},LD={layoutConfig:[],links:[],filterSets:[],version:2};function Gm(d){if(kD(d))return d;if(AD(d))return{layoutConfig:d,links:[],filterSets:[],version:2};throw new Error(`Unexpected layout import format: ${d}`)}async function PD(d,e=!0){try{const t=await d.getLayouts();if(t.length>0)try{const n=await d.getLayout(t[0]);return Gm(n)}catch(n){wa.error("Unable to load layout",t[0],":",n),wa.warn("No valid layouts found, falling back to default layout")}}catch(t){wa.error("Unable to fetch layout list",t),wa.warn("Falling back to default layout")}return e?OD:LD}function _D(d){const{filterSets:e,layoutConfig:t,links:n}=d;return{filterSets:e,layoutConfig:t,links:n,version:2}}const Ra={exportLayout:_D,getDefaultLayout:PD,normalizeLayout:Gm},va=X.module("DownloadServiceWorkerUtils");class Io{static DOWNLOAD_PATH="/download/";static registerOnLoaded(){new URL("/ide/",window.location.href).origin===window.location.origin&&("serviceWorker"in navigator?window.addEventListener("load",()=>{const t=new URL("/ide/download/serviceWorker.js",window.location.href);navigator.serviceWorker.register(t).then(n=>{n.update(),va.info("Registering service worker on ",t,n)}).catch(n=>{va.error("Failed to register service worker",n)})}):va.info("Service worker is not supported."))}static async getServiceWorker(){if("serviceWorker"in navigator){const t=(await navigator.serviceWorker.getRegistrations()).find(n=>n.scope.endsWith(Io.DOWNLOAD_PATH));if(t&&t.active)return va.info("Download service worker is active."),t.active;throw new Error("Can not find download service worker.")}throw new Error("Download service worker is not available.")}static unregisterSW(){}}const Et=X.module("AppMainContainer");class Ai extends b.Component{static handleWindowBeforeUnload(e){e.preventDefault(),e.returnValue=""}static hydrateConsole(e,t){return Sl.hydrate({...e,unzip:n=>Ah.loadAsync(n).then(s=>Object.values(s.files))},t)}static handleRefresh(){Et.info("Refreshing application"),window.location.reload()}constructor(e){super(e),this.handleSettingsMenuHide=this.handleSettingsMenuHide.bind(this),this.handleSettingsMenuShow=this.handleSettingsMenuShow.bind(this),this.handleError=this.handleError.bind(this),this.handleControlSelect=this.handleControlSelect.bind(this),this.handleToolSelect=this.handleToolSelect.bind(this),this.handleClearFilter=this.handleClearFilter.bind(this),this.handleDataChange=this.handleDataChange.bind(this),this.handleAutoFillClick=this.handleAutoFillClick.bind(this),this.handleGoldenLayoutChange=this.handleGoldenLayoutChange.bind(this),this.handleLayoutConfigChange=this.handleLayoutConfigChange.bind(this),this.handleExportLayoutClick=this.handleExportLayoutClick.bind(this),this.handleImportLayoutClick=this.handleImportLayoutClick.bind(this),this.handleImportLayoutFiles=this.handleImportLayoutFiles.bind(this),this.handleLoadTablePlugin=this.handleLoadTablePlugin.bind(this),this.handleResetLayoutClick=this.handleResetLayoutClick.bind(this),this.handleWidgetMenuClick=this.handleWidgetMenuClick.bind(this),this.handleWidgetsMenuClose=this.handleWidgetsMenuClose.bind(this),this.handleWidgetSelect=this.handleWidgetSelect.bind(this),this.handlePaste=this.handlePaste.bind(this),this.hydrateChart=this.hydrateChart.bind(this),this.hydrateGrid=this.hydrateGrid.bind(this),this.hydratePandas=this.hydratePandas.bind(this),this.hydrateDefault=this.hydrateDefault.bind(this),this.openNotebookFromURL=this.openNotebookFromURL.bind(this),this.handleDisconnect=this.handleDisconnect.bind(this),this.handleReconnect=this.handleReconnect.bind(this),this.handleReconnectAuthFailed=this.handleReconnectAuthFailed.bind(this),this.importElement=ee.createRef(),this.state={contextActions:[{action:()=>{this.handleToolSelect($t.LINKER)},shortcut:ss.LINKER,isGlobal:!0},{action:()=>{this.sendClearFilter()},shortcut:qt.TABLE.CLEAR_ALL_FILTERS,isGlobal:!0},{action:()=>{Et.debug("Consume unhandled save shortcut")},shortcut:ss.SAVE,isGlobal:!0}],isAuthFailed:!1,isDisconnected:!1,isPanelsMenuShown:!1,isSettingsMenuShown:!1,widgets:[]}}componentDidMount(){this.initWidgets(),this.startListeningForDisconnect(),window.addEventListener("beforeunload",Ai.handleWindowBeforeUnload)}componentDidUpdate(e){const{dashboardData:t}=this.props;e.dashboardData!==t&&this.handleDataChange(t)}componentWillUnmount(){this.deinitWidgets(),this.stopListeningForDisconnect(),window.removeEventListener("beforeunload",Ai.handleWindowBeforeUnload)}goldenLayout;importElement;widgetListenerRemover;initWidgets(){const{connection:e}=this.props;if(e.subscribeToFieldUpdates==null){Et.warn("subscribeToFieldUpdates not supported, not initializing widgets");return}this.widgetListenerRemover=e.subscribeToFieldUpdates(t=>{Et.debug("Got updates",t),this.setState(({widgets:n})=>{const{updated:s,created:i,removed:o}=t,a=[...s,...o],r=n.filter(h=>!a.some(u=>u.name===h.name));return[...s,...i].forEach(h=>{h.name!=null&&h.name!==""&&r.push(h)}),{widgets:r}})})}deinitWidgets(){this.widgetListenerRemover?.()}openNotebookFromURL(){const{match:e}=this.props,{notebookPath:t}=e.params;if(t){const{session:n,sessionConfig:s}=this.props;if(n==null||s==null){Et.error("No session available to open notebook URL",t);return}const i={id:`/${t}`,itemName:`/${t}`},o=s.type,a={value:null,language:o};this.emitLayoutEvent(We.SELECT_NOTEBOOK,n,o,a,i,!0)}}sendClearFilter(){this.emitLayoutEvent(Je.CLEAR_ALL_FILTERS)}emitLayoutEvent(e,...t){this.goldenLayout?.eventHub.emit(e,...t)}handleError(e){we.isCanceled(e)||Et.error(e)}handleSettingsMenuHide(){this.setState({isSettingsMenuShown:!1})}handleSettingsMenuShow(){this.setState({isSettingsMenuShown:!0})}handleControlSelect(e,t=null){switch(Et.debug("handleControlSelect",e),e){case Fs.DROPDOWN_FILTER:this.emitLayoutEvent(Je.OPEN_DROPDOWN,{title:"DropdownFilter",type:e,createNewStack:!0,dragEvent:t});break;case Fs.INPUT_FILTER:this.emitLayoutEvent(Je.OPEN_INPUT,{title:"InputFilter",type:e,createNewStack:!0,dragEvent:t});break;case Fs.MARKDOWN:this.emitLayoutEvent(Im.OPEN,{title:"Markdown",type:e,dragEvent:t});break;case Fs.FILTER_SET_MANAGER:this.emitLayoutEvent(Je.OPEN_FILTER_SET_MANAGER,{title:"FilterSets",type:e,dragEvent:t});break;default:throw new Error(`Unrecognized control type ${e}`)}}handleToolSelect(e){Et.debug("handleToolSelect",e);const{activeTool:t,setActiveTool:n}=this.props;n(t===e?$t.DEFAULT:e)}handleClearFilter(){this.sendClearFilter()}handleDataChange(e){const{updateWorkspaceData:t}=this.props,{closed:n,filterSets:s,links:i}=e;t({closed:n,filterSets:s,links:i})}handleGoldenLayoutChange(e){this.goldenLayout=e}handleLayoutConfigChange(e){const{updateWorkspaceData:t}=this.props;t({layoutConfig:e})}handleWidgetMenuClick(){this.setState(({isPanelsMenuShown:e})=>({isPanelsMenuShown:!e}))}handleWidgetSelect(e,t){this.setState({isPanelsMenuShown:!1}),Et.debug("handleWidgetSelect",e,t),this.openWidget(e,t)}handleWidgetsMenuClose(){this.setState({isPanelsMenuShown:!1})}handleAutoFillClick(){const{widgets:e}=this.state;Et.debug("handleAutoFillClick",e);const t=e.sort((n,s)=>n.title!=null&&s.title!=null?n.title.localeCompare(s.title):0);for(let n=0;n<t.length;n+=1)this.openWidget(t[n])}handleExportLayoutClick(){Et.info("handleExportLayoutClick"),this.setState({isPanelsMenuShown:!1});try{const{workspace:e}=this.props,{data:t}=e,n=Ra.exportLayout(t);Et.info("handleExportLayoutClick exportedConfig",n);const s=new Blob([JSON.stringify(n)],{type:"application/json"}),i=x.i18n.DateTimeFormat.format("yyyy-MM-dd-HHmmss",new Date),o=document.createElement("a");o.href=URL.createObjectURL(s),o.download=`deephaven-app-layout-${i}.json`,o.click()}catch(e){Et.error("Unable to export layout",e)}}handleImportLayoutClick(){Et.info("handleImportLayoutClick"),this.setState({isPanelsMenuShown:!1}),this.importElement.current!=null&&(this.importElement.current.value="",this.importElement.current.click())}handleResetLayoutClick(){Et.info("handleResetLayoutClick"),this.setState({isPanelsMenuShown:!1}),this.resetLayout()}handleImportLayoutFiles(e){e.stopPropagation(),e.preventDefault(),e.target.files!=null&&this.importLayoutFile(e.target.files?.[0])}handleDisconnect(){this.setState({isDisconnected:!0})}handleReconnect(){this.setState({isDisconnected:!1})}handleReconnectAuthFailed(){this.setState({isAuthFailed:!0})}async importLayoutFile(e){try{const{updateDashboardData:t,updateWorkspaceData:n}=this.props,s=await e.text(),i=JSON.parse(s),{filterSets:o,layoutConfig:a,links:r}=Ra.normalizeLayout(i);n({layoutConfig:a}),t(wn,{filterSets:o,links:r})}catch(t){Et.error("Unable to import layout",t)}}async resetLayout(){const{layoutStorage:e,session:t}=this.props,{filterSets:n,layoutConfig:s,links:i}=await Ra.getDefaultLayout(e,t!==void 0),{updateDashboardData:o,updateWorkspaceData:a}=this.props;a({layoutConfig:s}),o(wn,{filterSets:n,links:i})}handlePaste(e){if(e.target instanceof HTMLElement&&e.target.closest(".monaco-editor"))return;const{clipboardData:t}=e,n=t.getData("Text"),s=/“|”/g;s.test(n)&&(e.preventDefault(),e.stopPropagation(),document.execCommand("insertText",!1,n.replace(s,'"')))}handleLoadTablePlugin(e){const{plugins:t}=this.props,n=t.get(e);if(n!=null&&n.TablePlugin!=null)return n.TablePlugin;const s=Xc("/ide/plugins/");return Hp(s,e)}startListeningForDisconnect(){const{connection:e}=this.props;e.addEventListener(x.IdeConnection.EVENT_DISCONNECT,this.handleDisconnect),e.addEventListener(x.IdeConnection.EVENT_RECONNECT,this.handleReconnect),e.addEventListener(x.CoreClient.EVENT_RECONNECT_AUTH_FAILED,this.handleReconnectAuthFailed)}stopListeningForDisconnect(){const{connection:e}=this.props;e.removeEventListener(x.IdeConnection.EVENT_DISCONNECT,this.handleDisconnect),e.removeEventListener(x.IdeConnection.EVENT_RECONNECT,this.handleReconnect),e.removeEventListener(x.CoreClient.EVENT_RECONNECT_AUTH_FAILED,this.handleReconnectAuthFailed)}hydrateDefault(e,t){const{connection:n}=this.props,{metadata:s}=e;if(s?.type!=null&&(s?.id!=null||s?.name!=null)){const i=s.id!=null?{type:s.type,id:s.id}:{type:s.type,name:s.name,title:s.name};return{fetch:()=>n.getObject(i),localDashboardId:t,...e}}return Sl.hydrate(e,t)}hydrateGrid(e,t){return this.hydrateTable(e,t,e.metadata.type??x.VariableType.TABLE)}hydratePandas(e,t){return this.hydrateTable(e,t,x.VariableType.PANDAS)}hydrateTable(e,t,n=x.VariableType.TABLE){const{connection:s}=this.props;return{...e,getDownloadWorker:Io.getServiceWorker,loadPlugin:this.handleLoadTablePlugin,localDashboardId:t,makeModel:()=>ND(s,e.metadata,n)}}hydrateChart(e,t){const{connection:n}=this.props;return{...e,localDashboardId:t,makeModel:()=>{const{metadata:s,panelState:i}=e;return FD(n,s,i)}}}openWidget(e,t){const{connection:n}=this.props;this.emitLayoutEvent(Ee.OPEN,{dragEvent:t,fetch:()=>n.getObject(e),widget:e})}getDashboardPlugins=pe(e=>[...e.entries()].filter(([,t])=>t.DashboardPlugin!=null).map(([t,{DashboardPlugin:n}])=>l.jsx(n,{},t)));render(){const{activeTool:e,plugins:t,user:n,workspace:s,serverConfigValues:i}=this.props,{data:o}=s,{layoutConfig:a}=o,{permissions:r}=n,{canUsePanels:c}=r,{contextActions:h,isAuthFailed:u,isDisconnected:m,isPanelsMenuShown:g,isSettingsMenuShown:p,widgets:C}=this.state,f=this.getDashboardPlugins(t);return l.jsxs("div",{className:U("app-main-tabs","w-100","h-100","d-flex","flex-column",e?`active-tool-${e.toLowerCase()}`:""),onPaste:this.handlePaste,tabIndex:-1,children:[l.jsx("nav",{className:"nav-container",children:l.jsxs("div",{className:"app-main-top-nav-menus",children:[l.jsx("img",{src:jm,alt:"Deephaven Data Labs",width:"115px",className:"ml-1"}),l.jsxs("div",{children:[l.jsxs(B,{kind:"ghost",className:"btn-panels-menu",icon:Op,onClick:()=>{},children:["Controls",l.jsx(Pc,{handleControlSelect:this.handleControlSelect,handleToolSelect:this.handleToolSelect,onClearFilter:this.handleClearFilter})]}),c&&l.jsxs(B,{kind:"ghost",className:"btn-panels-menu btn-show-panels","data-testid":"app-main-panels-button",onClick:this.handleWidgetMenuClick,icon:Lp,children:["Panels",l.jsx(ci,{isShown:g,className:"panels-menu-popper",onExited:this.handleWidgetsMenuClose,closeOnBlur:!0,interactive:!0,children:l.jsx(DD,{widgets:C,onExportLayout:this.handleExportLayoutClick,onImportLayout:this.handleImportLayoutClick,onResetLayout:this.handleResetLayoutClick,onSelect:this.handleWidgetSelect})})]}),l.jsx(B,{kind:"ghost",className:U("btn-settings-menu",{"text-warning":n.operateAs!==n.name}),onClick:this.handleSettingsMenuShow,icon:l.jsx(Z,{icon:No,transform:"grow-3 right-1 down-1"}),tooltip:"User Settings"})]})]})}),l.jsxs(fv,{emptyDashboard:l.jsx(MD,{onAutoFillClick:this.handleAutoFillClick}),id:wn,layoutConfig:a,onGoldenLayoutChange:this.handleGoldenLayoutChange,onLayoutConfigChange:this.handleLayoutConfigChange,onLayoutInitialized:this.openNotebookFromURL,hydrate:this.hydrateDefault,children:[l.jsx(DI,{hydrate:this.hydrateGrid,getDownloadWorker:Io.getServiceWorker,loadPlugin:this.handleLoadTablePlugin}),l.jsx(TI,{hydrate:this.hydrateChart}),l.jsx(EI,{}),l.jsx(xI,{hydrateConsole:Ai.hydrateConsole,notebooksUrl:Xc("/notebooks/").href}),l.jsx(RI,{}),l.jsx(VI,{hydrate:this.hydratePandas}),l.jsx(HI,{}),l.jsx(jI,{}),f]}),l.jsx(Ct,{in:p,timeout:qe.transitionMidMs,classNames:"slide-left",mountOnEnter:!0,unmountOnExit:!0,children:l.jsx(kn,{serverConfigValues:i,onDone:this.handleSettingsMenuHide})}),l.jsx(ie,{actions:h}),l.jsx("input",{ref:this.importElement,type:"file",accept:".json",style:{display:"none"},onChange:this.handleImportLayoutFiles}),l.jsx(tf,{isOpen:m&&!u,icon:Pp,title:l.jsxs(l.Fragment,{children:[l.jsx(En,{})," Attempting to reconnect..."]}),subtitle:"Please check your network connection."}),l.jsx(ri,{confirmButtonText:"Refresh",onConfirm:Ai.handleRefresh,isOpen:u,headerText:"Authentication failed",bodyText:"Credentials are invalid. Please refresh your browser to try and reconnect."})]})}}const jD=d=>({activeTool:fr(d),dashboardData:Wt(d,wn),layoutStorage:RD(d),plugins:ub(d),connection:oR(d,wn),session:li(d,wn)?.session,sessionConfig:li(d,wn)?.config,user:pu(d),workspace:pr(d),serverConfigValues:ID(d)}),HD=St(jD,{setActiveTool:Sr,updateDashboardData:Hn,updateWorkspaceData:Ou})(Tg(Ai));function VD(){return l.jsxs("div",{className:"app",children:[l.jsx(HD,{}),l.jsx(qh,{})]})}const BD=X.module("LocalWorkspaceStorage");class Oi{static STORAGE_KEY="deephaven.WorkspaceStorage";static async makeDefaultWorkspaceData(e,t){const{filterSets:n,links:s,layoutConfig:i}=await Ra.getDefaultLayout(e,t?.isConsoleAvailable);return{settings:{defaultDateTimeFormat:He.DEFAULT_DATETIME_FORMAT_STRING,formatter:[],timeZone:He.DEFAULT_TIME_ZONE_ID,showTimeZone:!1,showTSeparator:!0,disableMoveConfirmation:!1,defaultDecimalFormatOptions:{defaultFormatString:xe.DEFAULT_FORMAT_STRING},defaultIntegerFormatOptions:{defaultFormatString:Ke.DEFAULT_FORMAT_STRING},truncateNumbersWithPound:!1,defaultNotebookSettings:{isMinimapEnabled:!1}},layoutConfig:i,closed:[{}],links:s,filterSets:n}}static async makeDefaultWorkspace(e,t){return{data:await Oi.makeDefaultWorkspaceData(e,t)}}layoutStorage;constructor(e){this.layoutStorage=e}async load(e){try{return JSON.parse(localStorage.getItem(Oi.STORAGE_KEY)??"")}catch{return BD.info("Unable to load workspace data, initializing to default data"),Oi.makeDefaultWorkspace(this.layoutStorage,e)}}async save(e){return localStorage.setItem(Oi.STORAGE_KEY,JSON.stringify(e)),e}}class $D{storageService;root;constructor(e,t=""){this.storageService=e,this.root=t}async getLayouts(){return(await this.storageService.listItems(this.root,"*.json")).map(t=>t.basename)}async getLayout(e){const n=await(await this.storageService.loadFile(`${this.root}/${e}`)).text();return JSON.parse(n)}}const ho=X.module("GrpcFileStorageTable");class nr{static REFRESH_DEBOUNCE=50;storageService;baseRoot;root;currentSize=0;currentViewport;listeners=[];viewportUpdatePromise;currentViewportData;childTables=new Map;constructor(e,t="",n=t){this.storageService=e,this.baseRoot=t,this.root=n,n===t&&(this.doRefresh=Xe(this.doRefresh.bind(this),nr.REFRESH_DEBOUNCE))}removeBaseRoot(e){return Ce.removeRoot(this.baseRoot,e)}getViewportData(){return this.viewportUpdatePromise||this.refreshInternal(),this.viewportUpdatePromise??Promise.resolve({items:[],offset:0})}getSnapshot(e){throw new Error("Method not implemented.")}get size(){return this.currentSize}setExpanded(e,t){const n=e.split("/");let s=n.shift();if((s===void 0||s==="")&&(s=n.shift()),s===void 0||s==="")throw new Error(`Invalid path: ${e}`);const i=n.join("/");if(t){if(!this.childTables.has(s)){const o=new nr(this.storageService,this.baseRoot,`${this.root}/${s}`);this.childTables.set(s,o)}i&&this.childTables.get(s)?.setExpanded(i,t)}else this.childTables.has(s)&&(i?this.childTables.get(s)?.setExpanded(i,t):this.childTables.delete(s));this.currentViewport&&this.refreshInternal()}collapseAll(){this.childTables.clear(),this.currentViewport&&this.refreshInternal()}setSearch(e){throw new Error("Method not implemented.")}setViewport(e){this.currentViewport=e,this.refreshInternal()}setFilters(){throw new Error("Method not implemented.")}setSorts(){throw new Error("Method not implemented.")}setReversed(){throw new Error("Method not implemented.")}close(){this.listeners=[]}onUpdate(e){return this.listeners=[...this.listeners,e],()=>{this.listeners=this.listeners.filter(t=>t!==e)}}doRefresh(e){ho.debug2("doRefresh",this.root),e(this.fetchData())}refresh(){ho.debug2("refresh",this.root),this.viewportUpdatePromise?.cancel();const e=new Promise(n=>{this.doRefresh(n)}),t=we.makeCancelable(e.then(n=>{if(this.viewportUpdatePromise!==t)throw new Hi;return this.currentViewportData=n,this.sendUpdate(),n}));t.catch(n=>{we.isCanceled(n)||ho.error("Error updating viewport",n)}),this.viewportUpdatePromise=t}refreshInternal(){try{this.refresh()}catch(e){we.isCanceled(e)||ho.error("Unable to refresh data",e)}}async fetchData(){const{currentViewport:e}=this;if(!e)throw new Error("No viewport set");let n=(await this.storageService.listItems(this.root)).map(s=>({type:s.type,filename:this.removeBaseRoot(s.filename),basename:s.basename,id:this.removeBaseRoot(s.filename),isExpanded:s.type==="directory"?this.childTables.has(s.basename):void 0})).sort((s,i)=>s.type!==i.type?s.type==="directory"?-1:1:s.basename.localeCompare(i.basename));for(let s=0;s<n.length;s+=1){const i=n[s],{basename:o,filename:a}=i;if(a===this.removeBaseRoot(`${this.root}/${o}`)&&i.type==="directory"){const r=this.childTables.get(o);if(r!=null){r.setViewport({top:0,bottom:e.bottom-s});const c=await r.getViewportData();n.splice(s+1,0,...c.items)}}}return this.currentSize=n.length,ho.debug2(this.root,"items",n,e),n=n.slice(e.top,e.bottom),{items:n,offset:e.top}}sendUpdate(){const{listeners:e}=this,t=this.currentViewportData??{items:[],offset:0};for(let n=0;n<e.length;n+=1)e[n](t)}}const UD=X.module("GrpcFileStorage");class _c{static REFRESH_THROTTLE=150;storageService;tables=[];root;constructor(e,t=""){this.storageService=e,this.root=t}removeRoot(e){return Ce.removeRoot(this.root,e)}addRoot(e){return Ce.addRoot(this.root,e)}async createDirectory(e){return await this.storageService.createDirectory(this.addRoot(e)),this.refreshTables(),{type:"directory",id:e,filename:e,basename:Ce.getBaseName(e)}}async getTable(){const e=new nr(this.storageService,this.root);return this.tables.push(e),e}async saveFile(e){const t=dh.storage.FileContents.text(e.content);return await this.storageService.saveFile(this.addRoot(e.filename),t,!0),this.refreshTables(),e}async loadFile(e){const n=await(await this.storageService.loadFile(this.addRoot(e))).text();return{filename:e,basename:Ce.getBaseName(e),content:n}}async deleteFile(e){await this.storageService.deleteItem(this.addRoot(e)),this.refreshTables()}async moveFile(e,t){await this.storageService.moveItem(this.addRoot(e),this.addRoot(t)),this.refreshTables()}async info(e){const t=await this.storageService.listItems(this.addRoot(Ce.getPath(e)),Ce.getBaseName(e));if(t.length===0)throw new Nc;if(t.length>1)throw UD.error("More than one matching file found, should never happen.",t),new Error("More than one matching file found");const n=t[0];return{filename:this.removeRoot(n.filename),basename:n.basename,id:this.removeRoot(n.filename),type:n.type}}refreshTables=ks(()=>{this.tables.forEach(e=>e.refresh())},_c.REFRESH_THROTTLE)}const WD=X.module("AppInit");function jc(d){const{workspace:e,setActiveTool:t,setCommandHistoryStorage:n,setDashboardData:s,setFileStorage:i,setLayoutStorage:o,setDashboardConnection:a,setDashboardSessionWrapper:r,setPlugins:c,setUser:h,setWorkspace:u,setWorkspaceStorage:m,setServerConfigValues:g}=d,p=Vp(),C=Bp(),f=$p(),[S,v]=b.useState();b.useEffect(function(){c(f)},[f,c]),b.useEffect(function(){async function I(){try{const D=await zS(),F=await KS(C,D),_="user",P=p.getStorageService(),$=new $D(P,"/layouts"),k=new _c(P,"/notebooks"),j=new Oi($),A=new eD,O=await j.load({isConsoleAvailable:F!==void 0}),{data:H}=O,{settings:G}=H;G.defaultDecimalFormatOptions===void 0&&(G.defaultDecimalFormatOptions={defaultFormatString:xe.DEFAULT_FORMAT_STRING}),G.defaultIntegerFormatOptions===void 0&&(G.defaultIntegerFormatOptions={defaultFormatString:Ke.DEFAULT_FORMAT_STRING}),G.truncateNumbersWithPound===void 0&&(G.truncateNumbersWithPound=!1);const{shortcutOverrides:z={}}=G,W=Le.isMacPlatform?z.mac??{}:z.windows??{};Object.entries(W).forEach(([J,ae])=>{Me.get(J)?.setKeyState(ae)});const Y={filterSets:H.filterSets,links:H.links},te=await p.getServerConfigValues(),re=new Map(te),ce={name:_,operateAs:_,groups:[],permissions:{isACLEditor:!1,isSuperUser:!1,isQueryViewOnly:!1,isNonInteractive:!1,canUsePanels:!0,canCreateDashboard:!0,canCreateCodeStudio:!0,canCreateQueryMonitor:!0,canCopy:re.get("internal.webClient.appInit.canCopy")!=="false",canDownloadCsv:re.get("internal.webClient.appInit.canDownloadCsv")!=="false"}};t($t.DEFAULT),g(re),n(A),s(wn,Y),i(k),o($),a(wn,C),F!==void 0&&r(wn,F),h(ce),m(j),u(O)}catch(D){WD.error(D),v(D)}}I()},[p,C,t,n,s,i,o,a,r,h,u,m,g]);const w=e==null&&S==null,T=!w&&S==null,y=S!=null?`${S}`:null;return l.jsxs(l.Fragment,{children:[T&&l.jsx(VD,{}),l.jsx(or,{isLoading:w&&y==null,isLoaded:T,errorMessage:y})]})}jc.propTypes={workspace:M.shape({}),workspaceStorage:M.shape({close:M.func}),setActiveTool:M.func.isRequired,setCommandHistoryStorage:M.func.isRequired,setDashboardData:M.func.isRequired,setFileStorage:M.func.isRequired,setLayoutStorage:M.func.isRequired,setDashboardConnection:M.func.isRequired,setDashboardSessionWrapper:M.func.isRequired,setPlugins:M.func.isRequired,setUser:M.func.isRequired,setWorkspace:M.func.isRequired,setWorkspaceStorage:M.func.isRequired};jc.defaultProps={workspace:null,workspaceStorage:null};const GD=d=>({workspace:pr(d),workspaceStorage:cb(d)}),Dh=St(GD,{setActiveTool:Sr,setCommandHistoryStorage:pb,setDashboardData:im,setFileStorage:fb,setLayoutStorage:tD,setDashboardConnection:aR,setDashboardSessionWrapper:rR,setPlugins:Sb,setUser:mb,setWorkspace:Au,setWorkspaceStorage:gb,setServerConfigValues:bb})(jc);function zD(){return l.jsx(Eg,{basename:"/ide/",children:l.jsxs(yg,{children:[l.jsx($c,{exact:!0,path:"/",component:Dh}),l.jsx($c,{path:"/notebook/:notebookPath+",component:Dh}),l.jsx(xg,{from:"*",to:"/"})]})})}function t0(){return Io.registerOnLoaded(),Bt.init({getWorker:()=>new Ig}),window["__react-beautiful-dnd-disable-dev-warnings"]=!0,l.jsx(Nh,{store:tc,children:l.jsx(zD,{})})}export{t0 as AppRoot,t0 as default};
43
- //# sourceMappingURL=AppRoot-98cdf6be.js.map
43
+ //# sourceMappingURL=AppRoot-0ddfec1d.js.map