@deephaven/code-studio 0.27.0 → 0.27.1-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,47 @@
1
+ import{B as D,A as w,R as X,P as zg,C as h,D as mt,E as z,F as T,G as bi,H as Fl,I as be,J as Ze,K as ee,L as Te,M as We,N as Wg,O as Gg,Q as fd,S as xl,T as Kg,U as qg,V as Se,W as Va,X as Qn,Y as bu,Z as ut,_ as Cd,$ as Yg,a0 as Xg,a1 as jg,a2 as Zg,a3 as fe,a4 as Oc,a5 as bd,a6 as Qg,a7 as Jg,a8 as Su,a9 as Je,aa as Ua,ab as _l,ac as Lc,ad as ef,ae as qn,af as tf,ag as nf,ah as sf,ai as of,aj as Ba,ak as rf,al as lf,am as af,an as Ac,ao as df,ap as cf,aq as Pc,ar as hf,as as uf,at as mf,au as pf,av as gf,aw as It,ax as wu,ay as ff,az as vu,aA as Cf,aB as Tu,aC as bf,aD as Sf,aE as wf,aF as vf,aG as Tf,aH as Ef,aI as yf,aJ as If,aK as Hc,aL as Rf}from"./vendor.cbc1eaf5.js";import{e as gs,l as Hi,K as Cn,a as Vc,b as Kn,_ as Df,W as Mf}from"./monaco.1292e04e.js";import{P as dl,b as Nf,h as Ff,p as xf,o as _f,s as kf,t as Of,c as Sa}from"./plotly.eb715493.js";import"./helpers.162e09a8.js";(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))s(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const r of o.addedNodes)r.tagName==="LINK"&&r.rel==="modulepreload"&&s(r)}).observe(document,{childList:!0,subtree:!0});function n(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerpolicy&&(o.referrerPolicy=i.referrerpolicy),i.crossorigin==="use-credentials"?o.credentials="include":i.crossorigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function s(i){if(i.ep)return;i.ep=!0;const o=n(i);fetch(i.href,o)}})();const Lf="#1a171a",Af="#f0f0ee",Pf="#fcd65b",Hf="#9edc6f",Vf="#76d9e4",Uf="#aa9af4",Bf="#f37e3f",$f="#f95d84",zf="#4878ea",Wf="#5b5a5c",Gf="#9edc6f",Kf="#fcd65b",qf="#f37e3f",Yf="#f95d84",Xf="#fcfcfa",jf="#929192",Zf="#373438",Qf="#1a171a",Jf="#f0f0ee",eC="0.15s",tC={"gray-100":"#fcfcfa","gray-200":"#f0f0ee","gray-300":"#c0bfbf","gray-400":"#929192","gray-500":"#5b5a5c","gray-600":"#555356","gray-700":"#403e41","gray-800":"#373438","gray-850":"#322f33","gray-900":"#211f22",black:Lf,white:Af,yellow:Pf,green:Hf,blue:Vf,purple:Uf,orange:Bf,red:$f,primary:zf,"primary-hover":"#235de6","primary-dark":"#343e5d",secondary:Wf,success:Gf,info:Kf,warning:qf,danger:Yf,light:Xf,mid:jf,dark:Zf,"text-muted":"#929192","content-bg":"#2d2a2e",background:Qf,foreground:Jf,transition:eC},nC={transitionMs:150,transitionMidMs:200,transitionLongMs:300,transitionSlowMs:1e3},ze=Object.freeze({...nC,...tC});class kn extends w.exports.Component{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=X.createRef(),this.rAF=0;const{isShown:n}=this.props;this.state={show:n,popper:null}}componentDidUpdate(e){const{isShown:n}=this.props;e.isShown!==n&&(n?(cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{this.show()})):this.hide())}componentWillUnmount(){this.destroyPopper(!1)}getVisibleElement(e){return e==null||e.clientHeight>0||e.clientWidth>0?e:this.getVisibleElement(e.parentElement)}initPopper(){let{popper:e}=this.state;const{closeOnBlur:n,referenceObject:s}=this.props;if(e||this.container.current===null)return;let{options:i}=this.props;i={placement:"auto",modifiers:{preventOverflow:{boundariesElement:"viewport"}},...i},document.body.appendChild(this.element);let o=this.getVisibleElement(this.container.current);o==null&&(o=this.container.current),e=new zg(s||o,this.element,i),e.scheduleUpdate(),cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{if(n&&!this.element.contains(document.activeElement)){const r=this.element.firstElementChild;r instanceof HTMLElement&&r.focus()}}),this.setState({popper:e})}destroyPopper(e=!0){cancelAnimationFrame(this.rAF);const{popper:n}=this.state;!n||(n.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:n}=this.state;n||this.destroyPopper(),e()}renderContent(){const{className:e,children:n,timeout:s,interactive:i,closeOnBlur:o}=this.props,{show:r}=this.state;return h(mt,{in:r,timeout:s,classNames:"popper-transition",onEntered:this.handleEnter,onExited:this.handleExit,children:h("div",{onClick:l=>{l.stopPropagation()},onKeyDown:l=>{l.key==="Escape"&&this.hide()},className:z("popper",{interactive:i},e),onBlur:o?this.handleBlur:void 0,tabIndex:o?-1:void 0,role:"presentation",children:T("div",{className:"popper-content",children:[n,h("div",{className:"popper-arrow","x-arrow":""})]})})})}render(){const{popper:e}=this.state,{"data-testid":n}=this.props;return h("div",{className:"popper-parent-container",ref:this.container,style:{display:"none"},"data-testid":n,children:e&&bi.createPortal(this.renderContent(),this.element)})}}kn.propTypes={children:D.exports.node.isRequired,options:D.exports.shape({}),className:D.exports.string,timeout:D.exports.number,onEntered:D.exports.func,onExited:D.exports.func,isShown:D.exports.bool,closeOnBlur:D.exports.bool,interactive:D.exports.bool,referenceObject:D.exports.shape({}),"data-testid":D.exports.string};kn.defaultProps={options:{},className:"",timeout:ze.transitionMs,onEntered(){},onExited(){},isShown:!1,interactive:!1,closeOnBlur:!1,referenceObject:null,"data-testid":void 0};const sC=-1,Eu=0,yu=1,Sd=2,Iu=3,Ru=4;Object.freeze({SILENT:sC,ERROR:Eu,WARN:yu,INFO:Sd,DEBUG:Iu,DEBUG2:Ru});const yn=()=>{};class Uc{constructor(e,n){this.name=e,this.prefix=e!=null?`[${e}]`:"",this.error=yn,this.warn=yn,this.log=yn,this.info=yn,this.debug=yn,this.debug2=yn,this.level=n,this.setLogLevel(n)}setLogLevel(e){if(!Number.isFinite(e)){console.warn(`Expected a number for log level. Received: ${e}. Ignoring`);return}this.level=e,this.error=e>=Eu?console.error.bind(console,this.prefix):yn,this.warn=e>=yu?console.warn.bind(console,this.prefix):yn,this.log=e>=Sd?console.log.bind(console,this.prefix):yn,this.info=this.log,this.debug=e>=Iu?console.debug.bind(console,this.prefix):yn,this.debug2=e>=Ru?console.debug.bind(console,this.prefix):yn}}class iC extends Uc{constructor(e=Sd){super(null,e),this.modules={}}module(e){return this.modules[e]==null&&(this.modules[e]=new Uc(e,this.level)),this.modules[e]}setLogLevel(e){if(super.setLogLevel(e),this.modules==null)return;const n=Object.keys(this.modules);for(let s=0;s<n.length;s+=1)this.modules[n[s]].setLogLevel(e)}}const Z=new iC;var Ht=(t=>(t.DEBUG="D",t.LOG="L",t.WARN="W",t.ERROR="E",t.UNCAUGHT_ERROR="U",t))(Ht||{});function Ro(t,e){return new CustomEvent(t,{detail:e})}class oC{constructor(){this.isEnabled=!1,this.handleUncaughtError=e=>{const n=[];e.error!=null&&n.push(e.error),e.message&&n.push(e.message),this.eventTarget.dispatchEvent(Ro("U",n))},this.debug=console.debug,this.log=console.log,this.warn=console.warn,this.error=console.error,this.eventTarget=new Fl}enable(){this.isEnabled||(console.debug=(...e)=>{this.eventTarget.dispatchEvent(Ro("D",e)),this.debug.apply(console,e)},console.log=(...e)=>{this.eventTarget.dispatchEvent(Ro("L",e)),this.log.apply(console,e)},console.warn=(...e)=>{this.eventTarget.dispatchEvent(Ro("W",e)),this.warn.apply(console,e)},console.error=(...e)=>{this.eventTarget.dispatchEvent(Ro("E",e)),this.error.apply(console,e)},window.addEventListener("error",this.handleUncaughtError),Z.setLogLevel(Z.level),this.isEnabled=!0)}disable(){!this.isEnabled||(console.debug=this.debug,console.log=this.log,console.warn=this.warn,console.error=this.error,window.removeEventListener("error",this.handleUncaughtError),Z.setLogLevel(Z.level),this.isEnabled=!1)}addEventListener(e,n){this.eventTarget.addEventListener(e,n)}removeEventListener(e,n){this.eventTarget.removeEventListener(e,n)}}class cl{static formatMessages(e){return e.map(s=>{if(typeof s=="string")return s;let i="";try{i=JSON.stringify(s)}catch{i=s.toString()}return i==="{}"?s.toString():i}).join(" ")}static formatStack(e,n){if(e==="")return"";let s=e.split(`
2
+ `).map(i=>i.trim());switch(n){case Ht.ERROR:s=s.splice(e[0]==="Error"?4:3);break;case Ht.UNCAUGHT_ERROR:s=s.splice(e[0]==="Error"?3:2);break}return s!=null?` ${s.join(`
3
+ `)}`:""}constructor(e){this.history=[],this.offset=0,this.limit=1e4,this.isEnabled=!1,this.proxy=e,this.addHistory=this.addHistory.bind(this)}enable(){this.isEnabled||(this.proxy.addEventListener(Ht.DEBUG,this.addHistory),this.proxy.addEventListener(Ht.LOG,this.addHistory),this.proxy.addEventListener(Ht.WARN,this.addHistory),this.proxy.addEventListener(Ht.ERROR,this.addHistory),this.proxy.addEventListener(Ht.UNCAUGHT_ERROR,this.addHistory),this.isEnabled=!0)}disable(){!this.isEnabled||(this.proxy.removeEventListener(Ht.DEBUG,this.addHistory),this.proxy.removeEventListener(Ht.LOG,this.addHistory),this.proxy.removeEventListener(Ht.WARN,this.addHistory),this.proxy.removeEventListener(Ht.ERROR,this.addHistory),this.proxy.removeEventListener(Ht.UNCAUGHT_ERROR,this.addHistory),this.isEnabled=!1)}addHistory({type:e,detail:n}){const s={type:e,messages:n,time:new Date};switch(e){case Ht.ERROR:case Ht.UNCAUGHT_ERROR:s.stack=Error().stack;break}this.history[this.offset%this.limit]=s,this.offset+=1}getHistory(){if(this.offset>this.limit){const e=this.offset%this.limit;this.history=this.history.slice(e).concat(this.history.slice(0,e)),this.offset=this.limit}return this.history}getFormattedHistory(){return this.getHistory().map(n=>`${n.time.toISOString()} ${n.type} ${cl.formatMessages(n.messages)}`+(n.stack!=null?`
4
+ ${cl.formatStack(n.stack,n.type)}`:"")).join(`
5
+ `)}}const rC=Z.module("Tooltip"),tn=class extends w.exports.Component{constructor(t){super(t),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=X.createRef(),this.popper=X.createRef(),this.parent=null,this.timer=null,this.state={isShown:!1}}static handleHidden(){tn.shownTooltipCount-=1,tn.shownTooltipCount===0&&(tn.lastHiddenTime=Date.now())}static handleShown(){tn.shownTooltipCount+=1}componentDidMount(){this.startListening();const{timeout:t}=this.props;t===0&&this.show()}componentDidUpdate(t,e){const{isShown:n}=e,{isShown:s}=this.state;s!==n&&(s?tn.handleShown():tn.handleHidden())}componentWillUnmount(){this.stopListening(),this.stopListeningWindow(),this.stopTimer();const{isShown:t}=this.state;t&&tn.handleHidden()}startListening(){if(!this.container.current||!this.container.current.parentElement){rC.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:t}=this.state;this.popper.current&&this.parent&&t&&!this.popper.current.element.matches(":hover")&&!this.parent.matches(":hover")&&(this.stopTimer(),this.hide())}handleMouseLeave(){const{isShown:t}=this.state;this.stopTimer();const{interactive:e}=this.props;!e&&t&&this.hide()}handleTimeout(){this.show()}handleWindowMouseMove(t){const e=t.clientX,n=t.clientY,{isShown:s}=this.state;if(!this.popper.current||!this.parent)return;const i=this.popper.current.element.getBoundingClientRect(),o=this.parent.getBoundingClientRect();e>=i.left&&e<=i.left+i.width&&n>=i.top&&n<=i.top+i.height?this.handleMouseMove():e>=o.left&&e<=o.left+o.width&&n>=o.top&&n<=o.top+o.height?this.handleMouseMove():s&&(this.stopTimer(),this.hide())}startTimer(){this.stopTimer();const{timeout:t,reshowTimeout:e}=this.props;let n=t;(tn.shownTooltipCount>0||Date.now()-tn.lastHiddenTime<tn.triggerReshowThreshold)&&(n=e),this.timer=window.setTimeout(this.handleTimeout,n)}stopTimer(){this.timer!=null&&(clearTimeout(this.timer),this.timer=null)}show(){var e;const{isShown:t}=this.state;if(this.stopTimer(),!t){(e=this.popper.current)==null||e.show(),this.setState({isShown:!0});const{interactive:n}=this.props;n&&this.startListeningWindow()}}hide(){var t;(t=this.popper.current)==null||t.hide(),this.stopListeningWindow()}update(){var t;(t=this.popper.current)==null||t.scheduleUpdate()}handleExited(){this.setState({isShown:!1});const{onExited:t}=this.props;t()}stopShowingTooltip(){const{isShown:t}=this.state;this.stopTimer(),t&&this.hide()}render(){const{interactive:t,children:e,referenceObject:n,popperClassName:s,"data-testid":i,onEntered:o}=this.props,{isShown:r}=this.state;let{options:l}=this.props;return l={placement:"bottom",...l},h("div",{ref:this.container,style:{display:"none"},"data-testid":i,children:h(kn,{className:z(s),options:l,ref:this.popper,onEntered:o,onExited:this.handleExited,interactive:t,referenceObject:n,children:T("div",{className:"tooltip-content",children:[" ",r&&e]})})})}};let Ye=tn;Ye.defaultTimeout=500;Ye.defaultReshowTimeout=100;Ye.triggerReshowThreshold=300;Ye.shownTooltipCount=0;Ye.lastHiddenTime=Date.now();Ye.defaultProps={interactive:!1,options:{},popperClassName:"",reshowTimeout:tn.defaultReshowTimeout,timeout:tn.defaultTimeout,onEntered:()=>{},onExited:()=>{},"data-testid":void 0};const lC=100;var Du=(t=>(t.UP="UP",t.DOWN="DOWN",t))(Du||{});const si=class extends w.exports.Component{constructor(t){super(t),this.getCachedFilteredOptions=be((n,s)=>n.filter(i=>i.title.toLowerCase().indexOf(s.toLowerCase())>=0));let{popperOptions:e}=this.props;e={placement:"bottom-end",modifiers:{preventOverflow:{enabled:!1}},...e},this.state={title:"",filteredOptions:[],keyboardOptionIndex:0,menuIsOpen:!1,inputWidth:100,invalid:!1,popperOptions:e},this.handleMenuKeyDown=this.handleMenuKeyDown.bind(this),this.handleMenuBlur=this.handleMenuBlur.bind(this),this.handleInputChange=this.handleInputChange.bind(this),this.handleInputKeyDown=this.handleInputKeyDown.bind(this),this.handleInputBlur=this.handleInputBlur.bind(this),this.handelInputFocus=this.handelInputFocus.bind(this),this.handleInputClick=this.handleInputClick.bind(this),this.updateInputValue=Ze(this.updateInputValue,lC),this.handleOptionClick=this.handleOptionClick.bind(this),this.handleMenuOpened=this.handleMenuOpened.bind(this),this.handleMenuExited=this.handleMenuExited.bind(this),this.popper=X.createRef(),this.cbContainer=X.createRef(),this.menuContainer=X.createRef(),this.input=X.createRef()}setInputWidth(){this.cbContainer.current&&this.setState({inputWidth:this.cbContainer.current.getBoundingClientRect().width})}getValueAndValidate(t){if(!t)return this.setState({invalid:!1}),{value:t,isValid:!1};const{options:e}=this.props,n=e.filter(s=>s.title.toLowerCase()===t.toLowerCase());return n.length<1?(this.setState({invalid:!0}),{value:t,isValid:!1}):(this.setState({invalid:!1}),{value:n[0].value,isValid:!0})}updateInputValue(t){const{menuIsOpen:e}=this.state,{value:n,isValid:s}=this.getValueAndValidate(t);e&&this.processFilterChange(t),this.fireOnChange(n,s)}fireOnChange(t,e=!0){const{onChange:n}=this.props;n(t,e)}processFilterChange(t){var o;const{options:e}=this.props,{menuIsOpen:n}=this.state,s=t?this.getCachedFilteredOptions(e,t):e,i=s.length===1&&s[0].title===t;if(this.setState({filteredOptions:s,keyboardOptionIndex:0}),i&&n){this.closeMenu();return}(o=this.popper.current)==null||o.scheduleUpdate()}resetValue(){this.setState({title:""}),this.fireOnChange("")}handleResize(){this.setInputWidth()}handleMenuKeyDown(t){var i;const{filteredOptions:e,keyboardOptionIndex:n}=this.state,s=e[n];switch(t.key){case"Enter":case"ArrowRight":t.stopPropagation(),t.preventDefault(),s!=null&&(this.setState({title:s.title,invalid:!1}),this.fireOnChange(s.value)),this.closeMenu(),(i=this.input.current)==null||i.focus();break;case"ArrowUp":t.stopPropagation(),t.preventDefault(),this.navigateMenu(si.MENU_NAVIGATION_DIRECTION.UP);break;case"ArrowDown":t.stopPropagation(),t.preventDefault(),this.navigateMenu(si.MENU_NAVIGATION_DIRECTION.DOWN);break;case"Tab":if(t.stopPropagation(),t.preventDefault(),t.shiftKey){this.navigateMenu(si.MENU_NAVIGATION_DIRECTION.UP);break}this.navigateMenu(si.MENU_NAVIGATION_DIRECTION.DOWN);break;case"Escape":t.preventDefault(),t.stopPropagation(),this.closeMenu();break}}navigateMenu(t){const{filteredOptions:e,keyboardOptionIndex:n}=this.state;let s=n;t===si.MENU_NAVIGATION_DIRECTION.UP?n>0?(s=(s-1)%e.length,this.setState({keyboardOptionIndex:s})):n===0&&(s=e.length-1,this.setState({keyboardOptionIndex:s})):t===si.MENU_NAVIGATION_DIRECTION.DOWN&&n<e.length&&(s=(s+1)%e.length,this.setState({keyboardOptionIndex:s})),this.scrollOptionIntoView(s)}handleInputKeyDown(t){const{onEnter:e}=this.props,{menuIsOpen:n}=this.state;n?this.handleMenuKeyDown(t):t.key==="Enter"?e():t.key==="Escape"?(this.resetValue(),t.preventDefault(),t.stopPropagation()):t.key==="ArrowRight"||t.key==="ArrowLeft"||t.key==="Tab"||t.key==="Shift"||this.openMenu()}handleInputChange(t){this.setState({title:t.target.value}),this.updateInputValue(t.target.value)}handleOptionClick(t){var e;this.setState({title:t.title,invalid:!1}),this.fireOnChange(t.value),this.closeMenu(),(e=this.input.current)==null||e.focus()}handelInputFocus(){const{menuIsOpen:t}=this.state;t||this.openMenu()}handleInputClick(){const{menuIsOpen:t}=this.state;t||this.openMenu()}handleInputBlur(t){const{menuIsOpen:e}=this.state;e&&t.relatedTarget instanceof Element&&this.popper.current!==null&&this.popper.current.element.contains(t.relatedTarget)||this.closeMenu(!1)}handleMenuBlur(t){t.relatedTarget===this.input.current||t.relatedTarget instanceof Element&&this.popper.current!==null&&this.popper.current.element.contains(t.relatedTarget)||this.closeMenu(!1)}handleMenuOpened(){var t;(t=this.input.current)==null||t.focus()}handleMenuExited(){const{menuIsOpen:t}=this.state;t&&this.setState({menuIsOpen:!1,keyboardOptionIndex:0})}openMenu(){const{title:t}=this.state;this.processFilterChange(t),this.setInputWidth(),this.setState({menuIsOpen:!0}),window.requestAnimationFrame(()=>{var e;(e=this.popper.current)==null||e.show()})}closeMenu(t=!0){var e,n;this.setState({menuIsOpen:!1,keyboardOptionIndex:0}),t&&((e=this.input.current)==null||e.focus()),(n=this.popper.current)==null||n.hide()}scrollOptionIntoView(t){var e;this.menuContainer.current&&((e=this.menuContainer.current.children.item(t))==null||e.scrollIntoView({behavior:"smooth",block:"nearest"}))}renderMenuElement(){const{inputWidth:t}=this.state;return h("div",{className:z("aci-options"),ref:this.menuContainer,role:"presentation",onKeyDown:this.handleMenuKeyDown,style:{width:t},onBlur:this.handleMenuBlur,children:this.renderOptions()})}renderOptions(){const{noMatchText:t}=this.props,{title:e,filteredOptions:n}=this.state;return e&&n.length===0?h("div",{className:"no-match",children:t}):n.map((s,i)=>this.renderOption(s,i))}renderOption(t,e){const{keyboardOptionIndex:n}=this.state,s=`option-${e}-${t.value}`;return h("button",{type:"button",className:z("aci-option-btn",{"keyboard-active":n===e}),onClick:()=>this.handleOptionClick(t),onFocus:()=>this.setState({keyboardOptionIndex:e}),children:t.title},s)}render(){const{options:t,inputPlaceholder:e,disabled:n,className:s,defaultTitle:i,spellCheck:o,"data-testid":r}=this.props,{title:l,menuIsOpen:a,popperOptions:d,invalid:c}=this.state;return T("div",{className:"aci-container",ref:this.cbContainer,children:[h("input",{value:l||i,className:z("form-control",s,"aci-input",{"is-invalid":c&&!a}),ref:this.input,onChange:this.handleInputChange,placeholder:e||t[0].title,disabled:n,onFocus:this.handelInputFocus,onClick:this.handleInputClick,onBlur:this.handleInputBlur,onKeyDown:this.handleInputKeyDown,spellCheck:o,"data-testid":r}),h(kn,{ref:this.popper,options:d,className:z("aci-options-popper interactive"),onEntered:this.handleMenuOpened,onExited:this.handleMenuExited,children:this.renderMenuElement()})]})}};let wd=si;wd.propTypes={options:D.exports.arrayOf(D.exports.shape({title:D.exports.string.isRequired,value:D.exports.string.isRequired})).isRequired,popperOptions:D.exports.shape({}),onChange:D.exports.func,inputPlaceholder:D.exports.string,disabled:D.exports.bool,className:D.exports.string,defaultTitle:D.exports.string,spellCheck:D.exports.bool,onEnter:D.exports.func,noMatchText:D.exports.string,"data-testid":D.exports.string};wd.defaultProps={onChange(){},inputPlaceholder:"",disabled:!1,className:"",defaultTitle:"",popperOptions:null,spellCheck:!0,onEnter(){},noMatchText:"No matching items found","data-testid":void 0};wd.MENU_NAVIGATION_DIRECTION=Du;D.exports.string.isRequired,D.exports.func.isRequired,D.exports.string,D.exports.string,D.exports.bool,D.exports.bool,D.exports.string,D.exports.string,D.exports.string;function kl(t){const{children:e,className:n,style:s,"data-testid":i}=t;return h("div",{className:z("btn-group",n),style:s,role:"group","data-testid":i,children:e})}kl.displayName="ButtonGroup";kl.propTypes={children:D.exports.node.isRequired,className:D.exports.string,style:D.exports.object,"data-testid":D.exports.string};kl.defaultProps={className:null,style:{},"data-testid":void 0};const aC=["primary","secondary","tertiary","success","danger","inline","ghost"],dC=["group-end"];function cC(t,e){switch(t){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 z("btn-link",{"btn-link-icon":e,"btn-link-icon-only":e})}}function hC(t){switch(t){case"group-end":return z("pl-2","pr-3")}}const W=X.forwardRef((t,e)=>{const{kind:n,variant:s,type:i,tooltip:o,icon:r,disabled:l=!1,active:a,onClick:d,onContextMenu:c,onMouseDown:u,onMouseUp:m,onMouseEnter:p,onMouseLeave:g,onKeyDown:f,className:b,style:C,children:S,tabIndex:v,"data-testid":y,"aria-label":E}=t,I=Boolean(r&&S==null),R=cC(n,I);let N;s&&(N=hC(s));let F;r&&(F=X.isValidElement(r)?r:h(ee,{icon:r}));let P;o!==void 0&&(P=typeof o=="string"?h(Ye,{children:o}):o);let H=E;E===void 0&&I&&o!=null&&typeof o=="string"&&(H=o);const x=T("button",{"data-testid":y,ref:e,type:i,className:z("btn",R,N,{active:a},b),onClick:d,onContextMenu:c,onMouseUp:m,onMouseDown:u,onMouseEnter:p,onMouseLeave:g,onKeyDown:f,style:C,disabled:l,tabIndex:v,"aria-label":H,children:[r&&F,S,o!=null&&!l&&P]});return l?T("span",{className:"btn-disabled-wrapper",children:[x,o!==void 0&&P]}):x});W.displayName="Button";W.propTypes={kind:D.exports.oneOf(aC).isRequired,variant:D.exports.oneOf(dC),type:D.exports.oneOf(["submit","reset","button"]),tooltip(t){const{tooltip:e,icon:n,children:s}=t;return e===void 0&&n!=null&&s==null?new Error("Tooltip is required for icon only buttons"):null},icon(t){const{children:e,icon:n}=t;return n==null&&e==null?new Error("Icon is required if no children are provided"):e==null&&!X.isValidElement(n)&&(n==null||n.iconName===""||n.iconName==null)?new Error("Icon must be react element or fontawesome IconDefinition"):null},disabled:D.exports.bool,active:D.exports.bool,onClick(t){const{onClick:e,type:n}=t;return n==="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:D.exports.func,onMouseUp:D.exports.func,onMouseDown:D.exports.func,onMouseEnter:D.exports.func,onMouseLeave:D.exports.func,onKeyDown:D.exports.func,tabIndex:D.exports.number,children:D.exports.node,className:D.exports.string,style:D.exports.object,"data-testid":D.exports.string};W.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};function Jo({className:t="theme-bg-light",children:e,role:n="role",keyboard:s=!0,isOpen:i=!1,centered:o=!1,size:r,onOpened:l,onClosed:a,toggle:d,"data-testid":c}){const u=w.exports.useRef(),m=w.exports.useRef(null),[p,g]=w.exports.useState(!1),f=w.exports.useCallback(C=>{switch(C.key){case"Escape":d==null||d();break}},[d]);w.exports.useEffect(function(){if(i&&s)return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[f,i,s]),w.exports.useEffect(function(){i&&l&&l()},[l,i]),w.exports.useEffect(function(){!i&&a&&a()},[a,i]),i&&!u.current&&(u.current=document.createElement("div"),u.current.setAttribute("style","padding-right: 15px; display: block"),u.current.setAttribute("role","presentation"),document.body.appendChild(u.current));const b=()=>{u.current&&(document.body.removeChild(u.current),u.current=void 0)};return u.current?bi.createPortal(T(Te,{children:[h(mt,{appear:!0,mountOnEnter:!0,unmountOnExit:!0,in:i,classNames:{appearActive:"show",appearDone:"show"},timeout:ze.transitionMs,onExited:b,children:h("div",{className:z("modal-backdrop fade"),style:{zIndex:1050}})}),h(mt,{appear:!0,mountOnEnter:!0,unmountOnExit:!0,in:i,classNames:{appearDone:"show"},timeout:ze.transitionMs,onExited:b,children:h("div",{ref:m,className:"modal fade",onMouseDown:C=>{C.target===m.current?g(!0):g(!1)},onMouseUp:C=>{p&&C.target===m.current&&d!==void 0&&d()},role:"dialog",style:{display:"block"},children:h("div",{className:z(`modal-dialog ${t}`,{"modal-lg":r==="lg","modal-sm":r==="sm","modal-xl":r==="xl","modal-dialog-centered":o}),style:{zIndex:1040},children:h("div",{className:"modal-content",role:"presentation","data-testid":c,children:e})})})})]}),u.current):null}function er({className:t="modal-body",style:e,children:n,"data-testid":s}){return h("div",{className:t,"data-testid":s,style:e,children:n})}function tr({className:t,children:e,closeButton:n=!0,style:s,toggle:i,"data-testid":o}){return T("div",{className:`modal-header ${t}`,style:s,children:[h("h5",{className:"modal-title",children:e}),n&&h("button",{type:"button",className:"close","data-dismiss":"modal","aria-label":"Close",onClick:i,children:h("span",{"aria-hidden":"true",children:"\xD7"})})]})}function vd({className:t="modal-footer",children:e,"data-testid":n}){return h("div",{className:t,"data-testid":n,children:e})}function ji(t){const{isOpen:e,headerText:n,bodyText:s,onCancel:i,onConfirm:o,onDiscard:r,onModalDisable:l,cancelButtonText:a="Cancel",confirmButtonText:d="Okay",discardButtonText:c="Discard",children:u,"data-testid":m}=t,p=w.exports.useRef(null),g=w.exports.useRef(null),f=w.exports.useCallback(()=>{g.current!==null&&g.current.checked&&l&&l(),o()},[o,l]),b=w.exports.useCallback(()=>{var S;(S=p.current)==null||S.focus()},[]);let C="";return e&&(C=typeof s=="function"?s():s),T(Jo,{isOpen:e,className:"theme-bg-light",onOpened:b,children:[h(tr,{closeButton:!1,children:n}),h(er,{children:C}),T(vd,{children:[l&&T("div",{className:"custom-control custom-checkbox form-group mr-auto",children:[h("input",{type:"checkbox",className:"custom-control-input",id:"move-confirmation-checkbox",defaultChecked:!1,ref:g,"data-testid":m!==void 0?`${m}-checkbox-confirm`:void 0}),h("label",{className:"custom-control-label",htmlFor:"move-confirmation-checkbox",children:"Don't ask me again"})]}),r&&h(W,{kind:"secondary",className:"mr-auto","data-dismiss":"modal",onClick:r,"data-testid":m!==void 0?`${m}-btn-discard`:void 0,children:c}),i&&h(W,{kind:"secondary","data-dismiss":"modal",onClick:i,"data-testid":m!==void 0?`${m}-btn-cancel`:void 0,children:a}),T(kl,{children:[h(W,{kind:"primary",onClick:f,ref:p,"data-testid":m!==void 0?`${m}-btn-confirm`:void 0,children:d}),u]})]})]})}ji.propTypes={isOpen:D.exports.bool.isRequired,headerText:D.exports.string.isRequired,bodyText:D.exports.oneOfType([D.exports.string,D.exports.func]).isRequired,onCancel:D.exports.func,onConfirm:D.exports.func.isRequired,onDiscard:D.exports.func,onModalDisable:D.exports.func,cancelButtonText:D.exports.string,confirmButtonText:D.exports.string,discardButtonText:D.exports.string,children:D.exports.node,"data-testid":D.exports.string};ji.defaultProps={children:void 0,cancelButtonText:"Cancel",confirmButtonText:"Okay",discardButtonText:"Discard",onCancel:void 0,onDiscard:void 0,onModalDisable:void 0,"data-testid":void 0};const jo=X.forwardRef((t,e)=>{const{children:n,className:s,disabled:i,onClick:o,style:r,id:l}=t;return h("button",{ref:e,type:"button",className:z("btn",s),onClick:o,style:r,disabled:i,id:l,children:n})});jo.displayName="Button";jo.propTypes={children:D.exports.node,className:D.exports.string,disabled:D.exports.bool,onClick:D.exports.func,style:D.exports.shape({}),id:D.exports.string};jo.defaultProps={children:null,className:"",disabled:!1,onClick:()=>null,style:{},id:""};function Td({className:t,isFlipped:e,children:n,"data-testid":s}){const i=a=>{if(n.length!==2)throw new Error("CardFlip requires 2 children to function");return n[a]},o=w.exports.useRef(null),r=w.exports.useCallback(a=>{a.target===a.currentTarget&&document.body.classList.add("card-flip--is-flipping")},[]),l=w.exports.useCallback(a=>{a.target===a.currentTarget&&document.body.classList.remove("card-flip--is-flipping")},[]);return w.exports.useEffect(function(){if(!o.current)throw Error("ref undefined");o.current.addEventListener("transitionstart",r);const d=o.current;return function(){if(d!=null)return d.removeEventListener("transitionstart",r)}},[r]),T("div",{className:z(t,{"card-flip--show-front":e,"card-flip--show-back":!e}),"data-testid":s,children:[h("div",{className:"card-flip--back",children:i(0)}),h("div",{ref:o,className:"card-flip--front",onTransitionEnd:l,children:i(1)})]})}function wa(t){return t.then!==void 0}const Vi=class{static disableAllActions(){Vi.actionsDisabled=!0}static enableAllActions(){Vi.actionsDisabled=!1}static isContextActionEvent(t){return Array.isArray(t.contextActions)}static compareActions(t,e){var n,s,i,o,r,l;return t.group!==e.group?((n=t.group)!=null?n:0)>((s=e.group)!=null?s:0)?1:-1:t.order!==e.order?((i=t.order)!=null?i:0)>((o=e.order)!=null?o:0)?1:-1:t.title!==e.title?((r=t.title)!=null?r:"")>((l=e.title)!=null?l:"")?1:-1:t!==e?t>e?1:-1:0}static sortActions(t){if(t==null||!Array.isArray(t))return[];const e=t.slice();return e.sort(Vi.compareActions),e}static isMacPlatform(){const{platform:t}=window.navigator;return t.startsWith("Mac")}static getModifierKey(){return Vi.isMacPlatform()?"metaKey":"ctrlKey"}static isModifierKeyDown(t){const e=Vi.getModifierKey();return t[e]}static getMenuItems(t,e=!0){let n=[],s=t;Array.isArray(s)||(s=[s]);for(let i=0;i<s.length;i+=1){const o=s[i];let r;typeof o=="function"?r=o():r=o,r!=null&&(r instanceof Promise?e&&n.push(r):Array.isArray(r)?n=n.concat(r):n.push(r))}return n=n.filter(i=>i.title!==void 0||i.then!=null||i.menuElement),n}static getNextMenuItem(t,e,n){let s=t;s<0&&e<0&&(s=n.length);for(let i=1;i<n.length+1;i+=1){const o=(s+e*i+n.length)%n.length,r=n[o];if(!(r instanceof Promise)&&r.disabled!==!0)return o}return t}};let Ge=Vi;Ge.actionsDisabled=!1;const Bc=Z.module("GlobalContextAction");class uC extends w.exports.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 n=e;n.contextActions==null&&(n.contextActions=[]);const{action:s}=this.props;s.title==null&&!s.menuElement||(n.contextActions==null&&(n.contextActions=[]),n.contextActions.push(s),Bc.debug("Received context menu event at global action! Menu items are now: ",n.contextActions))}handleKeyDown(e){var s;const{action:n}=this.props;!Ge.actionsDisabled&&n.shortcut!==void 0&&n.shortcut.matchesEvent(e)&&(Bc.debug("Global hotkey matched!",e),(s=n.action)==null||s.call(n,e),e.preventDefault(),e.stopPropagation())}render(){return null}}class mC extends w.exports.Component{render(){const{actions:e,"data-testid":n}=this.props,s=[];for(let i=0;i<e.length;i+=1){const o=e[i],{shortcut:r}=o;if(o.title!=null||o.menuElement||r){const l=h(uC,{action:o,"data-testid":n},`${o.title}.${r==null?void 0:r.id}`);s.push(l)}}return s}}const kr=Z.module("ContextActions");class ae extends w.exports.Component{constructor(e){super(e),this.handleContextMenu=this.handleContextMenu.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.container=X.createRef(),this.state={globalActions:[],keyboardActions:[]}}static triggerMenu(e,n,s,i){if(i.length===0)return;const o=new MouseEvent("contextmenu",{clientX:n,clientY:s,bubbles:!0,cancelable:!0});o.contextActions=i,e.dispatchEvent(o)}static getDerivedStateFromProps(e){if(e.actions==null||!Array.isArray(e.actions))return{globalActions:[],keyboardActions:[]};const n=e.actions.filter(i=>!wa(i)&&typeof i!="function"&&i.isGlobal),s=e.actions.filter(i=>!wa(i)&&typeof i!="function"&&(i.isGlobal===void 0||!i.isGlobal)&&i.shortcut!=null);return{globalActions:n,keyboardActions:s}}componentDidMount(){var e;(e=this.container.current)!=null&&e.parentElement&&(this.container.current.parentElement.addEventListener("contextmenu",this.handleContextMenu),this.container.current.parentElement.addEventListener("keydown",this.handleKeyDown))}componentWillUnmount(){var e;(e=this.container.current)!=null&&e.parentElement&&(this.container.current.parentElement.removeEventListener("contextmenu",this.handleContextMenu),this.container.current.parentElement.removeEventListener("keydown",this.handleKeyDown))}handleContextMenu(e){const{ignoreClassNames:n=[]}=this.props;if(n.length>0){let i=e.target;for(;i!=null;){const{classList:o}=i,r=n.find(l=>o.contains(l));if(r!==void 0){kr.debug2(`Contextmenu event ignored based on the target className "${r}"`);return}i=i.parentElement}}if(Ge.isContextActionEvent(e)||(e.contextActions=[]),!Ge.isContextActionEvent(e))return;const{actions:s}=this.props;if(s!=null){let i=s;Array.isArray(i)&&(i=i.filter(o=>wa(o)||typeof o=="function"||o.isGlobal===void 0||!o.isGlobal)),e.contextActions=e.contextActions.concat(i)}kr.debug("Received context menu event! Menu items are now: ",e.contextActions)}handleKeyDown(e){var s;const{keyboardActions:n}=this.state;for(let i=0;i<n.length;i+=1){const o=n[i];!Ge.actionsDisabled&&o.shortcut!=null&&o.shortcut.matchesEvent(e)&&(kr.debug("Context hotkey matched!",e),(s=o.action)==null||s.call(o,e),e.stopPropagation(),e.preventDefault(),kr.debug2("Matched hotkey returned false, key event not consumed"))}}render(){const{"data-testid":e}=this.props,{globalActions:n}=this.state;return h("div",{className:"context-actions-listener",ref:this.container,"data-testid":e,children:h(mC,{actions:n})})}}ae.groups={default:null,high:100,medium:5e3,low:1e4,global:1e5,edit:100};var pC={prefix:"vs",iconName:"add",icon:[512,512,[],"f000","M448 224v32H256v192H224V256H32V224h192V32h32v192h192z"]},gC={prefix:"vs",iconName:"arrow-down",icon:[512,512,[],"f000","m100.704 288 160 160h22.624l160 -160 -22.624 -22.624L288 398.048V64H256v334.08L123.328 265.344 100.704 288z"]},fC={prefix:"vs",iconName:"arrow-left",icon:[512,512,[],"f000","m224 98.976 -160 160V281.6l160 160 22.624 -22.624 -132.672 -132.704H448v-32H113.92L246.656 121.6 224 98.976z"]},$c={prefix:"vs",iconName:"arrow-small-down",icon:[512,512,[],"f000","m342.4 276.48 -80 80h-22.4L160 276.48l22.4 -22.72 52.8 52.48V128h32v178.24L320 253.44l22.4 23.04z"]},$a={prefix:"vs",iconName:"arrow-small-up",icon:[512,512,[],"f000","M160 208 240 128h22.4l80 80 -22.4 22.72 -52.8 -52.48v178.24h-32V178.24L182.4 231.04 160 208z"]},Mu={prefix:"vs",iconName:"arrow-up",icon:[512,512,[],"f000","m443.328 224 -160 -160h-22.624l-160 160 22.624 22.624L256 113.952V448h32V113.92l132.672 132.704 22.656 -22.624z"]},jn={prefix:"vs",iconName:"check",icon:[512,512,[],"f000","m461.792 106.336 -271.04 320 -25.28 -1.152 -107.2 -152.64 26.176 -18.368 95.296 135.68 257.632 -304.192 24.448 20.672z"]},CC={prefix:"vs",iconName:"chevron-down",icon:[512,512,[],"f000","m255.232 322.304 139.424 -139.424 19.84 19.776L265.088 352h-19.776L96 202.656l19.808 -19.776 139.424 139.424z"]},bC={prefix:"vs",iconName:"chevron-left",icon:[512,512,[],"f000","m189.696 255.232 139.424 139.424 -19.776 19.84L160 265.088v-19.776L309.344 96l19.776 19.808 -139.424 139.424z"]},Nu={prefix:"vs",iconName:"chevron-right",icon:[512,512,[],"f000","M322.304 256.768 182.88 117.344l19.776 -19.84L352 246.912v19.776L202.656 416l-19.776 -19.808 139.424 -139.424z"]},SC={prefix:"vs",iconName:"chevron-up",icon:[512,512,[],"f000","m256.768 189.696 -139.424 139.424 -19.84 -19.776L246.912 160h19.776L416 309.344l-19.808 19.776 -139.424 -139.424z"]},wC={prefix:"vs",iconName:"chrome-close",icon:[512,512,[],"f000","m227.712 256 -145.856 145.856 28.288 28.288L256 284.288l145.856 145.856 28.288 -28.288L284.288 256l145.856 -145.856 -28.288 -28.288L256 227.712 110.144 81.856l-28.288 28.288L227.712 256z"]},Zi={prefix:"vs",iconName:"circle-large-filled",icon:[512,512,[],"f000","M256 32a217.6 217.6 0 0 1 59.52 8.096 220.768 220.768 0 0 1 98.656 57.76 220.896 220.896 0 0 1 57.728 98.656C477.312 215.616 480 235.424 480 256s-2.688 40.384 -8.096 59.52a220.8 220.8 0 0 1 -22.528 53.568 229.024 229.024 0 0 1 -80.512 80.288 222.912 222.912 0 0 1 -53.376 22.72A223.488 223.488 0 0 1 256 480a223.488 223.488 0 0 1 -59.52 -7.872 227.136 227.136 0 0 1 -53.568 -22.752 233.6 233.6 0 0 1 -45.28 -35.008 233.44 233.44 0 0 1 -35.008 -45.28 227.136 227.136 0 0 1 -22.72 -53.6A223.52 223.52 0 0 1 32 256c0 -20.576 2.624 -40.384 7.872 -59.52a222.976 222.976 0 0 1 22.752 -53.344 228.992 228.992 0 0 1 80.288 -80.512 220.64 220.64 0 0 1 53.6 -22.528A217.856 217.856 0 0 1 256 32z"]},vC={prefix:"vs",iconName:"circle-large-outline",icon:[512,512,[],"f000","M306.816 70.88A185.856 185.856 0 0 0 256 64c-17.728 0 -34.624 2.336 -50.816 6.88l-0.192 0.064c-16.448 4.512 -31.68 10.944 -45.824 19.232A196.992 196.992 0 0 0 90.24 159.36l-0.064 0.128A190.944 190.944 0 0 0 70.72 205.12 191.552 191.552 0 0 0 64 256c0 17.76 2.24 34.72 6.72 50.912a193.6 193.6 0 0 0 49.536 84.832c11.84 11.68 24.768 21.664 38.912 30.08a195.2 195.2 0 0 0 45.92 19.488A192.64 192.64 0 0 0 256 448c17.76 0 34.72 -2.24 50.912 -6.72 16.48 -4.64 31.68 -11.136 45.632 -19.424l0.128 -0.064a197.12 197.12 0 0 0 69.152 -68.96 187.2 187.2 0 0 0 19.2 -45.824l0.096 -0.192A185.824 185.824 0 0 0 448 256c0 -17.728 -2.304 -34.624 -6.88 -50.816l-0.064 -0.192a184.704 184.704 0 0 0 -19.2 -45.536l-0.064 -0.128a188.8 188.8 0 0 0 -30.144 -38.72l-0.256 -0.256a188.864 188.864 0 0 0 -38.72 -30.144l-0.128 -0.064a184.704 184.704 0 0 0 -45.536 -19.2l-0.192 -0.064zm142.56 298.24a229.024 229.024 0 0 1 -80.512 80.256 222.912 222.912 0 0 1 -53.376 22.72A223.488 223.488 0 0 1 256 480a223.488 223.488 0 0 1 -59.52 -7.872 227.136 227.136 0 0 1 -53.568 -22.752 233.6 233.6 0 0 1 -45.28 -35.008 233.44 233.44 0 0 1 -35.008 -45.28 227.136 227.136 0 0 1 -22.72 -53.6A223.52 223.52 0 0 1 32 256c0 -20.576 2.624 -40.384 7.872 -59.52a222.976 222.976 0 0 1 22.752 -53.344 228.992 228.992 0 0 1 80.288 -80.512 220.64 220.64 0 0 1 53.6 -22.528A217.856 217.856 0 0 1 256 32a217.6 217.6 0 0 1 59.52 8.096 220.768 220.768 0 0 1 98.656 57.76 220.896 220.896 0 0 1 57.728 98.656C477.312 215.616 480 235.424 480 256s-2.688 40.384 -8.096 59.52a220.8 220.8 0 0 1 -22.528 53.568z"]},TC={prefix:"vs",iconName:"circle-slash",icon:[512,512,[],"f000","M256 32a224 224 0 1 1 -224 224 224.256 224.256 0 0 1 224 -224zM64 256c0 45.376 16.128 89.28 45.536 123.84l270.304 -270.304A191.776 191.776 0 0 0 64 256zm384 0c0 -45.376 -16.128 -89.28 -45.536 -123.84L132.16 402.464A191.776 191.776 0 0 0 448 256z"]},zc={prefix:"vs",iconName:"clippy",icon:[512,512,[],"f000","M224 447.744H128v-288h256v64h32v-80l-16 -16H352v-32h-32a64 64 0 0 0 -128 0H158.08v32H112l-16 16v320l16 16H224v-32zm0 -358.4a32 32 0 0 1 25.6 -25.6 32 32 0 0 1 18.56 1.92 30.08 30.08 0 0 1 14.4 11.52 32 32 0 1 1 -56 30.08 32 32 0 0 1 -2.56 -17.92zm226.56 302.72L416 426.944v-171.2h-32v170.88l-34.56 -34.56 -22.72 22.72 62.08 61.76h22.72l61.76 -61.76 -22.72 -22.72zm-189.44 -133.12h22.72l61.76 61.76 -22.72 22.72 -34.56 -34.56v170.88h-32v-171.2l-34.56 34.88 -22.72 -22.72 62.08 -61.76z"]},oo={prefix:"vs",iconName:"close",icon:[512,512,[],"f000","m256 278.624 116.672 116.704 22.656 -22.624L278.624 256l116.704 -116.672 -22.624 -22.656L256 233.376 139.328 116.672l-22.624 22.656L233.376 256l-116.672 116.672 22.624 22.656L256 278.624z"]},EC={prefix:"vs",iconName:"cloud-download",icon:[512,512,[],"f000","M382.624 192h1.6a95.68 95.68 0 0 1 67.712 28.128 96.096 96.096 0 0 1 0 135.744 95.68 95.68 0 0 1 -67.744 28.128v-32a64.064 64.064 0 0 0 0 -128h-29.248l-3.936 -27.424a79.68 79.68 0 0 0 -68.032 -67.904A79.296 79.296 0 0 0 199.392 176l-10.656 24.384 -25.888 -6.048A79.68 79.68 0 0 0 144.736 192c-21.184 0 -41.504 8.416 -56.448 23.424A80.096 80.096 0 0 0 144.736 352h15.936v32h-15.936a111.552 111.552 0 0 1 -84.096 -37.12 112.064 112.064 0 0 1 62.656 -184.96 110.784 110.784 0 0 1 46.976 1.28 111.552 111.552 0 0 1 117.024 -65.92A111.328 111.328 0 0 1 382.624 192zm-168 163.872 42.048 42.048V224h31.808v172.8l40.896 -40.928 22.624 22.624 -68.672 68.704h-22.656L192 378.528l22.624 -22.656z"]},yC={prefix:"vs",iconName:"code",icon:[512,512,[],"f000","M150.656 178.496 65.952 263.168l84.704 84.672 -22.656 22.656 -96 -96V251.84l96 -96 22.656 22.656zm224 -22.656L352 178.496l84.704 84.672L352 347.84l22.656 22.656 96 -96V251.84l-96 -96zM157.056 416l28.608 14.336 160 -320L317.056 96l-160 320z"]},IC={prefix:"vs",iconName:"copy",icon:[512,512,[],"f000","m128 128 32 -32h173.248L448 210.752V448l-32 32H160l-32 -32V128zm288 96 -96 -96H160v320h256V224zM96 32 64 64v320l32 32V64h205.248l-32 -32H96z"]},za={prefix:"vs",iconName:"device-camera",icon:[512,512,[],"f000","M342.624 96H464l16 16v288l-16 16h-416l-16 -16v-288l16 -16h121.376l27.296 -27.328L208 64h96l11.328 4.672 27.296 27.328zM64 384h384V128h-112l-11.328 -4.672L297.376 96H214.624l-27.296 27.328L176 128H64v256zm48 -224a16 16 0 1 0 0 32 16 16 0 0 0 0 -32zM256 192a64 64 0 1 1 0 128 64 64 0 0 1 0 -128zm0 -32a96 96 0 1 0 0 192 96 96 0 0 0 0 -192z"]},nr={prefix:"vs",iconName:"edit",icon:[512,512,[],"f000","M423.36 32h-46.72L112.64 296l-5.12 7.04L32 434.88 77.12 480l131.84 -75.52 7.04 -5.12L480 135.36V88.64L423.36 32zM77.12 434.88l48.32 -96 46.4 46.4 -94.72 49.6zm122.56 -65.92L143.04 312.32l256 -256 56.64 56.64 -256 256z"]},Wc={prefix:"vs",iconName:"file-code",icon:[512,512,[],"f000","m338.24 36.48 104.96 105.6 4.8 11.52v310.4l-16 16h-352l-16 -16v-416l16 -16h247.04l11.2 4.48zM320 160h96l-96 -96v96zM96 64v384h320V192H304L288 176V64H96zm65.984 241.056 58.144 -58.496L197.44 224 128 293.728v22.624l69.472 69.568 22.624 -22.624 -58.112 -58.24zM281.6 246.848l22.4 -22.688 70.048 69.6v22.688L304 385.984l-22.56 -22.688 58.592 -58.24L281.6 246.848z"]},RC={prefix:"vs",iconName:"file-zip",icon:[512,512,[],"f000","M80 32h352l16 16v160l-4.8 11.2 -27.2 27.52v217.28l-16 16h-320l-16 -16v-416l16 -16zM192 64H160v64h32V64zm0 384h128V245.76l-27.2 -27.2L288 207.04V64H224v80l-16 16H192v32H160V160h-16L128 144V64H96v384h64v-32h32v32zm0 -64v32h32v-32H192zm0 -32v32H160v-32h32zm0 -32h32v32H192v-32zm0 -32v32H160V288h32zm0 -32h32v32H192V256zm0 -32v32H160V224h32zm0 0h32V192H192v32zm196.8 4.8 27.2 -27.52V64h-96v136.64l27.2 27.2 4.8 11.2V448h32V240l4.8 -11.2z"]},DC={prefix:"vs",iconName:"files",icon:[512,512,[],"f000","M373.333 0h-192L149.333 32V128H53.333L21.333 160v321.493L53.333 512h257.493L341.333 481.493V384h100.267l27.733 -30.507V96L373.333 0zm0 45.227 50.773 50.773H373.333V45.227zm-64 434.773h-256v-320H149.333v193.493L181.333 384h128v96zm128 -128h-256v-320H341.333V128h96v224z"]},hl={prefix:"vs",iconName:"filter",icon:[512,512,[],"f000","M480 64v53.44l-160 152.288V448H192V269.728l-160 -152.32V64h448zM224 256v160h64V256l160 -152.32V96H64v7.68L224 256z"]},MC={prefix:"vs",iconName:"folder-opened",icon:[512,512,[],"f000","M48 448h352l15.36 -11.84 84.16 -224 -15.36 -20.16H448V112l-16 -16H246.72l-27.52 -27.2L208 64h-160l-16 16v352l16 16zM64 96h137.28l27.52 27.2 11.2 4.8H416v64H272l-11.2 4.8 -27.52 27.2H112l-15.04 10.88 -32 98.56L64 96zm324.16 320H70.08l53.44 -160H240l11.2 -4.8 27.52 -27.2h185.28l-75.84 192z"]},NC={prefix:"vs",iconName:"folder",icon:[512,512,[],"f000","M464 96H246.72l-27.2 -27.2L208.32 64h-160l-16 16v352l16 16h416l16 -16v-320L464 96zm-16.32 271.68V416h-384V224h143.68l11.2 -4.8 27.52 -27.52H448v48l-0.32 128zm0 -207.68h-208l-11.2 4.8 -27.52 27.52H64v-96h137.28l27.2 27.2 11.52 4.8H448l-0.32 31.68z"]},sr={prefix:"vs",iconName:"gear",icon:[512,512,[],"f000","M291.2 140.8 275.2 64H236.8l-16 76.8 -22.4 9.6 -64 -41.6 -28.8 25.6 41.6 64 -6.4 22.4 -76.8 16v38.4l76.8 16 9.6 25.6 -41.6 64 25.6 25.6 64 -41.6 25.6 9.6 12.8 73.6h38.4l16 -76.8 25.6 -9.6 64 41.6 25.6 -25.6 -41.6 -64 9.6 -25.6 73.6 -12.8V236.8l-76.8 -16 -9.6 -25.6 41.6 -64 -25.6 -25.6 -64 41.6 -22.4 -6.4zM300.8 32l16 76.8L384 67.2l64 64 -44.8 67.2 76.8 12.8v89.6l-76.8 16L448 384l-64 64 -67.2 -44.8 -16 76.8H211.2l-16 -76.8L128 444.8l-64 -64 44.8 -67.2L32 300.8V211.2l76.8 -16L67.2 128l64 -64 67.2 44.8 12.8 -76.8h89.6zm19.2 224c0 35.2 -28.8 64 -64 64s-64 -28.8 -64 -64 28.8 -64 64 -64 64 28.8 64 64zM256 288c19.2 0 32 -12.8 32 -32s-12.8 -32 -32 -32 -32 12.8 -32 32 12.8 32 32 32z"]},Fu={prefix:"vs",iconName:"graph",icon:[512,512,[],"f000","M48 448H480v-32H64V0H32v432l16 16zM96 368v-256l16 -16h64l16 16v256l-16 16h-64l-16 -16zm64 -16V128H128v224h32zm192 -304v320l16 16h64l16 -16v-320l-16 -16h-64l-16 16zm64 16v288h-32V64h32zm-192 304v-192l16 -16h64l16 16v192l-16 16h-64l-16 -16zm64 -16V192H256v160h32z"]},ir={prefix:"vs",iconName:"gripper",icon:[512,512,[],"f000","M160 96h64v64H160zm0 128h64v64H160zm0 128h64v64H160zm128 -256h64v64H288zm0 128h64v64H288zm0 128h64v64H288z"]},FC={prefix:"vs",iconName:"home",icon:[512,512,[],"f000","m267.52 43.84 203.52 185.6 -22.72 22.72L416 222.848v208.832l-16 16h-96l-16 -16v-112H224v112l-16 16h-96l-16 -16V223.104L64 252.16l-22.72 -22.72 203.2 -185.6h23.04zM128 194.016v221.664h64v-112l16 -16h96l16 16v112h64V193.824L256 77.76 128 194.016z"]},xC={prefix:"vs",iconName:"info",icon:[512,512,[],"f000","M274.176 32.992A217.6 217.6 0 0 1 408.32 97.6a225.92 225.92 0 0 1 14.72 300.48 219.2 219.2 0 0 1 -274.56 55.68 224 224 0 0 1 -99.84 -112 227.84 227.84 0 0 1 -7.36 -150.72 224 224 0 0 1 88.64 -121.28 217.6 217.6 0 0 1 144.256 -36.768zM289.28 444.16a188.48 188.48 0 0 0 109.12 -66.24 194.24 194.24 0 0 0 -12.8 -257.92 186.24 186.24 0 0 0 -237.76 -23.68 193.92 193.92 0 0 0 16 329.28 185.92 185.92 0 0 0 125.44 18.56zM236 192h40V160h-40v32zm40 32v128h-40V224h40z"]},_C={prefix:"vs",iconName:"json",icon:[512,512,[],"f000","M192 95.488V64h-2.88c-10.016 0 -19.712 1.984 -29.088 5.92a74.56 74.56 0 0 0 -24.8 16.96 71.36 71.36 0 0 0 -15.776 24.096v0.032a113.344 113.344 0 0 0 -6.336 26.56v0.064a194.56 194.56 0 0 0 -0.768 27.616c0.384 9.28 0.576 18.56 0.576 27.808 0 6.496 -1.28 12.576 -3.744 18.304v0.032a48.128 48.128 0 0 1 -24.48 25.184 44.032 44.032 0 0 1 -17.856 3.68H64v31.488h2.88c6.24 0 12.16 1.28 17.792 3.872l0.032 0.032c5.696 2.496 10.528 5.888 14.56 10.176l0.064 0.064c4.16 4.16 7.456 9.12 9.824 14.88l0.032 0.064c2.496 5.76 3.744 11.776 3.744 18.112 0 9.28 -0.192 18.56 -0.576 27.808 -0.384 9.472 -0.128 18.72 0.768 27.84v0.032c1.056 9.056 3.168 17.856 6.304 26.368v0.032c3.392 8.736 8.672 16.768 15.808 24.096 7.136 7.36 15.424 13.024 24.8 16.96 9.376 3.936 19.072 5.92 29.12 5.92H192v-31.488h-2.88c-6.4 0 -12.384 -1.216 -18.016 -3.68a51.616 51.616 0 0 1 -14.624 -10.24 53.088 53.088 0 0 1 -9.888 -14.944c-2.368 -5.76 -3.52 -11.84 -3.52 -18.336 0 -7.296 0.096 -14.496 0.352 -21.504 0.256 -7.296 0.256 -14.4 0 -21.28a148.448 148.448 0 0 0 -1.76 -20.48 85.824 85.824 0 0 0 -5.376 -19.488A73.088 73.088 0 0 0 112.704 256a73.088 73.088 0 0 0 23.616 -30.56c2.56 -6.144 4.32 -12.576 5.376 -19.264 1.056 -6.72 1.632 -13.536 1.76 -20.48 0.256 -7.04 0.256 -14.144 0 -21.312 -0.256 -7.168 -0.384 -14.4 -0.384 -21.696a47.04 47.04 0 0 1 28.064 -43.328 42.56 42.56 0 0 1 18.016 -3.872H192zm128 321.024V448h2.88c10.016 0 19.712 -1.984 29.088 -5.92 9.376 -3.936 17.664 -9.6 24.8 -16.96 7.136 -7.36 12.416 -15.36 15.776 -24.096v-0.032c3.2 -8.512 5.28 -17.376 6.336 -26.56v-0.064c0.896 -8.96 1.152 -18.144 0.768 -27.616 -0.384 -9.28 -0.576 -18.56 -0.576 -27.808 0 -6.496 1.28 -12.576 3.744 -18.304v-0.032a48.064 48.064 0 0 1 24.48 -25.184 44.16 44.16 0 0 1 17.856 -3.68H448v-31.488h-2.88c-6.272 0 -12.192 -1.28 -17.824 -3.872l-0.032 -0.032a44.032 44.032 0 0 1 -14.56 -10.176l-0.064 -0.064a45.28 45.28 0 0 1 -9.824 -14.88v-0.064a44.96 44.96 0 0 1 -3.776 -18.112c0 -9.28 0.192 -18.56 0.576 -27.808a197.568 197.568 0 0 0 -0.768 -27.84v-0.032a113.184 113.184 0 0 0 -6.304 -26.368v-0.032a71.36 71.36 0 0 0 -15.808 -24.096 74.592 74.592 0 0 0 -24.8 -16.96 74.4 74.4 0 0 0 -29.12 -5.92H320v31.488h2.88c6.4 0 12.384 1.216 17.984 3.68 5.568 2.624 10.432 6.016 14.624 10.24 4.064 4.288 7.36 9.28 9.888 14.944 2.368 5.76 3.52 11.84 3.52 18.336 0 7.296 -0.096 14.464 -0.352 21.504 -0.256 7.296 -0.256 14.4 0 21.28 0.128 7.104 0.704 13.92 1.76 20.48 1.056 6.848 2.848 13.312 5.376 19.488a73.12 73.12 0 0 0 23.616 30.56 73.12 73.12 0 0 0 -23.616 30.56 86.048 86.048 0 0 0 -5.376 19.264c-1.056 6.72 -1.632 13.536 -1.76 20.48a292.8 292.8 0 0 0 0 21.312c0.256 7.168 0.384 14.4 0.384 21.696a47.072 47.072 0 0 1 -28.064 43.328 42.56 42.56 0 0 1 -18.016 3.872H320z"]},xu={prefix:"vs",iconName:"kebab-vertical",icon:[512,512,[],"f000","M238.208 442.624a32 32 0 1 0 35.552 -53.216 32 32 0 0 0 -35.52 53.184zM256 288a32 32 0 1 1 0 -64 32 32 0 0 1 0 64zm0 -160a32 32 0 1 1 0 -64 32 32 0 0 1 0 64z"]},kC={prefix:"vs",iconName:"law",icon:[512,512,[],"f000","M468.16 224 416 96h32V64H288V32H256v32H96v32h32L76.16 224H64v32h4.8c4.992 15.936 15.136 29.76 28.8 39.36a79.04 79.04 0 0 0 92.8 0A78.08 78.08 0 0 0 219.52 256H224V224h-14.4L156.16 96H256v256H192l-12.48 5.76 -64 80.32 12.48 25.92h288l12.48 -25.92 -64 -80.32L352 352H288V96h100.16l-53.44 128H320v32h4.8a79.36 79.36 0 0 0 150.72 0H480V224h-11.84zM167.04 272.32a48.64 48.64 0 0 1 -23.04 6.08 46.4 46.4 0 0 1 -22.72 -6.08A47.04 47.04 0 0 1 104 256h80a48.64 48.64 0 0 1 -16.96 16.32zM175.04 224h-64l32 -76.8 32 76.8zm169.28 160L384 432H160L199.68 384h144.64zm56.96 -236.16 32 76.8h-64l32 -76.8zm21.76 125.12a45.12 45.12 0 0 1 -23.04 6.08 43.2 43.2 0 0 1 -22.72 -6.08 49.6 49.6 0 0 1 -17.28 -16.96h80a43.84 43.84 0 0 1 -16.96 16.96z"]},OC={prefix:"vs",iconName:"layers",icon:[512,512,[],"f000","m244.064 34.784 17.856 -0.128 194.912 129.184 -0.096 26.752L261.824 317.44l-17.632 -0.128 -189.12 -126.816 -0.096 -26.496 189.12 -129.184Zm9.152 32.512 -160.672 109.76 160.672 107.776 165.632 -107.776 -165.632 -109.76ZM57.376 272l186.816 125.28 17.6 0.128L454.592 272h-58.656l-142.688 92.8 -138.4 -92.8H57.376Zm186.816 205.28L57.376 352h57.44l138.4 92.8 142.688 -92.8h58.656l-192.736 125.44 -17.632 -0.16Z"]},LC={prefix:"vs",iconName:"link-external",icon:[512,512,[],"f000","M48 32H192v32H64v384h384v-128h32v144l-16 16h-416l-16 -16v-416l16 -16zm432 16V256h-32V86.624L231.776 302.88l-22.624 -22.656L425.376 64H256V32h208l16 16z"]},Ed={prefix:"vs",iconName:"link",icon:[512,512,[],"f000","M140.8 96h98.72a108.8 108.8 0 0 1 108.8 108.8v6.56A108.8 108.8 0 0 1 239.52 320H224V288h15.52A76.8 76.8 0 0 0 316.16 211.52V204.8A76.8 76.8 0 0 0 239.68 128H140.8A76.8 76.8 0 0 0 64 204.8v6.56A76.608 76.608 0 0 0 128 286.72v32a108.8 108.8 0 0 1 -96 -107.2V204.8A108.96 108.96 0 0 1 140.8 96zM384 225.28v-32a108.8 108.8 0 0 1 96 107.52v6.56A108.96 108.96 0 0 1 371.36 416h-98.88A108.8 108.8 0 0 1 163.84 307.52V300.8A108.8 108.8 0 0 1 272.48 192H288v32h-15.52A76.8 76.8 0 0 0 195.84 300.8v6.56A76.8 76.8 0 0 0 272.48 384h98.88A76.8 76.8 0 0 0 448 307.52V300.8a76.608 76.608 0 0 0 -64 -75.52z"]},AC={prefix:"vs",iconName:"list-ordered",icon:[512,512,[],"f000","M73.184 74.432 86.144 64h21.664v96h-22.656V89.344l-11.968 8.992v-23.904zM160 96h320v32H160V96zm0 128h320v32H160V224zm320 128H160v32h320v-32zM119.744 244.032l0.928 -1.248 2.08 -2.88a26.88 26.88 0 0 0 4.992 -16.224c0 -3.84 -0.64 -7.68 -1.824 -11.328a27.136 27.136 0 0 0 -15.744 -16.928 35.936 35.936 0 0 0 -14.464 -2.624 35.008 35.008 0 0 0 -14.656 2.784 27.744 27.744 0 0 0 -15.328 16.704A33.216 33.216 0 0 0 64 222.624v1.6h25.92v-1.6a9.6 9.6 0 0 1 1.472 -5.024 5.568 5.568 0 0 1 1.824 -1.728 6.08 6.08 0 0 1 5.504 0 6.016 6.016 0 0 1 1.792 1.92 7.68 7.68 0 0 1 0.992 2.592 14.24 14.24 0 0 1 -1.152 9.28 41.888 41.888 0 0 1 -3.84 5.824l-32 36.416 -0.384 0.416v17.28h63.616v-22.4h-28.8l20.8 -23.168zm-1.184 122.144c1.472 1.024 2.752 2.24 3.84 3.648a26.912 26.912 0 0 1 5.344 17.6c0 3.424 -0.544 6.816 -1.6 10.048a25.344 25.344 0 0 1 -15.584 16 41.216 41.216 0 0 1 -15.36 2.528c-3.68 0 -7.36 -0.512 -10.912 -1.568a30.08 30.08 0 0 1 -8.256 -3.936 24.032 24.032 0 0 1 -5.824 -5.664 34.016 34.016 0 0 1 -3.712 -6.4A33.216 33.216 0 0 1 64 386.496v-1.568h26.048v1.568c0 0.864 0.096 1.76 0.288 2.624a6.624 6.624 0 0 0 0.96 2.368 4.48 4.48 0 0 0 1.696 1.664 6.4 6.4 0 0 0 5.024 0.256 5.088 5.088 0 0 0 1.792 -1.248 7.04 7.04 0 0 0 1.344 -2.4 13.344 13.344 0 0 0 0.544 -4.032 15.456 15.456 0 0 0 -0.704 -5.216 6.4 6.4 0 0 0 -1.632 -2.56 4.416 4.416 0 0 0 -1.92 -0.928 17.184 17.184 0 0 0 -2.464 -0.224h-5.152v-20.64h5.376a7.712 7.712 0 0 0 2.208 -0.352 5.248 5.248 0 0 0 2.08 -1.088 5.6 5.6 0 0 0 1.536 -2.144 9.152 9.152 0 0 0 0.672 -3.872 8.96 8.96 0 0 0 -0.512 -3.2 5.312 5.312 0 0 0 -3.104 -3.168 6.4 6.4 0 0 0 -4.992 0.224 5.248 5.248 0 0 0 -1.76 1.696 11.008 11.008 0 0 0 -1.28 4.992v1.568H64v-1.568a31.584 31.584 0 0 1 5.76 -17.408 25.6 25.6 0 0 1 5.728 -5.952 27.84 27.84 0 0 1 8.384 -4.256c3.648 -1.152 7.488 -1.696 11.328 -1.632 3.712 -0.032 7.392 0.32 11.008 1.152 2.944 0.672 5.76 1.76 8.416 3.2a24.224 24.224 0 0 1 10.24 10.176 23.36 23.36 0 0 1 2.88 11.104 25.92 25.92 0 0 1 -5.344 16.896 17.984 17.984 0 0 1 -3.84 3.648z"]},_u={prefix:"vs",iconName:"loading",icon:[512,512,[],"f000","M445.344 224A192.064 192.064 0 0 0 66.656 224H34.272a224.064 224.064 0 0 1 443.456 0h-32.384z"]},PC={prefix:"vs",iconName:"lock",icon:[512,512,[],"f000","M416 224h-32V160a128 128 0 1 0 -256 0v64H96L64 256v192l32 32h320l32 -32V256l-32 -32zM160 160a96 96 0 1 1 192 0v64H160V160zm256 288H96V256h320v192z"]},HC={prefix:"vs",iconName:"markdown",icon:[512,512,[],"f000","M203.04 160h67.2v209.056H223.776l1.76 -169.92 -56.768 169.92H130.304l-57.76 -169.92c1.28 20.608 1.92 169.92 1.92 169.92H32V160h68.992s48.896 143.776 50.464 153.824L203.04 160zm214.72 115.744v-112H355.52v112H293.312l93.344 93.312L480 275.744h-62.24z"]},VC={prefix:"vs",iconName:"menu",icon:[512,512,[],"f000","M512 160H0V128h512v32zm0 256H0v-32h512v32zm0 -128.256H0V256h512v31.744z"]},ku={prefix:"vs",iconName:"new-file",icon:[512,512,[],"f000","m304 35.2 108.8 112 3.2 12.8v64h-32V192H256V64H96v352h128v32H80l-16 -16v-384l16 -16h214.4l9.6 3.2zM288 64v96h92.8L288 64zm128 448h-32v-96H288v-32h96V288h32v96h96v32h-96v96z"]},UC={prefix:"vs",iconName:"new-folder",icon:[512,512,[],"f000","M464 64H246.72l-27.2 -27.2L208.32 32h-160l-16 16v352l16 16H224v-32H63.68V192h143.68l11.2 -4.8 27.52 -27.52H448v48l-0.032 16.32h32.352V80L464 64zm-16.32 64h-208l-11.2 4.8 -27.52 27.52H64v-96h137.28l27.2 27.2 11.52 4.8H448l-0.32 31.68zM416 512h-32v-96H288v-32h96V288h32v96h96v32h-96v96z"]},BC={prefix:"vs",iconName:"paintcan",icon:[512,512,[],"f000","m465.28 377.952 -36.48 -99.84v-1.92l-157.12 -157.12v-39.68a53.12 53.12 0 0 0 -3.52 -18.56 47.36 47.36 0 0 0 -26.56 -25.6 45.44 45.44 0 0 0 -18.56 -3.2 47.04 47.04 0 0 0 -47.36 47.36v104.32l-97.92 96a48.64 48.64 0 0 0 0 67.84l116.16 116.16c4.48 4.512 9.824 8.096 15.68 10.56a48.96 48.96 0 0 0 36.48 0 48.32 48.32 0 0 0 15.68 -10.56l157.76 -157.44 -21.12 70.4a38.08 38.08 0 0 0 0 14.72c1.056 4.864 3.136 9.472 6.08 13.44 3.136 3.872 6.912 7.136 11.2 9.6 4.48 2.24 9.408 3.52 14.4 3.84a32 32 0 0 0 15.36 -2.88 36.48 36.48 0 0 0 12.48 -9.28 31.36 31.36 0 0 0 7.04 -14.08c1.024 -4.64 1.12 -9.408 0.32 -14.08zm-256 -298.56a14.72 14.72 0 0 1 0 -6.4 16.64 16.64 0 0 1 3.84 -5.44 20.48 20.48 0 0 1 5.76 -3.2 16 16 0 0 1 6.72 0 16 16 0 0 1 10.24 4.8 16 16 0 0 1 3.84 10.56v40.32l-32 32 1.6 -72.64zm32 363.2a11.52 11.52 0 0 1 -5.12 3.52 15.04 15.04 0 0 1 -12.16 0 11.552 11.552 0 0 1 -5.12 -3.52l-116.16 -115.84a16 16 0 0 1 0 -22.72l139.2 -139.2v91.2a23.68 23.68 0 0 0 -7.68 17.6 24 24 0 1 0 37.44 -17.6v-90.56l123.2 123.84 -153.6 153.28z"]},$C={prefix:"vs",iconName:"pass-filled",icon:[512,512,[],"f000","M256 480A224 224 0 1 0 256 32a224 224 0 0 0 0 448zm-32.64 -132.16h-22.72L128 275.2l22.72 -22.72 61.44 61.44 134.4 -134.72 22.72 22.72 -145.92 145.92z"]},yd={prefix:"vs",iconName:"pass",icon:[512,512,[],"f000","M200.64 347.84h22.72l145.92 -145.92 -22.72 -22.72 -134.4 134.72 -61.44 -61.44L128 275.2l72.64 72.64zM275.2 32c51.2 3.2 99.2 28.8 134.4 64 41.6 44.8 64 99.2 64 163.2 0 51.2 -19.2 99.2 -51.2 140.8 -32 38.4 -76.8 67.2 -128 76.8 -51.2 9.6 -102.4 3.2 -147.2 -22.4 -44.8 -25.6 -80 -64 -99.2 -112C28.8 294.4 25.6 240 41.6 192c16 -51.2 44.8 -92.8 89.6 -121.6C172.8 41.6 224 28.8 275.2 32zm16 412.8c41.6 -9.6 80 -32 108.8 -67.2 25.6 -35.2 41.6 -76.8 38.4 -121.6 0 -51.2 -19.2 -102.4 -54.4 -137.6 -32 -32 -70.4 -51.2 -115.2 -54.4 -41.6 -3.2 -86.4 6.4 -121.6 32 -35.2 25.6 -60.8 60.8 -73.6 105.6 -12.8 41.6 -12.8 86.4 6.4 128 19.2 41.6 48 73.6 86.4 96 38.4 22.4 83.2 28.8 124.8 19.2z"]},ul={prefix:"vs",iconName:"play",icon:[512,512,[],"f000","M120.96 64 96 77.12v384l24.96 13.44 288 -192V256l-288 -192zM128 431.36V107.2l243.2 162.24L128 431.36z"]},Wa={prefix:"vs",iconName:"preview",icon:[512,512,[],"f000","M64 64h384l32 32v320l-32 32H64l-32 -32V96l32 -32zm0 352h384V96H64v320zm352 -288H96v96h320V128zm-32 64H128V160h256v32zm-96 192h128V256H288v128zm32 -96h64v64h-64V288zM224 256H96v32h128V256zm-128 96h128v32H96v-32z"]},zC={prefix:"vs",iconName:"record-keys",icon:[512,512,[],"f000","M448 96H96a32 32 0 0 0 -32 32v224a32 32 0 0 0 32 32h352a32 32 0 0 0 32 -32V128a32 32 0 0 0 -32 -32zm0 256H96V128h352v224zm-96 -192h-32v32h32V160zm-32 64H288v32h32V224zm64 -64h32v32h-32V160zm32 128h-32v32h32V288zM192 288h160v32H192V288zm224 -64h-64v32h64V224zM256 160h32v32H256V160zm0 64H224v32h32V224zM128 288h32v32H128V288zm0 -128h32v32H128V160zm96 0H192v32h32V160zM128 224h64v32H128V224z"]},hi={prefix:"vs",iconName:"refresh",icon:[512,512,[],"f000","M149.792 96H64V64h112l16 16V192H160V128a160 160 0 1 0 144.96 -24.352l9.664 -30.528A192 192 0 1 1 149.792 96z"]},is={prefix:"vs",iconName:"remove",icon:[512,512,[],"f000","M480 256H32V224h448v32z"]},WC={prefix:"vs",iconName:"reply",icon:[512,512,[],"f000","m201.792 68.672 -128.64 128.64v22.656l128.64 128.64 22.656 -22.624L121.824 223.36H182.08c90.016 0 147.36 19.36 182.56 55.328 35.264 36 51.68 92.064 51.68 173.472v11.2h32v-11.2c0 -84.672 -16.864 -151.04 -60.8 -195.872C343.52 211.36 275.744 191.36 182.08 191.36H124.384l100.064 -100.032 -22.656 -22.656z"]},GC={prefix:"vs",iconName:"ruby",icon:[512,512,[],"f000","m32 230.08 212.48 212.48h23.04L480 230.08v-23.04l-106.24 -106.24 -11.52 -4.8H149.76l-11.52 4.8L32 207.04v23.04zm224 177.92L66.56 218.56 156.48 128h199.04l89.92 90.56L256 408zm0 -247.36h86.08l57.92 57.92 -144 140.8V160.64z"]},Ou={prefix:"vs",iconName:"save",icon:[512,512,[],"f000","m427.296 36.672 48 48L480 96v368l-16 16h-416l-16 -16v-416l16 -16H416l11.296 4.672zM64 64v384h384V102.656L409.376 64H352v128H128V64H64zm192 0v96h64V64H256z"]},Lu={prefix:"vs",iconName:"search",icon:[512,512,[],"f000","M325.333 0a176 176 0 0 0 -131.84 292.693L21.333 488.107l23.893 21.333 171.733 -194.56A176.021 176.021 0 1 0 325.333 0.213V0zm0 320a144 144 0 1 1 0 -288 144 144 0 0 1 0 288z"]},KC={prefix:"vs",iconName:"split-horizontal",icon:[512,512,[],"f000","M448 32H96L64 64v352l32 32h352l32 -32V64l-32 -32zM256 416H96V64h160v352zm192 0H288V64h160v352z"]},qC={prefix:"vs",iconName:"symbol-operator",icon:[512,512,[],"f000","M91.936 35.2c10.72 4.352 19.264 12.736 23.84 23.36 2.304 5.44 3.488 11.264 3.424 17.184a42.88 42.88 0 0 1 -19.52 36.32 43.488 43.488 0 0 1 -24.096 7.136A43.36 43.36 0 0 1 32 75.584a43.36 43.36 0 0 1 26.56 -40.192A43.84 43.84 0 0 1 91.936 35.2zm-9.536 56.48a17.632 17.632 0 0 0 10.624 -16 17.536 17.536 0 1 0 -10.624 16zM205.76 35.488 35.52 205.76l21.952 21.984 170.24 -170.24 -21.952 -21.984zM368 288h32v80H480v32h-80V480h-32v-80H288v-32h80V288zm-183.424 16.8 22.624 22.624L150.624 384l56.576 56.576 -22.624 22.624L128 406.624l-56.576 56.576 -22.624 -22.624L105.376 384l-56.576 -56.576 22.624 -22.624L128 361.376l56.576 -56.576zm43.2 -134.24a43.296 43.296 0 0 0 -40.192 -26.56 43.36 43.36 0 0 0 -40.192 26.56 43.584 43.584 0 0 0 40.224 60.64A43.456 43.456 0 0 0 227.776 170.56zm-24.096 23.84a17.696 17.696 0 0 1 -9.248 9.28 17.504 17.504 0 0 1 -19.168 -3.744 16.928 16.928 0 0 1 -3.744 -5.536 17.408 17.408 0 0 1 22.912 -22.88 18.08 18.08 0 0 1 5.536 3.712 17.568 17.568 0 0 1 3.712 19.168zM448 96h-128v32h128V96z"]},YC={prefix:"vs",iconName:"symbol-structure",icon:[512,512,[],"f000","M64 64 32 96v96l32 32h384l32 -32V96l-32 -32H64zm0 32h384v96H64V96zm-32 224 32 -32h96l32 32v96l-32 32H64l-32 -32v-96zm64 0H64v96h96v-96H96zm224 0 32 -32h96l32 32v96l-32 32h-96l-32 -32v-96zm64 0h-32v96h96v-96h-64z"]},Gc={prefix:"vs",iconName:"terminal",icon:[512,512,[],"f000","M64 32 32 64v384L64 480h384l32 -32V64L448 32H64zM64 448V64h384v384H64zm120.661 -85.547 22.144 22.635 112.213 -111.851v-19.456l-112.213 -112.213 -22.08 22.613 97.92 100.309 -97.984 97.963z"]},XC={prefix:"vs",iconName:"tools",icon:[512,512,[],"f000","m472.736 111.52 -24.96 -5.888 -67.456 67.072 -38.208 -38.912 65.792 -69.024 -5.76 -25.344a141.44 141.44 0 0 0 -43.104 -7.296 116.48 116.48 0 0 0 -46.624 8.96 122.368 122.368 0 0 0 -37.952 26.88 119.552 119.552 0 0 0 -28 40.48 126.016 126.016 0 0 0 0 94.912 10730.912 10730.912 0 0 0 -197.536 199.488c-6.72 8.8 -9.92 19.776 -9.088 30.816a44.896 44.896 0 0 0 14.848 30.944c3.968 4.32 8.704 7.904 13.984 10.496 5.44 2.4 11.296 3.776 17.216 4.064 10.112 -0.192 19.808 -4.032 27.328 -10.784 49.536 -46.624 144.448 -142.4 198.368 -198.528 14.624 6.208 30.336 9.408 46.208 9.376a119.552 119.552 0 0 0 85.664 -36.256 124.32 124.32 0 0 0 35.552 -87.36 134.752 134.752 0 0 0 -6.272 -44.096zM93.856 445.696a9.92 9.92 0 0 1 -4.32 2.24 13.984 13.984 0 0 1 -4.768 0 11.072 11.072 0 0 1 -4.608 -1.824 10.752 10.752 0 0 1 -3.648 -3.52c-4.48 -4.576 -8.672 -13.28 -4.48 -18.176 43.84 -46.624 134.112 -137.76 190.56 -193.472 3.2 4.224 6.72 8.256 10.496 12.032 3.776 3.936 7.84 7.584 12.16 10.912 -54.592 56 -143.616 146.048 -191.36 191.808zm355.776 -290.08c0.064 24.48 -9.472 48 -26.624 65.536a91.552 91.552 0 0 1 -128.224 0 95.744 95.744 0 0 1 -20.32 -100.384A87.936 87.936 0 0 1 324.48 69.76a88.32 88.32 0 0 1 34.304 -6.848h8.128L308.768 122.848v22.272l60.64 60.352h21.12l59.104 -58.112v8.256zM103.68 214.016h48.992l22.56 22.944 21.696 -21.568 -21.28 -21.696V192.32l1.824 -52.768 -7.04 -13.984 -91.52 -60.224 -18.912 2.112 -26.592 27.168 -2.112 19.168 58.816 93.376 13.568 6.88zm-30.24 -116.224L147.488 146.56 146.24 182.496H111.808L64.064 106.912l9.376 -9.12zm227.36 222.72 21.568 -21.536 99.392 101.92a47.328 47.328 0 0 1 0 65.248 44.928 44.928 0 0 1 -49.568 10.08 41.92 41.92 0 0 1 -13.984 -10.08l-100.544 -102.496 21.728 -21.696 100.224 102.208a12.864 12.864 0 0 0 4.896 3.36 15.264 15.264 0 0 0 11.488 0 12.896 12.896 0 0 0 4.896 -3.36 13.952 13.952 0 0 0 3.2 -4.896 16.8 16.8 0 0 0 1.152 -5.888 17.504 17.504 0 0 0 -1.12 -5.888 13.952 13.952 0 0 0 -3.2 -4.896L300.8 320.512z"]},hn={prefix:"vs",iconName:"trash",icon:[512,512,[],"f000","M320 96h96v32h-32v288l-32 32H128l-32 -32V128H64V96h96V64a32 32 0 0 1 32 -32h96a32 32 0 0 1 32 32v32zM288 64H192v32h96V64zM128 416h224V128H128v288zm64 -256H160v224h32V160zm32 0h32v224H224V160zm64 0h32v224H288V160z"]},Yn={prefix:"vs",iconName:"triangle-down",icon:[512,512,[],"f000","M64 177.92 77.216 160h358.208l12.576 17.28L267.936 352h-26.464L64 177.92z"]},Au={prefix:"vs",iconName:"triangle-right",icon:[512,512,[],"f000","M177.92 448 160 434.784V76.576L177.28 64 352 244.064v26.464L177.92 448z"]},fs={prefix:"vs",iconName:"warning",icon:[512,512,[],"f000","M241.92 32h28.16l209.28 392.32 -14.08 23.68H46.08L32 424.32 241.92 32zM256 72.96 72.96 416H438.4L256 72.96zM276 384v-32h-40v32h40zm-40 -64V192h40v128h-40z"]},jC={prefix:"vs",iconName:"watch",icon:[512,512,[],"f000","M240 288h64V256H256V176H224v96l16 16zm-64 -170.592A159.936 159.936 0 0 0 96 256a159.936 159.936 0 0 0 80 138.592V464l16 16h128l16 -16v-69.408A159.936 159.936 0 0 0 416 256a159.936 159.936 0 0 0 -80 -138.592V48L320 32H192l-16 16v69.408zM384 256a128 128 0 1 1 -256 0 128 128 0 0 1 256 0z"]},ZC={prefix:"dh",iconName:"arrow-to-bottom",icon:[512,512,[],"f000","m99.2 224 160 160h22.4l160 -160 -22.4 -22.4L288 332.8V64H256v268.8L124.8 201.6l-25.6 22.4zM96 416h352v32H96z"]},QC={prefix:"dh",iconName:"arrow-to-top",icon:[512,512,[],"f000","m444.8 288 -160 -160h-22.4l-160 160 22.4 22.4L256 179.2V448h32V179.2l131.2 131.2 25.6 -22.4zm3.2 -192H96V64h352v32z"]},JC={prefix:"dh",iconName:"check-square",icon:[512,512,[],"f000","M425.6 64H86.4l-22.4 22.4v342.4l22.4 19.2h342.4l22.4 -22.4V86.4l-25.6 -22.4zm-188.8 284.8h-22.4L144 278.4l22.4 -22.4 60.8 60.8 134.4 -134.4 22.4 22.4 -147.2 144z"]},eb={prefix:"dh",iconName:"exclamation",icon:[512,512,[],"f000","M275.2 384v-32H236.8v32h38.4zm-38.4 -64V128h38.4v192H236.8z"]},Pu={prefix:"dh",iconName:"eye-slash",icon:[512,512,[],"f000","M480 256c0 -32 -99.2 -160 -224 -160 -32 0 -64 9.6 -92.8 22.4L70.4 25.6 25.6 70.4 435.2 480l44.8 -44.8 -76.8 -76.8C451.2 320 480 272 480 256zM256 131.2c96 0 176 92.8 188.8 124.8 -6.4 16 -32 48 -67.2 76.8L316.8 272c3.2 -6.4 3.2 -9.6 3.2 -16 0 -35.2 -28.8 -64 -64 -64 -6.4 0 -9.6 0 -16 3.2L192 147.2c19.2 -9.6 41.6 -16 64 -16zm0 249.6C160 380.8 80 288 67.2 256c6.4 -9.6 19.2 -32 41.6 -54.4l-25.6 -25.6C51.2 208 32 243.2 32 256c0 32 99.2 160 224 160 19.2 0 38.4 -3.2 57.6 -9.6l-28.8 -28.8c-9.6 3.2 -19.2 3.2 -28.8 3.2z"]},Id={prefix:"dh",iconName:"eye",icon:[512,512,[],"f000","M256 96C131.2 96 32 224 32 256s99.2 160 224 160 224 -128 224 -160 -99.2 -160 -224 -160zm0 284.8C160 380.8 80 288 67.2 256 80 227.2 160 131.2 256 131.2S432 224 444.8 256c-12.8 28.8 -92.8 124.8 -188.8 124.8zM256 192c-35.2 0 -64 28.8 -64 64s28.8 64 64 64 64 -28.8 64 -64 -28.8 -64 -64 -64zm0 92.8c-16 0 -28.8 -12.8 -28.8 -28.8s12.8 -28.8 28.8 -28.8 28.8 12.8 28.8 28.8 -12.8 28.8 -28.8 28.8z"]},tb={prefix:"dh",iconName:"file-csv",icon:[512,512,[],"f000","m444.8 140.8 -105.6 -105.6 -12.8 -3.2H80l-16 16V224h32V64h192v112l16 16H416v32h32V153.6l-3.2 -12.8zM320 160V64l96 96h-96zM80 256l-16 16v192l16 16h352l16 -16v-192l-16 -16h-352zM416 416v32H96V288h320v128zm-217.6 -3.2c-6.4 3.2 -16 3.2 -25.6 3.2 -16 0 -25.6 -3.2 -35.2 -12.8 -9.6 -6.4 -12.8 -19.2 -12.8 -32 0 -16 3.2 -28.8 12.8 -38.4 9.6 -9.6 22.4 -12.8 38.4 -12.8 9.6 0 16 0 22.4 3.2v19.2c-6.4 -3.2 -12.8 -6.4 -22.4 -6.4 -9.6 0 -16 3.2 -22.4 9.6 -6.4 6.4 -9.6 12.8 -9.6 22.4 0 9.6 3.2 16 6.4 22.4 6.4 6.4 12.8 9.6 22.4 9.6 9.6 0 16 -3.2 22.4 -6.4v19.2zm19.2 0v-22.4c3.2 3.2 9.6 6.4 12.8 6.4 3.2 3.2 9.6 3.2 12.8 3.2h6.4c3.2 0 3.2 0 6.4 -3.2l3.2 -3.2v-3.2c0 -3.2 0 -3.2 -3.2 -6.4 3.2 0 0 0 0 -3.2 -3.2 0 -3.2 -3.2 -6.4 -3.2s-6.4 -3.2 -9.6 -3.2c-6.4 -3.2 -12.8 -6.4 -16 -12.8 -3.2 -3.2 -6.4 -9.6 -6.4 -16s0 -9.6 3.2 -12.8c3.2 -3.2 3.2 -6.4 9.6 -9.6 3.2 0 6.4 -3.2 12.8 -3.2h25.6c3.2 0 6.4 0 9.6 3.2v19.2s-3.2 -3.2 -6.4 -3.2 -3.2 0 -6.4 -3.2h-19.2c-3.2 0 -3.2 0 -6.4 3.2l-3.2 3.2v6.4l3.2 3.2s3.2 3.2 6.4 3.2 3.2 3.2 6.4 3.2c3.2 3.2 6.4 3.2 9.6 6.4 3.2 3.2 6.4 3.2 6.4 6.4 3.2 3.2 3.2 6.4 6.4 6.4 0 3.2 3.2 6.4 3.2 9.6 0 6.4 0 9.6 -3.2 12.8 -3.2 3.2 -3.2 6.4 -9.6 9.6 3.2 3.2 0 6.4 -3.2 6.4h-32c-3.2 0 -6.4 -3.2 -12.8 -3.2zm169.6 -92.8 -32 96h-25.6l-32 -96h22.4l19.2 67.2c0 3.2 3.2 6.4 3.2 9.6 0 -3.2 0 -6.4 3.2 -9.6l19.2 -67.2h22.4z"]},nb={prefix:"dh",iconName:"file-download",icon:[512,512,[],"f000","m438.4 137.6 -96 -96L320 32H128L96 64v384l32 32h288l32 -32V160l-9.6 -22.4zM416 448H128V64h160v128h128v256zm-96 -288V64l96 96h-96zm-134.4 182.4 76.8 76.8h22.4l76.8 -76.8 -25.6 -22.4L288 368V227.2H256v140.8L208 320l-22.4 22.4z"]},sb={prefix:"dh",iconName:"file-search",icon:[512,512,[],"f000","M412.8 147.2 304 35.2 294.4 32H80l-16 16v384l16 16H224v-32H96V64h160v128h128v32h32V160l-3.2 -12.8zM288 160V64l92.8 96H288zm224 329.6 -92.8 -92.8c9.6 -16 16 -32 16 -51.2 0 -51.2 -41.6 -89.6 -89.6 -89.6C297.6 256 256 297.6 256 345.6s41.6 89.6 89.6 89.6c19.2 0 38.4 -6.4 51.2 -16l92.8 92.8 22.4 -22.4zm-224 -144c0 -32 25.6 -57.6 57.6 -57.6s57.6 25.6 57.6 57.6 -25.6 57.6 -57.6 57.6S288 377.6 288 345.6z"]},ib={prefix:"dh",iconName:"file-spreadsheet",icon:[512,512,[],"f000","m438.4 137.6 -96 -96L320 32H128L96 64v384l32 32h288l32 -32V160l-9.6 -22.4zM416 448H128V64h160v128h128v256zm-96 -288V64l96 96h-96zm64 99.2 -19.2 -19.2H179.2l-19.2 19.2v137.6l19.2 19.2h185.6l19.2 -19.2V259.2zm-150.4 134.4H182.4v-48h51.2v48zm0 -115.2v48H182.4V278.4m115.2 115.2H246.4v-48h48v48zm0 -64H246.4V278.4h48v51.2zm64 64H310.4v-48h48v48zm-51.2 -64V278.4h48v48H310.4z"]},Rd={prefix:"dh",iconName:"filter-filled",icon:[512,512,[],"f000","M480 64v54.4l-160 153.6V448H192V268.8L32 118.4V64h448z"]},ob={prefix:"dh",iconName:"filter-slash",icon:[512,512,[],"f000","M480 118.4V64H108.8L70.4 25.6 25.6 70.4l406.4 406.4 44.8 -44.8L320 275.2v-6.4l160 -150.4zM288 416H224v-86.4l-32 -32V448h128v-22.4l-32 -32v22.4zM140.8 96H448v6.4L294.4 249.6 140.8 96z"]},rb={prefix:"dh",iconName:"freeze",icon:[512,512,[],"f000","m438.4 300.8 -19.2 -28.8 -60.8 35.2L272 256l86.4 -51.2 60.8 35.2 19.2 -28.8 -44.8 -25.6 48 -28.8 -16 -25.6 -48 28.8V108.8h-35.2v67.2L256 227.2V128l60.8 -35.2 -16 -28.8 -44.8 25.6V32H224v57.6L179.2 64l-16 28.8L224 128v99.2L137.6 176V108.8H102.4V160l-48 -28.8 -16 25.6 48 28.8 -44.8 25.6 19.2 28.8 60.8 -35.2L208 256 121.6 307.2 60.8 272l-19.2 28.8 44.8 25.6 -48 28.8 16 25.6 48 -28.8v51.2h35.2v-67.2L224 284.8V384l-60.8 35.2 16 28.8 44.8 -25.6V480h32v-57.6l44.8 25.6 16 -28.8L256 384V284.8l86.4 51.2v67.2h35.2V352l48 28.8 16 -25.6 -48 -28.8z"]},va={prefix:"dh",iconName:"gear-filled",icon:[512,512,[],"f000","m480 211.2 -76.8 -12.8L448 131.2l-64 -64 -67.2 41.6L300.8 32H211.2l-12.8 76.8L131.2 64l-64 64 41.6 67.2 -76.8 16v89.6l76.8 12.8L64 380.8l64 64 67.2 -41.6 16 76.8h89.6l16 -76.8L384 448l64 -64 -44.8 -67.2 76.8 -16V211.2zM256 320c-38.4 0 -64 -25.6 -64 -64s25.6 -64 64 -64 64 25.6 64 64 -25.6 64 -64 64z"]},lb={prefix:"dh",iconName:"graph-line-down",icon:[512,512,[],"f000","M64 416V0H32v432l16 16H480v-32zm67.2 -291.2 -22.4 22.4 108.8 112 70.4 -64 108.8 124.8H320v32h112l16 -16V224h-32v70.4L288 150.4l-70.4 64z"]},ab={prefix:"dh",iconName:"graph-line-up",icon:[512,512,[],"f000","M64 416V0H32v432l16 16H480v-32zm153.6 -150.4 70.4 64 128 -144V256h32V144l-16 -16H320v32h76.8L288 284.8l-70.4 -64 -108.8 112 22.4 22.4z"]},db={prefix:"dh",iconName:"input",icon:[512,512,[],"f000","M464 448h-416l-16 -16v-352l16 -16h416l16 16v352l-16 16zM64 416h384V96H64v320zm96 -224h32v128H160zm64 -32v32H128V160l48 16zm0 160v32l-48 -16L128 352v-32z"]},Gs={prefix:"dh",iconName:"new-circle-large-filled",icon:[512,512,[],"f000","M240 0C108.8 0 0 108.8 0 240S108.8 480 240 480 480 371.2 480 240 371.2 0 240 0zM352 256H256v96H224V256H128V224h96V128h32v96h96v32z"]},cb={prefix:"dh",iconName:"pandas",icon:[512,512,[],"f000","M185.6 28.8h54.4v115.2H185.6V28.8zm0 240h54.4V384H185.6V268.8zm0 -89.6h54.4v54.4H185.6V179.2zM96 124.8h54.4V512H96V124.8zm176 240h54.4V480H272v-115.2zm0 -240h54.4v115.2H272V124.8zm0 150.4h54.4v54.4H272V275.2zM361.6 0H416v387.2h-54.4V0z"]},hb={prefix:"dh",iconName:"panels",icon:[512,512,[],"f000","m496 288 16 16v160l-16 16h-192l-16 -16v-160l16 -16h192zm0 -256h-192l-16 16v160l16 16h192l16 -16v-160l-16 -16zM16 32l-16 16v160l16 16h192l16 -16v-160L208 32h-192zm0 256 -16 16v160l16 16h192l16 -16v-160L208 288h-192z"]},ub={prefix:"dh",iconName:"python",icon:[512,512,[],"f000","M198.4 249.6h99.2s57.6 0 57.6 -54.4V102.4s9.6 -54.4 -99.2 -54.4c-105.6 0 -99.2 44.8 -99.2 44.8v48H256v12.8H115.2s-67.2 -6.4 -67.2 99.2c0 105.6 57.6 102.4 57.6 102.4h35.2V307.2s-3.2 -57.6 57.6 -57.6zm3.2 -131.2c-9.6 0 -19.2 -9.6 -19.2 -19.2s6.4 -19.2 19.2 -19.2c9.6 0 19.2 9.6 19.2 19.2s-9.6 19.2 -19.2 19.2zm208 35.2h-35.2v48s3.2 57.6 -57.6 57.6H217.6S160 259.2 160 313.6v92.8s-12.8 54.4 99.2 54.4c105.6 0 99.2 -44.8 99.2 -44.8v-48H259.2v-12.8h140.8s67.2 6.4 67.2 -99.2 -57.6 -102.4 -57.6 -102.4zm-96 236.8c9.6 0 19.2 9.6 19.2 19.2s-9.6 19.2 -19.2 19.2 -19.2 -9.6 -19.2 -19.2 9.6 -19.2 19.2 -19.2z"]},Dd={prefix:"dh",iconName:"refresh",icon:[512,512,[],"f000","m313.6 73.6 -9.6 32c83.2 25.6 131.2 118.4 102.4 201.6 -19.2 64 -80 108.8 -150.4 108.8 -89.6 0 -160 -70.4 -160 -160 0 -51.2 22.4 -96 64 -128v64h32V80L176 64H64v32h86.4c-76.8 51.2 -108.8 150.4 -70.4 236.8C112 403.2 179.2 448 256 448c105.6 0 192 -86.4 192 -192 0 -83.2 -54.4 -156.8 -134.4 -182.4z"]},mb={prefix:"dh",iconName:"remove-square-filled",icon:[512,512,[],"f000","M432 32h-384l-16 16v384l16 16h384l16 -16v-384l-16 -16zM352 256H128V224h224v32z"]},pb={prefix:"dh",iconName:"run-selection",icon:[704,512,[],"f000","M124.8 64 128 96h-3.2c-6.4 0 -12.8 0 -19.2 3.2 -16 6.4 -25.6 25.6 -25.6 44.8v44.8c0 6.4 0 12.8 -3.2 19.2 0 6.4 -3.2 12.8 -6.4 19.2 -3.2 9.6 -12.8 22.4 -22.4 28.8 9.6 6.4 19.2 19.2 22.4 32 3.2 6.4 3.2 12.8 6.4 19.2 0 6.4 3.2 12.8 3.2 19.2v44.8c0 6.4 0 12.8 3.2 19.2 3.2 6.4 6.4 9.6 9.6 16 3.2 3.2 9.6 6.4 16 9.6H128v32h-3.2c-9.6 0 -19.2 -3.2 -28.8 -6.4 -9.6 -3.2 -19.2 -9.6 -25.6 -16 -6.4 -6.4 -12.8 -16 -16 -25.6 -3.2 -9.6 -6.4 -16 -6.4 -25.6V316.8c0 -6.4 0 -12.8 -3.2 -19.2 -3.2 -3.2 -6.4 -6.4 -9.6 -12.8 -3.2 -3.2 -9.6 -6.4 -16 -9.6 -3.2 -3.2 -9.6 -3.2 -16 -3.2H0v-32h3.2c6.4 0 12.8 0 19.2 -3.2 9.6 -6.4 19.2 -12.8 22.4 -25.6 3.2 -6.4 3.2 -12.8 3.2 -19.2V134.4c0 -9.6 3.2 -19.2 6.4 -25.6 3.2 -6.4 9.6 -16 16 -22.4 6.4 -6.4 16 -12.8 25.6 -16 9.6 -3.2 19.2 -6.4 28.8 -6.4zm576 176c-6.4 0 -12.8 0 -19.2 -3.2 -6.4 -3.2 -9.6 -6.4 -16 -9.6 -3.2 -3.2 -6.4 -9.6 -9.6 -16 -3.2 -6.4 -3.2 -12.8 -3.2 -19.2V134.4c0 -9.6 -3.2 -19.2 -6.4 -25.6 -3.2 -9.6 -9.6 -16 -16 -25.6 -6.4 -6.4 -16 -12.8 -25.6 -16 -6.4 0 -16 -3.2 -25.6 -3.2H576v32h3.2c6.4 0 12.8 0 19.2 3.2 6.4 3.2 9.6 6.4 16 9.6 3.2 3.2 6.4 9.6 9.6 16 3.2 6.4 3.2 12.8 3.2 19.2v44.8c0 6.4 0 12.8 3.2 19.2 0 6.4 3.2 12.8 6.4 19.2 6.4 12.8 12.8 22.4 22.4 32 -9.6 6.4 -19.2 19.2 -22.4 32 -3.2 6.4 -3.2 12.8 -6.4 19.2 0 6.4 -3.2 12.8 -3.2 19.2v44.8c0 19.2 -9.6 35.2 -28.8 44.8 -6.4 -3.2 -12.8 -3.2 -19.2 -3.2H576v32h3.2c9.6 0 19.2 -3.2 28.8 -6.4 9.6 -3.2 19.2 -9.6 25.6 -16 6.4 -6.4 12.8 -16 16 -25.6 3.2 -9.6 6.4 -16 6.4 -25.6V316.8c0 -6.4 0 -12.8 3.2 -19.2 3.2 -9.6 12.8 -16 25.6 -22.4 6.4 -3.2 12.8 -3.2 19.2 -3.2l-3.2 -32zm-192 28.8 -240 160 -25.6 -12.8V96l25.6 -12.8 240 160v25.6zM470.4 256 275.2 124.8V384l195.2 -128z"]},gb={prefix:"dh",iconName:"shapes",icon:[512,512,[],"f000","M195.2 320 160 256 128 313.6 105.6 352 32 480h256l-73.6 -128 -19.2 -32zm112 -76.8c51.2 -35.2 121.6 -22.4 156.8 28.8s22.4 121.6 -28.8 156.8c0 0 -3.2 0 -3.2 3.2 -51.2 32 -121.6 19.2 -153.6 -32 -35.2 -54.4 -22.4 -121.6 28.8 -156.8zM96 32v192h192V32H96z"]},Md={prefix:"dh",iconName:"sort-alpha-down",icon:[512,512,[],"f000","M236.8 368 156.8 448h-22.4l-80 -80 22.4 -22.4L128 396.8V64h32v332.8l51.2 -51.2 25.6 22.4zM371.2 224l-6.4 -28.8H316.8l-9.6 28.8H256l54.4 -160h60.8l51.2 160h-51.2zm-32 -124.8c0 3.2 -3.2 3.2 -3.2 9.6s-3.2 19.2 -12.8 51.2h32l-9.6 -44.8c-3.2 -6.4 -6.4 -9.6 -6.4 -16zm-6.4 310.4h73.6V448H272v-32l73.6 -89.6H275.2V288h128v32l-70.4 89.6z"]},Nd={prefix:"dh",iconName:"sort-alpha-up",icon:[512,512,[],"f000","M51.2 144 131.2 64h22.4l80 80 -22.4 22.4L160 115.2V448H128V115.2L76.8 166.4l-25.6 -22.4zm320 304 -6.4 -28.8H316.8l-9.6 28.8H256l54.4 -160h60.8l51.2 160h-51.2zm-32 -124.8c0 3.2 -3.2 3.2 -3.2 9.6 0 6.4 -3.2 19.2 -12.8 51.2h32l-9.6 -44.8c-3.2 -6.4 -6.4 -9.6 -6.4 -16zm-6.4 -137.6h73.6V224H272V192l73.6 -89.6H275.2V64h128v32l-70.4 89.6z"]},Kc={prefix:"dh",iconName:"sort-amount-down",icon:[512,512,[],"f000","M204.8 368 124.8 448h-22.4L22.4 368l22.4 -22.4L96 396.8V64h32v332.8l51.2 -51.2 25.6 22.4zM256 64h256v64H256zm0 105.6h192v64H256zm0 108.8h128v64H256zM256 384h64v64H256z"]},fb={prefix:"dh",iconName:"sort-down",icon:[512,512,[],"f000","m128 288 -12.8 25.6 128 118.4h25.6l128 -118.4L384 288H128z"]},Cb={prefix:"dh",iconName:"sort-up",icon:[512,512,[],"f000","m128 224 -12.8 -25.6 128 -118.4h25.6l128 118.4 -12.8 25.6H128z"]},Fd={prefix:"dh",iconName:"sort",icon:[512,512,[],"f000","m128 224 -12.8 -25.6 128 -118.4h25.6l128 118.4 -12.8 25.6H128zm0 64 -12.8 25.6 128 118.4h25.6l128 -118.4L384 288H128z"]},ml={prefix:"dh",iconName:"square-filled",icon:[512,512,[],"f000","M432 32h-384l-16 16v384l16 16h384l16 -16v-384l-16 -16z"]},xd={prefix:"dh",iconName:"table",icon:[512,512,[],"f000","M432 64h-384l-16 16v352l16 16h384l16 -16v-352l-16 -16zM160 416H64v-64h96v64zm0 -96H64V256h96v64zm0 -96H64V160h96v64zm128 192H192v-64h96v64zm0 -96H192V256h96v64zm0 -96H192V160h96v64zm128 192h-96v-64h96v64zm0 -96h-96V256h96v64zm0 -96h-96V160h96v64z"]},bb={prefix:"dh",iconName:"trash-undo",icon:[512,512,[],"f000","M320 96h96v32h-32v288l-32 32H128l-32 -32V128H64V96h96V64c0 -19.2 12.8 -32 32 -32h96c19.2 0 32 12.8 32 32v32zM288 64H192v32h96V64zM128 416h224V128H128v288zm112 -64L160 272v-22.4l80 -80 22.4 22.4 -51.2 54.4H320v32H211.2l51.2 51.2 -22.4 22.4z"]},Hu={prefix:"dh",iconName:"triangle-down-square",icon:[512,512,[],"f000","M425.6 64H86.4l-22.4 22.4v342.4l22.4 19.2h342.4l22.4 -22.4V86.4l-25.6 -22.4zm-160 288h-22.4L99.2 208l9.6 -16h291.2l9.6 12.8L265.6 352z"]},Sb={prefix:"dh",iconName:"unlink",icon:[512,512,[],"f000","M32 211.2v-6.4C32 144 80 96 140.8 96h99.2c12.8 0 25.6 3.2 38.4 6.4l-25.6 25.6H140.8C99.2 128 64 163.2 64 204.8v6.4c0 28.8 16 54.4 38.4 67.2l-22.4 22.4C51.2 281.6 32 249.6 32 211.2zM403.2 6.4l-38.4 38.4 -67.2 67.2 -22.4 25.6 -150.4 147.2 -25.6 25.6 -54.4 54.4 -38.4 38.4L51.2 448 448 51.2 403.2 6.4zM384 192v32c38.4 6.4 64 38.4 64 76.8v6.4c0 41.6 -35.2 76.8 -76.8 76.8H272c-32 0 -60.8 -22.4 -73.6 -51.2l-25.6 25.6c19.2 35.2 54.4 60.8 96 60.8h99.2c60.8 0 108.8 -48 108.8 -108.8v-9.6C480 246.4 438.4 198.4 384 192zM246.4 288l-22.4 19.2v12.8h16c60.8 0 108.8 -48 108.8 -108.8v-6.4c0 -6.4 0 -12.8 -3.2 -19.2l-32 32c0 38.4 -32 67.2 -67.2 70.4z"]},qc={prefix:"dh",iconName:"warning-circle-filled",icon:[512,512,[],"f000","M470.4 195.2c-9.6 -38.4 -28.8 -70.4 -57.6 -99.2 -25.6 -25.6 -60.8 -44.8 -96 -54.4C297.6 35.2 275.2 32 256 32c-19.2 0 -41.6 3.2 -60.8 9.6 -16 3.2 -35.2 9.6 -51.2 22.4 -35.2 19.2 -60.8 44.8 -80 80 -12.8 16 -19.2 35.2 -25.6 51.2C35.2 214.4 32 236.8 32 256c0 19.2 3.2 41.6 6.4 60.8 6.4 16 12.8 35.2 25.6 51.2 9.6 16 22.4 32 35.2 44.8 12.8 16 28.8 25.6 44.8 35.2 16 9.6 35.2 16 54.4 22.4 16 6.4 38.4 9.6 57.6 9.6 19.2 0 41.6 -3.2 60.8 -6.4 19.2 -6.4 35.2 -12.8 54.4 -22.4 32 -19.2 60.8 -48 80 -80 9.6 -16 16 -35.2 22.4 -54.4 3.2 -19.2 6.4 -41.6 6.4 -60.8s-3.2 -41.6 -9.6 -60.8zM275.2 352H236.8v-32h38.4v32zm0 -64H236.8V160h38.4v128z"]},Vu={prefix:"dh",iconName:"warning-filled",icon:[512,512,[],"f000","M268.8 32h-25.6L32 425.6l12.8 22.4h419.2l12.8 -22.4L268.8 32zm6.4 352H236.8v-32h38.4v32zm0 -64H236.8V192h38.4v128z"]};const Ol=X.forwardRef((t,e)=>{var b,C;function n(S){const{menuItem:v,onMenuItemClick:y}=t;y(v,S)}function s(S){const{menuItem:v,onMenuItemMouseMove:y}=t;y(v,S)}function i(S){const{menuItem:v,onMenuItemContextMenu:y}=t;y(v,S)}function o(S,v,y){if(typeof S.type=="string")return S;const{closeMenu:E,menuItem:I,isKeyboardSelected:R,isMouseSelected:N,"data-testid":F}=t,P={menuItem:I,closeMenu:E,isKeyboardSelected:R,isMouseSelected:N,iconElement:v,displayShortcut:y,"data-testid":F};return X.cloneElement(S,{forwardedProps:P})}const{children:r,menuItem:l,isKeyboardSelected:a=!1,isMouseSelected:d=!1,"data-testid":c}=t,u=(b=l.shortcut)==null?void 0:b.getDisplayText();let m=null;if(l.icon){const S=l.icon;if(X.isValidElement(S))m=S;else{let v;l.iconColor!=null&&(l.disabled===void 0||!l.disabled)&&(v={color:l.iconColor}),m=h(ee,{icon:S,style:v})}}let p=null;const g=Boolean(r);l.actions&&(p=h(ee,{icon:Nu}));let f=null;if(l.menuElement)f=h("div",{className:"custom-menu-item",onMouseMove:s,children:o(l.menuElement,m,u)});else{const S=l.disabled,v=l.iconOutline;f=h("button",{type:"button",className:z("btn-context-menu",{disabled:S},{active:(g||d)&&(S===void 0||!S)},{"keyboard-active":a&&(S===void 0||!S)}),onClick:n,onMouseMove:s,onContextMenu:i,title:(C=l.description)!=null?C:"",children:T("div",{className:"btn-context-menu-wrapper",children:[h("span",{className:z("icon",{outline:v}),children:m}),h("span",{className:"title",children:l.title}),u!==void 0&&h("span",{className:"shortcut",children:u}),p&&h("span",{className:z("submenu-indicator",{disabled:S}),children:p})]})})}return T("div",{className:"context-menu-item",ref:e,"data-testid":c,children:[r,f]})});Ol.displayName="ContextMenuItem";Ol.defaultProps={children:null,isKeyboardSelected:!1,isMouseSelected:!1,"data-testid":void 0};class Qi extends Error{constructor(){super(...arguments),this.isCanceled=!0}}class Ll{static isDark(e){const n=document.createElement("div");n.style.display="none",n.style.color=e;const s=getComputedStyle(document.body.appendChild(n)).color,i=s.match(/\d+/g);let o=[];if(i)o=i.map(l=>parseInt(l,10));else throw new Error(`Invalid color received. Got ${s}`);return document.body.removeChild(n),Ll.getBrightness(o)<125}static getBrightness(e){return Math.round((e[0]*299+e[1]*587+e[2]*114)/1e3)}}async function ro(t){const{clipboard:e}=navigator;if(e!==void 0)try{return navigator.clipboard.writeText(t)}catch{return Yc(t)}Yc(t)}function Yc(t){const e=document.activeElement,n=document.createElement("textarea");n.value=t,document.body.appendChild(n),n.focus(),n.select();const s=document.execCommand("copy");if(document.body.removeChild(n),e instanceof HTMLElement&&e.focus(),!s)throw new Error("Unable to execute copy command")}const wb="table_",Uu="column_",vb=new Set(["in","not","i","ii","k"]),Tb=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"]),Eb=/[^a-zA-Z0-9_$+@-]/g,yb=/[^A-Za-z0-9_$]/g,lo=class{};let En=lo;En.legalize=(t,e,n,s,i)=>{let o=t.trim().replace(/[- ]/g,"_");return s&&(vb.has(o)||Tb.has(o))&&(o=e+o),o=o.replace(n,""),o||(o=e+i),Number.isNaN(Number(o.charAt(0)))||(o=e+o),o};En.legalizeTableName=t=>lo.legalize(t,wb,Eb,!1,0);En.legalizeColumnNames=t=>{const e=[];return t.forEach((n,s)=>{let i=lo.legalizeColumnName(n,s);e.includes(i)&&(i=Uu+s),e.push(i)}),e};En.legalizeColumnName=(t,e=0)=>lo.legalize(t,Uu,yb,!0,e);En.isValidTableName=t=>lo.legalizeTableName(t)===t;En.isValidColumnName=t=>lo.legalizeColumnName(t)===t;function Ib(t,e){return t?t.closest(`.${e}`):null}const Rb={getClosestByClassName:Ib};class Ke extends CustomEvent{constructor(e,n){super(e,n)}}class Bu extends Error{constructor(){super(...arguments),this.isTimeout=!0}}class ye{static makeCancelable(e,n){let s=!1,i,o;const r=new Promise((l,a)=>{o=a,Promise.resolve(e).then(d=>{s?n&&n(d):(i=d,l(d))}).catch(d=>a(d))});return r.cancel=()=>{s=!0,o(new Qi),i!=null&&n&&n(i)},r}static isCanceled(e){return e instanceof Qi}static isTimedOut(e){return e instanceof Bu}}class Ss{constructor(){this.pending=[],this.resolved=[]}add(e,n){const s=ye.makeCancelable(e,n);return this.pending.push(s),s.then(()=>{this.resolve(s)},()=>{this.resolve(s)}),s}remove(e){for(let n=0;n<this.pending.length;n+=1)if(this.pending[n]===e){this.pending.splice(n,1);return}}resolve(e){this.remove(e),this.resolved.push(e)}cancel(){const e=[...this.pending,...this.resolved];for(let n=0;n<e.length;n+=1)e[n].cancel();this.pending=[],this.resolved=[]}}function L(t){if(t==null)throw new Error("Value is null or undefined")}class bn{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(!bn.isValidRange(e))throw new Error(`Invalid range! ${e}`)}static isSelected(e,n){for(let s=0;s<e.length;s+=1){const i=e[s],o=i[0],r=i[1];if(o<=n&&n<=r)return!0}return!1}static selectRange(e,n){let[s,i]=n;const o=[...e];for(let r=o.length-1;r>=0;r-=1){const l=o[r],a=l[0],d=l[1];if(a<=s&&i<=d)return o;s<=d&&a<=i&&(s=Math.min(s,a),i=Math.max(i,d),o.splice(r,1))}return o.push([s,i]),o}static deselectRange(e,n){const[s,i]=n,o=[...e];for(let r=o.length-1;r>=0;r-=1){const l=o[r],a=l[0],d=l[1];if(!(i<a||d<s))if(a<s&&i<d){o[r]=[a,s-1],o.splice(r+1,0,[i+1,d]);break}else s<=a&&d<=i?o.splice(r,1):a<s?o[r]=[a,s-1]:o[r]=[i+1,d]}return o}static count(e){return e.reduce((n,s)=>n+(s[1]-s[0]+1),0)}static getItemsInRanges(e,n){return n.reduce((s,i)=>{const o=[...s];for(let r=i[0];r<=i[1];r+=1)o.push(e[r]);return o},[])}}class nn{static join(e,n="and"){if(e==null||e.length===0)return"";if(e.length===1)return e[0];if(e.length===2)return`${e[0]} ${n} ${e[1]}`;const s=e.slice(0,e.length-1).join(", "),i=e[e.length-1];return`${s}, ${n} ${i}`}static toLower(e,n=!0){if(e==null){if(n)return"";throw new Error("Null string passed in to TextUtils.toLower")}return e.toLowerCase()}static sort(e,n,s=!0){return e<n?s?-1:1:e>n?s?1:-1:0}}const $u=class{static formatElapsedTime(t){if(typeof t!="number"||!Number.isInteger(t))throw new Error(`${t} is not a number that can be expressed as a formatted time`);const e=Math.floor(t/3600),n=Math.floor(t%3600/60),s=t%60;return`${e>0?`${e}h `:""}${n>0||e>0?`${n}m `:""}${t>=60?`${s}s`.padStart(3,"0"):`${s}s`}`}static formatTime(t){if(typeof t!="number"||!Number.isInteger(t)||t<0)throw new Error(`${t} is not a number that can be expressed as a formatted time`);const e=String(Math.floor(t/(60*60))).padStart(2,"0"),n=t%(60*60),s=String(Math.floor(n/60)).padStart(2,"0"),i=n%60,o=String(Math.ceil(i)).padStart(2,"0");return`${e}:${s}:${o}`}static isTimeString(t){return new RegExp($u.TIME_PATTERN).test(t)}static parseTime(t){if(t==null||typeof t!="string")throw new Error(`${t} is not a valid string`);const e=t.split(":");if(e.length!==3)throw new Error(`${t} is not a time string that can be parsed`);return Number(e[0])*60*60+Number(e[1])*60+Number(e[2])}};let Dn=$u;Dn.TIME_PATTERN="([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]";Dn.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\xB10 No DST",value:"UTC"},{label:"London UTC\xB10",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\u22125",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"}]);class Ki extends Error{constructor(){super(...arguments),this.isInvalid=!0}}function On({className:t="","data-testid":e}){return T("div",{className:z("loading-spinner fa-layers",t),"data-testid":e,children:[h(ee,{icon:vC,className:"text-white-50"}),h(ee,{icon:_u,className:"text-primary",spin:!0})]})}const Xc=Z.module("ContextMenu"),Ga=class extends w.exports.PureComponent{constructor(t){super(t),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=X.createRef(),this.oldFocus=document.activeElement,this.activeSubMenuRef=X.createRef(),this.subMenuTimer=0,this.rAF=0,this.initialPosition={top:t.top,left:t.left},this.state={menuItems:[],pendingItems:[],activeSubMenu:null,hasOverflow:!1,subMenuTop:null,subMenuLeft:null,subMenuParentWidth:0,subMenuParentHeight:0,keyboardIndex:-1,mouseIndex:-1}}static handleContextMenu(t){t.metaKey||(t.stopPropagation(),t.preventDefault())}componentDidMount(){this.initMenu(),this.verifyPosition(),window.addEventListener("resize",this.handleWindowResize),this.rAF=window.requestAnimationFrame(()=>{var e;(e=this.container.current)==null||e.focus();const{onMenuOpened:t}=this.props;t(this)})}componentDidUpdate(t,e){var i,o;const{actions:n}=this.props,{activeSubMenu:s}=this.state;s!==e.activeSubMenu&&(s==null?(i=this.container.current)==null||i.focus():this.setActiveSubMenuPosition()),t.actions!==n&&(this.initMenu(),(this.container.current==null||!this.container.current.contains(document.activeElement))&&((o=this.container.current)==null||o.focus())),this.verifyPosition()}componentWillUnmount(){this.cancelPromises(),window.removeEventListener("resize",this.handleWindowResize),cancelAnimationFrame(this.rAF)}getKeyboardIndex(){const{options:t}=this.props;if(t.separateKeyboardMouse!==void 0&&t.separateKeyboardMouse){const{keyboardIndex:e}=this.state;return e}return this.getMouseIndex()}setKeyboardIndex(t){const{options:e}=this.props;e.separateKeyboardMouse!==void 0&&e.separateKeyboardMouse?this.setState({keyboardIndex:t}):this.setMouseIndex(t)}getMouseIndex(){const{mouseIndex:t}=this.state;return t}setMouseIndex(t){this.setState({mouseIndex:t})}initMenu(){this.cancelPromises(),cancelAnimationFrame(this.rAF);const{options:t}=this.props;let e=t.initialKeyboardIndex;e===void 0&&(e=-1);const{actions:n}=this.props,s=Ge.getMenuItems(n),i=[];for(let o=s.length-1;o>=0;o-=1){const r=s[o];r instanceof Promise?this.initMenuPromise(r):i.push(r)}this.setState({mouseIndex:-1,keyboardIndex:e,activeSubMenu:null,menuItems:Ge.sortActions(i)})}initMenuPromise(t){const e=ye.makeCancelable(t);this.setState(n=>({pendingItems:n.pendingItems.concat(e)})),e.then(n=>{this.setState(s=>{const i=s.pendingItems.indexOf(e);if(i>=0){const o=s.pendingItems.slice();return o.splice(i,1),{menuItems:Ge.sortActions(s.menuItems.concat(n)),pendingItems:o}}return null})},n=>{ye.isCanceled(n)||(this.setState(s=>{const i=s.pendingItems.indexOf(e);if(i>=0){const o=s.pendingItems.slice();return o.splice(i,1),{pendingItems:o}}return null}),Xc.error(n))})}cancelPromises(){const{pendingItems:t}=this.state;t.map(e=>e.cancel())}setActiveSubMenuPosition(){if(this.activeSubMenuRef.current===null)return;const t=this.activeSubMenuRef.current.getBoundingClientRect();this.setState({subMenuTop:t.top,subMenuLeft:t.right,subMenuParentHeight:t.height,subMenuParentWidth:t.width})}verifyPosition(){var u,m,p,g;const{options:t,updatePosition:e,subMenuParentWidth:n,subMenuParentHeight:s,top:i,left:o}=this.props;if(!this.container.current||t.doNotVerifyPosition!=null&&t.doNotVerifyPosition)return;let{top:r,left:l}=this.initialPosition;const{width:a,height:d}=(m=(u=this.container.current)==null?void 0:u.getBoundingClientRect())!=null?m:{width:0,height:0},c=((g=(p=this.container.current)==null?void 0:p.scrollHeight)!=null?g:0)>window.innerHeight;d===0||a===0||(r+d>window.innerHeight&&(r-d-s>0?r-=d-s:r=window.innerHeight-d),l+a>window.innerWidth&&(l=l-a-n),(o!==l||i!==r)&&(this.setState({hasOverflow:c}),e(r,l)))}handleWindowResize(){!this.container.current||this.closeMenu(!0)}handleBlur(t){if(!this.container.current){Xc.warn("Container is null!");return}if(!this.container.current.contains(t.relatedTarget)){let e=t.relatedTarget,n=!1;for(;e&&!n;)n=e.hasAttribute("data-dh-context-menu"),e=e.parentElement;n||this.closeMenu(!0)}}isEscapeKey(t){const{left:e}=this.props;return t==="Escape"||e<0&&t==="ArrowRight"||t==="ArrowLeft"}handleKeyDown(t){const{menuItems:e}=this.state,n=this.getKeyboardIndex();let s=n,i=!1;if(t.key==="Enter"||t.key===" "){n>=0&&n<e.length&&this.handleMenuItemClick(e[n],t);return}if(t.key==="ArrowRight"?n>=0&&n<=e.length?i=!0:s=0:this.isEscapeKey(t.key)?s=null:t.key==="ArrowUp"||t.shiftKey&&t.key==="Tab"?s=Ge.getNextMenuItem(s,-1,e):(t.key==="ArrowDown"||t.key==="Tab")&&(s=Ge.getNextMenuItem(s,1,e)),i){this.openSubMenu(n),t.preventDefault(),t.stopPropagation();return}n!==s&&(s!==null?this.setKeyboardIndex(s):(this.closeMenu(),this.oldFocus instanceof HTMLElement&&this.oldFocus.focus()),t.preventDefault(),t.stopPropagation())}openSubMenu(t){const{menuItems:e,activeSubMenu:n}=this.state,s=e[t].actions?t:null;n!==s&&this.setState({activeSubMenu:s,subMenuTop:null,subMenuLeft:null})}closeMenu(t=!1){const{closeMenu:e,onMenuClosed:n}=this.props;cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{e(t),n(this)})}closeSubMenu(){this.setState({activeSubMenu:null})}handleCloseSubMenu(t){t?this.closeMenu(!0):this.closeSubMenu()}handleMenuItemClick(t,e){e.preventDefault(),e.stopPropagation();const{menuItems:n}=this.state;t!=null&&(t.disabled===void 0||!t.disabled)&&(t.actions!=null?this.openSubMenu(n.indexOf(t)):t.action!=null&&(t.action(),this.closeMenu(!0)))}handleMenuItemContextMenu(t,e){e.metaKey||this.handleMenuItemClick(t,e)}handleMenuItemMouseMove(t){const{menuItems:e}=this.state,n=e.indexOf(t);this.setMouseIndex(n),n>=0&&n<e.length&&(t.disabled===void 0||!t.disabled)&&this.openSubMenu(n)}handleMouseLeave(){this.setMouseIndex(-1)}render(){const t=[],{top:e,left:n}=this.props,{activeSubMenu:s,hasOverflow:i,keyboardIndex:o,menuItems:r,mouseIndex:l,pendingItems:a,subMenuTop:d,subMenuLeft:c,subMenuParentWidth:u,subMenuParentHeight:m}=this.state;for(let C=0;C<r.length;C+=1){const S=r[C];C>0&&S.group!==r[C-1].group&&t.push(h("hr",{},`${C}.separator`));const v=h(Ol,{ref:s===C?this.activeSubMenuRef:null,isKeyboardSelected:o===C,isMouseSelected:l===C,menuItem:S,closeMenu:this.handleCloseSubMenu,onMenuItemClick:this.handleMenuItemClick,onMenuItemMouseMove:this.handleMenuItemMouseMove,onMenuItemContextMenu:this.handleMenuItemContextMenu},C);t.push(v)}let p=null;a.length>0&&(p=h("div",{className:"loading",children:h(On,{})}));const{menuStyle:g,"data-testid":f}=this.props,b=s!==null&&d!==null&&c!==null;return T(Te,{children:[T("div",{className:z({"has-overflow":i},"context-menu-container"),style:{top:e,left:n,...g},ref:this.container,"data-dh-context-menu":!0,onBlur:this.handleBlur,onKeyDown:this.handleKeyDown,onMouseLeave:this.handleMouseLeave,onContextMenu:Ga.handleContextMenu,role:"menuitem",tabIndex:0,"data-testid":f,children:[t,p]}),b&&s!==null&&d!==null&&c!==null&&h(Ga,{actions:r[s].actions||[],closeMenu:this.handleCloseSubMenu,top:d,left:c,updatePosition:(C,S)=>{this.setState({subMenuTop:C,subMenuLeft:S})},subMenuParentWidth:u,subMenuParentHeight:m},`sub-${s}`)]})}};let zu=Ga;zu.defaultProps={subMenuParentWidth:0,subMenuParentHeight:0,closeMenu(){},onMenuOpened(){},onMenuClosed(){},options:{},menuStyle:{},"data-testid":void 0};class Wu extends w.exports.Component{constructor(e){super(e),this.handleMenuClose=this.handleMenuClose.bind(this),this.handleContextMenu=this.handleContextMenu.bind(this),this.container=X.createRef(),this.openMenu=X.createRef(),this.state={actions:null,left:0,top:0}}componentDidMount(){var e;(e=this.container.current)!=null&&e.parentElement&&this.container.current.parentElement.addEventListener("contextmenu",this.handleContextMenu)}componentWillUnmount(){var e;(e=this.container.current)!=null&&e.parentElement&&this.container.current.parentElement.removeEventListener("contextmenu",this.handleContextMenu)}handleContextMenu(e){if(!Ge.isContextActionEvent(e)||!this.container.current||e.metaKey||e.ctrlKey)return;const n=Ge.getMenuItems(e.contextActions),s=this.container.current.getBoundingClientRect(),i=e.clientY-s.top,o=e.clientX-s.left;if(n.length===0){if(e.target===this.container.current){e.preventDefault(),this.setState({actions:null},()=>{const r=document.elementFromPoint(o,i),l=new MouseEvent("contextmenu",{clientX:e.clientX,clientY:e.clientY,bubbles:!0,cancelable:!0});r==null||r.dispatchEvent(l)});return}return}e.preventDefault(),this.setState({actions:n,top:i,left:o})}handleMenuClose(e){e===this.openMenu.current&&this.setState({actions:null})}render(){let e=null;const{"data-testid":n}=this.props,{actions:s,top:i,left:o}=this.state;return s&&(e=h(zu,{ref:this.openMenu,actions:s,onMenuClosed:this.handleMenuClose,top:i,left:o,updatePosition:(r,l)=>{this.setState({top:r,left:l})},"data-testid":n})),h("div",{className:z("context-menu-root",{active:s}),ref:this.container,children:e})}}const ii=class extends w.exports.Component{static handleEnter(t){const e=t;e.style.height="0"}static handleEntering(t){const e=t;e.style.height=`${ii.getHeight(e)}px`}static handleExiting(t){const e=t;e.style.height="0"}static handleExit(t){const e=t;e.style.height=`${ii.getHeight(e)}px`}static getHeight(t){const e=t.scrollWidth-t.clientWidth;return t.scrollHeight-e}constructor(t){super(t),this.handleEntered=this.handleEntered.bind(this)}handleEntered(t){const e=t;e.style.height="";const{autoFocusOnShow:n}=this.props;if(n!==void 0&&n){const s=e.querySelector("input, select, textarea");s!=null&&s.focus()}}render(){const{children:t,className:e,in:n,"data-testid":s}=this.props;return h(mt,{in:n,classNames:{enterActive:"collapsing",enterDone:"collapse show",exitActive:"collapsing",exitDone:"collapse"},onEnter:ii.handleEnter,onEntering:ii.handleEntering,onEntered:this.handleEntered,onExit:ii.handleExit,onExiting:ii.handleExiting,timeout:350,children:i=>h("div",{className:z({collapse:i==="exited"},e),"data-testid":s,children:t})})}};let _d=ii;_d.propTypes={className:D.exports.string,in:D.exports.bool.isRequired,children:D.exports.node.isRequired,autoFocusOnShow:D.exports.bool,"data-testid":D.exports.string};_d.defaultProps={className:"",autoFocusOnShow:!1,"data-testid":void 0};function Al(t){const e=w.exports.useRef();return w.exports.useEffect(function(){e.current=t}),e.current}function Gu(t){const e=w.exports.useRef(null);return w.exports.useEffect(function(){!t||(typeof t=="function"?t(e.current):t.current=e.current)}),e}const Db=3500,Mb=Z.module("useCopyToClipboard");function Nb(){const[t,e]=w.exports.useState(!1),n=w.exports.useRef(null),s=w.exports.useCallback(i=>{ro(i).then(()=>{e(!0)}).catch(o=>Mb.error(`Unable to copy ${i}`,`
6
+ `,o))},[]);return w.exports.useEffect(()=>(n.current&&clearTimeout(n.current),t&&(n.current=setTimeout(()=>{e(!1)},Db)),()=>{n.current&&clearTimeout(n.current)}),[t]),[t,s]}const St=X.forwardRef((t,e)=>{const{checked:n=!1,children:s,className:i,disabled:o,inputClassName:r,isInvalid:l,labelClassName:a,name:d,onChange:c,"data-testid":u}=t,[m]=w.exports.useState(We()),p=Gu(e);w.exports.useEffect(function(){p.current&&(p.current.indeterminate=n===null)},[p,n]);const g=w.exports.useCallback(f=>{p.current&&(p.current.indeterminate=n===null),c&&c(f)},[p,n,c]);return T("div",{className:z("custom-control custom-checkbox",i),children:[h("input",{type:"checkbox",ref:p,checked:n!=null?n:!1,className:z("custom-control-input",r,{"is-invalid":l}),disabled:o,id:m,name:d,onChange:g,"data-testid":u}),h("label",{className:z("custom-control-label",a),htmlFor:m,children:s})]})});St.displayName="Checkbox";St.propTypes={checked:(t,e)=>{const{[e]:n}=t;return n!==null&&typeof n!="boolean"?new Error("Checked must be a boolean or null for indeterminate"):null},children:D.exports.node.isRequired,className:D.exports.string,disabled:D.exports.bool,inputClassName:D.exports.string,isInvalid:D.exports.bool,labelClassName:D.exports.string,name:D.exports.string,onChange:D.exports.func,"data-testid":D.exports.string};St.defaultProps={checked:!1,className:"",disabled:!1,inputClassName:"",isInvalid:!1,labelClassName:"",name:void 0,onChange:void 0,"data-testid":void 0};class ws extends w.exports.PureComponent{constructor(e){super(e),this.inputField=X.createRef()}focus(){var e;(e=this.inputField.current)==null||e.focus()}render(){const{value:e,placeholder:n,onBlur:s,onChange:i,className:o,disabled:r,matchCount:l,id:a,onKeyDown:d,"data-testid":c}=this.props;return T("div",{className:z("search-group",o),children:[h("input",{type:"search",value:e,onBlur:s,onChange:i,onKeyDown:d,className:"form-control",disabled:r,placeholder:n,ref:this.inputField,id:a,"data-testid":c}),l!=null&&h("span",{className:"search-match",children:l}),h("span",{className:"search-icon",children:h(ee,{icon:Lu})})]})}}ws.defaultProps={placeholder:"Search",className:"",matchCount:null,onKeyDown(){},id:"","data-testid":void 0};var Ku=(t=>(t.UP="UP",t.DOWN="DOWN",t))(Ku||{});const Ao=class extends w.exports.Component{constructor(t){super(t),this.getCachedFilteredOptions=be((e,n)=>e.filter(s=>s.title.toLowerCase().indexOf(n.toLowerCase())>=0||s.value.toLowerCase().indexOf(n.toLowerCase())>=0)),this.state={value:"",filter:"",filteredOptions:t.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=X.createRef(),this.cbContainer=X.createRef(),this.toggleButton=X.createRef(),this.menuContainer=X.createRef(),this.input=X.createRef(),this.searchInput=X.createRef()}componentDidUpdate(){const{menuIsOpen:t,keyboardOptionIndex:e}=this.state;t&&e>=0&&this.scrollOptionIntoView()}setInputWidth(){this.cbContainer.current&&this.setState({inputWidth:this.cbContainer.current.getBoundingClientRect().width})}focus(){var t;(t=this.input.current)==null||t.focus()}resetValue(){this.setState({value:""})}updateInputValue(t){const{onChange:e}=this.props;this.setState({value:t}),e(t)}handleResize(){this.setInputWidth()}handleMenuKeyDown(t){var r,l;const{filter:e,filteredOptions:n,keyboardOptionIndex:s}=this.state,{options:i}=this.props,o=e?n:i;switch(t.key){case"Enter":((r=o[s])==null?void 0:r.value)!=null&&this.updateInputValue(o[s].value),this.closeMenu(),(l=this.input.current)==null||l.focus(),t.stopPropagation(),t.preventDefault();break;case"ArrowUp":this.handleMenuNavigation(Ao.MENU_NAVIGATION_DIRECTION.UP),t.stopPropagation(),t.preventDefault();break;case"ArrowDown":this.handleMenuNavigation(Ao.MENU_NAVIGATION_DIRECTION.DOWN),t.stopPropagation(),t.preventDefault();break;case"Escape":e!==""?(this.setState({filter:""}),t.stopPropagation()):this.closeMenu();break;case"Tab":!t.shiftKey&&s===o.length-1&&this.closeMenu();break}}handleMenuNavigation(t){const{filter:e,filteredOptions:n,keyboardOptionIndex:s}=this.state,{options:i}=this.props,r=(e?n:i).length;let l=0;switch(t){case Ao.MENU_NAVIGATION_DIRECTION.UP:l=-1;break;case Ao.MENU_NAVIGATION_DIRECTION.DOWN:l=1;break}l!==0&&this.setState({keyboardOptionIndex:(s+l+r)%r})}handleInputKeyDown(t){const{onEnter:e}=this.props,{menuIsOpen:n}=this.state;t.key==="ArrowDown"||t.key==="ArrowUp"?n||this.openMenu():t.key==="Enter"&&e()}handleInputChange(t){this.updateInputValue(t.target.value)}handleOptionClick(t){var r;const e=Number(t.currentTarget.value),{filter:n,filteredOptions:s}=this.state,{options:i}=this.props,o=n?s:i;this.updateInputValue(o[e].value),this.closeMenu(),(r=this.input.current)==null||r.focus()}handleOptionFocus(t){this.setState({keyboardOptionIndex:Number(t.target.value)})}handleFilterChange(t){var i;const{options:e}=this.props,n=t.target.value,s=this.getCachedFilteredOptions(e,n);this.setState({filter:n,filteredOptions:s,keyboardOptionIndex:0}),(i=this.popper.current)==null||i.scheduleUpdate()}handleMenuBlur(t){t.relatedTarget instanceof Element&&this.popper.current!=null&&this.popper.current.element.contains(t.relatedTarget)||t.relatedTarget===this.toggleButton.current||this.closeMenu(!1)}handleInputBlur(t){const{menuIsOpen:e}=this.state;e&&t.relatedTarget instanceof Element&&this.popper.current!=null&&this.popper.current.element.contains(t.relatedTarget)||this.closeMenu(!1)}handleMenuOpened(){var t;this.scrollOptionIntoView(),(t=this.searchInput.current)==null||t.focus()}handleMenuExited(){var e;const{menuIsOpen:t}=this.state;t&&(this.setState({menuIsOpen:!1}),(e=this.popper.current)==null||e.hide()),this.setState({filter:""})}toggleMenu(t){const{menuIsOpen:e}=this.state;e?this.closeMenu():this.openMenu(),t.stopPropagation()}openMenu(){this.updateKeyboardIndex(),this.setInputWidth(),this.setState({menuIsOpen:!0}),window.requestAnimationFrame(()=>{var t;(t=this.popper.current)==null||t.show()})}closeMenu(t=!0){var e,n;this.setState({menuIsOpen:!1}),t&&((e=this.input.current)==null||e.focus()),(n=this.popper.current)==null||n.hide()}updateKeyboardIndex(){const{value:t,filter:e,filteredOptions:n}=this.state,{options:s}=this.props,o=(e?n:s).findIndex(r=>r.value===t);this.setState({keyboardOptionIndex:o})}scrollOptionIntoView(){var e;const t=(e=this.menuContainer.current)==null?void 0:e.querySelector(".cb-option-btn.keyboard-active");t instanceof HTMLElement&&t.scrollIntoView({block:"nearest",inline:"nearest"})}renderMenuElement(){const{searchPlaceholder:t}=this.props,{filter:e,inputWidth:n}=this.state;return T("div",{className:"cb-menu-container",ref:this.menuContainer,role:"presentation",onKeyDown:this.handleMenuKeyDown,onClick:s=>{s.stopPropagation()},style:{width:n},onBlur:this.handleMenuBlur,children:[h("div",{className:"cb-search-input-container",children:h(ws,{value:e,ref:this.searchInput,onChange:this.handleFilterChange,className:"cb-search-input",placeholder:t})}),h("div",{className:"cb-options-container",children:h("div",{className:"cb-options",children:this.renderOptions()})})]})}renderOptions(){const{options:t}=this.props,{keyboardOptionIndex:e,filter:n,filteredOptions:s}=this.state;return(n?s:t).map((o,r)=>{const l=`option-${r}-${o.value}`;return h("button",{type:"button",value:r,className:z("cb-option-btn",{"keyboard-active":e===r}),onClick:this.handleOptionClick,onFocus:this.handleOptionFocus,children:o.title},l)})}render(){const{options:t,inputPlaceholder:e,disabled:n,className:s,defaultValue:i,spellCheck:o,"data-testid":r}=this.props,{value:l}=this.state;let{popperOptions:a}=this.props;return a={placement:"bottom-end",modifiers:{preventOverflow:{enabled:!1}},...a},T("div",{className:"input-group cb-container",ref:this.cbContainer,children:[h("input",{value:l||i,className:z("form-control",s,"cb-input"),ref:this.input,onChange:this.handleInputChange,placeholder:e||(t[0]!=null?t[0].title:void 0),disabled:n,onBlur:this.handleInputBlur,onKeyDown:this.handleInputKeyDown,spellCheck:o,"data-testid":r!==void 0?`${r}-input`:void 0}),h("div",{className:"input-group-append cb-dropdown",children:T("button",{type:"button",className:"btn cb-btn form-control",ref:this.toggleButton,onClick:this.toggleMenu,onKeyDown:this.handleInputKeyDown,disabled:n,"data-testid":r!==void 0?`${r}-btn`:void 0,children:[h(ee,{icon:Yn}),h(kn,{ref:this.popper,options:a,className:z("combobox interactive"),onEntered:this.handleMenuOpened,onExited:this.handleMenuExited,children:this.renderMenuElement()})]})})]})}};let ao=Ao;ao.MENU_NAVIGATION_DIRECTION=Ku;ao.DROP_DOWN_MENU_HEIGHT=200;ao.propTypes={options:D.exports.arrayOf(D.exports.shape({title:D.exports.string.isRequired,value:D.exports.string.isRequired})).isRequired,popperOptions:D.exports.shape({title:D.exports.string.isRequired,value:D.exports.string.isRequired}),onChange:D.exports.func,inputPlaceholder:D.exports.string,searchPlaceholder:D.exports.string,disabled:D.exports.bool,className:D.exports.string,defaultValue:D.exports.string,spellCheck:D.exports.bool,onEnter:D.exports.func,"data-testid":D.exports.string};ao.defaultProps={onChange(){},inputPlaceholder:"",searchPlaceholder:"Search",disabled:!1,className:"",defaultValue:"",popperOptions:null,spellCheck:!0,onEnter(){},"data-testid":void 0};function Pl({copy:t,kind:e="ghost",tooltip:n="Copy",className:s,"data-testid":i,children:o}){const[r,l]=Nb();return h(W,{kind:e,className:s,"data-testid":i,icon:r?$C:IC,tooltip:r?"Copied":n,onClick:()=>{l(typeof t=="function"?t():t)},children:o})}const In=Z.module("MaskedInput"),xi={FORWARD:"forward",BACKWARD:"backward",NONE:"none"},Or="\u2007";function kd(t,e,n){return t.substring(0,e)+n+t.substring(e+1)}function Fb(t,e,n){return t.length<n?`${t}${e.substring(t.length,n)}`:t}function jc(t,e){let{length:n}=t;for(let s=t.length-1;s>=0&&e[s]===t[s];s-=1)n=s;return t.substring(0,n)}const Hl=X.forwardRef((t,e)=>{const{className:n,example:s,getNextSegmentValue:i=(x,A,k)=>k,getPreferredReplacementString:o=kd,onChange:r=()=>!1,onSelect:l=()=>!1,pattern:a,placeholder:d,selection:c,value:u,onFocus:m=()=>!1,onBlur:p=()=>!1,"data-testid":g}=t,f=Gu(e),b=w.exports.useMemo(()=>Array.isArray(s)?s:[s],[s]),C=w.exports.useMemo(()=>b[0].replace(/[a-zA-Z0-9]/g,Or),[b]);w.exports.useEffect(function(){var A;if(c!=null){In.debug("setting selection...",c);const{selectionStart:k,selectionEnd:G,selectionDirection:V}=c;(A=f.current)==null||A.setSelectionRange(k,G,V),In.debug("selection set!")}},[c,f]);const S=w.exports.useCallback(x=>{let A=x,k=x;const G=b.length>0?b[0]:u;for(let O=A-1;O>=0&&/[a-zA-Z0-9]/g.test(G.charAt(O));O-=1)A=O;for(let O=k;O<G.length&&/[a-zA-Z0-9]/g.test(G.charAt(O));O+=1)k=O+1;const V=A===k?xi.NONE:xi.BACKWARD;return{selectionStart:A,selectionEnd:k,selectionDirection:V}},[b,u]);function v(x,A,k=x.length){let G="";for(let V=0;V<k;V+=1)x.charAt(V)!==Or?G=G.concat(x[V]):G=G.concat(A[V]);return G=G.concat(A.substring(k)),G}function y(x,A=x.length){const k=new RegExp(`^${a}$`);if(k.test(x))return!0;for(let G=0;G<b.length;G+=1){const V=v(x,b[G],A);if(k.test(V))return!0}return!1}function E(x){const A=S(x),k=A.selectionEnd+1;return k>=u.length?A:S(k)}function I(x){const A=S(x),k=A.selectionStart-1;return k<=0?A:S(k)}function R(x,A){const k=S(x),G=u.substring(k.selectionStart,k.selectionEnd),V=i(k,A,G,u),O=u.substring(0,k.selectionStart)+V+u.substring(k.selectionEnd);y(O,k.selectionEnd)&&(r(O),l(k))}const N=w.exports.useCallback(x=>{const{selectionStart:A=0,selectionEnd:k=0,selectionDirection:G="none"}=x.target;if(A===null||k===null||G===null){In.error("Selection attempted on non-text input element",x.target);return}if(In.debug2("handleSelect",A,k,G),!(c!=null&&A===c.selectionStart&&k===c.selectionEnd)){if(c!=null&&A===u.length&&k===u.length&&x.nativeEvent.type!=="mouseup"){l({...c});return}if(A===k){const V=S(A);In.debug("Selection segment from ",A,k,"=>",V),l(V)}else l({selectionStart:A,selectionEnd:k,selectionDirection:G})}},[S,l,c,u]),F=w.exports.useCallback(x=>{var k;if(!f.current)return;In.debug("handleSelectCapture",x);const A=(k=f.current.selectionStart)!=null?k:0;A===u.length&&c!=null&&A!==c.selectionStart&&(x.preventDefault(),x.stopPropagation())},[f,c,u]);function P(x){if(x.preventDefault(),x.stopPropagation(),!f.current)return;const{key:A}=x,{selectionStart:k=0,selectionEnd:G=0}=f.current;if(k===null||G===null){In.error("Selection arrow nvaigation attempted on non-text input element",x.target);return}A==="ArrowLeft"?l(I(k)):A==="ArrowRight"?l(E(G)):A==="ArrowUp"?R(k,-1):A==="ArrowDown"&&R(k,1)}function H(x){if(!f.current)return;In.debug("handleKeyDown",x);const{key:A}=x,{selectionStart:k=0,selectionEnd:G=0}=f.current;if(k===null||G===null){In.error("Selection key event on non-text input element",x.target);return}if(A.startsWith("Arrow")){P(x);return}if(A==="Delete"||A==="Backspace"){if(x.preventDefault(),x.stopPropagation(),G>=jc(u,C).length){const O=u.substring(0,k===G?k-1:k),$=jc(O,C);$!==u&&(r($),l({selectionStart:$.length,selectionEnd:$.length,selectionDirection:xi.NONE}));return}if(k!==G){const O=u.substring(0,k)+u.substring(k,G).replace(/[a-zA-Z0-9]/g,Or)+u.substring(G);In.debug("Range ",k,G,"deleted, setting value",O),r(O),l({selectionStart:k,selectionEnd:k,selectionDirection:xi.NONE})}else if(k>0)for(let O=k-1;O>=0;O-=1){const $=u.substring(0,O)+u.substring(O,k).replace(/[a-zA-Z0-9]/g,Or)+u.substring(k);if($!==u){r($),l({selectionStart:O,selectionEnd:O,selectionDirection:xi.NONE});return}}return}if(x.altKey||x.metaKey||x.ctrlKey||A.length>1)return;x.preventDefault(),x.stopPropagation();const V=Array.from(new Set([A,A.toUpperCase(),A.toLowerCase()]));for(let O=0;O<V.length;O+=1){const $=V[O],Y=/[a-zA-Z0-9]/g.test($)?b[0].length-1:k;for(let Q=k;Q<=Y;Q+=1){const U=Fb(u,b[0],Q+1),q=o(U,Q,$,k,G);if(y(q,Q+1)){const j=S(Q),te=Q+1;let ce={selectionStart:te,selectionEnd:te,selectionDirection:xi.NONE};if(te>=j.selectionEnd){const ne=E(Q);ne.selectionStart!==j.selectionStart&&(ce=ne)}In.debug("handleKeyDown",A,"=>",q,ce),r(q),l(ce);return}}}}return h("input",{ref:f,className:z("form-control masked-input",n),type:"text",pattern:a,placeholder:d,value:u,onChange:()=>{},onKeyDown:H,onSelect:N,onSelectCapture:F,onFocus:m,onBlur:p,"data-testid":g})});Hl.defaultProps={className:"",placeholder:void 0,onChange(){},onSelect(){},getNextSegmentValue:(t,e,n)=>n,getPreferredReplacementString:kd,selection:void 0,onFocus(){},onBlur(){},"data-testid":void 0};const xb=Z.module("TimeInput"),_b="([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]",kb=["00:00:00","12:34:56","23:59:59"],qu=X.forwardRef((t,e)=>{const{allowValueWrapping:n=!0,className:s="",onChange:i=()=>!1,value:o=0,onFocus:r=()=>!1,onBlur:l=()=>!1,onSelect:a=()=>!1,"data-testid":d}=t,[c,u]=w.exports.useState(Dn.formatTime(o)),[m,p]=w.exports.useState(),g=w.exports.useRef(null);w.exports.useImperativeHandle(e,()=>({focus:()=>{var v;(v=g.current)==null||v.focus()},setSelection:v=>{var y;(y=g.current)==null||y.focus(),p(v)}}),[]),w.exports.useEffect(function(){u(Dn.formatTime(o))},[o]);function f(v,y,E){const I=v.selectionStart===0?24:60;let R=parseInt(E,10)-y;return Number.isNaN(R)?R=0:n?R=(R%I+I)%I:R=Math.min(Math.max(0,R),I-1),`${R}`.padStart(2,"0")}function b(v,y,E,I,R){return I===0&&R===2&&y===1&&parseInt(E,10)>1?`0${E}${v.substring(2)}`:kd(v,y,E)}function C(v){xb.debug("handleChange",v),u(v),Dn.isTimeString(v)&&i(Dn.parseTime(v))}const S=w.exports.useCallback(v=>{p(v),a(v)},[a]);return h(Hl,{ref:g,className:s,example:kb,getNextSegmentValue:f,getPreferredReplacementString:b,onChange:C,onSelect:S,pattern:_b,selection:m,value:c,onFocus:r,onBlur:l,"data-testid":d})});qu.defaultProps={allowValueWrapping:!0,className:"",onChange:()=>!1,onSelect:()=>!1,value:0,onFocus:()=>!1,onBlur:()=>!1,"data-testid":void 0};class Yu extends w.exports.PureComponent{constructor(e){var i;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=X.createRef(),this.oldFocus=document.activeElement,this.rAF=0;const{options:n}=e,s=(i=n.initialKeyboardIndex)!=null?i:-1;this.state={menuItems:[],keyboardIndex:s,mouseIndex:-1}}componentDidMount(){this.initMenu(),this.rAF=window.requestAnimationFrame(()=>{var n;(n=this.container.current)==null||n.focus();const{onMenuOpened:e}=this.props;e(this)})}componentDidUpdate(e){const{actions:n}=this.props;e.actions!==n&&this.initMenu()}componentWillUnmount(){cancelAnimationFrame(this.rAF)}getKeyboardIndex(){const{options:e}=this.props;if(e.separateKeyboardMouse!==void 0&&e.separateKeyboardMouse){const{keyboardIndex:n}=this.state;return n}return this.getMouseIndex()}setKeyboardIndex(e){const{options:n}=this.props;n.separateKeyboardMouse!==void 0&&n.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,n=Ge.getMenuItems(e,!1);n.length>0&&this.setState(s=>({menuItems:Ge.sortActions(s.menuItems.concat(n))}))}handleKeyDown(e){const{menuItems:n}=this.state,s=this.getKeyboardIndex();let i=s;if(e.key==="Enter"||e.key===" "){s!=null&&s>=0&&s<n.length&&this.handleMenuItemClick(n[s],e);return}e.key==="Escape"?i=null:e.key==="ArrowUp"||e.key==="Tab"&&e.shiftKey===!0?i=Ge.getNextMenuItem(i!=null?i:0,-1,n):(e.key==="ArrowDown"||e.key==="Tab"&&e.shiftKey===!1)&&(i=Ge.getNextMenuItem(i!=null?i:0,1,n)),s!==i&&(i!==null?this.setKeyboardIndex(i):(this.closeMenu(),this.oldFocus instanceof HTMLElement&&this.oldFocus.focus()),e.preventDefault(),e.stopPropagation())}closeMenu(e=!1){const{closeMenu:n,onMenuClosed:s}=this.props;cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{n(e),s(this)})}handleCloseMenu(){this.closeMenu()}handleMenuItemClick(e,n){n.preventDefault(),n.stopPropagation(),e!=null&&(e.disabled===void 0||!e.disabled)&&e.action!=null&&(e.action(),this.closeMenu(!0))}handleMenuItemMouseMove(e){const{menuItems:n}=this.state,s=n.indexOf(e);this.setMouseIndex(s)}handleMouseLeave(){this.setMouseIndex(-1)}render(){const e=[],{"data-testid":n}=this.props,{keyboardIndex:s,menuItems:i,mouseIndex:o}=this.state;for(let l=0;l<i.length;l+=1){const a=i[l];l>0&&a.group!==i[l-1].group&&e.push(h("hr",{},`${l}.separator`));const d=h(Ol,{isKeyboardSelected:s===l,isMouseSelected:o===l,menuItem:a,closeMenu:this.handleCloseMenu,onMenuItemClick:this.handleMenuItemClick,onMenuItemMouseMove:this.handleMenuItemMouseMove,onMenuItemContextMenu:()=>!1},l);e.push(d)}const{menuStyle:r}=this.props;return h("div",{className:"context-menu-container",style:{...r},ref:this.container,onKeyDown:this.handleKeyDown,onMouseLeave:this.handleMouseLeave,role:"menuitem",tabIndex:0,"data-testid":n,children:e})}}Yu.defaultProps={closeMenu(){},onMenuOpened(){},onMenuClosed(){},options:{},menuStyle:{},"data-testid":void 0};class Fn extends w.exports.PureComponent{constructor(e){super(e),this.handleClick=this.handleClick.bind(this),this.handleCloseMenu=this.handleCloseMenu.bind(this),this.handleExited=this.handleExited.bind(this),this.container=X.createRef(),this.parent=null,this.popper=X.createRef(),this.isOpen=!1}componentDidMount(){var n;const{isShown:e}=this.props;e===null?(n=this.container.current)!=null&&n.parentElement&&(this.parent=this.container.current.parentElement,this.parent.addEventListener("click",this.handleClick)):e&&this.openMenu()}componentDidUpdate(e){const{isShown:n}=this.props;e.isShown!==n&&(n!==null&&n?window.requestAnimationFrame(()=>{this.openMenu()}):this.closeMenu())}componentWillUnmount(){this.parent&&this.parent.removeEventListener("click",this.handleClick)}closeMenu(){var e;(e=this.popper.current)==null||e.hide()}openMenu(){this.popper.current&&!this.isOpen&&(this.popper.current.show(),this.isOpen=!0)}scheduleUpdate(){var e;(e=this.popper.current)==null||e.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:n,popperClassName:s,"data-testid":i}=this.props,{menuStyle:o}=this.props;let{options:r,popperOptions:l}=this.props;return l={placement:"bottom",...l},r={separateKeyboardMouse:!0,...r},h("div",{className:"menu-actions-listener",ref:this.container,"data-testid":i,children:h(kn,{ref:this.popper,options:l,className:z("menu-popper",s),onExited:this.handleExited,closeOnBlur:!0,interactive:!0,children:h(Yu,{actions:e,closeMenu:this.handleCloseMenu,onMenuOpened:n,options:r,menuStyle:o})})})}}Fn.defaultProps={isShown:null,onMenuClosed(){},onMenuOpened(){},options:{},popperOptions:{},popperClassName:"",menuStyle:{},"data-testid":void 0};const Zc=-1;var Xu=(t=>(t.UP="UP",t.DOWN="DOWN",t))(Xu||{});const ds=class extends w.exports.Component{constructor(t){super(t);const{value:e,valueToTime:n}=t;this.toggleMenu=this.toggleMenu.bind(this),this.handleMenuKeyDown=this.handleMenuKeyDown.bind(this),this.closeMenu=this.closeMenu.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.handleCustomInput=this.handleCustomInput.bind(this),this.csContainer=X.createRef(),this.menuContainer=X.createRef(),this.button=X.createRef(),this.input=X.createRef(),this.state={keyboardOptionIndex:0,menuIsOpen:!1,inputWidth:100,customTime:n(e),inputFocused:!1}}getSelectedText(){const{options:t,value:e,placeholder:n}=this.props,{customTime:s}=this.state;if(e===null)return n;for(let i=0;i<t.length;i+=1){const o=t[i];if(o.value===e)return o.title}return Dn.formatTime(s)}setInputWidth(){this.csContainer.current&&this.setState({inputWidth:this.csContainer.current.getBoundingClientRect().width})}focus(){var t;(t=this.button.current)==null||t.focus()}updateInputValue(t){const{onChange:e}=this.props;e(t)}handleResize(){this.setInputWidth()}handleMenuKeyDown(t){var i;const{keyboardOptionIndex:e,inputFocused:n}=this.state,{options:s}=this.props;switch(t.key){case"Enter":case" ":n?this.updateFromCustom():this.updateInputValue(s[e].value),this.closeMenu(),(i=this.button.current)==null||i.focus(),t.stopPropagation(),t.preventDefault();break;case"Tab":t.shiftKey?this.handleMenuNavigation(ds.MENU_NAVIGATION_DIRECTION.UP):this.handleMenuNavigation(ds.MENU_NAVIGATION_DIRECTION.DOWN),t.stopPropagation(),t.preventDefault();break;case"ArrowUp":this.handleMenuNavigation(ds.MENU_NAVIGATION_DIRECTION.UP),t.stopPropagation(),t.preventDefault();break;case"ArrowDown":this.handleMenuNavigation(ds.MENU_NAVIGATION_DIRECTION.DOWN),t.stopPropagation(),t.preventDefault();break;case"Escape":this.closeMenu();break}}handleMenuNavigation(t){const{keyboardOptionIndex:e,inputFocused:n}=this.state,{options:s}=this.props,i=s.length;let o=e;switch(t){case ds.MENU_NAVIGATION_DIRECTION.UP:if(!n&&e===0){this.focusInput();break}else n&&this.focusOption(e);e>0&&!n?(o=(o-1)%i,this.setState({keyboardOptionIndex:o})):e===0&&(o=i-1,this.setState({keyboardOptionIndex:o})),this.scrollOptionIntoView(o);break;case ds.MENU_NAVIGATION_DIRECTION.DOWN:if(!n&&e===i-1){this.focusInput();break}else n&&this.focusOption(e);e<i&&!(n&&e===0)&&(o=(o+1)%i,this.setState({keyboardOptionIndex:o})),this.scrollOptionIntoView(o);break}}handleOptionClick(t){const e=Number(t.currentTarget.value),{options:n,timeToValue:s}=this.props,{customTime:i}=this.state;if(e===Zc){const o=s(i);this.updateAndClose(o)}else this.updateAndClose(n[e].value)}updateAndClose(t){var e;this.updateInputValue(t),this.closeMenu(),(e=this.button.current)==null||e.focus()}handleOptionFocus(t){this.setState({keyboardOptionIndex:Number(t.target.value)})}handleMenuOpened(){var o;const{options:t,value:e}=this.props,{keyboardOptionIndex:n}=this.state;this.scrollOptionIntoView(n);const s=(o=this.menuContainer.current)==null?void 0:o.querySelector(".cs-option-btn.keyboard-active");if(s instanceof HTMLElement&&s.focus(),e===null)return;t.map(r=>r.value).indexOf(e)<0&&this.focusInput()}focusInput(){var t;(t=this.input.current)==null||t.focus()}focusOption(t){var n;const e=(n=this.menuContainer.current)==null?void 0:n.querySelector(".cs-options");if(e&&e.children!=null){const s=e.children.item(t);s instanceof HTMLElement&&s.focus()}}handleMenuExited(){const{menuIsOpen:t}=this.state;t&&this.setState({menuIsOpen:!1,keyboardOptionIndex:0})}handleCustomInput(t){const{timeToValue:e}=this.props,n=e(t);this.updateInputValue(n),this.setState({customTime:t})}updateFromCustom(){const{timeToValue:t}=this.props,{customTime:e}=this.state,n=t(e);this.updateInputValue(n)}toggleMenu(t){const{menuIsOpen:e}=this.state;e?this.closeMenu():this.openMenu(),t.stopPropagation()}openMenu(){this.updateKeyboardIndex(),this.setInputWidth(),this.setState({menuIsOpen:!0})}closeMenu(t=!0){var e;this.setState({menuIsOpen:!1}),t&&((e=this.button.current)==null||e.focus())}updateKeyboardIndex(){const{options:t,value:e}=this.props;if(e===null)return;const n=t.map(s=>s.value).indexOf(e);n>0&&this.setState({keyboardOptionIndex:n})}scrollOptionIntoView(t){var n;const e=(n=this.menuContainer.current)==null?void 0:n.querySelector(".cs-options");if(e&&e.children!=null){const s=e.children.item(t);s instanceof HTMLElement&&s.offsetTop>ds.DROP_DOWN_MENU_HEIGHT?e.scrollTop=s.offsetTop-ds.DROP_DOWN_MENU_HEIGHT:(s instanceof HTMLElement&&s.offsetTop<0||t===0)&&(e.scrollTop=0)}}renderMenuElement(){const{inputWidth:t}=this.state;return h("div",{className:"cs-menu-container",ref:this.menuContainer,role:"presentation",onKeyDown:this.handleMenuKeyDown,onClick:e=>{e.stopPropagation()},style:{width:t},children:h("div",{className:"cs-options-container",children:h("div",{className:"cs-options",children:this.renderOptions()})})})}renderOptions(){const{options:t,value:e,icon:n,customText:s}=this.props,{keyboardOptionIndex:i,customTime:o,inputFocused:r}=this.state;let l=!1;const a=[];for(let d=0;d<t.length;d+=1){const c=t[d],u=`option-${d}-${c.value}`;l=l||c.value===e,a.push(T("button",{type:"button",value:d,className:z("cs-option-btn",{"keyboard-active":i===d&&!r}),onClick:this.handleOptionClick,onFocus:this.handleOptionFocus,children:[c.value===e&&h(ee,{icon:n,className:"mr-2"}),c.value!==e&&h("span",{className:"mr-4"}),c.title]},u))}return a.push(h("hr",{className:"cs-divider"},"option-divider")),a.push(T("button",{type:"button",value:Zc,className:z("cs-option-btn",{"keyboard-active":r}),onClick:this.handleOptionClick,onFocus:this.handleOptionFocus,children:[!l&&e!==null?h(ee,{icon:n,className:"mr-2"}):h("span",{className:"mr-4"}),s]},"option-custom-label")),a.push(T("div",{className:"cs-custom-container",children:[h("span",{className:"mr-2"}),h(qu,{ref:this.input,onChange:this.handleCustomInput,value:o,onFocus:()=>this.setState({inputFocused:!0}),onBlur:()=>this.setState({inputFocused:!1})},"option-input"),h("span",{className:"ml-2"})]},"cs-custom-container")),a.push(h("hr",{className:"mb-2"},"option-end")),a}render(){const{disabled:t,invalid:e,value:n,"data-testid":s}=this.props,{menuIsOpen:i}=this.state;let{popperOptions:o}=this.props;return o={placement:"bottom-end",modifiers:{preventOverflow:{enabled:!1}},...o},h("div",{className:"input-group cs-container context-menu",ref:this.csContainer,"data-testid":s,children:h("div",{className:z("input-group-append cs-dropdown",{"cs-dropdown-invalid":e}),children:T("button",{type:"button",className:z("btn cs-btn form-control",{"cs-btn-invalid":e}),ref:this.button,onClick:this.toggleMenu,disabled:t,children:[h("span",{className:z({"text-muted":n===null}),children:this.getSelectedText()}),h("span",{children:h(ee,{icon:Fd,className:"cs-caret"})}),h(Fn,{isShown:i,actions:{menuElement:this.renderMenuElement()},popperOptions:o,popperClassName:"CustomTimeSelect",onMenuOpened:this.handleMenuOpened,onMenuClosed:this.handleMenuExited,menuStyle:{maxWidth:"100rem"}})]})})})}};let Od=ds;Od.MENU_NAVIGATION_DIRECTION=Xu;Od.DROP_DOWN_MENU_HEIGHT=125;Od.defaultProps={onChange(){},value:null,disabled:!1,popperOptions:{},icon:jn,customText:"Custom",placeholder:"Select a time",valueToTime:t=>t===null?0:Math.round(t/1e3),timeToValue:t=>t*1e3,invalid:!1,"data-testid":void 0};function _i(t,e,n,s,i){const o=s-n+1;return`${((parseInt(e,10)-t-n)%o+o)%o+n}`.padStart(i,"0")}function ju(t,e,n){const{selectionStart:s}=t;return s===0?_i(e,n,1900,2099,4):s===5?_i(e,n,1,12,2):s===8?_i(e,n,1,31,2):s===11?_i(e,n,0,23,2):s===17||s===14?_i(e,n,0,59,2):s===20||s===24||s===28?_i(e,n,0,999,3):n}const Ob=Z.module("DateTimeInput"),Lb="[12][0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])",Ab="([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]\\.[0-9]{3}\u200B[0-9]{3}\u200B[0-9]{3}",Pb=`${Lb} ${Ab}`,Jr="2022-01-01",Zu=`${Jr} 00:00:00.000000000`,Hb="YYYY-MM-DD HH:MM:SS.SSSSSSSSS";function Qc(t){return t!=null&&t.length>=Jr.length?`${t.substring(0,Jr.length)}${t.substring(Jr.length).replace(/\u2007/g,"0")}${Zu.substring(t.length)}`:t}function Ka(t){const e=t.substring(0,23),n=t.substring(23,26),s=t.substring(26);return[e,n,s].filter(i=>i!=="").join("\u200B")}const Jc=t=>t.replace(/\u200B/g,""),Vb=[Ka(Zu)],Ld=X.forwardRef((t,e)=>{const{className:n="",onChange:s=()=>{},defaultValue:i="",onFocus:o=()=>{},onBlur:r=()=>{},"data-testid":l}=t,[a,d]=w.exports.useState(i.length>0?Ka(i):""),[c,u]=w.exports.useState(),m=w.exports.useCallback(g=>{Ob.debug("handleChange",g),d(g),s(Qc(Jc(g)))},[s]),p=w.exports.useCallback(()=>{const g=Jc(a),f=Qc(g);f!==g&&d(Ka(f)),r()},[a,r]);return h("div",{className:"d-flex flex-row align-items-center",children:h(Hl,{ref:e,className:z(n),example:Vb,getNextSegmentValue:ju,onChange:m,onSelect:u,pattern:Pb,placeholder:Hb,selection:c,value:a,onFocus:o,onBlur:p,"data-testid":l})})});Ld.displayName="DateTimeInput";Ld.defaultProps={className:"",onChange:()=>{},defaultValue:"",onFocus:()=>{},onBlur:()=>{},"data-testid":void 0};const Ub=Z.module("DateInput"),Bb="[12][0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])",$b=["2000-01-01","2022-12-31"],zb="YYYY-MM-DD",Qu=X.forwardRef((t,e)=>{const{className:n="",onChange:s=()=>{},defaultValue:i="",onFocus:o=()=>{},onBlur:r=()=>{},"data-testid":l}=t,[a,d]=w.exports.useState(i),[c,u]=w.exports.useState(),m=w.exports.useCallback(p=>{Ub.debug("handleChange",p),d(p),s(p)},[s]);return h("div",{className:"d-flex flex-row align-items-center",children:h(Hl,{ref:e,className:z(n),example:$b,getNextSegmentValue:ju,onChange:m,onSelect:u,pattern:Bb,placeholder:zb,selection:c,value:a,onFocus:o,onBlur:r,"data-testid":l})})});Qu.displayName="DateInput";Qu.defaultProps={className:"",onChange:()=>!1,defaultValue:"",onFocus:()=>!1,onBlur:()=>!1,"data-testid":void 0};class Ju extends w.exports.PureComponent{constructor(e){super(e),this.searchInput=X.createRef(),this.handleChange=this.handleChange.bind(this),this.sendUpdate=Ze(this.sendUpdate.bind(this),e.debounceMs),this.state={value:e.value}}componentDidUpdate(e){const{value:n}=this.props;e.value!==n&&this.setState({value:n})}focus(){var e;(e=this.searchInput.current)==null||e.focus()}handleChange(e){this.setState({value:e.target.value},this.sendUpdate)}sendUpdate(){const{onChange:e}=this.props,{value:n}=this.state;e(n)}render(){const{placeholder:e,className:n,matchCount:s,id:i,"data-testid":o}=this.props,{value:r}=this.state;return h(ws,{value:r,placeholder:e,onChange:this.handleChange,className:n,matchCount:s,ref:this.searchInput,id:i,"data-testid":o})}}Ju.defaultProps={placeholder:"Search",className:"",matchCount:null,debounceMs:250,id:"","data-testid":void 0};const Wb=Z.module("ItemListItem"),em=class extends w.exports.Component{constructor(t){super(t),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=X.createRef()}static handleKeyDown(){return Wb.log("ItemListItem.handleKeyDown false"),!1}handleBlur(t){const{itemIndex:e,onBlur:n}=this.props;n(e,t)}handleFocus(t){const{itemIndex:e,onFocus:n}=this.props;n(e,t)}handleClick(t){const{itemIndex:e,onClick:n}=this.props;n(e,t)}handleContextMenu(t){const{itemIndex:e,onContextMenu:n}=this.props;n(e,t)}handleDragStart(t){const{itemIndex:e,onDragStart:n}=this.props;n(e,t)}handleDrag(t){const{itemIndex:e,onDrag:n}=this.props;n(e,t)}handleDragOver(t){t.preventDefault();const{itemIndex:e,onDragOver:n}=this.props;n(e,t)}handleDragEnd(t){const{itemIndex:e,onDragEnd:n}=this.props;n(e,t)}handleDrop(t){const{itemIndex:e,onDrop:n}=this.props;n(e,t)}handleDoubleClick(t){const{itemIndex:e,onDoubleClick:n}=this.props;n(e,t)}handleMouseMove(t){const{itemIndex:e,onMouseMove:n}=this.props;n(e,t)}handleMouseDown(t){const{itemIndex:e,onMouseDown:n}=this.props;n(e,t)}handleMouseUp(t){const{itemIndex:e,onMouseUp:n}=this.props;n(e,t)}render(){const{isDraggable:t,isFocused:e,isSelected:n,style:s,children:i,"data-testid":o}=this.props;return h("div",{className:z("item-list-item",{active:n},{"is-focused":e},{"is-draggable":t}),onKeyDown:em.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:t,"data-testid":o,children:i})}};let tm=em;tm.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:{}};const eh=Z.module("ItemList"),qi=class extends w.exports.PureComponent{constructor(t){super(t),this.getItemSelected=be((s,i)=>bn.isSelected(i,s),{max:qi.CACHE_SIZE}),this.getCachedItem=be((s,i,o,r,l,a,d,c)=>{const u=a({item:o,itemIndex:s,isFocused:r,isSelected:l,style:d});return h(tm,{onContextMenu:this.handleItemContextMenu,onDoubleClick:this.handleItemDoubleClick,onMouseDown:this.handleItemMouseDown,onFocus:this.handleItemFocus,onBlur:this.handleItemBlur,disableSelect:c,onMouseMove:this.handleItemMouseMove,onMouseUp:this.handleItemMouseUp,isFocused:r,isSelected:l,itemIndex:s,style:d,children:u},i)},{max:qi.CACHE_SIZE}),this.getOuterElement=be(s=>{const i=X.forwardRef((o,r)=>h("div",{ref:r,tabIndex:-1,onKeyDown:s,role:"presentation",...o}));return i.displayName="ItemListOuterElement",i}),this.getInnerElement=be(()=>{const s=X.forwardRef((i,o)=>h("div",{className:"item-list-inner-element",ref:o,...i}));return s.displayName="ItemListInnerElement",s}),this.getItemData=be((s,i,o)=>({items:s,selectedRanges:i,renderItem:o})),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=X.createRef(),this.listContainer=X.createRef();const{isStickyBottom:e,selectedRanges:n}=t;this.state={focusIndex:null,mouseDownIndex:null,selectedRanges:n,overscanStartIndex:0,height:null,isDragging:!1,isStuckToBottom:e,scrollOffset:null}}static renderItem({item:t}){var e,n;return h("div",{className:"item-list-item-content",children:t!=null&&((n=(e=t.displayValue)!=null?e:t.value)!=null?n:`${t}`)})}componentDidUpdate(t,e){const{selectedRanges:n,itemCount:s}=this.props,{focusIndex:i,isStuckToBottom:o,scrollOffset:r,height:l,selectedRanges:a}=this.state;if(o&&!this.isListAtBottom()&&s>0&&this.scrollToBottom(),(r!==e.scrollOffset||l!==e.height)&&this.sendViewportUpdate(),n!==t.selectedRanges&&n!==a)this.setSelectedRanges(n);else if(a!==e.selectedRanges){const{onSelectionChange:d}=this.props;d(a)}if(i!==e.focusIndex){const{onFocusChange:d}=this.props;d(i)}}componentWillUnmount(){window.removeEventListener("mouseup",this.handleWindowMouseUp)}focus(){var t;(t=this.listContainer.current)==null||t.focus()}restoreScrollPosition(){var e;const{scrollOffset:t}=this.state;t!=null&&((e=this.listContainer.current)==null||e.scrollTo(0,t))}getElement(t){if(this.listContainer.current==null)return null;const{focusSelector:e}=this.props,{overscanStartIndex:n}=this.state,s=this.listContainer.current.querySelectorAll(e),i=t-n;return s[i]}focusItem(t){const{disableSelect:e}=this.props;if(e)return;this.setState({focusIndex:t});const n=this.getElement(t);n instanceof HTMLElement&&n.focus()}scrollToItem(t){const e=this.getElement(t);e!=null&&e.scrollIntoView({block:"center"})}handleItemContextMenu(t,e){const{selectedRanges:n}=this.state,i=bn.isSelected(n,t)||Ge.isModifierKeyDown(e);this.toggleSelect(t,e.shiftKey,i,!1)}handleItemDoubleClick(t,e){const{isDoubleClickSelect:n,onSelect:s}=this.props;n&&this.setState(({selectedRanges:i})=>({selectedRanges:bn.selectRange(i,[t,t])}),()=>{s(t,e)})}handleItemMouseDown(t,e){const{selectedRanges:n}=this.state;if(!(e.target instanceof HTMLElement&&["button","select","input","textarea"].indexOf(e.target.tagName.toLowerCase())!==-1)){if(e.button===2&&n.length===0){this.focusItem(t),this.selectItem(t);return}e.button!=null&&e.button!==0||(this.setState({mouseDownIndex:t}),window.addEventListener("mouseup",this.handleWindowMouseUp))}}handleItemBlur(t,e){eh.debug2("item blur",t,e.currentTarget,e.relatedTarget),(!e.relatedTarget||this.listContainer.current&&e.relatedTarget instanceof HTMLElement&&!this.listContainer.current.contains(e.relatedTarget))&&this.setState({focusIndex:null})}handleItemFocus(t,e){eh.debug2("item focus",t,e.target),this.setState(n=>{const{focusIndex:s}=n;return s!==t?{focusIndex:t}:null})}handleItemMouseMove(t,e){const{isDragSelect:n,isMultiSelect:s,disableSelect:i}=this.props,{mouseDownIndex:o,selectedRanges:r}=this.state;o==null||i||(this.setState({isDragging:!0}),(n||o===t)&&(this.focusItem(t),s?(!n&&!this.getItemSelected(t,r)&&!Ge.isModifierKeyDown(e)&&this.deselectAll(),this.selectRange([Math.min(o,t),Math.max(o,t)])):this.toggleSelect(t,e.shiftKey,Ge.isModifierKeyDown(e),!1)))}handleItemMouseUp(t,e){const{isDeselectOnClick:n,isDoubleClickSelect:s,onSelect:i}=this.props,{mouseDownIndex:o,isDragging:r}=this.state;if(!(e.target instanceof HTMLElement&&["button","select","input","textarea"].indexOf(e.target.tagName.toLowerCase())!==-1)){if(o===t&&!r){const l=e.shiftKey,a=Ge.isModifierKeyDown(e);this.focusItem(t),this.toggleSelect(t,l,a,n),!s&&!l&&!a&&i(t,e)}this.resetMouseState()}}handleItemsRendered({overscanStartIndex:t}){this.setState({overscanStartIndex:t})}handleResize({height:t}){this.setState({height:t})}handleMouseLeave(){this.setState({mouseDownIndex:null})}handleWindowMouseUp(){this.resetMouseState(),window.removeEventListener("mouseup",this.handleWindowMouseUp)}handleKeyDown(t){var r;const{isMultiSelect:e,itemCount:n,onSelect:s}=this.props,{focusIndex:i}=this.state;let o=i;if(t.key==="Enter"||t.key===" "){!e&&o!=null&&this.setState({selectedRanges:[[o,o]]},()=>{o!=null&&s(o,t)});return}if(t.key==="ArrowUp")o!=null&&o>=0?o=Math.max(0,o-1):o=n-1;else if(t.key==="ArrowDown")o!=null&&o>=0?o=Math.min(o+1,n-1):o=0;else return;if(i!==o){t.stopPropagation(),t.preventDefault(),this.focusItem(o);const{selectedRanges:l}=this.state;if(t.shiftKey&&l.length>0){const a=l[l.length-1];this.selectRange([Math.min(o,a[0]),Math.max(o,a[1])])}else this.deselectAll(),o!==null?this.selectItem(o):(r=this.listContainer.current)==null||r.focus();this.scrollIntoView(o)}}handleScroll({scrollUpdateWasRequested:t,scrollOffset:e}){this.setState(n=>{if(t)return{scrollOffset:e};const{isStickyBottom:s}=this.props,{height:i}=n;return{isStuckToBottom:s&&this.isListAtBottom({scrollOffset:e,height:i}),scrollOffset:e}})}resetMouseState(){this.setState({mouseDownIndex:null,isDragging:!1})}scrollToBottom(){const{itemCount:t}=this.props;this.list.current&&this.list.current.scrollToItem(t)}scrollIntoView(t){this.list.current&&this.list.current.scrollToItem(t)}toggleSelect(t,e,n,s=!0){const{isMultiSelect:i}=this.props,{selectedRanges:o}=this.state;if(i&&e&&o.length>0){const r=o[o.length-1];this.selectRange([Math.min(r[0],t),Math.max(t,r[1])])}else i&&o.length===1&&o[0][0]===t&&o[0][1]===t?s&&this.deselectItem(t):i&&n?this.getItemSelected(t,o)?s&&this.deselectItem(t):this.selectItem(t):(this.deselectAll(),this.selectItem(t))}deselectAll(){const{itemCount:t}=this.props;this.deselectRange([0,t])}deselectItem(t){this.deselectRange([t,t])}deselectRange(t){bn.validateRange(t),this.setState(({selectedRanges:e})=>({selectedRanges:bn.deselectRange(e,t)}))}selectItem(t){const{disableSelect:e}=this.props;e||this.selectRange([t,t])}selectRange(t){bn.validateRange(t),this.setState(({selectedRanges:e})=>({selectedRanges:bn.selectRange(e,t)}))}setSelectedRanges(t){this.setState({selectedRanges:t})}sendViewportUpdate(){const{scrollOffset:t,height:e}=this.state;if(t!=null&&e!=null){const{onViewportChange:n,rowHeight:s}=this.props,i=Math.floor(t/s),o=i+Math.ceil(e/s);n(i,o)}}isListAtBottom({scrollOffset:t,height:e}=this.state){if(e==null||t==null)return!1;const{itemCount:n,rowHeight:s}=this.props;return t+e>=n*s}renderInnerElement({index:t,style:e}){const{items:n,offset:s,renderItem:i,disableSelect:o}=this.props,{focusIndex:r,selectedRanges:l}=this.state;if(t<s||t>=s+n.length)return null;const a=n[t-s];return this.getCachedItem(t,t,a,t===r&&!o,this.getItemSelected(t,l),i,e,o)}render(){const{items:t,itemCount:e,overscanCount:n,renderItem:s,rowHeight:i,"data-testid":o}=this.props,{selectedRanges:r,isStuckToBottom:l}=this.state;return h(Wg,{className:"item-list-auto-sizer",onResize:this.handleResize,children:({width:a,height:d})=>h(Gg,{className:"item-list-scroll-pane",height:d,width:a,initialScrollOffset:l?e*i:0,itemCount:e,itemSize:i,itemData:this.getItemData(t,r,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})})}};let vn=qi;vn.CACHE_SIZE=1e3;vn.DEFAULT_ROW_HEIGHT=20;vn.DEFAULT_OVERSCAN=10;vn.defaultProps={offset:0,items:[],rowHeight:qi.DEFAULT_ROW_HEIGHT,isDeselectOnClick:!0,isDoubleClickSelect:!1,isDragSelect:!0,isMultiSelect:!1,isStickyBottom:!1,disableSelect:!1,onFocusChange(){},onSelect(){},onSelectionChange(){},onViewportChange(){},overscanCount:qi.DEFAULT_OVERSCAN,renderItem:qi.renderItem,selectedRanges:[],focusSelector:".item-list-item","data-testid":void 0};const ui=class extends w.exports.PureComponent{constructor(t){super(t),this.getCachedDraggableItem=be((e,n,s,i,o,r,l,a)=>h(fd,{draggableId:ui.getDraggableId(e,i),index:i,isDragDisabled:l,children:d=>h("div",{role:"menuitem",className:"draggable-item-list-item",ref:d.innerRef,tabIndex:-1,...d.draggableProps,...d.dragHandleProps,children:n({item:s,itemIndex:i,isFocused:o,isSelected:r,style:a,isClone:!1})})},i),{max:vn.CACHE_SIZE}),this.getCachedRenderDraggableItem=be((e,n,s)=>({item:i,itemIndex:o,isFocused:r,isSelected:l,style:a})=>this.getCachedDraggableItem(e,s,i,o,r,l,n,a),{max:1}),this.getCachedRenderClone=be((e,n,s,i)=>(o,r,l)=>{const{selectedCount:a}=this.state,{draggableProps:d,dragHandleProps:c,innerRef:u}=o,{index:m}=l.source,p=n[m-s];return h("div",{className:z("draggable-item-list-dragging-item-container",e),...d,...c,ref:u,children:h("div",{className:z("draggable-item-list-dragging-item",{"two-dragged":a===2},{"multiple-dragged":a>2}),children:i({item:p,itemIndex:m,isFocused:!1,isSelected:!0,style:{},isClone:!0,selectedCount:a})})})},{max:1}),this.handleSelectionChange=this.handleSelectionChange.bind(this),this.itemList=X.createRef(),this.state={selectedCount:0}}static renderHandle(){return T("div",{children:[h(Ye,{children:"Drag to re-order"}),h(ee,{icon:ir})]})}static renderBadge({text:t}){return t!=null&&t.length>0?h("span",{className:"number-badge",children:t}):null}static renderTextItem({text:t,badgeText:e="",className:n=""}){return T("div",{className:z("item-list-item-content","draggable-item-list-item-content",n),children:[h("span",{className:"title",children:t}),ui.renderBadge({text:e}),ui.renderHandle()]})}static renderItem({item:t,isClone:e,selectedCount:n}){var r,l;const s=t!=null?(l=(r=t.displayValue)!=null?r:t.value)!=null?l:`${t}`:"",i=e!==void 0&&e?`${n}`:"",o=e!==void 0&&e?"item-list-item-clone":"";return ui.renderTextItem({text:s,badgeText:i,className:o})}static getDraggableId(t,e){return`${t}/${e}`}static getDraggableIndex(t){const e=t.split("/").pop();return parseInt(e!==void 0?e:"",10)}selectItem(t){var e;(e=this.itemList.current)==null||e.selectItem(t)}focusItem(t){var e;(e=this.itemList.current)==null||e.focusItem(t)}scrollToItem(t){var e;(e=this.itemList.current)==null||e.scrollToItem(t)}handleSelectionChange(t){this.setState({selectedCount:bn.count(t)});const{onSelectionChange:e}=this.props;e(t)}render(){const{className:t,draggablePrefix:e,draggingItemClassName:n,droppableId:s,isDoubleClickSelect:i,isDragDisabled:o,isDropDisabled:r,isMultiSelect:l,isStickyBottom:a,itemCount:d,items:c,offset:u,onFocusChange:m,onSelect:p,onViewportChange:g,renderItem:f,rowHeight:b,selectedRanges:C,style:S,"data-testid":v}=this.props;return h(xl,{isDropDisabled:r,droppableId:s,mode:"virtual",renderClone:this.getCachedRenderClone(n,c,u,f),"data-testid":v,children:(y,E)=>h("div",{role:"menu",className:z("draggable-item-list",t,{"is-drop-disabled":r,"is-drag-disabled":o,"is-dragging-from-this":E.draggingFromThisWith,"is-dragging-over":E.isDraggingOver,"is-dropping":E.draggingOverWith}),style:S,ref:y.innerRef,...y.droppableProps,children:h(vn,{focusSelector:".draggable-item-list-item",isDoubleClickSelect:i,isDragSelect:!1,isMultiSelect:l,isStickyBottom:a,itemCount:d,items:c,onFocusChange:m,onSelect:p,onSelectionChange:this.handleSelectionChange,onViewportChange:g,offset:u,ref:this.itemList,renderItem:this.getCachedRenderDraggableItem(e,o,f),rowHeight:b,selectedRanges:C})})})}};let sn=ui;sn.DEFAULT_ROW_HEIGHT=30;sn.defaultProps={className:"",draggingItemClassName:"",offset:0,items:[],rowHeight:ui.DEFAULT_ROW_HEIGHT,isDeselectOnClick:!0,isDoubleClickSelect:!0,isDropDisabled:!1,isDragDisabled:!1,isMultiSelect:!1,isStickyBottom:!1,disableSelect:!1,style:null,onFocusChange(){},onSelect(){},onSelectionChange(){},onViewportChange(){},renderItem:ui.renderItem,selectedRanges:[],draggablePrefix:"draggable-item",droppableId:"droppable-item-list","data-testid":void 0};class jt{static reorder(e,n,s,i){const o=e===s?jt.adjustDestinationIndex(i,n):i,r=jt.removeItems(e,n);return s.splice(o,0,...r),r}static removeItems(e,n){const s=[],i=n.map((o,r)=>({range:o,index:r})).sort((o,r)=>r.range[0]-o.range[0]);for(let o=0;o<i.length;o+=1){const{range:r,index:l}=i[o],[a,d]=r;s[l]=e.splice(a,d-a+1)}return Kg(s)}static adjustDestinationIndex(e,n){let s=e;for(let i=0;i<n.length;i+=1){const[o,r]=n[i];if(o>e)break;s-=Math.min(r,e-1)-o+1}return s}static startDragging(){document.documentElement.classList.add("drag-pointer-events-none")}static stopDragging(){document.documentElement.classList.remove("drag-pointer-events-none")}}const el=class extends w.exports.Component{static isParentSelected(t,e){const n=e.get(t);if(n===void 0)return!1;if(typeof n=="boolean")return n;const s=Array.from(n.values()).includes(!0),i=Array.from(n.values()).includes(!1);return s&&i?null:s}constructor(t){super(t),this.toggleMenu=this.toggleMenu.bind(this),this.toggleValueFor=this.toggleValueFor.bind(this),this.selectAll=this.selectAll.bind(this),this.clear=this.clear.bind(this),this.state={menuIsOpen:!1}}toggleMenu(t){t.stopPropagation(),t.preventDefault(),this.setState(e=>{const{menuIsOpen:n}=e;return{menuIsOpen:!n}})}toggleValueFor(t,e){const{valueMap:n,onUpdateValueMap:s}=this.props,i=new Map(n),o=i.get(t);if(o instanceof Map){const l=new Map(o);if(e!=null)l.set(e,o.get(e)===void 0);else{const a=el.isParentSelected(t,i),d=a==null||!a;o.forEach((c,u)=>l.set(u,d))}i.set(t,l)}else i.set(t,o==null||!o);const r=i.get(t);if(e===void 0&&r!==void 0&&typeof r!="boolean"){const l=el.isParentSelected(t,n);l!=null&&l?r.forEach((a,d)=>r.set(d,!1)):r.forEach((a,d)=>r.set(d,!0))}s(i)}setAllValues(t){const{valueMap:e,onUpdateValueMap:n}=this.props,s=new Map;e.forEach((i,o)=>{if(typeof i=="boolean")s.set(o,t);else{const r=new Map;i.forEach((l,a)=>r.set(a,t)),s.set(o,r)}}),n(s)}selectAll(){this.setAllValues(!0)}clear(){this.setAllValues(!1)}renderMenuElement(){const{valueMap:t,"data-testid":e}=this.props;return T("div",{className:"hcm-menu-container",children:[Array.from(t.entries()).map(([n,s])=>T("div",{children:[h(St,{className:"hcm-parent",checked:el.isParentSelected(n,t),onChange:()=>this.toggleValueFor(n),children:n}),s!==void 0&&typeof s!="boolean"&&Array.from(s.entries()).map(([i,o])=>h(St,{className:"hcm-child",checked:o,onChange:()=>this.toggleValueFor(n,i),children:i},i))]},n)),h(W,{kind:"ghost",onClick:this.selectAll,"data-testid":e!==void 0?`${e}-btn-select-all`:void 0,children:"Select All"}),h(W,{kind:"ghost",onClick:this.clear,"data-testid":e!==void 0?`${e}-btn-clear`:void 0,children:"Clear"})]})}render(){const{menuText:t,className:e,icon:n,id:s,"data-testid":i}=this.props,{menuIsOpen:o}=this.state;return T("button",{type:"button",className:z("btn hcm-btn",e),onClick:this.toggleMenu,id:s,"data-testid":i,children:[T("span",{children:[n&&h(ee,{icon:n,className:"hcm-icon mr-1"}),t]}),h(ee,{icon:Fd,className:"hcm-icon ml-1"}),h(kn,{options:{placement:"bottom"},isShown:o,onExited:()=>{this.setState({menuIsOpen:!1})},closeOnBlur:!0,interactive:!0,children:this.renderMenuElement()})]})}};let Gb=el;Gb.defaultProps={className:"",icon:null,id:"","data-testid":void 0};function Vl({isLoaded:t=!1,isLoading:e=!0,errorMessage:n=null,"data-testid":s}){return h(mt,{in:Boolean(n)||!t||e,timeout:ze.transitionMs,classNames:t?"fade":"",mountOnEnter:!0,unmountOnExit:!0,children:h("div",{className:"fill-parent-absolute","data-testid":s,children:h("div",{className:z("iris-panel-message-overlay","fill-parent-absolute",{"iris-panel-scrim-background":t}),children:T("div",{className:"message-content",children:[T("div",{className:"message-icon",children:[e&&h(On,{}),!e&&n!=null&&h(ee,{icon:fs})]}),h("div",{className:"message-text",children:n})]})})})})}function nm({on:t,id:e,className:n,isInvalid:s,disabled:i=!1,onClick:o,"data-testid":r}){return h("button",{type:"button",className:z("btn","btn-switch",n,{active:t},{"is-invalid":s}),id:e,onClick:o,disabled:i,"data-testid":r,children:h("div",{className:"handle"})})}function th(t){return t.isOn!==void 0}function Kb({item:t,onSelect:e=()=>{},"data-testid":n}){const{icon:s,subtitle:i,title:o}=t,r=w.exports.useMemo(()=>th(t)?()=>{t.onChange(!t.isOn)}:e,[t,e]);return T("div",{className:"btn btn-navigation-menu-item","data-testid":`menu-item-${o}`,onClick:r,onKeyDown:l=>{(l.key==="Enter"||l.key===" ")&&r()},tabIndex:0,role:"menuitem",children:[s!==void 0&&h("div",{className:"icon",children:h(ee,{icon:s})}),h("div",{className:"title",children:o}),i!==void 0&&h("div",{className:"shortcut",children:i}),h("div",{className:"accessory","data-testid":n,children:th(t)?h(nm,{on:t.isOn,onClick:l=>{l.stopPropagation(),r()}}):h(ee,{icon:Nu})})]})}function sm({items:t,onSelect:e=()=>{},"data-testid":n}){return h("div",{className:"navigation-menu-view","data-testid":n,children:h("ul",{className:"navigation-menu-list",children:t.map((s,i)=>h("li",{children:h(Kb,{item:s,onSelect:()=>{e(i)}})},s.title))})})}function nh({children:t,onBack:e,onClose:n,title:s,"data-testid":i}){return T("div",{className:"navigation-page","data-testid":i,children:[T("div",{className:"navigation-title-bar",children:[h("div",{className:"navigation-left-buttons",children:e!==void 0&&h(W,{kind:"ghost",className:"btn-back","data-testid":"btn-page-back",onClick:e,icon:bC,children:"Back"})}),h("div",{className:"navigation-title",children:s}),h("div",{className:"navigation-right-buttons",children:n!==void 0&&h(W,{kind:"ghost",className:"btn-close px-2 m-1","data-testid":"btn-page-close",onClick:n,icon:oo,tooltip:"Close"})})]}),h("div",{className:"navigation-content",children:t})]})}function qb({children:t,"data-testid":e}){const n=w.exports.useMemo(()=>X.Children.toArray(t),[t]),s=Al(n),[i,o]=w.exports.useState(n[n.length-1]),[r,l]=w.exports.useState(null),[a,d]=w.exports.useState(null);w.exports.useEffect(function(){if(s===void 0||n===s)return;const p=n[n.length-1];n.length===s.length||s.length===0||r!==null||a!==null?r!==null&&p!==r?l(p):p!==a&&p!==i&&o(p):n.length>s.length?l(p):n.length<s.length&&(o(p),d(s[s.length-1]))},[n,s,r,a,i]);const c=w.exports.useCallback(()=>{o(r),l(null)},[r]),u=w.exports.useCallback(()=>{d(null)},[]);return T("div",{className:"navigation-stack",children:[h("div",{className:"main-view","data-testid":e,children:i}),h(mt,{in:a!=null,timeout:ze.transitionMidMs,classNames:"slide-right",onEntered:u,children:h(Te,{children:a!=null&&h("div",{className:"popping-view",children:a})})}),h(mt,{in:r!=null,timeout:ze.transitionMidMs,classNames:"slide-left",onEntered:c,children:h(Te,{children:r!=null&&h("div",{className:"pushing-view",children:r})})})]})}function Yb({children:t,disabled:e,value:n,"data-testid":s}){return h("option",{value:n,disabled:e,"data-testid":s,children:t})}function Ul(t){const{children:e,disabled:n=!1,name:s,onChange:i,value:o="","data-testid":r}=t,[l]=w.exports.useState(s!=null?s:We());return h(Te,{children:X.Children.map(e,a=>{var d,c;return a?X.cloneElement(a,{name:l,onChange:(d=a.props.onChange)!=null?d:i,checked:o===a.props.value,disabled:(c=a.props.disabled)!=null?c:n,"data-testid":r}):null})})}const xn=X.forwardRef((t,e)=>{const{checked:n,children:s,className:i="",disabled:o=!1,inputClassName:r="",isInvalid:l=!1,labelClassName:a="",name:d,onChange:c,value:u,"data-testid":m}=t,[p]=w.exports.useState(We());return T("div",{className:z("custom-control custom-radio",i),children:[h("input",{type:"radio",id:p,"data-testid":m,name:d,ref:e,className:z("custom-control-input",r,{"is-invalid":l}),checked:n,disabled:o,value:u,onChange:c}),h("label",{className:z("custom-control-label",a),htmlFor:p,children:s})]})});xn.displayName="RadioItem";xn.defaultProps={checked:void 0,className:"",disabled:!1,inputClassName:"",isInvalid:!1,labelClassName:"",name:void 0,onChange:void 0,"data-testid":void 0};function Xb({children:t,onBlur:e,onChange:n,className:s,defaultValue:i,name:o,value:r,disabled:l,"data-testid":a}){const d=w.exports.useCallback(c=>{n(c.target.value)},[n]);return h("select",{className:z("custom-select",s),onBlur:e,onChange:d,defaultValue:i,value:r,name:o,disabled:l,"data-testid":a,children:t})}class im extends w.exports.PureComponent{constructor(e){super(e),this.getCachedItem=be((n,s,i,o,r,l,a)=>{const d={height:r},c=o!=null?o:i;return h("li",{className:"value-list-item",style:d,tabIndex:-1,children:h(St,{checked:l,disabled:a,onChange:()=>this.handleSelect(n),children:c})},s)},{max:1e3}),this.getCachedItems=be((n,s,i,o)=>{const r=[];for(let l=0;l<n.length;l+=1){const a=n[l],{value:d,displayValue:c,isSelected:u}=a,m=i+l,p=m,g=this.getCachedItem(m,p,d,c,s,u,o);r.push(g)}return r},{max:1}),this.handleBlur=this.handleBlur.bind(this),this.handleScroll=this.handleScroll.bind(this),this.handleSelect=this.handleSelect.bind(this),this.list=X.createRef(),this.topRow=null,this.bottomRow=null}componentDidMount(){this.sendViewportUpdate()}componentDidUpdate(){this.sendViewportUpdate()}handleBlur(e){if(!e.relatedTarget||this.list.current&&e.relatedTarget instanceof HTMLElement&&!this.list.current.contains(e.relatedTarget)){const{onBlur:n}=this.props;n==null||n(e)}}handleScroll(){this.sendViewportUpdate()}handleSelect(e){const{items:n,offset:s,onSelect:i}=this.props,o=e-s;if(o>=0&&o<n.length){const r=n[o],{value:l}=r;i(e,l)}else i(e,null)}sendViewportUpdate(){if(!this.list.current||this.list.current.clientHeight===0)return;const{onViewportChange:e,rowHeight:n}=this.props,s=this.list.current.scrollTop,i=s+this.list.current.clientHeight,o=Math.floor(s/n),r=Math.ceil(i/n);(this.topRow!==o||this.bottomRow!==r)&&(this.topRow=o,this.bottomRow=r,e(o,r))}getElement(e){return this.list.current==null?null:this.list.current.querySelectorAll(".value-list-item")[e]}scrollIntoView(e){const n=this.getElement(e);n==null||n.scrollIntoView({block:"center"})}render(){const{className:e,disabled:n,isInvalid:s,items:i,itemCount:o,offset:r,rowHeight:l,"data-testid":a}=this.props,d=this.getCachedItems(i,l,r,n);return h("div",{className:z("select-value-list-scroll-pane h-100 w-100",{"is-invalid":s},e),onBlur:this.handleBlur,onScroll:this.handleScroll,ref:this.list,"data-testid":a,children:h("div",{className:"select-value-list",style:{height:o*l},children:h("ol",{className:"select-value-list-content",style:{position:"absolute",height:i.length*l,top:r*l,left:0},children:d})})})}}im.defaultProps={disabled:!1,rowHeight:21,onBlur:()=>{},"data-testid":void 0};const sh=Z.module("Shortcut");var me=(t=>(t.CTRL="MODIFIER_CTRL",t.CMD="MODIFIER_CMD",t.ALT="MODIFIER_ALT",t.OPTION="MODIFIER_OPTION",t.SHIFT="MODIFIER_SHIFT",t))(me||{}),ge=(t=>(t.A="A",t.B="B",t.C="C",t.D="D",t.E="E",t.F="F",t.G="G",t.H="H",t.I="I",t.J="J",t.K="K",t.L="L",t.M="M",t.N="N",t.O="O",t.P="P",t.Q="Q",t.R="R",t.S="S",t.T="T",t.U="U",t.V="V",t.W="W",t.X="X",t.Y="Y",t.Z="Z",t.ZERO="0",t.ONE="1",t.TWO="2",t.THREE="3",t.FOUR="4",t.FIVE="5",t.SIX="6",t.SEVEN="7",t.EIGHT="8",t.NINE="9",t.BACKSPACE="Backspace",t.ESCAPE="Escape",t.ENTER="Enter",t.DELETE="Delete",t.SLASH="/",t.QUESTION_MARK="?",t.BACKSLASH="\\",t.PIPE="|",t.MINUS="-",t.UNDERSCORE="_",t.EQUALS="=",t.PLUS="+",t.BACKTICK="`",t.TILDE="~",t.COMMA=",",t.LEFT_CHEVRON="<",t.PERIOD=".",t.RIGHT_CHEVRON=">",t.SEMICOLON=";",t.COLON=":",t.SINGLE_QUOTE="'",t.DOUBLE_QUOTE='"',t.LEFT_BRACKET="[",t.RIGHT_BRACKET="]",t.LEFT_CURLY="{",t.RIGHT_CURLY="}",t.F1="F1",t.F2="F2",t.F3="F3",t.F4="F4",t.F5="F5",t.F6="F6",t.F7="F7",t.F8="F8",t.F9="F9",t.F10="F10",t.F11="F11",t.F12="F12",t))(ge||{});const jb=new Set(["Enter","Delete","F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12"]),ft=class extends Fl{constructor({id:t,shortcut:e,macShortcut:n,isEditable:s=!0,name:i,tooltip:o}){super(),this.id=t,this.name=i,this.tooltip=o,this.isEditable=s;const l=ft.isMacPlatform?n:e;this.defaultKeyState=ft.createKeyState(l),this.keyState=this.defaultKeyState}static isAllowedKey(t){return Object.values(ge).includes(t)}static isValidKeyState(t){const{keyValue:e}=t;return e===null?!0:!ft.isMacPlatform&&t.metaKey||!ft.isAllowedKey(e)?!1:!(!t.altKey&&!t.ctrlKey&&!t.metaKey&&!t.shiftKey)||jb.has(e)}static createKeyState(t){const e={altKey:!1,ctrlKey:!1,metaKey:!1,shiftKey:!1,keyValue:t[t.length-1]};return t.forEach(n=>{switch(n){case"MODIFIER_CTRL":e.ctrlKey=!0;break;case"MODIFIER_ALT":case"MODIFIER_OPTION":e.altKey=!0;break;case"MODIFIER_CMD":e.metaKey=!0;break;case"MODIFIER_SHIFT":e.shiftKey=!0;break}}),e}static getKeyStateFromEvent(t){const{key:e,keyCode:n}=t;let s="";return e==="Shift"||e==="Meta"||e==="Control"||e==="Alt"?s="":!ft.isAllowedKey(e)&&ft.isAllowedKey(String.fromCharCode(n))?s=String.fromCharCode(n):s=e,{keyValue:s,altKey:t.altKey,ctrlKey:t.ctrlKey,metaKey:t.metaKey,shiftKey:t.shiftKey}}static getWindowsDisplayText(t){let e="";return t.ctrlKey&&(e+="Ctrl+"),t.altKey&&(e+="Alt+"),t.shiftKey&&(e+="Shift+"),t.keyValue==="Escape"?e+="Esc":t.keyValue!==null&&(e+=t.keyValue),e}static getMacDisplayText(t){let e="";switch(t.ctrlKey&&(e+="\u2303"),t.altKey&&(e+="\u2325"),t.shiftKey&&(e+="\u21E7"),t.metaKey&&(e+="\u2318"),t.keyValue){case"Enter":e+="\u23CE";break;case"Escape":e+="\u238B";break;case"Backspace":e+="\u232B";break;case"Delete":e+="\u2326";break;case null:break;default:e+=t.keyValue}return e}static doKeyStatesMatch(t,e){var n,s;return((n=t.keyValue)==null?void 0:n.toUpperCase())===((s=e.keyValue)==null?void 0:s.toUpperCase())&&t.altKey===e.altKey&&t.ctrlKey===e.ctrlKey&&t.metaKey===e.metaKey&&t.shiftKey===e.shiftKey}static getDisplayText(t){return t.keyValue===null?"":ft.isMacPlatform?ft.getMacDisplayText(t):ft.getWindowsDisplayText(t)}getDisplayText(){return ft.getDisplayText(this.keyState)}getKeyState(){return this.keyState}setKeyState(t){ft.isValidKeyState(t)?(sh.debug2(`Shortcut ${this.id} updated to ${JSON.stringify(t)}`),this.keyState=t,this.dispatchEvent(new Ke("onUpdate",{detail:this}))):sh.debug2(`Shortcut ${this.id} tried to update to invalid keyState ${JSON.stringify(t)}`)}getDefaultKeyState(){return this.defaultKeyState}isDefault(){return ft.doKeyStatesMatch(this.getDefaultKeyState(),this.getKeyState())}setToNull(){this.setKeyState(ft.NULL_KEY_STATE)}isNull(){return ft.doKeyStatesMatch(this.keyState,ft.NULL_KEY_STATE)}setToDefault(){this.setKeyState(this.defaultKeyState)}matchesKeyState(t){return ft.doKeyStatesMatch(t,this.keyState)}matchesEvent(t){return this.matchesKeyState(ft.getKeyStateFromEvent(t))}};let Kt=ft;Kt.NULL_KEY_STATE={metaKey:!1,shiftKey:!1,altKey:!1,ctrlKey:!1,keyValue:null};Kt.isMacPlatform=Ge.isMacPlatform();const ih=Z.module("ShortcutRegistry");class Zb extends Fl{constructor(){super(...arguments),this.shortcutMap=new Map,this.shortcutsByCategory=new Map}createAndAdd(e){const n=new Kt(e);return this.add(n)}add(e){var i;const n=this.shortcutMap.get(e.id);if(n)return ih.warn(`Skipping attempt to add duplicate shortcut ID to registry: ${e.id}`),n;ih.debug2(`Adding shortcut to registry: ${e.id}`),e.addEventListener("onUpdate",({detail:o})=>this.dispatchEvent(new Ke("onUpdate",{detail:o})));const s=e.id.split(".")[0];return this.shortcutMap.set(e.id,e),this.shortcutsByCategory.has(s)?(i=this.shortcutsByCategory.get(s))==null||i.push(e):this.shortcutsByCategory.set(s,[e]),e}get(e){return this.shortcutMap.get(e)}getConflictingShortcuts(e){return Array.from(this.shortcutMap.values()).filter(n=>!n.isNull()&&n.matchesKeyState(e))}}const Ae=Object.freeze(new Zb),bs={COPY:Ae.createAndAdd({id:"GLOBAL.COPY",name:"Copy",shortcut:[me.CTRL,ge.C],macShortcut:[me.CMD,ge.C],isEditable:!1}),PASTE:Ae.createAndAdd({id:"GLOBAL.PASTE",name:"Paste",shortcut:[me.CTRL,ge.V],macShortcut:[me.CMD,ge.V],isEditable:!1}),SAVE:Ae.createAndAdd({id:"GLOBAL.SAVE",name:"Save",shortcut:[me.CTRL,ge.S],macShortcut:[me.CMD,ge.S],isEditable:!1}),SELECT_ALL:Ae.createAndAdd({id:"GLOBAL.SELECT_ALL",name:"Select All",shortcut:[me.CTRL,ge.A],macShortcut:[me.CMD,ge.A],isEditable:!1}),LINKER:Ae.createAndAdd({id:"GLOBAL.LINKER",name:"Linker",shortcut:[me.CTRL,ge.L],macShortcut:[me.CMD,ge.L]}),LINKER_CLOSE:Ae.createAndAdd({id:"GLOBAL.LINKER_CLOSE",name:"Close Linker Overlay",shortcut:[ge.ESCAPE],macShortcut:[ge.ESCAPE],isEditable:!1})};const Bl=X.forwardRef((t,e)=>{const{children:n,className:s,disabled:i,id:o,isLinked:r,isLinkedSource:l,isInvalid:a,onClick:d,onMouseEnter:c,onMouseLeave:u,style:m,"data-testid":p}=t;return T("button",{ref:e,type:"button",className:z("btn-socketed",{"btn-socketed-linked":r!==void 0&&r||l},{"btn-socketed-linked-source":l},{"is-invalid":a},s),id:o,onClick:d,onMouseEnter:c,onMouseLeave:u,style:m,disabled:i,"data-testid":p,children:[n,h(ee,{icon:Ed,className:"linked btn-socketed-icon",transform:"down-1"}),h(ee,{icon:eb,className:"is-invalid btn-socketed-icon"})]})});Bl.displayName="SocketedButton";Bl.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 Qb="_track_535ju_30",Jb="_handle_535ju_13",eS="_ticks_535ju_98",om={"handle-size":"15px","popover-width":"90px","time-slider":"_time-slider_535ju_3","time-slider-popovers":"_time-slider-popovers_535ju_8","handle-popper":"_handle-popper_535ju_13","flex-spacer":"_flex-spacer_535ju_26",track:Qb,"track-fills":"_track-fills_535ju_37","track-fill":"_track-fill_535ju_37","track-fill-start":"_track-fill-start_535ju_55","track-fill-middle":"_track-fill-middle_535ju_56","track-fill-end":"_track-fill-end_535ju_59","handle-track":"_handle-track_535ju_62",handle:Jb,ticks:eS,"tick-labels":"_tick-labels_535ju_116","tick-label":"_tick-label_535ju_116","tick-label-wrapper":"_tick-label-wrapper_535ju_132"};parseInt(om["handle-size"],10);parseInt(om["popover-width"],10);Object.freeze({ERROR:"error"});const{dh:M}=globalThis,$l=D.exports.shape({name:D.exports.string.isRequired,type:D.exports.string.isRequired,description:D.exports.string,constituentType:D.exports.string}),rm=D.exports.shape({not:D.exports.func.isRequired,and:D.exports.func.isRequired,or:D.exports.func.isRequired}),tS=D.exports.shape({asc:D.exports.func.isRequired,desc:D.exports.func.isRequired,abs:D.exports.func.isRequired,column:$l.isRequired,direction:D.exports.string.isRequired,isAbs:D.exports.bool.isRequired}),nS=D.exports.shape({columns:D.exports.arrayOf($l).isRequired,customColumns:D.exports.arrayOf(D.exports.string).isRequired,filter:D.exports.arrayOf(rm),addEventListener:D.exports.func.isRequired,removeEventListener:D.exports.func.isRequired,size:D.exports.number.isRequired,sort:D.exports.arrayOf(D.exports.any),copy:D.exports.func.isRequired,applyFilter:D.exports.func.isRequired,applySort:D.exports.func.isRequired,applyCustomColumns:D.exports.func.isRequired,description:D.exports.string}),sS=D.exports.shape({columns:D.exports.arrayOf($l),filter:D.exports.arrayOf(D.exports.any),isExpanded:D.exports.func.isRequired,saveExpandedState:D.exports.func.isRequired,addEventListener:D.exports.func.isRequired,removeEventListener:D.exports.func.isRequired,size:D.exports.number.isRequired,sort:D.exports.arrayOf(D.exports.any),applyFilter:D.exports.func.isRequired,applySort:D.exports.func.isRequired}),tl=D.exports.shape({name:D.exports.string.isRequired,type:D.exports.string.isRequired}),iS=D.exports.shape({created:D.exports.arrayOf(tl).isRequired,updated:D.exports.arrayOf(tl).isRequired,removed:D.exports.arrayOf(tl).isRequired}),oS=D.exports.shape({groupingColumns:D.exports.arrayOf(D.exports.string),aggregations:D.exports.shape({}),includeConstituents:D.exports.bool,includeOriginalColumns:D.exports.bool,includeDescriptions:D.exports.bool}),rS=D.exports.shape({addEventListener:D.exports.func.isRequired,removeEventListener:D.exports.func.isRequired,onLogMessage:D.exports.func,getTable:D.exports.func.isRequired,runCode:D.exports.func.isRequired});Object.freeze({Column:$l,FilterCondition:rm,IdeSession:rS,RollupConfig:oS,Sort:tS,Table:nS,TreeTable:sS,VariableChanges:iS,VariableDefinition:tl});function lm({type:t}){switch(t){case M.VariableType.TABLE:case M.VariableType.TABLEMAP:case M.VariableType.TREETABLE:case M.VariableType.HIERARCHICALTABLE:return h(ee,{icon:xd});case M.VariableType.FIGURE:return h(ee,{icon:Fu});case M.VariableType.PANDAS:return h(ee,{icon:cb});default:return h(ee,{icon:Wa})}}class zl extends w.exports.Component{constructor(e){super(e),this.container=null}componentDidMount(){this.colorize()}colorize(){const{children:e}=this.props;this.container&&e!=null&&gs.colorizeElement(this.container,{theme:"dh-dark"})}render(){const{children:e,language:n}=this.props;return h("div",{children:h("div",{"data-lang":n,ref:s=>{this.container=s},style:{pointerEvents:"none"},children:e})})}}class am{static get LANGUAGE_MAP(){return new Map([["python","Python"],["groovy","Groovy"],["scala","Scala"]])}}class Ji{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)?[]:qg.parse(e).filter(n=>!this.hasComment(n)).map(n=>this.hasPattern(n)?n.pattern:this.hasOp(n)?n.op:`${n}`)}static formatTimestamp(e){if(e==null||!(e instanceof Date))return null;const n=`${e.getHours()}`.padStart(2,"0"),s=`${e.getMinutes()}`.padStart(2,"0"),i=`${e.getSeconds()}`.padStart(2,"0"),o=`${e.getMilliseconds()}`.padStart(3,"0");return`${n}:${s}:${i}.${o}`}static isTableType(e){return e===M.VariableType.TABLE||e===M.VariableType.TREETABLE||e===M.VariableType.HIERARCHICALTABLE}static isWidgetType(e){return e===M.VariableType.FIGURE||e===M.VariableType.OTHERWIDGET||e===M.VariableType.PANDAS}static isOpenableType(e){return Ji.isTableType(e)||Ji.isWidgetType(e)}static isFigureType(e){return e===M.VariableType.FIGURE}static isPandas(e){return e===M.VariableType.PANDAS}}function dm({children:t}){return T("div",{className:"console-history-item-result",children:[h("div",{className:"console-history-gutter",children:"-"}),h("div",{className:"console-history-content",children:t})]})}dm.propTypes={children:D.exports.node.isRequired};class cm extends w.exports.Component{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}updateElapsed(){this.setState({elapsed:Math.round((Date.now()-this.startTime)/1e3)})}render(){const{disabled:e,onCancelClick:n}=this.props,{elapsed:s}=this.state;return h("div",{className:z("console-history-result-in-progress",{disabled:e}),children:T("span",{className:"badge",children:[h(On,{}),"\xA0Running... ",Dn.formatElapsedTime(s),"\xA0",h(W,{className:"console-history-result-in-progress-cancel",kind:"ghost",icon:oo,tooltip:"Cancel",onClick:n,disabled:e})]})})}}cm.defaultProps={disabled:!1};const qa=class extends w.exports.PureComponent{constructor(t){super(t),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}}handleKeyPress(t){switch(t.key){case"Enter":case" ":this.handleToggleError(),t.stopPropagation(),t.preventDefault();break}}handleMouseDown(t){this.mouseX=t.clientX,this.mouseY=t.clientY,this.isClicking=!0}handleMouseMove(t){this.mouseX!=null&&this.mouseY!=null?(Math.abs(t.clientX-this.mouseX)>=qa.mouseDragThreshold||Math.abs(t.clientY-this.mouseY)>=qa.mouseDragThreshold)&&(this.isClicking=!1):this.isClicking&&(this.isClicking=!1)}handleMouseUp(t){this.isClicking&&!t.shiftKey&&!t.metaKey&&!t.altKey&&this.handleToggleError(),this.mouseX=null,this.mouseY=null,this.isClicking=!1}handleToggleError(){this.setState(t=>({isExpanded:!t.isExpanded}))}handleMouseEnter(){this.setState({isTriggerHovered:!0})}handleMouseLeave(){this.setState({isTriggerHovered:!1})}render(){const{isExpanded:t,isTriggerHovered:e}=this.state,{message:n}=this.props;L(n);const s=n.indexOf(`
7
+ `),i=s>-1;let o=n;i&&(o=n.slice(0,s));const r=n.slice(s),l=e?"error-btn-link error-btn-link--active":"error-btn-link";return T("div",{className:z("error-message",{expanded:t}),children:[i&&T(Te,{children:[h("div",{className:"error-gutter",children:h("button",{type:"button",onClick:this.handleToggleError,className:l,tabIndex:-1,children:h(ee,{icon:t?Yn:Au,transform:"left-3"})})}),T("div",{className:"error-content",children:[h("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}),t?r:""]})]}),!i&&h("div",{className:"error-content",children:h("div",{className:"console-error-text",children:o})})]},"error")}};let Ad=qa;Ad.defaultProps={message:""};Ad.mouseDragThreshold=5;const oh=Z.module("ConsoleHistoryItem");class hm extends w.exports.PureComponent{constructor(e){super(e),this.handleCancelClick=this.handleCancelClick.bind(this),this.handleObjectClick=this.handleObjectClick.bind(this)}handleObjectClick(e){oh.debug("handleObjectClick",e);const{openObject:n}=this.props;n(e)}handleCancelClick(){const{item:e}=this.props;e!=null&&e.cancelResult&&(oh.debug(`Cancelling command: ${e.command}`),e.cancelResult())}render(){var c;const{disabled:e,item:n,language:s}=this.props,{disabledObjects:i,result:o}=n;let r=null;n.command!=null&&n.command!==""&&(r=T("div",{className:"console-history-item-command",children:[h("div",{className:"console-history-gutter",children:">"}),h("div",{className:"console-history-content",children:h(zl,{language:s,children:n.command})})]}));const l=[];let a=!1;if(o){const{error:u,message:m,changes:p}=o;if(p){const{created:g,updated:f}=p;[...g,...f].forEach(b=>{a=!0;const{title:C}=b,S=`${C}`,v=e===void 0||e||(i!=null?i:[]).indexOf(S)>=0,y=h(W,{kind:"primary",onClick:()=>this.handleObjectClick(b),className:"btn-console-object",disabled:v,icon:h(lm,{type:b.type}),children:C},S);l.push(y)})}if(u!=null&&n.command==null){let g=`${(c=u.message)!=null?c:u}`;g||(g=u);const f=h(Ad,{message:g},"result-error");l.push(f)}if(m!==void 0&&m!==""){const g=h("div",{className:"log-message",children:m},"log-message");l.push(g)}}else{a=!0;const u=h(cm,{onCancelClick:this.handleCancelClick,disabled:e},"in_progress");l.push(u)}let d=null;return l.length>0&&(d=h(dm,{children:l})),T("div",{className:z("console-command-result",{"console-result-buttons":a}),children:[r,d]})}}hm.defaultProps={disabled:!1};const um=class extends w.exports.Component{static itemKey(t,e){return`${t}.${e.command}.${e.result&&e.result.message}.${e.result&&e.result.error}`}render(){const{disabled:t,items:e,language:n,openObject:s}=this.props,i=[];for(let o=0;o<e.length;o+=1){const r=e[o],l=h(hm,{disabled:t,item:r,openObject:s,language:n},um.itemKey(o,r));i.push(l)}return h("div",{className:"container-fluid console-history",children:i})}};let mm=um;mm.defaultProps={disabled:!1};const lS={name:"Console",CLEAR:Ae.createAndAdd({id:"CONSOLE.CLEAR",name:"Clear",shortcut:[me.CTRL,ge.L],macShortcut:[me.CTRL,ge.C]}),FOCUS_HISTORY:Ae.createAndAdd({id:"CONSOLE.FOCUS_HISTORY",name:"Focus History",shortcut:[me.CTRL,ge.H],macShortcut:[me.CTRL,me.OPTION,ge.H]})},aS={name:"Command History",FOCUS_HISTORY:Ae.createAndAdd({id:"COMMAND_HISTORY.FOCUS_HISTORY",name:"Focus History Search",shortcut:[me.CTRL,ge.H],macShortcut:[me.CTRL,me.OPTION,ge.H]}),SEND_TO_CONSOLE:Ae.createAndAdd({id:"COMMAND_HISTORY.SEND_TO_CONSOLE",name:"Send to Console",shortcut:[ge.ENTER],macShortcut:[ge.ENTER]}),SEND_TO_NOTEBOOK:Ae.createAndAdd({id:"COMMAND_HISTORY.SEND_TO_NOTEBOOK",name:"Send to Notebook",shortcut:[me.CTRL,ge.ENTER],macShortcut:[me.CMD,ge.ENTER]}),RUN:Ae.createAndAdd({id:"COMMAND_HISTORY.RUN",name:"Run",shortcut:[me.ALT,ge.R],macShortcut:[me.OPTION,ge.R]})},dS={name:"Notebook",RUN:Ae.createAndAdd({id:"NOTEBOOK.RUN",name:"Run",shortcut:[me.ALT,ge.R],macShortcut:[me.OPTION,ge.R]}),RUN_SELECTED:Ae.createAndAdd({id:"NOTEBOOK.RUN_SELECTED",name:"Run Selected",shortcut:[me.ALT,me.SHIFT,ge.R],macShortcut:[me.OPTION,me.SHIFT,ge.R]}),FIND:Ae.createAndAdd({id:"NOTEBOOK.FIND",name:"Find",shortcut:[me.CTRL,ge.F],macShortcut:[me.CMD,ge.F],isEditable:!1}),MINIMAP:Ae.createAndAdd({id:"NOTEBOOK.MINIMAP",name:"Show Minimap",shortcut:[me.ALT,ge.M],macShortcut:[me.OPTION,ge.M]}),WORDWRAP:Ae.createAndAdd({id:"NOTEBOOK.WORDWRAP",name:"Word Wrap",shortcut:[me.ALT,ge.Z],macShortcut:[me.OPTION,ge.Z]})},Bt={CONSOLE:lS,COMMAND_HISTORY:aS,NOTEBOOK:dS},vt=Object.freeze({FATAL:"FATAL",STDERR:"STDERR",ERROR:"ERROR",WARN:"WARN",STDOUT:"STDOUT",INFO:"INFO",DEBUG:"DEBUG",TRACE:"TRACE"}),cS="#2d2a2e",hS="#fcfcfa",uS="#fcd65b",mS="#b2b1b2",pS="#9edc6f",gS="#76d9e4",fS="#f95d84",CS="#aa9af4",bS="#f95d84",SS="#fcfcfa",wS="#7c7b7c",Ee={"error-foreground":"#f95d84",background:cS,foreground:hS,"line-height":"19px",string:uS,"string-delim":"#929192",delimiter:mS,predefined:pS,keyword:gS,storage:fS,number:CS,operator:bS,identifier:SS,"namespace-identifier":"#f95d84","identifier-js":"#fcd65b",comment:wS,"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"},vS="python",TS={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/}}},ES={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"]]}},yS={id:vS,conf:TS,language:ES},IS="groovy",RS={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/}}},DS={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"]]}},MS={id:IS,conf:RS,language:DS},NS="scala",FS={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>))/}}},xS={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"]]}},_S={id:NS,conf:FS,language:xS},kS="deephavenDb",OS={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/}}},LS={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"]]}},AS={id:kS,conf:OS,language:LS},PS="log",HS={},VS={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"}]]}},US={id:PS,conf:HS,language:VS},Vn=Z.module("MonacoUtils");class rt{static init({getWorker:e}={}){Vn.debug("Initializing Monaco..."),e!==void 0&&rt.registerGetWorker(e);const{registerLanguages:n,removeHashtag:s}=rt,i=[{token:"",foreground:s(Ee.foreground)},{token:"string",foreground:s(Ee.string)},{token:"string.delim",foreground:s(Ee["string-delim"])},{token:"keyword",foreground:s(Ee.keyword)},{token:"identifier.js",foreground:s(Ee["identifier-js"])},{token:"delimiter",foreground:s(Ee.delimiter)},{token:"comment",foreground:s(Ee.comment)},{token:"number",foreground:s(Ee.number)},{token:"storage",foreground:s(Ee.storage)},{token:"identifier",foreground:s(Ee.identifier)},{token:"namespace.identifier",foreground:s(Ee["namespace-identifier"])},{token:"operator",foreground:s(Ee.operator)},{token:"predefined",foreground:s(Ee.predefined)},{token:"error.log",foreground:Ee["log-error"].substring(1)},{token:"warn.log",foreground:s(Ee["log-warn"])},{token:"info.log",foreground:s(Ee["log-info"])},{token:"stdout.log",foreground:s(Ee["log-stdout"])},{token:"trace.log",foreground:s(Ee["log-trace"])},{token:"debug.log",foreground:s(Ee["log-debug"])},{token:"date.log",foreground:s(Ee["log-date"])}],o={errorForeground:Ee["error-foreground"],"inputOption.activeBorder":Ee["input-option-active-border"],"editor.background":Ee.background,"editor.foreground":Ee.foreground,"editor.lineHighlightBackground":Ee["editor-line-highlight-bg"],"editorLineNumber.foreground":Ee["editor-line-number-foreground"],"editor.selectionBackground":Ee["editor-selection-background"],"editor.findMatchBackground":Ee["editor-find-match-background"],"editor.findMatchHighlightBackground":Ee["editor-find-match-highlight-background"],"editorSuggestWidget.background":Ee["editor-suggest-widget-background"],"editorSuggestWidget.border":Ee["editor-suggest-widget-border"],"editorSuggestWidget.foreground":Ee["editor-suggest-widget-foreground"],"editorSuggestWidget.selectedBackground":Ee["editor-suggest-widget-selected-background"],"editorSuggestWidget.highlightForeground":Ee["editor-suggest-widget-highlightForeground"],"list.hoverBackground":Ee["list-hover-background"],"dropdown.background":Ee["context-menu-background"],"dropdown.foreground":Ee["context-menu-foreground"],"menu.selectionBackground":Ee["menu-selection-background"],"list.focusBackground":Ee["menu-selection-background"],"editorWidget.background":Ee["editor-widget-background"],"inputOption.activeBackground":Ee["input-option-active-background"],"inputOption.activeForeground":Ee["input-option-active-foreground"],focusBorder:Ee["focus-border"],"input.background":Ee["input-background"],"input.foreground":Ee["input-foreground"],"input.border":Ee["input-border"]};gs.defineTheme("dh-dark",{base:"vs-dark",inherit:!0,rules:i,colors:o}),Vn.debug2("monaco theme: ",Ee),gs.setTheme("dh-dark"),n([AS,yS,MS,US,_S]),Vn.debug("Monaco initialized.")}static registerGetWorker(e){window.MonacoEnvironment={...window.MonacoEnvironment,getWorker:e}}static removeHashtag(e){return e.substring(1)}static registerLanguages(e){const n=e.map(({id:s})=>s);Hi.getLanguages().filter(({id:s})=>n.includes(s)).forEach(s=>{const i=s;Vn.debug2("Overriding default language loader:",i.id)}),e.forEach(s=>{rt.registerLanguage(s)})}static registerLanguage(e){Vn.debug2("Registering language: ",e.id),Hi.register(e),Hi.onLanguage(e.id,()=>{Hi.setLanguageConfiguration(e.id,e.conf),Hi.setMonarchTokensProvider(e.id,e.language)})}static setEOL(e,n=gs.EndOfLineSequence.LF){var s;(s=e.getModel())==null||s.setEOL(n)}static openDocument(e,n){const s=e.getModel();L(s);const i={textDocument:{uri:`${s.uri}`,languageId:s.getLanguageId(),version:s.getVersionId(),text:s.getValue()}};return Vn.debug2("didOpenDocumentParams: ",i),n.openDocument(i),e.onDidChangeModelContent(r=>{const{changes:l,versionId:a}=r,d=[];for(let c=0;c<l.length;c+=1){const u=l[c],{range:m,rangeLength:p,text:g}=u,f={range:{start:{line:m.startLineNumber-1,character:m.startColumn-1},end:{line:m.endLineNumber-1,character:m.endColumn-1}},rangeLength:p,text:g};d.push(f)}if(d.length>0){const c={textDocument:{version:a,uri:`${s.uri}`},contentChanges:d};Vn.debug2("didChangeDocumentParams",c),n.changeDocument(c)}})}static closeDocument(e,n){const s=e.getModel();L(s);const i={textDocument:{uri:`${s.uri}`}};n.closeDocument(i)}static registerPasteHandler(e){e.onDidPaste(n=>{const s=/“|”/g,i=/\u200b/g,o=/\u00A0/g,r=e.getModel();L(r);const l=r.getValueInRange(n.range);(s.test(l)||i.test(l)||o.test(l))&&r.applyEdits([{range:n.range,text:l.replace(s,'"').replace(i,"").replace(o," ")}])})}static isMacPlatform(){const{platform:e}=window.navigator;return e.startsWith("Mac")}static removeConflictingKeybindings(e){const n=[{windows:"ctrl+D",mac:"meta+D"},{windows:"ctrl+H"}];try{n.forEach(s=>{rt.isMacPlatform()&&s.mac===""||!rt.isMacPlatform()&&s.windows===""||rt.removeKeybinding(e,rt.isMacPlatform()?s.mac:s.windows)})}catch(s){Vn.error(s)}}static removeKeybinding(e,n){if(n===void 0)return;const s=e._standaloneKeybindingService._getResolver()._map.get(n);s!=null?s.forEach(i=>{Vn.debug2(`Removing Monaco keybinding ${n} for ${i.command}`),e._standaloneKeybindingService.addDynamicKeybinding(`-${i.command}`,null,()=>{})}):Vn.warn(`Did not find any keybindings to remove for ${n}`)}static getMonacoKeyCodeFromShortcut(e){const{keyState:n}=e,{keyValue:s}=n;return s===null?0:rt.isMacPlatform()?(n.metaKey?Cn.CtrlCmd:0)|(n.shiftKey?Cn.Shift:0)|(n.altKey?Cn.Alt:0)|(n.ctrlKey?Cn.WinCtrl:0)|Vc.fromString(s):(n.ctrlKey?Cn.CtrlCmd:0)|(n.shiftKey?Cn.Shift:0)|(n.altKey?Cn.Alt:0)|(n.metaKey?Cn.WinCtrl:0)|Vc.fromString(s)}}const rh=Z.module("MonacoCompletionProvider");class pm extends w.exports.PureComponent{constructor(e){super(e),this.handleCompletionRequest=this.handleCompletionRequest.bind(this)}componentDidMount(){const{language:e}=this.props;this.registeredCompletionProvider=Hi.registerCompletionItemProvider(e!=null?e:"",{provideCompletionItems:this.handleCompletionRequest,triggerCharacters:['"',".","'","(","[","{",","]})}componentWillUnmount(){var e;(e=this.registeredCompletionProvider)==null||e.dispose()}handleCompletionRequest(e,n,s){const{model:i,session:o}=this.props;if(e!==i)return null;const r={textDocument:{uri:`${e.uri}`,version:e.getVersionId()},position:{line:n.lineNumber-1,character:n.column-1},context:s},l=o.getCompletionItems(r);return rh.debug("Completion items received: ",r,l),l.then(d=>{const c=d.map(u=>{const{label:m,kind:p,detail:g,documentation:f,sortText:b,filterText:C,textEdit:S,insertTextFormat:v}=u,{start:y,end:E}=S.range,I={startLineNumber:y.line+1,startColumn:y.character+1,endLineNumber:E.line+1,endColumn:E.character+1};return{label:m,kind:p,detail:g,documentation:f,sortText:b,filterText:C,insertText:S.text,insertTextRules:v===2?4:v,range:I}});return{incomplete:!0,suggestions:c}}).catch(d=>(rh.error("There was an error retrieving completion items",d),{suggestions:[]}))}render(){return null}}const Ta=Z.module("ConsoleInput"),pl=parseInt(Ee["line-height"],10),gm=6,fm=6,BS=pl+gm+fm,Ea=100,Cm=class extends w.exports.PureComponent{constructor(t){super(t),this.handleWindowResize=this.handleWindowResize.bind(this),this.commandContainer=X.createRef(),this.commandHistoryIndex=null,this.timestamp=Date.now(),this.bufferIndex=0,this.history=[],this.modifiedCommands=new Map,this.state={commandEditorHeight:pl,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()}setConsoleText(t,e=!0,n=!1){var s;!t||(Ta.debug("Command received: ",t),n||(this.commandHistoryIndex=null,(s=this.commandEditor)==null||s.setValue(t)),e&&this.focusEnd(),this.updateDimensions(),n&&this.processCommand(t))}initCommandEditor(){const{language:t,session:e}=this.props,n={copyWithSyntaxHighlighting:!1,cursorStyle:"block",fixedOverflowWidgets:!0,folding:!1,fontFamily:"Fira Mono",glyphMargin:!1,language:t,lineHeight:pl,lineDecorationsWidth:3,lineNumbers:"off",minimap:{enabled:!1},renderLineHighlight:"none",scrollBeyondLastLine:!1,scrollbar:{arrowSize:0,horizontal:"hidden",horizontalScrollbarSize:0},padding:{top:gm,bottom:fm},tabCompletion:"on",value:"",wordWrap:"on"},s=this.commandContainer.current;L(s),this.commandEditor=gs.create(s,n),rt.setEOL(this.commandEditor),rt.openDocument(this.commandEditor,e),this.commandEditor.onDidChangeModelContent(()=>{var o;const i=(o=this.commandEditor)==null?void 0:o.getValue();this.modifiedCommands.set(this.commandHistoryIndex,i!=null?i:null),this.updateDimensions()}),this.commandEditor.onDidFocusEditorText(()=>{this.setState({isFocused:!0})}),this.commandEditor.onDidBlurEditorText(()=>{this.setState({isFocused:!1})}),this.commandEditor.onKeyDown(i=>{var c,u,m;const{commandEditor:o,commandHistoryIndex:r}=this,l=o==null?void 0:o.getPosition();L(l);const{lineNumber:a}=l,d=o==null?void 0:o.getModel();if(i.keyCode===Kn.UpArrow&&!this.isSuggestionMenuPopulated()&&a===1){r!=null?this.loadCommand(r+1):this.loadCommand(0),this.focusStart(),i.stopPropagation(),i.preventDefault();return}if(i.keyCode===Kn.DownArrow&&!this.isSuggestionMenuPopulated()&&a===(d==null?void 0:d.getLineCount())){r!=null&&r>0?this.loadCommand(r-1):this.loadCommand(null),this.focusEnd(),i.stopPropagation(),i.preventDefault();return}if(!i.altKey&&!i.shiftKey&&!i.metaKey)if(i.keyCode===Kn.Enter){if(!this.isSuggestionMenuPopulated()){i.stopPropagation(),i.preventDefault();const p=(c=this.commandEditor)==null?void 0:c.getValue().trim();p!==void 0&&(this.processCommand(p),(u=this.commandEditor)==null||u.setValue(""))}}else i.keyCode===Kn.Tab&&(this.isSuggestionMenuActive()?this.isSuggestionMenuPopulated()||(i.stopPropagation(),i.preventDefault()):(i.stopPropagation(),i.preventDefault(),(m=this.commandEditor)==null||m.trigger("Tab key trigger suggestions","editor.action.triggerSuggest",{})))}),this.commandEditor.addCommand(Cn.CtrlCmd|Kn.KeyF,()=>{}),rt.removeConflictingKeybindings(this.commandEditor),rt.registerPasteHandler(this.commandEditor),this.commandEditor.focus(),this.updateDimensions(),this.setState({model:this.commandEditor.getModel()})}destroyCommandEditor(){const{session:t}=this.props;this.commandEditor&&(rt.closeDocument(this.commandEditor,t),this.commandEditor.dispose(),this.commandEditor=void 0)}handleWindowResize(){this.updateDimensions()}isSuggestionMenuActive(){var t,e,n;return this.commandSuggestionContainer||(this.commandSuggestionContainer=(e=(t=this.commandEditor)==null?void 0:t.getDomNode())==null?void 0:e.querySelector(".suggest-widget")),(n=this.commandSuggestionContainer&&this.commandSuggestionContainer.classList.contains("visible"))!=null?n:!1}isSuggestionMenuPopulated(){var t,e,n;return this.isSuggestionMenuActive()&&((n=(e=(t=this.commandSuggestionContainer)==null?void 0:t.querySelector(".monaco-list-rows"))==null?void 0:e.childElementCount)!=null?n:0)>0}focus(){var t;(t=this.commandEditor)==null||t.focus()}focusStart(){var s,i,o,r,l;const t=(s=this.commandEditor)==null?void 0:s.getModel();L(t);const e=t.getLineLength(1)+1,n=(i=this.commandEditor)==null?void 0:i.getTopForPosition(1,e);L(n),(o=this.commandEditor)==null||o.setPosition({lineNumber:1,column:e}),(r=this.commandEditor)==null||r.setScrollTop(n),(l=this.commandEditor)==null||l.focus()}focusEnd(){var i,o,r,l,a;const t=(i=this.commandEditor)==null?void 0:i.getModel();L(t);const e=t.getLineCount(),n=t.getLineLength(e)+1,s=(o=this.commandEditor)==null?void 0:o.getTopForPosition(e,n);L(s),(r=this.commandEditor)==null||r.setPosition({lineNumber:e,column:n}),(l=this.commandEditor)==null||l.setScrollTop(s),(a=this.commandEditor)==null||a.focus()}clear(){var t,e,n;(t=this.commandEditor)==null||t.focus(),(n=(e=this.commandEditor)==null?void 0:e.getModel())==null||n.setValue(""),this.commandHistoryIndex=null}layoutEditor(){this.commandEditor&&this.commandEditor.layout()}loadCommand(t){var s,i;if(t===null||t>=this.history.length)return;const e=this.modifiedCommands.get(t),n=t===null?"":this.history[this.history.length-t-1];this.commandHistoryIndex=t,(i=(s=this.commandEditor)==null?void 0:s.getModel())==null||i.setValue(e!=null?e:n),t!==null&&t>this.history.length-Ea&&this.loadMoreHistory()}async loadMoreHistory(){try{if(this.loadingPromise!=null||this.bufferIndex==null)return;const{commandHistoryStorage:t,language:e,scope:n}=this.props;this.loadingPromise=ye.makeCancelable(t.getTable(e,n!=null?n:"",this.timestamp),o=>o.close());const s=await this.loadingPromise;s.setReversed(!0),s.setViewport({top:this.bufferIndex,bottom:this.bufferIndex+Ea-1}),this.loadingPromise=ye.makeCancelable(s.getViewportData(),()=>s.close());const i=await this.loadingPromise;this.bufferIndex+=Ea,this.bufferIndex>=s.size&&(this.bufferIndex=null),this.history=[...i.items.filter(({name:o},r,l)=>r===0||o!==l[r-1].name).map(({name:o})=>o).reverse(),...this.history],this.loadingPromise=void 0,s.close()}catch(t){if(this.loadingPromise=void 0,ye.isCanceled(t)){Ta.debug2("Promise canceled, not loading history");return}Ta.error("Error fetching history",t)}}processCommand(t){this.commandHistoryIndex=null,this.modifiedCommands.clear(),L(t),t!==""&&(this.history.length===0||t!==this.history[this.history.length-1])&&this.history.push(t),this.updateDimensions();const{onSubmit:e}=this.props;e(t)}updateDimensions(){if(!this.commandEditor)return;const{maxHeight:t}=this.props;L(t);const e=this.commandEditor.getContentHeight(),n=Math.max(Math.min(e,t),BS),i={overviewRulerLanes:e>n?void 0:0};this.setState({commandEditorHeight:n},()=>{var o,r;(o=this.commandEditor)==null||o.updateOptions(i),(r=this.commandEditor)==null||r.layout()})}render(){const{disabled:t,language:e,session:n}=this.props,{commandEditorHeight:s,isFocused:i,model:o}=this.state;return h("div",{className:z("console-input-wrapper",{disabled:t}),children:T("div",{className:z("console-input-inner-wrapper",{focus:i}),children:[h("div",{className:Cm.INPUT_CLASS_NAME,ref:this.commandContainer,style:{height:s}}),o&&h(pm,{model:o,language:e,session:n})]})})}};let gl=Cm;gl.defaultProps={maxHeight:pl*10,scope:null,disabled:!1};gl.INPUT_CLASS_NAME="console-input";const lh="pasted values",$S=[/^audio.*/,/^font.*/,/^image.*/,/^video.*/],ya=[".csv",".tsv",".tab",".psv",".dsv",".txt"],ah=[".zip"],Ui=class extends w.exports.Component{constructor(t){super(t),this.getValidExtensions=Se(e=>e?[...ya,...ah]:[...ya]),this.getAcceptString=Se(e=>this.getValidExtensions(e).join(", ")),this.getFileTypeErrorString=Se(e=>nn.join(this.getValidExtensions(e),"or")),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=X.createRef(),this.divElem=X.createRef(),this.state={selectedFileName:""}}static isValidDropItem(t){return t!=null&&t.kind==="file"&&!$S.find(e=>e.test(t.type))}static isValidExtension(t,e=!1){return ya.some(n=>t.endsWith(n))||e&&ah.some(n=>t.endsWith(n))}static handleDragOver(t){t.preventDefault(),t.stopPropagation()}static getIcon(t){return t===lh?zc:t.endsWith(".csv")?tb:t.endsWith(".zip")?RC:ib}componentDidMount(){var t,e;(t=this.divElem.current)==null||t.addEventListener("paste",this.handlePasteEvent),(e=this.divElem.current)==null||e.focus()}componentWillUnmount(){var t;(t=this.divElem.current)==null||t.removeEventListener("paste",this.handlePasteEvent)}handleSelectFile(){var t;this.fileElem.current&&(this.fileElem.current.value="",(t=this.fileElem.current)==null||t.click())}handleFiles(t){t.stopPropagation(),t.preventDefault();const{files:e}=t.target;e!=null&&this.handleFile(e[0])}handleDrop(t){const{allowZip:e,clearDragError:n,dragError:s}=this.props;if(t.preventDefault(),t.stopPropagation(),s!=null){n();return}if(t.dataTransfer==null||t.dataTransfer.items==null||t.dataTransfer.items.length===0)return;const i=t.dataTransfer.items[0].getAsFile();L(i),Ui.isValidExtension(i.name,e)?this.handleFile(i):this.setState({dropError:Ui.FILE_TYPE_ERROR})}unstageFile(t){const{onCancel:e}=this.props;t.stopPropagation(),t.preventDefault(),e(),this.setState({selectedFileName:"",dropError:void 0})}handleFile(t){const{onFileOpened:e}=this.props;e(t),this.setState({selectedFileName:t.name,dropError:void 0})}handleMenuPaste(){const{onPaste:t,onError:e,uploadInProgress:n}=this.props;n||navigator.clipboard.readText().then(s=>{t(s),this.setState({selectedFileName:lh,dropError:void 0})}).catch(s=>e(s))}handlePasteEvent(t){t.stopPropagation(),t.preventDefault(),this.handleMenuPaste()}makeContextMenuItems(){const{uploadInProgress:t}=this.props;return[{title:"Paste",icon:zc,action:this.handleMenuPaste,shortcut:bs.PASTE,disabled:t}]}render(){const{allowZip:t,dragError:e,uploadInProgress:n}=this.props,{selectedFileName:s,dropError:i}=this.state,o=e!=null?e:i,r=this.makeContextMenuItems();return T("div",{ref:this.divElem,className:"csv-overlay fill-parent-absolute",onDragOver:Ui.handleDragOver,onDrop:this.handleDrop,tabIndex:-1,children:[h(ae,{actions:r}),h("input",{ref:this.fileElem,type:"file",id:"fileElem",accept:this.getAcceptString(t),style:{display:"none"},onChange:this.handleFiles,"data-testid":"fileElem"}),!s&&(o===void 0||o==="")&&T("div",{className:"message-content",children:[h("div",{className:"message-icon",children:h(ee,{icon:nb})}),h("label",{children:"Drop file (or paste values) here to import"}),h("div",{className:"message-small",children:h("label",{children:"or"})}),h(W,{kind:"primary",onClick:this.handleSelectFile,children:"Select File..."})]}),s&&(o===void 0||o==="")&&T("div",{className:"selected-content",children:[h("div",{className:"selected-icon",children:h(ee,{icon:Ui.getIcon(s)})}),T("div",{className:"selected-text",children:[h("label",{children:"Selected File"}),T("label",{className:"selected-name",children:[s,!n&&h(W,{kind:"ghost",className:"ml-2",onClick:this.unstageFile,icon:hn,tooltip:"Remove"})]})]})]}),Boolean(o)&&T("div",{className:"message-content",children:[h("div",{className:"message-icon",children:h(ee,{icon:fs})}),h("label",{children:o}),o===Ui.FILE_TYPE_ERROR&&h("div",{className:"message-small",children:h("label",{children:this.getFileTypeErrorString(t)})})]})]})}};let ps=Ui;ps.defaultProps={allowZip:!1,dragError:null};ps.MULTIPLE_FILE_ERROR="Please select only one file";ps.FILE_TYPE_ERROR="Filetype not supported.";class Fe{}Fe.INTEGER="int";Fe.LONG="long";Fe.DOUBLE="double";Fe.BOOLEAN="bool";Fe.STRING="string";Fe.DATE_TIME="datetime";Fe.LOCAL_TIME="localtime";const ch="unknown",zS=2147483647,WS=-2147483648,hh=/^[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]+)?$/,uh=/^([0-9]+T)?([0-9]+):([0-9]+)(:[0-9]+)?(?:\.[0-9]{1,9})?$/;class _t{static determineType(e,n,s){if(!e||e===s)return n;switch(n){case Fe.STRING:return Fe.STRING;case Fe.INTEGER:return _t.checkInteger(e);case Fe.LONG:return _t.checkLong(e);case Fe.DOUBLE:return _t.checkDouble(e);case Fe.BOOLEAN:return _t.checkBoolean(e);case Fe.DATE_TIME:return _t.checkDateTime(e);case Fe.LOCAL_TIME:return _t.checkLocalTime(e);default:return _t.getTypeFromUnknown(e)}}static isNotParsableNumber(e){return isNaN(e)||e==="Infinity"||e==="-Infinity"}static checkInteger(e){const n=e.replace(/,/g,"");return _t.isNotParsableNumber(n)?Fe.STRING:_t.getNumberType(n)}static checkLong(e){const n=e.replace(/,/g,"");return _t.isNotParsableNumber(n)?Fe.STRING:n.includes(".")?Fe.DOUBLE:Fe.LONG}static checkDouble(e){const n=e.replace(/,/g,"");return _t.isNotParsableNumber(n)?Fe.STRING:Fe.DOUBLE}static checkBoolean(e){const n=e.toLowerCase();return n==="true"||n==="false"?Fe.BOOLEAN:Fe.STRING}static checkDateTime(e){return hh.test(e)?Fe.DATE_TIME:Fe.STRING}static checkLocalTime(e){return uh.test(e)?Fe.LOCAL_TIME:Fe.STRING}static getTypeFromUnknown(e){const n=e.replace(/,/g,"");if(_t.isNotParsableNumber(n)){const s=e.toLowerCase();return s==="true"||s==="false"?Fe.BOOLEAN:hh.test(e)&&e.includes(":")?Fe.DATE_TIME:uh.test(e)?Fe.LOCAL_TIME:Fe.STRING}return _t.getNumberType(n)}static getNumberType(e){if(e.includes("."))return Fe.DOUBLE;const n=e.startsWith("-")?11:10;if(e.length>n)return Fe.LONG;const s=parseInt(e,10);return s>zS||s<WS?Fe.LONG:Fe.INTEGER}constructor(e,n,s,i,o,r,l,a,d,c){this.onFileCompleted=e,this.file=n,this.readHeaders=s,this.nullString=o,this.onProgress=r,this.onError=l,this.chunks=0,this.totalChunks=a,this.isZip=d,this.shouldTrim=c,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={...i,error:this.handleError,chunk:this.handleChunk,complete:this.handleComplete}}parse(){const e=this.isZip?this.file.nodeStream("nodebuffer",this.handleNodeUpdate):this.file;Va.parse(e,this.config)}handleChunk(e,n){let{data:s}=e;if(!this.types){if(s==null||s.length===0){n.abort(),this.onError("Error parsing CSV: no data in file.");return}this.types=new Array(s[0].length).fill(ch),this.readHeaders&&(s=s.slice(1))}L(this.types);const i=[...this.types];s.forEach(l=>{if(l.length>=i.length){for(let a=0;a<i.length;a+=1)i[a]=_t.determineType(this.shouldTrim?l[a].trim():l[a],i[a],this.nullString);this.types=i}else n.abort(),this.onError(`Error parsing CSV: Insufficient data in row.
8
+ Expected length ${i.length} but found ${l.length}.
9
+ Row = ${l}`)}),this.chunks+=1;let o=0;this.totalChunks>0?o=Math.round(this.chunks/this.totalChunks*50):o=Math.round(this.zipProgress/2),this.onProgress(o)&&n.abort()}handleComplete(e){const{types:n,onFileCompleted:s}=this;L(n),(e==null||!e.meta.aborted)&&s(n.map(i=>i===ch?Fe.STRING:i))}handleError(e){const{onError:n}=this;n(e)}handleNodeUpdate(e){this.zipProgress=e.percent}}const Lr=Z.module("CsvParser"),GS=650,fl=class{static generateHeaderRecursive(t){let e="",n=t;return t>=26&&(e=e.concat(fl.generateHeaderRecursive(Math.floor(t/26)-1)),n=t%26),e.concat(String.fromCharCode(65+n))}constructor({onFileCompleted:t,session:e,file:n,type:s,readHeaders:i=!0,onProgress:o,onError:r,timeZone:l,isZip:a}){this.onFileCompleted=t,this.session=e,this.file=n,this.isZip=a,this.type=s,this.readHeaders=i,this.timeZone=l,this.onProgress=o,this.onError=r,this.tables=[],this.chunks=0,this.totalChunks=a?0:Math.ceil(n.size/Va.LocalChunkSize),this.isComplete=!1,this.zipProgress=0,this.numConsolidated=0,this.isCancelled=!1,this.handleChunk=this.handleChunk.bind(this),this.handleError=this.handleError.bind(this),this.handleComplete=this.handleComplete.bind(this),this.handleNodeUpdate=this.handleNodeUpdate.bind(this),this.handleCreateTable=this.handleCreateTable.bind(this),this.config={delimiter:s.delimiter,newline:s.newline,escapeChar:s.escapeChar,dynamicTyping:!1,error:this.handleError,skipEmptyLines:s.skipEmptyLines,chunk:this.handleChunk,complete:this.handleComplete,fastMode:!1}}cancel(){this.isCancelled=!0}transpose(t,e){const n=e.length,s=new Array(t).fill(null).map(()=>new Array(n));for(let i=0;i<n;i+=1){const o=e[i];if(o.length<t)throw new Error(`Insufficient columns. Expected ${t} but found ${o.length}
10
+ ${o}`);for(let r=0;r<t;r+=1){const l=this.type.shouldTrim?e[i][r].trim():e[i][r];s[r][i]=this.nullCheck(l)}}return s}nullCheck(t){return t===this.type.nullString?"":t}parse(){const t=n=>{const s=this.isZip?this.file.nodeStream("nodebuffer",this.handleNodeUpdate):this.file;this.types=n,Va.parse(s,this.config)};new _t(t,this.file,this.readHeaders,this.config,this.type.nullString,this.onProgress,this.onError,this.totalChunks,this.isZip,this.type.shouldTrim).parse()}handleChunk(t,e){const{readHeaders:n,onError:s,handleCreateTable:i,isZip:o,tables:r}=this;if(this.isCancelled){Lr.debug2("CSV parser cancelled."),e.abort(),r.forEach(d=>d.close());return}let{data:l}=t;this.headers||(n?(this.headers=En.legalizeColumnNames(l[0]),l=l.slice(1)):this.headers=fl.generateHeaders(l[0].length));let a=[];try{if(a=this.transpose(this.headers.length,l),o)this.consolidateChunks(a,e);else{const d=this.chunks;this.chunks+=1,i(d,a,e)}}catch(d){s(d)}}consolidateChunks(t,e){if(!this.consolidatedChunks)this.consolidatedChunks=t.slice();else for(let n=0;n<t.length;n+=1)this.consolidatedChunks[n]=this.consolidatedChunks[n].concat(t[n]);this.numConsolidated+=1,(this.numConsolidated>=GS||this.isComplete)&&this.uploadConsolidatedChunks(e)}uploadConsolidatedChunks(t){var i;const{handleCreateTable:e}=this,n=this.chunks;this.chunks+=1;const s=(i=this.consolidatedChunks)==null?void 0:i.slice();this.consolidatedChunks=void 0,this.numConsolidated=0,L(s),e(n,s,t)}handleCreateTable(t,e,n){const{session:s,tables:i,onFileCompleted:o,totalChunks:r,types:l,onProgress:a,onError:d}=this;n&&n.pause(),L(this.headers),L(l),s.newTable(this.headers,l,e,this.timeZone).then(c=>{if(this.isCancelled){Lr.debug2("CSV parser cancelled."),n&&n.abort(),i.forEach(m=>m.close());return}n&&n.resume(),i[t]=c;let u=0;r>0?u=Math.round(i.length/r*50)+50:u=Math.round(50+this.zipProgress/2),Lr.debug2(`CSV parser progress ${u}`),a(u),this.isComplete&&i.length===this.chunks&&(Lr.debug2("CSV parser complete."),o(i))}).catch(c=>{!this.isComplete&&n&&n.abort(),d(c)})}handleComplete(t){(t==null||t.meta.aborted==null)&&(this.isComplete=!0,this.consolidatedChunks&&this.uploadConsolidatedChunks(null))}handleError(t){const{onError:e}=this;e(t)}handleNodeUpdate(t){this.zipProgress=t.percent}};let bm=fl;bm.generateHeaders=t=>{const e=[];for(let n=0;n<t;n+=1)e.push(fl.generateHeaderRecursive(n));return e};class Us{static fromExtension(e){return e.endsWith(".csv")?"DEFAULT_CSV":e.endsWith(".tsv")||e.endsWith(".tab")?"TSV":e.endsWith(".psv")?"PIPE_SV":"AUTODETECT"}}Us.DEFAULT_TYPE="DEFAULT_CSV";Us.AUTO="AUTODETECT";Us.TYPES=Object.freeze({DEFAULT_CSV:{name:"Default csv (trimmed)",delimiter:",",newline:void 0,escapeChar:'"',shouldTrim:!0,skipEmptyLines:!0,nullString:"(null)"},TSV:{name:"Tab seperated (tsv)",delimiter:" ",newline:void 0,escapeChar:'"',shouldTrim:!0,skipEmptyLines:!0,nullString:"(null)"},APACHE_COMMON_CSV:{name:"Apache Common csv",delimiter:",",newline:`\r
11
+ `,escapeChar:'"',shouldTrim:!0,skipEmptyLines:!0,nullString:null},EXCEL_CSV:{name:"Excel csv (strict)",delimiter:",",newline:`\r
12
+ `,escapeChar:'"',shouldTrim:!0,skipEmptyLines:!1,nullString:null},MY_SQL_CSV:{name:"MySQL csv",delimiter:" ",newline:`
13
+ `,escapeChar:"\\",shouldTrim:!0,skipEmptyLines:!1,nullString:"\\N"},RFC4180_CSV:{name:"RFC4180 csv",delimiter:",",newline:`\r
14
+ `,escapeChar:'"',shouldTrim:!0,skipEmptyLines:!1,nullString:null},COLON_SV:{name:": colon sv",delimiter:":",newline:void 0,escapeChar:'"',shouldTrim:!0,skipEmptyLines:!0,nullString:"(null)"},SEMI_COLON_SV:{name:"; semi-colon sv",delimiter:";",newline:void 0,escapeChar:'"',shouldTrim:!0,skipEmptyLines:!0,nullString:"(null)"},PIPE_SV:{name:"| pipe separated (psv)",delimiter:"|",newline:void 0,escapeChar:'"',shouldTrim:!0,skipEmptyLines:!0,nullString:"(null)"},SPACE_SV:{name:'" " space sv',delimiter:" ",newline:void 0,escapeChar:'"',shouldTrim:!0,skipEmptyLines:!0,nullString:"(null)"},AUTODETECT:{name:"autodetect",delimiter:void 0,newline:void 0,escapeChar:'"',shouldTrim:!0,skipEmptyLines:!0,nullString:"(null)"}});const mh=Z.module("CsvInputBar"),KS=Object.entries(Us.TYPES).map(([t,e])=>h("option",{value:t,children:e.name},t));class Sm extends w.exports.Component{constructor(e){super(e),this.handleUpload=this.handleUpload.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleError=this.handleError.bind(this),this.handleTableName=this.handleTableName.bind(this),this.toggleFirstRowHeaders=this.toggleFirstRowHeaders.bind(this),this.handleProgress=this.handleProgress.bind(this),this.handleCancelInProgress=this.handleCancelInProgress.bind(this),this.handleQueryTypeChange=this.handleQueryTypeChange.bind(this),this.inputRef=X.createRef(),this.state={tableName:"",tableNameSet:!1,isFirstRowHeaders:!0,showProgress:!1,progressValue:0,type:Us.DEFAULT_TYPE,parser:null}}componentDidUpdate(e){var r;const{file:n,paste:s}=this.props,{tableName:i,tableNameSet:o}=this.state;if(!o&&n!=null&&!i){const l=n.name.lastIndexOf("."),a=En.legalizeTableName(n.name.substring(0,l));this.setState({tableName:a,tableNameSet:!0}),(r=this.inputRef.current)==null||r.focus()}else(n==null&&e.file!=null||s==null&&e.paste!=null)&&this.setState({tableName:"",tableNameSet:!1});s!=null&&s!==""&&!i&&this.inputRef.current&&this.inputRef.current.focus(),n!=null&&n!==e.file?this.setState({type:Us.fromExtension(n.name)}):s!=null&&s!==""&&(e.paste===void 0||e.paste==="")&&this.setState({type:Us.AUTO})}componentWillUnmount(){const{parser:e}=this.state;e&&e.cancel()}handleCancel(){const{onClose:e}=this.props;e()}handleError(e){const{onClose:n,onError:s}=this.props;mh.error(e),s(e),n()}handleTableName(e){this.setState({tableName:e.target.value,tableNameSet:!0})}toggleFirstRowHeaders(){const{isFirstRowHeaders:e}=this.state;this.setState({isFirstRowHeaders:!e})}handleUpload(e){e.stopPropagation(),e.preventDefault();const{file:n,paste:s}=this.props;n!=null?n.name.endsWith(".zip")?this.handleZipFile(n):this.handleFile(n):s!==void 0&&s!==""&&this.handleFile(new Blob([s],{type:"text/plain"}))}handleFile(e,n=!1){mh.info(`Starting CSV parser for ${e instanceof File?e.name:"pasted values"} ${n?"":e.size} bytes`);const{session:s,timeZone:i,onInProgress:o}=this.props,{tableName:r,isFirstRowHeaders:l,type:a}=this.state,d=u=>{u.length===1?s.bindTableToVariable(u[0],r).then(()=>this.openTable()).catch(m=>this.handleError(m)):s.mergeTables(u).then(m=>{s.bindTableToVariable(m,r).then(()=>this.openTable()).catch(p=>this.handleError(p)),u.forEach(p=>p.close())}).catch(m=>this.handleError(m))},c=new bm({onFileCompleted:d,session:s,file:e,type:Us.TYPES[a],readHeaders:l,onProgress:this.handleProgress,onError:this.handleError,timeZone:i,isZip:n});c.parse(),this.setState({showProgress:!0,parser:c}),o(!0)}handleZipFile(e){const{onUpdate:n,unzip:s}=this.props;if(s==null){this.handleError(new Error("No support for zip files available."));return}s(e).then(i=>{let o=!1;for(let r=0;r<i.length;r+=1){const l=i[r];if(ps.isValidExtension(l.name)){n(`Loading ${l.name} as csv from ${e.name}`),o=!0,this.handleFile(l,!0);break}}if(!o)throw new Error(`No csv file found in ${e.name}`)}).catch(i=>this.handleError(i))}handleProgress(e){const{showProgress:n}=this.state;return n&&this.setState({progressValue:e}),!n}handleCancelInProgress(){const{onInProgress:e}=this.props,{parser:n}=this.state;n&&n.cancel(),this.setState({showProgress:!1,progressValue:0}),e(!1)}openTable(){const{onOpenTable:e,onClose:n}=this.props,{tableName:s}=this.state;e(s),n()}handleQueryTypeChange(e){this.setState({type:e.target.value})}render(){const{file:e,paste:n}=this.props,{tableName:s,isFirstRowHeaders:i,showProgress:o,progressValue:r,type:l}=this.state,a=Boolean(n)&&!s;return T("div",{className:"csv-input-bar",children:[!o&&T("form",{onSubmit:this.handleUpload,className:"csv-input-bar-container form-inline",children:[T("div",{className:"form-group",children:[h("label",{htmlFor:"tableNameInput",children:"Table name"}),h("input",{ref:this.inputRef,id:"tableNameInput",type:"text",className:z("form-control",{"is-invalid":a}),value:s,onChange:this.handleTableName})]}),T("div",{className:"form-group",children:[h("label",{htmlFor:"formatSelect",children:"File format"}),h("select",{id:"formatSelect",className:"custom-select",value:l,onChange:this.handleQueryTypeChange,children:KS})]}),h(St,{className:"firstRowHeaders",checked:i,onChange:this.toggleFirstRowHeaders,children:"First row is column headers"}),T("div",{className:"csv-input-buttons form-group",children:[h(W,{kind:"secondary",onClick:this.handleCancel,children:"Cancel"}),h(W,{kind:"primary",type:"submit",disabled:!(e!==null||n!==void 0&&n!=="")||!s,children:"Upload"})]})]}),o&&T("div",{className:"csv-progress-container",children:[h("label",{children:"Uploading Table"}),h("div",{className:"progress",children:h("div",{className:"progress-bar bg-primary",style:{width:`${r}%`},"aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100})}),T("label",{children:[r,"%"]}),h(W,{kind:"primary",onClick:this.handleCancelInProgress,children:"Cancel"})]})]})}}Sm.defaultProps={file:null,paste:null,unzip:null};const ph=Z.module("ConsoleMenu");class Cl extends w.exports.PureComponent{constructor(e){super(e),this.makeTableActions=Se((n,s,i)=>{const o=n.filter(r=>Ji.isTableType(r.type));return Cl.makeItemActions(o,s,r=>{this.tableSearchField=r},this.handleTableFilterChange,i)}),this.makeWidgetActions=Se((n,s,i)=>{const o=n.filter(r=>Ji.isWidgetType(r.type));return Cl.makeItemActions(o,s,r=>{this.widgetSearchField=r},this.handleWidgetFilterChange,i)}),this.handleTableFilterChange=this.handleTableFilterChange.bind(this),this.handleTableMenuClosed=this.handleTableMenuClosed.bind(this),this.handleTableMenuOpened=this.handleTableMenuOpened.bind(this),this.handleWidgetFilterChange=this.handleWidgetFilterChange.bind(this),this.handleWidgetMenuClosed=this.handleWidgetMenuClosed.bind(this),this.handleWidgetMenuOpened=this.handleWidgetMenuOpened.bind(this),this.state={tableFilterText:"",widgetFilterText:""}}static makeItemActions(e,n,s,i,o){if(e.length===0)return[];const r={menuElement:h(ws,{value:n,onChange:i,className:"console-menu",ref:s})};let l=e;n&&(l=l.filter(({title:d})=>d!=null&&d.toLowerCase().indexOf(n.toLowerCase())>=0));const a=l.map(d=>({title:d.title,action:()=>{o(d)}}));return[r,...a]}handleTableFilterChange(e){ph.debug("filtering tables..."),this.setState({tableFilterText:e.target.value})}handleTableMenuClosed(){this.setState({tableFilterText:""})}handleTableMenuOpened(){var e;(e=this.tableSearchField)==null||e.focus()}handleWidgetFilterChange(e){ph.debug("filtering widgets..."),this.setState({widgetFilterText:e.target.value})}handleWidgetMenuClosed(){this.setState({widgetFilterText:""})}handleWidgetMenuOpened(){var e;(e=this.widgetSearchField)==null||e.focus()}render(){const{overflowActions:e,objects:n,openObject:s}=this.props,{tableFilterText:i,widgetFilterText:o}=this.state,r=this.makeTableActions(n,i,s),l=this.makeWidgetActions(n,o,s),a={placement:"bottom-end"},d=r.length===0,c=l.length===0;return T("div",{className:"console-pane-menu",children:[T(W,{kind:"ghost",className:"btn-link-icon",disabled:d,onClick:()=>{},tooltip:d?"No tables available":"Tables",children:[T("div",{className:"fa-md fa-layers",children:[h(ee,{mask:xd,icon:Yn,transform:"right-5 down-5"}),h(ee,{icon:Yn,transform:"right-8 down-6"})]}),h(Fn,{actions:r,onMenuOpened:this.handleTableMenuOpened,onMenuClosed:this.handleTableMenuClosed,options:{initialKeyboardIndex:1},popperOptions:a},"table-actions ")]}),T(W,{kind:"ghost",className:"btn-link-icon",disabled:l.length===0,onClick:()=>{},tooltip:c?"No widgets available":"Widgets",children:[T("div",{className:"fa-md fa-layers",children:[h(ee,{mask:Fu,icon:Yn,transform:"right-5 down-5"}),h(ee,{icon:Yn,transform:"right-8 down-6"})]}),h(Fn,{actions:l,onMenuOpened:this.handleWidgetMenuOpened,onMenuClosed:this.handleWidgetMenuClosed,options:{initialKeyboardIndex:1},popperOptions:a},"table-actions")]}),h(W,{kind:"ghost",className:"btn-overflow btn-link-icon",icon:xu,tooltip:"More Actions...",onClick:()=>{},children:h(Fn,{actions:e,popperOptions:a})})]})}}class wm extends w.exports.PureComponent{constructor(e){super(e),this.handleCommandStarted=this.handleCommandStarted.bind(this),this.handleCommandCompleted=this.handleCommandCompleted.bind(this),this.pending=new Ss,this.state={isDisconnected:!1,isCommandRunning:!1}}componentDidMount(){this.startListening()}componentWillUnmount(){this.stopListening(),this.cancelPendingPromises()}startListening(){const{session:e}=this.props;e.addEventListener(M.IdeSession.EVENT_COMMANDSTARTED,this.handleCommandStarted)}stopListening(){const{session:e}=this.props;e.removeEventListener(M.IdeSession.EVENT_COMMANDSTARTED,this.handleCommandStarted)}cancelPendingPromises(){this.pending.cancel()}handleCommandStarted(e){const{result:n}=e.detail;this.pending.add(n).then(()=>this.handleCommandCompleted(null)).catch(s=>this.handleCommandCompleted(s)),this.setState({isCommandRunning:!0})}handleCommandCompleted(e){e instanceof Qi||this.setState({isCommandRunning:this.pending.pending.length>0})}render(){const{children:e,openObject:n,overflowActions:s,objects:i}=this.props,{isDisconnected:o,isCommandRunning:r}=this.state;let l=null,a=null;return o?(l="console-status-icon-disconnected",a="Worker is disconnected"):r?(l="console-status-icon-pending",a="Worker is busy"):(l="console-status-icon-idle",a="Worker is idle"),T("div",{className:"console-pane-status-bar",children:[T("div",{children:[h("div",{className:z("console-status-icon",l)}),h(Ye,{children:a})]}),e,h(Cl,{overflowActions:s,openObject:n,objects:i})]})}}wm.defaultProps={children:null};const os=Z.module("Console"),gh={isAutoLaunchPanelsEnabled:!0,isPrintStdOutEnabled:!0,isClosePanelsOnDisconnectEnabled:!0},Po=class extends w.exports.PureComponent{constructor(t){super(t),this.processLogMessageQueue=Qn(()=>{this.scrollConsoleHistoryToBottom(),this.setState(s=>{os.debug2("processLogMessageQueue",this.queuedLogMessages.length," items");let{consoleHistory:i}=s;return i=i.concat(this.queuedLogMessages),this.queuedLogMessages=[],{consoleHistory:i}})},Po.LOG_THROTTLE),this.getObjects=Se(s=>[...s.values()]),this.getContextActions=Se(s=>[...s,{action:this.handleClearShortcut,shortcut:Bt.CONSOLE.CLEAR},{action:this.handleFocusHistory,shortcut:Bt.CONSOLE.FOCUS_HISTORY}]),this.handleCommandResult=this.handleCommandResult.bind(this),this.handleCommandStarted=this.handleCommandStarted.bind(this),this.handleCommandSubmit=this.handleCommandSubmit.bind(this),this.handleClearShortcut=this.handleClearShortcut.bind(this),this.handleFocusHistory=this.handleFocusHistory.bind(this),this.handleLogMessage=this.handleLogMessage.bind(this),this.handleOverflowActions=this.handleOverflowActions.bind(this),this.handleScrollPaneScroll=this.handleScrollPaneScroll.bind(this),this.handleToggleAutoLaunchPanels=this.handleToggleAutoLaunchPanels.bind(this),this.handleToggleClosePanelsOnDisconnect=this.handleToggleClosePanelsOnDisconnect.bind(this),this.handleTogglePrintStdout=this.handleTogglePrintStdout.bind(this),this.handleUploadCsv=this.handleUploadCsv.bind(this),this.handleHideCsv=this.handleHideCsv.bind(this),this.handleCsvFileCanceled=this.handleCsvFileCanceled.bind(this),this.handleCsvFileOpened=this.handleCsvFileOpened.bind(this),this.handleCsvPaste=this.handleCsvPaste.bind(this),this.handleDragEnter=this.handleDragEnter.bind(this),this.handleDragLeave=this.handleDragLeave.bind(this),this.handleClearDragError=this.handleClearDragError.bind(this),this.handleOpenCsvTable=this.handleOpenCsvTable.bind(this),this.handleCsvUpdate=this.handleCsvUpdate.bind(this),this.handleCsvError=this.handleCsvError.bind(this),this.handleCsvInProgress=this.handleCsvInProgress.bind(this),this.consolePane=X.createRef(),this.consoleInput=X.createRef(),this.consoleHistoryScrollPane=X.createRef(),this.pending=new Ss,this.queuedLogMessages=[];const{objectMap:e,settings:n}=this.props;this.state={consoleHistory:[],consoleHeight:0,isScrollDecorationShown:!1,objectHistoryMap:new Map,objectMap:new Map(e),showCsvOverlay:!1,csvFile:null,csvPaste:null,dragError:null,csvUploadInProgress:!1,...gh,...n}}static isErrorLevel(t){return t===vt.STDERR||t===vt.ERROR||t===vt.FATAL}static isOutputLevel(t){return t===vt.STDOUT||Po.isErrorLevel(t)}componentDidMount(){this.initConsoleLogging();const{session:t}=this.props;t.addEventListener(M.IdeSession.EVENT_COMMANDSTARTED,this.handleCommandStarted),this.updateDimensions()}componentDidUpdate(t,e){const{props:n,state:s}=this;this.sendSettingsChange(e,s),n.objectMap!==t.objectMap&&this.updateObjectMap()}componentWillUnmount(){const{session:t}=this.props;t.removeEventListener(M.IdeSession.EVENT_COMMANDSTARTED,this.handleCommandStarted),this.pending.cancel(),this.processLogMessageQueue.cancel(),this.deinitConsoleLogging()}initConsoleLogging(){const{session:t}=this.props;this.cancelListener=t.onLogMessage(this.handleLogMessage)}deinitConsoleLogging(){this.cancelListener!=null&&(this.cancelListener(),this.cancelListener=void 0)}handleClearShortcut(t){var e;t.preventDefault(),t.stopPropagation(),(e=this.consoleInput.current)==null||e.clear()}handleCommandStarted(t){const{code:e,result:n}=t.detail,s=this.pending.add(n),i={command:e,disabledObjects:[],startTime:Date.now(),cancelResult:()=>{n.cancel()},wrappedResult:s},{commandHistoryStorage:o,language:r,scope:l}=this.props,a=o.addItem(r,l,e,{command:e,startTime:new Date().toJSON()});a.catch(d=>{os.debug("Error adding workspace item",d)}),this.setState(d=>({consoleHistory:d.consoleHistory.concat(i)}),()=>{this.scrollConsoleHistoryToBottom(!0)}),s.then(d=>{this.handleCommandResult(d,i,a)}).catch(d=>{this.handleCommandError(d,i,a)})}handleCommandResult(t,e,n){const s={...e,wrappedResult:void 0,cancelResult:void 0,result:t!=null?t:e.result};this.setState(({consoleHistory:i})=>{const o=i.lastIndexOf(e);if(o<0)return os.error("historyItem not found in consoleHistory"),null;const r=i.concat();return r[o]=s,{consoleHistory:r}}),t&&(this.updateHistory(t,s),this.updateKnownObjects(s),this.updateWorkspaceHistoryItem({error:t.error},n),this.closeRemovedItems(t.changes),this.openUpdatedItems(t.changes))}handleCommandError(t,e,n){if(ye.isCanceled(t)){os.debug("Called handleCommandError on a cancelled promise result");return}this.updateWorkspaceHistoryItem({error:`${t}`},n),this.setState(s=>{const i=s.consoleHistory.concat(),o=i.lastIndexOf(e),r={...e};return r.wrappedResult=void 0,r.cancelResult=void 0,r.endTime=Date.now(),r.result={error:t},i[o]=r,{consoleHistory:i}})}handleFocusHistory(t){t.preventDefault(),t.stopPropagation();const{focusCommandHistory:e}=this.props;e()}handleLogMessage(t){const{isPrintStdOutEnabled:e}=this.state;!e||Po.isOutputLevel(t.logLevel)&&this.queueLogMessage(t.message,t.logLevel)}queueLogMessage(t,e){const n={};Po.isErrorLevel(e)?n.error=t:n.message=t;const s={command:void 0,result:n};this.queuedLogMessages.push(s),this.processLogMessageQueue()}openUpdatedItems(t){const{isAutoLaunchPanelsEnabled:e}=this.state;if(t==null||!e)return;const{openObject:n}=this.props;[...t.created,...t.updated].forEach(s=>n(s))}closeRemovedItems(t){if(t==null||t.removed==null||t.removed.length===0)return;const{closeObject:e}=this.props,{removed:n}=t;n.forEach(s=>e(s))}updateHistory(t,e){const n=e;t==null||t.changes==null||n==null||(n.endTime=Date.now(),this.scrollConsoleHistoryToBottom(),this.setState(s=>({consoleHistory:s.consoleHistory.concat()})))}updateKnownObjects(t){let e;if(t.result&&(e=t.result.changes),!e||(e.created==null||e.created.length===0)&&(e.updated==null||e.updated.length===0)&&(e.removed==null||e.removed.length===0)){os.debug2("updateKnownObjects no changes");return}this.setState(n=>{let{consoleHistory:s}=n;const i=s.lastIndexOf(t);if(i<0)return os.error("historyItem not found in state.consoleHistory"),null;const o=new Map(n.objectHistoryMap),r=new Map(n.objectMap),l=(a,d=!1)=>{var m;const{title:c}=a;L(c);const u=o.get(c);if(u!=null&&u>=0){s===n.consoleHistory&&(s=s.concat());const p={...s[u],disabledObjects:[...(m=s[u].disabledObjects)!=null?m:[],c]};s[u]=p}o.set(c,i),d?r.delete(c):r.set(c,a)};return e==null||e.updated.forEach(a=>l(a)),e==null||e.removed.forEach(a=>l(a,!0)),e==null||e.created.forEach(a=>{const{title:d}=a;L(d),o.set(d,i),r.set(d,a)}),{objectHistoryMap:o,objectMap:r,consoleHistory:s}})}updateObjectMap(){const{objectMap:t}=this.props;this.setState({objectMap:t})}updateWorkspaceHistoryItem(t,e){const n=this.pending.add(e),s=new Date().toJSON();n.then(i=>{const o={...i,data:{...i.data,endTime:s,result:t}},{commandHistoryStorage:r,language:l}=this.props;r.updateItem(l,o).catch(a=>{os.warn("Error updating command history storage",a)})}).catch(i=>{os.debug("Error updating workspace history item",i)})}scrollConsoleHistoryToBottom(t=!1){const e=this.consoleHistoryScrollPane.current;L(e),!(!t&&e.scrollTop<e.scrollHeight-e.offsetHeight)&&window.requestAnimationFrame(()=>{e.scrollTop=e.scrollHeight})}handleScrollPaneScroll(){const t=this.consoleHistoryScrollPane.current;L(t),t.scrollTop>0&&t.scrollHeight>t.clientHeight?this.setState({isScrollDecorationShown:!0}):this.setState({isScrollDecorationShown:!1})}handleToggleAutoLaunchPanels(){this.setState(t=>({isAutoLaunchPanelsEnabled:!t.isAutoLaunchPanelsEnabled}))}handleToggleClosePanelsOnDisconnect(){this.setState(t=>({isClosePanelsOnDisconnectEnabled:!t.isClosePanelsOnDisconnectEnabled}))}handleTogglePrintStdout(){this.setState(t=>({isPrintStdOutEnabled:!t.isPrintStdOutEnabled}))}handleUploadCsv(){this.setState({showCsvOverlay:!0,dragError:null,csvUploadInProgress:!1})}handleHideCsv(){this.setState({showCsvOverlay:!1,csvFile:null,csvPaste:null,dragError:null,csvUploadInProgress:!1})}handleCsvFileCanceled(){this.setState({csvFile:null,csvPaste:null})}handleCsvFileOpened(t){this.setState({csvFile:t,csvPaste:null})}handleCsvPaste(t){this.setState({csvFile:null,csvPaste:t})}handleDragEnter(t){if(t.dataTransfer==null||t.dataTransfer.items==null||t.dataTransfer.items.length===0||t.dataTransfer.items[0].kind==="string")return;t.preventDefault(),t.stopPropagation(),this.setState({showCsvOverlay:!0});const{items:e}=t.dataTransfer;if(e.length>1){this.setState({dragError:ps.MULTIPLE_FILE_ERROR});return}const n=e[0];ps.isValidDropItem(n)?this.setState({dragError:null}):this.setState({dragError:ps.FILE_TYPE_ERROR})}handleDragLeave(t){t.currentTarget==null||t.currentTarget instanceof Element&&t.relatedTarget instanceof Element&&t.currentTarget.contains(t.relatedTarget)||(t.preventDefault(),t.stopPropagation(),this.setState({showCsvOverlay:!1,dragError:null}))}handleClearDragError(){this.setState({dragError:null})}handleOpenCsvTable(t){const{openObject:e,commandHistoryStorage:n,language:s,scope:i}=this.props,{consoleHistory:o,objectMap:r}=this.state,l={name:t,title:t,type:M.VariableType.TABLE},a=r.has(t),d={startTime:Date.now(),endTime:Date.now(),disabledObjects:[],result:{changes:{created:[],updated:[],removed:[],[a?"updated":"created"]:[l]}}},c=o.concat(d);this.setState({consoleHistory:c}),this.scrollConsoleHistoryToBottom(!0),this.updateKnownObjects(d),e({name:t,title:t,type:M.VariableType.TABLE}),n.addItem(s,i,t,{command:t,startTime:new Date().toJSON(),endTime:new Date().toJSON()})}addConsoleHistoryMessage(t,e){const{consoleHistory:n}=this.state,s={command:"",startTime:Date.now(),endTime:Date.now(),result:{message:t,error:e}},i=n.concat(s);this.setState({consoleHistory:i})}handleCsvUpdate(t){this.addConsoleHistoryMessage(t)}handleCsvError(t){this.addConsoleHistoryMessage(void 0,t!=null?`${t}`:void 0)}handleCsvInProgress(t){this.setState({csvUploadInProgress:t})}handleOverflowActions(){const{isAutoLaunchPanelsEnabled:t,isClosePanelsOnDisconnectEnabled:e,isPrintStdOutEnabled:n}=this.state,{actions:s}=this.props;return[...s,{title:"Print Stdout",action:this.handleTogglePrintStdout,group:ae.groups.high,icon:n?jn:void 0,order:10},{title:"Auto Launch Panels",action:this.handleToggleAutoLaunchPanels,group:ae.groups.high,icon:t?jn:void 0,order:20},{title:"Close Panels on Disconnect",action:this.handleToggleClosePanelsOnDisconnect,group:ae.groups.high,icon:e?jn:void 0,order:30},{title:"Upload Table from File",action:this.handleUploadCsv,group:ae.groups.high+10,order:40}]}handleCommandSubmit(t){if(t==="clear"||t==="cls")this.clearConsoleHistory();else if(t.length>0){const{session:e}=this.props;e.runCode(t).catch(n=>{os.error("There was an error initiating the command",n)})}else{const e={command:" ",result:{},startTime:Date.now(),endTime:Date.now()};this.scrollConsoleHistoryToBottom(!0),this.setState(n=>({consoleHistory:n.consoleHistory.concat(e)}))}}clearConsoleHistory(){this.pending.cancel(),this.setState(t=>{const e=new Map([...t.objectHistoryMap.keys()].map(n=>[n,-1]));return{consoleHistory:[],objectHistoryMap:e}})}addCommand(t,e=!0,n=!1){!this.consoleInput.current||(this.consoleInput.current.setConsoleText(t,e,n),e&&this.scrollConsoleHistoryToBottom(!0))}focus(){var t;(t=this.consoleInput.current)==null||t.focus()}sendSettingsChange(t,e,n=!0){const s=Object.keys(gh),i={};let o=!1;for(let l=0;l<s.length;l+=1){const a=s[l],{[a]:d}=e,{[a]:c}=t;d!==c&&(o=!0),i[a]=d}if(n&&!o)return;const{onSettingsChange:r}=this.props;r(i)}updateDimensions(){this.consolePane.current&&this.setState({consoleHeight:this.consolePane.current.clientHeight}),this.consoleInput.current&&this.consoleInput.current.updateDimensions()}render(){const{actions:t,historyChildren:e,language:n,statusBarChildren:s,openObject:i,session:o,scope:r,commandHistoryStorage:l,timeZone:a,disabled:d,unzip:c}=this.props,{consoleHeight:u,consoleHistory:m,isScrollDecorationShown:p,objectMap:g,showCsvOverlay:f,csvFile:b,csvPaste:C,dragError:S,csvUploadInProgress:v}=this.state,y=this.getObjects(g),E=Math.round(u*.7),I=this.getContextActions(t);return T("div",{role:"presentation",className:z("iris-console","h-100","w-100",{disabled:d}),children:[T("div",{className:"console-pane",ref:this.consolePane,children:[h(wm,{session:o,overflowActions:this.handleOverflowActions,openObject:i,objects:y,children:s}),T("div",{className:"console-csv-container",onDragOver:ps.handleDragOver,onDragEnter:this.handleDragEnter,onDragLeave:this.handleDragLeave,children:[f&&h(ps,{onCancel:this.handleCsvFileCanceled,onFileOpened:this.handleCsvFileOpened,onPaste:this.handleCsvPaste,clearDragError:this.handleClearDragError,dragError:S,onError:this.handleCsvError,uploadInProgress:v,allowZip:c!=null}),T("div",{role:"presentation",className:z("scroll-pane no-scroll-x",{"scroll-decoration":p}),onScroll:this.handleScrollPaneScroll,ref:this.consoleHistoryScrollPane,children:[h(mm,{items:m,openObject:i,language:n,disabled:d}),e]})]}),!f&&h(gl,{ref:this.consoleInput,session:o,language:n,scope:r,onSubmit:this.handleCommandSubmit,maxHeight:E,commandHistoryStorage:l}),f&&h(Sm,{session:o,onOpenTable:this.handleOpenCsvTable,onClose:this.handleHideCsv,onUpdate:this.handleCsvUpdate,onError:this.handleCsvError,file:b!=null?b:void 0,paste:C!=null?C:void 0,onInProgress:this.handleCsvInProgress,timeZone:a,unzip:c})]}),h(ae,{actions:I,ignoreClassNames:[gl.INPUT_CLASS_NAME]})]})}};let Pd=Po;Pd.defaultProps={statusBarChildren:null,settings:{},onSettingsChange:()=>{},scope:null,actions:[],historyChildren:null,timeZone:"America/New_York",objectMap:new Map,disabled:!1,unzip:null};Pd.LOG_THROTTLE=500;class Wl extends w.exports.Component{constructor(e){super(e),this.handleResize=this.handleResize.bind(this),this.container=null,this.state={}}componentDidMount(){this.initEditor(),window.addEventListener("resize",this.handleResize)}componentWillUnmount(){window.removeEventListener("resize",this.handleResize),this.destroyEditor()}setLanguage(e){if(this.editor){const n=this.editor.getModel();L(n),gs.setModelLanguage(n,e)}}handleResize(){this.updateDimensions()}toggleFind(){this.editor&&(this.editor.focus(),this.editor.trigger("toggleFind","actions.find",void 0))}updateDimensions(){var e;(e=this.editor)==null||e.layout()}initEditor(){const{onEditorInitialized:e}=this.props;let{settings:n}=this.props;n={copyWithSyntaxHighlighting:!1,fixedOverflowWidgets:!0,folding:!1,fontFamily:"Fira Mono",glyphMargin:!1,language:"python",lineNumbersMinChars:3,minimap:{enabled:!1},scrollBeyondLastLine:!1,tabCompletion:"on",value:"",wordWrap:"off",...n},L(this.container),this.editor=gs.create(this.container,n),this.editor.addAction({id:"find",label:"Find",keybindings:[Cn.CtrlCmd|Kn.KeyF],precondition:void 0,keybindingContext:void 0,contextMenuGroupId:"navigation",contextMenuOrder:1,run:()=>{this.toggleFind()}}),this.editor.layout(),rt.removeConflictingKeybindings(this.editor),e(this.editor)}destroyEditor(){const{onEditorWillDestroy:e}=this.props;L(this.editor),e(this.editor),this.editor.dispose(),this.editor=void 0}render(){const{className:e}=this.props;return h("div",{className:z("editor-container",e),ref:n=>{this.container=n}})}}Wl.defaultProps={className:"fill-parent-absolute",onEditorInitialized:()=>{},onEditorWillDestroy:()=>{},settings:{}};const pn=Z.module("ScriptEditor");class vm extends w.exports.Component{constructor(e){super(e),this.handleEditorInitialized=this.handleEditorInitialized.bind(this),this.handleEditorWillDestroy=this.handleEditorWillDestroy.bind(this),this.handleRun=this.handleRun.bind(this),this.handleRunSelected=this.handleRunSelected.bind(this),this.updateShortcuts=this.updateShortcuts.bind(this),this.contextActionCleanups=[],this.editorComponent=X.createRef(),this.state={model:null}}componentDidMount(){Ae.addEventListener("onUpdate",this.updateShortcuts)}componentDidUpdate(e){var c,u;const{sessionLanguage:n,settings:s}=this.props,i=s==null?void 0:s.language;i!==((c=e.settings)==null?void 0:c.language)&&(pn.debug("Set language",i),this.setLanguage(i));const r=n==null&&e.sessionLanguage!=null,l=i===n,a=((u=e.settings)==null?void 0:u.language)===e.sessionLanguage;(r||n!==void 0&&a&&!l)&&(pn.debug("De-init completion and context actions"),this.deInitContextActions(),this.deInitCodeCompletion()),(n!=null&&e.sessionLanguage==null&&l||n!==void 0&&!a&&l)&&(pn.debug("Init completion and context actions"),this.initContextActions(),this.initCodeCompletion())}componentWillUnmount(){Ae.removeEventListener("onUpdate",this.updateShortcuts)}getValue(){return this.editor?this.editor.getValue():(pn.error("Editor not initialized"),null)}getSelectedCommand(){var d,c;const e=(d=this.editor)==null?void 0:d.getSelection();L(e);const n=(c=this.editor)==null?void 0:c.getModel();L(n);const{startLineNumber:s,endColumn:i}=e;let{endLineNumber:o}=e;i===1&&o>s&&(o-=1);const r=n==null?void 0:n.getLineMinColumn(s),l=n==null?void 0:n.getLineMaxColumn(o),a=e.setStartPosition(s,r).setEndPosition(o,l);return n==null?void 0:n.getValueInRange(a)}handleEditorInitialized(e){const{focusOnMount:n,onChange:s,onEditorInitialized:i,settings:o,session:r,sessionLanguage:l}=this.props;pn.debug("handleEditorInitialized",l,r,o),this.editor=e,this.setState({model:this.editor.getModel()}),rt.setEOL(e),rt.registerPasteHandler(e),r!=null&&o&&l===o.language&&(this.initContextActions(),this.initCodeCompletion()),e.onDidChangeModelContent(s),n!=null&&n&&e.focus(),i(this.editor)}handleEditorWillDestroy(e){pn.debug("handleEditorWillDestroy");const{onEditorWillDestroy:n}=this.props;n(e),this.deInitContextActions(),this.deInitCodeCompletion(),this.setState({model:null}),this.editor=void 0}handleRun(){const{onRunCommand:e}=this.props,n=this.getValue();n!=null&&e(n)}handleRunSelected(){const{onRunCommand:e}=this.props,n=this.getSelectedCommand();e(n)}initContextActions(){if(this.contextActionCleanups.length>0){pn.error("Context actions already initialized.");return}if(!this.editor)return;const e=[];e.push(this.editor.addAction({id:"run-code",label:"Run",keybindings:[rt.getMonacoKeyCodeFromShortcut(Bt.NOTEBOOK.RUN)],contextMenuGroupId:"navigation",contextMenuOrder:1.5,run:()=>{this.handleRun()}})),e.push(this.editor.addAction({id:"run-selected-code",label:"Run Selected",keybindings:[rt.getMonacoKeyCodeFromShortcut(Bt.NOTEBOOK.RUN_SELECTED)],contextMenuGroupId:"navigation",contextMenuOrder:1.5,run:()=>{this.handleRunSelected()}})),this.contextActionCleanups=e}deInitContextActions(){this.contextActionCleanups.length>0&&(this.contextActionCleanups.forEach(e=>e.dispose()),this.contextActionCleanups=[])}updateShortcuts(){this.deInitContextActions(),this.initContextActions()}initCodeCompletion(){if(this.completionCleanup!=null){pn.error("Code completion already initialized.");return}const{session:e}=this.props;pn.debug("initCodeCompletion",this.editor,e),this.editor&&e!=null&&(this.completionCleanup=rt.openDocument(this.editor,e))}deInitCodeCompletion(){const{session:e}=this.props;pn.debug("deInitCodeCompletion",this.editor,e),this.completionCleanup&&(this.completionCleanup.dispose(),this.completionCleanup=void 0,this.editor&&e!=null&&rt.closeDocument(this.editor,e))}append(e,n=!0){L(this.editor);const s=this.editor.getModel();L(s);const i=s.getValue();i?s.setValue(`${i}
15
+ ${e}`):s.setValue(`${e}`);const o=s.getLineCount(),r=s.getLineLength(o)+1;this.editor.setPosition({lineNumber:o,column:r}),n&&this.editor.focus()}updateDimensions(){pn.debug("updateDimensions"),this.editor&&this.editor.layout()}focus(){pn.debug("focus"),this.editor&&this.editor.focus()}toggleFind(){this.editorComponent.current&&this.editorComponent.current.toggleFind()}setLanguage(e){this.editorComponent.current&&e!==void 0&&this.editorComponent.current.setLanguage(e)}render(){var u;const{error:e,isLoaded:n,isLoading:s,session:i,sessionLanguage:o,settings:r}=this.props,{model:l}=this.state,a=e?`Unable to open document. ${e}`:null,d=r&&(u=r.language)!=null?u:null,c=l&&i&&d===o;return T(Te,{children:[(e||s)&&h("div",{className:"h-100 w-100 position-relative",children:h(Vl,{errorMessage:a,isLoading:s,isLoaded:n})}),n&&h("div",{className:"h-100 w-100 script-editor",children:r&&T(Te,{children:[h(Wl,{ref:this.editorComponent,settings:r,onEditorInitialized:this.handleEditorInitialized,onEditorWillDestroy:this.handleEditorWillDestroy}),c!=null&&c&&h(pm,{model:l,language:d,session:i})]})})]})}}vm.defaultProps={error:null,isLoading:!1,isLoaded:!1,focusOnMount:!0,onChange:()=>{},onEditorInitialized:()=>{},onEditorWillDestroy:()=>{},session:null};const qS={groovy:"Groovy",python:"Python",scala:"Scala"};class fh{static normalizeScriptLanguage(e){return qS[e]||null}static getDisabledRunTooltip(e,n,s,i){return e?n?null:`${s} doesn't match the session language \u2013 ${i} disabled`:`Console session not connected \u2013 ${i} disabled`}}const YS=250,XS=2500,Tm=class extends w.exports.Component{constructor(t){super(t),this.loadData=Ze(()=>{const{commandHistoryStorage:e,item:n,language:s}=this.props,{id:i}=n;this.cleanup=e.listenItem(s,i,this.handleUpdate,this.handleError)},YS),this.getPreviewText=be(e=>e.split(`
16
+ `,XS).join(`
17
+ `),{max:1}),this.handleUpdate=this.handleUpdate.bind(this),this.handleError=this.handleError.bind(this),this.handleTimeout=this.handleTimeout.bind(this),this.state={currentTime:Date.now()}}static getTimeString(t,e){if(t==null||e===""||e===0)return null;const n=Math.round((new Date(e).valueOf()-new Date(t).valueOf())/1e3);return n<1?"<1s":Dn.formatElapsedTime(n)}componentDidMount(){this.loadData()}componentDidUpdate(t,e){var s;const{data:n}=this.state;this.timer==null&&!(n!=null&&n.result)&&Boolean(n==null?void 0:n.startTime)&&!(n==null||n.endTime===void 0)?this.startTimer():((n==null?void 0:n.result)&&!((s=e.data)!=null&&s.result)||Boolean(n==null?void 0:n.endTime)&&!(e.data==null||e.data.endTime===void 0))&&this.stopTimer()}componentWillUnmount(){this.loadData.cancel(),this.cleanup!=null&&this.cleanup(),this.stopTimer()}startTimer(){this.stopTimer(),this.timer=setInterval(this.handleTimeout,1e3)}stopTimer(){this.timer&&(clearInterval(this.timer),this.timer=void 0)}updateTime(){this.setState({currentTime:Date.now()})}handleError(t){this.setState({error:`${t}`})}handleUpdate(t){const{data:e}=t!=null?t:{};this.setState({data:e});const{onUpdate:n}=this.props;n==null||n(e)}handleTimeout(){this.updateTime()}render(){var m;const{item:{name:t},language:e}=this.props,{currentTime:n,data:s,error:i}=this.state,{result:o,startTime:r,endTime:l}=s!=null?s:{},a=(m=o==null?void 0:o.error)!=null?m:i,d=Tm.getTimeString(r,l!=null?l:n),c=this.getPreviewText(t),u=Boolean(d);return T("div",{className:"command-history-item-tooltip",children:[T("div",{className:"scroll-container",children:[h(zl,{language:e,children:c}),c.length<t.length&&h("p",{children:"Preview Truncated..."})]}),T("div",{className:"result-info",children:[T("div",{className:"d-flex justify-content-between",children:[Boolean(a)&&T("div",{className:"text-danger mr-1",children:[h(ee,{icon:fs})," Executed with errors"]}),T("div",{className:"time-wrapper",children:["Elapsed time:"," ",u?h("span",{className:"time-string",children:d}):h(On,{})]})]}),Boolean(a)&&h("div",{className:"error-message",children:a})]})]})}};let Em=Tm;Em.defaultProps={onUpdate:()=>{}};const jS=512;function ym(t){const{item:e,language:n,isSelected:s,commandHistoryStorage:i}=t,o=e.name.substring(0,jS),r=w.exports.useRef(null),l=w.exports.useCallback(()=>{var a;(a=r.current)==null||a.update()},[r]);return T("div",{className:z("command-history-item",{selected:s}),children:[o,h(Ye,{ref:r,interactive:!0,options:{placement:"left",modifiers:{preventOverflow:{enabled:!0,boundariesElement:"viewport",order:825}}},popperClassName:"command-history-item-popper",children:h(Em,{item:e,language:n,onUpdate:l,commandHistoryStorage:i})})]})}ym.defaultProps={isSelected:!1};class bl extends w.exports.Component{static itemKey(e,n){return`${n.title}`}static renderContent(e){return e.selectionRequired!==void 0&&e.selectionRequired?T("div",{className:"fa-md fa-layers",children:[h(ee,{icon:Zi,mask:e.icon,transform:"right-5 down-5 shrink-4"}),h(ee,{icon:fC,transform:"shrink-3 right-7 down-6"})]}):h(ee,{icon:e.icon})}render(){const{actions:e,hasSelection:n}=this.props;return h("div",{className:"command-history-actions",children:e.map((s,i)=>h(W,{kind:"inline",className:z(s.className),onClick:s.action,tooltip:s.description,disabled:s.selectionRequired!==void 0&&s.selectionRequired&&!n,icon:bl.renderContent(s)},bl.itemKey(i,s)))})}}const ZS=150,Ch=3,bh=Z.module("CommandHistoryViewportUpdater");function QS({table:t,columns:e,top:n=0,bottom:s=0,search:i,isReversed:o=!1,onUpdate:r}){const l=w.exports.useMemo(()=>Qn(a=>{const d=a.bottom-a.top,c=Math.max(0,a.top-d*Ch),u=a.bottom+d*Ch;t.setViewport({top:c,bottom:u,columns:a.columns})},ZS),[t]);return w.exports.useEffect(function(){const d=t.onUpdate(c=>{var u,m;r({items:(u=c.items)!=null?u:[],offset:(m=c.offset)!=null?m:0})});return()=>{bh.debug("onUpdate cleanup"),d()}},[t,r]),w.exports.useEffect(function(){t.setSearch(i!=null?i:"")},[t,i]),w.exports.useEffect(function(){l({top:n,bottom:s,columns:e})},[l,n,s,e,i,o]),w.exports.useEffect(()=>()=>{bh.debug2("Cancel throttledUpdateViewport"),l.cancel()},[l]),null}const Ds=Z.module("CommandHistory"),cs=class extends w.exports.Component{constructor(t){super(t),this.copySelectedCommands=this.copySelectedCommands.bind(this),this.createNotebook=this.createNotebook.bind(this),this.sendToConsole=this.sendToConsole.bind(this),this.renderItem=this.renderItem.bind(this),this.runInConsole=this.runInConsole.bind(this),this.sendToNotebook=this.sendToNotebook.bind(this),this.handleSelect=this.handleSelect.bind(this),this.handleSelectionChange=this.handleSelectionChange.bind(this),this.handleSearchChange=this.handleSearchChange.bind(this),this.handleViewportChange=this.handleViewportChange.bind(this),this.handleViewportUpdate=this.handleViewportUpdate.bind(this),this.itemActions=[{title:"Copy Selection",description:"Copy selected commands to clipboard",icon:DC,shortcut:bs.COPY,action:this.copySelectedCommands,group:ae.groups.edit},{title:"Send to Console",description:"Open selected commands in the console",icon:Gc,shortcut:Bt.COMMAND_HISTORY.SEND_TO_CONSOLE,action:this.sendToConsole,group:cs.menuGroups.send,order:10},{title:"Run in Console",description:"Run selected commands in the console",icon:ul,shortcut:Bt.COMMAND_HISTORY.RUN,action:this.runInConsole,group:cs.menuGroups.send,order:10},{title:"Send to Active Notebook",description:"Open selected commands in a notebook",icon:Wc,shortcut:Bt.COMMAND_HISTORY.SEND_TO_NOTEBOOK,action:this.sendToNotebook,group:cs.menuGroups.send,order:20},{title:"Send to New Notebook",description:"Open selected commands in a new notebook",icon:ku,action:this.createNotebook,group:cs.menuGroups.send,order:30}],this.historyActions=[{title:"Send to Console",icon:Gc,selectionRequired:!0,description:"Open selected commands in the console",action:this.sendToConsole},{title:"Send to Notebook",icon:Wc,selectionRequired:!0,description:"Open selected commands in a notebook",action:this.sendToNotebook}],this.pending=new Ss,this.searchInputRef=X.createRef(),this.itemListRef=X.createRef();const{table:e}=t;this.state={actions:[],historyActions:this.historyActions,top:0,bottom:0,itemCount:e.size,items:[],offset:0,selectedRanges:[],searchText:""}}static getCommandsFromViewport(t,e,n){const s=[];for(let i=0;i<n.length;i+=1){const o=n[i];for(let r=o[0];r<=o[1];r+=1)if(r>=e&&r<e+t.length){const{name:l}=t[r-e];s.push(l)}}return s}static async getCommandsFromSnapshot(t,e){return[...(await t.getSnapshot(e)).values()].map(s=>s.name)}componentWillUnmount(){this.pending.cancel()}async getSelectedCommands(){const{items:t,offset:e,selectedRanges:n}=this.state,s=n.slice().sort((o,r)=>o[0]-r[0]);if(s.length===0)return[];if(s[0][0]>=e&&s[s.length-1][1]<e+t.length)return cs.getCommandsFromViewport(t,e,s);const{table:i}=this.props;return this.pending.add(cs.getCommandsFromSnapshot(i,s))}getSelectedCommandText(){return this.getSelectedCommands().then(t=>t.join(`
18
+ `))}updateActions(){this.setState(t=>{const{selectedRanges:e}=t,n=e.reduce((s,i)=>s+i[1]-i[0]+1,0);return n>0&&n<cs.MAX_SELECTION_COUNT?(Ds.debug("Updating actions",this.itemActions),{actions:this.itemActions}):(Ds.debug("Disabling actions",n),{actions:[]})})}copySelectedCommands(){this.getSelectedCommandText().then(ro).catch(Ds.error)}createNotebook(){this.getSelectedCommandText().then(t=>{const{language:e,sendToNotebook:n}=this.props;n({value:t,language:e},!0)}).catch(Ds.error)}sendToNotebook(){this.getSelectedCommandText().then(t=>{const{language:e,sendToNotebook:n}=this.props;n({value:t,language:e})}).catch(Ds.error)}sendToConsole(){const{sendToConsole:t}=this.props;this.getSelectedCommandText().then(t).catch(Ds.error)}runInConsole(){this.getSelectedCommandText().then(t=>{const{sendToConsole:e}=this.props;e(t,!0,!0)}).catch(Ds.error)}handleSelect(t){const{sendToConsole:e}=this.props,{items:n,offset:s}=this.state;if(t<s||t>=s+n.length){Ds.error("Invalid index!",t);return}const{name:i}=n[t-s];e(i)}handleSelectionChange(t){this.setState({selectedRanges:t}),this.updateActions()}handleViewportChange(t,e){this.setState({top:t,bottom:e})}handleSearchChange(t){this.setState({searchText:t.target.value,selectedRanges:[]})}handleViewportUpdate({items:t,offset:e}){const{table:n}=this.props,s=n.size;this.setState({items:t,itemCount:s,offset:e})}renderItem({item:t,itemIndex:e,isSelected:n}){const{language:s,commandHistoryStorage:i}=this.props;return h(ym,{isSelected:n,item:t,language:s,commandHistoryStorage:i})}focus(){this.searchInputRef.current&&this.searchInputRef.current.focus()}restoreScrollPosition(){var t;(t=this.itemListRef.current)==null||t.restoreScrollPosition()}render(){var m;const{language:t,table:e}=this.props,{actions:n,historyActions:s,searchText:i,top:o,bottom:r,items:l,itemCount:a,offset:d,selectedRanges:c}=this.state,u=(m=am.LANGUAGE_MAP.get(t))!=null?m:"";return T("div",{className:"command-history",children:[T("div",{className:"command-history-search-bar",children:[h(ws,{ref:this.searchInputRef,value:i,placeholder:`${u} Command History`,onChange:this.handleSearchChange}),h(bl,{actions:s,hasSelection:c.length>0})]}),T("div",{className:"command-history-list",children:[h(vn,{ref:this.itemListRef,itemCount:a,items:l,offset:d,selectedRanges:c,onSelect:this.handleSelect,onSelectionChange:this.handleSelectionChange,onViewportChange:this.handleViewportChange,renderItem:this.renderItem,rowHeight:cs.ITEM_HEIGHT,isDoubleClickSelect:!0,isMultiSelect:!0,isStickyBottom:!0}),h(QS,{table:e,top:o,bottom:r,search:i,onUpdate:this.handleViewportUpdate}),h(ae,{actions:n})]})]})}};let Gl=cs;Gl.ITEM_HEIGHT=29;Gl.MAX_SELECTION_COUNT=1e4;Gl.menuGroups={send:ae.groups.medium+100};class JS extends w.exports.PureComponent{constructor(e){super(e),this.handleSwitchClick=this.handleSwitchClick.bind(this)}handleSwitchClick(){const{logLevel:e,onClick:n}=this.props;n(e)}render(){const{logLevel:e,on:n}=this.props;return T("div",{className:z("log-level-menu-item",e),children:[h(nm,{on:n,onClick:this.handleSwitchClick}),e]})}}const Vt=class extends w.exports.PureComponent{constructor(t){super(t),this.handleClearClick=this.handleClearClick.bind(this),this.handleFlushTimeout=this.handleFlushTimeout.bind(this),this.handleLogMessage=this.handleLogMessage.bind(this),this.handleMenuItemClick=this.handleMenuItemClick.bind(this),this.handleResetClick=this.handleResetClick.bind(this),this.handleResize=this.handleResize.bind(this),this.handleToggleAllClick=this.handleToggleAllClick.bind(this),this.logLevelMenuItems={},this.editorContainer=null,this.bufferedMessages=[],this.messages=[],this.state={shownLogLevels:{}}}static getLogText(t){const e=new Date(t.micros/1e3);return`${Ji.formatTimestamp(e)} ${t.logLevel} ${t.message}`}componentDidMount(){this.resetLogLevels(),this.initMonaco(),this.startListening(),window.addEventListener("resize",this.handleResize)}componentDidUpdate(t,e){this.updateDimensions();const{shownLogLevels:n}=this.state;e.shownLogLevels!==n&&this.refreshLogText();const{session:s}=this.props;t.session!==s&&(this.stopListening(),this.startListening(),this.clearLogs())}componentWillUnmount(){this.stopFlushTimer(),this.stopListening(),this.destroyMonaco(),window.removeEventListener("resize",this.handleResize)}getMenuActions(t){const e=[];e.push({menuElement:h("div",{className:"log-level-menu-title",children:"Display Log Levels"}),group:1,order:10});for(let n=0;n<Vt.AllLogLevels.length;n+=1){const s=Vt.AllLogLevels[n],i=t[s]!=null?t[s]:!1;e.push({title:s,group:1,order:n+100,menuElement:h(JS,{logLevel:s,on:i,onClick:this.handleMenuItemClick,ref:o=>{o!=null&&(this.logLevelMenuItems[s]=o)}})})}return e.push({group:1,order:1e3,menuElement:T("div",{className:"log-level-menu-controls",children:[h(W,{kind:"ghost",className:"log-level-toggle-all",onClick:this.handleToggleAllClick,children:"Toggle All"}),h(W,{kind:"ghost",onClick:this.handleResetClick,children:"Reset"})]})}),e}resetLogLevels(){const t={};for(let e=0;e<Vt.AllLogLevels.length;e+=1){const n=Vt.AllLogLevels[e],s=Vt.DefaultLogLevels.some(i=>i===n);t[n]=s}this.setState({shownLogLevels:t})}startListening(){const{session:t}=this.props;this.cancelListener=t.onLogMessage(this.handleLogMessage)}stopListening(){this.cancelListener!=null&&(this.cancelListener(),this.cancelListener=void 0)}initMonaco(){L(this.editorContainer),this.editor=gs.create(this.editorContainer,{copyWithSyntaxHighlighting:!1,fixedOverflowWidgets:!0,folding:!1,fontFamily:"Fira Mono",glyphMargin:!1,language:"log",lineDecorationsWidth:0,lineNumbers:"off",lineNumbersMinChars:0,minimap:{enabled:!1},readOnly:!0,renderLineHighlight:"none",scrollBeyondLastLine:!1,value:"",wordWrap:"on"}),this.editor.addCommand(Kn.Escape,()=>{}),this.editor.addCommand(Cn.Shift|Kn.Escape,()=>{}),this.editor.addCommand(Kn.Escape,()=>{var e,n;const t=(e=this.editor)==null?void 0:e.getPosition();L(t),(n=this.editor)==null||n.setPosition(t)},"findWidgetVisible && editorTextFocus"),this.editor.addCommand(Cn.Shift|Kn.Escape,()=>{var e,n;const t=(e=this.editor)==null?void 0:e.getPosition();L(t),(n=this.editor)==null||n.setPosition(t)},"findWidgetVisible && editorTextFocus")}destroyMonaco(){this.editor&&(this.editor.dispose(),this.editor=void 0)}triggerFindWidget(){var t,e;(t=this.editor)==null||t.focus(),(e=this.editor)==null||e.trigger("keyboard","actions.find",void 0)}toggleAll(){const{shownLogLevels:t}=this.state;let e=!0;for(let n=0;n<Vt.AllLogLevels.length;n+=1){const s=Vt.AllLogLevels[n];if(!t[s]){e=!1;break}}if(e)this.setState({shownLogLevels:{}});else{const n={};for(let s=0;s<Vt.AllLogLevels.length;s+=1){const i=Vt.AllLogLevels[s];n[i]=!0}this.setState({shownLogLevels:n})}}toggleLogLevel(t){const{shownLogLevels:e}=this.state,n=e[t],s={};s[t]=!n,this.updateLogLevels(s)}updateLogLevels(t){let{shownLogLevels:e}=this.state;e={...e,...t},this.setState({shownLogLevels:e})}appendLogText(t){if(!this.editor)return;const e=this.editor.getModel();let n=e==null?void 0:e.getLineCount();L(n);let s=e==null?void 0:e.getLineLength(n);L(s);const i=this.isBottomVisible(),o=[];if(s>0&&(o.push({range:{startLineNumber:n,startColumn:s+1,endLineNumber:n,endColumn:s+1},text:`
19
+ `,forceMoveMarkers:!0}),n+=1,s=0),o.push({range:{startLineNumber:n,startColumn:s,endLineNumber:n,endColumn:s},text:t,forceMoveMarkers:!0}),e==null||e.applyEdits(o),i){const r=e==null?void 0:e.getLineCount();L(r),this.editor.revealLine(r,1)}}refreshLogText(){var s;if(!this.editor)return;this.truncateLogIfNecessary();const{shownLogLevels:t}=this.state,e=this.isBottomVisible();let n="";for(let i=0;i<this.messages.length;i+=1){const o=this.messages[i];if(t[o.logLevel]){const r=Vt.getLogText(o);r.length>0&&(n+=r,r.charAt(r.length-1)!==`
20
+ `&&(n+=`
21
+ `))}}if(n=n.trimRight(),this.editor.setValue(n),e){const i=(s=this.editor.getModel())==null?void 0:s.getLineCount();L(i),this.editor.revealLine(i,1)}this.stopFlushTimer(),this.bufferedMessages=[]}truncateLogIfNecessary(){this.messages.length>Vt.maxLogSize&&(this.messages=this.messages.splice(this.messages.length-Vt.truncateSize))}scrollToBottom(){var e,n,s;if(!this.editor)return;const t=(s=(n=(e=this.editor)==null?void 0:e.getModel)==null?void 0:n.call(e))==null?void 0:s.getLineCount();L(t),this.editor.revealLine(t,1)}isBottomVisible(){if(!this.editor)return!0;const t=this.editor.getModel(),e=t==null?void 0:t.getLineCount();return L(e),this.isLineVisible(e)}isLineVisible(t){var n;const e=(n=this.editor)==null?void 0:n.getVisibleRanges();if(e==null||e.length===0)return!1;for(let s=0;s<e.length;s+=1){const i=e[s];if(i.startLineNumber<=t&&t<=i.endLineNumber)return!0}return!1}isLogItemVisible(t){const{shownLogLevels:e}=this.state;return e[t.logLevel]}flush(){let t="";for(let e=0;e<this.bufferedMessages.length;e+=1){const n=this.bufferedMessages[e],s=Vt.getLogText(n);t+=s,s.charAt(s.length-1)!==`
22
+ `&&(t+=`
23
+ `)}this.bufferedMessages=[],this.appendLogText(t)}queue(t){this.bufferedMessages.push(t),this.bufferedMessages.length===1&&(this.flushTimer=setTimeout(this.handleFlushTimeout,Vt.bufferTimeout))}stopFlushTimer(){this.flushTimer&&(clearTimeout(this.flushTimer),this.flushTimer=void 0)}updateDimensions(){this.editor&&this.editor.layout()}handleClearClick(){this.clearLogs()}clearLogs(){this.messages=[],this.refreshLogText()}handleFlushTimeout(){this.stopFlushTimer(),this.flush()}handleLogMessage(t){this.messages.push(t),this.editor&&this.isLogItemVisible(t)&&this.queue(t)}handleMenuItemClick(t){this.toggleLogLevel(t)}handleResetClick(){this.resetLogLevels()}handleResize(){this.updateDimensions()}handleToggleAllClick(){this.toggleAll()}render(){const t={placement:"bottom-end"},{shownLogLevels:e}=this.state,n=this.getMenuActions(e);return T("div",{className:"log-pane h-100 w-100",children:[T("div",{className:"log-pane-menu",children:[h(W,{kind:"ghost",className:"btn-clear-logs",onClick:this.handleClearClick,icon:bb,tooltip:"Clear log"}),h(W,{kind:"ghost",className:"btn-link-icon btn-overflow",icon:sr,tooltip:"Log Settings",onClick:()=>{},children:h(Fn,{actions:n,popperClassName:"log-level-menu-popper",popperOptions:t})})]}),h("div",{className:"log-pane-editor h-100 w-100",ref:s=>{this.editorContainer=s}})]})}};let co=Vt;co.DefaultLogLevels=[vt.STDOUT,vt.ERROR,vt.FATAL,vt.STDERR,vt.WARN];co.AllLogLevels=[vt.INFO,vt.STDOUT,vt.ERROR,vt.FATAL,vt.STDERR,vt.WARN,vt.DEBUG,vt.TRACE];co.bufferTimeout=16;co.maxLogSize=131072;co.truncateSize=65536;class nt{static isValid(e){return!0}static isSameFormat(e,n){throw new Error("isSameFormat not implemented")}static makeFormat(e,n,s){return{label:e,formatString:n,type:s}}format(e,n){return""}}nt.TYPE_GLOBAL="type-global";nt.TYPE_CONTEXT_PRESET="type-context-preset";nt.TYPE_CONTEXT_CUSTOM="type-context-custom";class e0 extends nt{format(e){switch(e){case 1:case!0:return"true";case 0:case!1:return"false";default:return""}}}class t0 extends nt{format(e){return String.fromCharCode(e)}}const Sh=Z.module("DateTimeColumnFormatter"),oi=class extends nt{constructor({timeZone:t="",showTimeZone:e=!0,showTSeparator:n=!1,defaultDateTimeFormatString:s=oi.DEFAULT_DATETIME_FORMAT_STRING}={}){super();const i=t||oi.DEFAULT_TIME_ZONE_ID;try{this.dhTimeZone=M.i18n.TimeZone.getTimeZone(i)}catch{Sh.error("Unsupported time zone id",i),this.dhTimeZone=M.i18n.TimeZone.getTimeZone(oi.DEFAULT_TIME_ZONE_ID)}this.defaultDateTimeFormatString=s,this.showTimeZone=e,this.showTSeparator=n,this.formatStringMap=oi.makeFormatStringMap(e,n)}static isValid(t){try{return M.i18n.DateTimeFormat.format(t.formatString,new Date),!0}catch{return!1}}static makeFormat(t,e,n=nt.TYPE_CONTEXT_PRESET){return{label:t,formatString:e,type:n}}static isSameFormat(t,e){return t===e||t!==null&&e!==null&&t.type===e.type&&t.formatString===e.formatString}static makeGlobalFormatStringMap(t,e){const n=e?"'T'":" ",s=t?" z":"";return new Map([["yyyy-MM-dd HH:mm:ss",`yyyy-MM-dd${n}HH:mm:ss${s}`],["yyyy-MM-dd HH:mm:ss.SSS",`yyyy-MM-dd${n}HH:mm:ss.SSS${s}`],["yyyy-MM-dd HH:mm:ss.SSSSSSSSS",`yyyy-MM-dd${n}HH:mm:ss.SSSSSSSSS${s}`]])}static getGlobalFormats(t,e){return[...oi.makeGlobalFormatStringMap(t,e).keys()]}static makeFormatStringMap(t,e){const n=e!==void 0&&e?"'T'":" ",s=t!==void 0&&t?" z":"";return new Map([["yyyy-MM-dd",`yyyy-MM-dd${s}`],["MM-dd-yyyy",`MM-dd-yyyy${s}`],["HH:mm:ss",`HH:mm:ss${s}`],["HH:mm:ss.SSS",`HH:mm:ss.SSS${s}`],["HH:mm:ss.SSSSSSSSS",`HH:mm:ss.SSSSSSSSS${s}`],["yyyy-MM-dd HH:mm:ss",`yyyy-MM-dd${n}HH:mm:ss${s}`],["yyyy-MM-dd HH:mm:ss.SSS",`yyyy-MM-dd${n}HH:mm:ss.SSS${s}`],["yyyy-MM-dd HH:mm:ss.SSSSSSSSS",`yyyy-MM-dd${n}HH:mm:ss.SSSSSSSSS${s}`]])}static getFormats(t,e){return[...oi.makeFormatStringMap(t,e).keys()]}getEffectiveFormatString(t){var e;return(e=this.formatStringMap.get(t))!=null?e:t}format(t,e={}){const n=e.formatString!=null&&e.formatString!==""?e.formatString:this.defaultDateTimeFormatString,s=this.getEffectiveFormatString(n);try{return M.i18n.DateTimeFormat.format(s,t,this.dhTimeZone)}catch{Sh.error("Invalid format arguments")}return""}};let st=oi;st.DEFAULT_DATETIME_FORMAT_STRING="yyyy-MM-dd HH:mm:ss.SSS";st.DEFAULT_TIME_ZONE_ID="America/New_York";const n0=Z.module("DecimalColumnFormatter"),_n=class extends nt{constructor({defaultFormatString:t=_n.DEFAULT_FORMAT_STRING}={}){super(),this.defaultFormatString=t}static isValid(t){try{return M.i18n.NumberFormat.format(t.formatString,0),!0}catch{return!1}}static makeFormat(t,e,n=nt.TYPE_CONTEXT_PRESET,s){return{label:t,type:n,formatString:e,multiplier:s}}static makePresetFormat(t,e="",n){return _n.makeFormat(t,e,nt.TYPE_CONTEXT_PRESET,n)}static makeCustomFormat(t="",e){return _n.makeFormat("Custom Format",t,nt.TYPE_CONTEXT_CUSTOM,e)}static isSameFormat(t,e){return t===e||t!=null&&e!=null&&t.type===e.type&&t.formatString===e.formatString&&t.multiplier===e.multiplier}format(t,e={}){const n=e.formatString!=null&&e.formatString!==""?e.formatString:this.defaultFormatString,s=e.multiplier!==void 0&&e.multiplier!==0?t*e.multiplier:t;try{return M.i18n.NumberFormat.format(n,s)}catch{n0.error("Invalid format arguments")}return""}};let _e=_n;_e.DEFAULT_FORMAT_STRING="###,##0.0000";_e.FORMAT_PERCENT=_n.makePresetFormat("Percent","##0.00%");_e.FORMAT_BASIS_POINTS=_n.makePresetFormat("Basis Points","###,##0 bp",1e4);_e.FORMAT_MILLIONS=_n.makePresetFormat("Millions","###,##0.000 mm",1e-6);_e.FORMAT_SCIENTIFIC_NOTATION=_n.makePresetFormat("Scientific Notation","0.0000E0");_e.FORMAT_ROUND=_n.makePresetFormat("Round","###,##0");_e.FORMAT_ROUND_TWO_DECIMALS=_n.makePresetFormat("0.00","###,##0.00");_e.FORMAT_ROUND_FOUR_DECIMALS=_n.makePresetFormat("0.0000","###,##0.0000");class s0 extends nt{format(e){return`${e}`}}const i0=Z.module("IntegerColumnFormatter"),Yi=class extends nt{constructor({defaultFormatString:t=Yi.DEFAULT_FORMAT_STRING}={}){super(),this.defaultFormatString=t}static isValid(t){try{return M.i18n.NumberFormat.format(t.formatString,0),!0}catch{return!1}}static makeFormat(t,e,n=nt.TYPE_CONTEXT_PRESET,s){return{label:t,type:n,formatString:e,multiplier:s}}static makePresetFormat(t,e="",n){return Yi.makeFormat(t,e,nt.TYPE_CONTEXT_PRESET,n)}static makeCustomFormat(t="",e){return Yi.makeFormat("Custom Format",t,nt.TYPE_CONTEXT_CUSTOM,e)}static isSameFormat(t,e){return t===e||t!=null&&e!=null&&t.type===e.type&&t.formatString===e.formatString&&t.multiplier===e.multiplier}format(t,e={}){const n=e.formatString!=null&&e.formatString!==""?e.formatString:this.defaultFormatString,s=e.multiplier!==void 0&&e.multiplier!==0?t*e.multiplier:t;try{return M.i18n.NumberFormat.format(n,s)}catch{i0.error("Invalid format arguments")}return""}};let Qe=Yi;Qe.DEFAULT_FORMAT_STRING="###,##0";Qe.FORMAT_MILLIONS=Yi.makePresetFormat("Millions","###,##0.000 mm",1e-6);Qe.FORMAT_SCIENTIFIC_NOTATION=Yi.makePresetFormat("Scientific Notation","0.0000E0");class o0 extends nt{format(e){return e}}const Gt=class{static makeDateWrapper(t,e,n=0,s=1,i=0,o=0,r=0,l=0){if(!t)throw new Error("No timezone provided");const a=`${e}`.padStart(4,"0"),d=`${n+1}`.padStart(2,"0"),c=`${s}`.padStart(2,"0"),u=`${i}`.padStart(2,"0"),m=`${o}`.padStart(2,"0"),p=`${r}`.padStart(2,"0"),g=`${l}`.padStart(9,"0"),f=`${a}-${d}-${c} ${u}:${m}:${p}.${g}`;return M.i18n.DateTimeFormat.parse(Gt.FULL_DATE_FORMAT,f,M.i18n.TimeZone.getTimeZone(t))}static getNextNanos(t){const e=parseInt(t,10),n="0".repeat(9-t.length),s=`${e+1}${n}`;return parseInt(s,10)}static getNextDate(t,e,n){let{year:s,month:i,date:o,hours:r,minutes:l,seconds:a,nanos:d}=e;if(t.nanos!=null){if(t.nanos.length===9)return null;d=Gt.getNextNanos(t.nanos),d>999999999&&(a+=1,d=0)}else t.seconds!=null?a+=1:t.minutes!=null?l+=1:t.hours!=null?r+=1:t.date!=null?o+=1:t.month!=null?i+=1:s+=1;const c=new Date(s,i,o,r,l,a);return Gt.makeDateWrapper(n,c.getFullYear(),c.getMonth(),c.getDate(),c.getHours(),c.getMinutes(),c.getSeconds(),d)}static parseMonth(t){const e=parseInt(t,10);if(!Number.isNaN(e))return e>=1&&e<=12?e-1:NaN;const n=t.trim().toLowerCase();if(n.length>=3){for(let s=0;s<Gt.months.length;s+=1)if(Gt.months[s].startsWith(n))return s}return NaN}static parseDateValues(t,e,n,s,i,o,r){const l=parseInt(t,10),a=e!=null?this.parseMonth(e):0,d=n!=null?parseInt(n,10):1,c=s!=null?parseInt(s,10):0,u=i!=null?parseInt(i,10):0,m=o!=null?parseInt(o,10):0,p=r!=null?parseInt(r.padEnd(9,"0"),10):0;return Number.isNaN(l)||Number.isNaN(a)||Number.isNaN(d)||Number.isNaN(c)||Number.isNaN(u)||Number.isNaN(m)||Number.isNaN(p)?null:{year:l,month:a,date:d,hours:c,minutes:u,seconds:m,nanos:p}}static parseDateTimeString(t){const n=/\s*(\d{4})([-./]([\da-z]+))?([-./](\d{1,2}))?([tT\s](\d{2})([:](\d{2}))?([:](\d{2}))?([.](\d{1,9}))?)?(.*)/.exec(t);if(n==null)throw new Error(`Unexpected date string: ${t}`);const[,s,,i,,o,,r,,l,,a,,d,c]=n;if(c!=null&&c.length>0)throw new Error(`Unexpected characters after date string '${t}': ${c}`);return{year:s,month:i,date:o,hours:r,minutes:l,seconds:a,nanos:d}}static parseDateRange(t,e){const n=t.trim().toLowerCase();if(n.length===0)throw new Error("Cannot parse date range from empty string");if(n==="null")return[null,null];if(n==="today"){const l=new Date(Date.now()),a=Gt.makeDateWrapper(e,l.getFullYear(),l.getMonth(),l.getDate()),d=Gt.makeDateWrapper(e,l.getFullYear(),l.getMonth(),l.getDate()+1);return[a,d]}if(n==="yesterday"){const l=new Date(Date.now()),a=Gt.makeDateWrapper(e,l.getFullYear(),l.getMonth(),l.getDate()-1),d=Gt.makeDateWrapper(e,l.getFullYear(),l.getMonth(),l.getDate());return[a,d]}if(n==="now"){const l=new Date(Date.now());return[M.DateWrapper.ofJsDate(l),null]}const s=Gt.parseDateTimeString(n);if(s.year==null&&s.month==null&&s.date==null)throw new Error(`Unable to extract year, month, or day ${n}`);const i=Gt.parseDateValues(s.year,s.month,s.date,s.hours,s.minutes,s.seconds,s.nanos);if(i==null)throw new Error(`Unable to extract date values from ${s}`);const o=Gt.makeDateWrapper(e,i.year,i.month,i.date,i.hours,i.minutes,i.seconds,i.nanos),r=Gt.getNextDate(s,i,e);return[o,r]}static getJsDate(t){return typeof t=="number"?new Date(t):t.asDate()}};let Jn=Gt;Jn.FULL_DATE_FORMAT="yyyy-MM-dd HH:mm:ss.SSSSSSSSS";Jn.months=["january","february","march","april","may","june","july","august","september","october","november","december"];class Xt{}Xt.not="not";Xt.and="and";Xt.or="or";function r0(t){if(!(t==="not"||t==="and"||t==="or"))throw new Error("operator is not a valid FilterOperatorValue")}class K{}K.eq="eq";K.eqIgnoreCase="eqIgnoreCase";K.notEq="notEq";K.notEqIgnoreCase="notEqIgnoreCase";K.greaterThan="greaterThan";K.greaterThanOrEqualTo="greaterThanOrEqualTo";K.lessThan="lessThan";K.lessThanOrEqualTo="lessThanOrEqualTo";K.in="in";K.inIgnoreCase="inIgnoreCase";K.notIn="notIn";K.notInIgnoreCase="notInIgnoreCase";K.isTrue="isTrue";K.isFalse="isFalse";K.isNull="isNull";K.invoke="invoke";K.contains="contains";K.notContains="notContains";K.startsWith="startsWith";K.endsWith="endsWith";K.containsAny="containsAny";function Im(t){switch(t){case K.eq:return"is exactly";case K.eqIgnoreCase:return"is exactly (ignore case)";case K.notEq:return"is not exactly";case K.notEqIgnoreCase:return"is not exactly (ignore case)";case K.contains:return"contains";case K.notContains:return"does not contain";case K.startsWith:return"starts with";case K.endsWith:return"ends with";default:throw new Error(`Unrecognized text filter type ${t}`)}}function Rm(t){switch(t){case K.eq:return"is equal to";case K.notEq:return"is not equal to";case K.greaterThan:return"greater than";case K.greaterThanOrEqualTo:return"greater than or equal to";case K.lessThan:return"less than";case K.lessThanOrEqualTo:return"less than or equal to";default:throw new Error(`Unrecognized number filter type ${t}`)}}function Dm(t){switch(t){case K.eq:return"date is";case K.notEq:return"date is not";case K.notEqIgnoreCase:case K.greaterThan:return"date is after";case K.greaterThanOrEqualTo:return"date is after or equal";case K.lessThan:return"date is before";case K.lessThanOrEqualTo:return"date is before or equal";default:throw new Error(`Unrecognized date filter type ${t}`)}}function l0(t){switch(t){case K.isTrue:return"Is True";case K.isFalse:return"Is False";case K.isNull:return"Is Null";default:throw new Error(`Unrecognized boolean filter type ${t}`)}}const rs=Z.module("TableUtils"),re=class{static getSortIndex(t,e){var n;for(let s=0;s<t.length;s+=1)if(((n=t[s].column)==null?void 0:n.index)===e)return s;return null}static getSortForColumn(t,e){const n=re.getSortIndex(t,e);return n!=null?t[n]:null}static getFilterText(t){return t?t.toString():null}static getFilterTypes(t){return re.isBooleanType(t)?[K.isTrue,K.isFalse,K.isNull]:re.isCharType(t)||re.isNumberType(t)||re.isDateType(t)?[K.eq,K.notEq,K.greaterThan,K.greaterThanOrEqualTo,K.lessThan,K.lessThanOrEqualTo]:re.isTextType(t)?[K.eq,K.eqIgnoreCase,K.notEq,K.notEqIgnoreCase,K.contains,K.notContains,K.startsWith,K.endsWith]:[]}static getNextSort(t,e,n){if(t==null||n<0||n>=t.length)return null;const s=re.getSortForColumn(e,n);return s===null?t[n].sort().asc():s.direction===re.sortDirection.ascending?s.desc():null}static makeColumnSort(t,e,n,s){if(t==null||e<0||e>=t.length||n===re.sortDirection.none)return null;let i=t[e].sort();switch(n){case re.sortDirection.ascending:i=i.asc();break;case re.sortDirection.descending:i=i.desc();break}return s&&(i=i.abs()),i}static toggleSortForColumn(t,e,n,s=!1){if(n<0||n>=e.length)return[];const i=re.getNextSort(e,t,n);return re.setSortForColumn(t,n,i,s)}static sortColumn(t,e,n,s,i,o){if(t==null||n<0||n>=e.length)return[];const r=re.makeColumnSort(e,n,s,i);return re.setSortForColumn(t,n,r,o)}static setSortForColumn(t,e,n,s=!1){const i=re.getSortIndex(t,e);let o=[];return s&&(o=o.concat(t.filter(({direction:r})=>r!==re.sortDirection.reverse)),i!==null&&o.splice(i,1)),n!==null&&o.push(n),o}static getNormalizedType(t){switch(t){case"boolean":case"java.lang.Boolean":case re.dataType.BOOLEAN:return re.dataType.BOOLEAN;case"char":case"java.lang.Character":case re.dataType.CHAR:return re.dataType.CHAR;case"java.lang.String":case re.dataType.STRING:return re.dataType.STRING;case"io.deephaven.db.tables.utils.DBDateTime":case"io.deephaven.time.DateTime":case"com.illumon.iris.db.tables.utils.DBDateTime":case re.dataType.DATETIME:return re.dataType.DATETIME;case"double":case"java.lang.Double":case"float":case"java.lang.Float":case"java.math.BigDecimal":case re.dataType.DECIMAL:return re.dataType.DECIMAL;case"int":case"java.lang.Integer":case"long":case"java.lang.Long":case"short":case"java.lang.Short":case"byte":case"java.lang.Byte":case"java.math.BigInteger":case re.dataType.INT:return re.dataType.INT;default:return re.dataType.UNKNOWN}}static isLongType(t){switch(t){case"long":case"java.lang.Long":return!0;default:return!1}}static isDateType(t){switch(t){case"io.deephaven.db.tables.utils.DBDateTime":case"io.deephaven.time.DateTime":case"com.illumon.iris.db.tables.utils.DBDateTime":return!0;default:return!1}}static isNumberType(t){return re.isIntegerType(t)||re.isDecimalType(t)}static isIntegerType(t){switch(t){case"int":case"java.lang.Integer":case"java.math.BigInteger":case"long":case"java.lang.Long":case"short":case"java.lang.Short":case"byte":case"java.lang.Byte":return!0;default:return!1}}static isDecimalType(t){switch(t){case"double":case"java.lang.Double":case"java.math.BigDecimal":case"float":case"java.lang.Float":return!0;default:return!1}}static isBigDecimalType(t){switch(t){case"java.math.BigDecimal":return!0;default:return!1}}static isBigIntegerType(t){switch(t){case"java.math.BigInteger":return!0;default:return!1}}static isBooleanType(t){switch(t){case"boolean":case"java.lang.Boolean":return!0;default:return!1}}static isCharType(t){switch(t){case"char":case"java.lang.Character":return!0;default:return!1}}static isStringType(t){switch(t){case"java.lang.String":return!0;default:return!1}}static isTextType(t){return this.isStringType(t)||this.isCharType(t)}static getBaseType(t){return t.split("[]")[0]}static isCompatibleType(t,e){return re.getNormalizedType(t)===re.getNormalizedType(e)}static makeQuickFilter(t,e,n){const s=e.split("||");let i=null;for(let o=0;o<s.length;o+=1){const l=s[o].split("&&");let a=null;for(let d=0;d<l.length;d+=1){const c=l[d].trim();if(c.length>0){const u=re.makeQuickFilterFromComponent(t,c,n);if(u)a?a=a.and(u):a=u;else throw new Error(`Unable to parse quick filter from text ${e}`)}}i&&a?i=i.or(a):i=a}return i}static makeQuickFilterFromComponent(t,e,n){const{type:s}=t;return re.isNumberType(s)?this.makeQuickNumberFilter(t,e):re.isBooleanType(s)?this.makeQuickBooleanFilter(t,e):n!=null&&re.isDateType(s)?this.makeQuickDateFilter(t,e,n):re.isCharType(s)?this.makeQuickCharFilter(t,e):this.makeQuickTextFilter(t,e)}static makeQuickNumberFilter(t,e){if(e==null)return null;const n=t.filter();let s=null;const o=/\s*(>=|<=|=>|=<|>|<|!=|=|!)?(\s*-\s*)?(\s*\d*(?:,\d{3})*(?:\.\d*)?\s*)?(null|nan|infinity|inf|\u221E)?(.*)/i.exec(e);let r=null,l=null,a=null,d=null,c=null;if(o!==null&&o.length>3&&([,r,l,a,d,c]=o),c!=null&&c.trim().length>0)return null;if(r==null&&(r="="),d!=null){if(!(r==="="||r==="!"||r==="!="))return null;switch(d=d.trim().toLowerCase(),d){case"null":s=n.isNull();break;case"nan":s=M.FilterCondition.invoke("isNaN",n);break;case"infinity":case"inf":case"\u221E":l!=null?s=M.FilterCondition.invoke("isInf",n).and(n.lessThan(M.FilterValue.ofNumber(0))):s=M.FilterCondition.invoke("isInf",n).and(n.greaterThan(M.FilterValue.ofNumber(0)));break}return s!==null&&(r==="!"||r==="!=")&&(s=s.not()),s}if(a==null)return null;if(a=re.removeCommas(a),re.isLongType(t.type))try{a=M.FilterValue.ofNumber(M.LongWrapper.ofString(`${l!=null?"-":""}${a}`))}catch(u){return rs.warn("Unable to create long filter",u),null}else{if(a=parseFloat(a),a==null||Number.isNaN(a))return null;a=M.FilterValue.ofNumber(l!=null?0-a:a)}return s=t.filter(),re.makeRangeFilterWithOperation(s,r,a)}static makeQuickTextFilter(t,e){if(e==null)return null;const n=`${e}`.trim(),i=/^(!~|!=|~|=|!)?(.*)/.exec(n);let o=null,r=null;if(i!==null&&i.length>2&&([,o,r]=i,r!=null&&(r=r.trim())),r==null||r.length===0)return null;o==null&&(o="=");const l=t.filter();if(r.toLowerCase()==="null")switch(o){case"=":return l.isNull();case"!=":case"!":return l.isNull().not();default:return null}let a=null,d=null;switch(r.startsWith("*")?(a="*",r=r.substring(1)):r.endsWith("*")&&!r.endsWith("\\*")&&(d="*",r=r.substring(0,r.length-1)),r=r.replace("\\",""),o){case"~":return l.isNull().not().and(l.invoke("matches",M.FilterValue.ofString(`(?s)(?i).*\\Q${r}\\E.*`)));case"!~":return l.isNull().or(l.invoke("matches",M.FilterValue.ofString(`(?s)(?i).*\\Q${r}\\E.*`)).not());case"!=":return a==="*"?l.isNull().or(l.invoke("matches",M.FilterValue.ofString(`(?s)(?i).*\\Q${r}\\E$`)).not()):d==="*"?l.isNull().or(l.invoke("matches",M.FilterValue.ofString(`(?s)(?i)^\\Q${r}\\E.*`)).not()):l.notEqIgnoreCase(M.FilterValue.ofString(r.toLowerCase()));case"=":return a==="*"?l.isNull().not().and(l.invoke("matches",M.FilterValue.ofString(`(?s)(?i).*\\Q${r}\\E$`))):d==="*"?l.isNull().not().and(l.invoke("matches",M.FilterValue.ofString(`(?s)(?i)^\\Q${r}\\E.*`))):l.eqIgnoreCase(M.FilterValue.ofString(r.toLowerCase()))}return null}static makeQuickBooleanFilter(t,e){if(e==null)return null;const s=/^(!=|=|!)?(.*)/.exec(`${e}`.trim());if(s===null)return null;const[,i,o]=s,r=i==="!"||i==="!=",l=o.trim().toLowerCase();let a=t.filter();try{const d=re.makeBooleanValue(l);return d!=null&&d?a=a.isTrue():d===null?a=a.isNull():a=a.isFalse(),r?a.not():a}catch{return null}}static makeQuickDateFilter(t,e,n){const s=e.trim(),o=/\s*(>=|<=|=>|=<|>|<|!=|!|=)?(.*)/.exec(s);if(o==null||o.length<=2)throw new Error(`Unable to parse date filter: ${e}`);let r=null,l=null;[,r,l]=o;let a=K.eq;switch(r){case"<":a=K.lessThan;break;case"<=":case"=<":a=K.lessThanOrEqualTo;break;case">":a=K.greaterThan;break;case">=":case"=>":a=K.greaterThanOrEqualTo;break;case"!=":case"!":a=K.notEq;break;case"=":case"==":default:a=K.eq;break}return re.makeQuickDateFilterWithOperation(t,l,a,n)}static makeQuickDateFilterWithOperation(t,e,n,s){if(t==null)throw new Error("Column is null");const[i,o]=Jn.parseDateRange(e,s),r=i!=null?M.FilterValue.ofNumber(i):null,l=o!=null?M.FilterValue.ofNumber(o):null,a=t.filter();if(r==null)return n===K.notEq?a.isNull().not():a.isNull();switch(n){case K.eq:{if(l!=null){const d=a.greaterThanOrEqualTo(r),c=a.lessThan(l);return d.and(c)}return a.eq(r)}case K.lessThan:return a.lessThan(r);case K.lessThanOrEqualTo:return l!=null?a.lessThan(l):a.lessThanOrEqualTo(r);case K.greaterThan:return l!=null?a.greaterThanOrEqualTo(l):a.greaterThan(r);case K.greaterThanOrEqualTo:return a.greaterThanOrEqualTo(r);case K.notEq:{if(l!=null){const d=a.lessThan(r),c=a.greaterThanOrEqualTo(l);return d.or(c)}return a.notEq(r)}default:throw new Error(`Invalid operator: ${n}`)}}static quoteValue(t){return t.length>=2&&(t.charAt(0)==='"'&&t.charAt(t.length-1)==='"'||t.charAt(0)==="'"&&t.charAt(t.length-1)==="'")?t:`"${t}"`}static isRangeOperation(t){switch(t){case"<":case"<=":case"=<":case">":case">=":case"=>":return!0;default:return!1}}static makeQuickCharFilter(t,e){if(e==null)return null;const n=`${e}`.trim(),i=/^(>=|<=|=>|=<|>|<|!=|=|!)?(null|"."|'.'|.)?(.*)/.exec(n);let o=null,r=null,l=null;if(i!==null&&i.length>3&&([,o,r,l]=i),l!=null&&l.trim().length>0||r==null||r.length===0)return null;o==null&&(o="=");const a=t.filter();if(r.toLowerCase()==="null")switch(o){case"=":return a.isNull();case"!=":case"!":return a.isNull().not();default:return null}const d=M.FilterValue.ofString(re.isRangeOperation(o)?re.quoteValue(r):r);return re.makeRangeFilterWithOperation(a,o,d)}static makeRangeFilterWithOperation(t,e,n){switch(e){case"=":return t.eq(n);case"<":return t.lessThan(n);case"<=":case"=<":return t.lessThanOrEqualTo(n);case">":return t.greaterThan(n);case">=":case"=>":return t.greaterThanOrEqualTo(n);case"!=":case"!":return t.notEq(n);default:return null}}static makeCancelableTablePromise(t){return ye.makeCancelable(t,e=>{e.close()})}static makeCancelableTableEventPromise(t,e,n=0,s=null){let i,o,r=!0;const l=new Promise((a,d)=>{o=setTimeout(()=>{i(),r=!1,d(new Bu(`Event "${e}" timed out.`))},n),i=t.addEventListener(e,c=>{if(s!=null&&!s(c)){rs.debug2("Event triggered, but matcher returned false.");return}rs.debug2("Event triggered, resolving."),i(),clearTimeout(o),r=!1,a(c)})});return l.cancel=()=>{if(r){rs.debug2("Pending promise cleanup."),i(),clearTimeout(o),r=!1;return}rs.debug2("Ignoring non-pending promise cancel.")},l}static makeAdvancedFilter(t,e,n){const{filterItems:s,filterOperators:i,invertSelection:o,selectedValues:r}=e;let l=null;for(let d=0;d<s.length;d+=1){const c=s[d],{selectedType:u,value:m}=c;if(u!=null&&u.length>0&&m!=null&&m.length>0)try{const p=re.makeAdvancedValueFilter(t,u,m,n);if(p!=null){if(d===0)l=p;else if(l!==null&&d-1<i.length){const g=i[d-1];if(g===Xt.and)l=l.and(p);else if(g===Xt.or)l=l.or(p);else{rs.error("Unexpected filter operator",g,p),l=null;break}}}else rs.debug2("Empty filter ignored for",u,m)}catch(p){rs.error("Unable to create filter",p),l=null;break}}const a=re.makeSelectValueFilter(t,r,o);return a!=null&&(l!=null?l=l.and(a):l=a),l}static removeCommas(t){return t.replace(/[\s|,]/g,"")}static makeFilterValue(t,e){const n=re.getBaseType(t);return re.isTextType(n)?M.FilterValue.ofString(e):re.isLongType(n)?M.FilterValue.ofNumber(M.LongWrapper.ofString(re.removeCommas(e))):M.FilterValue.ofNumber(re.removeCommas(e))}static makeFilterRawValue(t,e){return re.isTextType(t)?M.FilterValue.ofString(e):re.isBooleanType(t)?M.FilterValue.ofBoolean(e):M.FilterValue.ofNumber(e)}static makeValue(t,e,n){if(e==null||e==="null")return null;if(re.isTextType(t))return e;if(re.isLongType(t))return M.LongWrapper.ofString(re.removeCommas(e));if(re.isBooleanType(t))return re.makeBooleanValue(e,!0);if(re.isDateType(t)){const[s]=Jn.parseDateRange(e,n);return s}return re.isNumberType(t)?re.makeNumberValue(e):(rs.error("Unexpected column type",t),null)}static makeBooleanValue(t,e=!1){if(t===""&&e)return null;switch(t==null?void 0:t.toLowerCase()){case"null":return null;case"0":case"f":case"fa":case"fal":case"fals":case"false":case"n":case"no":return!1;case"1":case"t":case"tr":case"tru":case"true":case"y":case"ye":case"yes":return!0;default:throw new Error(`Invalid boolean '${t}'`)}}static makeNumberValue(t){if(t==null||t==="null"||t==="")return null;const e=t.toLowerCase().trim();if(e==="\u221E"||e==="infinity"||e==="inf")return Number.POSITIVE_INFINITY;if(e==="-\u221E"||e==="-infinity"||e==="-inf")return Number.NEGATIVE_INFINITY;const n=re.removeCommas(e);if(re.NUMBER_REGEX.test(n))return parseFloat(n);throw new Error(`Invalid number '${t}'`)}static getFilterOperatorString(t){switch(t){case K.eq:return"=";case K.notEq:return"!=";case K.greaterThan:return">";case K.greaterThanOrEqualTo:return">=";case K.lessThan:return"<";case K.lessThanOrEqualTo:return"<=";case K.contains:return"~";case K.notContains:return"!~";default:throw new Error(`Unexpected filter type ${t}`)}}static makeAdvancedValueFilter(t,e,n,s){if(re.isDateType(t.type))return re.makeQuickDateFilterWithOperation(t,n,e,s);if(re.isNumberType(t.type)||re.isCharType(t.type))return re.makeQuickFilter(t,`${re.getFilterOperatorString(e)}${n}`);const i=re.makeFilterValue(t.type,n),o=t.filter();switch(e){case K.eq:return o.eq(i);case K.eqIgnoreCase:return o.eqIgnoreCase(i);case K.notEq:return o.notEq(i);case K.notEqIgnoreCase:return o.notEqIgnoreCase(i);case K.greaterThan:return o.greaterThan(i);case K.greaterThanOrEqualTo:return o.greaterThanOrEqualTo(i);case K.lessThan:return o.lessThan(i);case K.lessThanOrEqualTo:return o.lessThanOrEqualTo(i);case K.isTrue:return o.isTrue();case K.isFalse:return o.isFalse();case K.isNull:return o.isNull();case K.contains:return o.isNull().not().and(o.invoke("matches",M.FilterValue.ofString(`(?s)(?i).*\\Q${n}\\E.*`)));case K.notContains:return o.isNull().or(o.invoke("matches",M.FilterValue.ofString(`(?s)(?i).*\\Q${n}\\E.*`)).not());case K.startsWith:return o.isNull().not().and(o.invoke("matches",M.FilterValue.ofString(`(?s)(?i)^\\Q${n}\\E.*`)));case K.endsWith:return o.isNull().not().and(o.invoke("matches",M.FilterValue.ofString(`(?s)(?i).*\\Q${n}\\E$`)));case K.in:case K.inIgnoreCase:case K.notIn:case K.notInIgnoreCase:case K.invoke:default:throw new Error(`Unexpected filter operation: ${e}`)}}static makeSelectValueFilter(t,e,n){if(e.length===0){if(n)return null;let o=null;re.isTextType(t.type)?o=M.FilterValue.ofString("a"):re.isBooleanType(t.type)?o=M.FilterValue.ofBoolean(!0):re.isDateType(t.type)?o=M.FilterValue.ofNumber(M.DateWrapper.ofJsDate(new Date)):o=M.FilterValue.ofNumber(0);const r=t.filter().eq(o),l=t.filter().notEq(o);return r.and(l)}const s=[];let i=!1;for(let o=0;o<e.length;o+=1){const r=e[o];r==null?i=!0:re.isTextType(t.type)?s.push(M.FilterValue.ofString(typeof r=="number"?String.fromCharCode(r):r)):re.isBooleanType(t.type)?s.push(M.FilterValue.ofBoolean(Boolean(r))):s.push(M.FilterValue.ofNumber(r))}return i?s.length>0?n?t.filter().isNull().not().and(t.filter().notIn(s)):t.filter().isNull().or(t.filter().in(s)):n?t.filter().isNull().not():t.filter().isNull():n?t.filter().notIn(s):t.filter().in(s)}static isTreeTable(t){return t!=null&&t.expand!==void 0&&t.collapse!==void 0}static sortColumns(t,e=!0){return[...t].sort((n,s)=>{const i=n.name.toUpperCase(),o=s.name.toUpperCase();return nn.sort(i,o,e)})}};let _=re;_.dataType={BOOLEAN:"boolean",CHAR:"char",DATETIME:"datetime",DECIMAL:"decimal",INT:"int",STRING:"string",UNKNOWN:"unknown"};_.sortDirection={ascending:"ASC",descending:"DESC",reverse:"REVERSE",none:null};_.REVERSE_TYPE=Object.freeze({NONE:"none",PRE_SORT:"pre-sort",POST_SORT:"post-sort"});_.NUMBER_REGEX=/^-?\d+(\.\d+)?$/;class cn{static makeColumnFormatMap(e){return e==null?new Map:e.reduce((n,s)=>{const i=_.getNormalizedType(s.columnType);if(i===null)return n;n.has(i)||n.set(i,new Map);const o=n.get(i);return o==null||o.set(s.columnName,s.format),n},new Map)}static makeColumnFormattingRule(e,n,s){return{columnType:e,columnName:n,format:s}}constructor(e=[],n,s,i,o=!1){this.defaultColumnFormatter=new s0,this.typeFormatterMap=new Map([[_.dataType.BOOLEAN,new e0],[_.dataType.CHAR,new t0],[_.dataType.DATETIME,new st(n)],[_.dataType.DECIMAL,new _e(s)],[_.dataType.INT,new Qe(i)],[_.dataType.STRING,new o0]]),this.columnFormatMap=cn.makeColumnFormatMap(e),this.truncateNumbersWithPound=o}getColumnFormatMapForType(e,n=!1){const s=_.getNormalizedType(e);if(s!==null)return n&&!this.columnFormatMap.has(s)&&this.columnFormatMap.set(s,new Map),this.columnFormatMap.get(s)}getColumnFormat(e,n){var i;const s=this.getColumnFormatMapForType(e);return(i=s==null?void 0:s.get(n))!=null?i:null}getColumnTypeFormatter(e){var i;const n=_.getNormalizedType(e);let s=this.defaultColumnFormatter;return n&&(s=(i=this.typeFormatterMap.get(n))!=null?i:s),s}getFormattedString(e,n,s="",i){if(e==null)return"";const o=this.getColumnTypeFormatter(n),r=i||this.getColumnFormat(n,s);return o.format(e,r!=null?r:void 0)}get timeZone(){var n;const e=this.typeFormatterMap.get(_.dataType.DATETIME);return(n=e==null?void 0:e.dhTimeZone)==null?void 0:n.id}}function a0(t){if(t&&t.formatter){const{formatter:e}=t;return e}}function d0(t){return{timeZone:t==null?void 0:t.timeZone,defaultDateTimeFormatString:t==null?void 0:t.defaultDateTimeFormat,showTimeZone:t==null?void 0:t.showTimeZone,showTSeparator:t==null?void 0:t.showTSeparator}}function c0(t,e,n){const s=t.getColumnFormat(n,e);return s!=null&&(s.type===nt.TYPE_CONTEXT_PRESET||s.type===nt.TYPE_CONTEXT_CUSTOM)}const Cs={getColumnFormats:a0,getDateTimeFormatterOptions:d0,isCustomColumnFormatDefined:c0};dl.register([Nf,Ff,xf,_f,kf,Of]);const Mm=typeof Sa=="function"?Sa(dl):Sa.default(dl),hs=class{constructor(){this.listeners=[],this.isDownsamplingDisabled=!1}getData(){return[]}getDefaultTitle(){return""}getLayout(){return{}}getFilterColumnMap(){return new Map}isFilterRequired(){return!1}setFilter(t){}close(){}setFormatter(t){this.formatter=t}setDownsamplingDisabled(t){this.isDownsamplingDisabled=t}setDimensions(t){this.rect=t}setTitle(t){this.title=t}subscribe(t){this.listeners.push(t)}unsubscribe(t){this.listeners=this.listeners.filter(e=>e!==t)}fireEvent(t){for(let e=0;e<this.listeners.length;e+=1)this.listeners[e](t)}fireUpdate(t){this.fireEvent(new CustomEvent(hs.EVENT_UPDATED,{detail:t}))}fireDisconnect(){this.fireEvent(new CustomEvent(hs.EVENT_DISCONNECT))}fireReconnect(){this.fireEvent(new CustomEvent(hs.EVENT_RECONNECT))}fireDownsampleStart(t){this.fireEvent(new CustomEvent(hs.EVENT_DOWNSAMPLESTARTED,{detail:t}))}fireDownsampleFinish(t){this.fireEvent(new CustomEvent(hs.EVENT_DOWNSAMPLEFINISHED,{detail:t}))}fireDownsampleFail(t){this.fireEvent(new CustomEvent(hs.EVENT_DOWNSAMPLEFAILED,{detail:t}))}fireDownsampleNeeded(t){this.fireEvent(new CustomEvent(hs.EVENT_DOWNSAMPLENEEDED,{detail:t}))}fireLoadFinished(){this.fireEvent(new CustomEvent(hs.EVENT_LOADFINISHED))}};let Tt=hs;Tt.EVENT_UPDATED="ChartModel.EVENT_UPDATED";Tt.EVENT_DISCONNECT="ChartModel.EVENT_DISCONNECT";Tt.EVENT_RECONNECT="ChartModel.EVENT_RECONNECT";Tt.EVENT_DOWNSAMPLESTARTED="ChartModel.EVENT_DOWNSAMPLESTARTED";Tt.EVENT_DOWNSAMPLEFINISHED="ChartModel.EVENT_DOWNSAMPLEFINISHED";Tt.EVENT_DOWNSAMPLEFAILED="ChartModel.EVENT_DOWNSAMPLEFAILED";Tt.EVENT_DOWNSAMPLENEEDED="ChartModel.EVENT_DOWNSAMPLENEEDED";Tt.EVENT_LOADFINISHED="ChartModel.EVENT_LOADFINISHED";const h0="#76d9e4 #9edc6f #fcd65b #aa9af4 #f37e3f #f95d84 #f0f0ee",u0="#403e41",m0="#5b5a5c",p0="#c0bfbf",g0="#4878ea",f0="rgba(91, 90, 92, 0.7)",Nt={"paper-bgcolor":"#2d2a2e","plot-bgcolor":"#322f33","title-color":"#f0f0ee",colorway:h0,gridcolor:u0,linecolor:m0,zerolinecolor:p0,activecolor:g0,rangebgcolor:f0,"area-color":"#76d9e4","trend-color":"#d5f0c1","line-color":"#9edc6f","error-band-line-color":"white","error-band-fill-color":"rgba(213, 240, 193, 0.1)","ohlc-increasing":"#9edc6f","ohlc-decreasing":"#f95d84"},qt=Object.freeze({paper_bgcolor:Nt["paper-bgcolor"],plot_bgcolor:Nt["plot-bgcolor"],title_color:Nt["title-color"],colorway:Nt.colorway,gridcolor:Nt.gridcolor,linecolor:Nt.linecolor,zerolinecolor:Nt.zerolinecolor,activecolor:Nt.activecolor,rangebgcolor:Nt.rangebgcolor,area_color:Nt["area-color"],trend_color:Nt["trend-color"],line_color:Nt["line-color"],error_band_line_color:Nt["error-band-line-color"],error_band_fill_color:Nt["error-band-fill-color"],ohlc_increasing:Nt["ohlc-increasing"],ohlc_decreasing:Nt["ohlc-decreasing"]}),Ar=Z.module("ChartUtils"),Ms=Object.freeze(M.calendar.DayOfWeek.values()),wh="io.deephaven.time.DateTime",C0=36e5,b0=1e6;function S0(t){return t.asDate!==void 0}function w0(t){return t.asNumber!==void 0}function vh(t){return t.dhTimeZone!==void 0}function v0(t){return t!=null&&t.range!=null&&(t.autorange===!1||t.autorange===void 0)}const le=class{static getPlotlyChartType(t,e){switch(t){case M.plot.SeriesPlotStyle.SCATTER:return e?"scatter":"scattergl";case M.plot.SeriesPlotStyle.LINE:return"scatter";case M.plot.SeriesPlotStyle.BAR:case M.plot.SeriesPlotStyle.STACKED_BAR:return"bar";case M.plot.SeriesPlotStyle.PIE:return"pie";case M.plot.SeriesPlotStyle.TREEMAP:return"treemap";case M.plot.SeriesPlotStyle.HISTOGRAM:return"histogram";case M.plot.SeriesPlotStyle.OHLC:return"ohlc";default:return}}static getPlotlyChartMode(t){switch(t){case M.plot.SeriesPlotStyle.SCATTER:return"markers";case M.plot.SeriesPlotStyle.LINE:return"lines";default:return}}static getPlotlyProperty(t,e){switch(t){case M.plot.SeriesPlotStyle.PIE:switch(e){case M.plot.SourceType.X:return"labels";case M.plot.SourceType.Y:return"values"}break;case M.plot.SeriesPlotStyle.OHLC:switch(e){case M.plot.SourceType.TIME:return"x"}break;case M.plot.SeriesPlotStyle.TREEMAP:switch(e){case M.plot.SourceType.X:return"ids";case M.plot.SourceType.Y:return"values";case M.plot.SourceType.LABEL:return"labels";case M.plot.SourceType.PARENT:return"parents";case M.plot.SourceType.COLOR:return"marker.colors"}break}switch(e){case M.plot.SourceType.X:return"x";case M.plot.SourceType.Y:return"y";case M.plot.SourceType.Z:return"z";case M.plot.SourceType.X_LOW:return"xLow";case M.plot.SourceType.X_HIGH:return"xHigh";case M.plot.SourceType.Y_LOW:return"yLow";case M.plot.SourceType.Y_HIGH:return"yHigh";case M.plot.SourceType.TIME:return"time";case M.plot.SourceType.OPEN:return"open";case M.plot.SourceType.HIGH:return"high";case M.plot.SourceType.LOW:return"low";case M.plot.SourceType.CLOSE:return"close";case M.plot.SourceType.SHAPE:return"shape";case M.plot.SourceType.SIZE:return"size";case M.plot.SourceType.LABEL:return"label";case M.plot.SourceType.COLOR:return"color";case M.plot.SourceType.PARENT:return"parent";case M.plot.SourceType.HOVER_TEXT:return"hovertext";case M.plot.SourceType.TEXT:return"text";default:throw new Error(`Unrecognized source type: ${e}`)}}static getPlotlySeriesOrientation(t){var n,s;const{sources:e}=t;return e.length===2&&((s=(n=e[0])==null?void 0:n.axis)==null?void 0:s.type)===M.plot.AxisType.Y?le.ORIENTATION.HORIZONTAL:le.ORIENTATION.VERTICAL}static getPlotlyErrorBars(t,e,n){const s=n.map((o,r)=>o-t[r]),i=e.map((o,r)=>t[r]-o);return{type:"data",symmetric:!1,array:s,arrayminus:i}}static getPlotlyDateFormat(t,e,n){const s=n==null?void 0:n.replace("%","%%").replace(/S{9}/g,"%9f").replace(/S{8}/g,"%8f").replace(/S{7}/g,"%7f").replace(/S{6}/g,"%6f").replace(/S{5}/g,"%5f").replace(/S{4}/g,"%4f").replace(/S{3}/g,"%3f").replace(/S{2}/g,"%2f").replace(/S{1}/g,"%1f").replace(/y{4}/g,"%Y").replace(/y{2}/g,"%y").replace(/M{4}/g,"%B").replace(/M{3}/g,"%b").replace(/M{2}/g,"%m").replace(/M{1}/g,"%-m").replace(/E{4,}/g,"%A").replace(/E{1,}/g,"%a").replace(/d{2}/g,"%d").replace(/([^%]|^)d{1}/g,"$1%-d").replace(/H{2}/g,"%H").replace(/h{2}/g,"%I").replace(/h{1}/g,"%-I").replace(/m{2}/g,"%M").replace(/s{2}/g,"%S").replace("'T'","T").replace(" z","");let i;const o=t==null?void 0:t.getColumnTypeFormatter(e);return o!=null&&vh(o)&&o.dhTimeZone!=null&&o.showTimeZone&&(i=M.i18n.DateTimeFormat.format(" z",new Date,o.dhTimeZone)),{tickformat:s,ticksuffix:i,automargin:!0}}static convertNumberPrefix(t){return t.replace(/\u00A4\u00A4/g,"USD").replace(/\u00A4/g,"$")}static getPlotlyNumberFormat(t,e,n){if(!n)return null;const i=n.split(";")[0].match(/^([^#,0.]*)([#,]*)([0,]*)(\.?)(0*)(#*)(E?0*)(%?)(.*)/);L(i);const[,o,r,l,,a,d,c,u,m]=i,p=l.replace(",","").length,f=r.indexOf(",")>=0||l.indexOf(",")>=0?",":"",b=c!=null&&c!==""?"e":"f",C=u!==""?u:b,S=a.length+d.length,y=`0${p}${f}.${S}${C}`,E=le.convertNumberPrefix(o),I=le.convertNumberPrefix(m);return{tickformat:y,tickprefix:E,ticksuffix:I,automargin:!0}}static getPlotlyAxisFormat(t,e=null){const{axis:n,columnType:s}=t,{formatPattern:i}=n;let o=null;return _.isDateType(s)?(o=le.getPlotlyDateFormat(e,s,i),o=le.addTickSpacing(o,n,!0)):_.isNumberType(s)&&(o=le.getPlotlyNumberFormat(e,s,i),o=le.addTickSpacing(o,n,!1)),n.formatType===M.plot.AxisFormatType.CATEGORY&&(o?o.type="category":o={type:"category",tickformat:void 0,ticksuffix:void 0}),o}static addTickSpacing(t,e,n){const{gapBetweenMajorTicks:s}=e;if(s>0){const i=t||{};let o=s;return n&&(o=s/b0),e.log&&(o=Math.log(o)),i.tickmode="linear",i.dtick=o,i}return t}static getSourceForAxis(t,e){for(let n=0;n<t.series.length;n+=1){const s=t.series[n];for(let i=0;i<s.sources.length;i+=1){const o=s.sources[i];if(o.axis===e)return o}}return null}static getSeriesVisibility(t,e){return e!=null&&e.hiddenSeries!=null&&e.hiddenSeries.includes(t)?"legendonly":!0}static getHiddenLabels(t){return t!=null&&t.hiddenSeries?[...t.hiddenSeries]:[]}static makeSeriesData(t,e,n,s,i=le.ORIENTATION.VERTICAL){return{type:t,mode:e,name:n,orientation:i,showlegend:s!=null?s:void 0}}static makeSeriesDataFromSeries(t,e,n,s=null,i=qt){const{name:o,plotStyle:r,lineColor:l,shapeColor:a,sources:d}=t,c=d.some(f=>{var b;return(b=f.axis)==null?void 0:b.businessCalendar}),u=le.getChartType(r,c),m=le.getPlotlyChartMode(r),p=le.getPlotlySeriesOrientation(t),g=le.makeSeriesData(u,m,o,s,p);return le.addSourcesToSeriesData(g,r,d,e),le.addStylingToSeriesData(g,r,i,l,a,n),g}static addSourcesToSeriesData(t,e,n,s){const i=t;for(let o=0;o<n.length;o+=1){const r=n[o],{axis:l,type:a}=r,d=le.getPlotlyProperty(e,a);bu(i,d,[]);const c=l!=null?le.getAxisPropertyName(l.type):null;if(c!=null){const u=s.get(l.type);if(u){const m=u.indexOf(l),p=m>0?`${m+1}`:"";i[`${c}axis`]=`${c}${p}`}}}}static addStylingToSeriesData(t,e,n=qt,s=null,i=null,o=null){const r=t;r.marker={line:{}},r.line={width:1},e===M.plot.SeriesPlotStyle.AREA?r.fill="tozeroy":e===M.plot.SeriesPlotStyle.STACKED_AREA?r.stackgroup="stack":e===M.plot.SeriesPlotStyle.STEP?r.line.shape="hv":e===M.plot.SeriesPlotStyle.HISTOGRAM?(r.width=[],r.marker.line!==void 0&&Object.assign(r.marker.line,{color:n.paper_bgcolor,width:1})):e===M.plot.SeriesPlotStyle.OHLC?(r.increasing={line:{color:n.ohlc_increasing}},r.decreasing={line:{color:n.ohlc_decreasing}}):e===M.plot.SeriesPlotStyle.PIE?(r.textinfo="label+percent",r.outsidetextfont={color:n.title_color}):e===M.plot.SeriesPlotStyle.TREEMAP&&(r.hoverinfo="text",r.textinfo="label+text",r.tiling={packing:"squarify",pad:0},r.textposition="middle center",r.outsidetextfont={color:n.title_color}),s!=null&&(e===M.plot.SeriesPlotStyle.BAR?r.marker.color=s:r.line.color=s),i!=null&&(r.marker.color=i),o!=null&&e!==M.plot.SeriesPlotStyle.PIE&&(r.visible=o)}static getAxisFormats(t,e){const n=new Map,s={tickformat:null,ticksuffix:null},i=le.getAllAxes(t),o=le.groupArray(i,"type"),{charts:r}=t;for(let l=0;l<r.length;l+=1){const a=r[l];for(let d=0;d<a.series.length;d+=1){const c=a.series[d],{sources:u}=c,m=u.filter(p=>p.axis);for(let p=0;p<m.length;p+=1){const g=m[p],{axis:f}=g,{type:b}=f,C=o.get(b);L(C);const S=C.indexOf(f),v=le.getAxisPropertyName(b);if(v!=null){const y=le.getAxisLayoutProperty(v,S);if(n.has(y))Ar.debug(`${y} already added.`);else{Ar.debug(`Adding ${y} to axisFormats.`);const E=le.getPlotlyAxisFormat(g,e);if(E===null)n.set(y,s);else{n.set(y,E);const{businessCalendar:I}=f;if(I!=null){const R=[],{businessPeriods:N,businessDays:F,holidays:P,timeZone:H}=I,x=e==null?void 0:e.getColumnTypeFormatter(wh);let A;vh(x)&&(A=x.dhTimeZone);const k=A?(H.standardOffset-A.standardOffset)/60:0;P.length>0&&R.push(...le.createRangeBreakValuesFromHolidays(P,H,A)),N.forEach(G=>R.push({pattern:"hour",bounds:[le.periodToDecimal(G.close)+k,le.periodToDecimal(G.open)+k]})),F.length<Ms.length&&le.createBoundsFromDays(F).forEach(G=>R.push({pattern:"day of week",bounds:G})),E.rangebreaks=R}if(n.size===a.axes.length)return n}}}}}}return n}static getChartType(t,e){switch(t){case M.plot.SeriesPlotStyle.HISTOGRAM:return"bar";default:return le.getPlotlyChartType(t,e)}}static getAxisPropertyName(t){switch(t){case M.plot.AxisType.X:return"x";case M.plot.AxisType.Y:return"y";default:return null}}static getAxisSide(t){switch(t){case M.plot.AxisPosition.BOTTOM:return"bottom";case M.plot.AxisPosition.TOP:return"top";case M.plot.AxisPosition.LEFT:return"left";case M.plot.AxisPosition.RIGHT:return"right";default:return}}static getAllAxes(t){return t.charts.reduce((e,n)=>[...e,...n.axes],[])}static getChartForSeries(t,e){const{charts:n}=t;for(let s=0;s<n.length;s+=1){const i=n[s];for(let o=0;o<i.series.length;o+=1)if(e===i.series[o])return i}return null}static getLayoutRanges(t){const e={},n=Object.keys(t).filter(s=>s.indexOf("axis")>=0);for(let s=0;s<n.length;s+=1){const i=n[s],o=t[i];v0(o)&&(e[i]=[...o.range])}return e}static updateFigureAxes(t,e,n,s=0,i=0,o=qt){const r=t,l=le.getAllAxes(e);for(let a=0;a<e.charts.length;a+=1){const d=e.charts[a],c=n==null?void 0:n(d),u=le.getChartBounds(e,d,s,i);le.updateLayoutAxes(r,d.axes,l,s,i,u,c,o)}le.removeStaleAxes(r,l)}static getChartBounds(t,e,n=0,s=0){var v;const{cols:i,rows:o}=t,{column:r,colspan:l,row:a,rowspan:d}=e,c=r+l,u=a+d,m=1/i,p=1/o,g=le.AXIS_SIZE_PX/n,f=le.AXIS_SIZE_PX/s,b={left:r*m+(r>0?g/2:0),bottom:a*p+(a>0?f/2:0),top:u*p-(u<o?f/2:0),right:c*m-(c<i?g/2:0)};return((v=le.groupArray(e.axes,"position").get(M.plot.AxisPosition.RIGHT))!=null?v:[]).length>0&&(n>0?b.right-=(b.right-b.left)*Math.max(0,Math.min(le.LEGEND_WIDTH_PX/n,le.MAX_LEGEND_SIZE)):b.right-=(b.right-b.left)*le.DEFAULT_AXIS_SIZE),b}static updateLayoutAxes(t,e,n,s=0,i=0,o={left:0,top:0,right:1,bottom:1},r,l=qt){const a=s>0?Math.max(le.MIN_AXIS_SIZE,Math.min(le.AXIS_SIZE_PX/i,le.MAX_AXIS_SIZE)):le.DEFAULT_AXIS_SIZE,d=i>0?Math.max(le.MIN_AXIS_SIZE,Math.min(le.AXIS_SIZE_PX/s,le.MAX_AXIS_SIZE)):le.DEFAULT_AXIS_SIZE,c=t,u=le.groupArray(e,"position"),m=le.groupArray(e,"type"),p=[...m.keys()],g=le.groupArray(n,"type");for(let f=0;f<p.length;f+=1){const b=p[f],C=le.getAxisPropertyName(b);if(C!=null){const S=m.get(b),v=g.get(b),E=b===M.plot.AxisType.Y?i:s;L(S),L(v);for(let I=0;I<S.length;I+=1){const R=S[I],N=v.indexOf(R),F=le.getAxisLayoutProperty(C,N);c[F]==null&&(c[F]=le.makeLayoutAxis(b,l));const P=c[F];if(P!=null){le.updateLayoutAxis(P,R,I,u,a,d,o);const{range:H,autorange:x}=P;if(r!=null&&H!==void 0&&(x===void 0||x===!1)){const A=r(R),[k,G]=A(H);Ar.debug("Setting downsample range",E,k,G),R.range(E,k,G)}else R.range(E)}}}}}static removeStaleAxes(t,e){const n=t,s=le.groupArray(e,"type"),i=[...s.keys()];for(let o=0;o<i.length;o+=1){const r=i[o],l=s.get(r);L(l);let a=l.length;const d=le.getAxisPropertyName(r);if(d!=null){let c=le.getAxisLayoutProperty(d,a);for(;n[c]!=null;)delete n[c],a+=1,c=le.getAxisLayoutProperty(d,a)}}}static getAxisLayoutProperty(t,e){const n=e>0?`${e+1}`:"";return`${t!=null?t:""}axis${n}`}static updateLayoutAxis(t,e,n,s,i,o,r){var u,m,p;const a=e.type===M.plot.AxisType.Y?o:i,d=t,c=(u=e.label)!=null?u:"";if(d.title!==void 0&&typeof d.title!="string"?d.title.text=c:d.title={text:c},e.log&&(d.type="log"),d.side=le.getAxisSide(e.position),n>0){d.overlaying=(m=le.getAxisPropertyName(e.type))!=null?m:void 0;const g=(p=s.get(e.position))!=null?p:[],f=g.indexOf(e);f>0&&(d.anchor="free",e.position===M.plot.AxisPosition.RIGHT?d.position=r.right+(f-g.length+1)*a:e.position===M.plot.AxisPosition.TOP?d.position=r.top+(f-g.length+1)*a:e.position===M.plot.AxisPosition.BOTTOM?d.position=r.bottom+(g.length-f+1)*a:e.position===M.plot.AxisPosition.LEFT&&(d.position=r.left+(g.length-f+1)*a))}else if(e.type===M.plot.AxisType.X){const g=s.get(M.plot.AxisPosition.LEFT)||[],f=s.get(M.plot.AxisPosition.RIGHT)||[],b=Math.max(r.left,r.left+(g.length-1)*o),C=Math.min(r.right-(f.length-1)*o,r.right);d.domain=[b,C]}else if(e.type===M.plot.AxisType.Y){const g=s.get(M.plot.AxisPosition.BOTTOM)||[],f=s.get(M.plot.AxisPosition.TOP)||[],b=Math.max(r.bottom,r.bottom+(g.length-1)*i),C=Math.min(r.top-(f.length-1)*i,r.top);d.domain=[b,C]}}static periodToDecimal(t){const e=t.split(":");return Number(e[0])+Number(e[1])/60}static createBoundsFromDays(t){const e=t.map(o=>Ms.indexOf(o)),n=Ms.filter(o=>!t.includes(o)).map(o=>Ms.indexOf(o)),s=new Set;n.forEach(o=>{for(let r=o+1;r<o+Ms.length;r+=1){const l=r%Ms.length;if(e.includes(l)){s.add(l);break}}});const i=[];return s.forEach(o=>{for(let r=o-1;r>o-Ms.length;r-=1){const l=r<0?r+Ms.length:r;if(e.includes(l)){const a=(l+1)%7;i.push([a,o]);break}}}),i}static createRangeBreakValuesFromHolidays(t,e,n){const s=[],i=[];return t.forEach(o=>{o.businessPeriods.length>0?i.push(...le.createPartialHoliday(o,e,n)):s.push(le.createFullHoliday(o,e,n))}),[{values:s},...i]}static createFullHoliday(t,e,n){return le.adjustDateForTimeZone(`${t.date.toString()} 00:00:00.000000`,e,n)}static createPartialHoliday(t,e,n){const s=t.date.toString(),i=["00:00"];t.businessPeriods.forEach(r=>{i.push(r.open),i.push(r.close)}),i.push("24:00");const o=[];for(let r=0;r<i.length;r+=2){const l=i[r],a=i[r+1];if(l!==a){const d=[le.adjustDateForTimeZone(`${s} ${l}:00.000000`,e,n)],c=C0*(le.periodToDecimal(a)-le.periodToDecimal(l));o.push({values:d,dvalue:c})}}return o}static adjustDateForTimeZone(t,e,n){return n&&n.standardOffset!==e.standardOffset?le.unwrapValue(le.wrapValue(t,wh,e),n):t}static groupArray(t,e){return t.reduce((n,s)=>{var r;const i=s[e],o=(r=n.get(i))!=null?r:[];return o.push(s),n.set(i,o),n},new Map)}static unwrapValue(t,e){if(t!=null){if(S0(t))return M.i18n.DateTimeFormat.format(le.DATE_FORMAT,t,e);if(w0(t))return t.asNumber()}return t}static wrapValue(t,e,n=null){if(_.isDateType(e)&&typeof t=="string"){const s=t,i=le.DATE_FORMAT.substr(0,t.length),o=M.i18n.DateTimeFormat.parse(i,s);if(!n)return o;const r=`${i} Z`,l=M.i18n.DateTimeFormat.format("Z",o,n),a=M.i18n.DateTimeFormat.parse(r,`${s} ${l}`),d=M.i18n.DateTimeFormat.format("Z",a,n);return M.i18n.DateTimeFormat.parse(r,`${s} ${d}`)}return t}static makeLayoutAxis(t,e=qt){const n={automargin:!0,gridcolor:e.gridcolor,linecolor:e.linecolor,rangeslider:{visible:!1},showline:!0,ticklen:5,tickcolor:e.paper_bgcolor,tickfont:{color:e.zerolinecolor},title:{font:{color:e.title_color}}};return t===M.plot.AxisType.X?Object.assign(n,{showgrid:!0}):t===M.plot.AxisType.Y&&Object.assign(n,{zerolinecolor:e.zerolinecolor,zerolinewidth:2}),n}static getColorwayFromTheme(t=qt){let e=[];return t.colorway&&(Array.isArray(t.colorway)?e=t.colorway:typeof t.colorway=="string"?e=t.colorway.split(" "):Ar.warn(`Unable to handle colorway property: ${t.colorway}`)),e}static makeDefaultLayout(t=qt){const e={...t,autosize:!0,colorway:le.getColorwayFromTheme(t),font:{family:"'Fira Sans', sans-serif"},title:{font:{color:t.title_color},yanchor:"top",pad:{...le.DEFAULT_TITLE_PADDING},y:1},legend:{font:{color:t.title_color}},margin:{...le.DEFAULT_MARGIN},xaxis:le.makeLayoutAxis(M.plot.AxisType.X,t),yaxis:le.makeLayoutAxis(M.plot.AxisType.Y,t)};return e.datarevision=0,e}static hydrateSettings(t){return{...t,type:M.plot.SeriesPlotStyle[t.type]}}static titleFromSettings(t){const{series:e,xAxis:n,title:s=`${e.join(", ")} by ${n}`}=t;return s}static makeFigureSettings(t,e){const{series:n,xAxis:s,type:i}=t,o=le.titleFromSettings(t),r={formatType:`${M.plot.AxisFormatType.NUMBER}`,type:`${M.plot.AxisType.X}`,position:`${M.plot.AxisPosition.BOTTOM}`},l={formatType:`${M.plot.AxisFormatType.NUMBER}`,type:`${M.plot.AxisType.Y}`,position:`${M.plot.AxisPosition.LEFT}`};return{charts:[{chartType:`${M.plot.ChartType.XY}`,axes:[r,l],series:n.map(a=>({plotStyle:`${i}`,name:a,dataSources:[{type:`${M.plot.SourceType.X}`,columnName:s,axis:r,table:e},{type:`${M.plot.SourceType.Y}`,columnName:a,axis:l,table:e}]}))}],title:o}}};let xe=le;xe.DEFAULT_AXIS_SIZE=.15;xe.MIN_AXIS_SIZE=.025;xe.MAX_AXIS_SIZE=.2;xe.AXIS_SIZE_PX=75;xe.LEGEND_WIDTH_PX=50;xe.MAX_LEGEND_SIZE=.25;xe.ORIENTATION=Object.freeze({HORIZONTAL:"h",VERTICAL:"v"});xe.DATE_FORMAT="yyyy-MM-dd HH:mm:ss.SSSSSS";xe.DEFAULT_MARGIN=Object.freeze({l:60,r:50,t:30,b:60,pad:0});xe.DEFAULT_TITLE_PADDING=Object.freeze({t:8});xe.SUBTITLE_LINE_HEIGHT=25;const Ns=Z.module("Chart"),Ho=class extends w.exports.Component{constructor(t){super(t),this.getCachedConfig=Se((e,n,s,i)=>{const o=[],r=Boolean(e);if(r&&o.push({name:`Downsampling failed: ${e}`,click:()=>{},icon:Ho.convertIcon(Vu),attr:"fill-warning"}),n||s||i||r){const l=Ho.downsampleButtonTitle(s,i),a=Ho.downsampleButtonAttr(s,i),d=s?_u:lb;o.push({name:l,icon:Ho.convertIcon(d),click:this.handleDownsampleClick,attr:a})}return{displaylogo:!1,displayModeBar:s||r?!0:"hover",modeBarButtons:[o,["toImage"],["zoom2d","pan2d"],["zoomIn2d","zoomOut2d","autoScale2d","resetScale2d"]]}}),this.handleAfterPlot=this.handleAfterPlot.bind(this),this.handleDownsampleClick=this.handleDownsampleClick.bind(this),this.handleModelEvent=this.handleModelEvent.bind(this),this.handlePlotUpdate=this.handlePlotUpdate.bind(this),this.handleRelayout=this.handleRelayout.bind(this),this.handleRestyle=this.handleRestyle.bind(this),this.plot=X.createRef(),this.plotWrapper=X.createRef(),this.columnFormats=[],this.dateTimeFormatterOptions={},this.decimalFormatOptions={},this.integerFormatOptions={},this.isSubscribed=!1,this.isLoadedFired=!1,this.currentSeries=0,this.state={data:null,downsamplingError:null,isDownsampleFinished:!1,isDownsampleInProgress:!1,isDownsamplingDisabled:!1,layout:{datarevision:0},revision:0}}static convertIcon(t){const[e,,,,n]=t.icon,s=`${n}`;return{width:e,path:s,ascent:e,descent:0,transform:"matrix(1, 0, 0, 1, 0, 0)"}}static downsampleButtonTitle(t,e){return t?"Downsampling in progress...":e?"Downsampling disabled, click to enable":"Downsampling enabled, click to disable"}static downsampleButtonAttr(t,e){return t?"animation-spin":e?void 0:"fill-active"}componentDidMount(){this.updateDimensions(),this.updateModelDimensions(),this.initData(),this.initFormatter();const{isActive:t}=this.props;t&&this.subscribe()}componentDidUpdate(t){const{isActive:e,settings:n}=this.props;this.updateFormatterSettings(n),e!==t.isActive&&(e?this.subscribe():this.unsubscribe())}componentWillUnmount(){this.unsubscribe()}getPlotRect(){var t,e;return(e=(t=this.plotWrapper.current)==null?void 0:t.getBoundingClientRect())!=null?e:null}initData(){const{model:t}=this.props,{layout:e}=this.state;this.setState({data:t.getData(),layout:{...e,...t.getLayout()}})}subscribe(){if(this.isSubscribed)return;const{model:t}=this.props;if(!this.rect||this.rect.width===0||this.rect.height===0){Ns.debug2("Delaying subscription until model dimensions are set");return}t.subscribe(this.handleModelEvent),this.isSubscribed=!0}unsubscribe(){if(!this.isSubscribed)return;const{model:t}=this.props;t.unsubscribe(this.handleModelEvent),this.isSubscribed=!1}handleAfterPlot(){this.plot.current!=null}handleDownsampleClick(){this.setState(({isDownsamplingDisabled:t})=>({downsamplingError:null,isDownsampleInProgress:!1,isDownsampleFinished:!1,isDownsamplingDisabled:!t}),()=>{const{model:t}=this.props,{isDownsamplingDisabled:e}=this.state;t.setDownsamplingDisabled(e)})}handleModelEvent(t){var s;const{type:e,detail:n}=t;switch(Ns.debug2("Received data update",e,n),e){case Tt.EVENT_UPDATED:{this.currentSeries+=1,this.setState(o=>{const{layout:r,revision:l}=o;return typeof r.datarevision=="number"&&(r.datarevision+=1),{data:n,layout:r,revision:l+1}});const{onUpdate:i}=this.props;i({isLoading:!this.isLoadedFired});break}case Tt.EVENT_LOADFINISHED:{const{onUpdate:i}=this.props;this.isLoadedFired=!0,i({isLoading:!1});break}case Tt.EVENT_DISCONNECT:{const{onDisconnect:i}=this.props;i();break}case Tt.EVENT_RECONNECT:{const{onReconnect:i}=this.props;i();break}case Tt.EVENT_DOWNSAMPLESTARTED:{this.setState({isDownsampleFinished:!1,isDownsampleInProgress:!0,downsamplingError:null});break}case Tt.EVENT_DOWNSAMPLEFINISHED:{this.setState({isDownsampleFinished:!0,isDownsampleInProgress:!1,downsamplingError:null});break}case Tt.EVENT_DOWNSAMPLENEEDED:case Tt.EVENT_DOWNSAMPLEFAILED:{const i=(s=n.message)!=null?s:n;this.setState({isDownsampleFinished:!1,isDownsampleInProgress:!1,isDownsamplingDisabled:!1,downsamplingError:i});const{onError:o}=this.props;o(new Error(i));break}default:Ns.debug("Unknown event type",e,t)}}handlePlotUpdate(t){const{layout:e}=t,n=xe.getLayoutRanges(e);!ut(n,this.ranges)&&(this.ranges=n,this.updateModelDimensions(!0))}handleRelayout(t){if(Ns.debug("handleRelayout",t),t.hiddenlabels!=null){const{onSettingsChanged:e}=this.props,n=[...t.hiddenlabels];e({hiddenSeries:n})}this.updateModelDimensions()}handleRestyle([t,e]){if(Ns.debug("handleRestyle",t,e),Object.keys(t).includes("visible")){const{data:n}=this.state,{onSettingsChanged:s}=this.props;if(n!=null){const i=n.reduce((o,{name:r,visible:l})=>r!=null&&l==="legendonly"?[...o,r]:o,[]);s({hiddenSeries:i})}}}updateModelDimensions(t=!1){const e=this.getPlotRect();if(!e){Ns.warn("Unable to get plotting rect");return}if(!this.rect||this.rect.width!==e.width||this.rect.height!==e.height||t){this.rect=e;const{isActive:s,model:i}=this.props;i.setDimensions(e),s&&this.subscribe()}}initFormatter(){const{settings:t}=this.props;this.updateFormatterSettings(t)}updateFormatterSettings(t){const e=Cs.getColumnFormats(t),n=Cs.getDateTimeFormatterOptions(t),{decimalFormatOptions:s={},integerFormatOptions:i={}}=t;(!ut(this.columnFormats,e)||!ut(this.dateTimeFormatterOptions,n)||!ut(this.decimalFormatOptions,s)||!ut(this.integerFormatOptions,i))&&(this.columnFormats=Cs.getColumnFormats(t),this.dateTimeFormatterOptions=n,this.decimalFormatOptions=s,this.integerFormatOptions=i,this.updateFormatter())}updateFormatter(){const t=new cn(this.columnFormats,this.dateTimeFormatterOptions,this.decimalFormatOptions,this.integerFormatOptions),{model:e}=this.props;e.setFormatter(t)}updateDimensions(){const t=this.getPlotRect();this.plot.current!=null&&t!=null&&t.width>0&&t.height>0&&dl.relayout(this.plot.current.el,{autosize:!0}).catch(e=>{Ns.debug("Unable to resize, promise rejected",e)})}render(){const{data:t,downsamplingError:e,isDownsampleFinished:n,isDownsampleInProgress:s,isDownsamplingDisabled:i,layout:o,revision:r}=this.state,l=this.getCachedConfig(e,n,s,i),a=t!=null;return h("div",{className:"h-100 w-100 chart-wrapper",ref:this.plotWrapper,children:a&&h(Mm,{ref:this.plot,data:t,layout:o,revision:r,config:l,onAfterPlot:this.handleAfterPlot,onError:Ns.error,onRelayout:this.handleRelayout,onUpdate:this.handlePlotUpdate,onRestyle:this.handleRestyle,useResizeHandler:!0,style:{height:"100%",width:"100%"}})})}};let Nm=Ho;Nm.defaultProps={isActive:!0,settings:{timeZone:"America/New_York",defaultDateTimeFormat:Jn.FULL_DATE_FORMAT,showTimeZone:!1,showTSeparator:!0,formatter:[]},onDisconnect:()=>{},onReconnect:()=>{},onUpdate:()=>{},onError:()=>{},onSettingsChanged:()=>{}};const Lt=Z.module("FigureChartModel"),Fm=class extends Tt{constructor(t,e={},n=qt){super(),this.addPendingSeries=Ze(()=>{var r;const i=xe.getAllAxes(this.figure),{pendingSeries:o}=this;for(let l=0;l<o.length;l+=1){const a=o[l],d=this.figure.charts.find(c=>c.series.includes(a));this.addSeries(a,i,(r=d==null?void 0:d.showLegend)!=null?r:null),a.subscribe()}this.pendingSeries=[]},Fm.ADD_SERIES_DEBOUNCE),this.getTimeZone=be((i,o)=>{if(o!=null){const r=o.getColumnTypeFormatter(i);if(r!=null)return r.dhTimeZone}}),this.getValueTranslator=be((i,o)=>{const r=this.getTimeZone(i,o);return l=>xe.unwrapValue(l,r)}),this.getValueParser=be((i,o)=>{const r=this.getTimeZone(i,o);return l=>xe.wrapValue(l,i,r)}),this.getRangeParser=be((i,o)=>r=>{let[l,a]=r;const d=this.getValueParser(i,o);return l=d(l),a=d(a),[l,a]}),this.getAxisRangeParser=be((i,o)=>r=>{const l=xe.getSourceForAxis(i,r);return l?this.getRangeParser(l.columnType,o):a=>a}),this.handleFigureUpdated=this.handleFigureUpdated.bind(this),this.handleFigureDisconnected=this.handleFigureDisconnected.bind(this),this.handleFigureReconnected=this.handleFigureReconnected.bind(this),this.handleFigureSeriesAdded=this.handleFigureSeriesAdded.bind(this),this.handleDownsampleStart=this.handleDownsampleStart.bind(this),this.handleDownsampleFinish=this.handleDownsampleFinish.bind(this),this.handleDownsampleFail=this.handleDownsampleFail.bind(this),this.handleDownsampleNeeded=this.handleDownsampleNeeded.bind(this),this.handleRequestFailed=this.handleRequestFailed.bind(this),this.figure=t,this.settings=e,this.theme=n,this.data=[];const s={data:{},layout:xe.makeDefaultLayout(n)};this.layout={grid:{rows:t.rows,columns:t.cols,pattern:"independent"},template:s},this.seriesDataMap=new Map,this.pendingSeries=[],this.oneClicks=[],this.filterColumnMap=new Map,this.lastFilter=new Map,this.isConnected=!0,this.seriesToProcess=new Set,this.setTitle(this.getDefaultTitle()),this.initAllSeries(),this.updateAxisPositions(),this.startListeningFigure()}close(){this.figure.close(),this.addPendingSeries.cancel(),this.stopListeningFigure()}getDefaultTitle(){return this.figure.charts.length>0?this.figure.charts[0].title:""}initAllSeries(){this.oneClicks=[],this.filterColumnMap.clear();const{charts:t}=this.figure,e=xe.getAllAxes(this.figure),n=[];for(let o=0;o<t.length;o+=1){const r=t[o];for(let l=0;l<r.series.length;l+=1){const a=r.series[l];n.push(a.name),this.addSeries(a,e,r.showLegend)}}const i=[...this.seriesDataMap.keys()].filter(o=>n.indexOf(o)<0);for(let o=0;o<i.length;o+=1){const r=i[o];this.seriesDataMap.delete(r)}this.seriesToProcess=new Set([...this.seriesDataMap.keys()])}addSeries(t,e,n){const s=xe.groupArray(e,"type"),i=xe.makeSeriesDataFromSeries(t,s,xe.getSeriesVisibility(t.name,this.settings),n,this.theme);if(this.seriesDataMap.set(t.name,i),this.data=[...this.seriesDataMap.values()],t.plotStyle===M.plot.SeriesPlotStyle.STACKED_BAR?this.layout.barmode="stack":t.plotStyle===M.plot.SeriesPlotStyle.PIE&&(this.layout.hiddenlabels=xe.getHiddenLabels(this.settings)),this.layout.showlegend=this.data.length>1||t.plotStyle===M.plot.SeriesPlotStyle.PIE?n!=null?n:void 0:!1,t.oneClick!=null){const{oneClick:o}=t,{columns:r}=o;for(let l=0;l<r.length;l+=1)this.filterColumnMap.set(r[l].name,r[l]);this.oneClicks.push(o)}this.updateLayoutFormats()}subscribe(t){super.subscribe(t),this.listeners.length===1&&(this.initAllSeries(),this.subscribeFigure())}unsubscribe(t){super.unsubscribe(t),this.listeners.length===0&&this.unsubscribeFigure()}subscribeFigure(){if(!this.isConnected){Lt.debug("Ignoring subscribe when figure in disconnected state");return}this.figure.subscribe(this.isDownsamplingDisabled?M.plot.DownsampleOptions.DISABLE:M.plot.DownsampleOptions.DEFAULT)}unsubscribeFigure(){this.figure.unsubscribe()}startListeningFigure(){this.figure.addEventListener(M.plot.Figure.EVENT_UPDATED,this.handleFigureUpdated),this.figure.addEventListener(M.plot.Figure.EVENT_SERIES_ADDED,this.handleFigureSeriesAdded),this.figure.addEventListener(M.plot.Figure.EVENT_DISCONNECT,this.handleFigureDisconnected),this.figure.addEventListener(M.plot.Figure.EVENT_RECONNECT,this.handleFigureReconnected),this.figure.addEventListener(M.plot.Figure.EVENT_DOWNSAMPLESTARTED,this.handleDownsampleStart),this.figure.addEventListener(M.plot.Figure.EVENT_DOWNSAMPLEFINISHED,this.handleDownsampleFinish),this.figure.addEventListener(M.plot.Figure.EVENT_DOWNSAMPLEFAILED,this.handleDownsampleFail),this.figure.addEventListener(M.plot.Figure.EVENT_DOWNSAMPLENEEDED,this.handleDownsampleNeeded),this.figure.addEventListener(M.Client.EVENT_REQUEST_FAILED,this.handleRequestFailed)}stopListeningFigure(){this.figure.removeEventListener(M.plot.Figure.EVENT_UPDATED,this.handleFigureUpdated),this.figure.removeEventListener(M.plot.Figure.EVENT_SERIES_ADDED,this.handleFigureSeriesAdded),this.figure.removeEventListener(M.plot.Figure.EVENT_DISCONNECT,this.handleFigureDisconnected),this.figure.removeEventListener(M.plot.Figure.EVENT_RECONNECT,this.handleFigureReconnected),this.figure.removeEventListener(M.plot.Figure.EVENT_DOWNSAMPLESTARTED,this.handleDownsampleStart),this.figure.removeEventListener(M.plot.Figure.EVENT_DOWNSAMPLEFINISHED,this.handleDownsampleFinish),this.figure.removeEventListener(M.plot.Figure.EVENT_DOWNSAMPLEFAILED,this.handleDownsampleFail),this.figure.removeEventListener(M.plot.Figure.EVENT_DOWNSAMPLENEEDED,this.handleDownsampleNeeded),this.figure.removeEventListener(M.Client.EVENT_REQUEST_FAILED,this.handleRequestFailed)}handleDownsampleStart(t){Lt.debug("Downsample started",t),this.fireDownsampleStart(t.detail)}handleDownsampleFinish(t){Lt.debug("Downsample finished",t),this.fireDownsampleFinish(t.detail)}handleDownsampleFail(t){Lt.error("Downsample failed",t),this.fireDownsampleFail(t.detail)}handleDownsampleNeeded(t){Lt.info("Downsample needed",t),this.fireDownsampleNeeded(t.detail)}handleFigureUpdated(t){const{detail:e}=t,{series:n}=e;Lt.debug2("handleFigureUpdated",n);for(let i=0;i<n.length;i+=1){const o=n[i];Lt.debug2("handleFigureUpdated updating series",o.name);const{sources:r}=o;for(let l=0;l<r.length;l+=1){const a=r[l],{columnType:d,type:c}=a,u=this.getValueTranslator(d,this.formatter),m=e.getArray(o,c,u);this.setDataArrayForSeries(o,c,m)}this.seriesToProcess.delete(o.name),this.seriesToProcess.size===0&&this.fireLoadFinished(),this.cleanSeries(o)}const{data:s}=this;this.fireUpdate(s)}handleRequestFailed(t){Lt.error("Request failed",t)}resubscribe(){this.listeners.length>0&&(this.unsubscribeFigure(),this.subscribeFigure())}setFormatter(t){super.setFormatter(t),this.updateLayoutFormats(),this.resubscribe()}setDownsamplingDisabled(t){super.setDownsamplingDisabled(t),this.resubscribe()}handleFigureDisconnected(t){Lt.debug("Figure disconnected",t),this.isConnected=!1,this.listeners.length>0&&this.unsubscribeFigure(),this.fireDisconnect()}handleFigureReconnected(t){Lt.debug("Figure reconnected",t),this.isConnected=!0,this.initAllSeries(),this.fireReconnect(),this.listeners.length>0&&this.subscribeFigure()}handleFigureSeriesAdded(t){const{detail:e}=t;Lt.debug("handleFigureSeriesAdded",e),this.pendingSeries.push(e),this.addPendingSeries()}setDimensions(t){super.setDimensions(t),this.updateAxisPositions()}setTitle(t){var s,i;super.setTitle(t);const e=(i=(s=(t!=null?t:"").match(/<br>/g))==null?void 0:s.length)!=null?i:0,n=xe.DEFAULT_MARGIN.t+e*xe.SUBTITLE_LINE_HEIGHT;this.layout.margin?this.layout.margin.t=n:this.layout.margin={t:n},typeof this.layout.title=="string"?this.layout.title=t:(this.layout.title={...this.layout.title},this.layout.title.text=t,this.layout.title.pad={...this.layout.title.pad},this.layout.title.pad.t=xe.DEFAULT_TITLE_PADDING.t+e*xe.SUBTITLE_LINE_HEIGHT*.5)}getPlotWidth(){var t,e,n,s;return!this.rect||!this.rect.width?0:Math.max(this.rect.width-((e=(t=this.layout.margin)==null?void 0:t.l)!=null?e:0)-((s=(n=this.layout.margin)==null?void 0:n.r)!=null?s:0),0)}getPlotHeight(){var t,e,n,s;return!this.rect||!this.rect.height?0:Math.max(this.rect.height-((e=(t=this.layout.margin)==null?void 0:t.t)!=null?e:0)-((s=(n=this.layout.margin)==null?void 0:n.b)!=null?s:0),0)}updateAxisPositions(){const t=this.getPlotWidth(),e=this.getPlotHeight();xe.updateFigureAxes(this.layout,this.figure,n=>this.getAxisRangeParser(n,this.formatter),t,e,this.theme)}updateLayoutFormats(){if(!this.formatter)return;xe.getAxisFormats(this.figure,this.formatter).forEach((e,n)=>{Lt.debug(`Assigning ${n}`,this.layout[n],e);const s=this.layout[n];s!=null?Object.assign(s,e):Lt.debug(`Ignoring null layout.${n}`)})}setDataArrayForSeries(t,e,n){const{name:s,plotStyle:i}=t,o=this.seriesDataMap.get(s),r=xe.getPlotlyProperty(i,e);o&&bu(o,r,n)}cleanSeries(t){const{name:e,plotStyle:n}=t,s=this.seriesDataMap.get(e);if(s!=null){if(n===M.plot.SeriesPlotStyle.HISTOGRAM){const{xLow:i,xHigh:o}=s;if(i&&o&&i.length===o.length){const r=[];for(let l=0;l<i.length;l+=1)r.push(o[l]-i[l]);s.width=r}}else if(n===M.plot.SeriesPlotStyle.LINE){const{x:i,xLow:o,xHigh:r,y:l,yLow:a,yHigh:d}=s;o&&r&&o!==i&&(s.error_x=xe.getPlotlyErrorBars(i,o,r)),a&&d&&a!==l&&(s.error_y=xe.getPlotlyErrorBars(l,a,d))}else if(n===M.plot.SeriesPlotStyle.TREEMAP){const{ids:i,labels:o}=s;i!==void 0&&o===void 0&&(s.labels=i)}}}getData(){return this.data}getLayout(){return this.layout}getFilterColumnMap(){return new Map(this.filterColumnMap)}isFilterRequired(){return this.oneClicks.find(t=>t.requireAllFiltersToDisplay)!=null}setFilter(t){if(this.oneClicks.length===0){Lt.warn("Trying to set a filter, but no one click!");return}Lt.debug("setFilter",t);for(let e=0;e<this.oneClicks.length;e+=1){const n=this.oneClicks[e],{columns:s}=n;new Set([...t.keys(),...this.lastFilter.keys()]).forEach(o=>{const r=t.get(o);this.lastFilter.get(o)!==r&&s.find(l=>l.name===o)!=null&&n.setValueForColumn(o,r)})}this.lastFilter=new Map(t)}setFigure(t){this.close(),this.figure=t,this.setTitle(this.getDefaultTitle()),this.initAllSeries(),this.updateAxisPositions(),this.startListeningFigure(),this.listeners.length>0&&this.subscribeFigure()}updateSettings(t){this.settings=t}};let Ya=Fm;Ya.ADD_SERIES_DEBOUNCE=50;class eo{static async makeModelFromSettings(e,n,s=qt){const i=await eo.makeFigureFromSettings(e,n);return new Ya(i,e,s)}static async makeFigureFromSettings(e,n){const s=await n.copy();return s.applyCustomColumns(n.customColumns),s.applyFilter(n.filter),s.applySort(n.sort),M.plot.Figure.create(xe.makeFigureSettings(e,s))}static async makeModel(e,n,s=qt){return new Ya(n,e,s)}}function Th(t){return t.setFigure!==void 0}function T0({connection:t,defaultUpdateInterval:e,hoverUpdateInterval:n,bgMonitoring:s=!0,monitorDuration:i}){var P;const[o,r]=w.exports.useState({freeMemory:0,maximumHeapSize:999,totalHeapSize:0}),[l,a]=w.exports.useState(!1),d=w.exports.useRef({timestamps:[],usages:[]});w.exports.useEffect(function(){const x=async()=>{const k=await t.getWorkerHeapInfo();if(r(k),s||l){const G=(k.totalHeapSize-k.freeMemory)/k.maximumHeapSize,V=Date.now(),{timestamps:O,usages:$}=d.current;for(;O.length!==0&&V-O[0]>i*1.5;)O.shift(),$.shift();O.push(V),$.push(G)}else d.current={timestamps:[],usages:[]}};x();const A=setInterval(x,l?n:e);return()=>{clearInterval(A)}},[l,n,t,e,i,s]);const c=(H,x)=>Math.round(H*10**x)/10**x,u=2,m=1024**3,{freeMemory:p,totalHeapSize:g,maximumHeapSize:f}=o,b=c(p/m,u),C=c(g/m,u),S=c(f/m,u),v=C-b,y=(H,x,A=!1)=>T("div",{className:z("heap-usage-info-row",{"heading-bottom-border":A}),children:[h("div",{className:"font-weight-bold",children:H}),h("div",{children:x})]}),{timestamps:E,usages:I}=d.current,R=(P=E[E.length-1])!=null?P:0,N=g/f,F=(g-p)/f;return T(Te,{children:[T("div",{className:"max-memory",children:[h("div",{className:"total-memory",style:{width:`calc(${N*100}% - ${N*2}px`}}),h("div",{className:z("used-memory",{"heap-overflow":(g-p)/f>.95}),style:{width:`calc(${F*100}% - ${F*2}px`}}),T("div",{className:"memory-text",children:[S.toFixed(1)," GB"]})]}),h(Ye,{onEntered:()=>a(!0),onExited:()=>a(!1),interactive:!0,children:T("div",{className:"heap-tooltip",children:[y("In use:",`${v.toFixed(u)} of ${S.toFixed(u)} GB`,!0),y("Free:",`${b.toFixed(u)} GB`),y("Total:",`${C.toFixed(u)} GB`),y("Max:",`${S.toFixed(u)} GB`),h("div",{className:"heap-plot",children:h(Mm,{data:[{x:[...E],y:[...I],type:"scatter",mode:"lines"}],config:{staticPlot:!0,responsive:!0},style:{width:"196px",height:"100px"},layout:{legend:!1,margin:{l:2,t:2,r:2,b:2},plot_bgcolor:"transparent",paper_bgcolor:"transparent",colorway:["#4878ea"],xaxis:{dtick:Math.round(i/6),gridcolor:qt.linecolor,range:[R-i,R],linecolor:qt.linecolor,linewidth:2,mirror:!0},yaxis:{dtick:.2,gridcolor:qt.linecolor,range:[0,1],linecolor:qt.linecolor,linewidth:2,mirror:!0}}})}),T("div",{className:"heap-utilisation-text",children:["% utilization over ",Math.round(i/1e3/60)," min."]})]})})]})}const Hd=Object.freeze({}),E0=new Map,xm=t=>t.user,Vd=t=>t.storage,_m=t=>Vd(t).commandHistoryStorage,km=t=>Vd(t).fileStorage,y0=t=>Vd(t).workspaceStorage,Kl=t=>t.workspace,Rt=t=>Kl(t).data.settings,Om=t=>Rt(t).defaultDateTimeFormat,Lm=t=>{var e;return(e=Rt(t).defaultDecimalFormatOptions)!=null?e:Hd},Am=t=>{var e;return(e=Rt(t).defaultIntegerFormatOptions)!=null?e:Hd},Pm=t=>Rt(t).formatter,or=t=>Rt(t).timeZone,Hm=t=>Rt(t).showTimeZone,Vm=t=>Rt(t).showTSeparator,Um=t=>Rt(t).truncateNumbersWithPound,I0=t=>Rt(t).shortcutOverrides,R0=t=>{var e;return(e=Rt(t).defaultNotebookSettings)!=null?e:Hd},ql=t=>t.activeTool,D0=t=>{var e;return(e=t.plugins)!=null?e:E0},Bm="SET_ACTIVE_TOOL",$m="SET_COMMAND_HISTORY_STORAGE",zm="SET_FILE_STORAGE",Wm="SET_PLUGINS",Gm="SET_USER",Km="SET_WORKSPACE",qm="SET_WORKSPACE_STORAGE",Ym="SET_SERVER_CONFIG_VALUES",M0=t=>({type:Gm,payload:t}),Xm=t=>({type:Km,payload:t}),N0=t=>({type:qm,payload:t}),F0=t=>({type:$m,payload:t}),x0=t=>({type:zm,payload:t}),_0=t=>(e,n)=>{e(Xm(t));const{storage:s}=n(),{workspaceStorage:i}=s;return i.save(t)},jm=t=>(e,n)=>{const{workspace:s}=n(),{data:i}=s,o={...s,data:{...i,...t}};return e(_0(o))},Yl=t=>e=>e(jm({settings:t})),Xl=t=>({type:Bm,payload:t}),k0=t=>({type:Wm,payload:t}),O0=t=>({type:Ym,payload:t});function Zm(t,e){return(n=e,s)=>{switch(s.type){case t:{const i=s.payload;return i==null?null:n!=null?{...n,...i}:{...i}}default:return n}}}function L0(t,e={},n=!0){return(s=e,i)=>{switch(i.type){case t:{const{id:o,payload:r}=i;return n&&ut({payload:r},{payload:s[o]})?s:{...s,[o]:r}}default:return s}}}function Ks(t,e){return(n=e,s)=>{switch(s.type){case t:return s.payload;default:return n}}}const A0=Ks(Bm,null),P0=Ks(Wm,null),H0=Ks($m,null),V0=Ks(zm,null),U0=Ks(qm,null),B0=Cd({commandHistoryStorage:H0,fileStorage:V0,workspaceStorage:U0}),$0=Zm(Gm,null),z0=Zm(Km,null),W0=Ks(Ym,null),G0={activeTool:A0,plugins:P0,storage:B0,user:$0,workspace:z0,serverConfigValues:W0};class K0{constructor(){this.reducers={},this.listener=null}register(e,n){var s;this.reducers={...this.reducers,[e]:n},(s=this.listener)==null||s.call(this,this.reducers)}setListener(e){this.listener=e}}const ho=new K0,Eh=Z.module("redux-logger"),q0=t=>e=>n=>{Eh.debug("dispatching",n);const s=e(n);return Eh.debug("next state",t.getState()),s},Y0=Z.module("redux-crashReporter"),X0=t=>e=>n=>{try{return e(n)}catch(s){throw Y0.error("Error executing",n," with state ",t.getState(),":",s),s}},j0=[q0,X0,Yg];Object.entries(G0).map(([t,e])=>ho.register(t,e));var Cu;const Z0=(Cu=window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__)!=null?Cu:Zg,jl=Xg(Cd(ho.reducers),Z0(jg(...j0)));ho.setListener(t=>{jl.replaceReducer(Cd(t))});const Qm=Object.freeze({openPopouts:[],settings:{hasHeaders:!0,constrainDragToContainer:!0,reorderEnabled:!0,selectionEnabled:!1,popoutWholeStack:!1,blockedPopoutsThrowError:!0,closePopoutsOnUnload:!0,showPopoutIcon:!0,showMaximiseIcon:!0,showCloseIcon:!0,responsiveMode:"onload",tabOverlapAllowance:0,tabControlOffset:10},dimensions:{borderWidth:5,borderGrabWidth:10,minItemHeight:10,minItemWidth:10,headerHeight:20,dragProxyWidth:300,dragProxyHeight:200},labels:{close:"Close",maximise:"Maximize",minimise:"Minimize",popout:"Open in new window",popin:"Pop in",tabDropdown:"Additional tabs",tabNextLabel:"Next",tabPreviousLabel:"Previous"},content:[]});function Jm(t){return t.componentName!==void 0}function Q0(t){return t.component!==void 0}const ep=Object.freeze({type:"default",isClosable:!0,isFocusOnShow:!0,reorderEnabled:!0,title:""}),J0=Object.freeze(Object.defineProperty({__proto__:null,defaultConfig:Qm,isGLComponentConfig:Jm,isReactComponentConfig:Q0,itemDefaultConfig:ep},Symbol.toStringTag,{value:"Module"})),Xa=class{constructor(){this.off=this.unbind,this.trigger=this.emit,this._mSubscriptions={},this._mSubscriptions[Xa.ALL_EVENT]=[]}on(t,e,n){if(typeof e!="function")throw new Error("Tried to listen to event "+t+" with non-function callback "+e);this._mSubscriptions[t]||(this._mSubscriptions[t]=[]),this._mSubscriptions[t].push({fn:e,ctx:n})}emit(t,...e){const n=this._mSubscriptions[t];if(n)for(let i=0;i<n.length;i++){const o=n[i].ctx||{};n[i].fn.apply(o,e)}e.unshift(t);const s=this._mSubscriptions[Xa.ALL_EVENT];for(let i=0;i<s.length;i++){const o=s[i].ctx||{};s[i].fn.apply(o,e)}}unbind(t,e,n){if(!this._mSubscriptions[t])throw new Error("No subscribtions to unsubscribe for event "+t);let s=!1;for(let i=0;i<this._mSubscriptions[t].length;i++)(!e||this._mSubscriptions[t][i].fn===e)&&(!n||n===this._mSubscriptions[t][i].ctx)&&(this._mSubscriptions[t].splice(i,1),s=!0);if(s===!1)throw new Error("Nothing to unbind for "+t)}};let Tn=Xa;Tn.ALL_EVENT="__all";class ja extends Tn{constructor(e,n,s){super(),this.isHidden=!1,this._element=fe(['<div class="lm_item_container">','<div class="lm_content" tabindex="-1"></div>',"</div>"].join("")),this.title=Jm(e)?e.componentName:"",this.parent=n,this.layoutManager=s,this._config=e,this._contentElement=this._element.find(".lm_content"),this.beforeCloseHandler=null}getElement(){return this._contentElement}hide(){this.emit("hide"),this.isHidden=!0,this._element.hide()}show(){this.emit("show"),this.isHidden=!1,this._element.show(),(this.height!=0||this.width!=0)&&this.emit("shown")}setSize(e,n){var c,u,m,p;let s=this.parent,i=null;for(;s&&!s.isColumn&&!s.isRow;)if(i=s,s=s.parent,s!=null&&s.isRoot)return!1;if(!s||!i)return!1;const o=s.isColumn?"height":"width",r=o==="height"?n:e,l=((c=this[o])!=null?c:0)*(1/(((u=i.config[o])!=null?u:0)/100)),a=r/l*100,d=(((m=i.config[o])!=null?m:0)-a)/(s.contentItems.length-1);for(let g=0;g<s.contentItems.length;g++)s.contentItems[g]===i?s.contentItems[g].config[o]=a:s.contentItems[g].config[o]=((p=s.contentItems[g].config[o])!=null?p:0)+d;return s.callDownwards("setSize"),!0}close(e){var n,s;!this._config.isClosable||((s=(n=this.beforeCloseHandler)==null?void 0:n.call(this,e))==null||s)&&(this.emit("close"),this.parent.close())}beforeClose(e){this.beforeCloseHandler=e}getState(){return this._config.componentState}extendState(e){this.setState(fe.extend(!0,this.getState(),e))}setState(e){this._config.componentState=e,this.parent.emitBubblingEvent("stateChanged")}setTitle(e){this.parent.setTitle(e)}_$setSize(e=0,n=0){if(e!==this.width||n!==this.height){this.width=e,this.height=n;var s=this._contentElement[0],i=s.offsetWidth-s.clientWidth,o=s.offsetHeight-s.clientHeight;this._contentElement.width(this.width-i).height(this.height-o),this.emit("resize")}}}const ew=Object.freeze(Object.defineProperty({__proto__:null,ItemContainer:ja,Container:ja},Symbol.toStringTag,{value:"Module"}));function tp(t){var e=location.hash.match(new RegExp(t+"=([^&]*)"));return e?e[1]:null}function np(t){if(window.location.hash)return tp(t);if(!window.location.search)return null;var e=window.location.search.substr(1).split("&"),n={},s,i;for(i=0;i<e.length;i++)s=e[i].split("="),n[s[0]]=s[1];return n[t]||null}function Zl(t){return window.requestAnimationFrame(t)}function tw(t,e){var n=e.indexOf(t);if(n===-1)throw new Error("Can't remove item from array. Item is not in the array");e.splice(n,1)}function Ud(){return(Math.random()*1e15).toString(36).replace(".","")}function nw(t,e){var n=t.replace(/javascript/gi,"j&#97;vascript").replace(/expression/gi,"expr&#101;ssion").replace(/onload/gi,"onlo&#97;d").replace(/script/gi,"&#115;cript").replace(/onerror/gi,"on&#101;rror");return e===!0?n:n.replace(/>/g,"&gt;").replace(/</g,"&lt;")}function Bd(t){return fe.trim(t.replace(/(<([^>]+)>)/gi,""))}class rr extends Tn{constructor(e,n=!1){var s;super(),this._nDelay=400,this._nDistance=10,this._nX=0,this._nY=0,this._nOriginalX=0,this._nOriginalY=0,this._bDragging=!1,this._eElement=e,this._oDocument=fe(document),this._eBody=fe(document.body),this._destroyAfterMouseUp=n,this.onMouseMove=this.onMouseMove.bind(this),this.onMouseUp=this.onMouseUp.bind(this),this.onMouseDown=this.onMouseDown.bind(this),this._startDrag=this._startDrag.bind(this),(s=this._eElement)==null||s.on("mousedown",this.onMouseDown)}destroy(){var e,n;(e=this._eElement)==null||e.unbind("mousedown",this.onMouseDown),(n=this._oDocument)==null||n.unbind("mouseup",this.onMouseUp),this._eElement=void 0,this._oDocument=void 0,this._eBody=void 0,clearTimeout(this._timeout),this._timeout=void 0}onMouseDown(e){var s,i,o,r;if(e.preventDefault(),e.button===0){var n=this._getCoordinates(e);this._nOriginalX=(s=n.x)!=null?s:0,this._nOriginalY=(i=n.y)!=null?i:0,(o=this._oDocument)==null||o.on("mousemove",this.onMouseMove),(r=this._oDocument)==null||r.on("mouseup",this.onMouseUp),this._timeout=window.setTimeout(this._startDrag,this._nDelay)}}onMouseMove(e){var s,i;if(this._timeout!=null){e.preventDefault();var n=this._getCoordinates(e);this._nX=((s=n.x)!=null?s:0)-this._nOriginalX,this._nY=((i=n.y)!=null?i:0)-this._nOriginalY,this._bDragging===!1&&(Math.abs(this._nX)>this._nDistance||Math.abs(this._nY)>this._nDistance)&&this._startDrag(),this._bDragging&&this.emit("drag",this._nX,this._nY,e)}}onMouseUp(e){var n,s,i,o,r,l;this._timeout!=null&&(clearTimeout(this._timeout),(n=this._oDocument)==null||n.unbind("mousemove",this.onMouseMove),(s=this._oDocument)==null||s.unbind("mouseup",this.onMouseUp),(o=(i=this._oDocument)==null?void 0:i.find("iframe"))==null||o.css("pointer-events",""),this._bDragging===!0&&(this._bDragging=!1,this.emit("dragStop",e,this._nOriginalX+this._nX)),(r=this._eBody)==null||r.removeClass("lm_dragging"),this._eElement instanceof Window||(l=this._eElement)==null||l.removeClass("lm_dragging"),this._destroyAfterMouseUp&&this.destroy())}_startDrag(){var e,n,s,i;window.clearTimeout(this._timeout),this._bDragging=!0,(e=this._eBody)==null||e.addClass("lm_dragging"),(n=this._eElement)==null||n.addClass("lm_dragging"),(i=(s=this._oDocument)==null?void 0:s.find("iframe"))==null||i.css("pointer-events","none"),this.emit("dragStart",this._nOriginalX,this._nOriginalY)}_getCoordinates(e){var n,s;return{x:(n=e.pageX)!=null?n:0,y:(s=e.pageY)!=null?s:0}}}class sp{constructor(e,n){this._reactComponent=null,this._originalComponentWillUpdate=null,this._reactComponent=null,this._originalComponentWillUpdate=null,this._container=e,this._initialState=n,this._reactClass=this._getReactClass(),this._container.on("open",this._render,this),this._container.on("destroy",this._destroy,this)}_render(){bi.render(this._getReactComponent(),this._container.getElement()[0])}_gotReactComponent(e){if(!e)return;this._reactComponent=e,this._originalComponentWillUpdate=this._reactComponent.componentWillUpdate||function(){},this._reactComponent.componentWillUpdate=this._onUpdate.bind(this);const n=this._container.getState();n&&this._reactComponent.setState(n)}_destroy(){bi.unmountComponentAtNode(this._container.getElement()[0]),this._container.off("open",this._render,this),this._container.off("destroy",this._destroy,this)}_onUpdate(e,n){var s;this._container.setState(n),(s=this._originalComponentWillUpdate)==null||s.call(this._reactComponent,e,n)}_getReactClass(){var e=this._container._config.component;if(!e)throw new Error("No react component name. type: react-component needs a field `component`");const n=this._container.layoutManager.getComponent(e)||this._container.layoutManager.getFallbackComponent();if(!n)throw new Error('React component "'+e+'" not found. Please register all components with GoldenLayout using `registerComponent(name, component)`');return n}_getReactComponent(){var e={glEventHub:this._container.layoutManager.eventHub,glContainer:this._container,ref:this._gotReactComponent.bind(this)},n=fe.extend(e,this._container._config.props);return X.createElement(this._reactClass,n)}}const Sl=["settings","hasHeaders","constrainDragToContainer","selectionEnabled","dimensions","borderWidth","minItemHeight","minItemWidth","headerHeight","dragProxyWidth","dragProxyHeight","labels","close","maximise","minimise","popout","content","componentName","componentState","id","width","type","height","isClosable","title","popoutWholeStack","openPopouts","parentId","activeItemIndex","reorderEnabled","borderGrabWidth"],sw=[!0,!1,"row","column","stack","component","close","maximise","minimise","open in new window"];function $d(t){if(Sl.length>36)throw new Error("Too many keys in config minifier map");const e={};return zd(t,e,"_min"),e}function Za(t){if(Sl.length>36)throw new Error("Too many keys in config minifier map");const e={};return zd(t,e,"_max"),e}function zd(t,e,n){const s=n==="_min"?iw:ow;for(let i in t){if(!t.hasOwnProperty(i))continue;const o=Array.isArray(t)?t[Number.parseInt(i,10)]:t[i];if(typeof o=="object"&&o!=null){const r=o instanceof Array?[]:{};if(Array.isArray(e))e[Number.parseInt(i,10)]=r;else{const l=s(i,Sl);e[l]=r}zd(o,r,n)}else{const r=s(o,sw);if(Array.isArray(e))e[Number.parseInt(i,10)]=r;else{const l=s(i,Sl);e[l]=r}}}}function iw(t,e){if(typeof t=="string"&&t.length===1)return"___"+t;var n=e.indexOf(t);return n===-1?t:n.toString(36)}function ow(t,e){return typeof t=="string"&&t.length===1?e[parseInt(t,36)]:typeof t=="string"&&t.substr(0,3)==="___"?t[3]:t}class Qa{constructor(e,n){this.name=e,this.origin=n,this.isPropagationStopped=!1}stopPropagation(){this.isPropagationStopped=!0}}class ip extends Tn{constructor(e){super(),this._layoutManager=e,this._dontPropagateToParent=null,this._childEventSource=null,this.on(Tn.ALL_EVENT,this._onEventFromThis.bind(this)),this._boundOnEventFromChild=this._onEventFromChild.bind(this),fe(window).on("gl_child_event",this._boundOnEventFromChild)}_onEventFromThis(...e){this._layoutManager.isSubWindow&&e[0]!==this._dontPropagateToParent&&this._propagateToParent(e),this._propagateToChildren(e),this._dontPropagateToParent=null,this._childEventSource=null}_$onEventFromParent(e){this._dontPropagateToParent=e[0],this.emit.apply(this,e)}_onEventFromChild(e){this._childEventSource=e.originalEvent.__gl,this.emit.apply(this,e.originalEvent.__glArgs)}_propagateToParent(e){var i;const n="gl_child_event",s=(i=window.opener)==null?void 0:i.document.createEvent("HTMLEvents");s.initEvent(n,!0,!0),s.eventName=n,s.__glArgs=e,s.__gl=this._layoutManager,window.opener.dispatchEvent(s)}_propagateToChildren(e){for(let n=0;n<this._layoutManager.openPopouts.length;n++){const s=this._layoutManager.openPopouts[n].getGlInstance();s&&s!==this._childEventSource&&s.eventHub._$onEventFromParent(e)}}destroy(){fe(window).off("gl_child_event",this._boundOnEventFromChild)}}const rw=Object.freeze(Object.defineProperty({__proto__:null,EventEmitter:Tn,DragListener:rr,ReactComponentHandler:sp,BubblingEvent:Qa,EventHub:ip,getHashValue:tp,getQueryStringParam:np,animFrame:Zl,removeFromArray:tw,getUniqueId:Ud,filterXss:nw,stripTags:Bd,minifyConfig:$d,unminifyConfig:Za},Symbol.toStringTag,{value:"Module"}));class op extends Tn{constructor(e,n,s,i,o){super(),this.isInitialised=!1,this._popoutWindow=null,this._id=null,this._config=e,this._dimensions=n,this._parentId=s,this._indexInParent=i,this._layoutManager=o,this._createWindow()}toConfig(){var e,n,s,i,o,r,l,a,d,c,u;if(this.isInitialised===!1)throw new Error("Can't create config, layout not yet initialised");return{dimensions:{width:(e=this.getGlInstance())==null?void 0:e.width,height:(n=this.getGlInstance())==null?void 0:n.height,left:(r=(o=(s=this._popoutWindow)==null?void 0:s.screenX)!=null?o:(i=this._popoutWindow)==null?void 0:i.screenLeft)!=null?r:0,top:(c=(d=(l=this._popoutWindow)==null?void 0:l.screenY)!=null?d:(a=this._popoutWindow)==null?void 0:a.screenTop)!=null?c:0},content:(u=this.getGlInstance())==null?void 0:u.toConfig().content,parentId:this._parentId,indexInParent:this._indexInParent}}getGlInstance(){var e;return(e=this._popoutWindow)==null?void 0:e.__glInstance}getWindow(){return this._popoutWindow}close(){var e,n;if(this.getGlInstance())(e=this.getGlInstance())==null||e._$closeWindow();else try{(n=this.getWindow())==null||n.close()}catch{}}popIn(){var s,i;this._indexInParent;let e=null,n=null;this._parentId&&(e=fe.extend(!0,{},(s=this.getGlInstance())==null?void 0:s.toConfig()).content[0],n=this._layoutManager.root.getItemsById(this._parentId)[0],n||(((i=this._layoutManager.root.contentItems.length)!=null?i:0)>0?n=this._layoutManager.root.contentItems[0]:n=this._layoutManager.root)),e&&(n==null||n.addChild(e,this._indexInParent),this.close())}_createWindow(){const e=this._createUrl(),n=Math.floor(Math.random()*1e6).toString(36),s=this._serializeWindowOptions({width:this._dimensions.width,height:this._dimensions.height,innerWidth:this._dimensions.width,innerHeight:this._dimensions.height,menubar:"no",toolbar:"no",location:"no",personalbar:"no",resizable:"yes",scrollbars:"no",status:"no"});if(this._popoutWindow=window.open(e,n,s),!this._popoutWindow)if(this._layoutManager.config.settings.blockedPopoutsThrowError===!0){const o=new Error("Popout blocked");throw o.type="popoutBlocked",o}else return;fe(this._popoutWindow).on("load",this._positionWindow.bind(this)).on("unload beforeunload",this._onClose.bind(this));let i=window.setInterval(()=>{var o;((o=this._popoutWindow)==null?void 0:o.__glInstance)&&this._popoutWindow.__glInstance.isInitialised&&(this._onInitialised(),window.clearInterval(i))},10)}_serializeWindowOptions(e){var n=[],s;for(s in e)n.push(s+"="+e[s]);return n.join(",")}_createUrl(){var e={content:this._config};const n="gl-window-config-"+Ud();e=$d(e);try{localStorage.setItem(n,JSON.stringify(e))}catch(i){throw new Error("Error while writing to localStorage "+i.toString())}const s=document.location.href.split("?");return s.length===1?s[0]+"?gl-window="+n:document.location.href+"&gl-window="+n}_positionWindow(){var e,n;(e=this._popoutWindow)==null||e.moveTo(this._dimensions.left,this._dimensions.top),(n=this._popoutWindow)==null||n.focus()}_onInitialised(){var e;this.isInitialised=!0,(e=this.getGlInstance())==null||e.on("popIn",this.popIn,this),this.emit("initialised")}_onClose(){setTimeout(this.emit.bind(this,"closed"),50)}}const rp=class extends Tn{constructor(t,e,n,s,i,o){var l,a,d,c,u,m,p,g,f,b,C,S;super(),this._area=null,this._lastValidArea=null,this._dragListener=n,this._layoutManager=s,this._contentItem=i,this._originalParent=o,this._dragListener.on("drag",this._onDrag,this),this._dragListener.on("dragStop",this._onDrop,this),this._contentItem.tab&&this._contentItem.tab.element&&(this._layoutManager.tabDropPlaceholder.width((l=this._contentItem.tab.element.outerWidth(!0))!=null?l:0),this._layoutManager.tabDropPlaceholder.height((a=this._contentItem.tab.element.outerHeight(!0))!=null?a:0)),this.element=fe(rp._template),o&&o._side&&(this._sided=o._sided,this.element.addClass("lm_"+o._side),["right","bottom"].indexOf(o._side.toString())>=0&&this.element.find(".lm_content").after(this.element.find(".lm_header"))),this.element.css({left:t,top:e}),this._proxyTab=this.element.find(".lm_tab"),this._proxyTab.attr("title",Bd((d=this._contentItem.config.title)!=null?d:"")),this.element.find(".lm_title").html((c=this._contentItem.config.title)!=null?c:""),this.childElementContainer=this.element.find(".lm_content"),this.childElementContainer.append(i.element),this._updateTree(),this._layoutManager._$calculateItemAreas(),this._setDimensions(),fe(document.body).append(this.element),!this._contentItem.tab&&this._proxyTab.length&&(this._layoutManager.tabDropPlaceholder.width((u=this._proxyTab.outerWidth(!0))!=null?u:0),this._layoutManager.tabDropPlaceholder.height((m=this._proxyTab.outerHeight(!0))!=null?m:0));var r=this._layoutManager.container.offset();this._minX=(p=r==null?void 0:r.left)!=null?p:0,this._minY=(g=r==null?void 0:r.top)!=null?g:0,this._maxX=((f=this._layoutManager.container.width())!=null?f:0)+this._minX,this._maxY=((b=this._layoutManager.container.height())!=null?b:0)+this._minY,this._width=(C=this.element.width())!=null?C:0,this._height=(S=this.element.height())!=null?S:0,this._setDropPosition(t,e),this._layoutManager.emit("itemPickedUp",this._contentItem)}_onDrag(t,e,n){var r,l;const s=(r=n.pageX)!=null?r:0,i=(l=n.pageY)!=null?l:0;!(s>this._minX&&s<this._maxX&&i>this._minY&&i<this._maxY)&&this._layoutManager.config.settings.constrainDragToContainer===!0||this._setDropPosition(s,i)}_setDropPosition(t,e){this.element.css({left:t,top:e}),this._area=this._layoutManager._$getArea(t,e),this._area!==null&&(this._lastValidArea=this._area,this._area.contentItem._$highlightDropZone(t,e,this._area))}_onDrop(){var t;(t=this._layoutManager.dropTargetIndicator)==null||t.hide(),this._area!==null?this._area.contentItem._$onDrop(this._contentItem,this._area):this._lastValidArea!==null?this._lastValidArea.contentItem._$onDrop(this._contentItem,this._lastValidArea):this._originalParent?this._originalParent.addChild(this._contentItem):this._contentItem._$destroy(),this._dragListener.off("drag",this._onDrag,this),this._dragListener.off("dragStop",this._onDrop,this),this.element.remove(),this._layoutManager.emit("itemDropped",this._contentItem)}_updateTree(){this._contentItem.parent&&this._contentItem.parent.removeChild(this._contentItem,!0),this._contentItem._$setParent(null)}_setDimensions(){const t=this._layoutManager.config.dimensions;let e=t.dragProxyWidth,n=t.dragProxyHeight;this.element.width(e),this.element.height(n),e-=this._sided?t.headerHeight:0,n-=this._sided?0:t.headerHeight,this.childElementContainer.width(e),this.childElementContainer.height(n),this._contentItem.element.width(e),this._contentItem.element.height(n),this._contentItem.callDownwards("_$show"),this._contentItem.callDownwards("setSize")}};let lr=rp;lr._template='<div class="lm_dragProxy"><div class="lm_header"><ul class="lm_tabs"><li class="lm_tab lm_active"><i class="lm_left"></i><span class="lm_title"></span><i class="lm_right"></i></li></ul></div><div class="lm_content"></div></div>';class lp{constructor(e,n,s){this._element=e,this._itemConfig=n,this._layoutManager=s,this._dragListener=this._createDragListener()}_createDragListener(){return this._dragListener=new rr(this._element,!0),this._dragListener.on("dragStart",this._onDragStart,this),this._dragListener.on("dragStop",this._createDragListener,this),this._dragListener}_onDragStart(e,n){var r;let s=this._itemConfig;typeof s=="function"&&(s=s());const i=this._layoutManager._$normalizeContentItem(fe.extend(!0,{},s)),o=new lr(e,n,this._dragListener,this._layoutManager,i,null);(r=this._layoutManager.transitionIndicator)==null||r.transitionElements(this._element,o.element)}}class ap{constructor(e,n,s){this._element=fe(window),this._itemConfig=e,this._layoutManager=n,this._createDragListener(s)}_createDragListener(e){this._dragListener&&this._dragListener.destroy(),this._element&&(this._dragListener=new rr(this._element,!0),this._dragListener.on("dragStart",this._onDragStart,this),this._dragListener.on("dragStop",this._destroy,this),this._dragListener.onMouseDown(e),this._dragListener._startDrag())}_destroy(){this._dragListener=void 0,this._element=void 0,this._itemConfig=void 0,this._layoutManager=void 0}_onDragStart(e,n){if(!(!this._dragListener||!this._layoutManager)){var s=this._itemConfig;typeof s=="function"&&(s=s());var i=this._layoutManager._$normalizeContentItem(fe.extend(!0,{},s));new lr(e,n,this._dragListener,this._layoutManager,i,null)}}}const dp=class{constructor(){this.element=fe(dp._template),fe(document.body).append(this.element)}destroy(){this.element.remove()}highlightArea(t){this.element.css({left:t.x1,top:t.y1,width:Math.floor(t.x2-t.x1),height:Math.floor(t.y2-t.y1)}).show()}hide(){this.element.hide()}};let Wd=dp;Wd._template='<div class="lm_dropTargetIndicator"><div class="lm_inner"></div></div>';class Vo{constructor(e,n,s,i){this._header=e,this.element=fe('<li class="'+s+'" title="'+n+'"></li>'),this._header.on("destroy",this._$destroy,this),this._action=i,this.element.on("click",this._action),this._header.controlsContainer.append(this.element)}_$destroy(){this.element.off(),this.element.remove()}}class mi extends Error{constructor(e,n){super(),this.name="Configuration Error",this.message=e,this.node=n}}const lw=Object.freeze(Object.defineProperty({__proto__:null,ConfigurationError:mi},Symbol.toStringTag,{value:"Module"}));function Zo(t){return t.isStack}function Sn(t){return t.isComponent}function cp(t){return t.isRoot}class yt extends Tn{constructor(e,n,s,i){super(),this.isInitialised=!1,this.isMaximised=!1,this.isRoot=!1,this.isRow=!1,this.isColumn=!1,this.isStack=!1,this.isComponent=!1,this.element=i,this.config=this._extendItemNode(n),this.type=n.type,this.contentItems=[],this.parent=s,this.layoutManager=e,this._pendingEventPropagations={},this._throttledEvents=["stateChanged"],this.on(Tn.ALL_EVENT,this._propagateEvent,this),n.content&&this._createContentItems(n)}callDownwards(e,n=[],s=!1,i=!1){s!==!0&&i!==!0&&this[e].apply(this,n);for(let o=0;o<this.contentItems.length;o++)this.contentItems[o].callDownwards(e,n,s);s===!0&&i!==!0&&this[e].apply(this,n)}removeChild(e,n=!1){var i,o;const s=this.contentItems.indexOf(e);if(s===-1)throw new Error("Can't remove child item. Unknown content item");n!==!0&&this.contentItems[s]._$destroy(),this.contentItems.splice(s,1),(i=this.config.content)==null||i.splice(s,1),this.contentItems.length>0?this.callDownwards("setSize"):this.type!=="root"&&this.config.isClosable&&((o=this.parent)==null||o.removeChild(this))}addChild(e,n){e=this.layoutManager._$normalizeContentItem(e,this),n===void 0&&(n=this.contentItems.length),this.contentItems.splice(n,0,e),this.config.content===void 0&&(this.config.content=[]),this.config.content.splice(n,0,e.config),e.parent=this,e.parent.isInitialised===!0&&e.isInitialised===!1&&e._$init()}replaceChild(e,n,s=!1){n=this.layoutManager._$normalizeContentItem(n);const i=this.contentItems.indexOf(e),o=e.element[0].parentNode;if(i===-1)throw new Error("Can't replace child. oldChild is not child of this");o==null||o.replaceChild(n.element[0],e.element[0]),s===!0&&(e.parent=null,e._$destroy()),this.contentItems[i]=n,n.parent=this,Zo(this)&&(this.header.tabs[i].contentItem=n),n.parent.isInitialised===!0&&n.isInitialised===!1&&n._$init(),this.callDownwards("setSize")}remove(){var e;(e=this.parent)==null||e.removeChild(this)}popout(){var e=this.layoutManager.createPopout(this);return this.emitBubblingEvent("stateChanged"),e}toggleMaximise(e){e&&e.preventDefault(),this.isMaximised===!0?this.layoutManager._$minimiseItem(this):this.layoutManager._$maximiseItem(this),this.isMaximised=!this.isMaximised,this.emitBubblingEvent("stateChanged")}select(){this.layoutManager.selectedItem!==this&&(this.layoutManager.selectItem(this,!0),this.element.addClass("lm_selected"))}deselect(){this.layoutManager.selectedItem===this&&(this.layoutManager.selectedItem=null,this.element.removeClass("lm_selected"))}setTitle(e){this.config.title=e,this.emit("titleChanged",e),this.emitBubblingEvent("stateChanged")}hasId(e){if(this.config.id){if(typeof this.config.id=="string")return this.config.id===e;if(this.config.id instanceof Array)return this.config.id.indexOf(e)!==-1}else return!1}addId(e){this.hasId(e)||(this.config.id?typeof this.config.id=="string"?this.config.id=[this.config.id,e]:this.config.id instanceof Array&&this.config.id.push(e):this.config.id=e)}removeId(e){if(!this.hasId(e))throw new Error("Id not found");if(typeof this.config.id=="string")delete this.config.id;else if(this.config.id instanceof Array){var n=this.config.id.indexOf(e);this.config.id.splice(n,1)}}getItemsByFilter(e){const n=[],s=function(i){for(let o=0;o<i.contentItems.length;o++)e(i.contentItems[o])===!0&&n.push(i.contentItems[o]),s(i.contentItems[o])};return s(this),n}getItemsById(e){return this.getItemsByFilter(function(n){return n.config.id instanceof Array?n.config.id.indexOf(e)!==-1:n.config.id===e})}getItemsByType(e){return this._$getItemsByProperty("type",e)}getComponentsByName(e){const n=this._$getItemsByProperty("componentName",e),s=[];for(let i=0;i<n.length;i++)s.push(n[i].instance);return s}_$getItemsByProperty(e,n){return this.getItemsByFilter(function(s){return s[e]===n})}_$setParent(e){this.parent=e}_$highlightDropZone(e,n,s){var i;(i=this.layoutManager.dropTargetIndicator)==null||i.highlightArea(s)}_$onDrop(e,n){this.addChild(e)}_$hide(){this._callOnActiveComponents("hide"),this.element.hide(),this.layoutManager.updateSize()}_$show(){this._callOnActiveComponents("show"),this.element.show(),this.layoutManager.updateSize()}_callOnActiveComponents(e){const n=this.getItemsByType("stack");let s=null;for(let i=0;i<n.length;i++)s=n[i].getActiveContentItem(),s&&Sn(s)&&s.container[e]()}_$destroy(){this.emitBubblingEvent("beforeItemDestroyed"),this.callDownwards("_$destroy",[],!0,!0),this.element.remove(),this.emitBubblingEvent("itemDestroyed")}_$getArea(e){var o,r,l;e=e||this.element;const n=(o=e.offset())!=null?o:{left:0,top:0},s=(r=e.width())!=null?r:0,i=(l=e.height())!=null?l:0;return{x1:n.left,y1:n.top,x2:n.left+s,y2:n.top+i,surface:s*i,contentItem:this,side:""}}_$init(){var e;this.setSize();for(let n=0;n<this.contentItems.length;n++)(e=this.childElementContainer)==null||e.append(this.contentItems[n].element);this.isInitialised=!0,this.emitBubblingEvent("itemCreated"),this.emitBubblingEvent(this.type+"Created")}emitBubblingEvent(e){var n=new Qa(e,this);this.emit(e,n)}_createContentItems(e){var n;if(!(e.content instanceof Array))throw new mi("content must be an Array",e);for(let s=0;s<e.content.length;s++)n=this.layoutManager.createContentItem(e.content[s],this),this.contentItems.push(n)}_extendItemNode(e){for(let[n,s]of Object.entries(ep)){const i=n;e[i]===void 0&&(e[i]=s)}return e}_propagateEvent(e,n){n instanceof Qa&&n.isPropagationStopped===!1&&this.isInitialised===!0&&(this.isRoot===!1&&this.parent?this.parent.emit.apply(this.parent,[e,n]):this._scheduleEventPropagationToLayoutManager(e,n))}_scheduleEventPropagationToLayoutManager(e,n){this._throttledEvents.indexOf(e)===-1?this.layoutManager.emit(e,n.origin):this._pendingEventPropagations[e]!==!0&&(this._pendingEventPropagations[e]=!0,Zl(this._propagateEventToLayoutManager.bind(this,e,n)))}_propagateEventToLayoutManager(e,n){this._pendingEventPropagations[e]=!1,this.layoutManager.emit(e,n)}}class hp extends yt{constructor(e,n,s){super(e,n,s,fe()),this.config=n,this.parent=s;const i=e.getComponent(this.config.componentName)||e.getFallbackComponent(),o=fe.extend(!0,{},this.config.componentState||{});if(i==null)throw new mi('Unknown component "'+this.config.componentName+'"');o.componentName=this.config.componentName,this.componentName=this.config.componentName,this.config.title===""&&(this.config.title=this.config.componentName),this.isComponent=!0,this.container=new ja(this.config,this,e),this.instance=new i(this.container,o),this.element=this.container._element}close(){this.parent.removeChild(this)}setSize(){this.element.is(":visible")&&this.container._$setSize(this.element.width(),this.element.height())}_$init(){yt.prototype._$init.call(this),this.container.emit("open")}_$hide(){this.container.hide(),yt.prototype._$hide.call(this)}_$show(){this.container.show(),this.container._config.isFocusOnShow&&this.container._contentElement[0].focus({preventScroll:!0}),yt.prototype._$show.call(this)}_$destroy(){this.container.emit("destroy",this),yt.prototype._$destroy.call(this)}_$getArea(){return null}}class wl extends yt{constructor(e,n,s,i){super(n,s,i,fe('<div class="lm_item lm_'+(e?"column":"row")+'"></div>')),this._splitter=[],this._splitterPosition=null,this._splitterMinPosition=null,this._splitterMaxPosition=null,this.parent=i,this.isRow=!e,this.isColumn=e,this.childElementContainer=this.element,this._splitterSize=n.config.dimensions.borderWidth,this._splitterGrabSize=n.config.dimensions.borderGrabWidth,this._isColumn=e,this._dimension=e?"height":"width",this._splitterPosition=null,this._splitterMinPosition=null,this._splitterMaxPosition=null}addChild(e,n,s){var a;var i,o,r,l;if(e=this.layoutManager._$normalizeContentItem(e,this),n===void 0&&(n=this.contentItems.length),this.contentItems.length>0?(l=this._createSplitter(Math.max(0,n-1)).element,n>0?(this.contentItems[n-1].element.after(l),l.after(e.element)):(this.contentItems[0].element.before(l),l.before(e.element))):this.childElementContainer.append(e.element),yt.prototype.addChild.call(this,e,n),i=1/this.contentItems.length*100,s===!0){this.emitBubblingEvent("stateChanged");return}for(r=0;r<this.contentItems.length;r++)this.contentItems[r]===e?e.config[this._dimension]=i:(o=((a=this.contentItems[r].config[this._dimension])!=null?a:0)*(100-i)/100,this.contentItems[r].config[this._dimension]=o);this.callDownwards("setSize"),this.emitBubblingEvent("stateChanged")}removeChild(e,n){var a,d;var s=(a=e.config[this._dimension])!=null?a:0,i=this.contentItems.indexOf(e),o=Math.max(i-1,0),r,l;if(i===-1)throw new Error("Can't remove child. ContentItem is not child of this Row or Column");for(this._splitter[o]&&(this._splitter[o]._$destroy(),this._splitter.splice(o,1)),r=0;r<this.contentItems.length;r++)this.contentItems[r]!==e&&(this.contentItems[r].config[this._dimension]=((d=this.contentItems[r].config[this._dimension])!=null?d:0)+s/(this.contentItems.length-1));yt.prototype.removeChild.call(this,e,n),this.contentItems.length===1&&this.config.isClosable===!0?(l=this.contentItems[0],this.contentItems=[],this.parent.replaceChild(this,l,!0)):(this.callDownwards("setSize"),this.emitBubblingEvent("stateChanged"))}replaceChild(e,n){var s=e.config[this._dimension];super.replaceChild(e,n),n.config[this._dimension]=s,this.callDownwards("setSize"),this.emitBubblingEvent("stateChanged")}setSize(){this.contentItems.length>0&&(this._calculateRelativeSizes(),this._setAbsoluteSizes()),this.emitBubblingEvent("stateChanged"),this.emit("resize")}_$init(){if(this.isInitialised!==!0){var e;for(yt.prototype._$init.call(this),e=0;e<this.contentItems.length-1;e++)this.contentItems[e].element.after(this._createSplitter(e).element)}}_setAbsoluteSizes(){var e,n=this._calculateAbsoluteSizes();for(e=0;e<this.contentItems.length;e++)n.additionalPixel-e>0&&n.itemSizes[e]++,this._isColumn?(this.contentItems[e].element.width(n.totalWidth),this.contentItems[e].element.height(n.itemSizes[e])):(this.contentItems[e].element.width(n.itemSizes[e]),this.contentItems[e].element.height(n.totalHeight))}_calculateAbsoluteSizes(){var l,a,d,c;const e=(this.contentItems.length-1)*this._splitterSize;let n=(l=this.element.width())!=null?l:0,s=(a=this.element.height())!=null?a:0,i=0;const o=[];this._isColumn?s-=e:n-=e;for(let u=0;u<this.contentItems.length;u++){const m=this._isColumn?Math.floor(s*(((d=this.contentItems[u].config.height)!=null?d:0)/100)):Math.floor(n*(((c=this.contentItems[u].config.width)!=null?c:0)/100));i+=m,o.push(m)}const r=Math.floor((this._isColumn?s:n)-i);return{itemSizes:o,additionalPixel:r,totalWidth:n,totalHeight:s}}_calculateRelativeSizes(){var i,o;let e=0;const n=[],s=this._isColumn?"height":"width";for(let r=0;r<this.contentItems.length;r++)this.contentItems[r].config[s]!==void 0?e+=(i=this.contentItems[r].config[s])!=null?i:0:n.push(this.contentItems[r]);if(Math.round(e)===100){this._respectMinItemWidth();return}if(Math.round(e)<100&&n.length>0){for(let r=0;r<n.length;r++)n[r].config[s]=(100-e)/n.length;this._respectMinItemWidth();return}if(Math.round(e)>100)for(let r=0;r<n.length;r++)n[r].config[s]=50,e+=50;for(let r=0;r<this.contentItems.length;r++)this.contentItems[r].config[s]=((o=this.contentItems[r].config[s])!=null?o:0)/e*100;this._respectMinItemWidth()}_respectMinItemWidth(){var c;const e=this.layoutManager.config.dimensions&&(c=this.layoutManager.config.dimensions.minItemWidth)!=null?c:0,n=[];let s=0,i=0,o=0;const r=[];let l;if(this._isColumn||!e||this.contentItems.length<=1)return;const a=this._calculateAbsoluteSizes();for(let u=0;u<this.contentItems.length;u++){this.contentItems[u];const m=a.itemSizes[u];m<e?(i+=e-m,l={width:e}):(s+=m-e,l={width:m},n.push(l)),r.push(l)}if(i===0||i>s)return;const d=i/s;o=i;for(let u=0;u<n.length;u++){l=n[u];const m=Math.round((l.width-e)*d);o-=m,l.width-=m}o!==0&&(r[r.length-1].width-=o);for(let u=0;u<this.contentItems.length;u++)this.contentItems[u].config.width=r[u].width/a.totalWidth*100}_createSplitter(e){var n;return n=new mp(this._isColumn,this._splitterSize,this._splitterGrabSize),n.on("drag",this._onSplitterDrag.bind(this,n),this),n.on("dragStop",this._onSplitterDragStop.bind(this,n),this),n.on("dragStart",this._onSplitterDragStart.bind(this,n),this),this._splitter.splice(e,0,n),n}_getItemsForSplitter(e){const n=this._splitter.indexOf(e);if(n<0)throw new Error("Splitter not found in RowOrColumn");return{before:this.contentItems[n],after:this.contentItems[n+1]}}_getMinimumDimensions(e){var o,r;for(var n=0,s=0,i=0;i<e.length;++i)n=Math.max((o=e[i].minWidth)!=null?o:0,n),s=Math.max((r=e[i].minHeight)!=null?r:0,s);return{horizontal:n,vertical:s}}_onSplitterDragStart(e){var a,d,c,u;const n=this._getItemsForSplitter(e),s=this.layoutManager.config.dimensions[this._isColumn?"minItemHeight":"minItemWidth"];var i=this._getMinimumDimensions((a=n.before.config.content)!=null?a:[]),o=this._isColumn?i.vertical:i.horizontal,r=this._getMinimumDimensions((d=n.after.config.content)!=null?d:[]),l=this._isColumn?r.vertical:r.horizontal;this._splitterPosition=0,this._splitterMinPosition=-1*(((c=n.before.element[this._dimension]())!=null?c:0)-(o||s)),this._splitterMaxPosition=((u=n.after.element[this._dimension]())!=null?u:0)-(l||s)}_onSplitterDrag(e,n,s){const i=this._isColumn?s:n;this._splitterMaxPosition==null||this._splitterMinPosition==null||i>this._splitterMinPosition&&i<this._splitterMaxPosition&&(this._splitterPosition=i,e.element.css(this._isColumn?"top":"left",i))}_onSplitterDragStop(e){var l,a,d,c,u;const n=this._getItemsForSplitter(e),s=(l=n.before.element[this._dimension]())!=null?l:0,i=(a=n.after.element[this._dimension]())!=null?a:0,o=(((d=this._splitterPosition)!=null?d:0)+s)/(s+i),r=((c=n.before.config[this._dimension])!=null?c:0)+((u=n.after.config[this._dimension])!=null?u:0);n.before.config[this._dimension]=o*r,n.after.config[this._dimension]=(1-o)*r,e.element.css({top:0,left:0}),Zl(this.callDownwards.bind(this,"setSize",void 0,void 0,void 0))}}class Ja extends yt{constructor(e,n,s){super(e,{...n,type:"root"},null,fe('<div class="lm_goldenlayout lm_item lm_root"></div>')),this.isRoot=!0,this.type="root",this.childElementContainer=this.element,this._containerElement=s,this._containerElement.append(this.element)}addChild(e,n){if(this.contentItems.length>0)throw new Error("Root node can only have a single child");e=this.layoutManager._$normalizeContentItem(e,this),this.childElementContainer.append(e.element),super.addChild(e,n),this.callDownwards("setSize"),this.emitBubblingEvent("stateChanged")}setSize(e,n){var s,i;e=typeof e>"u"?(s=this._containerElement.width())!=null?s:0:e,n=typeof n>"u"?(i=this._containerElement.height())!=null?i:0:n,this.element.width(e),this.element.height(n),this.contentItems[0]&&(this.contentItems[0].element.width(e),this.contentItems[0].element.height(n))}_$getArea(){const e=super._$getArea();if(e==null)throw new Error("Unable to get root area");return e}_$highlightDropZone(e,n,s){this.layoutManager.tabDropPlaceholder.remove(),super._$highlightDropZone(e,n,s)}_$onDrop(e,n){var i;var s;if(Sn(e)&&(s=this.layoutManager.createContentItem({type:"stack",header:e.config.header||{}},this),s._$init(),s.addChild(e),e=s),!this.contentItems.length)this.addChild(e);else{const{side:o}=n,r=o==="left"||o==="right"?"row":"column",l=o==="left"||o==="right"?"width":"height",a=o==="left"||o==="top",d=this.contentItems[0];if(!(d instanceof wl)||d.type!=r){const c=this.layoutManager.createContentItem({type:r},this);this.replaceChild(d,c),c.addChild(e,a?0:void 0,!0),c.addChild(d,a?void 0:0,!0),d.config[l]=50,e.config[l]=50,c.callDownwards("setSize")}else{const c=d.contentItems[a?0:d.contentItems.length-1];d.addChild(e,a?0:void 0,!0),c.config[l]=((i=c.config[l])!=null?i:0)*.5,e.config[l]=c.config[l],d.callDownwards("setSize")}}}}class ed extends yt{constructor(e,n,s){var o,r,l,a,d,c,u,m,p;super(e,n,s,fe('<div class="lm_item lm_stack"></div>')),this._activeContentItem=null,this.childElementContainer=fe('<div class="lm_items"></div>'),this.isStack=!0,this._dropZones={},this._dropSegment=null,this._contentAreaDimensions=null,this._sided=!1,this.parent=s,this.config=n;const i=e.config;this._side=!1,this._header={show:((o=i.settings)==null?void 0:o.hasHeaders)&&n.hasHeaders!==!1,popout:(r=i.settings)!=null&&r.showPopoutIcon?(l=i.labels)==null?void 0:l.popout:void 0,maximise:(a=i.settings)!=null&&a.showMaximiseIcon?(d=i.labels)==null?void 0:d.maximise:void 0,close:(c=i.settings)!=null&&c.showCloseIcon?(u=i.labels)==null?void 0:u.close:void 0,minimise:(p=(m=i.labels)==null?void 0:m.minimise)!=null?p:void 0},i.header&&(this._header={...this._header,...i.header}),n.header&&(this._header={...this._header,...n.header}),n.content&&n.content[0]&&n.content[0].header&&(this._header={...this._header,...n.content[0].header}),this.header=new ar(e,this),this.element.append(this.header.element),this.element.append(this.childElementContainer),this._setupHeaderPosition(),this._$validateClosability()}setSize(){var o,r,l,a;var e,n=this._header.show&&(r=(o=this.layoutManager.config.dimensions)==null?void 0:o.headerHeight)!=null?r:0,s=((l=this.element.width())!=null?l:0)-(this._sided?n:0),i=((a=this.element.height())!=null?a:0)-(this._sided?0:n);for(this.childElementContainer.width(s),this.childElementContainer.height(i),e=0;e<this.contentItems.length;e++)this.contentItems[e].element.width(s).height(i);this.emit("resize"),this.emitBubblingEvent("stateChanged")}_$init(){if(this.isInitialised!==!0){this.header._attachWheelListener(),super._$init();for(let e=0;e<this.contentItems.length;e++)this.header.createTab(this.contentItems[e]),this.contentItems[e]._$hide();if(this.contentItems.length>0){const e=this.contentItems[this.config.activeItemIndex||0];if(!e)throw new Error("Configured activeItemIndex out of bounds");this.setActiveContentItem(e)}}}setActiveContentItem(e){if(this.contentItems.indexOf(e)===-1)throw new Error("contentItem is not a child of this stack");this._activeContentItem!==null&&this._activeContentItem._$hide(),this._activeContentItem=e,this.header.setActiveContentItem(e),e._$show(),this.emit("activeContentItemChanged",e),this.layoutManager.emit("activeContentItemChanged",e),this.emitBubblingEvent("stateChanged")}getActiveContentItem(){return this.header.activeContentItem}addChild(e,n){e=this.layoutManager._$normalizeContentItem(e,this),super.addChild(e,n),this.childElementContainer.append(e.element),this.header.createTab(e,n),this.setActiveContentItem(e),this.callDownwards("setSize"),this._$validateClosability(),this.emitBubblingEvent("stateChanged")}removeChild(e,n=!1){var s=this.contentItems.indexOf(e);super.removeChild(e,n),this.header.removeTab(e),this.header.activeContentItem===e&&(this.contentItems.length>0?this.setActiveContentItem(this.contentItems[Math.max(s-1,0)]):this._activeContentItem=null),this._$validateClosability(),this.emitBubblingEvent("stateChanged")}_$validateClosability(){var n;let e=this.header._isClosable();for(let s=0,i=this.contentItems.length;s<i&&e;s++)e=(n=this.contentItems[s].config.isClosable)!=null?n:!1;this.header._$setClosable(e)}_$destroy(){yt.prototype._$destroy.call(this),this.header._$destroy()}_$onDrop(e){var a;if(this._dropSegment==="header"){this._resetHeaderDropZone(),this.addChild(e,this._dropIndex);return}if(this._dropSegment==="body"){this.addChild(e);return}const n=this._dropSegment==="top"||this._dropSegment==="bottom",s=this._dropSegment==="left"||this._dropSegment==="right",i=this._dropSegment==="top"||this._dropSegment==="left",o=n&&this.parent.isColumn||s&&this.parent.isRow,r=n?"column":"row",l=n?"height":"width";if(Sn(e)){const d=this.layoutManager.createContentItem({type:"stack",header:e.config.header||{}},this);d._$init(),d.addChild(e),e=d}if(o){const d=this.parent.contentItems.indexOf(this);this.parent.addChild(e,i?d:d+1,!0),this.config[l]=((a=this.config[l])!=null?a:0)*.5,e.config[l]=this.config[l],this.parent.callDownwards("setSize")}else{const d=this.layoutManager.createContentItem({type:r},this);this.parent.replaceChild(this,d),d.addChild(e,i?0:void 0,!0),d.addChild(this,i?void 0:0,!0),this.config[l]=50,e.config[l]=50,d.callDownwards("setSize")}}_$highlightDropZone(e,n){if(!!this._contentAreaDimensions)for(let[s,i]of Object.entries(this._contentAreaDimensions)){const o=i.hoverArea;if(o.x1<e&&o.x2>e&&o.y1<n&&o.y2>n){s==="header"?(this._dropSegment="header",this._highlightHeaderDropZone(e)):(this._resetHeaderDropZone(),this._highlightBodyDropZone(s));return}}}_$getArea(){if(this.element.is(":visible")===!1)return null;const e=super._$getArea(this.header.element),n=super._$getArea(this.childElementContainer);if(e==null||n==null)return null;const s=n.x2-n.x1,i=n.y2-n.y1;return this._contentAreaDimensions={header:{hoverArea:{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2},highlightArea:{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2}}},this._activeContentItem&&this._activeContentItem.isComponent===!1?e:this.contentItems.length===0?(this._contentAreaDimensions.body={hoverArea:{x1:n.x1,y1:n.y1,x2:n.x2,y2:n.y2},highlightArea:{x1:n.x1,y1:n.y1,x2:n.x2,y2:n.y2}},super._$getArea(this.element)):(this._contentAreaDimensions.left={hoverArea:{x1:n.x1,y1:n.y1,x2:n.x1+s*.25,y2:n.y2},highlightArea:{x1:n.x1,y1:n.y1,x2:n.x1+s*.5,y2:n.y2}},this._contentAreaDimensions.top={hoverArea:{x1:n.x1+s*.25,y1:n.y1,x2:n.x1+s*.75,y2:n.y1+i*.5},highlightArea:{x1:n.x1,y1:n.y1,x2:n.x2,y2:n.y1+i*.5}},this._contentAreaDimensions.right={hoverArea:{x1:n.x1+s*.75,y1:n.y1,x2:n.x2,y2:n.y2},highlightArea:{x1:n.x1+s*.5,y1:n.y1,x2:n.x2,y2:n.y2}},this._contentAreaDimensions.bottom={hoverArea:{x1:n.x1+s*.25,y1:n.y1+i*.5,x2:n.x1+s*.75,y2:n.y2},highlightArea:{x1:n.x1,y1:n.y1+i*.5,x2:n.x2,y2:n.y2}},super._$getArea(this.element))}_highlightHeaderDropZone(e){var u,m,p,g,f,b,C,S,v,y,E,I,R,N,F,P,H,x,A,k,G,V,O,$,Y,Q;const n=this.header.tabs.length;if(n===0){const U=this.header.element.offset();(S=this.layoutManager.dropTargetIndicator)==null||S.highlightArea({x1:(u=U==null?void 0:U.left)!=null?u:0,x2:((m=U==null?void 0:U.left)!=null?m:0)+100,y1:(g=(p=this.header.element.offset())==null?void 0:p.top)!=null?g:0,y2:((b=(f=this.header.element.offset())==null?void 0:f.top)!=null?b:0)+((C=this.header.element.innerHeight())!=null?C:0)});return}const i=(v=this.header.tabsContainer.get(0))==null?void 0:v.getBoundingClientRect(),o=(y=this.layoutManager.tabDropPlaceholder.get(0))==null?void 0:y.getBoundingClientRect();if(!i||!o)return;e<i.left?e=i.left+1:e>i.right&&(e=i.right-1);let r,l;if(!(o.left<e&&e<o.right)){for(var a=0;a<n;a++)if(r=this.header.tabs[a].element,l=(E=r.get(0))==null?void 0:E.getBoundingClientRect(),l&&l.left<e&&e<l.right){this._dropIndex=a;break}r&&l&&e<l.left+l.width*.5?r.before(this.layoutManager.tabDropPlaceholder):r&&(this._dropIndex=Math.min(((I=this._dropIndex)!=null?I:0)+1,n),r.after(this.layoutManager.tabDropPlaceholder))}let d=(N=(R=this.layoutManager.tabDropPlaceholder.offset())==null?void 0:R.left)!=null?N:0;d=Math.max(d,(P=(F=this.header.tabsContainer.offset())==null?void 0:F.left)!=null?P:0);var c=d+((H=this.layoutManager.tabDropPlaceholder.width())!=null?H:0);c=Math.min(c,((A=(x=this.header.tabsContainer.offset())==null?void 0:x.left)!=null?A:0)+((k=this.header.tabsContainer.innerWidth())!=null?k:0)),(Q=this.layoutManager.dropTargetIndicator)==null||Q.highlightArea({x1:d,x2:c,y1:(V=(G=this.header.element.offset())==null?void 0:G.top)!=null?V:0,y2:(($=(O=this.header.element.offset())==null?void 0:O.top)!=null?$:0)+((Y=this.header.element.innerHeight())!=null?Y:0)})}_resetHeaderDropZone(){this.layoutManager.tabDropPlaceholder.remove()}_setupHeaderPosition(){const e=["right","left","bottom"].some(n=>n===this._header.show)?this._header.show:void 0;if(!!e&&(this.header.element.toggle(!!this._header.show),this._side=e,this._sided=["right","left"].indexOf(this._side.toString())>=0,this.element.removeClass("lm_left lm_right lm_bottom"),this._side&&this.element.addClass("lm_"+this._side),this.element.find(".lm_header").length&&this.childElementContainer)){const n=["right","bottom"].indexOf(this._side.toString())>=0?"before":"after";this.header.element[n](this.childElementContainer),this.callDownwards("setSize")}}_highlightBodyDropZone(e){var s,i,o;const n=(i=(s=this._contentAreaDimensions)==null?void 0:s[e])==null?void 0:i.highlightArea;n&&((o=this.layoutManager.dropTargetIndicator)==null||o.highlightArea(n)),this._dropSegment=e}}const aw=Object.freeze(Object.defineProperty({__proto__:null,AbstractContentItem:yt,ContentItem:yt,Component:hp,Root:Ja,RowOrColumn:wl,Stack:ed,isStack:Zo,isComponent:Sn,isRoot:cp},Symbol.toStringTag,{value:"Module"})),up=class{constructor(t,e){var n;this.element=fe(up._template),this.isActive=!1,this.header=t,this.contentItem=e,this.titleElement=this.element.find(".lm_title"),this.closeElement=this.element.find(".lm_close_tab"),this.closeElement[e.config.isClosable?"show":"hide"](),this.setTitle(e.config.title),this.contentItem.on("titleChanged",this.setTitle,this),this._layoutManager=this.contentItem.layoutManager,((n=this._layoutManager.config.settings)==null?void 0:n.reorderEnabled)&&e.config.reorderEnabled&&(this._dragListener=new rr(this.element),this._dragListener.on("dragStart",this._onDragStart,this),this.contentItem.on("destroy",this._dragListener.destroy,this._dragListener)),this._onTabClick=this._onTabClick.bind(this),this._onCloseClick=this._onCloseClick.bind(this),this._onTabContentFocusIn=this._onTabContentFocusIn.bind(this),this._onTabContentFocusOut=this._onTabContentFocusOut.bind(this),this.element.on("click",this._onTabClick),this.element.on("auxclick",this._onTabClick),this.contentItem.config.isClosable?(this.closeElement.on("click",this._onCloseClick),this.closeElement.on("mousedown",this._onCloseMousedown)):this.closeElement.remove(),this.contentItem.tab=this,this.contentItem.emit("tab",this),this.contentItem.layoutManager.emit("tabCreated",this),Sn(this.contentItem)&&(this.contentItem.container._contentElement.on("focusin",this._onTabContentFocusIn).on("focusout",this._onTabContentFocusOut),this.contentItem.container._contentElement[0].addEventListener("click",this._onTabContentFocusIn,!0),this.contentItem.container.tab=this,this.contentItem.container.emit("tab",this))}setTitle(t=""){this.titleElement.html(t)}setActive(t){t!==this.isActive&&(this.isActive=t,t?this.element.addClass("lm_active"):this.element.removeClass("lm_active"))}_$destroy(){this.element.off("click",this._onTabClick),this.element.off("auxclick",this._onTabClick),this.closeElement.off("click",this._onCloseClick),Sn(this.contentItem)&&(this.contentItem.container._contentElement.off(),this.contentItem.container._contentElement[0].removeEventListener("click",this._onTabContentFocusIn,!0)),this._dragListener&&(this.contentItem.off("destroy",this._dragListener.destroy,this._dragListener),this._dragListener.off("dragStart",this._onDragStart),this._dragListener=void 0),this.element.remove()}_onDragStart(t,e){var n;(n=this.contentItem.parent)!=null&&n.isMaximised&&this.contentItem.parent.toggleMaximise(),this._dragListener&&new lr(t,e,this._dragListener,this._layoutManager,this.contentItem,this.header.parent)}_onTabContentFocusIn(){Sn(this.contentItem)&&!this.contentItem.container._contentElement[0].contains(document.activeElement)&&this.contentItem.container._contentElement[0].focus(),this.element.addClass("lm_focusin")}_onTabContentFocusOut(){Sn(this.contentItem)&&!this.contentItem.container._contentElement[0].contains(document.activeElement)&&this.element.removeClass("lm_focusin")}_onTabClick(t){var n;if(!t||t.button===0){var e=this.header.parent.getActiveContentItem();this.contentItem!==e&&Sn(this.contentItem)?(this.header.parent.setActiveContentItem(this.contentItem),this.contentItem.container.emit("tabClicked")):Sn(this.contentItem)&&!this.contentItem.container._contentElement[0].contains(document.activeElement)&&(this.contentItem.container._contentElement.focus(),this.contentItem.container.emit("tabClicked")),this.header._hideAdditionalTabsDropdown(),(n=this.element.get(0))==null||n.scrollIntoView({inline:"nearest"})}else t.button===1&&this.contentItem.config.isClosable&&this._onCloseClick(t)}_onCloseClick(t){t.stopPropagation(),Sn(this.contentItem)?this.contentItem.container.close():this.header.parent.removeChild(this.contentItem)}_onCloseMousedown(t){t.stopPropagation()}};let Gd=up;Gd._template=['<li class="lm_tab">','<span class="lm_title_before"></span>','<span class="lm_title"></span>','<div class="lm_close_tab"></div>',"</li>"].join("");const nl=class extends Tn{constructor(t,e){var n,s;super(),this.element=fe(nl._template),this.tabDropdownList=null,this.tabs=[],this.activeContentItem=null,this.closeButton=null,this.tabDropdownButton=null,this.tabNextButton=fe(nl._nextButtonTemplate),this.tabPreviousButton=fe(nl._previousButtonTemplate),this.holdTimer=null,this.rAF=null,this.CLICK_TIMEOUT=500,this.START_SPEED=.01,this.ACCELERATION=5e-4,this.SCROLL_LEFT="left",this.SCROLL_RIGHT="right",this.isDraggingTab=!1,this.isOverflowing=!1,this.isDropdownShown=!1,this.dropdownKeyIndex=0,this._lastVisibleTabIndex=-1,this.layoutManager=t,(n=this.layoutManager.config.settings)!=null&&n.selectionEnabled&&(this.element.addClass("lm_selectable"),this.element.on("click",this._onHeaderClick.bind(this))),this.tabsContainer=this.element.find(".lm_tabs"),this.tabDropdownContainer=this.element.find(".lm_tabdropdown_list"),this.tabDropdownContainer.hide(),this.tabDropdownSearch=this.element.find(".lm_tabdropdown_search input"),this._handleFilterInput=this._handleFilterInput.bind(this),this._handleFilterKeydown=this._handleFilterKeydown.bind(this),this.tabDropdownSearch.on("input",this._handleFilterInput),this.tabDropdownSearch.on("keydown",this._handleFilterKeydown),this.controlsContainer=this.element.find(".lm_controls"),this.parent=e,this.parent.on("resize",this._updateTabSizes,this),this._handleItemPickedUp=this._handleItemPickedUp.bind(this),this._handleItemDropped=this._handleItemDropped.bind(this),this._handleNextMouseEnter=this._handleNextMouseEnter.bind(this),this._handleNextMouseLeave=this._handleNextMouseLeave.bind(this),this._handlePreviousMouseEnter=this._handlePreviousMouseEnter.bind(this),this._handlePreviousMouseLeave=this._handlePreviousMouseLeave.bind(this),this._handleScrollRepeat=this._handleScrollRepeat.bind(this),this._handleNextButtonMouseDown=this._handleNextButtonMouseDown.bind(this),this._handlePreviousButtonMouseDown=this._handlePreviousButtonMouseDown.bind(this),this._handleScrollButtonMouseDown=this._handleScrollButtonMouseDown.bind(this),this._handleScrollButtonMouseUp=this._handleScrollButtonMouseUp.bind(this),this._handleScrollEvent=this._handleScrollEvent.bind(this),this.tabNextButton.on("mousedown",this._handleNextButtonMouseDown),this.tabPreviousButton.on("mousedown",this._handlePreviousButtonMouseDown),this.tabsContainer.on("scroll",this._handleScrollEvent),this.layoutManager.on("itemPickedUp",this._handleItemPickedUp),this.layoutManager.on("itemDropped",this._handleItemDropped),this.tabsContainer.before(this.tabPreviousButton),this.tabPreviousButton=this.tabPreviousButton.find(">:first-child"),this.tabPreviousButton.hide(),this._showAdditionalTabsDropdown=this._showAdditionalTabsDropdown.bind(this),this._hideAdditionalTabsDropdown=this._hideAdditionalTabsDropdown.bind(this),this._tabControlOffset=(s=this.layoutManager.config.settings)==null?void 0:s.tabControlOffset,this._createControls()}createTab(t,e){for(let s=0;s<this.tabs.length;s++)if(this.tabs[s].contentItem===t)return;const n=new Gd(this,t);if(this.tabs.length===0){this.tabs.push(n),this.tabsContainer.append(n.element);return}e===void 0&&(e=this.tabs.length),e>0?this.tabs[e-1].element.after(n.element):this.tabs[0].element.before(n.element),this.tabs.splice(e,0,n),this._updateTabSizes()}removeTab(t){for(var e=0;e<this.tabs.length;e++)if(this.tabs[e].contentItem===t){this.tabs[e]._$destroy(),this.tabs.splice(e,1);return}throw new Error("contentItem is not controlled by this header")}setActiveContentItem(t){var s,i;for(var e,n=0;n<this.tabs.length;n++)e=this.tabs[n].contentItem===t,this.tabs[n].setActive(e),e===!0&&(this.activeContentItem=t,this.parent.config.activeItemIndex=n);(i=this.tabs[(s=this.parent.config.activeItemIndex)!=null?s:0].element.get(0))==null||i.scrollIntoView({inline:"nearest"}),this._hideAdditionalTabsDropdown(),this._updateTabSizes(),this.parent.emitBubblingEvent("stateChanged")}position(t){let e=this.parent._header.show;return e&&!this.parent._side&&(e="top"),t!==void 0&&this.parent._header.show!==t&&(this.parent._header.show=t,this.parent._setupHeaderPosition()),e}_attachWheelListener(){var t;(t=this.tabsContainer.get(0))==null||t.addEventListener("wheel",this._handleWheelEvent,{passive:!0})}_detachWheelListener(){var t;(t=this.tabsContainer.get(0))==null||t.removeEventListener("wheel",this._handleWheelEvent)}_handleWheelEvent(t){var s;const e=t.currentTarget;if(!(e instanceof HTMLElement))return;let n=Math.abs(t.deltaY)>Math.abs(t.deltaX)?t.deltaY:t.deltaX;t.deltaMode===WheelEvent.DOM_DELTA_PAGE?n*=(s=this.tabsContainer.innerWidth())!=null?s:1:t.deltaMode===WheelEvent.DOM_DELTA_LINE&&(n*=100/3),e.scrollLeft+=Math.round(n)}_handleScrollEvent(){this._checkScrollArrows()}_handleItemPickedUp(){this.isDraggingTab=!0,this.controlsContainer.on("mouseenter",this._handleNextMouseEnter),this.tabPreviousButton.on("mouseenter",this._handlePreviousMouseEnter)}_handleItemDropped(){var t;this.isDraggingTab=!1,window.cancelAnimationFrame((t=this.rAF)!=null?t:-1),this.rAF=null,this.controlsContainer.off("mouseenter",this._handleNextMouseEnter),this.controlsContainer.off("mouseleave",this._handleNextMouseLeave),this.tabPreviousButton.off("mouseenter",this._handlePreviousMouseEnter),this.tabPreviousButton.off("mouseleave",this._handlePreviousMouseLeave)}_handleNextMouseEnter(){var t;this.controlsContainer.on("mouseleave",this._handleNextMouseLeave),this._handleScrollRepeat(this.SCROLL_RIGHT,(t=this.tabsContainer.scrollLeft())!=null?t:0)}_handlePreviousMouseEnter(){var t;this.tabPreviousButton.on("mouseleave",this._handlePreviousMouseLeave),this._handleScrollRepeat(this.SCROLL_LEFT,(t=this.tabsContainer.scrollLeft())!=null?t:0)}_handleNextMouseLeave(){var t;window.cancelAnimationFrame((t=this.rAF)!=null?t:-1),this.rAF=null,this.controlsContainer.off("mouseleave",this._handleNextMouseLeave)}_handlePreviousMouseLeave(){var t;window.cancelAnimationFrame((t=this.rAF)!=null?t:-1),this.rAF=null,this.tabPreviousButton.off("mouseleave",this._handlePreviousMouseLeave)}_handleNextButtonMouseDown(){var e,n,s,i,o,r,l;var t;for(let a=0;a<this.tabs.length;a+=1)if(((n=(e=this.tabs[a].element.get(0))==null?void 0:e.offsetLeft)!=null?n:0)>((i=(s=this.tabsContainer.get(0))==null?void 0:s.offsetWidth)!=null?i:0)+((o=this.tabsContainer.scrollLeft())!=null?o:0)){t=this.tabs[a].element.get(0);break}if(t)t.scrollIntoView({behavior:"smooth",inline:"nearest"}),this._handleScrollButtonMouseDown(this.SCROLL_RIGHT);else{const a=this.tabsContainer.get(0);a&&(a.scrollLeft=(l=(r=this.tabsContainer.get(0))==null?void 0:r.scrollWidth)!=null?l:0)}}_handlePreviousButtonMouseDown(){var n,s,i;for(var t,e=this.tabs.length-1;e>=0;e-=1)if(((s=(n=this.tabs[e].element.get(0))==null?void 0:n.offsetLeft)!=null?s:0)<((i=this.tabsContainer.scrollLeft())!=null?i:0)){t=this.tabs[e].element.get(0);break}if(t)t.scrollIntoView({behavior:"smooth",inline:"start"}),this._handleScrollButtonMouseDown(this.SCROLL_LEFT);else{const o=this.tabsContainer.get(0);o&&(o.scrollLeft=0)}}_handleScrollButtonMouseDown(t){this.holdTimer=window.setTimeout(()=>{var e;this._handleScrollRepeat(t,(e=this.tabsContainer.scrollLeft())!=null?e:0,100)},this.CLICK_TIMEOUT),window.addEventListener("mouseup",this._handleScrollButtonMouseUp)}_handleScrollButtonMouseUp(){var t,e;clearTimeout((t=this.holdTimer)!=null?t:-1),this.holdTimer=null,cancelAnimationFrame((e=this.rAF)!=null?e:-1),this.rAF=null,window.removeEventListener("mouseup",this._handleScrollButtonMouseUp)}_checkScrollArrows(){var t,e,n;this.tabsContainer.scrollLeft()===0?this.tabPreviousButton.first().prop("disabled",!0):((t=this.tabsContainer.scrollLeft())!=null?t:0)+((e=this.tabsContainer.innerWidth())!=null?e:0)===((n=this.tabsContainer.get(0))==null?void 0:n.scrollWidth)?this.tabNextButton.prop("disabled",!0):(this.tabNextButton.prop("disabled",!1),this.tabPreviousButton.first().prop("disabled",!1))}_handleScrollRepeat(t,e,n=0,s){var r,l,a;const i=this.tabsContainer.get(0);if(!i)return;const o=i.getBoundingClientRect();if(t===this.SCROLL_LEFT){if(this.tabsContainer.scrollLeft(e-n),this.isDraggingTab&&this.parent._highlightHeaderDropZone(o.left-1),this.tabsContainer.scrollLeft()===0){this._checkScrollArrows();return}}else if(t===this.SCROLL_RIGHT&&(this.tabsContainer.scrollLeft(e+n),this.isDraggingTab&&this.parent._highlightHeaderDropZone(o.right+1),((r=this.tabsContainer.scrollLeft())!=null?r:0)+((l=this.tabsContainer.innerWidth())!=null?l:0)===i.scrollWidth)){this._checkScrollArrows();return}window.cancelAnimationFrame((a=this.rAF)!=null?a:-1),this.rAF=window.requestAnimationFrame(d=>{var p,g;var c=s||d,u=d-c,m=this.START_SPEED*u+.5*this.ACCELERATION*(u*u);m=Math.min(m,(g=(p=this.tabsContainer.get(0))==null?void 0:p.scrollWidth)!=null?g:1/0),this._handleScrollRepeat(t,e,m,c)})}_$setClosable(t){return this.closeButton&&this._isClosable()?(this.closeButton.element[t?"show":"hide"](),!0):!1}_$destroy(){this.emit("destroy",this);for(var t=0;t<this.tabs.length;t++)this.tabs[t]._$destroy();this._detachWheelListener(),this._handleItemDropped(),fe(document).off("mouseup",this._hideAdditionalTabsDropdown),this.tabDropdownSearch.off("input",this._handleFilterInput),this.tabDropdownSearch.off("keydown",this._handleFilterKeydown),this.element.remove()}_getHeaderSetting(t){if(t in this.parent._header)return this.parent._header[t]}_createControls(){var t,e,n,s,i;if(i=this.layoutManager.config.labels.tabDropdown,this.layoutManager.config.labels.tabNextLabel,this.layoutManager.config.labels.tabPreviousLabel,this.tabDropdownButton=new Vo(this,i,"lm_tabdropdown",this._showAdditionalTabsDropdown),this.tabDropdownButton.element.hide(),this.controlsContainer.prepend(this.tabNextButton),this.tabNextButton.hide(),this._getHeaderSetting("popout")&&(e=this._onPopoutClick.bind(this),n=this._getHeaderSetting("popout"),new Vo(this,n,"lm_popout",e)),this._getHeaderSetting("maximise")){s=this.parent.toggleMaximise.bind(this.parent);const o=this._getHeaderSetting("maximise"),r=this._getHeaderSetting("minimise"),l=new Vo(this,o,"lm_maximise",s);this.parent.on("maximised",function(){l.element.attr("title",r!=null?r:"")}),this.parent.on("minimised",function(){l.element.attr("title",o!=null?o:"")})}this._isClosable()&&(t=this.parent.remove.bind(this.parent),n=this._getHeaderSetting("close"),this.closeButton=new Vo(this,n,"lm_close",t))}_showAdditionalTabsDropdown(){if(this.isDropdownShown){this._hideAdditionalTabsDropdown();return}this.tabDropdownList=this.tabsContainer.clone(!0).appendTo(this.tabDropdownContainer).children().removeClass("lm_active"),this.tabDropdownContainer.show(),this.isDropdownShown=!0,this.element.addClass("lm_dropdown_open"),this.tabDropdownSearch.val("").focus(),this.dropdownKeyIndex=0,this.tabDropdownList.eq(this.dropdownKeyIndex).addClass("lm_keyboard_active"),fe(document).on("mousedown",this._hideAdditionalTabsDropdown),this._updateAdditionalTabsDropdown()}_handleFilterKeydown(t){var n,s,i,o;if(this.dropdownKeyIndex===-1)return;if(t.key==="Escape"){this._hideAdditionalTabsDropdown();return}if(t.key==="Enter"||t.key===" "){this._hideAdditionalTabsDropdown(),this.tabs[this.dropdownKeyIndex]._onTabClick();return}function e(r,l,a){if(a==null||a.length<2)return-1;for(var d=(r+l+a.length)%a.length;d!==r;){if(a.eq(d).css("display")!=="none")return d;d=(d+l+a.length)%a.length}return r}t.key==="ArrowDown"||t.key==="Tab"&&t.shiftKey===!1?(t.preventDefault(),(n=this.tabDropdownList)==null||n.eq(this.dropdownKeyIndex).removeClass("lm_keyboard_active"),this.dropdownKeyIndex=e(this.dropdownKeyIndex,1,this.tabDropdownList),(s=this.tabDropdownList)==null||s.eq(this.dropdownKeyIndex).addClass("lm_keyboard_active")):(t.key==="ArrowUp"||t.key==="Tab")&&(t.preventDefault(),(i=this.tabDropdownList)==null||i.eq(this.dropdownKeyIndex).removeClass("lm_keyboard_active"),this.dropdownKeyIndex=e(this.dropdownKeyIndex,-1,this.tabDropdownList),(o=this.tabDropdownList)==null||o.eq(this.dropdownKeyIndex).addClass("lm_keyboard_active"))}_handleFilterInput(t){var n,s;if(this.tabDropdownList!=null){this.tabDropdownList.eq(this.dropdownKeyIndex).removeClass("lm_keyboard_active"),this.dropdownKeyIndex=-1;for(var e=0;e<this.tabDropdownList.length;e++)((s=(n=this.tabs[e].contentItem.config.title)==null?void 0:n.toLowerCase().indexOf(t.target.value.toLowerCase()))!=null?s:-1)!==-1?(this.tabDropdownList.eq(e).css("display",""),this.dropdownKeyIndex===-1&&(this.dropdownKeyIndex=e)):this.tabDropdownList.eq(e).css("display","none");this.dropdownKeyIndex!==-1&&this.tabDropdownList.eq(this.dropdownKeyIndex).addClass("lm_keyboard_active")}}_hideAdditionalTabsDropdown(t){var e,n;!this.isDropdownShown||t&&((e=this.tabDropdownContainer.get(0))==null?void 0:e.contains(t.target))||t&&((n=this.tabDropdownButton)==null?void 0:n.element.get(0))===t.target||(this.element.removeClass("lm_dropdown_open"),this.tabDropdownContainer.hide(),this.isDropdownShown=!1,this.tabDropdownContainer.find(".lm_tabs").remove(),fe(document).off("mousedown",this._hideAdditionalTabsDropdown))}_updateAdditionalTabsDropdown(){var n,s,i,o,r;this.tabDropdownContainer.css("max-height","");const t=this.tabDropdownContainer[0].scrollHeight;if(t===0)return;const e=((s=(n=this.tabDropdownContainer.offset())==null?void 0:n.top)!=null?s:0)-((i=fe(window).scrollTop())!=null?i:0);e+t>((o=fe(window).height())!=null?o:0)&&this.tabDropdownContainer.css("max-height",((r=fe(window).height())!=null?r:0)-e-10)}_isClosable(){return Boolean(this.parent.config.isClosable&&this.layoutManager.config.settings.showCloseIcon)}_onPopoutClick(){var t;this.layoutManager.config.settings.popoutWholeStack===!0?this.parent.popout():(t=this.activeContentItem)==null||t.popout()}_onHeaderClick(t){t.target===this.element[0]&&this.parent.select()}_updateTabSizes(){var e,n;if(this.tabs.length===0)return;const t=this.tabsContainer.get(0);!t||(!this.isOverflowing&&t.scrollWidth>t.clientWidth?((e=this.tabDropdownButton)==null||e.element.show(),this.tabNextButton.show(),this.tabPreviousButton.show(),this.isOverflowing=!0):this.isOverflowing&&t.scrollWidth<=t.clientWidth&&((n=this.tabDropdownButton)==null||n.element.hide(),this.tabNextButton.hide(),this.tabPreviousButton.hide(),this.isOverflowing=!1),this.isOverflowing&&this._checkScrollArrows())}};let ar=nl;ar._template=['<div class="lm_header">','<ul class="lm_tabs"></ul>','<ul class="lm_controls"></ul>','<ul class="lm_tabdropdown_list">','<li class="lm_tabdropdown_search"><input type="text" placeholder="Find tab..."></li>',"</ul>","</div>"].join("");ar._previousButtonTemplate=['<ul class="lm_controls">','<li class="lm_tabpreviousbutton"></li>',"</ul>"].join("");ar._nextButtonTemplate=['<li class="lm_tabnextbutton"></li>'].join("");class mp{constructor(e,n,s){this._isVertical=e,this._size=n,this._grabSize=s<n?n:s,this.element=this._createElement(),this._dragListener=new rr(this.element)}on(e,n,s){var i;(i=this._dragListener)==null||i.on(e,n,s)}_$destroy(){var e;(e=this._dragListener)==null||e.destroy(),this._dragListener=null,this.element.remove()}_createElement(){var e=fe('<div class="lm_drag_handle"></div>'),n=fe('<div class="lm_splitter"></div>');n.append(e);var s=this._grabSize-this._size,i=s/2;return this._isVertical?(e.css("top",-i),e.css("height",this._size+s),n.addClass("lm_vertical"),n.height(this._size)):(e.css("left",-i),e.css("width",this._size+s),n.addClass("lm_horizontal"),n.width(this._size)),n}}class pp{constructor(){this._element=fe('<div class="lm_transition_indicator"></div>'),this._toElement=null,this._fromDimensions={},this._totalAnimationDuration=200,this._animationStartTime=null,fe(document.body).append(this._element)}destroy(){this._element.remove()}transitionElements(e,n){}_nextAnimationFrame(){var o,r,l;if(!this._toElement||this._animationStartTime==null)return;const e=this._measure(this._toElement),n=(Date.now()-this._animationStartTime)/this._totalAnimationDuration,s={};if(n>=1){this._element.hide();return}e.opacity=0;const i=Object.keys(this._fromDimensions);for(let a of i)s[a]=((o=this._fromDimensions[a])!=null?o:0)+(((r=e[a])!=null?r:0)-((l=this._fromDimensions[a])!=null?l:0))*n;this._element.css(s),Zl(this._nextAnimationFrame.bind(this))}_measure(e){const n=e.offset();return{left:n==null?void 0:n.left,top:n==null?void 0:n.top,width:e.outerWidth(),height:e.outerHeight()}}}const dw=Object.freeze(Object.defineProperty({__proto__:null,BrowserPopout:op,DragProxy:lr,DragSource:lp,DragSourceFromEvent:ap,DropTargetIndicator:Wd,Header:ar,HeaderButton:Vo,Splitter:mp,Tab:Gd,TransitionIndicator:pp},Symbol.toStringTag,{value:"Module"})),cw={config:J0,container:ew,controls:dw,errors:lw,items:aw,utils:rw};class Kd extends Tn{constructor(e,n){super(),this.isInitialised=!1,this._isFullPage=!1,this._components={"lm-react-component":sp},this._itemAreas=[],this._maximisedItem=null,this._maximisePlaceholder=fe('<div class="lm_maximise_place"></div>'),this._creationTimeoutPassed=!1,this._subWindowsCreated=!1,this._dragSources=[],this._updatingColumnsResponsive=!1,this._firstLoad=!0,this.width=null,this.height=null,this.openPopouts=[],this.selectedItem=null,this.isSubWindow=!1,this.eventHub=new ip(this),this.dropTargetIndicator=null,this.transitionIndicator=null,this.tabDropPlaceholder=fe('<div class="lm_drop_tab_placeholder"></div>'),this._onResize=this._onResize.bind(this),this._onUnload=this._onUnload.bind(this),this._windowBlur=this._windowBlur.bind(this),this._windowFocus=this._windowFocus.bind(this),this.config=this._createConfig(e),this._originalContainer=n,this.container=this._getContainer(),this.isSubWindow&&fe("body").css("visibility","hidden"),this._typeToItem={column:wl.bind(this,!0),row:wl.bind(this,!1),stack:ed,component:hp}}static minifyConfig(e){return $d(e)}static unminifyConfig(e){return Za(e)}registerComponent(e,n){if(typeof n!="function"&&(n==null||n.render==null||typeof n.render!="function"))throw new Error("Please register a constructor function");if(this._components[e]!==void 0)throw new Error("Component "+e+" is already registered");return this._components[e]=n,()=>{if(this._components[e]===void 0)throw new Error("Component "+e+" is not registered");delete this._components[e]}}setFallbackComponent(e){this._fallbackComponent=e}toConfig(e){if(this.isInitialised===!1)throw new Error("Can't create config, layout not yet initialised");if(e&&!(e instanceof yt))throw new Error("Root must be a ContentItem");const n={settings:{...this.config.settings},dimensions:{...this.config.dimensions},labels:{...this.config.labels},content:[]},s=function(i,o){for(let r in o.config)r!=="content"&&(i[r]=o.config[r]);if(i.componentName==="lm-react-component"&&(i.type="react-component"),o.contentItems.length){i.content=[];for(let r=0;r<o.contentItems.length;r++)i.content[r]={},s(i.content[r],o.contentItems[r])}};e?s(n,{contentItems:[e]}):s(n,this.root),this._$reconcilePopoutWindows(),n.openPopouts=[];for(let i=0;i<this.openPopouts.length;i++)n.openPopouts.push(this.openPopouts[i].toConfig());return n.maximisedItemId=this._maximisedItem?"__glMaximised":void 0,n}getComponent(e){return this._components[e]}getFallbackComponent(){return this._fallbackComponent}init(){if(this._subWindowsCreated===!1&&(this._createSubWindows(),this._subWindowsCreated=!0),document.readyState==="loading"||document.body===null){fe(document).ready(this.init.bind(this));return}if(this.isSubWindow===!0&&this._creationTimeoutPassed===!1){setTimeout(this.init.bind(this),7),this._creationTimeoutPassed=!0;return}this.isSubWindow===!0&&this._adjustToWindowMode(),this._setContainer(),this.dropTargetIndicator=new Wd,this.transitionIndicator=new pp,this.updateSize(),this._create(this.config),this._bindEvents(),this.isInitialised=!0,this._adjustColumnsResponsive(),this.emit("initialised")}updateSize(e,n){var s,i,o,r;this.width=(s=e!=null?e:this.container.width())!=null?s:0,this.height=(i=n!=null?n:this.container.height())!=null?i:0,this.isInitialised===!0&&(this.root.callDownwards("setSize",[this.width,this.height]),this._maximisedItem&&(this._maximisedItem.element.width((o=this.container.width())!=null?o:0),this._maximisedItem.element.height((r=this.container.height())!=null?r:0),this._maximisedItem.callDownwards("setSize")),this._adjustColumnsResponsive())}destroy(){var e,n;this.isInitialised===!1||!this.root||(this._onUnload(),fe(window).off("resize",this._onResize),fe(window).off("unload beforeunload",this._onUnload),fe(window).off("blur.lm").off("focus.lm"),this.root.callDownwards("_$destroy",[],!0),this.root.contentItems=[],this.tabDropPlaceholder.remove(),(e=this.dropTargetIndicator)==null||e.destroy(),(n=this.transitionIndicator)==null||n.destroy(),this.eventHub.destroy(),this._dragSources.forEach(function(s){s._dragListener.destroy()}),this._dragSources=[])}createContentItem(e,n){var s,i;if(typeof e.type!="string")throw new mi("Missing parameter 'type'",e);if(e.type==="react-component"&&(e.type="component",e.componentName="lm-react-component"),!this._typeToItem[e.type])throw s="Unknown type '"+e.type+"'. Valid types are "+Object.keys(this._typeToItem).join(","),new mi(s);return e.type==="component"&&!(n instanceof ed)&&!!n&&!(this.isSubWindow===!0&&n instanceof Ja)&&(e={type:"stack",width:e.width,height:e.height,content:[e]}),i=new this._typeToItem[e.type](this,e,n),i}createPopout(e,n,s,i){var d,c,u;let o=[];const r=e instanceof yt,l=this;if(r){o=this.toConfig(e).content,s=Ud();let m=e.parent,p=e;for(;(m==null?void 0:m.contentItems.length)===1&&!m.isRoot;)p=m,m=m.parent;m==null||m.addId(s),(i==null||Number.isNaN(i))&&(i=m==null?void 0:m.contentItems.indexOf(p))}else e instanceof Array?o=e:o=[e];if(!n&&r){const m=window.screenX||window.screenLeft,p=window.screenY||window.screenTop,g=(d=e.element.offset())!=null?d:{left:0,top:0};n={left:m+g.left,top:p+g.top,width:(c=e.element.width())!=null?c:0,height:(u=e.element.height())!=null?u:0}}if(!n&&!r&&(n={left:window.screenX||window.screenLeft+20,top:window.screenY||window.screenTop+20,width:500,height:309}),r&&e.remove(),!n||!s||i===void 0)return;const a=new op(o,n,s,i,this);return a.on("initialised",function(){l.emit("windowOpened",a)}),a.on("closed",function(){l._$reconcilePopoutWindows()}),this.openPopouts.push(a),a}createDragSource(e,n){this.config.settings.constrainDragToContainer=!1;var s=new lp(e,n,this);return this._dragSources.push(s),s}createDragSourceFromEvent(e,n){return this.config.settings.constrainDragToContainer=!1,new ap(e,this,n)}selectItem(e,n){if(this.config.settings.selectionEnabled!==!0)throw new Error("Please set selectionEnabled to true to use this feature");e!==this.selectedItem&&(this.selectedItem!==null&&this.selectedItem.deselect(),e&&n!==!0&&e.select(),this.selectedItem=e,this.emit("selectionChanged",e))}_$maximiseItem(e){var n,s;this._maximisedItem!==null&&this._$minimiseItem(this._maximisedItem),this._maximisedItem=e,this._maximisedItem.addId("__glMaximised"),e.element.addClass("lm_maximised"),e.element.after(this._maximisePlaceholder),this.root.element.prepend(e.element),e.element.width((n=this.container.width())!=null?n:0),e.element.height((s=this.container.height())!=null?s:0),e.callDownwards("setSize"),this._maximisedItem.emit("maximised"),this.emit("stateChanged")}_$minimiseItem(e){var n;e.element.removeClass("lm_maximised"),e.removeId("__glMaximised"),this._maximisePlaceholder.after(e.element),this._maximisePlaceholder.remove(),(n=e.parent)==null||n.callDownwards("setSize"),this._maximisedItem=null,e.emit("minimised"),this.emit("stateChanged")}_$closeWindow(){window.setTimeout(function(){window.close()},1)}_$getArea(e,n){let s=1/0,i=null;for(let o=0;o<this._itemAreas.length;o++){const r=this._itemAreas[o];e>r.x1&&e<r.x2&&n>r.y1&&n<r.y2&&s>r.surface&&(s=r.surface,i=r)}return i}_$createRootItemAreas(){const n={...this.root._$getArea()},s=[{...n,side:"left",x2:n.x1+50},{...n,side:"right",x1:n.x2-50},{...n,side:"top",y2:n.y1+50},{...n,side:"bottom",y1:n.y2-50}];s.forEach(i=>{i.surface=(i.x2-i.x1)*(i.y2-i.y1)}),this._itemAreas.push(...s)}_$calculateItemAreas(){var n;const e=this._getAllContentItems();if(this._itemAreas=[],e.length===1){this._itemAreas.push(this.root._$getArea());return}this._$createRootItemAreas();for(let s=0;s<e.length;s++){const i=e[s];if(!Zo(i))continue;const o=i._$getArea();if(o!==null)if(o instanceof Array)this._itemAreas=this._itemAreas.concat(o);else{this._itemAreas.push(o);let r={...o,...(n=o.contentItem._contentAreaDimensions)==null?void 0:n.header.highlightArea};r.surface=(r.x2-r.x1)*(r.y2-r.y1),this._itemAreas.push(r)}}}_$normalizeContentItem(e,n){if(!e)throw new Error("No content item defined");if(typeof e=="function"&&(e=e()),e instanceof yt)return e;if(fe.isPlainObject(e)&&e.type){var s=this.createContentItem(e,n);return s.callDownwards("_$init"),s}else throw new Error("Invalid contentItem")}_$reconcilePopoutWindows(){var n;const e=[];for(let s=0;s<this.openPopouts.length;s++)((n=this.openPopouts[s].getWindow())==null?void 0:n.closed)===!1?e.push(this.openPopouts[s]):this.emit("windowClosed",this.openPopouts[s]);this.openPopouts.length!==e.length&&(this.emit("stateChanged"),this.openPopouts=e)}_getAllContentItems(){const e=[],n=s=>{if(e.push(s),s.contentItems instanceof Array)for(let i=0;i<s.contentItems.length;i++)n(s.contentItems[i])};return n(this.root),e}_bindEvents(){this._isFullPage&&fe(window).resize(this._onResize),fe(window).on("unload beforeunload",this._onUnload).on("blur.lm",this._windowBlur).on("focus.lm",this._windowFocus)}_windowBlur(){this.root.element.addClass("lm_window_blur")}_windowFocus(){this.root.element.removeClass("lm_window_blur")}_onResize(){clearTimeout(this._resizeTimeoutId),this._resizeTimeoutId=window.setTimeout(this.updateSize.bind(this),100)}_createConfig(e){var i;var n=np("gl-window");n&&(this.isSubWindow=!0,e=JSON.parse(localStorage.getItem(n)||"{}"),e=Za(e),localStorage.removeItem(n)),e=fe.extend(!0,{},Qm,e);var s=function(o){for(var r in o){const l=o[r];r!=="props"&&typeof l=="object"&&l!=null?s(l):r==="type"&&l==="react-component"&&(o.type="component",o.componentName="lm-react-component")}};return s(e),((i=e.settings)==null?void 0:i.hasHeaders)===!1&&(e.dimensions.headerHeight=0),e}_adjustToWindowMode(){var n;var e=fe('<div class="lm_popin" title="'+this.config.labels.popin+'"><div class="lm_icon"></div><div class="lm_bg"></div></div>');e.click(()=>{this.emit("popIn")}),document.title=Bd((n=this.config.content[0].title)!=null?n:""),fe("head").append(fe("body link, body style, template, .gl_keep")),this.container=fe("body").html("").css("visibility","visible").append(e),document.body.offsetHeight,window.__glInstance=this}_createSubWindows(){if(!!this.config.openPopouts)for(let e=0;e<this.config.openPopouts.length;e++){const n=this.config.openPopouts[e];this.createPopout(n.content,n.dimensions,n.parentId,n.indexInParent)}}_getContainer(){const e=this._originalContainer?fe(this._originalContainer):fe("body");if(e.length===0)throw new Error("GoldenLayout container not found");if(e.length>1)throw new Error("GoldenLayout more than one container element specified");return e}_setContainer(){const e=this._getContainer();e[0]===document.body&&(this._isFullPage=!0,fe("html, body").css({height:"100%",margin:0,padding:0,overflow:"hidden"})),this.container=e}_create(e){var n;if(!(e.content instanceof Array))throw e.content===void 0?n="Missing setting 'content' on top level of configuration":n="Configuration parameter 'content' must be an array",new mi(n,e);if(e.content.length>1)throw n="Top level content can't contain more then one element.",new mi(n,e);this.root=new Ja(this,{content:e.content},this.container),this.root.callDownwards("_$init"),e.maximisedItemId==="__glMaximised"&&this.root.getItemsById(e.maximisedItemId)[0].toggleMaximise()}_onUnload(){if(this.config.settings.closePopoutsOnUnload===!0)for(var e=0;e<this.openPopouts.length;e++)this.openPopouts[e].close()}_adjustColumnsResponsive(){if(!this._useResponsiveLayout()||this._updatingColumnsResponsive||!this.config.dimensions||!this.config.dimensions.minItemWidth||this.root.contentItems.length===0||!this.root.contentItems[0].isRow){this._firstLoad=!1;return}this._firstLoad=!1;var e=this.root.contentItems[0].contentItems.length;if(!(e<=1)){var n=this.config.dimensions.minItemWidth,s=e*n;if(!(this.width==null||s<=this.width)){this._updatingColumnsResponsive=!0;for(var i=Math.max(Math.floor(this.width/n),1),o=e-i,r=this.root.contentItems[0],l=this._findAllStackContainers()[0],a=0;a<o;a++){var d=r.contentItems[r.contentItems.length-1];this._addChildContentItemsToContainer(l,d)}this._updatingColumnsResponsive=!1}}}_useResponsiveLayout(){return this.config.settings&&(this.config.settings.responsiveMode=="always"||this.config.settings.responsiveMode=="onload"&&this._firstLoad)}_addChildContentItemsToContainer(e,n){n.type==="stack"?n.contentItems.forEach(function(s){e.addChild(s),n.removeChild(s,!0)}):n.contentItems.forEach(s=>{this._addChildContentItemsToContainer(e,s)})}_findAllStackContainers(){const e=[];return this._findAllStackContainersRecursive(e,this.root),e}_findAllStackContainersRecursive(e,n){n.contentItems.forEach(s=>{Zo(s)?e.push(s):s.isComponent||this._findAllStackContainersRecursive(e,s)})}}Kd.__lm=cw;const hw="_lm_root_15d73_3",uw="_lm_row_15d73_7",mw="_lm_item_15d73_7",pw="_lm_content_15d73_11",gw="_lm_dragging_15d73_17",fw="_lm_maximised_15d73_23",Cw="_lm_maximise_placeholder_15d73_30",bw="_lm_splitter_15d73_34",Sw="_lm_vertical_15d73_41",ww="_lm_drag_handle_15d73_41",vw="_lm_horizontal_15d73_46",Tw="_lm_header_15d73_56",Ew="_lm_dropdown_open_15d73_63",yw="_lm_controls_15d73_69",Iw="_lm_tabs_15d73_89",Rw="_lm_tab_15d73_89",Dw="_lm_title_15d73_104",Mw="_lm_close_tab_15d73_111",Nw="_lm_stack_15d73_120",Fw="_lm_left_15d73_120",xw="_lm_right_15d73_121",_w="_lm_dragProxy_15d73_125",kw="_lm_items_15d73_148",Ow="_lm_tabdropdown_list_15d73_165",Lw="_lm_bottom_15d73_192",Aw="_lm_drop_tab_placeholder_15d73_207",Pw="_lm_tabdropdown_15d73_165",Hw="_lm_dropTargetIndicator_15d73_258",Vw="_lm_inner_15d73_264",Uw="_lm_transition_indicator_15d73_272",Bw="_lm_popin_15d73_282",$w="_lm_bg_15d73_297",zw="_lm_icon_15d73_300",Ww="_lm_goldenlayout_15d73_304",Gw="_lm_selectable_15d73_340",Kw="_lm_active_15d73_370",qw="_lm_selected_15d73_388",Yw="_lm_keyboard_active_15d73_397",Xw="_lm_popout_15d73_416",jw="_lm_maximise_15d73_23",Zw="_lm_close_15d73_111",Qw="_lm_tabnextbutton_15d73_425",Jw="_lm_tabpreviousbutton_15d73_428",ev="_lm_title_before_15d73_544",tv="_lm_focusin_15d73_568",nv="_lm_window_blur_15d73_573",sv="_lm_tabdropdown_search_15d73_631",iv="_march_15d73_1",ov="_app_15d73_712",rv="_plotly_15d73_721",yh={"tab-height":"28px","drag-border-width":"5px",lm_root:hw,lm_row:uw,lm_item:mw,lm_content:pw,lm_dragging:gw,lm_maximised:fw,lm_maximise_placeholder:Cw,lm_splitter:bw,lm_vertical:Sw,lm_drag_handle:ww,lm_horizontal:vw,lm_header:Tw,lm_dropdown_open:Ew,lm_controls:yw,lm_tabs:Iw,lm_tab:Rw,lm_title:Dw,lm_close_tab:Mw,lm_stack:Nw,lm_left:Fw,lm_right:xw,lm_dragProxy:_w,lm_items:kw,lm_tabdropdown_list:Ow,lm_bottom:Lw,lm_drop_tab_placeholder:Aw,lm_tabdropdown:Pw,lm_dropTargetIndicator:Hw,lm_inner:Vw,lm_transition_indicator:Uw,lm_popin:Bw,lm_bg:$w,lm_icon:zw,lm_goldenlayout:Ww,lm_selectable:Gw,lm_active:Kw,lm_selected:qw,lm_keyboard_active:Yw,lm_popout:Xw,lm_maximise:jw,lm_close:Zw,lm_tabnextbutton:Qw,lm_tabpreviousbutton:Jw,lm_title_before:ev,"editor-unsaved-indicator":"_editor-unsaved-indicator_15d73_548","is-unsaved":"_is-unsaved_15d73_556",lm_focusin:tv,lm_window_blur:nv,lm_tabdropdown_search:sv,march:iv,app:ov,"js-plotly-plot":"_js-plotly-plot_15d73_721",plotly:rv},Ih=Object.freeze({tabHeight:parseInt(yh["tab-height"],10),dragBorderWidth:parseInt(yh["drag-border-width"],10)}),Fs=Z.module("LayoutUtils");function gp(t){return t.componentName!==void 0}function zi(t){const e=t;return(gp(t)&&t.componentName==="lm-react-component"||t.type==="react-component")&&e.component!==void 0}function Pr(t){return t.focus!==void 0}function Rh(t){return t.type==="stack"}const $e=class{static activateTab(t,e){const n=$e.getStackForRoot(t,e,!1);if(!n){Fs.error("Could not find stack for config",e);return}const s=$e.getContentItemInStack(n,e);s&&n.setActiveContentItem(s)}static isActiveTab(t,e){const n=$e.getStackForRoot(t,e,!1);if(!n)return Fs.error("Could not find stack for config",e),!1;const s=$e.getContentItemInStack(n,e);return n.getActiveContentItem()===s}static addStack(t,e=!0){const n=e?"column":"row";if(cp(t)){(t.contentItems==null||t.contentItems.length===0)&&t.addChild({type:n});const o=t.contentItems[0];if(!(e?o.isColumn:o.isRow)){t.removeChild(o,!0),t.addChild({type:n});const l=document.activeElement;t.contentItems[0].addChild(o),l&&l.focus!=null&&l.focus()}return this.addStack(t.contentItems[0],e)}if(t.contentItems.length<2)return t.addChild({type:"stack"}),t.contentItems[t.contentItems.length-1];let s=t.contentItems[t.contentItems.length-1];return(e?s.isRow:s.isColumn)||(t.addChild({type:e?"row":"column"}),t.removeChild(s,!0),t.contentItems[t.contentItems.length-1].addChild(s),s=t.contentItems[t.contentItems.length-1]),this.addStack(s,!e)}static getStackForConfig(t,e={},n=!1){if(n&&Zo(t)&&t.contentItems.length===0)return t;if(t.contentItems==null)return null;for(let s=0;s<t.contentItems.length;s+=1){const i=t.contentItems[s];if(i.isComponent&&i.config!=null&&Oc(i.config,e))return t;const o=this.getStackForConfig(i,e,n);if(o)return o}return null}static getStackForRoot(t,e,n=!0,s=!0,i=!0){let o=this.getStackForConfig(t,e);return!o&&s&&(o=this.getStackForConfig(t,{component:e.component},i)),!o&&n&&(o=this.addStack(t)),o}static getStackForComponentTypes(t,e,n=!0,s=!0,i=!0){for(let o=0;o<e.length;o+=1){const r=e[o],l=o===e.length-1,a=$e.getStackForRoot(t,{component:r},n&&l,s,i);if(a)return a}return null}static getContentItemInStack(t,e){if(!t)return null;for(let n=0;n<t.contentItems.length;n+=1){const s=t.contentItems[n];if(s.isComponent&&s.config!=null&&Oc(s.config,e))return s}return null}static dehydrateLayoutConfig(t,e){if(t==null||!t.length)return[];const n=[];for(let s=0;s<t.length;s+=1){const i=t[s],{component:o,content:r}=i;if(o){const l=e(o,i);l!=null?n.push(l):Fs.debug2(`dehydrateLayoutConfig: skipping unmapped component "${o}"`)}else if(r){const l={...i,content:$e.dehydrateLayoutConfig(r,e)};n.push(l)}else n.push(i)}return n}static getTabPoint(t){const{tab:e}=t;if(e==null)throw new Error(`Cannot get tab for panel container ${t}`);const n=e.element[0].getBoundingClientRect();return[n.left+n.width*.5,n.bottom-8]}static dropLayoutMinorChange(t){for(let e=0;e<t.length;e+=1){const n=t[e],{content:s}=n;s!==void 0?(Rh(n)&&delete n.activeItemIndex,$e.dropLayoutMinorChange(s)):zi(n)&&n.component==="IrisGridPanel"&&n.props.panelState!=null&&(delete n.id,n.props.panelState.irisGridState.sorts=[],n.props.panelState.irisGridState.quickFilters=[])}}static isEqual(t,e,n=!1){if(n){const s=$e.cloneLayout(t),i=$e.cloneLayout(e);return $e.dropLayoutMinorChange(s),$e.dropLayoutMinorChange(i),ut(s,i)}return ut(t,e)}static cloneLayout(t){return JSON.parse(JSON.stringify(t))}static hydrateLayoutConfig(t,e){var s;if(t==null||!t.length)return[];const n=[];for(let i=0;i<t.length;i+=1){const o=t[i];if(zi(o)){const{component:r,props:l={}}=o;n.push({...o,id:(s=o==null?void 0:o.id)!=null?s:We(),props:e(r,l)})}else if(o.content!==void 0){const r=$e.hydrateLayoutConfig(o.content,e);Rh(o)&&o.activeItemIndex!=null&&o.activeItemIndex>=r.length&&(Fs.warn("Fixing bad activeItemIndex!",o.activeItemIndex,o),o.activeItemIndex=0),n.push({...o,content:r})}else n.push(o)}return n}static openComponent({root:t,config:e,replaceExisting:n=!0,replaceConfig:s=void 0,createNewStack:i=!1,focusElement:o=void 0,dragEvent:r=void 0}={}){const l=document.activeElement,a={...e};if(a.id==null&&(a.id=We.generate()),r){t==null||t.layoutManager.createDragSourceFromEvent(a,r);return}const d=s||{id:a.id,component:a.component};L(t);const c=i?$e.addStack(t):$e.getStackForRoot(t,d);L(c);const u=$e.getContentItemInStack(c,d);if(o!=null){const m=p=>{Fs.debug("Component created, focusing element",o),c.off("componentCreated",m);const{element:g}=p.origin;requestAnimationFrame(()=>{$e.focusElement(g[0],o)})};c.on("componentCreated",m)}if(n&&u){const m=c.contentItems.indexOf(u);c.addChild(a,m+1),c.removeChild(u),c.setActiveContentItem(c.contentItems[m])}else c.addChild(a);o==null&&l&&Pr(l)&&l.focus()}static openComponentInStack(t,e,n=!0){const s=document.activeElement,i={id:e.id},o=$e.getContentItemInStack(t,i);if(n&&o&&t){const r=t==null?void 0:t.contentItems.indexOf(o);t.addChild(e,r+1),t.removeChild(o),t.setActiveContentItem(t.contentItems[r])}else t==null||t.addChild(e);s&&Pr(s)&&s.focus()}static closeComponent(t,e,n){const s=$e.getStackForRoot(t,e,!1,!1,!1);if(!s){Fs.warn("Cannot find stack for component, ignoring close",e);return}const i=$e.getContentItemInStack(s,e),o=document.activeElement;i&&(Sn(i)?i.container.close(n):s.removeChild(i)),o&&document.contains(o)&&Pr(o)&&o.focus()}static renameComponent(t,e,n){const s=$e.getStackForRoot(t,e,!1);if(!s){Fs.error("Could not find stack for config",e);return}const i=$e.getContentItemInStack(s,e);i&&i.setTitle(n)}static cloneComponent(t,e){const n=$e.getStackForRoot(t,e,!1);if(!n)return Fs.error("Could not find stack for config",e),null;const{props:s={}}=e,i=$e.getPanelComponentState(e),o={type:"react-component",component:e.component,props:{...s,panelState:i},title:`${e.title} Copy`,id:We.generate()};return $e.openComponentInStack(n,o),o}static getPanelComponentState(t){var e,n;return gp(t)?(e=t.componentState)==null?void 0:e.panelState:zi(t)?(n=t.props)==null?void 0:n.panelState:null}static makeDefaultLayout(){return{dimensions:{headerHeight:Ih.tabHeight,borderWidth:Ih.dragBorderWidth,borderGrabWidth:10},settings:{showPopoutIcon:!1,showCloseIcon:!1,constrainDragToContainer:!1}}}static getRootFromContainer(t){return t.layoutManager.root}static getComponentConfigFromContainer(t){return t?t.tab!=null&&t.tab.contentItem!=null?t.tab.contentItem.config:t._config:null}static getTitleFromContainer(t){return t!=null&&t.tab!=null&&t.tab.contentItem!=null?t.tab.contentItem.config.title:null}static getTitleFromTab(t){return t!=null&&t.contentItem!=null?t.contentItem.config.title:null}static getIdFromContainer(t){const e=$e.getComponentConfigFromContainer(t);return e?e.id:null}static getIdFromPanel(t){const{glContainer:e}=t.props;return $e.getIdFromContainer(e)}static getComponentNameFromPanel(t){var s;const{glContainer:e}=t.props,n=$e.getComponentConfigFromContainer(e);return n&&zi(n)&&(s=n.component)!=null?s:null}static getComponentName(t){var n,s;const e=(s=(n=t.WrappedComponent)==null?void 0:n.displayName)!=null?s:t.displayName;if(e==null)throw new Error(`Component displayName not defined ${t}`);return e}static focusElement(t,e=$e.DEFAULT_FOCUS_SELECTOR){if(t==null)return null;const n=t.querySelector(e);return n==null?null:(Pr(n)&&n.focus(),n)}static onInitialized(t){return new Promise(e=>{if(t.isInitialised){e();return}const n=()=>{t.off("initialised",n),e()};t.on("initialised",n)})}};let oe=$e;oe.DEFAULT_FOCUS_SELECTOR="input, select, textarea, button";const fp=X.forwardRef((t,e)=>{const n=oe.getComponentNameFromPanel({props:t});return T("div",{ref:e,className:"panel-placeholder",children:['Component "',n,'" is not registered.']})});fp.displayName="PanelPlaceholder";const De=Object.freeze({FOCUS:"PanelEvent.FOCUS",MOUNT:"PanelEvent.MOUNT",UNMOUNT:"PanelEvent.UNMOUNT",TITLE_CHANGED:"PanelEvent.TITLE_CHANGED",REOPEN:"PanelEvent.REOPEN",DELETE:"PanelEvent.DELETE",CLONED:"PanelEvent.CLONED",CLOSED:"PanelEvent.CLOSED",OPEN:"PanelEvent.OPEN",CLOSE:"PanelEvent.CLOSE",DRAGGING:"PanelEvent.DRAGGING",DROPPED:"PanelEvent.DROPPED"});function Dh(t){return(t==null?void 0:t.WrappedComponent)!==void 0}function lv(t){return typeof t.id=="string"&&t.layout instanceof Kd&&t.panelManager instanceof qd&&typeof t.registerComponent=="function"}function qs(t){if(!lv(t))throw new Error(`Expected dashboard plugin props, but instead received ${t}`)}const gn=Z.module("PanelManager");class qd{constructor(e,n=(l,a)=>a,s=(l,a)=>a,i=new Map,o=[],r=()=>{}){this.handleFocus=this.handleFocus.bind(this),this.handleMount=this.handleMount.bind(this),this.handleUnmount=this.handleUnmount.bind(this),this.handleReopen=this.handleReopen.bind(this),this.handleDeleted=this.handleDeleted.bind(this),this.handleClosed=this.handleClosed.bind(this),this.handleControlClose=this.handleControlClose.bind(this),this.layout=e,this.hydrateComponent=n,this.dehydrateComponent=s,this.onPanelsUpdated=r,this.openedMap=new Map(i),this.closed=[...o],this.startListening()}startListening(){const{eventHub:e}=this.layout;e.on(De.FOCUS,this.handleFocus),e.on(De.MOUNT,this.handleMount),e.on(De.UNMOUNT,this.handleUnmount),e.on(De.REOPEN,this.handleReopen),e.on(De.DELETE,this.handleDeleted),e.on(De.CLOSED,this.handleClosed),e.on(De.CLOSE,this.handleControlClose)}stopListening(){const{eventHub:e}=this.layout;e.off(De.FOCUS,this.handleFocus),e.off(De.MOUNT,this.handleMount),e.off(De.UNMOUNT,this.handleUnmount),e.off(De.REOPEN,this.handleReopen),e.off(De.DELETE,this.handleDeleted),e.off(De.CLOSED,this.handleClosed),e.off(De.CLOSE,this.handleControlClose)}getClosedPanelConfigsOfType(e){return this.closed.filter(n=>n.component===e)}getOpenedPanels(){return Array.from(this.openedMap.values())}getOpenedPanelConfigs(){return this.getOpenedPanels().map(e=>{const{glContainer:n}=e.props;return oe.getComponentConfigFromContainer(n)})}getOpenedPanelConfigsOfType(e){return this.getOpenedPanelConfigs().filter(n=>n!=null&&zi(n)&&n.component===e)}getOpenedPanelById(e){return this.openedMap.get(e)}getContainerByPanelId(e){var s;const n=oe.getStackForConfig(this.layout.root,{id:e});return(s=n&&oe.getContentItemInStack(n,{id:e}))!=null?s:null}getLastUsedPanel(e){const n=this.getOpenedPanels();for(let s=n.length-1;s>=0;s-=1){const i=n[s];if(e==null||e(i))return i}}getLastUsedPanelOfType(e){return this.getLastUsedPanelOfTypes([e])}getLastUsedPanelOfTypes(e){return this.getLastUsedPanel(n=>e.some(s=>Dh(s)&&n instanceof s.WrappedComponent||!Dh(s)&&n instanceof s))}updatePanel(e){const n=oe.getIdFromPanel(e);if(n==null){gn.error("updatePanel Panel did not have an ID",e);return}gn.debug2(`Updating panel ID ${n} in open panels map`),this.openedMap.delete(n),this.openedMap.set(n,e)}removePanel(e){const n=oe.getIdFromPanel(e);if(n==null){gn.error("removePanel Panel did not have an ID",e);return}if(!this.openedMap.has(n)){gn.error(`Missing panel ID ${n} in open panels map`);return}if(this.openedMap.get(n)!==e){gn.debug(`Panel argument doesn't match the open panels map entry for ${n}, removePanel ignored`);return}gn.debug2(`Removing panel ID ${n} from open panels map`),this.openedMap.delete(n)}removeClosedPanelConfig(e){const n=this.closed.findIndex(s=>s===e||s.id!=null&&e.id!=null&&s.id===e.id);n>=0&&this.closed.splice(n,1)}handleFocus(e){gn.debug2("Focus: ",e),this.updatePanel(e)}handleMount(e){gn.debug2("Mount: ",e),this.updatePanel(e),this.sendUpdate()}handleUnmount(e){gn.debug2("Unmount: ",e),this.removePanel(e),this.sendUpdate()}handleReopen(e,n){gn.debug2("Reopen:",e,n),this.removeClosedPanelConfig(e);const{component:s}=e;let{props:i}=e;i=this.hydrateComponent(s,i);const o={...e,props:i},{root:r}=this.layout;oe.openComponent({root:r,config:o,replaceConfig:n})}handleDeleted(e){gn.debug2("Deleted:",e),this.removeClosedPanelConfig(e),this.sendUpdate()}handleClosed(e,n){gn.debug2("Closed: ",e),this.addClosedPanel(n),this.sendUpdate()}handleControlClose(e){const n={id:e},{root:s}=this.layout;oe.closeComponent(s,n)}addClosedPanel(e){const n=oe.getComponentConfigFromContainer(e);if(n&&zi(n)){const s=this.dehydrateComponent(n.component,n);s!=null&&this.closed.push(s)}}sendUpdate(){const{closed:e,openedMap:n}=this;this.onPanelsUpdated({closed:[...e],openedMap:new Map(n)})}}qd.MAX_CLOSED_PANEL_COUNT=100;const av=Z.module("PanelErrorBoundary");class dv extends w.exports.Component{constructor(e){super(e),this.state={error:null}}componentDidCatch(e){this.setState({error:e})}componentWillUnmount(){const{glContainer:e,glEventHub:n}=this.props,s=oe.getIdFromContainer(e);av.debug("componentWillUnmount",s),n.emit(De.CLOSED,s,e)}render(){const{children:e}=this.props,{error:n}=this.state;return n!=null?h("div",{className:"panel-error-boundary",children:h(Vl,{errorMessage:`${n}`,isLoading:!1,isLoaded:!1})}):e}}function Yd(t){const{props:e,componentState:n}=t,{metadata:s}=e;let{panelState:i=null}=e;n&&({panelState:i}=n);const o={};return s!=null&&(o.metadata=s),i!=null&&(o.panelState=i),{...t,componentState:null,props:o,type:"react-component"}}function Xd(t,e=""){return{metadata:{},...t,localDashboardId:e}}const td={dehydrate:Yd,hydrate:Xd},cv=D.exports.shape({on:D.exports.func,off:D.exports.func,isHidden:D.exports.bool,tab:D.exports.shape({header:D.exports.shape({tabs:D.exports.arrayOf(D.exports.shape({contentItem:D.exports.shape({})}))})}),title:D.exports.string,setTitle:D.exports.func,close:D.exports.func}),Cp=D.exports.shape({on:D.exports.func,off:D.exports.func,emit:D.exports.func}),hv=D.exports.shape({registerComponent:D.exports.func,root:D.exports.shape({addChild:D.exports.func}),on:D.exports.func,off:D.exports.func,eventHub:Cp}),jd=Object.freeze({Container:cv,EventHub:Cp,Layout:hv}),qe=(t,e,n)=>w.exports.useEffect(function(){return t.on(e,n),()=>{t.off(e,n)}},[t,e,n]),bp="SET_DASHBOARD_DATA",uv=L0(bp,{},!1),mv={dashboardData:uv},pv=new Map,gv=Object.freeze({}),fv=Object.freeze([]),Cv=t=>t.dashboardData,Zt=(t,e)=>{var n;return(n=Cv(t)[e])!=null?n:gv},bv=(t,e)=>{var n;return(n=Zt(t,e).closed)!=null?n:fv},Sp=(t,e)=>{var n;return(n=Zt(t,e).openedMap)!=null?n:pv},wp=(t,e)=>({type:bp,id:t,payload:e}),ts=(t,e)=>(n,s)=>n(wp(t,{...Zt(s(),t),...e}));Object.entries(mv).map(([t,e])=>ho.register(t,e));const Hr=Z.module("DashboardLayout"),Sv=Object.freeze({}),wv=[],Mh=()=>{},Nh=t=>t;function vp({id:t,children:e,emptyDashboard:n=h("div",{children:"Dashboard is empty."}),layout:s,layoutConfig:i=wv,onLayoutChange:o=Mh,onLayoutInitialized:r=Mh,hydrate:l=Xd,dehydrate:a=Yd}){var V,O;const d=bd(),c=(V=Qg($=>Zt($,t)))!=null?V:Sv,[u,m]=w.exports.useState(!1),[p,g]=w.exports.useState(!1),[f,b]=w.exports.useState(),[C]=w.exports.useState((O=c==null?void 0:c.closed)!=null?O:[]),[S,v]=w.exports.useState(!1),y=w.exports.useMemo(()=>new Map,[]),E=w.exports.useMemo(()=>new Map,[]),I=Jg(),R=w.exports.useCallback(($,Y,Q=l,U=a)=>{Hr.debug2("registerComponent",$,Y,Q,U);function q(ce,ne){const he=Y,{glContainer:Ce,glEventHub:Re}=ce;return h(Su,{store:I,children:h(dv,{glContainer:Ce,glEventHub:Re,children:h(he,{...ce,ref:ne})})})}const j=X.forwardRef(q),te=s.registerComponent($,j);return y.set($,Q),E.set($,U),te},[l,a,y,E,s,I]),N=w.exports.useCallback(($,Y)=>{var Q;return((Q=y.get($))!=null?Q:Nh)(Y,t)},[y,t]),F=w.exports.useCallback(($,Y)=>{var Q;return((Q=E.get($))!=null?Q:Nh)(Y,t)},[E,t]),P=w.exports.useMemo(()=>new qd(s,N,F,new Map,C,({closed:$,openedMap:Y})=>{d(ts(t,{closed:$,openedMap:Y}))}),[F,d,N,t,C,s]),H=w.exports.useCallback(()=>{if(p)return;S||(r(),v(!0));const Y=s.toConfig().content,Q=oe.dehydrateLayoutConfig(Y,F),U=f==null||!oe.isEqual(f,Q);Hr.debug("handleLayoutStateChanged",U,Y,Q),U&&(m(s.root.contentItems.length===0),b(Q),o(Q))},[F,S,p,f,s,o,r]),x=w.exports.useCallback($=>{const Y=oe.getIdFromContainer($);s.eventHub.emit(De.DRAGGING,Y),g(!0)},[s.eventHub]),A=w.exports.useCallback($=>{const Y=oe.getIdFromContainer($);s.eventHub.emit(De.DROPPED,Y),g(!1)},[s.eventHub]),k=w.exports.useCallback($=>{if(Hr.debug2("handleComponentCreated",$),$==null||$.config==null||$.config.component==null||$.element==null)return;const Q=`${$.config.component.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}-component`;$.element.addClass(Q)},[]);qe(s,"stateChanged",H),qe(s,"itemPickedUp",x),qe(s,"itemDropped",A),qe(s,"componentCreated",k),qe(s.eventHub,De.TITLE_CHANGED,H);const G=Al(i);return w.exports.useEffect(function(){if(G!==i&&i!==f){Hr.debug("Setting new layout content...");const Y=oe.hydrateLayoutConfig(i,N);for(;s.root.contentItems.length>0;)s.root.contentItems[0].remove();for(let Q=0;Q<Y.length;Q+=1)s.root.addChild(Y[Q]);m(s.root.contentItems.length===0)}},[N,s,i,f,P,G]),T(Te,{children:[u&&n,X.Children.map(e,$=>$!=null?X.cloneElement($,{id:t,layout:s,panelManager:P,registerComponent:R}):null)]})}vp.propTypes={id:D.exports.string.isRequired,children:D.exports.node,data:D.exports.shape({}),emptyDashboard:D.exports.node,layout:jd.Layout.isRequired,layoutConfig:D.exports.arrayOf(D.exports.shape({})),onLayoutChange:D.exports.func,onLayoutInitialized:D.exports.func};const vv=100,Ia=()=>{},Tv=Object.freeze({});function Ev({id:t="default",children:e,emptyDashboard:n,layoutConfig:s,layoutSettings:i=Tv,onLayoutConfigChange:o=Ia,onGoldenLayoutChange:r=Ia,onLayoutInitialized:l=Ia,fallbackComponent:a=fp,hydrate:d,dehydrate:c}){const u=w.exports.useRef(null),[m,p]=w.exports.useState(!1),[g,f]=w.exports.useState();w.exports.useEffect(function(){if(!u.current){f(void 0);return}const S={...oe.makeDefaultLayout()};S.settings===void 0&&(S.settings={}),Object.assign(S.settings,i),S.content=[];const v=new Kd(S,u.current),y=()=>{v.off("initialised",y),p(!0)};return v.on("initialised",y),a!=null&&v.setFallbackComponent(a),v.init(),f(v),r(v),()=>{v.destroy()}},[i,a,r,p,f]);const b=w.exports.useMemo(()=>Qn(()=>{g!=null&&g.isInitialised&&(g==null||g.updateSize())},vv),[g]);return w.exports.useEffect(function(){return window.addEventListener("resize",b),()=>{window.removeEventListener("resize",b)}},[b]),T("div",{className:"dashboard-container w-100 h-100",children:[h("div",{className:"w-100 h-100",ref:u}),m&&g&&h(vp,{emptyDashboard:n,id:t,layout:g,layoutConfig:s,onLayoutChange:o,onLayoutInitialized:l,hydrate:d,dehydrate:c,children:e})]})}const Mn="default";class Tp extends Error{constructor(){super(...arguments),this.isAssertionFailed=!0}}function Fh(t){if(t==null)throw new Tp(`Expected 'val' to be defined, but received ${t}`)}class Ra extends Error{constructor(){super(...arguments),this.isPasteError=!0}}function tt(t){return(t==null?void 0:t.isEditable)!==void 0}function xh(t){if(!tt(t))throw new Tp(`Expected 'model' to be editable, but received ${t}`)}function gt(t){return(t==null?void 0:t.hasExpandableRows)!==void 0}var Nn=(t=>(t.DOWN="DOWN",t.UP="UP",t.LEFT="LEFT",t.RIGHT="RIGHT",t))(Nn||{});const Ie=class{static normalize(t,e,n,s){let i=t,o=e,r=n,l=s;return i!=null&&r!=null&&r<i&&(i=r,r=t),o!=null&&l!=null&&l<o&&(o=l,l=e),[i,o,r,l]}static makeNormalized(t,e,n,s){return new Ie(...Ie.normalize(t,e,n,s))}static makeCell(t,e){return new Ie(t,e,t,e)}static makeColumn(t){return new Ie(t,null,t,null)}static makeRow(t){return new Ie(null,t,null,t)}static minOrNull(t,e){return t==null||e==null?null:Math.min(t,e)}static maxOrNull(t,e){return t==null||e==null?null:Math.max(t,e)}static consolidate(t){const e=t.slice();let n=!0;for(;n;){n=!1;for(let s=0;s<e.length&&!n;s+=1){const i=e[s];for(let o=e.length-1;o>s;o-=1){const r=e[o];if(i.contains(r))e.splice(o,1);else if(r.contains(i)){n=!0,e[s]=r,e.splice(o,1);break}else if(i.startRow===r.startRow&&i.endRow===r.endRow){if(i.touches(r)){const{startRow:l,endRow:a}=i,d=Ie.minOrNull(i.startColumn,r.startColumn),c=Ie.maxOrNull(i.endColumn,r.endColumn);n=!0,e[s]=new Ie(d,l,c,a),e.splice(o,1);break}}else if(i.startColumn===r.startColumn&&i.endColumn===r.endColumn&&i.touches(r)){const{startColumn:l,endColumn:a}=i,d=Ie.minOrNull(i.startRow,r.startRow),c=Ie.maxOrNull(i.endRow,r.endRow);n=!0,e[s]=new Ie(l,d,a,c),e.splice(o,1);break}}}}return e}static isAxisRangeTouching(t,e,n,s){return t==null?e==null||n==null?!0:n<=e+1:e==null?s==null?!0:s>=t-1:n==null?s==null?!0:t<=s+1:s==null?e>=n-1:n>=t-1?n<=e+1:s>=t-1}static rangeArraysEqual(t,e){if(t===e)return!0;if(t==null||e==null||t.length!==e.length)return!1;for(let n=0;n<t.length;n+=1)if(!t[n].equals(e[n]))return!1;return!0}static intersection(t,e){if(t.equals(e))return t;let{startColumn:n,startRow:s,endColumn:i,endRow:o}=t;return n=n!=null&&e.startColumn!=null?Math.max(n,e.startColumn):n!=null?n:e.startColumn,i=i!=null&&e.endColumn!=null?Math.min(i,e.endColumn):i!=null?i:e.endColumn,s=s!=null&&e.startRow!=null?Math.max(s,e.startRow):s!=null?s:e.startRow,o=o!=null&&e.endRow!=null?Math.min(o,e.endRow):o!=null?o:e.endRow,n!=null&&n>(i!=null?i:-1)||s!=null&&s>(o!=null?o:-1)?null:new Ie(n,s,i,o)}static subtractFromRange(t,e){const n=[],s=Ie.intersection(t,e);return s==null?[t]:(s.startRow!=null&&(t.startRow==null||t.startRow<s.startRow)&&n.push(new Ie(t.startColumn,t.startRow,t.endColumn,s.startRow-1)),s.startColumn!=null&&(t.startColumn==null||t.startColumn<s.startColumn)&&n.push(new Ie(t.startColumn,s.startRow,s.startColumn-1,s.endRow)),s.endColumn!=null&&(t.endColumn==null||t.endColumn>s.endColumn)&&n.push(new Ie(s.endColumn+1,s.startRow,t.endColumn,s.endRow)),s.endRow!=null&&(t.endRow==null||t.endRow>s.endRow)&&n.push(new Ie(t.startColumn,s.endRow+1,t.endColumn,t.endRow)),n)}static subtractFromRanges(t,e){const n=[];for(let s=0;s<t.length;s+=1)n.push(...Ie.subtractFromRange(t[s],e));return n}static subtractRangesFromRanges(t,e){if(e==null||e.length===0)return t;let n=[...t];for(let s=0;s<e.length;s+=1)n=Ie.subtractFromRanges(n,e[s]);return n}static isBounded(t){return t.startRow!=null&&t.startColumn!=null&&t.endRow!=null&&t.endColumn!=null}static boundedRange(t,e,n){var s,i,o,r;return Ie.isBounded(t)?t:new Ie((s=t.startColumn)!=null?s:0,(i=t.startRow)!=null?i:0,(o=t.endColumn)!=null?o:e-1,(r=t.endRow)!=null?r:n-1)}static boundedRanges(t,e,n){return t.map(s=>Ie.boundedRange(s,e,n))}static offset(t,e,n){return new Ie(t.startColumn!=null?t.startColumn+e:null,t.startRow!=null?t.startRow+n:null,t.endColumn!=null?t.endColumn+e:null,t.endRow!=null?t.endRow+n:null)}static nextCell(t,e=null,n=null,s=Ie.SELECTION_DIRECTION.DOWN){if(t.length===0)return null;let i=-1;if(e!=null&&n!=null&&(i=t.findIndex(o=>o.containsCell(e,n)),i>=0)){const r=t[i].nextCell(e,n,s);if(r!=null)return r}switch(s){case Ie.SELECTION_DIRECTION.DOWN:case Ie.SELECTION_DIRECTION.RIGHT:{const o=i<t.length-1?i+1:0;return t[o].startCell(s)}case Ie.SELECTION_DIRECTION.LEFT:case Ie.SELECTION_DIRECTION.UP:{const o=i>0?i-1:t.length-1;return t[o].startCell(s)}default:throw new Error(`Invalid direction: ${s}`)}}static cellCount(t){return t.reduce((e,n)=>{var s,i,o,r;return e+(((s=n.endRow)!=null?s:NaN)-((i=n.startRow)!=null?i:NaN)+1)*(((o=n.endColumn)!=null?o:NaN)-((r=n.startColumn)!=null?r:NaN)+1)},0)}static rowCount(t){return t.reduce((e,n)=>{var s,i;return e+((s=n.endRow)!=null?s:NaN)-((i=n.startRow)!=null?i:NaN)+1},0)}static columnCount(t){return t.reduce((e,n)=>{var s,i;return e+((s=n.endColumn)!=null?s:NaN)-((i=n.startColumn)!=null?i:NaN)+1},0)}static containsCell(t,e,n){for(let s=0;s<t.length;s+=1)if(t[s].containsCell(e,n))return!0;return!1}static forEachCell(t,e,n=Ie.SELECTION_DIRECTION.RIGHT){for(let s=0;s<t.length;s+=1)t[s].forEach(e,n)}constructor(t,e,n,s){this.startColumn=t,this.startRow=e,this.endColumn=n,this.endRow=s}equals(t){return this.startColumn===t.startColumn&&this.startRow===t.startRow&&this.endColumn===t.endColumn&&this.endRow===t.endRow}contains(t){return(this.startColumn==null||t.startColumn!=null&&this.startColumn<=t.startColumn)&&(this.startRow==null||t.startRow!=null&&this.startRow<=t.startRow)&&(this.endColumn==null||t.endColumn!=null&&this.endColumn>=t.endColumn)&&(this.endRow==null||t.endRow!=null&&this.endRow>=t.endRow)}containsCell(t,e){return t==null||e==null?!1:(this.startColumn==null||this.startColumn<=t)&&(this.endColumn==null||this.endColumn>=t)&&(this.startRow==null||this.startRow<=e)&&(this.endRow==null||this.endRow>=e)}touches(t){return Ie.isAxisRangeTouching(this.startRow,this.endRow,t.startRow,t.endRow)&&Ie.isAxisRangeTouching(this.startColumn,this.endColumn,t.startColumn,t.endColumn)}subtract(t){return Ie.subtractFromRange(this,t)}startCell(t=Ie.SELECTION_DIRECTION.DOWN){if(!Ie.isBounded(this))throw new Error("Cannot get the startCell of an unbounded range");switch(t){case Ie.SELECTION_DIRECTION.DOWN:case Ie.SELECTION_DIRECTION.RIGHT:return{column:this.startColumn,row:this.startRow};case Ie.SELECTION_DIRECTION.LEFT:case Ie.SELECTION_DIRECTION.UP:return{column:this.endColumn,row:this.endRow};default:throw new Error(`Invalid direction: ${t}`)}}nextCell(t,e,n){if(!Ie.isBounded(this))throw new Error("Bounded range required");if(t==null||e==null)throw new Error("Require a non-null cursor");const{startColumn:s,endColumn:i,startRow:o,endRow:r}=this;switch(n){case Ie.SELECTION_DIRECTION.DOWN:if(e<r)return{column:t,row:Math.max(e+1,o)};if(t<i)return{column:Math.max(t+1,s),row:o};break;case Ie.SELECTION_DIRECTION.UP:if(e>o)return{column:t,row:Math.min(e-1,r)};if(t>s)return{column:Math.min(t-1,i),row:r};break;case Ie.SELECTION_DIRECTION.RIGHT:if(t<i)return{column:Math.max(t+1,s),row:e};if(e<r)return{column:s,row:Math.max(e+1,o)};break;case Ie.SELECTION_DIRECTION.LEFT:if(t>s)return{column:Math.min(t-1,i),row:e};if(e>o)return{column:i,row:Math.min(e-1,r)};break;default:throw new Error(`Invalid direction: ${n}`)}return null}forEach(t,e=Ie.SELECTION_DIRECTION.RIGHT){var o;let n=0,{column:s,row:i}=this.startCell(e);for(;s!=null&&i!=null;)t(s,i,n),n+=1,{column:s,row:i}=(o=this.nextCell(s,i,e))!=null?o:{}}};let de=Ie;de.SELECTION_DIRECTION=Nn;function yv(t){return Array.isArray(t)&&t.length===2&&(t[0]===null||typeof t[0]=="number")&&(t[1]===null||typeof t[1]=="number")}function Vr(t){return yv(t)&&t[0]!=null&&t[1]!=null}const Ne=class{static getGridPointFromXY(t,e,n){const s=Ne.getColumnAtX(t,n),i=Ne.getRowAtY(e,n),o=Ne.getColumnHeaderDepthAtY(e,n);return{x:t,y:e,row:i,column:s,columnHeaderDepth:o}}static getCellInfoFromXY(t,e,n){const{row:s,column:i}=Ne.getGridPointFromXY(t,e,n),{allColumnWidths:o,allRowHeights:r,allColumnXs:l,allRowYs:a,modelColumns:d,modelRows:c}=n,u=s!==null?c.get(s):null,m=i!==null?d.get(i):null,p=i!==null?l.get(i):null,g=s!==null?a.get(s):null,f=i!==null?o.get(i):null,b=s!==null?r.get(s):null;return{row:s,column:i,modelRow:u!=null?u:null,modelColumn:m!=null?m:null,left:p!=null?p:null,top:g!=null?g:null,columnWidth:f!=null?f:null,rowHeight:b!=null?b:null}}static getColumnHeaderDepthAtY(t,e){const n=Ne.getRowAtY(t,e),{columnHeaderHeight:s,columnHeaderMaxDepth:i}=e;if(n===null&&t<=s*i)return Je(i-Math.ceil(t/s),0,i-1)}static iterateFloatingStart(t,e,n){for(let s=0;s<t&&s<e;s+=1){const i=n(s);if(i!==void 0)return i}}static iterateFloatingEnd(t,e,n){for(let s=0;s<t&&e-(t-s)>=0;s+=1){const i=n(e-(t-s));if(i!==void 0)return i}}static iterateFloating(t,e,n,s){const i=Ne.iterateFloatingStart(t,n,s);return i!==void 0?i:Ne.iterateFloatingEnd(e,n,s)}static iterateAllItems(t,e,n,s,i,o){const r=Math.max(t,n),l=Math.min(e,i-s-1);let a=Ne.iterateFloating(n,s,i,o);if(a!==void 0)return a;for(let d=r;d<=l;d+=1)if(a=o(d),a!==void 0)return a}static isInItem(t,e,n,s){var r,l;const i=(r=e.get(t))!=null?r:0,o=(l=n.get(t))!=null?l:0;return i<=s&&s<=i+o}static getItemAtOffset(t,e,n,s,i,o,r,l=!1){const a=l?void 0:Ne.iterateFloating(n,s,e,d=>{if(Ne.isInItem(d,o,r,t))return d});if(!l&&a!==void 0)return a;for(let d=0;d<i.length;d+=1){const c=i[d];if(Ne.isInItem(c,o,r,t))return c}return null}static getColumnAtX(t,e,n=!1){const{columnCount:s,floatingLeftColumnCount:i,floatingRightColumnCount:o,visibleColumns:r,allColumnXs:l,allColumnWidths:a,gridX:d}=e;return t<d?null:this.getItemAtOffset(t-d,s,i,o,r,l,a,n)}static getRowAtY(t,e){const{floatingTopRowCount:n,floatingBottomRowCount:s,rowCount:i,visibleRows:o,allRowYs:r,allRowHeights:l,gridY:a}=e;return t<a?null:this.getItemAtOffset(t-a,i,n,s,o,r,l)}static getNextShownItem(t,e,n,s){let i=n.findIndex(o=>o===t)||0;for(i-=1;i!=null&&i>=0;){const o=n[i],r=e.get(o);if(r!=null&&s.get(r)!==0)return o;i-=1}return null}static getNextShownColumn(t,e){const{modelColumns:n,visibleColumns:s,userColumnWidths:i}=e;return Ne.getNextShownItem(t,n,s,i)}static getNextShownRow(t,e){const{modelRows:n,visibleRows:s,userRowHeights:i}=e;return Ne.getNextShownItem(t,n,s,i)}static getColumnSeparatorIndex(t,e,n,s){var C,S,v,y;const{rowHeaderWidth:i,columnHeaderHeight:o,floatingColumns:r,floatingLeftWidth:l,visibleColumns:a,allColumnXs:d,allColumnWidths:c,columnHeaderMaxDepth:u}=n,{allowColumnResize:m,headerSeparatorHandleSize:p}=s;if(u*o<e||!m||p<=0)return null;const g=t-i,f=p*.5;let b=!1;for(let E=r.length-1;E>=0;E-=1){const I=r[E],R=(C=d.get(I))!=null?C:0,N=(S=c.get(I))!=null?S:0,F=N===0;if(!b||!F){let P=R+N;F?P+=f:b&&(P-=f);const H=P-f,x=P+f;if(H<=g&&g<=x)return I;b=F}}b=!1;for(let E=a.length-1;E>=0;E-=1){const I=a[E],R=(v=d.get(I))!=null?v:0,N=(y=c.get(I))!=null?y:0,F=N===0;if(R<l-N)return null;if(!b||!F){let P=R+N;F?P+=f:b&&(P-=f);const H=P-f,x=P+f;if(H<=g&&g<=x)return I;b=F}}return null}static isItemHidden(t,e){return e.get(t)===0}static isColumnHidden(t,e){const{allColumnWidths:n}=e;return Ne.isItemHidden(t,n)}static isFloatingRow(t,e){if(t==null)return!1;const{floatingTopRowCount:n,floatingBottomRowCount:s,rowCount:i}=e;return t<n||t>=i-s}static isFloatingColumn(t,e){if(t==null)return!1;const{floatingLeftColumnCount:n,floatingRightColumnCount:s,columnCount:i}=e;return t<n||t>=i-s}static getHiddenItems(t,e,n){if(!Ne.isItemHidden(t,e))return[];const s=[t],i=n.findIndex(o=>o===t);for(let o=i-1;o>=0;o-=1){const r=n[o];if(!Ne.isItemHidden(r,e))break;s.push(r)}return s}static getHiddenColumns(t,e){const{visibleColumns:n,allColumnWidths:s}=e;return Ne.getHiddenItems(t,s,n)}static getRowSeparatorIndex(t,e,n,s){var g,f;const{rowHeaderWidth:i,columnHeaderHeight:o,visibleRows:r,allRowYs:l,allRowHeights:a}=n,{allowRowResize:d,headerSeparatorHandleSize:c}=s;if(i<t||!d||c<=0)return null;const u=e-o,m=c*.5;let p=!1;for(let b=r.length-1;b>=0;b-=1){const C=r[b],S=(g=l.get(C))!=null?g:0,v=(f=a.get(C))!=null?f:0,y=v===0;if(!p||!y){let E=S+v;y?E+=m:p&&(E-=m);const I=E-m,R=E+m;if(I<=u&&u<=R)return C;p=y}}return null}static isRowHidden(t,e){const{allRowHeights:n}=e;return Ne.isItemHidden(t,n)}static getHiddenRows(t,e){const{visibleRows:n,allRowHeights:s}=e;return Ne.getHiddenItems(t,s,n)}static moveItem(t,e,n){if(t===e)return n;const s=[...n],i=s[s.length-1];return i!=null&&!Vr(i.from)&&i.to===t?i.from===e?s.pop():s[s.length-1]={...i,to:e}:s.push({from:t,to:e}),s}static moveRange(t,e,n,s=!1){if(t[0]===t[1])return Ne.moveItem(t[0],e,n);let i=e;if(s&&t[0]<e&&(i-=t[1]-t[0]),t[0]===i)return n;const o=[...n],r=o[o.length-1];r!=null&&Vr(r.from)&&r.from[1]-r.from[0]===t[1]-t[0]&&r.to===t[0]?o[o.length-1]={...r,to:i}:o.push({from:t,to:i});const l=o[o.length-1];return Vr(l.from)&&l.from[0]===l.to&&o.pop(),o}static moveItemOrRange(t,e,n,s=!1){return Array.isArray(t)?Ne.moveRange(t,e,n,s):Ne.moveItem(t,e,n)}static applyItemMoves(t,e,n,s=!1){var o,r;let i=[[t,e]];for(let l=s?n.length-1:0;s?l>=0:l<n.length;s?l-=1:l+=1){const{from:a,to:d}=n[l];let c=1,u;Vr(a)?(c=a[1]-a[0]+1,[u]=a):u=a;const m=s?d:u,p=m+c-1,g=s?u:d,f=g-m,b=[];for(let C=0;C<i.length;C+=1){const S=(o=i[C][0])!=null?o:Number.NEGATIVE_INFINITY,v=(r=i[C][1])!=null?r:Number.POSITIVE_INFINITY;let y;const E=[[S,m-1],[m,p],[p+1,v]].map(([I,R])=>[Math.max(I,S),Math.min(R,v)]).filter(([I,R])=>I<=R).map(I=>{const[R,N]=I;return m<=R&&p>=N?(y=[R+f,N+f],y):p<R?[R-c,N-c]:I}).map(I=>{const[R,N]=I;return g>R&&g<=N?[[R,g-1],[g+c,N+c]]:I===y?[I]:g<=R?[[R+c,N+c]]:[I]}).flat();b.push(...E)}i=b.map(([C,S])=>[Number.isFinite(C)?C:null,Number.isFinite(S)?S:null])}return i}static translateRange(t,e,n,s){const i=Ne.applyItemMoves(t.startColumn,t.endColumn,e,s),o=Ne.applyItemMoves(t.startRow,t.endRow,n,s),r=[];for(let l=0;l<i.length;l+=1){const a=i[l];for(let d=0;d<o.length;d+=1){const c=o[d];r.push(new de(a[0],c[0],a[1],c[1]))}}return r}static getModelIndex(t,e){return Ne.applyItemMoves(t,t,e,!0)[0][0]}static getModelIndexes(t,e){return t.map(n=>Ne.getModelIndex(n,e))}static getModelRangeIndexes(t,e,n){return Ne.applyItemMoves(t,e,n,!0)}static getModelRange(t,e=[],n=[]){return Ne.translateRange(t,e,n,!0)}static getModelRanges(t,e=[],n=[]){const s=[];for(let i=0;i<t.length;i+=1)s.push(...Ne.getModelRange(t[i],e,n));return s}static getVisibleRangeIndexes(t,e,n){return Ne.applyItemMoves(t,e,n,!1)}static getVisibleRange(t,e=[],n=[]){return this.translateRange(t,e,n,!1)}static getVisibleRanges(t,e=[],n=[]){const s=[];for(let i=0;i<t.length;i+=1)s.push(...Ne.getVisibleRange(t[i],e,n));return s}static getVisibleIndex(t,e){return Ne.applyItemMoves(t,t,e)[0][0]}static getVisibleIndexes(t,e){return t.map(n=>Ne.getVisibleIndex(n,e))}static isMacPlatform(){const{platform:t}=window.navigator;return t.startsWith("Mac")}static getModifierKey(){return Ne.isMacPlatform()?"metaKey":"ctrlKey"}static isModifierKeyDown(t){const e=Ne.getModifierKey();return t[e]}static checkColumnHidden(t,e){return e.get(t)===0}static checkAllColumnsHidden(t,e){return e.size===0?!1:t.every(n=>e.get(n)===0)}static getScrollDragBounds(t,e,n){const{gridX:s,gridY:i,width:o,height:r,floatingTopRowCount:l,floatingBottomRowCount:a,floatingLeftColumnCount:d,floatingRightColumnCount:c,floatingLeftWidth:u,floatingRightWidth:m,floatingTopHeight:p,floatingBottomHeight:g,columnCount:f,rowCount:b}=t;let C=s,S=i,v=o,y=r;return n!=null&&(n>d&&(C+=u),n<f-c&&(v-=m)),e!=null&&(e>l&&(S+=p),e<b-a&&(y-=g)),{x1:C,y1:S,x2:v,y2:y}}static getScrollDelta(t,e=1024,n=768,s=20,i=20){let{deltaX:o,deltaY:r}=t;return!Ne.isMacPlatform()&&t.shiftKey&&t.deltaX===0&&t.deltaY!==0&&(o=t.deltaY,r=t.deltaX),(t==null?void 0:t.deltaMode)===WheelEvent.DOM_DELTA_PAGE?(o*=e,r*=n):(t==null?void 0:t.deltaMode)===WheelEvent.DOM_DELTA_LINE&&(Ne.isMacPlatform()?(o=Math.round(o*s),r=Math.round(r*i)):(o=Math.round(o*this.PIXELS_PER_LINE),r=Math.round(r*this.PIXELS_PER_LINE))),{deltaX:o,deltaY:r}}static compareRanges(t,e){return t[0]==null||t[1]==null||e[0]==null||e[1]==null?0:t[0]!==e[0]?t[0]-e[0]:t[1]-e[1]}static mergeSortedRanges(t){const e=[];for(let n=0;n<t.length;n+=1){const s=t[n],i=s[0],o=s[1];n===0?e.push([i,o]):i-1<=e[e.length-1][1]?e[e.length-1][1]=Math.max(e[e.length-1][1],o):e.push([i,o])}return e}};let J=Ne;J.PIXELS_PER_LINE=100/3;function B(t,e,n=void 0){var i;const s=(i=t.get(e))!=null?i:n;if(s!==void 0)return s;throw new Error(`Missing value for key ${e}`)}function Ur(t,e=dr.CACHE_SIZE,n=Math.floor(e/2)){if(t.size>e){const s=t.keys();for(;t.size>n;)t.delete(s.next().value)}}function _h(t,e,n,s,i){const o=new Map;let r=0;for(let l=0;l<t&&l<n;l+=1)o.set(l,r),r+=B(i,l);r=s;for(let l=0;l<e&&n-l-1>=0;l+=1)r-=B(i,n-l-1),o.set(n-l-1,r);return o}const Ep=class{constructor({userColumnWidths:t=new Map,userRowHeights:e=new Map,calculatedColumnWidths:n=new Map,calculatedRowHeights:s=new Map,fontWidths:i=new Map,modelRows:o=new Map,modelColumns:r=new Map,movedRows:l=[],movedColumns:a=[]}={}){this.userColumnWidths=t,this.userRowHeights=e,this.calculatedRowHeights=s,this.calculatedColumnWidths=n,this.fontWidths=i,this.modelRows=o,this.modelColumns=r,this.movedRows=l,this.movedColumns=a}getMetrics(t){const{left:e,top:n,leftOffset:s,topOffset:i,width:o,height:r,theme:l,model:a,movedRows:d,movedColumns:c,draggingColumn:u}=t,{rowHeight:m,rowHeaderWidth:p,rowFooterWidth:g,columnWidth:f,columnHeaderHeight:b,minScrollHandleSize:C,scrollBarSize:S}=l;d!==this.movedRows&&(this.movedRows=d,this.modelRows.clear()),c!==this.movedColumns&&(this.movedColumns=c,this.modelColumns.clear());const{columnCount:v,rowCount:y,floatingTopRowCount:E,floatingBottomRowCount:I,floatingLeftColumnCount:R,floatingRightColumnCount:N,columnHeaderMaxDepth:F}=a,P=this.getFirstRow(t),H=this.getFirstColumn(t),x=this.getGridX(t),A=this.getGridY(t),k=gt(a)&&a.hasExpandableRows?this.calculateTreePaddingX(t):0,G=0,V=this.getVisibleRowHeights(t),O=this.getVisibleColumnWidths(t,H,k),$=Array.from(V.keys()),Y=Array.from(O.keys()),Q=new Map([...V,...this.getFloatingRowHeights(t)]),U=new Map([...O,...this.getFloatingColumnWidths(t)]),q=this.getVisibleColumnXs(U,Y,s),j=this.getVisibleRowYs(Q,$,i),te=$.length>0?$[$.length-1]:n,ce=Y.length>0?Y[Y.length-1]:e,ne=this.getBottomViewport(t,$,j,Q),he=this.getRightViewport(t,Y,q,U),Ce=this.getFloatingTopHeight(t,Q),Re=this.getFloatingBottomHeight(t,Q),He=this.getFloatingLeftWidth(t,U),lt=this.getFloatingRightWidth(t,U),Ve=Array.from(U.values()),Ln=Array.from(Q.values()),$t=Ve.reduce((pt,Ri)=>pt+Ri,0)-s,Me=Ln.reduce((pt,Ri)=>pt+Ri,0)-i,ct=s+$t+g,at=i+Me,Mt=o-x,zt=r-A,An=this.getLastLeft(t,null,Mt-g),un=this.getLastLeft(t,null,Mt-g-S),Ti=this.getLastTop(t,null,zt-Re),mn=this.getLastTop(t,null,zt-Re-S);let kt=un,Ts=mn;An===0&&Ti===0&&(kt=0,Ts=0);const Ei=kt>0,So=Ei?S:0,yi=Ts>0,Ii=yi?S:0,mr=x,pr=F*b,Es=o-mr-Ii,Ys=r-pr-So,ha=v===1?Es/ct:(v-kt)/v,gr=y===1?Ys/at:(y-Ts)/y,wo=Ei?Je(Es*ha,C,Es-1):0,fr=yi?Je(Ys*gr,C,Ys-1):0,Cr=B(U,e,0),br=B(Q,n,0),ua=Cr>0?s/Cr:0,ma=br>0?i/br:0,Xs=v===1?s/(ct-Mt):(e+ua)/kt,pa=y===1?i/(at-zt):(n+ma)/Ts,vo=Ei?Xs*(Es-wo):0,ga=yi?pa*(Ys-fr):0,Sr=[...Array(E).keys(),...[...Array(I).keys()].map(pt=>y-pt-1)],To=new Map([...j,...this.getFloatingRowYs(t,Q,Math.floor(r-A-So))]),Eo=[...Array(R).keys(),...[...Array(N).keys()].map(pt=>v-pt-1)],ys=new Map([...q,...this.getFloatingColumnXs(t,U,Math.floor(o-x-Ii))]),wr=[];if(u)for(let pt=u.range[0];pt<=u.range[1];pt+=1)wr.push(pt),U.has(pt)||U.set(pt,this.getVisibleColumnWidth(pt,t)),ys.has(pt)||ys.set(pt,0);const vr=$.concat(Sr),yo=Y.concat(Eo).concat(wr),Tr=this.getModelRows(vr,t),Er=this.getModelColumns(yo,t),yr=this.getVisibleRowTreeBoxes(Q,Tr,t),Ir=this.getTopVisible(t,To,Q,$),Rr=this.getLeftVisible(t,ys,U,Y),Dr=Ts>0?this.getBottomVisible(t,To,Q,$,A):te,fa=kt>0?this.getRightVisible(t,ys,U,Y,x):ce,{fontWidths:Ca,userColumnWidths:Mr,userRowHeights:Nr,calculatedRowHeights:Fr,calculatedColumnWidths:xr}=this;return{rowHeight:m,rowHeaderWidth:p,rowFooterWidth:g,rowCount:y,columnWidth:f,columnCount:v,columnHeaderHeight:b,floatingTopRowCount:E,floatingBottomRowCount:I,floatingLeftColumnCount:R,floatingRightColumnCount:N,gridX:x,gridY:A,firstRow:P,firstColumn:H,treePaddingX:k,treePaddingY:G,left:e,top:n,bottom:te,right:ce,topOffset:i,leftOffset:s,topVisible:Ir,leftVisible:Rr,bottomVisible:Dr,rightVisible:fa,bottomViewport:ne,rightViewport:he,width:o,height:r,maxX:$t,maxY:Me,lastLeft:kt,lastTop:Ts,barHeight:Ys,barTop:pr,barWidth:Es,barLeft:mr,handleHeight:fr,handleWidth:wo,hasHorizontalBar:Ei,hasVerticalBar:yi,verticalBarWidth:Ii,horizontalBarHeight:So,scrollX:vo,scrollY:ga,scrollableContentWidth:ct,scrollableContentHeight:at,scrollableViewportWidth:Mt,scrollableViewportHeight:zt,visibleRows:$,visibleColumns:Y,visibleRowHeights:V,visibleColumnWidths:O,floatingRows:Sr,floatingColumns:Eo,allRows:vr,allColumns:yo,allRowHeights:Q,allColumnWidths:U,floatingTopHeight:Ce,floatingBottomHeight:Re,floatingLeftWidth:He,floatingRightWidth:lt,visibleRowYs:j,visibleColumnXs:q,allRowYs:To,allColumnXs:ys,visibleRowTreeBoxes:yr,modelRows:Tr,modelColumns:Er,movedRows:d,movedColumns:c,fontWidths:Ca,userColumnWidths:Mr,userRowHeights:Nr,calculatedRowHeights:Fr,calculatedColumnWidths:xr,columnHeaderMaxDepth:F}}getGridX(t){const{theme:e}=t,{rowHeaderWidth:n}=e;return n}getGridY(t){const{theme:e,model:n}=t,{columnHeaderHeight:s}=e,{columnHeaderMaxDepth:i}=n;return i*s}getVisibleHeight(t,e=this.getFloatingRowHeights(t)){const{height:n,theme:s}=t,{scrollBarSize:i}=s,o=this.getGridY(t),r=this.getFloatingBottomHeight(t,e),l=this.getFloatingTopHeight(t,e);return n-r-l-o-i}getVisibleWidth(t,e=this.getFloatingColumnWidths(t)){const{width:n,theme:s}=t,{scrollBarSize:i,rowFooterWidth:o}=s,r=this.getGridX(t),l=this.getFloatingRightWidth(t,e),a=this.getFloatingLeftWidth(t,e);return n-a-l-r-i-o}getFirstIndex(t,e,n){const s=t.size+1;for(let i=0;i<s;i+=1){const o=e(i,n);if(t.get(o)!==0)return i}return 0}getFirstColumn(t){return this.getFirstIndex(this.userColumnWidths,this.getModelColumn.bind(this),t)}getFirstRow(t){return this.getFirstIndex(this.userRowHeights,this.getModelRow.bind(this),t)}getLastLeft(t,e,n){const{model:s}=t,{columnCount:i,floatingRightColumnCount:o}=s;let r=Math.max(0,i-o-1);e!=null&&(r=e);let l=0;for(;r>=0;){if(l+=this.getVisibleColumnWidth(r,t),l>=n)return Je(r+1,0,e!=null?e:i-1);r-=1}return 0}getLastTop(t,e,n){const{model:s}=t,{rowCount:i,floatingBottomRowCount:o}=s;let r=Math.max(0,i-o-1);e!=null&&(r=e);let l=0;for(;r>=0;){if(l+=this.getVisibleRowHeight(r,t),l>=n)return Je(r+1,0,i-1);r-=1}return 0}getTopForTopVisible(t,e){const n=this.getFloatingTopHeight(t);let s=e,i=0;for(;s>0&&i<n;)s-=1,i+=this.getVisibleRowHeight(s,t);return s}getTopForBottomVisible(t,e){const{height:n}=t,s=this.getGridY(t),i=this.getFloatingBottomHeight(t),o=n-s-i;return this.getLastTop(t,e,o)}getLeftForLeftVisible(t,e){const n=this.getFloatingLeftWidth(t);let s=e,i=0;for(;s>0&&i<n;)s-=1,i+=this.getVisibleColumnWidth(s,t);return s}getLeftForRightVisible(t,e){const{width:n}=t,s=this.getGridX(t),i=this.getFloatingRightWidth(t),o=n-s-i;return this.getLastLeft(t,e,o)}getFloatingRowHeights(t){const{model:e}=t,{floatingTopRowCount:n,floatingBottomRowCount:s,rowCount:i}=e,o=new Map;for(let r=0;r<n&&r<i;r+=1)o.set(r,this.getVisibleRowHeight(r,t));for(let r=0;r<s&&i-r-1>=0;r+=1){const l=i-r-1;o.set(l,this.getVisibleRowHeight(l,t))}return o}getVisibleRowHeights(t){const{top:e,topOffset:n,height:s,model:i}=t;let o=0,r=e;const l=new Map,{rowCount:a}=i;for(;o<s+n&&r<a;){const d=this.getVisibleRowHeight(r,t);l.set(r,d),o+=d,r+=1}return l}getFloatingColumnWidths(t,e=this.getFirstColumn(t),n=this.calculateTreePaddingX(t)){const{model:s}=t,{columnCount:i,floatingLeftColumnCount:o,floatingRightColumnCount:r}=s,l=new Map;for(let a=0;a<o&&a<i;a+=1)l.set(a,this.getVisibleColumnWidth(a,t,e,n));for(let a=0;a<r&&i-a-1>=0;a+=1){const d=i-a-1;l.set(d,this.getVisibleColumnWidth(d,t,e,n))}return l}getVisibleColumnWidths(t,e=this.getFirstColumn(t),n=this.calculateTreePaddingX(t)){const{left:s,leftOffset:i,width:o,model:r}=t;let l=0,a=s;const d=new Map,{columnCount:c}=r;for(;l<o+i&&a<c;){const u=this.getVisibleColumnWidth(a,t,e,n);d.set(a,u),l+=u,a+=1}return d}getFloatingColumnXs(t,e,n){const{model:s}=t,{columnCount:i,floatingLeftColumnCount:o,floatingRightColumnCount:r}=s;return _h(o,r,i,n,e)}getVisibleColumnXs(t,e,n){const s=new Map;let i=-n;for(let o=0;o<e.length;o+=1){const r=e[o],l=B(t,r);s.set(r,i),i+=l}return s}getFloatingRowYs(t,e,n){const{model:s}=t,{floatingTopRowCount:i,floatingBottomRowCount:o,rowCount:r}=s;return _h(i,o,r,n,e)}getVisibleRowYs(t,e,n){const s=new Map;let i=-n;for(let o=0;o<e.length;o+=1){const r=e[o],l=B(t,r);s.set(r,i),i+=l}return s}getVisibleRowTreeBoxes(t,e,n){const s=new Map,{model:i,theme:o}=n,{treeDepthIndent:r,treeHorizontalPadding:l}=o;return gt(i)&&i.hasExpandableRows&&t.forEach((a,d)=>{const c=B(e,d);if(i.isRowExpandable(c)){const u=i.depthForRow(c),m=u*r+l,p=(u+1)*r+l,g=0,f=a;s.set(d,{x1:m,y1:g,x2:p,y2:f})}}),s}getFloatingLeftWidth(t,e=this.getFloatingColumnWidths(t)){const{model:n}=t,{floatingLeftColumnCount:s}=n;let i=0;for(let o=0;o<s;o+=1)i+=B(e,o);return i}getFloatingRightWidth(t,e=this.getFloatingColumnWidths(t)){const{model:n}=t,{floatingRightColumnCount:s,columnCount:i}=n;let o=0;for(let r=0;r<s;r+=1)o+=B(e,i-r-1);return o}getFloatingTopHeight(t,e=this.getFloatingRowHeights(t)){const{model:n}=t,{floatingTopRowCount:s}=n;let i=0;for(let o=0;o<s;o+=1)i+=B(e,o);return i}getFloatingBottomHeight(t,e=this.getFloatingRowHeights(t)){const{model:n}=t,{floatingBottomRowCount:s,rowCount:i}=n;let o=0;for(let r=0;r<s;r+=1)o+=B(e,i-r-1);return o}getTopVisible(t,e,n,s){const i=this.getFloatingTopHeight(t,n);for(let o=0;o<s.length;o+=1){const r=s[o];if(B(e,r)>=i)return r}return 0}getLeftVisible(t,e,n,s){const i=this.getFloatingLeftWidth(t,n);for(let o=0;o<s.length;o+=1){const r=s[o];if(B(e,r)>=i)return r}return 0}getBottomVisible(t,e,n,s,i){const{height:o,theme:r}=t,{scrollBarSize:l}=r,a=this.getFloatingBottomHeight(t,n),d=o-i-l-a;for(let c=s.length-1;c>=0;c-=1){const u=s[c],m=B(e,u),p=B(n,u);if(m+p<=d)return u}return 0}getRightVisible(t,e,n,s,i){const{width:o,theme:r}=t,{scrollBarSize:l}=r,a=this.getFloatingRightWidth(t,n),d=o-i-l-a;for(let c=s.length-1;c>=0;c-=1){const u=s[c],m=B(e,u),p=B(n,u);if(m+p<=d)return u}return 0}getBottomViewport(t,e,n,s){const{height:i,theme:o}=t,{rowHeight:r}=o;return this.getLastIndexViewport(e,n,s,i,r)}getRightViewport(t,e,n,s){const{width:i,theme:o}=t,{columnWidth:r}=o;return this.getLastIndexViewport(e,n,s,i,r)}getLastIndexViewport(t,e,n,s,i){let o=0,r=0;return t.length>0&&(o=t[t.length-1],r=B(e,o)+B(n,o)),r<s&&(o+=Math.ceil((s-r)/i)),o}getVisibleItemSize(t,e,n){var i;const s=n();return(i=e.get(t))!=null?i:s}getVisibleRowHeight(t,e){const n=this.getModelRow(t,e);return this.getVisibleItemSize(n,this.userRowHeights,()=>this.calculateRowHeight(t,n,e))}getVisibleColumnWidth(t,e,n=this.getFirstColumn(e),s=this.calculateTreePaddingX(e)){const i=this.getModelColumn(t,e);return this.getVisibleItemSize(i,this.userColumnWidths,()=>this.calculateColumnWidth(t,i,e,n,s))}getModelRows(t,e){const n=new Map;for(let s=0;s<t.length;s+=1){const i=t[s],o=this.getModelRow(i,e);n.set(i,o)}return n}getModelRow(t,e){if(this.modelRows.has(t))return B(this.modelRows,t);const{movedRows:n}=e,s=J.getModelIndex(t,n);return this.modelRows.set(t,s),s}getModelColumns(t,e){const n=new Map;for(let s=0;s<t.length;s+=1){const i=t[s],o=this.getModelColumn(i,e);n.set(i,o)}return n}getModelColumn(t,e){if(this.modelColumns.has(t))return B(this.modelColumns,t);const{movedColumns:s}=e,i=J.getModelIndex(t,s);return this.modelColumns.set(t,i),i}calculateRowHeight(t,e,n){const{theme:s}=n,{autoSizeRows:i,rowHeight:o}=s;if(!i)return o;const r=this.calculatedRowHeights.get(e);return r!=null?r:(this.calculatedRowHeights.set(e,Math.ceil(o)),Ur(this.calculatedRowHeights),o)}calculateColumnWidth(t,e,n,s=this.getFirstColumn(n),i=this.calculateTreePaddingX(n)){const{theme:o}=n,{autoSizeColumns:r,minColumnWidth:l}=o;if(!r){const{columnWidth:m}=o;return m}const a=this.calculateColumnHeaderWidth(e,n),d=this.calculateColumnDataWidth(e,n),c=this.calculatedColumnWidths.get(e);let u=Math.ceil(Math.max(a,d));return u=Math.max(l,u),c!=null&&c>u?u=c:(this.calculatedColumnWidths.set(e,u),Ur(this.calculatedColumnWidths)),t===s&&(u+=i),u}calculateColumnHeaderWidth(t,e){const{model:n,theme:s}=e,{headerFont:i,headerHorizontalPadding:o}=s,r=n.textForColumnHeader(t,0);if(r!==void 0&&r!==""){const l=this.getWidthForFont(i,e);return r.length*l+o*2}return o*2}calculateColumnDataWidth(t,e){const{top:n,height:s,width:i,model:o,theme:r}=e,{floatingTopRowCount:l,floatingBottomRowCount:a,rowCount:d}=o,{font:c,cellHorizontalPadding:u,rowHeight:m,rowHeaderWidth:p,rowFooterWidth:g,scrollBarSize:f}=r;let b=0;const C=this.getWidthForFont(c,e),S=s/m,v=Math.ceil(n+S);return J.iterateAllItems(n,v,l,a,d,y=>{const E=this.getModelRow(y,e),I=o.textForCell(t,E);if(I){const R=u*2;b=Math.max(b,I.length*C+R)}}),b=Math.max(Math.min(b,(i-p-f-g)*Ep.MAX_COLUMN_WIDTH),u*2),b}calculateTreePaddingX(t){const{top:e,height:n,model:s,theme:i}=t,{rowHeight:o,treeDepthIndent:r}=i;if(!gt(s)||!s.hasExpandableRows)return 0;let l=0;const a=n/o,d=Math.ceil(e+a);for(let c=e;c<=d;c+=1){const u=this.getModelRow(c,t),m=s.depthForRow(u);l=Math.max(l,r*(m+1))}return l}getWidthForFont(t,e){if(this.fontWidths.has(t))return B(this.fontWidths,t);const{context:n}=e;n.font=t;const s=n.measureText("8"),{width:i}=s;return this.fontWidths.set(t,i),this.fontWidths.set(n.font,i),i}setColumnWidth(t,e){const n=new Map(this.userColumnWidths);n.set(t,Math.ceil(e)),Ur(n),this.userColumnWidths=n}resetColumnWidth(t){const e=new Map(this.userColumnWidths);e.delete(t),this.userColumnWidths=e}setRowHeight(t,e){const n=new Map(this.userRowHeights);n.set(t,Math.ceil(e)),Ur(n),this.userRowHeights=n}resetRowHeight(t){const e=new Map(this.userRowHeights);e.delete(t),this.userRowHeights=e,this.calculatedRowHeights.delete(t)}};let dr=Ep;dr.CACHE_SIZE=1e4;dr.MAX_COLUMN_WIDTH=.8;const Iv=Object.freeze({allowColumnResize:!0,allowRowResize:!0,autoSelectRow:!1,autoSelectColumn:!1,autoSizeColumns:!0,autoSizeRows:!0,backgroundColor:"#000000",black:"#000000",white:"#ffffff",cellHorizontalPadding:5,headerHorizontalPadding:5,font:"12px Arial, sans serif",gridColumnColor:"#8f8f8f66",gridRowColor:"#8f8f8f66",headerBackgroundColor:"#222222",headerSeparatorColor:"#000000",headerSeparatorHoverColor:"#888888",headerSeparatorHandleSize:5,headerHiddenSeparatorSize:5,headerHiddenSeparatorHoverColor:"#8888FF",headerColor:"#d5d5d5",headerFont:"10px Arial, sans serif",columnHoverBackgroundColor:"#444444",selectedColumnHoverBackgroundColor:"#494949",rowBackgroundColors:"#333333 #222222",rowHoverBackgroundColor:"#444444",selectedRowHoverBackgroundColor:"#494949",minScrollHandleSize:50,scrollBarBackgroundColor:"#111111",scrollBarHoverBackgroundColor:"#333333",scrollBarCasingColor:"#000000",scrollBarCornerColor:"#000000",scrollBarColor:"#555555",scrollBarHoverColor:"#888888",scrollBarActiveColor:"#AAAAAA",scrollBarSize:12,scrollBarHoverSize:16,scrollBarCasingWidth:1,scrollSnapToColumn:!1,scrollSnapToRow:!1,selectionColor:"#4286f433",selectionOutlineColor:"#4286f4",selectionOutlineCasingColor:"#222222",scrollBarSelectionTick:!0,scrollBarSelectionTickColor:"#4286f433",scrollBarActiveSelectionTickColor:"#4286f480",shadowBlur:8,shadowColor:"#000000",textColor:"#ffffff",maxDepth:6,treeDepthIndent:10,treeHorizontalPadding:5,treeLineColor:"#888888",treeMarkerColor:"#cccccc",treeMarkerHoverColor:"#ffffff",rowHeight:20,columnWidth:100,minRowHeight:20,minColumnWidth:55,columnHeaderHeight:20,rowHeaderWidth:30,rowFooterWidth:0,headerResizeSnapThreshold:10,headerResizeHiddenSnapThreshold:8,allowColumnReorder:!0,allowRowReorder:!0,reorderOffset:2,floatingGridColumnColor:"#8f8f8f66",floatingGridRowColor:"#8f8f8f66",floatingRowBackgroundColors:"#393939 #292929",floatingDividerOuterColor:"#000000",floatingDividerInnerColor:"#cccccc"}),ln=(t,e)=>{let n=!1;const s=be(t,{...e,dispose:()=>{n||(n=!0,s.clear(),n=!1)}});return s};function Rv(t,e,n=6){const s=Ua.hex.lab.raw(t);return s[0]=Math.max(s[0]-s[0]/n*e,0),`#${Ua.lab.hex(s)}`}function Dv(t,e){const[n,s,i]=Ua.hex.rgb(t);return`rgba(${n}, ${s}, ${i}, ${e})`}const kh={colorWithAlpha:Dv,darkenForDepth:Rv};class Dt{constructor(e=5e3){this.cursor=null,this.order=e}onDown(e,n,s){return!1}onMove(e,n,s){return!1}onDrag(e,n,s){return!1}onLeave(e,n,s){return!1}onClick(e,n,s){return!1}onContextMenu(e,n,s){return!1}onDoubleClick(e,n,s){return!1}onUp(e,n,s){return!1}onWheel(e,n,s){return!1}}class yp extends Dt{constructor(){super(...arguments),this.resizingItems=[],this.hiddenItems=[],this.targetSizes=new Map,this.dragOffset=0}onDown(e,n){const{metrics:s}=n,{model:i}=n.props,o=n.getTheme();if(!s)throw new Error("metrics not set");const r=this.getSeparator(e,s,i,o);if(r!=null){const l=r.index;return this.dragOffset=0,this.draggingIndex=l,this.resizingItems=[l],this.hiddenItems=this.getHiddenItems(l,s).reverse(),this.targetSizes.clear(),this.addTargetSize(s,l),this.updateCursor(s,l),this.updateSeparator(n,r),!0}return!1}onMove(e,n){const{metrics:s}=n,{model:i}=n.props,o=n.getTheme();if(!s)throw new Error("metrics not set");const r=this.getSeparator(e,s,i,o);return r!=null?(this.updateCursor(s,r.index),!0):!1}onDrag(e,n){var f;if(this.draggingIndex==null)return!1;const s=e[this.pointProperty],{metricCalculator:i,metrics:o}=n;if(!o)throw new Error("metrics not set");const r=n.getTheme(),l=o[this.visibleOffsetProperty],a=o[this.marginProperty],d=o[this.calculatedSizesProperty],c=o[this.modelIndexesProperty],u=o[this.firstIndexProperty],m=o[this.treePaddingProperty],p=new Map;let g=this.resizingItems[this.resizingItems.length-1];for(;g!=null;){const b=B(l,g),C=s-a-b-this.dragOffset,S=B(c,g),v=this.targetSizes.get(S),y=this.resizingItems.length>1,E=this.hiddenItems.indexOf(g);let I=B(d,S);g===u&&(I+=m);let R=C;Math.abs(C-I)<=r.headerResizeSnapThreshold?R=null:v!==void 0&&C>v&&(y&&E!==0||E>0)?R=v:C<=r.headerResizeHiddenSnapThreshold&&(R=0),R!==I?p.set(S,R):p.set(S,null),C<-r.headerResizeSnapThreshold&&R===0?E>=0&&y?(this.resizingItems.pop(),this.removeTargetSize(o,g),g=this.resizingItems[this.resizingItems.length-1],this.dragOffset-=(f=this.targetSizes.get(B(c,g)))!=null?f:0):(g=this.getNextShownItem(g,o),g!==null&&(this.resizingItems.push(g),this.addTargetSize(o,g))):v!==void 0&&C>v+r.headerResizeSnapThreshold&&R===v?E>0?(this.dragOffset+=R,g=this.hiddenItems[E-1],this.resizingItems.push(g),this.addTargetSize(o,g)):y?(this.resizingItems.pop(),this.removeTargetSize(o,g),g=this.resizingItems[this.resizingItems.length-1]):g=null:g=null}return p.forEach((b,C)=>{b!==null?this.setSize(i,C,b):this.resetSize(i,C)}),this.updateCursor(o,this.draggingIndex),!0}onUp(e,n){return this.draggingIndex!=null&&(this.draggingIndex=void 0,this.resizingItems=[],this.hiddenItems=[],this.targetSizes.clear(),this.updateSeparator(n,null)),!1}onDoubleClick(e,n){const{metrics:s,metricCalculator:i}=n,{model:o}=n.props,r=n.getTheme();if(!s)throw new Error("metrics not set");const l=this.getSeparator(e,s,o,r);if(l!=null){const a=s[this.modelIndexesProperty],d=B(a,l.index);return this.resetSize(i,d),n.forceUpdate(),!0}return!1}updateCursor(e,n){const s=e[this.visibleSizesProperty];B(s,n)===0?this.cursor=this.hiddenCursor:this.cursor=this.defaultCursor}addTargetSize(e,n){const s=e[this.modelIndexesProperty],i=e[this.userSizesProperty],o=e[this.calculatedSizesProperty],r=n===0?e[this.treePaddingProperty]:0,l=B(s,n);let a=i.get(l);(a==null||a===0)&&(a=B(o,l)+r),this.targetSizes.set(l,a)}removeTargetSize(e,n){const s=e[this.modelIndexesProperty],i=B(s,n);this.targetSizes.delete(i)}}class Ql extends yp{constructor(){super(...arguments),this.hiddenCursor="e-resize",this.defaultCursor="col-resize",this.pointProperty="x",this.userSizesProperty="userColumnWidths",this.visibleOffsetProperty="visibleColumnXs",this.visibleSizesProperty="visibleColumnWidths",this.marginProperty="rowHeaderWidth",this.calculatedSizesProperty="calculatedColumnWidths",this.modelIndexesProperty="modelColumns",this.firstIndexProperty="firstColumn",this.treePaddingProperty="treePaddingX",this.getHiddenItems=J.getHiddenColumns,this.getNextShownItem=J.getNextShownColumn,this.getSeparator=Ql.getColumnSeparator}static getColumnSeparator(e,n,s,i){if(!i.allowColumnResize)return null;const{x:o,y:r,columnHeaderDepth:l}=e,{modelColumns:a}=n,d=J.getColumnSeparatorIndex(o,r,n,i);return d==null||l==null||l>0?null:a.get(d)!=null?{index:d,depth:0}:null}setSize(e,n,s){e.setColumnWidth(n,s)}resetSize(e,n){e.resetColumnWidth(n)}updateSeparator(e,n){e.setState({draggingColumnSeparator:n,isDragging:n!==null})}}const us=class{constructor(){this.getCachedTruncatedString=ln((t,e,n,s,i)=>us.truncateToWidth(t,e,n,s,i),{max:1e4}),this.getCachedBackgroundColors=ln((t,e)=>t.split(" ").map(n=>{const s=[];for(let i=0;i<e;i+=1)s.push(kh.darkenForDepth(n,i,e));return s}),{max:1e3}),this.getCachedColorWithAlpha=ln((t,e)=>kh.colorWithAlpha(t,e),{max:1e3}),this.getCachedColorIsDark=ln(t=>Ll.isDark(t),{max:1e3})}static truncate(t,e){return e<t.length?t.substr(0,e)+"\u2026":t}static binaryTruncateToWidth(t,e,n,s=0,i=e.length,o){if(i>=e.length&&t.measureText(e).width<=n)return e;if(o!==void 0){const d=t.measureText(o).width;return o.repeat(Math.max(1,Math.floor(n/d)))}let r=s,l=Math.min(e.length-1,i),a=e;for(;l>=r;){const d=Math.ceil((l+r)/2),c=us.truncate(e,d);if(t.measureText(c).width<=n){if(a=c,r===d)break;r=d}else if(d===0){a=c;break}else l=d-1}return a}static truncateToWidth(t,e,n,s=us.DEFAULT_FONT_WIDTH,i){if(n<=0||e.length<=0)return"";const o=Math.min(Math.max(0,Math.floor(n/s/2)-5),e.length),r=Math.min(Math.ceil(n/s*2),e.length);return us.binaryTruncateToWidth(t,e,n,o,r,i)}drawCanvas(t){const{context:e}=t;e.save(),this.configureContext(e,t),this.drawBackground(e,t),this.drawGrid(e,t),this.drawHeaders(e,t),this.drawFooters(e,t),this.drawDraggingColumn(e,t),this.drawDraggingRow(e,t),this.drawScrollBars(e,t),e.restore()}configureContext(t,e){const{theme:n}=e;t.font=n.font,t.textBaseline="middle",t.lineCap="butt"}drawBackground(t,e){const{theme:n,metrics:s}=e,{width:i,height:o}=s;t.fillStyle=n.backgroundColor,t.fillRect(0,0,i,o)}drawGrid(t,e){const{metrics:n,draggingRow:s,draggingColumn:i}=e,{gridX:o,gridY:r}=n;t.translate(o,r),this.drawGridBackground(t,e,s==null&&i==null),this.drawCellContents(t,e),this.drawFloatingRows(t,e),this.drawFloatingColumns(t,e),t.translate(-o,-r)}drawFloatingRows(t,e){const{draggingRow:n,draggingColumn:s,metrics:i,theme:o}=e,{floatingTopRowCount:r,floatingBottomRowCount:l,floatingRows:a,rowCount:d,visibleColumns:c,allRowYs:u,allRowHeights:m}=i;if(a.length!==0){o.floatingRowBackgroundColors&&this.drawRowStripesForRows(t,e,a,o.floatingRowBackgroundColors),n==null&&s==null&&this.drawFloatingMouseRowHover(t,e),this.drawGridLinesForItems(t,e,c,a,o.floatingGridColumnColor,o.floatingGridRowColor),this.drawCellBackgroundsForItems(t,e,c,a),this.drawFloatingBorders(t,e),r>0&&this.drawSelectedRanges(t,e,{top:0,bottom:r-1,maxY:B(u,r-1)+B(m,r-1)-.5}),l>0&&this.drawSelectedRanges(t,e,{top:d-l-1,bottom:d-1,minY:B(u,d-l)+.5,maxY:B(u,d-1)+B(m,d-1)-.5});for(let p=0;p<c.length;p+=1){const g=c[p];for(let f=0;f<a.length;f+=1){const b=a[f];this.drawCellContent(t,e,g,b)}}}}drawFloatingColumns(t,e){const{draggingRow:n,draggingColumn:s,metrics:i,theme:o}=e,{floatingLeftColumnCount:r,floatingRightColumnCount:l,floatingLeftWidth:a,floatingRightWidth:d,floatingColumns:c,gridX:u,maxX:m,columnCount:p,visibleRows:g,allColumnXs:f,allColumnWidths:b,width:C,height:S}=i;if(c.length!==0){o.floatingRowBackgroundColors&&(this.drawRowStripesForRows(t,e,g,o.floatingRowBackgroundColors,0,a),this.drawRowStripesForRows(t,e,g,o.floatingRowBackgroundColors,C-u-d,m)),n==null&&s==null&&this.drawFloatingMouseRowHover(t,e),t.save(),t.beginPath(),t.rect(0,0,a,S),t.clip(),this.drawGridLinesForItems(t,e,c,g,o.floatingGridColumnColor,o.floatingGridRowColor),t.restore(),this.drawCellBackgroundsForItems(t,e,c,g),this.drawFloatingBorders(t,e),r>0&&this.drawSelectedRanges(t,e,{left:0,maxX:B(f,r-1)+B(b,r-1)}),l>0&&this.drawSelectedRanges(t,e,{left:p-l,right:p-1,minX:B(f,p-l)+.5,maxX:B(f,p-1)+B(b,p-1)});for(let v=0;v<c.length;v+=1){const y=c[v];for(let E=0;E<g.length;E+=1){const I=g[E];this.drawCellContent(t,e,y,I)}}}}drawFloatingBorders(t,e){const{metrics:n,theme:s}=e,{floatingTopRowCount:i,floatingBottomRowCount:o,floatingLeftColumnCount:r,floatingRightColumnCount:l,rowCount:a,columnCount:d,allRowYs:c,allColumnXs:u,allRowHeights:m,allColumnWidths:p,maxX:g,maxY:f}=n,{floatingDividerOuterColor:b,floatingDividerInnerColor:C}=s;if(t.lineWidth=3,t.beginPath(),t.strokeStyle=b,i>0){const S=B(c,i-1)+B(m,i-1)+.5;t.moveTo(0,S),t.lineTo(g,S)}if(o>0){const S=B(c,a-o)-.5;t.moveTo(0,S),t.lineTo(g,S)}if(r>0){const S=B(u,r-1)+B(p,r-1)+.5;t.moveTo(S,0),t.lineTo(S,f)}if(l>0){const S=B(u,d-l)-.5;t.moveTo(S,0),t.lineTo(S,f)}if(t.stroke(),t.beginPath(),t.lineWidth=1,t.strokeStyle=C,i>0){const S=B(c,i-1)+B(m,i-1)+.5;t.moveTo(0,S),t.lineTo(g,S)}if(o>0){const S=B(c,a-o)-.5;t.moveTo(0,S),t.lineTo(g,S)}if(r>0){const S=B(u,r-1)+B(p,r-1)+.5;t.moveTo(S,0),t.lineTo(S,f)}if(l>0){const S=B(u,d-l)-.5;t.moveTo(S,0),t.lineTo(S,f)}t.stroke()}drawGridBackground(t,e,n=!1){this.drawRowStripes(t,e),n&&(this.drawMouseColumnHover(t,e),this.drawMouseRowHover(t,e)),this.drawGridLines(t,e),this.drawCellBackgrounds(t,e);const{metrics:s}=e,{bottom:i,right:o,floatingBottomRowCount:r,floatingLeftColumnCount:l,floatingRightColumnCount:a,floatingTopRowCount:d,columnCount:c,rowCount:u,allRowHeights:m,allRowYs:p,allColumnXs:g,allColumnWidths:f,width:b,height:C}=s;this.drawSelectedRanges(t,e,{bottom:Math.min(i,u-r-1),right:Math.min(o,c-a-1),minX:l>0&&g.has(l+1)?B(g,l+1):-10,minY:d>0&&p.has(d+1)?B(p,d+1):-10,maxX:a>0&&g.has(c-a-1)?B(g,c-a-1)+B(f,c-a-1)-.5:b+10,maxY:r>0&&p.has(u-r-1)?B(p,u-r-1)+B(m,u-r-1)-.5:C+10})}drawRowStripes(t,e){const{metrics:n,theme:s}=e,{visibleRows:i}=n,{rowBackgroundColors:o}=s;!o||this.drawRowStripesForRows(t,e,i,o)}drawRowStripesForRows(t,e,n,s,i=0,o=e.metrics.maxX){const{theme:r,metrics:l,model:a}=e,{maxDepth:d,shadowBlur:c,shadowColor:u}=r,m=this.getCachedBackgroundColors(s,d),{allRowYs:p,allRowHeights:g}=l,f=new Map,b=[],C=[],S=(v,y)=>{const E=gt(a)?a.depthForRow(v):0,I=m[v%m.length],R=I[Math.min(E,I.length-1)];if(f.has(R)||f.set(R,[]),f.get(R).push(v),y!=null){const N=gt(a)?a.depthForRow(y):0;N<E?b.push(v):N>E&&C.push(y)}};for(let v=0;v<n.length;v+=1){const y=n[v],E=v>0?n[v-1]:void 0;S(y,E)}if(f.forEach((v,y)=>{t.fillStyle=y,t.beginPath();for(let E=0;E<v.length;E+=1){const I=v[E],R=B(p,I),N=B(g,I);t.rect(i,R,o,N)}t.fill()}),b.length>0){t.save();const v=this.getCachedColorWithAlpha(u,.15),y=this.getCachedColorWithAlpha(u,0),E=t.createLinearGradient(0,0,0,c);E.addColorStop(0,v),E.addColorStop(1,y),t.fillStyle=E;for(let I=0;I<b.length;I+=1){const R=b[I],N=B(p,R);t.translate(0,N),t.fillRect(i,0,o,c),t.translate(0,-N)}t.restore()}if(C.length>0){t.save();const v=this.getCachedColorWithAlpha(u,0),y=this.getCachedColorWithAlpha(u,.15),E=t.createLinearGradient(0,0,0,c);E.addColorStop(0,v),E.addColorStop(1,y),t.fillStyle=E;for(let I=0;I<C.length;I+=1){const R=C[I],N=B(p,R),F=B(g,R),P=N+F-c;t.translate(0,P),t.fillRect(i,0,o,c),t.translate(0,-P)}t.restore()}}drawMouseColumnHover(t,e){const{mouseX:n,mouseY:s,theme:i,metrics:o}=e;if(n==null||s==null)return;const r=J.getColumnAtX(n,o);if(r==null||i.columnHoverBackgroundColor==null)return;const{allColumnWidths:l,allColumnXs:a,maxY:d}=o;if(s>d)return;const c=B(a,r),u=B(l,r);t.fillStyle=i.columnHoverBackgroundColor,t.fillRect(c,0,u,d)}drawMouseRowHover(t,e){const{mouseX:n,mouseY:s,theme:i,metrics:o}=e;if(n==null||s==null)return;const{maxX:r}=o;if(n>r||i.rowHoverBackgroundColor==null)return;const l=J.getRowAtY(s,o);l!=null&&this.drawMouseRowHoverForRow(t,e,l)}drawFloatingMouseRowHover(t,e){const{mouseX:n,mouseY:s,theme:i,metrics:o}=e,{maxX:r,floatingTopRowCount:l,floatingBottomRowCount:a,rowCount:d,rowFooterWidth:c}=o;if(n==null||s==null||n>r+c||i.rowHoverBackgroundColor==null)return;const u=J.getRowAtY(s,o);u!=null&&(u<l||d-a<=u)&&this.drawMouseRowHoverForRow(t,e,u)}drawMouseRowHoverForRow(t,e,n){const{metrics:s,selectedRanges:i,theme:o}=e,{allRowHeights:r,allRowYs:l,maxX:a}=s,d=B(l,n),c=B(r,n);o.rowHoverBackgroundColor!=null&&(t.fillStyle=o.rowHoverBackgroundColor);for(let u=0;u<i.length;u+=1){const{startRow:m,endRow:p}=i[u];if(m!=null&&p!=null&&m<=n&&p>=n){o.selectedRowHoverBackgroundColor!=null&&(t.fillStyle=o.selectedRowHoverBackgroundColor);break}}t.fillRect(0,d,a,c)}drawGridLines(t,e){const{metrics:n,theme:s}=e,{visibleColumns:i,visibleRows:o}=n;this.drawGridLinesForItems(t,e,i,o,s.gridColumnColor,s.gridRowColor)}drawGridLinesForItems(t,e,n,s,i,o){i==null&&o==null||(t.lineWidth=1,t.beginPath(),i!=null&&(t.strokeStyle=i,this.drawGridLinesForColumns(t,e,n)),o!=null&&(t.strokeStyle=o,this.drawGridLinesForRows(t,e,s)),t.stroke())}drawGridLinesForColumns(t,e,n){const{metrics:s}=e,{allColumnXs:i,maxY:o}=s;for(let r=0;r<n.length;r+=1){const l=n[r],a=B(i,l)+.5;t.moveTo(a,0),t.lineTo(a,o)}}drawGridLinesForRows(t,e,n){const{metrics:s}=e,{allRowYs:i,maxX:o}=s,r=o;for(let l=0;l<n.length;l+=1){const a=n[l],d=B(i,a)+.5;t.moveTo(.5,d),t.lineTo(r-.5,d)}}drawCellBackgrounds(t,e){const{metrics:n}=e,{visibleColumns:s,visibleRows:i}=n;this.drawCellBackgroundsForItems(t,e,s,i)}drawCellBackgroundsForItems(t,e,n,s){t.save();for(let i=0;i<n.length;i+=1){const o=n[i];for(let r=0;r<s.length;r+=1){const l=s[r],a=r+1<s.length?s[r+1]:void 0;this.drawCellBackground(t,e,o,l,a)}}t.restore()}drawCellBackground(t,e,n,s,i){const{metrics:o,model:r,theme:l}=e,{firstColumn:a,modelColumns:d,modelRows:c,allColumnXs:u,allColumnWidths:m,allRowYs:p,allRowHeights:g}=o,f=B(c,s),b=B(d,n),C=r.backgroundColorForCell(b,f,l),S=n===a,v=gt(r)&&r.hasExpandableRows;if(C!=null){const y=B(u,n)+1,E=B(p,s)+1,I=B(m,n)-1,R=B(g,s)-1;t.fillStyle=C,t.fillRect(y,E,I,R)}S&&v&&this.drawCellRowTreeDepthLines(t,e,s,i)}drawCellContents(t,e){const{metrics:n}=e,{visibleColumns:s}=n;for(let i=0;i<s.length;i+=1){const o=s[i];this.drawColumnCellContents(t,e,o)}}drawColumnCellContents(t,e,n){const{metrics:s}=e,{allColumnXs:i,allColumnWidths:o,visibleRows:r,height:l}=s,a=B(i,n),d=B(o,n);t.save(),t.beginPath(),t.rect(a,0,d,l),t.clip();for(let c=0;c<r.length;c+=1){const u=r[c];this.drawCellContent(t,e,n,u)}t.restore()}getTextRenderMetrics(t,e,n,s){const{textAlign:i}=t,{metrics:o,model:r,theme:l}=e,{firstColumn:a,allColumnXs:d,allColumnWidths:c,allRowYs:u,allRowHeights:m}=o,{cellHorizontalPadding:p,treeDepthIndent:g,treeHorizontalPadding:f}=l,b=B(d,n),C=B(u,s),S=B(c,n),v=B(m,s),y=n===a;let E=0;gt(r)&&r.hasExpandableRows&&y&&(E=g*(r.depthForRow(s)+1)+f);const I=S-E;let R=b+p;const N=C+v*.5;return i==="right"?R=b+I-p:i==="center"&&(R=b+I*.5),R+=E,{width:I-p*2,x:R,y:N}}drawCellContent(t,e,n,s,i){var y;const{metrics:o,model:r,theme:l}=e,{firstColumn:a,fontWidths:d,modelColumns:c,modelRows:u,allRowHeights:m}=o,{textColor:p}=l,g=B(m,s),f=B(u,s),b=B(c,n),C=i!=null?i:r.textForCell(b,f),S=r.truncationCharForCell(b,f),v=n===a;if(C&&g>0){const E=r.textAlignForCell(b,f)||"left";t.textAlign=E;const I=r.colorForCell(b,f,l)||p;t.fillStyle=I;const{width:R,x:N,y:F}=this.getTextRenderMetrics(t,e,n,s),P=(y=d.get(t.font))!=null?y:us.DEFAULT_FONT_WIDTH,H=this.getCachedTruncatedString(t,C,R,P,S);H&&t.fillText(H,N,F)}v&&gt(r)&&r.hasExpandableRows&&this.drawCellRowTreeMarker(t,e,s)}drawCellRowTreeMarker(t,e,n){const{metrics:s,model:i,mouseX:o,mouseY:r,theme:l}=e,{firstColumn:a,gridX:d,gridY:c,allColumnXs:u,allColumnWidths:m,allRowYs:p,allRowHeights:g,visibleRowTreeBoxes:f}=s,{treeMarkerColor:b,treeMarkerHoverColor:C}=l,S=B(u,a),v=B(m,a),y=B(p,n),E=B(g,n);if(!gt(i)||!i.isRowExpandable(n))return;const I=B(f,n),R=o!=null&&r!=null&&o>=d+S&&o<=d+S+v&&r>=c+y&&r<=c+y+E?C:b;this.drawTreeMarker(t,e,S,y,I,R,i.isRowExpanded(n))}drawTreeMarker(t,e,n,s,i,o,r){const{x1:l,y1:a,x2:d,y2:c}=i,u=r?"\u229F":"\u229E",m=n+(l+d)*.5+.5,p=s+(a+c)*.5+.5;t.fillStyle=o,t.textAlign="center",t.fillText(u,m,p)}drawCellRowTreeDepthLines(t,e,n,s){const{metrics:i,model:o,theme:r}=e;if(!gt(o))return;const l=o.depthForRow(n);if(l===0)return;const{firstColumn:a,allColumnXs:d,allRowYs:c,allRowHeights:u}=i,{treeDepthIndent:m,treeHorizontalPadding:p,treeLineColor:g}=r,f=B(d,a),b=B(c,n),C=B(u,n),S=s!==void 0?o.depthForRow(s):0,v=l>S?l-S:0;if(t.strokeStyle=g,t.lineWidth=1,l-v>0){t.beginPath();for(let y=0;y<l-v;y+=1){const E=f+y*m+m*.5+p+.5;t.moveTo(E,b),t.lineTo(E,b+C)}t.stroke()}if(v>0){t.beginPath();for(let y=l-v;y<l;y+=1){const E=f+y*m+m*.5+p+.5;t.moveTo(E,b),t.lineTo(E,b+Math.ceil(C/2)),t.moveTo(E-.5,b+Math.ceil(C/2)+.5),t.lineTo(E+m-.5,b+Math.ceil(C/2)+.5)}t.stroke()}}drawHeaders(t,e){const{theme:n}=e;t.font=n.headerFont,this.drawColumnHeaders(t,e),this.drawRowHeaders(t,e)}drawFooters(t,e){const{theme:n}=e;t.font=n.headerFont,this.drawRowFooters(t,e)}drawColumnHeaders(t,e){const{mouseX:n,mouseY:s,theme:i,metrics:o,draggingColumnSeparator:r,isDragging:l,model:a}=e,{columnHeaderHeight:d,floatingColumns:c,gridX:u,width:m,visibleColumns:p,allColumnWidths:g,allColumnXs:f,floatingLeftColumnCount:b,floatingLeftWidth:C,floatingRightWidth:S,modelColumns:v,columnHeaderMaxDepth:y}=o;if(d<=0)return;const{headerHiddenSeparatorSize:E,headerHiddenSeparatorHoverColor:I,headerSeparatorColor:R,headerSeparatorHoverColor:N}=i,F=d*.5,P=d*(y-1)+d*.5-F*.5,H=b>0;if(t.save(),this.drawColumnHeadersForRange(t,e,[p[0],p[p.length-1]],{minX:u+C,maxX:m-S}),H&&this.drawColumnHeadersForRange(t,e,[c[0],c[c.length-1]],{minX:u,maxX:u+C}),R){t.strokeStyle=R;const x=[...g.entries()].filter(([A,k])=>k===0).map(([A])=>A);t.beginPath(),t.fillStyle=R;for(let A=0;A<x.length;A+=1){const k=x[A],G=B(f,k),V=B(g,k),O=u+G+V+.5-E*.5;t.rect(O,P,E,F)}t.fill()}if(N){let{index:x,depth:A}=r!=null?r:{};if(x==null&&n!=null&&s!=null){const G=Ql.getColumnSeparator(J.getGridPointFromXY(n,s,o),o,a,i);x=G==null?void 0:G.index,A=G==null?void 0:G.depth}let k;if(x==null)k=!1;else{const G=v.get(x),V=v.get(x+1);G==null||V==null?k=!1:k=a.textForColumnHeader(G,A)!==a.textForColumnHeader(V,A)}if(k&&x!=null&&A!=null&&(!l||r!=null)){t.strokeStyle=N;const G=B(f,x),V=B(g,x),O=u+G+V+.5,$=p.indexOf(x),Y=$<p.length-1?p[$+1]:null,Q=Y!=null?g.get(Y):null,U=V===0,q=Q!=null&&Q===0;U?(t.strokeStyle=I,t.fillStyle=I,t.fillRect(O,P,E*.5,F)):q&&(t.fillStyle=N,t.fillRect(O-E*.5,P,E*.5,F)),t.beginPath(),t.moveTo(O,(y-A-1)*d),t.lineTo(O,(y-A)*d-1),t.stroke()}}t.restore()}drawColumnHeadersForRange(t,e,n,s){const{model:i}=e,{columnHeaderMaxDepth:o}=i;if(o!==0)for(let r=0;r<=o;r+=1)this.drawColumnHeadersAtDepth(t,e,n,s,r)}drawColumnHeadersAtDepth(t,e,n,s,i){var R,N,F,P,H,x;const{metrics:o,model:r,theme:l}=e,{modelColumns:a,allColumnXs:d,gridX:c,calculatedColumnWidths:u,userColumnWidths:m,allColumnWidths:p,movedColumns:g}=o,{columnHeaderHeight:f,columnWidth:b}=l,{columnHeaderMaxDepth:C}=r,{minX:S,maxX:v}=s,y=v-S;if(C===0)return;const E=n[0],I=n[1];if(t.save(),t.translate(0,(C-i-1)*f),i===0){this.drawColumnHeader(t,e,"",S,v);for(let A=E;A<=I;A+=1)this.drawColumnHeaderAtIndex(t,e,A,s)}if(i>0){let A=E;for(;A<=I;){const{columnCount:k}=o,G=B(a,A),V=r.textForColumnHeader(G,i),O=r.colorForColumnHeader(G,i);let $=B(d,A)+c,Y=$+B(p,A);if(V!=null){let Q=A-1;for(;Q>=0&&(Y-$<y||$>S);){const te=(R=a.get(Q))!=null?R:J.getModelIndex(Q,g);if(te==null||r.textForColumnHeader(te,i)!==V)break;$-=(F=(N=m.get(te))!=null?N:u.get(te))!=null?F:b,Q-=1}let U=A+1;for(;U<k&&(Y-$<y||Y<v);){const te=(P=a.get(U))!=null?P:J.getModelIndex(U,g);if(r.textForColumnHeader(te,i)!==V)break;Y+=(x=(H=m.get(te))!=null?H:u.get(te))!=null?x:b,U+=1}A=U-1;const q=Y-$>=y;let j=$;q&&(Y<v?j=Y-y:$<S&&(j=S)),this.drawColumnHeader(t,e,V,j,Math.min(Y-$,y),{backgroundColor:O!=null?O:void 0},s)}A+=1}}t.restore()}drawColumnHeaderAtIndex(t,e,n,s){var g;const{metrics:i,model:o}=e,{modelColumns:r,allColumnWidths:l,allColumnXs:a,gridX:d}=i,c=B(l,n),u=B(a,n)+d,m=B(r,n),p=o.textForColumnHeader(m);p!=null&&this.drawColumnHeader(t,e,p,u,c,{backgroundColor:(g=o.colorForColumnHeader(m))!=null?g:void 0},s)}drawColumnHeader(t,e,n,s,i,o,r){var U;if(i<=0)return;const{metrics:l,theme:a}=e,{headerHorizontalPadding:d,columnHeaderHeight:c,headerBackgroundColor:u,headerColor:m,headerSeparatorColor:p,black:g,white:f}=a,{fontWidths:b,width:C}=l,S=(U=b.get(t.font))!=null?U:us.DEFAULT_FONT_WIDTH,y=(i-d*2)/S,{backgroundColor:E=u,separatorColor:I=p}=o!=null?o:{};let{textColor:R=m}=o!=null?o:{};try{const q=this.getCachedColorIsDark(E),j=this.getCachedColorIsDark(R);q&&j?R=f:!q&&!j&&(R=g)}catch{}let{minX:N=0,maxX:F=C}=r!=null?r:{};t.save(),t.rect(N,0,F-N,c),t.clip(),E!=null&&(t.fillStyle=E,t.fillRect(s,0,i,c)),I!=null&&(t.strokeStyle=I,t.beginPath(),s>0&&(t.moveTo(s+.5,0),t.lineTo(s+.5,c)),t.moveTo(s+i+.5,0),t.lineTo(s+i+.5,c),t.moveTo(s,c-.5),t.lineTo(s+i,c-.5),t.stroke()),t.beginPath(),t.rect(s,0,i,c),t.clip(),t.fillStyle=R;let P=n;y<=0?P="":P.length>y&&(P=`${P.substring(0,y-1)}\u2026`);const H=P.length*S;let x=s+i*.5;const A=c*.5;N+=d,F-=d;const k=s+d,G=Je(k,N,F),V=s+i-d,$=Je(V,N,F)-G,Y=x-H*.5<N,Q=x+H*.5>F;Y?H<$?x=N+H*.5:x=V-H*.5:Q&&(H<$?x=F-H*.5:x=k+H*.5),t.textAlign="center",t.fillText(P,x,A),t.restore()}drawRowHeaders(t,e){const{mouseX:n,mouseY:s,metrics:i,theme:o,draggingRowSeparator:r}=e,{gridY:l,rowHeaderWidth:a,height:d,visibleRows:c,allRowHeights:u,allRowYs:m}=i;if(a<=0)return;const{headerBackgroundColor:p,headerColor:g,headerHiddenSeparatorSize:f,headerHiddenSeparatorHoverColor:b,headerSeparatorColor:C,headerSeparatorHoverColor:S}=o,v=a*.5,y=a*.5-v*.5;if(t.save(),t.beginPath(),t.fillStyle=p,t.fillRect(0,0,a,d),C){t.strokeStyle=C,t.beginPath(),t.moveTo(0,l+.5),t.lineTo(a,l+.5);const E=[];let I=!1;for(let R=0;R<c.length;R+=1){const N=c[R],F=B(m,N),P=B(u,N);if(P>0){const H=l+F+P+.5;t.moveTo(0,H),t.lineTo(a,H),I=!1}else I||(I=!0,E.push(N))}t.moveTo(a-.5,0),t.lineTo(a-.5,d),t.stroke(),t.beginPath(),t.fillStyle=C;for(let R=0;R<E.length;R+=1){const N=E[R],F=B(m,N),P=B(u,N),H=l+F+P+.5-f*.5;t.rect(y,H,v,f)}t.fill()}if(S){let{index:E=null}=r!=null?r:{};if(E==null&&n!=null&&s!=null&&(E=J.getRowSeparatorIndex(n,s,i,o)),E!=null){t.strokeStyle=S;const I=B(m,E),R=B(u,E),N=l+I+R+.5,F=c.indexOf(E),P=F<c.length-1?c[F+1]:null,H=P!=null?u.get(P):null,x=R===0,A=H!=null&&H===0;x?(t.strokeStyle=b,t.fillStyle=b,t.fillRect(y,N,v,f*.5)):A&&(t.fillStyle=S,t.fillRect(y,N-f*.5,v,f*.5)),t.beginPath(),t.moveTo(.5,N),t.lineTo(a+.5,N),t.stroke()}}t.beginPath(),t.rect(0,l,a,d),t.clip(),t.fillStyle=g,t.textAlign="right";for(let E=0;E<c.length;E+=1){const I=c[E],R=B(u,I),N=B(m,I)+l;this.drawRowHeader(t,e,I,N,R)}t.restore()}drawRowHeader(t,e,n,s,i){if(i<=0)return;const{metrics:o,model:r,theme:l}=e,{modelRows:a,rowHeaderWidth:d}=o,c=B(a,n),u=d-l.cellHorizontalPadding,m=s+i*.5;t.fillText(r.textForRowHeader(c),u,m)}drawRowFooters(t,e){const{mouseX:n,mouseY:s,metrics:i,model:o,theme:r,draggingRowSeparator:l}=e,{gridY:a,gridX:d,maxX:c,modelRows:u,rowFooterWidth:m,height:p,verticalBarWidth:g,visibleRows:f,allRowHeights:b,allRowYs:C,width:S}=i;if(m<=0)return;const{cellHorizontalPadding:v,headerBackgroundColor:y,headerColor:E,headerHiddenSeparatorSize:I,headerHiddenSeparatorHoverColor:R,headerSeparatorColor:N,headerSeparatorHoverColor:F}=r,P=m*.5,H=m*.5-P*.5,x=Math.min(d+c,S-m-g);if(t.save(),t.beginPath(),t.fillStyle=y,t.fillRect(x,a,m,p),N){t.strokeStyle=N,t.beginPath(),t.moveTo(x,a+.5),t.lineTo(m,a+.5);const k=[];let G=!1;for(let V=0;V<f.length;V+=1){const O=f[V],$=B(C,O),Y=B(b,O);if(Y>0){const Q=a+$+Y+.5;t.moveTo(x+.5,Q),t.lineTo(x+m-.5,Q),G=!1}else G||(G=!0,k.push(O))}t.moveTo(x+.5,a),t.lineTo(x+.5,p),t.stroke(),t.beginPath(),t.fillStyle=N;for(let V=0;V<k.length;V+=1){const O=k[V],$=B(C,O),Y=B(b,O),Q=a+$+Y+.5-I*.5;t.rect(x+H,Q,P,I)}t.fill()}if(F){let{index:k=null}=l!=null?l:{};if(k==null&&n!=null&&s!=null&&(k=J.getRowSeparatorIndex(n,s,i,r)),k!=null){t.strokeStyle=F;const G=B(C,k),V=B(b,k),O=a+G+V+.5,$=f.indexOf(k),Y=$<f.length-1?f[$+1]:null,Q=Y!=null?b.get(Y):null,U=V===0,q=Q!=null&&Q===0;U?(t.strokeStyle=R,t.fillStyle=R,t.fillRect(H,O,P,I*.5)):q&&(t.fillStyle=F,t.fillRect(H,O-I*.5,P,I*.5)),t.beginPath(),t.moveTo(x+.5,O),t.lineTo(x+m+.5,O),t.stroke()}}t.beginPath(),t.rect(x,a,m,p),t.clip(),t.fillStyle=E,t.textAlign="left";const A=x+v;for(let k=0;k<f.length;k+=1){const G=f[k],V=B(b,G);if(V>0){const O=B(C,G)+a,$=B(u,G),Y=O+V*.5;t.fillText(o.textForRowFooter($),A,Y)}}t.restore()}drawSelectedRanges(t,e,n={}){const{cursorColumn:s,cursorRow:i,draggingRow:o,draggingColumn:r,editingCell:l,metrics:a,model:d,selectedRanges:c,theme:u}=e,{allColumnWidths:m,allColumnXs:p,allRowHeights:g,allRowYs:f,width:b,height:C}=a,{left:S=a.left,top:v=a.top,right:y=a.right,bottom:E=a.bottom,minY:I=-10,maxY:R=C+10,minX:N=-10,maxX:F=b+10}=n;if(c.length===0)return;const P=tt(d)&&d.isEditable&&l==null&&o==null&&r==null&&s!=null&&i!=null&&p.has(s)&&f.has(i);if(P){const H=B(p,s),x=B(f,i),A=B(m,s),k=B(g,i);t.save(),t.beginPath(),t.rect(0,0,b,C),t.rect(H,x,A,k),t.clip("evenodd")}t.beginPath();for(let H=0;H<c.length;H+=1){const x=c[H],A=x.startColumn!==null?x.startColumn:S,k=x.startRow!==null?x.startRow:v,G=x.endColumn!==null?x.endColumn:y,V=x.endRow!==null?x.endRow:E;if(V>=v&&E>=k&&G>=S&&y>=A){const O=A>=S&&p.has(A)?Math.round(B(p,A))+.5:N,$=k>=v&&f.has(k)?Math.max(Math.round(B(f,k))+.5,.5):I,Y=G<=y&&p.has(G)?Math.round(B(p,G)+B(m,G))-.5:F,Q=V<=E&&f.has(V)?Math.round(B(f,V)+B(g,V))-.5:R;t.rect(O,$,Y-O,Q-$)}t.fillStyle=u.selectionColor,t.fill(),t.save(),t.clip(),t.strokeStyle=u.selectionOutlineCasingColor,t.lineWidth=3,t.stroke(),t.restore(),t.strokeStyle=u.selectionOutlineColor,t.lineWidth=1,t.stroke()}P&&s!=null&&i!=null&&(t.restore(),this.drawActiveCell(t,e,s,i))}drawActiveCell(t,e,n,s,i=us.ACTIVE_CELL_BORDER_WIDTH){const{metrics:o,theme:r}=e,{allColumnWidths:l,allColumnXs:a,allRowHeights:d,allRowYs:c}=o,u=B(a,n),m=B(c,s),p=B(l,n),g=B(d,s);let f=u-i*.5,b=m-i*.5,C=p+i,S=g+i;f<=0&&(C+=f-1,f=1),b<=0&&(S+=b-1,b=1);const{lineWidth:v}=t;t.beginPath(),t.lineWidth=i,t.strokeStyle=r.selectionOutlineColor,this.drawRoundedRect(t,f,b,C,S),t.stroke(),t.lineWidth=v}drawRoundedRect(t,e,n,s,i,o=us.DEFAULT_EDGE_RADIUS){t.beginPath(),t.moveTo(e+o,n),t.lineTo(e+s-o,n),t.quadraticCurveTo(e+s,n,e+s,n+o),t.lineTo(e+s,n+i-o),t.quadraticCurveTo(e+s,n+i,e+s-o,n+i),t.lineTo(e+o,n+i),t.quadraticCurveTo(e,n+i,e,n+i-o),t.lineTo(e,n+o),t.quadraticCurveTo(e,n,e+o,n),t.closePath()}drawDraggingColumn(t,e){var Q;const{draggingColumn:n,metrics:s,mouseX:i,theme:o,model:r}=e;if(n==null||i==null)return;const{range:l,depth:a}=n,{gridX:d,gridY:c,allColumnXs:u,allColumnWidths:m,height:p,width:g,columnHeaderMaxDepth:f,columnHeaderHeight:b,movedColumns:C,modelColumns:S,floatingLeftWidth:v}=s,y=(Q=S.get(l[0]))!=null?Q:J.getModelIndex(l[0],C),E=r.getColumnHeaderGroup(y,a);if(a>0&&!E)return;const[I,R]=l,N=B(u,I),P=B(u,R)+B(m,R)-N,H=n.left,{backgroundColor:x,font:A,headerFont:k,reorderOffset:G,shadowBlur:V,shadowColor:O}=o,$=(f-a-1)*b;t.save(),t.translate(d,0),t.save(),t.beginPath(),t.rect(v,0,g,p),t.clip(),t.fillStyle=x,t.fillRect(N,$,P,p),t.restore(),t.translate(0,G),t.save(),t.shadowColor=O,t.shadowBlur=V,t.fillStyle=x,t.fillRect(n.left,$+G,n.width,p),t.restore(),t.beginPath(),t.rect(n.left,$,n.width+1,p),t.clip(),t.translate(H-N,0),t.font=k;const Y=[];for(let U=n.range[0];U<=n.range[1];U+=1)Y.push(U);this.drawColumnHeaders(t,e),this.drawColumnHeadersForRange(t,e,[Y[0],Y[Y.length-1]],{minX:N,maxX:g}),t.translate(0,c),t.font=A,this.drawGridBackground(t,e);for(let U=I;U<=R;U+=1)this.drawColumnCellContents(t,e,U);t.restore()}drawDraggingRow(t,e){const{draggingRow:n,draggingRowOffset:s,metrics:i,mouseY:o,theme:r}=e;if(n==null||o==null)return;const{gridX:l,gridY:a,allRowYs:d,allRowHeights:c,width:u}=i,m=B(d,n),p=B(c,n)+1,{backgroundColor:g,font:f,headerFont:b,reorderOffset:C,shadowBlur:S,shadowColor:v}=r;t.save(),t.translate(0,a),t.fillStyle=g,t.fillRect(0,m,u,p),t.translate(l+C,o-m-a-(s!=null?s:0)),t.save(),t.shadowColor=v,t.shadowBlur=S,t.fillStyle=g,t.fillRect(-l,m,u,p),t.restore(),t.beginPath(),t.rect(-l,m,u,p),t.clip(),t.font=f,this.drawGridBackground(t,e),this.drawCellContents(t,e),t.translate(-l,-a),t.font=b,this.drawRowHeaders(t,e),t.restore()}drawScrollBars(t,e){const{isDraggingHorizontalScrollBar:n,isDraggingVerticalScrollBar:s,isDragging:i,metrics:o,mouseX:r,mouseY:l,theme:a}=e;if(a.scrollBarSize<=0)return;const{width:d,height:c,handleHeight:u,handleWidth:m,scrollX:p,scrollY:g,hasHorizontalBar:f,hasVerticalBar:b,barWidth:C,barHeight:S,barLeft:v,barTop:y}=o,{scrollBarBackgroundColor:E,scrollBarHoverBackgroundColor:I,scrollBarCasingColor:R,scrollBarCornerColor:N,scrollBarColor:F,scrollBarHoverColor:P,scrollBarActiveColor:H,scrollBarSize:x,scrollBarHoverSize:A,scrollBarCasingWidth:k,scrollBarSelectionTick:G,scrollBarSelectionTickColor:V,scrollBarActiveSelectionTickColor:O,autoSelectRow:$,autoSelectColumn:Y}=a,Q=r!=null&&l!=null&&r<=d&&l<=c,U=s||b&&!n&&!i&&r!=null&&l!=null&&r>=d-A&&l>=y&&Q,q=n||f&&!s&&!i&&!U&&r!=null&&l!=null&&l>=c-A&&r>=v&&Q,j=q?A:x,te=U?A:x;if(t.translate(v,y),f&&b&&(t.fillStyle=R,t.fillRect(d-v-x,c-y-x,x,x),t.fillStyle=N,t.fillRect(d-v-x+k,c-y-x+k,x-k,x-k)),f){const ce=p,ne=c-y-j;if(t.fillStyle=R,t.fillRect(0,ne,C,j-k),t.fillStyle=q?I:E,t.fillRect(0,ne+k,C,j-k),n?t.fillStyle=H:q?t.fillStyle=P:t.fillStyle=F,t.fillRect(ce,ne+k,m,j-k),!$&&G&&V!=null&&O!=null){t.fillStyle=V;const{selectedRanges:he,cursorColumn:Ce}=e,{lastLeft:Re,columnCount:He}=o,Ve=[...he].filter(Me=>Me.startColumn!=null&&Me.endColumn!=null).map(Me=>[Me.startColumn,Me.endColumn]).sort(J.compareRanges),Ln=J.mergeSortedRanges(Ve),$t=Me=>Me<=Re?Me/Re*(C-m):C-m+(Me-Re)/(He-Re)*m;for(let Me=0;Me<Ln.length;Me+=1){const ct=Ln[Me],at=ct[0],Mt=ct[1];if(at!=null&&Mt!=null&&(at!==Ce||Mt!==Ce)){const zt=$t(at),An=Math.max(1,Math.round($t(Mt+1)-zt)),un=j-k;t.fillRect(zt,ne+k+Math.round(un/3),An,Math.round(un/3))}}if(Ce!=null){const Me=$t(Ce),ct=2,at=j-k;t.fillStyle=O,t.fillRect(Me,ne+k,ct,at)}}}if(b){const ce=d-v-te,ne=g;if(t.fillStyle=R,t.fillRect(ce,0,te-k,S),t.fillStyle=U?I:E,t.fillRect(ce+k,0,te-k,S),s?t.fillStyle=H:U?t.fillStyle=P:t.fillStyle=F,t.fillRect(ce+k,ne,te-k,u),!Y&&G&&V!=null&&O!=null){const{selectedRanges:he,cursorRow:Ce}=e,{lastTop:Re,rowCount:He}=o,lt=Me=>Me<=Re?Me/Re*(S-u):S-u+(Me-Re)/(He-Re)*u;t.fillStyle=V;const Ln=[...he].filter(Me=>Me.startRow!=null&&Me.endRow!=null).map(Me=>[Me.startRow,Me.endRow]).sort(J.compareRanges),$t=J.mergeSortedRanges(Ln);for(let Me=0;Me<$t.length;Me+=1){const ct=$t[Me],at=ct[0],Mt=ct[1];if(at!=null&&Mt!=null&&(at!==Ce||Mt!==Ce)){const zt=lt(at),An=te-k,un=Math.max(1,Math.round(lt(Mt+1)-zt));t.fillRect(ce+k+Math.round(An/3),zt,Math.round(An/3),un)}}if(Ce!=null){const Me=Math.round(lt(Ce)),ct=te-k,at=2;t.fillStyle=O,t.fillRect(ce+k,Me,ct,at)}}}t.translate(-v,-y)}};let to=us;to.DEFAULT_FONT_WIDTH=10;to.DEFAULT_EDGE_RADIUS=2;to.ACTIVE_CELL_BORDER_WIDTH=2;const Oh=100;class Mv extends Dt{constructor(){super(...arguments),this.hasExtendedFloating=!1}onDown(e,n,s){const{x:i,y:o,column:r,row:l}=e,{metrics:a}=n;if(!a)throw new Error("metrics not set");const{gridX:d,gridY:c,maxX:u,maxY:m}=a,p=i-d,g=o-c;if(p<0||g<0||r==null&&p>u||l==null&&g>m)return!1;const f=J.isModifierKeyDown(s),b=s.shiftKey;f||(b?n.trimSelectedRanges():n.clearSelectedRanges());const C=n.getTheme(),{autoSelectRow:S,autoSelectColumn:v}=C;return(r!==null||!v)&&(l!==null||!S)&&(n.focus(),n.moveCursorToPosition(r,l,b,!1,b&&f)),this.startPoint=e,this.hasExtendedFloating=!1,this.dragBounds=J.getScrollDragBounds(a,l,r),!0}onDrag(e,n){if(this.startPoint===void 0)return!1;this.stopTimer();const{row:s,column:i}=this.startPoint,{x:o,y:r}=e;let{row:l,column:a}=e;const{metrics:d}=n;if(!d)throw new Error("metrics not set");const{left:c,lastLeft:u,top:m,lastTop:p,columnWidth:g,rowHeight:f}=d,b=J.getScrollDragBounds(d,s,i);let C=0,S=0;if(c<u&&(o<b.x1?C=o-b.x1:o>b.x2&&(C=o-b.x2)),m<p&&(r<b.y1?S=r-b.y1:r>b.y2&&(S=r-b.y2)),C!==0||S!==0)this.startTimer(n,e,C>0?Math.ceil(C/g):Math.floor(C/g),S>0?Math.ceil(S/f):Math.floor(S/f));else if(l!=null&&a!=null){const{floatingTopRowCount:v,floatingBottomRowCount:y,floatingLeftColumnCount:E,floatingRightColumnCount:I,columnCount:R,rowCount:N,bottom:F,right:P,topVisible:H,bottomVisible:x,leftVisible:A,rightVisible:k}=d;this.hasExtendedFloating||(s!==null&&s<v&&l>=v?(l=v,this.hasExtendedFloating=!0):s!==null&&s>=N-y&&l<N-y&&(l=N-y-1,this.hasExtendedFloating=!0),i!==null&&i<E&&a>=E?(a=E,this.hasExtendedFloating=!0):i!==null&&i>=R-I&&a<R-I&&(a=R-I-1,this.hasExtendedFloating=!0)),s!==null&&!J.isFloatingRow(s,d)&&J.isFloatingRow(l,d)&&(s>l&&l<m?l=H-1:s<l&&l>F&&(l=x+1)),i!==null&&!J.isFloatingColumn(i,d)&&J.isFloatingColumn(a,d)&&(i>a&&a<c?a=A-1:i<a&&a>P&&(a=k+1)),n.moveCursorToPosition(a,l,!0,!0)}return!0}onUp(e,n){return this.startPoint!==void 0&&(this.startPoint=void 0,this.dragBounds=void 0,this.stopTimer(),n.commitSelection()),!1}moveSelection(e,n,s,i){const{row:o,column:r}=n,{metrics:l}=e;if(!l)throw new Error("metrics not set");const{selectionEndRow:a,selectionEndColumn:d}=e.state;if(a==null||d==null)throw new Error("selection not set");const{rowCount:c,columnCount:u}=l,m=s<0&&r!=null?r:0,p=s>0&&r!=null?r:u-1,g=i<0&&o!=null?o:0,f=i>0&&o!=null?o:c-1;e.moveCursorToPosition(Math.min(Math.max(m,d+s),p),Math.min(Math.max(g,a+i),f),!0),this.lastTriggerTime=Date.now()}startTimer(e,n,s,i){this.stopTimer();const o=this.lastTriggerTime!=null?Oh-Math.min(Oh,Date.now()-this.lastTriggerTime):0;this.timer=setTimeout(()=>{this.moveSelection(e,n,s,i),this.startTimer(e,n,s,i)},o)}stopTimer(){this.timer!==void 0&&(clearTimeout(this.timer),this.timer=void 0)}}const Lh=5,Nv=1e3/60,Br=10;function xs(t,e,n,s){var v,y,E,I,R,N,F;const{modelColumns:i,movedColumns:o,allColumnXs:r,columnCount:l,allColumnWidths:a,userColumnWidths:d,calculatedColumnWidths:c,floatingLeftWidth:u,maxX:m}=n;if(e==null||t==null||t>l||t<0)return null;const p=(v=i.get(t))!=null?v:J.getModelIndex(t,o),g=s.getColumnHeaderGroup(p,e),f=g!=null;let b,C,S;if(g!=null){const[P,H]=g.getVisibleRange(o);b=(y=r.get(P))!=null?y:u,C=((E=r.get(H))!=null?E:m)+((I=a.get(H))!=null?I:0),S=[P,H]}else{const P=r.get(t);if(P==null)return null;b=P,C=b+((F=(N=(R=a.get(t))!=null?R:d.get(p))!=null?N:c.get(p))!=null?F:0),S=[t,t]}return{visibleIndex:t,modelIndex:p,left:b,right:C,width:C-b,isColumnGroup:f,range:S,depth:e}}class Fv extends Dt{constructor(){super(...arguments),this.cursor=null,this.draggingColumn=null}setScrollInterval(e,n){this.scrollingInterval!=null&&n===this.scrollingDirection||(this.scrollingDirection=n,this.scrollingInterval=window.setInterval(()=>{var f,b;const{metrics:s}=e;if(!s)return;const{left:i,lastLeft:o,leftOffset:r,userColumnWidths:l,calculatedColumnWidths:a,movedColumns:d,allColumnWidths:c}=s;let u=i,m=r;if(n==="left")for(m-=Br;m<0;){u-=1;const C=J.getModelIndex(i-1,d),S=(f=l.get(C))!=null?f:a.get(C);S===void 0?m=0:m+=S,u<0&&(m=0,u=0)}else{m+=Br;let C=c.get(i);for(;C!==void 0&&m>C;){u+=1,m-=C;const S=J.getModelIndex(i+1,d);C=(b=l.get(S))!=null?b:a.get(S),u>o&&(m=0,u=o)}}const{mouseX:p,mouseY:g}=e.state;s==null||p==null||g==null||(this.moveDraggingColumn(p,e,n==="left"?-Br:Br),e.setState({left:u,leftOffset:m}),(n==="left"&&u===0&&r===0||n==="right"&&u===o)&&this.clearScrollInterval())},Nv))}clearScrollInterval(){this.scrollingDirection=void 0,window.clearInterval(this.scrollingInterval),this.scrollingInterval=void 0}onLeave(){return this.clearScrollInterval(),!1}onDown(e,n){const{model:s}=n.props,{x:i,column:o,columnHeaderDepth:r}=e,{metrics:l}=n;if(!l)throw new Error("Metrics not set");const a=xs(o,r,l,s);if(o==null||a==null||r==null||r>0&&!a.isColumnGroup)return!1;const{rowHeaderWidth:d}=l;return this.initialGridPoint=e,this.draggingColumn=null,this.cursor=null,a.modelIndex!=null&&r!=null&&s.isColumnMovable(a.modelIndex,r)&&(this.draggingOffset=i-a.left-d,this.initialOffset=this.draggingOffset),!1}onDrag(e,n,s){if(this.draggingOffset===void 0||this.initialGridPoint===void 0||this.initialOffset===void 0)return!1;const{x:i,y:o}=e,{columnHeaderDepth:r}=this.initialGridPoint,{model:l}=n.props;let{draggingColumn:a}=this;const{metrics:d}=n;if(!d)throw new Error("Metrics not set");if(!a&&Math.abs(this.initialGridPoint.x-i)<Lh&&Math.abs(this.initialGridPoint.y-o)<Lh)return!1;if(a==null){const c=xs(this.initialGridPoint.column,r,d,l);if(!c||r==null||!l.isColumnMovable(c.modelIndex)||r>0&&!c.isColumnGroup||c.range[0]==null)return!1;a={range:c.range,depth:r,left:c.left,width:c.width};const u=xs(a.range[0],0,d,l),m=xs(a.range[1],0,d,l);if(!u||!m)return!1;this.draggingColumn=a,n.setState({draggingColumn:a,isDragging:!0})}return this.cursor="move",this.moveDraggingColumn(e.x,n,s.movementX),!0}moveDraggingColumn(e,n,s){var R,N,F,P,H;if(this.draggingOffset===void 0||this.initialGridPoint===void 0||this.initialOffset===void 0||this.draggingColumn==null||s===0)return;if(this.initialOffset!==this.draggingOffset){this.draggingOffset<this.initialOffset&&this.initialOffset<this.draggingOffset+s||this.draggingOffset>this.initialOffset&&this.initialOffset>this.draggingOffset+s?this.draggingOffset=this.initialOffset:this.draggingOffset+=s,this.draggingColumn={...this.draggingColumn,left:e-this.draggingOffset},n.setState({draggingColumn:this.draggingColumn});return}const{depth:i}=this.draggingColumn,{model:o}=n.props,{movedColumns:r}=n.state,{metrics:l}=n;if(!l)throw new Error("Metrics not set");const{floatingLeftWidth:a,width:d,columnHeaderMaxDepth:c,allColumnXs:u}=l,m=s<0,p=xs(this.draggingColumn.range[0],i,l,o);if(!p)return;const g=e-this.draggingOffset,f=g+p.width;this.draggingColumn={...this.draggingColumn,left:g},n.setState({draggingColumn:this.draggingColumn});const b=xs(J.getColumnAtX(Je(m?g:f,a,d),l,!0),i,l,o),C=o.getColumnHeaderParentGroup(p.modelIndex,p.depth);if(!b)return;if(C!==void 0){const x=C.getVisibleRange(r);if(b.visibleIndex<x[0]){const A=this.moveColumn(p,x[0],r);this.draggingOffset=e-((R=u.get(x[0]))!=null?R:0),this.draggingColumn={...this.draggingColumn,left:e-this.draggingOffset},this.clearScrollInterval(),n.setState({draggingColumn:this.draggingColumn,movedColumns:A});return}if(b.visibleIndex>x[1]){const A=this.moveColumn(p,x[1]-(p.range[1]-p.range[0]),r),{right:k=0}=(N=xs(x[1],0,l,o))!=null?N:{};this.draggingOffset=e-(k-p.width),this.draggingColumn={...this.draggingColumn,left:e-this.draggingOffset},this.clearScrollInterval(),n.setState({draggingColumn:this.draggingColumn,movedColumns:A});return}}if(!o.isColumnMovable(b.modelIndex)){let x=b.visibleIndex;if(m)for(x+=1;x<p.visibleIndex&&!o.isColumnMovable(J.getModelIndex(x,r));)x+=1;else for(x-=1;x>p.visibleIndex&&!o.isColumnMovable(J.getModelIndex(x,r));)x-=1;if(x!==p.visibleIndex){m||(x-=p.range[1]-p.range[0]);const k=this.moveColumn(p,x,r);n.setState({movedColumns:k,draggingColumn:this.draggingColumn})}const A=xs(x,0,l,o);m?this.draggingOffset=e-((F=A==null?void 0:A.left)!=null?F:0):this.draggingOffset=e-(((P=A==null?void 0:A.right)!=null?P:0)-p.width),this.draggingColumn={...this.draggingColumn,left:e-this.draggingOffset},n.setState({draggingColumn:this.draggingColumn});return}if(g<=a?this.setScrollInterval(n,"left"):f>d?this.setScrollInterval(n,"right"):this.clearScrollInterval(),b.visibleIndex===p.visibleIndex||m&&p.visibleIndex<b.visibleIndex||!m&&p.visibleIndex>b.visibleIndex)return;const S=b.left+b.width*.5,v=o.getColumnHeaderParentGroup(p.modelIndex,p.depth);let y,E=((H=v==null?void 0:v.depth)!=null?H:c)-1;for(;E>=0&&y===void 0;)y=o.getColumnHeaderGroup(b.modelIndex,E),E-=1;let I;m&&g<S&&(!y||b.visibleIndex===y.getVisibleRange(r)[0])&&(I=this.moveColumn(p,b.range[0],r)),!m&&f>S&&(!y||b.visibleIndex===y.getVisibleRange(r)[1])&&(I=this.moveColumn(p,b.range[1]-(p.range[1]-p.range[0]),r)),I&&(this.draggingColumn={...this.draggingColumn,left:g},n.setState({movedColumns:I,draggingColumn:this.draggingColumn}))}moveColumn(e,n,s){const i=e.isColumnGroup?J.moveRange(e.range,n,s):J.moveItem(e.visibleIndex,n,s),o=n-e.range[0],r=[e.range[0]+o,e.range[1]+o];return this.draggingColumn&&(this.draggingColumn={...this.draggingColumn,range:r}),i}onUp(e,n){return this.cursor=null,this.clearScrollInterval(),this.draggingOffset!=null?(this.draggingOffset=void 0,n.setState({draggingColumn:null,isDragging:!1}),!0):!1}}class Zd extends Dt{constructor(){super(...arguments),this.cursor="default"}static getLeftWithOffsetFromRawLeft(e,n){const s=e.getTheme(),{metrics:i,metricCalculator:o}=e;if(!i)throw new Error("metrics not set");if(s.scrollSnapToColumn)return{left:Math.round(n),leftOffset:0};const r=Math.floor(n),l=n-r;let a=i.allColumnWidths.get(r);if(a==null){const c=e.getMetricState();a=o.getVisibleColumnWidth(r,c)}const d=a*l;return{left:r,leftOffset:d}}isInScrollBar(e,n){const s=n.getTheme(),{scrollBarSize:i,scrollBarHoverSize:o}=s,{metrics:r}=n;if(!r)throw new Error("metrics not set");const{x:l,y:a}=e,{barLeft:d,barWidth:c,height:u,hasHorizontalBar:m}=r;return m&&i>0&&a>=u-o&&a<u&&l>d&&l<d+c}getLeftWithOffset(e,n){var f;const{metrics:s}=n;if(!s)throw new Error("metrics not set");const{x:i}=e,{barWidth:o,handleWidth:r,lastLeft:l,barLeft:a,columnCount:d,scrollableContentWidth:c,scrollableViewportWidth:u}=s,m=i-a,p=Je((m-((f=this.dragOffset)!=null?f:0))/(o-r),0,1);if(d===1)return{left:0,leftOffset:p*(c-u)};const g=p*l;return Zd.getLeftWithOffsetFromRawLeft(n,g)}onDown(e,n){const{metrics:s}=n;if(!s)throw new Error("metrics not set");const{x:i}=e,{handleWidth:o,barLeft:r,scrollX:l}=s;if(!this.isInScrollBar(e,n))return!1;const a=i-r;if(a>=l&&a<=l+o)this.dragOffset=a-l,n.setState({isDraggingHorizontalScrollBar:!0});else{this.dragOffset=0;const{left:d,leftOffset:c}=this.getLeftWithOffset(e,n);n.setViewState({left:d,leftOffset:c,isDraggingHorizontalScrollBar:!0,isDragging:!0})}return!0}onDrag(e,n){if(this.dragOffset!=null){const{left:s,leftOffset:i}=this.getLeftWithOffset(e,n);return n.setViewState({left:s,leftOffset:i,isDraggingHorizontalScrollBar:!0,isDragging:!0}),!0}return!1}onMove(e,n){return this.isInScrollBar(e,n)}onUp(e,n){return this.dragOffset!==void 0&&(this.dragOffset=void 0,n.setState({isDraggingHorizontalScrollBar:!1,isDragging:!1})),this.isInScrollBar(e,n)}onClick(e,n){return this.isInScrollBar(e,n)}}class xv extends Dt{constructor(){super(...arguments),this.cursor="move"}onDown(e,n){const{model:s}=n.props,{x:i,y:o,row:r}=e,{metrics:l}=n;if(!l)throw new Error("metrics not set");const{columnHeaderHeight:a,rowHeaderWidth:d,allRowYs:c}=l;if(i<=d&&r!==null&&s.isRowMovable(r)){const u=B(c,r);this.draggingOffset=o-u-a,n.setState({draggingRowOffset:this.draggingOffset})}return!1}onDrag(e,n){if(this.draggingOffset==null)return!1;const{model:s}=n.props;let{draggingRow:i}=n.state;const{mouseX:o,mouseY:r}=n.state;if(o==null||r==null)return!1;if(i==null){const{row:I}=n.getGridPointFromXY(o,r);if(I!=null&&!s.isRowMovable(I)||(i=I,n.setState({draggingRow:i,isDragging:!0}),i==null))return!1}const{metrics:l}=n;if(!l)throw new Error("metrics not set");const{top:a,lastTop:d,bottom:c,bottomVisible:u,rowCount:m,columnHeaderHeight:p,allRowHeights:g,allRowYs:f,height:b}=l;let C=p;if(a<i){const I=i-1;C=B(f,I)+B(g,I)*.5+p}let S=b;if(i<c){const I=i+1;S=B(f,I)+B(g,I)*.5+p}let{movedRows:v}=n.state;r<C&&i>0&&s.isRowMovable(i-1)?(v=J.moveItem(i,i-1,v),i-=1):S<r&&i<m-1&&s.isRowMovable(i+1)&&(v=J.moveItem(i,i+1,v),i+=1),n.setState({movedRows:v,draggingRow:i});const y=p+B(g,a)*.5,E=p+B(f,u)+B(g,u)*.5;return r<y&&a>0?n.setState({top:a-1}):r>E&&a<d&&n.setState({top:a+1}),!0}onUp(e,n){return this.draggingOffset!==void 0?(this.draggingOffset=void 0,n.setState({draggingRowOffset:null,draggingRow:null,isDragging:!1}),!0):!1}}class Qd extends yp{constructor(){super(...arguments),this.hiddenCursor="s-resize",this.defaultCursor="row-resize",this.pointProperty="y",this.userSizesProperty="userRowHeights",this.visibleOffsetProperty="visibleRowYs",this.visibleSizesProperty="visibleRowHeights",this.marginProperty="columnHeaderHeight",this.calculatedSizesProperty="calculatedRowHeights",this.modelIndexesProperty="modelRows",this.firstIndexProperty="firstRow",this.treePaddingProperty="treePaddingY",this.getHiddenItems=J.getHiddenRows,this.getNextShownItem=J.getNextShownRow,this.getSeparator=Qd.getRowSeparator}static getRowSeparator(e,n,s,i){if(!i.allowRowResize)return null;const{x:o,y:r}=e,l=J.getRowSeparatorIndex(o,r,n,i);return l!=null?{index:l,depth:0}:null}setSize(e,n,s){e.setRowHeight(n,s)}resetSize(e,n){e.resetRowHeight(n)}updateSeparator(e,n){e.setState({draggingRowSeparator:n,isDragging:n!==null})}}class vl extends Dt{static isInTreeBox(e,n){const{column:s,row:i,x:o,y:r}=e,{metrics:l}=n;if(!l)throw new Error("metrics not set");const{gridX:a,gridY:d,firstColumn:c,allColumnXs:u,allColumnWidths:m,allRowHeights:p,allRowYs:g,visibleRowTreeBoxes:f}=l;if(s===c&&i!=null&&f.get(i)!=null&&o>a&&r>d){const b=B(u,s),C=B(m,s),S=B(g,i),v=B(p,i);if(o>=a+b&&o<=a+b+C&&r>=d+S&&r<=d+S+v)return!0}return!1}onDown(e,n){return vl.isInTreeBox(e,n)}onClick(e,n){if(vl.isInTreeBox(e,n)){const{row:s}=e;if(s!==null)return n.toggleRowExpanded(s),!0}return!1}}class _v extends Dt{isInCorner(e,n){const s=n.getTheme(),{scrollBarSize:i}=s,{metrics:o}=n;if(!o)throw new Error("metrics not set");const{x:r,y:l}=e,{width:a,height:d,hasVerticalBar:c,hasHorizontalBar:u}=o;return i>0&&c&&u&&r>=a-i&&l>=d-i&&r<=a&&l<=d}onDown(e,n){return this.isInCorner(e,n)}onUp(e,n){return this.isInCorner(e,n)}onClick(e,n){return this.isInCorner(e,n)}}class Jd extends Dt{constructor(){super(...arguments),this.cursor="default"}static getTopWithOffsetFromRawTop(e,n){const s=e.getTheme(),{metrics:i,metricCalculator:o}=e;if(!i)throw new Error("metrics not set");if(s.scrollSnapToRow)return{top:Math.round(n),topOffset:0};const r=Math.floor(n),l=n-r;let a=i.allRowHeights.get(r);if(a==null){const c=e.getMetricState();a=o.getVisibleRowHeight(r,c)}const d=a*l;return{top:r,topOffset:d}}isInScrollBar(e,n){const s=n.getTheme(),{scrollBarSize:i,scrollBarHoverSize:o}=s,{metrics:r}=n;if(!r)throw new Error("metrics not set");const{x:l,y:a}=e,{barTop:d,barHeight:c,width:u,hasVerticalBar:m}=r;return m&&i>0&&l>=u-o&&l<u&&a>d&&a<d+c}getTopWithOffset(e,n){var f;const{metrics:s}=n;if(!s)throw new Error("metrics not set");const{y:i}=e,{barHeight:o,handleHeight:r,lastTop:l,barTop:a,rowCount:d,scrollableContentHeight:c,scrollableViewportHeight:u}=s,m=i-a,p=Je((m-((f=this.dragOffset)!=null?f:0))/(o-r),0,1);if(d===1)return{top:0,topOffset:p*(c-u)};const g=p*l;return Jd.getTopWithOffsetFromRawTop(n,g)}onDown(e,n){const{metrics:s}=n;if(!s)throw new Error("metrics not set");const{y:i}=e,{handleHeight:o,barTop:r,scrollY:l}=s;if(!this.isInScrollBar(e,n))return!1;const a=i-r;if(a>=l&&a<=l+o)this.dragOffset=a-l,n.setState({isDraggingVerticalScrollBar:!0});else{this.dragOffset=0;const{top:d,topOffset:c}=this.getTopWithOffset(e,n);n.setViewState({top:d,topOffset:c,isDraggingVerticalScrollBar:!0,isDragging:!0})}return!0}onMove(e,n){return this.isInScrollBar(e,n)}onDrag(e,n){if(this.dragOffset!=null){const{top:s,topOffset:i}=this.getTopWithOffset(e,n);return n.setViewState({top:s,topOffset:i,isDraggingVerticalScrollBar:!0,isDragging:!0}),!0}return!1}onUp(e,n){return this.dragOffset!==void 0&&(this.dragOffset=void 0,n.setState({isDraggingVerticalScrollBar:!1,isDragging:!1})),this.isInScrollBar(e,n)}onClick(e,n){return this.isInScrollBar(e,n)}}class kv extends Dt{onDoubleClick({column:e,row:n},s){const{model:i}=s.props;return tt(i)&&e!=null&&n!=null&&i.isEditableRange(de.makeCell(e,n))?(s.startEditing(e,n),!0):!1}}class vi{constructor(e=5e3){this.order=e}onDown(e,n){return!1}}class Ov extends vi{onDown(e,n){switch(e.key){case"a":if(J.isModifierKeyDown(e))return n.selectAll(),!0;break;case"ArrowUp":return this.handleArrowMove(0,-1,e,n);case"ArrowDown":return this.handleArrowMove(0,1,e,n);case"ArrowRight":return this.handleArrowMove(1,0,e,n);case"ArrowLeft":return this.handleArrowMove(-1,0,e,n);case"k":case"K":return J.isModifierKeyDown(e)?!1:this.handlePageUp(e,n);case"j":case"J":return J.isModifierKeyDown(e)?!1:this.handlePageDown(e,n);case"h":case"H":return J.isModifierKeyDown(e)?!1:(e.shiftKey||n.clearSelectedRanges(),n.moveCursorToPosition(0,n.state.cursorRow,e.shiftKey),!0);case"l":case"L":{if(J.isModifierKeyDown(e))return!1;const{model:s}=n.props,{columnCount:i}=s;return e.shiftKey||n.clearSelectedRanges(),n.moveCursorToPosition(i-1,n.state.cursorRow,e.shiftKey),!0}case"PageDown":return this.handlePageDown(e,n);case"PageUp":return this.handlePageUp(e,n);case"Home":return e.shiftKey||n.clearSelectedRanges(),n.moveCursorToPosition(J.isModifierKeyDown(e)?n.state.cursorColumn:0,J.isModifierKeyDown(e)?0:n.state.cursorRow,e.shiftKey,!0,!0),!0;case"End":{const{model:s}=n.props,{columnCount:i,rowCount:o}=s;return e.shiftKey||n.clearSelectedRanges(),n.moveCursorToPosition(J.isModifierKeyDown(e)?n.state.cursorColumn:i-1,J.isModifierKeyDown(e)?o-1:n.state.cursorRow,e.shiftKey,!0,!0),!0}case"Escape":return n.clearSelectedRanges(),{preventDefault:!1,stopPropagation:!1};case"Enter":if(n.state.selectedRanges.length>0)return n.moveCursorInDirection(e.shiftKey?de.SELECTION_DIRECTION.UP:de.SELECTION_DIRECTION.DOWN),!0;break;case"Tab":if(n.state.selectedRanges.length>0)return n.moveCursorInDirection(e.shiftKey?de.SELECTION_DIRECTION.LEFT:de.SELECTION_DIRECTION.RIGHT),!0;break}return!1}handleArrowMove(e,n,s,i){const o=s.shiftKey,r=J.isModifierKeyDown(s);o?i.trimSelectedRanges():i.clearSelectedRanges();const{cursorRow:l,cursorColumn:a,selectionEndColumn:d,selectionEndRow:c}=i.state,u=o?d:a,m=o?c:l;if(r){const{model:p}=i.props,{columnCount:g,rowCount:f}=p,b=r&&o;let C=null,S=null;e<0?(C=0,S=m):e>0?(C=g-1,S=m):n<0?(C=u,S=0):n>0&&(C=u,S=f-1),C!=null&&S!=null&&i.moveCursorToPosition(C,S,o,!0,b)}else{if(!i.metrics)throw new Error("grid.metrics are not set");const{theme:p}=i.props,{autoSelectRow:g=!1,autoSelectColumn:f=!1}=p;if(g&&e!==0){const{lastLeft:b}=i.metrics;let{left:C}=i.state;C=Je(C+e,0,b),i.moveCursorToPosition(C,l,o,!1),i.setViewState({left:C})}else if(f&&n!==0){const{lastTop:b}=i.metrics;let{top:C}=i.state;C=Je(C+n,0,b),i.moveCursorToPosition(C,a,o,!1),i.setViewState({top:C})}else i.moveCursor(e,n,o)}return!0}handlePageUp(e,n){const s=e.shiftKey;s?n.trimSelectedRanges():n.clearSelectedRanges();const{cursorColumn:i,selectionEndRow:o}=n.state,r=o,l=i;if(r==null)return!1;const a=n.getMetricState(),{metricCalculator:d}=n,{bottomVisible:c,topVisible:u,hasHorizontalBar:m}=d.getMetrics(a);let p=r-(c-u);p-=m?0:1,p=Math.max(p,0);const g=Math.max(p-(r-u),0);return n.moveCursorToPosition(l,p,s,!1),n.setViewState({top:g}),!0}handlePageDown(e,n){const s=e.shiftKey;s?n.trimSelectedRanges():n.clearSelectedRanges();const{selectionEndRow:i,cursorColumn:o}=n.state,r=i,l=o;if(r===null)return!1;const a=n.getMetricState(),{metricCalculator:d}=n,{bottomVisible:c,topVisible:u,hasHorizontalBar:m,rowCount:p,lastTop:g}=d.getMetrics(a),f=p-1;let b=c-u+r;b+=m?0:1,b=Math.min(b,f);const C=Math.min(g,b-(r-u));return n.moveCursorToPosition(l,b,s,!1),n.setViewState({top:C}),!0}}class Lv extends vi{onDown(e,n){switch(e.key){case"Enter":case" ":return this.handleExpandKey(e,n)}return!1}handleExpandKey(e,n){const{selectedRanges:s}=n.state;if(s.length===1){const i=s[0];if(i.startRow===i.endRow&&i.startColumn===i.endColumn){if(!n.metrics)throw new Error("grid.metrics not set");const{model:o}=n.props,{startRow:r,startColumn:l}=i;if(r!=null){const a=n.getModelRow(r);if((l===0||l==null)&&gt(o)&&o.isRowExpandable(a))return n.toggleRowExpanded(r),!0}}}return!1}}class Av extends vi{onDown(e,n){if(J.isModifierKeyDown(e))return!1;const{model:s}=n.props,{cursorColumn:i,cursorRow:o}=n.state;if(i==null||o==null||!tt(s)||!s.isEditableRange(de.makeCell(i,o)))return!1;const r=i,l=o;return r==null||l==null?!1:e.key.length===1?(n.startEditing(r,l,!0,[1,1],e.key),!0):e.key==="F2"?(n.startEditing(r,l),!0):e.key==="Backspace"?(n.startEditing(r,l,!0,void 0,""),!0):e.key==="Delete"?(n.setValueForCell(r,l,""),!0):!1}}function Pv(t){var s,i;const e=[],n=t.querySelectorAll("tr");for(let o=0;o<n.length;o+=1){const l=n[o].querySelectorAll("td"),a=[];for(let d=0;d<l.length;d+=1){const c=l[d];a.push((i=(s=c.textContent)==null?void 0:s.trim())!=null?i:"")}e.push(a)}return e}function Hv(t){const e=[];return t.forEach(n=>{var i;const s=(i=n.textContent)!=null?i:"";s.length>0&&e.push(s.split(/\t|\u00a0\u00a0 \u00a0/))}),e}function Vv(t){var s,i;const e=t.querySelector("table");if(e!=null)return Pv(e);const n=(i=(s=t.textContent)==null?void 0:s.trim())!=null?i:"";if(n.length>0){const{childNodes:o}=t,r=n.includes(" "),l=n.includes("\xA0\xA0 \xA0");return r&&o.length!==0&&(o.length===1||o.length>1&&(o[0].textContent==null||!o[0].textContent.includes(" ")))?n.split(`
24
+ `).map(a=>a.split(" ")):o.length>1||l?Hv(t.childNodes):n}return null}class Uv extends vi{onDown(e,n){switch(e.key){case"v":if(J.isModifierKeyDown(e)){const s=document.createElement("div");document.body.appendChild(s),s.setAttribute("contenteditable","true"),s.setAttribute("style",'clip-path: "inset(50%)"; height: 1px; width: 1px; margin: -1px; overflow: hidden; padding 0; position: absolute;');const i=()=>{s.removeEventListener("input",i),s.remove(),n.focus();const o=Vv(s);o!=null&&n.pasteValue(o)};return s.addEventListener("input",i),s.focus(),{preventDefault:!1,stopPropagation:!0}}break}return!1}}const Bv=t=>{switch(t){case"ArrowDown":return Nn.DOWN;case"ArrowUp":return Nn.UP;case"ArrowLeft":return Nn.LEFT;case"ArrowRight":return Nn.RIGHT;default:return}};function ec({selectionRange:t=void 0,className:e="",disabled:n=!1,value:s="",isQuickEdit:i=!0,onChange:o=()=>{},onCancel:r=()=>{},onDone:l=()=>{},onContextMenu:a=()=>{},style:d={}}){const c=w.exports.useRef(null),u=w.exports.useRef(!1),[m]=w.exports.useState(s),[p,g]=w.exports.useState(!1),[f,b]=w.exports.useState(i),[C,S]=w.exports.useState(s);w.exports.useEffect(function(){const{current:x}=c;x!=null&&(x.focus(),t?x.setSelectionRange(t[0],t[1]):x.setSelectionRange(x.value.length,x.value.length))},[t]);const v=w.exports.useCallback(H=>{o(H)},[o]),y=w.exports.useCallback(H=>{const{value:x}=H.target;S(x),g(!0),v(x)},[v,S,g]),E=w.exports.useCallback(()=>{u.current=!0,p&&v(m),g(!1),r()},[m,p,r,v]),I=w.exports.useCallback(()=>{b(!1)},[b]),R=w.exports.useCallback((H,x=!1)=>{l(C,{direction:H,fillRange:x})},[l,C]),N=w.exports.useCallback(()=>{u.current||R(null)},[u,R]),F=w.exports.useCallback(H=>{switch(H.stopPropagation(),H.key){case"Escape":H.preventDefault(),E();break;case"Enter":if(H.preventDefault(),J.isModifierKeyDown(H))R(void 0,!0);else if(H.altKey){const x=`${C}
25
+ `;S(x),g(!0),v(x)}else R(H.shiftKey?Nn.UP:Nn.DOWN);break;case"Tab":H.preventDefault(),R(H.shiftKey?Nn.LEFT:Nn.RIGHT);break;case"ArrowDown":case"ArrowUp":case"ArrowLeft":case"ArrowRight":f&&(H.preventDefault(),R(Bv(H.key)));break}},[E,R,f,S,g,v,C]),P=w.exports.useCallback(H=>{a(H)},[a]);return h("textarea",{ref:c,className:z("grid-cell-input-field",e),value:C,onBlur:N,onChange:y,onKeyDown:F,onContextMenu:P,onClick:I,autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:"false",disabled:n,style:d})}ec.propTypes={selectionRange:D.exports.arrayOf(D.exports.number),className:D.exports.string,disabled:D.exports.bool,isQuickEdit:D.exports.bool,value:D.exports.string,onChange:D.exports.func,onCancel:D.exports.func,onDone:D.exports.func,onContextMenu:D.exports.func,style:D.exports.shape({})};ec.defaultProps={selectionRange:null,className:"",disabled:!1,value:"",isQuickEdit:!0,onChange:()=>{},onCancel:()=>{},onDone:()=>{},onContextMenu:()=>{},style:{}};const $v=X.createContext({}),ri=class extends w.exports.PureComponent{constructor(t){super(t),this.getCachedKeyHandlers=Se(l=>[...l,...this.keyHandlers].sort((a,d)=>a.order-d.order)),this.getCachedMouseHandlers=Se(l=>[...l,...this.mouseHandlers].sort((a,d)=>a.order-d.order)),this.handleClick=this.handleClick.bind(this),this.handleContextMenu=this.handleContextMenu.bind(this),this.handleEditCellCancel=this.handleEditCellCancel.bind(this),this.handleEditCellChange=this.handleEditCellChange.bind(this),this.handleEditCellCommit=this.handleEditCellCommit.bind(this),this.handleDoubleClick=this.handleDoubleClick.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleMouseDown=this.handleMouseDown.bind(this),this.handleMouseDrag=this.handleMouseDrag.bind(this),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.handleMouseUp=this.handleMouseUp.bind(this),this.handleResize=this.handleResize.bind(this),this.handleWheel=this.handleWheel.bind(this);const{isStuckToBottom:e,isStuckToRight:n,metricCalculator:s,movedColumns:i,movedRows:o,renderer:r}=t;this.renderer=r||new to,this.metricCalculator=s||new dr,this.canvas=null,this.canvasContext=null,this.animationFrame=null,this.prevMetrics=null,this.metrics=null,this.documentCursor=null,this.dragTimer=null,this.keyHandlers=[new Av(400),new Uv(450),new Ov(500),new Lv(900)],this.mouseHandlers=[new Qd(100),new Ql(200),new xv(300),new Fv(400),new kv(450),new Jd(500),new Zd(600),new _v(700),new vl(800),new Mv(900)],this.state={top:0,left:0,topOffset:0,leftOffset:0,draggingColumn:null,draggingRow:null,draggingRowOffset:null,draggingColumnSeparator:null,draggingRowSeparator:null,isDraggingHorizontalScrollBar:!1,isDraggingVerticalScrollBar:!1,isDragging:!1,mouseX:null,mouseY:null,movedColumns:i,movedRows:o,cursorRow:null,cursorColumn:null,selectionStartRow:null,selectionStartColumn:null,selectionEndRow:null,selectionEndColumn:null,selectedRanges:[],lastSelectedRanges:[],cursor:null,editingCell:null,isStuckToBottom:e,isStuckToRight:n}}static getScale(t){var i,o,r,l,a;const e=window.devicePixelRatio||1,n=t,s=(a=(l=(r=(o=(i=n.webkitBackingStorePixelRatio)!=null?i:n.mozBackingStorePixelRatio)!=null?o:n.msBackingStorePixelRatio)!=null?r:n.oBackingStorePixelRatio)!=null?l:n.backingStorePixelRatio)!=null?a:1;return e/s}static getCursorClassName(t){return t!=null&&t!==""?`grid-cursor-${t}`:null}componentDidMount(){var n;this.initContext(),(n=this.canvas)==null||n.addEventListener("wheel",this.handleWheel,{passive:!1}),window.addEventListener("resize",this.handleResize),this.updateCanvasScale(),this.updateCanvas();const{isStuckToBottom:t,isStuckToRight:e}=this.props;t&&this.scrollToBottom(),e&&this.scrollToRight()}componentDidUpdate(t,e){const{isStickyBottom:n,isStickyRight:s,movedColumns:i,movedRows:o,onMovedColumnsChanged:r,onMoveColumnComplete:l,onMovedRowsChanged:a,onMoveRowComplete:d}=this.props,{isStickyBottom:c,isStickyRight:u,movedColumns:m,movedRows:p}=t,{movedColumns:g,movedRows:f}=e,{draggingColumn:b,draggingRow:C,movedColumns:S,movedRows:v}=this.state;if(m!==i&&this.setState({movedColumns:i}),p!==o&&this.setState({movedRows:o}),g!==S&&r(S),e.draggingColumn!=null&&b==null&&l(S),f!==v&&a(v),e.draggingRow!=null&&C==null&&d(v),n!==c&&this.setState({isStuckToBottom:!1}),s!==u&&this.setState({isStuckToRight:!1}),this.updateMetrics(),this.requestUpdateCanvas(),!this.metrics||!this.prevMetrics)return;const{rowCount:y,columnCount:E,height:I,width:R}=this.metrics,{rowCount:N,columnCount:F,height:P,width:H}=this.prevMetrics;if(N!==y||I!==P){const{isStuckToBottom:x}=this.state;x&&this.scrollToBottom()}if(F!==E||R!==H){const{isStuckToRight:x}=this.state;x&&this.scrollToRight()}this.validateSelection()&&this.checkSelectionChange(e)}componentWillUnmount(){var t;this.animationFrame!=null&&cancelAnimationFrame(this.animationFrame),(t=this.canvas)==null||t.removeEventListener("wheel",this.handleWheel),window.removeEventListener("mousemove",this.handleMouseDrag,!0),window.removeEventListener("mouseup",this.handleMouseUp,!0),window.removeEventListener("resize",this.handleResize),this.stopDragTimer()}getTheme(){const{theme:t}=this.props;return ri.getTheme(this.context,t)}getGridPointFromEvent(t){Fh(this.canvas);const e=this.canvas.getBoundingClientRect(),n=t.clientX-e.left,s=t.clientY-e.top;return this.getGridPointFromXY(n,s)}getGridPointFromXY(t,e){if(!this.metrics)throw new Error("metrics must be set");return J.getGridPointFromXY(t,e,this.metrics)}getMetricState(t=this.state){const e=this.getTheme(),{model:n,stateOverride:s}=this.props;if(!this.canvasContext||!this.canvas)throw new Error("Canvas and context must be defined to get metrics");const i=this.canvasContext,o=this.canvas.clientWidth,r=this.canvas.clientHeight,{left:l,top:a,leftOffset:d,topOffset:c,movedColumns:u,movedRows:m,isDraggingHorizontalScrollBar:p,isDraggingVerticalScrollBar:g,draggingColumn:f}=t;return{left:l,top:a,leftOffset:d,topOffset:c,width:o,height:r,context:i,theme:e,model:n,movedColumns:u,movedRows:m,isDraggingHorizontalScrollBar:p,isDraggingVerticalScrollBar:g,draggingColumn:f,...s}}getKeyHandlers(){const{keyHandlers:t}=this.props;return this.getCachedKeyHandlers(t)}getMouseHandlers(){const{mouseHandlers:t}=this.props;return this.getCachedMouseHandlers(t)}getModelColumn(t){var n,s;const e=(s=(n=this.metrics)==null?void 0:n.modelColumns)==null?void 0:s.get(t);if(e===void 0)throw new Error(`Unable to get ModelIndex for column ${t}`);return e}getModelRow(t){var n,s;const e=(s=(n=this.metrics)==null?void 0:n.modelRows)==null?void 0:s.get(t);if(e===void 0)throw new Error(`Unable to get ModelIndex for row ${t}`);return e}toggleRowExpanded(t){const e=this.getModelRow(t),{model:n}=this.props;gt(n)&&n.isRowExpandable(e)&&n.setRowExpanded(e,!n.isRowExpanded(e)),this.clearSelectedRanges(),this.commitSelection(),this.moveCursorToPosition(0,t),this.commitSelection(),this.setState({isStuckToBottom:!1})}scrollToBottom(){if(!this.metrics)return;const{bottomVisible:t,rowCount:e,top:n,lastTop:s}=this.metrics;(t<e-1&&t>0||n>s)&&this.setState({top:s})}scrollToRight(){if(!this.metrics)return;const{rightVisible:t,columnCount:e,left:n,lastLeft:s}=this.metrics;(t<e-1&&t>0||n>s)&&this.setState({left:s})}setSelectedRanges(t){const{model:e}=this.props,{columnCount:n,rowCount:s}=e,{cursorRow:i,cursorColumn:o,selectedRanges:r}=this.state;if(this.setState({selectedRanges:t,lastSelectedRanges:r}),t.length>0){const l=de.boundedRange(t[0],n,s);let a=i,d=o;l.containsCell(o,i)||({row:a,column:d}=l.startCell()),this.setState({selectionStartColumn:l.startColumn,selectionStartRow:l.startRow,selectionEndColumn:l.endColumn,selectionEndRow:l.endRow,cursorColumn:d,cursorRow:a})}}initContext(){const{canvas:t}=this,{canvasOptions:e}=this.props;if(!t)throw new Error("Canvas not set");this.canvasContext=t.getContext("2d",e)}requestUpdateCanvas(){this.animationFrame==null&&(this.animationFrame=requestAnimationFrame(()=>{if(this.animationFrame=null,!this.metrics)throw new Error("Metrics not set");this.updateCanvas(this.metrics)}))}updateCanvas(t=this.updateMetrics()){this.updateCanvasScale();const{onViewChanged:e}=this.props;e(t),this.drawCanvas(t)}updateCanvasScale(){const{canvas:t,canvasContext:e}=this;if(!t)throw new Error("canvas not set");if(!e)throw new Error("canvasContext not set");if(!t.parentElement)throw new Error("Canvas has no parent element");const n=ri.getScale(e),s=t.parentElement.getBoundingClientRect(),i=Math.floor(s.width),o=Math.floor(s.height);t.style.width=`${i}px`,t.style.height=`${o}px`,t.width=i*n,t.height=o*n,e.scale(n,n)}updateScrollBounds(){if(!this.metrics)throw new Error("metrics not set");const{left:t,top:e}=this.state,{lastLeft:n,lastTop:s}=this.metrics;t>n&&this.setState({left:n,leftOffset:0}),e>s&&this.setState({top:s,topOffset:0})}updateMetrics(t=this.state){this.prevMetrics=this.metrics;const{metricCalculator:e}=this,n=this.getMetricState(t);return this.metrics=e.getMetrics(n),this.updateScrollBounds(),this.metrics}checkSelectionChange(t){const{selectedRanges:e}=t,{selectedRanges:n}=this.state;if(n!==e){const{onSelectionChanged:s}=this.props;s(n)}}validateSelection(){const{model:t}=this.props,{selectedRanges:e}=this.state,{columnCount:n,rowCount:s}=t;for(let i=0;i<e.length;i+=1){const o=e[i];if(o.endColumn!=null&&o.endColumn>=n||o.endRow!=null&&o.endRow>=s)return this.setState({selectedRanges:[],lastSelectedRanges:[]}),!1}return!0}clearSelectedRanges(){const{selectedRanges:t}=this.state;this.setState({selectedRanges:[],lastSelectedRanges:t})}trimSelectedRanges(){const{selectedRanges:t}=this.state;t.length>0&&this.setState({selectedRanges:t.slice(t.length-1)})}beginSelection(t,e){this.setState({selectionStartColumn:t,selectionStartRow:e,selectionEndColumn:t,selectionEndRow:e,cursorColumn:t,cursorRow:e})}moveSelection(t,e,n=!1,s=!1){this.setState(i=>{var g,f,b,C;const{selectedRanges:o,selectionStartRow:r,selectionStartColumn:l}=i,{theme:a}=this.props,{autoSelectRow:d,autoSelectColumn:c}=a;if(n&&o.length>0){const S=o[o.length-1];let v=null,y=null,E=null,I=null;s?(v=d!==void 0&&d?null:Math.min(t!=null?t:0,(g=S.startColumn)!=null?g:0),y=c!==void 0&&c?null:Math.min(e!=null?e:0,(f=S.startRow)!=null?f:0),E=d!==void 0&&d?null:Math.max(t!=null?t:0,(b=S.endColumn)!=null?b:0),I=c!==void 0&&c?null:Math.max(e!=null?e:0,(C=S.endRow)!=null?C:0)):(v=S.startColumn,y=S.startRow,(l!=null||r!=null)&&((d===void 0||!d)&&(v=l),(c===void 0||!c)&&(y=r)),E=d!==void 0&&d?null:t,I=c!==void 0&&c?null:e);const R=de.makeNormalized(v,y,E,I);if(S.equals(R))return null;const N=[...o];return N[N.length-1]=R,{selectedRanges:N,selectionEndColumn:t,selectionEndRow:e}}const u=[...o],m=d!==void 0&&d?null:t,p=c!==void 0&&c?null:e;return u.push(de.makeNormalized(m,p,m,p)),{selectedRanges:u,selectionEndColumn:t,selectionEndRow:e}})}commitSelection(){this.setState(t=>{const{theme:e}=this.props,{autoSelectRow:n}=e,{selectedRanges:s,lastSelectedRanges:i,cursorRow:o,cursorColumn:r}=t;if(s.length===1&&(n!==void 0&&n?de.rowCount(s)===1:de.cellCount(s)===1)&&de.rangeArraysEqual(s,i))return{selectedRanges:[],lastSelectedRanges:[],cursorColumn:null,cursorRow:null};let l=s.slice();if(l.length>1){const c=l[l.length-1];for(let u=0;u<l.length-1;u+=1){const m=l[u];if(m.contains(c)){const p=m.subtract(c);l.pop(),l.splice(u,1),l=l.concat(p);break}}l=de.consolidate(l)}let a=r,d=o;if(!de.containsCell(l,r,o)){const{model:c}=this.props,{columnCount:u,rowCount:m}=c,p=de.nextCell(de.boundedRanges(s,u,m));p!=null?{column:a,row:d}=p:(a=null,d=null)}return l.length===0&&(a=null,d=null),{cursorRow:d,cursorColumn:a,selectedRanges:l,lastSelectedRanges:s}})}setFocusRow(t){var u;if(!this.metrics||!this.prevMetrics)return;const{gridY:e,height:n,lastTop:s,userRowHeights:i,rowHeight:o}=this.metrics,r=n-e,l=Math.round(r/2)+((u=i.get(t))!=null?u:o),a=this.getMetricState(),d=this.metricCalculator.getLastTop(a,t+1,l);this.setState({top:Math.min(s,d),selectedRanges:[new de(null,t,null,t)],isStuckToBottom:!1});const{cursorColumn:c}=this.state;this.moveCursorToPosition(c,t,!1,!1)}selectAll(){const{model:t,theme:e}=this.props,{autoSelectRow:n,autoSelectColumn:s}=e,i=s!==void 0&&s?null:0,o=s!==void 0&&s?null:t.rowCount-1,r=n!==void 0&&n?null:0,l=n!==void 0&&n?null:t.columnCount-1;this.setSelectedRanges([new de(r,i,l,o)])}moveCursor(t,e,n){const{cursorRow:s,cursorColumn:i,selectionEndColumn:o,selectionEndRow:r}=this.state,l=n?o:i,a=n?r:s;if(a===null||l===null){const{left:d,top:c}=this.state;this.moveCursorToPosition(d,c,n)}else{const{model:d}=this.props,{columnCount:c,rowCount:u}=d,m=Je(l+t,0,c-1),p=Je(a+e,0,u-1);this.moveCursorToPosition(m,p,n)}}moveCursorInDirection(t=de.SELECTION_DIRECTION.DOWN){var d;const{model:e}=this.props,{columnCount:n,rowCount:s}=e,{cursorRow:i,cursorColumn:o,selectedRanges:r}=this.state,l=r.length>0?r:[de.makeCell(o,i)];let a=null;if(l.length===1&&de.cellCount(l)===1){const c=new de(0,0,n-1,s-1);a=(d=c.nextCell(o,i,t))!=null?d:c.startCell(t)}else a=de.nextCell(de.boundedRanges(l,n,s),o,i,t);if(a!=null){const{column:c,row:u}=a;this.setState({cursorColumn:c,cursorRow:u}),de.containsCell(r,c,u)||this.setState({selectedRanges:[de.makeCell(c,u)],selectionStartColumn:c,selectionStartRow:u,selectionEndColumn:c,selectionEndRow:u}),this.moveViewToCell(a.column,a.row)}}moveCursorToPosition(t,e,n=!1,s=!0,i=!1){n||this.beginSelection(t,e),this.moveSelection(t,e,n,i),s&&this.moveViewToCell(t,e)}moveViewToCell(t,e){if(!this.metrics)throw new Error("metrics not set");const{metricCalculator:n}=this,{bottomVisible:s,rightVisible:i,topVisible:o,leftVisible:r}=this.metrics,l=this.getMetricState(this.state);let{top:a,left:d,topOffset:c,leftOffset:u}=this.state;e!=null&&!J.isFloatingRow(e,this.metrics)&&(e<o?(a=n.getTopForTopVisible(l,e),c=0):e>s&&(a=n.getTopForBottomVisible(l,e),c=0)),t!=null&&!J.isFloatingColumn(t,this.metrics)&&(t<r?(d=n.getLeftForLeftVisible(l,t),u=0):t>i&&(d=n.getLeftForRightVisible(l,t),u=0)),this.setViewState({top:a,left:d,topOffset:c,leftOffset:u})}setViewState(t,e=!1){if(!this.metrics)throw new Error("metrics not set");const{isStickyBottom:n,isStickyRight:s}=this.props,{top:i,left:o}=t,{lastTop:r,lastLeft:l}=this.metrics;i!=null&&this.setState({isStuckToBottom:n&&i>=r}),o!=null&&this.setState({isStuckToRight:s&&o>=l}),this.setState(t),e&&this.forceUpdate()}startEditing(t,e,n=!1,s,i){const{model:o}=this.props;if(!tt(o))throw new Error("model is not editable");const r=this.getModelColumn(t),l=this.getModelRow(e),a={column:t,row:e,selectionRange:s,value:i!==void 0?i:o.editValueForCell(r,l),isQuickEdit:n};this.setState({editingCell:a,cursorColumn:t,cursorRow:e}),this.moveViewToCell(t,e)}isValidForCell(t,e,n){const{model:s}=this.props,i=this.getModelColumn(t),o=this.getModelRow(e);return tt(s)&&s.isValidForCell(i,o,n)}async pasteValue(t){const{model:e}=this.props,{movedColumns:n,movedRows:s,selectedRanges:i}=this.state;try{if(xh(e),!e.isEditable||!i.every(u=>e.isEditableRange(u)))throw new Ra("Can't paste in to read-only area.");if(i.length<=0)throw new Ra("Select an area to paste to.");if(typeof t=="string"){const u=[],m=J.getModelRanges(i,n,s);de.forEachCell(m,(p,g)=>{u.push({column:p,row:g,text:t})}),await e.setValues(u);return}const o=t.length,r=t[0].length,{columnCount:l,rowCount:a}=e;let d=i;if(d.every(u=>{var m,p;return de.cellCount([u])===1&&((m=u.startColumn)!=null?m:0)+r<=l&&((p=u.startRow)!=null?p:0)+o<=a})&&(d=d.map(u=>{var m,p;return new de(u.startColumn,u.startRow,((m=u.startColumn)!=null?m:0)+r-1,((p=u.startRow)!=null?p:0)+o-1)}),this.setSelectedRanges(d)),!d.every(u=>de.rowCount([u])===o&&de.columnCount([u])===r))throw new Ra("Copy and paste area are not same size.");const c=[];d.forEach(u=>{var m,p;for(let g=0;g<r;g+=1)for(let f=0;f<o;f+=1)c.push({column:((m=u.startColumn)!=null?m:0)+g,row:((p=u.startRow)!=null?p:0)+f,text:t[f][g]})}),await e.setValues(c)}catch(o){const{onError:r}=this.props;r(o instanceof Error?o:new Error(`${o}`))}}setValueForCell(t,e,n){const{model:s}=this.props;xh(s);const i=this.getModelColumn(t),o=this.getModelRow(e);return s.isValidForCell(i,o,n)?(s.setValueForCell(i,o,n),!0):!1}setValueForRanges(t,e){const{model:n}=this.props,{movedColumns:s,movedRows:i}=this.state,o=J.getModelRanges(t,s,i);tt(n)&&n.setValueForRanges(o,e)}isSelected(t,e){var s,i;const{selectedRanges:n}=this.state;for(let o=0;o<n.length;o+=1){const r=n[o],l=r.startRow===null||r.startRow<=t&&t<=((s=r.endRow)!=null?s:0),a=r.startColumn===null||r.startColumn<=e&&e<=((i=r.endColumn)!=null?i:0);if(l&&a)return!0}return!1}addDocumentCursor(t=null){this.documentCursor!==ri.getCursorClassName(t)&&(this.documentCursor!=null&&document.documentElement.classList.remove(this.documentCursor),this.documentCursor=ri.getCursorClassName(t),this.documentCursor!=null&&document.documentElement.classList.add(this.documentCursor),document.documentElement.classList.add("grid-block-events"))}removeDocumentCursor(){this.documentCursor!=null&&(document.documentElement.classList.remove(this.documentCursor),document.documentElement.classList.remove("grid-block-events"),this.documentCursor=null)}startDragTimer(t){this.stopDragTimer();const e=new MouseEvent("custom",t.nativeEvent);this.dragTimer=setTimeout(()=>{this.handleMouseDrag(e)},ri.dragTimeout)}stopDragTimer(){this.dragTimer&&(clearTimeout(this.dragTimer),this.dragTimer=null)}drawCanvas(t=this.updateMetrics()){if(!this.canvas)throw new Error("canvas is not set");if(!this.canvasContext)throw new Error("context not set");const{cursorColumn:e,cursorRow:n,draggingColumn:s,draggingColumnSeparator:i,draggingRow:o,draggingRowOffset:r,draggingRowSeparator:l,editingCell:a,isDraggingHorizontalScrollBar:d,isDraggingVerticalScrollBar:c,isDragging:u,mouseX:m,mouseY:p,selectedRanges:g}=this.state,{model:f,stateOverride:b}=this.props,{renderer:C}=this,S=this.canvasContext,v=this.getTheme(),y=this.canvas.clientWidth,E=this.canvas.clientHeight,I={width:y,height:E,context:S,theme:v,model:f,metrics:t,mouseX:m,mouseY:p,selectedRanges:g,draggingColumn:s,draggingColumnSeparator:i,draggingRow:o,draggingRowOffset:r,draggingRowSeparator:l,editingCell:a,isDraggingHorizontalScrollBar:d,isDraggingVerticalScrollBar:c,isDragging:u,cursorColumn:e,cursorRow:n,...b};S.save(),C.drawCanvas(I),S.restore()}focus(){var t;(t=this.canvas)==null||t.focus()}isFocused(){return document.activeElement===this.canvas}handleClick(t){var s;const e=this.getGridPointFromEvent(t),n=this.getMouseHandlers();for(let i=0;i<n.length;i+=1)if(n[i].onClick(e,this,t)!==!1){t.stopPropagation(),t.preventDefault();break}(s=this.canvas)==null||s.focus()}handleContextMenu(t){const e=this.getGridPointFromEvent(t),n=this.getMouseHandlers();for(let s=0;s<n.length;s+=1)if(n[s].onContextMenu(e,this,t)!==!1){t.stopPropagation(),t.preventDefault();break}}handleKeyDown(t){var n,s;const e=this.getKeyHandlers();for(let i=0;i<e.length;i+=1){const r=e[i].onDown(t,this);if(r!==!1){const l=r;((n=l==null?void 0:l.stopPropagation)==null||n)&&t.stopPropagation(),((s=l==null?void 0:l.preventDefault)==null||s)&&t.preventDefault();break}}}notifyMouseHandlers(t,e,n=!0,s=!1){var l,a;const i=this.getGridPointFromEvent(e),o=this.getMouseHandlers();let r=null;for(let d=0;d<o.length;d+=1){const c=o[d],u=c[t]!=null&&c[t](i,this,e);if(u!==!1){c.cursor!=null&&({cursor:r}=c,s&&this.addDocumentCursor(r));const m=u;((l=m==null?void 0:m.stopPropagation)==null||l)&&e.stopPropagation(),((a=m==null?void 0:m.preventDefault)==null||a)&&e.preventDefault();break}}if(this.setState({cursor:r}),n){const{x:d,y:c}=i;this.setState({mouseX:d,mouseY:c})}}handleMouseDown(t){window.addEventListener("mousemove",this.handleMouseDrag,!0),window.addEventListener("mouseup",this.handleMouseUp,!0),!(t.button!=null&&t.button!==0)&&(this.notifyMouseHandlers("onDown",t),this.startDragTimer(t))}handleDoubleClick(t){this.notifyMouseHandlers("onDoubleClick",t)}handleMouseMove(t){this.notifyMouseHandlers("onMove",t)}handleMouseLeave(t){this.notifyMouseHandlers("onLeave",t,!1),this.setState({mouseX:null,mouseY:null})}handleMouseDrag(t){this.setState({isDragging:!0}),this.notifyMouseHandlers("onDrag",t,!0,!0),this.stopDragTimer()}handleMouseUp(t){window.removeEventListener("mousemove",this.handleMouseDrag,!0),window.removeEventListener("mouseup",this.handleMouseUp,!0),!(t.button!=null&&t.button!==0)&&(this.notifyMouseHandlers("onUp",t,!1),this.stopDragTimer(),this.removeDocumentCursor())}handleResize(){if(this.updateCanvasScale(),this.updateCanvas(),!this.metrics)throw new Error("metrics not set");this.forceUpdate()}handleWheel(t){var E,I,R,N;if(this.notifyMouseHandlers("onWheel",t),t.defaultPrevented)return;const{metricCalculator:e,metrics:n}=this,s=this.getMetricState();if(!n)throw new Error("metrics not set");const{lastTop:i,lastLeft:o,columnCount:r,rowCount:l,scrollableContentWidth:a,scrollableViewportWidth:d,scrollableContentHeight:c,scrollableViewportHeight:u,hasHorizontalBar:m,hasVerticalBar:p}=n;let{top:g,left:f,topOffset:b,leftOffset:C}=n;const S=this.getTheme();let{deltaX:v,deltaY:y}=J.getScrollDelta(t,n.barWidth,n.barHeight,n.rowHeight,n.rowHeight);for(;m&&v!==0;){if(C+=v,v=0,r>1){if(C>0&&f>=o||C<0&&f<=0){C=0;break}}else{if(C<=0){C=0;break}const F=a-d;if(C>=F){C=F;break}}if(C>0){const F=(E=n.allColumnWidths.get(f))!=null?E:e.getVisibleColumnWidth(f,s);C>=F?(v=C-F,C=0,f+=1):S.scrollSnapToColumn&&r>1&&(C=0,f+=1)}else if(C<0){const F=(I=n.allColumnWidths.get(f-1))!=null?I:e.getVisibleColumnWidth(f-1,s);Math.abs(C)<=F&&S.scrollSnapToColumn&&r>1?(C=0,f-=1):(v=C+F,C=0,f-=1)}}for(;p&&y!==0;){if(b+=y,y=0,l>1){if(b>0&&g>=i||b<0&&g<=0){b=0;break}}else{if(b<=0){b=0;break}const F=c-u;if(b>=F){b=F;break}}if(b>0){const F=(R=n.allRowHeights.get(g))!=null?R:e.getVisibleRowHeight(g,s);b>=F?(y=b-F,b=0,g+=1):S.scrollSnapToRow&&l>1&&(b=0,g+=1)}else if(b<0){const F=(N=n.allRowHeights.get(g-1))!=null?N:e.getVisibleRowHeight(g-1,s);Math.abs(b)<=F&&S.scrollSnapToRow&&l>1?(b=0,g-=1):(y=b+F,b=0,g-=1)}}this.setViewState({top:g,left:f,leftOffset:C,topOffset:b}),t.stopPropagation(),t.preventDefault()}handleEditCellCancel(){this.setState({editingCell:null}),this.focus()}handleEditCellChange(t){this.setState(({editingCell:e})=>{try{return Fh(e),{editingCell:{...e,value:t}}}catch(n){const{onError:s}=this.props;return s(n instanceof Error?n:new Error(`${n}`)),null}})}handleEditCellCommit(t,{direction:e=Nn.DOWN,fillRange:n=!1}={}){const{editingCell:s,selectedRanges:i}=this.state;if(!s)throw new Error("editingCell not set");const{column:o,row:r}=s;if(!this.isValidForCell(o,r,t)){e===null&&this.setState({editingCell:null});return}n?this.setValueForRanges(i,t):this.setValueForCell(o,r,t),e!==null&&this.moveCursorInDirection(e),this.setState({editingCell:null}),this.focus()}renderInputField(){const{model:t}=this.props,{editingCell:e}=this.state,{metrics:n}=this;if(e==null||n==null||!tt(t))return null;const{selectionRange:s,value:i,isQuickEdit:o}=e,{column:r,row:l}=e,{gridX:a,gridY:d,allColumnXs:c,allRowYs:u,allColumnWidths:m,allRowHeights:p}=n,g=c.get(r),f=u.get(l),b=m.get(r),C=p.get(l),S=g!=null&&f!=null&&b!=null&&C!=null?{position:"absolute",left:a+g,top:d+f,width:b,height:C}:{opacity:0},v=this.getModelColumn(r),y=this.getModelRow(l),E=v!=null&&y!=null?{textAlign:t.textAlignForCell(v,y)}:void 0,I=t.isValidForCell(v,y,i);return h("div",{style:S,children:h(ec,{selectionRange:s,className:z({error:!I}),onCancel:this.handleEditCellCancel,onChange:this.handleEditCellChange,onDone:this.handleEditCellCommit,isQuickEdit:o,style:E,value:i},`${r},${l}`)})}render(){const{cursor:t}=this.state;return T(Te,{children:[h("canvas",{className:z("grid-canvas",ri.getCursorClassName(t)),ref:e=>{this.canvas=e},onClick:this.handleClick,onContextMenu:this.handleContextMenu,onDoubleClick:this.handleDoubleClick,onKeyDown:this.handleKeyDown,onMouseDown:this.handleMouseDown,onMouseMove:this.handleMouseMove,onMouseLeave:this.handleMouseLeave,tabIndex:0,children:"Your browser does not support HTML canvas. Update your browser?"}),this.renderInputField()]})}};let uo=ri;uo.contextType=$v;uo.defaultProps={canvasOptions:{alpha:!1},isStickyBottom:!1,isStickyRight:!1,isStuckToBottom:!1,isStuckToRight:!1,keyHandlers:[],mouseHandlers:[],movedColumns:[],movedRows:[],onError:()=>{},onSelectionChanged:()=>{},onMovedColumnsChanged:t=>{},onMoveColumnComplete:()=>{},onMovedRowsChanged:()=>{},onMoveRowComplete:()=>{},onViewChanged:()=>{},stateOverride:{},theme:{autoSelectColumn:!1,autoSelectRow:!1}};uo.pixelsPerLine=100/3;uo.dragTimeout=1e3;uo.getTheme=Se((t,e)=>({...Iv,...t,...e}));class Ip extends Fl{get floatingTopRowCount(){return 0}get floatingBottomRowCount(){return 0}get floatingLeftColumnCount(){return 0}get floatingRightColumnCount(){return 0}get columnHeaderMaxDepth(){return 1}truncationCharForCell(e,n){}textAlignForCell(e,n){return"left"}colorForCell(e,n,s){return s.textColor}backgroundColorForCell(e,n,s){return null}colorForColumnHeader(e,n=0){return null}textForRowHeader(e){return""}textForRowFooter(e){return""}isColumnMovable(e,n=0){return!0}isRowMovable(e){return!0}getColumnHeaderGroup(e,n){}getColumnHeaderParentGroup(e,n){}}class zv extends Ip{constructor({rowCount:e=1e9,columnCount:n=100,floatingTopRowCount:s=0,floatingBottomRowCount:i=0,floatingLeftColumnCount:o=0,floatingRightColumnCount:r=0,isEditable:l=!1,editedData:a=[]}={}){super(),this.numRows=e,this.numColumns=n,this.floatingTop=s,this.floatingBottom=i,this.floatingLeft=o,this.floatingRight=r,this.editable=l,this.editedData=a}get rowCount(){return this.numRows}get columnCount(){return this.numColumns}get floatingTopRowCount(){return this.floatingTop}get floatingBottomRowCount(){return this.floatingBottom}get floatingLeftColumnCount(){return this.floatingLeft}get floatingRightColumnCount(){return this.floatingRight}get isEditable(){return this.editable}textForCell(e,n){var s,i;return(i=(s=this.editedData[e])==null?void 0:s[n])!=null?i:`${e},${n}`}colorForCell(e,n,s){return s.textColor}textForColumnHeader(e,n=0){return`${e}`}textForRowHeader(e){return`${e}`}textForRowFooter(e){return`${e}`}async setValueForCell(e,n,s){this.editedData[e]==null&&(this.editedData[e]=[]),this.editedData[e][n]=`${s}`}async setValueForRanges(e,n){de.forEachCell(e,(s,i)=>{this.setValueForCell(s,i,n)})}async setValues(e){var n,s;for(let i=0;i<e.length;i+=1){const o=e[i];this.setValueForCell((n=o.column)!=null?n:o.x,(s=o.row)!=null?s:o.y,o.text)}}editValueForCell(e,n){return this.textForCell(e,n)}isValidForCell(e,n,s){return!0}isEditableRange(e){return this.isEditable}delete(e){throw new Error("Method not implemented.")}}const li=class extends zv{constructor({rowCount:t=li.DEFAULT_ROW_COUNT,columnCount:e=li.DEFAULT_COLUMN_COUNT,children:n=new Map,childRowCount:s=Math.ceil(Math.max(li.MIN_CHILD_ROW_COUNT,t*li.DEFAULT_CHILD_ROW_COUNT_FACTOR)),maxDepth:i=li.MAX_DEPTH}={}){super({rowCount:t,columnCount:e}),this.getCachedModelRowOffset=ln((o,r)=>{let l=null,a=r;const d=[...o].sort((c,u)=>c[0]-u[0]);for(let c=0;c<d.length;c+=1){const[u,m]=d[c];if(a<=u)break;const p=m.rowCount;if(a<=u+p){l=u,a=a-u-1;break}a-=p}return{key:l,offsetRow:a}}),this.getCachedTextForRowHeader=ln((o,r)=>{const{key:l,offsetRow:a}=this.getCachedModelRowOffset(o,r);if(l!=null){const d=o.get(l);if(d!==void 0)return`${l}.${d.textForRowHeader(a)}`}return`${a}`}),this.getCachedTextForCell=ln((o,r,l)=>{const{key:a,offsetRow:d}=this.getCachedModelRowOffset(o,l);if(a!=null){const c=o.get(a);if(c!==void 0)return`${a}.${c.textForCell(r,d)}`}return`${r},${d}`}),this.getCachedIsRowExpandable=ln((o,r,l)=>this.getCachedDepthForRow(o,r)<l),this.getCachedIsRowExpanded=ln((o,r)=>{const{key:l,offsetRow:a}=this.getCachedModelRowOffset(o,r);if(l!=null){const d=o.get(l);if(d!==void 0)return d.isRowExpanded(a)}return o.has(a)}),this.getCachedDepthForRow=ln((o,r)=>{const{key:l,offsetRow:a}=this.getCachedModelRowOffset(o,r);if(l!=null){const d=o.get(l);if(d!==void 0)return d.depthForRow(a)+1}return 0}),this.children=n,this.childRowCount=s,this.maxDepth=i}textForCell(t,e){return this.getCachedTextForCell(this.children,t,e)}textForRowHeader(t){return this.getCachedTextForRowHeader(this.children,t)}isRowMovable(t){return!1}get hasExpandableRows(){return!0}get floatingBottomRowCount(){return 0}isRowExpandable(t){return this.getCachedIsRowExpandable(this.children,t,this.maxDepth)}isRowExpanded(t){return this.getCachedIsRowExpanded(this.children,t)}setRowExpanded(t,e){const{key:n,offsetRow:s}=this.getCachedModelRowOffset(this.children,t),i=new Map(this.children);if(n!=null){const o=this.children.get(n);if(o!==void 0){const{rowCount:r}=o;o.setRowExpanded(s,e),this.numRows+=o.rowCount-r}}else if(e){const o=new li({rowCount:this.childRowCount,columnCount:this.numColumns});i.set(s,o),this.numRows+=o.rowCount}else{const o=i.get(s);o!==void 0&&(this.numRows-=o.rowCount,i.delete(s))}this.children=i}depthForRow(t){return this.getCachedDepthForRow(this.children,t)}};let cr=li;cr.DEFAULT_ROW_COUNT=1e9;cr.DEFAULT_COLUMN_COUNT=100;cr.DEFAULT_CHILD_ROW_COUNT_FACTOR=.01;cr.MIN_CHILD_ROW_COUNT=10;cr.MAX_DEPTH=10;function Wv(t,e){const n=qv(t);return n===void 0?void 0:`${Jv(t)} ? ${n} : ${e}`}function Gv(t){return dh.Column.formatRowColor(t)}function Kv(t,e){return t.formatColor(e)}const Da=Z.module("ConditionalFormattingUtils");var es=(t=>(t.CONDITIONAL="conditional",t.ROWS="rows",t))(es||{}),je=(t=>(t.IS_EQUAL="is-equal",t.IS_NOT_EQUAL="is-not-equal",t.IS_BETWEEN="is-between",t.GREATER_THAN="greater-than",t.GREATER_THAN_OR_EQUAL="greater-than-or-equal",t.LESS_THAN="less-than",t.LESS_THAN_OR_EQUAL="less-than-or-equal",t.IS_NULL="is-null",t.IS_NOT_NULL="is-not-null",t))(je||{}),on=(t=>(t.IS_EXACTLY="is-exactly",t.IS_NOT_EXACTLY="is-not-exactly",t.CONTAINS="contains",t.DOES_NOT_CONTAIN="does-not-contain",t.STARTS_WITH="starts-with",t.ENDS_WITH="ends-with",t.IS_NULL="is-null",t.IS_NOT_NULL="is-not-null",t))(on||{}),Ut=(t=>(t.IS_EXACTLY="is-exactly",t.IS_NOT_EXACTLY="is-not-exactly",t.IS_BEFORE="is-before",t.IS_BEFORE_OR_EQUAL="is-before-or-equal",t.IS_AFTER="is-after",t.IS_AFTER_OR_EQUAL="is-after-or-equal",t.IS_NULL="is-null",t.IS_NOT_NULL="is-not-null",t))(Ut||{}),Uo=(t=>(t.IS_TRUE="is-true",t.IS_FALSE="is-false",t.IS_NULL="is-null",t.IS_NOT_NULL="is-not-null",t))(Uo||{}),pi=(t=>(t.IS_EQUAL="is-equal",t.IS_NOT_EQUAL="is-not-equal",t.IS_NULL="is-null",t.IS_NOT_NULL="is-not-null",t))(pi||{}),$n=(t=>(t.NO_FORMATTING="no-formatting",t.POSITIVE="positive",t.NEGATIVE="negative",t.WARN="warn",t.NEUTRAL="neutral",t.ACCENT_1="accent-1",t.ACCENT_2="accent-2",t.CUSTOM="custom",t))($n||{});function Ah(t){switch(t){case"no-formatting":return"No formatting";case"positive":return"Positive";case"negative":return"Negative";case"warn":return"Warn";case"neutral":return"Neutral";case"accent-1":return"Accent 1";case"accent-2":return"Accent 2";case"custom":return"Custom..."}}function Tl(t){const{type:e,customConfig:n}=t;switch(e){case"no-formatting":return;case"positive":return"#9fde6f";case"negative":return"#ff6087";case"warn":return"#f67f40";case"neutral":return"#ffd95c";case"accent-1":return"#78dce8";case"accent-2":return"#ab9bf5";case"custom":return n==null?void 0:n.background;default:return}}function El(t){const{type:e,customConfig:n}=t;switch(e){case"no-formatting":return;case"positive":return"#526a3f";case"negative":return"#802f44";case"warn":return"#663318";case"neutral":return"#63562b";case"accent-1":return"#3f6469";case"accent-2":return"#554d72";case"custom":return n==null?void 0:n.color;default:return}}function qv(t){const e=El(t.style),n=Tl(t.style);if(!(e===void 0||n===void 0))return`bgfg(\`${n}\`, \`${e}\`)`}function Yv(t){const{column:e,value:n,start:s,end:i}=t;return hT(e.name,t.condition,n,s,i)}function Xv(t){const{column:e,value:n}=t;return uT(e.name,t.condition,n)}function jv(t){const{column:e,value:n}=t;return mT(e.name,t.condition,n)}function Zv(t){const{column:e}=t;return pT(e.name,t.condition)}function Qv(t){const{column:e,value:n}=t;return gT(e.name,t.condition,n)}function Jv(t){const{column:e}=t;if(_.isNumberType(e.type))return Yv(t);if(_.isCharType(e.type))return Qv(t);if(_.isStringType(e.type))return Xv(t);if(_.isDateType(e.type))return jv(t);if(_.isBooleanType(e.type))return Zv(t);throw new Error("Invalid column type")}function eT(t){switch(t){case"is-equal":return"is equal to";case"is-not-equal":return"is not equal to";case"is-between":return"is between";case"greater-than":return"greater than";case"greater-than-or-equal":return"greater than or equal to";case"less-than":return"less than";case"less-than-or-equal":return"less than or equal to";case"is-null":return"is null";case"is-not-null":return"is not null"}}function tT(t){switch(t){case"is-exactly":return"is exactly";case"is-not-exactly":return"is not exactly";case"contains":return"contains";case"does-not-contain":return"does not contain";case"starts-with":return"starts with";case"ends-with":return"ends with";case"is-null":return"is null";case"is-not-null":return"is not null"}}function nT(t){switch(t){case"is-exactly":return"is";case"is-not-exactly":return"is not";case"is-before":return"is before";case"is-before-or-equal":return"is before or equal";case"is-after":return"is after";case"is-after-or-equal":return"is after or equal";case"is-null":return"is null";case"is-not-null":return"is not null"}}function sT(t){switch(t){case"is-true":return"is true";case"is-false":return"is false";case"is-null":return"is null";case"is-not-null":return"is not null"}}function iT(t){switch(t){case"is-equal":return"is";case"is-not-equal":return"is not";case"is-null":return"is null";case"is-not-null":return"is not null"}}function Rp(t){if(_.isNumberType(t)||_.isCharType(t))return"is-equal";if(_.isStringType(t)||_.isDateType(t))return"is-exactly";if(_.isBooleanType(t))return"is-true";throw new Error("Invalid column type")}function oT(t){if(_.isCharType(t)||_.isStringType(t))return""}function Dp(t){const{condition:e,value:n,start:s,end:i}=t;return{condition:e,value:n,start:s,end:i}}function Jl(t){return{condition:Rp(t),value:oT(t),start:void 0,end:void 0}}function Mp(){return{type:"no-formatting"}}function rT(t){switch(t){case"is-exactly":return"==";case"is-not-exactly":return"!=";case"contains":return"contains";case"does-not-contain":return"does not contain";case"starts-with":return"starts with";case"ends-with":return"ends with";case"is-null":return"is null";case"is-not-null":return"is not null"}}function lT(t){switch(t){case"is-exactly":return"==";case"is-not-exactly":return"!=";case"is-before":return"<";case"is-before-or-equal":return"<=";case"is-after":return">";case"is-after-or-equal":return">=";case"is-null":return"is null";case"is-not-null":return"is not null"}}function aT(t){switch(t){case"is-true":return"is true";case"is-false":return"is false";case"is-null":return"is null";case"is-not-null":return"is not null"}}function dT(t){switch(t){case"is-equal":return"==";case"is-not-equal":return"!=";case"is-null":return"is null";case"is-not-null":return"is not null"}}function cT(t){switch(t){case"is-equal":return"==";case"is-not-equal":return"!=";case"is-between":return"==";case"greater-than":return">";case"greater-than-or-equal":return">=";case"less-than":return"<";case"less-than-or-equal":return"<=";case"is-null":return"is null";case"is-not-null":return"is not null"}}function hT(t,e,n,s,i){switch(e){case"is-equal":return`${t} == ${n}`;case"is-not-equal":return`${t} != ${n}`;case"is-between":return`${t} > ${s} && ${t} < ${i}`;case"greater-than":return`${t} > ${n}`;case"greater-than-or-equal":return`${t} >= ${n}`;case"less-than":return`${t} < ${n}`;case"less-than-or-equal":return`${t} <= ${n}`;case"is-null":return`${t} == null`;case"is-not-null":return`${t} != null`}}function uT(t,e,n){switch(e){case"is-exactly":return`${t} == "${n}"`;case"is-not-exactly":return`${t} != "${n}"`;case"contains":return`${t} != null && ${t}.contains("${n}")`;case"does-not-contain":return`${t} != null && !${t}.contains("${n}")`;case"starts-with":return`${t} != null && ${t}.startsWith("${n}")`;case"ends-with":return`${t} != null && ${t}.endsWith("${n}")`;case"is-null":return`${t} == null`;case"is-not-null":return`${t} != null`}}function mT(t,e,n){switch(e){case"is-exactly":return`${t} == convertDateTime("${n}")`;case"is-not-exactly":return`${t} != convertDateTime(\`${n}\`)`;case"is-before":return`${t} < convertDateTime(\`${n}\`)`;case"is-before-or-equal":return`${t} <= convertDateTime("${n}")`;case"is-after":return`${t} > convertDateTime(\`${n}\`)`;case"is-after-or-equal":return`${t} >= convertDateTime(\`${n}\`)`;case"is-null":return`${t} == null`;case"is-not-null":return`${t} != null`}}function pT(t,e){switch(e){case"is-true":return`${t} == true`;case"is-false":return`${t} == false`;case"is-null":return`${t} == null`;case"is-not-null":return`${t} != null`}}function gT(t,e,n){switch(e){case"is-equal":return`${t} == '${n}'`;case"is-not-equal":return`${t} != '${n}'`;case"is-null":return`isNull(${t})`;case"is-not-null":return`!isNull(${t})`}}function fT(t,e){if(_.isNumberType(t))return cT(e);if(_.isCharType(t))return dT(e);if(_.isStringType(t))return rT(e);if(_.isDateType(t))return lT(e);if(_.isBooleanType(t))return aT(e);throw new Error("Invalid column type")}function CT(t,e){if(e===void 0)return Da.debug("no rules passed."),[];const n=[];let s;const i=new Map;return e.forEach(({config:o,type:r})=>{var g;const{column:l}=o,a=t.find(({name:f,type:b})=>f===l.name&&b===l.type);if(a===void 0){Da.debug(`Column ${l.name}:${l.type} not found. Ignoring format rule.`,o);return}const[d,c]=(g=r==="conditional"?i.get(a.name):s)!=null?g:["null",void 0],u=Wv(o,d);if(u===void 0){Da.debug("Ignoring format rule.",o);return}const m=c===void 0?-1:n.indexOf(c);m>-1&&n.splice(m,1);const p=r==="conditional"?Kv(a,u):Gv(u);n.push(p),r==="conditional"?i.set(a.name,[u,p]):s=[u,p]}),n}function bT({type:t}){return _.isNumberType(t)||_.isCharType(t)||_.isStringType(t)||_.isDateType(t)||_.isBooleanType(t)}function ea({animation:t="iris-grid-bottom-bar-slide-up",children:e,className:n,isShown:s,onClick:i,onEntering:o,onEntered:r,onExiting:l,onExited:a}){return h(mt,{in:s,timeout:ze.transitionMs,classNames:t,onEntering:o,onEntered:r,onExiting:l,onExited:a,mountOnEnter:!0,unmountOnExit:!0,children:h("div",{className:z("iris-grid-bottom-bar",n),role:"presentation",onClick:i,onKeyPress:i,children:e})})}const ST=3e3,wT=5;function vT({isSaving:t=!1,onSave:e,onDiscard:n,discardTooltip:s,saveTooltip:i,error:o,pendingDataErrors:r,pendingDataMap:l,onEntering:a,onEntered:d,onExiting:c,onExited:u}){const[m,p]=w.exports.useState(!1),[g,f]=w.exports.useState(!1),b=w.exports.useRef(),C=Al(t),S=w.exports.useMemo(()=>r.size===0?o:r.size<=wT?`Key can't be empty (on pending row${r.size>1?"s":""} ${Array.from(r.keys()).join(", ").trim()})`:`Key can't be empty (on ${r.size} rows)`,[o,r]);w.exports.useEffect(function(){C!=null&&C&&!t&&S==null&&(p(!0),f(!0),b.current=setTimeout(()=>{p(!1)},ST))},[S,t,C]),w.exports.useEffect(function(){b.current&&l.size>0&&(clearTimeout(b.current),p(!1),f(!1))},[l]),w.exports.useEffect(function(){return()=>b.current?clearTimeout(b.current):void 0},[]);const v=l.size;let y;return t?y=h(On,{}):g&&(y=yd),T(ea,{className:"pending-data-bottom-bar",isShown:v>0||m||S!=null,onEntering:a,onEntered:d,onExiting:c,onExited:()=>{f(!1),u&&u()},children:[S!=null&&S!==""&&T("div",{className:"error-message",children:[h(ee,{icon:fs}),h("span",{children:`${S}`})]}),(S==null||S==="")&&h("div",{className:"status-message",children:v>0&&h("span",{children:`${v} row${v>1?"s":""} pending`})}),T("div",{className:"buttons-container",children:[!t&&!g&&h(W,{kind:"secondary",onClick:n,tooltip:s,children:"Discard"}),T(W,{kind:g?"success":"primary",onClick:e,icon:y,disabled:t||g||S!=null,tooltip:i,children:[t&&"Committing...",!t&&g&&"Success",!t&&!g&&"Commit"]})]})]})}var Oe=(t=>(t.COUNT="Count",t.MIN="Min",t.MAX="Max",t.SUM="Sum",t.ABS_SUM="AbsSum",t.VAR="Var",t.AVG="Avg",t.STD="Std",t.FIRST="First",t.LAST="Last",t.SKIP="Skip",t.COUNT_DISTINCT="CountDistinct",t.DISTINCT="Distinct",t.UNIQUE="Unique",t))(Oe||{});const TT=t=>{switch(t){default:return!1}},ET=(t,e)=>{switch(t){case Oe.COUNT:case Oe.FIRST:case Oe.LAST:case Oe.COUNT_DISTINCT:case Oe.DISTINCT:case Oe.UNIQUE:return!0;case Oe.MIN:case Oe.MAX:return _.isNumberType(e)||_.isDateType(e)||_.isTextType(e);case Oe.SUM:case Oe.ABS_SUM:case Oe.VAR:case Oe.AVG:case Oe.STD:return _.isNumberType(e);case Oe.SKIP:return!1}},tc=(t,e)=>t.filter(n=>ET(e,n.type)),yT=(t,e,n,s)=>tc(t,e).map(({name:i})=>i).filter(i=>n.includes(i)?!s:s),Bs={isRollupOperation:TT,filterValidColumns:tc,getOperationColumnNames:yT};var Si=(t=>(t.FILTER_CONTROL_CHANGE_CLEARS_ALL_FILTERS="filter-control-change-clears-all-filters",t.LINK_CHANGE_CLEARS_ALL_FILTERS="link-change-clears-all-filters",t))(Si||{});const IT=Object.freeze([[Si.FILTER_CONTROL_CHANGE_CLEARS_ALL_FILTERS,!1],[Si.LINK_CHANGE_CLEARS_ALL_FILTERS,!1]]),Np={DEFAULTS:IT},RT=Z.module("ColumnHeaderGroup");function Ma(t){return t instanceof Gn}const Fp=class{constructor({name:t,children:e,color:n,depth:s,childIndexes:i,parent:o}){this.getVisibleRange=Se(r=>{const l=this.childIndexes.flat(),a=J.getVisibleIndexes(l,r),d=Math.min(...a),c=Math.max(...a);return c-d!==l.length-1&&RT.warn(`Column header group ${this.name} is not contiguous`),[d,c]}),this.name=t,this.children=e,this.color=n,this.depth=s,this.childIndexes=i,this.parent=o}setParent(t){this.parent=t}addChildren(t){const e=new Set(this.children.concat(t));this.children=[...e]}removeChildren(t){const e=new Set(this.children);t.forEach(n=>e.delete(n)),this.children=[...e]}get isNew(){return this.name.startsWith(Fp.NEW_GROUP_PREFIX)}};let Gn=Fp;Gn.NEW_GROUP_PREFIX=":newGroup";const Do=Z.module("IrisGridUtils");function _s(t,e){return t>=0&&t<e.length}class ie{static dehydrateGridState(e,n){const{isStuckToBottom:s,isStuckToRight:i,movedColumns:o,movedRows:r}=n,{columns:l}=e;return{isStuckToBottom:s,isStuckToRight:i,movedColumns:[...o].filter(({to:a,from:d})=>_s(a,l)&&(typeof d=="number"&&_s(d,l)||Array.isArray(d)&&_s(d[0],l)&&_s(d[1],l))).map(({to:a,from:d})=>({to:l[a].name,from:Array.isArray(d)?[l[d[0]].name,l[d[1]].name]:l[d].name})),movedRows:[...r]}}static hydrateGridState(e,n,s=[]){const{isStuckToBottom:i,isStuckToRight:o,movedColumns:r,movedRows:l}=n,{columns:a}=e,d=ie.parseCustomColumnNames(s),c=a.map(({name:u})=>u).concat(d);return{isStuckToBottom:i,isStuckToRight:o,movedColumns:[...r].map(({to:u,from:m})=>{const p=g=>typeof g=="string"?c.findIndex(f=>f===g):g;return{to:p(u),from:Array.isArray(m)?[p(m[0]),p(m[1])]:p(m)}}).filter(({to:u,from:m})=>_s(u,c)&&(typeof m=="number"&&_s(m,c)||Array.isArray(m)&&_s(m[0],c)&&_s(m[1],c))),movedRows:[...l]}}static dehydrateIrisGridState(e,n){const{aggregationSettings:s={aggregations:[],showOnTop:!1},advancedFilters:i,customColumnFormatMap:o,isFilterBarShown:r,metrics:l,quickFilters:a,customColumns:d,conditionalFormats:c=[],reverseType:u,rollupConfig:m=void 0,showSearchBar:p,searchValue:g,selectDistinctColumns:f=[],selectedSearchColumns:b,sorts:C,invertSearchColumns:S,pendingDataMap:v=new Map,frozenColumns:y,columnHeaderGroups:E}=n;L(l);const{userColumnWidths:I,userRowHeights:R}=l,{columns:N}=e;return{advancedFilters:ie.dehydrateAdvancedFilters(N,i),aggregationSettings:s,customColumnFormatMap:[...o],isFilterBarShown:r,quickFilters:ie.dehydrateQuickFilters(a),sorts:ie.dehydrateSort(C),userColumnWidths:[...I].filter(([F])=>F!=null&&F>=0&&F<N.length).map(([F,P])=>[N[F].name,P]),userRowHeights:[...R],customColumns:[...d],conditionalFormats:[...c],reverseType:u,rollupConfig:m,showSearchBar:p,searchValue:g,selectDistinctColumns:[...f],selectedSearchColumns:b,invertSearchColumns:S,pendingDataMap:ie.dehydratePendingDataMap(N,v),frozenColumns:y,columnHeaderGroups:E==null?void 0:E.map(F=>({name:F.name,children:F.children,color:F.color}))}}static hydrateIrisGridState(e,n){var F,P;const{advancedFilters:s,aggregationSettings:i={aggregations:[],showOnTop:!1},customColumnFormatMap:o,isFilterBarShown:r,quickFilters:l,sorts:a,customColumns:d,conditionalFormats:c,userColumnWidths:u,userRowHeights:m,reverseType:p,rollupConfig:g=void 0,showSearchBar:f,searchValue:b,selectDistinctColumns:C,selectedSearchColumns:S,invertSearchColumns:v=!0,pendingDataMap:y=[],frozenColumns:E,columnHeaderGroups:I}=n,{columns:R,formatter:N}=e;return{advancedFilters:ie.hydrateAdvancedFilters(R,s,N.timeZone),aggregationSettings:i,customColumnFormatMap:new Map(o),isFilterBarShown:r,quickFilters:ie.hydrateQuickFilters(R,l,N.timeZone),sorts:ie.hydrateSort(R,a),userColumnWidths:new Map(u.map(([H,x])=>typeof H=="string"||H instanceof String?[R.findIndex(({name:A})=>A===H),x]:[H,x]).filter(([H])=>H!=null&&H>=0&&H<R.length)),customColumns:d,conditionalFormats:c,userRowHeights:new Map(m),reverseType:p,rollupConfig:g,showSearchBar:f,searchValue:b,selectDistinctColumns:C,selectedSearchColumns:S,invertSearchColumns:v,pendingDataMap:ie.hydratePendingDataMap(R,y),frozenColumns:E,columnHeaderGroups:ie.parseColumnHeaderGroups(e,(P=I!=null?I:(F=e.layoutHints)==null?void 0:F.columnGroups)!=null?P:[]).groups}}static dehydrateIrisGridPanelState(e,n){const{isSelectingPartition:s,partition:i,partitionColumn:o,advancedSettings:r}=n;return{isSelectingPartition:s,partition:i,partitionColumn:o!=null?o.name:void 0,advancedSettings:[...r]}}static hydrateIrisGridPanelState(e,n){const{isSelectingPartition:s,partition:i,partitionColumn:o,advancedSettings:r}=n,{columns:l}=e;return{isSelectingPartition:s,partition:i,partitionColumn:o!=null?ie.getColumnByName(l,o):void 0,advancedSettings:new Map([...Np.DEFAULTS,...r])}}static dehydrateQuickFilters(e){return[...e].map(([n,s])=>{const{text:i}=s;return[n,{text:i}]})}static hydrateQuickFilters(e,n,s){const i=n.map(([o,r])=>{const{text:l}=r;let a=null;try{const d=ie.getColumn(e,o);d!=null&&(a=_.makeQuickFilter(d,l,s))}catch(d){Do.error("hydrateQuickFilters error with",l,d)}return[o,{text:l,filter:a}]});return new Map(i)}static dehydrateAdvancedFilters(e,n){return[...n].map(([s,i])=>{const o=ie.getColumn(e,s);L(o);const r=ie.dehydrateAdvancedFilterOptions(o,i.options);return[s,{options:r}]})}static hydrateAdvancedFilters(e,n,s){const i=n.map(([o,r])=>{const l=ie.getColumn(e,o);L(l);const a=ie.hydrateAdvancedFilterOptions(l,r.options);let d=null;try{ie.getColumn(e,o)!=null&&(d=_.makeAdvancedFilter(l,a,s))}catch(c){Do.error("hydrateAdvancedFilters error with",a,c)}return[o,{options:a,filter:d}]});return new Map(i)}static dehydrateAdvancedFilterOptions(e,n){const{selectedValues:s,...i}=n;return{selectedValues:s==null?void 0:s.map(o=>ie.dehydrateValue(o,e==null?void 0:e.type)),...i}}static hydrateAdvancedFilterOptions(e,n){const{selectedValues:s,...i}=n;return{selectedValues:s==null?void 0:s.map(o=>ie.hydrateValue(o,e==null?void 0:e.type)),...i}}static dehydratePendingDataMap(e,n){return[...n].map(([s,{data:i}])=>[s,{data:[...i].map(([o,r])=>[e[o].name,ie.dehydrateValue(r,e[o].type)])}])}static hydratePendingDataMap(e,n){const s=new Map,i=o=>(s.has(o)||s.set(o,e.findIndex(({name:r})=>r===o)),s.get(o));return new Map(n.map(([o,{data:r}])=>[o,{data:new Map(r.map(([l,a])=>{var c;const d=i(l);return L(d),[(c=i(l))!=null?c:null,ie.hydrateValue(a,e[d].type)]}))}]))}static dehydrateValue(e,n){return _.isDateType(n)?ie.dehydrateDateTime(e):_.isLongType(n)?ie.dehydrateLong(e):e}static hydrateValue(e,n){return _.isDateType(n)?ie.hydrateDateTime(e):_.isLongType(n)?ie.hydrateLong(e):e}static dehydrateDateTime(e){return e!=null?M.i18n.DateTimeFormat.format(Jn.FULL_DATE_FORMAT,e):null}static hydrateDateTime(e){return e!=null?M.i18n.DateTimeFormat.parse(Jn.FULL_DATE_FORMAT,e):null}static dehydrateLong(e){return e!=null?`${e}`:null}static hydrateLong(e){return e!=null?M.LongWrapper.ofString(e):null}static dehydrateSort(e){return e.map(n=>{const{column:s,isAbs:i,direction:o}=n;return{column:s.index,isAbs:i,direction:o}})}static hydrateSort(e,n){return n.map(s=>{const{column:i,isAbs:o,direction:r}=s;if(r===_.sortDirection.reverse)return M.Table.reverse();const l=ie.getColumn(e,i);if(l!=null){let a=l.sort();return o&&(a=a.abs()),r===_.sortDirection.descending?a=a.desc():a=a.asc(),a}return null}).filter(s=>s!=null&&s.direction!==_.sortDirection.reverse)}static extractTableSettings(e,n=[]){const{irisGridPanelState:s,irisGridState:i}=e,{partitionColumn:o,partition:r}=s,{advancedFilters:l,quickFilters:a,sorts:d}=i;return{advancedFilters:l,inputFilters:n,partition:r,partitionColumn:o,quickFilters:a,sorts:d}}static applyTableSettings(e,n,s){const{columns:i}=e;let o=[];n.quickFilters&&(o=ie.getFiltersFromFilterMap(ie.hydrateQuickFilters(i,n.quickFilters,s)));let r=[];n.advancedFilters&&(r=ie.getFiltersFromFilterMap(ie.hydrateAdvancedFilters(i,n.advancedFilters,s)));const l=ie.getFiltersFromInputFilters(i,n.inputFilters,s);let a=[];n.sorts&&(a=ie.hydrateSort(i,n.sorts));let d=[...o,...r];const{partition:c,partitionColumn:u}=n;if(c!=null&&u!=null){const m=ie.getColumnByName(i,u);m&&(d=[m.filter().eq(M.FilterValue.ofString(c)),...d])}d=[...l,...d],e.applyFilter(d),e.applySort(a)}static getInputFiltersForColumns(e,n=[]){return n.filter(({name:s,type:i})=>e.find(({name:o,type:r})=>o===s&&r===i))}static getFiltersFromInputFilters(e,n=[],s){return n.map(({name:i,type:o,value:r})=>{const l=e.find(({name:a,type:d})=>a===i&&d===o);if(l)try{return _.makeQuickFilter(l,r,s)}catch(a){Do.debug("Unable to create input filter",a)}return null}).filter(i=>i!=null)}static getFiltersFromFilterMap(e){const n=[],s=Array.from(e.keys());for(let i=0;i<s.length;i+=1){const o=s[i],r=e.get(o);r&&r.filter!=null&&n.push(r.filter)}return n}static getHiddenColumns(e){return[...e.entries()].filter(([,n])=>n===0).map(([n])=>n)}static parseCustomColumnNames(e){return e.map(n=>n.split("=")[0])}static getRemovedCustomColumnNames(e,n){const s=ie.parseCustomColumnNames(e),i=ie.parseCustomColumnNames(n);return s.filter(o=>!i.includes(o))}static removeSortsInColumns(e,n){return e.filter(s=>!n.includes(s.column.name))}static removeFiltersInColumns(e,n,s){const i=e.map(({name:r})=>r),o=new Map(n);return s.forEach(r=>o.delete(i.indexOf(r))),o}static removeColumnFromMovedColumns(e,n,s){const i=e.map(({name:r})=>r);let o=[...n];for(let r=0;r<s.length;r+=1){const l=s[r];let a=i.findIndex(c=>c===l);const d=[];for(let c=0;c<o.length;c+=1){const u=o[c],m={...u};let[p,g]=Array.isArray(u.from)?u.from:[u.from,u.from];a<=u.to&&(m.to-=1),a<p&&(p-=1),a<=g&&(g-=1),p<=g&&p!==m.to&&(p===g?d.push({...m,from:p}):d.push({...m,from:[p,g]})),a=J.applyItemMoves(a,a,[u])[0][0]}o=d,i.splice(i.findIndex(c=>c===l),1)}return o}static removeColumnsFromSelectDistinctColumns(e,n){return e.filter(s=>!n.includes(s))}static getVisibleColumnsInRange(e,n,s,i,o){const r=[];for(let l=n;l<=s;l+=1){const a=J.getModelIndex(l,i);a>=0&&a<e.length&&!o.includes(a)&&r.push(e[a])}return r}static getPrevVisibleColumns(e,n,s,i,o){const r=[];let l=n;for(;l>=0&&r.length<s;){const a=J.getModelIndex(l,i);a>=0&&a<e.length&&!o.includes(a)&&r.unshift(e[a]),l-=1}return r}static getNextVisibleColumns(e,n,s,i,o){const r=[];let l=n;for(;l<e.length&&r.length<s;){const a=J.getModelIndex(l,i);a>=0&&a<e.length&&!o.includes(a)&&r.push(e[a]),l+=1}return r}static getColumnsToFetch(e,n,s){const i=[...n];return s.forEach(o=>{const r=e.find(({name:l})=>l===o);r!=null&&!n.includes(r)&&i.push(r)}),i}static getModelViewportColumns(e,n,s,i,o=[],r=[],l=0){if(n==null||s==null)return null;const a=ie.getVisibleColumnsInRange(e,n,s,i,o),d=a.length*l,c=ie.getPrevVisibleColumns(e,n-1,d,i,o),u=ie.getNextVisibleColumns(e,s+1,d,i,o),m=[...c,...a,...u];return ie.getColumnsToFetch(e,m,r)}static rangeSetFromRanges(e){const n=e.slice().sort((s,i)=>(L(s.startRow),L(i.startRow),s.startRow-i.startRow)).map(s=>{const{startRow:i,endRow:o}=s;return L(i),L(o),M.RangeSet.ofRange(i,o)});return M.RangeSet.ofRanges(n)}static isValidSnapshotRanges(e){if(e==null||e.length===0)return!1;const n=new Map;for(let o=0;o<e.length;o+=1){const r=e[o],l=`${r.startRow}:${r.endRow}`,a=`${r.startColumn}:${r.endColumn}`;n.has(l)||n.set(l,[]),n.get(l).push(a)}const s=[...n.keys()],i=n.get(s[0]).sort().join(",");for(let o=1;o<s.length;o+=1)if(n.get(s[o]).sort().join(",")!==i)return!1;return!0}static isValidIndex(e){return!Number.isInteger(e)||typeof e!="number"?!1:e>=0}static columnsFromRanges(e,n){var i,o;if(e==null||e.length===0)return[];if(e[0].startColumn===null&&e[0].endColumn===null)return n;const s=new Set;for(let r=0;r<e.length;r+=1){const l=e[r];L(l.startColumn),L(l.endColumn);for(let a=(i=l.startColumn)!=null?i:0;a<=((o=l.endColumn)!=null?o:n.length-1);a+=1)s.add(a)}return[...s].map(r=>n[r])}static snapshotDataToMatrix(e){const{columns:n,rows:s}=e,i=[];for(let o=0;o<s.length;o+=1){const r=s[o],l=[];for(let a=0;a<n.length;a+=1){const d=n[a],c=r.get(d);l.push(c)}i.push(l)}return i}static getModelRollupConfig(e,n,s){var u,m,p;if(((m=(u=n==null?void 0:n.columns)==null?void 0:u.length)!=null?m:0)===0)return null;const{columns:i=[],showConstituents:o=!0,showNonAggregatedColumns:r=!0,includeDescriptions:l=!0}=n!=null?n:{},{aggregations:a=[]}=s!=null?s:{},d=a.map(({operation:g,selected:f,invert:b})=>Bs.isRollupOperation(g)?[]:Bs.getOperationColumnNames(e,g,f,b)),c={};for(let g=0;g<a.length;g+=1)c[a[g].operation]=d[g];if(r){const g=new Set(e.map(f=>f.name).filter(f=>!i.includes(f)));if(d.forEach(f=>{f.forEach(b=>g.delete(b))}),g.size>0){const f=(p=c[Oe.FIRST])!=null?p:[];c[Oe.FIRST]=[...f,...g]}}return{groupingColumns:i,includeConstituents:o,includeDescriptions:l,aggregations:c}}static getPendingErrors(e){e.forEach((n,s)=>{if(!ie.isValidIndex(s))throw new Error(`Invalid rowIndex ${s}`);const{data:i}=n;i.forEach((o,r)=>{if(!ie.isValidIndex(r))throw new Error(`Invalid columnIndex ${r}`)})})}static getColumn(e,n){return n<e.length?e[n]:(Do.error("Unable to retrieve column",n,">=",e.length),null)}static getColumnByName(e,n){const s=e.find(({name:i})=>i===n);return s==null&&Do.error("Unable to retrieve column by name",n,e.map(({name:i})=>i)),s}static changeFilterColumnNamesToIndexes(e,n){return n.map(({name:s,filter:i})=>{const o=e.findIndex(r=>r.name===s);return o<0?null:[o,i]}).filter(s=>s!=null)}static combineFiltersFromList(e,n){n.sort((i,o)=>i.operator==="eq"&&o.operator!=="eq"?1:i.operator!=="eq"&&o.operator==="eq"?-1:i.startColumnIndex-o.startColumnIndex);let s="";for(let i=0;i<n.length;i+=1){const{text:o,value:r,operator:l}=n[i];if(r!==void 0){let a="";l!==void 0&&(r==null&&l==="eq"?a="=":l!=="eq"&&(l==="startsWith"||l==="endsWith"?a="*":a=_.getFilterOperatorString(l)));let d=`${a}${o}`;l==="startsWith"&&(d=`${o}${a}`),e!=null&&r!==null&&_.isCharType(e)&&(d=`${a}${String.fromCharCode(parseInt(o,10))}`),i!==0&&(s+=l==="eq"?" || ":" && "),s+=d}}return s}static parseColumnHeaderGroups(e,n){let s=1;const i=new Map,o=new Map,r=n==null?void 0:n.filter(({children:u})=>u.length>0);if(r.length===0)return{groups:[],maxDepth:s,parentMap:i,groupMap:o};const l=new Map(r.map(u=>[u.name,u])),a=new Set,d=u=>{const{name:m}=u;if(e.getColumnIndexByName(m)!=null)throw new Error(`Column header group has same name as column: ${m}`);const p=o.get(m);if(p)return p;const g=[];let f=1;u.children.forEach(C=>{if(a.has(C))throw new Error(`Column group child ${C} specified in multiple groups`);a.add(C);const S=l.get(C),v=e.getColumnIndexByName(C);if(S){const y=d(S);g.push(...y.childIndexes),f=Math.max(f,y.depth+1)}else if(v!=null)g.push(v),f=Math.max(f,1);else throw new Error(`Unknown child ${C} in group ${m}`)});const b=new Gn({...u,depth:f,childIndexes:g.flat()});return o.set(m,b),u.children.forEach(C=>i.set(C,b)),s=Math.max(s,b.depth+1),b},c=new Set;return r.forEach(u=>{const{name:m}=u;if(c.has(m))throw new Error(`Duplicate column group name: ${m}`);c.add(m),d(u)}),o.forEach(u=>{var m;u.setParent((m=i.get(u.name))==null?void 0:m.name)}),{groups:[...o.values()],maxDepth:s,groupMap:o,parentMap:i}}}const Jt=Z.module("IrisGridCopyHandler"),Ue=class extends w.exports.Component{constructor(t){super(t),this.handleBackgroundClick=this.handleBackgroundClick.bind(this),this.handleCancelClick=this.handleCancelClick.bind(this),this.handleCopyClick=this.handleCopyClick.bind(this),this.handleHideTimeout=this.handleHideTimeout.bind(this),this.state={error:void 0,copyState:Ue.COPY_STATES.IDLE,buttonState:Ue.BUTTON_STATES.COPY,isShown:!1,rowCount:0}}static getStatusMessageText(t,e){switch(t){case Ue.COPY_STATES.CONFIRMATION_REQUIRED:return`Are you sure you want to copy ${e.toLocaleString()} rows to your clipboard?`;case Ue.COPY_STATES.CLICK_REQUIRED:return`Fetched ${e.toLocaleString()} rows!`;case Ue.COPY_STATES.FETCH_ERROR:return"Unable to copy data.";case Ue.COPY_STATES.FETCH_IN_PROGRESS:return`Fetching ${e.toLocaleString()} rows for clipboard...`;case Ue.COPY_STATES.DONE:return"Copied to Clipboard!";default:return""}}static getCopyButtonText(t){switch(t){case Ue.BUTTON_STATES.FETCH_IN_PROGRESS:return"Fetching";case Ue.BUTTON_STATES.CLICK_TO_COPY:return"Click to Copy";case Ue.BUTTON_STATES.RETRY:return"Retry";default:return"Copy"}}componentDidMount(){const{copyOperation:t}=this.props;t!=null&&this.startCopy()}componentDidUpdate(t){const{copyOperation:e}=this.props;t.copyOperation!==e&&this.startCopy()}componentWillUnmount(){this.stopCopy()}startCopy(){Jt.debug2("startCopy"),this.stopCopy();const{copyOperation:t}=this.props;if(t==null){Jt.debug2("No copy operation set, cancelling out"),this.setState({isShown:!1});return}const{ranges:e,error:n}=t;if(n!=null){Jt.debug("Showing copy error",n),this.setState({isShown:!0,copyState:Ue.COPY_STATES.DONE,error:n}),this.startHideTimer();return}const s=de.rowCount(e);this.setState({rowCount:s,isShown:!0,error:void 0}),s>Ue.NO_PROMPT_THRESHOLD?this.setState({buttonState:Ue.BUTTON_STATES.COPY,copyState:Ue.COPY_STATES.CONFIRMATION_REQUIRED}):this.startFetch()}stopCopy(){this.textData=void 0,this.stopFetch(),this.stopHideTimer()}handleBackgroundClick(){Jt.debug2("handleBackgroundClick");const{copyState:t}=this.state;t===Ue.COPY_STATES.DONE&&this.setState({isShown:!1})}handleCancelClick(){Jt.debug2("handleCancelClick"),this.stopFetch(),this.setState({isShown:!1})}handleCopyClick(){Jt.debug2("handleCopyClick"),this.textData!=null?this.copyText(this.textData):this.startFetch()}handleHideTimeout(){Jt.debug2("handleHideTimeout"),this.stopHideTimer(),this.setState({isShown:!1})}copyText(t){Jt.debug2("copyText",t),this.textData=t,ro(t).then(()=>{this.setState({copyState:Ue.COPY_STATES.DONE}),this.startHideTimer()},e=>{Jt.error("copyText error",e),this.setState({buttonState:Ue.BUTTON_STATES.CLICK_TO_COPY,copyState:Ue.COPY_STATES.CLICK_REQUIRED})})}startFetch(){this.stopFetch(),this.setState({buttonState:Ue.BUTTON_STATES.FETCH_IN_PROGRESS,copyState:Ue.COPY_STATES.FETCH_IN_PROGRESS});const{model:t,copyOperation:e}=this.props,{ranges:n,includeHeaders:s,userColumnWidths:i,movedColumns:o,formatValues:r}=e;Jt.debug("startFetch",n);const l=ie.getHiddenColumns(i);let a=J.getModelRanges(n,o);if(l.length>0){const c=l.map(de.makeColumn);a=de.subtractRangesFromRanges(a,c)}const d=r!=null&&r?(c,u)=>t.displayString(c,u.type,u.name):c=>`${c}`;this.fetchPromise=ye.makeCancelable(t.textSnapshot(a,s,d)),this.fetchPromise.then(c=>{this.fetchPromise=void 0,this.copyText(c)}).catch(c=>{c instanceof Qi?Jt.debug("User cancelled copy."):(Jt.error("Error fetching contents",c),this.fetchPromise=void 0,this.setState({buttonState:Ue.BUTTON_STATES.RETRY,copyState:Ue.COPY_STATES.FETCH_ERROR}))})}stopFetch(){this.fetchPromise&&(Jt.debug2("stopFetch"),this.fetchPromise.cancel(),this.fetchPromise=void 0)}startHideTimer(){this.stopHideTimer(),this.hideTimer=setTimeout(this.handleHideTimeout,Ue.HIDE_TIMEOUT)}stopHideTimer(){this.hideTimer!=null&&(clearTimeout(this.hideTimer),this.hideTimer=void 0)}render(){const{onEntering:t,onEntered:e,onExiting:n,onExited:s}=this.props,{buttonState:i,copyState:o,isShown:r,rowCount:l,error:a}=this.state,d=o===Ue.COPY_STATES.DONE?"fade":"copy-slide-up",c=Ue.getCopyButtonText(i),u=a!=null?a:Ue.getStatusMessageText(o,l),m=o!==Ue.COPY_STATES.DONE,p=i===Ue.BUTTON_STATES.FETCH_IN_PROGRESS,g=o===Ue.COPY_STATES.DONE;return T(ea,{animation:d,isShown:r,className:z("iris-grid-copy-handler",{"copy-done":g}),onClick:this.handleBackgroundClick,onEntering:t,onEntered:e,onExiting:n,onExited:s,children:[h("div",{className:"status-message",children:h("span",{children:u})}),h(mt,{in:m,timeout:ze.transitionMs,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,children:T("div",{className:"buttons-container",children:[h("button",{type:"button",className:"btn btn-outline-secondary btn-cancel",onClick:this.handleCancelClick,children:"Cancel"}),T(W,{kind:p?"tertiary":"primary",className:z("btn-copy",{"btn-spinner":p}),onClick:this.handleCopyClick,disabled:p,children:[p&&h(On,{}),c]})]})})]})}};let mo=Ue;mo.NO_PROMPT_THRESHOLD=1e4;mo.HIDE_TIMEOUT=3e3;mo.COPY_STATES={IDLE:"IDLE",CONFIRMATION_REQUIRED:"CONFIRMATION_REQUIRED",FETCH_IN_PROGRESS:"FETCH_IN_PROGRESS",FETCH_ERROR:"FETCH_ERROR",CLICK_REQUIRED:"CLICK_REQUIRED",DONE:"DONE"};mo.BUTTON_STATES={COPY:"COPY",FETCH_IN_PROGRESS:"FETCH_IN_PROGRESS",CLICK_TO_COPY:"CLICK_TO_COPY",RETRY:"RETRY"};mo.defaultProps={copyOperation:null,onEntering:()=>{},onEntered:()=>{},onExiting:()=>{},onExited:()=>{}};class xp extends w.exports.PureComponent{constructor(e){super(e);const{debounceMs:n}=e;this.debouncedSendUpdate=Ze(this.sendUpdate.bind(this),n),this.handleCancel=this.handleCancel.bind(this),this.handleChange=this.handleChange.bind(this),this.handleCommit=this.handleCommit.bind(this),this.handleFocus=this.handleFocus.bind(this),this.handleBlur=this.handleBlur.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleContextMenu=this.handleContextMenu.bind(this),this.inputField=null;const{value:s}=e;this.initialValue=s,this.state={isChanged:!1,value:s}}componentDidMount(){var e;(e=this.inputField)==null||e.focus()}componentDidUpdate(e){const{debounceMs:n}=this.props;e.debounceMs!==n&&(this.debouncedSendUpdate.flush(),this.debouncedSendUpdate=Ze(this.sendUpdate.bind(this),n))}componentWillUnmount(){this.debouncedSendUpdate.cancel()}setValue(e){this.initialValue=e,this.setState({value:e})}focus(){var e;(e=this.inputField)==null||e.focus()}handleChange(e){const{value:n}=e.target;this.setState({value:n,isChanged:!0}),this.debouncedSendUpdate(n)}handleCancel(){this.debouncedSendUpdate.cancel();const{initialValue:e}=this,{isChanged:n}=this.state;n&&this.sendUpdate(e);const{onDone:s}=this.props;s()}handleCommit(e=!0,n=!0){this.debouncedSendUpdate.flush();const{onDone:s}=this.props;s(e,n)}handleFocus(){var e;(e=this.inputField)==null||e.select()}handleBlur(e){const{relatedTarget:n}=e;n!=null&&n.classList.contains("context-menu-container")?this.handleCommit(!1,!0):n!=null&&n.classList.contains("advanced-filter-button")?this.handleCommit(!1,!1):this.handleCommit(!0,!0)}handleTab(e=!1){this.debouncedSendUpdate.flush();const{onTab:n}=this.props;n(e)}handleKeyDown(e){switch(e.key){case"Escape":e.stopPropagation(),e.preventDefault(),this.handleCancel();break;case"Enter":e.stopPropagation(),e.preventDefault(),this.handleCommit();break;case"Tab":e.stopPropagation(),e.preventDefault(),this.handleTab(e.shiftKey);break}}handleContextMenu(e){const{onContextMenu:n}=this.props;n(e)}sendUpdate(e){const{onChange:n}=this.props;n(e)}render(){const{className:e,style:n,isAdvancedFilterSet:s,onAdvancedFiltersTriggered:i}=this.props,{value:o}=this.state;return T("div",{style:n,className:"iris-grid-input-autosized-wrapper","data-value":o,children:[h("input",{ref:r=>{this.inputField=r},className:z("iris-grid-input-field",e),type:"text",value:o,onBlur:this.handleBlur,onFocus:this.handleFocus,onChange:this.handleChange,onKeyDown:this.handleKeyDown,onContextMenu:this.handleContextMenu,autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:"false"}),h("div",{className:"advanced-filter-button-container",children:h(W,{kind:"ghost",className:z("btn-link-icon advanced-filter-button",{"filter-set":s}),onClick:i,onContextMenu:this.handleContextMenu,children:T("div",{className:"fa-layers ",children:[h(ee,{icon:Rd,className:"filter-solid"}),h(ee,{icon:hl,className:"filter-light"})]})})})]})}}xp.defaultProps={style:{},className:"",value:"",isAdvancedFilterSet:!1,onAdvancedFiltersTriggered:()=>{},onChange:()=>{},onDone:()=>{},onTab:()=>{},onContextMenu:()=>{},debounceMs:150};class DT extends vi{constructor(e){super(),this.irisGrid=e}onDown(e){const{selectedRanges:n}=this.irisGrid.state;return e.key==="c"&&Ge.isModifierKeyDown(e)?(ie.isValidSnapshotRanges(n)?this.irisGrid.copyRanges(n):this.irisGrid.copyRanges(n,!1,!1,"Invalid copy ranges"),!0):!1}}const MT={TOGGLE_QUICK_FILTER:Ae.createAndAdd({id:"TABLE.TOGGLE_QUICK_FILTER",name:"Toggle Quick Filter",shortcut:[me.CTRL,ge.F],macShortcut:[me.CMD,ge.F]}),CLEAR_ALL_FILTERS:Ae.createAndAdd({id:"TABLE.CLEAR_ALL_FILTERS",name:"Clear All Table Filters",shortcut:[me.CTRL,ge.E],macShortcut:[me.CMD,ge.E]}),CLEAR_FILTERS:Ae.createAndAdd({id:"TABLE.CLEAR_FILTERS",name:"Clear Active Table Filters",shortcut:[me.CTRL,me.SHIFT,ge.E],macShortcut:[me.CMD,me.SHIFT,ge.E]}),REVERSE:Ae.createAndAdd({id:"TABLE.REVERSE",name:"Reverse",shortcut:[me.CTRL,ge.I],macShortcut:[me.CMD,ge.I]}),TOGGLE_SEARCH:Ae.createAndAdd({id:"TABLE.TOGGLE_SEARCH",name:"Toggle Search",shortcut:[me.CTRL,me.SHIFT,ge.F],macShortcut:[me.CMD,me.SHIFT,ge.F]}),GOTO_ROW:Ae.createAndAdd({id:"TABLE.GOTO_ROW",name:"Go to Row",shortcut:[me.CTRL,ge.G],macShortcut:[me.CMD,ge.G]})},NT={COMMIT:Ae.createAndAdd({id:"INPUT_TABLE.COMMIT",name:"Commit",shortcut:[me.CTRL,ge.S],macShortcut:[me.CMD,ge.S]}),DISCARD:Ae.createAndAdd({id:"INPUT_TABLE.DISCARD",name:"Discard",shortcut:[me.CTRL,me.ALT,ge.S],macShortcut:[me.CMD,me.OPTION,ge.S]})},an={TABLE:MT,INPUT_TABLE:NT};class FT extends vi{constructor(e){super(),this.irisGrid=e}onDown(e){if(an.TABLE.REVERSE.matchesEvent(e)){if(!this.irisGrid.isReversible())return!1;const{reverseType:n}=this.irisGrid.state;return n===_.REVERSE_TYPE.NONE?this.irisGrid.reverse(_.REVERSE_TYPE.POST_SORT):this.irisGrid.reverse(_.REVERSE_TYPE.NONE),!0}return!1}}class xT extends vi{constructor(e){super(),this.irisGrid=e}onDown(e){return an.TABLE.CLEAR_FILTERS.matchesEvent(e)?(this.irisGrid.clearAllFilters(),!0):!1}}class _T extends Dt{constructor(e){super(850),this.irisGrid=e}destroyColumnTooltip(){this.irisGrid.setState({overflowButtonTooltipProps:null})}setCursor(e){return this.isHoveringOverflowButton(e)?(this.cursor="pointer",{stopPropagation:!1,preventDefault:!1}):(this.cursor=null,!1)}getButtonPosition({x:e,y:n,column:s,row:i}){if(s==null||i==null)return null;const{renderer:o,grid:r,state:l,props:a}=this.irisGrid;if(!r)return null;const{metrics:d}=l,{model:c}=a,{canvasContext:u}=r,m=r.getTheme(),p={context:u,mouseX:e,mouseY:n,metrics:d,model:c,theme:m},{left:g,top:f,width:b,height:C}=o.getCellOverflowButtonPosition(p);return g==null||b==null||f==null||C==null?null:{left:g,top:f,width:b,height:C}}isHoveringOverflowButton(e){var C;const{x:n,y:s}=e,{left:i,top:o,width:r,height:l}=(C=this.getButtonPosition(e))!=null?C:{};if(i==null||r==null||o==null||l==null)return!1;const{renderer:a,grid:d,state:c,props:u}=this.irisGrid;if(!d)return!1;const{metrics:m}=c,{model:p}=u,{canvasContext:g}=d,f=d.getTheme(),b={context:g,mouseX:n,mouseY:s,metrics:m,model:p,theme:f};return a.shouldRenderOverflowButton(b)&&n>=i&&n<=i+r&&s>=o&&s<=o+l}onMove(e){if(this.isHoveringOverflowButton(e)){const{overflowButtonTooltipProps:n}=this.irisGrid.state,s=this.getButtonPosition(e);ut(n,s)||this.irisGrid.setState({overflowButtonTooltipProps:s})}else this.destroyColumnTooltip();return this.setCursor(e)}onWheel(e){return this.destroyColumnTooltip(),this.onMove(e)}onDown(e){this.destroyColumnTooltip();const{column:n,row:s}=e;return this.isHoveringOverflowButton(e)&&this.irisGrid.setState({showOverflowModal:!0,overflowText:this.irisGrid.getValueForCell(n,s)}),!1}onContextMenu(){return this.destroyColumnTooltip(),!1}onLeave(){return this.destroyColumnTooltip(),!1}}class kT extends Dt{constructor(e){super(),this.irisGrid=e,this.cursor=null}isActive(){const{isSelectingColumn:e}=this.irisGrid.props;return e}isValidColumn(e){if(e==null)return!1;const{columnSelectionValidator:n}=this.irisGrid.props;return n!=null?n(e):!0}updateColumnSelectionStatus(){const{columnSelectionValidator:e}=this.irisGrid.props;e!=null&&e(null)}getTableColumn(e){if(e==null)return null;const{model:n}=this.irisGrid.props,s=this.irisGrid.getModelColumn(e);return s==null?null:n.columns[s]}onMove(e){if(!this.isActive())return!1;const{columnAllowedCursor:n,columnNotAllowedCursor:s}=this.irisGrid.props,{column:i}=e,o=this.getTableColumn(i);return this.isValidColumn(o)?(this.cursor=n,this.irisGrid.setState({hoverSelectColumn:i})):(this.cursor=s,this.irisGrid.setState({hoverSelectColumn:null})),!0}onWheel(e){if(!this.isActive())return!1;const{columnAllowedCursor:n,columnNotAllowedCursor:s}=this.irisGrid.props,{column:i}=e,o=this.getTableColumn(i);return this.isValidColumn(o)?this.cursor=n:this.cursor=s,{preventDefault:!1,stopPropagation:!1}}onLeave(){return this.isActive()&&this.irisGrid.setState({hoverSelectColumn:null}),this.updateColumnSelectionStatus(),!1}onDown(){return this.isActive()}onClick(e){if(!this.isActive())return!1;const{column:n}=e,s=this.getTableColumn(n);return s!=null&&this.isValidColumn(s)&&this.irisGrid.selectColumn(s),!0}}class OT extends Dt{constructor(e){super(),this.irisGrid=e}hideColumnTooltip(){const{tooltip:e}=this.irisGrid;e&&(e.stopTimer(),e.hide())}onDown(){return this.hideColumnTooltip(),!1}onContextMenu(){return this.hideColumnTooltip(),!1}onWheel(){return this.hideColumnTooltip(),!1}onLeave(e,n,s){const{relatedTarget:i}=s instanceof MouseEvent?s:s.nativeEvent,{tooltip:o}=this.irisGrid;if(!o)return!1;const r=o.popper.current;return r&&i instanceof Element&&r.element.contains(i)||this.hideColumnTooltip(),!1}onMove(e){const{column:n,row:s,columnHeaderDepth:i}=e,{shownColumnTooltip:o}=this.irisGrid.state;let r=null;return n!==null&&s===null&&i===0&&(r=n),r!==o&&this.irisGrid.setState({shownColumnTooltip:r}),!1}}const _p=class extends w.exports.Component{constructor(t=_p.defaultProps){super(t),this.handleInputChange=this.handleInputChange.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.inputRef=X.createRef()}handleInputChange(){const{onChange:t}=this.props;this.inputRef.current&&t(this.inputRef.current.value)}closeContextMenu(){const{forwardedProps:t}=this.props,{closeMenu:e}=t;e(!0)}revertToDefault(){const{onChange:t}=this.props;t(null)}returnFocusToContextMenu(){const t=Rb.getClosestByClassName(this.inputRef.current,"context-menu-container");t instanceof HTMLElement&&t.focus()}handleKeyDown(t){switch(t.key){case"Enter":t.stopPropagation(),this.closeContextMenu();break;case"Escape":t.stopPropagation(),this.revertToDefault(),this.closeContextMenu();break;case"ArrowRight":case"ArrowLeft":t.stopPropagation();break;case"ArrowUp":case"ArrowDown":this.returnFocusToContextMenu();break;default:t.stopPropagation()}}render(){const{formatString:t,forwardedProps:e,placeholder:n,title:s}=this.props,{menuItem:{description:i},iconElement:o}=e;return T("div",{className:"form-group flex-grow mb-0",children:[T("div",{className:"custom-format-title",children:[h("span",{className:"icon",children:o}),T("label",{className:"title mb-0",htmlFor:"custom-format-input",children:[s,i!=null&&h(Ye,{children:i})]})]}),h("div",{className:"pl-2 pr-2 pb-2",children:h("input",{id:"custom-format-input",className:"form-control text-right mb-0",type:"text",defaultValue:t,ref:this.inputRef,placeholder:n,onKeyDown:this.handleKeyDown,onChange:this.handleInputChange,autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:"false"})})]})}};let kp=_p;kp.defaultProps={formatString:"",forwardedProps:{menuItem:{},closeMenu(t){},iconElement:null},placeholder:"",title:"",onChange(t){}};class dn{static isDefaultSelected(e){return!e||![nt.TYPE_CONTEXT_CUSTOM,nt.TYPE_CONTEXT_PRESET].includes(e.type)}static isCustomSelected(e){return e!=null&&e.type===nt.TYPE_CONTEXT_CUSTOM}static makeOption(e,n,s,i){return{title:e,description:e,group:s,format:n,isSelected:i}}static makeCustomFormatOption(e,n,s,i,o){return{title:e.label,description:e.label,format:e,group:n,isSelected:i,menuElement:h(kp,{formatString:e.formatString,title:e.label,placeholder:s,onChange:o})}}}const zn=class{static getOptions(t,e){const n=new Date,i=[{group:zn.dateGroup,formatString:"yyyy-MM-dd"},{group:zn.dateGroup,formatString:"MM-dd-yyyy"},{group:zn.timeGroup,formatString:"HH:mm:ss"},{group:zn.timeGroup,formatString:"HH:mm:ss.SSS"},{group:zn.timeGroup,formatString:"HH:mm:ss.SSSSSSSSS"},{group:zn.dateTimeGroup,formatString:"yyyy-MM-dd HH:mm:ss"},{group:zn.dateTimeGroup,formatString:"yyyy-MM-dd HH:mm:ss.SSS"},{group:zn.dateTimeGroup,formatString:"yyyy-MM-dd HH:mm:ss.SSSSSSSSS"}].map(r=>{const l=st.makeFormat("",r.formatString,st.TYPE_CONTEXT_PRESET),a=t.getFormattedString(n,_.dataType.DATETIME,"",l);return dn.makeOption(a,l,r.group,st.isSameFormat(l,e))});return[dn.makeOption("Default",null,zn.dateGroup,dn.isDefaultSelected(e)),...i]}};let ta=zn;ta.dateGroup=10;ta.timeGroup=20;ta.dateTimeGroup=30;const Wn=class{static getOptions(t,e){const n=[{format:_e.FORMAT_PERCENT,group:Wn.presetGroup},{format:_e.FORMAT_BASIS_POINTS,group:Wn.presetGroup},{format:_e.FORMAT_MILLIONS,group:Wn.presetGroup},{format:_e.FORMAT_SCIENTIFIC_NOTATION,group:Wn.presetGroup},{format:_e.FORMAT_ROUND,group:Wn.presetRoundGroup},{format:_e.FORMAT_ROUND_TWO_DECIMALS,group:Wn.presetRoundGroup},{format:_e.FORMAT_ROUND_FOUR_DECIMALS,group:Wn.presetRoundGroup}],s=dn.makeOption("Default",null,Wn.defaultGroup,dn.isDefaultSelected(t)),i=n.map(a=>dn.makeOption(a.format.label,a.format,a.group,_e.isSameFormat(a.format,t))),o=dn.isCustomSelected(t),r=o?t:_e.makeCustomFormat(),l=dn.makeCustomFormatOption(r,Wn.customGroup,_e.DEFAULT_FORMAT_STRING,o,a=>{if(a!=null){const d=_e.makeCustomFormat(a);_e.isValid(d)&&e(d)}else e(null)});return[s,...i,l]}};let hr=Wn;hr.defaultGroup=10;hr.presetGroup=20;hr.presetRoundGroup=30;hr.customGroup=40;const Bo=class{static getOptions(t,e){const n=[{format:Qe.FORMAT_MILLIONS,group:Bo.presetGroup},{format:Qe.FORMAT_SCIENTIFIC_NOTATION,group:Bo.presetGroup}],s=dn.makeOption("Default",null,Bo.defaultGroup,dn.isDefaultSelected(t)),i=n.map(a=>dn.makeOption(a.format.label,a.format,a.group,Qe.isSameFormat(a.format,t))),o=dn.isCustomSelected(t),r=o?t:Qe.makeCustomFormat(),l=dn.makeCustomFormatOption(r,Bo.customGroup,Qe.DEFAULT_FORMAT_STRING,o,a=>{if(a!=null){const d=Qe.makeCustomFormat(a);Qe.isValid(d)&&e(d)}else e(null)});return[s,...i,l]}};let na=Bo;na.defaultGroup=10;na.presetGroup=20;na.customGroup=30;const Ph=Z.module("IrisGridContextMenuHandler"),LT=150,Hh="yyyy-MM-dd HH:mm:ss.SSSSSSSSS",se=class extends Dt{constructor(t){super(),this.debouncedUpdateCustomFormat=Ze(t.handleFormatSelection,LT),this.irisGrid=t}static getQuickFilterCondition(t,e,n){return t&&n==="&&"?t.and(e):t&&n==="||"?t.or(e):e}static getQuickFilterText(t,e,n){return n&&t!=null?`${t} ${n} ${e}`:e}static getOperatorAsText(t){return t==="&&"?"And":"Or"}static getNumberValueEqualsFilter(t,e){const n=t.filter();if(e===Number.POSITIVE_INFINITY)return M.FilterCondition.invoke("isInf",n).and(n.greaterThan(M.FilterValue.ofNumber(0)));if(e===Number.NEGATIVE_INFINITY)return M.FilterCondition.invoke("isInf",n).and(n.lessThan(M.FilterValue.ofNumber(0)));if(Number.isNaN(e))return M.FilterCondition.invoke("isNaN",n);const s=se.getFilterValueForNumberOrChar(t.type,e);return n.eq(s)}static getFilterValueForNumberOrChar(t,e){return _.isCharType(t)?M.FilterValue.ofString(String.fromCharCode(e)):M.FilterValue.ofNumber(e)}componentWillUnmount(){this.debouncedUpdateCustomFormat.flush()}getHeaderActions(t,e){var F;const{irisGrid:n}=this,{column:s}=e;L(s);const{model:i}=n.props,{columns:o}=i,r=o[t],l=[],{metrics:a,reverseType:d,quickFilters:c,advancedFilters:u,searchFilter:m}=n.state,p=n.getTheme();L(a);const{filterIconColor:g,filterBarActiveColor:f,contextMenuSortIconColor:b,contextMenuReverseIconColor:C}=p,S=i.sort,v=_.getSortForColumn(S,t),y=d!==_.REVERSE_TYPE.NONE,{userColumnWidths:E}=a,I=[...E.values()].some(P=>P===0),R=i.getColumnHeaderParentGroup(t,0)===void 0,N=i.isColumnFrozen(t);return l.push({title:"Hide Column",group:se.GROUP_HIDE_COLUMNS,action:()=>{this.irisGrid.hideColumnByVisibleIndex(s)}}),l.push({title:N?"Unfreeze Column":"Freeze Column",group:se.GROUP_HIDE_COLUMNS,disabled:!R,action:()=>{N?this.irisGrid.unFreezeColumnByColumnName(r.name):this.irisGrid.freezeColumnByColumnName(r.name)},order:10}),l.push({title:"Show All Columns",group:se.GROUP_HIDE_COLUMNS,action:()=>{this.irisGrid.showAllColumns()},disabled:!I}),l.push({title:"Quick Filters",icon:is,iconColor:f,shortcut:an.TABLE.TOGGLE_QUICK_FILTER,group:se.GROUP_FILTER,order:10,action:()=>{this.irisGrid.toggleFilterBar(s)}}),l.push({title:"Advanced Filters",icon:u.get(t)?Rd:hl,iconColor:g,group:se.GROUP_FILTER,order:20,action:()=>{this.irisGrid.handleAdvancedMenuOpened(s)}}),l.push({title:"Clear Table Filters",group:se.GROUP_FILTER,order:40,shortcut:an.TABLE.CLEAR_FILTERS,action:()=>{this.irisGrid.clearAllFilters()},disabled:!(c.size>0||u.size>0||m!=null)}),l.push({title:"Sort by",icon:is,iconColor:b,group:se.GROUP_SORT,order:10,actions:this.sortByActions(r,t,v)}),l.push({title:"Add Additional Sort",disabled:v&&S.length===1||y&&S.length===1||v&&y&&S.length===2||S.length===0,group:se.GROUP_SORT,order:20,actions:this.additionalSortActions(r,t)}),l.push({title:"Clear Table Sorting",disabled:S.length===0||y&&S.length===1,group:se.GROUP_SORT,action:()=>{this.irisGrid.sortColumn(s,se.COLUMN_SORT_DIRECTION.none)},order:30}),l.push({title:d===_.REVERSE_TYPE.NONE?"Reverse Table":"Clear Reverse Table",icon:is,iconColor:C,group:se.GROUP_SORT,order:40,disabled:!i.isReversible,shortcut:an.TABLE.REVERSE,action:()=>{d===_.REVERSE_TYPE.NONE?this.irisGrid.reverse(_.REVERSE_TYPE.POST_SORT):this.irisGrid.reverse(_.REVERSE_TYPE.NONE)}}),l.push({title:"Copy Column Name",group:se.GROUP_COPY,action:()=>{var P;ro((P=i.textForColumnHeader(t))!=null?P:"").catch(H=>Ph.error("Unable to copy header",H))}}),_.isDateType(r.type)?l.push({title:"Date/Time Format",group:se.GROUP_FORMAT,actions:this.dateFormatActions(r)}):_.isNumberType(r.type)&&l.push({title:"Number Format",group:se.GROUP_FORMAT,actions:(F=this.numberFormatActions(r))!=null?F:void 0}),l}getCellActions(t,e,n){L(t);const{irisGrid:s}=this,{column:i,row:o}=n,{model:r,canCopy:l}=s.props,{columns:a}=r,d=s.getModelRow(o);L(d);const c=r.valueForCell(t,d),u=r.textForCell(t,d),m=a[t],p=[],{quickFilters:g}=s.state,f=s.getTheme(),{filterIconColor:b}=f,{settings:C}=s.props,S=new st({timeZone:C==null?void 0:C.timeZone,showTimeZone:!1,showTSeparator:!0,defaultDateTimeFormatString:Hh}),v=new st({timeZone:C==null?void 0:C.timeZone,showTimeZone:C==null?void 0:C.showTimeZone,showTSeparator:C==null?void 0:C.showTSeparator,defaultDateTimeFormatString:Hh});if(m==null||o==null)return p;if(r.isFilterable(t)){const E={title:"Filter By Value",icon:is,iconColor:b,group:se.GROUP_FILTER,order:10,actions:[]};if(c==null)g.get(t)&&E.actions.push({title:"And",actions:this.nullFilterActions(m,g.get(t),"&&"),order:2,group:ae.groups.high}),E.actions.push(...this.nullFilterActions(m));else if(_.isBooleanType(m.type))g.get(t)&&E.actions.push({title:"Or",actions:this.booleanFilterActions(m,u,g.get(t),"||"),order:2,group:ae.groups.high}),E.actions.push(...this.booleanFilterActions(m,u));else if(_.isNumberType(m.type)||_.isCharType(m.type)){L(t);const I=_.isCharType(m.type)?String.fromCharCode(c):`${c}`;g.get(t)&&E.actions.push({title:"And",actions:this.numberFilterActions(m,I,c,g.get(t),"&&"),order:2,group:ae.groups.high}),E.actions.push(...this.numberFilterActions(m,I,c,g.get(t)))}else if(_.isDateType(m.type)){const I=S.format(c),R=v.format(c);g.get(t)&&E.actions.push({title:"And",actions:this.dateFilterActions(m,I,R,c,g.get(t),"&&"),order:2,group:ae.groups.high}),E.actions.push(...this.dateFilterActions(m,I,R,c,g.get(t)))}else g.get(t)&&E.actions.push({title:"And",actions:this.stringFilterActions(m,u,c,g.get(t),"&&"),order:2,group:ae.groups.high}),E.actions.push(...this.stringFilterActions(m,u,c));E.actions!=null&&E.actions.length>0&&p.push(E)}const y={title:"Go to",iconColor:b,shortcut:an.TABLE.GOTO_ROW,group:se.GROUP_GOTO,order:10,action:()=>this.irisGrid.toggleGotoRow(`${o+1}`,`${c}`,m.name)};return p.push(y),l&&(p.push({title:"Copy Cell",group:se.GROUP_COPY,order:10,action:()=>{s.copyCell(i,o)}}),p.push({title:"Copy Cell Unformatted",group:se.GROUP_COPY,order:20,action:()=>{s.copyCell(i,o,!0)}})),p}onContextMenu(t,e,n){const{irisGrid:s}=this,{y:i,column:o,row:r,columnHeaderDepth:l}=t,a=s.getModelColumn(o),d=s.getModelRow(r),{model:c,canCopy:u}=s.props,{columns:m}=c,{metrics:p,isFilterBarShown:g,quickFilters:f,advancedFilters:b,selectedRanges:C}=s.state;L(p);const{columnHeaderHeight:S,gridY:v,columnHeaderMaxDepth:y}=p,E=[];if(a!=null&&d!=null){const I=c.valueForCell(a,d),R=c.textForCell(a,d),N=m[a],{onContextMenu:F}=s.props;N!=null&&E.push(F({model:c,value:I,valueText:R,column:N,rowIndex:r,columnIndex:o,modelRow:d,modelColumn:a}))}return a!=null&&c.isFilterable(a)&&E.push({title:"Clear Column Filter",group:se.GROUP_FILTER,order:30,action:()=>{this.irisGrid.removeColumnFilter(a)},disabled:!(f.has(a)||b.has(a))}),(g?i<=v:i<=S*y&&l===0)?a!=null&&E.push(...this.getHeaderActions(a,t)):(a!=null&&d!=null&&E.push(...this.getCellActions(a,e,t)),u&&C.length>0&&(E.push({title:"Copy Selection",shortcut:bs.COPY,group:se.GROUP_COPY,order:30,action:()=>{s.copyRanges(C)}}),E.push({title:"Copy Selection w/ Headers",group:se.GROUP_COPY,order:40,action:()=>{s.copyRanges(C,!0)}})),tt(c)&&c.isEditable&&C.length>0&&E.push({title:"Delete Selected Rows",group:se.GROUP_EDIT,order:50,action:()=>{this.irisGrid.deleteRanges(C)}})),E.length===0?!1:(L(s.gridWrapper),ae.triggerMenu(s.gridWrapper,n.pageX,n.pageY,E),!0)}dateFormatActions(t){const{model:e}=this.irisGrid.props,{formatter:n}=e,s=n.getColumnFormat(t.type,t.name),i=ta.getOptions(n,s),o=[];for(let r=0;r<i.length;r+=1){const{description:l,format:a,group:d,isSelected:c,title:u}=i[r];o.push({title:u,description:l,icon:c?jn:void 0,group:d,order:r,action:()=>{const m=e.getColumnIndexByName(t.name);L(m),this.irisGrid.handleFormatSelection(m,a)}})}return o}numberFormatActions(t){const{model:e}=this.irisGrid.props,{formatter:n}=e,s=n.getColumnFormat(t.type,t.name);let i;const o=e.getColumnIndexByName(t.name);if(_.isDecimalType(t.type))i=hr.getOptions(s,l=>{L(o),this.debouncedUpdateCustomFormat(o,l)});else if(_.isIntegerType(t.type))i=na.getOptions(s,l=>{L(o),this.debouncedUpdateCustomFormat(o,l)});else return Ph.error("Invalid column type in numberFormatActions"),null;const r=[];for(let l=0;l<i.length;l+=1){const{format:a,isSelected:d}=i[l];r.push({...i[l],icon:d?jn:void 0,order:l,action:()=>{o===void 0&&a&&a.type===nt.TYPE_CONTEXT_CUSTOM||(L(o),this.irisGrid.handleFormatSelection(o,a))}})}return r}stringFilterActions(t,e,n,s,i){const o=M.FilterValue.ofString(n);let r=s;r||(r={filter:null,text:null});const{filter:l,text:a}=r,d=[],{model:c}=this.irisGrid.props,u=c.getColumnIndexByName(t.name);return L(u),d.push({menuElement:T("div",{className:"iris-grid-filter-menu-item-value",children:[i?se.getOperatorAsText(i):""," ",'"',e,'"']}),order:1,group:ae.groups.high}),d.push({title:"text is exactly",description:`Show only rows where ${t.name} is ${n} (case sensitive)`,action:()=>{this.irisGrid.setQuickFilter(u,se.getQuickFilterCondition(l,t.filter().eq(o),i),se.getQuickFilterText(a,`=${e}`,i))},order:10,group:ae.groups.low}),d.push({title:"text is not exactly",description:`Show only rows where ${t.name} is not ${e} (case sensitive)`,action:()=>{this.irisGrid.setQuickFilter(u,se.getQuickFilterCondition(l,t.filter().notEq(o),i),se.getQuickFilterText(a,`!=${e}`,i))},order:20,group:ae.groups.low}),d.push({title:"text contains",description:`Show only rows where ${t.name} contains ${e}`,action:()=>{this.irisGrid.setQuickFilter(u,se.getQuickFilterCondition(l,t.filter().contains(o),i),se.getQuickFilterText(a,`~${e}`,i))},order:30,group:ae.groups.low}),d.push({title:"text does not contain",description:`Show only rows where ${t.name} does not contain ${n}`,action:()=>{this.irisGrid.setQuickFilter(u,se.getQuickFilterCondition(l,t.filter().contains(o).not(),i),se.getQuickFilterText(a,`!~${e}`,i))},order:40,group:ae.groups.low}),d.push({title:"text starts with",description:`Show only rows where ${t.name} starts with ${e}`,action:()=>{this.irisGrid.setQuickFilter(u,se.getQuickFilterCondition(l,t.filter().invoke("startsWith",o),i),se.getQuickFilterText(a,`${e}*`,i))},order:50,group:ae.groups.low}),d.push({title:"text ends with",description:`Show only rows where ${t.name} ends with ${e}`,action:()=>{this.irisGrid.setQuickFilter(u,se.getQuickFilterCondition(l,t.filter().invoke("endsWith",o),i),se.getQuickFilterText(a,`*${e}`,i))},order:60,group:ae.groups.low}),d}numberFilterActions(t,e,n,s,i){const o=se.getFilterValueForNumberOrChar(t.type,n);let r=null,l=null;s&&(r=s.filter,l=s.text);const a=[],d=n!==Number.POSITIVE_INFINITY&&n!==Number.NEGATIVE_INFINITY&&!Number.isNaN(n),{model:c}=this.irisGrid.props,u=c.getColumnIndexByName(t.name);return L(u),a.push({menuElement:T("div",{className:"iris-grid-filter-menu-item-value",children:[i?se.getOperatorAsText(i):""," ",'"',e,'"']}),order:1,group:ae.groups.high}),a.push({title:"is equal to",description:`Show only rows where ${t.name} is ${e}`,action:()=>{const m=se.getNumberValueEqualsFilter(t,n);this.irisGrid.setQuickFilter(u,se.getQuickFilterCondition(r,m,i),se.getQuickFilterText(l,`=${e}`,i))},order:10,group:ae.groups.low}),a.push({title:"is not equal to",description:`Show only rows where ${t.name} is not ${e}`,action:()=>{const m=se.getNumberValueEqualsFilter(t,n).not();this.irisGrid.setQuickFilter(u,se.getQuickFilterCondition(r,m,i),se.getQuickFilterText(l,`!=${e}`,i))},order:20,group:ae.groups.low}),d&&!_.isCharType(t.type)&&(a.push({title:"greater than",description:`Show only rows where ${t.name} is greater than ${e}`,action:()=>{this.irisGrid.setQuickFilter(u,se.getQuickFilterCondition(r,t.filter().greaterThan(o),i),se.getQuickFilterText(l,`>${e}`,i))},order:30,group:ae.groups.low}),a.push({title:"greater than or equal to",description:`Show only rows where ${t.name} is greater than or equal to ${e}`,action:()=>{this.irisGrid.setQuickFilter(u,se.getQuickFilterCondition(r,t.filter().greaterThanOrEqualTo(o),i),se.getQuickFilterText(l,`>=${e}`,i))},order:40,group:ae.groups.low}),a.push({title:"less than",description:`Show only rows where ${t.name} is less than ${e}`,action:()=>{this.irisGrid.setQuickFilter(u,se.getQuickFilterCondition(r,t.filter().lessThan(o),i),se.getQuickFilterText(l,`<${e}`,i))},order:50,group:ae.groups.low}),a.push({title:"less than or equal to",description:`Show only rows where ${t.name} is less than or equal to ${e}`,action:()=>{this.irisGrid.setQuickFilter(u,se.getQuickFilterCondition(r,t.filter().lessThanOrEqualTo(o),i),se.getQuickFilterText(l,`<=${e}`,i))},order:60,group:ae.groups.low})),a}booleanFilterActions(t,e,n,s){const i=[],{model:o}=this.irisGrid.props,{filter:r,text:l}=n||{},a=o.getColumnIndexByName(t.name);return L(a),i.push({menuElement:T("div",{className:"iris-grid-filter-menu-item-value",children:[s?se.getOperatorAsText(s):""," ",'"',e!=null?e:"null",'"']}),order:1,group:ae.groups.high}),i.push({title:"true",description:`Show only rows where ${t.name} is true`,action:()=>{this.irisGrid.setQuickFilter(a,se.getQuickFilterCondition(r,t.filter().isTrue(),s),se.getQuickFilterText(l,"true",s))},order:10,group:ae.groups.low}),i.push({title:"false",description:`Show only rows where ${t.name} is false`,action:()=>{this.irisGrid.setQuickFilter(a,se.getQuickFilterCondition(r,t.filter().isFalse(),s),se.getQuickFilterText(l,"false",s))},order:20,group:ae.groups.low}),i.push({title:"is null",description:`Show only rows where ${t.name} is null`,action:()=>{this.irisGrid.setQuickFilter(a,se.getQuickFilterCondition(r,t.filter().isNull(),s),se.getQuickFilterText(l,"null",s))},order:30,group:ae.groups.low}),i.push({title:"is not null",description:`Show only rows where ${t.name} is not null`,action:()=>{this.irisGrid.setQuickFilter(a,se.getQuickFilterCondition(r,t.filter().isNull().not(),s),se.getQuickFilterText(l,"!null",s))},order:40,group:ae.groups.low}),i}dateFilterActions(t,e,n,s,i,o){const r=M.FilterValue.ofNumber(s);let l=null,a=null;i&&(l=i.filter,a=i.text);const{model:d}=this.irisGrid.props,c=d.getColumnIndexByName(t.name);L(c);const u=[];return u.push({menuElement:T("div",{className:"iris-grid-filter-menu-item-value",children:[o?se.getOperatorAsText(o):""," ",'"',n,'"']}),order:1,group:ae.groups.high}),u.push({title:"date is",description:`Show only rows where ${t.name} is ${n}`,action:()=>{this.irisGrid.setQuickFilter(c,se.getQuickFilterCondition(l,t.filter().eq(r),o),se.getQuickFilterText(a,`=${e}`,o))},order:10,group:ae.groups.low}),u.push({title:"date is not",description:`Show only rows where ${t.name} is not ${n}`,action:()=>{this.irisGrid.setQuickFilter(c,se.getQuickFilterCondition(l,t.filter().notEq(r),o),se.getQuickFilterText(a,`!=${e}`,o))},order:20,group:ae.groups.low}),u.push({title:"date is before",description:`Show only rows where ${t.name} is before ${n}`,action:()=>{this.irisGrid.setQuickFilter(c,se.getQuickFilterCondition(l,t.filter().lessThan(r),o),se.getQuickFilterText(a,`<${e}`,o))},order:30,group:ae.groups.low}),u.push({title:"date is before or equal",description:`Show only rows where ${t.name} is before or equal to ${n}`,action:()=>{this.irisGrid.setQuickFilter(c,se.getQuickFilterCondition(l,t.filter().lessThanOrEqualTo(r),o),se.getQuickFilterText(a,`<=${e}`,o))},order:40,group:ae.groups.low}),u.push({title:"date is after",description:`Show only rows where ${t.name} is greater than ${n}`,action:()=>{this.irisGrid.setQuickFilter(c,se.getQuickFilterCondition(l,t.filter().greaterThan(r),o),se.getQuickFilterText(a,`>${e}`,o))},order:50,group:ae.groups.low}),u.push({title:"date is after or equal",description:`Show only rows where ${t.name} is after or equal to ${n}`,action:()=>{this.irisGrid.setQuickFilter(c,se.getQuickFilterCondition(l,t.filter().greaterThanOrEqualTo(r),o),se.getQuickFilterText(a,`>=${e}`,o))},order:60,group:ae.groups.low}),u}nullFilterActions(t,e,n){let s=null,i=null;e&&(s=e.filter,i=e.text);const o=[],{model:r}=this.irisGrid.props,l=r.getColumnIndexByName(t.name);return L(l),o.push({menuElement:T("div",{className:"iris-grid-filter-menu-item-value",children:[n?se.getOperatorAsText(n):""," ",'"null"']}),order:1,group:ae.groups.high}),o.push({title:"is null",description:`Show only rows where ${t.name} is null`,action:()=>{this.irisGrid.setQuickFilter(l,se.getQuickFilterCondition(s,t.filter().isNull(),n),se.getQuickFilterText(i,"null",n))},order:10,group:ae.groups.low}),o.push({title:"is not null",description:`Show only rows where ${t.name} is not null`,action:()=>{this.irisGrid.setQuickFilter(l,se.getQuickFilterCondition(s,t.filter().isNull().not(),n),se.getQuickFilterText(i,"!null",n))},order:20,group:ae.groups.low}),o}sortByActions(t,e,n){const s=this.irisGrid.getTheme(),{contextMenuSortIconColor:i}=s,o=[{title:`${t.name} Ascending`,order:10,action:()=>{this.irisGrid.sortColumn(e,se.COLUMN_SORT_DIRECTION.ascending)},icon:this.checkColumnSort(n,se.COLUMN_SORT_DIRECTION.ascending)?is:void 0,iconColor:i},{title:`${t.name} Descending`,order:20,action:()=>{this.irisGrid.sortColumn(e,se.COLUMN_SORT_DIRECTION.descending)},icon:this.checkColumnSort(n,se.COLUMN_SORT_DIRECTION.descending)?is:void 0,iconColor:i},{title:"Remove Sort",order:50,action:()=>{this.irisGrid.sortColumn(e,se.COLUMN_SORT_DIRECTION.none,!1,!0)},disabled:!n}];return _.isNumberType(t.type)&&(o.push({title:`ABS(${t.name}) Ascending`,order:30,action:()=>{this.irisGrid.sortColumn(e,se.COLUMN_SORT_DIRECTION.ascending,!0)},icon:this.checkColumnSort(n,se.COLUMN_SORT_DIRECTION.ascending,!0)?is:void 0,iconColor:i}),o.push({title:`ABS(${t.name}) Descending`,order:40,action:()=>{this.irisGrid.sortColumn(e,se.COLUMN_SORT_DIRECTION.descending,!0)},icon:this.checkColumnSort(n,se.COLUMN_SORT_DIRECTION.descending,!0)?is:void 0,iconColor:i})),o}additionalSortActions(t,e){const n=this.irisGrid.getTheme(),{contextMenuSortIconColor:s}=n,i=[{title:"Add Sort By",menuElement:T("div",{className:"btn-context-menu menu-title",children:[h("span",{className:"icon",children:h(ee,{icon:is,style:{color:s!=null?s:void 0}})}),h("span",{className:"title",children:"Add Additional Sort"}),h("span",{className:"shortcut",children:Ge.isMacPlatform()?"\u2318Click":"^Click"})]}),order:1},{title:`${t.name} Ascending`,order:10,action:()=>{this.irisGrid.sortColumn(e,se.COLUMN_SORT_DIRECTION.ascending,!1,!0)}},{title:`${t.name} Descending`,order:20,action:()=>{this.irisGrid.sortColumn(e,se.COLUMN_SORT_DIRECTION.descending,!1,!0)}}];return _.isNumberType(t.type)&&(i.push({title:`ABS(${t.name}) Ascending`,order:30,action:()=>{this.irisGrid.sortColumn(e,se.COLUMN_SORT_DIRECTION.ascending,!0,!0)}}),i.push({title:`ABS(${t.name}) Descending`,order:40,action:()=>{this.irisGrid.sortColumn(e,se.COLUMN_SORT_DIRECTION.descending,!0,!0)}})),i}checkColumnSort(t,e=null,n=!1){return t?t.direction===e&&t.isAbs===n:!1}};let vs=se;vs.GROUP_EDIT=ae.groups.high+10;vs.GROUP_HIDE_COLUMNS=ae.groups.high+25;vs.GROUP_FILTER=ae.groups.high+50;vs.GROUP_GOTO=ae.groups.high+51;vs.GROUP_SORT=ae.groups.high+75;vs.GROUP_COPY=ae.groups.high+100;vs.GROUP_FORMAT=ae.groups.high+150;vs.COLUMN_SORT_DIRECTION={ascending:"ASC",descending:"DESC",none:null};class AT extends Dt{constructor(e){super(),this.irisGrid=e}onDoubleClick(e){const{column:n,row:s}=e;return s==null||n==null?!1:(this.irisGrid.selectData(n,s),!0)}}class PT extends Dt{constructor(e){super(),this.irisGrid=e}onDown(e){const{y:n,column:s,row:i}=e;if(s!==null&&i===null){const{isFilterBarShown:o,metrics:r}=this.irisGrid.state;if(!r)throw new Error("Metrics not set");const{columnHeaderMaxDepth:l}=r,a=this.irisGrid.getTheme();if(o&&a.columnHeaderHeight!=null&&a.filterBarHeight!=null&&n>a.columnHeaderHeight*l&&n<=a.columnHeaderHeight*l+a.filterBarHeight)return this.irisGrid.focusFilterBar(s),!0}return!1}onMove(e){const{y:n,column:s}=e,{isFilterBarShown:i,hoverAdvancedFilter:o,metrics:r}=this.irisGrid.state;if(!r)throw new Error("Metrics not set");const{columnHeaderMaxDepth:l}=r,a=this.irisGrid.getTheme();let d=null;return i&&a.columnHeaderHeight!=null&&a.filterBarHeight!=null&&s!==null&&n>=a.columnHeaderHeight*l&&n<=a.columnHeaderHeight*l+a.filterBarHeight&&(d=s),d!==o&&this.irisGrid.setState({hoverAdvancedFilter:d}),!1}onLeave(e){const{column:n}=e,{hoverAdvancedFilter:s}=this.irisGrid.state;return s!==null&&n!==s&&this.irisGrid.setState({hoverAdvancedFilter:null}),!1}}class HT extends Dt{constructor(e){super(),this.column=null,this.irisGrid=e}getColumnFromGridPoint(e){const{column:n,row:s,columnHeaderDepth:i}=e;return n!==null&&s===null&&i===0?n:null}onDown(e){return this.column=this.getColumnFromGridPoint(e),!1}onClick(e,n,s){const i=this.getColumnFromGridPoint(e);if(i!=null&&i===this.column){const o=Ge.isModifierKeyDown(s);return this.irisGrid.toggleSort(i,o),!0}return!1}}class VT extends Dt{constructor(e){super(),this.irisGrid=e}onWheel(e,n,s){const{irisGrid:i}=this,{model:o}=i.props,{metrics:r,pendingRowCount:l}=i.state;L(r);const{bottom:a,rowCount:d,rowHeight:c}=r,{deltaY:u}=J.getScrollDelta(s);return tt(o)&&o.isEditable&&a>=d-1&&u>0&&i.setState({pendingRowCount:l+Math.ceil(u/c)}),!1}}const UT=3e3;function BT({children:t=null,onEntering:e,onEntered:n,onExiting:s,onExited:i}){const[o,r]=w.exports.useState(!1),l=w.exports.useRef(),a=Al(t),d=w.exports.useCallback(()=>{r(!0),l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{r(!1)},UT)},[r,l]);return w.exports.useEffect(()=>{a!==t&&t!=null&&d()},[t,a,r,d]),w.exports.useEffect(()=>()=>l.current?clearTimeout(l.current):void 0,[]),h(ea,{className:"toast-bottom-bar",isShown:o,onEntering:e,onEntered:n,onExiting:s,onExited:i,children:t})}class $T extends dr{getVisibleColumnWidth(e,n,s=this.getFirstColumn(n),i=this.calculateTreePaddingX(n)){var c,u,m;const{model:o}=n,r=(u=(c=o.layoutHints)==null?void 0:c.hiddenColumns)!=null?u:[],l=this.getModelColumn(e,n),a=super.getVisibleColumnWidth(e,n,s,i);return!this.userColumnWidths.has(l)&&r.includes((m=o.columns[l])==null?void 0:m.name)?0:a}getGridY(e){let n=super.getGridY(e);const{isFilterBarShown:s,theme:i,advancedFilters:o,quickFilters:r,sorts:l,reverseType:a}=e;return s?n+=i.filterBarHeight:(r!=null&&r.size>0||o!=null&&o.size>0)&&(n+=i.filterBarCollapsedHeight),a!==_.REVERSE_TYPE.NONE&&l!=null&&l.length>0&&(n+=i.reverseHeaderBarHeight),n}getUserColumnWidths(){return this.userColumnWidths}}const zT=1,Op=X.memo(({model:t,modelColumns:e,top:n,bottom:s,left:i,right:o,filter:r,formatter:l,reverseType:a=_.REVERSE_TYPE.NONE,sorts:d,customColumns:c,movedColumns:u,hiddenColumns:m,alwaysFetchColumns:p,rollupConfig:g=null,totalsConfig:f=null,selectDistinctColumns:b=[],pendingRowCount:C=0,pendingDataMap:S=new Map,frozenColumns:v,formatColumns:y,columnHeaderGroups:E})=>{const I=w.exports.useMemo(()=>ie.getModelViewportColumns(e,i,o,u,m,p,zT),[e,i,o,u,m,p]);return w.exports.useEffect(function(){t.filter=r},[t,r]),w.exports.useEffect(function(){const N=[...d];a!==_.REVERSE_TYPE.NONE&&N.push(M.Table.reverse()),t.sort=N},[t,d,a]),w.exports.useEffect(function(){t.formatter=l},[t,l]),w.exports.useEffect(function(){t.isCustomColumnsAvailable&&(t.customColumns=c)},[t,c]),w.exports.useEffect(function(){t.isFormatColumnsAvailable&&(t.formatColumns=y)},[t,y]),w.exports.useEffect(function(){t.setViewport(n,s,I)},[t,n,s,I]),w.exports.useEffect(function(){t.isRollupAvailable&&(t.rollupConfig=g)},[t,t.isRollupAvailable,g]),w.exports.useEffect(function(){t.isSelectDistinctAvailable&&(t.selectDistinctColumns=b)},[t,b]),w.exports.useEffect(function(){t.isTotalsAvailable&&(t.totalsConfig=f)},[t,t.isTotalsAvailable,f]),w.exports.useEffect(function(){t.pendingRowCount=C},[t,C]),w.exports.useEffect(function(){t.pendingDataMap=S},[t,S]),w.exports.useEffect(function(){v&&t.updateFrozenColumns(v)},[t,v]),w.exports.useEffect(function(){t.columnHeaderGroups=E},[t,E]),null});Op.displayName="IrisGridModelUpdater";const Un=Object.freeze({SORT_UP:"sortUp",SORT_DOWN:"sortDown",CARET_DOWN:"caretDown",CARET_RIGHT:"caretRight",CELL_OVERFLOW:"cellOverflow"}),Na=16;class Wo extends to{constructor(){super(),this.icons={},this.initIcons()}static isFilterValid(e,n){const s=e==null||e.filter!=null,i=n==null||n.filter!=null;return s&&i}initIcons(){this.setIcon(Un.SORT_UP,Cb),this.setIcon(Un.SORT_DOWN,fb),this.setIcon(Un.CARET_DOWN,Yn),this.setIcon(Un.CARET_RIGHT,Au),this.setIcon(Un.CELL_OVERFLOW,LC)}setIcon(e,n){const s=Array.isArray(n.icon[4])?n.icon[4][0]:n.icon[4],i=new Path2D(s),o=new Path2D,r={a:Na/n.icon[0],d:Na/n.icon[1]};o.addPath(i,r),this.icons[e]=o}getIcon(e){return this.icons[e]}getSortIcon(e){return e?e.direction===_.sortDirection.ascending?this.getIcon(Un.SORT_UP):e.direction===_.sortDirection.descending?this.getIcon(Un.SORT_DOWN):null:null}drawCanvas(e){super.drawCanvas(e),this.drawScrim(e)}drawGrid(e,n){super.drawGrid(e,n),this.drawCellOverflowButton(n)}drawGridLines(e,n){super.drawGridLines(e,n),this.drawGroupedColumnLine(e,n),this.drawPendingRowLine(e,n)}drawCellContent(e,n,s,i){var m;const{metrics:o,model:r}=n,{modelColumns:l,modelRows:a}=o,d=B(a,i),c=l.get(s);if(c===void 0)return;const u=r.valueForCell(c,d);if(_.isTextType((m=r.columns[c])==null?void 0:m.type)&&(u===null||u==="")){const p=e.font;e.font=`italic ${p}`;const g=u===null?"null":"empty";super.drawCellContent(e,n,s,i,g),e.font=p;return}super.drawCellContent(e,n,s,i)}drawGroupedColumnLine(e,n){const{metrics:s,model:i,theme:o}=n,{groupedColumns:r,columns:l}=i,{maxY:a,allColumnWidths:d,allColumnXs:c}=s;if(r.length===0||o.groupedColumnDividerColor==null)return;const u=r[r.length-1],m=l.findIndex(b=>b.name===u.name),p=c.get(m),g=d.get(m);if(p==null||g==null)return;const f=p+g+.5;e.strokeStyle=o.groupedColumnDividerColor,e.lineWidth=1,e.beginPath(),e.moveTo(f,0),e.lineTo(f,a),e.stroke()}drawPendingRowLine(e,n){const{metrics:s,model:i,theme:o}=n,{allRowYs:r,maxX:l}=s,{pendingRowCount:a}=i;if(a<=0)return;const d=i.rowCount-i.pendingRowCount-i.floatingBottomRowCount;let c=r.get(d);c!=null&&(c-=.5,e.save(),e.setLineDash([4,2]),e.strokeStyle=o.pendingTextColor,e.lineWidth=1,e.beginPath(),e.moveTo(0,c),e.lineTo(l,c),e.stroke(),e.restore())}drawMouseColumnHover(e,n){const{theme:s,metrics:i,hoverSelectColumn:o}=n;if(o==null||s.linkerColumnHoverBackgroundColor==null)return;const{allColumnWidths:r,allColumnXs:l,maxY:a}=i,d=l.get(o),c=r.get(o);L(d),L(c),e.fillStyle=s.linkerColumnHoverBackgroundColor,e.fillRect(d,0,c,a)}drawMouseRowHover(e,n){const{isSelectingColumn:s}=n;s||super.drawMouseRowHover(e,n)}drawScrim(e){const{context:n,loadingScrimProgress:s,metrics:i,theme:o}=e;if(s==null)return;const{width:r,height:l,gridY:a}=i,{scrimBlurSize:d,scrimColor:c}=o;n.save(),n.globalCompositeOperation="color",n.filter=`blur(${d}px)`,c!=null&&(n.fillStyle=c),n.beginPath(),n.rect(0,a,r,l-a),n.clip(),n.fillRect(-d,-d+a,d*2+r,(d*2+(l-a))*s),n.globalCompositeOperation="overlay",n.filter=`blur(${d}px) opacity(15%)`,n.fillRect(-d,-d+a,d*2+r,(d*2+(l-a))*s),n.restore()}drawColumnHeaders(e,n){super.drawColumnHeaders(e,n);const{theme:s,metrics:i,model:o,reverseType:r}=n,{columnHeaderHeight:l}=i;if(this.drawFilterHeaders(e,n),l<=0)return;const{sort:a}=o;if(a.length===1){const d=r!==_.REVERSE_TYPE.NONE;let c;d?c=s.headerReverseBarColor:c=s.headerSortBarColor,this.drawHeaderBar(e,n,c,d?s.reverseHeaderBarHeight:s.sortHeaderBarHeight)}else a.length>1&&(r!==_.REVERSE_TYPE.NONE&&this.drawHeaderBar(e,n,s.headerReverseBarColor,s.reverseHeaderBarHeight,!1),this.drawHeaderBar(e,n,s.headerSortBarColor,s.sortHeaderBarHeight))}drawHeaderBar(e,n,s,i,o=!0){const{theme:r,metrics:l,model:a}=n,{columnHeaderHeight:d,width:c}=l;let u=0;o||(u=i),e.fillStyle=r.headerBarCasingColor,e.fillRect(0,a.columnHeaderMaxDepth*d-i-2+u,c,i+2),e.fillStyle=s,e.fillRect(0,a.columnHeaderMaxDepth*d-i-1+u,c,i)}drawColumnHeadersAtDepth(e,n,s,i,o){const{metrics:r,model:l,isMenuShown:a}=n,{columnHeaderMaxDepth:d}=l,{width:c}=r,u={...i,maxX:o===d-1&&i.maxX===c?c-(a?0:30):i.maxX};super.drawColumnHeadersAtDepth(e,n,s,u,o)}drawColumnHeaderAtIndex(e,n,s,i){var A;super.drawColumnHeaderAtIndex(e,n,s,i);const{metrics:o,model:r,theme:l}=n,{modelColumns:a,allColumnWidths:d,allColumnXs:c,gridX:u,columnHeaderHeight:m,fontWidths:p}=o,{headerHorizontalPadding:g}=l,f=B(d,s,0),b=B(c,s)+u,C=a.get(s);if(C==null)return;const S=_.getSortForColumn(r.sort,C);if(!S)return;const v=this.getSortIcon(S);if(!v)return;const y=r.textForColumnHeader(C);if(y===void 0)return;const E=(A=p.get(e.font))!=null?A:to.DEFAULT_FONT_WIDTH;L(E);const I=y.length*E,R=u+b+I+g;let{maxX:N}=i;N-=g;const F=u+b+f-g-1,P=R>N?R+1:Math.min(N,F),H=S.direction===_.sortDirection.ascending?-6:-12,x=m*.5+H;e.save(),e.beginPath(),e.rect(b,0,f,m),e.clip(),e.fillStyle=l.headerSortBarColor,e.translate(P,x),e.fill(v),e.restore()}drawFilterHeaders(e,n){const{isFilterBarShown:s,quickFilters:i,advancedFilters:o}=n;s?this.drawExpandedFilterHeaders(e,n):(i!=null&&i.size>0||o!=null&&o.size>0)&&this.drawCollapsedFilterHeaders(e,n)}drawExpandedFilterHeaders(e,n){const{metrics:s,model:i,theme:o,quickFilters:r,advancedFilters:l}=n,{filterBarHeight:a}=o;if(a<=0)return;const{gridX:d,gridY:c,maxX:u,modelColumns:m,visibleColumns:p,allColumnWidths:g,allColumnXs:f}=s,b=c-a;e.save(),e.font=o.font,e.textAlign="left",r!=null&&r.size>0||l!=null&&l.size>0?e.fillStyle=o.filterBarExpandedActiveBackgroundColor:e.fillStyle=o.filterBarExpandedBackgroundColor,e.fillRect(d,b,u,a-1),e.fillStyle=o.headerBarCasingColor,e.fillRect(d,b+a-1,u,1);const C=b;e.strokeStyle=o.filterBarSeparatorColor,e.beginPath();for(let S=0;S<p.length;S+=1){const v=p[S],y=B(m,v),E=B(f,v),I=B(g,v);if(i.isFilterable(y)&&I>0){const R=d+(E!=null?E:0);e.rect(R+.5,C+.5,I,a-2)}}e.stroke();for(let S=0;S<p.length;S+=1){const v=p[S],y=B(g,v),I=B(f,v)+d;this.drawExpandedFilterHeader(e,n,v,I,y)}e.restore()}drawExpandedFilterHeader(e,n,s,i,o){if(o<=0)return;const{metrics:r,theme:l,quickFilters:a,advancedFilters:d}=n,{modelColumns:c,gridY:u}=r,{filterBarHeight:m,filterBarExpandedActiveCellBackgroundColor:p,filterBarErrorColor:g,filterBarHorizontalPadding:f,headerColor:b}=l,C=u-m,S=c.get(s);if(S===void 0)return;const v=a.get(S),y=d.get(S);if(v==null&&y==null)return;let E=null;if(v!=null){const{text:R}=v;if(E=R,E||(E=_.getFilterText(v.filter)),E!=null){const{fontWidths:N}=r;let F=N.get(e.font);(F==null||F===0)&&(F=e.measureText("8").width,F||(F=10));const P=(o-f*2)/F;P<=0?E="":E.length>P&&(E=`${E.substring(0,P-1)}\u2026`)}}if(e.save(),Wo.isFilterValid(y,v)&&p!=null)e.fillStyle=p,e.fillRect(i+1,C+1,o-1,m-3);else if(g!=null){e.fillStyle=g,e.lineWidth=2,e.strokeStyle=g;const R=i+2,N=C+2,F=o-3,P=m-5;e.strokeRect(R,N,F,P)}if(E!=null&&E!==""){const R=i+f,N=C+m*.5+1;e.fillStyle=b,e.fillText(E,R,N)}e.restore()}drawCollapsedFilterHeaders(e,n){const{metrics:s,theme:i}=n,{headerSeparatorColor:o,filterBarCollapsedHeight:r}=i;if(r<=0)return;const{gridX:l,gridY:a,maxX:d,visibleColumns:c,allColumnWidths:u,allColumnXs:m}=s,p=a-r;e.save(),e.fillStyle=o,e.fillRect(l,p,d,r);for(let g=0;g<c.length;g+=1){const f=c[g],b=u.get(f),C=m.get(f);if(C!=null&&b!=null){const S=C+l;this.drawCollapsedFilterHeader(e,n,f,S,b)}}e.restore()}drawCollapsedFilterHeader(e,n,s,i,o){if(o<=0)return;const{metrics:r,theme:l,quickFilters:a,advancedFilters:d}=n,{modelColumns:c,gridY:u}=r,m=c.get(s);if(m===void 0)return;const p=a.get(m),g=d.get(m),{filterBarCollapsedHeight:f,filterBarActiveColor:b,filterBarActiveBackgroundColor:C,filterBarErrorColor:S}=l;e.save();const v=Wo.isFilterValid(g,p);C!=null&&p==null&&g==null?e.fillStyle=C:b!=null&&v?e.fillStyle=b:S!=null&&(e.fillStyle=S);const y=i+1,E=u-f,I=o-1,R=f-1;e.fillRect(y,E,I,R),e.restore()}drawTreeMarker(e,n,s,i,o,r,l){e.save();const{x1:a,y1:d}=o,c=l?this.getIcon(Un.CARET_DOWN):this.getIcon(Un.CARET_RIGHT),u=s+a-2,m=i+d+2.5;e.fillStyle=r,e.textAlign="center",e.translate(u,m),e.fill(c),e.restore()}drawRowFooters(e,n){const{metrics:s,model:i,mouseX:o,mouseY:r,theme:l}=n,{gridY:a,gridX:d,maxX:c,modelRows:u,floatingTopHeight:m,floatingBottomHeight:p,floatingRows:g,rowFooterWidth:f,height:b,horizontalBarHeight:C,verticalBarWidth:S,allRowHeights:v,allRowYs:y,width:E}=s;if(f<=0||g.length===0)return;const{cellHorizontalPadding:I,floatingGridRowColor:R,floatingRowBackgroundColors:N,headerColor:F,rowHoverBackgroundColor:P}=l;e.translate(d,a),e.beginPath();const H=Math.min(c,E-f-S-d);e.fillStyle=N,m>0&&e.rect(H,0,f,m),p>0&&e.rect(H,b-a-C-p,f,p),e.fill();const x=o!=null&&r!=null&&o>=d&&o<=c+f?J.getRowAtY(r,s):null;if(P!=null&&x!==null&&g.includes(x)){e.fillStyle=P;const k=y.get(x),G=v.get(x);L(k),L(G),e.fillRect(H,k,f,G)}if(e.beginPath(),R!=null&&(e.strokeStyle=R),m>0&&(e.moveTo(H+.5,.5),e.lineTo(H+.5,m-.5)),p>0){const k=b-a-C-p;e.moveTo(H-.5,k+.5),e.lineTo(H-.5,k+p-.5)}e.stroke(),e.fillStyle=F,e.textAlign="left";const A=H+I;for(let k=0;k<g.length;k+=1){const G=g[k],V=v.get(G),O=y.get(G),$=u.get(G);if(O!=null&&V!=null&&$!=null){const Y=O+V*.5;e.fillText(i.textForRowFooter($),A,Y)}}e.translate(-d,-a)}getTextRenderMetrics(e,n,s,i){const o=super.getTextRenderMetrics(e,n,s,i),{mouseX:r,mouseY:l,metrics:a}=n;if(r==null||l==null)return o;const{column:d,row:c}=J.getGridPointFromXY(r,l,a);if(s===d&&i===c){const{left:u}=this.getCellOverflowButtonPosition(n);this.shouldRenderOverflowButton(n)&&u!=null&&(o.width=u-a.gridX-o.x)}return o}shouldRenderOverflowButton(e){var b,C;const{context:n,mouseX:s,mouseY:i,metrics:o,model:r,theme:l}=e;if(s==null||i==null)return!1;const{row:a,column:d,modelRow:c,modelColumn:u}=J.getCellInfoFromXY(s,i,o);if(a==null||d==null||c==null||u==null||!_.isStringType(r.columns[u].type))return!1;const m=(b=r.textForCell(u,c))!=null?b:"",{width:p}=super.getTextRenderMetrics(n,e,d,a),g=(C=o.fontWidths.get(l.font))!=null?C:Wo.DEFAULT_FONT_WIDTH;n.save(),n.font=l.font;const f=this.getCachedTruncatedString(n,m,p,g,r.truncationCharForCell(u,c));return n.restore(),m!==""&&f!==m}getCellOverflowButtonPosition({mouseX:e,mouseY:n,metrics:s,theme:i}){const o={left:null,top:null,width:null,height:null};if(e==null||n==null||!s)return o;const{rowHeight:r,columnWidth:l,left:a,top:d}=J.getCellInfoFromXY(e,n,s);L(a),L(l),L(d);const{width:c,verticalBarWidth:u}=s,{cellHorizontalPadding:m}=i,p=Na+2*m,g=r,b=Math.min(s.gridX+a+l,c-u)-p,C=s.gridY+d;return{left:b,top:C,width:p,height:g}}drawCellOverflowButton(e){const{context:n,mouseX:s,mouseY:i,theme:o}=e;if(s==null||i==null||!this.shouldRenderOverflowButton(e))return;const{left:r,top:l,width:a,height:d}=this.getCellOverflowButtonPosition(e),{cellHorizontalPadding:c,overflowButtonColor:u,overflowButtonHoverColor:m}=o;n.save(),m!=null&&r!=null&&a!=null&&l!=null&&d!=null&&s>=r&&s<=r+a&&i>=l&&i<=l+d?n.fillStyle=m:u!=null&&(n.fillStyle=u);const p=this.getIcon(Un.CELL_OVERFLOW);r!=null&&l!=null&&n.translate(r+c,l+2),n.fill(p),n.restore()}}const WT="12px Fira Sans, sans-serif",GT="#f0f0ee",KT="#1a171a",ue={"grid-bg":"#211f22",font:WT,white:GT,black:KT,"header-bg":"#2d2a2e","header-color":"#f0f0ee","header-height":"30px","header-separator-color":"#211f22","header-separator-hover-color":"#929192","header-hidden-separator-hover-color":"#4878ea","header-sort-bar-color":"#aa9af4","header-reverse-bar-color":"#548d29","header-bar-casing-color":"#211f22","header-font":"600 12px Fira Sans, sans-serif","row-height":"19px","row-background-colors":"#373438 #2d2a2e","selection-color":"rgba(118, 217, 228, 0.09)","selection-outline-color":"#76d9e4","selection-outline-casing-color":"#211f22","row-hover-bg":"#4b494c","selected-row-hover-bg":"rgba(118, 217, 228, 0.25)","scroll-bar-active-selection-tick-color":"rgba(118, 217, 228, 0.5)","scroll-bar-bg":"#322f33","scroll-bar-hover-bg":"#373438","scroll-bar-casing-color":"#555356","scroll-bar-corner-color":"#322f33","scroll-bar-color":"#5b5a5c","scroll-bar-hover-color":"#929192","scroll-bar-active-color":"#c0bfbf","text-color":"#f0f0ee","positive-number-color":"#9edc6f","negative-number-color":"#f95d84","zero-number-color":"#fcd65b","date-color":"#fcd65b","pending-text-color":"#fde38d","error-text-color":"#f95d84","null-string-color":"#929192","filter-bar-active-bg":"#425175","filter-bar-active-color":"#4878ea","filter-bar-expanded-bg":"#373438","filter-bar-expanded-active-bg":"#313849","filter-bar-expanded-active-cell-bg":"#374d80","filter-bar-separator-color":"#929192","filter-bar-error-color":"#f95d84","filter-icon-color":"#4878ea","scrim-color":"#211f22","context-menu-sort-icon-color":"#aa9af4","context-menu-reverse-icon-color":"#548d29","linker-column-hover-bg":"rgba(118, 217, 228, 0.09)","tree-line-color":"#5b5a5c","tree-marker-color":"#c0bfbf","tree-marker-hover-color":"#fcfcfa","grouped-column-divider-color":"#1a171a","floating-grid-row-color":"#555356","floating-row-background-colors":"#403e41","floating-divider-inner-color":"#403e41","floating-divider-outer-color":"#211f22","overflow-button-color":"#c0bfbf","overflow-button-hover-color":"#fcfcfa"},Lp=Object.freeze({backgroundColor:ue["grid-bg"],white:ue.white,black:ue.black,font:ue.font,headerBackgroundColor:ue["header-bg"],headerColor:ue["header-color"],headerSeparatorColor:ue["header-separator-color"],headerSeparatorHoverColor:ue["header-separator-hover-color"],headerHiddenSeparatorHoverColor:ue["header-hidden-separator-hover-color"],headerSortBarColor:ue["header-sort-bar-color"],headerReverseBarColor:ue["header-reverse-bar-color"],headerBarCasingColor:ue["header-bar-casing-color"],headerFont:ue["header-font"],rowBackgroundColors:ue["row-background-colors"],rowHoverBackgroundColor:ue["row-hover-bg"],selectionColor:ue["selection-color"],selectionOutlineColor:ue["selection-outline-color"],selectionOutlineCasingColor:ue["selection-outline-casing-color"],selectedRowHoverBackgroundColor:ue["selected-row-hover-bg"],scrollBarBackgroundColor:ue["scroll-bar-bg"],scrollBarHoverBackgroundColor:ue["scroll-bar-hover-bg"],scrollBarCasingColor:ue["scroll-bar-casing-color"],scrollBarCornerColor:ue["scroll-bar-corner-color"],scrollBarColor:ue["scroll-bar-color"],scrollBarHoverColor:ue["scroll-bar-hover-color"],scrollBarActiveColor:ue["scroll-bar-active-color"],scrollBarSelectionTickColor:ue["selected-row-hover-bg"],scrollBarActiveSelectionTickColor:ue["scroll-bar-active-selection-tick-color"],textColor:ue["text-color"],positiveNumberColor:ue["positive-number-color"],negativeNumberColor:ue["negative-number-color"],zeroNumberColor:ue["zero-number-color"],dateColor:ue["date-color"],pendingTextColor:ue["pending-text-color"],errorTextColor:ue["error-text-color"],nullStringColor:ue["null-string-color"],filterBarActiveBackgroundColor:ue["filter-bar-active-bg"],filterBarExpandedBackgroundColor:ue["filter-bar-expanded-bg"],filterBarExpandedActiveBackgroundColor:ue["filter-bar-expanded-active-bg"],filterBarExpandedActiveCellBackgroundColor:ue["filter-bar-expanded-active-cell-bg"],filterBarSeparatorColor:ue["filter-bar-separator-color"],filterBarActiveColor:ue["filter-bar-active-color"],filterBarErrorColor:ue["filter-bar-error-color"],filterIconColor:ue["filter-icon-color"],scrimColor:ue["scrim-color"],contextMenuSortIconColor:ue["context-menu-sort-icon-color"],contextMenuReverseIconColor:ue["context-menu-reverse-icon-color"],allowRowResize:!1,autoSelectRow:!0,gridColumnColor:null,gridRowColor:null,groupedColumnDividerColor:ue["grouped-column-divider-color"],columnHoverBackgroundColor:null,headerHorizontalPadding:12,scrollBarSize:13,scrollBarHoverSize:16,minScrollHandleSize:24,rowHeight:parseInt(ue["row-height"],10)||19,columnWidth:100,rowHeaderWidth:0,rowFooterWidth:60,columnHeaderHeight:parseInt(ue["header-height"],10)||30,filterBarHeight:30,filterBarCollapsedHeight:5,sortHeaderBarHeight:2,reverseHeaderBarHeight:4,filterBarHorizontalPadding:4,scrimBlurSize:25,minScrimTransitionTime:150,maxScrimTransitionTime:350,scrollSnapToRow:!0,linkerColumnHoverBackgroundColor:ue["linker-column-hover-bg"],treeLineColor:ue["tree-line-color"],treeMarkerColor:ue["tree-marker-color"],treeMarkerHoverColor:ue["tree-marker-hover-color"],floatingGridColumnColor:null,floatingGridRowColor:ue["floating-grid-row-color"],floatingRowBackgroundColors:ue["floating-row-background-colors"],floatingDividerInnerColor:ue["floating-divider-inner-color"],floatingDividerOuterColor:ue["floating-divider-outer-color"],overflowButtonColor:ue["overflow-button-color"],overflowButtonHoverColor:ue["overflow-button-hover-color"]});const Fa=Z.module("ColumnStatistics"),qT={SIZE:"Number of Rows"},nd=class extends w.exports.Component{constructor(t){super(t),this.handleError=this.handleError.bind(this),this.handleGenerateStatistics=this.handleGenerateStatistics.bind(this),this.handleStatistics=this.handleStatistics.bind(this),this.cancelablePromise=null,this.state={error:null,loading:!1,statistics:null,numRows:0}}static getStatsLabel(t){var e;return(e=qT[t])!=null?e:t.split(" ").map(n=>n[0].toUpperCase()+n.substr(1).toLowerCase()).join(" ")}componentDidMount(){this.maybeGenerateStatistics()}componentWillUnmount(){this.cancelablePromise&&this.cancelablePromise.cancel()}maybeGenerateStatistics(){const{model:t}=this.props,e=t.rowCount-t.pendingRowCount;this.setState({numRows:e}),t.isColumnStatisticsAvailable?e<nd.AUTO_GENERATE_LIMIT&&this.handleGenerateStatistics():this.setState({loading:!1})}handleGenerateStatistics(){this.setState({loading:!0});const{column:t,model:e}=this.props;this.cancelablePromise=ye.makeCancelable(e.columnStatistics(t)),this.cancelablePromise.then(this.handleStatistics).catch(this.handleError)}handleStatistics(t){Fa.debug("Received statistics",t);const{model:e,onStatistics:n}=this.props,s=[];t.statisticsMap.forEach((i,o)=>{s.push({operation:nd.getStatsLabel(o),value:i,type:t.getType(o)})}),t.uniqueValues.forEach((i,o)=>{s.push({operation:o,className:"column-statistics-unique-value",value:i,type:"long"})}),this.setState({loading:!1,statistics:s,numRows:e.rowCount-e.pendingRowCount}),n()}handleError(t){if(t!=null&&ye.isCanceled(t)){Fa.debug("Called handleError on a cancelled promise result");return}Fa.error("Error generating statistics",t),this.setState({error:t,loading:!1,statistics:null})}render(){const{column:t,model:e}=this.props,{error:n,loading:s,statistics:i,numRows:o}=this.state,r=!s&&n==null&&i==null&&e.isColumnStatisticsAvailable,l=[],a=t.type.substring(t.type.lastIndexOf(".")+1),d=t.description===null?null:t.description;if(i!=null)for(let p=0;p<i.length;p+=1){const{operation:g,className:f,value:b,type:C}=i[p],S=C?e.displayString(b,C):e.displayString(b,t.type,t.name),v=T(X.Fragment,{children:[h("div",{className:z("column-statistic-operation",f),children:g}),h("div",{className:"column-statistic-value",children:S})]},g);l.push(v)}const c=gt(e)&&e.hasExpandableRows?"Expanded Rows":"Number of Rows",u=e.displayString(o,"long"),m=e.getColumnIndexByName(t.name);return T("div",{className:"column-statistics",children:[T("div",{className:"column-statistics-title",children:[t.name,T("span",{className:"column-statistics-type",children:["\xA0(",a,")"]}),h(Pl,{className:"column-statistics-copy",tooltip:"Copy column name",copy:t.name})]}),d!=null&&h("div",{className:"column-statistics-description",children:d}),m!=null&&!e.isColumnMovable(m)&&T("div",{className:"column-statistics-status",children:[h(ee,{icon:e.isColumnFrozen(m)?rb:PC,className:"mr-1"}),e.isColumnFrozen(m)?"Frozen":"Not movable"]}),T("div",{className:"column-statistics-grid",children:[i==null&&T(Te,{children:[h("div",{className:"column-statistic-operation",children:c}),h("div",{className:"column-statistic-value",children:u})]}),l]}),r&&h(W,{kind:"ghost",className:"px-0",onClick:this.handleGenerateStatistics,children:"Generate Stats"}),n!=null&&h("div",{className:"error-message",children:`${n}`}),i&&!s&&h(W,{kind:"ghost",className:"px-0",onClick:this.handleGenerateStatistics,icon:h(ee,{icon:Dd,className:"mr-1"}),children:"Refresh"}),s&&T("div",{className:"column-statistics-loading",children:[h(On,{className:"mr-2"}),"Calculating Stats..."]})]})}};let Ap=nd;Ap.AUTO_GENERATE_LIMIT=1e5;const $r=Z.module("AdvancedFilterCreatorFilterItem");class nc extends w.exports.PureComponent{constructor(e){super(e),this.getCachedIsValid=Se((o,r,l,a)=>{try{return!l||_.makeAdvancedValueFilter(o,r,l,a)!=null}catch{return!1}}),this.handleDelete=this.handleDelete.bind(this),this.handleTypeChange=this.handleTypeChange.bind(this),this.handleValueChange=this.handleValueChange.bind(this),this.typeDropdown=null;const{value:n="",filterTypes:s,selectedType:i=s[0]}=e;this.state={selectedType:i,value:n}}static getLabelForFilter(e,n){try{if(_.isNumberType(e)||_.isCharType(e))return Rm(n);if(_.isTextType(e))return Im(n);if(_.isDateType(e))return Dm(n);if(_.isBooleanType(e))return l0(n);throw new Error(`Unrecognized column type: ${e}`)}catch(s){return $r.warn(s),""}}componentDidMount(){var e;(e=this.typeDropdown)==null||e.focus()}componentDidUpdate(e){const{value:n,selectedType:s}=this.props;s!==void 0&&e.selectedType!==s&&this.setState({selectedType:s}),n!==void 0&&e.value!==n&&this.setState({value:n})}handleTypeChange(e){const n=e.target.value;$r.debug2("typeChange",n),this.setState({selectedType:n});const{onChange:s}=this.props,{value:i}=this.state;i!=null&&i.length>0&&s(n,i)}handleValueChange(e){$r.debug2("valueChange");const{value:n}=e.target;this.setState({value:n});const{onChange:s}=this.props,{selectedType:i}=this.state;i!=null&&s(i,n)}handleDelete(){$r.debug("delete");const{onDelete:e}=this.props;e()}render(){const{column:e,filterTypes:n,formatter:s}=this.props,{selectedType:i,value:o}=this.state,r=!_.isBooleanType(e.type),l=[],a=this.getCachedIsValid(e,i,o,s.timeZone);for(let d=0;d<n.length;d+=1){const c=n[d],u=nc.getLabelForFilter(e.type,c),m=h("option",{value:c,children:u},c);l.push(m)}return h("div",{className:"advanced-filter-creator-filter-item",children:T("div",{className:"form-row",children:[h("div",{className:"form-group col",children:h("select",{className:"form-control custom-select",value:i,onChange:this.handleTypeChange,ref:d=>{this.typeDropdown=d},children:l})}),r&&h("div",{className:"form-group col",children:h("div",{className:"input-group",children:h("input",{type:"text",className:z("form-control",{error:!a}),placeholder:"Enter value",value:o,onChange:this.handleValueChange})})}),h("div",{className:"form-group col-1 px-0",children:h(W,{kind:"ghost",className:"w-100 h-100 p-0 m-0",onClick:this.handleDelete,icon:hn,tooltip:"Remove Filter"})})]})})}}const Vh=Z.module("AdvancedFilterCreatorSelectValueList"),sd=class extends w.exports.PureComponent{constructor(t){super(t),this.handleSelect=this.handleSelect.bind(this),this.handleViewportChange=this.handleViewportChange.bind(this),this.handleSelectionUpdate=this.handleSelectionUpdate.bind(this),this.handleTableUpdate=this.handleTableUpdate.bind(this),this.list=null;const{selectedValues:e}=this.props;this.state={itemCount:0,items:[],offset:0,selectedValues:e,isLoading:!0}}static indexOf(t,e){for(let n=0;n<e.length;n+=1){const s=e[n];if(s===t||s!=null&&s.valueOf!=null&&t!=null&&t.valueOf!=null&&s.valueOf()===t.valueOf())return n}return-1}componentDidMount(){const{table:t}=this.props;t&&this.startListening(t)}componentDidUpdate(t){const{filters:e,invertSelection:n,selectedValues:s,table:i}=this.props;t.table!==i&&(t.table&&this.stopListening(t.table),i&&this.startListening(i),this.resetViewport()),t.invertSelection!==n&&this.setState({selectedValues:[]},this.handleSelectionUpdate),t.selectedValues!==s&&this.setState({selectedValues:s},this.handleSelectionUpdate),t.filters!==e&&(i==null||i.applyFilter(e),this.resetViewport())}componentWillUnmount(){const{table:t}=this.props;t&&this.stopListening(t)}handleSelect(t,e){const{invertSelection:n}=this.props;let{selectedValues:s}=this.state;s=[...s];const i=sd.indexOf(e,s);i>=0?s.splice(i,1):s.push(e);let o=i<0;n&&(o=!o);const{offset:r}=this.state;let{items:l}=this.state;l=[...l];const a=t-r;a>=0&&a<l.length&&(l[a].isSelected=o),this.setState({items:l,selectedValues:s});const{onChange:d}=this.props;d(s,n)}handleViewportChange(t,e){this.updateViewport(t,e)}handleSelectionUpdate(){this.updateItemSelection()}handleTableUpdate(t){const{table:e,formatter:n}=this.props;if(!e)return;const s=t.detail,{offset:i}=s,o=[],r=e.columns[0];for(let a=0;a<s.rows.length;a+=1){const c=s.rows[a].get(r),u=n.getFormattedString(c,r.type,r.name),m=this.isValueSelected(c);o.push({displayValue:u,value:c,isSelected:m})}Vh.debug2("Received table update:",i,o.length);const l=e.size;this.setState({itemCount:l,items:o,offset:i,isLoading:!1})}isValueSelected(t){const{invertSelection:e}=this.props,{selectedValues:n}=this.state,s=sd.indexOf(t,n);return e?s<0:s>=0}startListening(t){t.addEventListener(M.Table.EVENT_UPDATED,this.handleTableUpdate)}stopListening(t){t.removeEventListener(M.Table.EVENT_UPDATED,this.handleTableUpdate)}resetViewport(){this.list&&this.list.topRow!=null&&this.list.bottomRow!=null&&this.updateViewport(this.list.topRow,this.list.bottomRow,!0)}updateItemSelection(){let{items:t}=this.state;t=[...t];for(let e=0;e<t.length;e+=1){const n=t[e],{value:s}=n;n.isSelected=this.isValueSelected(s)}this.setState({items:t})}updateViewport(t,e,n=!1){const{table:s}=this.props;if(s==null)return;n&&this.setState({isLoading:!0});const i=e-t+1,o=Math.max(0,t-i*3),r=Math.max(o,e+i*3);Vh.debug2("Setting viewport",o,",",r),s.setViewport(o,r)}render(){const{offset:t,isLoading:e,items:n,itemCount:s}=this.state;return T("div",{className:"select-value-list-wrapper",children:[h(im,{itemCount:s,items:n,offset:t,onSelect:this.handleSelect,onViewportChange:this.handleViewportChange,ref:i=>{this.list=i}}),h(mt,{in:e,timeout:250,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,children:h("div",{className:"loading-list",children:h(On,{className:"loading-spinner-large"})})})]})}};let Pp=sd;Pp.defaultProps={invertSelection:!0,selectedValues:[],onChange:()=>{}};const Hp=class extends w.exports.PureComponent{constructor(t){super(t),this.handleSelectAllClick=this.handleSelectAllClick.bind(this),this.handleClearAllClick=this.handleClearAllClick.bind(this),this.handleListChange=this.handleListChange.bind(this),this.handleSearchChange=this.handleSearchChange.bind(this),this.handleUpdateFilterTimeout=this.handleUpdateFilterTimeout.bind(this);const{invertSelection:e,selectedValues:n}=t;this.state={filters:[],invertSelection:e,selectedValues:n,searchText:""}}componentDidMount(){this.initSearchTable()}componentDidUpdate(t,e){const{invertSelection:n,selectedValues:s,table:i}=this.props;t.table!==i&&this.initSearchTable(),t.invertSelection!==n&&this.setState({invertSelection:n}),t.selectedValues!==s&&this.setState({selectedValues:s});const{table:o,searchText:r}=this.state;o!==e.table&&(e.table!=null&&e.table.close(),o!=null&&this.startUpdateFilterTimer()),r!==e.searchText&&this.startUpdateFilterTimer()}componentWillUnmount(){const{table:t}=this.state;t!=null&&t.close(),this.searchTablePromise=void 0,this.stopUpdateFilterTimer()}getColumnName(){const{table:t}=this.props;return t!=null?t.columns[0].name:""}getDisplayedValuesCount(){const{invertSelection:t,selectedValues:e,table:n}=this.state;return n==null?null:t?n.totalSize-e.length:e.length}getDisplayedValueText(){const t=this.getDisplayedValuesCount(),{table:e}=this.state,{formatter:n}=this.props;if(t!=null&&e!=null){const s=n.getFormattedString(t,"long"),i=n.getFormattedString(e.totalSize,"long");let o="";return t<1e6&&(o="Displaying "),`${o}${s} of ${i}`}return null}initSearchTable(){const{table:t}=this.props;if(t==null)return;const e=t.copy();this.searchTablePromise=e,this.searchTablePromise.then(n=>{this.searchTablePromise===e?(this.setState({table:n}),this.searchTablePromise=void 0):n.close()})}handleListChange(t,e){this.setState({selectedValues:t,invertSelection:e});const{onChange:n}=this.props;n(t,e)}handleSearchChange(t){const e=t.target.value;this.setState({searchText:e})}handleSelectAllClick(){this.resetSelection(!0)}handleClearAllClick(){this.resetSelection(!1)}handleUpdateFilterTimeout(){this.updateFilterTimer=void 0,this.updateTableFilter()}resetSelection(t){const e=[];this.setState({invertSelection:t,selectedValues:e});const{onChange:n}=this.props;n(e,t)}startUpdateFilterTimer(){this.stopUpdateFilterTimer(),this.updateFilterTimer=setTimeout(this.handleUpdateFilterTimeout,Hp.searchDebounceTime)}stopUpdateFilterTimer(){this.updateFilterTimer!=null&&(clearTimeout(this.updateFilterTimer),this.updateFilterTimer=void 0)}updateTableFilter(){const{table:t,searchText:e}=this.state,{timeZone:n}=this.props,s=t==null?void 0:t.columns[0],i=[];if(s==null)return;let o;if(e.length>0){let r=null;_.isCharType(s.type)?r=_.makeQuickFilter(s,e):_.isTextType(s.type)?r=_.makeQuickFilter(s,`~${e}`,n):r=_.makeQuickFilter(s,`>=${e}`,n),r!=null?i.push(r):o="Invalid search text"}this.setState({filters:i,error:o})}render(){const{error:t,filters:e,invertSelection:n,selectedValues:s,searchText:i,table:o}=this.state,{formatter:r,showSearch:l}=this.props,a=this.getColumnName(),d=this.getDisplayedValueText(),c=a?`Find ${a}...`:"";return T("div",{className:"advanced-filter-creator-select-value",children:[T("div",{className:l?"form-group":"",children:[h("label",{htmlFor:"advanced-filter-creator-select-value-input",children:"Select Values"}),l&&h("input",{type:"text",className:z("form-control",{"is-invalid":t!=null}),id:"advanced-filter-creator-select-value-input",placeholder:c,value:i,onChange:this.handleSearchChange})]}),h(Pp,{table:o,filters:e,invertSelection:n,selectedValues:s,formatter:r,onChange:this.handleListChange}),T("div",{className:"advanced-filter-creator-select-meta-row",children:[T("div",{children:[h(W,{kind:"ghost",onClick:this.handleSelectAllClick,children:"Select All"}),h(W,{kind:"ghost",onClick:this.handleClearAllClick,children:"Clear"})]}),h(mt,{in:d!=null,timeout:250,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,children:h("div",{className:"row-count-info",children:d})})]})]})}};let sc=Hp;sc.searchDebounceTime=250;sc.defaultProps={invertSelection:!0,selectedValues:[],onChange:()=>{},showSearch:!0};const Mo=Z.module("AdvancedFilterCreator"),ai=class extends w.exports.PureComponent{constructor(t){var r,l;super(t),this.getFilterTypes=Se(a=>_.getFilterTypes(a)),this.handleAddAnd=this.handleAddAnd.bind(this),this.handleAddOr=this.handleAddOr.bind(this),this.handleChangeFilterOperator=this.handleChangeFilterOperator.bind(this),this.handleDone=this.handleDone.bind(this),this.handleFilterChange=this.handleFilterChange.bind(this),this.handleFilterDelete=this.handleFilterDelete.bind(this),this.handleSelectValueChange=this.handleSelectValueChange.bind(this),this.handleReset=this.handleReset.bind(this),this.handleSortDown=this.handleSortDown.bind(this),this.handleSortUp=this.handleSortUp.bind(this),this.handleSubmit=this.handleSubmit.bind(this),this.handleFocusTrapStart=this.handleFocusTrapStart.bind(this),this.handleFocusTrapEnd=this.handleFocusTrapEnd.bind(this),this.handleUpdateTimeout=this.handleUpdateTimeout.bind(this),this.focusTrapContainer=X.createRef();const{options:e}=t;let{filterOperators:n,invertSelection:s,selectedValues:i}=e;const o=(l=(r=e.filterItems)==null?void 0:r.map(({selectedType:a,value:d})=>({selectedType:a,value:d,key:We()})))!=null?l:[];o.length===0&&o.push(ai.makeFilterItem()),n==null&&(n=[]),s==null&&(s=!0),i==null&&(i=[]),this.state={filterItems:o,filterOperators:n,invertSelection:s,selectedValues:i,valuesTableError:null,valuesTable:void 0}}static makeFilterItem(){return{key:We()}}componentDidMount(){this.initValuesTable()}componentWillUnmount(){this.debounceTimeout!=null&&(clearTimeout(this.debounceTimeout),this.sendUpdate()),this.valuesTablePromise!=null&&this.valuesTablePromise.cancel()}getFilterChangeHandler(t){return this.handleFilterChange.bind(this,t)}getFilterDeleteHandler(t){return this.handleFilterDelete.bind(this,t)}initValuesTable(){const{model:t,column:e}=this.props;if(!t.isValuesTableAvailable){Mo.debug("No values table for this model, just ignore");return}this.valuesTablePromise=_.makeCancelableTablePromise(t.valuesTable(e)),this.valuesTablePromise.then(n=>{const s=n.columns[0].sort().asc();n.applySort([s]),this.setState({valuesTable:n})}).catch(n=>{ye.isCanceled(n)||(Mo.error("Unable to open values table",n),this.setState({valuesTableError:n}))})}handleFocusTrapEnd(){var t,e;((e=(t=this.focusTrapContainer)==null?void 0:t.current)==null?void 0:e.querySelector("button,select,input,textarea")).focus()}handleFocusTrapStart(){var e,n;const t=(n=(e=this.focusTrapContainer)==null?void 0:e.current)==null?void 0:n.querySelectorAll("button,select,input,textarea");t&&t.length>0&&t[t.length-1].focus()}handleAddAnd(){let{filterItems:t,filterOperators:e}=this.state;t=t.concat(ai.makeFilterItem()),e=e.concat(Xt.and),this.setState({filterItems:t,filterOperators:e})}handleAddOr(){let{filterItems:t,filterOperators:e}=this.state;t=t.concat(ai.makeFilterItem()),e=e.concat(Xt.or),this.setState({filterItems:t,filterOperators:e})}handleChangeFilterOperator(t,e){let{filterOperators:n}=this.state;n=[...n],r0(e),n[t]=e,this.setState({filterOperators:n}),this.startUpdateTimer()}handleFilterChange(t,e,n){let{filterItems:s}=this.state;s=[...s];const{key:i}=s[t];s[t]={key:i,selectedType:e,value:n},this.setState({filterItems:s}),this.startUpdateTimer()}handleFilterDelete(t){let{filterItems:e,filterOperators:n}=this.state;e=[...e],n=[...n],t<e.length&&e.splice(t,1),t<n.length?n.splice(t,1):t===n.length&&n.splice(n.length-1,1),e.length===0&&e.push(ai.makeFilterItem()),this.setState({filterItems:e,filterOperators:n}),this.startUpdateTimer()}handleSelectValueChange(t,e){this.setState({selectedValues:t,invertSelection:e}),this.startUpdateTimer()}handleReset(){Mo.debug("Resetting Advanced Filter"),this.setState({filterItems:[ai.makeFilterItem()],filterOperators:[],selectedValues:[],invertSelection:!0}),this.startUpdateTimer()}handleSortDown(t){const e=Ge.isModifierKeyDown(t);this.sortTable(_.sortDirection.descending,e)}handleSortUp(t){const e=Ge.isModifierKeyDown(t);this.sortTable(_.sortDirection.ascending,e)}handleSubmit(t){Mo.debug("Submitting Advanced Filter"),this.stopUpdateTimer(),this.sendUpdate(),t.preventDefault()}handleDone(t){Mo.debug("Submitting and Closing Advanced Filter"),this.stopUpdateTimer(),this.sendUpdate();const{onDone:e}=this.props;e(),t.preventDefault()}handleUpdateTimeout(){this.debounceTimeout=void 0,this.sendUpdate()}shouldShowAddFilter(){const{filterItems:t}=this.state;if(t.length===0)return!1;const e=t[t.length-1],{selectedType:n,value:s}=e;return n!=null&&n.length>0&&s!=null&&s.length>0}sortTable(t,e=!1){const{column:n,onSortChange:s}=this.props;s(n,t,e)}startUpdateTimer(){this.stopUpdateTimer(),this.debounceTimeout=setTimeout(this.handleUpdateTimeout,ai.debounceFilterUpdate)}stopUpdateTimer(){this.debounceTimeout!==void 0&&(clearTimeout(this.debounceTimeout),this.debounceTimeout=void 0)}sendUpdate(){const{filterItems:t,filterOperators:e,invertSelection:n,selectedValues:s}=this.state,{column:i,onFilterChange:o,model:r}=this.props,{formatter:l}=r,a=t.filter(({selectedType:m,value:p})=>m!=null&&p!=null&&p!==""),d=e.filter((m,p)=>m!=null&&t[p].selectedType!=null&&t[p].value!=null&&t[p].value!=="").slice(0,a.length-1),c={filterItems:a,filterOperators:d,invertSelection:n,selectedValues:s},u=_.makeAdvancedFilter(i,c,l.timeZone);o(i,u,c)}render(){const{column:t,model:e,sortDirection:n,formatter:s}=this.props,{filterItems:i,filterOperators:o,invertSelection:r,selectedValues:l,valuesTable:a,valuesTableError:d}=this.state,{isValuesTableAvailable:c}=e,u=_.isBooleanType(t.type),m=_.isDateType(t.type),p=this.getFilterTypes(t.type),g=t.type.substring(t.type.lastIndexOf(".")+1),f=[];if(!u&&p.length)for(let S=0;S<i.length;S+=1){const v=i[S],{key:y,selectedType:E,value:I}=v,R=h(nc,{column:t,filterTypes:p,onChange:this.getFilterChangeHandler(S),onDelete:this.getFilterDeleteHandler(S),selectedType:E,value:I,formatter:s},y);if(f.push(R),S<o.length){const F=o[S]===Xt.and,P=T("div",{className:"form-row justify-content-end advanced-filter-creator-filter-operator",children:[h(W,{kind:"ghost",className:z("filter-operator",{active:F}),onClick:()=>this.handleChangeFilterOperator(S,Xt.and),children:"AND"}),h(W,{kind:"ghost",className:z("filter-operator",{active:!F}),onClick:()=>this.handleChangeFilterOperator(S,Xt.or),children:"OR"})]},`filterOperator${y}`);f.push(P)}}const b=this.shouldShowAddFilter(),C=T("div",{className:z("form-row justify-content-end add-filter-item",{hidden:!b}),children:[h("span",{className:"text-muted",children:h(ee,{icon:Gs})}),h(W,{kind:"ghost",className:"btn-filter-item",onClick:this.handleAddAnd,disabled:!b,tooltip:"Add filter with AND",children:"AND"}),h(W,{kind:"ghost",className:"btn-filter-item",onClick:this.handleAddOr,disabled:!b,tooltip:"Add filter with OR",children:"OR"})]},"addFilterItem");return f.push(C),T("div",{className:"advanced-filter-creator",role:"presentation",children:[h("div",{tabIndex:0,onFocus:this.handleFocusTrapStart}),T("form",{onSubmit:this.handleSubmit,ref:this.focusTrapContainer,children:[T("div",{className:"title-bar",children:[h("h6",{className:"advanced-filter-title",children:"Advanced Filters"}),T("div",{className:"advanced-filter-menu-buttons",children:[h(W,{kind:"ghost",className:z("sort-operator",{active:n===_.sortDirection.descending}),onClick:this.handleSortDown,icon:Kc,tooltip:`Sort ${t.name} Descending`}),h(W,{kind:"ghost",className:z("sort-operator",{active:n===_.sortDirection.ascending}),onClick:this.handleSortUp,icon:h(ee,{icon:Kc,rotation:180}),tooltip:`Sort ${t.name} Ascending`})]})]}),h("hr",{}),T("div",{className:"advanced-filter-column-name",children:[t.name,"\xA0",T("span",{className:"column-type",children:["(",g,")"]})]}),f,c&&d==null&&T(Te,{children:[!u&&h("hr",{}),h("div",{className:"form-group",children:h(sc,{table:a,onChange:this.handleSelectValueChange,invertSelection:r,selectedValues:l,formatter:s,showSearch:!m,timeZone:s.timeZone})})]}),T("div",{className:"form-row justify-content-end",children:[h(W,{kind:"secondary",className:"mr-2",onClick:this.handleReset,children:"Reset"}),h(W,{kind:"primary",onClick:this.handleDone,children:"Done"})]})]}),h("div",{tabIndex:0,onFocus:this.handleFocusTrapEnd})]})}};let ic=ai;ic.debounceFilterUpdate=250;ic.defaultProps={options:{filterItems:null,filterOperators:null,invertSelection:!0,selectedValues:[]},sortDirection:null};const Uh=Z.module("Aggregations"),YT=[Oe.SUM,Oe.ABS_SUM,Oe.MIN,Oe.MAX,Oe.VAR,Oe.AVG,Oe.STD,Oe.FIRST,Oe.LAST,Oe.COUNT_DISTINCT,Oe.DISTINCT,Oe.COUNT,Oe.UNIQUE];function XT({isRollup:t,settings:e,onChange:n,onEdit:s}){const{aggregations:i,showOnTop:o}=e,r=w.exports.useMemo(()=>YT.filter(F=>!i.some(P=>P.operation===F)),[i]),[l,a]=w.exports.useState(r[0]),[d,c]=w.exports.useState([]),u=w.exports.useCallback(F=>{n({...e,...F})},[n,e]),m=w.exports.useCallback(F=>{u({aggregations:F})},[u]),p=w.exports.useCallback(F=>{u({showOnTop:F})},[u]),g=w.exports.useCallback(()=>{Uh.debug("handleDragStart"),jt.startDragging()},[]),f=w.exports.useCallback(({destination:F,source:P})=>{if(Uh.debug("handleDragEnd",F,P),jt.stopDragging(),F===null)return;let H=F.index;P.index<F.index&&(H+=1);const x=[...i],A=jt.reorder(x,d,x,H),k=jt.adjustDestinationIndex(H,d),G=[[k,k+A.length-1]];m(x),c(G)},[m,i,d,c]),b=w.exports.useCallback(F=>{a(F)},[a]),C=w.exports.useCallback(()=>{m([...i,{operation:l,selected:[],invert:!0}])},[i,l,m]),S=w.exports.useCallback(F=>{m(i.filter((P,H)=>H!==F))},[i,m]),v=w.exports.useCallback(F=>{c(F)},[c]),y=w.exports.useCallback(F=>{const P=i[F];Bs.isRollupOperation(P.operation)||s(P)},[i,s]),E=w.exports.useCallback(F=>{p(F.target.value==="true")},[p]);w.exports.useEffect(function(){r.length>0&&!r.includes(l)&&a(r[0])},[r,l]);const I=w.exports.useCallback(({item:F,itemIndex:P,isClone:H=!1,selectedCount:x})=>{const A=F.operation,k=H?`${x}`:void 0,G=H?"item-list-item-clone":void 0,V=Bs.isRollupOperation(F.operation),O=!H&&!V;return T(Te,{children:[T("div",{className:z("item-list-item-content","draggable-item-list-item-content",G),children:[T("span",{className:"title",children:[A,!t&&V&&T("span",{className:"small text-warning",children:[h(ee,{icon:Vu})," Requires rollup"]})]}),sn.renderBadge({text:k}),sn.renderHandle()]}),!H&&T(Te,{children:[h(W,{kind:"ghost",className:"btn-edit",icon:nr,tooltip:"Edit Columns",onClick:()=>s(F),disabled:!O}),h(W,{kind:"ghost",className:"btn-delete",icon:hn,tooltip:"Delete Aggregation",onClick:()=>S(P)})]})]})},[S,s,t]),R=r.length>0,N=i.length>0;return T("div",{className:"aggregations",children:[R&&T("div",{className:"form-inline",children:[h(Xb,{onChange:b,value:l,children:r.map(F=>h(Yb,{value:F,children:F},F))}),T("button",{type:"button",className:"btn btn-link btn-add",onClick:C,children:[h(ee,{icon:Gs}),"Add Aggregation"]})]}),R&&N&&h("hr",{}),N&&T(Te,{children:[!t&&T("div",{className:"form-inline",children:[h("label",{children:"Placement:\xA0"}),T(Ul,{onChange:E,value:`${o}`,children:[h(xn,{value:"true",children:"Top"}),h(xn,{value:"false",children:"Bottom"})]})]}),h(_l,{onDragStart:g,onDragEnd:f,children:h(sn,{className:"selected-aggregations",itemCount:i.length,items:i,renderItem:I,offset:0,onSelectionChange:v,onSelect:y,selectedRanges:d,isMultiSelect:!0})})]})]})}const jT=30;function ZT({aggregation:t,columns:e,onChange:n}){const[s,i]=w.exports.useState(-1),[o,r]=w.exports.useState(-1),[l,a]=w.exports.useState(0),{invert:d,selected:c}=t,u=w.exports.useRef(null),m=w.exports.useCallback(E=>c.includes(E)?!d:d,[d,c]),p=w.exports.useMemo(()=>{let E=tc(e,t.operation);return l!==0&&(E=_.sortColumns(E,l===1)),E},[e,t.operation,l]),g=w.exports.useMemo(()=>s>=0?p.slice(s,o+1).map(E=>({value:E.name,displayValue:E.name,isSelected:m(E.name)})):[],[p,m,o,s]),f=w.exports.useCallback(E=>{const{name:I}=p[E],R=c.indexOf(I);let N=[...c],F=d;R>=0?N.splice(R,1):(N.push(I),N.length===p.length&&(N=[],F=!d)),n({...t,selected:N,invert:F})},[t,d,p,c,n]),b=w.exports.useCallback(()=>{a(0),n({...t,selected:[],invert:!0})},[t,n]),C=w.exports.useCallback((E,I)=>{i(E),r(I)},[i,r]),S=w.exports.useCallback(()=>{c.length===0?n({...t,invert:!d}):n({...t,selected:[],invert:!0})},[t,d,n,c]),v=c.length===0?d:null,y=c.length!==0||!d||l!==0;return T("div",{role:"menu",className:"aggregation-edit",children:[h("div",{className:"top-menu",children:T("div",{className:"form-inline",children:[h(St,{checked:v,onChange:S,children:"Toggle All"}),h("div",{className:"spacer"}),h(mt,{in:y,timeout:ze.transitionSlowMs,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,children:h(W,{kind:"ghost",className:"btn-reset",onClick:b,children:"Reset"})}),h(W,{kind:"ghost",className:z({active:l===1}),icon:Md,tooltip:"Sort ascending",onClick:()=>a(1)}),h(W,{kind:"ghost",className:z({active:l===2}),icon:Nd,tooltip:"Sort descending",onClick:()=>a(2)})]})}),h("div",{className:"aggregation-edit-item-list",children:h(vn,{itemCount:p.length,items:g,offset:s,renderItem:({item:E})=>h(St,{checked:m(E.value),children:E.displayValue}),onSelect:f,onViewportChange:C,rowHeight:jT,focusSelector:"input",ref:u})})]})}function QT(t){return h("svg",{width:48,height:48,xmlns:"http://www.w3.org/2000/svg",...t,children:T("g",{fill:"none",fillRule:"evenodd",children:[h("path",{fill:"#C1C0C0",d:"M44 43v1H4v-1z"}),h("path",{fill:"#7DA4FF",d:"M8 26h4v15H8zM15 17h4v24h-4zM22 21h4v20h-4zM29 17h4v24h-4zM36 11h4v30h-4z"})]})})}function JT(t){return h("svg",{width:48,height:48,xmlns:"http://www.w3.org/2000/svg",...t,children:T("g",{fill:"none",fillRule:"evenodd",children:[h("path",{fill:"#C1C0C0",d:"M44 43v1H4v-1z"}),h("path",{fill:"#7DA4FF",d:"M7 34h4v8H7zM12 31h4v11h-4zM17 27h4v15h-4zM22 22h4v20h-4zM27 27h4v15h-4zM32 29h4v13h-4zM37 31h4v11h-4z"})]})})}function eE(t){return h("svg",{width:48,height:48,xmlns:"http://www.w3.org/2000/svg",...t,children:T("g",{fill:"none",fillRule:"evenodd",children:[h("path",{fill:"#C1C0C0",d:"M4 4h1v40H4zM44 43v1H5v-1z"}),h("path",{stroke:"#7DA4FF",d:"M7.984 32.44l7.982-11.378 5.273 3.739 9.952-10.838 2.826 1.894 7.45-5.802"}),h("path",{stroke:"#BECDEF",d:"M8.244 37.926L17 33.496l5 .87 10.637-10.35 10.615-1.381"})]})})}function tE(t){return h("svg",{width:48,height:48,xmlns:"http://www.w3.org/2000/svg",...t,children:T("g",{fill:"none",fillRule:"evenodd",children:[h("path",{d:"M24 10c7.732 0 14 6.268 14 14s-6.268 14-14 14-14-6.268-14-14h14V10z",fill:"#80A6FF"}),h("path",{d:"M10 24c0-7.732 6.268-14 14-14v14H10z",fill:"#C1C0C0"})]})})}function nE(t){return h("svg",{width:48,height:48,xmlns:"http://www.w3.org/2000/svg",...t,children:T("g",{fill:"none",fillRule:"evenodd",children:[h("path",{fill:"#C1C0C0",d:"M44 43v1H4v-1z"}),h("path",{fill:"#939293",d:"M44 34v1H4v-1zM44 25v1H4v-1zM44 16v1H4v-1z"}),h("circle",{fill:"#7DA4FF",cx:9.5,cy:37.5,r:1.5}),h("circle",{fill:"#7DA4FF",cx:16.5,cy:30.5,r:1.5}),h("circle",{fill:"#7DA4FF",cx:22.5,cy:36.5,r:1.5}),h("circle",{fill:"#7DA4FF",cx:28.5,cy:30.5,r:1.5}),h("circle",{fill:"#7DA4FF",cx:15.5,cy:38.5,r:1.5}),h("circle",{fill:"#7DA4FF",cx:23.5,cy:25.5,r:1.5}),h("circle",{fill:"#7DA4FF",cx:19.5,cy:19.5,r:1.5}),h("circle",{fill:"#7DA4FF",cx:29.5,cy:19.5,r:1.5}),h("circle",{fill:"#7DA4FF",cx:32.5,cy:26.5,r:1.5}),h("circle",{fill:"#7DA4FF",cx:36.5,cy:13.5,r:1.5})]})})}function sE(t){return T("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:[h("rect",{width:"48",height:"48",fill:"none"}),h("rect",{x:"26",y:"10",width:"15",height:"4",fill:"#9FDE70"}),h("rect",{x:"26",y:"22",width:"15",height:"4",fill:"#9FDE70"}),h("rect",{x:"26",y:"28",width:"15",height:"4",fill:"#FFD95C"}),h("rect",{x:"26",y:"34",width:"15",height:"4",fill:"#9FDE70"})]})}function iE(t){return T("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:[h("rect",{width:"48",height:"48",fill:"none"}),h("rect",{x:"4",y:"16",width:"40",height:"4",fill:"#FFD95C"}),h("rect",{x:"4",y:"10",width:"40",height:"4",fill:"#78DCE8"}),h("rect",{x:"4",y:"34",width:"40",height:"4",fill:"#78DCE8"})]})}const Bh=Z.module("ChartBuilder"),Ct=class extends w.exports.PureComponent{static getTypeName(t){switch(t){case M.plot.SeriesPlotStyle.LINE:return"Line";case M.plot.SeriesPlotStyle.BAR:return"Bar";case M.plot.SeriesPlotStyle.SCATTER:return"Scatter";case M.plot.SeriesPlotStyle.PIE:return"Pie";case M.plot.SeriesPlotStyle.HISTOGRAM:return"Histogram";default:return t}}static getTypeIcon(t){switch(t){case M.plot.SeriesPlotStyle.LINE:return h(eE,{});case M.plot.SeriesPlotStyle.BAR:return h(QT,{});case M.plot.SeriesPlotStyle.SCATTER:return h(nE,{});case M.plot.SeriesPlotStyle.PIE:return h(tE,{});case M.plot.SeriesPlotStyle.HISTOGRAM:return h(JT,{});default:return null}}static getMaxSeriesCount(t){switch(t){case M.plot.SeriesPlotStyle.PIE:return 1;case M.plot.SeriesPlotStyle.HISTOGRAM:return 0;default:return 100}}static getXAxisLabel(t){switch(t){case M.plot.SeriesPlotStyle.PIE:return"Labels";case M.plot.SeriesPlotStyle.HISTOGRAM:return"Data";default:return"X-Axis"}}static getSeriesLabel(t){switch(t){case M.plot.SeriesPlotStyle.PIE:return"Values";default:return"Series"}}static makeSeriesItem(t){return{id:We.generate(),value:t}}static makeDefaultSeriesItems(t,e){if(Ct.getMaxSeriesCount(t)===0||e==null||e.length===0)return[];const s=e.length>1?e[1].name:e[0].name;return[Ct.makeSeriesItem(s)]}static getDefaultXAxis(t,e){return e!=null&&e.length>0?e[0].name:null}constructor(t){super(t),this.handleAddSeries=this.handleAddSeries.bind(this),this.handleLinkStateChange=this.handleLinkStateChange.bind(this),this.handleReset=this.handleReset.bind(this),this.handleSeriesChange=this.handleSeriesChange.bind(this),this.handleSeriesDeleteClick=this.handleSeriesDeleteClick.bind(this),this.handleSubmit=this.handleSubmit.bind(this),this.handleTypeClick=this.handleTypeClick.bind(this),this.handleXAxisChange=this.handleXAxisChange.bind(this),this.sendChange=this.sendChange.bind(this);const{model:e}=t,{columns:n}=e,s=Ct.types[0],i=Ct.getDefaultXAxis(s,n),o=Ct.makeDefaultSeriesItems(s,n);this.state={type:s,seriesItems:o,xAxis:i,isLinked:!0}}handleAddSeries(){this.setState(t=>{let{seriesItems:e}=t;e=[...e];const{model:n}=this.props,{columns:s}=n;return e.push({id:We.generate(),value:s[0].name}),{seriesItems:e}},this.sendChange)}handleLinkStateChange(t){this.setState({isLinked:t.target.value==="true"},this.sendChange)}handleReset(){const{model:t}=this.props,{columns:e}=t,n=Ct.types[0],s=Ct.getDefaultXAxis(n,e),i=Ct.makeDefaultSeriesItems(n,e),o=!0;this.setState({type:n,seriesItems:i,xAxis:s,isLinked:o},this.sendChange)}handleSeriesChange(t){const{value:e}=t.target,n=t.target.getAttribute("data-index"),s=parseInt(n,10);this.setState(i=>{let{seriesItems:o}=i;return o=[...o],o[s].value=e,{seriesItems:o}},this.sendChange)}handleSeriesDeleteClick(t){const n=t.target.getAttribute("data-index"),s=parseInt(n,10);this.setState(i=>{let{seriesItems:o}=i;return o=[...o],o.splice(s,1),{seriesItems:o}},this.sendChange)}handleSubmit(t){t.preventDefault();const{onSubmit:e}=this.props,{type:n,seriesItems:s,xAxis:i,isLinked:o}=this.state,r=s.map(l=>l.value);e({type:`${n}`,series:r,xAxis:i,isLinked:o})}handleTypeClick(t){const n=t.target.getAttribute("data-index"),s=parseInt(n,10),i=Ct.types[s];Bh.debug2("handleTypeSelect",i),this.setState(o=>{const r=Ct.getMaxSeriesCount(i);let{seriesItems:l}=o;if(l=l.slice(0,r),l.length===0&&r>0){const{model:a}=this.props,{columns:d}=a;l=Ct.makeDefaultSeriesItems(i,d)}return{type:i,seriesItems:l}},this.sendChange)}handleXAxisChange(t){const e=t.target.value;Bh.debug2("x-axis change",e),this.setState({xAxis:e},this.sendChange)}sendChange(){const{onChange:t}=this.props,{isLinked:e,type:n,seriesItems:s,xAxis:i}=this.state,o=s.map(r=>r.value);t({type:n,series:o,xAxis:i,isLinked:e})}render(){const{model:t}=this.props,{columns:e}=t,{seriesItems:n,type:s,xAxis:i,isLinked:o}=this.state,r=Ct.getMaxSeriesCount(s),l=Ct.getXAxisLabel(s),a=Ct.getSeriesLabel(s),d=n.length>0,c=n.length<r;return h("div",{className:"chart-builder",children:T("form",{onSubmit:this.handleSubmit,children:[T("div",{className:"form-row",children:[h("label",{children:"Select Chart Type"}),h("div",{className:"form-row",children:Ct.types.map((u,m)=>{const p=u;return h("div",{className:"col col-chart-type",children:T("button",{type:"button",className:z("btn","btn-icon","btn-chart-type",{active:u===s}),"data-index":m,onClick:this.handleTypeClick,children:[Ct.getTypeIcon(u),Ct.getTypeName(u)]})},p)})})]}),h("hr",{}),T("div",{className:"form-row form-inline",children:[h("label",{className:"col-2 label-left",children:l}),h("select",{className:"form-control custom-select select-x-axis col",value:i,onChange:this.handleXAxisChange,children:e.map(u=>h("option",{value:u.name,children:u.name},u.name))})]}),d&&h("hr",{}),n.map((u,m)=>T("div",{className:"form-row form-inline form-series-item","data-testid":`form-series-item-${m}`,children:[h("label",{className:"col-2 label-left",children:m===0?a:""}),h("select",{className:"form-control custom-select select-series col",value:u.value,onChange:this.handleSeriesChange,"data-testid":`select-series-item-${m}`,"data-index":m,children:e.map(p=>h("option",{value:p.name,"data-index":m,children:p.name},p.name))}),n.length>1&&h(W,{kind:"ghost",className:"btn-delete-series ml-2 px-2","data-index":m,"data-testid":`delete-series-${m}`,onClick:this.handleSeriesDeleteClick,icon:hn,tooltip:"Delete"})]},u.id)),c&&T("div",{className:"form-row",children:[h("div",{className:"col-2"}),h(W,{kind:"ghost",className:"btn-add-series mt-1",onClick:this.handleAddSeries,icon:Gs,children:"Add Series"})]}),T("div",{className:"form-row chart-builder-link",children:[h("label",{className:"col-2 label-right",children:T("div",{className:"fa-md fa-layers",children:[h(ee,{mask:xd,icon:Zi,transform:"right-5 down-5"}),h(ee,{icon:o?Ed:Sb,transform:"grow-2 right-8 down-6"})]})}),T(Ul,{onChange:this.handleLinkStateChange,value:`${o}`,children:[h(xn,{value:"true",children:"Sync State"}),h(xn,{value:"false",children:"Freeze State"})]})]}),T("div",{className:"form-row",children:[h("div",{className:"col-2 label-right"}),h("div",{className:"col chart-builder-link-info",children:o?"Charts with synced state will update to match any filters or user modifications applied to the parent table.":"Freeze State disconnects the chart state from the parent table. New filters or user modifications on the parent table will not be applied."})]}),T("div",{className:z("form-row","justify-content-end","my-3"),children:[h(W,{kind:"secondary",className:"btn-reset",onClick:this.handleReset,children:"Reset"}),h(W,{kind:"primary",type:"submit",className:"btn-submit",children:"Create"})]})]})})}};let Vp=Ct;Vp.types=[M.plot.SeriesPlotStyle.LINE,M.plot.SeriesPlotStyle.BAR,M.plot.SeriesPlotStyle.SCATTER,M.plot.SeriesPlotStyle.PIE];class Up extends w.exports.Component{constructor(e){super(e),this.handleContentChanged=this.handleContentChanged.bind(this),this.handleEditorFocus=this.handleEditorFocus.bind(this),this.handleEditorBlur=this.handleEditorBlur.bind(this),this.handleContainerClick=this.handleContainerClick.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.state={isEditorFocused:!1,isEditorEmpty:!0},this.editorContainer=null}componentDidMount(){this.initEditor()}componentWillUnmount(){this.destroyEditor()}initEditor(){var i;const{value:e,editorSettings:n}=this.props,s={copyWithSyntaxHighlighting:"false",fixedOverflowWidgets:!0,folding:!1,fontFamily:"Fira Mono",glyphMargin:!1,language:"groovyDB",lineDecorationsWidth:8,lineNumbers:"off",minimap:{enabled:!1},renderLineHighlight:"none",scrollbar:{arrowSize:0,horizontal:"hidden",horizontalScrollbarSize:0},scrollBeyondLastLine:!1,padding:{top:6,bottom:6},tabCompletion:"off",useTabStops:!0,value:e,wordWrap:"on",automaticLayout:!0,...n};if(!this.editorContainer)throw new Error("editorContainer is null");this.editor=gs.create(this.editorContainer,s),this.editor.layout(),(i=this.editor.getModel())==null||i.updateOptions({tabSize:0}),this.editor.onKeyDown(this.handleKeyDown),this.editor.onDidChangeModelContent(this.handleContentChanged),this.editor.onDidFocusEditorText(this.handleEditorFocus),this.editor.onDidBlurEditorText(this.handleEditorBlur)}destroyEditor(){var e;(e=this.editor)==null||e.dispose(),this.editor=void 0}handleContentChanged(){var s,i;const{onContentChanged:e}=this.props,n=(i=(s=this.editor)==null?void 0:s.getModel())==null?void 0:i.getValue();n!==void 0&&this.setState({isEditorEmpty:n.length===0}),e(n)}handleEditorFocus(){this.setState({isEditorFocused:!0})}handleEditorBlur(){var n,s,i;const e=(i=(s=(n=this.editor)==null?void 0:n.getModel())==null?void 0:s.getValue())!=null?i:"";this.setState({isEditorEmpty:e.length===0,isEditorFocused:!1})}handleContainerClick(){var n;const{isEditorFocused:e}=this.state;e||(n=this.editor)==null||n.focus()}handleKeyDown(e){const{onTab:n,editorIndex:s}=this.props;e.code==="Tab"&&(e.stopPropagation(),e.preventDefault(),n(s,e.shiftKey))}render(){const{value:e,invalid:n}=this.props,{isEditorFocused:s,isEditorEmpty:i}=this.state;return T("div",{className:z("input-editor-wrapper",{focused:s,invalid:n}),role:"presentation",onClick:this.handleContainerClick,children:[h("div",{className:"editor-container",ref:o=>{this.editorContainer=o}}),i&&!e&&h("div",{className:"editor-placeholder text-muted",children:"Column Formula"})]})}}Up.defaultProps={value:"",onContentChanged:()=>{},editorSettings:{},editorIndex:0,onTab:()=>{},invalid:!1};const $h=Object.freeze({NAME:"name",FORMULA:"formula"}),oE=()=>{};function rE({eventKey:t,name:e,inputIndex:n,formula:s,onChange:i,onDeleteColumn:o,onTabInEditor:r,invalid:l,isDuplicate:a}){const d=e===""||En.isValidColumnName(e),c=w.exports.useCallback(u=>{u!==void 0&&(u.replace(/(\r\n|\n|\r)/gm,""),i(t,$h.FORMULA,u))},[i,t]);return h(fd,{draggableId:t,index:n,disableInteractiveElementBlocking:!0,children:(u,m)=>T("div",{className:z("draggable-container",{dragging:m.isDragging}),ref:u.innerRef,...u.draggableProps,children:[T("div",{className:"custom-column-input-container",children:[T("div",{className:"pb-3",children:[T("div",{className:"d-flex flex-row custom-column-name",children:[h("input",{className:z("form-control custom-column-input",{"is-invalid":l||!d||a}),placeholder:"Column Name",value:e,onChange:p=>{i(t,$h.NAME,p.target.value)}}),h(W,{kind:"ghost",className:"ml-1 px-2",onClick:()=>{o(t)},icon:hn,tooltip:"Delete custom column"}),h(W,{kind:"ghost",className:"btn-drag-handle",onClick:oE,...u.dragHandleProps,icon:ir,tooltip:"Drag column to re-order"})]}),(!d||a)&&h("p",{className:"validate-label-error text-danger mb-0 mt-2 pl-1",children:d?"Duplicate name":"Invalid name"})]}),h(Up,{editorSettings:{language:"deephavenDb"},editorIndex:n,value:s,onContentChanged:c,onTab:r,invalid:l})]}),h("hr",{})]})})}class ve extends Ip{constructor(){super(),this.listenerCount=0}addEventListener(e,n,s){super.addEventListener(e,n,s),this.listenerCount+=1,this.listenerCount===1&&this.startListening()}removeEventListener(e,n,s){super.removeEventListener(e,n,s),this.listenerCount-=1,this.listenerCount===0&&this.stopListening()}startListening(){}stopListening(){}get originalColumns(){return this.columns}get layoutHints(){return null}get frontColumns(){return[]}get backColumns(){return[]}get frozenColumns(){return[]}isColumnFrozen(e){return!1}get isFilterRequired(){return!1}get isReversible(){return!0}get isColumnStatisticsAvailable(){return!1}get description(){return""}get isCustomColumnsAvailable(){return!1}get isFormatColumnsAvailable(){return!1}get isExportAvailable(){return!1}get isValuesTableAvailable(){return!1}get isChartBuilderAvailable(){return!1}get isRollupAvailable(){return!1}get isSelectDistinctAvailable(){return!1}get isTotalsAvailable(){return!1}isFilterable(e){return!1}close(){}isRowMovable(){return!1}get isSeekRowAvailable(){return!1}}ve.EVENT=Object.freeze({UPDATED:"UPDATED",FORMATTER_UPDATED:"FORMATTER_UPDATED",REQUEST_FAILED:"REQUEST_FAILED",COLUMNS_CHANGED:"COLUMNS_CHANGED",TABLE_CHANGED:"TABLE_CHANGED",FILTERS_CHANGED:"FILTERS_CHANGED",SORTS_CHANGED:"SORTS_CHANGED",DISCONNECT:"DISCONNECT",RECONNECT:"RECONNECT",TOTALS_UPDATED:"TOTALS_UPDATED",PENDING_DATA_UPDATED:"PENDING_DATA_UPDATED"});const Bi=class extends w.exports.Component{constructor(t){super(t),this.getInput=Se((e,n)=>e.find(s=>s.eventKey===n)),this.getInputIndex=Se((e,n)=>e.findIndex(s=>s.eventKey===n)),this.handleAddColumnClick=this.handleAddColumnClick.bind(this),this.handleSaveClick=this.handleSaveClick.bind(this),this.handleInputChange=this.handleInputChange.bind(this),this.handleDeleteColumn=this.handleDeleteColumn.bind(this),this.handleCustomColumnUpdated=this.handleCustomColumnUpdated.bind(this),this.handleRequestFailed=this.handleRequestFailed.bind(this),this.handleDragEnd=this.handleDragEnd.bind(this),this.resetRequestFailed=this.resetRequestFailed.bind(this),this.handleEditorTabNavigation=this.handleEditorTabNavigation.bind(this),this.state={inputs:[],isCustomColumnApplying:!1,errorMessage:null,hasRequestFailed:!1,isSuccessShowing:!1},this.container=null,this.successButtonTimer=null}static makeCustomColumnInputEventKey(){return We.generate()}static createCustomColumnInput(){return{eventKey:We.generate(),name:"",formula:""}}componentDidMount(){const{customColumns:t}=this.props;this.parseCustomColumns(t),this.startListening()}componentWillUnmount(){this.stopListening(),this.successButtonTimer&&clearTimeout(this.successButtonTimer)}resetErrorMessage(){this.setState({errorMessage:null})}startListening(){const{model:t}=this.props;t.addEventListener(ve.EVENT.COLUMNS_CHANGED,this.handleCustomColumnUpdated),t.addEventListener(ve.EVENT.UPDATED,this.handleCustomColumnUpdated),t.addEventListener(ve.EVENT.REQUEST_FAILED,this.handleRequestFailed)}stopListening(){const{model:t}=this.props;t.removeEventListener(ve.EVENT.COLUMNS_CHANGED,this.handleCustomColumnUpdated),t.removeEventListener(ve.EVENT.UPDATED,this.handleCustomColumnUpdated),t.removeEventListener(ve.EVENT.REQUEST_FAILED,this.handleRequestFailed)}parseCustomColumns(t){if(t.length>0){const e=t.map(n=>{const s=n.split(/=(.+)/,2);return{eventKey:Bi.makeCustomColumnInputEventKey(),name:s[0],formula:s[1]}});this.setState({inputs:e})}else this.setState({inputs:[Bi.createCustomColumnInput()]})}handleAddColumnClick(){const{inputs:t}=this.state,e=[...t];e.push(Bi.createCustomColumnInput()),this.setState({inputs:e})}handleDeleteColumn(t){const{inputs:e}=this.state,n=this.getInputIndex(e,t),s=[...e];s.splice(n,1),s.length===0&&s.push(Bi.createCustomColumnInput()),this.setState({inputs:s})}handleInputChange(t,e,n){const{inputs:s}=this.state,i=this.getInputIndex(s,t),r={...this.getInput(s,t)};r[e]=n;const l=[...s];l.splice(i,1,r),this.setState({inputs:l})}handleCustomColumnUpdated(){const{isCustomColumnApplying:t}=this.state;!t||this.setState({isCustomColumnApplying:!1,isSuccessShowing:!0},()=>{this.successButtonTimer=setTimeout(()=>this.setState({isSuccessShowing:!1}),Bi.SUCCESS_SHOW_DURATION)})}handleRequestFailed(t){const e=t,{isCustomColumnApplying:n}=this.state;!n||this.setState({isCustomColumnApplying:!1,errorMessage:T(Te,{children:[T("p",{children:[h(ee,{icon:fs})," Failed to apply custom columns."]}),T("div",{className:"error-box",children:[e.detail.errorMessage,h("br",{}),"Table configuration:"," ",JSON.stringify(e.detail.configuration)]})]}),hasRequestFailed:!0})}handleDragEnd(t){if(jt.stopDragging(),!t.destination)return;const{inputs:e}=this.state,n=t.source.index,s=t.destination.index,i=[...e],o=e[n];i.splice(n,1),i.splice(s,0,o),this.setState({inputs:i})}handleEditorTabNavigation(t,e){var s,i,o,r;const{inputs:n}=this.state;if(e){((s=this.container)==null?void 0:s.querySelectorAll(".btn-drag-handle")[t]).focus();return}if(t===n.length-1)(o=(i=this.container)==null?void 0:i.querySelector(".btn-add-column"))==null||o.focus();else{const l=t+1;((r=this.container)==null?void 0:r.querySelectorAll(".custom-column-input")[l]).focus()}}handleSaveClick(){const{onSave:t,customColumns:e}=this.props,{inputs:n,isCustomColumnApplying:s}=this.state;if(s)return;const i=[];n.forEach(o=>{const{name:r,formula:l}=o;r&&l&&i.push(`${r}=${l}`)}),this.resetErrorMessage(),this.setState({isCustomColumnApplying:i.length>0||e.length>0}),t(i)}resetRequestFailed(){this.setState(({hasRequestFailed:t})=>t?{hasRequestFailed:!1}:null)}renderInputs(){const{inputs:t,hasRequestFailed:e}=this.state,n=new Map;return t.forEach(({name:s})=>{var i;return n.set(s,((i=n.get(s))!=null?i:0)+1)}),t.map((s,i)=>{var d;const{eventKey:o,name:r,formula:l}=s,a=((d=n.get(r))!=null?d:0)>1;return h(rE,{inputIndex:i,eventKey:o,name:r,formula:l,onChange:this.handleInputChange,onDeleteColumn:this.handleDeleteColumn,onTabInEditor:this.handleEditorTabNavigation,invalid:e,isDuplicate:a},o)})}renderSaveButton(){const{inputs:t,isCustomColumnApplying:e,isSuccessShowing:n}=this.state,s=t.length>1?"Save Columns":"Save Column",i=t.every(({name:l})=>l===""||En.isValidColumnName(l)),o=t.filter(({name:l})=>l!=="").map(({name:l})=>l),r=new Set(o).size===o.length;return T(W,{kind:n?"success":"primary",className:z("btn-apply",{"btn-spinner":e}),disabled:n||e||!i||!r,onClick:this.handleSaveClick,children:[e&&T("span",{children:[h(On,{}),h("span",{className:"btn-normal-content",children:"Applying"})]}),!n&&!e&&s,n&&T(Te,{children:[h(ee,{icon:yd})," Success"]})]})}render(){const{onCancel:t}=this.props,{errorMessage:e}=this.state;return T("div",{role:"presentation",className:"custom-column-builder-container",ref:n=>{this.container=n},onClick:this.resetRequestFailed,onFocus:this.resetRequestFailed,children:[h("hr",{}),h(_l,{onDragStart:jt.startDragging,onDragEnd:this.handleDragEnd,children:h(xl,{droppableId:"droppable-custom-columns",children:(n,s)=>T("div",{ref:n.innerRef,...n.droppableProps,className:z("droppable-container",{dragging:s.draggingFromThisWith}),children:[this.renderInputs(),n.placeholder]})})}),h("div",{className:"pt-1 px-3",children:h(W,{kind:"ghost",className:"btn-add-column",onClick:this.handleAddColumnClick,icon:Gs,children:"Add Another Column"})}),T("div",{className:"custom-column-builder-footer",children:[e&&h("div",{className:"error-message",children:e}),T("div",{className:"d-flex justify-content-end",children:[h(W,{kind:"secondary",className:"mr-2",onClick:t,children:"Cancel"}),this.renderSaveButton()]})]})]})}};let Bp=Bi;Bp.SUCCESS_SHOW_DURATION=750;var ke=(t=>(t.ADVANCED_SETTINGS="ADVANCED_SETTINGS",t.AGGREGATIONS="AGGREGATIONS",t.AGGREGATION_EDIT="AGGREGATIONS_EDIT",t.CHART_BUILDER="CHART_BUILDER",t.CUSTOM_COLUMN_BUILDER="CUSTOM_COLUMN_BUILDER",t.QUICK_FILTERS="QUICK_FILTERS",t.ROLLUP_ROWS="ROLLUP_ROWS",t.SEARCH_BAR="SEARCH_BAR",t.SELECT_DISTINCT="SELECT_DISTINCT",t.TABLE_EXPORTER="TABLE_EXPORTER",t.VISIBILITY_ORDERING_BUILDER="VISIBILITY_ORDERING_BUILDER",t.CONDITIONAL_FORMATTING="CONDITIONAL_FORMATTING",t.CONDITIONAL_FORMATTING_EDIT="CONDITIONAL_FORMATTING_EDIT",t.GOTO="GOTO",t))(ke||{});const No=Z.module("RollupRows"),lE=150,zr="grouped-rollup-rows",Wr="ungrouped-rollup-rows",Rn=class extends w.exports.Component{constructor(t){super(t),this.search=Ze(o=>{const r=this.getSortedUngroupedColumns(),l=[];let a=null;for(let d=0;d<r.length;d+=1)r[d].name.toLowerCase().includes(o.toLowerCase())&&(a==null&&(a=d),l.push([d,d]));L(a),this.setState({ungroupedSelectedRanges:l}),l.length>0&&this.ungroupedList.current&&this.ungroupedList.current.scrollToItem(a)},lE),this.getCachedUngroupedColumns=be((o,r)=>o.filter(l=>Rn.isGroupable(l)&&r.find(a=>a===l.name)==null)),this.getCachedSortedColumns=be((o,r)=>r==null?[...o]:_.sortColumns(o,r===Rn.SORT.ASCENDING)),this.handleDeleteClicked=this.handleDeleteClicked.bind(this),this.handleSearchChange=this.handleSearchChange.bind(this),this.handleUngroupedSelect=this.handleUngroupedSelect.bind(this),this.handleUngroupedSelectionChange=this.handleUngroupedSelectionChange.bind(this),this.handleDragStart=this.handleDragStart.bind(this),this.handleDragEnd=this.handleDragEnd.bind(this),this.handleGroupedSelectionChange=this.handleGroupedSelectionChange.bind(this),this.handleShowConstituentsChange=this.handleShowConstituentsChange.bind(this),this.handleShowNonAggregatedColumnsChange=this.handleShowNonAggregatedColumnsChange.bind(this),this.handleSortAscending=this.handleSortAscending.bind(this),this.handleSortDescending=this.handleSortDescending.bind(this),this.renderGroupedItem=this.renderGroupedItem.bind(this),this.ungroupedList=X.createRef(),this.groupedList=X.createRef();const{config:e}=t,{columns:n=[],showConstituents:s=!0,showNonAggregatedColumns:i=!0}=e!=null?e:{};this.state={ungroupedSelectedRanges:[],columns:n,groupedSelectedRanges:[],searchFilter:"",showConstituents:s,showNonAggregatedColumns:i,dragSource:null,sort:null}}static renderColumn({item:t,isClone:e,selectedCount:n}){const s=t==null?void 0:t.name,i=e!==void 0&&e?`${n}`:void 0,o=e!==void 0&&e?"item-list-item-clone":"";return sn.renderTextItem({text:s,badgeText:i,className:o})}static addGroupings(t,e,n=t.length){if(e==null||e.length===0)return t;let s=n;const i=t.filter((o,r)=>e.includes(o)?(r<s&&(s-=1),!1):!0);return i.splice(s,0,...e),i}static isGroupable(t){return!_.isDecimalType(t.type)}componentDidUpdate(t,e){const{config:n}=this.props,{columns:s,showConstituents:i,showNonAggregatedColumns:o}=this.state;n!==t.config?this.updateFromConfig():(s!==e.columns||i!==e.showConstituents||o!==e.showNonAggregatedColumns)&&(n==null||s!==n.columns||i!==n.showConstituents||o!==n.showNonAggregatedColumns)&&this.sendChange()}componentWillUnmount(){this.search.cancel()}handleSearchChange(t){const e=t.target.value;if(this.setState({searchFilter:e}),!e){this.search.cancel(),this.resetSelection();return}this.search(e)}handleSortAscending(){this.setState(({sort:t})=>({sort:t===Rn.SORT.ASCENDING?null:Rn.SORT.ASCENDING}))}handleSortDescending(){this.setState(({sort:t})=>({sort:t===Rn.SORT.DESCENDING?null:Rn.SORT.DESCENDING}))}resetSelection(){this.setState({ungroupedSelectedRanges:[],groupedSelectedRanges:[]})}handleDragStart(t){No.debug("handleDragStart",t),document.documentElement.classList.add("drag-pointer-events-none"),this.setState({dragSource:t.source})}handleDragEnd(t){No.debug("handleDragEnd",t),document.documentElement.classList.remove("drag-pointer-events-none"),this.setState({dragSource:null});const{destination:e,source:n}=t;if(e==null||n==null)return;if(e.droppableId===Wr){this.setState(({groupedSelectedRanges:o,columns:r})=>{const l=[...r];return jt.reorder(l,o,[],0),{columns:l,ungroupedSelectedRanges:[],groupedSelectedRanges:[]}});return}const s=n.droppableId===zr;let i=e.index;s&&n.index<e.index&&(i+=1),this.setState(({columns:o,ungroupedSelectedRanges:r,groupedSelectedRanges:l})=>{const a=[...o],d=s?a:this.getSortedUngroupedColumns().map(g=>g.name),c=s?l:r,u=jt.reorder(d,c,a,i),m=s?jt.adjustDestinationIndex(i,l):i,p=[[m,m+u.length-1]];return{columns:a,ungroupedSelectedRanges:[],groupedSelectedRanges:p}}),this.resetSelection()}handleUngroupedSelect(t){No.debug("handleUngroupedSelect"),this.setState(({columns:e})=>({columns:Rn.addGroupings(e,[this.getSortedUngroupedColumns()[t].name]),ungroupedSelectedRanges:[],groupedSelectedRanges:[]}))}handleUngroupedSelectionChange(t){No.debug2("handleUngroupedSelectionChange",t),this.setState(({ungroupedSelectedRanges:e})=>t===e?null:{ungroupedSelectedRanges:t,groupedSelectedRanges:[]})}handleGroupedSelectionChange(t){No.debug2("handleGroupedSelectedRanges",t),this.setState(({groupedSelectedRanges:e})=>t===e?null:{groupedSelectedRanges:t,ungroupedSelectedRanges:[]})}handleDeleteClicked(t){this.setState(({columns:e})=>{const n=e.slice();return n.splice(t,1),{columns:n}})}handleShowConstituentsChange(){this.setState(({showConstituents:t})=>({showConstituents:!t}))}handleShowNonAggregatedColumnsChange(){this.setState(({showNonAggregatedColumns:t})=>({showNonAggregatedColumns:!t}))}updateFromConfig(){const{config:t}=this.props,{columns:e=[],showConstituents:n=!0,showNonAggregatedColumns:s=!0}=t!=null?t:{};this.setState({columns:e,showConstituents:n,showNonAggregatedColumns:s})}sendChange(){const{onChange:t}=this.props,{columns:e,showConstituents:n,showNonAggregatedColumns:s}=this.state;t({columns:e,showConstituents:n,showNonAggregatedColumns:s})}getUngroupedColumns(){const{model:t}=this.props,{columns:e}=this.state,{originalColumns:n}=t;return this.getCachedUngroupedColumns(n,e)}getSortedUngroupedColumns(){const{sort:t}=this.state,e=this.getUngroupedColumns();return this.getCachedSortedColumns(e,t)}renderGroupedItem({item:t,itemIndex:e,isClone:n,selectedCount:s}){const o=`${n!==void 0&&n?"":"\xA0\xA0".repeat(e)}${t}`,r=n!==void 0&&n?`${s}`:void 0,l=n!==void 0&&n?"item-list-item-clone":"";return T(Te,{children:[sn.renderTextItem({text:o,badgeText:r,className:l}),(n===void 0||!n)&&h(W,{kind:"ghost",className:"btn btn-link btn-link-icon btn-delete-grouping float-right",onClick:()=>this.handleDeleteClicked(e),children:h(ee,{icon:hn})})]})}render(){const{columns:t,dragSource:e,searchFilter:n,groupedSelectedRanges:s,ungroupedSelectedRanges:i,showConstituents:o,showNonAggregatedColumns:r,sort:l}=this.state,a=this.getSortedUngroupedColumns();let d=t.length*sn.DEFAULT_ROW_HEIGHT;(e==null?void 0:e.droppableId)===Wr&&(d+=sn.DEFAULT_ROW_HEIGHT);const c=a.length*sn.DEFAULT_ROW_HEIGHT+10,u=Math.min(3*sn.DEFAULT_ROW_HEIGHT,c);return h("div",{role:"menu",className:z("rollup-rows",{"is-dragging":e!=null}),tabIndex:0,children:T(_l,{onDragEnd:this.handleDragEnd,onDragStart:this.handleDragStart,children:[T("div",{className:"rollup-rows-group-by",children:[h("div",{className:"section-title",children:"Group By"}),t.length===0&&h(xl,{droppableId:"placeholder",children:(m,p)=>h("div",{className:z("placeholder","text-muted",{"is-dragging-from-this":p.draggingFromThisWith,"is-dragging-over":p.isDraggingOver,"is-dropping":p.draggingOverWith}),ref:m.innerRef,...m.droppableProps,children:"Create rollup by dragging columns here, from the available columns list below."})}),t.length>0&&h(sn,{draggingItemClassName:"rollup-rows-dragging-grouped-item",draggablePrefix:zr,droppableId:zr,itemCount:t.length,items:t,offset:0,onSelectionChange:this.handleGroupedSelectionChange,ref:this.groupedList,renderItem:this.renderGroupedItem,selectedRanges:s,style:{height:d},isMultiSelect:!0})]}),T("div",{className:"rollup-rows-available-columns",children:[h("div",{className:"section-title",children:"Available Grouping Columns"}),T("div",{className:"top-menu",children:[h(ws,{className:"w-100",value:n,matchCount:n?i.length:void 0,placeholder:"Find column...",onChange:this.handleSearchChange}),T(W,{kind:"ghost",className:z("btn-link btn-link-icon",{active:l===Rn.SORT.ASCENDING}),onClick:this.handleSortAscending,children:[h(ee,{icon:Md}),h(Ye,{children:"Sort ascending"})]}),T(W,{kind:"ghost",className:z("btn-link btn-link-icon",{active:l===Rn.SORT.DESCENDING}),onClick:this.handleSortDescending,children:[h(ee,{icon:Nd}),h(Ye,{children:"Sort descending"})]})]}),h(sn,{className:"rollup-available-grouping-columns",draggablePrefix:Wr,droppableId:Wr,itemCount:a.length,items:a,renderItem:Rn.renderColumn,offset:0,onSelect:this.handleUngroupedSelect,onSelectionChange:this.handleUngroupedSelectionChange,ref:this.ungroupedList,selectedRanges:i,style:{maxHeight:c,minHeight:u},isDropDisabled:(e==null?void 0:e.droppableId)!==zr,isMultiSelect:!0}),T("div",{className:"bottom-menu",children:[h("div",{className:"label",children:"Show:"}),h(St,{checked:o,onChange:this.handleShowConstituentsChange,children:"Constituents"}),h(St,{checked:r,onChange:this.handleShowNonAggregatedColumnsChange,children:"Non-Aggregated Columns"})]})]})]})})}};let oc=Rn;oc.SORT=Object.freeze({ASCENDING:"ASC",DESCENDING:"DESC"});oc.defaultProps={config:null,onChange:()=>{}};const aE=Z.module("TableCsvExporter"),Xe=class extends w.exports.Component{static getDateString(){return M.i18n.DateTimeFormat.format(Xe.FILENAME_DATE_FORMAT,new Date)}constructor(t){super(t),this.handleDownloadClick=this.handleDownloadClick.bind(this),this.handleDownloadRowOptionChanged=this.handleDownloadRowOptionChanged.bind(this),this.handleCustomizedDownloadRowOptionChanged=this.handleCustomizedDownloadRowOptionChanged.bind(this),this.handleCustomizedDownloadRowsChanged=this.handleCustomizedDownloadRowsChanged.bind(this),this.handleIncludeColumnHeadersChanged=this.handleIncludeColumnHeadersChanged.bind(this),this.handleIncludeHiddenColumnsChanged=this.handleIncludeHiddenColumnsChanged.bind(this),this.handleUseUnformattedValuesChanged=this.handleUseUnformattedValuesChanged.bind(this);const{name:e}=t;this.state={fileName:`${e}-${Xe.getDateString()}.csv`,downloadRowOption:Xe.DOWNLOAD_ROW_OPTIONS.ALL_ROWS,customizedDownloadRowOption:Xe.CUSTOMIZED_ROWS_OPTIONS.FIRST,customizedDownloadRows:Xe.DEFAULT_DOWNLOAD_ROWS,includeColumnHeaders:!0,includeHiddenColumns:!1,useUnformattedValues:!1,errorMessage:null,id:We.generate()}}getSnapshotRanges(){const{model:t,selectedRanges:e}=this.props,{downloadRowOption:n,customizedDownloadRowOption:s,customizedDownloadRows:i}=this.state,{rowCount:o,columnCount:r}=t;let l=[];switch(n){case Xe.DOWNLOAD_ROW_OPTIONS.ALL_ROWS:l.push(new de(0,0,r-1,o-1));break;case Xe.DOWNLOAD_ROW_OPTIONS.SELECTED_ROWS:l=e.map(a=>({...a,startColumn:0,endColumn:r-1})).sort((a,d)=>a.startRow!=null&&d.startRow!=null?a.startRow-d.startRow:0);break;case Xe.DOWNLOAD_ROW_OPTIONS.CUSTOMIZED_ROWS:switch(s){case Xe.CUSTOMIZED_ROWS_OPTIONS.FIRST:l.push(new de(0,0,r-1,Math.min(i-1,o-1)));break;case Xe.CUSTOMIZED_ROWS_OPTIONS.LAST:l.push(new de(0,Math.max(0,o-i),r-1,o-1));break}break}return l}getModelRanges(t){const{userColumnWidths:e,movedColumns:n}=this.props,{includeHiddenColumns:s}=this.state,i=ie.getHiddenColumns(e);let o=J.getModelRanges(t,n);if(!s&&i.length>0){const r=i.map(de.makeColumn);o=de.subtractRangesFromRanges(o,r)}return o}resetDownloadState(){this.setState({errorMessage:null})}async handleDownloadClick(){const{model:t,isDownloading:e,onDownloadStart:n,onDownload:s,onCancel:i}=this.props,{fileName:o,includeColumnHeaders:r,useUnformattedValues:l}=this.state;if(e){i();return}this.resetDownloadState();const a=this.getSnapshotRanges(),d=this.getModelRanges(a);if(this.validateOptionInput()){n();try{const c=await t.export(),u=c.setViewport(0,0);await u.getViewportData(),s(o,c,u,a,d,r,l)}catch(c){aE.error("CSV download failed",c),this.setState({errorMessage:T("p",{children:[h(ee,{icon:fs})," ",`${c}`]})}),i()}}}handleDownloadRowOptionChanged(t){this.setState({downloadRowOption:t.target.value})}handleCustomizedDownloadRowOptionChanged(t){this.setState({customizedDownloadRowOption:t.target.value})}handleCustomizedDownloadRowsChanged(t){this.setState({customizedDownloadRows:parseInt(t.target.value,10)})}handleIncludeColumnHeadersChanged(){this.setState(({includeColumnHeaders:t})=>({includeColumnHeaders:!t}))}handleIncludeHiddenColumnsChanged(){this.setState(({includeHiddenColumns:t})=>({includeHiddenColumns:!t}))}handleUseUnformattedValuesChanged(){this.setState(({useUnformattedValues:t})=>({useUnformattedValues:!t}))}validateOptionInput(){const{selectedRanges:t}=this.props,{downloadRowOption:e,customizedDownloadRows:n}=this.state;return e===Xe.DOWNLOAD_ROW_OPTIONS.SELECTED_ROWS&&t.length===0?(this.setState({errorMessage:T("p",{children:[h(ee,{icon:fs})," No rows selected. Please select some rows in the table."]})}),!1):e===Xe.DOWNLOAD_ROW_OPTIONS.CUSTOMIZED_ROWS&&n<=0?(this.setState({errorMessage:T("p",{children:[h(ee,{icon:fs})," Number of rows to output must be greater than 0"]})}),!1):!0}render(){const{model:t,isDownloading:e,tableDownloadProgress:n,tableDownloadEstimatedTime:s,selectedRanges:i,tableDownloadStatus:o}=this.props,{fileName:r,downloadRowOption:l,customizedDownloadRowOption:a,customizedDownloadRows:d,includeColumnHeaders:c,includeHiddenColumns:u,useUnformattedValues:m,errorMessage:p,id:g}=this.state,{rowCount:f}=t;return T("div",{className:"table-csv-exporter",children:[h("div",{className:"section-title",children:"Download Rows"}),h("div",{className:"form-group",children:T(Ul,{onChange:this.handleDownloadRowOptionChanged,value:l,disabled:e,children:[T(xn,{value:Xe.DOWNLOAD_ROW_OPTIONS.ALL_ROWS,"data-testid":"radio-csv-exporter-download-all",children:["All Rows",h("span",{className:"text-muted ml-2",children:`(${f.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1,")} rows)`})]}),T(xn,{value:Xe.DOWNLOAD_ROW_OPTIONS.SELECTED_ROWS,"data-testid":"radio-csv-exporter-only-selected",children:["Only Selected Rows",h("span",{className:"text-muted ml-2",children:i.length>0?`(${de.rowCount(i).toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1,")} rows)`:null})]}),h(xn,{value:Xe.DOWNLOAD_ROW_OPTIONS.CUSTOMIZED_ROWS,"data-testid":"radio-csv-exporter-customized-rows",children:T("div",{className:"radio-input-row",role:"presentation",onClick:()=>{this.setState({downloadRowOption:Xe.DOWNLOAD_ROW_OPTIONS.CUSTOMIZED_ROWS})},children:[T("select",{value:a,"data-testid":"select-csv-exporter-customized-rows",className:"custom-select",disabled:e,onChange:this.handleCustomizedDownloadRowOptionChanged,children:[h("option",{value:"FIRST",children:"First"}),h("option",{value:"LAST",children:"Last"})]}),h("input",{type:"number",className:"form-control",id:`customizedRows-${g}`,"data-testid":"input-csv-exporter-customized-rows",name:`customizedRows-${g}`,placeholder:"100",value:d,disabled:e,onChange:this.handleCustomizedDownloadRowsChanged}),h("div",{children:"Rows"})]})})]})}),T("div",{className:"form-group",children:[h("label",{htmlFor:`customizedRows-${g}`,children:"File Name"}),h("input",{type:"text",className:"form-control",id:`filename-${g}`,"data-testid":"input-csv-exporter-file-name",name:`filename-${g}`,value:r,onChange:b=>{this.setState({fileName:b.target.value})},disabled:e})]}),T("div",{className:"checkbox-options",children:[h(St,{checked:c,onChange:this.handleIncludeColumnHeadersChanged,children:"Include column headers"}),h(St,{checked:u,onChange:this.handleIncludeHiddenColumnsChanged,children:"Include hidden columns"}),h(St,{checked:m,onChange:this.handleUseUnformattedValuesChanged,children:"Use unformatted values"})]}),T("div",{className:"section-footer flex-column",children:[p!=null&&h("div",{className:"error-message",children:p}),o&&T("div",{className:"download-status",children:[(o===Xe.DOWNLOAD_STATUS.DOWNLOADING||o===Xe.DOWNLOAD_STATUS.INITIATING)&&T(Te,{children:[o===Xe.DOWNLOAD_STATUS.INITIATING&&h("div",{className:"text-muted",children:"Starting Download..."}),o===Xe.DOWNLOAD_STATUS.DOWNLOADING&&T("div",{className:"text-muted d-flex justify-content-between",children:[h("span",{children:s||s===0?`Estimated time: ${Dn.formatElapsedTime(s)}`:null}),h("span",{children:`${n}%`})]})]}),o===Xe.DOWNLOAD_STATUS.FINISHED&&h("div",{className:"text-muted text-right",children:"Download Completed"}),o===Xe.DOWNLOAD_STATUS.CANCELED&&h("div",{className:"text-muted",children:"Download Canceled"}),(o===Xe.DOWNLOAD_STATUS.DOWNLOADING||o===Xe.DOWNLOAD_STATUS.INITIATING)&&h("div",{className:"progress",children:h("div",{className:"progress-bar progress-bar-striped progress-bar-animated",style:{width:`${n}%`}})}),o===Xe.DOWNLOAD_STATUS.FINISHED&&h("div",{className:"progress",children:h("div",{className:"progress-bar bg-success",style:{width:`${n}%`}})})]}),T(W,{kind:"primary","data-testid":"btn-csv-exporter-download",className:z("btn-downloading",{"btn-spinner btn-cancelable":e}),onClick:this.handleDownloadClick,children:[e&&T("span",{children:[h(On,{}),h("span",{className:"btn-normal-content",children:"Downloading"}),h("span",{className:"btn-hover-content",children:"Cancel"})]}),!e&&"Download"]})]})]})}};let rn=Xe;rn.FILENAME_DATE_FORMAT="yyyy-MM-dd-HHmmss";rn.DOWNLOAD_STATUS={INITIATING:"INITIATING",DOWNLOADING:"DOWNLOADING",FINISHED:"FINISHED",CANCELED:"CANCELED"};rn.DOWNLOAD_ROW_OPTIONS={ALL_ROWS:"ALL_ROWS",SELECTED_ROWS:"SELECTED_ROWS",CUSTOMIZED_ROWS:"CUSTOMIZED_ROWS"};rn.CUSTOMIZED_ROWS_OPTIONS={FIRST:"FIRST",LAST:"LAST"};rn.DEFAULT_DOWNLOAD_ROWS=100;rn.defaultProps={onDownloadStart:()=>{},isDownloading:!1,tableDownloadStatus:"",tableDownloadProgress:0,tableDownloadEstimatedTime:null,selectedRanges:[]};const ls=Z.module("TableSaver"),dE="yyyy-MM-dd'T'HH:mm:ss.SSSSSSSSS z";function cE(t){return t.added!==void 0}function hE(t){if(!cE(t))throw new Error("event is not UpdateEventData")}const Ps=class extends w.exports.PureComponent{constructor(t){var e,n;super(t),this.WritableStream=(e=window.WritableStream)!=null?e:Lc,this.getCachedCustomColumnFormatFlag=ln(Cs.isCustomColumnFormatDefined,{max:1e4}),this.handlePortMessage=this.handlePortMessage.bind(this),this.handleSnapshotResolved=this.handleSnapshotResolved.bind(this),this.handleDownloadTimeout=this.handleDownloadTimeout.bind(this),this.state={},this.gridRanges=[],this.gridRangeCounter=0,this.rangedSnapshotsTotal=[],this.rangedSnapshotCounter=0,this.includeColumnHeaders=!0,this.useUnformattedValues=!1,this.snapshotsTotal=0,this.snapshotCounter=0,this.snapshotsBuffer=new Map,this.currentSnapshotIndex=0,this.snapshotPending=0,this.cancelableSnapshots=[],this.WritableStream=(n=window.WritableStream)!=null?n:Lc,this.iframes=[],this.useBlobFallback=!1}static csvEscapeString(t){return`"${t.replace(/"/g,'""')}"`}componentDidMount(){const{getDownloadWorker:t}=this.props;t().then(e=>{ls.info("found active service worker"),this.sw=e,this.sw.postMessage("ping")}).catch(e=>{ls.warn("Download csv is not optimized.",e),this.useBlobFallback=!0})}componentWillUnmount(){this.iframes.length>0&&this.iframes.forEach(t=>{t.remove()}),this.streamTimeout&&clearTimeout(this.streamTimeout),this.snapshotHandlerTimeout&&clearTimeout(this.snapshotHandlerTimeout)}createWriterStream(t){const e=this.useBlobFallback,n=[];let s=null;e&&(s=TextEncoder.prototype.encode.bind(new TextEncoder));const{fileName:i}=this,o={};return e?(o.write=r=>{L(s),r.header!==void 0&&n.push(s(r.header)),r.rows!==void 0&&n.push(s(r.rows))},o.close=()=>{L(i);const r=new Blob(n,{type:"application/octet-stream; charset=utf-8"}),l=document.createElement("a");l.href=URL.createObjectURL(r),l.download=i,l.click()},o.abort=()=>{t.postMessage({cancel:!0}),t.close()}):(o.write=r=>{t.postMessage(r)},o.close=()=>{t.postMessage({end:!0}),t.close()},o.abort=()=>{t.postMessage({cancel:!0}),t.close()}),new this.WritableStream(o)}startDownload(t,e,n,s,i,o,r){const{isDownloading:l}=this.props;if(l)return;this.downloadStartTime=Date.now(),ls.info(`start downloading ${t}`),this.table=e,this.columns=ie.columnsFromRanges(i,e.columns),this.tableSubscription=n,this.gridRanges=s,this.includeColumnHeaders=o,this.useUnformattedValues=r;const a=encodeURIComponent(t.replace(/\//g,":")).replace(/['()]/g,escape).replace(/\*/g,"%2A"),d=new MessageChannel;if(this.port=d.port1,this.fileName=t,this.fileWriter=this.createWriterStream(this.port).getWriter(),this.useBlobFallback){this.writeCsvTable(o);return}this.sw&&this.sw.postMessage({encodedFileName:a},[d.port2]),this.port.onmessage=this.handlePortMessage}finishDownload(){this.table&&this.table.close(),this.tableSubscription&&this.tableSubscription.close(),this.fileWriter&&this.fileWriter.close();const{onDownloadCompleted:t}=this.props;t(),this.resetTableSaver(),this.downloadStartTime!==void 0&&ls.info(`download finished, total elapsed time ${(Date.now()-this.downloadStartTime)/1e3} seconds`)}cancelDownload(){this.table&&this.table.close(),this.tableSubscription&&this.tableSubscription.close(),this.fileWriter&&this.fileWriter.abort(),this.cancelableSnapshots.forEach(e=>{e&&(e.catch(()=>null),e.cancel())});const{onDownloadCanceled:t}=this.props;t(),this.resetTableSaver()}resetTableSaver(){this.table=void 0,this.tableSubscription=void 0,this.columns=void 0,this.chunkRows=void 0,this.gridRanges=[],this.gridRangeCounter=0,this.rangedSnapshotsTotal=[],this.rangedSnapshotCounter=0,this.includeColumnHeaders=!0,this.useUnformattedValues=!1,this.snapshotsTotal=0,this.snapshotCounter=0,this.snapshotsBuffer=new Map,this.currentSnapshotIndex=0,this.snapshotPending=0,this.cancelableSnapshots=[],this.streamTimeout!=null&&clearTimeout(this.streamTimeout),this.snapshotHandlerTimeout!=null&&clearTimeout(this.snapshotHandlerTimeout),this.streamTimeout=void 0,this.snapshotHandlerTimeout=void 0}handleDownloadTimeout(){ls.info("download canceled"),this.cancelDownload()}writeTableHeader(){var e;let t="";if(this.columns)for(let n=0;n<this.columns.length;n+=1)t+=this.columns[n].name,t+=n===this.columns.length-1?`
26
+ `:",";(e=this.fileWriter)==null||e.write({header:t}).then(()=>null)}startWriteTableBody(){this.columns&&this.gridRanges!=null&&(this.chunkRows=Math.floor(Ps.DOWNLOAD_CELL_CHUNK/this.columns.length),this.rangedSnapshotsTotal=this.gridRanges.map(t=>(L(t.endRow),L(t.startRow),L(this.chunkRows),Math.ceil((t.endRow-t.startRow+1)/this.chunkRows))),this.snapshotsTotal=this.rangedSnapshotsTotal.reduce((t,e)=>t+e),ls.info("start writing table, total snapshots: ",this.snapshotsTotal),this.makeSnapshot(Math.min(Ps.SNAPSHOT_BUFFER_SIZE,this.snapshotsTotal)))}writeCsvTable(t){t&&this.writeTableHeader(),this.startWriteTableBody()}writeSnapshot(t,e,n){if(this.currentSnapshotIndex===t&&this.fileWriter){for(;this.snapshotsBuffer.has(this.currentSnapshotIndex);){const s=this.snapshotsBuffer.get(this.currentSnapshotIndex);L(s),this.fileWriter.write({rows:this.convertSnapshotIntoCsv(s)}),this.snapshotsBuffer.delete(this.currentSnapshotIndex),this.currentSnapshotIndex+=1,this.updateDownloadProgress(t)}if(this.snapshotsTotal&&this.currentSnapshotIndex>=this.snapshotsTotal){this.finishDownload();return}}this.snapshotCounter&&this.snapshotsTotal&&this.snapshotCounter<this.snapshotsTotal&&(ls.debug2(`
27
+ current range index: ${this.gridRangeCounter},
28
+ snapshotIndexCounter: ${this.snapshotCounter},
29
+ currentRangedSnapshotIndex : ${this.rangedSnapshotCounter},
30
+ snapshotpending: ${this.snapshotPending},
31
+ buffered ${this.snapshotsBuffer.size}
32
+ making ${Math.min(Ps.SNAPSHOT_BUFFER_SIZE-this.snapshotsBuffer.size-this.snapshotPending,this.snapshotsTotal-this.snapshotCounter)} more snapshots
33
+ `),this.makeSnapshot(Math.min(Ps.SNAPSHOT_BUFFER_SIZE-this.snapshotsBuffer.size-this.snapshotPending,this.snapshotsTotal-this.snapshotCounter)))}updateDownloadProgress(t){if(t!=null&&this.snapshotsTotal!=null&&this.downloadStartTime!=null){const{onDownloadProgressUpdate:e}=this.props,n=Math.floor(t*100/this.snapshotsTotal),s=t>1?Math.floor((Date.now()-this.downloadStartTime)*(this.snapshotsTotal-t)/t/1e3):null;e(n,s)}}convertSnapshotIntoCsv(t){var r;let e="";const n=t.added.iterator(),{formatter:s}=this.props,i=[];for(;n.hasNext();)i.push(n.next().value);L(this.columns);const{useUnformattedValues:o}=this;for(let l=0;l<i.length;l+=1){const a=i[l];for(let d=0;d<this.columns.length;d+=1){const{type:c,name:u}=this.columns[d];let m=null;if(o){let p=(r=t.getData(a,this.columns[d]))!=null?r:"";p!==""&&_.isDateType(c)&&(p=M.i18n.DateTimeFormat.format(dE,p,M.i18n.TimeZone.getTimeZone(s.timeZone))),m=p.toString()}else{const p=this.getCachedCustomColumnFormatFlag(s,u,c);let g=null;if(!p){const f=t.getFormat(a,this.columns[d]);g=(f==null?void 0:f.formatString)!=null?f:null}g?m=s.getFormattedString(t.getData(a,this.columns[d]),c,u,g):m=s.getFormattedString(t.getData(a,this.columns[d]),c,u)}e+=Ps.csvEscapeString(m),e+=d===this.columns.length-1?`
34
+ `:","}}return e}makeSnapshot(t){if(t<=0)return;L(this.gridRangeCounter);let e=0,n=this.gridRanges[this.gridRangeCounter];for(L(this.tableSubscription),L(this.columns);e<t;){L(n),L(n.startRow),L(n.endRow),L(this.rangedSnapshotCounter),L(this.chunkRows);const s=n.startRow+this.rangedSnapshotCounter*this.chunkRows,i=Math.min(s+this.chunkRows-1,n.endRow),o=this.snapshotCounter;this.cancelableSnapshots.push(ye.makeCancelable(this.tableSubscription.snapshot(M.RangeSet.ofRange(s,i),this.columns).then(r=>(hE(r),this.handleSnapshotResolved(r,o,s,i),o)).catch(r=>{ls.error(r)}),r=>{ls.info(`snapshot ${r} has been canceled`)})),this.rangedSnapshotCounter+=1,this.snapshotCounter+=1,this.snapshotPending+=1,this.rangedSnapshotCounter>=this.rangedSnapshotsTotal[this.gridRangeCounter]&&(this.gridRangeCounter+=1,this.rangedSnapshotCounter=0,n=this.gridRanges[this.gridRangeCounter]),e+=1}}handlePortMessage({data:t}){const{download:e,readableStreamPulling:n}=t;if(!this.useBlobFallback){if(e!=null){const{includeColumnHeaders:s}=this;this.makeIframe(`${e}`),this.writeCsvTable(s)}n!=null&&(this.useBlobFallback||(this.streamTimeout!=null&&clearTimeout(this.streamTimeout),this.streamTimeout=setTimeout(this.handleDownloadTimeout,Ps.STREAM_TIMEOUT)))}}handleSnapshotResolved(t,e,n,s){this.snapshotHandlerTimeout=setTimeout(()=>{this.snapshotsBuffer.set(e,t),this.snapshotPending-=1,this.writeSnapshot(e,n,s),this.cancelableSnapshots[e]=null},Ps.SNAPSHOT_HANDLER_TIMEOUT)}makeIframe(t){const e=document.createElement("iframe");e.hidden=!0,e.src=`download/${t}`,e.name="iframe",document.body.appendChild(e),this.iframes.push(e)}render(){return null}};let po=Ps;po.DOWNLOAD_CELL_CHUNK=6e3;po.SNAPSHOT_BUFFER_SIZE=5;po.STREAM_TIMEOUT=8e3;po.SNAPSHOT_HANDLER_TIMEOUT=5;po.defaultProps={getDownloadWorker:()=>Promise.reject(new Error("Download worker not provided")),isDownloading:!1,onDownloadCompleted:()=>{},onDownloadCanceled:()=>{},onDownloadProgressUpdate:()=>{}};function uE(t){var E;const{group:e,onDelete:n,onColorChange:s,onNameChange:i,validateName:o}=t,{isNew:r}=e,l=w.exports.useRef(e),a=w.exports.useRef(null),d=w.exports.useRef(null),[c,u]=w.exports.useState(r?"":e.name),[m,p]=w.exports.useState(r),[g,f]=w.exports.useState(!1),b=c!==e.name?o(c):"",C=r&&!g||b==="";w.exports.useEffect(function(){m&&a.current&&(a.current.focus(),a.current.select())},[m]),w.exports.useEffect(function(){return()=>{l.current.isNew&&n(l.current)}},[n]);const S=()=>{C&&(i(e,c),p(!1))},v=()=>{if(r){n(e);return}u(e.name),p(!1)},y=I=>{f(!0),I.key==="Enter"&&(I.stopPropagation(),S()),I.key===" "&&I.stopPropagation(),I.key==="Escape"&&v()};return m?T(Te,{children:[T("div",{className:"editing-container",children:[h("input",{ref:a,className:z("form-control",{"is-invalid":!C}),value:c,placeholder:"Group Name",onChange:I=>u(I.target.value),onKeyDown:y}),h(W,{kind:"ghost",icon:jn,tooltip:"Confirm",onClick:S}),h(W,{kind:"ghost",icon:wC,tooltip:"Cancel",onClick:v})]}),!C&&h("p",{className:"mb-0 validate-label-error text-danger",children:b})]}):T("div",{className:"group-name-wrapper",children:[h("span",{className:"column-name",children:c}),h(W,{className:"p-1 mx-1",kind:"ghost",icon:nr,tooltip:"Edit",onClick:()=>{p(!0)}}),T("span",{className:"right-buttons",children:[h(W,{kind:"ghost",icon:hn,tooltip:"Delete group",onClick:()=>n(e)}),h(W,{kind:"ghost",className:"color-swatch mr-1",icon:e.color!==void 0?T("span",{className:"fa-layers",children:[h(ee,{className:"color-swatch",icon:ml,color:ze.white,transform:"down-1"}),h(ee,{className:"color-swatch",icon:ml,color:e.color,transform:"shrink-2 down-1"})]}):BC,tooltip:"Set color",onClick:()=>{var I,R;(I=d.current)==null||I.click(),(R=d.current)==null||R.focus()}}),h("input",{"aria-label":"Color input",ref:d,type:"color",list:"presetColors",value:(E=e.color)!=null?E:ze["content-bg"],style:{visibility:"hidden",width:0,height:0,padding:0,border:0},onChange:I=>{e.color=I.target.value,s(e,I.target.value)}}),T("datalist",{id:"presetColors",children:[h("option",{children:ze["content-bg"]}),h("option",{children:ze.primary}),h("option",{children:ze.foreground}),h("option",{children:ze.green}),h("option",{children:ze.yellow}),h("option",{children:ze.orange}),h("option",{children:ze.red}),h("option",{children:ze.purple}),h("option",{children:ze.blue}),h("option",{children:ze["gray-400"]})]})]})]})}function mE(){}const pE=w.exports.forwardRef(function(e,n){const{value:s,clone:i,childCount:o,item:r,onVisibilityChange:l,onClick:a,onGroupDelete:d,onGroupColorChange:c,onGroupNameChange:u,validateGroupName:m,handleProps:p}=e,{group:g,modelIndex:f,isVisible:b}=r.data,C=w.exports.useRef(null),S=w.exports.useCallback(y=>{var E;y.buttons===1&&(l([f].flat(),!b),(E=C.current)==null||E.focus())},[l,f,b]),v=w.exports.useCallback(y=>{a(s,y)},[a,s]);return T("div",{ref:n,className:z("tree-item",{isSelected:r.selected,"two-dragged":o===2,"multiple-dragged":o>2}),onClick:v,...p,children:[h(W,{ref:C,kind:"ghost",className:"px-1",onClick:mE,onMouseDown:S,onMouseEnter:S,icon:b?Id:Pu,tooltip:"Toggle visibility"}),h("span",{className:z("column-name",g&&"column-group"),children:g&&!i?h(uE,{group:g,onDelete:d,onColorChange:c,onNameChange:u,validateName:m}):s}),T("div",{children:[i&&o>1&&h("span",{className:"item-count",children:o}),h(Ye,{children:"Drag to re-order"}),h(ee,{icon:ir})]})]})});function gE(t){return t.parentId!==void 0}function fE(t,e){return Math.round(t/e)}function $p(t,e,n,s,i,o){var l;const r=t.findIndex(a=>a.name===s);if(r===-1){const a=n.get(s);if(a==null)throw new Error(`Column or header group not found: ${s}`);const d=a.childIndexes.flat();return{id:s,selected:o.has(s),children:a.children.map(c=>$p(t,e,n,c,i,o)).sort((c,u)=>{const m=Array.isArray(c.data.visibleIndex)?c.data.visibleIndex[0]:c.data.visibleIndex,p=Array.isArray(u.data.visibleIndex)?u.data.visibleIndex[0]:u.data.visibleIndex;return m-p}),data:{modelIndex:d,visibleIndex:a.getVisibleRange(e),group:a,isVisible:d.some(c=>{var u;return((u=i.get(c))!=null?u:1)>0})}}}return{id:s,children:[],selected:o.has(s),data:{modelIndex:r,visibleIndex:J.getVisibleIndex(r,e),isVisible:((l=i.get(r))!=null?l:1)>0}}}function CE(t,e,n,s,i){const o=[],r=new Set(i),l=new Map(n.map(d=>[d.name,d]));let a=0;for(;a<t.length;){const d=J.getModelIndex(a,e),c=t[d].name;let u=n.find(({children:p})=>p.includes(c));for(;u!==void 0&&u.parent!==void 0;)u=l.get(u.parent);const m=$p(t,e,l,u?u.name:c,s,r);o.push(m),Array.isArray(m.data.visibleIndex)?a+=m.data.visibleIndex[1]-m.data.visibleIndex[0]+1:a+=1}return o}function yl(t,e,n,s,i){const o=t.findIndex(({id:C})=>C===n),r=t.findIndex(({id:C})=>C===e),l=t[r],a=ef(t,r,o),d=a[o-1],c=a[o+1],u=fE(s,i),m=l.depth+u,p=bE({previousItem:d,nextItem:c}),g=SE({nextItem:c});let f=m;return m>=p?f=p:m<g&&(f=g),{depth:f,maxDepth:p,minDepth:g,parentId:b()};function b(){var S;if(f===0||!d)return null;if(f===d.depth)return d.parentId;if(f>d.depth)return d.id;const C=(S=a.slice(0,o).reverse().find(v=>v.depth===f))==null?void 0:S.parentId;return C!=null?C:null}}function bE({previousItem:t,nextItem:e}){var n,s;return Math.max((n=t==null?void 0:t.depth)!=null?n:0,(s=e==null?void 0:e.depth)!=null?s:0)}function SE({nextItem:t}){return t?t.depth:0}function zp(t,e=null,n=0){return t.reduce((s,i,o)=>[...s,{...i,parentId:e,depth:n,index:o},...zp(i.children,i.id,n+1)],[])}function fn(t){return t.every(gE)?t:zp(t)}function Wp(t,e){for(let n=0;n<t.length;n+=1){const s=t[n],{id:i,children:o}=s;if(i===e)return s;if(o.length){const r=Wp(o,e);if(r)return r}}}function Gp(t,e=0){return t.reduce((n,{children:s})=>s.length?Gp(s,n+1):n+1,e)}function wE(t,e){const n=Wp(t,e);return n?Gp(n.children):0}const vE=[qn.Down,qn.Right,qn.Up,qn.Left],TE=[qn.Left,qn.Right];function EE(t,e,n){return(s,{currentCoordinates:i,context:{active:o,over:r,collisionRect:l,droppableRects:a,droppableContainers:d}})=>{if(vE.includes(s.code)){if(!o||!l)return;s.preventDefault();const{current:{items:c,offset:u}}=t;if(TE.includes(s.code)&&(r==null?void 0:r.id)!=null){const{depth:f,maxDepth:b,minDepth:C}=yl(c,o.id,r.id,u,n);switch(s.code){case qn.Left:if(f>C)return{...i,x:i.x-n};break;case qn.Right:if(f<b)return{...i,x:i.x+n};break}return}const m=[];d.forEach(f=>{if((f==null?void 0:f.disabled)||f.id===(r==null?void 0:r.id))return;const b=a.get(f.id);if(!!b)switch(s.code){case qn.Down:l.top<b.top&&m.push(f);break;case qn.Up:l.top>b.top&&m.push(f);break}});const p=tf({active:o,collisionRect:l,pointerCoordinates:null,droppableRects:a,droppableContainers:m});let g=nf(p,"id");if(g===(r==null?void 0:r.id)&&p.length>1&&(g=p[1].id),g!=null&&(r==null?void 0:r.id)!=null){const f=a.get(o.id),b=a.get(g),C=d.get(g);if(f&&b&&C){const S=c.findIndex(({id:I})=>I===g),v=c[S],y=c.findIndex(({id:I})=>I===o.id),E=c[y];if(v!=null&&E!=null){const{depth:I}=yl(c,o.id,g,(v.depth-E.depth)*n,n),N=S>y?1:-1,F=e?(l.height-f.height)/2:0;return{x:b.left+I*n,y:b.top+N*F}}}}}}}class Kp extends sf{}Kp.activators=[{eventName:"onPointerDown",handler:({nativeEvent:t})=>!(!t.isPrimary||t.button!==0||IE(t.target))}];const yE=["button","input","textarea","select","option"];function IE(t){return!!((t==null?void 0:t.tagName)!=null&&yE.includes(t.tagName.toLowerCase()))}function qp(t){const{clone:e=!1,depth:n,disableInteraction:s=!1,ghost:i=!1,handleProps:o,value:r,dragRef:l=null,wrapperRef:a=null,renderItem:d,item:c,childCount:u}=t,m=w.exports.useMemo(()=>Array(n).fill(0).map((g,f)=>h("span",{className:"depth-line"},`depth-line-${f}`)),[n]),p=w.exports.useMemo(()=>({ref:l,clone:e,value:r,item:c,childCount:u,handleProps:o}),[l,e,r,c,u,o]);return T("li",{className:z("item-wrapper",{clone:e,ghost:i,disableInteraction:s}),ref:a,children:[!e&&m,d(p)]},r)}qp.displayName="TreeItem";const RE=({isSorting:t,wasDragging:e})=>!(t||e);function zh({id:t,depth:e,...n}){const{attributes:s,isDragging:i,isSorting:o,listeners:r,setDraggableNodeRef:l,setDroppableNodeRef:a,transform:d,transition:c}=of({id:t,animateLayoutChanges:RE}),u=Ba.Translate.toString(d),m=w.exports.useMemo(()=>({transform:u,transition:c}),[u,c]),p=w.exports.useMemo(()=>({...s,...r,style:m}),[s,r,m]);return h(qp,{dragRef:l,wrapperRef:a,depth:e,ghost:i,disableInteraction:o,handleProps:p,...n})}const DE={keyframes({transform:t}){return[{opacity:1,transform:Ba.Transform.toString(t.initial)},{opacity:0,transform:Ba.Transform.toString({...t.final,x:t.final.x+5,y:t.final.y+5})}]},easing:"ease-out",sideEffects({active:t}){t.node.animate([{opacity:0},{opacity:1}],{duration:Ac.duration,easing:Ac.easing})}};let ki=null;function ME(t){return ki==null&&t.activeNodeRect&&t.activatorEvent instanceof PointerEvent&&(ki=Math.floor((t.activatorEvent.clientY-t.activeNodeRect.top)/t.activeNodeRect.height)*t.activeNodeRect.height),t.activeNodeRect||(ki=null),{...t.transform,y:t.transform.y+(ki!=null?ki:0)}}function NE({items:t,renderItem:e,indentationWidth:n=30,indicator:s=!1,activeId:i,overId:o,offsetLeft:r}){const l=rf(),a=w.exports.useRef(l);w.exports.useEffect(function(){a.current=l},[l]),w.exports.useEffect(function(){a.current.measureDroppableContainers(t.map(({id:p})=>p))},[t]);const d=i!=null&&o!=null?yl(t,i,o,r,n):null,c=w.exports.useRef({items:t,offset:r}),u=i!=null?t.find(({id:m})=>m===i):null;return w.exports.useEffect(()=>{c.current={items:t,offset:r}},[t,r]),T(Te,{children:[h("div",{className:z("tree-container",i!=null&&"marching-ants"),children:t.map(m=>{const{id:p,depth:g}=m;return h(zh,{id:p,value:p,depth:p===i&&d?d.depth:g,item:m,renderItem:e},p)})}),lf.exports.createPortal(h(af,{dropAnimation:DE,modifiers:[ME],className:"visibility-ordering-list",children:i!=null&&u?h(zh,{id:i,depth:u.depth,clone:!0,childCount:wE(t,i)+1,value:i.toString(),renderItem:e,item:u}):null}),document.body)]})}const FE={droppable:{strategy:df.Always}},xE={activationConstraint:{distance:5}};function _E({items:t,indicator:e=!1,indentationWidth:n=30,onDragStart:s,onDragEnd:i,renderItem:o}){const[r,l]=w.exports.useState(null),[a,d]=w.exports.useState(null),[c,u]=w.exports.useState(0),m=w.exports.useMemo(()=>{const N=fn(t);return r!=null?N.filter(({id:F,selected:P})=>F===r||!P):N},[r,t]),p=r!=null&&a!=null?yl(m,r,a,c,n):null,g=w.exports.useRef({items:m,offset:c}),f=w.exports.useMemo(()=>({coordinateGetter:EE(g,e,n)}),[n,e]),b=cf(Pc(Kp,xE),Pc(gf,f)),C=w.exports.useMemo(()=>m.map(({id:N})=>N),[m]);w.exports.useEffect(()=>{g.current={items:m,offset:c}},[m,c]);const S=w.exports.useCallback(({active:{id:N}})=>{l(N),d(N),s==null||s(N),document.body.style.setProperty("cursor","grabbing")},[s]),v=w.exports.useCallback(({delta:N})=>{u(N.x)},[]),y=w.exports.useCallback(({over:N})=>{var F;d((F=N==null?void 0:N.id)!=null?F:null)},[]),E=w.exports.useCallback(()=>{d(null),l(null),u(0),document.body.style.setProperty("cursor","")},[]),I=w.exports.useCallback(({active:N,over:F})=>{if(E(),p&&F){const{depth:P,parentId:H}=p,x=JSON.parse(JSON.stringify(fn(t))),A=x.findIndex(({id:V})=>V===F.id),k=x.findIndex(({id:V})=>V===N.id),G=x[k];x[k]={...G,depth:P,parentId:H},i==null||i(G,{...x[A],parentId:p.parentId})}},[t,i,p,E]),R=w.exports.useCallback(()=>{E()},[E]);return h(hf,{sensors:b,collisionDetection:uf,measuring:FE,onDragStart:S,onDragMove:v,onDragOver:y,onDragEnd:I,onDragCancel:R,children:h(mf,{items:C,strategy:pf,children:h(NE,{items:m,renderItem:o,indicator:e,indentationWidth:n,activeId:r,overId:a,offsetLeft:c})})})}function kE(t,e,n,s,i,o,r,l){const a=i.map((S,v)=>({...S,index:v}));let d=[],c=s;const u=o[0].data.visibleIndex,m=a.findIndex(({id:S})=>S===t.id),p=a.findIndex(({id:S})=>S===e.id);let g=Array.isArray(u)?u[1]+1:u+1;c=Vs(o[0],e.parentId,c);for(let S=1;S<o.length;S+=1){const{data:{visibleIndex:v}}=o[S];d=J.moveItemOrRange(v,g,d,!0),g+=Array.isArray(v)?v[1]-v[0]+1:1,c=Vs(o[S],e.parentId,c)}const f=[Array.isArray(u)?u[0]:u,g-1],b=Array.isArray(e.data.visibleIndex)?e.data.visibleIndex[0]:e.data.visibleIndex;let C=J.getVisibleIndex(b,d);return m>p&&C>b&&(C-=1),e.children.length>0&&(Array.isArray(u)?u[0]:u)<C&&(C-=1),f[0]<C&&(C-=f[1]-f[0]),d=J.moveItemOrRange(f,Je(C,r,l),d),{groups:c,movedColumns:n.concat(d)}}function Vs(t,e,n){var a;if(t.parentId===e)return n;let s=n.map(d=>new Gn(d));const i=new Map(s.map(d=>[d.name,d])),o=s.find(d=>d.name===t.parentId),r=s.find(d=>d.name===e),l=s.find(d=>d.name===t.id);if(o!=null&&(o.children=o.children.filter(d=>d!==t.id),o.children.length===0)){const d=new Set([o.name]),{parent:c=""}=o;let u=i.get(c);for(u==null||u.removeChildren([o.name]);u&&u.children.length===0;){d.add(u.name);const m=(a=u==null?void 0:u.parent)!=null?a:"",p=i.get(m);p==null||p.removeChildren([u.name]),u=p}s=s.filter(({name:m})=>!d.has(m))}return r!=null&&r.addChildren([t.id]),l==null||l.setParent(e!=null?e:void 0),s}const OE=150,wt=class extends w.exports.Component{constructor(t){super(t),this.debouncedSearchColumns=Ze(this.searchColumns,OE),this.handleGroupColorChange=Qn((e,n)=>{const{columnHeaderGroups:s,onColumnHeaderGroupChanged:i}=this.props,o=[...s],r=new Gn({...e,color:n});o.splice(o.findIndex(({name:l})=>l===e.name),1,r),i(o)},250),this.renderItem=be(({value:e,clone:n,item:s,ref:i,handleProps:o})=>{const{onColumnVisibilityChanged:r}=this.props,{selectedColumns:l}=this.state;let a=e;return n&&(a=this.getSelectedParentItems().map(({id:c})=>c).join(", ")),h(pE,{ref:i,value:a,clone:n,item:s,childCount:l.size,onVisibilityChange:r,onClick:this.handleItemClick,onGroupDelete:this.handleGroupDelete,onGroupColorChange:this.handleGroupColorChange,onGroupNameChange:this.handleGroupNameChange,validateGroupName:this.validateGroupName,handleProps:o})}),this.getMemoizedFirstMovableIndex=be((e,n,s)=>{for(let i=0;i<n.length;i+=1){const o=J.getModelIndex(i,s);if(e.isColumnMovable(o))return i}return null}),this.getMemoizedLastMovableIndex=be((e,n,s)=>{for(let i=n.length-1;i>=0;i-=1){const o=J.getModelIndex(i,s);if(e.isColumnMovable(o))return i}return null}),this.memoizedGetTreeItems=be((e,n,s,i,o)=>CE(e,n,s,i,[...o.values()])),this.makeVisibilityOrderingList=be((e,n)=>{const{movedColumns:s}=this.props,i=[],o=this.getFirstMovableIndex(),r=this.getLastMovableIndex(),l=n.findIndex(({data:c})=>Array.isArray(c.visibleIndex)?c.visibleIndex[0]===o:c.visibleIndex===o),a=n.findIndex(({data:c})=>Array.isArray(c.visibleIndex)?c.visibleIndex[1]===r:c.visibleIndex===r),d=n.slice(l,a+1);if(o==null||r===null){for(let c=0;c<e.length;c+=1){const u=J.getModelIndex(c,s),m=e[u];i.push(this.renderImmovableItem(m.name))}return i}for(let c=0;c<o;c+=1){const u=J.getModelIndex(c,s),m=e[u];i.push(this.renderImmovableItem(m.name))}o!==null&&o>0&&i.push(h("hr",{},"top-horizontal-divider")),i.push(h(_E,{items:d,renderItem:this.renderItem,onDragStart:this.handleDragStart,onDragEnd:this.handleDragEnd},"movable-items")),r!=null&&r<e.length-1&&i.push(h("hr",{},"bottom-horizontal-divider"));for(let c=r+1;c<e.length;c+=1){const u=J.getModelIndex(c,s),m=e[u];i.push(this.renderImmovableItem(m.name))}return i}),this.renderImmovableItem=be(e=>h("div",{className:"visibility-ordering-list-item immovable",children:h("div",{className:"column-item",children:h("span",{className:"column-name",children:e})})},e)),this.handleSearchInputChange=this.handleSearchInputChange.bind(this),this.searchColumns=this.searchColumns.bind(this),this.handleItemClick=this.handleItemClick.bind(this),this.handleDragEnd=this.handleDragEnd.bind(this),this.handleGroupDelete=this.handleGroupDelete.bind(this),this.handleGroupNameChange=this.handleGroupNameChange.bind(this),this.handleGroupCreate=this.handleGroupCreate.bind(this),this.validateGroupName=this.validateGroupName.bind(this),this.addColumnToSelected=this.addColumnToSelected.bind(this),this.handleDragStart=this.handleDragStart.bind(this),this.state={selectedColumns:new Set,lastSelectedColumn:"",searchFilter:""},this.list=null}componentWillUnmount(){this.debouncedSearchColumns.cancel()}resetVisibilityOrdering(){const{model:t,onColumnVisibilityChanged:e,onMovedColumnsChanged:n,onColumnHeaderGroupChanged:s}=this.props,{columns:i}=t;e(i.map((o,r)=>r),!0),this.setState({selectedColumns:new Set,lastSelectedColumn:"",searchFilter:""}),s(t.initialColumnHeaderGroups),n(t.initialMovedColumns)}resetSelection(){this.setState({selectedColumns:new Set,lastSelectedColumn:""})}handleSearchInputChange(t){const e=t.target.value;if(this.setState({searchFilter:e}),!e){this.debouncedSearchColumns.cancel(),this.resetSelection();return}this.debouncedSearchColumns(e)}searchColumns(t){var o;const e=fn(this.getTreeItems()),s=e.filter(({id:r})=>r.toLowerCase().includes(t.toLowerCase())).map(({id:r})=>r),i=e.findIndex(({id:r})=>r.toLowerCase().includes(t.toLowerCase()));if(this.addColumnToSelected(s,!1),s.length>0){const r=(o=this.list)==null?void 0:o.querySelectorAll(".item-wrapper")[i];r==null||r.scrollIntoView({block:"center"})}}moveSelectedColumns(t){var c;const{columnHeaderGroups:e}=this.props,{selectedColumns:n}=this.state,s=fn(this.getTreeItems());let i=this.getFirstMovableIndex(),o=this.getLastMovableIndex();L(i),L(o);const r=this.getSelectedParentItems();t===wt.MOVE_OPTIONS.UP||t===wt.MOVE_OPTIONS.TOP||r.reverse();let a=[],d=e;for(let u=0;u<r.length;u+=1){const{id:m,parentId:p,depth:g,data:{visibleIndex:f}}=r[u];switch(t){case wt.MOVE_OPTIONS.TOP:{a=J.moveItemOrRange(f,i,a,!0),i+=Array.isArray(f)?f[1]-f[0]+1:1,d=Vs(r[u],null,d);break}case wt.MOVE_OPTIONS.BOTTOM:{a=J.moveItemOrRange(f,o,a,!0),o-=Array.isArray(f)?f[1]-f[0]+1:1,d=Vs(r[u],null,d);break}case wt.MOVE_OPTIONS.UP:{const b=s.findIndex(v=>v.id===m),C=s.map((v,y)=>y<b&&!n.has(v.id)).lastIndexOf(!0),S=s[C];if(S!=null&&S.parentId!==p)if(Math.abs(S.depth-g)>1){const v=s.map((E,I)=>I<C&&E.depth===g).lastIndexOf(!0),y=s[v];d=Vs(r[u],y.id,d)}else d=Vs(r[u],S.parentId,d);else{const v=Je(Array.isArray(f)?f[0]-1:f-1,i,o);a=J.moveItemOrRange(f,v,a,!1),i+=Array.isArray(f)?f[1]-f[0]+1:1}break}case wt.MOVE_OPTIONS.DOWN:{const b=s.findIndex(y=>y.id===m),C=s.find((y,E)=>E>b&&!n.has(y.id));if((C==null?void 0:C.parentId)!==p){const y=s.find(E=>E.id===p);d=Vs(r[u],(c=y==null?void 0:y.parentId)!=null?c:null,d);break}else if((C==null?void 0:C.children.length)>0){d=Vs(r[u],C.id,d);break}const S=Je(Array.isArray(f)?f[0]+1:f+1,i,o);a=J.moveItemOrRange(f,S,a,!1),o-=Array.isArray(f)?f[1]-f[0]+1:1;break}}}return{newMoves:a,groups:d}}handleMoveColumns(t){const{onMovedColumnsChanged:e,movedColumns:n,onColumnHeaderGroupChanged:s}=this.props,{newMoves:i,groups:o}=this.moveSelectedColumns(t);let r;t===wt.MOVE_OPTIONS.TOP&&(r=()=>{var l,a;(a=(l=this.list)==null?void 0:l.parentElement)==null||a.scroll({top:0})}),t===wt.MOVE_OPTIONS.BOTTOM&&(r=()=>{var l,a;(a=(l=this.list)==null?void 0:l.parentElement)==null||a.scroll({top:this.list.parentElement.scrollHeight})}),s(o),i.length>0&&e(n.concat(i),r)}getSortMoves(t,e,n){const s=[...t],i=e===wt.SORTING_OPTIONS.ASC;s.sort((l,a)=>{const d=l.id.toUpperCase(),c=a.id.toUpperCase();return nn.sort(d,c,i)});let o=[...n],r=Math.min(...s.flatMap(l=>{const{modelIndex:a}=l.data;return Array.isArray(a)?J.getVisibleIndexes(a,o):J.getVisibleIndex(a,o)}));for(let l=0;l<s.length;l+=1){const a=s[l],{modelIndex:d}=a.data,c=Array.isArray(d)?J.getVisibleIndexes(d,o):J.getVisibleIndex(d,o);o=Array.isArray(c)?J.moveRange([Math.min(...c),Math.max(...c)],r,o,!0):J.moveItem(c,r,o),Array.isArray(c)&&(o=this.getSortMoves(a.children,e,o)),r+=Array.isArray(d)?d.length:1}return o}handleSortColumns(t){const{model:e,onMovedColumnsChanged:n}=this.props,s=this.getSortMoves(this.getTreeItems(),t,e.initialMovedColumns);n(s)}handleItemClick(t,e){if(e.stopPropagation(),e.target instanceof HTMLElement&&(e.target.tagName==="BUTTON"||e.target.tagName==="INPUT"))return;e.currentTarget.focus();const{selectedColumns:n,lastSelectedColumn:s}=this.state,i=J.isModifierKeyDown(e),o=e.shiftKey,r=n.has(t),l=[t];if(r&&i){this.removeColumnFromSelected(t);return}const a=fn(this.getTreeItems());if(r&&!o&&s===t){const d=a.find(({id:u})=>u===t);if(L(d),fn(d.children).length+1===n.size){this.resetSelection();return}}if(o){const d=a.findIndex(u=>u.id===t),c=a.findIndex(u=>u.id===s);l.push(...a.slice(Math.min(c,d),Math.max(c,d)+1).map(u=>u.id))}this.addColumnToSelected(l,i||o),this.setState({lastSelectedColumn:t})}addColumnToSelected(t,e){const{selectedColumns:n}=this.state,s=new Set(e?[...n.values()].concat(t):t);fn(this.getTreeItems()).forEach(({id:o,children:r})=>{s.has(o)&&r.forEach(l=>s.add(l.id))}),this.setState({selectedColumns:s})}removeColumnFromSelected(t){const{selectedColumns:e}=this.state,n=fn(this.getTreeItems()),s=n.find(({id:o})=>o===t);L(s);let i=n.find(({id:o})=>o===s.parentId);for(fn(s==null?void 0:s.children).forEach(o=>e.delete(o.id));i!=null;){e.delete(i.id);const o=i.parentId;i=n.find(({id:r})=>r===o)}e.delete(t),this.setState({selectedColumns:new Set(e)})}handleDragStart(t){const{selectedColumns:e}=this.state;e.has(t)||this.addColumnToSelected([t],!1)}handleDragEnd(t,e){const{movedColumns:n,onMovedColumnsChanged:s,columnHeaderGroups:i,onColumnHeaderGroupChanged:o}=this.props,r=this.getSelectedParentItems(),l=fn(this.getTreeItems()).map((m,p)=>({...m,index:p})),a=this.getFirstMovableIndex(),d=this.getLastMovableIndex();L(a),L(d);const{groups:c,movedColumns:u}=kE(t,e,n,i,l,r,a,d);o(c),s(u)}handleGroupNameChange(t,e){const{columnHeaderGroups:n,onColumnHeaderGroupChanged:s}=this.props,i=[...n],o=t.name,r=i.findIndex(({name:c})=>c===o),l=i[r];L(l);const a=new Gn(l);a.name=e,i.splice(r,1,a);const d=i.findIndex(({name:c})=>c===a.parent);if(d>=0){const c=new Gn(i[d]);c.removeChildren([o]),c.addChildren([e]),i.splice(d,1,c)}s(i)}handleGroupDelete(t){const{columnHeaderGroups:e,onColumnHeaderGroupChanged:n}=this.props,s=e.filter(o=>o.name!==t.name),i=s.findIndex(o=>o.name===t.parent);if(i>=0){const o=new Gn(s[i]);o.addChildren(t.children),o.removeChildren([t.name]),s.splice(i,1,o)}n(s)}handleGroupCreate(){const{movedColumns:t,onMovedColumnsChanged:e,onColumnHeaderGroupChanged:n}=this.props,{newMoves:s,groups:i}=this.moveSelectedColumns(wt.MOVE_OPTIONS.TOP),o=i.filter(c=>!c.isNew),r=this.getSelectedParentItems(),l=r.map(c=>c.data.modelIndex).flat().filter(c=>c>=0),a=`${Gn.NEW_GROUP_PREFIX}-${Date.now()}`,d=new Gn({name:a,children:r.map(({id:c})=>c),depth:0,childIndexes:[...new Set(l)]});e(t.concat(s),()=>{var c,u;(u=(c=this.list)==null?void 0:c.parentElement)==null||u.scroll({top:0})}),n(o.concat([d])),this.resetSelection()}validateGroupName(t){const{model:e,columnHeaderGroups:n}=this.props,{columns:s}=e;return En.isValidColumnName(t)?s.some(({name:i})=>i===t)||n.some(({name:i})=>i===t)?"Duplicate name":"":"Invalid name"}getFirstMovableIndex(){const{model:t,movedColumns:e}=this.props;return this.getMemoizedFirstMovableIndex(t,t.columns,e)}getLastMovableIndex(){const{model:t,movedColumns:e}=this.props;return this.getMemoizedLastMovableIndex(t,t.columns,e)}getTreeItems(){const{model:t,movedColumns:e,userColumnWidths:n,columnHeaderGroups:s}=this.props,{selectedColumns:i}=this.state;return this.memoizedGetTreeItems(t.columns,e,s,n,i)}getSelectedParentItems(){const{selectedColumns:t}=this.state;return fn(this.getTreeItems()).filter(({id:n,parentId:s})=>t.has(n)&&!t.has(s!=null?s:""))}render(){const{model:t,userColumnWidths:e,onColumnVisibilityChanged:n}=this.props,{selectedColumns:s,searchFilter:i}=this.state,o=s.size>0,r=this.getTreeItems(),l=new Map(fn(r).map(p=>[p.id,p.data.modelIndex])),a=[...new Set(o?[...s.values()].map(p=>l.get(p)).filter(p=>p!=null).flat():r.map(p=>p.data.modelIndex).flat())],d=!J.checkAllColumnsHidden(a,e),c=d?"Hide All":"Show All",u=d?"Hide Selected":"Show Selected",m=this.makeVisibilityOrderingList(t.columns,r);return T("div",{role:"menu",className:"visibility-ordering-builder",tabIndex:0,children:[T("div",{className:"top-menu",children:[h(W,{kind:"ghost",className:"toggle-visibility-btn",onClick:()=>{n(a,!d)},icon:d?Id:Pu,tooltip:"Toggle column visibility",children:o?u:c}),h(ws,{className:"visibility-search",value:i,matchCount:i?s.size:void 0,onChange:this.handleSearchInputChange})]}),T("div",{className:"top-menu",children:[h(W,{kind:"ghost",icon:hi,tooltip:"Reset to default",onClick:()=>{this.resetVisibilityOrdering()},children:"Reset"}),h("span",{className:"vertical-divider"}),h(W,{kind:"ghost",icon:Md,tooltip:"Sort ascending",onClick:()=>{this.handleSortColumns(wt.SORTING_OPTIONS.ASC)}}),h(W,{kind:"ghost",icon:Nd,tooltip:"Sort descending",onClick:()=>{this.handleSortColumns(wt.SORTING_OPTIONS.DSC)}}),h("span",{className:"vertical-divider"}),T(W,{kind:"ghost",tooltip:"Create group from selection",disabled:!o,onClick:this.handleGroupCreate,children:[T("span",{className:"fa-layers",style:{marginRight:"0.75rem"},children:[h(ee,{mask:YC,icon:Zi,transform:"right-7 down-5 shrink-6"}),h(ee,{icon:pC,transform:"right-8 down-6 shrink-8"})]}),"Group"]}),h("span",{className:"vertical-divider"}),h(W,{kind:"ghost",icon:SC,tooltip:"Move selection up",onClick:()=>{this.handleMoveColumns(wt.MOVE_OPTIONS.UP)},disabled:!o}),h(W,{kind:"ghost",icon:CC,tooltip:"Move selection down",onClick:()=>{this.handleMoveColumns(wt.MOVE_OPTIONS.DOWN)},disabled:!o}),h(W,{kind:"ghost",icon:QC,tooltip:"Move selection to top",onClick:()=>{this.handleMoveColumns(wt.MOVE_OPTIONS.TOP)},disabled:!o}),h(W,{kind:"ghost",icon:ZC,tooltip:"Move selection to bottom",onClick:()=>{this.handleMoveColumns(wt.MOVE_OPTIONS.BOTTOM)},disabled:!o})]}),h("div",{role:"menu",className:z("visibility-ordering-list"),children:h("div",{className:"column-list",ref:p=>{this.list=p},children:m})})]})}};let rc=wt;rc.SORTING_OPTIONS={DSC:"DSC",ASC:"ASC"};rc.MOVE_OPTIONS={TOP:"TOP",BOTTOM:"BOTTOM",UP:"UP",DOWN:"DOWN"};class Gr extends w.exports.PureComponent{constructor(e){super(e),this.handleSearchValueChange=this.handleSearchValueChange.bind(this),this.toggleColumn=this.toggleColumn.bind(this),this.selectAll=this.selectAll.bind(this),this.clear=this.clear.bind(this),this.selectNumbers=this.selectNumbers.bind(this),this.searchField=X.createRef(),this.state={isConfigureColumnsShown:!1}}static createSearchFilter(e,n,s,i){const o=i?s.filter(r=>!n.includes(r.name)).map(r=>r.name):n;if(e&&o.length>0){const r=M.FilterValue.ofString(e);return o.length===s.length?M.FilterCondition.search(r):M.FilterCondition.search(r,s.filter(a=>o.includes(a.name)).map(a=>a.filter()))}}focus(){var e;(e=this.searchField.current)==null||e.focus()}handleSearchValueChange(e){const{onChange:n,selectedColumns:s,invertSelection:i}=this.props;n(e.target.value,s,i)}sendColumnChange(e,n){const{onChange:s,value:i}=this.props;s(i,e,n)}setInvertSelection(e){const{onChange:n,value:s}=this.props;n(s,[],e)}toggleColumn(e){const{selectedColumns:n,invertSelection:s}=this.props;if(n.includes(e))this.sendColumnChange(n.filter(i=>i!==e),s);else{const i=n.slice();i.push(e),this.sendColumnChange(i,s)}}selectAll(){this.setInvertSelection(!0)}clear(){this.setInvertSelection(!1)}selectNumbers(){const{columns:e}=this.props;this.sendColumnChange(e.filter(n=>_.isNumberType(n.type)).map(n=>n.name),!1)}render(){const{value:e,selectedColumns:n,invertSelection:s,columns:i}=this.props,{isConfigureColumnsShown:o}=this.state,r=n.length===0&&s===!0||n.length===i.length&&s===!1,l=n.length===0&&s===!1||n.length===i.length&&s===!0;let a;return r?a=T(Te,{children:[h(ee,{icon:ml,mask:va,transform:"shrink-2 down-5 right-7"}),h(ee,{icon:JC,className:"text-primary",transform:"shrink-4 down-5 right-7"})]}):l?a=T(Te,{children:[h(ee,{icon:Zi,mask:va,transform:"shrink-1 down-5 right-7"}),h(ee,{icon:qc,className:"text-danger",transform:"shrink-4 down-5 right-7"})]}):a=T(Te,{children:[h(ee,{icon:ml,mask:va,transform:"shrink-2 down-5 right-7"}),h(ee,{icon:mb,className:"text-primary",transform:"shrink-4 down-5 right-7"})]}),T("div",{className:"cross-column-container",children:[h(ws,{className:"cross-column-search",placeholder:"Search Data...",value:e,onChange:this.handleSearchValueChange,ref:this.searchField}),T("button",{type:"button",className:"btn btn-link btn-link-icon px-2",onClick:()=>{o?this.setState({isConfigureColumnsShown:!1}):this.setState({isConfigureColumnsShown:!0})},children:[h("div",{className:"fa-layers",children:a}),h(Ye,{children:"Configure Columns"}),h(kn,{isShown:o,className:"cross-column-popper",onExited:()=>{this.setState({isConfigureColumnsShown:!1})},closeOnBlur:!0,interactive:!0,children:T("div",{className:"cross-column-popup",children:["Searched Columns",h("div",{className:"cross-column-scroll",children:i.map(d=>T(X.Fragment,{children:[h(St,{className:"cross-column-checkbox",checked:s?!n.includes(d.name):n.includes(d.name),onChange:()=>this.toggleColumn(d.name),children:d.name}),d.type.substring(d.type.lastIndexOf(".")+1)]},d.name))}),T("div",{className:"cross-column-button-bar",children:[h("button",{type:"button",className:"btn btn-link",onClick:this.selectAll,children:"Select All"}),h("button",{type:"button",className:"btn btn-link",onClick:this.clear,children:"Clear"}),h("button",{type:"button",className:"btn btn-link",onClick:this.selectNumbers,children:"Numbers Only"})]}),l&&T("p",{className:"text-danger",children:[h(ee,{icon:qc})," Select at least one column to search."]})]})})]})]})}}const ks=Z.module("PartitionSelectorSearch"),LE=150,Yp=class extends w.exports.Component{constructor(t){super(t),this.debounceUpdateFilter=Ze(()=>{this.updateFilter()},LE),this.handleFilterChange=this.handleFilterChange.bind(this),this.handleInputFocus=this.handleInputFocus.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleListKeydown=this.handleListKeydown.bind(this),this.handleSelect=this.handleSelect.bind(this),this.handleTableUpdate=this.handleTableUpdate.bind(this),this.handleTextChange=this.handleTextChange.bind(this),this.handleViewportChange=this.handleViewportChange.bind(this),this.itemList=null,this.searchInput=null,this.timer=null,this.state={offset:0,itemCount:0,items:[],text:"",isLoading:!0}}static handleError(t){t instanceof Qi||ks.error(t)}componentDidMount(){this.startListening()}componentDidUpdate(t,e){const{isLoading:n,itemCount:s}=this.state,{onListResized:i}=this.props;(s!==e.itemCount||n!==e.isLoading)&&i()}componentWillUnmount(){this.debounceUpdateFilter.cancel(),this.stopListening()}handleKeyDown(t){if(this.itemList==null)return!1;const{items:e,itemCount:n}=this.state;switch(t.key){case"Enter":{let s=null;if(e.length>0)s=e[0].value;else{const{text:i}=this.state;s=i.trim()}if(s.length>0){const{onSelect:i}=this.props;i(s)}return t.stopPropagation(),t.preventDefault(),!0}case"ArrowDown":return n>0&&this.itemList.focusItem(1),t.stopPropagation(),t.preventDefault(),!0;default:return!1}}handleListKeydown(t){switch(t.key){case"Escape":break;default:this.focus();break}}handleFilterChange(){ks.debug2("handleFilterChange");const{table:t}=this.props,e=t.size;this.setState({itemCount:e,isLoading:!0})}handleInputFocus(){this.itemList&&this.itemList.focusItem(0)}handleSelect(t){ks.debug2("handleSelect",t);const{onSelect:e}=this.props,{offset:n,items:s}=this.state,i=t-n;if(i<0||s.length<=i){ks.error("No data for item",t);return}const{value:o}=s[i];e(o)}handleTableUpdate(t){const e=t.detail,{offset:n}=e,s=[],{getFormattedString:i,table:o}=this.props,r=o.columns[0];for(let a=0;a<e.rows.length;a+=1){const c=e.rows[a].get(r),u=i(c,r.type,r.name);s.push({displayValue:u,value:c})}const l=o.size;ks.debug2("handleTableUpdate",l,n,s.length),this.setState({itemCount:l,items:s,offset:n,isLoading:!1})}handleTextChange(t){ks.debug2("handleTextChange");const{value:e}=t.target;this.setState({text:e}),this.debounceUpdateFilter()}handleViewportChange(t,e){ks.debug2("handleViewportChange",t,e);const n=Math.max(1,e-t),s=Math.max(0,t-n),i=e+n,{table:o}=this.props;o.setViewport(s,i)}focus(){this.searchInput&&this.searchInput.focus()}startListening(){const{initialPageSize:t,table:e}=this.props;e.addEventListener(M.Table.EVENT_UPDATED,this.handleTableUpdate),e.addEventListener(M.Table.EVENT_FILTERCHANGED,this.handleFilterChange),e.setViewport(0,t)}stopListening(){const{table:t}=this.props;t.removeEventListener(M.Table.EVENT_UPDATED,this.handleTableUpdate),t.removeEventListener(M.Table.EVENT_FILTERCHANGED,this.handleFilterChange)}updateFilter(){const{initialPageSize:t,table:e}=this.props,{text:n}=this.state,s=n.trim(),i=[];if(s.length>0){const r=e.columns[0].filter().invoke("matches",M.FilterValue.ofString(`(?s)(?i).*\\Q${s}\\E.*`));i.push(r)}ks.debug2("updateFilter",i),e.applyFilter(i),e.setViewport(0,t)}render(){const{isLoading:t,itemCount:e,items:n,offset:s,text:i}=this.state,o=Math.min(e,Yp.MAX_VISIBLE_ITEMS)*vn.DEFAULT_ROW_HEIGHT+11;return T("div",{className:"iris-grid-partition-selector-search",children:[h("div",{className:"search-container",children:h("input",{type:"text",ref:r=>{this.searchInput=r},value:i,placeholder:"Available Partitions",onChange:this.handleTextChange,onFocus:this.handleInputFocus,onKeyDown:this.handleKeyDown,className:"form-control input-partition"})}),!t&&e>0&&h("div",{className:"iris-grid-partition-selector-search-list",onKeyDown:this.handleListKeydown,role:"presentation",style:{height:o},children:h(vn,{ref:r=>{this.itemList=r},itemCount:e,items:n,offset:s,onSelect:this.handleSelect,onViewportChange:this.handleViewportChange})}),!t&&e===0&&h("div",{className:"iris-grid-partition-selector-search-empty",children:"No results"}),t&&T("div",{className:"iris-grid-partition-selector-loading",children:[h(On,{}),"\xA0Loading..."]})]})}};let sa=Yp;sa.MAX_VISIBLE_ITEMS=12;sa.defaultProps={initialPageSize:100,onSelect:()=>{},onListResized:()=>{}};sa.propTypes={getFormattedString:D.exports.func.isRequired,table:D.exports.shape({addEventListener:D.exports.func.isRequired,removeEventListener:D.exports.func.isRequired,columns:D.exports.arrayOf(D.exports.shape({name:D.exports.string.isRequired,type:D.exports.string.isRequired,filter:D.exports.func.isRequired})),size:D.exports.number.isRequired,applyFilter:D.exports.func.isRequired,setViewport:D.exports.func.isRequired}).isRequired,initialPageSize:D.exports.number,onSelect:D.exports.func,onListResized:D.exports.func};const Oi=Z.module("IrisGridPartitionSelector"),AE=250;class Xp extends w.exports.Component{constructor(e){super(e),this.debounceUpdate=Ze(()=>{this.sendUpdate()},AE),this.handleAppendClick=this.handleAppendClick.bind(this),this.handleCloseClick=this.handleCloseClick.bind(this),this.handleIgnoreClick=this.handleIgnoreClick.bind(this),this.handlePartitionChange=this.handlePartitionChange.bind(this),this.handlePartitionSelect=this.handlePartitionSelect.bind(this),this.handlePartitionListResized=this.handlePartitionListResized.bind(this),this.handleSearchOpened=this.handleSearchOpened.bind(this),this.handleSearchClosed=this.handleSearchClosed.bind(this),this.searchMenu=null,this.selectorSearch=null;const{partition:n}=e;this.state={partition:n}}componentWillUnmount(){this.debounceUpdate.cancel()}handleAppendClick(){Oi.debug2("handleAppendClick");const{onAppend:e}=this.props,{partition:n}=this.state;e(n)}handleCloseClick(){Oi.debug2("handleCloseClick"),this.sendDone()}handleIgnoreClick(){Oi.debug2("handleIgnoreClick"),this.sendFetchAll()}handlePartitionChange(e){Oi.debug2("handlePartitionChange");const{value:n}=e.target;this.setState({partition:n}),this.debounceUpdate()}handlePartitionSelect(e){this.searchMenu&&this.searchMenu.closeMenu(),this.setState({partition:e},()=>{this.sendUpdate()})}handlePartitionListResized(){this.searchMenu&&this.searchMenu.scheduleUpdate()}handleSearchClosed(){const{table:e}=this.props;e.applyFilter([])}handleSearchOpened(){this.selectorSearch&&this.selectorSearch.focus()}sendDone(){this.debounceUpdate.flush();const{onDone:e}=this.props;e()}sendUpdate(){Oi.debug2("sendUpdate");const{onChange:e}=this.props,{partition:n}=this.state;e(n)}sendFetchAll(){Oi.debug2("sendFetchAll"),this.debounceUpdate.cancel();const{onFetchAll:e}=this.props;e()}render(){const{columnName:e,getFormattedString:n,onDone:s,table:i}=this.props,{partition:o}=this.state,r=h(sa,{getFormattedString:n,table:i,onSelect:this.handlePartitionSelect,onListResized:this.handlePartitionListResized,ref:l=>{this.selectorSearch=l}},"search");return T("div",{className:"iris-grid-partition-selector",children:[h("div",{className:"status-message",children:T("span",{children:['Filtering "',e,'" partition to']})}),T("div",{className:"input-group",children:[h("input",{type:"text",value:o,onChange:this.handlePartitionChange,className:"form-control input-partition"}),h("div",{className:"input-group-append",children:T("button",{type:"button",className:"btn btn-outline-primary",children:[h(ee,{icon:Yn}),h(Ye,{children:"Partitions"}),h(Fn,{ref:l=>{this.searchMenu=l},actions:[{menuElement:r}],onMenuOpened:this.handleSearchOpened,onMenuClosed:this.handleSearchClosed})]})})]}),h("div",{className:"iris-grid-partition-selector-spacer"}),h("button",{type:"button",className:"btn btn-outline-primary btn-ignore",onClick:this.handleIgnoreClick,children:"Ignore & Fetch All"}),h("button",{type:"button",className:"btn btn-outline-primary btn-append",onClick:this.handleAppendClick,children:"Append Command"}),h("button",{type:"button",className:"btn btn-link btn-link-icon btn-close",onClick:s,children:h(ee,{icon:oo})})]})}}Xp.defaultProps={onAppend:()=>{},onChange:()=>{},onFetchAll:()=>{},onDone:()=>{},partition:""};const PE=Z.module("SelectDistinctBuilder");class jp extends w.exports.Component{constructor(e){super(e),this.handleAddColumnClick=this.handleAddColumnClick.bind(this),this.handleDeleteColumn=this.handleDeleteColumn.bind(this),this.handleDropdownChanged=this.handleDropdownChanged.bind(this);const{model:n,selectDistinctColumns:s}=this.props;this.state={inputs:s.length>0?[...s]:[""],columns:n.originalColumns}}componentDidUpdate(e,n){const{inputs:s}=this.state,{onChange:i}=this.props;if(n.inputs!==s){const o=s.filter(r=>r!=="");ut(n.inputs.filter(r=>r!==""),o)||i(o)}}handleAddColumnClick(){this.setState(({inputs:e})=>({inputs:[...e,""]}))}handleDeleteColumn(e){this.setState(({inputs:n})=>({inputs:n.length===1&&e===0?[""]:n.filter((s,i)=>e!==i)}))}handleDropdownChanged(e,n){PE.debug("handleDropdownChanged",e,n);const{value:s}=n.target;this.setState(({inputs:i})=>{const o=[...i];return o[e]=s,{inputs:o}})}renderInputs(){const{columns:e,inputs:n}=this.state;return n.map((s,i)=>{const o=e.filter(({name:r})=>r===s||!n.includes(r)).map(({name:r})=>h("option",{value:r,children:r},r));return T("div",{className:"form-inline px-3 pb-3",children:[T("select",{className:"form-control custom-select col",value:s,onChange:r=>this.handleDropdownChanged(i,r),children:[h("option",{value:"",children:"Select a column"}),o]}),(n.length>1||s!=="")&&h(W,{kind:"ghost",className:"ml-1 px-2",onClick:()=>{this.handleDeleteColumn(i)},icon:h(ee,{icon:hn,transform:"grow-3"}),tooltip:"Delete column"})]},i)})}render(){const{columns:e,inputs:n}=this.state,s=n.length>=e.length;return T("div",{role:"presentation",className:"select-distinct-builder-container h-100",children:[h("div",{className:"select-distinct-title",children:"Display Unique Values From"}),this.renderInputs(),h("hr",{}),h("div",{className:"pt-1 px-3",children:h(W,{kind:"ghost",className:"btn-add-column",onClick:this.handleAddColumnClick,disabled:s,icon:Gs,children:"Add Additional Column"})}),h("div",{className:"select-distinct-builder-footer",children:T("div",{className:"select-distinct-builder-hint",children:["Modifies a table to show unique value from a column, same as"," ",h("span",{className:"inline-code-snippet",children:'selectDistinct("Column")'}),". Filters will be reset and the resulting table will contain only the selected columns above."]})})]})}}jp.defaultProps={selectDistinctColumns:[],onChange:()=>{}};function lc({items:t,onChange:e=()=>{}}){return h(sm,{items:Array.from(t.entries()).map(([n,s])=>({title:lc.getAdvancedSettingsTitleForKey(n),isOn:s,onChange:i=>e(n,i)}))})}lc.getAdvancedSettingsTitleForKey=t=>{switch(t){case Si.FILTER_CONTROL_CHANGE_CLEARS_ALL_FILTERS:return"Control filters clear existing table filters";case Si.LINK_CHANGE_CLEARS_ALL_FILTERS:return"Inbound links clear existing table filters"}};const Wh=Z.module("ConditionalFormattingMenu"),xa=()=>{};function HE(t){const{column:{type:e}}=t;if(_.isNumberType(e))return t.condition===je.IS_NULL||t.condition===je.IS_NOT_NULL?"":`${t.value}`;if(_.isCharType(e))return t.condition===Ut.IS_NULL||t.condition===Ut.IS_NOT_NULL?"":`${t.value}`;if(_.isStringType(e))return t.condition===on.IS_NULL||t.condition===on.IS_NOT_NULL?"":`"${t.value}"`;if(_.isDateType(e))return t.condition===Ut.IS_NULL||t.condition===Ut.IS_NOT_NULL?"":`${t.value}`;if(_.isBooleanType(e))return"";throw new Error(`Invalid column type ${e} in getRuleValue`)}function VE(t){return _.isNumberType(t.column.type)&&t.condition===je.IS_BETWEEN?`${t.start} < ${t.column.name} < ${t.end}`:`${t.column.name} ${fT(t.column.type,t.condition)}
35
+ ${HE(t)}`}function UE(t){const{rules:e=[],onChange:n=xa,onCreate:s=xa,onSelect:i=xa}=t,o=w.exports.useCallback((d,c,u)=>{d.stopPropagation(),Wh.debug("Rule clicked",c,u),i(u)},[i]),r=w.exports.useCallback((d,c,u)=>{d.stopPropagation(),Wh.debug("Delete button clicked",c,u);const m=[...e];m.splice(u,1),n(m)},[n,e]),l=w.exports.useCallback(d=>{d.stopPropagation()},[]),a=w.exports.useCallback(d=>{if(jt.stopDragging(),d.destination==null)return;const c=d.source.index,u=d.destination.index,m=[...e],p=e[c];m.splice(c,1),m.splice(u,0,p),n(m)},[n,e]);return T("div",{className:"conditional-formatting-rules",children:[h(_l,{onDragStart:jt.startDragging,onDragEnd:a,children:h(xl,{droppableId:"droppable-custom-columns",children:(d,c)=>T("div",{ref:d.innerRef,...d.droppableProps,className:z("droppable-container",{dragging:c.draggingFromThisWith}),children:[e.length===0&&h("div",{className:"text-muted pl-2",children:"No formats defined"}),e.map((u,m)=>h(fd,{draggableId:`${m}-${u.type}`,index:m,disableInteractiveElementBlocking:!0,children:(p,g)=>h("div",{role:"menuitem",tabIndex:0,onClick:f=>o(f,u,m),className:z("draggable-container",{dragging:g.isDragging}),ref:p.innerRef,...p.draggableProps,children:h("div",{className:"conditional-formatting-list-item",children:T("div",{className:"formatting-item",children:[h("div",{className:"rule-icon",children:h("span",{className:"rule-icon-bg",style:{backgroundColor:Tl(u.config.style),color:El(u.config.style)},children:u.type===es.ROWS?"row":"col"})}),h("div",{className:"rule-title",children:VE(u.config)}),h(W,{kind:"ghost",className:"ml-1 px-2",onClick:f=>r(f,u,m),icon:hn,tooltip:"Delete rule"}),T("button",{type:"button",className:"btn btn-link btn-link-icon px-2 btn-drag-handle",onClick:l,...p.dragHandleProps,children:[h(Ye,{children:"Drag to re-order"}),h(ee,{icon:ir})]})]})})})},`${m}-${u.type}`)),d.placeholder]})})}),h("hr",{}),h(W,{kind:"ghost",onClick:s,icon:Gs,children:"Add New Rule"})]})}const Li=Z.module("ConditionEditor"),BE=()=>{},$E=[je.IS_EQUAL,je.IS_NOT_EQUAL,je.IS_BETWEEN,je.GREATER_THAN,je.GREATER_THAN_OR_EQUAL,je.LESS_THAN,je.LESS_THAN_OR_EQUAL,je.IS_NULL,je.IS_NOT_NULL].map(t=>h("option",{value:t,children:eT(t)},t)),zE=[on.IS_EXACTLY,on.IS_NOT_EXACTLY,on.CONTAINS,on.DOES_NOT_CONTAIN,on.STARTS_WITH,on.ENDS_WITH,on.IS_NULL,on.IS_NOT_NULL].map(t=>h("option",{value:t,children:tT(t)},t)),WE=[Ut.IS_EXACTLY,Ut.IS_NOT_EXACTLY,Ut.IS_BEFORE,Ut.IS_BEFORE_OR_EQUAL,Ut.IS_AFTER,Ut.IS_AFTER_OR_EQUAL,Ut.IS_NULL,Ut.IS_NOT_NULL].map(t=>h("option",{value:t,children:nT(t)},t)),GE=[Uo.IS_TRUE,Uo.IS_FALSE,Uo.IS_NULL,Uo.IS_NOT_NULL].map(t=>h("option",{value:t,children:sT(t)},t)),KE=[pi.IS_EQUAL,pi.IS_NOT_EQUAL,pi.IS_NULL,pi.IS_NOT_NULL].map(t=>h("option",{value:t,children:iT(t)},t));function qE(t,e,n,s){return t===je.IS_NULL||t===je.IS_NOT_NULL||t===je.IS_BETWEEN&&n!=null&&n!==""&&!Number.isNaN(Number.parseFloat(n))&&s!=null&&s!==""&&!Number.isNaN(Number.parseFloat(s))||t!==je.IS_BETWEEN&&e!==void 0&&e!==""&&!Number.isNaN(Number.parseFloat(e))}function YE(t,e,n,s,i,o,r){switch(t){case je.IS_EQUAL:case je.IS_NOT_EQUAL:case je.GREATER_THAN:case je.GREATER_THAN_OR_EQUAL:case je.LESS_THAN:case je.LESS_THAN_OR_EQUAL:return h("input",{type:"number",className:"form-control",placeholder:"Enter value",value:i!=null?i:"",onChange:e});case je.IS_BETWEEN:return T("div",{className:"d-flex flex-row",children:[h("input",{type:"number",className:"form-control d-flex mr-2",placeholder:"Start value",value:o!=null?o:"",onChange:n}),h("input",{type:"number",className:"form-control d-flex",placeholder:"End value",value:r!=null?r:"",onChange:s})]});case je.IS_NULL:case je.IS_NOT_NULL:return null}}function XE(t,e,n){switch(t){case on.IS_NULL:case on.IS_NOT_NULL:return null;default:return h("input",{type:"text",className:"form-control",placeholder:"Enter value",value:n!=null?n:"",onChange:e})}}function jE(t,e,n){switch(t){case Ut.IS_NULL:case Ut.IS_NOT_NULL:return null;default:return h("input",{type:"text",className:"form-control",placeholder:"Enter value",value:n!=null?n:"",onChange:e})}}function ZE(){return null}function QE(t,e,n){switch(t){case pi.IS_NULL:case pi.IS_NOT_NULL:return null;default:return h("input",{type:"text",className:"form-control",maxLength:1,placeholder:"Enter value",value:n!=null?n:"",onChange:e})}}function Zp(t){const{column:e,config:n,onChange:s=BE}=t,i=e.type,[o,r]=w.exports.useState(i),[l,a]=w.exports.useState(n.condition),[d,c]=w.exports.useState(n.value),[u,m]=w.exports.useState(n.start),[p,g]=w.exports.useState(n.end);i!==o&&(a(Rp(i)),c(void 0),m(void 0),g(void 0),r(i));const f=w.exports.useMemo(()=>{if(i===void 0)return[];if(_.isNumberType(i))return $E;if(_.isCharType(i))return KE;if(_.isStringType(i))return zE;if(_.isDateType(i))return WE;if(_.isBooleanType(i))return GE},[i]),b=w.exports.useCallback(E=>{const{value:I}=E.target;Li.debug("handleConditionChange",I),a(I)},[]),C=w.exports.useCallback(E=>{const{value:I}=E.target;Li.debug("handleValueChange",I),c(I)},[]),S=w.exports.useCallback(E=>{const{value:I}=E.target;Li.debug("handleStartValueChange",I),m(I)},[]),v=w.exports.useCallback(E=>{const{value:I}=E.target;Li.debug("handleEndValueChange",I),g(I)},[]);w.exports.useEffect(function(){let I=!0;l===void 0&&(Li.debug("Unable to create formatting rule. Condition is not selected."),I=!1),_.isNumberType(e.type)&&!qE(l,d,u,p)&&(Li.debug("Unable to create formatting rule. Invalid value",d),I=!1),s({condition:l,value:d,start:u,end:p},I)},[s,e.type,l,d,u,p]);const y=w.exports.useMemo(()=>{if(i===void 0)return null;if(_.isNumberType(i))return YE(l,C,S,v,d,u,p);if(_.isCharType(i))return QE(l,C,d);if(_.isStringType(i))return XE(l,C,d);if(_.isDateType(i))return jE(l,C,d);if(_.isBooleanType(i))return ZE()},[i,l,d,u,p,C,S,v]);return T("div",{className:"condition-editor mb-2",children:[h("select",{value:l,id:"condition-select",className:"custom-select mb-2",onChange:b,children:f}),y]})}const JE=Z.module("StyleEditor"),e1="#fcfcfa",t1="#f0f0ee",n1="#1a171a",s1=200,i1=()=>{};function Qp(t){var v,y;const{config:e,onChange:n=i1}=t,[s,i]=w.exports.useState(e.type),[o,r]=w.exports.useState((y=(v=e.customConfig)==null?void 0:v.background)!=null?y:e1),[l,a]=w.exports.useState(!1),[d,c]=w.exports.useState(s1),u=w.exports.useRef(null),m=w.exports.useCallback(E=>{const{value:I}=E.target;JE.debug("handleBackgroundChange",I),r(I)},[]),p=w.exports.useCallback(()=>{l&&a(!1)},[l]),g=w.exports.useCallback(()=>{l||b(),a(!l)},[l]),f=w.exports.useMemo(()=>[$n.NO_FORMATTING,$n.POSITIVE,$n.NEGATIVE,$n.WARN,$n.NEUTRAL,$n.ACCENT_1,$n.ACCENT_2,$n.CUSTOM],[]);function b(){u.current&&c(u.current.getBoundingClientRect().width)}w.exports.useEffect(function(){n({type:s,customConfig:{color:Ll.isDark(o)?t1:n1,background:o}})},[n,s,o]);const C=w.exports.useCallback(()=>{const E=[];for(let I=0;I<f.length;I+=1){const R=f[I],N=`option-${I}-${R}`;E.push(T(W,{kind:"inline",className:"style-option-btn",onClick:()=>{i(R),a(!1)},style:{color:El({type:R}),background:Tl({type:R})},children:[R===s&&h(ee,{icon:jn,className:"mr-2"}),R!==s&&h("span",{className:"mr-4"}),Ah(R)]},N))}return E},[f,s]),S=w.exports.useCallback(()=>h("div",{className:"style-menu-container",role:"presentation",style:{width:d},children:h("div",{className:"style-options",children:C()})}),[d,C]);return T("div",{className:"style-editor",children:[T("div",{className:"mb-2",ref:u,children:[h("label",{className:"mb-0",children:"Style"}),T(W,{kind:"inline",className:"cs-dropdown",style:{color:El({type:s}),background:Tl({type:s})},onClick:g,children:[Ah(s),h("span",{children:h(ee,{icon:Fd,className:"cs-caret"})}),h(Fn,{isShown:l,actions:{menuElement:S()},popperOptions:{placement:"bottom-start"},popperClassName:"style-dropdown-menu",onMenuClosed:p,menuStyle:{maxWidth:"100rem"}})]})]}),s===$n.CUSTOM&&T("div",{className:"mb-2",children:[h("label",{className:"mb-0",children:"Background"}),h("input",{type:"color",value:o,className:"custom-select color-select",onChange:m})]})]})}const Fo=Z.module("ColumnFormatEditor"),o1=()=>{};function r1(t){const{type:e,name:n}=t[0];return{column:{type:e,name:n},style:Mp(),...Jl(e)}}function l1(t){var b;const{columns:e,config:n=r1(e),onChange:s=o1}=t,[i,o]=w.exports.useState((b=e.find(C=>C.name===n.column.name&&C.type===n.column.type))!=null?b:e[0]),[r,l]=w.exports.useState(Dp(n)),[a,d]=w.exports.useState(!1),[c,u]=w.exports.useState(n.style),m=w.exports.useCallback(C=>{const S=e.find(({name:v})=>v===C);S!==void 0?(o(S),i.type!==S.type&&(l(Jl(S.type)),d(!1))):Fo.error(`Column ${C} not found.`)},[e,i]),p=w.exports.useCallback((C,S)=>{Fo.debug("handleConditionChange",C,S),l(C),d(S)},[]),g=w.exports.useCallback(C=>{Fo.debug("handleStyleChange",C),u(C)},[]);w.exports.useEffect(function(){if(i===void 0){Fo.debug("Column is not selected, skip update.");return}if(c===void 0){Fo.debug("Style is not selected, skip update.");return}const{type:S,name:v}=i;s({column:{type:S,name:v},style:c,...r},a)},[s,i,c,r,a]);const f=e.map(({name:C})=>({title:C,value:C}));return T("div",{className:"conditional-rule-editor form",children:[T("div",{className:"mb-2",children:[h("label",{className:"mb-0",children:"Format Cell If"}),h(ao,{defaultValue:i==null?void 0:i.name,options:f,inputPlaceholder:"Select a column",spellCheck:!1,onChange:m,searchPlaceholder:"Filter columns"})]}),i!==void 0&&T(Te,{children:[h(Zp,{column:i,config:r,onChange:p}),h(Qp,{config:c,onChange:g})]})]})}const xo=Z.module("RowFormatEditor"),a1=()=>{};function d1(t){const{type:e,name:n}=t[0];return{column:{type:e,name:n},style:Mp(),...Jl(e)}}function c1(t){var b;const{columns:e,config:n=d1(e),onChange:s=a1}=t,[i,o]=w.exports.useState((b=e.find(C=>C.name===n.column.name&&C.type===n.column.type))!=null?b:e[0]),[r,l]=w.exports.useState(Dp(n)),[a,d]=w.exports.useState(!1),[c,u]=w.exports.useState(n.style),m=w.exports.useCallback(C=>{const S=e.find(({name:v})=>v===C);S!==void 0?(o(S),i.type!==S.type&&(l(Jl(S.type)),d(!1))):xo.error(`Column ${C} not found.`)},[e,i]),p=w.exports.useCallback((C,S)=>{xo.debug("handleConditionChange",C,S),l(C),d(S)},[]),g=w.exports.useCallback(C=>{xo.debug("handleStyleChange",C),u(C)},[]);w.exports.useEffect(function(){if(i===void 0){xo.debug("Column is not selected, skip update.");return}if(c===void 0){xo.debug("Style is not selected, skip update.");return}const{type:S,name:v}=i;s({column:{type:S,name:v},style:c,...r},a)},[s,i,c,r,a]);const f=e.map(({name:C})=>({title:C,value:C}));return T("div",{className:"conditional-rule-editor form",children:[T("div",{className:"mb-2",children:[h("label",{className:"mb-0",children:"Format Row If"}),h(ao,{defaultValue:i==null?void 0:i.name,options:f,inputPlaceholder:"Select a column",spellCheck:!1,onChange:m,searchPlaceholder:"Filter columns"})]}),i!==void 0&&T(Te,{children:[h(Zp,{column:i,config:r,onChange:p}),h(Qp,{config:c,onChange:g})]})]})}const _a=Z.module("ConditionalFormatEditor"),ka=()=>{};function h1(t){switch(t){case es.CONDITIONAL:return h(sE,{});case es.ROWS:return h(iE,{})}}function u1(t){switch(t){case es.CONDITIONAL:return"Conditional";case es.ROWS:return"Rows"}}const Gh=[es.CONDITIONAL,es.ROWS];function m1(t){var C;const{columns:e,onSave:n=ka,onUpdate:s=ka,onCancel:i=ka,rule:o}=t,r=e.filter(bT),[l,a]=w.exports.useState((C=o==null?void 0:o.type)!=null?C:Gh[0]),[d,c]=w.exports.useState(o),[u,m]=w.exports.useState(!1),p=w.exports.useCallback(()=>{i()},[i]),g=w.exports.useCallback(()=>{if(d===void 0){_a.error("Rule is not defined.");return}n(d)},[n,d]),f=w.exports.useCallback(S=>{_a.debug("handleFormatterChange",S),a(S)},[]),b=w.exports.useCallback((S,v)=>{_a.debug("handleRuleChange",S,v,l);const y={type:l,config:S};c(y),m(v),s(v?y:void 0)},[s,l]);return T("div",{className:"conditional-format-editor form",children:[T("div",{className:"mb-2",children:[h("label",{className:"mb-0",htmlFor:"formatter-select",children:"Select Formatter"}),h("div",{className:"formatter-list",children:Gh.map((S,v)=>h("div",{className:"formatter-type",children:T("button",{type:"button",className:z("btn","btn-icon","btn-formatter-type",{active:S===l}),"data-index":v,onClick:()=>f(S),children:[h1(S),u1(S)]})},S))})]}),l===es.CONDITIONAL&&h(l1,{columns:r,config:d==null?void 0:d.config,onChange:b}),l===es.ROWS&&h(c1,{columns:r,config:d==null?void 0:d.config,onChange:b}),h("hr",{}),T("div",{className:"d-flex justify-content-end my-3",children:[h(W,{kind:"secondary",onClick:p,className:"mr-2",children:"Cancel"}),h(W,{kind:"primary",onClick:g,disabled:d===void 0||!u,children:"Done"})]})]})}function p1({text:t,isOpen:e,onClose:n}){var v,y;const[s,i]=w.exports.useState(!1),[o,r]=w.exports.useState(0),[l,a]=w.exports.useState(!1),[d,c]=w.exports.useState(!1),[u,m]=w.exports.useState(!1),p=w.exports.useRef();w.exports.useEffect(function(){if(!!e){try{JSON.parse(t),m(!0)}catch{m(!1)}c(!1)}},[e,t]),w.exports.useEffect(function(){p.current&&p.current.layout()},[o]),w.exports.useEffect(function(){p.current&&p.current.updateOptions({lineNumbers:l?"on":"off"})},[l]);function g(){a(!l)}function f(){var I;const E=(I=p.current)==null?void 0:I.getModel();!u||!E||(d?(E.setValue(t),c(!1)):(E.setValue(JSON.stringify(JSON.parse(t),void 0,2)),c(!0)),b())}function b(){var I,R;const E=p.current;!E||a(((R=(I=E.getModel())==null?void 0:I.getLineCount())!=null?R:0)>1)}function C(){s&&(p.current=void 0,n())}function S(E){p.current=E,r(E.getContentHeight()),E.onDidContentSizeChange(({contentHeight:I})=>r(I)),b()}return!e&&!s?null:T(Jo,{isOpen:e,centered:!0,keyboard:!0,toggle:C,onOpened:()=>i(!0),onClosed:()=>{i(!1),r(0)},className:"theme-bg-dark cell-overflow-modal",size:"xl",children:[T(tr,{toggle:n,children:[h("h5",{className:"overflow-modal-title",children:"Cell Contents"}),h(Pl,{kind:"inline",tooltip:"Copy cell contents",copy:(y=(v=p.current)==null?void 0:v.getValue())!=null?y:t}),h(W,{kind:"inline",active:l,icon:AC,tooltip:"Toggle line numbers",onClick:g}),u&&h(W,{kind:"inline",icon:_C,active:d,tooltip:"Format as JSON",onClick:f})]}),h(er,{style:{height:o},children:h(Wl,{onEditorInitialized:S,settings:{value:t,readOnly:!0,wordWrap:"on",language:u?"typescript":"plaintext",folding:u,padding:{bottom:16},lineNumbers:l?"on":"off",overviewRulerLanes:0,renderLineHighlight:"none",find:{seedSearchStringFromSelection:"never"}}})})]})}function g1(t){return t.model!==void 0}const f1="###,##0";function C1({gotoRow:t,gotoRowError:e,gotoValueError:n,onGotoRowSubmit:s,isShown:i,onEntering:o,onEntered:r,onExiting:l,onExited:a,model:d,onGotoRowNumberChanged:c,onClose:u,gotoValueSelectedColumnName:m,gotoValue:p,onGotoValueSelectedColumnNameChanged:g,onGotoValueSelectedFilterChanged:f,onGotoValueChanged:b,onGotoValueSubmit:C}){const S=w.exports.useRef(null),v=w.exports.useRef(null),[y,E]=w.exports.useState(!1);let I=[];g1(d)&&d.table!==void 0&&({columns:I}=d.table);const R="Row number",{rowCount:N}=d,F=O=>{O.key==="Enter"&&(O.stopPropagation(),O.preventDefault(),C())},P=d.getColumnIndexByName(m);L(P);const H=I[P],x=H==null?void 0:H.type,A=_.getNormalizedType(x),k=O=>{b(O!=null?O:"")},G=()=>{var O,$;y&&document.activeElement!==S.current?(O=S.current)==null||O.select():!y&&document.activeElement!==v.current&&(($=v.current)==null||$.select())};w.exports.useEffect(G,[y,t,p]);const V=()=>{switch(A){case _.dataType.DECIMAL:case _.dataType.INT:return h("div",{className:"goto-row-input",children:h("input",{ref:v,type:"number",className:z("form-control",{"is-invalid":n!==""}),onKeyDown:F,placeholder:"value",onChange:O=>k(O.target.value),value:p})});case _.dataType.DATETIME:return h("div",{className:"goto-value-date-time-input",children:h(Ld,{className:z("form-control","goto-value-date-time-input",{"is-invalid":n!==""}),onChange:k})});case _.dataType.STRING:return T(Te,{children:[h("div",{className:"goto-row-input",children:T("select",{className:"custom-select",onChange:O=>{f(O.target.value)},children:[h("option",{value:K.eq,children:"Equals"},K.eq),h("option",{value:K.contains,children:"Contains"},K.contains),h("option",{value:K.eqIgnoreCase,children:"EqIgnoreCase"},K.eqIgnoreCase)]})}),h("div",{className:"goto-row-input",children:h("input",{ref:v,className:z("form-control",{"is-invalid":n!==""}),onKeyDown:F,placeholder:"value",onChange:O=>k(O.target.value),value:p})})]});case _.dataType.BOOLEAN:return h("div",{className:"goto-row-input",children:T("select",{className:"custom-select",onChange:O=>{k(O.target.value)},value:p,children:[h("option",{value:"true",children:"true"},"true"),h("option",{value:"false",children:"false"},"false")]})});default:return h("div",{className:"goto-row-input",children:h("input",{ref:v,className:"form-control",onKeyDown:F,placeholder:"value",onChange:O=>k(O.target.value),value:p})})}};return h(ea,{isShown:i,className:z("goto-row"),onEntering:o,onEntered:()=>{r(),G()},onExiting:l,onExited:a,children:T(Te,{children:[T("div",{className:"goto-row-row",children:[T("div",{className:z("goto-row-wrapper",{"is-inactive":!y}),onClick:()=>E(!0),onFocus:()=>E(!0),role:"group",children:[h("div",{className:"goto-row-text",children:"Go to row"}),h("div",{className:"goto-row-input",children:h("input",{ref:S,type:"number",onKeyDown:O=>{O.key==="Enter"&&(O.stopPropagation(),O.preventDefault(),s())},className:z("form-control",{"is-invalid":e!==""}),placeholder:R,onChange:O=>{c(O)},value:t})}),T("div",{className:"goto-row-text",children:["of ",dh.i18n.NumberFormat.format(f1,N)]}),e&&h("div",{className:"text-danger",children:e})]}),h("div",{className:"goto-row-close",children:h(W,{kind:"ghost",onClick:u,children:h(ee,{icon:oo,style:{marginRight:"0"}})})})]}),d.isSeekRowAvailable&&h("div",{className:"goto-row-row",children:T("div",{className:z("goto-row-wrapper",{"is-inactive":y}),onClick:()=>E(!1),onFocus:()=>E(!1),role:"group",children:[h("div",{className:"goto-row-text",children:"Go to value"}),h("div",{className:"goto-row-input",children:h("select",{className:"custom-select",onChange:O=>{const $=O.target.value;g($)},value:m,children:I.map(O=>h("option",{value:O.name,children:O.name},O.name))})}),V(),T("div",{children:[h(W,{kind:"ghost",disabled:p==="",onClick:()=>{C(!0)},children:h(ee,{icon:Mu})}),h(W,{kind:"ghost",disabled:p==="",onClick:()=>{C(!1)},children:h(ee,{icon:gC})})]}),n&&h("div",{className:"text-danger",children:n})]})})]})})}const we=Z.module("IrisGrid"),b1=500,S1=250,w1=250,v1=250,Jp=Object.freeze({aggregations:[],showOnTop:!1}),T1="yyyy-MM-dd'T'HH:mm:ss.SSSSSSSSS z";function Kh({advancedFilters:t,aggregationSettings:e,customColumns:n,quickFilters:s,reverseType:i,rollupConfig:o,searchFilter:r,selectDistinctColumns:l,sorts:a}){return t.size===0&&e.aggregations.length===0&&n.length===0&&s.size===0&&i===_.REVERSE_TYPE.NONE&&o==null&&r==null&&l.length===0&&a.length===0}const Hs=class extends w.exports.Component{constructor(t){super(t),this.getAdvancedMenuOpenedHandler=be(V=>this.handleAdvancedMenuOpened.bind(this,V),{max:100}),this.getCachedAdvancedFilterMenuActions=be((V,O,$,Y,Q)=>h(ic,{model:V,column:O,onFilterChange:this.handleAdvancedFilterChange,onSortChange:this.handleAdvancedFilterSortChange,onDone:this.handleAdvancedFilterDone,options:$,sortDirection:Y,formatter:Q}),{max:50}),this.getCachedOptionItems=be((V,O,$,Y,Q,U,q,j,te,ce,ne,he,Ce,Re,He,lt)=>{const Ve=[];return V&&Ve.push({type:ke.CHART_BUILDER,title:"Chart Builder",icon:ab}),Ve.push({type:ke.VISIBILITY_ORDERING_BUILDER,title:"Hide, Group, and Order Columns",icon:Id}),$&&Ve.push({type:ke.CONDITIONAL_FORMATTING,title:"Conditional Formatting",icon:nr}),O&&Ve.push({type:ke.CUSTOM_COLUMN_BUILDER,title:"Custom Columns",icon:KC}),Y&&Ve.push({type:ke.ROLLUP_ROWS,title:"Rollup Rows",icon:Hu}),Q&&Ve.push({type:ke.AGGREGATIONS,title:"Aggregate Columns",icon:qC}),U&&Ve.push({type:ke.SELECT_DISTINCT,title:"Select Distinct Values",icon:GC}),q&&Ce&&Ve.push({type:ke.TABLE_EXPORTER,title:"Download CSV",icon:EC}),lt&&Ve.push({type:ke.ADVANCED_SETTINGS,title:"Advanced Settings",icon:XC}),Ve.push({type:ke.QUICK_FILTERS,title:"Quick Filters",subtitle:j.shortcut.getDisplayText(),icon:hl,isOn:ne,onChange:j.action}),Re&&Ve.push({type:ke.SEARCH_BAR,title:"Search Bar",subtitle:te.shortcut.getDisplayText(),icon:Lu,isOn:he,onChange:te.action}),Ve.push({type:ke.GOTO,title:"Go to",subtitle:ce.shortcut.getDisplayText(),icon:WC,isOn:He,onChange:ce.action}),Ve},{max:1}),this.getCachedHiddenColumns=be(V=>V,{max:1,normalizer:([V])=>V.join()}),this.getAggregationMap=be((V,O)=>{const $={};return O.forEach(({operation:Y,selected:Q,invert:U})=>{$[Y]=Bs.getOperationColumnNames(V,Y,Q,U)}),$}),this.getOperationMap=be((V,O)=>{const $={};return O.filter(Y=>!Bs.isRollupOperation(Y.operation)).forEach(({operation:Y,selected:Q,invert:U})=>{Bs.getOperationColumnNames(V,Y,Q,U).forEach(q=>{var te;const j=[...(te=$[q])!=null?te:[],Y];$[q]=j})}),$}),this.getOperationOrder=be(V=>V.map(O=>O.operation).filter(O=>!Bs.isRollupOperation(O))),this.getCachedFormatColumns=be((V,O)=>CT(V,O)),this.getCachedModelColumns=be((V,O)=>V.columns),this.getCachedPreviewFormatColumns=be((V,O,$,Y)=>{if(we.debug("getCachedPreviewFormatColumns",O,$,Y),$!==void 0&&Y!==void 0){const Q=[...O];return Q[Y]=$,this.getCachedFormatColumns(V,Q)}return this.getCachedFormatColumns(V,O)}),this.getModelRollupConfig=be((V,O,$)=>ie.getModelRollupConfig(V,O,$)),this.getModelTotalsConfig=be((V,O,$)=>{var j,te,ce;const{aggregations:Y,showOnTop:Q}=$;if(((te=(j=O==null?void 0:O.columns)==null?void 0:j.length)!=null?te:0)>0||((ce=Y==null?void 0:Y.length)!=null?ce:0)===0)return null;const U=this.getOperationMap(V,Y),q=this.getOperationOrder(Y);return{operationMap:U,operationOrder:q,showOnTop:Q}}),this.getCachedStateOverride=be((V,O,$,Y,Q,U,q,j,te,ce)=>({hoverSelectColumn:V,isFilterBarShown:O,isSelectingColumn:$,loadingScrimProgress:Y,quickFilters:Q,advancedFilters:U,sorts:q,reverseType:j,rollupConfig:te,isMenuShown:ce}),{max:1}),this.getCachedFilter=be((V,O,$,Y,Q)=>[...V!=null?V:[],...Y!=null?Y:[],...ie.getFiltersFromFilterMap(O),...ie.getFiltersFromFilterMap($),...Q!==void 0?[Q]:[]],{max:1}),this.getCachedTheme=be((V,O,$)=>({...Lp,...V,autoSelectRow:!O,rowFooterWidth:$>0?V.rowFooterWidth:0}),{max:1}),this.getAlwaysFetchColumns=be((V,O,$,Y,Q,U)=>{const q=[];for(let te=0;te<Y;te+=1)q.push(O[J.getModelIndex(te,$)].name);for(let te=0;te<Q;te+=1)q.push(O[J.getModelIndex(O.length-1-te,$)].name);if(U)for(let te=U[0];te<=U[1];te+=1)q.push(O[J.getModelIndex(te,$)].name);return[...new Set([...V,...q])]}),this.updateSearchFilter=Ze((V,O,$,Y)=>{const Q=Gr.createSearchFilter(V,O,$,Y);this.setState({searchFilter:Q})},S1),this.handleConditionalFormatEditorUpdate=Ze(V=>{this.setState({conditionalFormatPreview:V})},v1),this.handleDownloadProgressUpdate=Qn((V,O)=>{const{tableDownloadStatus:$}=this.state;$===rn.DOWNLOAD_STATUS.DOWNLOADING&&this.setState({tableDownloadProgress:V,tableDownloadEstimatedTime:O})},b1),this.getOverflowButtonTooltip=be(V=>{if(V==null)return null;const O={position:"absolute",...V,pointerEvents:"none"};return h("div",{style:O,children:h(Ye,{options:{placement:"left",modifiers:{flip:{behavior:["left","right"]}}},ref:this.handleTooltipRef,children:"View full contents"},Date.now())})}),this.handleGotoValueChanged=V=>{this.setState({gotoValue:V}),this.debouncedSeekRow(V)},this.debouncedSeekRow=Ze(V=>{this.seekRow(V)},w1),this.handleAdvancedFilterChange=this.handleAdvancedFilterChange.bind(this),this.handleAdvancedFilterSortChange=this.handleAdvancedFilterSortChange.bind(this),this.handleAdvancedFilterDone=this.handleAdvancedFilterDone.bind(this),this.handleAdvancedMenuOpened=this.handleAdvancedMenuOpened.bind(this),this.handleGotoRowOpened=this.handleGotoRowOpened.bind(this),this.handleGotoRowClosed=this.handleGotoRowClosed.bind(this),this.handleAdvancedMenuClosed=this.handleAdvancedMenuClosed.bind(this),this.handleAggregationChange=this.handleAggregationChange.bind(this),this.handleAggregationsChange=this.handleAggregationsChange.bind(this),this.handleAggregationEdit=this.handleAggregationEdit.bind(this),this.handleAnimationLoop=this.handleAnimationLoop.bind(this),this.handleAnimationStart=this.handleAnimationStart.bind(this),this.handleAnimationEnd=this.handleAnimationEnd.bind(this),this.handleChartChange=this.handleChartChange.bind(this),this.handleChartCreate=this.handleChartCreate.bind(this),this.handleGridError=this.handleGridError.bind(this),this.handleFilterBarChange=this.handleFilterBarChange.bind(this),this.handleFilterBarDone=this.handleFilterBarDone.bind(this),this.handleFilterBarTab=this.handleFilterBarTab.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleMenu=this.handleMenu.bind(this),this.handleMenuClose=this.handleMenuClose.bind(this),this.handleMenuSelect=this.handleMenuSelect.bind(this),this.handleMenuBack=this.handleMenuBack.bind(this),this.handleRequestFailed=this.handleRequestFailed.bind(this),this.handleSelectionChanged=this.handleSelectionChanged.bind(this),this.handleMovedColumnsChanged=this.handleMovedColumnsChanged.bind(this),this.handleHeaderGroupsChanged=this.handleHeaderGroupsChanged.bind(this),this.handleUpdate=this.handleUpdate.bind(this),this.handleTooltipRef=this.handleTooltipRef.bind(this),this.handleViewChanged=this.handleViewChanged.bind(this),this.handleFormatSelection=this.handleFormatSelection.bind(this),this.handleConditionalFormatCreate=this.handleConditionalFormatCreate.bind(this),this.handleConditionalFormatEdit=this.handleConditionalFormatEdit.bind(this),this.handleConditionalFormatsChange=this.handleConditionalFormatsChange.bind(this),this.handleConditionalFormatEditorSave=this.handleConditionalFormatEditorSave.bind(this),this.handleConditionalFormatEditorCancel=this.handleConditionalFormatEditorCancel.bind(this),this.handleUpdateCustomColumns=this.handleUpdateCustomColumns.bind(this),this.handleCustomColumnsChanged=this.handleCustomColumnsChanged.bind(this),this.handleSelectDistinctChanged=this.handleSelectDistinctChanged.bind(this),this.handlePendingDataUpdated=this.handlePendingDataUpdated.bind(this),this.handlePendingCommitClicked=this.handlePendingCommitClicked.bind(this),this.handlePendingDiscardClicked=this.handlePendingDiscardClicked.bind(this),this.handleGotoRowSelectedRowNumberSubmit=this.handleGotoRowSelectedRowNumberSubmit.bind(this),this.focusRowInGrid=this.focusRowInGrid.bind(this),this.handleDownloadTable=this.handleDownloadTable.bind(this),this.handleDownloadTableStart=this.handleDownloadTableStart.bind(this),this.handleCancelDownloadTable=this.handleCancelDownloadTable.bind(this),this.handleDownloadCanceled=this.handleDownloadCanceled.bind(this),this.handleDownloadCompleted=this.handleDownloadCompleted.bind(this),this.handlePartitionAppend=this.handlePartitionAppend.bind(this),this.handlePartitionChange=this.handlePartitionChange.bind(this),this.handlePartitionFetchAll=this.handlePartitionFetchAll.bind(this),this.handlePartitionDone=this.handlePartitionDone.bind(this),this.handleColumnVisibilityChanged=this.handleColumnVisibilityChanged.bind(this),this.handleCrossColumnSearch=this.handleCrossColumnSearch.bind(this),this.handleRollupChange=this.handleRollupChange.bind(this),this.handleOverflowClose=this.handleOverflowClose.bind(this),this.getColumnBoundingRect=this.getColumnBoundingRect.bind(this),this.handleGotoRowSelectedRowNumberChanged=this.handleGotoRowSelectedRowNumberChanged.bind(this),this.handleGotoValueSelectedColumnNameChanged=this.handleGotoValueSelectedColumnNameChanged.bind(this),this.handleGotoValueSelectedFilterChanged=this.handleGotoValueSelectedFilterChanged.bind(this),this.handleGotoValueChanged=this.handleGotoValueChanged.bind(this),this.handleGotoValueSubmitted=this.handleGotoValueSubmitted.bind(this),this.grid=null,this.gridWrapper=null,this.lastLoadedConfig=null,this.pending=new Ss,this.globalColumnFormats=[],this.decimalFormatOptions={},this.integerFormatOptions={},this.truncateNumbersWithPound=!1,this.renderer=new Wo,this.tableSaver=null,this.crossColumnRef=X.createRef(),this.isAnimating=!1,this.filterInputRef=X.createRef(),this.toggleFilterBarAction={action:()=>this.toggleFilterBar(),shortcut:an.TABLE.TOGGLE_QUICK_FILTER},this.toggleSearchBarAction={action:()=>this.toggleSearchBar(),shortcut:an.TABLE.TOGGLE_SEARCH},this.toggleGotoRowAction={action:()=>this.toggleGotoRow(),shortcut:an.TABLE.GOTO_ROW},this.discardAction={action:()=>{const{model:V}=this.props;tt(V)&&V.isEditable&&V.pendingDataMap.size>0&&this.discardPending().catch(we.error)},shortcut:an.INPUT_TABLE.DISCARD},this.commitAction={action:()=>{const{model:V}=this.props;tt(V)&&V.isEditable&&V.pendingDataMap.size>0&&V.pendingDataErrors.size===0&&this.commitPending().catch(we.error)},shortcut:an.INPUT_TABLE.COMMIT},this.contextActions=[this.toggleFilterBarAction,this.toggleSearchBarAction,this.toggleGotoRowAction,this.discardAction,this.commitAction];const{aggregationSettings:e,conditionalFormats:n,customColumnFormatMap:s,isFilterBarShown:i,isSelectingPartition:o,model:r,movedColumns:l,movedRows:a,partition:d,partitionColumn:c,rollupConfig:u,userColumnWidths:m,userRowHeights:p,showSearchBar:g,searchValue:f,selectedSearchColumns:b,invertSearchColumns:C,advancedFilters:S,quickFilters:v,selectDistinctColumns:y,pendingDataMap:E,canCopy:I,frozenColumns:R,columnHeaderGroups:N}=t,F=[new FT(this),new xT(this)];I&&F.push(new DT(this));const P=[new _T(this),new kT(this),new OT(this),new HT(this),new PT(this),new vs(this),new AT(this),new VT(this)],H=l.length>0?l:r.initialMovedColumns,x=a.length>0?a:r.initialMovedRows,A=new $T({userColumnWidths:new Map(m),userRowHeights:new Map(p),movedColumns:H}),k=b!=null?b:[],G=Gr.createSearchFilter(f,k,r.columns,C);this.state={isFilterBarShown:i,isSelectingPartition:o,focusedFilterBarColumn:null,metricCalculator:A,metrics:void 0,keyHandlers:F,mouseHandlers:P,partition:d,partitionColumn:c,partitionTable:null,partitionFilters:[],quickFilters:v?new Map(v):new Map,advancedFilters:new Map(S),shownAdvancedFilter:null,hoverAdvancedFilter:null,sorts:[],reverseType:_.REVERSE_TYPE.NONE,customColumns:[],selectDistinctColumns:y,selectedRanges:[],copyOperation:null,loadingText:null,loadingScrimProgress:null,loadingSpinnerShown:!1,movedColumns:H,movedRows:x,shownColumnTooltip:null,formatter:new cn,isMenuShown:!1,customColumnFormatMap:new Map(s),conditionalFormats:n,conditionalFormatEditIndex:null,conditionalFormatPreview:void 0,hoverSelectColumn:null,isTableDownloading:!1,isReady:!1,tableDownloadStatus:"",tableDownloadProgress:0,tableDownloadEstimatedTime:0,showSearchBar:g,searchFilter:G,searchValue:f,selectedSearchColumns:k,invertSearchColumns:C,rollupConfig:u,rollupSelectedColumns:[],aggregationSettings:e,selectedAggregation:null,openOptions:[],pendingRowCount:0,pendingDataMap:E!=null?E:new Map,pendingDataErrors:new Map,pendingSavePromise:null,pendingSaveError:null,toastMessage:null,frozenColumns:R,showOverflowModal:!1,overflowText:"",overflowButtonTooltipProps:null,isGotoShown:!1,gotoRow:"",gotoRowError:"",gotoValueError:"",gotoValueSelectedColumnName:r.columns[0].name,gotoValueSelectedFilter:K.eq,gotoValue:"",columnHeaderGroups:N!=null?N:r.initialColumnHeaderGroups}}static makeQuickFilter(t,e,n){try{return _.makeQuickFilter(t,e,n)}catch(s){we.error("Error creating quick filter",s)}return null}componentDidMount(){const{partitionColumn:t,model:e}=this.props,n=t!=null?t:e.columns.find(s=>s.isPartitionColumn);e.isFilterRequired&&e.isValuesTableAvailable&&n!=null?this.loadPartitionsTable(n):this.initState(),this.startListening(e)}componentDidUpdate(t){var c;const{inputFilters:e,isSelectingColumn:n,settings:s,model:i,customFilters:o,sorts:r}=this.props;i!==t.model&&(this.stopListening(t.model),this.startListening(i));const l=e!==t.inputFilters?e.filter(u=>!t.inputFilters.includes(u)):[];if(l.length>0){const{advancedSettings:u}=this.props,m=(c=u.get(Si.FILTER_CONTROL_CHANGE_CLEARS_ALL_FILTERS))!=null?c:!1;m&&(this.clearGridInputField(),this.clearCrossColumSearch()),this.startLoading("Filtering...",!0),this.applyInputFilters(l,m)}n!==t.isSelectingColumn&&this.resetColumnSelection(),s!==t.settings&&this.updateFormatterSettings(s),o!==t.customFilters&&this.startLoading("Filtering...",!0),r!==t.sorts&&this.updateSorts(r);const{loadingScrimStartTime:a,loadingScrimFinishTime:d}=this;a!=null&&d!=null&&window.requestAnimationFrame(()=>{const u=Date.now(),m=u-a,p=d-a,g=Math.min(m/p,1);d<u&&(this.loadingScrimStartTime=void 0,this.loadingScrimFinishTime=void 0),this.setState(f=>f.loadingScrimProgress==null?(we.debug2("Ignoring scrim update because loading cancelled."),null):{loadingScrimProgress:g})}),this.sendStateChange()}componentWillUnmount(){const{model:t}=this.props;this.stopListening(t),this.pending.cancel(),this.updateSearchFilter.cancel(),this.loadingTimer&&clearTimeout(this.loadingTimer),this.handleDownloadProgressUpdate.cancel(),this.animationFrame!==void 0&&cancelAnimationFrame(this.animationFrame)}getValueForCell(t,e,n=!1){const{model:s}=this.props,i=this.getModelColumn(t),o=this.getModelRow(e);if(n&&i!=null&&o!=null){const r=s.valueForCell(i,o);if(_.isDateType(s.columns[i].type)){const{formatter:l}=s;return M.i18n.DateTimeFormat.format(T1,r,M.i18n.TimeZone.getTimeZone(l.timeZone))}return r}return n?null:i!=null&&o!=null?s.textForCell(i,o):""}getModelColumn(t){const{metrics:e}=this.state;L(e);const{modelColumns:n}=e;return n==null?null:t!=null?n.get(t):null}getModelRow(t){const{metrics:e}=this.state;L(e);const{modelRows:n}=e;return n==null?null:t!=null?n.get(t):null}getTheme(){var n;const{model:t,theme:e}=this.props;return this.getCachedTheme(e,(n=tt(t)&&t.isEditable)!=null?n:!1,t.floatingTopRowCount+t.floatingBottomRowCount)}getVisibleColumn(t){const{movedColumns:e}=this.state;return J.getVisibleIndex(t,e)}applyInputFilters(t,e=!1){const{model:n}=this.props,{advancedFilters:s,quickFilters:i}=this.state,o=e?new Map:new Map(s),r=e?new Map:new Map(i);let l=e&&s.size>0;t.forEach(({name:a,type:d,value:c})=>{const u=n.columns.findIndex(({name:m,type:p})=>m===a&&p===d);u>=0?(l=o.delete(u)||l,l=this.applyQuickFilter(u,c,r)||l):we.error("Unable to find column for inputFilter",a,d,c)}),l&&this.setState({quickFilters:r,advancedFilters:o})}applyQuickFilter(t,e,n){const{model:s}=this.props,{formatter:i}=s,o=s.columns[t];if(e!=null&&`${e}`.trim().length>0){const r=n.get(t);if(r!=null){const{text:l}=r;if(l===e)return we.debug2("Ignoring change to existing filter"),!1}return n.set(t,{text:e,filter:Hs.makeQuickFilter(o,e,i.timeZone)}),!0}return n.delete(t)}setAdvancedFilterMap(t){this.setState({advancedFilters:t})}setAdvancedFilter(t,e,n){we.debug("Setting advanced filter",t,e),this.startLoading("Filtering...",!0),this.setState(({advancedFilters:s})=>{const i=new Map(s);return e==null?i.delete(t):i.set(t,{filter:e,options:n}),{advancedFilters:i}})}setQuickFilter(t,e,n){we.debug("Setting quick filter",t,e,n),this.startLoading("Filtering...",!0),this.setState(({quickFilters:s})=>{const i=new Map(s);return i.set(t,{filter:e,text:n}),{quickFilters:i}})}setFilterMap(t){var i;we.debug("setFilterMap",t);const{advancedSettings:e}=this.props;((i=e.get(Si.LINK_CHANGE_CLEARS_ALL_FILTERS))!=null?i:!1)&&this.clearAllFilters();const{model:s}=this.props;t.forEach(({columnType:o,filterList:r},l)=>{const a=s.columns.find(u=>u.name===l&&u.type===o);if(a==null)return;const d=s.getColumnIndexByName(a.name);L(d);const c=ie.combineFiltersFromList(o,r);if(c.length===0)this.removeQuickFilter(d);else{const{formatter:u}=s;this.setQuickFilter(d,Hs.makeQuickFilter(a,c,u.timeZone),`${c}`)}})}removeColumnFilter(t){this.startLoading("Filtering...",!0),this.setState(({advancedFilters:e,quickFilters:n})=>{const s=e?new Map(e):new Map,i=n?new Map(n):new Map;return i.delete(t),s.delete(t),{quickFilters:i,advancedFilters:s}})}removeQuickFilter(t){this.startLoading("Clearing Filter...",!0),this.setState(({quickFilters:e})=>{const n=new Map(e);return n.delete(t),{quickFilters:n}})}clearAllFilters(){we.debug("Clearing all filters");const{advancedFilters:t,quickFilters:e,searchFilter:n}=this.state;e.size===0&&t.size===0&&n===null||(this.clearGridInputField(),this.startLoading("Clearing Filters...",!0),this.setState({quickFilters:new Map,advancedFilters:new Map,searchValue:"",searchFilter:void 0}))}clearCrossColumSearch(){we.debug("Clearing cross-column search"),this.setState({searchValue:"",searchFilter:void 0})}clearGridInputField(){this.filterInputRef.current!=null&&this.filterInputRef.current.setValue("")}rebuildFilters(){we.debug("Rebuilding filters");const{model:t}=this.props,{advancedFilters:e,quickFilters:n}=this.state,{columns:s,formatter:i}=t,o=new Map,r=new Map;e.forEach((l,a)=>{const{options:d}=l,c=s[a],u=_.makeAdvancedFilter(c,d,i.timeZone);o.set(a,{options:d,filter:u})}),n.forEach((l,a)=>{const{text:d}=l,c=s[a];r.set(a,{text:d,filter:Hs.makeQuickFilter(c,d,i.timeZone)})}),this.startLoading("Rebuilding filters...",!0),this.setState({quickFilters:r,advancedFilters:o})}setFilters({quickFilters:t,advancedFilters:e}){this.setState({quickFilters:t,advancedFilters:e})}updateFormatterSettings(t,e=!0){var m,p,g;const n=Cs.getColumnFormats(t),s=Cs.getDateTimeFormatterOptions(t),i=(m=t==null?void 0:t.defaultDecimalFormatOptions)!=null?m:{},o=(p=t==null?void 0:t.defaultIntegerFormatOptions)!=null?p:{},r=(g=t==null?void 0:t.truncateNumbersWithPound)!=null?g:!1,l=!ut(this.globalColumnFormats,n),a=!ut(this.dateTimeFormatterOptions,s),d=!ut(this.decimalFormatOptions,t==null?void 0:t.defaultDecimalFormatOptions),c=!ut(this.integerFormatOptions,o),u=this.truncateNumbersWithPound!==r;(l||a||d||c||u)&&(this.globalColumnFormats=n,this.dateTimeFormatterOptions=s,this.decimalFormatOptions=i,this.integerFormatOptions=o,this.truncateNumbersWithPound=r,this.updateFormatter({},e),a&&e&&this.rebuildFilters())}updateFormatter(t,e=!0){var r;const{customColumnFormatMap:n}=this.state,s={customColumnFormatMap:n,...t},i=[...(r=this.globalColumnFormats)!=null?r:[],...s.customColumnFormatMap.values()],o=new cn(i,this.dateTimeFormatterOptions,this.decimalFormatOptions,this.integerFormatOptions,this.truncateNumbersWithPound);we.debug("updateFormatter",this.globalColumnFormats,i),this.setState({...s,formatter:o},()=>{e&&this.grid&&this.grid.forceUpdate()})}initFormatter(){const{settings:t}=this.props;this.updateFormatterSettings(t)}initState(){const{applyInputFiltersOnInit:t,inputFilters:e,sorts:n,model:s,reverseType:i,customColumns:o,searchValue:r,selectedSearchColumns:l,invertSearchColumns:a}=this.props,d=l!=null?l:[],c=Gr.createSearchFilter(r,d,s.columns,a);if(t){const u=e.filter(m=>m.value!=null);this.applyInputFilters(u)}this.setState({sorts:n,reverseType:i,customColumns:o,isReady:!0,searchFilter:c}),this.initFormatter()}async loadPartitionsTable(t){const{model:e}=this.props;this.setState({isSelectingPartition:!0});try{const n=await this.pending.add(e.valuesTable(t),r=>r.close()),s=n.columns[0],i=s.sort().desc();n.applySort([i]),n.setViewport(0,0,[s]);const o=await this.pending.add(n.getViewportData());if(o.rows.length>0){const l=o.rows[0].get(s);this.updatePartition(l,t),this.setState({isSelectingPartition:!0})}else we.info("Table does not have any data, just fetching all"),this.setState({isSelectingPartition:!1}),this.handlePartitionFetchAll();this.setState({partitionTable:n,partitionColumn:t},()=>{this.initState()})}catch(n){this.handleTableLoadError(n)}}updatePartition(t,e){const s=[e.filter().eq(M.FilterValue.ofString(t))];this.setState({partition:t,partitionFilters:s})}copyCell(t,e,n=!1){const{canCopy:s}=this.props;if(s){const i=String(this.getValueForCell(t,e,n));ro(i).catch(o=>we.error("Unable to copy cell",o))}else we.error("Attempted to copyCell for user without copy permission.")}copyRanges(t,e=!1,n=!0,s){const{model:i,canCopy:o}=this.props,{metricCalculator:r,movedColumns:l}=this.state,a=r.getUserColumnWidths();if(o){const d={ranges:de.boundedRanges(t,i.columnCount,i.rowCount),includeHeaders:e,formatValues:n,movedColumns:l,userColumnWidths:a,error:s};this.setState({copyOperation:d})}else we.error("Attempted copyRanges for user without copy permission.")}startLoading(t,e=!1){var s,i;this.setState({loadingText:t});const n=this.getTheme();if(e&&this.grid&&(this.grid.clearSelectedRanges(),this.grid.setViewState({top:0},!0)),this.loadingScrimStartTime==null){const{minScrimTransitionTime:o,maxScrimTransitionTime:r}=n;L(o),L(r);const l=(i=(s=this.gridWrapper)==null?void 0:s.getBoundingClientRect().height)!=null?i:0,a=Math.max(o,Math.min(l/2,r));this.loadingScrimStartTime=Date.now(),this.loadingScrimFinishTime=this.loadingScrimStartTime+a,this.setState({loadingScrimProgress:0}),this.loadingTimer=setTimeout(()=>{this.setState({loadingSpinnerShown:!0})},Hs.loadingSpinnerDelay)}}stopLoading(){this.loadingScrimStartTime=void 0,this.loadingScrimFinishTime=void 0,this.setState({loadingText:null,loadingScrimProgress:null,loadingSpinnerShown:!1}),this.loadingTimer!=null&&(clearTimeout(this.loadingTimer),this.loadingTimer=void 0)}rollback(){if(this.lastLoadedConfig){we.debug("loading last loading config",this.lastLoadedConfig);const{advancedFilters:t,aggregationSettings:e,customColumns:n,quickFilters:s,reverseType:i,rollupConfig:o,searchFilter:r,selectDistinctColumns:l,sorts:a}=this.lastLoadedConfig;this.lastLoadedConfig=null,this.setState({advancedFilters:t,aggregationSettings:e,customColumns:n,quickFilters:s,reverseType:i,rollupConfig:o,searchFilter:r,selectDistinctColumns:l,sorts:a})}else we.debug("remove all sorts, filters, and custom columns"),this.setState({advancedFilters:new Map,aggregationSettings:Jp,customColumns:[],quickFilters:new Map,reverseType:_.REVERSE_TYPE.NONE,rollupConfig:void 0,selectDistinctColumns:[],sorts:[]})}canRollback(){return this.lastLoadedConfig!=null||!Kh(this.state)}startListening(t){t.addEventListener(ve.EVENT.UPDATED,this.handleUpdate),t.addEventListener(ve.EVENT.REQUEST_FAILED,this.handleRequestFailed),t.addEventListener(ve.EVENT.COLUMNS_CHANGED,this.handleCustomColumnsChanged),t.addEventListener(ve.EVENT.PENDING_DATA_UPDATED,this.handlePendingDataUpdated)}stopListening(t){t.removeEventListener(ve.EVENT.UPDATED,this.handleUpdate),t.removeEventListener(ve.EVENT.REQUEST_FAILED,this.handleRequestFailed),t.removeEventListener(ve.EVENT.COLUMNS_CHANGED,this.handleCustomColumnsChanged),t.removeEventListener(ve.EVENT.PENDING_DATA_UPDATED,this.handlePendingDataUpdated)}focus(){var t;(t=this.grid)==null||t.focus()}focusFilterBar(t){var c,u,m;const{movedColumns:e}=this.state,{model:n}=this.props,{columnCount:s}=n,i=J.getModelIndex(t,e);if(t==null||t<0||s<=t||!n.isFilterable(i)){this.setState({focusedFilterBarColumn:null});return}const{metricCalculator:o,metrics:r}=this.state;L(r);const{left:l,rightVisible:a,lastLeft:d}=r;if(t<l)(c=this.grid)==null||c.setViewState({left:t},!0);else if(a<t){const p=(u=this.grid)==null?void 0:u.getMetricState();L(p);const g=o.getLastLeft(p,t,o.getVisibleWidth(p));(m=this.grid)==null||m.setViewState({left:Math.min(g,d),leftOffset:0},!0)}this.lastFocusedFilterBarColumn=t,this.setState({focusedFilterBarColumn:t,isFilterBarShown:!0})}hideColumnByVisibleIndex(t){var s;const{metricCalculator:e,movedColumns:n}=this.state;e.setColumnWidth(J.getModelIndex(t,n),0),(s=this.grid)==null||s.forceUpdate()}freezeColumnByColumnName(t){const{frozenColumns:e,movedColumns:n}=this.state,{model:s}=this.props;we.debug2("freezing column",t);const i=e==null?new Set(s.frozenColumns):new Set(e);i.add(t);const o=s.getColumnIndexByName(t);L(o);const r=J.getVisibleIndex(o,n),l=J.moveItem(r,i.size-1,n);this.setState({frozenColumns:[...i],movedColumns:l})}unFreezeColumnByColumnName(t){const{frozenColumns:e,movedColumns:n}=this.state,{model:s}=this.props;we.debug2("unfreezing column",t);const i=e==null?new Set(s.frozenColumns):new Set(e);i.delete(t);const o=s.getColumnIndexByName(t);L(o);const r=J.getVisibleIndex(o,n),l=J.moveItem(r,i.size+s.frontColumns.length,n);this.setState({frozenColumns:[...i],movedColumns:l})}handleColumnVisibilityChanged(t,e){var s;const{metricCalculator:n}=this.state;e?t.forEach(i=>{n.resetColumnWidth(i)}):t.forEach(i=>{n.setColumnWidth(i,0)}),(s=this.grid)==null||s.forceUpdate()}handleCrossColumnSearch(t,e,n){const{model:s}=this.props;this.updateSearchFilter(t,e,s.columns,n),this.setState({searchValue:t,selectedSearchColumns:e,invertSearchColumns:n})}handleAnimationLoop(){var t,e;(t=this.grid)==null||t.updateCanvasScale(),(e=this.grid)==null||e.updateCanvas(),this.isAnimating&&(this.animationFrame=requestAnimationFrame(this.handleAnimationLoop))}handleAnimationStart(){we.debug2("handleAnimationStart"),this.isAnimating=!0,this.animationFrame=requestAnimationFrame(this.handleAnimationLoop)}handleAnimationEnd(){we.debug2("handleAnimationEnd"),this.isAnimating=!1}handlePartitionAppend(t){const{onPartitionAppend:e}=this.props,{partitionColumn:n}=this.state;!n||e(n,t)}handlePartitionChange(t){const{partitionColumn:e}=this.state;!e||this.updatePartition(t,e)}handlePartitionFetchAll(){this.setState({partitionFilters:[],isSelectingPartition:!1})}handlePartitionDone(){this.setState({isSelectingPartition:!1})}handleTableLoadError(t){if(ye.isCanceled(t))return;we.error(t);const{onError:e}=this.props;e(t)}showAllColumns(){var s;const{metricCalculator:t}=this.state,n=[...t.getUserColumnWidths().entries()];for(let i=0;i<n.length;i+=1){const[o,r]=n[i];r===0&&t.resetColumnWidth(o)}(s=this.grid)==null||s.forceUpdate()}toggleSort(t,e){we.info("Toggling sort for column",t);const{model:n}=this.props,{sorts:s}=this.state,i=this.getModelColumn(t);L(i);const o=_.toggleSortForColumn(s,n.columns,i,e);this.updateSorts(o)}updateSorts(t){var e;this.startLoading("Sorting..."),this.setState({sorts:t}),(e=this.grid)==null||e.forceUpdate()}sortColumn(t,e=_.sortDirection.none,n=!1,s=!1){var r;L(t);const{model:i}=this.props,o=_.sortColumn(i.sort,i.columns,t,e,n,s);this.startLoading("Sorting..."),this.setState({sorts:o}),(r=this.grid)==null||r.forceUpdate()}reverse(t){var e;this.startLoading("Reversing..."),this.setState({reverseType:t}),(e=this.grid)==null||e.forceUpdate()}isReversible(){const{model:t}=this.props;return t.isReversible}toggleFilterBar(t=this.lastFocusedFilterBarColumn){var n;let{isFilterBarShown:e}=this.state;if(e=!e,this.setState({isFilterBarShown:e}),e)if(t!=null)this.focusFilterBar(t);else{let s=0;const{model:i}=this.props,{columnCount:o}=i;for(let r=0;r<o;r+=1){const l=this.getModelColumn(r);if(l!=null){const a=i.columns[l];if(a!=null&&_.isTextType(a.type)){s=r;break}}}this.focusFilterBar(s)}else(n=this.grid)==null||n.focus()}isTableSearchAvailable(){var s,i,o;const{model:t,canToggleSearch:e}=this.props,n=(s=t==null?void 0:t.layoutHints)==null?void 0:s.searchDisplayMode;return n===((i=M.SearchDisplayMode)==null?void 0:i.SEARCH_DISPLAY_HIDE)?!1:n===((o=M.SearchDisplayMode)==null?void 0:o.SEARCH_DISPLAY_SHOW)?!0:e}toggleSearchBar(){const{showSearchBar:t}=this.state;if(!this.isTableSearchAvailable())return;const e=!t;this.setState({showSearchBar:e},()=>{var n,s,i;e&&((n=this.crossColumnRef)==null?void 0:n.current)?(s=this.crossColumnRef)==null||s.current.focus():(i=this.grid)==null||i.focus()})}toggleGotoRow(t="",e="",n=""){const{isGotoShown:s}=this.state;if(t||e){this.setState({isGotoShown:!0,gotoRow:t,gotoValue:e,gotoValueSelectedColumnName:n,gotoRowError:"",gotoValueError:""}),this.focusRowInGrid(t);return}this.setState({isGotoShown:!s,gotoRow:"",gotoValue:"",gotoRowError:"",gotoValueError:""})}async commitPending(){var i,o;const{model:t}=this.props;if(!tt(t)||!t.isEditable)throw new Error("Cannot save, table is not editable");const{pendingSavePromise:e}=this.state;if(e!=null)throw new Error("Save already in progress");const n=(i=document==null?void 0:document.activeElement)==null?void 0:i.classList.contains("grid-cell-input-field");if(n!=null&&n){if(document.activeElement!=null&&document.activeElement.classList.contains("error"))throw new Ki("Current input is invalid");(o=this.grid)==null||o.focus()}const s=this.pending.add(t.commitPending()).then(()=>{this.setState({pendingSaveError:null,pendingSavePromise:null})}).catch(r=>{ye.isCanceled(r)||this.setState({pendingSaveError:r,pendingSavePromise:null})});return this.setState({pendingSavePromise:s}),s}async discardPending(){const{pendingSavePromise:t}=this.state;if(t!=null)throw new Error("Cannot cancel a save in progress");this.setState({pendingSavePromise:null,pendingSaveError:null,pendingDataMap:new Map,pendingDataErrors:new Map})}selectColumn(t){const{onColumnSelected:e}=this.props;e(t)}selectData(t,e){const{model:n}=this.props,{columns:s,groupedColumns:i}=n,o={};for(let l=0;l<s.length;l+=1){const a=s[l],{name:d,type:c}=a,u=n.valueForCell(l,e),m=n.textForCell(l,e),p=this.getVisibleColumn(l),g=gt(n)&&n.isRowExpandable(e),f=i.find(b=>b.name===d)!=null;o[d]={value:u,text:m,type:c,isGrouped:f,isExpandable:g,visibleIndex:p}}const{onDataSelected:r}=this.props;r(e,o)}handleAdvancedFilterChange(t,e,n){const{model:s}=this.props,i=s.getColumnIndexByName(t.name);L(i),this.setAdvancedFilter(i,e,n)}handleAdvancedFilterSortChange(t,e,n=!1){var a;const{model:s}=this.props,i=s.getColumnIndexByName(t.name);L(i);const o=_.getSortForColumn(s.sort,i);let r=null;(o==null||o.direction!==e)&&(e===_.sortDirection.descending?r=t.sort().desc():r=t.sort().asc());const l=_.setSortForColumn(s.sort,i,r,n);we.info("Setting table sorts",l),this.startLoading("Sorting..."),this.setState({sorts:l}),(a=this.grid)==null||a.forceUpdate()}handleAdvancedFilterDone(){var t;(t=this.grid)==null||t.focus()}handleAdvancedMenuOpened(t){this.setState({shownAdvancedFilter:t})}handleGotoRowOpened(){this.setState({isGotoShown:!0})}handleGotoRowClosed(){this.setState({isGotoShown:!1})}handleAdvancedMenuClosed(t){var s,i;const{focusedFilterBarColumn:e,isFilterBarShown:n}=this.state;n&&e===t&&((s=this.filterInputRef)==null?void 0:s.current)!==null?((i=this.filterInputRef)==null||i.current.focus(),this.setState({shownAdvancedFilter:null})):this.setState({focusedFilterBarColumn:null,shownAdvancedFilter:null})}handleCancel(){this.rollback()}handleChartChange(){}handleChartCreate(t){const{model:e,onCreateChart:n}=this.props;n(t,e)}handleGridError(t){we.warn("Grid Error",t),this.setState({toastMessage:h("div",{className:"error-message",children:`${t}`})})}handleFilterBarChange(t){this.startLoading("Filtering...",!0),this.setState(({focusedFilterBarColumn:e,quickFilters:n})=>{const s=new Map(n);if(e!=null){const i=this.getModelColumn(e);L(i),this.applyQuickFilter(i,t,s)}return{quickFilters:s}})}handleFilterBarDone(t=!0,e=!0){var n;t&&((n=this.grid)==null||n.focus()),e&&this.setState({focusedFilterBarColumn:null})}handleFilterBarTab(t){const{focusedFilterBarColumn:e}=this.state;L(e),t?this.focusFilterBar(e-1):this.focusFilterBar(e+1)}handleFormatSelection(t,e){const{model:n}=this.props,s=n.columns[t],{customColumnFormatMap:i}=this.state,o=new Map(i);if(e!=null){const r=_.getNormalizedType(s.type);L(r);const l=cn.makeColumnFormattingRule(r,s.name,e);o.set(s.name,l)}else o.delete(s.name);this.updateFormatter({customColumnFormatMap:o})}handleMenu(t){t.stopPropagation(),this.setState({isMenuShown:!0})}handleMenuClose(){this.setState({isMenuShown:!1,openOptions:[]})}handleMenuBack(){this.setState(({openOptions:t})=>{const e=[...t];return e.pop(),{openOptions:e}})}handleMenuSelect(t){this.setState(({openOptions:e})=>({openOptions:[...e,t]}))}handleRequestFailed(t){const e=t;if(we.error("request failed:",e.detail),this.stopLoading(),this.canRollback())this.startLoading("Rolling back changes...",!0),this.rollback();else{we.error("Table failed and unable to rollback");const{onError:n}=this.props;n(new Error(`Error displaying table: ${e.detail}`))}}handleUpdate(){var c;this.stopLoading(),we.debug2("Received model update");const{advancedFilters:t,aggregationSettings:e,customColumns:n,quickFilters:s,reverseType:i,rollupConfig:o,searchFilter:r,selectDistinctColumns:l,sorts:a}=this.state,d={advancedFilters:t,aggregationSettings:e,customColumns:n,quickFilters:s,reverseType:i,rollupConfig:o,searchFilter:r,selectDistinctColumns:l,sorts:a};Kh(d)?this.lastLoadedConfig=null:this.lastLoadedConfig=d,(c=this.grid)==null||c.forceUpdate()}handleViewChanged(t){var i,o;const{model:e}=this.props,{selectionEndRow:n=0}=(o=(i=this.grid)==null?void 0:i.state)!=null?o:{};let s=0;if(tt(e)&&e.isEditable){L(t);const{bottomViewport:r}=t,l=e.rowCount-e.floatingBottomRowCount;n===l-1?s=e.pendingRowCount+1:n===l-2?s=e.pendingRowCount:s=Math.max(0,r-(e.rowCount-e.pendingRowCount)-e.floatingTopRowCount-e.floatingBottomRowCount-1)}this.setState({metrics:t,pendingRowCount:s})}handleSelectionChanged(t){L(t);const{onSelectionChanged:e}=this.props,{copyOperation:n}=this.state;this.setState({selectedRanges:t}),n!=null&&this.setState({copyOperation:null}),e(t)}handleMovedColumnsChanged(t,e){this.setState({movedColumns:t},e)}handleHeaderGroupsChanged(t){const{model:e}=this.props;this.setState({columnHeaderGroups:ie.parseColumnHeaderGroups(e,t).groups},()=>{var n;return(n=this.grid)==null?void 0:n.forceUpdate()})}handleTooltipRef(t){t!=null&&t.startTimer(),this.tooltip=t}handleConditionalFormatsChange(t){we.debug("Updated conditional formats",t),this.setState({conditionalFormats:t})}handleConditionalFormatCreate(){we.debug("Create new conditional format");const{openOptions:t,conditionalFormats:e}=this.state;this.setState({openOptions:[...t,{type:ke.CONDITIONAL_FORMATTING_EDIT,title:"Create Formatting Rule"}],conditionalFormatEditIndex:e.length,conditionalFormatPreview:void 0})}handleConditionalFormatEdit(t){we.debug("Edit conditional format",t);const{openOptions:e,conditionalFormats:n}=this.state;this.setState({openOptions:[...e,{type:ke.CONDITIONAL_FORMATTING_EDIT,title:"Edit Formatting Rule"}],conditionalFormatEditIndex:t,conditionalFormatPreview:{...n[t]}})}handleConditionalFormatEditorSave(t){we.debug("Save conditional format changes",t),this.setState(e=>{if(e.conditionalFormatEditIndex===null)return we.debug("Invalid format index"),null;const n=[...e.conditionalFormats];return n[e.conditionalFormatEditIndex]=t,{conditionalFormats:n}},()=>{this.handleMenuBack()})}handleConditionalFormatEditorCancel(){this.handleMenuBack(),this.setState({conditionalFormatEditIndex:null})}handleUpdateCustomColumns(t){we.info("handleUpdateCustomColumns:",t);const{model:e}=this.props,{movedColumns:n,sorts:s,quickFilters:i,advancedFilters:o,selectDistinctColumns:r}=this.state,{columns:l}=e,a=e.customColumns.map(c=>`${c}`),d=ie.getRemovedCustomColumnNames(a,t);if(d.length>0){const c=ie.removeSortsInColumns(s,d),u=ie.removeFiltersInColumns(l,i,d),m=ie.removeFiltersInColumns(l,o,d),p=ie.removeColumnFromMovedColumns(l,n,d),g=ie.removeColumnsFromSelectDistinctColumns(r,d);c.length!==s.length&&(we.debug("removing sorts from removed custom columns..."),this.setState({sorts:c})),(u.size!==i.size||m.size!==o.size)&&(we.debug("removing filters from removed custom columns..."),this.setState({quickFilters:u,advancedFilters:m})),ut(n,p)||(we.debug("change moved columns for removed custom columns",p),this.setState({movedColumns:p})),ut(r,g)||(we.debug("change selectDistinct columns for removed custom columns",p),this.setState({selectDistinctColumns:g}))}this.setState({customColumns:t}),t.length>0&&this.startLoading("Applying custom columns...")}handleCustomColumnsChanged(){var e;we.debug("custom columns changed");const{isReady:t}=this.state;t?(this.stopLoading(),(e=this.grid)==null||e.forceUpdate()):this.initState()}handlePendingCommitClicked(){return this.commitPending()}handlePendingDiscardClicked(){return this.discardPending()}handlePendingDataUpdated(){var s;we.debug("pending data updated");const{model:t}=this.props,{pendingDataMap:e,pendingDataErrors:n}=t;this.setState({pendingDataMap:e,pendingDataErrors:n,pendingSaveError:null}),(s=this.grid)==null||s.forceUpdate()}handleAggregationsChange(t){we.debug("handleAggregationsChange",t),this.startLoading(`Aggregating ${t.aggregations.map(e=>e.operation).join(", ")}...`),this.setState({aggregationSettings:t})}handleAggregationChange(t){we.debug("handleAggregationChange",t),this.startLoading(`Aggregating ${t.operation}...`),this.setState(({aggregationSettings:e})=>({selectedAggregation:t,aggregationSettings:{...e,aggregations:e.aggregations.map(n=>n.operation===t.operation?t:n)}}))}handleAggregationEdit(t){we.debug("handleAggregationEdit",t);const{openOptions:e}=this.state;this.setState({openOptions:[...e,{type:ke.AGGREGATION_EDIT,title:`Edit Columns to ${t.operation}`}],selectedAggregation:t})}handleRollupChange(t){var e,n;we.info("Rollup change",t),this.resetGridViewState(),this.showAllColumns(),this.clearAllFilters(),this.startLoading(`Grouping by columns ${(n=(e=t==null?void 0:t.columns)==null?void 0:e.join(", "))!=null?n:""}...`),this.setState({rollupConfig:t,movedColumns:[],sorts:[],reverseType:_.REVERSE_TYPE.NONE,selectDistinctColumns:[]})}handleSelectDistinctChanged(t){we.debug("SelectDistinct change",t),this.resetGridViewState(),this.showAllColumns(),this.clearAllFilters(),this.startLoading(`Selecting distinct values in ${t.length>0?t.join(", "):""}...`),this.setState({selectDistinctColumns:t,movedColumns:[],sorts:[],reverseType:_.REVERSE_TYPE.NONE})}handleDownloadTableStart(){const{canDownloadCsv:t}=this.props;t?this.setState({isTableDownloading:!0,tableDownloadProgress:0,tableDownloadEstimatedTime:null,tableDownloadStatus:rn.DOWNLOAD_STATUS.INITIATING}):we.error("Attempted to handleDownloadTableStart for user without download CSV permission.")}handleDownloadTable(t,e,n,s,i,o,r){const{canDownloadCsv:l}=this.props;l?(we.info("start table downloading",t,e,n,s,i,o,r),this.setState(()=>(this.tableSaver&&this.tableSaver.startDownload(t,e,n,s,i,o,r),{tableDownloadStatus:rn.DOWNLOAD_STATUS.DOWNLOADING}))):we.error("Attempted to handleDownloadTable for user without download CSV permission.")}async seekRow(t,e=!1){var c;const{gotoValueSelectedColumnName:n,gotoValueSelectedFilter:s}=this.state,{model:i}=this.props;if(!i.isSeekRowAvailable||t==="")return;const o=i.getColumnIndexByName(n);if(o===void 0)return;const r=i.columns[o];let l;this.grid&&({selectionEndRow:l}=this.grid.state),l==null&&(l=0);const a=s===K.contains,d=s===K.eq||s===K.eqIgnoreCase;try{const u=_.getNormalizedType(r.type);let m;switch(u){case _.dataType.STRING:{m=await i.seekRow(e===!0?l-1:l+1,r,M.ValueType.STRING,t,d,a,e!=null?e:!1);break}case _.dataType.DATETIME:{const{formatter:p}=i,[g]=Jn.parseDateRange(t,p.timeZone);m=await i.seekRow(e===!0?l-1:l+1,r,M.ValueType.DATETIME,g,void 0,void 0,e!=null?e:!1);break}case _.dataType.DECIMAL:case _.dataType.INT:{if(!_.isBigDecimalType(r.type)&&!_.isBigIntegerType(r.type)){const p=parseInt(t,10);m=await i.seekRow(l,r,M.ValueType.NUMBER,p,void 0,void 0,e!=null?e:!1)}else m=await i.seekRow(l,r,M.ValueType.STRING,t,void 0,void 0,e!=null?e:!1);break}default:m=await i.seekRow(l,r,M.ValueType.STRING,t,void 0,void 0,e!=null?e:!1)}(c=this.grid)==null||c.setFocusRow(m),this.setState({gotoValueError:""})}catch{this.setState({gotoValueError:"invalid input"})}}handleCancelDownloadTable(){var t;(t=this.tableSaver)==null||t.cancelDownload(),this.setState({isTableDownloading:!1})}handleDownloadCompleted(){this.setState({isTableDownloading:!1,tableDownloadProgress:100,tableDownloadStatus:rn.DOWNLOAD_STATUS.FINISHED})}handleDownloadCanceled(){this.setState({isTableDownloading:!1,tableDownloadProgress:0,tableDownloadStatus:rn.DOWNLOAD_STATUS.CANCELED})}deleteRanges(t){const{model:e}=this.props;this.pending.add(e.delete(t)).catch(n=>{ye.isCanceled(n)||we.error("Unable to delete ranges",t,n)})}resetColumnSelection(){if(this.grid==null)return;const{isSelectingColumn:t}=this.props;if(t){const{columnAllowedCursor:e}=this.props;this.grid.setState({cursor:e})}else this.grid.setState({cursor:null}),this.setState({hoverSelectColumn:null})}resetGridViewState(t=!0){!this.grid||(this.grid.clearSelectedRanges(),this.grid.setViewState({left:0,top:0,topOffset:0,leftOffset:0},t))}sendStateChange(){if(!this.grid)return;const{state:t}=this,{state:e}=this.grid,{onStateChange:n}=this.props;n(t,e)}handleOverflowClose(){this.setState({showOverflowModal:!1})}getColumnBoundingRect(){var m;const{metrics:t,shownColumnTooltip:e}=this.state;L(t),L(e);const n=(m=this.gridWrapper)==null?void 0:m.getBoundingClientRect(),s=20;L(n);const{columnHeaderHeight:i,allColumnXs:o,allColumnWidths:r,width:l,columnHeaderMaxDepth:a}=t,d=o.get(e),c=r.get(e);L(d),L(c);const u=n.left+Je(d+c/2,s,l-s);return{top:n.top+(a-1)*i,left:n.left+Je(d+c/2,s,l-s),bottom:n.top+a*i,right:n.left+Je(d+c/2,s,l-s)+1,width:1,height:i,x:u,y:n.top,toJSON:()=>{throw new Error("not implemented")}}}handleGotoRowSelectedRowNumberSubmit(){const{gotoRow:t}=this.state;this.focusRowInGrid(t)}focusRowInGrid(t){var i,o,r;const{model:e}=this.props,{rowCount:n}=e;if(this.setState({gotoRow:t}),t===""){this.setState({gotoRowError:"",gotoValueError:""});return}const s=parseInt(t,10);s>n||s<-n?this.setState({gotoRowError:"Invalid row index"}):s===0?(this.setState({gotoRowError:"",gotoValueError:""}),(i=this.grid)==null||i.setFocusRow(0)):s<0?(this.setState({gotoRowError:"",gotoValueError:""}),(o=this.grid)==null||o.setFocusRow(s+n)):((r=this.grid)==null||r.setFocusRow(s-1),this.setState({gotoRowError:"",gotoValueError:""}))}handleGotoRowSelectedRowNumberChanged(t){const e=t.target.value;this.focusRowInGrid(e)}getColumnTooltip(t,e,n){const{columnHeaderHeight:s,columnHeaderMaxDepth:i,allColumnXs:o,allColumnWidths:r,width:l}=e,a=o.get(t),d=r.get(t);if(a==null||d==null)return null;const c=Math.max(0,a);let u=d;a+d>l?u=l-a:a<0&&(u=d-Math.abs(a));const m={position:"absolute",top:(i-1)*s,left:c,width:u,height:s,pointerEvents:"none"},p={clientWidth:1,clientHeight:s,getBoundingClientRect:this.getColumnBoundingRect},g={placement:"bottom",modifiers:{flip:{behavior:["bottom","top"]}}},f=this.getModelColumn(t);if(f==null)return null;const b=n.columns[f];return b==null?null:h("div",{style:m,children:h(Ye,{timeout:400,interactive:!0,options:g,ref:this.handleTooltipRef,referenceObject:p,onExited:()=>{this.setState({shownColumnTooltip:null})},children:h(Ap,{model:n,column:b,onStatistics:()=>{var C;(C=this.tooltip)==null||C.update()}})},b.name)})}handleGotoValueSelectedColumnNameChanged(t){this.setState({gotoValueSelectedColumnName:t,gotoValueError:""})}handleGotoValueSelectedFilterChanged(t){this.setState({gotoValueSelectedFilter:t,gotoValueError:""})}handleGotoValueSubmitted(t){const{gotoValue:e}=this.state;this.seekRow(e,t)}render(){var Mr,Nr,Fr,xr,pt,Ri,Fc,xc,_c;const{children:t,customFilters:e,getDownloadWorker:n,isSelectingColumn:s,isStuckToBottom:i,isStuckToRight:o,model:r,name:l,onlyFetchVisibleColumns:a,alwaysFetchColumns:d,advancedSettings:c,onAdvancedSettingsChange:u,canDownloadCsv:m,onCreateChart:p}=this.props,{metricCalculator:g,metrics:f,isFilterBarShown:b,isSelectingPartition:C,isMenuShown:S,isReady:v,copyOperation:y,focusedFilterBarColumn:E,loadingText:I,loadingScrimProgress:R,loadingSpinnerShown:N,keyHandlers:F,mouseHandlers:P,shownColumnTooltip:H,hoverAdvancedFilter:x,shownAdvancedFilter:A,hoverSelectColumn:k,quickFilters:G,advancedFilters:V,partition:O,partitionFilters:$,partitionTable:Y,partitionColumn:Q,searchFilter:U,selectDistinctColumns:q,movedColumns:j,movedRows:te,formatter:ce,conditionalFormats:ne,conditionalFormatPreview:he,conditionalFormatEditIndex:Ce,sorts:Re,reverseType:He,customColumns:lt,selectedRanges:Ve,isTableDownloading:Ln,tableDownloadStatus:$t,tableDownloadProgress:Me,tableDownloadEstimatedTime:ct,showSearchBar:at,searchValue:Mt,selectedSearchColumns:zt,invertSearchColumns:An,aggregationSettings:un,selectedAggregation:Ti,rollupConfig:mn,openOptions:kt,pendingSavePromise:Ts,pendingSaveError:Ei,pendingRowCount:So,pendingDataErrors:yi,pendingDataMap:Ii,toastMessage:mr,frozenColumns:pr,columnHeaderGroups:Es,showOverflowModal:Ys,overflowText:ha,overflowButtonTooltipProps:gr,isGotoShown:wo,gotoRow:fr,gotoRowError:Cr,gotoValueError:br,gotoValueSelectedColumnName:ua,gotoValue:ma}=this.state;if(!v)return null;const Xs=this.getTheme(),pa=this.getCachedFilter(e,G,V,$,U),vo=g.getUserColumnWidths(),ga=this.getCachedStateOverride(k,b,s,R,G,V,Re,He,mn,S),Sr=f?f.top:0,To=f?f.bottomViewport:0;let Eo=null,ys=null;a&&(Eo=f?f.left:0,ys=f?f.right:0);const wr=f!=null&&f.width>0&&f.height>0,vr=((Nr=(Mr=mn==null?void 0:mn.columns)==null?void 0:Mr.length)!=null?Nr:0)>0;let yo=null;const Tr=f?Math.min(Math.max(Hs.minDebounce,Math.round(f.rowCount/200)),Hs.maxDebounce):Hs.maxDebounce;if(b&&E!=null&&f!=null){const{gridX:et,gridY:Qt,allColumnXs:Is,allColumnWidths:Io,width:Di}=f,Pn=Is.get(E),Wt=Io.get(E);if(Pn!=null&&Wt!=null){const Ot=et+Pn,ss=Qt-((Fr=Xs.filterBarHeight)!=null?Fr:0),js=Wt+1,Zs=((xr=Xs.filterBarHeight)!=null?xr:0)-1,_r={top:ss,left:Ot,minWidth:Math.min(js,Di-Ot),height:Zs};let Hn="",Mi=!0;const Qs=this.getModelColumn(E);L(Qs);const Ni=G.get(Qs),Rs=V.get(Qs);Ni!=null&&(Hn=Ni.text,Mi=Ni.filter!=null);const Fi=G.size!==0||V.size!==0;yo=h(xp,{ref:this.filterInputRef,style:_r,className:z({error:!Mi,active:Hn!==""||Rs!=null,"iris-grid-has-filter":Fi}),isAdvancedFilterSet:Rs!=null,onAdvancedFiltersTriggered:()=>{this.setState({shownAdvancedFilter:E})},onChange:this.handleFilterBarChange,onDone:this.handleFilterBarDone,onTab:this.handleFilterBarTab,onContextMenu:(pt=this.grid)==null?void 0:pt.handleContextMenu,debounceMs:Tr,value:Hn},E)}}let Er=null;if(I!=null){const et=T("div",{className:"iris-grid-loading-status",children:[h("div",{className:z("iris-grid-loading-status-bar",{show:N}),children:I}),T("button",{type:"button",onClick:this.handleCancel,className:z("iris-grid-btn-cancel",{show:N}),children:[h(ee,{icon:oo,transform:"down-1"}),"Cancel"]})]}),Qt=f?f.gridY:0;Er=h("div",{className:"iris-grid-loading",style:{top:Qt},children:et})}let yr=null;H!=null&&f&&(yr=this.getColumnTooltip(H,f,r),(Ri=this.tooltip)==null||Ri.update());const Ir=[];if(f&&b){const{gridX:et,gridY:Qt,visibleColumns:Is,allColumnXs:Io,allColumnWidths:Di}=f,{filterBarHeight:Pn}=Xs;for(let Wt=0;Wt<Is.length;Wt+=1){const Ot=Is[Wt],ss=Io.get(Ot),js=Di.get(Ot),Zs=this.getModelColumn(Ot);if(Zs!=null&&r.isFilterable(Zs)&&ss!=null&&js!=null&&js>0){const Hn=et+ss+js-24,Mi=Qt-(Pn!=null?Pn:0)+2,Qs={position:"absolute",top:Mi,left:Hn},Rs=V.get(Zs)!=null,Fi=Ot===x||Ot===E||Rs,ba=h("div",{className:z("advanced-filter-button-container",{hidden:!Fi}),style:Qs,children:Fi&&h(W,{kind:"ghost",className:z("btn-link-icon advanced-filter-button",{"filter-set":Rs}),onClick:()=>{this.setState({shownAdvancedFilter:Ot})},onContextMenu:$g=>{var kc;(kc=this.grid)==null||kc.handleContextMenu($g)},onMouseEnter:()=>{this.setState({hoverAdvancedFilter:Ot})},onMouseLeave:()=>{this.setState({hoverAdvancedFilter:null})},children:T("div",{className:"fa-layers",children:[h(ee,{icon:Rd,className:"filter-solid"}),h(ee,{icon:hl,className:"filter-light"})]})})},Ot);Ir.push(ba)}}}const Rr=[];if(f){const{gridX:et,visibleColumns:Qt,allColumnXs:Is,allColumnWidths:Io,columnHeaderHeight:Di}=f;for(let Pn=0;Pn<Qt.length;Pn+=1){const Wt=Qt[Pn],Ot=Is.get(Wt),ss=Io.get(Wt);if(Ot!=null&&ss!=null&&ss>0){const js=et+Ot,Zs=et+Ot+ss-20,_r=b?{position:"absolute",top:Di,left:Zs,width:20,height:Xs.filterBarHeight}:{position:"absolute",top:0,left:js,width:ss,height:Di},Hn=this.getModelColumn(Wt);if(Hn!=null){const Mi=r.columns[Hn],Qs=V.get(Hn),{options:Ni}=Qs||{},Rs=_.getSortForColumn(r.sort,Hn),Fi=Rs?Rs.direction:null,ba=h("div",{className:"advanced-filter-menu-container",style:_r,children:h(kn,{className:"advanced-filter-menu-popper",onEntered:this.getAdvancedMenuOpenedHandler(Wt),onExited:()=>{this.handleAdvancedMenuClosed(Wt)},isShown:A===Wt,interactive:!0,closeOnBlur:!0,options:{positionFixed:!0},children:this.getCachedAdvancedFilterMenuActions(r,Mi,Ni,Fi,ce)})},Wt);Rr.push(ba)}}}}const Dr=this.getCachedOptionItems(p!==void 0&&r.isChartBuilderAvailable,r.isCustomColumnsAvailable,r.isFormatColumnsAvailable,r.isRollupAvailable,r.isTotalsAvailable,r.isSelectDistinctAvailable,r.isExportAvailable,this.toggleFilterBarAction,this.toggleSearchBarAction,this.toggleGotoRowAction,b,at,m,this.isTableSearchAvailable(),wo,c.size>0),fa=kt.map(et=>{switch(et.type){case ke.CHART_BUILDER:return h(Vp,{model:r,onChange:this.handleChartChange,onSubmit:this.handleChartCreate},ke.CHART_BUILDER);case ke.VISIBILITY_ORDERING_BUILDER:return h(rc,{model:r,movedColumns:j,userColumnWidths:vo,columnHeaderGroups:Es,onColumnVisibilityChanged:this.handleColumnVisibilityChanged,onMovedColumnsChanged:this.handleMovedColumnsChanged,onColumnHeaderGroupChanged:this.handleHeaderGroupsChanged},ke.VISIBILITY_ORDERING_BUILDER);case ke.CONDITIONAL_FORMATTING:return h(UE,{rules:ne,onChange:this.handleConditionalFormatsChange,onCreate:this.handleConditionalFormatCreate,onSelect:this.handleConditionalFormatEdit});case ke.CONDITIONAL_FORMATTING_EDIT:return L(r.columns),L(this.handleConditionalFormatEditorUpdate),h(m1,{columns:r.columns,rule:he,onUpdate:this.handleConditionalFormatEditorUpdate,onSave:this.handleConditionalFormatEditorSave,onCancel:this.handleConditionalFormatEditorCancel});case ke.CUSTOM_COLUMN_BUILDER:return h(Bp,{model:r,customColumns:lt,onSave:this.handleUpdateCustomColumns,onCancel:this.handleMenuBack},ke.CUSTOM_COLUMN_BUILDER);case ke.ROLLUP_ROWS:return h(oc,{model:r,onChange:this.handleRollupChange,config:mn},ke.ROLLUP_ROWS);case ke.AGGREGATIONS:return h(XT,{settings:un,isRollup:vr,onChange:this.handleAggregationsChange,onEdit:this.handleAggregationEdit});case ke.AGGREGATION_EDIT:return Ti&&h(ZT,{aggregation:Ti,columns:r.originalColumns,onChange:this.handleAggregationChange});case ke.TABLE_EXPORTER:return h(rn,{model:r,name:l,userColumnWidths:vo,movedColumns:j,isDownloading:Ln,tableDownloadStatus:$t,tableDownloadProgress:Me,tableDownloadEstimatedTime:ct!=null?ct:void 0,onDownload:this.handleDownloadTable,onDownloadStart:this.handleDownloadTableStart,onCancel:this.handleCancelDownloadTable,selectedRanges:Ve},ke.TABLE_EXPORTER);case ke.SELECT_DISTINCT:return h(jp,{model:r,selectDistinctColumns:q,onChange:this.handleSelectDistinctChanged});case ke.ADVANCED_SETTINGS:return h(lc,{items:c,onChange:u});default:throw Error(`Unexpected option type ${et.type}`)}}),Ca=this.getCachedHiddenColumns(ie.getHiddenColumns(vo));return T("div",{className:"iris-grid",role:"presentation",children:[T("div",{className:"iris-grid-column",children:[t!=null&&h("div",{className:"iris-grid-bar",children:t}),h(mt,{in:C,timeout:ze.transitionSlowMs,classNames:"iris-grid-bar-horizontal",onEnter:this.handleAnimationStart,onEntered:this.handleAnimationEnd,onExit:this.handleAnimationStart,onExited:this.handleAnimationEnd,mountOnEnter:!0,unmountOnExit:!0,children:h("div",{className:"iris-grid-partition-selector-wrapper iris-grid-bar iris-grid-bar-primary",children:Y&&Q&&O!=null&&h(Xp,{table:Y,getFormattedString:(et,Qt,Is)=>r.displayString(et,Qt,Is),columnName:Q.name,partition:O,onChange:this.handlePartitionChange,onFetchAll:this.handlePartitionFetchAll,onAppend:this.handlePartitionAppend,onDone:this.handlePartitionDone})})}),h(mt,{in:at,timeout:ze.transitionSlowMs,classNames:"iris-grid-bar-horizontal",onEnter:this.handleAnimationStart,onEntered:this.handleAnimationEnd,onExit:this.handleAnimationStart,onExited:this.handleAnimationEnd,mountOnEnter:!0,unmountOnExit:!0,children:h("div",{className:"iris-grid-bar",children:h(Gr,{value:Mt,selectedColumns:zt,invertSelection:An,onChange:this.handleCrossColumnSearch,columns:r.columns,ref:this.crossColumnRef})})}),T("div",{className:"grid-wrapper",ref:et=>{this.gridWrapper=et},children:[h(uo,{ref:et=>{this.grid=et},isStickyBottom:!tt(r)||!r.isEditable,isStuckToBottom:i,isStuckToRight:o,metricCalculator:g,model:r,keyHandlers:F,mouseHandlers:P,movedColumns:j,movedRows:te,onError:this.handleGridError,onViewChanged:this.handleViewChanged,onSelectionChanged:this.handleSelectionChanged,onMovedColumnsChanged:this.handleMovedColumnsChanged,renderer:this.renderer,stateOverride:ga,theme:Xs}),h(p1,{isOpen:Ys,text:ha,onClose:this.handleOverflowClose}),wr&&h(Op,{model:r,modelColumns:r.columns,top:Sr,bottom:To,left:Eo,right:ys,filter:pa,formatter:ce,sorts:Re,reverseType:He,movedColumns:j,customColumns:lt,hiddenColumns:Ca,alwaysFetchColumns:this.getAlwaysFetchColumns(d,r.columns,j,r.floatingLeftColumnCount,r.floatingRightColumnCount,(xc=(Fc=this.grid)==null?void 0:Fc.state.draggingColumn)==null?void 0:xc.range),formatColumns:this.getCachedPreviewFormatColumns(this.getCachedModelColumns(r,lt),ne,he,((_c=kt[kt.length-1])==null?void 0:_c.type)===ke.CONDITIONAL_FORMATTING_EDIT&&Ce!=null?Ce:void 0),rollupConfig:this.getModelRollupConfig(r.originalColumns,mn,un),totalsConfig:this.getModelTotalsConfig(r.columns,mn,un),selectDistinctColumns:q,pendingRowCount:So,pendingDataMap:Ii,frozenColumns:pr,columnHeaderGroups:Es}),!S&&h("div",{className:"grid-settings-button",children:h(W,{kind:"ghost","data-testid":`btn-iris-grid-settings-button-${l}`,onClick:this.handleMenu,icon:h(ee,{icon:VC,transform:"up-1"}),tooltip:"Table Options"})}),yo,Er,Ir,yr,Rr,gr&&this.getOverflowButtonTooltip(gr)]}),h(C1,{model:r,isShown:wo,gotoRow:fr,gotoRowError:Cr,gotoValueError:br,onGotoRowSubmit:this.handleGotoRowSelectedRowNumberSubmit,onGotoRowNumberChanged:this.handleGotoRowSelectedRowNumberChanged,onClose:this.handleGotoRowClosed,onEntering:this.handleAnimationStart,onEntered:this.handleAnimationEnd,onExiting:()=>{this.handleAnimationStart(),this.focus()},onExited:this.handleAnimationEnd,gotoValueSelectedColumnName:ua,gotoValue:ma,onGotoValueSelectedColumnNameChanged:this.handleGotoValueSelectedColumnNameChanged,onGotoValueSelectedFilterChanged:this.handleGotoValueSelectedFilterChanged,onGotoValueChanged:this.handleGotoValueChanged,onGotoValueSubmit:this.handleGotoValueSubmitted}),h(vT,{error:Ei,isSaving:Ts!=null,saveTooltip:`Commit (${this.commitAction.shortcut.getDisplayText()})`,discardTooltip:`Discard (${this.discardAction.shortcut.getDisplayText()})`,pendingDataErrors:yi,pendingDataMap:Ii,onEntering:this.handleAnimationStart,onEntered:this.handleAnimationEnd,onExiting:this.handleAnimationStart,onExited:this.handleAnimationEnd,onSave:this.handlePendingCommitClicked,onDiscard:this.handlePendingDiscardClicked}),h(BT,{children:mr}),h(mo,{model:r,copyOperation:y!=null?y:void 0,onEntering:this.handleAnimationStart,onEntered:this.handleAnimationEnd,onExiting:this.handleAnimationStart,onExited:this.handleAnimationEnd}),h(po,{ref:et=>{this.tableSaver=et},getDownloadWorker:n,onDownloadCompleted:this.handleDownloadCompleted,onDownloadCanceled:this.handleDownloadCanceled,onDownloadProgressUpdate:this.handleDownloadProgressUpdate,isDownloading:$t===rn.DOWNLOAD_STATUS.DOWNLOADING,formatter:ce})]}),h(mt,{in:S,timeout:ze.transitionMidMs,classNames:"slide-left",onEntering:this.handleAnimationStart,onEntered:this.handleAnimationEnd,onExiting:this.handleAnimationStart,onExited:this.handleAnimationEnd,mountOnEnter:!0,unmountOnExit:!0,children:h("div",{className:"table-sidebar",children:T(qb,{children:[h(nh,{title:"Table Options",onClose:this.handleMenuClose,children:h(sm,{onSelect:et=>this.handleMenuSelect(Dr[et]),items:Dr})}),fa.map((et,Qt)=>h(nh,{title:kt[Qt].title,onBack:this.handleMenuBack,onClose:this.handleMenuClose,children:et},kt[Qt].type))]})})}),h(ae,{actions:this.contextActions})]})}};let go=Hs;go.minDebounce=150;go.maxDebounce=500;go.loadingSpinnerDelay=800;go.defaultProps={children:null,advancedFilters:new Map,advancedSettings:new Map,alwaysFetchColumns:[],conditionalFormats:[],customColumnFormatMap:new Map,isFilterBarShown:!1,applyInputFiltersOnInit:!1,movedColumns:[],movedRows:[],inputFilters:[],customFilters:[],onCreateChart:void 0,onColumnSelected:()=>{},onDataSelected:()=>{},onError:()=>{},onStateChange:()=>{},onPartitionAppend:()=>{},onAdvancedSettingsChange:()=>{},partition:null,partitionColumn:null,quickFilters:new Map,selectDistinctColumns:[],sorts:[],reverseType:_.REVERSE_TYPE.NONE,customColumns:[],aggregationSettings:Jp,rollupConfig:void 0,userColumnWidths:new Map,userRowHeights:new Map,onSelectionChanged:()=>{},isSelectingColumn:!1,isSelectingPartition:!1,isStuckToBottom:!1,isStuckToRight:!1,columnSelectionValidator:null,columnAllowedCursor:null,columnNotAllowedCursor:null,name:"table",onlyFetchVisibleColumns:!0,showSearchBar:!1,searchValue:"",selectedSearchColumns:null,invertSearchColumns:!0,onContextMenu:()=>{},pendingDataMap:new Map,getDownloadWorker:void 0,settings:{timeZone:"America/New_York",defaultDateTimeFormat:Jn.FULL_DATE_FORMAT,showTimeZone:!1,showTSeparator:!0,truncateNumbersWithPound:!1,formatter:[],decimalFormatOptions:D.exports.shape({defaultFormatString:D.exports.string}),integerFormatOptions:D.exports.shape({defaultFormatString:D.exports.string})},canCopy:!0,canDownloadCsv:!0,frozenColumns:null,theme:Lp,canToggleSearch:!0};class E1 extends Error{constructor(e,n){super(`${n} can't be empty (on pending row ${e+1})`),this.isMissingKey=!0,this.rowIndex=e,this.columnName=n}}const it=Z.module("IrisGridTableModel"),y1=150,I1=0,R1=[];function gi(t){return t.table!==void 0}const id=class extends ve{constructor(t,e=new cn,n=null){var s,i;super(),this.pendingNewRowCount=0,this._columnHeaderGroupMap=new Map,this.columnHeaderParentMap=new Map,this._columnHeaderMaxDepth=null,this._columnHeaderGroups=[],this._movedColumns=null,this.getMemoizedInitialMovedColumns=Se(o=>{var u;if(!o)return[];let r=[];const{groupMap:l}=ie.parseColumnHeaderGroups(this,(u=o==null?void 0:o.columnGroups)!=null?u:[]),a=(m,p)=>{const g=this.getColumnIndexByName(m);if(g==null)throw new Error(`Unknown layout hint column: ${m}`);const f=J.getVisibleIndex(g,r);r=J.moveItem(f,p,r)},d=(m,p)=>{const g=l.get(m);if(g==null)throw new Error(`Unknown layout hint group: ${m}`);const f=g.getVisibleRange(r);r=J.moveRange(f,p,r)};if(this.frontColumns.length||this.backColumns.length||this.frozenColumns.length){const m=new Set;let p=0;this.frozenColumns.forEach(f=>{if(m.has(f))throw new Error(`Column specified in multiple layout hints: ${f}`);a(f,p),p+=1}),this.frontColumns.forEach(f=>{if(m.has(f))throw new Error(`Column specified in multiple layout hints: ${f}`);a(f,p),p+=1});let g=this.columnMap.size-1;this.backColumns.forEach(f=>{if(m.has(f))throw new Error(`Column specified in multiple layout hints: ${f}`);a(f,g),g-=1})}if(o==null?void 0:o.columnGroups){const m=[...l.values()];m.sort((p,g)=>p.depth-g.depth),m.forEach(p=>{const g=p.children[0],f=this.getColumnIndexByName(g);let b;if(f!=null)b=J.getVisibleIndex(f,r);else{const C=l.get(g);if(!C)throw new Error(`Unknown column ${g} in group ${p.name}`);[,b]=C.getVisibleRange(r)}for(let C=1;C<p.children.length;C+=1){const S=p.children[C],v=l.get(S),y=this.getColumnIndexByName(S);if(v){const I=v.getVisibleRange(r)[0]<b?b-v.childIndexes.length+1:b+1;d(S,I),b=I+v.childIndexes.length-1}else if(y!=null){const I=J.getVisibleIndex(y,r)<b?b:b+1;a(S,I),b=I}}})}return this._movedColumns=r,r}),this.getMemoizedInitialColumnHeaderGroups=Se(o=>{var r;return ie.parseColumnHeaderGroups(this,(r=o==null?void 0:o.columnGroups)!=null?r:[]).groups}),this.getMemoizedColumnMap=Se(o=>{const r=new Map;return o.forEach(l=>r.set(l.name,l)),r}),this.getColumnIndicesByNameMap=Se(o=>{const r=new Map;return o.forEach(({name:l},a)=>r.set(l,a)),r}),this.setViewport=Qn((o,r,l)=>{if(r<o){it.error("Invalid viewport",o,r);return}const{viewport:a}=this;if(a!=null&&a.top===o&&a.bottom===r&&a.columns===l){it.debug2("Ignoring duplicate viewport",a);return}this.viewport={top:o,bottom:r,columns:l},it.debug2("setViewport",this.viewport),this.applyViewport()},y1),this.applyViewport=Qn(()=>{if(!this.viewport)return;it.debug2("applyViewport",this.viewport);const{top:o,bottom:r,columns:l}=this.viewport,[a,d]=this.getCachedViewportRowRange(o,r);this.applyBufferedViewport(a,d,l)},I1,{leading:!1}),this.getCachedFormattedString=ln((o,r,l,a,d)=>o.getFormattedString(r,l,a,d),{max:1e4}),this.getCachedCustomColumnFormatFlag=ln(Cs.isCustomColumnFormatDefined,{max:1e4}),this.getCachedViewportRowRange=Se((o,r)=>{const l=r-o,a=Math.max(0,o-l*id.ROW_BUFFER_PAGES),d=r+l*id.ROW_BUFFER_PAGES;return[a,d]}),this.getCachedPendingErrors=Se((o,r,l)=>{const a=new Map;return o.forEach((d,c)=>{var m;const{data:u}=d;for(let p=0;p<l;p+=1)u.has(p)||(a.has(c)||a.set(c,[]),(m=a.get(c))==null||m.push(new E1(c,r[p].name)))}),a}),this.handleTableDisconnect=this.handleTableDisconnect.bind(this),this.handleTableReconnect=this.handleTableReconnect.bind(this),this.handleTableUpdate=this.handleTableUpdate.bind(this),this.handleTotalsUpdate=this.handleTotalsUpdate.bind(this),this.handleRequestFailed=this.handleRequestFailed.bind(this),this.handleCustomColumnsChanged=this.handleCustomColumnsChanged.bind(this),this.irisFormatter=e,this.inputTable=n,this.subscription=null,this.table=t,this.viewport=null,this.viewportData=null,this.formattedStringData=[],this.pendingStringData=[],this.isSaveInProgress=!1,this.totalsTable=null,this.totalsTablePromise=null,this.totals=null,this.totalsDataMap=null,this.pendingNewDataMap=new Map,this.pendingNewRowCount=0,this.columnHeaderGroups=ie.parseColumnHeaderGroups(this,(i=(s=this.layoutHints)==null?void 0:s.columnGroups)!=null?i:[]).groups}seekRow(t,e,n,s,i,o,r){throw new Error("Method not implemented.")}export(){throw new Error("Method not implemented.")}columnStatistics(t){throw new Error("Method not implemented.")}get customColumns(){return[]}set customColumns(t){throw new Error("Method not implemented.")}get formatColumns(){return[]}set formatColumns(t){throw new Error("Method not implemented.")}updateFrozenColumns(t){throw new Error("Method not implemented.")}get rollupConfig(){throw new Error("Method not implemented.")}set rollupConfig(t){throw new Error("Method not implemented.")}get selectDistinctColumns(){throw new Error("Method not implemented.")}set selectDistinctColumns(t){throw new Error("Method not implemented.")}get columns(){return this.table.columns}close(){this.table.close(),this.totalsTable!==null&&this.totalsTable.close(),this.totalsTablePromise!==null&&this.totalsTablePromise.cancel()}startListening(){super.startListening(),this.table.addEventListener(M.Table.EVENT_DISCONNECT,this.handleTableDisconnect),this.table.addEventListener(M.Table.EVENT_RECONNECT,this.handleTableReconnect),this.table.addEventListener(M.Table.EVENT_UPDATED,this.handleTableUpdate),this.table.addEventListener(M.Client.EVENT_REQUEST_FAILED,this.handleRequestFailed),this.table.addEventListener(M.Table.EVENT_CUSTOMCOLUMNSCHANGED,this.handleCustomColumnsChanged),this.totalsTable!=null&&this.addTotalsListeners(this.totalsTable),this.applyViewport()}stopListening(){super.stopListening(),this.table.removeEventListener(M.Table.EVENT_DISCONNECT,this.handleTableDisconnect),this.table.removeEventListener(M.Table.EVENT_RECONNECT,this.handleTableReconnect),this.table.removeEventListener(M.Table.EVENT_UPDATED,this.handleTableUpdate),this.table.removeEventListener(M.Client.EVENT_REQUEST_FAILED,this.handleRequestFailed),this.table.removeEventListener(M.Table.EVENT_CUSTOMCOLUMNSCHANGED,this.handleCustomColumnsChanged),this.totalsTable!=null&&this.removeTotalsListeners(this.totalsTable),this.closeSubscription()}addTotalsListeners(t){t.addEventListener(M.Table.EVENT_UPDATED,this.handleTotalsUpdate),t.setViewport(0,0)}removeTotalsListeners(t){t.removeEventListener(M.Table.EVENT_UPDATED,this.handleTotalsUpdate)}handleTableDisconnect(){this.dispatchEvent(new Ke(ve.EVENT.DISCONNECT))}handleTableReconnect(){this.dispatchEvent(new Ke(ve.EVENT.RECONNECT))}handleTableUpdate(t){this.copyViewportData(t.detail),this.dispatchEvent(new Ke(ve.EVENT.UPDATED))}handleTotalsUpdate(t){this.copyTotalsData(t.detail),this.dispatchEvent(new Ke(ve.EVENT.UPDATED))}handleRequestFailed(t){this.dispatchEvent(new Ke(ve.EVENT.REQUEST_FAILED,t))}handleCustomColumnsChanged(){this.dispatchEvent(new Ke(ve.EVENT.COLUMNS_CHANGED,{detail:this.columns}))}get rowCount(){var t,e,n;return this.table.size+this.pendingNewRowCount+((n=(e=(t=this.totals)==null?void 0:t.operationOrder)==null?void 0:e.length)!=null?n:0)}get pendingDataErrors(){var t,e;return this.getCachedPendingErrors(this.pendingNewDataMap,this.columns,(e=(t=this.inputTable)==null?void 0:t.keyColumns.length)!=null?e:0)}get pendingDataMap(){return this.pendingNewDataMap}set pendingDataMap(t){t!==this.pendingNewDataMap&&(t.forEach((e,n)=>{if(!ie.isValidIndex(n))throw new Error(`Invalid rowIndex ${n}`);const{data:s}=e;s.forEach((i,o)=>{if(!ie.isValidIndex(o))throw new Error(`Invalid columnIndex ${o}`)})}),this.pendingNewDataMap=t,this.pendingNewRowCount=Math.max(this.pendingNewRowCount,this.maxPendingDataRow),this.formattedStringData=[],this.dispatchEvent(new Ke(ve.EVENT.PENDING_DATA_UPDATED)))}get pendingRowCount(){return this.pendingNewRowCount}set pendingRowCount(t){t!==this.pendingNewRowCount&&(this.pendingNewRowCount=Math.max(0,t,this.maxPendingDataRow),this.dispatchEvent(new Ke(ve.EVENT.UPDATED)))}get maxPendingDataRow(){return this.pendingNewDataMap.size>0?Math.max(...this.pendingNewDataMap.keys())+1:0}get columnCount(){return this.columns.length}get floatingBottomRowCount(){var t,e,n;return this.totals!=null&&this.totals.showOnTop?0:(n=(e=(t=this.totals)==null?void 0:t.operationOrder)==null?void 0:e.length)!=null?n:0}get floatingTopRowCount(){var t,e,n;return this.totals!=null&&this.totals.showOnTop&&(n=(e=(t=this.totals)==null?void 0:t.operationOrder)==null?void 0:e.length)!=null?n:0}get isChartBuilderAvailable(){return!0}get isTotalsAvailable(){return this.table.getTotalsTable!=null}get isEditable(){return!this.isSaveInProgress&&this.inputTable!=null}cacheFormattedValue(t,e,n){this.formattedStringData[t]==null&&(this.formattedStringData[t]=[]),this.formattedStringData[t][e]=n}cachePendingValue(t,e,n){this.pendingStringData[t]==null&&(this.pendingStringData[t]=[]),this.pendingStringData[t][e]=n}clearPendingValue(t,e){const n=this.pendingStringData[t];n!=null&&delete n[e]}textValueForCell(t,e){var n,s,i;if(((n=this.pendingStringData[t])==null?void 0:n[e])!==void 0)return this.pendingStringData[t][e];if(((s=this.formattedStringData[t])==null?void 0:s[e])===void 0){const o=this.valueForCell(t,e);if(o==null)return null;const r=(i=this.totalsColumn(t,e))!=null?i:this.columns[t],l=this.getCachedCustomColumnFormatFlag(this.formatter,r.name,r.type);let a;if(!l){const c=this.formatForCell(t,e);(c==null?void 0:c.formatString)!=null&&(a=c)}const d=this.displayString(o,r.type,r.name,a);this.cacheFormattedValue(t,e,d)}return this.formattedStringData[t][e]}textForCell(t,e){const n=this.textValueForCell(t,e);if(n==null&&this.isKeyColumn(t)){const s=this.pendingRow(e);if(s!=null&&this.pendingDataMap.has(s))return"*"}return n!=null?n:""}truncationCharForCell(t){const e=this.columns[t],{type:n}=e;if(_.isNumberType(n)&&this.formatter.truncateNumbersWithPound)return"#"}colorForCell(t,e,n){var i;const s=this.dataForCell(t,e);if(s){const{format:o,value:r}=s;if(r==null||r==="")return L(n.nullStringColor),n.nullStringColor;if(o&&o.color)return o.color;if(this.isPendingRow(e))return L(n.pendingTextColor),n.pendingTextColor;if(r!=null){const l=(i=this.totalsColumn(t,e))!=null?i:this.columns[t];if(_.isDateType(l.type)||l.name==="Date")return L(n.dateColor),n.dateColor;if(_.isNumberType(l.type))return r>0?(L(n.positiveNumberColor),n.positiveNumberColor):r<0?(L(n.negativeNumberColor),n.negativeNumberColor):(L(n.zeroNumberColor),n.zeroNumberColor)}}else if(this.isPendingRow(e)&&this.isKeyColumn(t))return L(n.errorTextColor),n.errorTextColor;return n.textColor}backgroundColorForCell(t,e){var n,s;return(s=(n=this.formatForCell(t,e))==null?void 0:n.backgroundColor)!=null?s:null}textAlignForCell(t){const e=this.columns[t],{type:n}=e;return _.isNumberType(n)?"right":_.isDateType(n)||e.name==="Date"?"center":"left"}textForColumnHeader(t,e=0){const n=this.columnAtDepth(t,e);return Ma(n)?n.isNew?"":n.name:n==null?void 0:n.name}colorForColumnHeader(t,e=0){var s;const n=this.columnAtDepth(t,e);return Ma(n)&&(s=n.color)!=null?s:null}getColumnHeaderGroup(t,e){const n=this.columnAtDepth(t,e);if(Ma(n))return n}getColumnHeaderParentGroup(t,e){var n,s;return this.columnHeaderParentMap.get((s=(n=this.columnAtDepth(t,e))==null?void 0:n.name)!=null?s:"")}columnAtDepth(t,e=0){var o;if(e===0)return this.columns[t];const n=(o=this.columns[t])==null?void 0:o.name;let s=this.columnHeaderParentMap.get(n);if(!s)return;let i=s.depth;for(;i<e;){if(s=this.columnHeaderParentMap.get(s.name),!s)return;i=s.depth}if(s.depth===e)return s}textForRowFooter(t){const e=this.totalsRow(t);return e!=null&&this.totals?this.totals.operationOrder[e]:""}get initialMovedColumns(){var t;return this.getMemoizedInitialMovedColumns((t=this.layoutHints)!=null?t:void 0)}get initialMovedRows(){return R1}get initialColumnHeaderGroups(){var t;return this.getMemoizedInitialColumnHeaderGroups((t=this.layoutHints)!=null?t:void 0)}get columnMap(){return this.getMemoizedColumnMap(this.table.columns)}get columnHeaderMaxDepth(){var t;return(t=this._columnHeaderMaxDepth)!=null?t:1}set columnHeaderMaxDepth(t){this._columnHeaderMaxDepth=t}get columnHeaderGroupMap(){return this._columnHeaderGroupMap}get columnHeaderGroups(){return this._columnHeaderGroups}set columnHeaderGroups(t){if(t===this._columnHeaderGroups)return;const{groups:e,maxDepth:n,parentMap:s,groupMap:i}=ie.parseColumnHeaderGroups(this,t!=null?t:this.initialColumnHeaderGroups);this._columnHeaderGroups=e,this.columnHeaderMaxDepth=n,this.columnHeaderParentMap=s,this._columnHeaderGroupMap=i}get groupedColumns(){return[]}row(t){var l,a,d,c,u,m,p,g,f,b,C,S,v,y;const e=(d=(a=(l=this.totals)==null?void 0:l.operationOrder)==null?void 0:a.length)!=null?d:0,n=(u=(c=this.totals)==null?void 0:c.showOnTop)!=null?u:!1,s=this.totalsRow(t);if(s!=null){const E=(m=this.totals)==null?void 0:m.operationOrder[s];return L(E),(g=(p=this.totalsDataMap)==null?void 0:p.get(E))!=null?g:null}const i=this.pendingRow(t);if(i!=null)return(f=this.pendingNewDataMap.get(i))!=null?f:null;const o=(C=(b=this.viewportData)==null?void 0:b.offset)!=null?C:0,r=(n?t-e:t)-o;return(y=(v=(S=this.viewportData)==null?void 0:S.rows)==null?void 0:v[r])!=null?y:null}totalsColumn(t,e){var r,l,a,d;const n=this.totalsRow(e);if(n==null)return null;const s=(r=this.totals)==null?void 0:r.operationOrder[n],i=(a=(l=this.totals)==null?void 0:l.defaultOperation)!=null?a:Oe.SUM,o=this.columns[t];return(d=this.totalsTable)==null?void 0:d.columns.find(c=>{var u;return c.name===`${o.name}__${s}`||(s===i||((u=this.totals)==null?void 0:u.operationOrder.length)===1)&&c.name===o.name})}totalsRow(t){var i,o,r,l,a;const e=(r=(o=(i=this.totals)==null?void 0:i.operationOrder)==null?void 0:o.length)!=null?r:0,s=((a=(l=this.totals)==null?void 0:l.showOnTop)!=null?a:!1)?t:t-this.table.size;return s>=0&&s<e?s:null}pendingRow(t){const e=t-this.floatingTopRowCount-this.table.size;return e>=0&&e<this.pendingNewRowCount?e:null}isTotalsRow(t){return this.totalsRow(t)!=null}isPendingRow(t){return this.pendingRow(t)!=null}dataForCell(t,e){var n;return(n=this.row(e))==null?void 0:n.data.get(t)}formatForCell(t,e){var n;return(n=this.dataForCell(t,e))==null?void 0:n.format}valueForCell(t,e){var s;const n=this.dataForCell(t,e);if(n)return(s=n.value)!=null?s:null}copyViewportData(t){if(t==null){it.warn("invalid data!");return}this.viewportData=this.extractViewportData(t),this.formattedStringData=[]}copyTotalsData(t){var l,a,d,c,u;if(t==null){it.warn("invalid data!");return}const{columns:e,rows:n}=t;if(n.length!==1){it.error("Unexpected number of rows received for totals table, ignoring update");return}const s=new Map,i=n[0],o=(a=(l=this.totals)==null?void 0:l.defaultOperation)!=null?a:Oe.SUM,r=(d=this.totals)==null?void 0:d.operationMap;for(let m=0;m<e.length;m+=1){const p=e[m],[g,f=(u=(c=r==null?void 0:r[g])==null?void 0:c[0])!=null?u:o]=p.name.split("__");s.has(f)||s.set(f,{data:new Map});const{data:b}=s.get(f),C=this.columns.findIndex(S=>S.name===g);b.set(C,{value:i.get(p),format:i.getFormat(p)})}it.debug2("copyTotalsData",s),this.totalsDataMap=s,this.formattedStringData=[]}getColumnIndexByName(t){return this.getColumnIndicesByNameMap(this.columns).get(t)}extractViewportData(t){const e={offset:t.offset,rows:[]},{columns:n}=t;for(let s=0;s<t.rows.length;s+=1){const i=t.rows[s],o=this.extractViewportRow(i,n);e.rows.push(o)}return e}extractViewportRow(t,e){const n=new Map;for(let s=0;s<e.length;s+=1){const i=e[s],o=this.getColumnIndexByName(i.name);L(o),n.set(o,{value:t.get(i),format:t.getFormat(i)})}return{data:n}}closeSubscription(){it.debug2("closeSubscription",this.subscription),this.subscription&&(this.subscription.close(),this.subscription=null),this.setViewport.cancel(),this.applyViewport.cancel()}get filter(){return this.table.filter}set filter(t){this.closeSubscription(),this.table.applyFilter(t),this.applyViewport()}get formatter(){return this.irisFormatter}set formatter(t){this.irisFormatter=t,this.formattedStringData=[],this.dispatchEvent(new Ke(ve.EVENT.FORMATTER_UPDATED))}displayString(t,e,n="",s){return this.getCachedFormattedString(this.formatter,t,e,n,s)}get sort(){return this.table.sort}set sort(t){this.closeSubscription(),this.table.applySort(t),this.applyViewport()}set totalsConfig(t){if(it.debug("set totalsConfig",t),t!==this.totals){if(this.totals=t,this.formattedStringData=[],this.totalsTablePromise!=null&&this.totalsTablePromise.cancel(),this.setTotalsTable(null),t==null){this.dispatchEvent(new Ke(ve.EVENT.UPDATED));return}this.totalsTablePromise=ye.makeCancelable(this.table.getTotalsTable(t),e=>e.close()),this.totalsTablePromise.then(e=>{this.totalsTablePromise=null,this.setTotalsTable(e)}).catch(e=>{ye.isCanceled(e)||(it.error("Unable to set next totalsTable",e),this.totalsTablePromise=null,this.dispatchEvent(new Ke(ve.EVENT.REQUEST_FAILED,{detail:e})))})}}setTotalsTable(t){it.debug("setTotalsTable",t),this.totalsTable!==null&&(this.listenerCount>0&&this.removeTotalsListeners(this.totalsTable),this.totalsTable.close()),this.totalsTable=t,this.totalsDataMap=null,this.listenerCount>0&&this.totalsTable!=null&&this.addTotalsListeners(this.totalsTable)}applyBufferedViewport(t,e,n){it.debug2("applyBufferedViewport",t,e,n),this.subscription==null?(it.debug2("applyBufferedViewport creating new subscription"),this.subscription=this.table.setViewport(t,e,n)):(it.debug2("applyBufferedViewport using existing subscription"),this.subscription.setViewport(t,e,n))}async snapshot(t,e=!1,n=i=>i,s=!0){if(this.subscription==null)throw new Error("No subscription available");const i=s?de.consolidate(t):t;if(!ie.isValidSnapshotRanges(i))throw new Error(`Invalid snapshot ranges ${t}`);const o=new Set,r=[],l=new Set;for(let m=0;m<i.length;m+=1){const p=i[m];L(p.endRow),L(p.startRow);for(let g=p.startRow;g<=p.endRow&&g<this.floatingTopRowCount;g+=1)o.add(g);p.endRow>=this.floatingTopRowCount&&p.startRow<=this.floatingTopRowCount+this.table.size&&r.push(new de(p.startColumn,Math.min(Math.max(0,p.startRow-this.floatingTopRowCount)),p.endColumn,Math.min(Math.max(0,p.endRow-this.floatingTopRowCount),this.table.size-this.floatingTopRowCount)));for(let g=Math.max(p.startRow,this.floatingTopRowCount+this.table.size);g<=p.endRow&&g<this.floatingTopRowCount+this.table.size+this.floatingBottomRowCount;g+=1)l.add(g)}const a=ie.columnsFromRanges(i,this.columns),d=[];e&&d.push(a.map(m=>m.name));const c=[...o].sort();for(let m=0;m<c.length;m+=1){const p=c[m],g=a.map(f=>{const b=this.getColumnIndexByName(f.name);return L(b),n(this.valueForCell(b,p),f)});e&&g.push(this.textForRowFooter(p)),d.push(g)}if(r.length>0){const m=ie.rangeSetFromRanges(r),p=await this.subscription.snapshot(m,a);d.push(...p.rows.map(g=>a.map(f=>n(g.get(f),f))))}const u=[...l].sort();for(let m=0;m<u.length;m+=1){const p=u[m],g=a.map(f=>{const b=this.getColumnIndexByName(f.name);return L(b),n(this.valueForCell(b,p),f)});e&&g.push(this.textForRowFooter(p)),d.push(g)}return d}async textSnapshot(t,e=!1,n=s=>`${s}`){return it.debug2("textSnapshot",t,e),(await this.snapshot(t,e,n,!1)).map(i=>i.join(" ")).join(`
36
+ `)}async valuesTable(t){let e=null;try{return e=await this.table.copy(),e.applyFilter([]),e.applySort([]),e.selectDistinct([t])}finally{e!=null&&e.close()}}isColumnMovable(t,e){if(t<0||t>=this.columnCount)return!1;if(e>0)return!0;const n=this.columns[t].name;return this.frontColumns.includes(n)||this.backColumns.includes(n)||this.frozenColumns.includes(n)||!n?!1:!this.isKeyColumn(t)}isKeyColumn(t){var e,n;return t<((n=(e=this.inputTable)==null?void 0:e.keyColumns.length)!=null?n:0)}isRowMovable(){return!1}isEditableRange(t){return!(this.inputTable==null||!de.isBounded(t)||!(this.isPendingRow(t.startRow)&&this.isPendingRow(t.endRow)||this.inputTable.keyColumns.length!==0&&t.startColumn>=this.inputTable.keyColumns.length&&t.endColumn>=this.inputTable.keyColumns.length)||t.startRow<this.floatingTopRowCount||t.startRow>=this.floatingTopRowCount+this.table.size+this.pendingRowCount||t.endRow>=this.floatingTopRowCount+this.table.size+this.pendingRowCount)}isDeletableRange(t){return this.inputTable!=null&&t.startRow!=null&&t.endRow!=null&&t.startRow>=this.floatingTopRowCount&&t.startRow<this.floatingTopRowCount+this.table.size+this.pendingRowCount&&t.endRow<this.floatingTopRowCount+this.table.size+this.pendingRowCount}isEditableRanges(t){return t.every(e=>this.isEditableRange(e))}isDeletableRanges(t){return t.every(e=>this.isDeletableRange(e))}getTableAreaRange(){return new de(null,this.floatingTopRowCount,null,this.floatingTopRowCount+this.table.size-1)}getPendingAreaRange(){return new de(null,this.floatingTopRowCount+this.table.size,null,this.floatingTopRowCount+this.table.size+this.pendingNewRowCount-1)}async setValueForCell(t,e,n){return this.setValueForRanges([new de(t,e,t,e)],n)}async setValueForRanges(t,e){var n;if(!this.isEditableRanges(t))throw new Error(`Uneditable ranges ${t}`);try{const s=new Set,i=[];de.forEachCell(t,(d,c)=>{const u=this.columns[d];if(s.add(u),i[d]===void 0){const m=_.makeValue(u.type,e,this.formatter.timeZone);i[d]=m!=null?this.displayString(m,u.type,u.name):null}this.cachePendingValue(d,c,i[d])});const o=this.getPendingAreaRange(),r=t.map(d=>de.intersection(o,d)).filter(d=>d!=null).map(d=>(L(d),de.offset(d,0,-(this.floatingTopRowCount+this.table.size))));if(r.length>0){const d=new Map(this.pendingNewDataMap);de.forEachCell(r,(c,u)=>{d.has(u)||d.set(u,{data:new Map});const m=this.columns[c],p=d.get(u);L(p);const{data:g}=p,f=new Map(g),b=_.makeValue(m.type,e,this.formatter.timeZone);b!=null?f.set(c,{value:b}):f.delete(c),f.size>0?d.set(u,{...p,data:f}):d.delete(u)}),this.pendingDataMap=d}this.dispatchEvent(new Ke(ve.EVENT.UPDATED));const l=this.getTableAreaRange(),a=t.map(d=>de.intersection(l,d)).filter(d=>d!=null);if(a.length>0){const c=(await this.snapshot(a.map(m=>{var p,g;return new de(null,(p=m==null?void 0:m.startRow)!=null?p:null,null,(g=m==null?void 0:m.endRow)!=null?g:null)}))).map(m=>{const p={};for(let g=0;g<this.columns.length;g+=1)p[this.columns[g].name]=m[g];return s.forEach(g=>{p[g.name]=_.makeValue(g.type,e,this.formatter.timeZone)}),p}),u=await((n=this.inputTable)==null?void 0:n.addRows(c));it.debug("setValueForRanges(",t,",",e,") set tableRanges",a,"result",u)}de.forEachCell(t,(d,c)=>{const u=i[d];L(u),this.cacheFormattedValue(d,c,u)})}catch(s){it.error("Unable to set ranges",t,e,s)}finally{de.forEachCell(t,(s,i)=>{this.clearPendingValue(s,i)})}}async setValues(t=[]){var e;if(it.debug("setValues(",t,")"),!t.every(n=>{var s,i;return this.isEditableRange(de.makeCell((s=n.column)!=null?s:n.x,(i=n.row)!=null?i:n.y))}))throw new Error(`Uneditable ranges ${t}`);try{const n=new Map(this.pendingNewDataMap);t.forEach(l=>{var f,b;const{text:a}=l,d=(f=l.column)!=null?f:l.x,c=(b=l.row)!=null?b:l.y,u=this.columns[d],m=_.makeValue(u.type,a,this.formatter.timeZone),p=m!=null?this.displayString(m,u.type,u.name):null;this.cachePendingValue(d,c,p);const g=this.pendingRow(c);if(g!=null){n.has(g)||n.set(g,{data:new Map});const C=n.get(g);L(C);const{data:S}=C,v=new Map(S);m!=null?v.set(d,{value:m}):v.delete(d),v.size>0?n.set(g,{...C,data:v}):n.delete(g)}}),this.pendingDataMap=n,this.dispatchEvent(new Ke(ve.EVENT.UPDATED));const s=t.reduce((l,a)=>{var c,u;const d=(c=a.row)!=null?c:a.y;return l.has(d)||l.set(d,[]),(u=l.get(d))==null||u.push(a),l},new Map),i=de.consolidate(t.map(l=>{var a,d;return de.makeCell((a=l.column)!=null?a:l.x,(d=l.row)!=null?d:l.y)})),o=this.getTableAreaRange(),r=i.map(l=>de.intersection(o,l)).filter(l=>l!=null);if(r.length>0){const a=(await this.snapshot(r.map(c=>(L(c),new de(null,c.startRow,null,c.endRow))))).map((c,u)=>{let m=null,p=u;for(let b=0;b<r.length;b+=1){const C=r[b];L(C);const S=de.rowCount([C]);if(p<S){L(C.startRow),m=C.startRow+p;break}p-=S}const g={};for(let b=0;b<this.columns.length;b+=1)g[this.columns[b].name]=c[b];L(m);const f=s.get(m);return f!=null&&f.forEach(b=>{var S;const C=this.columns[(S=b.column)!=null?S:b.x];g[C.name]=_.makeValue(C.type,b.text,this.formatter.timeZone)}),g});it.info("setValues setting tableRanges",r);const d=await((e=this.inputTable)==null?void 0:e.addRows(a));it.info("setValues set tableRanges",r,"SUCCESS",d)}t.forEach(l=>{var g,f;const{text:a}=l,d=(g=l.column)!=null?g:l.x,c=(f=l.row)!=null?f:l.y,u=this.columns[d],m=_.makeValue(u.type,a,this.formatter.timeZone),p=m!=null?this.displayString(m,u.type,u.name):null;this.cacheFormattedValue(d,c,p)})}finally{t.forEach(n=>{this.clearPendingValue(n.column,n.row)})}}async commitPending(){var t,e,n;if(this.pendingNewDataMap.size<=0)throw new Error("No pending changes to commit");try{this.isSaveInProgress=!0;const s=[];this.pendingNewDataMap.forEach(o=>{const r={};o.data.forEach(({value:l},a)=>{const d=this.columns[a];r[d.name]=l}),s.push(r)});const i=await((t=this.inputTable)==null?void 0:t.addRows(s));it.debug("commitPending()",this.pendingNewDataMap,"result",i),this.pendingNewDataMap=new Map,this.pendingNewRowCount=Math.max(0,((n=(e=this.viewport)==null?void 0:e.bottom)!=null?n:0)-this.table.size),this.formattedStringData=[],this.dispatchEvent(new Ke(ve.EVENT.PENDING_DATA_UPDATED))}finally{this.isSaveInProgress=!1}}editValueForCell(t,e){return this.textValueForCell(t,e)}async delete(t){if(!this.isDeletableRanges(t))throw new Error(`Undeletable ranges ${t}`);L(this.inputTable);const{keyColumns:e}=this.inputTable;if(e.length===0)throw new Error("No key columns to allow deletion");const n=this.getPendingAreaRange(),s=t.map(c=>de.intersection(n,c)).filter(c=>c!=null).map(c=>(L(c),de.offset(c,0,-(this.floatingTopRowCount+this.table.size))));if(s.length>0){const c=new Map(this.pendingNewDataMap);for(let u=0;u<s.length;u+=1){const m=s[u];L(m.startRow),L(m.endRow);for(let p=m.startRow;p<=m.endRow;p+=1)c.delete(p)}this.pendingNewDataMap=c,this.formattedStringData=[],this.dispatchEvent(new Ke(ve.EVENT.PENDING_DATA_UPDATED)),this.dispatchEvent(new Ke(ve.EVENT.UPDATED))}const i=this.getTableAreaRange(),o=t.map(c=>de.intersection(i,c)).filter(c=>c!=null);if(o.length<=0)return;const[r,l]=await Promise.all([this.snapshot(o.map(c=>(L(c),new de(0,c.startRow,e.length-1,c.endRow)))),this.table.copy()]),d=r.map(c=>{const u=[];for(let m=0;m<e.length;m+=1){const p=e[m],g=c[m],f=_.makeFilterRawValue(p.type,g),b=p.filter().eq(f);u.push(b)}return u.reduce((m,p)=>{var g;return(g=m==null?void 0:m.and(p))!=null?g:p})}).reduce((c,u)=>{var m;return(m=c==null?void 0:c.or(u))!=null?m:u});l.applyFilter([d]),l.close()}isValidForCell(t,e,n){try{const s=this.columns[t];return _.makeValue(s.type,n,this.formatter.timeZone),!0}catch{return!1}}};let ac=id;ac.ROW_BUFFER_PAGES=1;const Os=Z.module("IrisGridTableModel");class eg extends ac{constructor(e,n=new cn,s=null){super(e,n,s),this.getMemoizedFrontColumns=Se(i=>i!=null?i:[]),this.getMemoizedBackColumns=Se(i=>i!=null?i:[]),this.getMemoizedFrozenColumns=Se((i,o)=>{var r;return(r=o!=null?o:i)!=null?r:[]}),this.getCachedFilterableColumnSet=Se(i=>new Set(i.map((o,r)=>r))),this.customColumnList=[],this.formatColumnList=[]}get isExportAvailable(){return this.table.freeze!=null}get isColumnStatisticsAvailable(){return this.table.getColumnStatistics!=null}get isValuesTableAvailable(){return this.table.selectDistinct!=null&&this.table.copy!=null}get isRollupAvailable(){return this.table.rollup!=null}get isSelectDistinctAvailable(){return this.table.selectDistinct!=null}get isCustomColumnsAvailable(){return this.table.applyCustomColumns!=null}get isFormatColumnsAvailable(){return this.table.applyCustomColumns!=null}get frontColumns(){var e;return this.getMemoizedFrontColumns((e=this.layoutHints)==null?void 0:e.frontColumns)}get backColumns(){var e;return this.getMemoizedBackColumns((e=this.layoutHints)==null?void 0:e.backColumns)}get frozenColumns(){var e;return this.getMemoizedFrozenColumns((e=this.layoutHints)==null?void 0:e.frozenColumns,this.userFrozenColumns)}get layoutHints(){return this.table.layoutHints}get floatingLeftColumnCount(){return this.frozenColumns.length}get description(){return this.table.description}get customColumns(){return this.customColumnList}set customColumns(e){if(Os.debug2("set customColumns",e,this.customColumnList,e===this.customColumnList),this.customColumnList.length===0&&e.length===0){Os.debug("Ignore empty initial customColumns"),this.customColumnList=e;return}if(this.customColumnList===e){Os.debug("Ignore same customColumns");return}this.closeSubscription(),this.customColumnList=e,this.table.applyCustomColumns([...e,...this.formatColumns]),this.applyViewport()}get formatColumns(){return this.formatColumnList}set formatColumns(e){if(Os.debug2("set formatColumns",e,this.formatColumnList,e===this.formatColumnList),this.formatColumnList.length===0&&e.length===0){Os.debug("Ignore empty initial formatColumns"),this.formatColumnList=e;return}if(this.formatColumnList===e){Os.debug("Ignore same formatColumns");return}this.closeSubscription(),this.formatColumnList=e,this.table.applyCustomColumns([...this.customColumns,...e]),this.applyViewport()}updateFrozenColumns(e){this.userFrozenColumns=e,this.dispatchEvent(new Ke(ve.EVENT.TABLE_CHANGED,{detail:this.table}))}set totalsConfig(e){if(Os.debug("set totalsConfig",e),e!==this.totals){if(this.totals=e,this.formattedStringData=[],this.totalsTablePromise!=null&&this.totalsTablePromise.cancel(),this.setTotalsTable(null),e==null){this.dispatchEvent(new Ke(ve.EVENT.UPDATED));return}this.totalsTablePromise=ye.makeCancelable(this.table.getTotalsTable(e),n=>n.close()),this.totalsTablePromise.then(n=>{this.totalsTablePromise=null,this.setTotalsTable(n)}).catch(n=>{ye.isCanceled(n)||(Os.error("Unable to set next totalsTable",n),this.totalsTablePromise=null,this.dispatchEvent(new Ke(ve.EVENT.REQUEST_FAILED,{detail:n})))})}}get isFilterRequired(){return this.table.isUncoalesced}isFilterable(e){return this.getCachedFilterableColumnSet(this.columns).has(e)}async export(){return this.table.freeze()}columnStatistics(e){return this.table.getColumnStatistics(e)}isColumnMovable(e){const n=this.columns[e].name;return this.frontColumns.includes(n)||this.backColumns.includes(n)||this.frozenColumns.includes(n)?!1:!this.isKeyColumn(e)}isColumnFrozen(e){return this.frozenColumns.includes(this.columns[e].name)}async delete(e){var u;if(!this.isDeletableRanges(e))throw new Error(`Undeletable ranges ${e}`);L(this.inputTable);const{keyColumns:n}=this.inputTable;if(n.length===0)throw new Error("No key columns to allow deletion");const s=this.getPendingAreaRange(),i=e.map(m=>de.intersection(s,m)).filter(m=>m!=null).map(m=>(L(m),de.offset(m,0,-(this.floatingTopRowCount+this.table.size))));if(i.length>0){const m=new Map(super.pendingDataMap);for(let p=0;p<i.length;p+=1){const g=i[p];L(g.startRow),L(g.endRow);for(let f=g.startRow;f<=g.endRow;f+=1)m.delete(f)}super.pendingDataMap=m,this.formattedStringData=[],this.dispatchEvent(new Ke(ve.EVENT.PENDING_DATA_UPDATED)),this.dispatchEvent(new Ke(ve.EVENT.UPDATED))}const o=this.getTableAreaRange(),r=e.map(m=>de.intersection(o,m)).filter(m=>m!=null);if(r.length<=0)return;const[l,a]=await Promise.all([this.snapshot(r.map(m=>(L(m),new de(0,m.startRow,n.length-1,m.endRow)))),this.table.copy()]),c=l.map(m=>{const p=[];for(let g=0;g<n.length;g+=1){const f=n[g],b=m[g],C=_.makeFilterRawValue(f.type,b),S=f.filter().eq(C);p.push(S)}return p.reduce((g,f)=>{var b;return(b=g==null?void 0:g.and(f))!=null?b:f})}).reduce((m,p)=>{var g;return(g=m==null?void 0:m.or(p))!=null?g:p});a.applyFilter([c]),await((u=this.inputTable)==null?void 0:u.deleteTable(a)),a.close()}async seekRow(e,n,s,i,o,r,l){return this.table.seekRow(e,n,s,i,o,r,l)}get isSeekRowAvailable(){return this.table.seekRow!=null}}class D1 extends ac{constructor(){super(...arguments),this.getCachedFilterableColumnSet=Se((e,n)=>new Set(((n==null?void 0:n.length)>0?n:e).map(s=>e.findIndex(i=>s.name===i.name))))}applyBufferedViewport(e,n,s){this.table.setViewport(e,n,s)}textForCell(e,n){const s=this.columns[e],i=this.row(n);if(i!=null&&s!=null&&!i.hasChildren&&s.constituentType!=null){const o=this.valueForCell(e,n);return this.displayString(o,s.constituentType,s.name)}return super.textForCell(e,n)}extractViewportRow(e,n){const{isExpanded:s,hasChildren:i,depth:o}=e;return{...super.extractViewportRow(e,n),isExpanded:s,hasChildren:i,depth:o}}async snapshot(e,n,s){var l,a;L(this.viewport),L(this.viewportData);const{columns:i}=this.viewport,o=[];n!=null&&n&&o.push(i.map(d=>d.name));const r=new de(0,(l=this.viewportData)==null?void 0:l.offset,i.length,this.viewportData.offset+this.viewportData.rows.length);for(let d=0;d<e.length;d+=1){const c=de.intersection(r,e[d]);L(c),L(c.startRow),L(c.endRow);for(let u=c.startRow;u<=c.endRow;u+=1){const m=[],p=this.viewportData.rows[u-this.viewportData.offset];L(c.startColumn),L(c.endColumn);for(let g=c.startColumn;g<=c.endColumn;g+=1)L(s),m.push(s((a=p.data.get(g))==null?void 0:a.value,this.columns[g]));o.push(m)}}return o}get groupedColumns(){return this.table.groupedColumns}get hasExpandableRows(){return!0}get isChartBuilderAvailable(){return!1}get isSelectDistinctAvailable(){return!1}get isReversible(){return!1}isFilterable(e){return this.getCachedFilterableColumnSet(this.columns,this.groupedColumns).has(e)}isColumnMovable(e){return e>=this.groupedColumns.length}isRowExpandable(e){var s;const n=this.row(e);return(s=n==null?void 0:n.hasChildren)!=null?s:!1}isRowExpanded(e){var s;const n=this.row(e);return(s=n==null?void 0:n.isExpanded)!=null?s:!1}setRowExpanded(e,n){this.table.setExpanded(e,n)}depthForRow(e){var s;const n=this.row(e);return((s=n==null?void 0:n.depth)!=null?s:1)-1}}const Ls=Z.module("IrisGridProxyModel");function Oa(t,e,n){return _.isTreeTable(t)?new D1(t,e):new eg(t,e,n)}class M1 extends ve{constructor(e,n=new cn,s=null){super(),this.textForCell=(...o)=>this.model.textForCell(...o),this.truncationCharForCell=(...o)=>this.model.truncationCharForCell(...o),this.textAlignForCell=(...o)=>this.model.textAlignForCell(...o),this.colorForCell=(...o)=>this.model.colorForCell(...o),this.backgroundColorForCell=(...o)=>this.model.backgroundColorForCell(...o),this.textForColumnHeader=(...o)=>this.model.textForColumnHeader(...o),this.colorForColumnHeader=(...o)=>this.model.colorForColumnHeader(...o),this.textForRowHeader=(...o)=>this.model.textForRowHeader(...o),this.textForRowFooter=(...o)=>this.model.textForRowFooter(...o),this.isRowMovable=(...o)=>this.model.isRowMovable(...o),this.isColumnMovable=(...o)=>this.model.isColumnMovable(...o),this.isRowExpandable=(...o)=>gt(this.model)?this.model.isRowExpandable(...o):!1,this.isRowExpanded=(...o)=>gt(this.model)?this.model.isRowExpanded(...o):!1,this.setRowExpanded=(...o)=>{if(gt(this.model))return this.model.setRowExpanded(...o);throw Error("Function setRowExpanded does not exist on IrisGridTableModel")},this.depthForRow=(...o)=>gt(this.model)?this.model.depthForRow(...o):0,this.getColumnHeaderGroup=(...o)=>this.model.getColumnHeaderGroup(...o),this.getColumnHeaderParentGroup=(...o)=>this.model.getColumnHeaderParentGroup(...o),this.formatForCell=(...o)=>this.model.formatForCell(...o),this.valueForCell=(...o)=>this.model.valueForCell(...o),this.displayString=(...o)=>this.model.displayString(...o),this.isEditableRange=(...o)=>tt(this.model)?this.model.isEditableRange(...o):!1,this.isFilterable=(...o)=>this.model.isFilterable(...o),this.setViewport=(o,r,l)=>this.model.setViewport(o,r,l),this.snapshot=(...o)=>this.model.snapshot(...o),this.textSnapshot=(...o)=>this.model.textSnapshot(...o),this.valuesTable=(...o)=>this.model.valuesTable(...o),this.editValueForCell=(...o)=>(tt(this.model)&&this.model.editValueForCell(...o),""),this.setValueForCell=(...o)=>tt(this.model)?this.model.setValueForCell(...o):Promise.reject(new Error("Model is not editable")),this.setValueForRanges=(...o)=>tt(this.model)?this.model.setValueForRanges(...o):Promise.reject(new Error("Model is not editable")),this.setValues=(...o)=>tt(this.model)?this.model.setValues(...o):Promise.resolve(),this.isValidForCell=(...o)=>tt(this.model)?this.model.isValidForCell(...o):!1,this.delete=(...o)=>this.model.delete(...o),this.commitPending=(...o)=>this.model.commitPending(...o),this.handleModelEvent=this.handleModelEvent.bind(this);const i=Oa(e,n,s);this.originalModel=i,this.model=i,this.modelPromise=null,this.rollup=null,this.selectDistinct=[]}close(){this.originalModel.close(),this.model!==this.originalModel&&this.model.close(),this.modelPromise!=null&&this.modelPromise.cancel()}handleModelEvent(e){Ls.debug2("handleModelEvent",e);const{detail:n,type:s}=e;this.dispatchEvent(new Ke(s,{detail:n}))}setModel(e){Ls.debug("setModel",e);const n=this.model;n!==this.originalModel&&n.close(),this.model=e,this.listenerCount>0&&this.addListeners(e),this.dispatchEvent(new Ke(ve.EVENT.COLUMNS_CHANGED,{detail:e.columns})),gi(e)&&this.dispatchEvent(new Ke(ve.EVENT.TABLE_CHANGED,{detail:e.table}))}setNextModel(e){Ls.debug2("setNextModel"),this.modelPromise&&this.modelPromise.cancel(),this.listenerCount>0&&this.removeListeners(this.model),this.modelPromise=ye.makeCancelable(e,n=>n.close()),this.modelPromise.then(n=>{this.modelPromise=null,this.setModel(n)}).catch(n=>{if(ye.isCanceled(n)){Ls.debug2("setNextModel cancelled");return}Ls.error("Unable to set next model",n),this.modelPromise=null,this.dispatchEvent(new Ke(ve.EVENT.REQUEST_FAILED,{detail:n}))})}startListening(){super.startListening(),this.addListeners(this.model)}stopListening(){super.stopListening(),this.removeListeners(this.model)}addListeners(e){const n=Object.keys(ve.EVENT);for(let s=0;s<n.length;s+=1)e.addEventListener(n[s],this.handleModelEvent)}removeListeners(e){const n=Object.keys(ve.EVENT);for(let s=0;s<n.length;s+=1)e.removeEventListener(n[s],this.handleModelEvent)}get rowCount(){return this.model.rowCount}get columnCount(){return this.model.columnCount}get floatingTopRowCount(){return this.model.floatingTopRowCount}get floatingBottomRowCount(){return this.model.floatingBottomRowCount}get floatingLeftColumnCount(){return this.model.floatingLeftColumnCount}get floatingRightColumnCount(){return this.model.floatingRightColumnCount}isColumnFrozen(e){return this.model.isColumnFrozen(e)}get hasExpandableRows(){return gt(this.model)?this.model.hasExpandableRows:!1}get isExportAvailable(){return this.model.isExportAvailable}get isColumnStatisticsAvailable(){return this.model.isColumnStatisticsAvailable}get isValuesTableAvailable(){return this.model.isValuesTableAvailable}get isCustomColumnsAvailable(){return this.model.isCustomColumnsAvailable&&!(this.isSelectDistinctAvailable&&this.selectDistinctColumns.length>0)}get isFormatColumnsAvailable(){return this.model.isFormatColumnsAvailable}get isChartBuilderAvailable(){return this.model.isChartBuilderAvailable}get isRollupAvailable(){return(this.originalModel.isRollupAvailable||this.rollup!=null)&&this.selectDistinct.length===0}get isSelectDistinctAvailable(){return(this.originalModel.isSelectDistinctAvailable||this.selectDistinct.length>0)&&this.rollup==null}get isTotalsAvailable(){return this.model.isTotalsAvailable}get isReversible(){return this.model.isReversible}get columns(){return this.model.columns}get initialMovedColumns(){return this.model.initialMovedColumns}get initialMovedRows(){return this.model.initialMovedRows}get layoutHints(){return this.model.layoutHints}get frontColumns(){return this.model.frontColumns}get backColumns(){return this.model.backColumns}get frozenColumns(){return this.model.frozenColumns}get columnHeaderGroups(){return this.model.columnHeaderGroups}set columnHeaderGroups(e){this.model.columnHeaderGroups=e}get initialColumnHeaderGroups(){return this.model.initialColumnHeaderGroups}get columnHeaderGroupMap(){return this.model.columnHeaderGroupMap}get columnHeaderMaxDepth(){return this.model.columnHeaderMaxDepth}updateFrozenColumns(e){return this.model.updateFrozenColumns(e)}get originalColumns(){return this.originalModel.columns}get groupedColumns(){return this.model.groupedColumns}get description(){return this.model.description}get filter(){return this.model.filter}set filter(e){this.model.filter=e}get formatter(){return this.model.formatter}set formatter(e){this.model.formatter=e}get sort(){return this.model.sort}set sort(e){this.model.sort=e}get customColumns(){return this.model.customColumns}set customColumns(e){this.model.customColumns=e}get formatColumns(){return this.model.formatColumns}set formatColumns(e){this.model.formatColumns=e}get rollupConfig(){return this.rollup}set rollupConfig(e){if(Ls.debug("set rollupConfig",e),!this.isRollupAvailable)throw new Error("Rollup Rows are not available");if(ut(e,this.rollup))return;this.rollup=e;let n=Promise.resolve(this.originalModel);gi(this.originalModel)&&e!=null&&(n=this.originalModel.table.rollup(e).then(s=>Oa(s,this.formatter))),this.setNextModel(n)}get selectDistinctColumns(){return this.selectDistinct}set selectDistinctColumns(e){if(Ls.debug("set selectDistinctColumns",e),!this.isSelectDistinctAvailable)throw new Error("Select distinct is not available");if(e===this.selectDistinctColumns||e.length===0&&this.selectDistinctColumns.length===0){Ls.debug("Ignore same selectDistinctColumns",e);return}this.selectDistinct=e;const n=e.map(i=>this.originalColumns.find(o=>o.name===i)).filter(i=>i!=null);let s=Promise.resolve(this.originalModel);gi(this.originalModel)&&n.length>0&&(s=this.originalModel.table.selectDistinct(n).then(i=>Oa(i,this.formatter))),this.setNextModel(s)}get table(){if(gi(this.model))return this.model.table}get totalsConfig(){return this.model.totalsConfig}set totalsConfig(e){this.model.totalsConfig=e}get isFilterRequired(){return this.model.isFilterRequired}get isEditable(){return tt(this.model)&&this.model.isEditable}export(){if(_.isTreeTable(this.model))throw new Error("TreeTable has no 'export' property");return this.model.export()}columnStatistics(e){if(_.isTreeTable(this.model))throw new Error("TreeTable has no 'columnStatistics' function");return this.model.columnStatistics(e)}get pendingDataMap(){return this.model.pendingDataMap}set pendingDataMap(e){this.model.pendingDataMap=e}get pendingRowCount(){return this.model.pendingRowCount}set pendingRowCount(e){this.model.pendingRowCount=e}get pendingDataErrors(){return this.model.pendingDataErrors}getColumnIndexByName(e){return this.model.getColumnIndexByName(e)}async seekRow(e,n,s,i,o,r,l){return this.model.seekRow(e,n,s,i,o,r,l)}get isSeekRowAvailable(){return this.model.isSeekRowAvailable}}class dc{static async makeModel(e,n=new cn){let s=null;return!_.isTreeTable(e)&&e.hasInputTable&&(s=await e.inputTable()),new M1(e,n,s)}}const as=Z.module("TableViewportUpdater"),N1=150,$o=class extends w.exports.PureComponent{constructor(){super(...arguments),this.getViewportRowRange=Se((t,e,n)=>{const s=n-e,i=Math.max(0,e-s*$o.ROW_BUFFER_PAGES),o=n+s*$o.ROW_BUFFER_PAGES;return[i,o]}),this.getViewportColumns=Se((t,e,n,s)=>{if(e==null||n==null)return null;const i=n-e,o=Math.max(0,e-i*$o.COLUMN_BUFFER_PAGES),r=Math.min(n+i*$o.COLUMN_BUFFER_PAGES,t.columns.length-1),l=[];for(let a=o;a<=r;a+=1){const d=J.getModelIndex(a,s);l.push(t.columns[d])}return l}),this.updateViewport=Qn((t,e,n,s,i)=>{if(e<t){as.error("Invalid viewport",t,e);return}if(t===0&&e===0){as.debug2("Ignoring 0-0 viewport");return}const{movedColumns:o,table:r}=this.props,[l,a]=this.getViewportRowRange(r,t,e),d=i!=null?i:this.getViewportColumns(r,n,s,o);if(as.debug2("Setting Viewport Top:",l,"Bottom:",a,"Columns:",d),this.subscription==null){as.debug2("updateViewport creating new subscription"),this.subscription=r.setViewport(l,a,d);const{onSubscription:c}=this.props;c(this.subscription)}else as.debug2("updateViewport using existing subscription"),this.subscription.setViewport(l,a,d)},N1)}componentDidMount(){const{top:t,bottom:e,left:n,right:s,table:i,filters:o,sorts:r,columns:l,customColumns:a}=this.props;i.applyFilter(o),i.applySort(r),i.applyCustomColumns(a),this.updateViewport(t,e,n,s,l)}componentDidUpdate(t){const{top:e,bottom:n,left:s,right:i,table:o,filters:r,sorts:l,customColumns:a,columns:d}=this.props,c=r!==t.filters,u=l!==t.sorts,m=a!==t.customColumns,p=o!==t.table;(c||u||m||p)&&this.closeSubscription(),(c||p)&&(as.debug("update table filter",r),o.applyFilter(r)),(u||p)&&(as.debug("update table sort",l),o.applySort(l)),(m||p)&&(as.debug("update table custom columns",a),o.applyCustomColumns(a)),this.updateViewport(e,n,s,i,d)}componentWillUnmount(){this.closeSubscription()}closeSubscription(){if(as.debug2("closeSubscription",this.subscription),this.subscription){this.subscription.close(),this.subscription=void 0;const{onSubscription:t}=this.props;t()}this.updateViewport.cancel()}render(){return null}};let cc=$o;cc.ROW_BUFFER_PAGES=3;cc.COLUMN_BUFFER_PAGES=1;cc.defaultProps={top:0,bottom:0,left:null,right:null,columns:null,onSubscription:()=>{},filters:[],sorts:[],customColumns:[],movedColumns:[]};const Ai=Z.module("TreeTableViewportUpdater"),F1=150,tg=class extends w.exports.PureComponent{constructor(t){super(t),this.updateViewport=Qn((e,n)=>{if(n<e){Ai.error("Invalid viewport",e,n);return}if(e===0&&n===0){Ai.debug2("Ignoring 0-0 viewport");return}const{table:s,updateInterval:i}=this.props,o=n-e,r=Math.max(0,e-o*3),l=n+o*3+1;if(Ai.debug2("Setting Viewport Top:",r,"Bottom:",l,s),!this.listenerCleanup){const{onViewportUpdate:a}=this.props;this.listenerCleanup=s.addEventListener(M.TreeTable.EVENT_UPDATED,a)}s.setViewport(r,l,void 0,i)},F1),this.listenerCleanup=null}componentDidMount(){const{top:t,bottom:e,table:n,filters:s,sorts:i}=this.props;Ai.debug("componentDidMount",this.props),n.applyFilter(s),n.applySort(i),this.updateViewport(t,e)}componentDidUpdate(t){const{top:e,bottom:n,table:s,filters:i,sorts:o}=this.props;i!==t.filters&&(Ai.debug("update table filter",i),s.applyFilter(i)),o!==t.sorts&&(Ai.debug("update table sort",o),s.applySort(o)),this.updateViewport(e,n)}componentWillUnmount(){this.updateViewport.cancel(),this.listenerCleanup&&this.listenerCleanup()}render(){return null}};let ng=tg;ng.UPDATE_INTERVAL=1e3;ng.defaultProps={top:0,bottom:0,onViewportUpdate:()=>{},filters:[],sorts:[],updateInterval:tg.UPDATE_INTERVAL};class no{}no.OPEN="ChartEvent.OPEN";no.CLOSE="ChartEvent.CLOSE";no.COLUMN_SELECTED="ChartEvent.COLUMN_SELECTED";class bt{}bt.SESSION_OPENED="ConsoleEvent.SESSION_OPENED";bt.SESSION_CLOSED="ConsoleEvent.SESSION_CLOSED";bt.FOCUS_HISTORY="ConsoleEvent.FOCUS_HISTORY";bt.SEND_COMMAND="ConsoleEvent.SEND_COMMAND";bt.SETTINGS_CHANGED="ConsoleEvent.SETTINGS_CHANGED";class Pe{}Pe.TABLE_CHANGED="InputFilterEvent.TABLE_CHANGED";Pe.COLUMNS_CHANGED="InputFilterEvent.COLUMNS_CHANGED";Pe.FILTERS_CHANGED="InputFilterEvent.FILTERS_CHANGED";Pe.CLEAR_ALL_FILTERS="InputFilterEvent.CLEAR_ALL_FILTERS";Pe.COLUMN_SELECTED="InputFilterEvent.COLUMN_SELECTED";Pe.OPEN_DROPDOWN="InputFilterEvent.OPEN_DROPDOWN";Pe.OPEN_INPUT="InputFilterEvent.OPEN_INPUT";Pe.OPEN_FILTER_SET_MANAGER="InputFilterEvent.OPEN_FILTER_SET_MANAGER";class Et{}Et.OPEN_GRID="IrisGridEvent.OPEN_GRID";Et.CLOSE_GRID="IrisGridEvent.CLOSE_GRID";Et.DATA_SELECTED="IrisGridEvent.DATA_SELECTED";Et.COLUMN_SELECTED="IrisGridEvent.COLUMN_SELECTED";Et.STATE_CHANGED="IrisGridEvent.STATE_CHANGED";Et.CREATE_CHART="IrisGridevent.CREATE_CHART";const sg=Object.freeze({OPEN:"MarkdownEvent.OPEN"});class Le{}Le.CREATE_NOTEBOOK="NotebookEvent.createNotebook";Le.SELECT_NOTEBOOK="NotebookEvent.selectNotebook";Le.CLOSE_FILE="NotebookEvent.closeFile";Le.RENAME="NotebookEvent.rename";Le.RENAME_FILE="NotebookEvent.renameFile";Le.REGISTER_FILE="NotebookEvent.registerFile";Le.SEND_TO_NOTEBOOK="NotebookEvent.sendToNotebook";Le.UNREGISTER_FILE="NotebookEvent.unregisterFile";class Xn{}Xn.focus="TabEvent.focus";Xn.blur="TabEvent.blur";Xn.openPQObject="TabEvent.openPQObject";Xn.openControl="TabEvent.openControl";Xn.reload="TabEvent.reload";Xn.clearAllFilters="TabEvent.clearAllFilters";class ig extends w.exports.PureComponent{constructor(e){super(e),this.handleCloseTab=this.handleCloseTab.bind(this),this.handleCloseTabsRight=this.handleCloseTabsRight.bind(this),this.handleCloseTabsAll=this.handleCloseTabsAll.bind(this)}getAllTabs(){var n,s,i;const{glContainer:e}=this.props;return[...(i=(s=(n=e==null?void 0:e.tab)==null?void 0:n.header)==null?void 0:s.tabs)!=null?i:[]]}handleCloseTab(){const{glContainer:e}=this.props;e.close()}handleCloseTabsAll(){this.getAllTabs().forEach(n=>{var s;return(s=(n==null?void 0:n.contentItem).container)==null?void 0:s.close()})}handleCloseTabsRight(){var s,i,o,r,l,a,d;const{glContainer:e}=this.props,n=this.getAllTabs();for(let c=n.length-1;c>0&&((i=(s=n[c].contentItem)==null?void 0:s.config)==null?void 0:i.id)!==((l=(r=(o=e.tab)==null?void 0:o.contentItem)==null?void 0:r.config)==null?void 0:l.id);c-=1)(d=((a=n[c])==null?void 0:a.contentItem).container)==null||d.close()}canCloseTabsRight(){var i,o,r,l,a,d,c,u;const{glContainer:e}=this.props,n=this.getAllTabs();let s=!0;for(let m=n.length-1;m>0&&((o=(i=n[m].contentItem)==null?void 0:i.config)==null?void 0:o.id)!==((a=(l=(r=e.tab)==null?void 0:r.contentItem)==null?void 0:l.config)==null?void 0:a.id);m-=1)if(Boolean((u=(c=(d=n[m])==null?void 0:d.contentItem)==null?void 0:c.config)==null?void 0:u.isClosable)){s=!1;break}return s}canCloseAny(){var s,i,o;const e=this.getAllTabs();let n=!0;for(let r=e.length-1;r>0;r-=1)if(Boolean((o=(i=(s=e[r])==null?void 0:s.contentItem)==null?void 0:i.config)==null?void 0:o.isClosable)){n=!1;break}return n}render(){var o,r,l;const{additionalActions:e,glContainer:n}=this.props,s=[...e],i=(l=(r=(o=n.tab)==null?void 0:o.contentItem)==null?void 0:r.config)==null?void 0:l.isClosable;return s.push({title:"Close",order:10,group:ae.groups.low,action:this.handleCloseTab,disabled:i===void 0||!i}),s.push(()=>({title:"Close Tabs to Right",order:20,group:ae.groups.low,action:this.handleCloseTabsRight,disabled:this.canCloseTabsRight()})),s.push(()=>({title:"Close All",order:30,group:ae.groups.low,action:this.handleCloseTabsAll,disabled:this.canCloseAny()})),h(ae,{actions:s})}}ig.defaultProps={additionalActions:[]};class og extends w.exports.PureComponent{constructor(e){super(e),this.handleRenameDialogOpened=this.handleRenameDialogOpened.bind(this),this.handleRenameInputChange=this.handleRenameInputChange.bind(this),this.handleRenameCancel=this.handleRenameCancel.bind(this),this.handleRenameSubmit=this.handleRenameSubmit.bind(this),this.renameInputRef=X.createRef();const{value:n}=e;this.state={value:n,valueWasValidated:!1}}componentDidUpdate(e){const{isShown:n}=e,{isShown:s}=this.props;s&&!n&&this.resetState()}resetState(){const{value:e}=this.props;this.setState({value:e,valueWasValidated:!1})}handleRenameDialogOpened(){var e,n;(n=(e=this.renameInputRef)==null?void 0:e.current)==null||n.focus()}handleRenameInputChange(e){this.setState({value:e.target.value})}handleRenameCancel(){const{onCancel:e}=this.props;e()}handleRenameSubmit(e){e.stopPropagation(),e.preventDefault();const{value:n}=this.state,s=n==null?void 0:n.trim();if(s!==void 0&&s!==""){const{onSubmit:i}=this.props;i(s)}else this.setState({value:s,valueWasValidated:!0})}renderRenameDialog(){const{isShared:e,isOwner:n,itemType:s}=this.props,{value:i,valueWasValidated:o}=this.state;return T("form",{className:z("p-3",{"was-validated":o}),onSubmit:this.handleRenameSubmit,noValidate:!0,role:"presentation",onMouseDown:r=>{r.stopPropagation()},onMouseUp:r=>{r.stopPropagation()},children:[T("div",{className:"form-group",children:[T("label",{htmlFor:`rename-dialog-${s}-input`,children:["Rename ",s]}),h("input",{type:"text",className:"form-control",id:`rename-dialog-${s}-input`,value:i!=null?i:void 0,ref:this.renameInputRef,onChange:this.handleRenameInputChange,required:!0}),T("div",{className:"invalid-feedback",children:[s," name cannot be empty"]}),(e||!n)&&T("div",{className:"pt-2",children:["Renaming this ",s," will rename for all users."]})]}),T("div",{className:"text-right",children:[h(W,{kind:"secondary",className:"mr-2",onClick:this.handleRenameCancel,children:"Cancel"}),h(W,{kind:"primary",type:"submit",children:"Rename"})]})]})}render(){const{isShown:e,onCancel:n}=this.props;return h(kn,{isShown:e,onEntered:this.handleRenameDialogOpened,onExited:n,options:{placement:"bottom"},interactive:!0,closeOnBlur:!0,children:this.renderRenameDialog()})}}og.defaultProps={isShared:!1,isOwner:!0,itemType:"Item",value:""};const x1=Z.module("Panel");class ns extends w.exports.PureComponent{constructor(e){super(e),this.getAdditionActions=Se((s,i,o)=>{const r=[];return i&&r.push(this.getCloneAction()),o&&r.push(this.getRenameAction()),[...r,...s]}),this.handleClearAllFilters=this.handleClearAllFilters.bind(this),this.handleCopyPanel=this.handleCopyPanel.bind(this),this.handleFocus=this.handleFocus.bind(this),this.handleBlur=this.handleBlur.bind(this),this.handleHide=this.handleHide.bind(this),this.handleResize=this.handleResize.bind(this),this.handleSessionClosed=this.handleSessionClosed.bind(this),this.handleSessionOpened=this.handleSessionOpened.bind(this),this.handleBeforeShow=this.handleBeforeShow.bind(this),this.handleShow=this.handleShow.bind(this),this.handleTabBlur=this.handleTabBlur.bind(this),this.handleTabFocus=this.handleTabFocus.bind(this),this.handleRenameCancel=this.handleRenameCancel.bind(this),this.handleRenameSubmit=this.handleRenameSubmit.bind(this),this.handleShowRenameDialog=this.handleShowRenameDialog.bind(this),this.handleTabClicked=this.handleTabClicked.bind(this),this.handleTab=this.handleTab.bind(this);const{glContainer:n}=this.props;this.state={title:oe.getTitleFromContainer(n),showRenameDialog:!1}}componentDidMount(){const{componentPanel:e,glContainer:n,glEventHub:s}=this.props;n.on("resize",this.handleResize),n.on("show",this.handleBeforeShow),n.on("shown",this.handleShow),n.on("hide",this.handleHide),n.on("tab",this.handleTab),n.on("tabClicked",this.handleTabClicked),s.on(bt.SESSION_CLOSED,this.handleSessionClosed),s.on(bt.SESSION_OPENED,this.handleSessionOpened),s.on(Xn.focus,this.handleTabFocus),s.on(Xn.blur,this.handleTabBlur),s.on(Pe.CLEAR_ALL_FILTERS,this.handleClearAllFilters),s.emit(De.MOUNT,e)}componentWillUnmount(){const{componentPanel:e,glContainer:n,glEventHub:s}=this.props;n.off("resize",this.handleResize),n.off("show",this.handleBeforeShow),n.off("shown",this.handleShow),n.off("hide",this.handleHide),n.off("tab",this.handleTab),n.off("tabClicked",this.handleTabClicked),s.off(bt.SESSION_CLOSED,this.handleSessionClosed),s.off(bt.SESSION_OPENED,this.handleSessionOpened),s.off(Xn.focus,this.handleTabFocus),s.off(Xn.blur,this.handleTabBlur),s.off(Pe.CLEAR_ALL_FILTERS,this.handleClearAllFilters),s.emit(De.UNMOUNT,e)}handleTab(e){e!=null&&this.setState({title:oe.getTitleFromTab(e)}),this.forceUpdate();const{onTab:n}=this.props;n(e)}handleTabClicked(...e){const{onTabClicked:n}=this.props;n(...e)}handleClearAllFilters(...e){const{onClearAllFilters:n}=this.props;n(...e)}handleFocus(e){const{componentPanel:n,glEventHub:s}=this.props;s.emit(De.FOCUS,n);const{onFocus:i}=this.props;i(e)}handleBlur(e){const{onBlur:n}=this.props;n(e)}handleHide(...e){const{onHide:n}=this.props;n(...e)}handleResize(...e){const{onResize:n}=this.props;n(...e)}handleSessionClosed(e){const{onSessionClose:n}=this.props;n(e)}handleSessionOpened(e,n){const{onSessionOpen:s}=this.props;s(e,n)}handleBeforeShow(...e){const{onBeforeShow:n}=this.props;n(...e)}handleShow(...e){const{onShow:n}=this.props;n(...e)}handleTabBlur(...e){const{onTabBlur:n}=this.props;n(...e)}handleTabFocus(...e){const{onTabFocus:n}=this.props;n(...e)}handleRenameCancel(){this.setState({showRenameDialog:!1})}handleShowRenameDialog(){this.setState({showRenameDialog:!0})}handleRenameSubmit(e){const{glContainer:n}=this.props;this.setState({showRenameDialog:!1,title:e});const s=oe.getRootFromContainer(n),i=oe.getComponentConfigFromContainer(n);L(i),oe.renameComponent(s,i,e)}handleCopyPanel(){const{glContainer:e,glEventHub:n}=this.props,s=oe.getRootFromContainer(e),i=oe.getComponentConfigFromContainer(e);if(i==null){x1.error("Could not get component config from container",e);return}const o=oe.cloneComponent(s,i);o!==null&&n.emit(De.CLONED,this,o)}getCloneAction(){return{title:"Copy Panel",order:10,group:ae.groups.high,action:this.handleCopyPanel}}getRenameAction(){return{title:"Rename",order:10,group:ae.groups.medium,action:this.handleShowRenameDialog}}render(){const{children:e,className:n,renderTabTooltip:s,glContainer:i,additionalActions:o,errorMessage:r,isLoaded:l,isLoading:a,isClonable:d,isRenamable:c}=this.props,{tab:u}=i,{showRenameDialog:m,title:p}=this.state;return T("div",{className:z("h-100 w-100 iris-panel",n),onFocusCapture:this.handleFocus,onBlurCapture:this.handleBlur,children:[e,h(Vl,{errorMessage:r,isLoaded:l,isLoading:a}),u!=null&&bi.createPortal(T(Te,{children:[h(ig,{glContainer:i,additionalActions:this.getAdditionActions(o,d,c)}),c&&h(og,{isShown:m,value:p,itemType:"Panel",onCancel:this.handleRenameCancel,onSubmit:this.handleRenameSubmit}),s!=null&&h(Ye,{interactive:!0,options:{placement:"bottom"},popperClassName:"panel-tab-popper",children:s()})]}),u.element[0])]})}}ns.defaultProps={className:"",onTab:()=>{},onTabClicked:()=>{},onClearAllFilters:()=>{},onFocus:()=>{},onBlur:()=>{},onHide:()=>{},onResize:()=>{},onSessionClose:()=>{},onSessionOpen:()=>{},onBeforeShow:()=>{},onShow:()=>{},onTabBlur:()=>{},onTabFocus:()=>{},renderTabTooltip:null,additionalActions:[],errorMessage:null,isLoading:!1,isLoaded:!0,isClonable:!1,isRenamable:!1};function ia(t){const{widgetType:e,widgetName:n,glContainer:s,description:i,children:o}=t,r=oe.getTitleFromContainer(s);return T("div",{className:"tab-tooltip-container",children:[T("div",{className:"row flex-nowrap align-items-start",children:[h("span",{className:"tab-tooltip-title",children:T("b",{children:[e," Name "]})}),h("span",{className:"tab-tooltip-name",children:n}),h(Pl,{className:"tab-tooltip-copy",tooltip:"Copy name",copy:n})]}),n!==r&&T("div",{className:"row",children:[h("span",{className:"tab-tooltip-title",children:h("b",{children:"Display Name"})}),h("span",{className:"tab-tooltip-name",children:r})]}),i&&h("div",{className:"row",children:h("span",{className:"tab-tooltip-description",children:i})}),o]})}ia.propTypes={glContainer:jd.Container.isRequired,widgetType:D.exports.string,widgetName:D.exports.string,description:D.exports.string,children:D.exports.node};ia.defaultProps={widgetType:"",widgetName:"",description:null,children:null};class oa extends w.exports.PureComponent{constructor(e){super(e),this.getCachedRenderTabTooltip=Se((n,s,i,o,r)=>n?()=>h(ia,{glContainer:s,widgetType:i,widgetName:o,description:r}):null),this.handleSessionClosed=this.handleSessionClosed.bind(this),this.handleSessionOpened=this.handleSessionOpened.bind(this),this.handleCopyName=this.handleCopyName.bind(this),this.state={isClientDisconnected:!1,isPanelDisconnected:!1,isWidgetDisconnected:!1,isWaitingForReconnect:!1,isPanelInactive:!1}}handleCopyName(){const{widgetName:e}=this.props;ro(e)}getErrorMessage(){const{errorMessage:e}=this.props,{isClientDisconnected:n,isPanelDisconnected:s,isWidgetDisconnected:i,isWaitingForReconnect:o}=this.state;if(e)return`${e}`;if(n&&s&&o)return`Disconnected from server.
37
+ Check your internet connection.`;if(n&&s)return"Disconnected from server.";if(s){const{widgetName:r,widgetType:l}=this.props;return`Variable "${r}" not set.
38
+ ${l} does not exist yet.`}if(i){const{widgetName:r}=this.props;return`${r} is unavailable.`}}handleSessionClosed(...e){const{onSessionClose:n}=this.props;this.setState({isPanelDisconnected:!0,isWaitingForReconnect:!1}),n(...e)}handleSessionOpened(...e){const{onSessionOpen:n}=this.props;n(...e)}render(){const{children:e,className:n,componentPanel:s,isLoaded:i,isLoading:o,glContainer:r,glEventHub:l,isDisconnected:a,isClonable:d,isRenamable:c,showTabTooltip:u,renderTabTooltip:m,widgetType:p,widgetName:g,description:f,onClearAllFilters:b,onHide:C,onFocus:S,onBlur:v,onResize:y,onShow:E,onTabBlur:I,onTabFocus:R,onTabClicked:N}=this.props,{isPanelDisconnected:F,isWidgetDisconnected:P,isPanelInactive:H}=this.state,x=this.getErrorMessage(),A=m!=null?m:this.getCachedRenderTabTooltip(u,r,p,g,f),k=[{title:`Copy ${p} Name`,group:ae.groups.medium,order:20,action:this.handleCopyName}];return T(ns,{className:z(n,{disconnected:F||P||a,inactive:H}),componentPanel:s,glContainer:r,glEventHub:l,onClearAllFilters:b,onHide:C,onFocus:S,onBlur:v,onResize:y,onShow:E,onSessionClose:this.handleSessionClosed,onSessionOpen:this.handleSessionOpened,onTabBlur:I,onTabFocus:R,onTabClicked:N,renderTabTooltip:A,errorMessage:x,isLoaded:i,isLoading:o,isClonable:d,isRenamable:c,additionalActions:k,children:[e,H&&h("div",{className:"fill-parent-absolute"})]})}}oa.defaultProps={className:"",errorMessage:null,isClonable:!0,isDisconnected:!1,isLoading:!1,isLoaded:!0,isRenamable:!0,showTabTooltip:!0,widgetName:"Widget",widgetType:"Widget",renderTabTooltip:null,description:"",onFocus:()=>{},onBlur:()=>{},onHide:()=>{},onClearAllFilters:()=>{},onResize:()=>{},onSessionClose:()=>{},onSessionOpen:()=>{},onShow:()=>{},onTabBlur:()=>{},onTabFocus:()=>{},onTabClicked:()=>{}};const Yt=Object.freeze({DEFAULT:"DEFAULT",LINKER:"LINKER"}),_1="SET_SESSION_WRAPPER",k1=Ks(_1,null),O1={sessionWrapper:k1},L1=new Map,ra=Object.freeze([]),rg=(t,e)=>{var n;return(n=Zt(t,e).columns)!=null?n:ra},A1=(t,e)=>{var n;return(n=Zt(t,e).filterSets)!=null?n:ra},hc=(t,e)=>{var n;return(n=Zt(t,e).filters)!=null?n:ra},uc=(t,e)=>{var n;return(n=Zt(t,e).tableMap)!=null?n:L1},mc=(t,e)=>Zt(t,e).isolatedLinkerPanelId,fo=(t,e)=>{var n;return(n=Zt(t,e).links)!=null?n:ra},pc=(t,e)=>Zt(t,e).columnSelectionValidator,P1=(t,e)=>Zt(t,e).connection,wi=(t,e)=>Zt(t,e).sessionWrapper,H1=(t,e)=>n=>n(ts(t,{connection:e})),V1=(t,e)=>n=>n(ts(t,{sessionWrapper:e})),gc=(t,e)=>n=>n(ts(t,{links:e})),U1=(t,e)=>(n,s)=>{const i=fo(s(),t),o=e.filter(r=>i.findIndex(l=>ut(l.start,r.start)&&ut(l.end,r.end))<0);return n(gc(t,i.concat(o)))},B1=(t,e)=>(n,s)=>{const o=fo(s(),t).filter(r=>!e.includes(r.id));return n(gc(t,o))},lg=(t,e)=>n=>n(ts(t,{isolatedLinkerPanelId:e})),$1=(t,e)=>n=>n(ts(t,{columnSelectionValidator:e})),z1=(t,e)=>n=>n(ts(t,{consoleSettings:e})),W1=(t,e)=>n=>n(ts(t,{filterSets:e}));Object.entries(O1).map(([t,e])=>ho.register(t,e));function ag({columnMap:t,inputFilterMap:e,linkedColumnMap:n,onAdd:s,onOpenLinker:i,waitingFilterMap:o,waitingInputMap:r}){const l=w.exports.useMemo(()=>{const p=Array.from(r.keys()),g=p.find(C=>e.get(C)!=null),f=p.find(C=>n.get(C)!=null),b=nn.join(p.map(C=>`"${C}"`));return g!=null&&g&&f!=null&&f?`Use a filter control or linked table to set a value for ${b}`:g!=null&&g?`Set a filter control value for ${b}`:`Double click a row in a linked table to set a value for ${b}`},[e,n,r]),a=w.exports.useMemo(()=>Array.from(t.values()),[t]),d=w.exports.useCallback(p=>{p.stopPropagation(),p.preventDefault(),s(Array.from(o.values()))},[s,o]),c=w.exports.useCallback(p=>{p.stopPropagation(),p.preventDefault(),i()},[i]),u=o.size>0,m=!u&&r.size>0;return h("div",{className:"chart-panel-overlay chart-filter-overlay",children:T("div",{className:z("chart-panel-overlay-content chart-filter-overlay-content",{"chart-filter-waiting-filter":u},{"chart-filter-waiting-input":m}),children:[u&&T(Te,{children:[h("div",{className:"info-message",children:"This plot requires a filter control to be added to the layout or a table link to be created on the following columns:"}),h("div",{className:"waiting-filter-list",children:a.map(p=>{const g=o.has(p.name),f=g?fs:yd;return T("div",{className:z("waiting-filter-item",{"is-invalid":g}),children:[h(ee,{icon:f}),p.name]},p.name)})}),T("div",{children:[h(jo,{onClick:d,className:"btn-primary",children:"Add Input Filters"}),h(jo,{onClick:c,className:"btn-primary",children:"Open Linker Tool"})]})]}),m&&T(Te,{children:[h("div",{className:"info-message",children:"Waiting for User Input"}),h("div",{className:"",children:l})]})]})})}ag.propTypes={columnMap:D.exports.instanceOf(Map).isRequired,inputFilterMap:D.exports.instanceOf(Map).isRequired,linkedColumnMap:D.exports.instanceOf(Map).isRequired,onAdd:D.exports.func.isRequired,onOpenLinker:D.exports.func.isRequired,waitingFilterMap:D.exports.instanceOf(Map).isRequired,waitingInputMap:D.exports.instanceOf(Map).isRequired};function Qo({columns:t,onColumnSelected:e,onMouseEnter:n,onMouseLeave:s}){return h("div",{className:"chart-panel-overlay chart-column-selector-overlay",children:T("div",{className:z("chart-panel-overlay-content"),children:[h("div",{className:"info-message",children:"This plot requires a filter control to be added to the layout or a table link to be created on the following columns:"}),h("div",{className:"waiting-column-select-list",children:t.map(i=>h(Bl,{className:z("btn-chart-column-selector",Qo.makeButtonClassName(i.name)),onClick:()=>e(i.name),onMouseEnter:()=>{n&&n(i)},onMouseLeave:s,disabled:!i.isValid,isLinked:i.isActive,children:i.name},i.name))})]})})}Qo.makeButtonClassName=t=>`btn-chart-column-selector-${t}`;Qo.defaultProps={onMouseEnter:()=>{},onMouseLeave:()=>{}};const en=Z.module("ChartPanel"),G1=150;function sl(t){return t.settings!==void 0}function K1(t){return t.inputFilters!=null}function q1(t){return t.panelState!=null}class la extends w.exports.Component{constructor(e){super(e),this.getWaitingInputMap=Se((r,l,a)=>{if(!r)return new Map;const d=new Map(l);return a.forEach((c,u)=>{d.delete(u)}),d}),this.getWaitingFilterMap=Se((r,l,a,d,c)=>{if(!r)return new Map;const u=new Map(l);return a.forEach((m,p)=>{u.delete(p)}),c.forEach((m,p)=>{u.delete(p)}),d.forEach((m,p)=>{u.delete(p)}),u}),this.getInputFilterColumnMap=Se((r,l)=>{const a=new Map;for(let d=0;d<l.length;d+=1){const c=l[d],{name:u,type:m}=c,p=r.get(u);p!=null&&p.type===m&&a.set(u,c)}return a}),this.getLinkedColumnMap=Se((r,l)=>{const a=new Map,d=oe.getIdFromPanel(this);for(let c=0;c<l.length;c+=1){const u=l[c];let m=null;if(u.start!=null&&u.start.panelId===d&&r.has(u.start.columnName)?m=u.start.columnName:u.end&&u.end.panelId===d&&r.has(u.end.columnName)&&(m=u.end.columnName),m!=null&&r.has(m)){const p=r.get(m);L(p),a.set(m,p)}}return a}),this.getSelectorColumns=Se((r,l,a)=>Array.from(r.values()).map(d=>({name:d.name,type:d.type,isValid:a?a(this,d):!1,isActive:l.has(d.name)}))),this.handleColumnSelected=this.handleColumnSelected.bind(this),this.handleColumnMouseEnter=this.handleColumnMouseEnter.bind(this),this.handleColumnMouseLeave=this.handleColumnMouseLeave.bind(this),this.handleDisconnect=this.handleDisconnect.bind(this),this.handleReconnect=this.handleReconnect.bind(this),this.handleFilterAdd=this.handleFilterAdd.bind(this),this.handleHide=this.handleHide.bind(this),this.handleError=this.handleError.bind(this),this.handleLoadError=this.handleLoadError.bind(this),this.handleLoadSuccess=this.handleLoadSuccess.bind(this),this.handleResize=this.handleResize.bind(this),this.handleSettingsChanged=this.handleSettingsChanged.bind(this),this.handleOpenLinker=this.handleOpenLinker.bind(this),this.handleShow=this.handleShow.bind(this),this.handleSourceColumnChange=this.handleSourceColumnChange.bind(this),this.handleSourceFilterChange=this.handleSourceFilterChange.bind(this),this.handleSourceSortChange=this.handleSourceSortChange.bind(this),this.handleTabBlur=this.handleTabBlur.bind(this),this.handleTabFocus=this.handleTabFocus.bind(this),this.handleUpdate=this.handleUpdate.bind(this),this.updateModelFromSource=Ze(this.updateModelFromSource.bind(this),G1),this.handleClearAllFilters=this.handleClearAllFilters.bind(this),this.panelContainer=X.createRef(),this.chart=X.createRef(),this.pending=new Ss;const{metadata:n,panelState:s}=e,{filterValueMap:i=[],settings:o={}}=s!=null?s:{};this.state={settings:o,error:void 0,isActive:!1,isDisconnected:!1,isLoading:!1,isLoaded:!1,isLinked:n!=null&&sl(n)&&n.settings.isLinked,filterMap:new Map(i),filterValueMap:new Map(i),model:void 0,columnMap:new Map,panelState:s}}componentDidMount(){this.isHidden()||(this.setState({isActive:!0}),this.initModel())}componentDidUpdate(e,n){const{inputFilters:s,source:i}=this.props,{columnMap:o,model:r,filterMap:l,filterValueMap:a,isLinked:d,settings:c}=this.state;!r||(o!==n.columnMap&&this.pruneFilterMaps(),s!==e.inputFilters&&this.updateChangedInputFilters(s,e.inputFilters),l!==n.filterMap?this.updateFilters():a!==n.filterValueMap&&this.updatePanelState(),c!==n.settings&&Th(r)&&(r.updateSettings(c),this.updatePanelState()),d!==n.isLinked?i&&(d?(this.startListeningToSource(i),this.updateModelFromSource()):this.stopListeningToSource(i)):d&&i!==e.source&&(e.source&&this.stopListeningToSource(e.source),i&&(this.startListeningToSource(i),this.updateModelFromSource())))}componentWillUnmount(){this.pending.cancel();const{source:e}=this.props;e&&this.stopListeningToSource(e)}initModel(){this.setState({isLoading:!0,isLoaded:!1,error:void 0});const{makeModel:e}=this.props;this.pending.add(e(),n=>{n.close()}).then(this.handleLoadSuccess,this.handleLoadError)}startListeningToSource(e){en.debug("startListeningToSource",e),e.addEventListener(M.Table.EVENT_CUSTOMCOLUMNSCHANGED,this.handleSourceColumnChange),e.addEventListener(M.Table.EVENT_FILTERCHANGED,this.handleSourceFilterChange),e.addEventListener(M.Table.EVENT_SORTCHANGED,this.handleSourceSortChange)}stopListeningToSource(e){en.debug("stopListeningToSource",e),e.removeEventListener(M.Table.EVENT_CUSTOMCOLUMNSCHANGED,this.handleSourceColumnChange),e.removeEventListener(M.Table.EVENT_FILTERCHANGED,this.handleSourceFilterChange),e.removeEventListener(M.Table.EVENT_SORTCHANGED,this.handleSourceSortChange)}loadModelIfNecessary(){const{isActive:e,isLoaded:n,isLoading:s}=this.state;e&&!n&&!s&&this.initModel()}isHidden(){const{glContainer:e}=this.props,{isHidden:n}=e;return n}handleColumnSelected(e){const{glEventHub:n}=this.props,{columnMap:s}=this.state;n.emit(no.COLUMN_SELECTED,this,s.get(e))}handleColumnMouseEnter({type:e,name:n}){const{columnSelectionValidator:s}=this.props;en.debug("handleColumnMouseEnter",s,e,n),s&&s(this,{type:e,name:n})}handleColumnMouseLeave(){const{columnSelectionValidator:e}=this.props;en.debug("handleColumnMouseLeave",e),e&&e(this,void 0)}handleDisconnect(){this.setState({error:new Error("Figure disconnected"),isDisconnected:!0})}handleFilterAdd(e){for(let n=0;n<e.length;n+=1)this.openInputFilter(e[n])}handleOpenLinker(){const{localDashboardId:e,setActiveTool:n,setDashboardIsolatedLinkerPanelId:s}=this.props;s(e,void 0),n(Yt.LINKER)}handleReconnect(){this.setState({isDisconnected:!1,error:void 0}),this.sendColumnChange(),this.updateColumnFilters()}handleLoadSuccess(e){en.debug("handleLoadSuccess");const{model:n}=this.state;this.setState({model:e,isLoaded:!0},()=>{const{inputFilters:s,source:i}=this.props,{filterMap:o,isLinked:r}=this.state;e!==n&&(this.sendColumnChange(),this.updateColumnFilters(),this.updateInputFilters(s,o.size>0||e.isFilterRequired()),i&&r&&(this.startListeningToSource(i),this.updateModelFromSource()))})}handleLoadError(e){ye.isCanceled(e)||(en.error("handleLoadError",e),this.setState({error:e,isLoading:!1}))}handleSourceColumnChange(){this.updateModelFromSource()}handleSourceFilterChange(){this.updateModelFromSource()}handleSourceSortChange(){this.updateModelFromSource()}updateModelFromSource(){const{metadata:e,source:n}=this.props,{isLinked:s,model:i}=this.state;if(!s||!i||!n){en.debug2("updateModelFromSource ignoring",s,i,n);return}if(this.pending.cancel(),sl(e)){const{settings:o}=e;this.pending.add(M.plot.Figure.create(xe.makeFigureSettings(o,n))).then(r=>{Th(i)&&i.setFigure(r)}).catch(this.handleLoadError)}this.updatePanelState()}updatePanelState(){const{sourcePanel:e}=this.props,{panelState:n,filterValueMap:s,settings:i}=this.state;let{tableSettings:o}=n!=null?n:{};if(e&&K1(e.props)&&q1(e.state)){const{inputFilters:r}=e.props,{panelState:l}=e.state;l!=null&&(o=ie.extractTableSettings(l,r))}this.setState({panelState:{settings:i,tableSettings:o,filterValueMap:Array.from(s)}})}handleError(){this.setState({isLoading:!1})}handleResize(){this.updateChart()}handleSettingsChanged(e){this.setState(({settings:n})=>{const s={...n,...e};return en.debug("Updated settings",s),{settings:s}})}handleHide(){this.setActive(!1)}handleShow(){this.setActive(!0)}handleTabBlur(){this.setActive(!1)}handleTabFocus(){const e=this.isHidden();this.setActive(!e)}handleUpdate(){this.setState({isLoading:!1})}handleClearAllFilters(){this.setState({filterValueMap:new Map,filterMap:new Map}),this.updatePanelState()}openInputFilter(e){const{glEventHub:n}=this.props,{name:s,type:i}=e;n.emit(Pe.OPEN_INPUT,{title:`${s} Filter`,panelState:{name:s,type:i,isValueShown:!0},createNewStack:!0,focusElement:"input"})}setActive(e){this.setState({isActive:e},()=>{e&&(this.loadModelIfNecessary(),this.updateChart())})}sendColumnChange(){const{model:e}=this.state;if(!e)return;const{glEventHub:n}=this.props;n.emit(Pe.COLUMNS_CHANGED,this,Array.from(e.getFilterColumnMap().values()))}getCoordinateForColumn(e){var l;const n=Qo.makeButtonClassName(e);if(!this.panelContainer.current)return null;const s=this.panelContainer.current.querySelector(`.${n}`),i=(l=s==null?void 0:s.getBoundingClientRect())!=null?l:null;if(i==null||i.width<=0||i.height<=0)return null;const o=i.left+i.width/2,r=i.bottom;return[o,r]}setFilterMap(e){en.debug("setFilterMap",e),this.setState(n=>{const{columnMap:s,filterMap:i}=n;let o=null;const r=new Map(n.filterValueMap);return e.forEach(({columnType:l,value:a},d)=>{const c=s.get(d);c==null||c.type!==l||(r.set(d,a),i.get(d)!==a&&(o===null&&(o=new Map(i)),o.set(d,a)))}),{filterValueMap:r,filterMap:o!=null?o:i}})}unsetFilterValue(e){this.setState(n=>{var a;const{inputFilters:s}=this.props,{columnMap:i}=n;let{filterMap:o,filterValueMap:r}=n;if(!r.has(e))return null;r=new Map(n.filterValueMap),r.delete(e);const l=this.getInputFilterColumnMap(i,s);if(l.has(e)){const d=o.get(e),c=(a=l.get(e))==null?void 0:a.value;c!=null&&d!==c&&(o=new Map(n.filterMap),c.length>0?o.set(e,c):o.delete(e))}else o=new Map(n.filterMap),o.delete(e);return{filterMap:o,filterValueMap:r}})}updateChangedInputFilters(e,n){const s=n.filter(o=>e.find(r=>r.name===o.name&&r.type===o.type)===void 0);s.length>0&&this.deleteInputFilters(s);const i=e.filter(o=>!n.includes(o));i.length>0&&this.updateInputFilters(i)}updateInputFilters(e,n=!1){this.setState(s=>{const{columnMap:i}=s,o=new Map(s.filterValueMap),r=new Map(s.filterMap),l=n?{filterMap:r,filterValueMap:o}:{};for(let a=0;a<e.length;a+=1){const{name:d,type:c,value:u}=e[a],m=i.get(d);m!=null&&m.type===c&&(u!=null&&r.get(d)!==u&&(u===""?r.delete(d):r.set(d,u),l.filterMap=r),o.has(d)&&(o.delete(d),l.filterValueMap=o))}return en.debug("updateInputFilters",l),l})}deleteInputFilters(e,n=!1){this.setState(s=>{const{columnMap:i,filterValueMap:o}=s,r=new Map(s.filterMap);let l=n;for(let a=0;a<e.length;a+=1){const{name:d,type:c}=e[a],u=i.get(d);if(u!=null&&u.type===c&&r.has(d)){const m=r.get(d);if(o.has(d)){const p=o.get(d);p!==m&&p!=null&&(l=!0,r.set(d,p))}else l=!0,r.delete(d)}}return en.debug("deleteInputFilters",l),l?{filterMap:r}:null})}updateColumnFilters(){this.setState(({model:e})=>e?{columnMap:e.getFilterColumnMap()}:null)}updateFilters(){const{columnMap:e,filterMap:n,model:s}=this.state;L(s);const i=this.getWaitingInputMap(s.isFilterRequired(),e,n);if(s.setFilter(n),n.size>0&&i.size===0){const o=s.getDefaultTitle(),r=nn.join(Array.from(n.entries()).map(([l,a])=>`${l}: ${a}`));o?s.setTitle(`${o}<br><span style="font-size: smaller">${r}</span>`):s.setTitle(r),en.debug2("updateFilters filters set",n),this.setState({isLoading:!0})}else en.debug2("updateFilters waiting on inputs",i),s.setTitle(s.getDefaultTitle()),this.setState({isLoading:!1});this.updatePanelState()}pruneFilterMaps(){this.setState(e=>{const{columnMap:n}=e,s=new Map(e.filterMap),i=new Map(e.filterValueMap),o={};return e.filterValueMap.forEach((r,l)=>{n.has(l)||(i.delete(l),o.filterValueMap=i)}),e.filterMap.forEach((r,l)=>{n.has(l)||(s.delete(l),o.filterMap=s)}),o})}updateChart(){this.chart.current&&this.chart.current.updateDimensions()}render(){const{columnSelectionValidator:e,glContainer:n,glEventHub:s,inputFilters:i,isLinkerActive:o,links:r,metadata:l,settings:a}=this.props,{columnMap:d,filterMap:c,error:u,model:m,isActive:p,isDisconnected:g,isLoaded:f,isLoading:b}=this.state;let C;sl(l)?C=l.table:C=l.figure;const S=this.getInputFilterColumnMap(d,i),v=this.getLinkedColumnMap(d,r),y=m!=null?this.getWaitingInputMap(m.isFilterRequired(),d,c):new Map,E=m!=null?this.getWaitingFilterMap(m.isFilterRequired(),d,c,v,S):new Map,I=u!=null?`Unable to open chart. ${u}`:void 0,R=y.size>0,N=d.size>0&&o;return h(oa,{className:z("iris-chart-panel",{"input-required":R}),componentPanel:this,glContainer:n,glEventHub:s,onHide:this.handleHide,onClearAllFilters:this.handleClearAllFilters,onResize:this.handleResize,onShow:this.handleShow,onTabBlur:this.handleTabBlur,onTabFocus:this.handleTabFocus,errorMessage:I,isDisconnected:g,isLoading:b,isLoaded:f,widgetName:C,widgetType:"Chart",children:T("div",{ref:this.panelContainer,className:"chart-panel-container h-100 w-100",children:[h("div",{className:"chart-container h-100 w-100",children:f&&m&&h(Nm,{isActive:p,model:m,settings:a,ref:this.chart,onDisconnect:this.handleDisconnect,onReconnect:this.handleReconnect,onUpdate:this.handleUpdate,onError:this.handleError,onSettingsChanged:this.handleSettingsChanged})}),h(mt,{in:R&&!N&&!b,timeout:ze.transitionMs,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,children:h(ag,{inputFilterMap:S,linkedColumnMap:v,onAdd:this.handleFilterAdd,onOpenLinker:this.handleOpenLinker,columnMap:d,waitingFilterMap:E,waitingInputMap:y})}),h(mt,{in:N,timeout:ze.transitionMs,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,children:h(Qo,{columns:this.getSelectorColumns(d,v,e),onColumnSelected:this.handleColumnSelected,onMouseEnter:this.handleColumnMouseEnter,onMouseLeave:this.handleColumnMouseLeave})})]})})}}la.defaultProps={columnSelectionValidator:null,isLinkerActive:!1,source:null,sourcePanel:null,panelState:null,settings:{}};la.displayName="ChartPanel";la.COMPONENT="ChartPanel";const Y1=(t,e)=>{const{localDashboardId:n,metadata:s}=e;let i;s!=null&&(i=s.sourcePanelId);const o=uc(t,n),r=Sp(t,n),l=ql(t),a=mc(t,n),d=l===Yt.LINKER&&a===void 0;return{columnSelectionValidator:pc(t,n),isLinkerActive:d,inputFilters:hc(t,n),links:fo(t,n),source:i!=null?o.get(i):void 0,sourcePanel:i!=null?r.get(i):void 0,settings:Rt(t)}},Xi=It(Y1,{setActiveTool:Xl,setDashboardIsolatedLinkerPanelId:lg},null,{forwardRef:!0})(la);const Kr=Z.module("CommandHistoryPanel"),dg=class extends w.exports.Component{constructor(t){super(t),this.handleFocusHistory=this.handleFocusHistory.bind(this),this.handleSessionOpened=this.handleSessionOpened.bind(this),this.handleSessionClosed=this.handleSessionClosed.bind(this),this.handleShow=this.handleShow.bind(this),this.handleSendToConsole=this.handleSendToConsole.bind(this),this.handleSendToNotebook=this.handleSendToNotebook.bind(this),this.container=X.createRef(),this.pending=new Ss;const{session:e,sessionId:n,language:s}=t;this.state={panelState:{},session:e,sessionId:n,language:s,contextActions:[{action:this.handleFocusHistory,shortcut:Bt.COMMAND_HISTORY.FOCUS_HISTORY}]}}static handleError(t){Kr.error(t)}componentDidMount(){const{glEventHub:t,session:e}=this.props;t.on(bt.FOCUS_HISTORY,this.handleFocusHistory),e!=null&&this.loadTable()}componentWillUnmount(){const{glEventHub:t}=this.props;t.off(bt.FOCUS_HISTORY,this.handleFocusHistory),this.pending.cancel()}handleFocusHistory(){this.container.current&&this.container.current.focus()}handleShow(){var t;(t=this.container.current)==null||t.restoreScrollPosition()}handleSessionOpened(t,{language:e,sessionId:n}){this.setState({session:t,sessionId:n,language:e},()=>{this.loadTable()})}handleSessionClosed(){this.pending.cancel(),this.setState({session:void 0,language:void 0,table:void 0})}handleSendToNotebook(t,e=!1){const{session:n,language:s}=this.state;if(Kr.debug("handleSendToNotebook",n,t),!n){Kr.error("Session is not connected.");return}const{glEventHub:i}=this.props;i.emit(e?Le.CREATE_NOTEBOOK:Le.SEND_TO_NOTEBOOK,n,s,t)}handleSendToConsole(t,e=!0,n=!1){Kr.debug("handleSendToConsole",t);const{glEventHub:s}=this.props;s.emit(bt.SEND_COMMAND,t,e,n)}loadTable(){const{commandHistoryStorage:t}=this.props,{language:e,sessionId:n}=this.state;L(e),L(n),this.pending.add(t.getTable(e,n,Date.now()),s=>s.close()).then(s=>{this.setState({table:s})}).catch(dg.handleError)}render(){const{glContainer:t,glEventHub:e,commandHistoryStorage:n}=this.props,{language:s,contextActions:i,table:o}=this.state;return T(ns,{className:"command-history-pane",componentPanel:this,glContainer:t,glEventHub:e,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,onShow:this.handleShow,children:[!o&&h("div",{className:"command-history-disconnected-message",children:"Waiting for console connection"}),o&&s!=null&&T(Te,{children:[h(Gl,{ref:this.container,language:s,sendToNotebook:this.handleSendToNotebook,sendToConsole:this.handleSendToConsole,table:o,commandHistoryStorage:n}),h(ae,{actions:i})]})]})}};let fc=dg;fc.COMPONENT="CommandHistoryPanel";fc.TITLE="Command History";const X1=(t,e)=>{const n=_m(t),s=wi(t,e.localDashboardId),{session:i,config:o}=s!=null?s:{},{type:r,id:l}=o!=null?o:{};return{commandHistoryStorage:n,language:r,session:i,sessionId:l}},Il=It(X1,null,null,{forwardRef:!0})(fc);const qr=Z.module("ConsolePanel"),j1=500,Z1=Object.freeze({consoleSettings:{},itemIds:[]});class Cc extends w.exports.PureComponent{constructor(e){super(e),this.savePanelState=Ze(()=>{const{consoleSettings:r,itemIds:l}=this.state,a={consoleSettings:r,itemIds:[...l]};qr.debug("Saving panel state",a),this.setState({panelState:a})},j1),this.handleFocusCommandHistory=this.handleFocusCommandHistory.bind(this),this.handleOpenObject=this.handleOpenObject.bind(this),this.handleCloseObject=this.handleCloseObject.bind(this),this.handleResize=this.handleResize.bind(this),this.handleSettingsChange=this.handleSettingsChange.bind(this),this.handleShow=this.handleShow.bind(this),this.handlePanelMount=this.handlePanelMount.bind(this),this.consoleRef=X.createRef();const{panelState:n}=e,s={...Z1,...n||{}},{consoleSettings:i,itemIds:o}=s;this.state={consoleSettings:i,itemIds:new Map(o),objectMap:new Map,error:void 0,panelState:s}}componentDidMount(){const{glEventHub:e}=this.props;this.closeDisconnectedPanels(),e.on(De.MOUNT,this.handlePanelMount),this.subscribeToFieldUpdates()}componentDidUpdate(e,n){const{consoleSettings:s,itemIds:i}=this.state;(n.consoleSettings!==s||n.itemIds!==i)&&this.savePanelState()}componentWillUnmount(){var n;const{glEventHub:e}=this.props;this.savePanelState.flush(),e.off(De.MOUNT,this.handlePanelMount),(n=this.objectSubscriptionCleanup)==null||n.call(this)}subscribeToFieldUpdates(){const{sessionWrapper:e}=this.props,{session:n}=e;this.objectSubscriptionCleanup=n.subscribeToFieldUpdates(s=>{qr.debug("Got updates",s),this.setState(({objectMap:i})=>{const{updated:o,created:r,removed:l}=s,a=[...o,...l],d=new Map(i);return a.forEach(u=>{const{title:m}=u;m!==void 0&&d.delete(m)}),[...o,...r].forEach(u=>{u.title!==void 0&&d.set(u.title,u)}),{objectMap:d}})})}setItemId(e,n){this.setState(({itemIds:s})=>{const i=new Map(s);return i.set(e,n),{itemIds:i}})}getItemId(e,n=!0){const{itemIds:s}=this.state;let i=s.get(e);return i==null&&n&&(i=We.generate(),this.setItemId(e,i)),i}handleTabFocus(){var e;(e=this.consoleRef.current)==null||e.focus()}handlePanelMount(e){var o,r,l;const{itemIds:n}=this.state,s=(o=e==null?void 0:e.props)==null?void 0:o.id,i=(l=(r=e==null?void 0:e.props)==null?void 0:r.metadata)==null?void 0:l.sourcePanelId;s&&i&&new Set(n.values()).has(i)&&this.setItemId(s,s)}handleFocusCommandHistory(){const{glEventHub:e}=this.props;e.emit(bt.FOCUS_HISTORY)}handleResize(){this.updateDimensions()}handleShow(){this.updateDimensions()}handleOpenObject(e){const{sessionWrapper:n}=this.props,{session:s}=n;this.openWidget(e,s)}handleCloseObject(e){const{title:n}=e;if(n!==void 0){const s=this.getItemId(n,!1),{glEventHub:i}=this.props;i.emit(De.CLOSE,s)}}handleSettingsChange(e){const{glEventHub:n}=this.props;qr.debug("handleSettingsChange",e),this.setState({consoleSettings:e}),n.emit(bt.SETTINGS_CHANGED,e)}openWidget(e,n){const{glEventHub:s}=this.props,{title:i}=e;L(i);const o=this.getItemId(i),r={fetch:()=>n.getObject(e),panelId:o,widget:e};qr.debug("openWidget",r),s.emit(De.OPEN,r)}addCommand(e,n=!0,s=!1){var i;(i=this.consoleRef.current)==null||i.addCommand(e,n,s)}closeDisconnectedPanels(e=!1){const{consoleSettings:n,itemIds:s}=this.state,{isClosePanelsOnDisconnectEnabled:i=!0}=n;if(!i&&!e)return;const o=[...s.values()],{glEventHub:r}=this.props;o.forEach(l=>{r.emit(De.CLOSE,l)}),this.setState({itemIds:new Map})}updateDimensions(){var e;(e=this.consoleRef.current)==null||e.updateDimensions()}render(){const{commandHistoryStorage:e,glContainer:n,glEventHub:s,sessionWrapper:i,timeZone:o,unzip:r}=this.props,{consoleSettings:l,error:a,objectMap:d}=this.state,{config:c,session:u,connection:m}=i,{id:p,type:g}=c;return h(ns,{componentPanel:this,glContainer:n,glEventHub:s,onResize:this.handleResize,onShow:this.handleShow,onTabFocus:this.handleTabFocus,errorMessage:a!=null?`${a}`:void 0,children:u!=null&&h(Pd,{ref:this.consoleRef,settings:l,session:u,focusCommandHistory:this.handleFocusCommandHistory,openObject:this.handleOpenObject,closeObject:this.handleCloseObject,commandHistoryStorage:e,onSettingsChange:this.handleSettingsChange,language:g,statusBarChildren:T(Te,{children:[h("div",{children:"\xA0"}),h("div",{children:am.LANGUAGE_MAP.get(g)}),h("div",{children:"\xA0"}),h("div",{children:h(T0,{connection:m,defaultUpdateInterval:10*1e3,hoverUpdateInterval:3*1e3,monitorDuration:10*60*1e3})}),h("div",{children:"\xA0"})]}),scope:p,timeZone:o,objectMap:d,unzip:r})})}}Cc.COMPONENT="ConsolePanel";Cc.TITLE="Console";const Q1=(t,e)=>({commandHistoryStorage:_m(t),sessionWrapper:wi(t,e.localDashboardId),timeZone:or(t)}),Wi=It(Q1,null,null,{forwardRef:!0})(Cc);const Yr=Z.module("DropdownFilter"),J1=150,il=class extends w.exports.Component{constructor(t){super(t),this.getCompatibleColumns=Se((i,o)=>i!=null?o.filter(({type:r})=>r!==void 0&&_.isCompatibleType(r,i.columnType)):[]),this.getColumnOptions=Se((i,o)=>{let r=-1;const l=[];return l.push(h("option",{value:"-1",children:"Select a column"},"placeholder")),i.forEach((a,d)=>{l.push(h("option",{value:d,children:this.getItemLabel(i,d)},`${a.name}/${a.type}`)),o!==null&&a.name===o.name&&a.type===o.type&&(r=d)}),[l,r]}),this.getSelectedOptionIndex=Se((i,o)=>i.indexOf(o)),this.getValueOptions=Se(i=>[h("option",{value:"-1",children:il.PLACEHOLDER},"-1"),...i.map((o,r)=>h("option",{value:r,children:o!=null?o:"(null)"},`${r}/${o}`))]),this.getItemLabel=be((i,o)=>{const{name:r,type:l}=i[o];if(o>0&&i[o-1].name===r||o<i.length-1&&i[o+1].name===r){const a=l.substring(l.lastIndexOf(".")+1);return`${r} (${a})`}return r}),this.sendUpdate=Ze(()=>{const{onChange:i}=this.props,{column:o,value:r,isValueShown:l}=this.state;i({column:o,isValueShown:l,value:r!=null?r:void 0})},J1),this.handleColumnChange=this.handleColumnChange.bind(this),this.handleSettingsCancel=this.handleSettingsCancel.bind(this),this.handleSettingsClick=this.handleSettingsClick.bind(this),this.handleSettingsSave=this.handleSettingsSave.bind(this),this.handleBackgroundClick=this.handleBackgroundClick.bind(this),this.handleDropdownKeyPress=this.handleDropdownKeyPress.bind(this),this.handleValueChange=this.handleValueChange.bind(this),this.dropdownRef=X.createRef();const{column:e,isValueShown:n,value:s}=t;this.state={column:e,id:We(),selectedColumn:e,disableCancel:!n,isValueShown:n,value:s}}componentDidUpdate(t,e){const{source:n,values:s,isLoaded:i}=this.props,{column:o,value:r,isValueShown:l}=this.state;i&&(n!==t.source&&this.sourceUpdated(),s!==t.values&&r!==""&&!s.includes(r)&&this.resetValue(),l!==e.isValueShown&&l&&this.focusInput(),(o!==e.column||r!==e.value||l!==e.isValueShown)&&this.sendUpdate())}componentWillUnmount(){this.sendUpdate.flush()}handleColumnChange(t){const{value:e}=t.target;if(Yr.debug2("handleColumnChange",e),e!=null&&parseInt(e,10)<0){this.setState({selectedColumn:null});return}const{columns:n,source:s}=this.props,i=this.getCompatibleColumns(s,n);this.setState({selectedColumn:i[parseInt(e,10)]})}handleDropdownKeyPress(t){t.key==="Enter"&&(t.preventDefault(),t.stopPropagation(),Yr.debug2("handleDropdownKeyPress"),this.sendUpdate(),this.sendUpdate.flush())}handleValueChange(t){const{value:e}=t.target,n=parseInt(e,10);let s="";const{values:i}=this.props;n>=0&&n<i.length?s=i[n]:Yr.debug2("Selected default item"),Yr.debug2("handleValueChange",s),this.setState({value:s})}handleSettingsCancel(){this.setState(({column:t})=>({selectedColumn:t,isValueShown:!0}))}handleSettingsSave(){this.setState(({column:t,selectedColumn:e,value:n})=>({column:e,value:t===e?n:"",isValueShown:!0,disableCancel:!1}))}handleSettingsClick(t){t.stopPropagation(),this.showSettings()}handleBackgroundClick(t){t.target!==this.dropdownRef.current&&this.focusInput()}sourceUpdated(){this.setState({column:null,selectedColumn:null,isValueShown:!1,disableCancel:!0,value:""})}showSettings(){const{column:t}=this.state;this.setState({selectedColumn:t,isValueShown:!1})}focusInput(){var t;(t=this.dropdownRef.current)==null||t.focus()}resetValue(){this.setState({value:""})}clearFilter(){this.resetValue()}setFilterState({name:t,type:e,value:n,isValueShown:s}){const i=t!=null&&e!=null?{name:t,type:e}:null;this.setState(({value:o,isValueShown:r})=>({column:i,value:n!=null?n:o,isValueShown:s!=null?s:r}))}render(){var A;const{columns:t,disableLinking:e,isLinkerActive:n,isLoaded:s,source:i,onColumnSelected:o,onSourceMouseEnter:r,onSourceMouseLeave:l,values:a,settingsError:d}=this.props,{column:c,disableCancel:u,id:m,isValueShown:p,selectedColumn:g,value:f}=this.state,b=i===null,C=this.getCompatibleColumns(i,t),S=i!=null,v=(A=i==null?void 0:i.columnName)!=null?A:il.SOURCE_BUTTON_PLACEHOLDER,y=c!=null?`${c.name} Filter`:null,[E,I]=this.getColumnOptions(C,g),R=this.getValueOptions(a),N=this.getSelectedOptionIndex(a,f),F=!S||g==null,P=p&&!n,H=`source-column-btn-${m}`,x=`filter-column-select-${m}`;return T(Td,{className:"dropdown-filter fill-parent-absolute",isFlipped:P,children:[h("div",{className:"dropdown-filter-settings-card",children:T("div",{className:"dropdown-filter-card-content",children:[T("div",{className:"dropdown-filter-settings-grid",children:[h("label",{htmlFor:H,children:"Source Column"}),h(Bl,{id:H,isLinked:S,onClick:o,onMouseEnter:r,onMouseLeave:l,className:il.SOURCE_BUTTON_CLASS_NAME,disabled:e,children:v}),h("div",{className:"text-muted small",children:"Select a source column for the list by linking to a table."}),h("label",{htmlFor:x,children:"Filter Column"}),h("select",{id:x,value:I,className:"custom-select",onChange:this.handleColumnChange,disabled:b,children:E}),h("div",{className:"text-muted small",children:"Dropdown filter control will apply its filter to all columns matching this name in this dashboard."})]}),d&&h("div",{className:"error-message text-center",children:d}),S&&T("div",{className:"dropdown-filter-settings-buttons",children:[h(W,{kind:"secondary",type:"button",onClick:this.handleSettingsCancel,disabled:u||p||n,tooltip:n?"Cancel disabled while linker open":void 0,children:"Cancel"}),h(W,{kind:"primary",type:"button",className:"ml-2",onClick:this.handleSettingsSave,disabled:F||p||n,tooltip:n?"Save disabled while linker open":void 0,children:"Save"})]})]})}),h("div",{className:"dropdown-filter-value-card",onClick:this.handleBackgroundClick,"data-testid":"dropdown-filter-value-background",children:s&&T(Te,{children:[h("div",{className:"dropdown-filter-column",children:h("div",{className:"dropdown-filter-column-title",children:y})}),T("div",{className:"dropdown-filter-card-content",children:[h("div",{className:"dropdown-filter-value-input d-flex flex-column justify-content-center",children:h("select",{className:"custom-select",value:N,ref:this.dropdownRef,onChange:this.handleValueChange,onKeyPress:this.handleDropdownKeyPress,title:"Select Value",children:R})}),d&&h("div",{className:"error-message mt-3 text-center",children:d})]}),h("div",{className:"dropdown-filter-menu",children:h(W,{kind:"ghost",className:"m-2 px-2",onClick:this.handleSettingsClick,icon:h(ee,{icon:sr,transform:"grow-4"}),tooltip:"Dropdown Filter Settings"})})]})})]})}};let so=il;so.defaultProps={column:null,disableLinking:!1,isLinkerActive:!1,isLoaded:!1,isValueShown:!1,settingsError:null,source:null,value:"",values:[],onColumnSelected:()=>{},onSourceMouseEnter:()=>{},onSourceMouseLeave:()=>{}};so.PLACEHOLDER="Select a value...";so.SOURCE_BUTTON_CLASS_NAME="btn-dropdown-filter-selector";so.SOURCE_BUTTON_PLACEHOLDER="Select a column";const ot=Z.module("DropdownFilterPanel"),e2=250,t2=(t,e)=>{const{localDashboardId:n}=e,s=oe.getIdFromPanel({props:e}),i=uc(t,n),o=fo(t,n),r=ql(t),l=mc(t,n),a=r===Yt.LINKER&&(l===void 0||l===s),d=r===Yt.LINKER&&l!==void 0&&l!==s;return{columns:rg(t,n),columnSelectionValidator:pc(t,n),isLinkerActive:a,disableLinking:d,settings:Rt(t),panelTableMap:i,dashboardLinks:o}},n2=It(t2,null,null,{forwardRef:!0}),di=class extends w.exports.Component{constructor(t){super(t),this.getCachedValues=be((d,{type:c,name:u},m)=>c!==void 0&&_.isDateType(c)?d.map(p=>di.DATETIME_FORMATTER.format(p)):d.map(p=>p!=null&&c!=null?m.getFormattedString(p,c,u):null)),this.getCachedPanelLinks=be((d,c)=>{const u=oe.getIdFromPanel(c);return ot.debug("getCachedPanelLinks",d,u),d.filter(m=>{var p;return((p=m.end)==null?void 0:p.panelId)===u})}),this.getCachedSource=be(d=>{ot.debug("getCachedSource",d);let c;if(d.length>0){const[u]=d;c=u.start,d.length>1&&ot.error("Filter has more that one link",d)}return c}),this.getCachedSourceTable=be((d,c)=>{var m;if(ot.debug("getCachedSourceTable",d,c),c==null)return null;const{panelId:u}=c;return(m=d.get(u))!=null?m:null}),this.getCachedSourceColumn=be((d,c)=>{var u;return ot.debug("getCachedSourceColumn",d,c),d==null||c==null?null:(u=d.columns.find(({name:m,type:p})=>m===c.columnName&&p===c.columnType))!=null?u:null}),this.handleChange=Ze(this.handleChange.bind(this),e2),this.handleClearAllFilters=this.handleClearAllFilters.bind(this),this.handleDisconnect=this.handleDisconnect.bind(this),this.handleReconnect=this.handleReconnect.bind(this),this.handleColumnSelected=this.handleColumnSelected.bind(this),this.handleSourceFilterChange=this.handleSourceFilterChange.bind(this),this.handleSourceSortChange=this.handleSourceSortChange.bind(this),this.handleSourceSizeChange=this.handleSourceSizeChange.bind(this),this.handleSourceMouseEnter=this.handleSourceMouseEnter.bind(this),this.handleSourceMouseLeave=this.handleSourceMouseLeave.bind(this),this.handleValuesTableUpdate=this.handleValuesTableUpdate.bind(this),this.dropdownFilterRef=X.createRef(),this.panelContainer=X.createRef(),this.pending=new Ss;const{panelState:e,settings:n}=t;this.columnFormats=Cs.getColumnFormats(n);const{value:s="",isValueShown:i=!1,name:o,type:r,timestamp:l}=e!=null?e:{},a=o!=null&&r!=null?{name:o,type:r}:void 0;this.state={column:a,formatter:new cn(this.columnFormats),valuesTable:void 0,valuesColumn:void 0,sourceSize:0,value:s,timestamp:l,values:[],isValueShown:i,wasFlipped:!1,skipUpdate:!1,panelState:e,isDisconnected:!1,isLoading:!1,isLoaded:!1,error:null}}componentDidMount(){this.updateValuesTable();const{dashboardLinks:t,panelTableMap:e}=this.props,{column:n,value:s,timestamp:i}=this.state,o=this.getSourceTable(e,t);if(o!==null&&this.startListeningToSource(o),n!=null){const{name:r,type:l}=n;this.sendUpdate(r,l,s,i)}}componentDidUpdate(t,e){const{dashboardLinks:n,panelTableMap:s,settings:i}=this.props,{valuesTable:o}=this.state,r=this.getSource(n),l=this.getSourceTable(s,n),a=this.getSource(t.dashboardLinks),d=this.getSourceTable(t.panelTableMap,t.dashboardLinks);i!==t.settings&&i!==void 0&&this.updateFormatterSettings(i),o!==e.valuesTable&&e.valuesTable!=null&&(ot.debug("Table in state modified, closing the old table."),e.valuesTable.close()),(l!==d||r!==a)&&this.updateValuesTable(),l!==d&&(d!==null&&this.stopListeningToSource(d),l!==null&&this.startListeningToSource(l))}componentWillUnmount(){const{dashboardLinks:t,panelTableMap:e}=this.props,{valuesTable:n}=this.state,s=this.getSourceTable(e,t);this.pending.cancel(),s!==null&&this.stopListeningToSource(s),this.cleanup&&this.cleanup(),n!=null&&n.close()}getCoordinateForColumn(){var i;if(this.panelContainer.current==null)return null;const t=this.panelContainer.current.querySelector(`.${so.SOURCE_BUTTON_CLASS_NAME}`),e=(i=t==null?void 0:t.getBoundingClientRect())!=null?i:null;if(e==null||e.width<=0||e.height<=0)return null;const n=e.left+e.width/2,s=e.bottom;return[n,s]}getSettingsErrorMessage(){const{sourceSize:t}=this.state;if(t>di.MAX_TABLE_SIZE)return`Table too large, must have fewer than ${di.MAX_TABLE_SIZE} options.`}getPanelErrorMessage(){const{error:t}=this.state;return t!=null?`${t}`:void 0}getSource(t){const e=this.getCachedPanelLinks(t,this);return this.getCachedSource(e)}getSourceTable(t,e){const n=this.getSource(e);return this.getCachedSourceTable(t,n)}getValuesColumn(t,e){const n=this.getSource(e);return this.getCachedSourceColumn(t,n)}startListeningToSource(t){ot.debug("startListeningToSource"),t.addEventListener(M.Table.EVENT_FILTERCHANGED,this.handleSourceFilterChange),t.addEventListener(M.Table.EVENT_SORTCHANGED,this.handleSourceSortChange),t.addEventListener(M.Table.EVENT_SIZECHANGED,this.handleSourceSizeChange),t.addEventListener(M.Table.EVENT_DISCONNECT,this.handleDisconnect),t.addEventListener(M.Table.EVENT_RECONNECT,this.handleReconnect)}stopListeningToSource(t){ot.debug("stopListeningToSource"),t.removeEventListener(M.Table.EVENT_FILTERCHANGED,this.handleSourceFilterChange),t.removeEventListener(M.Table.EVENT_SORTCHANGED,this.handleSourceSortChange),t.removeEventListener(M.Table.EVENT_SIZECHANGED,this.handleSourceSizeChange),t.removeEventListener(M.Table.EVENT_DISCONNECT,this.handleDisconnect),t.removeEventListener(M.Table.EVENT_RECONNECT,this.handleReconnect)}handleChange({column:t,isValueShown:e=!1,value:n}){const{name:s=void 0,type:i=void 0}=t!=null?t:{};let o=!0,r=Date.now();this.setState(({panelState:l,timestamp:a,wasFlipped:d,skipUpdate:c})=>{var m;const u=l!=null&&e!==l.isValueShown&&s===l.name&&i===l.type&&n===l.value;return o=(m=!c&&e&&(!u||!d))!=null?m:!1,o||(r=a),{panelState:{isValueShown:e,name:s,type:i,value:n,timestamp:r!=null?r:void 0},timestamp:r,wasFlipped:u,skipUpdate:!1}},()=>{o&&this.sendUpdate(s!=null?s:null,i,n,r)})}handleDisconnect(){this.setState({error:new Error("Table disconnected"),isDisconnected:!0,isLoading:!1})}handleReconnect(){this.setState({isDisconnected:!1,error:null})}handleSourceFilterChange(){this.applySourceFilters()}handleSourceSortChange(){this.applySourceSorts()}handleSourceSizeChange({detail:t}){this.setState({sourceSize:t})}handleColumnSelected(){ot.debug("handleColumnSelected");const{glEventHub:t}=this.props;t.emit(Pe.COLUMN_SELECTED,this,di.SOURCE_COLUMN)}handleClearAllFilters(){var t,e;(e=(t=this.dropdownFilterRef)==null?void 0:t.current)==null||e.clearFilter()}setPanelState(t,e=!1){var s,i;const{dashboardLinks:n}=this.props;if(this.getSource(n)==null){ot.debug("Ignore state update for unlinked filter",t);return}this.setState({skipUpdate:!e}),(i=(s=this.dropdownFilterRef)==null?void 0:s.current)==null||i.setFilterState(t)}sendUpdate(t,e,n,s){var a;const{dashboardLinks:i,glEventHub:o}=this.props,r=(a=this.getSource(i))==null?void 0:a.panelId,l=r===null?[]:[r];ot.debug("sendUpdate",{name:t,type:e,value:n,timestamp:s,excludePanelIds:l}),o.emit(Pe.FILTERS_CHANGED,this,{name:t,type:e,value:n!=null?n:"=null",timestamp:s,excludePanelIds:l})}updateValuesTable(){const{dashboardLinks:t,panelTableMap:e}=this.props,n=this.getSource(t),s=this.getSourceTable(e,t);if(ot.debug("updateValuesTable",n,s),this.setState({values:[],valuesTable:void 0,error:null}),n==null){ot.debug("Filter unlinked."),this.setState({isLoading:!1,isLoaded:!0,isValueShown:!1,sourceSize:0});return}this.setState({isLoading:!0}),s!=null&&(this.setState({isLoaded:!1,sourceSize:s.size}),this.pending.add(s.copy(),i=>i.close()).then(i=>{this.updateViewportListener(i),this.setState({valuesTable:i})}).catch(i=>{ye.isCanceled(i)||(ot.error(i),this.setState({isLoading:!1,error:i}))}))}applySourceSorts(){const{dashboardLinks:t,panelTableMap:e}=this.props,{valuesTable:n}=this.state,s=this.getSourceTable(e,t);if(ot.debug("applySourceSorts",s==null?void 0:s.sort),n==null||s==null){ot.debug("Table not initialized");return}const i=[...s.sort];n.applySort(i),this.setViewport(n)}applySourceFilters(){const{dashboardLinks:t,panelTableMap:e}=this.props,{valuesTable:n}=this.state,s=this.getSourceTable(e,t);if(ot.debug("applySourceFilters",s==null?void 0:s.filter),n==null||s==null){ot.debug("Table not initialized");return}const i=[...s.filter];n.applyFilter(i),this.setViewport(n)}updateViewportListener(t){if(ot.debug("updateViewportListener",t==null?void 0:t.size),this.cleanup&&this.cleanup(),t==null){this.cleanup=void 0;return}this.cleanup=t.addEventListener(M.Table.EVENT_UPDATED,this.handleValuesTableUpdate),this.setViewport(t)}setViewport(t){const{dashboardLinks:e}=this.props,n=this.getValuesColumn(t,e);if(!n){ot.error("values column is null");return}t.setViewport(0,di.MAX_TABLE_SIZE-1,[n])}updateFormatterSettings(t){const e=Cs.getColumnFormats(t);ut(this.columnFormats,e)||(this.columnFormats=e,this.setState({formatter:new cn(e)}))}handleValuesTableUpdate({detail:t}){const{rows:e}=t,{dashboardLinks:n}=this.props,{valuesTable:s}=this.state;if(!s){ot.error("valuesTable is null");return}const i=this.getValuesColumn(s,n);if(!i){ot.error("Values column not found");return}const o=e.map(r=>r.get(i));this.setState({values:o,isLoading:!1,isLoaded:!0,valuesColumn:i})}handleSourceMouseEnter(){const{columnSelectionValidator:t}=this.props;!t||t(this,di.SOURCE_COLUMN)}handleSourceMouseLeave(){const{columnSelectionValidator:t}=this.props;!t||t(this,void 0)}render(){const{columns:t,dashboardLinks:e,disableLinking:n,glContainer:s,glEventHub:i,isLinkerActive:o}=this.props,{column:r,formatter:l,isDisconnected:a,isValueShown:d,value:c,values:u,valuesColumn:m,isLoading:p,isLoaded:g}=this.state,f=this.getSource(e),b=this.getSettingsErrorMessage(),C=this.getPanelErrorMessage(),S=g&&m!=null?this.getCachedValues(u,m,l):[];return h(oa,{errorMessage:C,isLoading:p,isLoaded:g,isDisconnected:a,className:"iris-dropdown-filter-panel",componentPanel:this,glContainer:s,glEventHub:i,onClearAllFilters:this.handleClearAllFilters,widgetName:"Dropdown Filter",widgetType:"DropdownFilter",children:h("div",{ref:this.panelContainer,className:"dropdown-filter-container h-100 w-100 container",children:h(so,{ref:this.dropdownFilterRef,column:r,columns:t,isValueShown:d,isLinkerActive:o,disableLinking:n,isLoaded:g,settingsError:b,source:f,value:c,values:S,onChange:this.handleChange,onColumnSelected:this.handleColumnSelected,onSourceMouseEnter:this.handleSourceMouseEnter,onSourceMouseLeave:this.handleSourceMouseLeave})})})}};let Co=di;Co.displayName="DropdownFilterPanel";Co.COMPONENT="DropdownFilterPanel";Co.MAX_TABLE_SIZE=256;Co.DATETIME_FORMATTER=new st({showTimeZone:!1,showTSeparator:!0,defaultDateTimeFormatString:"yyyy-MM-dd HH:mm:ss.SSSSSSSSS"});Co.SOURCE_COLUMN=Object.freeze({name:"FilterSource",type:null});const fi=n2(Co);function Zn(t){return t.type==="directory"}var cg=(t=>(t.GROOVY="text/x-groovy",t.PLAIN_TEXT="text/plain",t.PYTHON="text/x-python",t.PYTHON_COMPILED="application/x-python-code",t.SCALA="text/x-scala",t.UNKNOWN="",t))(cg||{});class pe{static fileExtensionToString(e=""){return e.length===0?"":`.${e}`}static getDepth(e){var s;if(!pe.hasPath(e))throw new Error(`Invalid path provided: ${e}`);return((s=e.match(/\//g))!=null?s:[]).length-1}static getExtension(e){var s;const n=this.getBaseName(e).split(".");return n.length>1&&(s=n.pop())!=null?s:""}static getBaseName(e){var n;return(n=e.split("/").pop())!=null?n:""}static getCopyFileName(e){const n=e.lastIndexOf(".");let s=null,i=null;n<0?i=e:(i=e.substring(0,n),s=e.substring(n+1));const o=i?`${i}-copy`:"Copy";return s!==null?`${o}.${s}`:o}static getMimeType(e){switch(this.getExtension(e).toLowerCase()){case"groovy":return"text/x-groovy";case"py":return"text/x-python";case"pyc":return"application/x-python-code";case"scala":return"text/x-scala";case"txt":return"text/plain";default:return""}}static getParent(e){if(!pe.hasPath(e))throw new Error(`Invalid name provided: ${e}`);const n=e.split("/");for(;n.pop()==="";);if(n.length===0)throw new Error(`No parent for path provided: ${e}`);return`${n.join("/")}/`}static getPath(e){if(!pe.hasPath(e))throw new Error(`Invalid filename provided: ${e}`);const n=e.split("/");return n.pop(),`${n.join("/")}/`}static hasPath(e){return e.startsWith("/")}static isPath(e){return e.startsWith("/")&&e.endsWith("/")}static makePath(e){return e.endsWith("/")?e:`${e}/`}static replaceExtension(e,n=""){const s=e.lastIndexOf("."),i=s>-1?e.substring(0,s):e,o=pe.fileExtensionToString(n);return`${i}${o}`}static validateName(e){var o,r;const n=[".",".."],s=/[\\/\0]/g,i=new Map([["\0","null"]]);if(!e)throw new Ki("Name cannot be empty");if(n.includes(e))throw new Ki(`"${e}" is a reserved name`);if(s.test(e))throw new Ki(`Invalid characters in name: "${(r=(o=e.match(s))==null?void 0:o.reduce((l,a)=>l.includes(a)?l:[...l,a],[]).map(l=>i.has(l)?i.get(l):l).join('", "'))!=null?r:""}"`)}static reducePaths(e){const n=e.filter(s=>pe.isPath(s));return e.filter(s=>!n.some(i=>s!==i&&s.startsWith(i)))}static removeRoot(e,n){if(e.length===0)return n;if(!n.startsWith(e))throw new Error(`Filename ${n} does not start with expected root ${e}`);return n.substring(e.length)}static addRoot(e,n){return`${e}${n}`}}const At=Z.module("FileList"),od=t=>Zn(t)?pe.makePath(t.filename):pe.getPath(t.filename),bc=26,s2=500,qh="item-list-scroll-pane",rd=t=>{var I;const{children:e,draggedItems:n,isDragInProgress:s,isDropTargetValid:i,isSelected:o,item:r,itemIndex:l,dropTargetItem:a,onDragStart:d,onDragOver:c,onDragEnd:u,onDrop:m}=t,p=(I=n==null?void 0:n.some(R=>R.id===r.id))!=null?I:!1,g=od(r),f=s&&a?od(a):null,b=s&&i&&Zn(r)&&f===g,C=s&&i&&f===g,S=s&&!i&&f===g,v=i2(r),y=pe.getDepth(r.filename),E=Array(y).fill(null).map((R,N)=>h("span",{className:"file-list-depth-line"},N));return T("div",{className:z("d-flex w-100 align-items-center","file-list-item",{"is-dragged":p,"is-exact-drop-target":b,"is-in-drop-target":C,"is-invalid-drop-target":S,"is-selected":o}),onDragStart:R=>d(l,R),onDragOver:R=>c(l,R),onDragEnd:R=>u(l,R),onDrop:R=>m(l,R),draggable:!0,role:"presentation","aria-label":r.basename,children:[E," ",h(ee,{icon:v,className:"item-icon",fixedWidth:!0})," ",T("span",{className:"truncation-wrapper",children:[e!=null?e:r.basename,h(Ye,{options:{placement:"left"},children:e!=null?e:r.basename})]})]})};function i2(t){if(Zn(t))return t.isExpanded?MC:NC;switch(pe.getMimeType(t.basename)){case cg.PYTHON:return ub;default:return yC}}function Yh(t,e){if(t.length===0||e==null)throw new Error("No items to move");const n=od(e);if(t.some(({filename:s})=>pe.getPath(s)===n))throw new Error("File already in the destination folder");if(t.some(s=>Zn(s)&&n.startsWith(pe.makePath(s.filename))))throw new Error("Destination folder cannot be a child of a dragged folder");return{files:t,targetPath:n}}function o2(t){const{isMultiSelect:e=!1,table:n,onFocusChange:s=()=>{},onMove:i,onSelect:o,onSelectionChange:r=()=>{},renderItem:l=rd,rowHeight:a=bc,overscanCount:d=vn.DEFAULT_OVERSCAN}=t,[c,u]=w.exports.useState(()=>({items:[],offset:0,itemCount:0})),[m,p]=w.exports.useState({top:0,bottom:0}),[g,f]=w.exports.useState(),[b,C]=w.exports.useState(),[S,v]=w.exports.useState(),[y,E]=w.exports.useState([]),I=w.exports.useRef(null),R=w.exports.useRef(null),N=w.exports.useCallback(ne=>{if(ne.length===0||c==null)return[];const he=[];for(let Ce=0;Ce<ne.length;Ce+=1){const Re=ne[Ce];for(let He=Re[0];He<=Re[1];He+=1)He>=c.offset&&He<c.offset+c.items.length&&he.push(c.items[He-c.offset])}return he},[c]),F=w.exports.useCallback(ne=>{const he=N([[ne,ne]]);if(he.length>0)return he[0]},[N]),P=w.exports.useCallback(()=>{const ne=bn.count(y);if(ne===0)return null;if(ne===1){const he=y[0][0],Ce=F(he);if(Ce!=null)return Ce.filename}return`${ne} items`},[F,y]),H=w.exports.useCallback(ne=>{var he;if(!(!b||!g)){At.debug("dropItems",b,"to",ne);try{const{files:Ce,targetPath:Re}=Yh(b,g);i(Ce,Re),ne!=null&&(E([[ne,ne]]),(he=I.current)==null||he.focusItem(ne))}catch(Ce){At.error("Unable to complete move",Ce)}}},[b,g,i]),x=w.exports.useCallback((ne,he)=>{const Ce=c.items[ne-c.offset];Ce!==void 0&&(At.debug("handleItemClick",Ce),o(Ce,he),Zn(Ce)&&(n==null||n.setExpanded(Ce.filename,!Ce.isExpanded)))},[c,o,n]),A=w.exports.useCallback((ne,he)=>{var He;At.debug2("handleItemDragStart",ne,y);let Ce=y;bn.isSelected(y,ne)||(Ce=[[ne,ne]],E(Ce)),C(N(Ce)),(He=I.current)==null||He.resetMouseState();const Re=document.createElement("div");Re.innerHTML=`<div class="dnd-placeholder-content">${P()}</div>`,Re.className="file-list-dnd-placeholder",document.body.appendChild(Re),he.dataTransfer.setDragImage(Re,0,0),he.dataTransfer.effectAllowed="move",v(Re)},[P,N,y]),k=w.exports.useCallback((ne,he)=>{he.preventDefault(),At.debug2("handleItemDragOver",he),f(F(ne))},[F]),G=w.exports.useCallback((ne,he)=>{At.debug("handleItemDragEnd",ne),S==null||S.remove(),C(void 0),f(void 0),v(void 0)},[S]),V=w.exports.useCallback((ne,he)=>{H(ne)},[H]),O=w.exports.useCallback(()=>{At.debug2("handleItemDragExit"),f(void 0)},[]),$=w.exports.useCallback(ne=>{ne.target instanceof Element&&ne.target.classList.contains(qh)&&(ne.preventDefault(),At.debug2("handleListDragOver",ne),f({type:"directory",filename:"/",basename:"/",id:"/"}))},[]),Y=w.exports.useCallback(ne=>{ne.target instanceof Element&&ne.target.classList.contains(qh)&&(At.debug("handleListDrop"),H())},[H]),Q=w.exports.useCallback(ne=>{if(At.debug2("handleSelectionChange",ne),ne!==y){E(ne);const he=N(ne);r(he)}},[N,r,y]),U=w.exports.useCallback(ne=>{if(At.debug2("handleFocusChange",ne),ne!=null){const[he]=N([[ne,ne]]);s(he)}else s()},[N,s]),q=w.exports.useCallback((ne,he)=>{At.debug("handleViewportChange",ne,he),(ne!==m.top||he!==m.bottom)&&p({top:ne,bottom:he})},[m]),j=w.exports.useMemo(()=>{if(!b||!g)return!1;try{return Yh(b,g),At.debug("handleValidateDropTarget true"),!0}catch{return At.debug("handleValidateDropTarget false"),!1}},[b,g]),{focusedPath:te}=t;w.exports.useEffect(()=>{te!==void 0&&(te==="/"?n.collapseAll():(n.setExpanded(te,!1),n.setExpanded(te,!0)))},[n,te]),w.exports.useEffect(function(){At.debug("updating table viewport",m),n==null||n.setViewport({top:Math.max(0,m.top-d),bottom:m.bottom+d})},[d,n,m]),w.exports.useEffect(function(){const he=n.onUpdate(Ce=>{u({items:Ce.items.map(Re=>({...Re,itemName:Re.basename})),offset:Ce.offset,itemCount:n.size})});return()=>{he()}},[n]),w.exports.useEffect(function(){if(g!=null&&Zn(g)&&g.filename!=="/"){const he=setTimeout(()=>{g.isExpanded||n==null||n.setExpanded(g.filename,!0)},s2);return()=>clearTimeout(he)}},[g,n]);const ce=w.exports.useCallback(ne=>l({...ne,isDragInProgress:b!=null,dropTargetItem:g,draggedItems:b,isDropTargetValid:j,onDragStart:A,onDragEnd:G,onDragOver:k,onDragExit:O,onDrop:V}),[G,O,k,A,V,b,g,j,l]);return h("div",{ref:R,className:z("file-list",{"is-dragging":b!=null}),onDragOver:$,onDrop:Y,children:h(vn,{ref:I,items:c.items,itemCount:c.itemCount,offset:c.offset,onFocusChange:U,onSelect:x,onSelectionChange:Q,onViewportChange:q,selectedRanges:y,renderItem:ce,rowHeight:a,isMultiSelect:e,isDragSelect:!1,isDeselectOnClick:!1})})}const r2={name:"File Explorer",DELETE:Ae.createAndAdd({id:"FILE_EXPLORER.DELETE",name:"Delete",shortcut:[ge.DELETE],macShortcut:[me.CMD,ge.BACKSPACE]}),RENAME:Ae.createAndAdd({id:"FILE_EXPLORER.RENAME",name:"Rename",shortcut:[ge.ENTER],macShortcut:[ge.ENTER]})},Xh={FILE_EXPLORER:r2};const jh=Z.module("FileListItemEditor"),l2=()=>Promise.resolve();function a2({item:t,onCancel:e,onSubmit:n,validate:s=l2}){const i=w.exports.useRef(null),[o,r]=w.exports.useState(t.basename),[l,a]=w.exports.useState(),[d,c]=w.exports.useState(Promise.resolve()),u=w.exports.useCallback(()=>{var C;(C=i.current)==null||C.focus()},[i]),m=w.exports.useCallback(C=>C.stopPropagation(),[]),p=w.exports.useCallback(()=>{d.then(()=>{n(o)}).catch(C=>jh.info("Unable to validate name",C))},[n,o,d]);w.exports.useEffect(function(){const S=ye.makeCancelable(s(o));return S.then(()=>a(void 0)).catch(v=>{ye.isCanceled(v)||a(v)}),c(S),()=>S.cancel()},[s,o]),w.exports.useEffect(function(){u()},[u]);const g=w.exports.useCallback(()=>{jh.debug2("handleBlur"),p()},[p]),f=w.exports.useCallback(C=>{const{value:S}=C.target;r(S)},[]),b=w.exports.useCallback(C=>{C.stopPropagation();const{key:S}=C;switch(S){case"Enter":{p();break}case"Escape":{e();break}}},[e,p]);return T("div",{className:"file-list-item-editor",children:[h("input",{type:"text",className:z("form-control file-list-item-editor-input",{"is-invalid":l}),value:o,ref:i,onBlur:g,onKeyDown:b,onChange:f,onClick:m,onDoubleClick:m,onMouseDown:m}),l&&h("div",{className:"invalid-feedback",children:`${l}`})]})}function hg(t){const{isMultiSelect:e=!1,focusedPath:n,showContextMenu:s=!1,onCreateFile:i,onCreateFolder:o,onCopy:r,onDelete:l,onMove:a=()=>{},onRename:d,onSelect:c,onSelectionChange:u,table:m,rowHeight:p=bc,validateRename:g=()=>Promise.resolve()}=t,[f,b]=w.exports.useState(),[C,S]=w.exports.useState([]),[v,y]=w.exports.useState(),E=w.exports.useCallback(O=>{S(O),u==null||u(O)},[u]),I=w.exports.useCallback(O=>{y(O)},[]),R=w.exports.useCallback(()=>{v&&(r==null||r(v))},[v,r]),N=w.exports.useCallback(()=>{C.length>0&&(l==null||l(C))},[l,C]),F=w.exports.useCallback(()=>{i==null||i()},[i]),P=w.exports.useCallback(()=>{v&&(o==null||o(pe.getPath(v.filename)))},[v,o]),H=w.exports.useCallback(()=>{v&&b(v)},[v]),x=w.exports.useCallback(()=>{b(void 0)},[]),A=w.exports.useCallback(O=>{f&&(d==null||d(f,O),b(void 0))},[d,f]),k=w.exports.useMemo(()=>{if(f)return[];const O=[];return i&&O.push({title:"New File",description:"Create new file",action:F,group:ae.groups.medium}),o&&O.push({title:"New Folder",description:"Create new folder",action:P,group:ae.groups.medium}),r&&O.push({title:"Copy",description:"Copy",action:R,group:ae.groups.low,disabled:v==null||Zn(v)}),l&&C.length>0&&O.push({title:"Delete",description:"Delete",shortcut:Xh.FILE_EXPLORER.DELETE,action:N,group:ae.groups.low}),d&&O.push({title:"Rename",description:"Rename",shortcut:Xh.FILE_EXPLORER.RENAME,action:H,group:ae.groups.low,disabled:v==null}),O},[R,N,F,P,H,v,r,i,o,l,d,C,f]),G=w.exports.useCallback(O=>f?g(f,O):Promise.reject(new Error("No rename item")),[f,g]),V=w.exports.useCallback(O=>{const{item:$}=O;return f&&f.filename===$.filename?rd({...O,children:h(a2,{item:$,validate:G,onSubmit:A,onCancel:x})}):rd(O)},[x,A,f,G]);return T("div",{className:"file-list-container",children:[m!=null&&h(o2,{onMove:a,onSelect:c,onSelectionChange:E,onFocusChange:I,renderItem:V,rowHeight:p,table:m,isMultiSelect:e,focusedPath:n}),s&&h(ae,{actions:k})]})}hg.displayName="FileListContainer";class ol extends Ki{constructor(e){super("Name already exists"),this.isExistingFile=!0,this.info=e}}class Sc extends Error{constructor(){super("No file exists at the path specified"),this.isFileNotFound=!0}}const Js=Z.module("FileExplorer");function wc(t){const{storage:e,isMultiSelect:n=!1,focusedPath:s,onDelete:i=()=>{},onRename:o=()=>{},onSelect:r,onSelectionChange:l,rowHeight:a=bc}=t,[d,c]=w.exports.useState([]),[u,m]=w.exports.useState();w.exports.useEffect(function(){let R;async function N(){Js.debug("initTable"),R=ye.makeCancelable(e.getTable(),F=>F.close());try{m(await R)}catch(F){ye.isCanceled(F)||Js.error("Unable to initialize table",F)}}return N(),()=>{R.cancel()}},[e]);const p=w.exports.useCallback(I=>{ye.isCanceled(I)||Js.error(I)},[]),g=w.exports.useCallback(I=>{Js.debug("handleDelete, pending confirmation",I),c(I)},[]),f=w.exports.useCallback(()=>{Js.debug("handleDeleteConfirm",d),d.forEach(I=>e.deleteFile(Zn(I)?pe.makePath(I.filename):I.filename)),i(d),c([])},[d,i,e]),b=w.exports.useCallback(()=>{Js.debug("handleDeleteCancel"),c([])},[]),C=w.exports.useCallback((I,R)=>{pe.reducePaths(I.map(F=>Zn(F)?pe.makePath(F.filename):F.filename)).forEach(F=>{const P=pe.isPath(F)?`${R}${pe.getBaseName(F.substring(0,F.length-1))}/`:`${R}${pe.getBaseName(F)}`;e.moveFile(F,P).then(()=>{o(F,P)}).catch(p)})},[p,o,e]),S=w.exports.useCallback((I,R)=>{let N=I.filename;const F=Zn(I);F&&!N.endsWith("/")&&(N=`${N}/`);let P=`${pe.getParent(N)}${R}`;F&&!P.endsWith("/")&&(P=`${P}/`),Js.debug2("handleRename",N,P),e.moveFile(N,P).catch(p),o(N,P)},[p,o,e]),v=w.exports.useCallback(async(I,R)=>{if(R===I.basename)return;pe.validateName(R);const N=`${pe.getPath(I.filename)}${R}`;try{const F=await e.info(N);throw new ol(F)}catch(F){if(!(F instanceof Sc))throw F}},[e]),y=d.length>0,E=w.exports.useMemo(()=>d.length===1?`Are you sure you want to delete "${d[0].filename}"?`:"Are you sure you want to delete the selected files?",[d]);return T("div",{className:"file-explorer",children:[u&&h(hg,{isMultiSelect:n,focusedPath:s,showContextMenu:!0,onMove:C,onDelete:g,onRename:S,onSelect:r,onSelectionChange:l,rowHeight:a,table:u,validateRename:v}),h(ji,{isOpen:y,headerText:E,bodyText:"You cannot undo this action.",onCancel:b,onConfirm:f,confirmButtonText:"Delete"})]})}wc.displayName="FileExplorer";const ei=Z.module("NewItemModal"),rl=class extends w.exports.PureComponent{constructor(t){super(t),this.inputRef=X.createRef(),this.pending=new Ss,this.pathMap=new Map,this.isInitialLoad=!0,this.handleModalSubmit=this.handleModalSubmit.bind(this),this.handleModalOpened=this.handleModalOpened.bind(this),this.handleSelect=this.handleSelect.bind(this),this.handleChange=this.handleChange.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleValidationError=this.handleValidationError.bind(this),this.handleOverwriteCancel=this.handleOverwriteCancel.bind(this),this.handleOverwriteConfirm=this.handleOverwriteConfirm.bind(this),this.handleExtensionChangeCancel=this.handleExtensionChangeCancel.bind(this),this.handleExtensionChangeConfirm=this.handleExtensionChangeConfirm.bind(this),this.handleBreadcrumbSelect=this.handleBreadcrumbSelect.bind(this);const{defaultValue:e}=t,n=pe.hasPath(e)?pe.getPath(e):"/";this.state={isSubmitting:!1,path:n,prevExtension:pe.getExtension(e),showExtensionChangeModal:!1,showOverwriteModal:!1,value:pe.getBaseName(e)}}static getValidationMessage(t){return t instanceof ol&&t.info.type==="directory"?"Error: Cannot overwrite existing directory":`${t}`}static handleError(t){ye.isCanceled(t)||ei.error(t)}componentDidUpdate(t,e){const{isOpen:n}=this.props,{isOpen:s}=t,{value:i,path:o}=this.state;!s&&n&&(this.resetValue(),this.isInitialLoad=!0),s&&n&&(!this.isInitialLoad&&(o!==e.path||i!==e.value)&&this.updateValidationStatus(o,i),this.isInitialLoad=!1)}componentWillUnmount(){this.pending.cancel(),this.cancelableValidatePromise&&this.cancelableValidatePromise.cancel(),this.cancelableExistingItemPromise&&this.cancelableExistingItemPromise.cancel()}resetValue(){const{defaultValue:t}=this.props,e=pe.hasPath(t)?pe.getPath(t):"/";this.setState({path:e,value:pe.getBaseName(t),validationError:void 0,prevExtension:pe.getExtension(t),isSubmitting:!1})}getValidationPromise(t,e,n=!1){return this.cancelableValidatePromise&&this.cancelableValidatePromise.cancel(),this.cancelableValidatePromise=ye.makeCancelable(this.validateName(t,e,n)),this.cancelableValidatePromise}async validateName(t,e,n){pe.validateName(e);const{defaultValue:s,storage:i}=this.props;if(n){const o=`${t}${e}`;if(o!==s)try{const r=await i.info(o);throw new ol(r)}catch(r){if(!(r instanceof Sc))throw r}}return e}updateValidationStatus(t,e){this.getValidationPromise(t,e).then(()=>{this.setState({validationError:void 0})}).catch(this.handleValidationError).catch(rl.handleError)}handleModalOpened(){this.focusRenameInput()}handleModalSubmit(){this.submitModal()}handleChange(t){const{value:e}=t.target;this.setState({value:e})}handleSelect(t){if(ei.debug("handleSelect",t),t.type==="directory")this.setState({path:pe.makePath(t.filename)});else{const e=t.basename,n=pe.getPath(t.filename);this.setState({value:e,path:n},()=>{this.focusRenameInput()})}}handleKeyDown(t){const{key:e}=t;switch(t.stopPropagation(),e){case"Enter":{t.preventDefault(),this.submitModal();break}case"Escape":{t.preventDefault();const{onCancel:n}=this.props;n();break}}}handleValidationError(t){if(!(t instanceof Ki))throw t;ei.debug("Validation error",t),this.setState({validationError:t})}handleOverwriteCancel(){this.setState({showOverwriteModal:!1,isSubmitting:!1})}handleOverwriteConfirm(){this.setState({showOverwriteModal:!1});const{onSubmit:t}=this.props,{path:e,value:n}=this.state;ei.debug("handleOverwriteConfirm",e,n),t(`${e}${n}`,!0)}handleExtensionChangeCancel(){ei.debug("handleExtensionChangeCancel"),this.setState(({value:t,prevExtension:e})=>{const n=pe.replaceExtension(t,e);return{showExtensionChangeModal:!1,value:n}}),this.submitModal(!0)}handleExtensionChangeConfirm(){ei.debug("handleExtensionChangeConfirm"),this.setState({showExtensionChangeModal:!1}),this.submitModal(!0)}focusRenameInput(){const t=this.inputRef.current;if(t){const{type:e}=this.props,{value:n}=t,s=e==="directory"?n.length:n.lastIndexOf(".");t.focus(),t.setSelectionRange(0,s>0?s:n.length)}}submitModal(t=!1){this.setState(({prevExtension:e,value:n,path:s})=>{const{notifyOnExtensionChange:i,type:o}=this.props;ei.debug("submitModal",e,n);const r=pe.getExtension(n);return i&&!t&&e!==null&&e!==r?{isSubmitting:!1,showExtensionChangeModal:!0,newExtension:r}:(this.getValidationPromise(s,n,!0).then(l=>{const{onSubmit:a}=this.props;a(`${s}${n}`)}).catch(l=>{if(l instanceof ol&&o!=="directory"&&l.info.type!=="directory"){this.setState({showOverwriteModal:!0});return}throw l}).catch(l=>{throw ye.isCanceled(l)&&this.setState({isSubmitting:!1}),l}).catch(this.handleValidationError).catch(rl.handleError),{isSubmitting:!0,showExtensionChangeModal:!1,newExtension:void 0})})}handleBreadcrumbSelect(t){this.setState({path:t})}renderPathButtons(t){const e=t.split("/");return e.pop(),e.map((n,s)=>{let i="";for(let o=0;o<s;o+=1)i+=`${e[o]}/`;return i+=`${n}/`,T(X.Fragment,{children:[h(W,{kind:"ghost",className:"directory-breadcrumbs",onClick:()=>this.handleBreadcrumbSelect(i),"aria-label":s===0?"Home":void 0,icon:s===0?h(ee,{icon:FC,transform:"right-1.6"}):void 0,tooltip:s===0?"Home":void 0,children:n}),"/"]},i)})}render(){const{storage:t,isOpen:e,onCancel:n,placeholder:s,title:i,type:o}=this.props,{isSubmitting:r,path:l,showExtensionChangeModal:a,showOverwriteModal:d,validationError:c,value:u,prevExtension:m,newExtension:p}=this.state,g=o==="directory",f=pe.fileExtensionToString(m),b=pe.fileExtensionToString(p),C=g?"Create":"Save",S=g?"New folder name":"Save file as";return T(Te,{children:[T(Jo,{isOpen:e,toggle:n,onOpened:this.handleModalOpened,className:"modal-dialog-centered new-file-modal theme-bg-dark",children:[h(tr,{toggle:n,children:i}),h(er,{children:h("form",{children:T("div",{className:"d-flex flex-column new-file-modal-content",children:[T("div",{className:"flex-grow-0 mb-4",children:[h("label",{htmlFor:"file-name-input",children:S}),h("input",{id:"file-name-input",type:"text",autoComplete:"off",autoCapitalize:"none",autoCorrect:"off",spellCheck:"false",className:z("form-control",{"is-invalid":c}),value:u,placeholder:s,ref:this.inputRef,onKeyDown:this.handleKeyDown,onChange:this.handleChange}),c&&h("div",{className:"invalid-feedback",children:rl.getValidationMessage(c)})]}),T("div",{className:"flex-grow-0",children:[h("label",{children:"Directory: /"}),this.renderPathButtons(l)]}),h("div",{className:"flex-grow-1 file-explorer-container",children:h(wc,{onSelect:this.handleSelect,storage:t,focusedPath:l})})]})})}),T(vd,{children:[h(W,{kind:"secondary",onClick:n,children:"Cancel"}),h(W,{kind:"primary",disabled:r,onClick:this.handleModalSubmit,children:C})]})]}),h(ji,{isOpen:d,headerText:"Confirm overwrite",bodyText:"File with this name already exists, are you sure you want to overwrite it?",onCancel:this.handleOverwriteCancel,onConfirm:this.handleOverwriteConfirm,cancelButtonText:"Cancel",confirmButtonText:"Overwrite"}),h(ji,{isOpen:a,headerText:"Confirm extension change",bodyText:`Are you sure you want to change extension from "${f}" to "${b}"?`,onCancel:this.handleExtensionChangeCancel,onConfirm:this.handleExtensionChangeConfirm,cancelButtonText:`Keep "${f}"`,confirmButtonText:`Use "${b}"`})]})}};let aa=rl;aa.propTypes={isOpen:D.exports.bool,title:D.exports.string.isRequired,defaultValue:D.exports.string,type:D.exports.oneOf(["file","directory"]).isRequired,onSubmit:D.exports.func,onCancel:D.exports.func,placeholder:D.exports.string,storage:D.exports.shape({}).isRequired,notifyOnExtensionChange:D.exports.bool};aa.defaultProps={isOpen:!1,defaultValue:"/",notifyOnExtensionChange:!1,placeholder:"",onSubmit:(t,e)=>{},onCancel:()=>{}};function d2({createFile:t,createFolder:e,onSearchChange:n,defaultSearchText:s=""}){return T("div",{className:"file-explorer-toolbar",children:[T("div",{className:"file-explorer-toolbar-buttons",children:[h(W,{kind:"ghost",icon:ku,tooltip:"New notebook",onClick:t,"aria-label":"New notebook"}),h(W,{kind:"ghost",icon:UC,tooltip:"New folder",onClick:e,"aria-label":"New folder"})]}),n&&h("div",{className:"file-explorer-toolbar-search",children:h(Ju,{value:s,onChange:n,placeholder:"Search by name"})})]})}const Pi=Z.module("FileExplorerPanel"),c2=(t,e)=>{const n=km(t),s=wi(t,e.localDashboardId),{session:i,config:o}=s!=null?s:{},r=o==null?void 0:o.type;return{fileStorage:n,language:r,session:i}},h2=It(c2,null,null,{forwardRef:!0});function u2(t){const e=t;return e!=null&&typeof e.button=="number"}const ld=class extends X.Component{static handleError(t){Pi.error(t)}static isFocusEvent(t){return u2(t)?t.detail>=2:!0}constructor(t){super(t),this.handleFileSelect=this.handleFileSelect.bind(this),this.handleCreateFile=this.handleCreateFile.bind(this),this.handleCreateDirectory=this.handleCreateDirectory.bind(this),this.handleCreateDirectoryCancel=this.handleCreateDirectoryCancel.bind(this),this.handleCreateDirectorySubmit=this.handleCreateDirectorySubmit.bind(this),this.handleDelete=this.handleDelete.bind(this),this.handleRename=this.handleRename.bind(this),this.handleSessionOpened=this.handleSessionOpened.bind(this),this.handleSessionClosed=this.handleSessionClosed.bind(this),this.handleShow=this.handleShow.bind(this),this.handleSelectionChange=this.handleSelectionChange.bind(this);const{session:e,language:n}=t;this.state={isShown:!1,language:n,session:e,showCreateFolder:!1,focusedFilePath:"/"}}componentDidMount(){this.isHidden()||this.setState({isShown:!0})}handleCreateFile(){const{glEventHub:t}=this.props,{session:e,language:n}=this.state,s={language:n,value:""};Pi.debug("handleCreateFile",e,n,s),t.emit(Le.CREATE_NOTEBOOK,e,n,s)}handleCreateDirectory(t){this.setState({showCreateFolder:!0})}handleCreateDirectoryCancel(){Pi.debug("handleCreateDirectoryCancel"),this.setState({showCreateFolder:!1})}handleCreateDirectorySubmit(t){Pi.debug("handleCreateDirectorySubmit",t),this.setState({showCreateFolder:!1});const{fileStorage:e}=this.props;e.createDirectory(t).catch(ld.handleError)}handleDelete(t){const{glEventHub:e}=this.props;t.forEach(n=>{e.emit(Le.CLOSE_FILE,{id:n.filename,itemName:n.filename})})}handleSelectionChange(t){let e="/";t.length===1&&(t[0].type==="directory"?e=pe.makePath(t[0].filename):e=pe.getPath(t[0].filename)),this.setState({focusedFilePath:e})}handleFileSelect(t,e){if(Pi.debug("fileSelect",t),t.type==="directory")return;const n=ld.isFocusEvent(e),s={id:t.filename,itemName:t.filename},{glEventHub:i}=this.props,{session:o,language:r}=this.state,l={value:null,language:r};i.emit(Le.SELECT_NOTEBOOK,o,r,l,s,n)}handleRename(t,e){const{glEventHub:n}=this.props;Pi.debug("handleRename",t,e),n.emit(Le.RENAME_FILE,t,e)}handleSessionOpened(t,{language:e}){this.setState({session:t,language:e})}handleSessionClosed(){this.setState({session:void 0,language:void 0})}handleShow(){this.setState({isShown:!0})}isHidden(){const{glContainer:t}=this.props,{isHidden:e}=t;return e}render(){const{fileStorage:t,glContainer:e,glEventHub:n}=this.props,{isShown:s,showCreateFolder:i,focusedFilePath:o}=this.state;return T(ns,{className:"file-explorer-panel",componentPanel:this,glContainer:e,glEventHub:n,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,onShow:this.handleShow,children:[h(d2,{createFile:this.handleCreateFile,createFolder:this.handleCreateDirectory}),s&&h(wc,{isMultiSelect:!0,storage:t,onDelete:this.handleDelete,onRename:this.handleRename,onSelect:this.handleFileSelect,onSelectionChange:this.handleSelectionChange}),h(aa,{isOpen:i,type:"directory",title:"Create New Folder",storage:t,onSubmit:this.handleCreateDirectorySubmit,onCancel:this.handleCreateDirectoryCancel,defaultValue:o})]})}};let vc=ld;vc.COMPONENT="FileExplorerPanel";vc.TITLE="File Explorer";const Rl=h2(vc);const dt=Z.module("FilterSetManager"),m2="Enter name...",Zh="No Available Filter Sets";class Dl extends w.exports.Component{constructor(e){super(e),this.renameInputRef=X.createRef(),this.dropdownRef=X.createRef(),this.editDropdownRef=X.createRef(),this.isRenamingExistingSet=Se((n,s)=>s!==void 0&&n.some(({id:i})=>i===s.id)),this.handleSettingsCancel=this.handleSettingsCancel.bind(this),this.handleSettingsClick=this.handleSettingsClick.bind(this),this.handleSettingsSave=this.handleSettingsSave.bind(this),this.handleBackgroundClick=this.handleBackgroundClick.bind(this),this.handleEditDropdownChange=this.handleEditDropdownChange.bind(this),this.handleFilterChange=this.handleFilterChange.bind(this),this.handleFilterApply=this.handleFilterApply.bind(this),this.handleCaptureNewSet=this.handleCaptureNewSet.bind(this),this.handleNameInputChange=this.handleNameInputChange.bind(this),this.handleNameInputKeyPress=this.handleNameInputKeyPress.bind(this),this.handleRenameConfirm=this.handleRenameConfirm.bind(this),this.handleRenameCancel=this.handleRenameCancel.bind(this),this.handleRestoreFullStateChange=this.handleRestoreFullStateChange.bind(this),this.handleSetDelete=this.handleSetDelete.bind(this),this.handleSetEdit=this.handleSetEdit.bind(this),this.handleSetUpdate=this.handleSetUpdate.bind(this),this.state={editId:void 0,renameSet:void 0,nameInputValue:"",nameInputError:void 0,modifiedFilterSets:[],restoreFullState:!1}}static animateScreenFlash(){var n;const e=document.createElement("div");e.classList.add("screen-flash-overlay"),e.addEventListener("animationend",()=>{e.remove()}),(n=document.querySelector("body"))==null||n.appendChild(e)}componentDidMount(){const{isValueShown:e}=this.props;e?this.updateSelectedId():this.initSettingsScreen()}componentDidUpdate(e,n){const{isValueShown:s,filterSets:i}=this.props,{modifiedFilterSets:o}=this.state;if(e.isValueShown&&!s&&this.initSettingsScreen(),this.isNameInputScreen()&&!this.isNameInputScreen(n)&&this.focusRenameInput(),i!==e.filterSets)if(!s&&i.length>0&&e.filterSets.length===0&&o.length===0){const{onChange:r}=this.props;r({isValueShown:!0,selectedId:i[0].id})}else this.updateSelectedId()}initSettingsScreen(){const{filterSets:e,selectedId:n}=this.props;dt.debug("initSettingsScreen",e,n),this.setState({modifiedFilterSets:[...e],editId:n})}updateSelectedId(){const{isValueShown:e,filterSets:n,selectedId:s,onChange:i}=this.props;if(dt.debug("updateSelectedId",n,s),!!e&&!n.some(({id:o})=>o===s)){const o=n.length===0;i({isValueShown:!o,selectedId:o?void 0:n[0].id})}}handleEditDropdownChange(e){const{value:n}=e.target;this.setState({editId:n})}handleFilterChange(e){const{value:n}=e.target,{isValueShown:s,onChange:i}=this.props;this.applyFilterSet(n),i({isValueShown:s,selectedId:n})}handleFilterApply(){const{selectedId:e}=this.props;this.applyFilterSet(e)}handleSettingsCancel(){const{onChange:e,selectedId:n,filterSets:s}=this.props;this.setState({modifiedFilterSets:[]}),s.length>0&&e({isValueShown:!0,selectedId:n})}handleSettingsSave(){const{onChange:e,onUpdateSets:n}=this.props,{modifiedFilterSets:s,editId:i}=this.state;this.setState({modifiedFilterSets:[]}),dt.debug("Update sets",s,i),n(s),s.length>0&&e({isValueShown:!0,selectedId:i})}handleCaptureNewSet(){const{getFilterState:e}=this.props;Dl.animateScreenFlash();const n=We(),s=e(),i={id:n,title:"",panels:s};dt.debug("handleSetCreate",i),this.setState({nameInputValue:"",nameInputError:void 0,renameSet:i})}handleRenameCancel(){this.setState({renameSet:void 0})}handleRestoreFullStateChange(e){this.setState({restoreFullState:e.target.value==="true"})}getNameError(e){var o;const{renameSet:n,modifiedFilterSets:s}=this.state,i=(o=e==null?void 0:e.trim())!=null?o:"";if(i.length===0)return dt.debug("Name cannot be empty",i),"Name cannot be empty";if(n!==void 0&&s.some(({title:r,id:l})=>r===i&&l!==n.id))return dt.debug("Set with this name already exists",i),"Set with this name already exists"}handleRenameConfirm(){var c;const{nameInputValue:e,renameSet:n,modifiedFilterSets:s,restoreFullState:i}=this.state;if(n===void 0){dt.error("Renamed set undefined.");return}const o=this.getNameError(e);if(dt.debug("handleRenameConfirm",e,o),o!==void 0){this.setState({nameInputError:o});return}const r=(c=e==null?void 0:e.trim())!=null?c:"",l={...n,title:r,restoreFullState:i},a=s.findIndex(({id:u})=>u===n.id),d=[...s];a>=0?(d[a]=l,dt.debug("Renamed existing set",d)):(d.push(l),dt.debug("Added new set to modified sets",d)),this.setState({editId:l.id,modifiedFilterSets:d,renameSet:void 0})}handleSetDelete(){this.setState(e=>{const{editId:n,modifiedFilterSets:s}=e,i=s.findIndex(({id:a})=>a===n);if(i<0)return dt.error("Unable to find selected filterSet index",s,n),null;const o=s.filter(({id:a})=>a!==n),r=Math.max(0,Math.min(o.length-1,i-1)),l=o.length>0?o[r].id:void 0;return dt.debug("Deleted selected set",n,s,o),dt.debug("New selection",r,l),{modifiedFilterSets:o,editId:l}})}handleSetUpdate(){const{getFilterState:e}=this.props;Dl.animateScreenFlash();const n=e();this.setState(({modifiedFilterSets:s,editId:i})=>{if(i===void 0)return dt.error("Filter for update not selected."),null;const o=[...s],r=o.findIndex(({id:l})=>l===i);return r<0?(dt.error("Selected set for update not found."),null):(o[r]={...o[r],panels:n},dt.debug("Update set",o,n),{modifiedFilterSets:o})})}handleSetEdit(){this.setState(({editId:e,modifiedFilterSets:n})=>{const s=n.find(({id:r})=>r===e);if(s===void 0)return dt.error("Could not find selected set",e,n),null;const{title:i,restoreFullState:o=!1}=s;return{nameInputValue:i,nameInputError:void 0,renameSet:s,restoreFullState:o}})}handleSettingsClick(e){e.stopPropagation();const{onChange:n,selectedId:s}=this.props;n({isValueShown:!1,selectedId:s})}handleBackgroundClick(e){dt.debug("handleBackgroundClick"),e.target!==this.dropdownRef.current&&this.focusInput()}handleNameInputChange(e){const{value:n}=e.target,s=this.getNameError(n);this.setState({nameInputValue:n,nameInputError:s})}handleNameInputKeyPress(e){const{key:n}=e;n==="Enter"&&(e.preventDefault(),this.handleRenameConfirm())}isNameInputScreen(e=this.state){const{renameSet:n}=e;return n!==void 0}applyFilterSet(e){const{onApply:n,filterSets:s}=this.props;if(e===void 0){dt.debug("No filter selected");return}const i=s.find(({id:o})=>o===e);if(i===void 0){dt.debug("Selected id not found in filterSets",e,s);return}dt.debug("Apply filterSet",i),n(i)}focusInput(){var e;(e=this.dropdownRef.current)==null||e.focus()}focusRenameInput(){var e;(e=this.renameInputRef.current)==null||e.focus()}render(){const{nameInputValue:e,nameInputError:n,editId:s,renameSet:i,modifiedFilterSets:o,restoreFullState:r}=this.state,{isValueShown:l,filterSets:a,selectedId:d}=this.props,c=this.isNameInputScreen(),u=this.isRenamingExistingSet(o,i),m=o.length===0,p=!c&&m&&a.length===0,g=!c&&!p,f=T("div",{className:"fa-layers mr-3",children:[h(ee,{icon:Zi,mask:za,transform:"shrink-1 down-5 right-7"}),h(ee,{icon:Gs,className:"text-primary",transform:"shrink-6 down-5 right-7"})]}),b=T("div",{className:"fa-layers",children:[h(ee,{icon:Zi,mask:za,transform:"shrink-1 down-5 right-7"}),h(ee,{icon:$a,transform:"shrink-1 down-5 right-7"})]});return h("div",{className:"filter-set-manager fill-parent-absolute",children:T(Td,{className:"w-100 h-100",isFlipped:l,children:[h("div",{className:"filter-set-manager-settings-card fill-parent-absolute",children:T("div",{className:"filter-set-manager-card-content",children:[p&&T("div",{children:[h(W,{kind:"ghost",className:"btn btn-link no-underline",onClick:this.handleCaptureNewSet,icon:f,children:"Capture filter set"}),h("div",{className:"py-3 text-muted small",children:"Takes a snapshot of the currently applied filters on all panels, allowing you to restore saved filter sets later."})]}),c&&T("div",{className:"d-flex flex-column justify-content-center","data-testid":"edit-filter-set-container",children:[T("div",{className:"form-group",children:[h("label",{children:u?"Edit set":"Name captured set"}),T("div",{className:"name-input-container",children:[h("input",{type:"text",className:"input-set-name form-control",placeholder:m2,value:e,ref:this.renameInputRef,onChange:this.handleNameInputChange,onKeyPress:this.handleNameInputKeyPress,spellCheck:"false"}),h(W,{"data-testid":"rename-confirm-button",kind:"ghost",className:"btn btn-link no-underline pt-2 pb-2",onClick:this.handleRenameConfirm,tooltip:"Save","test-id":"button-save",icon:Ou}),h(W,{"data-testid":"rename-cancel-button",kind:"ghost",className:"btn btn-link no-underline pt-2 pb-2",onClick:this.handleRenameCancel,tooltip:"Cancel",icon:TC})]}),n!==void 0&&h("div",{className:"error-message",children:n})]}),h("div",{className:"form-group",children:T(Ul,{onChange:this.handleRestoreFullStateChange,value:`${r}`,children:[h(xn,{value:"false",children:"Restore only filters"}),h(xn,{value:"true",children:"Restore full table state"})]})})]}),g&&T("div",{className:"filter-set-manager-settings-grid-1",children:[T("div",{className:"form-group",children:[h("label",{children:"Edit filter sets"}),T("div",{className:"filter-select-container",children:[T("select",{"data-testid":"settings-card-filter-select",ref:this.editDropdownRef,value:s!=null?s:"-1",className:"custom-select filter-value-select",onChange:this.handleEditDropdownChange,disabled:m,children:[m&&h("option",{value:"-1",disabled:!0,children:Zh}),o.map(({id:C,title:S})=>h("option",{value:C,children:S},C))]}),h(W,{kind:"ghost",onClick:this.handleSetUpdate,disabled:m,icon:b,tooltip:"Update"}),h(W,{kind:"ghost",onClick:this.handleSetEdit,disabled:m,icon:nr,tooltip:"Edit"}),h(W,{kind:"ghost",onClick:this.handleSetDelete,disabled:m,icon:hn,tooltip:"Delete"})]})]}),h("div",{children:h(W,{kind:"ghost",className:"btn btn-link no-underline",onClick:this.handleCaptureNewSet,icon:f,children:"Capture new filter set"})}),T("div",{className:"py-3 text-right",children:[h(W,{kind:"secondary",onClick:this.handleSettingsCancel,children:"Cancel"}),"\xA0",h(W,{kind:"primary",onClick:this.handleSettingsSave,children:"Save"})]})]})]})},"front"),T("div",{className:"filter-set-manager-value-card fill-parent-absolute",onClick:this.handleBackgroundClick,children:[h("div",{className:"filter-set-manager-column",children:h("div",{className:"filter-set-manager-column-title",children:"Filter sets"})}),h("div",{className:"filter-set-manager-card-content",children:h("div",{className:"filter-set-manager-value-input",children:T("div",{className:"filter-select-container",children:[T("select",{"data-testid":"value-card-filter-select",ref:this.dropdownRef,value:d,className:"custom-select filter-value-select",onChange:this.handleFilterChange,children:[a.length===0&&h("option",{value:"-1",disabled:!0,children:Zh}),a.map(({id:C,title:S})=>h("option",{value:C,children:S},C))]}),h(W,{"data-testid":"filter-apply-button",kind:"ghost",onClick:this.handleFilterApply,icon:Dd,tooltip:"Apply Filter Set"})]})})}),h("div",{className:"filter-set-manager-menu",children:h(W,{kind:"ghost",className:"btn btn-link btn-link-icon m-2 px-2",onClick:this.handleSettingsClick,tooltip:"Settings",icon:h(ee,{icon:sr,transform:"grow-4"})})})]},"back")]})})}}function Tc(t){var l,a;const{model:e,widgetName:n,glContainer:s,description:i}=t,o=((l=e==null?void 0:e.rowCount)!=null?l:0)-((a=e==null?void 0:e.pendingRowCount)!=null?a:0),r=e==null?void 0:e.displayString(o,"long");return h(ia,{widgetType:"Table",widgetName:n,glContainer:s,description:i,children:T("div",{className:"column-statistics-grid",children:[h("span",{className:"column-statistic-operation",children:"Number of Rows"}),h("span",{className:"column-statistic-value",children:r})]})})}Tc.propTypes={glContainer:jd.Container.isRequired,widgetName:D.exports.string.isRequired,description:D.exports.string};Tc.defaultProps={description:null};const Bn=Z.module("IrisGridPanel"),p2=500,g2={IrisGrid:go,IrisGridTableModel:eg,ContextMenuRoot:Wu};class io extends w.exports.PureComponent{constructor(e){super(e),this.getGridInputFilters=Se((s,i)=>ie.getInputFiltersForColumns(s,i.filter(({value:o,excludePanelIds:r})=>{const l=oe.getIdFromPanel(this);return o!=null&&(r==null||l!=null&&!r.includes(l))}))),this.getAlwaysFetchColumns=Se((s,i)=>{const o=oe.getIdFromPanel(this),r=new Set(i);for(let l=0;l<s.length;l+=1){const{start:a}=s[l];a!=null&&a.panelId===o&&r.add(a.columnName)}return[...r]}),this.getPluginContent=Se((s,i,o,r,l)=>!i||!gi(i)||s==null||i.table==null?null:h("div",{className:"iris-grid-plugin",children:h(s,{ref:this.pluginRef,filter:this.handlePluginFilter,onFilter:this.handlePluginFilter,fetchColumns:this.handlePluginFetchColumns,onFetchColumns:this.handlePluginFetchColumns,table:i.table,user:o,panel:this,workspace:r,components:g2,onStateChange:this.handlePluginStateChange,pluginState:l})})),this.getDehydratedIrisGridPanelState=Se((s,i,o,r,l)=>ie.dehydrateIrisGridPanelState(s,{isSelectingPartition:i,partition:o,partitionColumn:r,advancedSettings:l})),this.getDehydratedIrisGridState=Se((s,i,o,r,l,a,d,c,u,m,p,g,f,b,C,S,v,y,E,I,R)=>ie.dehydrateIrisGridState(s,{advancedFilters:o,aggregationSettings:v,customColumnFormatMap:r,isFilterBarShown:l,metrics:{userColumnWidths:C,userRowHeights:S},quickFilters:a,customColumns:d,reverseType:c,rollupConfig:u,showSearchBar:m,searchValue:p,selectDistinctColumns:g,selectedSearchColumns:f,sorts:i,invertSearchColumns:b,pendingDataMap:y,frozenColumns:E,conditionalFormats:I,columnHeaderGroups:R})),this.getDehydratedGridState=Se((s,i,o,r,l)=>ie.dehydrateGridState(s,{isStuckToBottom:r,isStuckToRight:l,movedColumns:i,movedRows:o})),this.getCachedPanelState=Se((s,i,o,r)=>({irisGridPanelState:s,irisGridState:i,gridState:o,pluginState:r})),this.savePanelState=Ze(()=>{const{irisGridState:s,gridState:i,pluginState:o}=this;L(s);const{onPanelStateUpdate:r}=this.props,{model:l,panelState:a,isSelectingPartition:d,partition:c,partitionColumn:u,advancedSettings:m}=this.state,{advancedFilters:p,aggregationSettings:g,customColumnFormatMap:f,isFilterBarShown:b,quickFilters:C,customColumns:S,reverseType:v,rollupConfig:y,showSearchBar:E,searchValue:I,selectDistinctColumns:R,selectedSearchColumns:N,sorts:F,invertSearchColumns:P,metrics:H,pendingDataMap:x,frozenColumns:A,conditionalFormats:k,columnHeaderGroups:G}=s;L(l),L(H);const{userColumnWidths:V,userRowHeights:O}=H;L(i);const{isStuckToBottom:$,isStuckToRight:Y,movedColumns:Q,movedRows:U}=i,q=this.getCachedPanelState(this.getDehydratedIrisGridPanelState(l,d,c,u,m),this.getDehydratedIrisGridState(l,F,p,f,b,C,S,v,y,E,I,R,N,P,V,O,g,x,A,k,G),this.getDehydratedGridState(l,Q,U,$,Y),o);q!==a&&(Bn.debug("Saving panel state",this,q),this.setState({panelState:q}),r==null||r(q))},p2),this.handleAdvancedSettingsChange=this.handleAdvancedSettingsChange.bind(this),this.handleColumnsChanged=this.handleColumnsChanged.bind(this),this.handleTableChanged=this.handleTableChanged.bind(this),this.handleColumnSelected=this.handleColumnSelected.bind(this),this.handleDataSelected=this.handleDataSelected.bind(this),this.handleError=this.handleError.bind(this),this.handleGridStateChange=this.handleGridStateChange.bind(this),this.handlePluginStateChange=this.handlePluginStateChange.bind(this),this.handlePartitionAppend=this.handlePartitionAppend.bind(this),this.handleCreateChart=this.handleCreateChart.bind(this),this.handleResize=this.handleResize.bind(this),this.handleShow=this.handleShow.bind(this),this.handleTabClicked=this.handleTabClicked.bind(this),this.handleDisconnect=this.handleDisconnect.bind(this),this.handleReconnect=this.handleReconnect.bind(this),this.handleLoadSuccess=this.handleLoadSuccess.bind(this),this.handleLoadError=this.handleLoadError.bind(this),this.isColumnSelectionValid=this.isColumnSelectionValid.bind(this),this.handleContextMenu=this.handleContextMenu.bind(this),this.handlePluginFilter=this.handlePluginFilter.bind(this),this.handlePluginFetchColumns=this.handlePluginFetchColumns.bind(this),this.handleClearAllFilters=this.handleClearAllFilters.bind(this),this.irisGrid=X.createRef(),this.pluginRef=X.createRef();const{panelState:n}=e;this.pluginState=null,this.state={error:null,isDisconnected:!1,isLoaded:!1,isLoading:!0,isModelReady:!1,model:void 0,advancedFilters:new Map,aggregationSettings:{aggregations:[],showOnTop:!1},advancedSettings:new Map(Np.DEFAULTS),customColumns:[],customColumnFormatMap:new Map,isFilterBarShown:!1,quickFilters:new Map,sorts:[],userColumnWidths:new Map,userRowHeights:new Map,reverseType:_.REVERSE_TYPE.NONE,movedColumns:[],movedRows:[],isSelectingPartition:!1,partition:void 0,partitionColumn:void 0,rollupConfig:void 0,showSearchBar:!1,searchValue:"",selectedSearchColumns:void 0,invertSearchColumns:!0,Plugin:void 0,pluginFilters:[],pluginFetchColumns:[],modelQueue:[],pendingDataMap:new Map,frozenColumns:void 0,panelState:n,irisGridStateOverrides:{},gridStateOverrides:{},isStuckToBottom:!1,isStuckToRight:!1,conditionalFormats:[],selectDistinctColumns:[]}}componentDidMount(){this.initModel()}componentDidUpdate(e,n){const{model:s}=this.state;s!==n.model&&(n.model!=null&&(this.stopModelListening(n.model),n.model.close()),s!=null&&this.startModelListening(s))}componentWillUnmount(){this.savePanelState.cancel(),this.modelPromise!=null&&(this.modelPromise.cancel(),this.modelPromise=void 0);const{model:e}=this.state;e&&(this.stopModelListening(e),e.close())}getTableName(){const{metadata:e}=this.props;return e.table}initModel(){this.setState({isModelReady:!1,isLoading:!0,error:null});const{makeModel:e}=this.props;this.modelPromise!=null&&this.modelPromise.cancel(),this.modelPromise=ye.makeCancelable(e(),n=>n.close()),this.modelPromise.then(this.handleLoadSuccess).catch(this.handleLoadError)}handleLoadSuccess(e){const n=e,{panelState:s,irisGridStateOverrides:i}=this.state,o=[];if(s!=null){const{irisGridState:r}=s,{aggregationSettings:l,customColumns:a,selectDistinctColumns:d=[],rollupConfig:c}={...r,...i};a.length>0&&o.push(u=>{u.customColumns=a}),c!=null&&c.columns.length>0&&o.push(u=>{u.rollupConfig=ie.getModelRollupConfig(u.originalColumns,c,l)}),d.length>0&&o.push(u=>{u.selectDistinctColumns=d})}this.setState({model:n,modelQueue:o}),this.initModelQueue(n,o)}initModelQueue(e,n){const s=e;if(n.length===0){this.modelInitialized(s);return}const i=n.shift();Bn.debug("initModelQueue",i),i&&i(s),this.setState({modelQueue:n})}handleAdvancedSettingsChange(e,n){Bn.debug("handleAdvancedSettingsChange",e,n),this.setState(({advancedSettings:s})=>s.get(e)===n?null:{advancedSettings:new Map(s).set(e,n)})}handlePluginFilter(e){const{model:n}=this.state;L(n);const{columns:s,formatter:i}=n,o=ie.getFiltersFromInputFilters(s,e,i.timeZone);this.setState({pluginFilters:o})}handlePluginFetchColumns(e){this.setState({pluginFetchColumns:e})}handleContextMenu(e){var n,s,i;return(i=(s=(n=this.pluginRef.current)==null?void 0:n.getMenu)==null?void 0:s.call(n,e))!=null?i:[]}isColumnSelectionValid(e){const{columnSelectionValidator:n}=this.props;return n&&e?n(this,e):!1}handleGridStateChange(e,n){this.irisGridState=e,this.gridState=n,this.setState({isLoaded:!0,isLoading:!1}),this.savePanelState();const{glEventHub:s,onStateChange:i}=this.props;s.emit(Et.STATE_CHANGED,this),i==null||i(e,n)}handlePluginStateChange(e){const{irisGridState:n,gridState:s}=this;this.pluginState=e,n!==null&&s!==null&&this.savePanelState()}handleColumnsChanged(e){const{isModelReady:n,model:s,modelQueue:i}=this.state;n?this.sendColumnsChange(e.detail):(L(s),this.initModelQueue(s,i))}handleTableChanged(e){Bn.debug("handleTableChanged",e);const{glEventHub:n}=this.props,{detail:s}=e;n.emit(Pe.TABLE_CHANGED,this,s)}handlePartitionAppend(e,n){const{glEventHub:s}=this.props,{name:i}=e,o=this.getTableName(),r=`${o} = ${o}.where("${i}=\`${n}\`")`;s.emit(bt.SEND_COMMAND,r,!1,!0)}handleCreateChart(e,n){this.savePanelState.flush(),this.setState(()=>null,()=>{const{glEventHub:s,inputFilters:i,metadata:o}=this.props,{table:r}=o,{panelState:l}=this.state,a=oe.getIdFromPanel(this);let d;l&&(d=ie.extractTableSettings(l,i)),s.emit(Et.CREATE_CHART,{metadata:{settings:e,sourcePanelId:a,table:r,tableSettings:d},table:gi(n)?n.table:void 0})})}handleColumnSelected(e){const{glEventHub:n}=this.props;n.emit(Et.COLUMN_SELECTED,this,e)}handleDataSelected(e,n){const{glEventHub:s}=this.props;s.emit(Et.DATA_SELECTED,this,n)}handleResize(){this.updateGrid()}handleShow(){this.updateGrid()}handleTabClicked(){this.irisGrid.current&&this.irisGrid.current.focus()}handleError(e){Bn.error(e),this.setState({error:e,isLoading:!1})}handleDisconnect(){this.setState({error:new Error("Table disconnected"),isDisconnected:!0,isLoading:!1})}handleReconnect(){this.setState({isDisconnected:!1,error:null})}handleLoadError(e){ye.isCanceled(e)||this.handleError(e)}modelInitialized(e){const{glEventHub:n,loadPlugin:s}=this.props;if(this.modelPromise=void 0,this.loadPanelState(e),this.setState({isModelReady:!0}),gi(e)){const{table:i}=e,{pluginName:o}=i;if(o!==""&&s!=null&&o!=null){const r=s(o);this.setState({Plugin:r})}n.emit(Pe.TABLE_CHANGED,this,i)}this.sendColumnsChange(e.columns)}handleClearAllFilters(){const e=this.irisGrid.current,{isDisconnected:n}=this.state;e!=null&&!n&&e.clearAllFilters()}sendColumnsChange(e){Bn.debug2("sendColumnsChange",e);const{glEventHub:n}=this.props;n.emit(Pe.COLUMNS_CHANGED,this,e)}startModelListening(e){e.addEventListener(ve.EVENT.DISCONNECT,this.handleDisconnect),e.addEventListener(ve.EVENT.RECONNECT,this.handleReconnect),e.addEventListener(ve.EVENT.COLUMNS_CHANGED,this.handleColumnsChanged),e.addEventListener(ve.EVENT.TABLE_CHANGED,this.handleTableChanged)}stopModelListening(e){e.removeEventListener(ve.EVENT.DISCONNECT,this.handleDisconnect),e.removeEventListener(ve.EVENT.RECONNECT,this.handleReconnect),e.removeEventListener(ve.EVENT.COLUMNS_CHANGED,this.handleColumnsChanged),e.removeEventListener(ve.EVENT.TABLE_CHANGED,this.handleTableChanged)}getCoordinateForColumn(e){var S,v,y;const{model:n}=this.state;if(!n)return null;const s=this.irisGrid.current,{gridWrapper:i}=s||{},o=(S=i==null?void 0:i.getBoundingClientRect())!=null?S:null;if(o==null||o.width<=0||o.height<=0)return null;L(s);const{metrics:r}=s.state;L(r);const{columnHeaderHeight:l,allColumnXs:a,allColumnWidths:d,right:c,columnHeaderMaxDepth:u}=r,m=n.getColumnIndexByName(e);L(m);const p=s.getVisibleColumn(m),g=(v=a.get(p))!=null?v:0,f=(y=d.get(p))!=null?y:0,b=Math.max(o.left,Math.min(p>c?o.right:o.left+g+f*.5,o.right)),C=o.top+l*u;return[b,C]}setFilterMap(e){const n=this.irisGrid.current;n!=null&&n.setFilterMap(e)}setAdvancedFilterMap(e){const n=this.irisGrid.current;n!=null&&n.setAdvancedFilterMap(e)}setFilters({quickFilters:e,advancedFilters:n}){Bn.debug("setFilters",e,n);const{model:s,isDisconnected:i}=this.state,o=this.irisGrid.current;if(o==null||i){Bn.debug("Ignore setFilters, model disconnected");return}L(s);const{columns:r,formatter:l}=s,a=ie.changeFilterColumnNamesToIndexes(s.columns,e).filter(([c])=>s.isFilterable(c)),d=ie.changeFilterColumnNamesToIndexes(s.columns,n).filter(([c])=>s.isFilterable(c));o.clearAllFilters(),o.setFilters({quickFilters:ie.hydrateQuickFilters(r,a,l.timeZone),advancedFilters:ie.hydrateAdvancedFilters(r,d,l.timeZone)})}setStateOverrides(e){Bn.debug("setStateOverrides",e);const{irisGridState:n,gridState:s}=e;this.setState({irisGridStateOverrides:n,gridStateOverrides:s},()=>{this.initModel()})}unsetFilterValue(){}loadPanelState(e){const{panelState:n,irisGridStateOverrides:s,gridStateOverrides:i}=this.state;if(n!=null)try{const{gridState:o,irisGridState:r,irisGridPanelState:l}=n,a={...s},{quickFilters:d,advancedFilters:c}=a;d&&(a.quickFilters=ie.changeFilterColumnNamesToIndexes(e.columns,d)),c&&(a.advancedFilters=ie.changeFilterColumnNamesToIndexes(e.columns,c));const{isSelectingPartition:u,partition:m,partitionColumn:p,advancedSettings:g}=ie.hydrateIrisGridPanelState(e,l),{advancedFilters:f,customColumns:b,customColumnFormatMap:C,isFilterBarShown:S,quickFilters:v,reverseType:y,rollupConfig:E,aggregationSettings:I,sorts:R,userColumnWidths:N,userRowHeights:F,showSearchBar:P,searchValue:H,selectDistinctColumns:x,selectedSearchColumns:A,invertSearchColumns:k,pendingDataMap:G,frozenColumns:V,conditionalFormats:O,columnHeaderGroups:$}=ie.hydrateIrisGridState(e,{...r,...a}),{isStuckToBottom:Y,isStuckToRight:Q,movedColumns:U,movedRows:q}=ie.hydrateGridState(e,{...o,...i},r.customColumns);this.setState({advancedFilters:f,advancedSettings:g,conditionalFormats:O,customColumns:b,customColumnFormatMap:C,isFilterBarShown:S,isSelectingPartition:u,movedColumns:U,movedRows:q,partition:m,partitionColumn:p,quickFilters:v,reverseType:y,rollupConfig:E,aggregationSettings:I,sorts:R,userColumnWidths:N,userRowHeights:F,showSearchBar:P,searchValue:H,selectDistinctColumns:x,selectedSearchColumns:A,invertSearchColumns:k,pendingDataMap:G,frozenColumns:V,isStuckToBottom:Y,isStuckToRight:Q,columnHeaderGroups:$})}catch(o){Bn.error("loadPanelState failed to load panelState",n,o)}}updateGrid(){var n,s;const e=(s=(n=this.irisGrid.current)==null?void 0:n.grid)!=null?s:null;!e||e.handleResize()}render(){var mn,kt;const{children:e,glContainer:n,glEventHub:s,columnSelectionValidator:i,getDownloadWorker:o,inputFilters:r,links:l,metadata:a,panelState:d,user:c,workspace:u,settings:m,theme:p}=this.props,{advancedFilters:g,aggregationSettings:f,advancedSettings:b,conditionalFormats:C,customColumns:S,customColumnFormatMap:v,error:y,isDisconnected:E,isFilterBarShown:I,isSelectingPartition:R,isStuckToBottom:N,isStuckToRight:F,isLoaded:P,isLoading:H,isModelReady:x,model:A,movedColumns:k,movedRows:G,partition:V,partitionColumn:O,quickFilters:$,reverseType:Y,rollupConfig:Q,sorts:U,userColumnWidths:q,userRowHeights:j,showSearchBar:te,searchValue:ce,selectDistinctColumns:ne,selectedSearchColumns:he,invertSearchColumns:Ce,Plugin:Re,pluginFilters:He,pluginFetchColumns:lt,pendingDataMap:Ve,frozenColumns:Ln,columnHeaderGroups:$t}=this.state,Me=y!=null?`Unable to open table. ${y}`:void 0,{table:ct}=a,at=(mn=A==null?void 0:A.description)!=null?mn:void 0,Mt=(kt=d==null?void 0:d.pluginState)!=null?kt:null,zt=e!=null?e:this.getPluginContent(Re,A,c,u,Mt),{permissions:An}=c,{canCopy:un,canDownloadCsv:Ti}=An;return h(oa,{errorMessage:Me,isDisconnected:E,isLoading:H,isLoaded:P,className:"iris-grid-panel",glContainer:n,glEventHub:s,onClearAllFilters:this.handleClearAllFilters,onResize:this.handleResize,onShow:this.handleShow,onTabFocus:this.handleShow,onTabClicked:this.handleTabClicked,widgetName:ct,widgetType:"Table",description:at,componentPanel:this,renderTabTooltip:()=>h(Tc,{model:A,widgetName:ct,glContainer:n,description:at}),children:x&&A&&h(go,{advancedFilters:g,aggregationSettings:f,advancedSettings:b,alwaysFetchColumns:this.getAlwaysFetchColumns(l,lt),columnAllowedCursor:"linker",columnNotAllowedCursor:"not-allowed",customColumns:S,customColumnFormatMap:v,columnSelectionValidator:this.isColumnSelectionValid,conditionalFormats:C,inputFilters:this.getGridInputFilters(A.columns,r),applyInputFiltersOnInit:d==null,isFilterBarShown:I,isSelectingColumn:i!=null,isSelectingPartition:R,isStuckToBottom:N,isStuckToRight:F,movedColumns:k,movedRows:G,partition:V,partitionColumn:O,quickFilters:$,reverseType:Y,rollupConfig:Q,settings:m,sorts:U,userColumnWidths:q,userRowHeights:j,model:A,showSearchBar:te,searchValue:ce,selectedSearchColumns:he,selectDistinctColumns:ne,invertSearchColumns:Ce,onColumnSelected:this.handleColumnSelected,onCreateChart:this.handleCreateChart,onDataSelected:this.handleDataSelected,onError:this.handleError,onPartitionAppend:this.handlePartitionAppend,onStateChange:this.handleGridStateChange,onContextMenu:this.handleContextMenu,onAdvancedSettingsChange:this.handleAdvancedSettingsChange,customFilters:He,pendingDataMap:Ve,canCopy:un,canDownloadCsv:Ti,ref:this.irisGrid,getDownloadWorker:o,frozenColumns:Ln,theme:p,columnHeaderGroups:$t,children:zt})})}}io.defaultProps={onStateChange:()=>{},onPanelStateUpdate:()=>{}};io.displayName="IrisGridPanel";io.COMPONENT="IrisGridPanel";const f2=(t,{localDashboardId:e=Mn})=>({inputFilters:hc(t,e),links:fo(t,e),columnSelectionValidator:pc(t,e),user:xm(t),workspace:Kl(t),settings:Rt(t)}),Ci=It(f2,null,null,{forwardRef:!0})(io);const Qh=Z.module("InputFilter"),C2=150,ad=class extends w.exports.Component{constructor(t){super(t),this.getItemLabel=be((i,o)=>{const{name:r,type:l}=i[o];if(o>0&&i[o-1].name===r||o<i.length-1&&i[o+1].name===r){const a=l.substring(l.lastIndexOf(".")+1);return`${r} (${a})`}return r}),this.sendUpdate=Ze(()=>{const{onChange:i}=this.props,{column:o,value:r,isValueShown:l}=this.state;i({column:o,isValueShown:l,value:r})},C2),this.handleColumnChange=this.handleColumnChange.bind(this),this.handleInputKeyPress=this.handleInputKeyPress.bind(this),this.handleValueChange=this.handleValueChange.bind(this),this.handleSettingsCancel=this.handleSettingsCancel.bind(this),this.handleSettingsClick=this.handleSettingsClick.bind(this),this.handleSettingsSave=this.handleSettingsSave.bind(this),this.handleBackgroundClick=this.handleBackgroundClick.bind(this),this.inputRef=X.createRef();const{column:e,isValueShown:n,value:s}=t;this.state={column:e,selectedColumn:e,value:s,isValueShown:n}}componentDidUpdate(t,e){const{column:n}=this.props,{column:s,value:i,isValueShown:o}=this.state;n!==t.column&&this.setState({column:n,selectedColumn:n}),o!==void 0&&o&&o!==e.isValueShown&&this.focusInput(),(s!==e.column||i!==e.value||o!==e.isValueShown)&&this.sendUpdate()}componentWillUnmount(){this.sendUpdate.flush()}handleColumnChange(t){const{columns:e}=this.props,{value:n}=t.target,s=e[parseInt(n,10)];Qh.debug2("handleColumnChange",s),this.setState({selectedColumn:s,value:void 0})}handleInputKeyPress(t){t.key==="Enter"&&(t.preventDefault(),t.stopPropagation(),this.setState(({value:e})=>e==null?{value:""}:null,()=>{this.sendUpdate(),this.sendUpdate.flush()}))}handleValueChange(t){const{value:e}=t.target;Qh.debug2("handleValueChange",e),this.setState({value:e})}handleSettingsCancel(){const{column:t}=this.state;this.setState({selectedColumn:t,isValueShown:!0})}handleSettingsSave(){const{selectedColumn:t}=this.state;this.setState({column:t,isValueShown:!0})}handleSettingsClick(t){const{column:e}=this.state;this.setState({selectedColumn:e,isValueShown:!1}),t.stopPropagation()}handleBackgroundClick(t){t.target!==this.inputRef.current&&this.focusInput()}focusInput(){this.inputRef.current!==null&&(this.inputRef.current.select(),this.inputRef.current.focus())}clearFilter(){this.setState({value:""})}setFilterState({name:t,type:e,value:n,isValueShown:s}){const i=t!=null&&e!=null?{name:t,type:e}:void 0,o=s===void 0?{column:i,value:n}:{column:i,value:n,isValueShown:s};this.setState(o)}render(){const{columns:t}=this.props,{column:e,isValueShown:n,selectedColumn:s,value:i}=this.state,o=i==null||i.length===0?ad.PLACEHOLDER.length:i.length;let r=null;if(e!=null){const l=t.findIndex(a=>a.name===e.name&&a.type===e.type);r=l>=0?this.getItemLabel(t,l):e.name}return T(Td,{className:"input-filter fill-parent-absolute",isFlipped:n!=null?n:!1,children:[h("div",{className:"input-filter-settings-card",children:T("div",{className:"input-filter-settings-content",children:[T("div",{className:"input-filter-settings-grid",children:[h("label",{children:"Filter Column"}),T("select",{value:t.findIndex(l=>l.name===(s==null?void 0:s.name)&&l.type===(s==null?void 0:s.type)),className:"custom-select",onChange:this.handleColumnChange,children:[t.map((l,a)=>h("option",{value:a,children:this.getItemLabel(t,a)},`${l.name}/${l.type}`)),t.length===0&&h("option",{value:"-1",disabled:!0,children:"No Available Columns"})]}),h("div",{className:"text-muted small",children:"Input filter control will apply its filter to all columns matching this name in this dashboard."})]}),T("div",{className:"input-filter-settings-buttons",children:[h(W,{kind:"secondary",onClick:this.handleSettingsCancel,disabled:e==null,children:"Cancel"}),h(W,{kind:"primary",className:"ml-2",onClick:this.handleSettingsSave,disabled:s==null,children:"Save"})]})]})}),T("div",{className:"input-filter-value-card",onClick:this.handleBackgroundClick,children:[h("div",{className:"input-filter-column",children:T("div",{className:"input-filter-column-title",children:[r," Filter"]})}),h("div",{className:"d-flex justify-content-center align-items-center h-100 w-100",children:h("div",{className:"input-filter-value-input d-flex flex-column justify-content-center",children:h("input",{type:"text",ref:this.inputRef,placeholder:ad.PLACEHOLDER,value:i!=null?i:"",onChange:this.handleValueChange,onKeyPress:this.handleInputKeyPress,style:{width:`${o+3}ch`},spellCheck:"false"})})}),h("div",{className:"input-filter-menu",children:h(W,{kind:"ghost",className:"m-2 px-2",onClick:this.handleSettingsClick,icon:h(ee,{icon:sr,transform:"grow-4"}),tooltip:"Input Filter Settings"})})]})]})}};let Ec=ad;Ec.PLACEHOLDER="Enter value...";Ec.defaultProps={column:null,isValueShown:!1,value:null};const b2=250;class da extends w.exports.Component{constructor(e){super(e),this.handleChange=Ze(this.handleChange.bind(this),b2),this.handleClearAllFilters=this.handleClearAllFilters.bind(this),this.inputFilterRef=X.createRef();const{panelState:n}=e,{value:s,isValueShown:i=!1,name:o,type:r,timestamp:l}=n!=null?n:{};this.state={columns:[],column:o!=null&&r!=null?{name:o,type:r}:void 0,value:s,timestamp:l,isValueShown:i,wasFlipped:!1,skipUpdate:!1,panelState:n}}componentDidMount(){this.updateColumns();const{column:e,value:n,timestamp:s}=this.state;if(e!=null){const{name:i,type:o}=e;this.sendUpdate(i,o,n,s)}}componentDidUpdate(e){const{columns:n}=this.props;n!==e.columns&&this.updateColumns()}handleChange({column:e,isValueShown:n=!1,value:s}){let i,o;e!=null&&({name:i,type:o}=e);let r=!0,l=Date.now();this.setState(({panelState:a,timestamp:d,wasFlipped:c,skipUpdate:u})=>{var p;const m=a!=null&&n!==a.isValueShown&&i===a.name&&o===a.type&&s===a.value;return r=(p=!u&&n&&(!m||!c))!=null?p:!1,r||(l=d),{panelState:{isValueShown:n,name:i,type:o,value:s,timestamp:l},timestamp:l,wasFlipped:m,skipUpdate:!1}},()=>{r&&this.sendUpdate(i,o,s,l)})}handleClearAllFilters(){var e;(e=this.inputFilterRef.current)==null||e.clearFilter()}sendUpdate(e,n,s,i){const{glEventHub:o}=this.props;o.emit(Pe.FILTERS_CHANGED,this,{name:e,type:n,value:s,timestamp:i})}setPanelState(e,n=!1){var s;this.setState({skipUpdate:!n}),(s=this.inputFilterRef.current)==null||s.setFilterState(e)}updateColumns(){const{columns:e}=this.props;e!=null&&this.setState(n=>{const{column:s}=n;return s==null&&e.length>0?{columns:[...e],column:e[0]}:s!=null&&!e.find(({name:i,type:o})=>s.name===i&&s.type===o)?{columns:[...e,s]}:{columns:[...e]}})}render(){const{glContainer:e,glEventHub:n}=this.props,{column:s,columns:i,isValueShown:o,value:r}=this.state;return h(ns,{className:"iris-input-filter-panel",componentPanel:this,glContainer:e,glEventHub:n,onClearAllFilters:this.handleClearAllFilters,isClonable:!0,isRenamable:!0,children:h(Ec,{ref:this.inputFilterRef,column:s,columns:i,onChange:this.handleChange,isValueShown:o,value:r})})}}da.defaultProps={panelState:null};da.COMPONENT="InputFilterPanel";da.displayName="InputFilterPanel";const S2=(t,e)=>{const{localDashboardId:n}=e;return{columns:rg(t,n)}},Go=It(S2,null,null,{forwardRef:!0})(da);const Ft=Z.module("FilterSetManagerPanel");function w2(t){return t.setPanelState!=null}const dd=class extends w.exports.Component{static changeFilterIndexesToColumnNames(t,e){return e.map(([n,s])=>{if(n>=t.columns.length)return null;const{name:i}=t.columns[n];return{name:i,filter:s}}).filter(n=>n!=null)}constructor(t){super(t),this.handleChange=this.handleChange.bind(this),this.handleFilterApply=this.handleFilterApply.bind(this),this.handleSetsUpdate=this.handleSetsUpdate.bind(this),this.handleGetFilterState=this.handleGetFilterState.bind(this);const{panelState:e,filterSets:n}=t,{selectedId:s=n.length>0?n[0].id:void 0,isValueShown:i=!1}=e!=null?e:{};this.state={selectedId:s,isValueShown:i,panelState:e}}getFilterState(){const{dashboardOpenedPanelMap:t}=this.props,e=[];return[...t.keys()].forEach(n=>{const s=t.get(n);if(s===void 0){Ft.error("Could not get panel",s);return}const i=oe.getComponentNameFromPanel(s),o=oe.getIdFromPanel(s);Ft.debug("Panel:",s,i);const{glContainer:r=null}=s.props;if(r==null){Ft.error("Could not get panel container",s);return}const l=oe.getComponentConfigFromContainer(r);if(l==null){Ft.error("Could not get component config from container",r);return}const a=oe.getPanelComponentState(l);if(a==null){Ft.debug(`Panel state is null ${o}`);return}switch(i){case oe.getComponentName(io):{let d;o!=null&&(d=this.getIrisGridPanelFilters(o,a)),d!=null&&e.push({panelId:o,type:i,state:d});break}case oe.getComponentName(Go):case oe.getComponentName(fi):{const{isValueShown:d,name:c,type:u,value:m}=a;e.push({panelId:o,type:i,state:{isValueShown:d,name:c,type:u,value:m}});break}}}),e}getIrisGridPanelFilters(t,e){const{panelTableMap:n}=this.props,s=n.get(t);if(s==null)return Ft.error(`Unable to get table for panel ${t}.`),null;const{irisGridState:i={advancedFilters:void 0,quickFilters:void 0},gridState:o={}}=e,{advancedFilters:r,quickFilters:l}=i;let a;r&&(a=dd.changeFilterIndexesToColumnNames(s,r));let d;return l&&(d=dd.changeFilterIndexesToColumnNames(s,l)),{irisGridState:{...i,advancedFilters:a,quickFilters:d},gridState:{...o}}}handleGetFilterState(){return this.getFilterState()}handleChange({isValueShown:t,selectedId:e}){Ft.debug("handleChange",t,e),this.setState({isValueShown:t,selectedId:e}),this.updatePanelState()}handleFilterApply(t){const{dashboardOpenedPanelMap:e}=this.props,{panels:n,restoreFullState:s=!1}=t;Ft.debug("Apply filters from filter set",t),n.forEach(({panelId:i,type:o,state:r})=>{if(i==null){Ft.debug("panel is null",i);return}if(!e.has(i)){Ft.debug("Ignore closed panel",i);return}Ft.debug("Apply panel filters",i,o,r);const l=e.get(i);switch(o){case oe.getComponentName(io):this.restoreIrisGridFilters(l,r,s);break;case oe.getComponentName(Go):case oe.getComponentName(fi):this.restoreInputFilterState(l,r);break}})}handleSetsUpdate(t){const{setDashboardFilterSets:e,localDashboardId:n}=this.props;Ft.debug("Saving updated sets",t),e(n,[...t])}updatePanelState(){this.setState(({selectedId:t,isValueShown:e})=>({panelState:{selectedId:t,isValueShown:e}}))}restoreIrisGridFilters(t,e,n){const{irisGridState:s={},advancedFilters:i=[],quickFilters:o=[]}=e,{advancedFilters:r=i,quickFilters:l=o}=s,{panelTableMap:a}=this.props,d=oe.getIdFromPanel(t);if(d==null){Ft.error("Panel Id is null.");return}if(a.get(d)==null){Ft.error(`Unable to get table for panel ${d}.`);return}Ft.debug("restoreIrisGridFilters",d,e,n),n?t.setStateOverrides(e):t.setFilters({quickFilters:l,advancedFilters:r})}restoreInputFilterState(t,e){const n={...e};delete n.isValueShown,Ft.debug("restoreInputFilterState",t,n),t&&w2(t)&&t.setPanelState(n)}render(){const{glContainer:t,glEventHub:e,filterSets:n}=this.props,{isValueShown:s,selectedId:i}=this.state;return h(ns,{className:"filter-set-manager-panel",componentPanel:this,glContainer:t,glEventHub:e,isClonable:!0,isRenamable:!0,children:h("div",{className:"input-filter-container h-100 w-100 container",children:h(Dl,{onChange:this.handleChange,onApply:this.handleFilterApply,onUpdateSets:this.handleSetsUpdate,isValueShown:s,filterSets:n,selectedId:i,getFilterState:this.handleGetFilterState})})})}};let yc=dd;yc.defaultProps={panelState:null};yc.COMPONENT="FilterSetManagerPanel";const v2=(t,e)=>{const{localDashboardId:n}=e;return{filterSets:A1(t,n),dashboardOpenedPanelMap:Sp(t,n),dashboardInputFilters:hc(t,n),panelTableMap:uc(t,n)}},La=It(v2,{setDashboardFilterSets:W1},null,{forwardRef:!0})(yc);const Jh=Z.module("LogPanel");class ca extends w.exports.PureComponent{constructor(e){super(e),this.handleResize=this.handleResize.bind(this),this.handleShow=this.handleShow.bind(this),this.handleHide=this.handleHide.bind(this),this.handleSessionOpened=this.handleSessionOpened.bind(this),this.handleSessionClosed=this.handleSessionClosed.bind(this),this.isBottomVisible=!0,this.logView=null;const{session:n}=this.props;this.state={session:n}}handleResize(){this.updateDimensions()}handleShow(){this.updateDimensions(),this.logView&&(this.logView.triggerFindWidget(),this.isBottomVisible&&this.logView.scrollToBottom())}handleHide(){this.logView&&(this.isBottomVisible=this.logView.isBottomVisible())}handleSessionOpened(e){Jh.debug("Session opened",[e]),this.setState({session:e})}handleSessionClosed(e){Jh.debug("Session closed",e)}updateDimensions(){this.logView&&this.logView.updateDimensions()}render(){const{glContainer:e,glEventHub:n}=this.props,{session:s}=this.state;return T(ns,{componentPanel:this,glContainer:e,glEventHub:n,onResize:this.handleResize,onHide:this.handleHide,onShow:this.handleShow,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,children:[s==null&&h("div",{className:"log-panel-disconnected-message",children:"Waiting for session connection"}),s!=null&&h(co,{session:s,ref:i=>{this.logView=i}})]})}}ca.defaultProps={session:null};ca.COMPONENT="LogPanel";ca.TITLE="Log";const T2=(t,e)=>{var n;return{session:(n=wi(t,e.localDashboardId))==null?void 0:n.session}},Ml=It(T2,null,null,{forwardRef:!0})(ca);class ug extends w.exports.PureComponent{render(){const{isEditing:e,children:n,onDoubleClick:s}=this.props;return T("div",{className:"markdown-editor-container h-100 w-100",onDoubleClick:s,children:[h("div",{className:z("text-muted","edit-hint",{viewing:e===void 0||!e}),children:T("span",{children:["double-click to edit ",h(ee,{icon:nr})]})}),n]})}}ug.defaultProps={isEditing:!1};const E2=Z.module("MarkdownStartPage");class mg extends w.exports.PureComponent{constructor(e){super(e),this.handleDeleteButtonClick=this.handleDeleteButtonClick.bind(this),this.handleDeleteModalClose=this.handleDeleteModalClose.bind(this),this.state={isDeleteModalShown:!1}}handleDeleteButtonClick(e){this.setState({isDeleteModalShown:!0,toBeDeleted:e})}handleDeleteModalClose(){this.setState({isDeleteModalShown:!1,toBeDeleted:void 0})}handleDeleteMarkdown(e){if(E2.debug("delete markdown: ",e),e!==void 0){const{onDelete:n}=this.props;n(e)}this.setState({isDeleteModalShown:!1,toBeDeleted:void 0})}render(){const{closedMarkdowns:e,onOpen:n,onCreate:s}=this.props,{isDeleteModalShown:i,toBeDeleted:o}=this.state;return h("div",{className:"markdown-panel-start-page h-100 w-100",children:T("div",{className:"markdown-panel-start-page-container",children:[T("div",{className:"markdown-panel-start-list",children:[h("h3",{className:"list-title",children:"Start"}),h("div",{className:"list-item",children:h(W,{kind:"ghost",className:"title",onClick:s,children:"New Markdown Note"})})]}),T("div",{className:"markdown-panel-start-list",children:[h("h3",{className:"list-title",children:"Recently Closed from Dashboard"}),e.map(r=>T("div",{className:"list-item",children:[h(W,{kind:"ghost",className:"title",onClick:()=>n(r),children:r.title}),h("button",{className:"btn-link icon",type:"button",onClick:()=>{this.handleDeleteButtonClick(r)},children:h(ee,{icon:hn})})]},r.id)),T(Jo,{isOpen:i,toggle:this.handleDeleteModalClose,className:"modal-dialog-centered markdown-delete-modal theme-bg-light",children:[h(tr,{children:"Are you sure you want to permanently delete this note?"}),h(er,{children:"You can't undo this action."}),T(vd,{children:[h(W,{kind:"secondary",onClick:this.handleDeleteModalClose,children:"Cancel"}),h(W,{kind:"danger",onClick:()=>{this.handleDeleteMarkdown(o)},children:"Delete"})]})]})]})]})})}}mg.defaultProps={closedMarkdowns:[],onOpen:()=>{},onCreate:()=>{},onDelete:()=>{}};const y2=t=>{const{children:e,className:n}=t,s=n!==void 0&&(n==null?void 0:n.startsWith("language-"))?n.substring(9):"plaintext";return h("pre",{children:h("code",{children:h(zl,{language:s,children:X.Children.map(e,i=>typeof i=="string"?i.trim():i)})})})};class pg extends w.exports.PureComponent{constructor(e){super(e),this.container=null}render(){const{isEditing:e,content:n,onEditorInitialized:s}=this.props;return h("div",{className:"markdown-editor-container",ref:i=>{this.container=i},children:e?h(Wl,{settings:{language:"markdown",value:n,lineNumbers:"off"},onEditorInitialized:s}):h(wu,{components:{code:y2},children:n})})}}pg.defaultProps={isEditing:!1,content:""};const Xr=Z.module("MarkdownPanel");class Ic extends w.exports.Component{constructor(e){super(e),this.getClosedMarkdowns=Se(i=>i.filter(o=>o.component==="MarkdownPanel").reverse()),this.handleContainerDoubleClick=this.handleContainerDoubleClick.bind(this),this.handleCreateMarkdown=this.handleCreateMarkdown.bind(this),this.handleDeleteMarkdown=this.handleDeleteMarkdown.bind(this),this.handleOpenMarkdown=this.handleOpenMarkdown.bind(this),this.handleEditorInitialized=this.handleEditorInitialized.bind(this),this.handleEditorBlur=this.handleEditorBlur.bind(this),this.handleEditorResize=this.handleEditorResize.bind(this);const{panelState:n}=e;let s=null;n!=null&&n.content!=null&&({content:s}=n),this.state={isStartPageShown:s==null,isEditing:!1,content:s,panelState:n},this.markdownEditor=null}setEditorPosition(e){var s,i;L(this.markdownEditor);const{container:n}=this.markdownEditor;if(this.editor&&n){const o=n.getBoundingClientRect().top,r=n.scrollTop,l=n.scrollHeight,a=(i=(s=this.editor.getModel())==null?void 0:s.getLineCount())!=null?i:0;let d=Math.round((r+e-o)/l*a);d>a&&(d=a),this.editor.revealLine(d),this.editor.setPosition({lineNumber:d,column:1}),this.editor.focus()}}handleContainerDoubleClick(e){const{isEditing:n}=this.state,s=e.clientY;n||this.setState({isEditing:!0},()=>{this.setEditorPosition(s)})}handleEditorInitialized(e){Xr.debug("Markdown Editor Initialized..."),this.editor=e}handleCreateMarkdown(){Xr.debug("create markdown..."),this.setState({isStartPageShown:!1,content:"",isEditing:!0,panelState:{content:""}},()=>{this.editor!=null&&this.editor.focus!=null&&this.editor.focus()})}handleOpenMarkdown(e){Xr.debug("open markdown...",e);const{glContainer:n,glEventHub:s}=this.props,i=oe.getComponentConfigFromContainer(n);s.emit(De.REOPEN,e,i)}handleDeleteMarkdown(e){const{glEventHub:n}=this.props;n.emit(De.DELETE,e)}handleEditorBlur(e){var i;Xr.debug("markdown content changed, saving...");const{isEditing:n}=this.state;if(!n||this.markdownEditor!=null&&this.markdownEditor.container!=null&&this.markdownEditor.container.contains(e.relatedTarget))return;const s=(i=this.editor)==null?void 0:i.getValue();this.setState({content:s,isEditing:!1,panelState:{content:s}})}handleEditorResize(){const{isEditing:e}=this.state;e&&this.editor&&this.editor.layout()}render(){const{glContainer:e,glEventHub:n,closedPanels:s}=this.props,{isEditing:i,isStartPageShown:o,content:r}=this.state,l=this.getClosedMarkdowns(s);return h(ns,{glContainer:e,glEventHub:n,className:"markdown-panel",componentPanel:this,onResize:this.handleEditorResize,onBlur:this.handleEditorBlur,isClonable:!0,isRenamable:!0,children:o?h(mg,{closedMarkdowns:l,onCreate:this.handleCreateMarkdown,onOpen:this.handleOpenMarkdown,onDelete:this.handleDeleteMarkdown}):h(ug,{isEditing:i,onDoubleClick:this.handleContainerDoubleClick,children:h(pg,{ref:a=>{this.markdownEditor=a},isEditing:i,content:r!=null?r:void 0,onEditorInitialized:this.handleEditorInitialized})})})}}Ic.defaultProps={panelState:null};Ic.COMPONENT="MarkdownPanel";const I2=(t,e)=>{const{localDashboardId:n}=e;return{closedPanels:bv(t,n)}},_o=It(I2,null,null,{forwardRef:!0})(Ic);class gg extends w.exports.PureComponent{constructor(e){super(e),this.handleRunSelected=this.handleRunSelected.bind(this),this.renderCodeBlock=this.renderCodeBlock.bind(this),this.renderLink=this.renderLink.bind(this),this.commands=new Map,this.codeElements=new Map,this.editorScrollView=X.createRef(),this.state={hasCode:!1,hasRunCode:!1,nextStartLine:null}}componentDidMount(){this.updateHasCode()}componentDidUpdate(){this.updateHasCode()}updateHasCode(){const{hasCode:e}=this.state;this.commands.size===0&&e?this.setState({hasCode:!1}):this.commands.size>0&&!e&&this.setState({hasCode:!0})}getNextStartLine(e){const n=[...this.commands.keys()],s=n.findIndex(i=>i===e)+1;return s>=n.length?null:n[s]}handleRunSelected(e){var c,u,m;e.preventDefault(),e.stopPropagation();const{nextStartLine:n}=this.state,s=[...this.commands.keys()],i=s.findIndex(p=>p===n||n==null);if(i<0)return;const o=s[i],r=this.commands.get(o),l=this.getNextStartLine(o),a=(c=this.codeElements.get(o))==null?void 0:c.current,d=(u=a==null?void 0:a.parentElement)==null?void 0:u.nextElementSibling;if(d!=null){const{offsetTop:p}=d,g=p;(m=this.editorScrollView.current)==null||m.scroll({top:g,left:0})}this.runCode(r),this.setState({nextStartLine:l})}runCode(e){const{onRunCode:n}=this.props;n(e),this.setState({hasRunCode:!0})}renderCodeBlock(e){const{children:n,className:s,inline:i,node:o}=e,{hasRunCode:r,nextStartLine:l}=this.state,{children:a,position:d}=o;L(d);const{start:c}=d,{line:u}=c,m=a[0].value,p=X.createRef(),g=this.commands.size===0,f=l===u||g&&l==null&&!r,b=s!==void 0&&s.startsWith("language-")?s.substring(9):"plaintext";return i!=null&&i?h("code",{className:s,children:n}):(this.commands.set(u,m),this.codeElements.set(u,p),T("div",{className:z("markdown-notebook-code-block",{"is-selected":f}),ref:p,onClick:()=>{this.setState({nextStartLine:u})},role:"presentation",children:[h(W,{kind:"ghost",icon:ul,className:"btn-play-block",onClick:C=>{C.stopPropagation(),C.preventDefault(),this.runCode(m),this.setState({nextStartLine:u})},tooltip:"Run code"}),h("code",{children:h(zl,{language:b,children:X.Children.map(n,C=>typeof C=="string"?C.trim():C)})})]}))}renderLink(e){const{onLinkClick:n}=this.props,{href:s,children:i,target:o}=e;return h("a",{href:s,onClick:n,target:o,children:i})}render(){const{content:e,transformImageUri:n,transformLinkUri:s}=this.props,{hasCode:i,hasRunCode:o,nextStartLine:r}=this.state;return T("div",{className:"markdown-notebook",children:[h("div",{className:"markdown-notebook-toolbar",children:h(W,{className:z("btn-play-selected-cell",{flashing:i&&!o}),kind:"ghost",icon:ul,onClick:this.handleRunSelected,tooltip:"Run code and select next",disabled:o&&r==null||!i,children:"Run Selected Code"})}),h("div",{className:"markdown-notebook-content",ref:this.editorScrollView,children:h(wu,{components:{code:this.renderCodeBlock,a:this.renderLink},linkTarget:"_blank",remarkPlugins:[ff],transformLinkUri:s,transformImageUri:n,includeElementIndex:!0,children:e})})]})}}gg.defaultProps={onRunCode:()=>{}};const Be=Z.module("NotebookPanel"),eu=400,$i=class extends w.exports.Component{constructor(t){super(t),this.getSettings=Se((u,m)=>({...u,minimap:{enabled:m}})),this.getOverflowActions=Se((u,m)=>[{title:"Find",icon:sb,action:this.handleFind,group:ae.groups.high,shortcut:Bt.NOTEBOOK.FIND,order:10},{title:"Show Minimap",icon:u?jn:void 0,action:this.handleMinimapChange,group:ae.groups.medium,shortcut:Bt.NOTEBOOK.MINIMAP,order:20},{title:"Word Wrap",icon:m?jn:void 0,action:this.handleWordWrapChange,group:ae.groups.medium,shortcut:Bt.NOTEBOOK.WORDWRAP,order:30}]),this.handleBlur=this.handleBlur.bind(this),this.handleCloseCancel=this.handleCloseCancel.bind(this),this.handleCloseDiscard=this.handleCloseDiscard.bind(this),this.handleCloseSave=this.handleCloseSave.bind(this),this.handleCopy=this.handleCopy.bind(this),this.handleEditorInitialized=this.handleEditorInitialized.bind(this),this.handleEditorWillDestroy=this.handleEditorWillDestroy.bind(this),this.handleEditorChange=this.handleEditorChange.bind(this),this.handleFind=this.handleFind.bind(this),this.handleMinimapChange=this.handleMinimapChange.bind(this),this.handleWordWrapChange=this.handleWordWrapChange.bind(this),this.handleFocus=this.handleFocus.bind(this),this.handleLinkClick=this.handleLinkClick.bind(this),this.handleLoadSuccess=this.handleLoadSuccess.bind(this),this.handleLoadError=this.handleLoadError.bind(this),this.handlePanelTabClick=this.handlePanelTabClick.bind(this),this.handleRenameFile=this.handleRenameFile.bind(this),this.handleResize=this.handleResize.bind(this),this.handleRunCommand=this.handleRunCommand.bind(this),this.handleRunAll=this.handleRunAll.bind(this),this.handleRunSelected=this.handleRunSelected.bind(this),this.handleSave=this.handleSave.bind(this),this.handleSaveAsCancel=this.handleSaveAsCancel.bind(this),this.handleSaveAsSubmit=this.handleSaveAsSubmit.bind(this),this.handleSaveError=this.handleSaveError.bind(this),this.handleSaveSuccess=this.handleSaveSuccess.bind(this),this.handleSessionOpened=this.handleSessionOpened.bind(this),this.handleSessionClosed=this.handleSessionClosed.bind(this),this.handleShow=this.handleShow.bind(this),this.handleShowRename=this.handleShowRename.bind(this),this.handleTab=this.handleTab.bind(this),this.handleTabFocus=this.handleTabFocus.bind(this),this.handleTabBlur=this.handleTabBlur.bind(this),this.handleTransformLinkUri=this.handleTransformLinkUri.bind(this),this.handleOverwrite=this.handleOverwrite.bind(this),this.getDropdownOverflowActions=this.getDropdownOverflowActions.bind(this),this.pending=new Ss,this.debouncedSavePanelState=Ze(this.savePanelState.bind(this),eu),this.debouncedLoad=Ze(this.load.bind(this),eu),this.notebook=null,this.tabTitleElement=null,this.tabInitOnce=!1;const{isDashboardActive:e,session:n,sessionLanguage:s,panelState:i}=t;let o={value:"",language:"",wordWrap:"off"},r=null,{isPreview:l}=t;i!=null&&({fileMetadata:r=r,isPreview:l=l,settings:o=o}=i);const a=r!=null&&pe.hasPath(r.itemName),c=a===!0&&o.value!=null||!a&&o.value!=null&&o.value.length>0?1:0;this.state={error:void 0,isDashboardActive:e,isFocused:!1,isLoading:!0,isLoaded:!1,isPreview:l,savedChangeCount:0,changeCount:c,fileMetadata:r,settings:o,session:n,sessionLanguage:s,panelState:{fileMetadata:r,settings:o},showCloseModal:!1,showSaveAsModal:!1,scriptCode:"",shouldPromptClose:!0},Be.debug("constructor",t,this.state)}static handleError(t){ye.isCanceled(t)||Be.error(t)}static languageFromFileName(t){switch(pe.getExtension(t).toLowerCase()){case"py":case"python":return"python";case"groovy":return"groovy";case"scala":return"scala";default:return null}}componentDidMount(){const{glContainer:t,glEventHub:e}=this.props,{tab:n}=t;n!=null&&this.initTab(n),this.initNotebookContent(),e.on(Le.RENAME_FILE,this.handleRenameFile),t.on("tabClicked",this.handlePanelTabClick)}componentDidUpdate(t,e){const{isPreview:n,settings:s}=this.state,{wordWrap:i}=s,{defaultNotebookSettings:o}=this.props;n!==e.isPreview&&this.setPreviewStatus(),i!==e.settings.wordWrap&&(this.updateEditorWordWrap(),this.debouncedSavePanelState()),o.isMinimapEnabled!==t.defaultNotebookSettings.isMinimapEnabled&&this.updateEditorMinimap()}componentWillUnmount(){this.debouncedSavePanelState.flush(),this.pending.cancel();const{glContainer:t,glEventHub:e}=this.props,{fileMetadata:n,isPreview:s}=this.state;e.off(Le.RENAME_FILE,this.handleRenameFile),t.off("tabClicked",this.handlePanelTabClick),e.emit(Le.UNREGISTER_FILE,n,s)}initTab(t){this.tabInitOnce||(this.tabInitOnce=!0,this.initTabCloseOverride()),this.initTabClasses(t)}initTabCloseOverride(){const{glContainer:t}=this.props;t.beforeClose(e=>{if((e==null?void 0:e.force)===!0)return!0;const{changeCount:n,savedChangeCount:s,shouldPromptClose:i}=this.state;return n!==s&&i?(this.setState({showCloseModal:!0}),!1):!0})}initTabClasses(t){const e=t.element.get(0);L(e);const n=e.querySelector(".lm_title");this.tabTitleElement=n,n==null||n.classList.add("notebook-title"),this.setPreviewStatus()}getNotebookValue(){const{changeCount:t,savedChangeCount:e,settings:n}=this.state,{value:s}=n;if(t!==e&&this.notebook){const i=this.notebook.getValue();return i!=null?i:s}return s}initNotebookContent(){const{fileMetadata:t,settings:e,isPreview:n}=this.state;if(t&&t.id){Be.debug("Init content from file"),this.registerFileMetadata(t,n),this.load();return}if(e.value!=null){Be.debug("Use content passed in the settings prop"),this.handleLoadSuccess();return}this.handleLoadError(new Error("Missing file metadata"))}closeFileTabById(t){const{glEventHub:e}=this.props;e.emit(Le.CLOSE_FILE,{id:t})}registerFileMetadata(t,e){const{glEventHub:n,metadata:s}=this.props,{id:i}=s;n.emit(Le.REGISTER_FILE,i,t,e)}renameTab(t,e){const{glEventHub:n}=this.props;n.emit(Le.RENAME,t,e)}load(){const{fileMetadata:t,settings:e}=this.state;L(t);const{id:n}=t,{fileStorage:s}=this.props;this.pending.add(s.loadFile(n)).then(i=>{var a;Be.debug("Loaded file",i);const{filename:o}=i,{itemName:r}=this.state;if(o!==r){const{metadata:d}=this.props,{id:c}=d;this.renameTab(c,pe.getBaseName(o))}const l={...e,language:(a=$i.languageFromFileName(o))!=null?a:""};e.value==null&&(l.value=i.content),e.wordWrap===void 0&&(e.wordWrap="off"),this.setState({fileMetadata:{id:o,itemName:o},settings:l}),this.debouncedSavePanelState()}).then(this.handleLoadSuccess).catch(this.handleLoadError)}save(){const{fileMetadata:t}=this.state;if(t&&pe.hasPath(t.itemName)){const e=this.getNotebookValue();return e!==void 0?(this.saveContent(t.itemName,e),!0):!1}return this.setState({showSaveAsModal:!0}),!1}saveContent(t,e){Be.debug("saveContent",t,e),this.updateSavedChangeCount();const{fileStorage:n}=this.props;this.pending.add(n.saveFile({filename:t,content:e,basename:t})).then(this.handleSaveSuccess).catch(this.handleSaveError)}updateSavedChangeCount(){this.setState(({changeCount:t})=>({savedChangeCount:t}))}setPreviewStatus(){if(!this.tabTitleElement)return;const{isPreview:t}=this.state;Be.debug("setPreviewStatus",this.tabTitleElement,t),t?this.tabTitleElement.classList.add("is-preview"):this.tabTitleElement.classList.remove("is-preview")}savePanelState(){this.setState(t=>{const{changeCount:e,savedChangeCount:n,fileMetadata:s,isPreview:i,settings:o}=t,r=this.getNotebookValue(),l=e!==n?r:void 0,a={...o,value:r},c={settings:{...o,value:l},fileMetadata:s,isPreview:i};return Be.debug("Saving panel state",c),{settings:a,panelState:c}})}handleCloseDiscard(){this.setState({shouldPromptClose:!1,showCloseModal:!1});const{glContainer:t}=this.props;t.close()}handleCloseSave(){if(this.setState({shouldPromptClose:!1,showCloseModal:!1}),this.save()){const{glContainer:t}=this.props;t.close()}}handleCloseCancel(){this.setState({shouldPromptClose:!0,showCloseModal:!1})}handleOverwrite(t){const{glEventHub:e}=this.props;e.emit(Le.CLOSE_FILE,{id:t,itemName:t},{force:!0}),this.focus()}handleCopy(){const{fileMetadata:t,settings:e}=this.state;L(t);const n=this.getNotebookValue(),{language:s}=e,{itemName:i}=t,o=pe.getCopyFileName(i);Be.debug("handleCopy",t,i,o),this.createNotebook(o,s,n)}handleEditorInitialized(t){this.editor=t}handleEditorWillDestroy(){this.editor=void 0}handleEditorChange(t){Be.debug2("handleEditorChanged",t),this.removePreviewStatus(),this.setState(e=>{const{changeCount:n,savedChangeCount:s}=e,{isUndoing:i,isRedoing:o}=t;return i?{changeCount:n-1,savedChangeCount:s}:!o&&n<s?{changeCount:n+1,savedChangeCount:0}:{changeCount:n+1,savedChangeCount:s}}),this.debouncedSavePanelState()}handleFind(){this.notebook&&this.notebook.toggleFind()}updateEditorMinimap(){if(this.editor){const{defaultNotebookSettings:t}=this.props;this.editor.updateOptions({minimap:{enabled:t.isMinimapEnabled}})}}handleMinimapChange(){const{settings:t,defaultNotebookSettings:e,saveSettings:n}=this.props,s={...t,defaultNotebookSettings:{isMinimapEnabled:!e.isMinimapEnabled}};n(s)}updateEditorWordWrap(){if(this.editor){const{settings:t}=this.state,{wordWrap:e}=t;this.editor.updateOptions({wordWrap:e})}}handleWordWrapChange(){this.editor&&this.setState(t=>{const{settings:e}=t,n=e.wordWrap==="on"?"off":"on";return{settings:{...e,wordWrap:n}}})}handleBlur(){Be.debug("handleBlur"),this.setState({isFocused:!1})}handleFocus(){Be.debug("handleFocus"),this.setState({isFocused:!0})}handleLinkClick(t){const{notebooksUrl:e,session:n,sessionLanguage:s}=this.props,{href:i}=t.currentTarget;if(!i||!i.startsWith(e))return;t.stopPropagation(),t.preventDefault();const o=`/${i.substring(e.length)}`.replace(/%20/g," ");if(o==="/"){Be.debug("Ignoring invalid notebook link",o);return}Be.debug("Notebook link clicked, opening",o);const{glEventHub:r}=this.props,l={value:null,language:s},a={id:o,itemName:o};r.emit(Le.SELECT_NOTEBOOK,n,s,l,a)}handleLoadSuccess(){this.setState({error:void 0,isLoaded:!0,isLoading:!1})}handleLoadError(t){let e=t;ye.isCanceled(e)||(ye.isTimedOut(e)&&(e=new Error("File not found.")),Be.error(e),this.setState({error:e,isLoading:!1}))}handleSave(){Be.debug("handleSave"),this.save()}handleSaveSuccess(t){var i;const{fileStorage:e}=this.props,n={id:t.filename,itemName:t.filename},s=(i=$i.languageFromFileName(t.filename))!=null?i:"";this.setState(o=>{const{fileMetadata:r}=o,l={...o.settings,language:s};return Be.debug("handleSaveSuccess",n,r,l),r&&pe.hasPath(r.itemName)&&r.itemName!==n.itemName&&(Be.debug("handleSaveSuccess deleting old file",r.itemName),e.deleteFile(r.itemName).catch($i.handleError)),{fileMetadata:n,settings:l,isPreview:!1}}),this.debouncedSavePanelState(),this.registerFileMetadata(n,!1)}handleSaveError(t){ye.isCanceled(t)||(this.setState({savedChangeCount:0}),Be.error(t))}handleSaveAsCancel(){this.setState({showSaveAsModal:!1})}handleSaveAsSubmit(t,e=!1){var o;e&&this.handleOverwrite(t),Be.debug("handleSaveAsSubmit",t);const{fileMetadata:n}=this.state;if(!n)return;const{itemName:s}=n,i=(o=this.getNotebookValue())!=null?o:"";if(this.setState({showSaveAsModal:!1}),pe.getBaseName(s)!==pe.getBaseName(t)){const{metadata:r}=this.props,{id:l}=r;this.renameTab(l,pe.getBaseName(t))}this.saveContent(t,i)}handleRenameFile(t,e,n){const{fileMetadata:s,panelState:i}=this.state,{glContainer:o}=this.props;if((s==null?void 0:s.itemName)===`/${e}`&&n&&JSON.stringify(i)!==JSON.stringify(n)){o.close();return}s&&s.id===t&&(this.setState({fileMetadata:{id:e,itemName:e}}),this.debouncedSavePanelState())}handleResize(){var t;(t=this.notebook)==null||t.updateDimensions()}handleRunCommand(t){this.runCommand(t)}handleRunAll(){var t;if(!this.notebook){Be.error("Editor is not initialized.");return}this.runCommand((t=this.notebook.getValue())!=null?t:void 0)}handleRunSelected(){if(!this.notebook){Be.error("Editor is not initialized.");return}this.runCommand(this.notebook.getSelectedCommand())}handleSessionOpened(t,{language:e}){this.setState({session:t,sessionLanguage:e})}handleSessionClosed(){this.setState({session:void 0,sessionLanguage:void 0})}handleShow(){var t;Be.debug("handleShow"),(t=this.notebook)==null||t.updateDimensions()}handleShowRename(){this.setState({showSaveAsModal:!0})}handleTab(t){Be.debug("NotebookPanel tab event",t),this.initTab(t)}handleTabFocus(...t){Be.debug("handleTabFocus",...t);const{glContainer:e}=this.props;this.setState({isDashboardActive:!0}),this.notebook&&!e.isHidden&&this.notebook.updateDimensions()}handleTabBlur(){Be.debug("handleTabBlur"),this.setState({isDashboardActive:!1})}handlePanelTabClick(){Be.debug("handlePanelTabClick"),this.focus()}handleTransformLinkUri(t){const{notebooksUrl:e}=this.props,{fileMetadata:n}=this.state;if(t.endsWith("/"))return t;if(t.startsWith("/"))return`${e}${t.substring(1)}`;let s=n==null?void 0:n.itemName;if(s===void 0)return t;s.charAt(0)==="/"&&(s=s.substring(1));const i=new URL(s,e);return new URL(t,i).href}focus(){requestAnimationFrame(()=>{this.notebook&&this.notebook.focus()})}createNotebook(t,e,n=""){const{glEventHub:s}=this.props,{session:i,sessionLanguage:o,settings:r}=this.state,l={...r,language:e,value:n},a={id:null,itemName:t};Be.debug("handleCreateNotebook",i,o,l,a),s.emit(Le.CREATE_NOTEBOOK,i,o,l,a)}runCommand(t){if(t===void 0){Be.debug("Ignoring empty command.");return}this.removePreviewStatus();const{glEventHub:e}=this.props;e.emit(bt.SEND_COMMAND,t,!1,!0)}removePreviewStatus(){this.setState(({isPreview:t})=>{if(t){const{fileMetadata:e}=this.state;return e&&this.registerFileMetadata(e,!1),{isPreview:!1}}return null})}getDropdownOverflowActions(){const{defaultNotebookSettings:t}=this.props,{settings:e}=this.state;return this.getOverflowActions(t.isMinimapEnabled,this.getSettings(e,t.isMinimapEnabled).wordWrap==="on")}render(){var V,O;const{fileStorage:t,glContainer:e,glContainer:{tab:n},glEventHub:s,defaultNotebookSettings:i}=this.props,{changeCount:o,savedChangeCount:r,error:l,isDashboardActive:a,isLoaded:d,isLoading:c,isPreview:u,fileMetadata:m,session:p,sessionLanguage:g,settings:f,showCloseModal:b,showSaveAsModal:C}=this.state,S=a&&!e.isHidden&&!u,v=(V=m==null?void 0:m.itemName)!=null?V:$i.DEFAULT_NAME,y=v.endsWith(".md"),E=(m==null?void 0:m.id)!=null,I=this.getSettings(f,i.isMinimapEnabled),R=p!=null,N=g===I.language,F=!d||!R||!N,P=!d,H=[{action:this.handleSave,shortcut:bs.SAVE},{action:this.handleMinimapChange,shortcut:Bt.NOTEBOOK.MINIMAP},{action:this.handleWordWrapChange,shortcut:Bt.NOTEBOOK.WORDWRAP}],x=fh.getDisabledRunTooltip(R,N,"Notebook extension","Run"),A=fh.getDisabledRunTooltip(R,N,"Notebook extension","Run Selected"),k=[{title:E?"Rename":"Save As\u2026",order:10,group:ae.groups.high,action:this.handleShowRename},{title:"Copy File",action:this.handleCopy,group:ae.groups.high,order:20}],G=n==null?void 0:n.element.find(".lm_title_before").get(0);return T(Te,{children:[G&&bi.createPortal(h("span",{className:z("editor-unsaved-indicator",{"is-unsaved":o!==r})}),G),T(ns,{className:"notebook-container",componentPanel:this,glContainer:e,glEventHub:s,onTab:this.handleTab,onResize:this.handleResize,onShow:this.handleShow,onTabFocus:this.handleTabFocus,onTabBlur:this.handleTabBlur,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,onFocus:this.handleFocus,onBlur:this.handleBlur,additionalActions:k,renderTabTooltip:()=>v,children:[!y&&T(Te,{children:[T("div",{className:"notebook-toolbar",children:[T("span",{children:[h(W,{kind:"ghost",className:"btn-play",onClick:this.handleRunAll,disabled:F,icon:h(ee,{icon:ul,transform:"grow-4"}),tooltip:`Run ${Bt.NOTEBOOK.RUN.getDisplayText()}`,"aria-label":"Run"}),x!=null&&h(Ye,{children:x})]}),T("span",{children:[h(W,{kind:"ghost",className:"btn-play",onClick:this.handleRunSelected,disabled:F,icon:h(ee,{icon:pb,transform:"grow-4"}),tooltip:`Run Selected ${Bt.NOTEBOOK.RUN_SELECTED.getDisplayText()}`,"aria-label":"Run Selected"}),A!=null&&h(Ye,{children:A})]}),h(W,{kind:"ghost",className:"mr-auto",disabled:P,onClick:this.handleSave,icon:Ou,tooltip:`Save ${bs.SAVE.getDisplayText()}`,"aria-label":"Save"}),h(W,{kind:"ghost",className:"btn-overflow btn-link-icon",disabled:P,icon:xu,tooltip:"More Actions...",onClick:()=>{},children:h(Fn,{actions:this.getDropdownOverflowActions,popperOptions:$i.POPPER_OPTIONS})})]}),h(vm,{isLoaded:d,isLoading:c,error:l,onChange:this.handleEditorChange,onRunCommand:this.handleRunCommand,session:p,sessionLanguage:g,onEditorInitialized:this.handleEditorInitialized,onEditorWillDestroy:this.handleEditorWillDestroy,settings:I,focusOnMount:S,ref:$=>{this.notebook=$}})]}),y&&h(gg,{content:(O=I.value)!=null?O:"",onLinkClick:this.handleLinkClick,onRunCode:this.handleRunCommand,transformImageUri:this.handleTransformLinkUri,transformLinkUri:this.handleTransformLinkUri}),h(aa,{isOpen:C,type:"file",defaultValue:v,title:E?"Rename":"Save file as",onSubmit:this.handleSaveAsSubmit,onCancel:this.handleSaveAsCancel,notifyOnExtensionChange:!0,storage:t}),h(ji,{isOpen:b,headerText:`Do you want to save the changes you made to ${v}?`,bodyText:"Your changes will be lost if you don't save them.",onCancel:this.handleCloseCancel,onDiscard:this.handleCloseDiscard,onConfirm:this.handleCloseSave,discardButtonText:"Discard Changes",confirmButtonText:"Save"}),h(ae,{actions:H})]})]})}};let ur=$i;ur.COMPONENT="NotebookPanel";ur.POPPER_OPTIONS={placement:"bottom-end"};ur.DEFAULT_NAME="Untitled";ur.defaultProps={isDashboardActive:!0,isPreview:!1,session:null,sessionLanguage:null,defaultNotebookSettings:null};const R2=(t,e)=>{const n=km(t),s=Rt(t),i=R0(t),o=wi(t,e.localDashboardId),{session:r,config:l}=o!=null?o:{},{type:a}=l!=null?l:{};return{fileStorage:n,settings:s,defaultNotebookSettings:i,session:r,sessionLanguage:a}},ti=It(R2,{saveSettings:Yl},null,{forwardRef:!0})(ur);class Ko extends w.exports.Component{constructor(e){super(e),this.irisGridRef=X.createRef(),this.buttonRef=X.createRef(),this.handleReload=this.handleReload.bind(this),this.handleGridStateChange=this.handleGridStateChange.bind(this),this.handlePanelStateUpdate=this.handlePanelStateUpdate.bind(this);const{panelState:n}=e;this.state={shouldFocusGrid:!1,panelState:n}}handleReload(){var e,n;(e=this.irisGridRef.current)==null||e.initModel(),(n=this.buttonRef.current)==null||n.blur(),this.setState({shouldFocusGrid:!0})}handleGridStateChange(){var n,s,i;const{shouldFocusGrid:e}=this.state;e&&((i=(s=(n=this.irisGridRef.current)==null?void 0:n.irisGrid)==null?void 0:s.current)==null?void 0:i.grid)&&(this.irisGridRef.current.irisGrid.current.grid.focus(),this.setState({shouldFocusGrid:!1}))}handlePanelStateUpdate(e){this.setState({panelState:e})}render(){const{...e}=this.props;return h(Ci,{ref:this.irisGridRef,onStateChange:this.handleGridStateChange,onPanelStateUpdate:this.handlePanelStateUpdate,...e,children:T(W,{ref:this.buttonRef,kind:"primary",className:"btn-pandas",onClick:this.handleReload,tooltip:"Click to refresh pandas dataframe, updates do not occur automatically.",children:["pandas dataframe",T("span",{children:[h(ee,{icon:Dd,transform:"shrink-1",className:"mr-1"}),"Reload"]})]})})}}Ko.defaultProps={panelState:null};Ko.COMPONENT="PandasPanel";function D2(t){qs(t);const{id:e,layout:n,registerComponent:s,hydrate:i}=t,o=w.exports.useCallback(({dragEvent:r,fetch:l,panelId:a=We.generate(),widget:d})=>{const{name:c,type:u}=d;if(u!==dh.VariableType.FIGURE)return;const m={name:c,figure:c},p=()=>l().then(b=>eo.makeModel(void 0,b)),g={type:"react-component",component:Xi.COMPONENT,props:{localDashboardId:e,id:a,metadata:m,makeModel:p},title:c,id:a},{root:f}=n;oe.openComponent({root:f,config:g,dragEvent:r})},[e,n]);return w.exports.useEffect(function(){const l=[s(Xi.COMPONENT,Xi,i)];return()=>{l.forEach(a=>a())}},[i,s]),qe(n.eventHub,De.OPEN,o),null}function M2(t){qs(t);const{id:e,layout:n}=t,s=w.exports.useCallback(({metadata:i,panelId:o=We.generate(),table:r})=>{const{settings:l}=i,a=()=>eo.makeModelFromSettings(l,r),d=xe.titleFromSettings(l),c={type:"react-component",component:Xi.COMPONENT,props:{localDashboardId:e,id:o,metadata:i,makeModel:a},title:d,id:o},{root:u}=n;oe.openComponent({root:u,config:c})},[e,n]);return qe(n.eventHub,Et.CREATE_CHART,s),null}const ht=Z.module("ConsolePlugin");function tu(t){return t.notebook!==void 0}function N2(t){qs(t)}function F2(t){N2(t);const{id:e,hydrateConsole:n,layout:s,panelManager:i,registerComponent:o,notebooksUrl:r}=t,l=w.exports.useRef(0),[a,d]=w.exports.useState(new Map),[c,u]=w.exports.useState(new Map),m=bd(),p=w.exports.useCallback(()=>i.getLastUsedPanelOfType(Wi),[i]),g=w.exports.useCallback((U,q)=>{d(j=>new Map(j.set(U,q)))},[d]),f=w.exports.useCallback(U=>{d(q=>(q.delete(U),new Map(q)))},[d]),b=w.exports.useCallback((U,q)=>{u(j=>new Map(j.set(U,q)))},[u]),C=w.exports.useCallback(U=>{u(q=>(q.delete(U),new Map(q)))},[u]),S=w.exports.useCallback((U,q=!0,j=!0)=>{if(!(U&&U.trim()))ht.info("Ignoring empty code");else{const ce=p();if(!ce||!(ce instanceof Wi.WrappedComponent)){ht.error("Console panel not found");return}ht.debug("Send command: ",U,q,j),ce.addCommand(U,q,j)}},[p]),v=w.exports.useCallback(U=>{m(z1(e,U))},[m,e]),y=w.exports.useCallback(({language:U})=>{const q=U==="python"?"py":U;let j=null;return q==null?(ht.debug("No extension for language",U),j=`Untitled-${l.current}`):j=`Untitled-${l.current}.${q}`,l.current+=1,j},[]),E=w.exports.useCallback((U,q=!0)=>{const{id:j}=U;return j!=null&&a.has(j)?a.get(j):j!=null&&c.has(j)?c.get(j):q?We.generate():null},[a,c]),I=w.exports.useCallback((U,q)=>{oe.renameComponent(s.root,{id:U},q)},[s.root]),R=w.exports.useCallback((U,q)=>{ht.debug("Rename file panel",U,q);let j;if(a.has(U)&&(j=a.get(U),f(U),j!=null&&g(q,j)),c.has(U)&&(j=c.get(U),C(U),j!=null&&b(q,j)),j===void 0){ht.debug2(`File ${U} isn't open, no need to rename the tab`);return}I(j,pe.getBaseName(q))},[a,c,I,g,b,f,C]),N=w.exports.useCallback(U=>{const q=E(U,!1);if(q==null){ht.error("Could not find panel id for file metadata",U);return}oe.activateTab(s.root,{id:q})},[E,s.root]),F=w.exports.useCallback((U,q,j)=>{if(ht.debug("registerFilePanel",U,q,j),q==null||q.id==null){ht.debug("Ignore empty file id",q);return}const{id:te}=q;if(j){b(te,U);return}if(a.has(te)){const ce=a.get(te);if(U===ce){ht.debug(`Update tab title for file ${te}`);const{itemName:ne}=q;R(te,ne)}else ht.error(`File ${te} already associated with a different tab ${ce}`);return}g(te,U),c.has(te)&&C(te)},[a,c,R,g,b,C]),P=w.exports.useCallback((U,q)=>{if(ht.debug("unregisterFileTab",U,q),U==null||U.id==null){ht.debug("Ignore empty file id",U);return}const{id:j}=U;if(q){C(j);return}f(j)},[f,C]),H=w.exports.useCallback((U,q)=>{ht.debug("closeFilePanel",U);const{id:j}=U;let te=null,ce=!1;if(a.has(j))te=a.get(j);else if(c.has(j))te=c.get(j),ce=!0;else{ht.debug(`File ${j} isn't open, ignore close event`);return}P(U,ce),oe.closeComponent(s.root,{id:te},q)},[s.root,a,c,P]),x=w.exports.useCallback(U=>{const{itemName:q}=U;return pe.getBaseName(q)},[]),A=w.exports.useCallback(U=>{const{id:q}=U;return ht.debug("fileIsOpen",U,q,a),q!=null&&a.has(q)},[a]),k=w.exports.useCallback(U=>{const{id:q}=U;return ht.debug("fileIsOpenAsPreview",U,q,c),q!=null&&c.has(q)},[c]),G=w.exports.useCallback(U=>{if(U==null)return;const q=i.getOpenedPanelById(U);q&&tu(q)&&q.focus()},[i]),V=w.exports.useCallback(({id:U,settings:q,fileMetadata:j,session:te,sessionLanguage:ce,isPreview:ne=!1})=>{const he={settings:q,fileMetadata:j},Ce=x(j);return{type:"react-component",component:ti.COMPONENT,isFocusOnShow:!1,props:{localDashboardId:e,metadata:{id:U},session:te,sessionLanguage:ce,panelState:he,isPreview:ne,notebooksUrl:r},title:Ce,id:U}},[x,e,r]),O=w.exports.useCallback((U,q,j,te={id:null,itemName:y(j)})=>{const ce=E(te);if(A(te)&&ce!=null){ht.debug("File is already open, focus panel"),N(te),G(ce);return}const ne=oe.getStackForComponentTypes(s.root,[ti.COMPONENT]),he=V({id:ce,settings:j,fileMetadata:te,session:U,sessionLanguage:q});ht.debug("createNotebook",he,a),oe.openComponentInStack(ne,he)},[A,G,y,E,s.root,V,a,N]),$=w.exports.useCallback((U,q,j,te,ce=!1)=>{ht.debug("selectNotebook",te,ce);const ne=A(te),he=k(te);if(ne){if(N(te),ce){const Ve=E(te);G(Ve)}return}if(he&&!ce){N(te);return}const[Ce]=Array.from(c.values());let Re=null,He=null;Ce!=null&&(Re=Ce,He=oe.getStackForConfig(s.root,{component:ti.COMPONENT,id:Re})),He==null&&(Re=E(te),He=oe.getStackForComponentTypes(s.root,[ti.COMPONENT]));const lt=V({id:Re,settings:j,fileMetadata:te,session:U,sessionLanguage:q,isPreview:!ce});oe.openComponentInStack(He,lt),ce&&G(Re)},[N,A,k,G,E,s.root,V,c]),Y=w.exports.useCallback((U,q,j={},te=!0)=>{const ce=i.getLastUsedPanelOfType(ti);ce&&tu(ce)?j!=null&&j.value!=null&&ce.notebook!=null&&ce.notebook.append(j.value):te&&O(U,q,j)},[O,i]),Q=w.exports.useCallback((U,q)=>td.hydrate({...U,notebooksUrl:r},q),[r]);return w.exports.useEffect(function(){const q=[o(Wi.COMPONENT,Wi,n),o(Il.COMPONENT,Il),o(Rl.COMPONENT,Rl),o(Ml.COMPONENT,Ml),o(ti.COMPONENT,ti,Q)];return()=>{q.forEach(j=>j())}},[o,n,Q]),qe(s.eventHub,bt.SEND_COMMAND,S),qe(s.eventHub,bt.SETTINGS_CHANGED,v),qe(s.eventHub,Le.CLOSE_FILE,H),qe(s.eventHub,Le.CREATE_NOTEBOOK,O),qe(s.eventHub,Le.SELECT_NOTEBOOK,$),qe(s.eventHub,Le.RENAME,I),qe(s.eventHub,Le.RENAME_FILE,R),qe(s.eventHub,Le.SEND_TO_NOTEBOOK,Y),qe(s.eventHub,Le.REGISTER_FILE,F),qe(s.eventHub,Le.UNREGISTER_FILE,P),null}const ko=Z.module("FilterPlugin");function nu(t,e){return t.concat(e)}function x2(t){qs(t);const{id:e,layout:n,registerComponent:s}=t,i=bd(),[o]=w.exports.useState(()=>new Map),[r]=w.exports.useState(()=>new Map),[l]=w.exports.useState(()=>new Map),a=w.exports.useCallback(()=>{const b=Array.from(o.values()).reduce(nu,[]).sort((v,y)=>{const E=nn.toLower(v.name),I=nn.toLower(y.name);if(E!==I)return E>I?1:-1;const R=nn.toLower(v.type),N=nn.toLower(y.type);return R!==N?R>N?1:-1:0}).reduce((v,y)=>((v.length===0||nn.toLower(v[v.length-1].name)!==nn.toLower(y.name)||nn.toLower(v[v.length-1].type)!==nn.toLower(y.type))&&v.push(y),v),[]),C=Array.from(r.values()).reduce(nu,[]).sort((v,y)=>v.timestamp-y.timestamp),S=new Map(l);ko.debug("sendUpdate",{columns:b,filters:C,tableMap:S}),i(ts(e,{columns:b,filters:C,tableMap:S}))},[i,e,o,r,l]),d=w.exports.useCallback((b,C)=>{ko.debug2("handleColumnsChanged",b,C),o.set(b,[].concat(C)),a()},[o,a]),c=w.exports.useCallback((b,C)=>{ko.debug2("handleFiltersChanged",b,C),r.set(b,[].concat(C)),a()},[r,a]),u=w.exports.useCallback((b,C)=>{ko.debug2("handleTableChanged",b,C),l.set(oe.getIdFromPanel(b),C),a()},[l,a]),m=w.exports.useCallback(b=>{ko.debug2("handlePanelUnmount",b),o.delete(b),r.delete(b),l.delete(oe.getIdFromPanel(b)),a()},[o,r,l,a]),p=w.exports.useCallback(({title:b="DropdownFilter",metadata:C={},panelState:S=null,id:v=We.generate(),focusElement:y=oe.DEFAULT_FOCUS_SELECTOR,createNewStack:E=!1,dragEvent:I=null})=>{const R={type:"react-component",component:fi.COMPONENT,props:{id:v,metadata:C,panelState:S,localDashboardId:e},title:b,id:v},{root:N}=n;oe.openComponent({root:N,config:R,focusElement:y,createNewStack:E,dragEvent:I})},[n,e]),g=w.exports.useCallback(({title:b="InputFilter",metadata:C={},panelState:S=null,id:v=We.generate(),focusElement:y=oe.DEFAULT_FOCUS_SELECTOR,createNewStack:E=!1,dragEvent:I=null})=>{const R={type:"react-component",component:Go.COMPONENT,props:{id:v,metadata:C,panelState:S,localDashboardId:e},title:b,id:v},{root:N}=n;oe.openComponent({root:N,config:R,focusElement:y,createNewStack:E,dragEvent:I})},[n,e]),f=w.exports.useCallback(({title:b="FilterSets",metadata:C={},panelState:S=null,id:v=We.generate(),focusElement:y=oe.DEFAULT_FOCUS_SELECTOR,createNewStack:E=!1,dragEvent:I=null})=>{const R={type:"react-component",component:La.COMPONENT,props:{id:v,metadata:C,panelState:S,localDashboardId:e},title:b,id:v},{root:N}=n;oe.openComponent({root:N,config:R,focusElement:y,createNewStack:E,dragEvent:I})},[n,e]);return w.exports.useEffect(function(){const C=[s(fi.COMPONENT,fi),s(Go.COMPONENT,Go),s(La.COMPONENT,La)];return()=>{C.forEach(S=>S())}},[s]),qe(n.eventHub,Pe.COLUMNS_CHANGED,d),qe(n.eventHub,Pe.FILTERS_CHANGED,c),qe(n.eventHub,Pe.TABLE_CHANGED,u),qe(n.eventHub,Pe.OPEN_DROPDOWN,p),qe(n.eventHub,Pe.OPEN_INPUT,g),qe(n.eventHub,Pe.OPEN_FILTER_SET_MANAGER,f),qe(n.eventHub,De.UNMOUNT,m),null}const _2=[dh.VariableType.TABLE,dh.VariableType.TREETABLE,dh.VariableType.HIERARCHICALTABLE];function k2(t){qs(t);const{getDownloadWorker:e,loadPlugin:n,id:s,layout:i,registerComponent:o,hydrate:r,theme:l}=t,a=w.exports.useCallback(({dragEvent:d,fetch:c,panelId:u=We.generate(),widget:m})=>{const{name:p,type:g}=m;if(!_2.includes(g))return;const f={name:p,table:p,type:m.type},b=()=>c().then(v=>dc.makeModel(v)),C={type:"react-component",component:Ci.COMPONENT,props:{getDownloadWorker:e,loadPlugin:n,localDashboardId:s,id:u,metadata:f,makeModel:b,theme:l},title:p,id:u},{root:S}=i;oe.openComponent({root:S,config:C,dragEvent:d})},[e,s,i,n,l]);return w.exports.useEffect(function(){const c=[o(Ci.COMPONENT,Ci,r)];return()=>{c.forEach(u=>u())}},[r,o]),qe(i.eventHub,De.OPEN,a),null}function fg(t){return typeof t.getCoordinateForColumn=="function"}function su(t){const e=t;return fg(t)&&typeof e.setFilterMap=="function"&&typeof e.unsetFilterValue=="function"}function iu(t){var e;return t.description===void 0||!((e=t.description)!=null&&e.startsWith("Preview of type: "))}const Oo=Z.module("LinkerUtils"),Cg=class{static getLinkType(t,e,n){var l;if((t==null?void 0:t.panelId)==null||(e==null?void 0:e.panelId)==null||t.panelId===e.panelId||n!=null&&n!==t.panelId&&n!==e.panelId)return Oo.debug2("Incompatible panel ids",t,e,n),"invalid";if(t.panelComponent==null||e.panelComponent==null)return Oo.error("PanelComponent should not be null",t,e),"invalid";const s=(l=Cg.ALLOWED_LINKS.get(t.panelComponent))==null?void 0:l.includes(e.panelComponent);if(s===void 0||!s)return Oo.debug2("Incompatible panel components",t,e),"invalid";const{columnType:i}=t,{columnType:o}=e;if(!(o===null||_.isCompatibleType(i,o)))return Oo.debug2("Incompatible type",i,o),"invalid";switch(e.panelComponent){case oe.getComponentName(Xi):case oe.getComponentName(Ci):return"tableLink";case oe.getComponentName(fi):return"filterSource"}return Oo.debug2("Incompatible target panel component",e.panelComponent),"invalid"}static findColumn(t,{columnName:e,columnType:n}){return t.find(({name:s,type:i})=>s===e&&i===n)}static cloneLinksForPanel(t,e,n){const s=[];return t.forEach(i=>{var o;i.start.panelId===e&&i.type!=="filterSource"?s.push({...i,id:We.generate(),start:{...i.start,panelId:n}}):((o=i.end)==null?void 0:o.panelId)===e&&s.push({...i,id:We.generate(),end:{...i.end,panelId:n}})}),s}};let ci=Cg;ci.ALLOWED_LINKS=new Map([[oe.getComponentName(Ci),[oe.getComponentName(Ci),oe.getComponentName(Xi),oe.getComponentName(fi)]]]);const O2=Z.module("LinkerLink"),ou=.015,ru=1.5,bg=12,Sg=12,lu=2,jr=Math.sqrt((Sg*.5)**2+bg**2),au=Math.asin(Sg*.5/bg),du=15,As=Math.PI*.5,ll=class extends w.exports.Component{constructor(t){super(t),this.getOperators=Se((e,n)=>{const{onOperatorChanged:s}=this.props;let i=_.getFilterTypes(n);return _.isBooleanType(n)&&(i=[K.eq,K.notEq]),i.flatMap((o,r)=>{if(o==="eqIgnoreCase"||o==="notEqIgnoreCase")return[];let l="";return o==="startsWith"?l="a*":o==="endsWith"?l="*z":l=_.getFilterOperatorString(o),[{title:ll.getLabelForLinkFilter(n,o),icon:h("b",{children:l}),action:()=>s(e,o),order:r}]})}),this.handleClick=this.handleClick.bind(this),this.handleMouseEnter=this.handleMouseEnter.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.handleDelete=this.handleDelete.bind(this),this.getDropdownActions=this.getDropdownActions.bind(this),this.state={isHovering:void 0}}static makeCirclePath(t,e,n){return`M ${t} ${e} m -${n},0 a ${n},${n} 0 1,0 ${n*2},0 a ${n},${n} 0 1,0 -${n*2},0 z`}static getLabelForLinkFilter(t,e){try{if(_.isNumberType(t)||_.isCharType(t))return Rm(e);if(_.isTextType(t))return Im(e);if(_.isDateType(t))return Dm(e);if(_.isBooleanType(t)){if(e===K.eq)return"is equal to";if(e===K.notEq)return"is not equal to"}throw new Error(`Unrecognized column type: ${t}`)}catch(n){return O2.warn(n),""}}handleClick(t){t.stopPropagation(),t.preventDefault();const{id:e,onClick:n,onDelete:s}=this.props;t.altKey?s(e):n(e)}handleMouseEnter(){this.setState({isHovering:!0})}handleMouseLeave(){this.setState({isHovering:!1})}handleDelete(){const{id:t,onDelete:e}=this.props;e(t)}getDropdownActions(){const{id:t,startColumnType:e}=this.props;return e!=null?this.getOperators(t,e):[]}render(){const{className:t,operator:e,isSelected:n,x1:s,y1:i,x2:o,y2:r,id:l,startColumnType:a}=this.props,{isHovering:d}=this.state,c=Math.sqrt((s-o)**2+(i-r)**2),u=Math.atan2(r-i,o-s),m=Math.sin(u),p=Math.cos(u)+2,g=window.innerWidth,f=window.innerHeight,b=0,C=0,S=Math.max(b,Math.min(s+(o-s)/2+m*(c*ou)**ru,g)),v=Math.max(C,Math.min(i+(r-i)/2+p*(c*ou)**ru,f)),y=`M ${s} ${i} Q ${S} ${v} ${o} ${r}`,E=`M ${b} ${C} L ${b} ${f} L ${g} ${f} L ${g} ${C} z
39
+ ${ll.makeCirclePath(s,i,du)}
40
+ ${ll.makeCirclePath(o,r,du)}`,I=`link-select-clip-${l}`,R=Math.atan2(r-v,o-S),N=R-au+Math.PI,F=R+au+Math.PI,P=o+Math.cos(R)*lu,H=r+Math.sin(R)*lu,x=P+Math.cos(N)*jr,A=H+Math.sin(N)*jr,k=P+Math.cos(F)*jr,G=H+Math.sin(F)*jr,V=`${P},${H} ${x},${A} ${k},${G}`,O=.25*s+.5*S+.25*o,$=.25*i+.5*v+.25*r,Y=S-s+(o-S),U=(v-i+(r-v))/Y;let j=20/Math.sqrt(1+U**2),te=j*U,ce=j*-1,ne=te*-1;Number.isFinite(U)?U>0?(j*=-1,te*=-1,ce*=-1,ne*=-1,ce-=50-10*(Math.abs(u)%As),ne+=10*(Math.abs(u)%As),j-=50-10*(Math.abs(u)%As),te+=10*(Math.abs(u)%As)):U<0?(ce+=10*(Math.abs(u)%As),ne+=10*(Math.abs(u)%As),j+=10*(Math.abs(u)%As),te+=10*(Math.abs(u)%As)):(ce=15,ne=10,j=-25,te=10):(ce=10,ne=5,j=10,te=-35);let he="";return e!==void 0&&(e==="startsWith"?he="a*":e==="endsWith"?he="*z":he=_.getFilterOperatorString(e)),T(Te,{children:[T("svg",{className:z(t,{hovering:d}),children:[h("clipPath",{id:I,children:h("path",{d:E,clipRule:"evenodd"})}),h("path",{className:"link-select",d:y,onClick:this.handleClick,onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave,clipPath:`url(#${I})`}),h("path",{className:"link-background",d:y}),h("path",{className:"link-foreground",d:y}),h("circle",{className:"link-dot",cx:s,cy:i,r:"5"}),h("polygon",{className:"link-triangle",points:V})]}),a!=null&&n&&T(Te,{children:[h(W,{kind:"primary",className:"btn-fab btn-operator",style:{top:$+(U>=0?te:ne),left:O+(U>=0?j:ce)},onClick:()=>{},icon:T("div",{className:"fa-md fa-layers",children:[h("b",{children:he}),h(ee,{icon:Yn,transform:"right-8 down-9 shrink-5"})]}),tooltip:"Change comparison operator",children:h(Fn,{actions:this.getDropdownActions,popperOptions:{placement:"bottom-start"}})}),h(W,{kind:"primary",className:"btn-fab btn-delete",style:{top:$+(U<0?te:ne),left:O+(U<0?j:ce)},onClick:this.handleDelete,icon:hn,tooltip:"Delete"})]})]})}};let wg=ll;wg.defaultProps={className:"",isSelected:!1,onClick(){},onDelete(){}};const Aa=Z.module("LinkerOverlayContent");class vg extends w.exports.Component{constructor(e){super(e),this.handleBlur=this.handleBlur.bind(this),this.handleResize=this.handleResize.bind(this),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleMouseDown=this.handleMouseDown.bind(this),this.handleMouseUp=this.handleMouseUp.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleKeyUp=this.handleKeyUp.bind(this),this.handleEscapePressed=this.handleEscapePressed.bind(this),this.handleOperatorChanged=this.handleOperatorChanged.bind(this),this.dialogRef=X.createRef(),this.state={mouse:void 0,dialog:void 0,offset:{x:0,y:0},isDragging:!1,mode:"select"}}componentDidMount(){window.addEventListener("blur",this.handleBlur,!0),window.addEventListener("mousemove",this.handleMouseMove,!0),window.addEventListener("mouseup",this.handleMouseUp,!0),window.addEventListener("keydown",this.handleKeyDown,!0),window.addEventListener("keyup",this.handleKeyUp,!0),window.addEventListener("resize",this.handleResize,!0)}componentDidCatch(e,n){Aa.error("componentDidCatch",e,n)}componentWillUnmount(){window.removeEventListener("blur",this.handleBlur,!0),window.removeEventListener("mousemove",this.handleMouseMove,!0),window.removeEventListener("mouseup",this.handleMouseUp,!0),window.removeEventListener("keydown",this.handleKeyDown,!0),window.removeEventListener("keyup",this.handleKeyUp,!0),window.removeEventListener("resize",this.handleResize,!0)}getPointFromLinkPoint(e){const{panelManager:n}=this.props,{panelId:s,columnName:i}=e,o=n.getOpenedPanelById(s);if(o!=null){if(!fg(o))throw new Error(`Panel does not have getCoordinateForColumn method: ${s}`);try{const l=o.getCoordinateForColumn(i);if(l!=null)return l}catch{Aa.error("Could not get coordinate for column",i,o)}}const r=n.getContainerByPanelId(s);if(r==null)throw new Error(`Unable to find panel container for id: ${s}`);return oe.getTabPoint(r)}handleOperatorChanged(e,n){const{links:s,onLinksUpdated:i}=this.props,o=s.map(r=>r.id===e?{...r,operator:n}:r);i(o)}handleBlur(){this.setState({mode:"select"})}handleResize(){const{dialog:e}=this.state;if(e&&this.dialogRef.current){const n=this.dialogRef.current.getBoundingClientRect(),s=Je(e.x,0,window.innerWidth-n.width),i=Je(e.y,0,window.innerHeight-n.height);this.setState({dialog:{x:s,y:i}})}}handleMouseMove(e){const{offset:n,isDragging:s}=this.state;if(this.setState({mouse:{x:e.clientX,y:e.clientY}}),s&&this.dialogRef.current){const i=this.dialogRef.current.getBoundingClientRect(),o=Je(window.innerWidth-(e.clientX+i.width+n.x),0,window.innerWidth-i.width),r=Je(window.innerHeight-(e.clientY+i.height+n.y),0,window.innerHeight-i.height);this.setState({dialog:{x:o,y:r}})}}handleMouseDown(e){const n={x:0,y:0};if(this.dialogRef.current){const s=this.dialogRef.current.getBoundingClientRect();n.x=s.right-(s.width+e.clientX),n.y=s.bottom-(s.height+e.clientY)}this.setState({isDragging:!0,offset:n})}handleMouseUp(){this.setState({isDragging:!1})}handleKeyDown(e){if(e.key==="Alt")e.preventDefault(),this.setState({mode:"delete"});else if(e.key==="Delete"||e.key==="Backspace"){const{selectedIds:n,onLinkDeleted:s}=this.props;e.preventDefault(),n.forEach(i=>s(i))}}handleKeyUp(e){e.key==="Alt"&&(e.preventDefault(),this.setState({mode:"select"}))}handleEscapePressed(){const{onCancel:e}=this.props;e()}render(){const{disabled:e,links:n,selectedIds:s,messageText:i,onLinkSelected:o,onLinkDeleted:r,onAllLinksDeleted:l,onDone:a}=this.props,{mouse:d,dialog:c,isDragging:u,mode:m}=this.state,p=n.map(g=>{var f,b;try{const{id:C,type:S,isReversed:v,start:y,end:E,operator:I}=g,R=y.columnType;let[N,F]=this.getPointFromLinkPoint(y),P=(f=d==null?void 0:d.x)!=null?f:N,H=(b=d==null?void 0:d.y)!=null?b:F;if(E!=null&&([P,H]=this.getPointFromLinkPoint(E)),v!=null&&v){const[A,k]=[N,F];[N,F]=[P,H],[P,H]=[A,k]}const x=z("linker-link",{disabled:e},{"link-filter-source":S==="filterSource"},{"link-invalid":S==="invalid"},{interactive:g.end==null},{"link-is-selected":s.has(C)},{"danger-delete":m==="delete"});return{x1:N,y1:F,x2:P,y2:H,id:C,className:x,operator:I,startColumnType:R}}catch(C){return Aa.warn("Unable to get point for link",g,C),null}}).filter(g=>g!=null);return T("div",{className:z("linker-overlay",{"danger-delete":m==="delete"}),children:[p.map(({x1:g,y1:f,x2:b,y2:C,id:S,className:v,operator:y,startColumnType:E})=>h(wg,{className:v,id:S,x1:g,y1:f,x2:b,y2:C,onClick:o,onDelete:r,isSelected:s.has(S),operator:y,startColumnType:E,onOperatorChanged:this.handleOperatorChanged},S)),T("div",{className:z("linker-toast-dialog",{dragging:u}),ref:this.dialogRef,style:{bottom:c==null?void 0:c.y,right:c==null?void 0:c.x},children:[h(W,{draggable:!0,kind:"inline",className:"btn-drag-handle",icon:ir,onClick:()=>{},onMouseDown:this.handleMouseDown,children:!u&&h(Ye,{children:"Drag to reposition"})}),h("div",{className:"toast-body",children:i}),T("div",{className:"toast-footer",children:[h(W,{kind:"secondary",onClick:l,children:"Clear All"}),h(W,{kind:"primary",onClick:a,children:"Done"})]})]}),h(ae,{actions:[{action:this.handleEscapePressed,shortcut:bs.LINKER_CLOSE,isGlobal:!0}]})]})}}vg.defaultProps={disabled:"false"};const xt=Z.module("Linker"),L2=(t,e)=>({activeTool:ql(t),isolatedLinkerPanelId:mc(t,e.localDashboardId),links:fo(t,e.localDashboardId),timeZone:or(t)}),A2=It(L2,{setActiveTool:Xl,setDashboardLinks:gc,addDashboardLinks:U1,deleteDashboardLinks:B1,setDashboardIsolatedLinkerPanelId:lg,setDashboardColumnSelectionValidator:$1});class P2 extends w.exports.Component{constructor(e){super(e),this.getCachedLinks=Se((n,s,i)=>{const o=[...n];return s!=null&&s.start!=null&&o.push(s),i!==void 0?o.filter(r=>{var l,a;return((l=r==null?void 0:r.start)==null?void 0:l.panelId)===i||((a=r==null?void 0:r.end)==null?void 0:a.panelId)===i||(r==null?void 0:r.end)==null}):o}),this.handleCancel=this.handleCancel.bind(this),this.handleDone=this.handleDone.bind(this),this.handlePanelCloned=this.handlePanelCloned.bind(this),this.handleFilterColumnSelect=this.handleFilterColumnSelect.bind(this),this.handleColumnsChanged=this.handleColumnsChanged.bind(this),this.handlePanelClosed=this.handlePanelClosed.bind(this),this.handleLayoutStateChanged=this.handleLayoutStateChanged.bind(this),this.handleAllLinksDeleted=this.handleAllLinksDeleted.bind(this),this.handleLinkDeleted=this.handleLinkDeleted.bind(this),this.handleLinksUpdated=this.handleLinksUpdated.bind(this),this.handleChartColumnSelect=this.handleChartColumnSelect.bind(this),this.handleGridColumnSelect=this.handleGridColumnSelect.bind(this),this.handleUpdateValues=this.handleUpdateValues.bind(this),this.handleStateChange=this.handleStateChange.bind(this),this.handleExited=this.handleExited.bind(this),this.handleLinkSelected=this.handleLinkSelected.bind(this),this.handlePanelDragging=this.handlePanelDragging.bind(this),this.handlePanelDropped=this.handlePanelDropped.bind(this),this.isColumnSelectionValid=this.isColumnSelectionValid.bind(this),this.state={linkInProgress:void 0,selectedIds:new Set,isDraggingPanel:!1}}componentDidMount(){const{layout:e}=this.props;this.startListening(e),this.updateSelectionValidators()}componentDidUpdate(e){const{activeTool:n,layout:s}=this.props;s!==e.layout&&(this.stopListening(e.layout),this.startListening(s)),n!==e.activeTool&&(this.updateSelectionValidators(),n===Yt.DEFAULT&&this.reset())}componentDidCatch(e,n){xt.error("componentDidCatch",e,n)}componentWillUnmount(){const{layout:e}=this.props;this.stopListening(e)}startListening(e){e.on("stateChanged",this.handleLayoutStateChanged);const{eventHub:n}=e;n.on(Et.COLUMN_SELECTED,this.handleGridColumnSelect),n.on(Et.DATA_SELECTED,this.handleUpdateValues),n.on(Et.STATE_CHANGED,this.handleStateChange),n.on(no.COLUMN_SELECTED,this.handleChartColumnSelect),n.on(De.CLONED,this.handlePanelCloned),n.on(Pe.COLUMN_SELECTED,this.handleFilterColumnSelect),n.on(Pe.COLUMNS_CHANGED,this.handleColumnsChanged),n.on(De.CLOSE,this.handlePanelClosed),n.on(De.CLOSED,this.handlePanelClosed),n.on(De.DRAGGING,this.handlePanelDragging),n.on(De.DROPPED,this.handlePanelDropped)}stopListening(e){e.off("stateChanged",this.handleLayoutStateChanged);const{eventHub:n}=e;n.off(Et.COLUMN_SELECTED,this.handleGridColumnSelect),n.off(Et.DATA_SELECTED,this.handleUpdateValues),n.off(Et.STATE_CHANGED,this.handleStateChange),n.off(no.COLUMN_SELECTED,this.handleChartColumnSelect),n.off(De.CLONED,this.handlePanelCloned),n.off(Pe.COLUMN_SELECTED,this.handleFilterColumnSelect),n.off(Pe.COLUMNS_CHANGED,this.handleColumnsChanged),n.off(De.CLOSE,this.handlePanelClosed),n.off(De.CLOSED,this.handlePanelClosed),n.off(De.DRAGGING,this.handlePanelDragging),n.off(De.DROPPED,this.handlePanelDropped)}reset(){this.setState({linkInProgress:void 0,selectedIds:new Set})}handleCancel(){const{linkInProgress:e}=this.state;if(e==null){const{setActiveTool:n}=this.props;n(Yt.DEFAULT)}this.setState({linkInProgress:void 0})}handleDone(){const{setActiveTool:e}=this.props;e(Yt.DEFAULT)}handleChartColumnSelect(e,n){this.columnSelected(e,n,!0)}handleFilterColumnSelect(e,n){xt.debug("handleFilterColumnSelect",this.isOverlayShown());const{links:s,localDashboardId:i,setActiveTool:o,setDashboardIsolatedLinkerPanelId:r}=this.props,l=oe.getIdFromPanel(e),a=s.filter(d=>{var c,u;return((c=d.start)==null?void 0:c.panelId)===l||((u=d.end)==null?void 0:u.panelId)===l});if(!this.isOverlayShown()&&l!=null){o(Yt.LINKER),r(i,l),a.length===0&&this.columnSelected(e,n,!0,l);return}this.columnSelected(e,n,!0)}handleColumnsChanged(e,n){xt.debug("handleColumnsChanged",e,n);const{links:s}=this.props,i=oe.getIdFromPanel(e);if(i==null){xt.error("Invalid panelId",e);return}const o=s.filter(({start:r,end:l})=>r.panelId===i&&ci.findColumn(n,r)==null||l!=null&&l.panelId===i&&ci.findColumn(n,l)==null);this.deleteLinks(o)}handleGridColumnSelect(e,n){if(!iu(n)){xt.debug2("Column is not filterable");return}this.columnSelected(e,n)}columnSelected(e,n,s=!1,i){if(i===void 0&&!this.isOverlayShown())return;const{isolatedLinkerPanelId:o}=this.props,{linkInProgress:r}=this.state,l=oe.getIdFromPanel(e);if(l==null)return;const a=oe.getComponentNameFromPanel(e),{name:d,type:c}=n;if(r==null||r.start==null){const u={id:We.generate(),start:{panelId:l,panelComponent:a,columnName:d,columnType:c},type:"invalid",isReversed:s};xt.debug("starting link",u),this.setState({linkInProgress:u})}else{const{links:u}=this.props,{start:m,id:p,isReversed:g}=r,f={panelId:l,panelComponent:a,columnName:d,columnType:c},b=ci.getLinkType(g!==void 0&&g?f:m,g!==void 0&&g?m:f,i!=null?i:o);switch(b){case"invalid":xt.debug("Ignore invalid link connection",r,f);return;case"filterSource":{const S=g!==void 0&&g?m.panelId:f.panelId,v=u.filter(({end:y})=>(y==null?void 0:y.panelId)===S);this.deleteLinks(v);break}}const C={start:g!==void 0&&g?f:m,end:g!==void 0&&g?m:f,id:p,type:b,operator:K.eq};xt.info("creating link",C),this.setState({linkInProgress:void 0,selectedIds:new Set([p])},()=>{this.addLinks([C])})}}unsetFilterValueForLink(e){const{panelManager:n}=this.props;if(e.end){const{end:s}=e,{panelId:i,columnName:o,columnType:r}=s,l=n.getOpenedPanelById(i);l?su(l)?l.unsetFilterValue(o,r):xt.debug("endPanel.unsetFilterValue not implemented",l):xt.debug("endPanel no longer exists, ignoring unsetFilterValue",i)}}setPanelFilterMap(e,n){xt.debug("Set filter data for panel:",e,n);const{panelManager:s}=this.props,i=s.getOpenedPanelById(e);i?su(i)?i.setFilterMap(n):xt.debug("panel.setFilterMap not implemented",e,i):xt.debug("panel no longer exists, ignoring setFilterMap",e)}addLinks(e){const{addDashboardLinks:n,localDashboardId:s}=this.props;n(s,e)}deleteLinks(e,n=!1){const{localDashboardId:s}=this.props;if(e.forEach(i=>this.unsetFilterValueForLink(i)),n){const{setDashboardLinks:i}=this.props;i(s,[])}else if(e.length>0){const{deleteDashboardLinks:i}=this.props;i(s,e.map(({id:o})=>o))}}handleAllLinksDeleted(){const{links:e,isolatedLinkerPanelId:n}=this.props;if(n===void 0)this.deleteLinks(e,!0);else{const s=e.filter(i=>{var o,r;return((o=i==null?void 0:i.start)==null?void 0:o.panelId)===n||((r=i==null?void 0:i.end)==null?void 0:r.panelId)===n});this.deleteLinks(s)}this.reset()}handleLinkDeleted(e){const{links:n}=this.props,s=n.find(i=>i.id===e);s?this.deleteLinks([s]):xt.error("Unable to find link to delete",e)}handleUpdateValues(e,n){const s=oe.getIdFromPanel(e),{links:i,timeZone:o}=this.props,r=new Map;for(let l=0;l<i.length;l+=1){const{start:a,end:d,operator:c}=i[l];if(a.panelId===s&&d!=null){const{panelId:u,columnName:m,columnType:p}=d,g=r.has(u)?r.get(u):new Map,f=g.has(m)===!0?g.get(m).filterList:[],{visibleIndex:b,isExpandable:C,isGrouped:S}=n[a.columnName];let{value:v}=n[a.columnName],y=`${v}`;v===null&&C&&S&&(v=void 0),p!=null&&_.isDateType(p)&&(y=new st({timeZone:o,showTimeZone:!1,showTSeparator:!0,defaultDateTimeFormatString:Jn.FULL_DATE_FORMAT}).format(v));const E={operator:c,text:y,value:v,startColumnIndex:b};f.push(E),g.set(m,{columnType:p,filterList:f}),r.set(u,g)}}r.forEach((l,a)=>{this.setPanelFilterMap(a,l)})}handlePanelCloned(e,n){const{links:s}=this.props,i=oe.getIdFromPanel(e),o=n.id;if(i!=null){const r=ci.cloneLinksForPanel(s,i,o);this.addLinks(r)}}handlePanelDragging(e){const{links:n}=this.props;for(let s=0;s<n.length;s+=1){const i=n[s],{start:o,end:r}=i;if(o.panelId===e||(r==null?void 0:r.panelId)===e){this.setState({isDraggingPanel:!0});return}}}handlePanelDropped(){this.setState({isDraggingPanel:!1})}handlePanelClosed(e){xt.debug(`Panel ${e} closed, deleting links.`),this.deleteLinksForPanelId(e)}handleLinkSelected(e){this.setState({selectedIds:new Set([e])})}handleLinksUpdated(e){const{localDashboardId:n,setDashboardLinks:s}=this.props;s(n,e)}handleLayoutStateChanged(){this.forceUpdate()}handleStateChange(){this.forceUpdate()}handleExited(){const{localDashboardId:e,setDashboardIsolatedLinkerPanelId:n}=this.props;n(e,void 0)}deleteLinksForPanelId(e){const{links:n}=this.props;for(let s=0;s<n.length;s+=1){const i=n[s],{start:o,end:r,id:l}=i;(o.panelId===e||(r==null?void 0:r.panelId)===e)&&this.handleLinkDeleted(l)}}isOverlayShown(){const{activeTool:e}=this.props;return e===Yt.LINKER}updateSelectionValidators(){const{activeTool:e,setDashboardColumnSelectionValidator:n,localDashboardId:s}=this.props;switch(e){case Yt.LINKER:n(s,this.isColumnSelectionValid);break;default:n(s,void 0);break}}updateLinkInProgressType(e,n="invalid"){this.setState({linkInProgress:{...e,type:n}})}isColumnSelectionValid(e,n){const{linkInProgress:s}=this.state,{isolatedLinkerPanelId:i}=this.props;if(n==null)return(s==null?void 0:s.start)!=null&&this.updateLinkInProgressType(s),!1;if(!iu(n))return xt.debug2("Column is not filterable",n.description),(s==null?void 0:s.start)!=null&&this.updateLinkInProgressType(s,"invalid"),!1;if((s==null?void 0:s.start)==null)return!0;const{isReversed:o,start:r}=s,l=oe.getIdFromPanel(e);if(l==null)return!1;const a={panelId:l,panelComponent:oe.getComponentNameFromPanel(e),columnName:n.name,columnType:n.type},d=o!==void 0&&o?ci.getLinkType(a,r,i):ci.getLinkType(r,a,i);return this.updateLinkInProgressType(s,d),d!=="invalid"}render(){const{links:e,isolatedLinkerPanelId:n,panelManager:s}=this.props,{linkInProgress:i,selectedIds:o,isDraggingPanel:r}=this.state,l=this.isOverlayShown(),a=i!=null&&i.start!=null,d=n===void 0?"Click a column source, then click a column target to create a filter link. The filter comparison operator used by a selected link can be changed. Delete a filter link by clicking the delete button or with alt+click. Click done when finished.":"Create a link between the source column button and a table column by clicking on one, then the other. Delete a filter link by clicking the delete button or with alt+click. Click done when finished.";return r?null:h(mt,{in:l,timeout:ze.transitionMs,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,onExited:this.handleExited,children:h(vg,{disabled:a,panelManager:s,links:this.getCachedLinks(e,i,n),selectedIds:o,messageText:d,onLinkSelected:this.handleLinkSelected,onLinkDeleted:this.handleLinkDeleted,onAllLinksDeleted:this.handleAllLinksDeleted,onLinksUpdated:this.handleLinksUpdated,onDone:this.handleDone,onCancel:this.handleCancel})})}}const H2=A2(P2);function V2(t){qs(t);const{id:e,layout:n,panelManager:s}=t;return h(H2,{layout:n,localDashboardId:e,panelManager:s})}const cd=class{static getNewMarkdownTitle(t){let e=`${cd.DEFAULT_TITLE}`,n=0;for(;t.indexOf(e)>=0;)n+=1,e=`${cd.DEFAULT_TITLE}-${n}`;return e}};let qo=cd;qo.DEFAULT_TITLE="Note";qo.DEFAULT_CONTENT=`# Markdown Note
41
+
42
+ This note can be edited using **markdown** for styling.`;function U2(t){qs(t);const{id:e,layout:n,panelManager:s,registerComponent:i}=t,o=w.exports.useCallback(l=>{const{title:a,componentState:d,props:c}=l;let{panelState:u=null}=c;return d!=null&&({panelState:u=null}=d),a==null||u==null||u.content==null||u.content.length===0||u.content===qo.DEFAULT_CONTENT?null:Yd(l)},[]),r=w.exports.useCallback(({title:l="",metadata:a={},id:d=We.generate(),focusElement:c=oe.DEFAULT_FOCUS_SELECTOR,createNewStack:u=!1,dragEvent:m=null}={})=>{const p=s.getOpenedPanelConfigsOfType(_o.COMPONENT),g=s.getClosedPanelConfigsOfType(_o.COMPONENT),f=p.map(y=>{var E;return(E=y.title)!=null?E:""}),b=l!=null&&l!==""?l:qo.getNewMarkdownTitle(f),C=g.length>0?null:qo.DEFAULT_CONTENT,S={type:"react-component",component:_o.COMPONENT,props:{id:d,metadata:a,panelState:{content:C},localDashboardId:e},title:b,id:d},{root:v}=n;oe.openComponent({root:v,config:S,focusElement:c,createNewStack:u,dragEvent:m})},[e,n,s]);return w.exports.useEffect(function(){const a=[i(_o.COMPONENT,_o,Xd,o)];return()=>{a.forEach(d=>d())}},[o,i]),qe(n.eventHub,sg.OPEN,r),null}function B2(t){qs(t);const{hydrate:e,id:n,layout:s,registerComponent:i}=t,o=w.exports.useCallback(({dragEvent:r,fetch:l,panelId:a=We.generate(),widget:d})=>{const{name:c,type:u}=d;if(u!==dh.VariableType.PANDAS)return;const m={name:c,table:c},p=()=>l().then(b=>dc.makeModel(b)),g={type:"react-component",component:Ko.COMPONENT,props:{localDashboardId:n,id:a,metadata:m,makeModel:p},title:c,id:a},{root:f}=s;oe.openComponent({root:f,config:g,dragEvent:r})},[n,s]);return w.exports.useEffect(function(){const l=[i(Ko.COMPONENT,Ko,e)];return()=>{l.forEach(a=>a())}},[e,i]),qe(s.eventHub,De.OPEN,o),null}class wn{}wn.DROPDOWN_FILTER="ControlType.DROPDOWN_FILTER";wn.INPUT_FILTER="ControlType.INPUT_FILTER";wn.MARKDOWN="ControlType.MARKDOWN";wn.FILTER_SET_MANAGER="ControlType.FILTER_SET_MANAGER";const $2=D.exports.shape({state:D.exports.shape({panelState:D.exports.shape({})})}),z2=D.exports.shape({panelId:D.exports.string.isRequired,columnName:D.exports.string.isRequired,columnType:D.exports.string.isRequired}),cu=D.exports.shape({panelId:D.exports.string.isRequired,columnName:D.exports.string.isRequired}),Tg=D.exports.shape({start:cu,end:cu,id:D.exports.string,isReversed:D.exports.bool}),W2=D.exports.arrayOf(Tg),G2=D.exports.shape({name:D.exports.string.isRequired,operateAs:D.exports.string.isRequired,groups:D.exports.arrayOf(D.exports.string).isRequired,permissions:D.exports.shape({isSuperUser:D.exports.bool.isRequired,isQueryViewOnly:D.exports.bool.isRequired,isNonInteractive:D.exports.bool.isRequired,canUsePanels:D.exports.bool.isRequired,canCreateDashboard:D.exports.bool.isRequired,canCreateCodeStudio:D.exports.bool.isRequired,canCreateQueryMonitor:D.exports.bool.isRequired,canCopy:D.exports.bool.isRequired,canDownloadCsv:D.exports.bool.isRequired}).isRequired});Object.freeze({LinkPoint:z2,Link:Tg,Links:W2,Panel:$2,User:G2});const K2=(t,e)=>t[e]===null?null:D.exports.bool,q2=(t,e)=>t[e]===null?null:D.exports.string;Object.freeze({nullableBoolean:K2,nullableString:q2});Z.module("StorageTableViewportUpdater");class hu{static makeSortConfig(e,n){return{column:e,direction:n}}static makeFilterConfig(e){const n=[],s=[];return e.forEach((i,o)=>{n.push(i),o>0&&s.push(Xt.and)}),{filterItems:n,filterOperators:s}}static combineFilterConfigs(e,n,s=Xt.and){return{filterItems:[...e.filterItems,...n.filterItems],filterOperators:[...e.filterOperators,s,...n.filterOperators]}}static makeFilterItem(e,n,s){return{columnName:e,type:n,value:s}}}const Pa=Z.module("PouchStorageTable"),Y2="Deephaven.";vu.plugin(Cf);function X2(t,e){switch(t){case K.in:case K.contains:return{$regex:new RegExp(`${e}`)};case K.inIgnoreCase:return{$regex:new RegExp(`${e}`,"i")};case K.eq:return{$eq:e};case K.notEq:return{$neq:e};case K.greaterThan:return{$gt:e};case K.greaterThanOrEqualTo:return{$gte:e};case K.lessThan:return{$lt:e};case K.lessThanOrEqualTo:return{$lte:e};case K.startsWith:return{$regex:new RegExp(`^(?${e}).*`)};default:throw new Error(`Unsupported type: ${t}`)}}function j2(t){const{filterItems:e,filterOperators:n}=t;let s=null;for(let i=0;i<e.length;i+=1){const o=e[i],{columnName:r,type:l,value:a}=o,d={[r]:X2(l,a)};if(i===0)s=d;else if(s!==null&&i-1<n.length){const c=n[i-1];if(c===Xt.and)s={$and:[s,d]};else if(c===Xt.or)s={$or:[s,d]};else throw new Error(`Unexpected filter operator ${c}, ${d}`)}}if(s==null)throw new Error(`Invalid filter config ${t}`);return s}function Ha(t=[]){return{$and:[...t.map(e=>j2(e)),{name:{$gt:null}},{id:{$gt:null}}]}}function Z2(t,e=!1){var n;return[{id:e?"desc":"asc"},...(n=t==null?void 0:t.map(s=>({[s.column]:s.direction})))!=null?n:[]]}class Q2{constructor(e){this.listeners=[],this.itemListeners=new Map,this.currentSize=0,this.currentReverse=!1,this.currentFilter=null,this.currentSort=null,this.db=new vu(`${Y2}${e}`),this.db._remote=!1,this.db.changes({live:!0,since:"now",include_docs:!0}).on("change",this.dbUpdate.bind(this)),this.db.createIndex({index:{fields:["id","name"]}}),this.refreshInfo()}onUpdate(e){return this.listeners=[...this.listeners,e],()=>{this.listeners=this.listeners.filter(n=>n!==e)}}onItemUpdate(e,n){return this.itemListeners.has(e)||this.itemListeners.set(e,[]),this.itemListeners.set(e,[...this.itemListeners.get(e),n]),this.refreshItem(e),()=>{this.itemListeners.set(e,this.itemListeners.get(e).filter(s=>s!==n))}}close(){this.listeners=[]}get size(){return this.currentSize}get viewport(){return this.currentViewport}setReversed(e){this.currentReverse=e,this.currentViewportData=void 0,this.refreshData()}setViewport(e){this.currentViewport=e,this.refreshInfo(),this.refreshData()}setSorts(e){this.currentSort=e,this.currentViewportData=void 0,this.refreshData()}setFilters(e){this.currentFilter=e,this.currentViewportData=void 0,this.refreshInfo(),this.refreshData()}get data(){return this.currentViewportData}async getViewportData(){var e;return this.viewportUpdatePromise||this.refreshData(),(e=this.viewportUpdatePromise)!=null?e:Promise.resolve({items:[],offset:0})}async put(e){const n={...e,_id:e.id};return await this.db.put(n),n}sendUpdate(){var s;const{listeners:e}=this,n=(s=this.currentViewportData)!=null?s:{items:[],offset:0};for(let i=0;i<e.length;i+=1)e[i](n)}sendItemUpdate(e){const n=this.itemListeners.get(e.id);if(n!==void 0)for(let s=0;s<n.length;s+=1)n[s](e)}dbUpdate(e){Pa.debug("Update received",e),this.refreshInfo(),e.doc!==void 0&&this.sendItemUpdate(e.doc),this.refreshData()}async refreshInfo(){var e,n;try{(e=this.infoUpdatePromise)==null||e.cancel(),this.infoUpdatePromise=ye.makeCancelable(this.db.find({selector:Ha((n=this.currentFilter)!=null?n:[]),fields:[]}));const s=await this.infoUpdatePromise;this.currentSize=s.docs.length,this.sendUpdate()}catch(s){if(!ye.isCanceled(s))throw Pa.error("Unable to refreshInfo",s),s}}async refreshData(){var e,n;if(!!this.currentViewport)try{const{currentViewport:s}=this,i=Z2(this.currentSort,this.currentReverse);(e=this.viewportUpdatePromise)==null||e.cancel(),this.viewportUpdatePromise=ye.makeCancelable(this.db.find({selector:Ha((n=this.currentFilter)!=null?n:[]),skip:s.top,limit:s.bottom-s.top+1,sort:i,fields:["id","name"]}).then(r=>({items:r.docs,offset:s.top})));const o=await this.viewportUpdatePromise;return this.currentViewportData=o,this.sendUpdate(),o}catch(s){if(!ye.isCanceled(s))throw Pa.error("Unable to refreshData",s),s}}async refreshItem(e){const s=(await this.db.find({selector:{id:e},limit:1})).docs[0];return s!==void 0&&this.sendItemUpdate(s),s}async getSnapshot(e){const n=new Map,s=[{id:this.currentReverse?"desc":"asc"}];return await Promise.all(e.map(async([i,o])=>{var l;const r=o-i+1;return this.db.find({selector:Ha((l=this.currentFilter)!=null?l:[]),skip:i,limit:r,sort:s,fields:["id","name"]}).then(a=>{for(let d=0;d<r;d+=1){const c=i+d;n.set(c,a.docs[d])}})})),n}}class uu extends Q2{constructor(e){super(`CommandHistoryStorage.${e}`)}setSearch(e){this.setFilters(e?[hu.makeFilterConfig([hu.makeFilterItem("name",K.contains,e)])]:[])}}const mu=Z.module("PouchCommandHistoryStorage");class J2{constructor(){this.updateTableMap=new Map}getUpdateTable(e){return this.updateTableMap.has(e)||this.updateTableMap.set(e,new uu(e)),this.updateTableMap.get(e)}async getTable(e){return new uu(e)}async addItem(e,n,s,i){return this.updateItem(e,{id:`${new Date().getTime()}`,name:s,data:i})}async updateItem(e,n){const s=this.getUpdateTable(e),i=await s.refreshItem(n.id),o={...i!=null?i:{},...n};return mu.debug("Updating item",o),await s.put(o),mu.debug("Update saved"),n}listenItem(e,n,s){return this.getUpdateTable(e).onItemUpdate(n,s)}}const Eg="SET_LAYOUT_STORAGE",ey=t=>({type:Eg,payload:t}),yg="/ide/assets/community-wordmark-app.d2c5c1eb.svg";const ty=Z.module("FormattingSectionContent");function ny(t){return t.formatString!=null}function hd(t){const e=t==null?void 0:t.querySelector("input, select, textarea");e&&e.focus()}function Ig(t,e){return t.defaultFormatString===e.defaultFormatString}function sy(t,e){return Ig(t,e)}function iy(t,e){return Ig(t,e)}function Rg(t){return t!==""&&En.isValidColumnName(t)}function $s(t,e){if(!t||e.formatString==null||!ny(e))return!1;switch(t){case"datetime":return st.isValid(e);case"decimal":return _e.isValid(e);case"int":return Qe.isValid(e);default:return ty.warn("Trying to validate format of unknown type"),!0}}function Dg(t){const{id:e,isNewRule:n,...s}=t;return s}function Mg(t){return Rg(t.columnName)&&$s(t.columnType,t.format)}function Ng(t){const{timestamp:e,timeZone:n,showTimeZone:s,showTSeparator:i,isGlobalOptions:o,legacyGlobalFormat:r}=t,l=new cn([],{timeZone:n,showTimeZone:s,showTSeparator:i}),a=o?st.getGlobalFormats(s,i):st.getFormats(s,i);return r!=null&&!a.includes(r)&&a.unshift(r),h(Te,{children:a.map(d=>{const c=st.makeFormat("",d,st.TYPE_GLOBAL);return h("option",{value:d,"data-testid":"time-format",children:l.getFormattedString(e,_.dataType.DATETIME,"",c)},d)})})}function oy(){return h(Te,{children:Dn.TIME_ZONES.map(t=>{const{label:e,value:n}=t;return h("option",{value:n,children:e},n)})})}const ni=Z.module("FormattingSectionContent"),Fg=class extends w.exports.PureComponent{constructor(t){super(t),this.getCachedDateTimeFormatOptions=be((c,u,m,p=!1,g)=>{const{timestampAtMenuOpen:f}=this.state;return h(Ng,{timestamp:f,timeZone:c,showTimeZone:u,showTSeparator:m,isGlobalOptions:p,legacyGlobalFormat:g})}),this.debouncedCommitChanges=Ze(this.commitChanges.bind(this),Fg.inputDebounceTime),this.handleDefaultDateTimeFormatChange=this.handleDefaultDateTimeFormatChange.bind(this),this.handleDefaultDecimalFormatChange=this.handleDefaultDecimalFormatChange.bind(this),this.handleDefaultIntegerFormatChange=this.handleDefaultIntegerFormatChange.bind(this),this.handleShowTimeZoneChange=this.handleShowTimeZoneChange.bind(this),this.handleShowTSeparatorChange=this.handleShowTSeparatorChange.bind(this),this.handleTimeZoneChange=this.handleTimeZoneChange.bind(this),this.handleResetDateTimeFormat=this.handleResetDateTimeFormat.bind(this),this.handleResetDecimalFormat=this.handleResetDecimalFormat.bind(this),this.handleResetIntegerFormat=this.handleResetIntegerFormat.bind(this),this.handleResetTimeZone=this.handleResetTimeZone.bind(this),this.handleTruncateNumbersWithPoundChange=this.handleTruncateNumbersWithPoundChange.bind(this);const{formatter:e,defaultDateTimeFormat:n,defaultDecimalFormatOptions:s,defaultIntegerFormatOptions:i,showTimeZone:o,showTSeparator:r,timeZone:l,truncateNumbersWithPound:a}=t,d=e.map((c,u)=>({...c,id:u}));this.containerRef=X.createRef(),this.state={formatSettings:d,showTimeZone:o,showTSeparator:r,timeZone:l,defaultDateTimeFormat:n,defaultDecimalFormatOptions:s,defaultIntegerFormatOptions:i,truncateNumbersWithPound:a,timestampAtMenuOpen:new Date}}componentDidMount(){hd(this.containerRef.current)}componentWillUnmount(){this.debouncedCommitChanges.flush()}handleDefaultDateTimeFormatChange(t){ni.debug("handleDefaultDateTimeFormatChange",t.target.value),this.setState({defaultDateTimeFormat:t.target.value},()=>{this.debouncedCommitChanges()})}handleDefaultDecimalFormatChange(t){ni.debug("handleDefaultDecimalFormatChange",t.target.value),this.setState({defaultDecimalFormatOptions:{defaultFormatString:t.target.value}},()=>{this.debouncedCommitChanges()})}handleDefaultIntegerFormatChange(t){ni.debug("handleDefaultIntegerFormatChange",t.target.value),this.setState({defaultIntegerFormatOptions:{defaultFormatString:t.target.value}},()=>{this.debouncedCommitChanges()})}handleShowTimeZoneChange(){this.setState(t=>({showTimeZone:!t.showTimeZone}),()=>{this.debouncedCommitChanges()})}handleShowTSeparatorChange(){this.setState(t=>({showTSeparator:!t.showTSeparator}),()=>{this.debouncedCommitChanges()})}handleTimeZoneChange(t){this.setState({timeZone:t.target.value},()=>{this.debouncedCommitChanges()})}handleResetDateTimeFormat(){const{defaults:t}=this.props,{defaultDateTimeFormat:e,showTimeZone:n,showTSeparator:s}=t;ni.debug("handleResetDateTimeFormat"),this.setState({defaultDateTimeFormat:e,showTimeZone:n,showTSeparator:s},()=>{this.debouncedCommitChanges()})}handleResetTimeZone(){const{defaults:t}=this.props,{timeZone:e}=t;ni.debug("handleResetTimeZone"),this.setState({timeZone:e},()=>{this.debouncedCommitChanges()})}handleResetDecimalFormat(){const{defaults:t}=this.props,{defaultDecimalFormatOptions:e}=t;ni.debug("handleResetDecimalFormat"),this.setState({defaultDecimalFormatOptions:e},()=>{this.debouncedCommitChanges()})}handleResetIntegerFormat(){const{defaults:t}=this.props,{defaultIntegerFormatOptions:e}=t;ni.debug("handleResetIntegerFormat"),this.setState({defaultIntegerFormatOptions:e},()=>{this.debouncedCommitChanges()})}handleTruncateNumbersWithPoundChange(){this.setState(t=>({truncateNumbersWithPound:!t.truncateNumbersWithPound}),()=>{this.debouncedCommitChanges()})}commitChanges(){var m;const{formatSettings:t,defaultDateTimeFormat:e,showTimeZone:n,showTSeparator:s,timeZone:i,defaultDecimalFormatOptions:o,defaultIntegerFormatOptions:r,truncateNumbersWithPound:l}=this.state,a=(m=t.filter(Mg).map(Dg))!=null?m:[],{settings:d,saveSettings:c}=this.props,u={...d,formatter:a,defaultDateTimeFormat:e,showTimeZone:n,showTSeparator:s,timeZone:i,truncateNumbersWithPound:l};$s(_.dataType.DECIMAL,_e.makeCustomFormat(o.defaultFormatString))&&(u.defaultDecimalFormatOptions=o),$s(_.dataType.INT,Qe.makeCustomFormat(r.defaultFormatString))&&(u.defaultIntegerFormatOptions=r),c(u)}render(){const{defaults:t}=this.props,{defaultDateTimeFormat:e,defaultDecimalFormatOptions:n,defaultIntegerFormatOptions:s,timeZone:i,showTimeZone:o,showTSeparator:r,truncateNumbersWithPound:l}=this.state,{defaultFormatString:a=_e.DEFAULT_FORMAT_STRING}=n!=null?n:{},{defaultFormatString:d=Qe.DEFAULT_FORMAT_STRING}=s!=null?s:{},c=i===t.timeZone,u=r===t.showTSeparator&&o===t.showTimeZone&&e===t.defaultDateTimeFormat,m=sy(n,t.defaultDecimalFormatOptions),p=iy(s,t.defaultIntegerFormatOptions);return h("div",{className:"app-settings-formatting-section",ref:this.containerRef,children:T("div",{className:"container-fluid p-0",children:[h("div",{children:"Default formatting for column types"}),h("div",{className:"app-settings-menu-description mb-3",children:"Applies a formatting rule to all columns of a set type."}),T("div",{className:"form-row mb-2",children:[h("label",{className:"col-form-label col-3",htmlFor:"select-reset-timezone",children:"Time zone"}),h("div",{className:"col pr-0",children:h("select",{className:"custom-select",value:i,onChange:this.handleTimeZoneChange,id:"select-reset-timezone",children:h(oy,{})})}),h("div",{className:"col-1 btn-col",children:h(W,{kind:"ghost",icon:hi,onClick:this.handleResetTimeZone,tooltip:"Reset Time Zone",className:z("btn-reset","btn-reset-time-zone",{hidden:c})})})]}),T("div",{className:"form-row mb-2",children:[h("label",{className:"col-form-label col-3",htmlFor:"select-default-time-format",children:"DateTime"}),h("div",{className:"col pr-0",children:h("select",{className:"custom-select",value:e,onChange:this.handleDefaultDateTimeFormatChange,id:"select-default-time-format",children:this.getCachedDateTimeFormatOptions(i,o,r,!0,e)})}),h("div",{className:"col-1 btn-col",children:h(W,{kind:"ghost",icon:hi,onClick:this.handleResetDateTimeFormat,tooltip:"Reset DateTime Options",className:z("btn-reset","btn-reset-date-time",{hidden:u})})})]}),h("div",{className:"form-row",children:h("div",{className:"offset-3 col-9",children:h(St,{checked:o!=null?o:null,onChange:this.handleShowTimeZoneChange,children:"Show time zone in dates"})})}),h("div",{className:"form-row mb-3",children:h("div",{className:"offset-3 col-9",children:h(St,{checked:r!=null?r:null,onChange:this.handleShowTSeparatorChange,children:"Show 'T' separator"})})}),T("div",{className:"form-row mb-2",children:[h("label",{className:"col-form-label col-3",htmlFor:"default-decimal-format-input",children:"Decimal"}),h("div",{className:"col pr-0",children:h("input",{className:z("form-control","flex-grow-1","default-decimal-format-input",{"is-invalid":!$s(_.dataType.DECIMAL,_e.makeCustomFormat(a))}),"data-lpignore":!0,placeholder:_e.DEFAULT_FORMAT_STRING,type:"text",id:"default-decimal-format-input",value:a,onChange:this.handleDefaultDecimalFormatChange})}),h("div",{className:"col-1 btn-col",children:h(W,{kind:"ghost",icon:hi,onClick:this.handleResetDecimalFormat,tooltip:"Reset Decimal Formatting",className:z("btn-reset","btn-reset-decimal",{hidden:m}),"data-testid":"btn-reset-decimal"})})]}),T("div",{className:"form-row mb-2",children:[h("label",{className:"col-form-label col-3",htmlFor:"default-integer-format-input",children:"Integer"}),h("div",{className:"col pr-0",children:h("input",{className:z("form-control","flex-grow-1","default-integer-format-input",{"is-invalid":!$s(_.dataType.INT,Qe.makeCustomFormat(d))}),"data-lpignore":!0,placeholder:Qe.DEFAULT_FORMAT_STRING,type:"text",id:"default-integer-format-input",value:d,onChange:this.handleDefaultIntegerFormatChange})}),h("div",{className:"col-1 btn-col",children:h(W,{kind:"ghost",icon:hi,onClick:this.handleResetIntegerFormat,tooltip:"Reset Integer Formatting",className:z("btn-reset","btn-reset-integer",{hidden:p}),"data-testid":"btn-reset-integer"})})]}),h("div",{className:"form-row mb-3",children:h("div",{className:"offset-3 col-9",children:h(St,{checked:l!=null?l:null,onChange:this.handleTruncateNumbersWithPoundChange,children:"Truncate numbers with #"})})})]})})}};let Rc=Fg;Rc.defaultProps={scrollTo:()=>{},defaults:{defaultDateTimeFormat:st.DEFAULT_DATETIME_FORMAT_STRING,defaultDecimalFormatOptions:{defaultFormatString:_e.DEFAULT_FORMAT_STRING},defaultIntegerFormatOptions:{defaultFormatString:Qe.DEFAULT_FORMAT_STRING},showTimeZone:!1,showTSeparator:!0,timeZone:st.DEFAULT_TIME_ZONE_ID}};Rc.inputDebounceTime=250;const ry=t=>({formatter:Pm(t),defaultDateTimeFormat:Om(t),defaultDecimalFormatOptions:Lm(t),defaultIntegerFormatOptions:Am(t),showTimeZone:Hm(t),showTSeparator:Vm(t),truncateNumbersWithPound:Um(t),timeZone:or(t),settings:Rt(t)}),ly=It(ry,{saveSettings:Yl})(Rc);function ay(){const[t,e]=w.exports.useState(!1),n=()=>{e(!t)};return T(W,{kind:"ghost",onClick:n,icon:kC,children:["Legal Notices",T(Jo,{isOpen:t,toggle:n,className:"theme-bg-light",children:[h(tr,{toggle:n,children:"Legal Notice"}),T(er,{children:[h("p",{children:"Deephaven software is protected by U.S. Patent Nos. 9,612,959; 9,613,018; 9,613,109; 9,619,210; 9,633,060; 9,639,570; 9,672,238; 9,679,006; 9,690,821; 9,710,511; 9,760,591; 9,805,084; 9,836,495; 9,836,494; 9,886,469; 9,898,496; 9,934,266; 10,002,153; 10,002,154; 10,002,155; 10,003,673; 10,019,138; 10,069,943; 10,176,211; 10,198,465; 10,198,466; 10,198,469; 10,212,257; 10,241,960; 10,241,965; 10,242,040; 10,242,041; 10,353,893; 10,346,394; 10,452,649; 10,496,639; 10,540,351; 10,552,412; 10,565,194; 10,565,206; 10,572,474; 10,621,168; 10,642,829; 10,657,184; 10,678,787; 10,691,686; and 10,783,191. Other patents pending."}),T("p",{children:["\xA9 2016-",new Date().getFullYear()," Deephaven Data Labs LLC. Patent Pending."]})]})]})]})}function Yo(t){const{children:e,isExpanded:n,sectionKey:s,title:i,onToggle:o}=t;return T(Te,{children:[h("div",{children:T(W,{kind:"ghost",className:"btn-collapse-trigger",onClick:()=>o(s),children:[h("div",{className:"flex-grow-1",children:i}),h("div",{className:"flex-shrink-0",children:h(ee,{transform:n?"flip-v":"",icon:Yn})})]})}),h(_d,{in:n,autoFocusOnShow:!0,children:e})]})}Yo.propTypes={children:D.exports.node,isExpanded:D.exports.bool.isRequired,sectionKey:D.exports.string.isRequired,title:D.exports.node.isRequired,onToggle:D.exports.func};Yo.defaultProps={children:null,onToggle:()=>{}};function dy({shortcut:t,displayText:e,categoryName:n,onChange:s}){const[i,o]=w.exports.useState(e),[r,l]=w.exports.useState(t.getKeyState()),[a,d]=w.exports.useState(!1),[c,u]=w.exports.useState("");w.exports.useEffect(function(){o(e),l(t.getKeyState())},[e,t]),w.exports.useEffect(function(){o(Kt.getDisplayText(r)),t.matchesKeyState(r)&&d(!1)},[r,t]),w.exports.useEffect(function(){if(a){if(!Kt.isValidKeyState(r)){Kt.isAllowedKey(r.keyValue)?u("Must contain a modifier key"):u("Must contain an allowed action key");return}const y=Ae.getConflictingShortcuts(r).filter(E=>E.id.startsWith(n)&&E!==t).map(E=>E.name);if(y.length){u(`Conflicts with ${y.join(", ")}`);return}u("")}else u("")},[a,r,n,t]);function m(v){if(v.stopPropagation(),v.preventDefault(),t.isEditable&&!v.repeat){const y=Kt.getKeyStateFromEvent(v),E=Kt.createKeyState([ge.BACKSPACE]);Kt.doKeyStatesMatch(y,E)?l(Kt.NULL_KEY_STATE):l(y)}}function p(v){v.stopPropagation(),v.preventDefault(),t.matchesKeyState(r)||d(!0)}function g(){Ge.disableAllActions()}function f(){Ge.enableAllActions()}function b(){t.setKeyState(r),d(!1),s(t)}function C(){const v=t.getKeyState();l(v),d(!1)}function S(){d(!0),l(t.getDefaultKeyState())}return T(Te,{children:[T("div",{className:"shortcut-item-container",children:[T("label",{className:"shortcut-item-name",children:[t.name,t.tooltip!==void 0&&h(Ye,{children:t.tooltip})]}),T("div",{className:"shortcut-item-input-container",children:[h("input",{className:z("form-control",{"is-invalid":c}),onKeyDown:m,onKeyUp:p,onFocus:g,onBlur:f,disabled:!t.isEditable,value:i,readOnly:!0}),!Kt.doKeyStatesMatch(r,t.getDefaultKeyState())&&!c&&h(W,{className:"reset-to-default-button",kind:"ghost",icon:h(ee,{icon:hi,transform:{rotate:90,flipX:!0}}),tooltip:"Reset to default",onClick:S})]})]}),a&&T("div",{className:z("shortcut-item-message-container",{"is-invalid":c}),children:[h("div",{className:"shortcut-item-message",children:c}),T("div",{className:"shortcut-item-message-buttons",children:[Kt.isValidKeyState(r)&&h(W,{kind:"ghost",onClick:b,children:"Confirm"}),h(W,{kind:"ghost",onClick:C,children:"Undo"})]})]})]})}function cy({shortcutOverrides:t={},settings:e,saveSettings:n}){const s=w.exports.useCallback(l=>{const a=Kt.isMacPlatform,d={mac:{...t.mac},windows:{...t.windows}},c=a?d.mac:d.windows;l.forEach(u=>{u.isDefault()?delete c[u.id]:c[u.id]=u.getKeyState()}),n({...e,shortcutOverrides:d})},[e,n,t]);let i=Array.from(Ae.shortcutsByCategory.entries()).map(([l,a])=>({name:l,shortcuts:a}));const o=i.findIndex(l=>l.name.toUpperCase()==="GLOBAL"),r=i.splice(o,1);return i=i.concat(r),T(Te,{children:[h("div",{className:"app-settings-menu-description",children:"Customize shortcuts below. Assigning shortcuts that conflict with the browser or IDE shortcuts may cause unintended behavior"}),i.map(l=>h(hy,{name:l.name,shortcuts:l.shortcuts,saveShortcutOverrides:s},l.name))]})}function hy({name:t,shortcuts:e,saveShortcutOverrides:n}){function s(a){return a.split("_").map(d=>`${d[0].toUpperCase()}${d.slice(1).toLowerCase()}`).join(" ")}const[i,o]=w.exports.useState(e);function r(a){const d=i.filter(u=>u!==a&&!u.isNull()&&u.matchesKeyState(a.getKeyState()));d.forEach(u=>u.setToNull());const c=[a,...d];n(c),o(u=>[...u])}const l=w.exports.useMemo(()=>i.map(a=>a.getDisplayText()),[i]);return T("div",{className:"mt-3",children:[h("div",{className:"font-weight-bold",children:s(t)}),i.map((a,d)=>h(dy,{shortcut:a,displayText:l[d],categoryName:t,onChange:r},a.id))]})}const uy=t=>({settings:Rt(t),shortcutOverrides:I0(t)}),my={saveSettings:Yl},py=It(uy,my)(cy),ud=new oC,md=new cl(ud);function gy(){Z.setLogLevel(parseInt("2",10)),ud.enable(),md.enable(),window!=null&&(window.DHLog=Z,window.DHLogProxy=ud,window.DHLogHistory=md)}const fy="yyyy-MM-dd-HHmmss";function xg(t,e="root",n=new Map([[t,""]])){const s={};return Object.entries(t).forEach(([i,o])=>{try{JSON.stringify(o),s[i]=o}catch{const l=o;if(typeof o=="bigint")s[i]=o.toString();else if(n.has(l))s[i]=`Circular ref to ${n.get(l)}`;else{const a=`${e}.${i}`;n.set(l,a),s[i]=xg(o,a,n)}}}),s}function Cy(){const t=jl.getState();return JSON.stringify(xg(t),null,2)}function by(t){const e={uiVersion:"0.27.0",userAgent:navigator.userAgent,...t};return JSON.stringify(e,null,2)}async function Sy(t=`${M.i18n.DateTimeFormat.format(fy,new Date)}_support_logs`,e){const n=new Tu,s=n.folder(t);s.file("console.txt",md.getFormattedHistory()),s.file("redux.json",Cy()),s.file("metadata.json",by(e));const i=await n.generateAsync({type:"blob"}),o=document.createElement("a");o.href=URL.createObjectURL(i),o.download=`${t}.zip`,o.click()}const wy=[{value:_.dataType.DATETIME,label:"DateTime"},{value:_.dataType.DECIMAL,label:"Decimal"},{value:_.dataType.INT,label:"Integer"}];function vy(){const t=wy.map(e=>h("option",{value:e.value,children:e.label},`key-columnType-${e.value}`));return T(Te,{children:[h("option",{disabled:!0,value:"",children:"Select Type"},"key-columnType-placeholder"),t]})}const _g=class extends w.exports.PureComponent{constructor(t){super(t),this.getCachedColumnTypeOptions=be(()=>h(vy,{})),this.getCachedDateTimeFormatOptions=be((c,u,m,p=!1,g)=>{const{timestampAtMenuOpen:f}=this.state;return h(Ng,{timestamp:f,timeZone:c,showTimeZone:u,showTSeparator:m,isGlobalOptions:p,legacyGlobalFormat:g})}),this.debouncedCommitChanges=Ze(this.commitChanges.bind(this),_g.inputDebounceTime),this.handleFormatRuleEntered=this.handleFormatRuleEntered.bind(this),this.handleFormatRuleChange=this.handleFormatRuleChange.bind(this),this.handleFormatRuleCreate=this.handleFormatRuleCreate.bind(this),this.handleFormatRuleDelete=this.handleFormatRuleDelete.bind(this);const{formatter:e,defaultDateTimeFormat:n,defaultDecimalFormatOptions:s,defaultIntegerFormatOptions:i,showTimeZone:o,showTSeparator:r,timeZone:l,truncateNumbersWithPound:a}=t,d=e.map((c,u)=>({...c,id:u}));this.containerRef=X.createRef(),this.addFormatRuleButtonRef=X.createRef(),this.lastFormatRuleIndex=d.length,this.state={formatSettings:d,formatRulesChanged:!1,showTimeZone:o,showTSeparator:r,timeZone:l,defaultDateTimeFormat:n,defaultDecimalFormatOptions:s,defaultIntegerFormatOptions:i,truncateNumbersWithPound:a,timestampAtMenuOpen:new Date}}componentDidMount(){hd(this.containerRef.current)}componentWillUnmount(){this.debouncedCommitChanges.flush()}isDuplicateRule(t){var n;const{formatSettings:e}=this.state;return(n=e.some(s=>s.id!==t.id&&s.columnName===t.columnName&&s.columnType===t.columnType))!=null?n:!1}getAutoIncrementFormatRuleIndex(){const{lastFormatRuleIndex:t}=this;return this.lastFormatRuleIndex+=1,t}handleFormatRuleChange(t,e,n){this.setState(s=>{const{formatSettings:i}=s;L(i);const o=[...i];let r={};e==="columnType"&&(r={format:""});const l={...o[t],...r,[e]:n};return o[t]=l,{formatSettings:o}},()=>{this.debouncedCommitChanges()})}handleFormatRuleCreate(){this.setState(t=>{const{formatSettings:e}=t,n={columnType:_.dataType.DATETIME,columnName:"",format:{},id:this.getAutoIncrementFormatRuleIndex(),isNewRule:!0};return{formatSettings:e!=null?[...e,n]:[n],formatRulesChanged:!0}})}handleFormatRuleDelete(t){this.setState(e=>{const{formatSettings:n}=e;return{formatSettings:n.filter((i,o)=>o!==t),formatRulesChanged:!0}},()=>{this.debouncedCommitChanges()})}handleFormatRuleEntered(t){this.scrollToFormatBlockBottom(),hd(t)}commitChanges(){var m;const{formatSettings:t,defaultDateTimeFormat:e,showTimeZone:n,showTSeparator:s,timeZone:i,defaultDecimalFormatOptions:o,defaultIntegerFormatOptions:r,truncateNumbersWithPound:l}=this.state,a=(m=t.filter(Mg).map(Dg))!=null?m:[],{settings:d,saveSettings:c}=this.props,u={...d,formatter:a,defaultDateTimeFormat:e,showTimeZone:n,showTSeparator:s,timeZone:i,truncateNumbersWithPound:l};$s(_.dataType.DECIMAL,_e.makeCustomFormat(o.defaultFormatString))&&(u.defaultDecimalFormatOptions=o),$s(_.dataType.INT,Qe.makeCustomFormat(r.defaultFormatString))&&(u.defaultIntegerFormatOptions=r),c(u)}scrollToFormatBlockBottom(){var e,n,s,i;const{scrollTo:t}=this.props;t(0,((n=(e=this.addFormatRuleButtonRef.current)==null?void 0:e.offsetHeight)!=null?n:0)+((i=(s=this.addFormatRuleButtonRef.current)==null?void 0:s.offsetTop)!=null?i:0))}getRuleError(t){const e={hasColumnNameError:!1,hasFormatError:!1,message:""},n=[];return t.isNewRule!==void 0&&t.isNewRule||(this.isDuplicateRule(t)&&(e.hasColumnNameError=!0,n.push("Duplicate column name/type combo.")),Rg(t.columnName)||(e.hasColumnNameError=!0,n.push("Column names must start with a letter or underscore and contain only alphanumeric characters or underscores.")),t.format.formatString!==void 0&&t.format.formatString.length===0?(e.hasFormatError=!0,n.push("Empty formatting rule.")):$s(t.columnType,t.format)||(e.hasFormatError=!0,n.push("Invalid formatting rule.")),e.message=n.join(`
43
+ `)),e}renderFormatRule(t,e){const n=`input-${t}-columnName`,s=`input-${t}-columnType`,i=`input-${t}-format`,o=this.getCachedColumnTypeOptions(),r=c=>this.handleFormatRuleChange(t,"columnName",c.target.value),l=()=>this.handleFormatRuleChange(t,"isNewRule",!1),a=c=>this.handleFormatRuleChange(t,"columnType",c.target.value),d=this.getRuleError(e);return T("fieldset",{className:"container-fluid format-rule-container",children:[T("div",{className:"form-row",children:[T("div",{className:"form-group col-7 mb-2",children:[h("label",{htmlFor:n,children:"Column Name"}),h("input",{id:n,className:z("form-control",{"is-invalid":d.hasColumnNameError}),"data-lpignore":!0,type:"text",value:e.columnName,onChange:r,onBlur:l})]}),T("div",{className:"form-group col mb-2",children:[h(W,{kind:"ghost",className:"btn-delete-format-rule float-right",tabIndex:-1,onClick:()=>this.handleFormatRuleDelete(t),icon:hn,tooltip:"Delete","aria-label":"Delete Format Rule"}),h("label",{htmlFor:s,children:"Column Type"}),h("select",{id:s,className:"custom-select",value:e.columnType,onChange:a,children:o})]})]}),h("div",{className:"form-row",children:T("div",{className:"form-group col-12 d-flex mb-2",children:[h("label",{className:"flex-shrink-0 col-form-label mr-3",htmlFor:i,children:"Formatting Rule"}),this.renderFormatRuleInput(t,e.columnType,i,e.format,d.hasFormatError)]})}),h("div",{className:"form-row",children:h("div",{className:"form-group col-12 d-flex mb-2",children:d.message&&h("p",{className:"text-danger",children:d.message})})})]},t)}renderFormatRuleInput(t,e,n,s,i){switch(_.getNormalizedType(e)){case _.dataType.DATETIME:return this.renderDateTimeFormatRuleInput(t,n,s,i);case _.dataType.DECIMAL:return this.renderDecimalFormatRuleInput(t,n,s,i);case _.dataType.INT:return this.renderIntegerFormatRuleInput(t,n,s,i);default:throw new Error(`Unrecognized column type: ${e}`)}}renderDateTimeFormatRuleInput(t,e,n,s){var a;const{showTimeZone:i,showTSeparator:o,timeZone:r}=this.state,l=(a=n.formatString)!=null?a:"";return T("select",{className:z("custom-select",{"is-invalid":s}),value:l,id:e,onChange:d=>{const c=st.makeFormat("",d.target.value,st.TYPE_GLOBAL);this.handleFormatRuleChange(t,"format",c)},children:[h("option",{value:"",disabled:!0,children:"Select format"},"default"),this.getCachedDateTimeFormatOptions(r,i,o)]})}renderIntegerFormatRuleInput(t,e,n,s){var o;const i=(o=n.formatString)!=null?o:"";return h("input",{className:z("form-control","flex-grow-1",{"is-invalid":s}),"data-lpignore":!0,id:e,placeholder:Qe.DEFAULT_FORMAT_STRING,type:"text",value:i,onChange:r=>{const l=Qe.makeFormat("",r.target.value,Qe.TYPE_GLOBAL,void 0);this.handleFormatRuleChange(t,"format",l)}})}renderDecimalFormatRuleInput(t,e,n,s){var o;const i=(o=n.formatString)!=null?o:"";return h("input",{className:z("form-control","flex-grow-1",{"is-invalid":s}),"data-lpignore":!0,id:e,placeholder:_e.DEFAULT_FORMAT_STRING,type:"text",value:i,onChange:r=>{const l=_e.makeFormat("",r.target.value,_e.TYPE_GLOBAL,void 0);this.handleFormatRuleChange(t,"format",l)}})}render(){const{formatRulesChanged:t,formatSettings:e}=this.state,n=e.map((i,o)=>h(mt,{classNames:"fade",timeout:ze.transitionMs,onEnter:this.handleFormatRuleEntered,children:this.renderFormatRule(o,i)},i.id)),s=h(W,{kind:"ghost",className:"mb-3",onClick:this.handleFormatRuleCreate,ref:this.addFormatRuleButtonRef,icon:Gs,children:"Add New Rule"});return T("div",{className:"app-settings-formatting-section",ref:this.containerRef,children:[h("div",{children:"Default formatting for matched column names"}),h("div",{className:"app-settings-menu-description mb-3",children:"Applies a formatting rule to all columns that match a specified name and type."}),h(bf,{appear:t,enter:t,exit:t,children:n}),s]})}};let Dc=_g;Dc.defaultProps={scrollTo:()=>{},defaults:{defaultDateTimeFormat:st.DEFAULT_DATETIME_FORMAT_STRING,defaultDecimalFormatOptions:{defaultFormatString:_e.DEFAULT_FORMAT_STRING},defaultIntegerFormatOptions:{defaultFormatString:Qe.DEFAULT_FORMAT_STRING},showTimeZone:!1,showTSeparator:!0,timeZone:st.DEFAULT_TIME_ZONE_ID}};Dc.inputDebounceTime=250;const Ty=t=>({formatter:Pm(t),defaultDateTimeFormat:Om(t),defaultDecimalFormatOptions:Lm(t),defaultIntegerFormatOptions:Am(t),showTimeZone:Hm(t),showTSeparator:Vm(t),truncateNumbersWithPound:Um(t),timeZone:or(t),settings:Rt(t)}),Ey=It(Ty,{saveSettings:Yl})(Dc),ms=class extends w.exports.Component{constructor(t){super(t),this.handleClose=this.handleClose.bind(this),this.handleScrollTo=this.handleScrollTo.bind(this),this.handleSectionToggle=this.handleSectionToggle.bind(this),this.handleExportSupportLogs=this.handleExportSupportLogs.bind(this),this.menuContentRef=X.createRef(),this.state={expandedSectionKey:ms.FORMATTING_SECTION_KEY}}static focusFirstInputInContainer(t){const e=t==null?void 0:t.querySelector("input, select, textarea");e&&e.focus()}componentDidMount(){ms.focusFirstInputInContainer(this.menuContentRef.current)}isSectionExpanded(t){const{expandedSectionKey:e}=this.state;return e===t}handleScrollTo(t,e){var n;(n=this.menuContentRef.current)==null||n.scrollTo(t,e)}handleSectionToggle(t){this.setState(e=>({expandedSectionKey:e.expandedSectionKey===t?void 0:t}))}handleClose(){const{onDone:t}=this.props;t()}handleExportSupportLogs(){const{serverConfigValues:t}=this.props;Sy(void 0,Object.fromEntries(t))}render(){const t="0.27.0",e="https://github.com/deephaven/web-client-ui/",n="https://deephaven.io/core/docs/",{serverConfigValues:s}=this.props,i=s.get("barrage.version"),o=s.get("java.version"),r=s.get("deephaven.version"),l=(a,d)=>T(Te,{children:[h("div",{children:a}),h("div",{children:d})]});return T("div",{className:"app-settings-menu",children:[T("header",{className:"app-settings-menu-header",children:[h("div",{className:"flex-spacer"}),h(W,{kind:"ghost",className:"btn-close-settings-menu",onClick:this.handleClose,icon:h(ee,{icon:oo,transform:"grow-4"}),tooltip:"Close"})]}),T("div",{className:"app-settings-menu-content",ref:this.menuContentRef,children:[h("h5",{children:"Settings"}),h("hr",{className:"my-0"}),h(Yo,{sectionKey:ms.FORMATTING_SECTION_KEY,isExpanded:this.isSectionExpanded(ms.FORMATTING_SECTION_KEY),title:T(Te,{children:[h(ee,{icon:jC,transform:"grow-4",className:"mr-2"}),"Default Formatting & Time zone"]}),onToggle:this.handleSectionToggle,children:h(ly,{})}),h(Yo,{sectionKey:ms.COLUMN_SPECIFIC_SECTION_KEY,isExpanded:this.isSectionExpanded(ms.COLUMN_SPECIFIC_SECTION_KEY),title:T(Te,{children:[h(ee,{icon:OC,transform:"grow-4",className:"mr-2"}),"Column Specific Formatting Rules"]}),onToggle:this.handleSectionToggle,children:h(Ey,{scrollTo:this.handleScrollTo})}),h(Yo,{sectionKey:ms.SHORTCUT_SECTION_KEY,isExpanded:this.isSectionExpanded(ms.SHORTCUT_SECTION_KEY),title:T(Te,{children:[h(ee,{icon:zC,transform:"grow-2"})," ","Keyboard Shortcuts"]}),onToggle:this.handleSectionToggle,children:h(py,{})}),T("div",{className:"app-settings-footer",children:[T("div",{className:"app-settings-footer-section",children:[T("div",{className:"app-settings-footer-item",children:[h("div",{className:"font-weight-bold",children:"Support"}),T("div",{children:["GitHub:\xA0",h("a",{href:e,className:"custom-link",target:"_blank",rel:"noopener noreferrer",children:e})]}),h(W,{kind:"tertiary",className:"mt-2 py-2",onClick:this.handleExportSupportLogs,children:"Export Logs"})]}),T("div",{className:"app-settings-footer-item",children:[h("div",{className:"font-weight-bold",children:"Documentation"}),h("a",{target:"_blank",rel:"noreferrer noopener",href:n,className:"custom-link",children:n})]}),T("div",{className:"app-settings-footer-item",children:[h("div",{className:"font-weight-bold",children:"Version"}),T("span",{className:"d-inline-block text-muted",children:[r," ",h(ee,{icon:xC}),T(Ye,{interactive:!0,children:[T("div",{className:"detailed-server-config",children:[l("Engine Version",r),l("Web UI Version",t),l("Java Version",o),l("Barrage Version",i)]}),h(Pl,{tooltip:"Copy version numbers",copy:`Engine Version: ${r}
44
+ Web UI Version: ${t}
45
+ Java Version: ${o}
46
+ Barrage Version: ${i}`,children:"Copy Versions"})]})]})]}),h("div",{className:"app-settings-footer-item",children:h(ay,{})})]}),h("div",{className:"app-settings-footer-section",children:h("div",{className:"logo",children:h("a",{target:"_blank",rel:"noreferrer noopener",href:"https://deephaven.io",className:"d-inline-block custom-link p-1",children:h("img",{src:yg,alt:"Deephaven Data Labs",width:"230px"})})})})]})]})]})}};let bo=ms;bo.defaultProps={onDone:()=>{}};bo.FORMATTING_SECTION_KEY="SettingsMenu.formatting";bo.COLUMN_SPECIFIC_SECTION_KEY="SettingsMenu.columnFormatting";bo.APPLICATION_SECTION_KEY="ApplicationMenu.settings";bo.SHORTCUT_SECTION_KEY="SettingsMenu.shortcuts";const pu=10;function Gi(t){const{forwardedProps:{menuItem:{action:e,title:n,disabled:s},iconElement:i,displayShortcut:o,isMouseSelected:r,isKeyboardSelected:l,closeMenu:a}}=t,d=w.exports.useRef(),c=w.exports.useRef(),u=w.exports.useRef(null),[m,p]=w.exports.useState(!1),g=w.exports.useCallback(C=>{d.current!=null&&c.current!=null&&u.current&&(Math.abs(d.current-C.clientX)>=pu||Math.abs(c.current-C.clientY)>=pu)&&(p(!0),window.removeEventListener("mousemove",g),a(),e(C),u.current=null)},[e,a]);function f(C){d.current=C.clientX,c.current=C.clientY,u.current=C.target,window.addEventListener("mousemove",g)}function b(C){u.current===C.target&&(p(!0),a(),e(),window.removeEventListener("mousemove",g)),u.current=null}return w.exports.useEffect(function(){return function(){return window.removeEventListener("mousemove",g)}},[g]),T("button",{type:"button",className:z("btn-context-menu",{disabled:s},{active:r&&!s},{"keyboard-active":l&&!s}),onMouseDown:f,onMouseUp:b,disabled:m,children:[h("span",{className:z("icon"),children:i}),h("span",{className:"title",children:n}),h("span",{className:"shortcut",children:o})]})}function Mc(t){const{handleControlSelect:e,handleToolSelect:n,onClearFilter:s}=t,i=w.exports.useMemo(()=>[{title:"Input Filter",icon:db,menuElement:h(Gi,{}),action:o=>{e(wn.INPUT_FILTER,o)},order:10},{title:"Dropdown Filter",icon:Hu,menuElement:h(Gi,{}),action:o=>{e(wn.DROPDOWN_FILTER,o)},order:15},{title:"Markdown Widget",icon:HC,menuElement:h(Gi,{}),action:o=>{e(wn.MARKDOWN,o)},order:20},{title:"Filter Sets",icon:za,menuElement:h(Gi,{}),action:o=>{e(wn.FILTER_SET_MANAGER,o)},order:25},{disabled:!0,menuElement:h("div",{className:"context-menu-group-header",children:"Tools"}),order:30},{title:"Linker",icon:Ed,action:()=>{n(Yt.LINKER)},order:40,shortcut:bs.LINKER},{disabled:!0,menuElement:h("div",{className:"context-menu-group-header",children:"Actions"}),order:50},{title:"Clear All Filters",icon:ob,action:()=>{s()},order:60,shortcut:an.TABLE.CLEAR_ALL_FILTERS}],[e,n,s]);return h(Fn,{popperClassName:"controls-menu-popper",actions:i})}Mc.propTypes={handleControlSelect:D.exports.func,handleToolSelect:D.exports.func,onClearFilter:D.exports.func};Mc.defaultProps={handleControlSelect:()=>{},handleToolSelect:()=>{},onClearFilter:()=>{}};Gi.propTypes={forwardedProps:D.exports.shape({iconElement:D.exports.node,displayShortcut:D.exports.string,isMouseSelected:D.exports.bool.isRequired,isKeyboardSelected:D.exports.bool.isRequired,closeMenu:D.exports.func.isRequired,menuItem:D.exports.shape({action:D.exports.func,title:D.exports.string,disabled:D.exports.bool}).isRequired})};Gi.defaultProps={forwardedProps:null};const yy=Ks(Eg,null),Iy={layoutStorage:yy},Ry=t=>t.layoutStorage,Dy=t=>t.serverConfigValues;Object.entries(Iy).map(([t,e])=>ho.register(t,e));const gu=10;function My(t){const{onExportLayout:e,onImportLayout:n,onResetLayout:s,onSelect:i,widgets:o=[]}=t,[r,l]=w.exports.useState(!1),[a,d]=w.exports.useState(""),c=w.exports.useRef(null),u=w.exports.useRef(),m=w.exports.useCallback((y,E)=>{y!=null&&i(y,E)},[i]),p=w.exports.useCallback(y=>{d(y.target.value)},[]),g=w.exports.useCallback(y=>{u.current!=null&&(Math.abs(u.current.x-y.clientX)>=gu||Math.abs(u.current.y-y.clientY)>=gu)&&(l(!0),window.removeEventListener("mousemove",g),m(u.current.widget,y),u.current=void 0)},[u,m]),f=w.exports.useCallback((y,E)=>{u.current={x:y.clientX,y:y.clientY,widget:E},window.addEventListener("mousemove",g)},[g]),b=w.exports.useCallback((y,E)=>{var I;window.removeEventListener("mousemove",g),((I=u.current)==null?void 0:I.widget)===E&&(l(!0),m(E)),u.current=void 0},[g,u,m]),C=w.exports.useMemo(()=>o.filter(y=>{var E;return a?(E=y.name)==null?void 0:E.toLowerCase().includes(a.toLowerCase()):!0}),[a,o]).sort((y,E)=>{var I,R,N;return(N=(R=y.name)==null?void 0:R.localeCompare((I=E.name)!=null?I:""))!=null?N:0}),S=w.exports.useMemo(()=>C.map(y=>{var E,I;return h("li",{children:T(W,{kind:"ghost","data-testid":`panel-list-item-${(E=y.name)!=null?E:""}-button`,onMouseDown:R=>{f(R,y)},onMouseUp:R=>{b(R,y)},onKeyDown:R=>{(R.key==="Enter"||R.key===" ")&&m(y)},disabled:r,onClick:()=>{},children:[h(lm,{type:y.type})," ",(I=y.name)!=null?I:""]})},y.name)}),[C,r,f,b,m]),v=w.exports.useMemo(()=>S.length===0?h("span",{children:"No bound variables found."}):null,[S]);return T("div",{className:"widget-list-container d-flex flex-column",children:[h("div",{className:"widget-list-header",children:h(ws,{value:a,placeholder:"Find Table, Plot or Widget",onChange:p,ref:c})}),T("ul",{className:"widget-list flex-grow-1",children:[v&&h("li",{className:"widget-list-message",children:v}),!v&&S]}),h("div",{children:h("hr",{})}),T("div",{className:"widget-list-footer",children:[T(W,{kind:"ghost",onClick:e,children:[T("div",{className:"fa-md fa-layers",children:[h(ee,{mask:Wa,icon:$c,transform:"right-5 down-5"}),h(ee,{icon:$c,transform:"right-8 down-6"})]}),"Export Layout"]}),T(W,{kind:"ghost",onClick:n,children:[T("div",{className:"fa-md fa-layers",children:[h(ee,{mask:Wa,icon:$a,transform:"right-5 down-5"}),h(ee,{icon:$a,transform:"right-8 down-6"})]}),"Import Layout"]}),h(W,{kind:"ghost",icon:hi,onClick:s,tooltip:"Reset Layout"})]})]})}const Ny=async(t,e,n)=>{let s,i,o,r;if(sl(e)?(s=e.settings,i=e.table,o=void 0,r=e.tableSettings):(s={},i="",o=e.figure,r={}),n!==void 0&&(n.tableSettings!=null&&(r=n.tableSettings),n.table!=null&&(i=n.table),n.figure!=null&&(o=n.figure),n.settings!=null&&(s={...s,...n.settings})),o!==void 0){const d={title:o,name:o,type:M.VariableType.FIGURE},c=await t.getObject(d);return eo.makeModel(s,c)}const l={title:o,name:i,type:M.VariableType.TABLE},a=await t.getObject(l);return ie.applyTableSettings(a,r,or(jl.getState())),eo.makeModelFromSettings(s,a)},Fy=async(t,e,n=M.VariableType.TABLE)=>{const{table:s}=e,i={title:s,name:s,type:n},o=await t.getObject(i);return dc.makeModel(o)};function xy({onAutoFillClick:t=()=>{}}){return T("div",{className:"empty-dashboard-container",children:[T("div",{className:"hint-container",children:[h(ee,{icon:Mu})," ",h("br",{}),"Use the panel list to add objects from a query."]}),T("div",{className:"empty-dashboard",children:[h("div",{className:"add-panels-hint",children:"Drag Panels Here"}),h(W,{kind:"tertiary",onClick:t,children:"Auto fill objects"})]})]})}function _y(t){return t.version===2}function ky(t){return Array.isArray(t)}const Zr=Z.module("UserLayoutUtils"),Oy={layoutConfig:[{type:"column",content:[{type:"row",height:40,content:[{type:"stack",content:[{type:"react-component",component:Wi.COMPONENT,title:Wi.TITLE,isClosable:!1},{type:"react-component",component:Ml.COMPONENT,title:Ml.TITLE,isClosable:!1}]},{type:"stack",width:25,content:[{type:"react-component",component:Il.COMPONENT,title:Il.TITLE,isClosable:!1},{type:"react-component",component:Rl.COMPONENT,title:Rl.TITLE,isClosable:!1}]}]},{type:"row",content:[{type:"stack",title:"Notebooks",content:[]}]}]}],links:[],filterSets:[],version:2},Ly={layoutConfig:[],links:[],filterSets:[],version:2};function kg(t){if(_y(t))return t;if(ky(t))return{layoutConfig:t,links:[],filterSets:[],version:2};throw new Error(`Unexpected layout import format: ${t}`)}async function Ay(t,e=!0){try{const n=await t.getLayouts();if(n.length>0)try{const s=await t.getLayout(n[0]);return kg(s)}catch(s){Zr.error("Unable to load layout",n[0],":",s),Zr.warn("No valid layouts found, falling back to default layout")}}catch(n){Zr.error("Unable to fetch layout list",n),Zr.warn("Falling back to default layout")}return e?Oy:Ly}function Py(t){const{filterSets:e,layoutConfig:n,links:s}=t;return{filterSets:e,layoutConfig:n,links:s,version:2}}const al={exportLayout:Py,getDefaultLayout:Ay,normalizeLayout:kg},Qr=Z.module("DownloadServiceWorkerUtils"),Og=class{static registerOnLoaded(){new URL("/ide/",window.location.href).origin===window.location.origin&&("serviceWorker"in navigator?window.addEventListener("load",()=>{const e=new URL("/ide/download/serviceWorker.js",window.location.href);navigator.serviceWorker.register(e).then(n=>{n.update(),Qr.info("Registering service worker on ",e,n)}).catch(n=>{Qr.error("Failed to register service worker",n)})}):Qr.info("Service worker is not supported."))}static async getServiceWorker(){if("serviceWorker"in navigator){const e=(await navigator.serviceWorker.getRegistrations()).find(n=>n.scope.endsWith(Og.DOWNLOAD_PATH));if(e&&e.active)return Qr.info("Download service worker is active."),e.active;throw new Error("Can not find download service worker.")}throw new Error("Download service worker is not available.")}static unregisterSW(){}};let Nl=Og;Nl.DOWNLOAD_PATH="/download/";const Lg={react:X},Hy=Sf(Lg),Vy=wf({requires:Hy}),Uy=vf.createRequires(Lg),By=Tf({requires:Uy}),$y=Z.module("PluginUtils");class pd{static loadComponentPlugin(e){if("".split(",").includes(e)){const o=X.lazy(()=>Df(()=>import(`./internal/${e}`),[])),r=X.forwardRef((l,a)=>h(w.exports.Suspense,{fallback:h("div",{children:"Loading Plugin..."}),children:h(o,{ref:a,...l})}));return r.pluginName=e,r.displayName="Local Plugin",r}const n=new URL("/ide/plugins/",`${window.location}`),s=new URL(`${e}.js`,n),i=X.forwardRef((o,r)=>h(Vy,{url:s,render:({err:l,Component:a})=>{if(l!=null&&l!==""){const d=`Error loading plugin ${e} from ${s} due to ${l}`;return $y.error(d),h("div",{className:"error-message",children:`${d}`})}return h(a,{ref:r,...o})}}));return i.pluginName=e,i.displayName="Plugin",i}static async loadModulePlugin(e){return await By(e)}static async loadJson(e){return new Promise((n,s)=>{const i=new XMLHttpRequest;i.addEventListener("load",()=>{try{const o=JSON.parse(i.responseText);n(o)}catch(o){s(o)}}),i.addEventListener("error",o=>{s(o)}),i.open("GET",e),i.send()})}}const Pt=Z.module("AppMainContainer");class Xo extends w.exports.Component{constructor(e){super(e),this.getDashboardPlugins=Se(n=>[...n.entries()].filter(([,s])=>s.DashboardPlugin!=null).map(([s,{DashboardPlugin:i}])=>h(i,{},s))),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.importElement=X.createRef(),this.state={contextActions:[{action:()=>{this.handleToolSelect(Yt.LINKER)},shortcut:bs.LINKER,isGlobal:!0},{action:()=>{this.sendClearFilter()},shortcut:an.TABLE.CLEAR_ALL_FILTERS,isGlobal:!0},{action:()=>{Pt.debug("Consume unhandled save shortcut")},shortcut:bs.SAVE,isGlobal:!0}],isPanelsMenuShown:!1,isSettingsMenuShown:!1,widgets:[]}}static handleWindowBeforeUnload(e){e.preventDefault(),e.returnValue=""}static hydrateConsole(e,n){return td.hydrate({...e,unzip:s=>Tu.loadAsync(s).then(i=>Object.values(i.files))},n)}componentDidMount(){this.initWidgets(),window.addEventListener("beforeunload",Xo.handleWindowBeforeUnload)}componentDidUpdate(e){const{dashboardData:n}=this.props;e.dashboardData!==n&&this.handleDataChange(n)}componentWillUnmount(){this.deinitWidgets(),window.removeEventListener("beforeunload",Xo.handleWindowBeforeUnload)}initWidgets(){const{connection:e}=this.props;if(e.subscribeToFieldUpdates==null){Pt.warn("subscribeToFieldUpdates not supported, not initializing widgets");return}this.widgetListenerRemover=e.subscribeToFieldUpdates(n=>{Pt.debug("Got updates",n),this.setState(({widgets:s})=>{const{updated:i,created:o,removed:r}=n,l=[...i,...r],a=s.filter(c=>!l.some(u=>u.name===c.name));return[...i,...o].forEach(c=>{c.name!=null&&c.name!==""&&a.push(c)}),{widgets:a}})})}deinitWidgets(){var e;(e=this.widgetListenerRemover)==null||e.call(this)}openNotebookFromURL(){const{match:e}=this.props,{notebookPath:n}=e.params;if(n){const{session:s,sessionConfig:i}=this.props;if(s==null||i==null){Pt.error("No session available to open notebook URL",n);return}const o={id:`/${n}`,itemName:`/${n}`},r=i.type,l={value:null,language:r};this.emitLayoutEvent(Le.SELECT_NOTEBOOK,s,r,l,o,!0)}}sendClearFilter(){this.emitLayoutEvent(Pe.CLEAR_ALL_FILTERS)}emitLayoutEvent(e,...n){var s;(s=this.goldenLayout)==null||s.eventHub.emit(e,...n)}handleError(e){ye.isCanceled(e)||Pt.error(e)}handleSettingsMenuHide(){this.setState({isSettingsMenuShown:!1})}handleSettingsMenuShow(){this.setState({isSettingsMenuShown:!0})}handleControlSelect(e,n=null){switch(Pt.debug("handleControlSelect",e),e){case wn.DROPDOWN_FILTER:this.emitLayoutEvent(Pe.OPEN_DROPDOWN,{title:"DropdownFilter",type:e,createNewStack:!0,dragEvent:n});break;case wn.INPUT_FILTER:this.emitLayoutEvent(Pe.OPEN_INPUT,{title:"InputFilter",type:e,createNewStack:!0,dragEvent:n});break;case wn.MARKDOWN:this.emitLayoutEvent(sg.OPEN,{title:"Markdown",type:e,dragEvent:n});break;case wn.FILTER_SET_MANAGER:this.emitLayoutEvent(Pe.OPEN_FILTER_SET_MANAGER,{title:"FilterSets",type:e,dragEvent:n});break;default:throw new Error(`Unrecognized control type ${e}`)}}handleToolSelect(e){Pt.debug("handleToolSelect",e);const{activeTool:n,setActiveTool:s}=this.props;s(n===e?Yt.DEFAULT:e)}handleClearFilter(){this.sendClearFilter()}handleDataChange(e){const{updateWorkspaceData:n}=this.props,{closed:s,filterSets:i,links:o}=e;n({closed:s,filterSets:i,links:o})}handleGoldenLayoutChange(e){this.goldenLayout=e}handleLayoutConfigChange(e){const{updateWorkspaceData:n}=this.props;n({layoutConfig:e})}handleWidgetMenuClick(){this.setState(({isPanelsMenuShown:e})=>({isPanelsMenuShown:!e}))}handleWidgetSelect(e,n){this.setState({isPanelsMenuShown:!1}),Pt.debug("handleWidgetSelect",e,n),this.openWidget(e,n)}handleWidgetsMenuClose(){this.setState({isPanelsMenuShown:!1})}handleAutoFillClick(){const{widgets:e}=this.state;Pt.debug("handleAutoFillClick",e);const n=e.sort((s,i)=>s.title!=null&&i.title!=null?s.title.localeCompare(i.title):0);for(let s=0;s<n.length;s+=1)this.openWidget(n[s])}handleExportLayoutClick(){Pt.info("handleExportLayoutClick"),this.setState({isPanelsMenuShown:!1});try{const{workspace:e}=this.props,{data:n}=e,s=al.exportLayout(n);Pt.info("handleExportLayoutClick exportedConfig",s);const i=new Blob([JSON.stringify(s)],{type:"application/json"}),o=M.i18n.DateTimeFormat.format("yyyy-MM-dd-HHmmss",new Date),r=document.createElement("a");r.href=URL.createObjectURL(i),r.download=`deephaven-app-layout-${o}.json`,r.click()}catch(e){Pt.error("Unable to export layout",e)}}handleImportLayoutClick(){Pt.info("handleImportLayoutClick"),this.setState({isPanelsMenuShown:!1}),this.importElement.current!=null&&(this.importElement.current.value="",this.importElement.current.click())}handleResetLayoutClick(){Pt.info("handleResetLayoutClick"),this.setState({isPanelsMenuShown:!1}),this.resetLayout()}handleImportLayoutFiles(e){var n;e.stopPropagation(),e.preventDefault(),e.target.files!=null&&this.importLayoutFile((n=e.target.files)==null?void 0:n[0])}async importLayoutFile(e){try{const{updateDashboardData:n,updateWorkspaceData:s}=this.props,i=await e.text(),o=JSON.parse(i),{filterSets:r,layoutConfig:l,links:a}=al.normalizeLayout(o);s({layoutConfig:l}),n(Mn,{filterSets:r,links:a})}catch(n){Pt.error("Unable to import layout",n)}}async resetLayout(){const{layoutStorage:e,session:n}=this.props,{filterSets:s,layoutConfig:i,links:o}=await al.getDefaultLayout(e,n!==void 0),{updateDashboardData:r,updateWorkspaceData:l}=this.props;l({layoutConfig:i}),r(Mn,{filterSets:s,links:o})}handlePaste(e){if(e.target instanceof HTMLElement&&e.target.closest(".monaco-editor"))return;const{clipboardData:n}=e,s=n.getData("Text"),i=/“|”/g;i.test(s)&&(e.preventDefault(),e.stopPropagation(),document.execCommand("insertText",!1,s.replace(i,'"')))}handleLoadTablePlugin(e){const{plugins:n}=this.props,s=n.get(e);return s!=null&&s.TablePlugin!=null?s.TablePlugin:pd.loadComponentPlugin(e)}hydrateDefault(e,n){const{connection:s}=this.props,{metadata:i}=e;if((i==null?void 0:i.type)!=null&&((i==null?void 0:i.id)!=null||(i==null?void 0:i.name)!=null)){const o=i.id!=null?{type:i.type,id:i.id}:{type:i.type,name:i.name,title:i.name};return{fetch:()=>s.getObject(o),localDashboardId:n,...e}}return td.hydrate(e,n)}hydrateGrid(e,n){var s;return this.hydrateTable(e,n,(s=e.metadata.type)!=null?s:M.VariableType.TABLE)}hydratePandas(e,n){return this.hydrateTable(e,n,M.VariableType.PANDAS)}hydrateTable(e,n,s=M.VariableType.TABLE){const{connection:i}=this.props;return{...e,getDownloadWorker:Nl.getServiceWorker,loadPlugin:this.handleLoadTablePlugin,localDashboardId:n,makeModel:()=>Fy(i,e.metadata,s)}}hydrateChart(e,n){const{connection:s}=this.props;return{...e,localDashboardId:n,makeModel:()=>{const{metadata:i,panelState:o}=e;return Ny(s,i,o)}}}openWidget(e,n){const{connection:s}=this.props;this.emitLayoutEvent(De.OPEN,{dragEvent:n,fetch:()=>s.getObject(e),widget:e})}render(){const{activeTool:e,plugins:n,user:s,workspace:i,serverConfigValues:o}=this.props,{data:r}=i,{layoutConfig:l}=r,{permissions:a}=s,{canUsePanels:d}=a,{contextActions:c,isPanelsMenuShown:u,isSettingsMenuShown:m,widgets:p}=this.state,g=this.getDashboardPlugins(n);return T("div",{className:z("app-main-tabs","w-100","h-100","d-flex","flex-column",e?`active-tool-${e.toLowerCase()}`:""),onPaste:this.handlePaste,tabIndex:-1,children:[h("nav",{className:"nav-container",children:T("div",{className:"app-main-top-nav-menus",children:[h("img",{src:yg,alt:"Deephaven Data Labs",width:"115px",className:"ml-1"}),T("div",{children:[T(W,{kind:"ghost",className:"btn-panels-menu",icon:gb,onClick:()=>{},children:["Controls",h(Mc,{handleControlSelect:this.handleControlSelect,handleToolSelect:this.handleToolSelect,onClearFilter:this.handleClearFilter})]}),d&&T(W,{kind:"ghost",className:"btn-panels-menu btn-show-panels","data-testid":"app-main-panels-button",onClick:this.handleWidgetMenuClick,icon:hb,children:["Panels",h(kn,{isShown:u,className:"panels-menu-popper",onExited:this.handleWidgetsMenuClose,closeOnBlur:!0,interactive:!0,children:h(My,{widgets:p,onExportLayout:this.handleExportLayoutClick,onImportLayout:this.handleImportLayoutClick,onResetLayout:this.handleResetLayoutClick,onSelect:this.handleWidgetSelect})})]}),h(W,{kind:"ghost",className:z("btn-settings-menu",{"text-warning":s.operateAs!==s.name}),onClick:this.handleSettingsMenuShow,icon:h(ee,{icon:sr,transform:"grow-3 right-1 down-1"}),tooltip:"User Settings"})]})]})}),T(Ev,{emptyDashboard:h(xy,{onAutoFillClick:this.handleAutoFillClick}),id:Mn,layoutConfig:l,onGoldenLayoutChange:this.handleGoldenLayoutChange,onLayoutConfigChange:this.handleLayoutConfigChange,onLayoutInitialized:this.openNotebookFromURL,hydrate:this.hydrateDefault,children:[h(k2,{hydrate:this.hydrateGrid,getDownloadWorker:Nl.getServiceWorker,loadPlugin:this.handleLoadTablePlugin}),h(D2,{hydrate:this.hydrateChart}),h(M2,{}),h(F2,{hydrateConsole:Xo.hydrateConsole,notebooksUrl:new URL("/notebooks/",`${window.location}`).href}),h(x2,{}),h(B2,{hydrate:this.hydratePandas}),h(U2,{}),h(V2,{}),g]}),h(mt,{in:m,timeout:ze.transitionMidMs,classNames:"slide-left",mountOnEnter:!0,unmountOnExit:!0,children:h(bo,{serverConfigValues:o,onDone:this.handleSettingsMenuHide})}),h(ae,{actions:c}),h("input",{ref:this.importElement,type:"file",accept:".json",style:{display:"none"},onChange:this.handleImportLayoutFiles})]})}}const zy=t=>{var e,n;return{activeTool:ql(t),dashboardData:Zt(t,Mn),layoutStorage:Ry(t),plugins:D0(t),connection:P1(t,Mn),session:(e=wi(t,Mn))==null?void 0:e.session,sessionConfig:(n=wi(t,Mn))==null?void 0:n.config,user:xm(t),workspace:Kl(t),serverConfigValues:Dy(t)}},Wy=It(zy,{setActiveTool:Xl,updateDashboardData:ts,updateWorkspaceData:jm})(Ef(Xo));function Gy(){return T("div",{className:"app",children:[h(Wy,{}),h(Wu,{})]})}const Ky=Z.module("LocalWorkspaceStorage"),zo=class{static async makeDefaultWorkspaceData(t,e){const{filterSets:n,links:s,layoutConfig:i}=await al.getDefaultLayout(t,e==null?void 0:e.isConsoleAvailable);return{settings:{defaultDateTimeFormat:st.DEFAULT_DATETIME_FORMAT_STRING,formatter:[],timeZone:st.DEFAULT_TIME_ZONE_ID,showTimeZone:!1,showTSeparator:!0,disableMoveConfirmation:!1,defaultDecimalFormatOptions:{defaultFormatString:_e.DEFAULT_FORMAT_STRING},defaultIntegerFormatOptions:{defaultFormatString:Qe.DEFAULT_FORMAT_STRING},truncateNumbersWithPound:!1,defaultNotebookSettings:{isMinimapEnabled:!1}},layoutConfig:i,closed:[{}],links:s,filterSets:n}}static async makeDefaultWorkspace(t,e){return{data:await zo.makeDefaultWorkspaceData(t,e)}}constructor(t){this.layoutStorage=t}async load(t){var e;try{return JSON.parse((e=localStorage.getItem(zo.STORAGE_KEY))!=null?e:"")}catch{return Ky.info("Unable to load workspace data, initializing to default data"),zo.makeDefaultWorkspace(this.layoutStorage,t)}}async save(t){return localStorage.setItem(zo.STORAGE_KEY,JSON.stringify(t)),t}};let Ag=zo;Ag.STORAGE_KEY="deephaven.WorkspaceStorage";class qy extends Error{constructor(){super(...arguments),this.isNoConsolesError=!0}}function Yy(t){return t.isNoConsolesError}const zs=Z.module("SessionUtils");var Pg=(t=>(t.ANONYMOUS="anonymous",t.PARENT="parent",t))(Pg||{});function Xy(){return new URL("/jsapi",`${window.location}`)}function Hg(){const t=Xy();return`${t.protocol}//${t.host}`}function jy(){switch(new URLSearchParams(window.location.search).get("authProvider")){case"parent":return"parent";default:return"anonymous"}}function Zy(){const t=Hg();return zs.info(`Starting connection to '${t}'...`),new M.IdeConnection(t)}async function Qy(t){zs.info("Getting console types...");const e=await t.getConsoleTypes();if(zs.info("Available types:",e),e.length===0)throw new qy("No console types available");const n=e[0];zs.info("Starting session with type",n);const s=await t.startSession(n),i={type:n,id:We.generate()};return zs.info("Console session established",i),{session:s,config:i,connection:t}}function Jy(){const t=Hg();return zs.info("createCoreClient",t),new M.CoreClient(t)}async function eI(){if(window.opener==null)throw new Error("window.opener is null, unable to send auth request.");return new Promise(t=>{const e=n=>{const{data:s}=n;if(zs.debug("Received message",s),(s==null?void 0:s.message)!=="loginOptions"){zs.debug("Ignore received message",s);return}window.removeEventListener("message",e),t(s.payload)};window.addEventListener("message",e),window.opener.postMessage("requestLoginOptionsFromParent","*")})}async function tI(t){switch(t){case"parent":return eI();case"anonymous":return{type:M.CoreClient.LOGIN_TYPE_ANONYMOUS};default:throw new Error(`Unknown auth type: ${t}`)}}class nI{constructor(e,n=""){this.storageService=e,this.root=n}async getLayouts(){return(await this.storageService.listItems(this.root,"*.json")).map(n=>n.basename)}async getLayout(e){const s=await(await this.storageService.loadFile(`${this.root}/${e}`)).text();return JSON.parse(s)}}const Lo=Z.module("GrpcFileStorageTable"),gd=class{constructor(t,e="",n=e){this.currentSize=0,this.listeners=[],this.childTables=new Map,this.storageService=t,this.baseRoot=e,this.root=n,n===e&&(this.doRefresh=Ze(this.doRefresh.bind(this),gd.REFRESH_DEBOUNCE))}removeBaseRoot(t){return pe.removeRoot(this.baseRoot,t)}getViewportData(){var t;return this.viewportUpdatePromise||this.refreshInternal(),(t=this.viewportUpdatePromise)!=null?t:Promise.resolve({items:[],offset:0})}getSnapshot(t){throw new Error("Method not implemented.")}get size(){return this.currentSize}setExpanded(t,e){const n=t.split("/");let s=n.shift();if((s===void 0||s==="")&&(s=n.shift()),s===void 0||s==="")throw new Error(`Invalid path: ${t}`);const i=n.join("/");if(e){if(!this.childTables.has(s)){const o=new gd(this.storageService,this.baseRoot,`${this.root}/${s}`);this.childTables.set(s,o)}if(i){const o=this.childTables.get(s);o==null||o.setExpanded(i,e)}}else if(this.childTables.has(s))if(i){const o=this.childTables.get(s);o==null||o.setExpanded(i,e)}else this.childTables.delete(s);this.currentViewport&&this.refreshInternal()}collapseAll(){this.childTables.clear(),this.currentViewport&&this.refreshInternal()}setSearch(t){throw new Error("Method not implemented.")}setViewport(t){this.currentViewport=t,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(t){return this.listeners=[...this.listeners,t],()=>{this.listeners=this.listeners.filter(e=>e!==t)}}doRefresh(t){Lo.debug2("doRefresh",this.root),t(this.fetchData())}refresh(){var n;Lo.debug2("refresh",this.root),(n=this.viewportUpdatePromise)==null||n.cancel();const t=new Promise(s=>{this.doRefresh(s)}),e=ye.makeCancelable(t.then(s=>{if(this.viewportUpdatePromise!==e)throw new Qi;return this.currentViewportData=s,this.sendUpdate(),s}));e.catch(s=>{ye.isCanceled(s)||Lo.error("Error updating viewport",s)}),this.viewportUpdatePromise=e}refreshInternal(){try{this.refresh()}catch(t){ye.isCanceled(t)||Lo.error("Unable to refresh data",t)}}async fetchData(){const{currentViewport:t}=this;if(!t)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:r}=i;if(r===this.removeBaseRoot(`${this.root}/${o}`)&&i.type==="directory"){const l=this.childTables.get(o);if(l!=null){l.setViewport({top:0,bottom:t.bottom-s});const a=await l.getViewportData();n.splice(s+1,0,...a.items)}}}return this.currentSize=n.length,Lo.debug2(this.root,"items",n,t),n=n.slice(t.top,t.bottom),{items:n,offset:t.top}}sendUpdate(){var n;const{listeners:t}=this,e=(n=this.currentViewportData)!=null?n:{items:[],offset:0};for(let s=0;s<t.length;s+=1)t[s](e)}};let Vg=gd;Vg.REFRESH_DEBOUNCE=50;const sI=Z.module("GrpcFileStorage"),Ug=class{constructor(t,e=""){this.tables=[],this.refreshTables=Qn(()=>{this.tables.forEach(n=>n.refresh())},Ug.REFRESH_THROTTLE),this.storageService=t,this.root=e}removeRoot(t){return pe.removeRoot(this.root,t)}addRoot(t){return pe.addRoot(this.root,t)}async createDirectory(t){return await this.storageService.createDirectory(this.addRoot(t)),this.refreshTables(),{type:"directory",id:t,filename:t,basename:pe.getBaseName(t)}}async getTable(){const t=new Vg(this.storageService,this.root);return this.tables.push(t),t}async saveFile(t){const e=dh.storage.FileContents.text(t.content);return await this.storageService.saveFile(this.addRoot(t.filename),e,!0),this.refreshTables(),t}async loadFile(t){const n=await(await this.storageService.loadFile(this.addRoot(t))).text();return{filename:t,basename:pe.getBaseName(t),content:n}}async deleteFile(t){await this.storageService.deleteItem(this.addRoot(t)),this.refreshTables()}async moveFile(t,e){await this.storageService.moveItem(this.addRoot(t),this.addRoot(e)),this.refreshTables()}async info(t){const e=await this.storageService.listItems(this.addRoot(pe.getPath(t)),pe.getBaseName(t));if(e.length===0)throw new Sc;if(e.length>1)throw sI.error("More than one matching file found, should never happen.",e),new Error("More than one matching file found");const n=e[0];return{filename:this.removeRoot(n.filename),basename:n.basename,id:this.removeRoot(n.filename),type:n.type}}};let Bg=Ug;Bg.REFRESH_THROTTLE=150;const Ws=Z.module("AppInit");async function iI(){Ws.debug("Loading plugins...");try{const t=await pd.loadJson("/js-plugins/manifest.json");Ws.debug("Plugin manifest loaded:",t);const e=[];for(let i=0;i<t.plugins.length;i+=1){const{name:o,main:r}=t.plugins[i],l=`/js-plugins/${o}/${r}`;e.push(pd.loadModulePlugin(l))}const n=await Promise.all(e),s=new Map;for(let i=0;i<n.length;i+=1){const{name:o}=t.plugins[i];s.set(o,n[i])}return Ws.info("Plugins loaded:",s),s}catch(t){return Ws.error("Unable to load plugins:",t),new Map}}async function oI(t){let e;try{e=await Qy(t)}catch(n){if(!Yy(n))throw n}return e}function Nc(t){const{workspace:e,setActiveTool:n,setCommandHistoryStorage:s,setDashboardData:i,setFileStorage:o,setLayoutStorage:r,setDashboardConnection:l,setDashboardSessionWrapper:a,setPlugins:d,setUser:c,setWorkspace:u,setWorkspaceStorage:m,setServerConfigValues:p}=t,[g,f]=w.exports.useState(),[b,C]=w.exports.useState(!0),S=w.exports.useCallback(async()=>{var R,N;try{Ws.info("Initializing Web UI","0.27.0",navigator.userAgent);const F=Jy(),P=jy();Ws.info(`Login using auth type ${P}...`),await F.login(await tI(P));const H=await iI(),x=await(P===Pg.ANONYMOUS&&F.getAsIdeConnection==null?Zy():F.getAsIdeConnection());x.addEventListener(M.IdeConnection.HACK_CONNECTION_FAILURE,He=>{var Ve;const{detail:lt}=He;Ws.error("Connection failure",`${JSON.stringify(lt)}`),f(`Unable to connect: ${(Ve=lt.details)!=null?Ve:"Unknown Error"}`)});const A=await oI(x),k="user",G=F.getStorageService(),V=new nI(G,"/layouts"),O=new Bg(G,"/notebooks"),$=new Ag(V),Y=new J2,Q=await $.load({isConsoleAvailable:A!==void 0}),{data:U}=Q,{settings:q}=U;q.defaultDecimalFormatOptions===void 0&&(q.defaultDecimalFormatOptions={defaultFormatString:_e.DEFAULT_FORMAT_STRING}),q.defaultIntegerFormatOptions===void 0&&(q.defaultIntegerFormatOptions={defaultFormatString:Qe.DEFAULT_FORMAT_STRING}),q.truncateNumbersWithPound===void 0&&(q.truncateNumbersWithPound=!1);const{shortcutOverrides:j={}}=q,ce=Kt.isMacPlatform?(R=j.mac)!=null?R:{}:(N=j.windows)!=null?N:{};Object.entries(ce).forEach(([He,lt])=>{var Ve;(Ve=Ae.get(He))==null||Ve.setKeyState(lt)});const ne={filterSets:U.filterSets,links:U.links},he=await F.getServerConfigValues(),Ce=new Map(he),Re={name:k,operateAs:k,groups:[],permissions:{isSuperUser:!1,isQueryViewOnly:!1,isNonInteractive:!1,canUsePanels:!0,canCreateDashboard:!0,canCreateCodeStudio:!0,canCreateQueryMonitor:!0,canCopy:Ce.get("internal.webClient.appInit.canCopy")!=="false",canDownloadCsv:Ce.get("internal.webClient.appInit.canDownloadCsv")!=="false"}};n(Yt.DEFAULT),p(Ce),s(Y),i(Mn,ne),o(O),r(V),l(Mn,x),A!==void 0&&a(Mn,A),d(H),c(Re),m($),u(Q)}catch(F){Ws.error(F),f(F)}},[n,s,i,o,r,l,a,d,c,u,m,p]),v=w.exports.useCallback(()=>{document.fonts!=null?document.fonts.ready.then(()=>{C(!1)}):C(!1)},[]);w.exports.useEffect(function(){S(),v()},[S,v]);const y=e==null&&g==null||b,E=!y&&g==null,I=g!=null?`${g}`:null;return T(Te,{children:[E&&h(Gy,{}),h(Vl,{isLoading:y,isLoaded:E,errorMessage:I}),T("div",{id:"preload-fonts",style:{visibility:"hidden",position:"absolute",top:-1e4},children:[h("p",{className:"fira-sans-regular",children:"preload"}),h("p",{className:"fira-sans-semibold",children:"preload"}),h("p",{className:"fira-mono",children:"preload"})]})]})}Nc.propTypes={workspace:D.exports.shape({}),workspaceStorage:D.exports.shape({close:D.exports.func}),setActiveTool:D.exports.func.isRequired,setCommandHistoryStorage:D.exports.func.isRequired,setDashboardData:D.exports.func.isRequired,setFileStorage:D.exports.func.isRequired,setLayoutStorage:D.exports.func.isRequired,setDashboardConnection:D.exports.func.isRequired,setDashboardSessionWrapper:D.exports.func.isRequired,setPlugins:D.exports.func.isRequired,setUser:D.exports.func.isRequired,setWorkspace:D.exports.func.isRequired,setWorkspaceStorage:D.exports.func.isRequired};Nc.defaultProps={workspace:null,workspaceStorage:null};const rI=t=>({workspace:Kl(t),workspaceStorage:y0(t)}),fu=It(rI,{setActiveTool:Xl,setCommandHistoryStorage:F0,setDashboardData:wp,setFileStorage:x0,setLayoutStorage:ey,setDashboardConnection:H1,setDashboardSessionWrapper:V1,setPlugins:k0,setUser:M0,setWorkspace:Xm,setWorkspaceStorage:N0,setServerConfigValues:O0})(Nc);function lI(){return h(yf,{basename:"/ide/",children:T(If,{children:[h(Hc,{exact:!0,path:"/",component:fu}),h(Hc,{path:"/notebook/:notebookPath+",component:fu}),h(Rf,{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 aI(){"serviceWorker"in navigator&&navigator.serviceWorker.getRegistrations().then(t=>{t.forEach(e=>{e.scope.endsWith("/download/")||e.unregister()})})}gy();bi.render(h(Su,{store:jl,children:h(lI,{})}),document.getElementById("root"));aI();Nl.registerOnLoaded();rt.init({getWorker:()=>new Mf});window["__react-beautiful-dnd-disable-dev-warnings"]=!0;
47
+ //# sourceMappingURL=index.a4955cea.js.map