@deephaven/code-studio 0.35.1-beta.1 → 0.35.1-react-spectrum-provider.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import{A as b,B as I,H as J,P as Hm,C as l,D as ft,F as $,R as Bi,G as Q,I as _e,J as ge,K as Ye,L as Vm,M as Bm,N as Rl,O as tr,Q as Um,E as xl,S as $m,T as il,U as fe,V as ol,W as Ls,X as Th,Y as it,Z as Il,_ as Wm,$ as Gm,a0 as zm,a1 as Km,a2 as me,a3 as Ac,a4 as Dl,a5 as qm,a6 as Ym,a7 as Eh,a8 as He,a9 as al,aa as nr,ab as Xm,ac as Ln,ad as Zm,ae as Qm,af as Jm,ag as eg,ah as rl,ai as tg,aj as ng,ak as sg,al as Lc,am as ig,an as Pc,ao as og,ap as ag,aq as rg,ar as lg,as as cg,at as dg,au as Ct,av as yh,aw as hg,ax as Rh,ay as ug,az as xh,aA as mg,aB as gg,aC as pg,aD as fg,aE as Cg,aF as Sg,aG as bg,aH as wg,aI as vg,aJ as Tg,aK as _c,aL as Eg}from"./vendor-44bb27a6.js";import{e as Qn,l as An,K as dn,a as jc,R as yg,b as Ds,W as Rg}from"./monaco-a26f85af.js";import{T as Ke,L as Z,M as zi,a as Ki,b as Mo,v as Ih,c as yn,d as Dh,e as Pn,f as xg,g as Ig,h as ko,i as Dg,j as qi,k as Fl,l as Fg,m as ll,n as Ng,o as Fh,p as Nl,q as Nh,r as Hc,s as Mg,t as kg,u as Og,w as Ag,x as Jt,y as As,z as Mh,A as Jn,B as sr,C as Ui,D as Lg,E as Pg,F as Vc,G as Da,H as Bc,I as kh,J as _g,K as Oo,N as Oh,O as jg,P as Hg,Q as Ml,R as kl,S as Fa,U as Un,V as Vg,W as Bg,X as Ug,Y as $g,Z as Wg,_ as Ol,$ as Ps,a0 as Uc,a1 as Ao,a2 as Al,a3 as Ll,a4 as Gg,a5 as zg,a6 as Na,a7 as Kg,a8 as Pl,a9 as Ah,aa as si,ab as qg,ac as Yg,ad as Xg,ae as Zg,af as Qg,ag as Jg,ah as $c,ai as Lr,aj as ep,ak as tp,al as np,am as sp,an as ip,ao as Lh,ap as op,aq as ap,ar as rp,as as Ph,at as lp,au as cp,av as dp,aw as hp,ax as up,ay as mp,az as gp,aA as pp,aB as fp,aC as Cp,aD as Sp,aE as bp,aF as _h,aG as wp,aH as cl,aI as dl,aJ as vp,aK as Tp,aL as Ep,aM as yp,aN as Rp,aO as xp,aP as Ip,aQ as Dp,aR as Fp,aS as Np,aT as Mp,aU as Wc,aV as kp,aW as Op,aX as Ap}from"./index-e15126db.js";import{P as Ma,b as Lp,h as Pp,p as _p,o as jp,s as Hp,t as Vp,c as Pr}from"./plotly-a0b86fc0.js";import"./helpers-042e6b4d.js";class Bp extends b.Component{static propTypes={children:I.node.isRequired,options:I.shape({}),className:I.string,timeout:I.number,onEntered:I.func,onExited:I.func,isShown:I.bool,closeOnBlur:I.bool,interactive:I.bool,referenceObject:I.shape({}),"data-testid":I.string};static defaultProps={options:{},className:"",timeout:Ke.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=J.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 Hm(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(ft,{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:$("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&&Bi.createPortal(this.renderContent(),this.element)})}}const hi=Bp,Up=Z.module("Tooltip");class Lt 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:Lt.defaultReshowTimeout,timeout:Lt.defaultTimeout,onEntered:()=>{},onExited:()=>{},"data-testid":void 0};static handleHidden(){Lt.shownTooltipCount-=1,Lt.shownTooltipCount===0&&(Lt.lastHiddenTime=Date.now())}static handleShown(){Lt.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=J.createRef(),this.popper=J.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?Lt.handleShown():Lt.handleHidden())}componentWillUnmount(){this.stopListening(),this.stopListeningWindow(),this.stopTimer();const{isShown:e}=this.state;e&&Lt.handleHidden()}container;popper;parent;timer;startListening(){if(!this.container.current||!this.container.current.parentElement){Up.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;(Lt.shownTooltipCount>0||Date.now()-Lt.lastHiddenTime<Lt.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(hi,{className:$(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=Lt;function ir(d){const{children:e,className:t,style:n,"data-testid":s}=d;return l.jsx("div",{className:$("btn-group",t),style:n,role:"group","data-testid":s,children:e})}ir.displayName="ButtonGroup";ir.propTypes={children:I.node.isRequired,className:I.string,style:I.object,"data-testid":I.string};ir.defaultProps={className:null,style:{},"data-testid":void 0};const $p=["primary","secondary","tertiary","success","danger","inline","ghost"],Wp=["group-end"];function Gp(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 $("btn-link",{"btn-link-icon":e,"btn-link-icon-only":e})}}function zp(d){switch(d){case"group-end":return $("pl-2","pr-3")}}const or=J.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),D=Gp(t,E);let F;n&&(F=zp(n));let N;o&&(N=J.isValidElement(o)?o:l.jsx(Q,{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 U=l.jsxs("button",{"data-testid":T,ref:e,type:s,className:$("btn",D,F,{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&&N,v,i!=null&&!a&&_]});return a?l.jsxs("span",{className:"btn-disabled-wrapper",children:[U,i!==void 0&&_]}):U});or.displayName="Button";or.propTypes={kind:I.oneOf($p).isRequired,variant:I.oneOf(Wp),type:I.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&&!J.isValidElement(t)&&(t==null||t.iconName===""||t.iconName==null)?new Error("Icon must be react element or fontawesome IconDefinition"):null},disabled:I.bool,active:I.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:I.func,onMouseUp:I.func,onMouseDown:I.func,onMouseEnter:I.func,onMouseLeave:I.func,onKeyDown:I.func,tabIndex:I.number,children:I.node,className:I.string,style:I.object,"data-testid":I.string};or.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=or;function Kp({className:d,icon:e,isOpen:t,subtitle:n,title:s}){return l.jsx(zi,{isOpen:t,className:d,children:l.jsx(Ki,{children:l.jsxs("div",{className:"info-modal",children:[e!=null&&l.jsx("div",{className:"message-icon",children:l.jsx(Q,{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 ci(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(zi,{isOpen:e,className:"theme-bg-light",onOpened:S,children:[l.jsx(Mo,{closeButton:!1,children:t}),l.jsx(Ki,{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(ir,{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]})]})]})}ci.propTypes={isOpen:I.bool.isRequired,headerText:I.string.isRequired,bodyText:I.oneOfType([I.string,I.func]).isRequired,onCancel:I.func,onConfirm:I.func.isRequired,onDiscard:I.func,onModalDisable:I.func,cancelButtonText:I.string,confirmButtonText:I.string,discardButtonText:I.string,children:I.node,"data-testid":I.string};ci.defaultProps={children:void 0,cancelButtonText:"Cancel",confirmButtonText:"Okay",discardButtonText:"Discard",onCancel:void 0,onDiscard:void 0,onModalDisable:void 0,"data-testid":void 0};const ar=J.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:$("btn",n),onClick:i,style:o,disabled:s,id:a,children:t})});ar.displayName="Button";ar.propTypes={children:I.node,className:I.string,disabled:I.bool,onClick:I.func,style:I.shape({}),id:I.string};ar.defaultProps={children:null,className:"",disabled:!1,onClick:()=>null,style:{},id:""};const Gc=ar;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:$(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 Ve=Qs,zc=Z.module("GlobalContextAction");class qp 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),zc.debug("Received context menu event at global action! Menu items are now: ",t.contextActions))}handleKeyDown(e){const{action:t}=this.props;!Ve.actionsDisabled&&t.shortcut!==void 0&&t.shortcut.matchesEvent(e)&&(zc.debug("Global hotkey matched!",e),t.action?.(e),e.preventDefault(),e.stopPropagation())}render(){return null}}const Yp=qp;class Xp 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(Yp,{action:i,"data-testid":t},`${i.title}.${o?.id}`);n.push(a)}}return n}}const Zp=Xp;const na=Z.module("ContextActions");class Qp 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=J.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){na.debug2(`Contextmenu event ignored based on the target className "${o}"`);return}s=s.parentElement}}if(Ve.isContextActionEvent(e)||(e.contextActions=[]),!Ve.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)}na.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];!Ve.actionsDisabled&&s.shortcut!=null&&s.shortcut.matchesEvent(e)&&(na.debug("Context hotkey matched!",e),s.action?.(e),e.stopPropagation(),e.preventDefault(),na.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(Zp,{actions:t})})}}const ie=Qp,Hl=J.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":D}=d,F={menuItem:T,closeMenu:w,isKeyboardSelected:y,isMouseSelected:E,iconElement:S,displayShortcut:v,"data-testid":D};return J.cloneElement(f,{forwardedProps:F})}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(J.isValidElement(f))m=f;else{let S;a.iconColor!=null&&(a.disabled===void 0||!a.disabled)&&(S={color:a.iconColor}),m=l.jsx(Q,{icon:f,style:S})}}let g=null;const p=Boolean(o);a.actions&&(g=l.jsx(Q,{icon:Ih}));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:$("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:$("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:$("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 jh=Hl,Fe=Object.freeze([]),qn=new Map;class Jp extends Error{isCanceled=!0}const $i=Jp;class rr{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),rr.getBrightness(i)<125}static getBrightness(e){return Math.round((e[0]*299+e[1]*587+e[2]*114)/1e3)}}async function Yi(d){const{clipboard:e}=navigator;if(e!==void 0)try{return navigator.clipboard.writeText(d)}catch{return Kc(d)}Kc(d)}function Kc(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 ef="table_",qc="column_",tf=new Set(["in","not","i","ii","k"]),nf=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"]),sf=/[^a-zA-Z0-9_$+@-]/g,of=/[^A-Za-z0-9_$]/g;class un{static legalize=(e,t,n,s,i)=>{let o=e.trim().replace(/[- ]/g,"_");return s&&(tf.has(o)||nf.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=>un.legalize(e,ef,sf,!1,0);static legalizeColumnNames=e=>{const t=[];return e.forEach((n,s)=>{let i=un.legalizeColumnName(n,s);t.includes(i)&&(i=qc+s),t.push(i)}),t};static legalizeColumnName=(e,t=0)=>un.legalize(e,qc,of,!0,t);static isValidTableName=e=>un.legalizeTableName(e)===e;static isValidColumnName=e=>un.legalizeColumnName(e)===e}function af(d,e){return d?d.closest(`.${e}`):null}const rf={getClosestByClassName:af};class Ue extends CustomEvent{constructor(e,t){super(e,t)}}class lf extends Error{isTimeout=!0}const Hh=lf;class ve{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 $i),s!=null&&t&&t(s)},o}static isCanceled(e){return e instanceof $i}static isTimedOut(e){return e instanceof Hh}static withTimeout(e,t){return new Promise((n,s)=>{setTimeout(()=>{try{n(t())}catch(i){s(i)}},e)})}}class cf{pending=[];resolved=[];add(e,t){const n=ve.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=cf;function M(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 hn{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(!hn.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},[])}}class df{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=df;class Xi{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(Xi.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])}}class hf extends Error{isInvalid=!0}const Li=hf,Yc=Z.module("ContextMenu");class ka 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=J.createRef(),this.oldFocus=document.activeElement,this.activeSubMenuRef=J.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=Ve.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:Ve.sortActions(i)})}initMenuPromise(e){const t=ve.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:Ve.sortActions(s.menuItems.concat(n)),pendingItems:o}}return null})},n=>{ve.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}),Yc.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){Yc.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=Ve.getNextMenuItem(s,-1,t):(e.key==="ArrowDown"||e.key==="Tab")&&(s=Ve.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(jh,{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(yn,{})}));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:$({"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:ka.handleContextMenu,role:"menuitem",tabIndex:0,"data-testid":f,children:[e,p]}),S&&s!==null&&h!==null&&u!==null&&l.jsx(ka,{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 uf=ka;class mf extends b.Component{constructor(e){super(e),this.handleMenuClose=this.handleMenuClose.bind(this),this.handleContextMenu=this.handleContextMenu.bind(this),this.container=J.createRef(),this.openMenu=J.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(!Ve.isContextActionEvent(e)||!this.container.current||e.metaKey||e.ctrlKey)return;const t=Ve.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(uf,{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:$("context-menu-root",{active:n}),ref:this.container,children:e})}}const Vh=mf;class vs extends b.Component{static propTypes={className:I.string,in:I.bool.isRequired,children:I.node.isRequired,autoFocusOnShow:I.bool,"data-testid":I.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(ft,{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:$({collapse:i==="exited"},t),"data-testid":s,children:e})})}}const gf=vs;function lr(d){const e=b.useRef();return b.useEffect(function(){e.current=d}),e.current}function Bh(d){const e=b.useRef(null);return b.useEffect(function(){d&&(typeof d=="function"?d(e.current):d.current=e.current)}),e}const pf=3500,ff=Z.module("useCopyToClipboard");function Cf(){const[d,e]=b.useState(!1),t=b.useRef(null),n=b.useCallback(s=>{Yi(s).then(()=>{e(!0)}).catch(i=>ff.error(`Unable to copy ${s}`,`
1
+ import{A as b,B as I,H as J,P as Hm,C as l,D as ft,F as $,R as Bi,G as Q,I as _e,J as ge,K as Ye,L as Vm,M as Bm,N as Rl,O as tr,Q as Um,E as xl,S as $m,T as il,U as fe,V as ol,W as Ls,X as Th,Y as it,Z as Il,_ as Wm,$ as Gm,a0 as zm,a1 as Km,a2 as me,a3 as Ac,a4 as Dl,a5 as qm,a6 as Ym,a7 as Eh,a8 as He,a9 as al,aa as nr,ab as Xm,ac as Ln,ad as Zm,ae as Qm,af as Jm,ag as eg,ah as rl,ai as tg,aj as ng,ak as sg,al as Lc,am as ig,an as Pc,ao as og,ap as ag,aq as rg,ar as lg,as as cg,at as dg,au as Ct,av as yh,aw as hg,ax as Rh,ay as ug,az as xh,aA as mg,aB as gg,aC as pg,aD as fg,aE as Cg,aF as Sg,aG as bg,aH as wg,aI as vg,aJ as Tg,aK as _c,aL as Eg}from"./vendor-494e0592.js";import{e as Qn,l as An,K as dn,a as jc,R as yg,b as Ds,W as Rg}from"./monaco-a26f85af.js";import{T as Ke,L as Z,M as zi,a as Ki,b as Mo,v as Ih,c as yn,d as Dh,e as Pn,f as xg,g as Ig,h as ko,i as Dg,j as qi,k as Fl,l as Fg,m as ll,n as Ng,o as Fh,p as Nl,q as Nh,r as Hc,s as Mg,t as kg,u as Og,w as Ag,x as Jt,y as As,z as Mh,A as Jn,B as sr,C as Ui,D as Lg,E as Pg,F as Vc,G as Da,H as Bc,I as kh,J as _g,K as Oo,N as Oh,O as jg,P as Hg,Q as Ml,R as kl,S as Fa,U as Un,V as Vg,W as Bg,X as Ug,Y as $g,Z as Wg,_ as Ol,$ as Ps,a0 as Uc,a1 as Ao,a2 as Al,a3 as Ll,a4 as Gg,a5 as zg,a6 as Na,a7 as Kg,a8 as Pl,a9 as Ah,aa as si,ab as qg,ac as Yg,ad as Xg,ae as Zg,af as Qg,ag as Jg,ah as $c,ai as Lr,aj as ep,ak as tp,al as np,am as sp,an as ip,ao as Lh,ap as op,aq as ap,ar as rp,as as Ph,at as lp,au as cp,av as dp,aw as hp,ax as up,ay as mp,az as gp,aA as pp,aB as fp,aC as Cp,aD as Sp,aE as bp,aF as _h,aG as wp,aH as cl,aI as dl,aJ as vp,aK as Tp,aL as Ep,aM as yp,aN as Rp,aO as xp,aP as Ip,aQ as Dp,aR as Fp,aS as Np,aT as Mp,aU as Wc,aV as kp,aW as Op,aX as Ap}from"./index-77c47f16.js";import{P as Ma,b as Lp,h as Pp,p as _p,o as jp,s as Hp,t as Vp,c as Pr}from"./plotly-92dafae1.js";import"./helpers-042e6b4d.js";class Bp extends b.Component{static propTypes={children:I.node.isRequired,options:I.shape({}),className:I.string,timeout:I.number,onEntered:I.func,onExited:I.func,isShown:I.bool,closeOnBlur:I.bool,interactive:I.bool,referenceObject:I.shape({}),"data-testid":I.string};static defaultProps={options:{},className:"",timeout:Ke.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=J.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 Hm(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(ft,{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:$("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&&Bi.createPortal(this.renderContent(),this.element)})}}const hi=Bp,Up=Z.module("Tooltip");class Lt 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:Lt.defaultReshowTimeout,timeout:Lt.defaultTimeout,onEntered:()=>{},onExited:()=>{},"data-testid":void 0};static handleHidden(){Lt.shownTooltipCount-=1,Lt.shownTooltipCount===0&&(Lt.lastHiddenTime=Date.now())}static handleShown(){Lt.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=J.createRef(),this.popper=J.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?Lt.handleShown():Lt.handleHidden())}componentWillUnmount(){this.stopListening(),this.stopListeningWindow(),this.stopTimer();const{isShown:e}=this.state;e&&Lt.handleHidden()}container;popper;parent;timer;startListening(){if(!this.container.current||!this.container.current.parentElement){Up.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;(Lt.shownTooltipCount>0||Date.now()-Lt.lastHiddenTime<Lt.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(hi,{className:$(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=Lt;function ir(d){const{children:e,className:t,style:n,"data-testid":s}=d;return l.jsx("div",{className:$("btn-group",t),style:n,role:"group","data-testid":s,children:e})}ir.displayName="ButtonGroup";ir.propTypes={children:I.node.isRequired,className:I.string,style:I.object,"data-testid":I.string};ir.defaultProps={className:null,style:{},"data-testid":void 0};const $p=["primary","secondary","tertiary","success","danger","inline","ghost"],Wp=["group-end"];function Gp(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 $("btn-link",{"btn-link-icon":e,"btn-link-icon-only":e})}}function zp(d){switch(d){case"group-end":return $("pl-2","pr-3")}}const or=J.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),D=Gp(t,E);let F;n&&(F=zp(n));let N;o&&(N=J.isValidElement(o)?o:l.jsx(Q,{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 U=l.jsxs("button",{"data-testid":T,ref:e,type:s,className:$("btn",D,F,{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&&N,v,i!=null&&!a&&_]});return a?l.jsxs("span",{className:"btn-disabled-wrapper",children:[U,i!==void 0&&_]}):U});or.displayName="Button";or.propTypes={kind:I.oneOf($p).isRequired,variant:I.oneOf(Wp),type:I.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&&!J.isValidElement(t)&&(t==null||t.iconName===""||t.iconName==null)?new Error("Icon must be react element or fontawesome IconDefinition"):null},disabled:I.bool,active:I.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:I.func,onMouseUp:I.func,onMouseDown:I.func,onMouseEnter:I.func,onMouseLeave:I.func,onKeyDown:I.func,tabIndex:I.number,children:I.node,className:I.string,style:I.object,"data-testid":I.string};or.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=or;function Kp({className:d,icon:e,isOpen:t,subtitle:n,title:s}){return l.jsx(zi,{isOpen:t,className:d,children:l.jsx(Ki,{children:l.jsxs("div",{className:"info-modal",children:[e!=null&&l.jsx("div",{className:"message-icon",children:l.jsx(Q,{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 ci(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(zi,{isOpen:e,className:"theme-bg-light",onOpened:S,children:[l.jsx(Mo,{closeButton:!1,children:t}),l.jsx(Ki,{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(ir,{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]})]})]})}ci.propTypes={isOpen:I.bool.isRequired,headerText:I.string.isRequired,bodyText:I.oneOfType([I.string,I.func]).isRequired,onCancel:I.func,onConfirm:I.func.isRequired,onDiscard:I.func,onModalDisable:I.func,cancelButtonText:I.string,confirmButtonText:I.string,discardButtonText:I.string,children:I.node,"data-testid":I.string};ci.defaultProps={children:void 0,cancelButtonText:"Cancel",confirmButtonText:"Okay",discardButtonText:"Discard",onCancel:void 0,onDiscard:void 0,onModalDisable:void 0,"data-testid":void 0};const ar=J.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:$("btn",n),onClick:i,style:o,disabled:s,id:a,children:t})});ar.displayName="Button";ar.propTypes={children:I.node,className:I.string,disabled:I.bool,onClick:I.func,style:I.shape({}),id:I.string};ar.defaultProps={children:null,className:"",disabled:!1,onClick:()=>null,style:{},id:""};const Gc=ar;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:$(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 Ve=Qs,zc=Z.module("GlobalContextAction");class qp 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),zc.debug("Received context menu event at global action! Menu items are now: ",t.contextActions))}handleKeyDown(e){const{action:t}=this.props;!Ve.actionsDisabled&&t.shortcut!==void 0&&t.shortcut.matchesEvent(e)&&(zc.debug("Global hotkey matched!",e),t.action?.(e),e.preventDefault(),e.stopPropagation())}render(){return null}}const Yp=qp;class Xp 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(Yp,{action:i,"data-testid":t},`${i.title}.${o?.id}`);n.push(a)}}return n}}const Zp=Xp;const na=Z.module("ContextActions");class Qp 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=J.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){na.debug2(`Contextmenu event ignored based on the target className "${o}"`);return}s=s.parentElement}}if(Ve.isContextActionEvent(e)||(e.contextActions=[]),!Ve.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)}na.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];!Ve.actionsDisabled&&s.shortcut!=null&&s.shortcut.matchesEvent(e)&&(na.debug("Context hotkey matched!",e),s.action?.(e),e.stopPropagation(),e.preventDefault(),na.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(Zp,{actions:t})})}}const ie=Qp,Hl=J.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":D}=d,F={menuItem:T,closeMenu:w,isKeyboardSelected:y,isMouseSelected:E,iconElement:S,displayShortcut:v,"data-testid":D};return J.cloneElement(f,{forwardedProps:F})}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(J.isValidElement(f))m=f;else{let S;a.iconColor!=null&&(a.disabled===void 0||!a.disabled)&&(S={color:a.iconColor}),m=l.jsx(Q,{icon:f,style:S})}}let g=null;const p=Boolean(o);a.actions&&(g=l.jsx(Q,{icon:Ih}));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:$("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:$("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:$("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 jh=Hl,Fe=Object.freeze([]),qn=new Map;class Jp extends Error{isCanceled=!0}const $i=Jp;class rr{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),rr.getBrightness(i)<125}static getBrightness(e){return Math.round((e[0]*299+e[1]*587+e[2]*114)/1e3)}}async function Yi(d){const{clipboard:e}=navigator;if(e!==void 0)try{return navigator.clipboard.writeText(d)}catch{return Kc(d)}Kc(d)}function Kc(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 ef="table_",qc="column_",tf=new Set(["in","not","i","ii","k"]),nf=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"]),sf=/[^a-zA-Z0-9_$+@-]/g,of=/[^A-Za-z0-9_$]/g;class un{static legalize=(e,t,n,s,i)=>{let o=e.trim().replace(/[- ]/g,"_");return s&&(tf.has(o)||nf.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=>un.legalize(e,ef,sf,!1,0);static legalizeColumnNames=e=>{const t=[];return e.forEach((n,s)=>{let i=un.legalizeColumnName(n,s);t.includes(i)&&(i=qc+s),t.push(i)}),t};static legalizeColumnName=(e,t=0)=>un.legalize(e,qc,of,!0,t);static isValidTableName=e=>un.legalizeTableName(e)===e;static isValidColumnName=e=>un.legalizeColumnName(e)===e}function af(d,e){return d?d.closest(`.${e}`):null}const rf={getClosestByClassName:af};class Ue extends CustomEvent{constructor(e,t){super(e,t)}}class lf extends Error{isTimeout=!0}const Hh=lf;class ve{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 $i),s!=null&&t&&t(s)},o}static isCanceled(e){return e instanceof $i}static isTimedOut(e){return e instanceof Hh}static withTimeout(e,t){return new Promise((n,s)=>{setTimeout(()=>{try{n(t())}catch(i){s(i)}},e)})}}class cf{pending=[];resolved=[];add(e,t){const n=ve.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=cf;function M(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 hn{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(!hn.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},[])}}class df{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=df;class Xi{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(Xi.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])}}class hf extends Error{isInvalid=!0}const Li=hf,Yc=Z.module("ContextMenu");class ka 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=J.createRef(),this.oldFocus=document.activeElement,this.activeSubMenuRef=J.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=Ve.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:Ve.sortActions(i)})}initMenuPromise(e){const t=ve.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:Ve.sortActions(s.menuItems.concat(n)),pendingItems:o}}return null})},n=>{ve.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}),Yc.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){Yc.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=Ve.getNextMenuItem(s,-1,t):(e.key==="ArrowDown"||e.key==="Tab")&&(s=Ve.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(jh,{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(yn,{})}));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:$({"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:ka.handleContextMenu,role:"menuitem",tabIndex:0,"data-testid":f,children:[e,p]}),S&&s!==null&&h!==null&&u!==null&&l.jsx(ka,{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 uf=ka;class mf extends b.Component{constructor(e){super(e),this.handleMenuClose=this.handleMenuClose.bind(this),this.handleContextMenu=this.handleContextMenu.bind(this),this.container=J.createRef(),this.openMenu=J.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(!Ve.isContextActionEvent(e)||!this.container.current||e.metaKey||e.ctrlKey)return;const t=Ve.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(uf,{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:$("context-menu-root",{active:n}),ref:this.container,children:e})}}const Vh=mf;class vs extends b.Component{static propTypes={className:I.string,in:I.bool.isRequired,children:I.node.isRequired,autoFocusOnShow:I.bool,"data-testid":I.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(ft,{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:$({collapse:i==="exited"},t),"data-testid":s,children:e})})}}const gf=vs;function lr(d){const e=b.useRef();return b.useEffect(function(){e.current=d}),e.current}function Bh(d){const e=b.useRef(null);return b.useEffect(function(){d&&(typeof d=="function"?d(e.current):d.current=e.current)}),e}const pf=3500,ff=Z.module("useCopyToClipboard");function Cf(){const[d,e]=b.useState(!1),t=b.useRef(null),n=b.useCallback(s=>{Yi(s).then(()=>{e(!0)}).catch(i=>ff.error(`Unable to copy ${s}`,`
2
2
  `,i))},[]);return b.useEffect(()=>(t.current&&clearTimeout(t.current),d&&(t.current=setTimeout(()=>{e(!1)},pf)),()=>{t.current&&clearTimeout(t.current)}),[d]),[d,n]}const cr=J.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(_e()),g=Bh(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:$("custom-control custom-checkbox",s),children:[l.jsx("input",{type:"checkbox",ref:g,checked:t??!1,className:$("custom-control-input",o,{"is-invalid":a}),disabled:i,id:m,name:c,onChange:p,"data-testid":u}),l.jsx("label",{className:$("custom-control-label",r),htmlFor:m,children:n})]})});cr.displayName="Checkbox";cr.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:I.node.isRequired,className:I.string,disabled:I.bool,inputClassName:I.string,isInvalid:I.bool,labelClassName:I.string,name:I.string,onChange:I.func,"data-testid":I.string};cr.defaultProps={checked:!1,className:"",disabled:!1,inputClassName:"",isInvalid:!1,labelClassName:"",name:void 0,onChange:void 0,"data-testid":void 0};const Zt=cr;class Sf extends b.PureComponent{static defaultProps={placeholder:"Search",className:"",matchCount:null,onKeyDown(){},id:"","data-testid":void 0};constructor(e){super(e),this.inputField=J.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:$("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(Q,{icon:Dh})})]})}}const _s=Sf;var Uh=(d=>(d.UP="UP",d.DOWN="DOWN",d))(Uh||{});class xi extends b.Component{static MENU_NAVIGATION_DIRECTION=Uh;static DROP_DOWN_MENU_HEIGHT=200;static propTypes={options:I.arrayOf(I.shape({title:I.string.isRequired,value:I.string.isRequired})).isRequired,popperOptions:I.shape({title:I.string.isRequired,value:I.string.isRequired}),onChange:I.func,inputPlaceholder:I.string,searchPlaceholder:I.string,disabled:I.bool,className:I.string,defaultValue:I.string,spellCheck:I.bool,onEnter:I.func,"data-testid":I.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=J.createRef(),this.cbContainer=J.createRef(),this.toggleButton=J.createRef(),this.menuContainer=J.createRef(),this.input=J.createRef(),this.searchInput=J.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=ge((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(xi.MENU_NAVIGATION_DIRECTION.UP),e.stopPropagation(),e.preventDefault();break;case"ArrowDown":this.handleMenuNavigation(xi.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 xi.MENU_NAVIGATION_DIRECTION.UP:r=-1;break;case xi.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(_s,{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:$("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:$("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(Q,{icon:Pn}),l.jsx(hi,{ref:this.popper,options:c,className:$("combobox interactive"),onEntered:this.handleMenuOpened,onExited:this.handleMenuExited,children:this.renderMenuElement()})]})})]})}}const $h=xi;function dr({copy:d,kind:e="ghost",tooltip:t="Copy",className:n,"data-testid":s,children:i}){const[o,a]=Cf();return l.jsx(B,{kind:e,className:n,"data-testid":s,icon:o?xg:Ig,tooltip:o?"Copied":t,onClick:()=>{a(typeof d=="function"?d():d)},children:i})}function Wh(d,e,t){return d.substring(0,e)+t+d.substring(e+1)}function bf(d,e,t){return d.length<t?`${d}${e.substring(d.length,t)}`:d}function Xc(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 mn=Z.module("MaskedInput"),vi={FORWARD:"forward",BACKWARD:"backward",NONE:"none"},sa=" ",Gh=J.forwardRef((d,e)=>{const{className:t,example:n,getNextSegmentValue:s=(O,j,k)=>k,getPreferredReplacementString:i=Wh,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=Bh(e),S=b.useMemo(()=>Array.isArray(n)?n:[n],[n]),v=b.useMemo(()=>S[0].replace(/[a-zA-Z0-9]/g,sa),[S]);b.useEffect(function(){if(u!=null){mn.debug("setting selection...",u);const{selectionStart:j,selectionEnd:k,selectionDirection:A}=u;f.current?.setSelectionRange(j,k,A),mn.debug("selection set!")}},[u,f]);const w=b.useCallback(O=>{let j=O,k=O;const A=S.length>0?S[0]:m;for(let K=j-1;K>=0&&/[a-zA-Z0-9]/g.test(A.charAt(K));K-=1)j=K;for(let K=k;K<A.length&&/[a-zA-Z0-9]/g.test(A.charAt(K));K+=1)k=K+1;const H=j===k?vi.NONE:vi.BACKWARD;return{selectionStart:j,selectionEnd:k,selectionDirection:H}},[S,m]);function T(O,j,k=O.length){let A="";for(let H=0;H<k;H+=1)O.charAt(H)!==sa?A=A.concat(O[H]):A=A.concat(j[H]);return A=A.concat(j.substring(k)),A}function y(O,j=O.length){const k=new RegExp(`^${c}$`);if(k.test(O))return!0;for(let A=0;A<S.length;A+=1){const H=T(O,S[A],j);if(k.test(H))return!0}return!1}function E(O){const j=w(O),k=j.selectionEnd+1;return k>=m.length?j:w(k)}function D(O){const j=w(O),k=j.selectionStart-1;return k<=0?j:w(k)}function F(O,j){const k=w(O),A=m.substring(k.selectionStart,k.selectionEnd),H=s(k,j,A,m),K=m.substring(0,k.selectionStart)+H+m.substring(k.selectionEnd);y(K,k.selectionEnd)&&(o(K),a(k))}const N=b.useCallback(O=>{const{selectionStart:j=0,selectionEnd:k=0,selectionDirection:A="none"}=O.target;if(j===null||k===null||A===null){mn.error("Selection attempted on non-text input element",O.target);return}if(mn.debug2("handleSelect",j,k,A),!(u!=null&&j===u.selectionStart&&k===u.selectionEnd)){if(u!=null&&j===m.length&&k===m.length&&O.nativeEvent.type!=="mouseup"){a({...u});return}if(j===k){const H=w(j);mn.debug("Selection segment from ",j,k,"=>",H),a(H)}else a({selectionStart:j,selectionEnd:k,selectionDirection:A})}},[w,a,u,m]),_=b.useCallback(O=>{if(!f.current)return;mn.debug("handleSelectCapture",O);const j=f.current.selectionStart??0;j===m.length&&u!=null&&j!==u.selectionStart&&(O.preventDefault(),O.stopPropagation())},[f,u,m]);function P(O){if(O.preventDefault(),O.stopPropagation(),!f.current)return;const{key:j}=O,{selectionStart:k=0,selectionEnd:A=0}=f.current;if(k===null||A===null){mn.error("Selection arrow nvaigation attempted on non-text input element",O.target);return}j==="ArrowLeft"?a(D(k)):j==="ArrowRight"?a(E(A)):j==="ArrowUp"?F(k,-1):j==="ArrowDown"&&F(k,1)}function U(O){if(!f.current)return;mn.debug("handleKeyDown",O);const{key:j}=O,{selectionStart:k=0,selectionEnd:A=0}=f.current;if(k===null||A===null){mn.error("Selection key event on non-text input element",O.target);return}if(j==="Enter"){r?.(O);return}if(j.startsWith("Arrow")){P(O);return}if(j==="Delete"||j==="Backspace"){if(O.preventDefault(),O.stopPropagation(),A>=Xc(m,v).length){const K=m.substring(0,k===A?k-1:k),q=Xc(K,v);q!==m&&(o(q),a({selectionStart:q.length,selectionEnd:q.length,selectionDirection:vi.NONE}));return}if(k!==A){const K=m.substring(0,k)+m.substring(k,A).replace(/[a-zA-Z0-9]/g,sa)+m.substring(A);mn.debug("Range ",k,A,"deleted, setting value",K),o(K),a({selectionStart:k,selectionEnd:k,selectionDirection:vi.NONE})}else if(k>0)for(let K=k-1;K>=0;K-=1){const q=m.substring(0,K)+m.substring(K,k).replace(/[a-zA-Z0-9]/g,sa)+m.substring(k);if(q!==m){o(q),a({selectionStart:K,selectionEnd:K,selectionDirection:vi.NONE});return}}return}if(O.altKey||O.metaKey||O.ctrlKey||j.length>1)return;O.preventDefault(),O.stopPropagation();const H=Array.from(new Set([j,j.toUpperCase(),j.toLowerCase()]));for(let K=0;K<H.length;K+=1){const q=H[K],oe=/[a-zA-Z0-9]/g.test(q)?S[0].length-1:k;for(let W=k;W<=oe;W+=1){const G=bf(m,S[0],W+1),ne=i(G,W,q,k,A);if(y(ne,W+1)){const ae=w(W),ce=W+1;let te={selectionStart:ce,selectionEnd:ce,selectionDirection:vi.NONE};if(ce>=ae.selectionEnd){const re=E(W);re.selectionStart!==ae.selectionStart&&(te=re)}mn.debug("handleKeyDown",j,"=>",ne,te),o(ne),a(te);return}}}}return l.jsx("input",{ref:f,className:$("form-control masked-input",t),type:"text",pattern:c,placeholder:h,value:m,onChange:()=>{},onKeyDown:U,onSelect:N,onSelectCapture:_,onFocus:g,onBlur:p,"data-testid":C})});Gh.defaultProps={className:"",placeholder:void 0,onChange(){},onSelect(){},getNextSegmentValue:(d,e,t)=>t,getPreferredReplacementString:Wh,selection:void 0,onFocus(){},onBlur(){},"data-testid":void 0};const wf=Gh;let vf=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=J.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=Ve.getMenuItems(e,!1);t.length>0&&this.setState(n=>({menuItems:Ve.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=Ve.getNextMenuItem(s??0,-1,t):(e.key==="ArrowDown"||e.key==="Tab"&&e.shiftKey===!1)&&(s=Ve.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(jh,{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 Tf=vf;class Ef 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=J.createRef(),this.parent=null,this.popper=J.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(hi,{ref:this.popper,options:a,className:$("menu-popper",n),onExited:this.handleExited,closeOnBlur:!0,interactive:!0,children:l.jsx(Tf,{actions:e,closeMenu:this.handleCloseMenu,onMenuOpened:t,options:o,menuStyle:i})})})}}const es=Ef;function Ti(d,e,t,n,s){const i=n-t+1;return`${((parseInt(e,10)-d-t)%i+i)%i+t}`.padStart(s,"0")}function yf(d,e,t){const{selectionStart:n}=d;return n===0?Ti(e,t,1900,2099,4):n===5?Ti(e,t,1,12,2):n===8?Ti(e,t,1,31,2):n===11?Ti(e,t,0,23,2):n===17||n===14?Ti(e,t,0,59,2):n===20||n===24||n===28?Ti(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 Rf=Z.module("DateTimeInput"),xf="[12][0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])",If="([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]\\.[0-9]{3}​[0-9]{3}​[0-9]{3}",Df=`${xf} ${If}`,Ea="2022-01-01",zh=`${Ea} 00:00:00.000000000`,Ff="YYYY-MM-DD HH:MM:SS.SSSSSSSSS";function Zc(d){return d!=null&&d.length>=Ea.length?`${d.substring(0,Ea.length)}${d.substring(Ea.length).replace(/\u2007/g,"0")}${zh.substring(d.length)}`:d}function Qc(d){return d.replace(/\u200B/g,"")}const Nf=[hl(zh)],Vl=J.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=>{Rf.debug("handleChange",C),h(C),n(Zc(Qc(C)))},[n]),p=b.useCallback(()=>{const C=Qc(c),f=Zc(C);f!==C&&h(hl(f)),o()},[c,o]);return l.jsx("div",{className:"d-flex flex-row align-items-center",children:l.jsx(wf,{ref:e,className:$(t),example:Nf,getNextSegmentValue:yf,onChange:g,onSelect:m,onSubmit:a,pattern:Df,placeholder:Ff,selection:u,value:c,onFocus:i,onBlur:p,"data-testid":r})})});Vl.displayName="DateTimeInput";Vl.defaultProps={className:"",onChange:()=>{},defaultValue:"",onFocus:()=>{},onBlur:()=>{},"data-testid":void 0};const Mf=Vl;class kf extends b.PureComponent{static defaultProps={placeholder:"Search",className:"",matchCount:null,debounceMs:250,id:"","data-testid":void 0};constructor(e){super(e),this.searchInput=J.createRef(),this.handleChange=this.handleChange.bind(this),this.sendUpdate=Ye(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(_s,{value:o,placeholder:e,onChange:this.handleChange,className:t,matchCount:n,ref:this.searchInput,id:s,"data-testid":i})}}const Of=kf;const Af=Z.module("ItemListItem");class Bl 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 Af.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=J.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:$("item-list-item",{active:n},{"is-focused":t},{"is-draggable":e}),onKeyDown:Bl.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 Lf=Bl;const Jc=Z.module("ItemList"),ed=5;class Bt extends b.PureComponent{static CACHE_SIZE=1e3;static DEFAULT_ROW_HEIGHT=20;static DEFAULT_OVERSCAN=10;static defaultProps={offset:0,items:[],rowHeight:Bt.DEFAULT_ROW_HEIGHT,isDeselectOnClick:!0,isDoubleClickSelect:!1,isDragSelect:!0,isMultiSelect:!1,isStickyBottom:!1,disableSelect:!1,onFocusChange(){},onSelect(){},onSelectionChange(){},onViewportChange(){},overscanCount:Bt.DEFAULT_OVERSCAN,renderItem:Bt.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=J.createRef(),this.listContainer=J.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=ge((e,t)=>hn.isSelected(t,e),{max:Bt.CACHE_SIZE});getCachedItem=ge((e,t,n,s,i,o,a,r)=>{const c=o({item:n,itemIndex:e,isFocused:s,isSelected:i,style:a});return l.jsx(Lf,{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:Bt.CACHE_SIZE});getOuterElement=ge(e=>{const t=J.forwardRef((n,s)=>l.jsx("div",{ref:s,tabIndex:-1,onKeyDown:e,role:"presentation",...n}));return t.displayName="ItemListOuterElement",t});getInnerElement=ge(()=>{const e=J.forwardRef((t,n)=>l.jsx("div",{className:"item-list-inner-element",ref:n,...t}));return e.displayName="ItemListInnerElement",e});getItemData=ge((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=hn.isSelected(n,e)||Ve.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:hn.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){Jc.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){Jc.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>ed&&u>ed&&this.setState({isDragging:!0}),(n||o===e)&&(this.focusItem(e),s?(!n&&!this.getItemSelected(e,a)&&!Ve.isModifierKeyDown(t)&&this.deselectAll(),this.selectRange([Math.min(o,e),Math.max(o,e)])):this.toggleSelect(e,t.shiftKey,Ve.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=Ve.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){hn.validateRange(e),this.setState(({selectedRanges:t})=>({selectedRanges:hn.deselectRange(t,e)}))}selectItem(e){const{disableSelect:t}=this.props;t||this.selectRange([e,e])}selectRange(e){hn.validateRange(e),this.setState(({selectedRanges:t})=>({selectedRanges:hn.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(Vm,{className:"item-list-auto-sizer",onResize:this.handleResize,children:({width:c,height:h})=>l.jsx(Bm,{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(Q,{icon:ko})]})}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:$("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=J.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=ge((e,t,n,s,i,o,a,r)=>l.jsx(Rl,{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:Bt.CACHE_SIZE});handleSelectionChange(e){this.setState({selectedCount:hn.count(e)});const{onSelectionChange:t}=this.props;t(e)}getCachedRenderDraggableItem=ge((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=ge((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:$("draggable-item-list-dragging-item-container",e),...c,...h,ref:u,children:l.jsx("div",{className:$("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(tr,{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:$("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(Bt,{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 Cn=Ts;class Oa{static reorder(e,t,n,s){const i=e===n?Oa.adjustDestinationIndex(s,t):s,o=Oa.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 Um(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 vn=Oa;function Kh({on:d,id:e,className:t,isInvalid:n,disabled:s=!1,onClick:i,"data-testid":o}){return l.jsx("button",{type:"button",className:$("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 td(d){return d.isOn!==void 0}function Pf({item:d,onSelect:e=()=>{},"data-testid":t}){const{icon:n,subtitle:s,title:i}=d,o=b.useMemo(()=>td(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(Q,{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:td(d)?l.jsx(Kh,{on:d.isOn,onClick:a=>{a.stopPropagation(),o()}}):l.jsx(Q,{icon:Ih})})]})}function qh({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(Pf,{item:n,onSelect:()=>{e(s)}})},n.title))})})}function nd({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:Dg,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:qi,tooltip:"Close"})})]}),l.jsx("div",{className:"navigation-content",children:d})]})}function _f({children:d,"data-testid":e}){const t=b.useMemo(()=>J.Children.toArray(d),[d]),n=lr(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(ft,{in:r!=null,timeout:Ke.transitionMidMs,classNames:"slide-right",onEntered:u,children:l.jsx(l.Fragment,{children:r!=null&&l.jsx("div",{className:"popping-view",children:r})})}),l.jsx(ft,{in:o!=null,timeout:Ke.transitionMidMs,classNames:"slide-left",onEntered:h,children:l.jsx(l.Fragment,{children:o!=null&&l.jsx("div",{className:"pushing-view",children:o})})})]})}function jf({children:d,disabled:e,value:t,"data-testid":n}){return l.jsx("option",{value:t,disabled:e,"data-testid":n,children:d})}function hr(d){const{children:e,disabled:t=!1,name:n,onChange:s,value:i="","data-testid":o}=d,[a]=b.useState(n??_e());return l.jsx(l.Fragment,{children:J.Children.map(e,r=>r?J.cloneElement(r,{name:a,onChange:r.props.onChange??s,checked:i===r.props.value,disabled:r.props.disabled??t,"data-testid":o}):null)})}const Ul=J.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(_e());return l.jsxs("div",{className:$("custom-control custom-radio",s),children:[l.jsx("input",{type:"radio",id:g,"data-testid":m,name:c,ref:e,className:$("custom-control-input",o,{"is-invalid":a}),checked:t,disabled:i,value:u,onChange:h}),l.jsx("label",{className:$("custom-control-label",r),htmlFor:g,children:n})]})});Ul.displayName="RadioItem";Ul.defaultProps={checked:void 0,className:"",disabled:!1,inputClassName:"",isInvalid:!1,labelClassName:"",name:void 0,onChange:void 0,"data-testid":void 0};const ts=Ul;function Hf({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:$("custom-select",n),onBlur:e,onChange:c,defaultValue:s,value:o,name:i,disabled:a,"data-testid":r,children:d})}class Vf 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=J.createRef(),this.topRow=null,this.bottomRow=null}componentDidMount(){this.sendViewportUpdate()}componentDidUpdate(){this.sendViewportUpdate()}list;topRow;bottomRow;getCachedItem=ge((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=ge((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:$("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 Bf=Vf,sd=Z.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||{}),ue=(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))(ue||{});const Uf=new Set(["Enter","Delete","F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12"]);class Ae extends xl{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(ue).includes(e)}static isValidKeyState(e){const{keyValue:t}=e;return t===null?!0:!Ae.isMacPlatform&&e.metaKey||!Ae.isAllowedKey(t)?!1:!(!e.altKey&&!e.ctrlKey&&!e.metaKey&&!e.shiftKey)||Uf.has(t)}static isMacPlatform=Ve.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="":!Ae.isAllowedKey(t)&&Ae.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?"":Ae.isMacPlatform?Ae.getMacDisplayText(e):Ae.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=Ae.isMacPlatform?n:t;this.defaultKeyState=Ae.createKeyState(r),this.keyState=this.defaultKeyState}getDisplayText(){return Ae.getDisplayText(this.keyState)}getKeyState(){return this.keyState}setKeyState(e){Ae.isValidKeyState(e)?(sd.debug2(`Shortcut ${this.id} updated to ${JSON.stringify(e)}`),this.keyState=e,this.dispatchEvent(new Ue("onUpdate",{detail:this}))):sd.debug2(`Shortcut ${this.id} tried to update to invalid keyState ${JSON.stringify(e)}`)}getDefaultKeyState(){return this.defaultKeyState}isDefault(){return Ae.doKeyStatesMatch(this.getDefaultKeyState(),this.getKeyState())}setToNull(){this.setKeyState(Ae.NULL_KEY_STATE)}isNull(){return Ae.doKeyStatesMatch(this.keyState,Ae.NULL_KEY_STATE)}setToDefault(){this.setKeyState(this.defaultKeyState)}matchesKeyState(e){return Ae.doKeyStatesMatch(e,this.keyState)}matchesEvent(e){return this.matchesKeyState(Ae.getKeyStateFromEvent(e))}}const id=Z.module("ShortcutRegistry");class $f extends xl{shortcutMap=new Map;shortcutsByCategory=new Map;createAndAdd(e){const t=new Ae(e);return this.add(t)}add(e){const t=this.shortcutMap.get(e.id);if(t)return id.warn(`Skipping attempt to add duplicate shortcut ID to registry: ${e.id}`),t;id.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 Wf=Object.freeze(new $f),Ne=Wf,Gf={COPY:Ne.createAndAdd({id:"GLOBAL.COPY",name:"Copy",shortcut:[de.CTRL,ue.C],macShortcut:[de.CMD,ue.C],isEditable:!1}),PASTE:Ne.createAndAdd({id:"GLOBAL.PASTE",name:"Paste",shortcut:[de.CTRL,ue.V],macShortcut:[de.CMD,ue.V],isEditable:!1}),SAVE:Ne.createAndAdd({id:"GLOBAL.SAVE",name:"Save",shortcut:[de.CTRL,ue.S],macShortcut:[de.CMD,ue.S],isEditable:!1}),SELECT_ALL:Ne.createAndAdd({id:"GLOBAL.SELECT_ALL",name:"Select All",shortcut:[de.CTRL,ue.A],macShortcut:[de.CMD,ue.A],isEditable:!1}),LINKER:Ne.createAndAdd({id:"GLOBAL.LINKER",name:"Linker",shortcut:[de.CTRL,ue.L],macShortcut:[de.CMD,ue.L]}),LINKER_CLOSE:Ne.createAndAdd({id:"GLOBAL.LINKER_CLOSE",name:"Close Linker Overlay",shortcut:[ue.ESCAPE],macShortcut:[ue.ESCAPE],isEditable:!1})},ss=Gf;const $l=J.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:$("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(Q,{icon:Fl,className:"linked btn-socketed-icon",transform:"down-1"}),l.jsx(Q,{icon:Fg,className:"is-invalid btn-socketed-icon"})]})});$l.displayName="SocketedButton";$l.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 Yh=$l,{dh:R}=globalThis,Wl=I.shape({name:I.string.isRequired,type:I.string.isRequired,description:I.string,constituentType:I.string}),zf=I.shape({not:I.func.isRequired,and:I.func.isRequired,or:I.func.isRequired});I.shape({asc:I.func.isRequired,desc:I.func.isRequired,abs:I.func.isRequired,column:Wl.isRequired,direction:I.string.isRequired,isAbs:I.bool.isRequired});I.shape({columns:I.arrayOf(Wl).isRequired,customColumns:I.arrayOf(I.string).isRequired,filter:I.arrayOf(zf),addEventListener:I.func.isRequired,removeEventListener:I.func.isRequired,size:I.number.isRequired,sort:I.arrayOf(I.any),copy:I.func.isRequired,applyFilter:I.func.isRequired,applySort:I.func.isRequired,applyCustomColumns:I.func.isRequired,description:I.string});I.shape({columns:I.arrayOf(Wl),filter:I.arrayOf(I.any),isExpanded:I.func.isRequired,saveExpandedState:I.func.isRequired,addEventListener:I.func.isRequired,removeEventListener:I.func.isRequired,size:I.number.isRequired,sort:I.arrayOf(I.any),applyFilter:I.func.isRequired,applySort:I.func.isRequired});const jr=I.shape({name:I.string.isRequired,type:I.string.isRequired});I.shape({created:I.arrayOf(jr).isRequired,updated:I.arrayOf(jr).isRequired,removed:I.arrayOf(jr).isRequired});I.shape({groupingColumns:I.arrayOf(I.string),aggregations:I.shape({}),includeConstituents:I.bool,includeOriginalColumns:I.bool,includeDescriptions:I.bool});I.shape({addEventListener:I.func.isRequired,removeEventListener:I.func.isRequired,onLogMessage:I.func,getTable:I.func.isRequired,runCode:I.func.isRequired});function Xh({type:d}){switch(d){case R.VariableType.TABLE:case R.VariableType.TABLEMAP:case R.VariableType.TREETABLE:case R.VariableType.HIERARCHICALTABLE:return l.jsx(Q,{icon:Nl});case R.VariableType.FIGURE:return l.jsx(Q,{icon:Fh});case R.VariableType.PANDAS:return l.jsx(Q,{icon:Ng});default:return l.jsx(Q,{icon:ll})}}class Kf 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 ur=Kf;class qf{static get LANGUAGE_MAP(){return new Map([["python","Python"],["groovy","Groovy"],["scala","Scala"]])}}const Zh=qf;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)?[]:$m.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===R.VariableType.TABLE||e===R.VariableType.TREETABLE||e===R.VariableType.HIERARCHICALTABLE}static isWidgetType(e){return e===R.VariableType.FIGURE||e===R.VariableType.OTHERWIDGET||e===R.VariableType.PANDAS}static isOpenableType(e){return Aa.isTableType(e)||Aa.isWidgetType(e)}static isFigureType(e){return e===R.VariableType.FIGURE}static isPandas(e){return e===R.VariableType.PANDAS}}const ul=Aa;function Qh({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})]})}Qh.propTypes={children:I.node.isRequired};class Yf 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:$("console-history-result-in-progress",{disabled:e}),children:l.jsxs("span",{className:"badge",children:[l.jsx(yn,{})," Running... ",Xi.formatElapsedTime(n)," ",l.jsx(B,{className:"console-history-result-in-progress-cancel",kind:"ghost",icon:qi,tooltip:"Cancel",onClick:t,disabled:e})]})})}}const Xf=Yf;class La 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)>=La.mouseDragThreshold||Math.abs(e.clientY-this.mouseY)>=La.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;M(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:$("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(Q,{icon:e?Pn:Nh,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 Zf=La;const od=Z.module("ConsoleHistoryItem");class Qf 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){od.debug("handleObjectClick",e);const{openObject:t}=this.props;t(e)}handleCancelClick(){const{item:e}=this.props;e!=null&&e.cancelResult&&(od.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(ur,{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(Xh,{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(Zf,{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(Xf,{onCancelClick:this.handleCancelClick,disabled:e},"in_progress");a.push(h)}let c=null;return a.length>0&&(c=l.jsx(Qh,{children:a})),l.jsxs("div",{className:$("console-command-result",{"console-result-buttons":r}),children:[o,c]})}}const Jf=Qf;class Gl 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(Jf,{disabled:e,item:a,openObject:s,language:n},Gl.itemKey(o,a));i.push(r)}return l.jsx("div",{className:"container-fluid console-history",children:i})}}const eC=Gl,tC={name:"Console",CLEAR:Ne.createAndAdd({id:"CONSOLE.CLEAR",name:"Clear",shortcut:[de.CTRL,ue.L],macShortcut:[de.CTRL,ue.C]}),FOCUS_HISTORY:Ne.createAndAdd({id:"CONSOLE.FOCUS_HISTORY",name:"Focus History",shortcut:[de.CTRL,ue.H],macShortcut:[de.CTRL,de.OPTION,ue.H]})},nC={name:"Command History",FOCUS_HISTORY:Ne.createAndAdd({id:"COMMAND_HISTORY.FOCUS_HISTORY",name:"Focus History Search",shortcut:[de.CTRL,ue.H],macShortcut:[de.CTRL,de.OPTION,ue.H]}),SEND_TO_CONSOLE:Ne.createAndAdd({id:"COMMAND_HISTORY.SEND_TO_CONSOLE",name:"Send to Console",shortcut:[ue.ENTER],macShortcut:[ue.ENTER]}),SEND_TO_NOTEBOOK:Ne.createAndAdd({id:"COMMAND_HISTORY.SEND_TO_NOTEBOOK",name:"Send to Notebook",shortcut:[de.CTRL,ue.ENTER],macShortcut:[de.CMD,ue.ENTER]}),RUN:Ne.createAndAdd({id:"COMMAND_HISTORY.RUN",name:"Run",shortcut:[de.ALT,ue.R],macShortcut:[de.OPTION,ue.R]})},sC={name:"Notebook",RUN:Ne.createAndAdd({id:"NOTEBOOK.RUN",name:"Run",shortcut:[de.ALT,ue.R],macShortcut:[de.OPTION,ue.R]}),RUN_SELECTED:Ne.createAndAdd({id:"NOTEBOOK.RUN_SELECTED",name:"Run Selected",shortcut:[de.ALT,de.SHIFT,ue.R],macShortcut:[de.OPTION,de.SHIFT,ue.R]}),FIND:Ne.createAndAdd({id:"NOTEBOOK.FIND",name:"Find",shortcut:[de.CTRL,ue.F],macShortcut:[de.CMD,ue.F],isEditable:!1}),MINIMAP:Ne.createAndAdd({id:"NOTEBOOK.MINIMAP",name:"Show Minimap",shortcut:[de.ALT,ue.M],macShortcut:[de.OPTION,ue.M]}),WORDWRAP:Ne.createAndAdd({id:"NOTEBOOK.WORDWRAP",name:"Word Wrap",shortcut:[de.ALT,ue.Z],macShortcut:[de.OPTION,ue.Z]})},iC={CONSOLE:tC,COMMAND_HISTORY:nC,NOTEBOOK:sC},Mt=iC,gt=Object.freeze({FATAL:"FATAL",STDERR:"STDERR",ERROR:"ERROR",WARN:"WARN",STDOUT:"STDOUT",INFO:"INFO",DEBUG:"DEBUG",TRACE:"TRACE"}),oC="#2d2a2e",aC="#fcfcfa",rC="#fcd65b",lC="#b2b1b2",cC="#9edc6f",dC="#76d9e4",hC="#f95d84",uC="#aa9af4",mC="#f95d84",gC="#fcfcfa",pC="#7c7b7c",Ce={"error-foreground":"#f95d84",background:oC,foreground:aC,"line-height":"19px",string:rC,"string-delim":"#929192",delimiter:lC,predefined:cC,keyword:dC,storage:hC,number:uC,operator:mC,identifier:gC,"namespace-identifier":"#f95d84","identifier-js":"#fcd65b",comment:pC,"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"},fC="python",CC={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/}}},SC={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"]]}},bC={id:fC,conf:CC,language:SC},wC=bC,vC="groovy",TC={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/}}},EC={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"]]}},yC={id:vC,conf:TC,language:EC},RC=yC,xC="scala",IC={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>))/}}},DC={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"]]}},FC={id:xC,conf:IC,language:DC},NC=FC,MC="deephavenDb",kC={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/}}},OC={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"]]}},AC={id:MC,conf:kC,language:OC},LC=AC,PC="log",_C={},jC={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"}]]}},HC={id:PC,conf:_C,language:jC},VC=HC,In=Z.module("MonacoUtils");class Nn{static init({getWorker:e}={}){In.debug("Initializing Monaco..."),e!==void 0&&Nn.registerGetWorker(e);const{registerLanguages:t,removeHashtag:n}=Nn,s=[{token:"",foreground:n(Ce.foreground)},{token:"string",foreground:n(Ce.string)},{token:"string.delim",foreground:n(Ce["string-delim"])},{token:"keyword",foreground:n(Ce.keyword)},{token:"identifier.js",foreground:n(Ce["identifier-js"])},{token:"delimiter",foreground:n(Ce.delimiter)},{token:"comment",foreground:n(Ce.comment)},{token:"number",foreground:n(Ce.number)},{token:"storage",foreground:n(Ce.storage)},{token:"identifier",foreground:n(Ce.identifier)},{token:"namespace.identifier",foreground:n(Ce["namespace-identifier"])},{token:"operator",foreground:n(Ce.operator)},{token:"predefined",foreground:n(Ce.predefined)},{token:"error.log",foreground:Ce["log-error"].substring(1)},{token:"warn.log",foreground:n(Ce["log-warn"])},{token:"info.log",foreground:n(Ce["log-info"])},{token:"stdout.log",foreground:n(Ce["log-stdout"])},{token:"trace.log",foreground:n(Ce["log-trace"])},{token:"debug.log",foreground:n(Ce["log-debug"])},{token:"date.log",foreground:n(Ce["log-date"])}],i={errorForeground:Ce["error-foreground"],"inputOption.activeBorder":Ce["input-option-active-border"],"editor.background":Ce.background,"editor.foreground":Ce.foreground,"editor.lineHighlightBackground":Ce["editor-line-highlight-bg"],"editorLineNumber.foreground":Ce["editor-line-number-foreground"],"editor.selectionBackground":Ce["editor-selection-background"],"editor.findMatchBackground":Ce["editor-find-match-background"],"editor.findMatchHighlightBackground":Ce["editor-find-match-highlight-background"],"editorSuggestWidget.background":Ce["editor-suggest-widget-background"],"editorSuggestWidget.border":Ce["editor-suggest-widget-border"],"editorSuggestWidget.foreground":Ce["editor-suggest-widget-foreground"],"editorSuggestWidget.selectedBackground":Ce["editor-suggest-widget-selected-background"],"editorSuggestWidget.highlightForeground":Ce["editor-suggest-widget-highlightForeground"],"list.hoverBackground":Ce["list-hover-background"],"dropdown.background":Ce["context-menu-background"],"dropdown.foreground":Ce["context-menu-foreground"],"menu.selectionBackground":Ce["menu-selection-background"],"list.focusBackground":Ce["menu-selection-background"],"editorWidget.background":Ce["editor-widget-background"],"inputOption.activeBackground":Ce["input-option-active-background"],"inputOption.activeForeground":Ce["input-option-active-foreground"],focusBorder:Ce["focus-border"],"input.background":Ce["input-background"],"input.foreground":Ce["input-foreground"],"input.border":Ce["input-border"],"textLink.foreground":Ce["text-link-foreground"],"textLink.activeForeground":Ce["text-link-active-foreground"],"editorLink.activeForeground":Ce["editor-link-active-foreground"]};Qn.defineTheme("dh-dark",{base:"vs-dark",inherit:!0,rules:s,colors:i}),In.debug2("monaco theme: ",Ce),Qn.setTheme("dh-dark"),t([LC,wC,RC,VC,NC]),In.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);An.getLanguages().filter(({id:n})=>t.includes(n)).forEach(n=>{const s=n;In.debug2("Overriding default language loader:",s.id)}),e.forEach(n=>{Nn.registerLanguage(n)})}static registerLanguage(e){In.debug2("Registering language: ",e.id),An.register(e),An.onLanguage(e.id,()=>{An.setLanguageConfiguration(e.id,e.conf),An.setMonarchTokensProvider(e.id,e.language)})}static setEOL(e,t=Qn.EndOfLineSequence.LF){e.getModel()?.setEOL(t)}static openDocument(e,t){const n=e.getModel();M(n);const s={textDocument:{uri:`${n.uri}`,languageId:n.getLanguageId(),version:n.getVersionId(),text:n.getValue()}};return In.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};In.debug2("didChangeDocumentParams",h),t.changeDocument(h)}})}static closeDocument(e,t){const n=e.getModel();M(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();M(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=>{Nn.isMacPlatform()&&n.mac===""||!Nn.isMacPlatform()&&n.windows===""||Nn.removeKeybinding(e,Nn.isMacPlatform()?n.mac:n.windows)})}catch(n){In.error(n)}}static removeKeybinding(e,t){if(t===void 0)return;const n=e._standaloneKeybindingService._getResolver()._map.get(t);n!=null?n.forEach(s=>{In.debug2(`Removing Monaco keybinding ${t} for ${s.command}`),e._standaloneKeybindingService.addDynamicKeybinding(`-${s.command}`,null,()=>{})}):In.warn(`Did not find any keybindings to remove for ${t}`)}static getMonacoKeyCodeFromShortcut(e){const{keyState:t}=e,{keyValue:n}=t;return n===null?0:Nn.isMacPlatform()?(t.metaKey?dn.CtrlCmd:0)|(t.shiftKey?dn.Shift:0)|(t.altKey?dn.Alt:0)|(t.ctrlKey?dn.WinCtrl:0)|jc.fromString(n):(t.ctrlKey?dn.CtrlCmd:0)|(t.shiftKey?dn.Shift:0)|(t.altKey?dn.Alt:0)|(t.metaKey?dn.WinCtrl:0)|jc.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 yg(n,o.start+1,n,o.end+1)})})}return{links:t}}}const Ht=Nn,$n=Z.module("MonacoCompletionProvider");class Js extends b.PureComponent{static lspToMonacoKind(e){const t=An.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=An.registerCompletionItemProvider(e,{provideCompletionItems:this.handleCompletionRequest,triggerCharacters:[".",'"',"'"]}),t.getSignatureHelp&&(this.registeredSignatureProvider=An.registerSignatureHelpProvider(e,{provideSignatureHelp:this.handleSignatureRequest,signatureHelpTriggerCharacters:["(",","]})),t.getHover&&(this.registeredHoverProvider=An.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:Js.monacoToLspPosition(t),context:n},a=i.getCompletionItems(o);return $n.debug("Requested completion items",o),a.then(c=>($n.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:Js.lspToMonacoKind(g),detail:p,documentation:C?.kind==="markdown"?C:C?.value,sortText:f,filterText:S,insertText:v.text,insertTextRules:w===2?4:w,range:Js.lspToMonacoRange(v.range)}})})).catch(c=>($n.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:Js.monacoToLspPosition(t),context:s},c=a.getSignatureHelp(r);return $n.debug("Requested signature help",r),c.then(u=>{$n.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=>($n.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:Js.monacoToLspPosition(t)},o=s.getHover(i);return $n.debug("Requested hover",i),o.then(r=>{$n.debug("Hover received: ",i,r);const{contents:c}=r;return{contents:c?[c]:[]}}).catch(r=>($n.error("There was an error retrieving hover",r),{contents:[]}))}render(){return null}}const Jh=Js;const Hr=Z.module("ConsoleInput"),ya=parseInt(Ce["line-height"],10),eu=6,tu=6,BC=ya+eu+tu,Vr=100;class zl extends b.PureComponent{static defaultProps={maxHeight:ya*10,scope:null,disabled:!1};static INPUT_CLASS_NAME="console-input";constructor(e){super(e),this.handleWindowResize=this.handleWindowResize.bind(this),this.commandContainer=J.createRef(),this.commandHistoryIndex=null,this.timestamp=Date.now(),this.bufferIndex=0,this.history=[],this.modifiedCommands=new Map,this.state={commandEditorHeight:ya,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&&(Hr.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:ya,lineDecorationsWidth:3,lineNumbers:"off",minimap:{enabled:!1},renderLineHighlight:"none",scrollBeyondLastLine:!1,scrollbar:{arrowSize:0,horizontal:"hidden",horizontalScrollbarSize:0},padding:{top:eu,bottom:tu},tabCompletion:"on",value:"",wordWrap:"on"},s=this.commandContainer.current;M(s),this.commandEditor=Qn.create(s,n),Ht.setEOL(this.commandEditor),Ht.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();M(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===Ds.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===Ds.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|Ds.KeyF,()=>{}),Ht.removeConflictingKeybindings(this.commandEditor),Ht.registerPasteHandler(this.commandEditor),this.commandEditor.focus(),this.updateDimensions(),this.setState({model:this.commandEditor.getModel()})}destroyCommandEditor(){const{session:e}=this.props;this.commandEditor&&(Ht.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();M(e);const t=e.getLineLength(1)+1,n=this.commandEditor?.getTopForPosition(1,t);M(n),this.commandEditor?.setPosition({lineNumber:1,column:t}),this.commandEditor?.setScrollTop(n),this.commandEditor?.focus()}focusEnd(){const e=this.commandEditor?.getModel();M(e);const t=e.getLineCount(),n=e.getLineLength(t)+1,s=this.commandEditor?.getTopForPosition(t,n);M(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-Vr&&this.loadMoreHistory()}async loadMoreHistory(){try{if(this.loadingPromise!=null||this.bufferIndex==null)return;const{commandHistoryStorage:e,language:t,scope:n}=this.props;this.loadingPromise=ve.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+Vr-1}),this.loadingPromise=ve.makeCancelable(s.getViewportData(),()=>s.close());const i=await this.loadingPromise;this.bufferIndex+=Vr,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,ve.isCanceled(e)){Hr.debug2("Promise canceled, not loading history");return}Hr.error("Error fetching history",e)}}processCommand(e){this.commandHistoryIndex=null,this.modifiedCommands.clear(),M(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;M(e);const t=this.commandEditor.getContentHeight(),n=Math.max(Math.min(t,e),BC),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:$("console-input-wrapper",{disabled:e}),children:l.jsxs("div",{className:$("console-input-inner-wrapper",{focus:i}),children:[l.jsx("div",{className:zl.INPUT_CLASS_NAME,ref:this.commandContainer,style:{height:s}}),o&&l.jsx(Jh,{model:o,language:t,session:n})]})})}}const ad=zl;const rd="pasted values",UC=[/^audio.*/,/^font.*/,/^image.*/,/^video.*/],Br=[".csv",".tsv",".tab",".psv",".dsv",".txt"],ld=[".zip"];class ei 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"&&!UC.find(t=>t.test(e.type))}static isValidExtension(e,t=!1){return Br.some(n=>e.endsWith(n))||t&&ld.some(n=>e.endsWith(n))}static handleDragOver(e){e.preventDefault(),e.stopPropagation()}static getIcon(e){return e===rd?Hc:e.endsWith(".csv")?Mg:e.endsWith(".zip")?kg:Og}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=J.createRef(),this.divElem=J.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();M(i),ei.isValidExtension(i.name,t)?this.handleFile(i):this.setState({dropError:ei.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:rd,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:Hc,action:this.handleMenuPaste,shortcut:ss.PASTE,disabled:e}]}getValidExtensions=fe(e=>e?[...Br,...ld]:[...Br]);getAcceptString=fe(e=>this.getValidExtensions(e).join(", "));getFileTypeErrorString=fe(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:ei.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(Q,{icon:Ag})}),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(Q,{icon:ei.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(Q,{icon:As})}),l.jsx("label",{children:o}),o===ei.FILE_TYPE_ERROR&&l.jsx("div",{className:"message-small",children:l.jsx("label",{children:this.getFileTypeErrorString(e)})})]})]})}}const Ri=ei;class $C{static INTEGER="int";static LONG="long";static DOUBLE="double";static BOOLEAN="bool";static STRING="string";static DATE_TIME="datetime";static LOCAL_TIME="localtime"}const Le=$C,cd="unknown",WC=2147483647,GC=-2147483648,dd=/^[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]+)?$/,hd=/^([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 Le.STRING:return Le.STRING;case Le.INTEGER:return yt.checkInteger(e);case Le.LONG:return yt.checkLong(e);case Le.DOUBLE:return yt.checkDouble(e);case Le.BOOLEAN:return yt.checkBoolean(e);case Le.DATE_TIME:return yt.checkDateTime(e);case Le.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)?Le.STRING:yt.getNumberType(t)}static checkLong(e){const t=e.replace(/,/g,"");return yt.isNotParsableNumber(t)?Le.STRING:t.includes(".")?Le.DOUBLE:Le.LONG}static checkDouble(e){const t=e.replace(/,/g,"");return yt.isNotParsableNumber(t)?Le.STRING:Le.DOUBLE}static checkBoolean(e){const t=e.toLowerCase();return t==="true"||t==="false"?Le.BOOLEAN:Le.STRING}static checkDateTime(e){return dd.test(e)?Le.DATE_TIME:Le.STRING}static checkLocalTime(e){return hd.test(e)?Le.LOCAL_TIME:Le.STRING}static getTypeFromUnknown(e){const t=e.replace(/,/g,"");if(yt.isNotParsableNumber(t)){const n=e.toLowerCase();return n==="true"||n==="false"?Le.BOOLEAN:dd.test(e)&&e.includes(":")?Le.DATE_TIME:hd.test(e)?Le.LOCAL_TIME:Le.STRING}return yt.getNumberType(t)}static getNumberType(e){if(e.includes("."))return Le.DOUBLE;const t=e.startsWith("-")?11:10;if(e.length>t)return Le.LONG;const n=parseInt(e,10);return n>WC||n<GC?Le.LONG:Le.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(cd),this.readHeaders&&(n=n.slice(1))}M(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}.
@@ -40,4 +40,4 @@ This note can be edited using **markdown** for styling.`;static getNewMarkdownTi
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(jx,{})})]}),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:Im,alt:"Deephaven Data Labs",width:"230px"})})})})]})]})]})}}const bh=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)>=bh||Math.abs(h.current-S.clientY)>=bh)&&(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:$("btn-context-menu",{disabled:n},{active:o&&!n},{"keyboard-active":a&&!n}),onMouseDown:C,onMouseUp:f,disabled:m,children:[l.jsx("span",{className:$("icon"),children:s}),l.jsx("span",{className:"title",children:t}),l.jsx("span",{className:"shortcut",children:i})]})}function Mc(d){const{handleControlSelect:e,handleToolSelect:t,onClearFilter:n}=d,s=b.useMemo(()=>[{title:"Input Filter",icon:Fp,menuElement:l.jsx(ki,{}),action:i=>{e(Ns.INPUT_FILTER,i)},order:10},{title:"Dropdown Filter",icon:Ph,menuElement:l.jsx(ki,{}),action:i=>{e(Ns.DROPDOWN_FILTER,i)},order:15},{title:"Markdown Widget",icon:Np,menuElement:l.jsx(ki,{}),action:i=>{e(Ns.MARKDOWN,i)},order:20},{title:"Filter Sets",icon:cl,menuElement:l.jsx(ki,{}),action:i=>{e(Ns.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(Vt.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:Mp,action:()=>{n()},order:60,shortcut:qt.TABLE.CLEAR_ALL_FILTERS}],[e,t,n]);return l.jsx(es,{popperClassName:"controls-menu-popper",actions:s})}Mc.propTypes={handleControlSelect:I.func,handleToolSelect:I.func,onClearFilter:I.func};Mc.defaultProps={handleControlSelect:()=>{},handleToolSelect:()=>{},onClearFilter:()=>{}};ki.propTypes={forwardedProps:I.shape({iconElement:I.node,displayShortcut:I.string,isMouseSelected:I.bool.isRequired,isKeyboardSelected:I.bool.isRequired,closeMenu:I.func.isRequired,menuItem:I.shape({action:I.func,title:I.string,disabled:I.bool}).isRequired})};ki.defaultProps={forwardedProps:null};const Jx=js(xm,null),eI={layoutStorage:Jx},tI=d=>d.layoutStorage,nI=d=>d.serverConfigValues;Object.entries(eI).map(([d,e])=>Zi.register(d,e));const wh=10;function sI(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)>=wh||Math.abs(u.current.y-T.clientY)>=wh)&&(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(Xh,{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(_s,{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(Q,{mask:ll,icon:Wc,transform:"right-5 down-5"}),l.jsx(Q,{icon:Wc,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(Q,{mask:ll,icon:dl,transform:"right-5 down-5"}),l.jsx(Q,{icon:dl,transform:"right-8 down-6"})]}),"Import Layout"]}),l.jsx(B,{kind:"ghost",icon:si,onClick:n,tooltip:"Reset Layout"})]})]})}const iI=async(d,e,t)=>{let n,s,i,o;if(Ra(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:R.VariableType.FIGURE},h=await d.getObject(c);return ja.makeModel(n,h)}const a={title:i,name:s,type:R.VariableType.TABLE},r=await d.getObject(a);return be.applyTableSettings(r,o,Lo(Cr.getState())),ja.makeModelFromSettings(n,r)},oI=async(d,e,t=R.VariableType.TABLE)=>{const{table:n}=e,s={title:n,name:n,type:t},i=await d.getObject(s);return Cc.makeModel(i)};function aI({onAutoFillClick:d=()=>{}}){return l.jsxs("div",{className:"empty-dashboard-container",children:[l.jsxs("div",{className:"hint-container",children:[l.jsx(Q,{icon:Lh})," ",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 rI(d){return d.version===2}function lI(d){return Array.isArray(d)}const va=Z.module("UserLayoutUtils"),cI={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:Ja.COMPONENT,title:Ja.TITLE,isClosable:!1}]},{type:"stack",width:25,content:[{type:"react-component",component:Ka.COMPONENT,title:Ka.TITLE,isClosable:!1},{type:"react-component",component:Ya.COMPONENT,title:Ya.TITLE,isClosable:!1}]}]},{type:"row",content:[{type:"stack",title:"Notebooks",content:[]}]}]}],links:[],filterSets:[],version:2},dI={layoutConfig:[],links:[],filterSets:[],version:2};function Am(d){if(rI(d))return d;if(lI(d))return{layoutConfig:d,links:[],filterSets:[],version:2};throw new Error(`Unexpected layout import format: ${d}`)}async function hI(d,e=!0){try{const t=await d.getLayouts();if(t.length>0)try{const n=await d.getLayout(t[0]);return Am(n)}catch(n){va.error("Unable to load layout",t[0],":",n),va.warn("No valid layouts found, falling back to default layout")}}catch(t){va.error("Unable to fetch layout list",t),va.warn("Falling back to default layout")}return e?cI:dI}function uI(d){const{filterSets:e,layoutConfig:t,links:n}=d;return{filterSets:e,layoutConfig:t,links:n,version:2}}const Ia={exportLayout:uI,getDefaultLayout:hI,normalizeLayout:Am},Ta=Z.module("DownloadServiceWorkerUtils");class No{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(),Ta.info("Registering service worker on ",t,n)}).catch(n=>{Ta.error("Failed to register service worker",n)})}):Ta.info("Service worker is not supported."))}static async getServiceWorker(){if("serviceWorker"in navigator){const t=(await navigator.serviceWorker.getRegistrations()).find(n=>n.scope.endsWith(No.DOWNLOAD_PATH));if(t&&t.active)return Ta.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 Lm={react:J,"react-dom":Bi,redux:gg,"react-redux":pg},mI=fg(Lm),gI=Cg({requires:mI}),pI=Sg.createRequires(Lm),fI=bg({requires:pI}),CI=Z.module("PluginUtils");class yl{static loadComponentPlugin(e){const t=new URL("/ide/plugins/",`${window.location}`),n=new URL(`${e}.js`,t),s=J.forwardRef((i,o)=>l.jsx(gI,{url:n,render:({err:a,Component:r})=>{if(a!=null&&a!==""){const c=`Error loading plugin ${e} from ${n} due to ${a}`;return CI.error(c),l.jsx("div",{className:"error-message",children:`${c}`})}return l.jsx(r,{ref:o,...i})}}));return s.pluginName=e,s.displayName="Plugin",s}static async loadModulePlugin(e){return await fI(e)}static async loadJson(e){return new Promise((t,n)=>{const s=new XMLHttpRequest;s.addEventListener("load",()=>{try{const i=JSON.parse(s.responseText);t(i)}catch(i){n(i)}}),s.addEventListener("error",i=>{n(i)}),s.open("GET",e),s.send()})}}const Et=Z.module("AppMainContainer");class Oi extends b.Component{static handleWindowBeforeUnload(e){e.preventDefault(),e.returnValue=""}static hydrateConsole(e,t){return Sl.hydrate({...e,unzip:n=>xh.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=J.createRef(),this.state={contextActions:[{action:()=>{this.handleToolSelect(Vt.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",Oi.handleWindowBeforeUnload)}componentDidUpdate(e){const{dashboardData:t}=this.props;e.dashboardData!==t&&this.handleDataChange(t)}componentWillUnmount(){this.deinitWidgets(),this.stopListeningForDisconnect(),window.removeEventListener("beforeunload",Oi.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($e.SELECT_NOTEBOOK,n,o,a,i,!0)}}sendClearFilter(){this.emitLayoutEvent(Qe.CLEAR_ALL_FILTERS)}emitLayoutEvent(e,...t){this.goldenLayout?.eventHub.emit(e,...t)}handleError(e){ve.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 Ns.DROPDOWN_FILTER:this.emitLayoutEvent(Qe.OPEN_DROPDOWN,{title:"DropdownFilter",type:e,createNewStack:!0,dragEvent:t});break;case Ns.INPUT_FILTER:this.emitLayoutEvent(Qe.OPEN_INPUT,{title:"InputFilter",type:e,createNewStack:!0,dragEvent:t});break;case Ns.MARKDOWN:this.emitLayoutEvent(Cm.OPEN,{title:"Markdown",type:e,dragEvent:t});break;case Ns.FILTER_SET_MANAGER:this.emitLayoutEvent(Qe.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?Vt.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=Ia.exportLayout(t);Et.info("handleExportLayoutClick exportedConfig",n);const s=new Blob([JSON.stringify(n)],{type:"application/json"}),i=R.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}=Ia.normalizeLayout(i);n({layoutConfig:a}),t(Tn,{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 Ia.getDefaultLayout(e,t!==void 0),{updateDashboardData:o,updateWorkspaceData:a}=this.props;a({layoutConfig:s}),o(Tn,{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);return n!=null&&n.TablePlugin!=null?n.TablePlugin:yl.loadComponentPlugin(e)}startListeningForDisconnect(){const{connection:e}=this.props;e.addEventListener(R.IdeConnection.EVENT_DISCONNECT,this.handleDisconnect),e.addEventListener(R.IdeConnection.EVENT_RECONNECT,this.handleReconnect),e.addEventListener(R.CoreClient.EVENT_RECONNECT_AUTH_FAILED,this.handleReconnectAuthFailed)}stopListeningForDisconnect(){const{connection:e}=this.props;e.removeEventListener(R.IdeConnection.EVENT_DISCONNECT,this.handleDisconnect),e.removeEventListener(R.IdeConnection.EVENT_RECONNECT,this.handleReconnect),e.removeEventListener(R.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??R.VariableType.TABLE)}hydratePandas(e,t){return this.hydrateTable(e,t,R.VariableType.PANDAS)}hydrateTable(e,t,n=R.VariableType.TABLE){const{connection:s}=this.props;return{...e,getDownloadWorker:No.getServiceWorker,loadPlugin:this.handleLoadTablePlugin,localDashboardId:t,makeModel:()=>oI(s,e.metadata,n)}}hydrateChart(e,t){const{connection:n}=this.props;return{...e,localDashboardId:t,makeModel:()=>{const{metadata:s,panelState:i}=e;return iI(n,s,i)}}}openWidget(e,t){const{connection:n}=this.props;this.emitLayoutEvent(Ee.OPEN,{dragEvent:t,fetch:()=>n.getObject(e),widget:e})}getDashboardPlugins=fe(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:$("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:Im,alt:"Deephaven Data Labs",width:"115px",className:"ml-1"}),l.jsxs("div",{children:[l.jsxs(B,{kind:"ghost",className:"btn-panels-menu",icon:kp,onClick:()=>{},children:["Controls",l.jsx(Mc,{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:Op,children:["Panels",l.jsx(hi,{isShown:g,className:"panels-menu-popper",onExited:this.handleWidgetsMenuClose,closeOnBlur:!0,interactive:!0,children:l.jsx(sI,{widgets:C,onExportLayout:this.handleExportLayoutClick,onImportLayout:this.handleImportLayoutClick,onResetLayout:this.handleResetLayoutClick,onSelect:this.handleWidgetSelect})})]}),l.jsx(B,{kind:"ghost",className:$("btn-settings-menu",{"text-warning":n.operateAs!==n.name}),onClick:this.handleSettingsMenuShow,icon:l.jsx(Q,{icon:Oo,transform:"grow-3 right-1 down-1"}),tooltip:"User Settings"})]})]})}),l.jsxs(Gw,{emptyDashboard:l.jsx(aI,{onAutoFillClick:this.handleAutoFillClick}),id:Tn,layoutConfig:a,onGoldenLayoutChange:this.handleGoldenLayoutChange,onLayoutConfigChange:this.handleLayoutConfigChange,onLayoutInitialized:this.openNotebookFromURL,hydrate:this.hydrateDefault,children:[l.jsx(cx,{hydrate:this.hydrateGrid,getDownloadWorker:No.getServiceWorker,loadPlugin:this.handleLoadTablePlugin}),l.jsx(sx,{hydrate:this.hydrateChart}),l.jsx(ix,{}),l.jsx(ax,{hydrateConsole:Oi.hydrateConsole,notebooksUrl:new URL("/notebooks/",`${window.location}`).href}),l.jsx(rx,{}),l.jsx(Sx,{hydrate:this.hydratePandas}),l.jsx(Cx,{}),l.jsx(fx,{}),f]}),l.jsx(ft,{in:p,timeout:Ke.transitionMidMs,classNames:"slide-left",mountOnEnter:!0,unmountOnExit:!0,children:l.jsx(On,{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(Kp,{isOpen:m&&!u,icon:Ap,title:l.jsxs(l.Fragment,{children:[l.jsx(yn,{})," Attempting to reconnect..."]}),subtitle:"Please check your network connection."}),l.jsx(ci,{confirmButtonText:"Refresh",onConfirm:Oi.handleRefresh,isOpen:u,headerText:"Authentication failed",bodyText:"Credentials are invalid. Please refresh your browser to try and reconnect."})]})}}const SI=d=>({activeTool:gr(d),dashboardData:$t(d,Tn),layoutStorage:tI(d),plugins:YS(d),connection:iR(d,Tn),session:di(d,Tn)?.session,sessionConfig:di(d,Tn)?.config,user:ru(d),workspace:mr(d),serverConfigValues:nI(d)}),bI=Ct(SI,{setActiveTool:fr,updateDashboardData:Hn,updateWorkspaceData:xu})(wg(Oi));function wI(){return l.jsxs("div",{className:"app",children:[l.jsx(bI,{}),l.jsx(Vh,{})]})}const vI=Z.module("LocalWorkspaceStorage");class Ai{static STORAGE_KEY="deephaven.WorkspaceStorage";static async makeDefaultWorkspaceData(e,t){const{filterSets:n,links:s,layoutConfig:i}=await Ia.getDefaultLayout(e,t?.isConsoleAvailable);return{settings:{defaultDateTimeFormat:je.DEFAULT_DATETIME_FORMAT_STRING,formatter:[],timeZone:je.DEFAULT_TIME_ZONE_ID,showTimeZone:!1,showTSeparator:!0,disableMoveConfirmation:!1,defaultDecimalFormatOptions:{defaultFormatString:Re.DEFAULT_FORMAT_STRING},defaultIntegerFormatOptions:{defaultFormatString:ze.DEFAULT_FORMAT_STRING},truncateNumbersWithPound:!1,defaultNotebookSettings:{isMinimapEnabled:!1}},layoutConfig:i,closed:[{}],links:s,filterSets:n}}static async makeDefaultWorkspace(e,t){return{data:await Ai.makeDefaultWorkspaceData(e,t)}}layoutStorage;constructor(e){this.layoutStorage=e}async load(e){try{return JSON.parse(localStorage.getItem(Ai.STORAGE_KEY)??"")}catch{return vI.info("Unable to load workspace data, initializing to default data"),Ai.makeDefaultWorkspace(this.layoutStorage,e)}}async save(e){return localStorage.setItem(Ai.STORAGE_KEY,JSON.stringify(e)),e}}class TI extends Error{isNoConsolesError=!0}function EI(d){return d.isNoConsolesError}const ks=Z.module("SessionUtils");var Pm=(d=>(d.ANONYMOUS="anonymous",d.PARENT="parent",d))(Pm||{});function yI(){return new URL("/jsapi",`${window.location}`)}function _m(){const d=yI();return`${d.protocol}//${d.host}`}function RI(){switch(new URLSearchParams(window.location.search).get("authProvider")){case"parent":return"parent";default:return"anonymous"}}function xI(){const d=_m();return ks.info(`Starting connection to '${d}'...`),new R.IdeConnection(d)}async function II(d){ks.info("Getting console types...");const e=await d.getConsoleTypes();if(ks.info("Available types:",e),e.length===0)throw new TI("No console types available");const t=e[0];ks.info("Starting session with type",t);const n=await d.startSession(t),s={type:t,id:_e.generate()};return ks.info("Console session established",s),{session:n,config:s,connection:d}}function DI(){const d=_m();return ks.info("createCoreClient",d),new R.CoreClient(d)}async function FI(){if(window.opener==null)throw new Error("window.opener is null, unable to send auth request.");return new Promise(d=>{const e=t=>{const{data:n}=t;if(ks.debug("Received message",n),n?.message!=="loginOptions"){ks.debug("Ignore received message",n);return}window.removeEventListener("message",e),d(n.payload)};window.addEventListener("message",e),window.opener.postMessage("requestLoginOptionsFromParent","*")})}async function NI(d){switch(d){case"parent":return FI();case"anonymous":return{type:R.CoreClient.LOGIN_TYPE_ANONYMOUS};default:throw new Error(`Unknown auth type: ${d}`)}}class MI{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 Co=Z.module("GrpcFileStorageTable");class er{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=Ye(this.doRefresh.bind(this),er.REFRESH_DEBOUNCE))}removeBaseRoot(e){return he.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 er(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){Co.debug2("doRefresh",this.root),e(this.fetchData())}refresh(){Co.debug2("refresh",this.root),this.viewportUpdatePromise?.cancel();const e=new Promise(n=>{this.doRefresh(n)}),t=ve.makeCancelable(e.then(n=>{if(this.viewportUpdatePromise!==t)throw new $i;return this.currentViewportData=n,this.sendUpdate(),n}));t.catch(n=>{ve.isCanceled(n)||Co.error("Error updating viewport",n)}),this.viewportUpdatePromise=t}refreshInternal(){try{this.refresh()}catch(e){ve.isCanceled(e)||Co.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,Co.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 kI=Z.module("GrpcFileStorage");class kc{static REFRESH_THROTTLE=150;storageService;tables=[];root;constructor(e,t=""){this.storageService=e,this.root=t}removeRoot(e){return he.removeRoot(this.root,e)}addRoot(e){return he.addRoot(this.root,e)}async createDirectory(e){return await this.storageService.createDirectory(this.addRoot(e)),this.refreshTables(),{type:"directory",id:e,filename:e,basename:he.getBaseName(e)}}async getTable(){const e=new er(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:he.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(he.getPath(e)),he.getBaseName(e));if(t.length===0)throw new xc;if(t.length>1)throw kI.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=Ls(()=>{this.tables.forEach(e=>e.refresh())},kc.REFRESH_THROTTLE)}const Os=Z.module("AppInit");async function OI(){Os.debug("Loading plugins...");try{const d=await yl.loadJson("/js-plugins/manifest.json");Os.debug("Plugin manifest loaded:",d);const e=[];for(let s=0;s<d.plugins.length;s+=1){const{name:i,main:o}=d.plugins[s],a=`/js-plugins/${i}/${o}`;e.push(yl.loadModulePlugin(a))}const t=await Promise.all(e),n=new Map;for(let s=0;s<t.length;s+=1){const{name:i}=d.plugins[s];n.set(i,t[s])}return Os.info("Plugins loaded:",n),n}catch(d){return Os.error("Unable to load plugins:",d),new Map}}async function AI(d){let e;try{e=await II(d)}catch(t){if(!EI(t))throw t}return e}function Oc(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,C]=b.useState(),[f,S]=b.useState(),[v,w]=b.useState(!0),T=b.useCallback(async()=>{try{Os.info("Initializing Web UI","0.35.0",navigator.userAgent);const N=DI(),_=RI();Os.info(`Login using auth type ${_}...`),await N.login(await NI(_));const P=await OI(),U=await(_===Pm.ANONYMOUS&&N.getAsIdeConnection==null?xI():N.getAsIdeConnection());U.addEventListener(R.IdeConnection.EVENT_SHUTDOWN,xe=>{const{detail:at}=xe;Os.info("Shutdown",`${JSON.stringify(at)}`),C(`Server shutdown: ${at??"Unknown reason"}`),S(null)});const O=await AI(U),j="user",k=N.getStorageService(),A=new MI(k,"/layouts"),H=new kc(k,"/notebooks"),K=new Ai(A),q=new Fx,oe=await K.load({isConsoleAvailable:O!==void 0}),{data:W}=oe,{settings:G}=W;G.defaultDecimalFormatOptions===void 0&&(G.defaultDecimalFormatOptions={defaultFormatString:Re.DEFAULT_FORMAT_STRING}),G.defaultIntegerFormatOptions===void 0&&(G.defaultIntegerFormatOptions={defaultFormatString:ze.DEFAULT_FORMAT_STRING}),G.truncateNumbersWithPound===void 0&&(G.truncateNumbersWithPound=!1);const{shortcutOverrides:ne={}}=G,ce=Ae.isMacPlatform?ne.mac??{}:ne.windows??{};Object.entries(ce).forEach(([xe,at])=>{Ne.get(xe)?.setKeyState(at)});const te={filterSets:W.filterSets,links:W.links},re=await N.getServerConfigValues(),we=new Map(re),Ie={name:j,operateAs:j,groups:[],permissions:{isACLEditor:!1,isSuperUser:!1,isQueryViewOnly:!1,isNonInteractive:!1,canUsePanels:!0,canCreateDashboard:!0,canCreateCodeStudio:!0,canCreateQueryMonitor:!0,canCopy:we.get("internal.webClient.appInit.canCopy")!=="false",canDownloadCsv:we.get("internal.webClient.appInit.canDownloadCsv")!=="false"}};t(Vt.DEFAULT),g(we),n(q),s(Tn,te),i(H),o(A),a(Tn,U),O!==void 0&&r(Tn,O),c(P),h(Ie),m(K),u(oe)}catch(N){Os.error(N),C(N)}},[t,n,s,i,o,a,r,c,h,u,m,g]),y=b.useCallback(()=>{document.fonts!=null?document.fonts.ready.then(()=>{w(!1)}):w(!1)},[]);b.useEffect(function(){T(),y()},[T,y]);const E=e==null&&p==null||v,D=!E&&p==null,F=p!=null||f!=null?`${p??f}`:null;return l.jsxs(l.Fragment,{children:[D&&l.jsx(wI,{}),l.jsx(sr,{isLoading:E,isLoaded:D,errorMessage:F}),l.jsxs("div",{id:"preload-fonts",style:{visibility:"hidden",position:"absolute",top:-1e4},children:[l.jsx("p",{className:"fira-sans-regular",children:"preload"}),l.jsx("p",{className:"fira-sans-semibold",children:"preload"}),l.jsx("p",{className:"fira-mono",children:"preload"})]})]})}Oc.propTypes={workspace:I.shape({}),workspaceStorage:I.shape({close:I.func}),setActiveTool:I.func.isRequired,setCommandHistoryStorage:I.func.isRequired,setDashboardData:I.func.isRequired,setFileStorage:I.func.isRequired,setLayoutStorage:I.func.isRequired,setDashboardConnection:I.func.isRequired,setDashboardSessionWrapper:I.func.isRequired,setPlugins:I.func.isRequired,setUser:I.func.isRequired,setWorkspace:I.func.isRequired,setWorkspaceStorage:I.func.isRequired};Oc.defaultProps={workspace:null,workspaceStorage:null};const LI=d=>({workspace:mr(d),workspaceStorage:zS(d)}),vh=Ct(LI,{setActiveTool:fr,setCommandHistoryStorage:QS,setDashboardData:Yu,setFileStorage:JS,setLayoutStorage:Nx,setDashboardConnection:oR,setDashboardSessionWrapper:aR,setPlugins:tb,setUser:XS,setWorkspace:Ru,setWorkspaceStorage:ZS,setServerConfigValues:nb})(Oc);function PI(){return l.jsx(vg,{basename:"/ide/",children:l.jsxs(Tg,{children:[l.jsx(_c,{exact:!0,path:"/",component:vh}),l.jsx(_c,{path:"/notebook/:notebookPath+",component:vh}),l.jsx(Eg,{from:"*",to:"/"})]})})}Boolean(window.location.hostname==="localhost"||window.location.hostname==="[::1]"||window.location.hostname.match(/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/));function _I(){"serviceWorker"in navigator&&navigator.serviceWorker.getRegistrations().then(d=>{d.forEach(e=>{e.scope.endsWith("/download/")||e.unregister()})})}function GI(){return _I(),No.registerOnLoaded(),Ht.init({getWorker:()=>new Rg}),window["__react-beautiful-dnd-disable-dev-warnings"]=!0,l.jsx(Eh,{store:Cr,children:l.jsx(PI,{})})}export{GI as AppRoot,GI as default};
43
- //# sourceMappingURL=AppRoot-e0394f7d.js.map
43
+ //# sourceMappingURL=AppRoot-c10c5659.js.map