@deephaven/code-studio 0.19.2-beta.4 → 0.20.0
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,44 @@
|
|
|
1
|
+
import{A as R,z as S,R as Y,P as Up,B as h,C as ht,D as W,E as v,F as hi,G as il,H as Te,I as Xe,J as q,K as he,L as ze,M as Bp,N as $p,O as ol,Q as ko,S as Wp,T as zp,U as ge,V as Ca,W as ui,X as Wh,Y as ct,Z as Ya,_ as Gp,$ as Kp,a0 as qp,a1 as Yp,a2 as ce,a3 as hc,a4 as Xa,a5 as Xp,a6 as jp,a7 as zh,a8 as Lo,a9 as At,aa as ba,ab as uc,ac as Mt,ad as Gh,ae as Qp,af as Zp,ag as Kh,ah as Jp,ai as eg,aj as tg,ak as ng,al as sg,am as qh,an as ig,ao as og,ap as rg,aq as mc,ar as lg}from"./vendor.222459d5.js";import{e as ds,W as ag,l as Ri,K as gn,a as pc,b as Bn,_ as dg}from"./monaco.1292e04e.js";import{P as Hr,b as cg,h as hg,p as ug,o as mg,s as pg,t as gg,c as Ql}from"./plotly.14964292.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 fg="#1a171a",Cg="#f0f0ee",bg="#fcd65b",Sg="#9edc6f",wg="#76d9e4",vg="#aa9af4",Tg="#f37e3f",Eg="#f95d84",yg="#4878ea",Ig="#5b5a5c",Rg="#9edc6f",Dg="#fcd65b",Mg="#f37e3f",Ng="#f95d84",Fg="#fcfcfa",xg="#929192",_g="#373438",kg="#f0f0ee",Lg="#1a171a",Og="#2d2a2e",Ag="#1a171a",Pg="#f0f0ee",Hg="0.15s",Vg={"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:fg,white:Cg,yellow:bg,green:Sg,blue:wg,purple:vg,orange:Tg,red:Eg,primary:yg,"primary-hover":"#235de6","primary-dark":"#343e5d",secondary:Ig,success:Rg,info:Dg,warning:Mg,danger:Ng,light:Fg,mid:xg,dark:_g,"text-muted":"#929192",interfacewhite:kg,interfaceblack:Lg,interfacegray:Og,"content-bg":"#2d2a2e",background:Ag,foreground:Pg,transition:Hg},Tt=Object.freeze({transitionMs:150,transitionMidMs:200,transitionLongMs:300,transitionSlowMs:1e3,...Vg});class Fn extends S.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=Y.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",...i},document.body.appendChild(this.element);let o=this.getVisibleElement(this.container.current);o==null&&(o=this.container.current),e=new Up(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(ht,{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:W("popper",{interactive:i},e),onBlur:o?this.handleBlur:void 0,tabIndex:o?-1:void 0,role:"presentation",children:v("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&&hi.createPortal(this.renderContent(),this.element)})}}Fn.propTypes={children:R.exports.node.isRequired,options:R.exports.shape({}),className:R.exports.string,timeout:R.exports.number,onEntered:R.exports.func,onExited:R.exports.func,isShown:R.exports.bool,closeOnBlur:R.exports.bool,interactive:R.exports.bool,referenceObject:R.exports.shape({}),"data-testid":R.exports.string};Fn.defaultProps={options:{},className:"",timeout:Tt.transitionMs,onEntered(){},onExited(){},isShown:!1,interactive:!1,closeOnBlur:!1,referenceObject:null,"data-testid":void 0};const Ug=-1,Yh=0,Xh=1,ja=2,jh=3,Qh=4;Object.freeze({SILENT:Ug,ERROR:Yh,WARN:Xh,INFO:ja,DEBUG:jh,DEBUG2:Qh});const vn=()=>{};class gc{constructor(e,n){this.name=e,this.prefix=e!=null?`[${e}]`:"",this.error=vn,this.warn=vn,this.log=vn,this.info=vn,this.debug=vn,this.debug2=vn,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>=Yh?console.error.bind(console,this.prefix):vn,this.warn=e>=Xh?console.warn.bind(console,this.prefix):vn,this.log=e>=ja?console.log.bind(console,this.prefix):vn,this.info=this.log,this.debug=e>=jh?console.debug.bind(console,this.prefix):vn,this.debug2=e>=Qh?console.debug.bind(console,this.prefix):vn}}class Bg extends gc{constructor(e=ja){super(null,e),this.modules={}}module(e){return this.modules[e]==null&&(this.modules[e]=new gc(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 X=new Bg;var kt=(t=>(t.DEBUG="D",t.LOG="L",t.WARN="W",t.ERROR="E",t.UNCAUGHT_ERROR="U",t))(kt||{});function ro(t,e){return new CustomEvent(t,{detail:e})}class $g{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 il}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),X.setLogLevel(X.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),X.setLogLevel(X.level),this.isEnabled=!1)}addEventListener(e,n){this.eventTarget.addEventListener(e,n)}removeEventListener(e,n){this.eventTarget.removeEventListener(e,n)}}class Vr{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 kt.ERROR:s=s.splice(e[0]==="Error"?4:3);break;case kt.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(kt.DEBUG,this.addHistory),this.proxy.addEventListener(kt.LOG,this.addHistory),this.proxy.addEventListener(kt.WARN,this.addHistory),this.proxy.addEventListener(kt.ERROR,this.addHistory),this.proxy.addEventListener(kt.UNCAUGHT_ERROR,this.addHistory),this.isEnabled=!0)}disable(){!this.isEnabled||(this.proxy.removeEventListener(kt.DEBUG,this.addHistory),this.proxy.removeEventListener(kt.LOG,this.addHistory),this.proxy.removeEventListener(kt.WARN,this.addHistory),this.proxy.removeEventListener(kt.ERROR,this.addHistory),this.proxy.removeEventListener(kt.UNCAUGHT_ERROR,this.addHistory),this.isEnabled=!1)}addHistory({type:e,detail:n}){const s={type:e,messages:n,time:new Date};switch(e){case kt.ERROR:case kt.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} ${Vr.formatMessages(n.messages)}`+(n.stack!=null?`
|
|
4
|
+
${Vr.formatStack(n.stack,n.type)}`:"")).join(`
|
|
5
|
+
`)}}const Wg=X.module("Tooltip"),en=class extends S.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=Y.createRef(),this.popper=Y.createRef(),this.parent=null,this.timer=null,this.state={isShown:!1}}static handleHidden(){en.shownTooltipCount-=1,en.shownTooltipCount===0&&(en.lastHiddenTime=Date.now())}static handleShown(){en.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?en.handleShown():en.handleHidden())}componentWillUnmount(){this.stopListening(),this.stopListeningWindow(),this.stopTimer();const{isShown:t}=this.state;t&&en.handleHidden()}startListening(){if(!this.container.current||!this.container.current.parentElement){Wg.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;(en.shownTooltipCount>0||Date.now()-en.lastHiddenTime<en.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,options:n,referenceObject:s,popperClassName:i,"data-testid":o,onEntered:r}=this.props,{isShown:l}=this.state;return h("div",{ref:this.container,style:{display:"none"},"data-testid":o,children:h(Fn,{className:W(i),options:n,ref:this.popper,onEntered:r,onExited:this.handleExited,interactive:t,referenceObject:s,children:v("div",{className:"tooltip-content",children:[" ",l&&e]})})})}};let Ie=en;Ie.defaultTimeout=500;Ie.defaultReshowTimeout=100;Ie.triggerReshowThreshold=300;Ie.shownTooltipCount=0;Ie.lastHiddenTime=Date.now();Ie.defaultProps={interactive:!1,options:{},popperClassName:"",reshowTimeout:en.defaultReshowTimeout,timeout:en.defaultTimeout,onEntered:()=>{},onExited:()=>{},"data-testid":void 0};const zg=100;var Zh=(t=>(t.UP="UP",t.DOWN="DOWN",t))(Zh||{});const qs=class extends S.exports.Component{constructor(t){super(t),this.getCachedFilteredOptions=Te((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=Xe(this.updateInputValue,zg),this.handleOptionClick=this.handleOptionClick.bind(this),this.handleMenuOpened=this.handleMenuOpened.bind(this),this.handleMenuExited=this.handleMenuExited.bind(this),this.popper=Y.createRef(),this.cbContainer=Y.createRef(),this.menuContainer=Y.createRef(),this.input=Y.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(qs.MENU_NAVIGATION_DIRECTION.UP);break;case"ArrowDown":t.stopPropagation(),t.preventDefault(),this.navigateMenu(qs.MENU_NAVIGATION_DIRECTION.DOWN);break;case"Tab":if(t.stopPropagation(),t.preventDefault(),t.shiftKey){this.navigateMenu(qs.MENU_NAVIGATION_DIRECTION.UP);break}this.navigateMenu(qs.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===qs.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===qs.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:W("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:W("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 v("div",{className:"aci-container",ref:this.cbContainer,children:[h("input",{value:l||i,className:W("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(Fn,{ref:this.popper,options:d,className:W("aci-options-popper interactive"),onEntered:this.handleMenuOpened,onExited:this.handleMenuExited,children:this.renderMenuElement()})]})}};let Qa=qs;Qa.propTypes={options:R.exports.arrayOf(R.exports.shape({title:R.exports.string.isRequired,value:R.exports.string.isRequired})).isRequired,popperOptions:R.exports.shape({}),onChange:R.exports.func,inputPlaceholder:R.exports.string,disabled:R.exports.bool,className:R.exports.string,defaultTitle:R.exports.string,spellCheck:R.exports.bool,onEnter:R.exports.func,noMatchText:R.exports.string,"data-testid":R.exports.string};Qa.defaultProps={onChange(){},inputPlaceholder:"",disabled:!1,className:"",defaultTitle:"",popperOptions:null,spellCheck:!0,onEnter(){},noMatchText:"No matching items found","data-testid":void 0};Qa.MENU_NAVIGATION_DIRECTION=Zh;R.exports.string.isRequired,R.exports.func.isRequired,R.exports.string,R.exports.string,R.exports.bool,R.exports.bool,R.exports.string,R.exports.string,R.exports.string;const rl=t=>{const{children:e,className:n,style:s,"data-testid":i}=t;return h("div",{className:W("btn-group",n),style:s,role:"group","data-testid":i,children:e})};rl.displayName="ButtonGroup";rl.propTypes={children:R.exports.node.isRequired,className:R.exports.string,style:R.exports.object,"data-testid":R.exports.string};rl.defaultProps={className:null,style:{},"data-testid":void 0};const Gg=["primary","secondary","tertiary","success","danger","inline","ghost"],Kg=["group-end"];function qg(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 W("btn-link",{"btn-link-icon":e,"btn-link-icon-only":e})}}function Yg(t){switch(t){case"group-end":return W("pl-2","pr-3")}}const Q=Y.forwardRef((t,e)=>{const{kind:n,variant:s,type:i,tooltip:o,icon:r,disabled:l,active:a,onClick:d,onMouseDown:c,onMouseUp:u,className:m,style:p,children:g,tabIndex:f,"data-testid":b,"aria-label":C}=t,w=Boolean(r&&g==null),T=qg(n,w);let E;s&&(E=Yg(s));let y;r&&(y=Y.isValidElement(r)?r:h(q,{icon:r}));let I;o!==void 0&&(I=typeof o=="string"?h(Ie,{children:o}):o);let D=C;C===void 0&&w&&o!=null&&typeof o=="string"&&(D=o);const N=v("button",{"data-testid":b,ref:e,type:i,className:W("btn",T,E,{active:a},m),onClick:d,onMouseUp:u,onMouseDown:c,style:p,disabled:l,tabIndex:f,"aria-label":D,children:[r&&y,g,o!=null&&(l===void 0||!l)&&I]});return l!==void 0&&l?v("span",{className:"btn-disabled-wrapper",children:[N,o!==void 0&&I]}):N});Q.displayName="Button";Q.propTypes={kind:R.exports.oneOf(Gg).isRequired,variant:R.exports.oneOf(Kg),type:R.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&&!Y.isValidElement(n)&&(n==null||n.iconName===""||n.iconName==null)?new Error("Icon must be react element or fontawesome IconDefinition"):null},disabled:R.exports.bool,active:R.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},onMouseUp:R.exports.func,onMouseDown:R.exports.func,tabIndex:R.exports.number,children:R.exports.node,className:R.exports.string,style:R.exports.object,"data-testid":R.exports.string};Q.defaultProps={type:"button",onClick:void 0,onMouseUp:void 0,onMouseDown:void 0,variant:void 0,tooltip:void 0,icon:void 0,disabled:!1,active:void 0,tabIndex:void 0,children:void 0,className:void 0,style:{},"data-testid":void 0};const Oo=({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=S.exports.useRef(),m=S.exports.useCallback(g=>{switch(g.key){case"Escape":d==null||d();break}},[d]);S.exports.useEffect(function(){if(i&&s)return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[m,i,s]),S.exports.useEffect(function(){i&&l&&l()},[l,i]),S.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 p=()=>{u.current&&(document.body.removeChild(u.current),u.current=void 0)};return u.current?hi.createPortal(v(he,{children:[h(ht,{appear:!0,mountOnEnter:!0,unmountOnExit:!0,in:i,classNames:{appearActive:"show",appearDone:"show"},timeout:Tt.transitionMs,onExited:p,children:h("div",{className:W("modal-backdrop fade"),style:{zIndex:1050}})}),h(ht,{appear:!0,mountOnEnter:!0,unmountOnExit:!0,in:i,classNames:{appearDone:"show"},timeout:Tt.transitionMs,onExited:p,children:h("div",{className:"modal fade",onClick:d,role:"dialog",style:{display:"block"},children:h("div",{className:W(`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",onClick:g=>g.stopPropagation(),role:"presentation","data-testid":c,children:e})})})})]}),u.current):h(he,{})},Ao=({className:t="modal-body",style:e,children:n,"data-testid":s})=>h("div",{className:t,"data-testid":s,style:e,children:n}),Po=({className:t,children:e,closeButton:n=!0,style:s,toggle:i,"data-testid":o})=>v("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"})})]}),Za=({className:t="modal-footer",children:e,"data-testid":n})=>h("div",{className:t,"data-testid":n,children:e}),Hi=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=S.exports.useRef(null),g=S.exports.useRef(null),f=S.exports.useCallback(()=>{g.current!==null&&g.current.checked&&l&&l(),o()},[o,l]);let b="";return e&&(b=typeof s=="function"?s():s),v(Oo,{isOpen:e,className:"theme-bg-light",onOpened:()=>{var C;(C=p.current)==null||C.focus()},children:[h(Po,{closeButton:!1,children:n}),h(Ao,{children:b}),v(Za,{children:[l&&v("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(Q,{kind:"secondary",className:"mr-auto","data-dismiss":"modal",onClick:r,"data-testid":m!==void 0?`${m}-btn-discard`:void 0,children:c}),i&&h(Q,{kind:"secondary","data-dismiss":"modal",onClick:i,"data-testid":m!==void 0?`${m}-btn-cancel`:void 0,children:a}),v(rl,{children:[h(Q,{kind:"primary",onClick:f,ref:p,"data-testid":m!==void 0?`${m}-btn-confirm`:void 0,children:d}),u]})]})]})};Hi.propTypes={isOpen:R.exports.bool.isRequired,headerText:R.exports.string.isRequired,bodyText:R.exports.oneOfType([R.exports.string,R.exports.func]).isRequired,onCancel:R.exports.func,onConfirm:R.exports.func.isRequired,onDiscard:R.exports.func,onModalDisable:R.exports.func,cancelButtonText:R.exports.string,confirmButtonText:R.exports.string,discardButtonText:R.exports.string,children:R.exports.node,"data-testid":R.exports.string};Hi.defaultProps={children:void 0,cancelButtonText:"Cancel",confirmButtonText:"Okay",discardButtonText:"Discard",onCancel:void 0,onDiscard:void 0,onModalDisable:void 0,"data-testid":void 0};const Vi=Y.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:W("btn",s),onClick:o,style:r,disabled:i,id:l,children:n})});Vi.displayName="Button";Vi.propTypes={children:R.exports.node,className:R.exports.string,disabled:R.exports.bool,onClick:R.exports.func,style:R.exports.shape({}),id:R.exports.string};Vi.defaultProps={children:null,className:"",disabled:!1,onClick:()=>null,style:{},id:""};const Ja=({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=S.exports.useRef(null),r=S.exports.useCallback(a=>{a.target===a.currentTarget&&document.body.classList.add("card-flip--is-flipping")},[]),l=S.exports.useCallback(a=>{a.target===a.currentTarget&&document.body.classList.remove("card-flip--is-flipping")},[]);return S.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]),v("div",{className:W(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 Zl(t){return t.then!==void 0}const Ms=class{static disableAllActions(){Ms.actionsDisabled=!0}static enableAllActions(){Ms.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(Ms.compareActions),e}static isMacPlatform(){const{platform:t}=window.navigator;return t.startsWith("Mac")}static getModifierKey(){return Ms.isMacPlatform()?"metaKey":"ctrlKey"}static isModifierKeyDown(t){const e=Ms.getModifierKey();return t[e]}static copyToClipboard(t){const{clipboard:e}=navigator;return e===void 0?(Ms.copyToClipboardExecCommand(t),Promise.resolve()):navigator.clipboard.writeText(t).catch(()=>{Ms.copyToClipboardExecCommand(t)})}static copyToClipboardExecCommand(t){const e=document.activeElement,n=document.createElement("textarea");if(n.value=t,document.body.appendChild(n),n.focus(),n.select(),!document.execCommand("copy"))throw new Error("Unable to execute copy command");document.body.removeChild(n),e instanceof HTMLElement&&e.focus()}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||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 Ne=Ms;Ne.actionsDisabled=!1;const fc=X.module("GlobalContextAction");class Xg extends S.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),fc.debug("Received context menu event at global action! Menu items are now: ",n.contextActions))}handleKeyDown(e){var s;const{action:n}=this.props;!Ne.actionsDisabled&&n.shortcut!==void 0&&n.shortcut.matchesEvent(e)&&(fc.debug("Global hotkey matched!",e),(s=n.action)==null||s.call(n,e),e.preventDefault(),e.stopPropagation())}render(){return null}}class jg extends S.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(Xg,{action:o,"data-testid":n},`${o.title}.${r==null?void 0:r.id}`);s.push(l)}}return s}}const cr=X.module("ContextActions");class ie extends S.exports.Component{constructor(e){super(e),this.handleContextMenu=this.handleContextMenu.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.container=Y.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=>!Zl(i)&&typeof i!="function"&&i.isGlobal),s=e.actions.filter(i=>!Zl(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){cr.debug2(`Contextmenu event ignored based on the target className "${r}"`);return}i=i.parentElement}}if(Ne.isContextActionEvent(e)||(e.contextActions=[]),!Ne.isContextActionEvent(e))return;const{actions:s}=this.props;if(s!=null){let i=s;Array.isArray(i)&&(i=i.filter(o=>Zl(o)||typeof o=="function"||o.isGlobal===void 0||!o.isGlobal)),e.contextActions=e.contextActions.concat(i)}cr.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];!Ne.actionsDisabled&&o.shortcut!=null&&o.shortcut.matchesEvent(e)&&(cr.debug("Context hotkey matched!",e),(s=o.action)==null||s.call(o,e),e.stopPropagation(),e.preventDefault(),cr.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(jg,{actions:n})})}}ie.groups={default:null,high:100,medium:5e3,low:1e4,global:1e5,edit:100};var Qg={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"]},Cc={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"]},Sa={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"]},Zg={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"]},li={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"]},Jg={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"]},ef={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"]},Jh={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"]},tf={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"]},Fo={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"]},nf={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"]},sf={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"]},bc={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"]},Ho={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"]},of={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"]},rf={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"]},ed={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"]},wa={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"]},ll={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"]},Sc={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"]},lf={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"]},af={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"]},Ur={prefix:"vs",iconName:"filter",icon:[512,512,[],"f000","M480 64v53.44l-160 152.288V448H192V269.728l-160 -152.32V64h448zM224 256v160h64V256l160 -152.32V96H64v7.68L224 256z"]},df={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"]},cf={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"]},Vo={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"]},eu={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"]},al={prefix:"vs",iconName:"gripper",icon:[512,512,[],"f000","M160 96h64v64H160zm0 128h64v64H160zm0 128h64v64H160zm128 -256h64v64H288zm0 128h64v64H288zm0 128h64v64H288z"]},hf={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"]},uf={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"]},tu={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"]},mf={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"]},pf={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"]},td={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"]},gf={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"]},nu={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"]},ff={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"]},Cf={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"]},bf={prefix:"vs",iconName:"menu",icon:[512,512,[],"f000","M512 160H0V128h512v32zm0 256H0v-32h512v32zm0 -128.256H0V256h512v31.744z"]},su={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"]},Sf={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"]},nd={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"]},sd={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"]},Br={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"]},va={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"]},wf={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"]},Fi={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"]},Jn={prefix:"vs",iconName:"remove",icon:[512,512,[],"f000","M480 256H32V224h448v32z"]},vf={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"]},Tf={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"]},iu={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"]},ou={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"]},Ef={prefix:"vs",iconName:"split-horizontal",icon:[512,512,[],"f000","M448 32H96L64 64v352l32 32h352l32 -32V64l-32 -32zM256 416H96V64h160v352zm192 0H288V64h160v352z"]},yf={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"]},wc={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"]},If={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"]},xn={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"]},as={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"]},ru={prefix:"vs",iconName:"triangle-right",icon:[512,512,[],"f000","M177.92 448 160 434.784V76.576L177.28 64 352 244.064v26.464L177.92 448z"]},cs={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"]},Rf={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"]},Df={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"]},Mf={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"]},Nf={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"]},Ff={prefix:"dh",iconName:"exclamation",icon:[512,512,[],"f000","M275.2 384v-32H236.8v32h38.4zm-38.4 -64V128h38.4v192H236.8z"]},vc={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"]},Ta={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"]},xf={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"]},_f={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"]},kf={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"]},Lf={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"]},id={prefix:"dh",iconName:"filter-filled",icon:[512,512,[],"f000","M480 64v54.4l-160 153.6V448H192V268.8L32 118.4V64h448z"]},Of={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"]},Af={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"]},Jl={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"]},Pf={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"]},Hf={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"]},Vf={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"]},Ls={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"]},Uf={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"]},Bf={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"]},$f={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"]},od={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"]},Wf={prefix:"dh",iconName:"remove-square-filled",icon:[512,512,[],"f000","M432 32h-384l-16 16v384l16 16h384l16 -16v-384l-16 -16zM352 256H128V224h224v32z"]},zf={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"]},Gf={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"]},rd={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"]},ld={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"]},Tc={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"]},Kf={prefix:"dh",iconName:"sort-down",icon:[512,512,[],"f000","m128 288 -12.8 25.6 128 118.4h25.6l128 -118.4L384 288H128z"]},qf={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"]},ad={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"]},Ec={prefix:"dh",iconName:"square-filled",icon:[512,512,[],"f000","M432 32h-384l-16 16v384l16 16h384l16 -16v-384l-16 -16z"]},dd={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"]},Yf={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"]},lu={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"]},Xf={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"]},yc={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"]},au={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 dl=Y.forwardRef((t,e)=>{var b,C;function n(w){const{menuItem:T,onMenuItemClick:E}=t;E(T,w)}function s(w){const{menuItem:T,onMenuItemMouseMove:E}=t;E(T,w)}function i(w){const{menuItem:T,onMenuItemContextMenu:E}=t;E(T,w)}function o(w,T,E){if(typeof w.type=="string")return w;const{closeMenu:y,menuItem:I,isKeyboardSelected:D,isMouseSelected:N,"data-testid":x}=t,U={menuItem:I,closeMenu:y,isKeyboardSelected:D,isMouseSelected:N,iconElement:T,displayShortcut:E,"data-testid":x};return Y.cloneElement(w,{forwardedProps:U})}const{children:r,menuItem:l,isKeyboardSelected:a,isMouseSelected:d,"data-testid":c}=t,u=(b=l.shortcut)==null?void 0:b.getDisplayText();let m=null;if(l.icon){const w=l.icon;if(Y.isValidElement(w))m=w;else{let T;l.iconColor!=null&&(l.disabled===void 0||!l.disabled)&&(T={color:l.iconColor}),m=h(q,{icon:w,style:T})}}let p=null;const g=Boolean(r);l.actions&&(p=h(q,{icon:Jh}));let f=null;if(l.menuElement)f=h("div",{className:"custom-menu-item",onMouseMove:s,children:o(l.menuElement,m,u)});else{const w=l.disabled,T=l.iconOutline;f=h("button",{type:"button",className:W("btn-context-menu",{disabled:w},{active:(g||d)&&(w===void 0||!w)},{"keyboard-active":a!==void 0&&a&&(w===void 0||!w)}),onClick:n,onMouseMove:s,onContextMenu:i,title:(C=l.description)!=null?C:"",children:v("div",{className:"btn-context-menu-wrapper",children:[h("span",{className:W("icon",{outline:T}),children:m}),h("span",{className:"title",children:l.title}),u!==void 0&&h("span",{className:"shortcut",children:u}),p&&h("span",{className:W("submenu-indicator",{disabled:w}),children:p})]})})}return v("div",{className:"context-menu-item",ref:e,"data-testid":c,children:[r,f]})});dl.displayName="ContextMenuItem";dl.defaultProps={children:null,isKeyboardSelected:!1,isMouseSelected:!1,"data-testid":void 0};class ai extends Error{constructor(){super(...arguments),this.isCanceled=!0}}class cl{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),cl.getBrightness(o)<125}static getBrightness(e){return Math.round((e[0]*299+e[1]*587+e[2]*114)/1e3)}}const jf="table_",du="column_",Qf=new Set(["in","not","i","ii","k"]),Zf=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"]),Jf=/[^a-zA-Z0-9_$+@-]/g,eC=/[^A-Za-z0-9_$]/g,Ki=class{};let ms=Ki;ms.legalize=(t,e,n,s,i)=>{let o=t.trim().replace(/[- ]/g,"_");return s&&(Qf.has(o)||Zf.has(o))&&(o=e+o),o=o.replace(n,""),o||(o=e+i),Number.isNaN(Number(o.charAt(0)))||(o=e+o),o};ms.legalizeTableName=t=>Ki.legalize(t,jf,Jf,!1,0);ms.legalizeColumnNames=t=>{const e=[];return t.forEach((n,s)=>{let i=Ki.legalizeColumnName(n,s);e.includes(i)&&(i=du+s),e.push(i)}),e};ms.legalizeColumnName=(t,e=0)=>Ki.legalize(t,du,eC,!0,e);ms.isValidTableName=t=>Ki.legalizeTableName(t)===t;ms.isValidColumnName=t=>Ki.legalizeColumnName(t)===t;function tC(t,e){return t?t.closest(`.${e}`):null}const nC={getClosestByClassName:tC};class Ge extends CustomEvent{constructor(e,n){super(e,n)}}class cu extends Error{constructor(){super(...arguments),this.isTimeout=!0}}class Ee{static makeCancelable(e,n){let s=!1,i;const o=new Promise((r,l)=>{Promise.resolve(e).then(a=>{s?(n&&n(a),l(new ai)):(i=a,r(a))},a=>l(s?new ai:a))});return o.cancel=()=>{s=!0,i!=null&&n&&n(i)},o}static isCanceled(e){return e instanceof ai}static isTimedOut(e){return e instanceof cu}}class ps{constructor(){this.pending=[],this.resolved=[]}add(e,n){const s=Ee.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 A(t){if(t==null)throw new Error("Value is null or undefined")}class fn{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(!fn.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)}}class tn{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 hu=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(hu.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 In=hu;In.TIME_PATTERN="([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]";In.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 Oi extends Error{constructor(){super(...arguments),this.isInvalid=!0}}const _n=({className:t="","data-testid":e})=>v("div",{className:W("loading-spinner fa-layers",t),"data-testid":e,children:[h(q,{icon:nf,className:"text-white-50"}),h(q,{icon:nu,className:"text-primary",spin:!0})]}),Ic=X.module("ContextMenu"),Ea=class extends S.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=Y.createRef(),this.oldFocus=document.activeElement,this.activeSubMenuRef=Y.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=Ne.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:Ne.sortActions(i)})}initMenuPromise(t){const e=Ee.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:Ne.sortActions(s.menuItems.concat(n)),pendingItems:o}}return null})},n=>{Ee.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}),Ic.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){Ic.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=Ne.getNextMenuItem(s,-1,e):(t.key==="ArrowDown"||t.key==="Tab")&&(s=Ne.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 w=r[C];C>0&&w.group!==r[C-1].group&&t.push(h("hr",{},`${C}.separator`));const T=h(dl,{ref:s===C?this.activeSubMenuRef:null,isKeyboardSelected:o===C,isMouseSelected:l===C,menuItem:w,closeMenu:this.handleCloseSubMenu,onMenuItemClick:this.handleMenuItemClick,onMenuItemMouseMove:this.handleMenuItemMouseMove,onMenuItemContextMenu:this.handleMenuItemContextMenu},C);t.push(T)}let p=null;a.length>0&&(p=h("div",{className:"loading",children:h(_n,{})}));const{menuStyle:g,"data-testid":f}=this.props,b=s!==null&&d!==null&&c!==null;return v(he,{children:[v("div",{className:W({"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:Ea.handleContextMenu,role:"menuitem",tabIndex:0,"data-testid":f,children:[t,p]}),b&&s!==null&&d!==null&&c!==null&&h(Ea,{actions:r[s].actions||[],closeMenu:this.handleCloseSubMenu,top:d,left:c,updatePosition:(C,w)=>{this.setState({subMenuTop:C,subMenuLeft:w})},subMenuParentWidth:u,subMenuParentHeight:m},`sub-${s}`)]})}};let uu=Ea;uu.defaultProps={subMenuParentWidth:0,subMenuParentHeight:0,closeMenu(){},onMenuOpened(){},onMenuClosed(){},options:{},menuStyle:{},"data-testid":void 0};class mu extends S.exports.Component{constructor(e){super(e),this.handleMenuClose=this.handleMenuClose.bind(this),this.handleContextMenu=this.handleContextMenu.bind(this),this.container=Y.createRef(),this.openMenu=Y.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(!Ne.isContextActionEvent(e)||!this.container.current||e.metaKey||e.ctrlKey)return;const n=Ne.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(uu,{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:W("context-menu-root",{active:s}),ref:this.container,children:e})}}const Ys=class extends S.exports.Component{static handleEnter(t){const e=t;e.style.height="0"}static handleEntering(t){const e=t;e.style.height=`${Ys.getHeight(e)}px`}static handleExiting(t){const e=t;e.style.height="0"}static handleExit(t){const e=t;e.style.height=`${Ys.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(ht,{in:n,classNames:{enterActive:"collapsing",enterDone:"collapse show",exitActive:"collapsing",exitDone:"collapse"},onEnter:Ys.handleEnter,onEntering:Ys.handleEntering,onEntered:this.handleEntered,onExit:Ys.handleExit,onExiting:Ys.handleExiting,timeout:350,children:i=>h("div",{className:W({collapse:i==="exited"},e),"data-testid":s,children:t})})}};let cd=Ys;cd.propTypes={className:R.exports.string,in:R.exports.bool.isRequired,children:R.exports.node.isRequired,autoFocusOnShow:R.exports.bool,"data-testid":R.exports.string};cd.defaultProps={className:"",autoFocusOnShow:!1,"data-testid":void 0};function hl(t){const e=S.exports.useRef();return S.exports.useEffect(function(){e.current=t}),e.current}function pu(t){const e=S.exports.useRef(null);return S.exports.useEffect(function(){!t||(typeof t=="function"?t(e.current):t.current=e.current)}),e}const Pt=Y.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]=S.exports.useState(ze()),p=pu(e);S.exports.useEffect(function(){p.current&&(p.current.indeterminate=n===null)},[p,n]);const g=S.exports.useCallback(f=>{p.current&&(p.current.indeterminate=n===null),c&&c(f)},[p,n,c]);return v("div",{className:W("custom-control custom-checkbox",i),children:[h("input",{type:"checkbox",ref:p,checked:n!=null?n:!1,className:W("custom-control-input",r,{"is-invalid":l}),disabled:o,id:m,name:d,onChange:g,"data-testid":u}),h("label",{className:W("custom-control-label",a),htmlFor:m,children:s})]})});Pt.displayName="Checkbox";Pt.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:R.exports.node.isRequired,className:R.exports.string,disabled:R.exports.bool,inputClassName:R.exports.string,isInvalid:R.exports.bool,labelClassName:R.exports.string,name:R.exports.string,onChange:R.exports.func,"data-testid":R.exports.string};Pt.defaultProps={checked:!1,className:"",disabled:!1,inputClassName:"",isInvalid:!1,labelClassName:"",name:void 0,onChange:void 0,"data-testid":void 0};class gs extends S.exports.PureComponent{constructor(e){super(e),this.inputField=Y.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 v("div",{className:W("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(q,{icon:ou})})]})}}gs.defaultProps={placeholder:"Search",className:"",matchCount:null,onKeyDown(){},id:"","data-testid":void 0};var gu=(t=>(t.UP="UP",t.DOWN="DOWN",t))(gu||{});const bo=class extends S.exports.Component{constructor(t){super(t),this.getCachedFilteredOptions=Te((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=Y.createRef(),this.cbContainer=Y.createRef(),this.toggleButton=Y.createRef(),this.menuContainer=Y.createRef(),this.input=Y.createRef(),this.searchInput=Y.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(bo.MENU_NAVIGATION_DIRECTION.UP),t.stopPropagation(),t.preventDefault();break;case"ArrowDown":this.handleMenuNavigation(bo.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 bo.MENU_NAVIGATION_DIRECTION.UP:l=-1;break;case bo.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 v("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(gs,{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:W("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},v("div",{className:"input-group cb-container",ref:this.cbContainer,children:[h("input",{value:l||i,className:W("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:v("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(q,{icon:as}),h(Fn,{ref:this.popper,options:a,className:W("combobox interactive"),onEntered:this.handleMenuOpened,onExited:this.handleMenuExited,children:this.renderMenuElement()})]})})]})}};let qi=bo;qi.MENU_NAVIGATION_DIRECTION=gu;qi.DROP_DOWN_MENU_HEIGHT=200;qi.propTypes={options:R.exports.arrayOf(R.exports.shape({title:R.exports.string.isRequired,value:R.exports.string.isRequired})).isRequired,popperOptions:R.exports.shape({title:R.exports.string.isRequired,value:R.exports.string.isRequired}),onChange:R.exports.func,inputPlaceholder:R.exports.string,searchPlaceholder:R.exports.string,disabled:R.exports.bool,className:R.exports.string,defaultValue:R.exports.string,spellCheck:R.exports.bool,onEnter:R.exports.func,"data-testid":R.exports.string};qi.defaultProps={onChange(){},inputPlaceholder:"",searchPlaceholder:"Search",disabled:!1,className:"",defaultValue:"",popperOptions:null,spellCheck:!0,onEnter(){},"data-testid":void 0};const Tn=X.module("MaskedInput"),vi={FORWARD:"forward",BACKWARD:"backward",NONE:"none"},hr="\u2007";function hd(t,e,n){return t.substring(0,e)+n+t.substring(e+1)}function sC(t,e,n){return t.length<n?`${t}${e.substring(t.length,n)}`:t}function Rc(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 ul=Y.forwardRef((t,e)=>{const{className:n,example:s,getNextSegmentValue:i=(L,H,O)=>O,getPreferredReplacementString:o=hd,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=pu(e),b=S.exports.useMemo(()=>Array.isArray(s)?s:[s],[s]),C=S.exports.useMemo(()=>b[0].replace(/[a-zA-Z0-9]/g,hr),[b]);S.exports.useEffect(function(){var H;if(c!=null){Tn.debug("setting selection...",c);const{selectionStart:O,selectionEnd:F,selectionDirection:_}=c;(H=f.current)==null||H.setSelectionRange(O,F,_),Tn.debug("selection set!")}},[c,f]);const w=S.exports.useCallback(L=>{let H=L,O=L;const F=b.length>0?b[0]:u;for(let k=H-1;k>=0&&/[a-zA-Z0-9]/g.test(F.charAt(k));k-=1)H=k;for(let k=O;k<F.length&&/[a-zA-Z0-9]/g.test(F.charAt(k));k+=1)O=k+1;const _=H===O?vi.NONE:vi.BACKWARD;return{selectionStart:H,selectionEnd:O,selectionDirection:_}},[b,u]);function T(L,H,O=L.length){let F="";for(let _=0;_<O;_+=1)L.charAt(_)!==hr?F=F.concat(L[_]):F=F.concat(H[_]);return F=F.concat(H.substring(O)),F}function E(L,H=L.length){const O=new RegExp(`^${a}$`);if(O.test(L))return!0;for(let F=0;F<b.length;F+=1){const _=T(L,b[F],H);if(O.test(_))return!0}return!1}function y(L){const H=w(L),O=H.selectionEnd+1;return O>=u.length?H:w(O)}function I(L){const H=w(L),O=H.selectionStart-1;return O<=0?H:w(O)}function D(L,H){const O=w(L),F=u.substring(O.selectionStart,O.selectionEnd),_=i(O,H,F,u),k=u.substring(0,O.selectionStart)+_+u.substring(O.selectionEnd);E(k,O.selectionEnd)&&(r(k),l(O))}const N=S.exports.useCallback(L=>{const{selectionStart:H=0,selectionEnd:O=0,selectionDirection:F="none"}=L.target;if(H===null||O===null||F===null){Tn.error("Selection attempted on non-text input element",L.target);return}if(Tn.debug2("handleSelect",H,O,F),!(c!=null&&H===c.selectionStart&&O===c.selectionEnd)){if(c!=null&&H===u.length&&O===u.length&&L.nativeEvent.type!=="mouseup"){l({...c});return}if(H===O){const _=w(H);Tn.debug("Selection segment from ",H,O,"=>",_),l(_)}else l({selectionStart:H,selectionEnd:O,selectionDirection:F})}},[w,l,c,u]),x=S.exports.useCallback(L=>{var O;if(!f.current)return;Tn.debug("handleSelectCapture",L);const H=(O=f.current.selectionStart)!=null?O:0;H===u.length&&c!=null&&H!==c.selectionStart&&(L.preventDefault(),L.stopPropagation())},[f,c,u]);function U(L){if(L.preventDefault(),L.stopPropagation(),!f.current)return;const{key:H}=L,{selectionStart:O=0,selectionEnd:F=0}=f.current;if(O===null||F===null){Tn.error("Selection arrow nvaigation attempted on non-text input element",L.target);return}H==="ArrowLeft"?l(I(O)):H==="ArrowRight"?l(y(F)):H==="ArrowUp"?D(O,-1):H==="ArrowDown"&&D(O,1)}function $(L){if(!f.current)return;Tn.debug("handleKeyDown",L);const{key:H}=L,{selectionStart:O=0,selectionEnd:F=0}=f.current;if(O===null||F===null){Tn.error("Selection key event on non-text input element",L.target);return}if(H.startsWith("Arrow")){U(L);return}if(H==="Delete"||H==="Backspace"){if(L.preventDefault(),L.stopPropagation(),F>=Rc(u,C).length){const k=u.substring(0,O===F?O-1:O),V=Rc(k,C);V!==u&&(r(V),l({selectionStart:V.length,selectionEnd:V.length,selectionDirection:vi.NONE}));return}if(O!==F){const k=u.substring(0,O)+u.substring(O,F).replace(/[a-zA-Z0-9]/g,hr)+u.substring(F);Tn.debug("Range ",O,F,"deleted, setting value",k),r(k),l({selectionStart:O,selectionEnd:O,selectionDirection:vi.NONE})}else if(O>0)for(let k=O-1;k>=0;k-=1){const V=u.substring(0,k)+u.substring(k,O).replace(/[a-zA-Z0-9]/g,hr)+u.substring(O);if(V!==u){r(V),l({selectionStart:k,selectionEnd:k,selectionDirection:vi.NONE});return}}return}if(L.altKey||L.metaKey||L.ctrlKey||H.length>1)return;L.preventDefault(),L.stopPropagation();const _=Array.from(new Set([H,H.toUpperCase(),H.toLowerCase()]));for(let k=0;k<_.length;k+=1){const V=_[k],z=/[a-zA-Z0-9]/g.test(V)?b[0].length-1:O;for(let j=O;j<=z;j+=1){const ee=sC(u,b[0],j+1),ve=o(ee,j,V,O,F);if(E(ve,j+1)){const le=w(j),Se=j+1;let Oe={selectionStart:Se,selectionEnd:Se,selectionDirection:vi.NONE};if(Se>=le.selectionEnd){const J=y(j);J.selectionStart!==le.selectionStart&&(Oe=J)}Tn.debug("handleKeyDown",H,"=>",ve,Oe),r(ve),l(Oe);return}}}}return h("input",{ref:f,className:W("form-control masked-input",n),type:"text",pattern:a,placeholder:d,value:u,onChange:()=>{},onKeyDown:$,onSelect:N,onSelectCapture:x,onFocus:m,onBlur:p,"data-testid":g})});ul.defaultProps={className:"",placeholder:void 0,onChange(){},onSelect(){},getNextSegmentValue:(t,e,n)=>n,getPreferredReplacementString:hd,selection:void 0,onFocus(){},onBlur(){},"data-testid":void 0};const iC=X.module("TimeInput"),oC="([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]",rC=["00:00:00","12:34:56","23:59:59"],fu=Y.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]=S.exports.useState(In.formatTime(o)),[m,p]=S.exports.useState(),g=S.exports.useRef(null);S.exports.useImperativeHandle(e,()=>({focus:()=>{var T;(T=g.current)==null||T.focus()},setSelection:T=>{var E;(E=g.current)==null||E.focus(),p(T)}}),[]),S.exports.useEffect(function(){u(In.formatTime(o))},[o]);function f(T,E,y){const I=T.selectionStart===0?24:60;let D=parseInt(y,10)-E;return Number.isNaN(D)?D=0:n?D=(D%I+I)%I:D=Math.min(Math.max(0,D),I-1),`${D}`.padStart(2,"0")}function b(T,E,y,I,D){return I===0&&D===2&&E===1&&parseInt(y,10)>1?`0${y}${T.substring(2)}`:hd(T,E,y)}function C(T){iC.debug("handleChange",T),u(T),In.isTimeString(T)&&i(In.parseTime(T))}const w=S.exports.useCallback(T=>{p(T),a(T)},[a]);return h(ul,{ref:g,className:s,example:rC,getNextSegmentValue:f,getPreferredReplacementString:b,onChange:C,onSelect:w,pattern:oC,selection:m,value:c,onFocus:r,onBlur:l,"data-testid":d})});fu.defaultProps={allowValueWrapping:!0,className:"",onChange:()=>!1,onSelect:()=>!1,value:0,onFocus:()=>!1,onBlur:()=>!1,"data-testid":void 0};class Cu extends S.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=Y.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=Ne.getMenuItems(e,!1);n.length>0&&this.setState(s=>({menuItems:Ne.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=Ne.getNextMenuItem(i!=null?i:0,-1,n):(e.key==="ArrowDown"||e.key==="Tab"&&e.shiftKey===!1)&&(i=Ne.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(dl,{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})}}Cu.defaultProps={closeMenu(){},onMenuOpened(){},onMenuClosed(){},options:{},menuStyle:{},"data-testid":void 0};class Wn extends S.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=Y.createRef(),this.parent=null,this.popper=Y.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(Fn,{ref:this.popper,options:l,className:W("menu-popper",s),onExited:this.handleExited,closeOnBlur:!0,interactive:!0,children:h(Cu,{actions:e,closeMenu:this.handleCloseMenu,onMenuOpened:n,options:r,menuStyle:o})})})}}Wn.defaultProps={isShown:null,onMenuClosed(){},onMenuOpened(){},options:{},popperOptions:{},popperClassName:"",menuStyle:{},"data-testid":void 0};const Dc=-1;var bu=(t=>(t.UP="UP",t.DOWN="DOWN",t))(bu||{});const ns=class extends S.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=Y.createRef(),this.menuContainer=Y.createRef(),this.button=Y.createRef(),this.input=Y.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 In.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(ns.MENU_NAVIGATION_DIRECTION.UP):this.handleMenuNavigation(ns.MENU_NAVIGATION_DIRECTION.DOWN),t.stopPropagation(),t.preventDefault();break;case"ArrowUp":this.handleMenuNavigation(ns.MENU_NAVIGATION_DIRECTION.UP),t.stopPropagation(),t.preventDefault();break;case"ArrowDown":this.handleMenuNavigation(ns.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 ns.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 ns.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===Dc){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>ns.DROP_DOWN_MENU_HEIGHT?e.scrollTop=s.offsetTop-ns.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(v("button",{type:"button",value:d,className:W("cs-option-btn",{"keyboard-active":i===d&&!r}),onClick:this.handleOptionClick,onFocus:this.handleOptionFocus,children:[c.value===e&&h(q,{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(v("button",{type:"button",value:Dc,className:W("cs-option-btn",{"keyboard-active":r}),onClick:this.handleOptionClick,onFocus:this.handleOptionFocus,children:[!l&&e!==null?h(q,{icon:n,className:"mr-2"}):h("span",{className:"mr-4"}),s]},"option-custom-label")),a.push(v("div",{className:"cs-custom-container",children:[h("span",{className:"mr-2"}),h(fu,{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:W("input-group-append cs-dropdown",{"cs-dropdown-invalid":e}),children:v("button",{type:"button",className:W("btn cs-btn form-control",{"cs-btn-invalid":e}),ref:this.button,onClick:this.toggleMenu,disabled:t,children:[h("span",{className:W({"text-muted":n===null}),children:this.getSelectedText()}),h("span",{children:h(q,{icon:ad,className:"cs-caret"})}),h(Wn,{isShown:i,actions:{menuElement:this.renderMenuElement()},popperOptions:o,popperClassName:"CustomTimeSelect",onMenuOpened:this.handleMenuOpened,onMenuClosed:this.handleMenuExited,menuStyle:{maxWidth:"100rem"}})]})})})}};let ud=ns;ud.MENU_NAVIGATION_DIRECTION=bu;ud.DROP_DOWN_MENU_HEIGHT=125;ud.defaultProps={onChange(){},value:null,disabled:!1,popperOptions:{},icon:li,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 Ti(t,e,n,s,i){const o=s-n+1;return`${((parseInt(e,10)-t-n)%o+o)%o+n}`.padStart(i,"0")}function Su(t,e,n){const{selectionStart:s}=t;return s===0?Ti(e,n,1900,2099,4):s===5?Ti(e,n,1,12,2):s===8?Ti(e,n,1,31,2):s===11?Ti(e,n,0,23,2):s===17||s===14?Ti(e,n,0,59,2):s===20||s===24||s===28?Ti(e,n,0,999,3):n}const lC=X.module("DateTimeInput"),aC="[12][0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])",dC="([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}",cC=`${aC} ${dC}`,hC="2022-01-01 00:00:00.000000000",uC="YYYY-MM-DD HH:MM:SS.SSSSSSSSS";function wu(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 mC=t=>t.replace(/\u200B/g,""),pC=[wu(hC)],vu=Y.forwardRef((t,e)=>{const{className:n="",onChange:s=()=>{},defaultValue:i="",onFocus:o=()=>{},onBlur:r=()=>{},"data-testid":l}=t,[a,d]=S.exports.useState(i.length>0?wu(i):""),[c,u]=S.exports.useState(),m=S.exports.useCallback(p=>{lC.debug("handleChange",p),d(p),s(mC(p))},[s]);return h("div",{className:"d-flex flex-row align-items-center",children:h(ul,{ref:e,className:W(n),example:pC,getNextSegmentValue:Su,onChange:m,onSelect:u,pattern:cC,placeholder:uC,selection:c,value:a,onFocus:o,onBlur:r,"data-testid":l})})});vu.displayName="DateTimeInput";vu.defaultProps={className:"",onChange:()=>{},defaultValue:"",onFocus:()=>{},onBlur:()=>{},"data-testid":void 0};const gC=X.module("DateInput"),fC="[12][0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])",CC=["2000-01-01","2022-12-31"],bC="YYYY-MM-DD",Tu=Y.forwardRef((t,e)=>{const{className:n="",onChange:s=()=>{},defaultValue:i="",onFocus:o=()=>{},onBlur:r=()=>{},"data-testid":l}=t,[a,d]=S.exports.useState(i),[c,u]=S.exports.useState(),m=S.exports.useCallback(p=>{gC.debug("handleChange",p),d(p),s(p)},[s]);return h("div",{className:"d-flex flex-row align-items-center",children:h(ul,{ref:e,className:W(n),example:CC,getNextSegmentValue:Su,onChange:m,onSelect:u,pattern:fC,placeholder:bC,selection:c,value:a,onFocus:o,onBlur:r,"data-testid":l})})});Tu.displayName="DateInput";Tu.defaultProps={className:"",onChange:()=>!1,defaultValue:"",onFocus:()=>!1,onBlur:()=>!1,"data-testid":void 0};class Eu extends S.exports.PureComponent{constructor(e){super(e),this.searchInput=Y.createRef(),this.handleChange=this.handleChange.bind(this),this.sendUpdate=Xe(this.sendUpdate.bind(this),e.debounceMs),this.state={value:e.value}}componentDidUpdate(e){const{value: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(gs,{value:r,placeholder:e,onChange:this.handleChange,className:n,matchCount:s,ref:this.searchInput,id:i,"data-testid":o})}}Eu.defaultProps={placeholder:"Search",className:"",matchCount:null,debounceMs:250,id:"","data-testid":void 0};const SC=({className:t="",show:e=!0,"data-testid":n})=>v("div",{className:W("dh-loader",t,{show:e}),"data-testid":n,children:[h("svg",{className:"dh-outer-shape",viewBox:"0 0 182 182",children:h("g",{transform:"translate(91,91.0033) translate(-64,-64.0033)",children:h("path",{d:"M82.7429,0L82.7429,41.3714L45.2571,41.3714L45.2571,0L0,0L0,128L45.2571,128L45.2571,86.6286L82.5143,86.6286L82.5143,128L128,128L128,0L82.7429,0ZM41.3714,124.114L4.11429,124.114L4.11429,86.6286L41.3714,86.6286L41.3714,124.114ZM41.3714,82.7429L4.11429,82.7429L4.11429,45.2571L41.3714,45.2571L41.3714,82.7429ZM41.3714,41.3714L4.11429,41.3714L4.11429,4.11429L41.3714,4.11429L41.3714,41.3714ZM45.2571,82.7429L45.2571,45.2571L82.5143,45.2571L82.5143,82.5143L45.2571,82.5143ZM124.114,124.114L86.6286,124.114L86.6286,86.6286L123.886,86.6286L123.886,124.114ZM124.114,82.7429L86.6286,82.7429L86.6286,45.2571L123.886,45.2571L123.886,82.7429ZM86.6286,41.3714L86.6286,4.11429L123.886,4.11429L123.886,41.3714L86.6286,41.3714Z",fill:"#f0f0ee"})})}),h("svg",{className:"dh-loader-tile dh-loader-tile-3",viewBox:"0 0 182 182",children:h("g",{transform:"translate(91,91.0033) translate(-64,-64.0033)",children:h("g",{transform:"translate(63.9589,64.0492) translate(-59.9751,-63.9508)",children:h("rect",{width:"37.3438",height:"37.6389",fill:"#5189e5",transform:"translate(-21.9838,29.7957) translate(21.9838,15.3027)"})})})}),h("svg",{className:"dh-loader-tile dh-loader-tile-2",viewBox:"0 0 182 182",children:h("g",{transform:"translate(91,91.0033) translate(-64,-64.0033)",children:h("g",{transform:"translate(63.9589,64.0492) translate(-59.9751,-63.9508)",children:h("rect",{width:"37.2755",height:"37.4675",fill:"#5189e5",transform:"translate(-21.9838,69.7957) translate(22.0822,16.7783)"})})})}),h("svg",{className:"dh-loader-tile dh-loader-tile-5",viewBox:"0 0 182 182",children:h("g",{transform:"translate(91,91.0033) translate(-64,-64.0033)",children:h("g",{transform:"translate(63.9589,64.0492) translate(-59.9751,-63.9508)",children:h("rect",{width:"37.3512",height:"41.3781",fill:"#35618c",transform:"translate(18.0162,72.7957) translate(23.1643,13.7278)"})})})}),h("svg",{className:"dh-loader-tile dh-loader-tile-6",viewBox:"0 0 182 182",children:h("g",{transform:"translate(91,91.0033) translate(-64,-64.0033)",children:h("g",{transform:"translate(63.9589,64.0492) translate(-59.9751,-63.9508)",children:h("rect",{width:"37.2483",height:"37.5869",fill:"#35618c",transform:"translate(59.0162,29.7957) translate(23.6379,15.3564)"})})})}),h("svg",{className:"dh-loader-tile dh-loader-tile-7",viewBox:"0 0 182 182",children:h("g",{transform:"translate(91,91.0033) translate(-64,-64.0033)",children:h("g",{transform:"translate(63.9589,64.0492) translate(-59.9751,-63.9508)",children:h("rect",{width:"37.5664",height:"41.2747",fill:"#35618c",transform:"translate(17.0162,-13.2043) translate(24.2531,13.2043)"})})})}),h("svg",{className:"dh-loader-tile dh-loader-tile-4",viewBox:"0 0 182 182",children:h("g",{transform:"translate(91,91.0033) translate(-64,-64.0033)",children:h("g",{transform:"translate(63.9589,64.0492) translate(-59.9751,-63.9508)",children:h("rect",{width:"37.2854",height:"37.3014",fill:"#5189e5",transform:"translate(-21.9838,-13.2043) translate(22.0822,17.1792)"})})})})]});const wC=X.module("ItemListItem"),yu=class extends S.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=Y.createRef()}static handleKeyDown(){return wC.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:W("item-list-item",{active:n},{"is-focused":e},{"is-draggable":t}),onKeyDown:yu.handleKeyDown,onContextMenu: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 Iu=yu;Iu.defaultProps={children:null,isDraggable:!1,isFocused:!1,isSelected:!1,itemIndex:0,disableSelect:!1,"data-testid":void 0,onBlur(){},onClick(){},onContextMenu(){},onDragStart(){},onDrag(){},onDragOver(){},onDragEnd(){},onDrop(){},onDoubleClick(){},onFocus(){},onMouseDown(){},onMouseMove(){},onMouseUp(){},style:{}};const Mc=X.module("ItemList"),Ai=class extends S.exports.PureComponent{constructor(t){super(t),this.getItemSelected=Te((s,i)=>fn.isSelected(i,s),{max:Ai.CACHE_SIZE}),this.getCachedItem=Te((s,i,o,r,l,a,d,c)=>{const u=a({item:o,itemIndex:s,isFocused:r,isSelected:l,style:d});return h(Iu,{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:Ai.CACHE_SIZE}),this.getOuterElement=Te(s=>{const i=Y.forwardRef((o,r)=>h("div",{ref:r,tabIndex:-1,onKeyDown:s,role:"presentation",...o}));return i.displayName="ItemListOuterElement",i}),this.getInnerElement=Te(()=>{const s=Y.forwardRef((i,o)=>h("div",{className:"item-list-inner-element",ref:o,...i}));return s.displayName="ItemListInnerElement",s}),this.getItemData=Te((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=Y.createRef(),this.listContainer=Y.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}`)})}componentDidMount(){const{isStickyBottom:t}=this.props;t&&!this.isListAtBottom()&&this.scrollToBottom()}componentDidUpdate(t,e){const{selectedRanges:n}=this.props,{focusIndex:s,isStuckToBottom:i,scrollOffset:o,height:r,selectedRanges:l}=this.state;if(i&&!this.isListAtBottom()&&this.scrollToBottom(),(o!==e.scrollOffset||r!==e.height)&&this.sendViewportUpdate(),n!==t.selectedRanges&&n!==l)this.setSelectedRanges(n);else if(l!==e.selectedRanges){const{onSelectionChange:a}=this.props;a(l)}if(s!==e.focusIndex){const{onFocusChange:a}=this.props;a(s)}}componentWillUnmount(){window.removeEventListener("mouseup",this.handleWindowMouseUp)}focus(){var t;(t=this.listContainer.current)==null||t.focus()}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=fn.isSelected(n,t)||Ne.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:fn.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){Mc.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){Mc.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)&&!Ne.isModifierKeyDown(e)&&this.deselectAll(),this.selectRange([Math.min(o,t),Math.max(o,t)])):this.toggleSelect(t,e.shiftKey,Ne.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=Ne.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){fn.validateRange(t),this.setState(({selectedRanges:e})=>({selectedRanges:fn.deselectRange(e,t)}))}selectItem(t){const{disableSelect:e}=this.props;e||this.selectRange([t,t])}selectRange(t){fn.validateRange(t),this.setState(({selectedRanges:e})=>({selectedRanges:fn.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}=this.state;return h(Bp,{className:"item-list-auto-sizer",onResize:this.handleResize,children:({width:l,height:a})=>h($p,{className:"item-list-scroll-pane",height:a,width:l,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 bn=Ai;bn.CACHE_SIZE=1e3;bn.DEFAULT_ROW_HEIGHT=20;bn.DEFAULT_OVERSCAN=10;bn.defaultProps={offset:0,items:[],rowHeight:Ai.DEFAULT_ROW_HEIGHT,isDeselectOnClick:!0,isDoubleClickSelect:!1,isDragSelect:!0,isMultiSelect:!1,isStickyBottom:!1,disableSelect:!1,onFocusChange(){},onSelect(){},onSelectionChange(){},onViewportChange(){},overscanCount:Ai.DEFAULT_OVERSCAN,renderItem:Ai.renderItem,selectedRanges:[],focusSelector:".item-list-item","data-testid":void 0};const ni=class extends S.exports.PureComponent{constructor(t){super(t),this.getCachedDraggableItem=Te((e,n,s,i,o,r,l,a)=>h(ol,{draggableId:ni.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:bn.CACHE_SIZE}),this.getCachedRenderDraggableItem=Te((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=Te((e,n,s,i)=>(o,r,l)=>{const{selectedCount:a}=this.state,{index:d}=l.source,c=n[d-s];return h("div",{className:W("draggable-item-list-dragging-item-container",e),...o.draggableProps,...o.dragHandleProps,ref:o.innerRef,children:h("div",{className:W("draggable-item-list-dragging-item",{"two-dragged":a===2},{"multiple-dragged":a>2}),children:i({item:c,itemIndex:d,isFocused:!1,isSelected:!0,style:{},isClone:!0,selectedCount:a})})})},{max:1}),this.handleSelectionChange=this.handleSelectionChange.bind(this),this.itemList=Y.createRef(),this.state={selectedCount:0}}static renderHandle(){return v("div",{children:[h(Ie,{children:"Drag to re-order"}),h(q,{icon:al})]})}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 v("div",{className:W("item-list-item-content","draggable-item-list-item-content",n),children:[h("span",{className:"title",children:t}),ni.renderBadge({text:e}),ni.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 ni.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:fn.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:w,"data-testid":T}=this.props;return h(ko,{isDropDisabled:r,droppableId:s,mode:"virtual",renderClone:this.getCachedRenderClone(n,c,u,f),"data-testid":T,children:(E,y)=>h("div",{role:"menu",className:W("draggable-item-list",t,{"is-drop-disabled":r,"is-drag-disabled":o,"is-dragging-from-this":y.draggingFromThisWith,"is-dragging-over":y.isDraggingOver,"is-dropping":y.draggingOverWith}),style:w,ref:E.innerRef,...E.droppableProps,children:h(bn,{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 nn=ni;nn.DEFAULT_ROW_HEIGHT=30;nn.defaultProps={className:"",draggingItemClassName:"",offset:0,items:[],rowHeight:ni.DEFAULT_ROW_HEIGHT,isDeselectOnClick:!0,isDoubleClickSelect:!0,isDropDisabled:!1,isDragDisabled:!1,isMultiSelect:!1,isStickyBottom:!1,disableSelect:!1,style:null,onFocusChange(){},onSelect(){},onSelectionChange(){},onViewportChange(){},renderItem:ni.renderItem,selectedRanges:[],draggablePrefix:"draggable-item",droppableId:"droppable-item-list","data-testid":void 0};class Gt{static reorder(e,n,s,i){const o=e===s?Gt.adjustDestinationIndex(i,n):i,r=Gt.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 Wp(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 Nr=class extends S.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=Nr.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=Nr.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 v("div",{className:"hcm-menu-container",children:[Array.from(t.entries()).map(([n,s])=>v("div",{children:[h(Pt,{className:"hcm-parent",checked:Nr.isParentSelected(n,t),onChange:()=>this.toggleValueFor(n),children:n}),s!==void 0&&typeof s!="boolean"&&Array.from(s.entries()).map(([i,o])=>h(Pt,{className:"hcm-child",checked:o,onChange:()=>this.toggleValueFor(n,i),children:i},i))]},n)),h(Q,{kind:"ghost",onClick:this.selectAll,"data-testid":e!==void 0?`${e}-btn-select-all`:void 0,children:"Select All"}),h(Q,{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 v("button",{type:"button",className:W("btn hcm-btn",e),onClick:this.toggleMenu,id:s,"data-testid":i,children:[v("span",{children:[n&&h(q,{icon:n,className:"hcm-icon mr-1"}),t]}),h(q,{icon:ad,className:"hcm-icon ml-1"}),h(Fn,{options:{placement:"bottom"},isShown:o,onExited:()=>{this.setState({menuIsOpen:!1})},closeOnBlur:!0,interactive:!0,children:this.renderMenuElement()})]})}};let vC=Nr;vC.defaultProps={className:"",icon:null,id:"","data-testid":void 0};const ml=({isLoaded:t=!1,isLoading:e=!0,errorMessage:n=null,"data-testid":s})=>h(ht,{in:Boolean(n)||!t||e,timeout:Tt.transitionMs,classNames:t?"fade":"",mountOnEnter:!0,unmountOnExit:!0,children:h("div",{className:"fill-parent-absolute","data-testid":s,children:h("div",{className:W("iris-panel-message-overlay","fill-parent-absolute",{"iris-panel-scrim-background":t}),children:v("div",{className:"message-content",children:[v("div",{className:"message-icon",children:[e&&h(_n,{}),!e&&n&&h(q,{icon:cs})]}),h("div",{className:"message-text",children:n})]})})})});const Ru=({on:t,id:e,className:n,isInvalid:s,disabled:i=!1,onClick:o,"data-testid":r})=>h("button",{type:"button",className:W("btn","btn-switch",n,{active:t},{"is-invalid":s}),id:e,onClick:o,disabled:i,"data-testid":r,children:h("div",{className:"handle"})});function Nc(t){return t.isOn!==void 0}const TC=({item:t,onSelect:e=()=>{},"data-testid":n})=>{const{icon:s,subtitle:i,title:o}=t,r=S.exports.useMemo(()=>Nc(t)?()=>{t.onChange(!t.isOn)}:e,[t,e]);return v("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(q,{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:Nc(t)&&h(Ru,{on:t.isOn,onClick:l=>{l.stopPropagation(),r()}})||h(q,{icon:Jh})})]})};const Du=({items:t,onSelect:e=()=>{},"data-testid":n})=>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(TC,{item:s,onSelect:()=>{e(i)}})},s.title))})});const Fc=({children:t,onBack:e,onClose:n,title:s,"data-testid":i})=>v("div",{className:"navigation-page","data-testid":i,children:[v("div",{className:"navigation-title-bar",children:[h("div",{className:"navigation-left-buttons",children:e!==void 0&&h(Q,{kind:"ghost",className:"btn-back","data-testid":"btn-page-back",onClick:e,icon:ef,children:"Back"})}),h("div",{className:"navigation-title",children:s}),h("div",{className:"navigation-right-buttons",children:n!==void 0&&h(Q,{kind:"ghost",className:"btn-close px-2 m-1","data-testid":"btn-page-close",onClick:n,icon:Ho,tooltip:"Close"})})]}),h("div",{className:"navigation-content",children:t})]});const EC=({children:t,"data-testid":e})=>{const n=S.exports.useMemo(()=>Y.Children.toArray(t),[t]),s=hl(n),[i,o]=S.exports.useState(n[n.length-1]),[r,l]=S.exports.useState(null),[a,d]=S.exports.useState(null);S.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=S.exports.useCallback(()=>{o(r),l(null)},[r]),u=S.exports.useCallback(()=>{d(null)},[]);return v("div",{className:"navigation-stack",children:[h("div",{className:"main-view","data-testid":e,children:i}),h(ht,{in:a!=null,timeout:Tt.transitionMidMs,classNames:"slide-right",onEntered:u,children:h(he,{children:a!=null&&h("div",{className:"popping-view",children:a})})}),h(ht,{in:r!=null,timeout:Tt.transitionMidMs,classNames:"slide-left",onEntered:c,children:h(he,{children:r!=null&&h("div",{className:"pushing-view",children:r})})})]})},yC=({children:t,disabled:e,value:n,"data-testid":s})=>h("option",{value:n,disabled:e,"data-testid":s,children:t}),pl=t=>{const{children:e,disabled:n=!1,name:s,onChange:i,value:o="","data-testid":r}=t,[l]=S.exports.useState(s!=null?s:ze());return h(he,{children:Y.Children.map(e,a=>{var d,c;return a?Y.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})})},Mn=Y.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]=S.exports.useState(ze());return v("div",{className:W("custom-control custom-radio",i),children:[h("input",{type:"radio",id:p,"data-testid":m,name:d,ref:e,className:W("custom-control-input",r,{"is-invalid":l}),checked:n,disabled:o,value:u,onChange:c}),h("label",{className:W("custom-control-label",a),htmlFor:p,children:s})]})});Mn.displayName="RadioItem";Mn.defaultProps={checked:void 0,className:"",disabled:!1,inputClassName:"",isInvalid:!1,labelClassName:"",name:void 0,onChange:void 0,"data-testid":void 0};const IC=({children:t,onBlur:e,onChange:n,className:s,defaultValue:i,name:o,value:r,disabled:l,"data-testid":a})=>{const d=S.exports.useCallback(c=>{n(c.target.value)},[n]);return h("select",{className:W("custom-select",s),onBlur:e,onChange:d,defaultValue:i,value:r,name:o,disabled:l,"data-testid":a,children:t})};class Mu extends S.exports.PureComponent{constructor(e){super(e),this.getCachedItem=Te((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(Pt,{checked:l,disabled:a,onChange:()=>this.handleSelect(n),children:c})},s)},{max:1e3}),this.getCachedItems=Te((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=Y.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:W("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})})})}}Mu.defaultProps={disabled:!1,rowHeight:21,onBlur:()=>{},"data-testid":void 0};const xc=X.module("Shortcut");var ue=(t=>(t.CTRL="MODIFIER_CTRL",t.CMD="MODIFIER_CMD",t.ALT="MODIFIER_ALT",t.OPTION="MODIFIER_OPTION",t.SHIFT="MODIFIER_SHIFT",t))(ue||{}),pe=(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))(pe||{});const RC=new Set(["Enter","Delete","F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12"]),mt=class extends il{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=mt.isMacPlatform?n:e;this.defaultKeyState=mt.createKeyState(l),this.keyState=this.defaultKeyState}static isAllowedKey(t){return Object.values(pe).includes(t)}static isValidKeyState(t){const{keyValue:e}=t;return e===null?!0:!mt.isMacPlatform&&t.metaKey||!mt.isAllowedKey(e)?!1:!(!t.altKey&&!t.ctrlKey&&!t.metaKey&&!t.shiftKey)||RC.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="":!mt.isAllowedKey(e)&&mt.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?"":mt.isMacPlatform?mt.getMacDisplayText(t):mt.getWindowsDisplayText(t)}getDisplayText(){return mt.getDisplayText(this.keyState)}getKeyState(){return this.keyState}setKeyState(t){mt.isValidKeyState(t)?(xc.debug2(`Shortcut ${this.id} updated to ${JSON.stringify(t)}`),this.keyState=t,this.dispatchEvent(new Ge("onUpdate",{detail:this}))):xc.debug2(`Shortcut ${this.id} tried to update to invalid keyState ${JSON.stringify(t)}`)}getDefaultKeyState(){return this.defaultKeyState}isDefault(){return mt.doKeyStatesMatch(this.getDefaultKeyState(),this.getKeyState())}setToNull(){this.setKeyState(mt.NULL_KEY_STATE)}isNull(){return mt.doKeyStatesMatch(this.keyState,mt.NULL_KEY_STATE)}setToDefault(){this.setKeyState(this.defaultKeyState)}matchesKeyState(t){return mt.doKeyStatesMatch(t,this.keyState)}matchesEvent(t){return this.matchesKeyState(mt.getKeyStateFromEvent(t))}};let Wt=mt;Wt.NULL_KEY_STATE={metaKey:!1,shiftKey:!1,altKey:!1,ctrlKey:!1,keyValue:null};Wt.isMacPlatform=Ne.isMacPlatform();const _c=X.module("ShortcutRegistry");class DC extends il{constructor(){super(...arguments),this.shortcutMap=new Map,this.shortcutsByCategory=new Map}createAndAdd(e){const n=new Wt(e);return this.add(n)}add(e){var i;const n=this.shortcutMap.get(e.id);if(n)return _c.warn(`Skipping attempt to add duplicate shortcut ID to registry: ${e.id}`),n;_c.debug2(`Adding shortcut to registry: ${e.id}`),e.addEventListener("onUpdate",({detail:o})=>this.dispatchEvent(new Ge("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 Be=Object.freeze(new DC),ks={COPY:Be.createAndAdd({id:"GLOBAL.COPY",name:"Copy",shortcut:[ue.CTRL,pe.C],macShortcut:[ue.CMD,pe.C],isEditable:!1}),PASTE:Be.createAndAdd({id:"GLOBAL.PASTE",name:"Paste",shortcut:[ue.CTRL,pe.V],macShortcut:[ue.CMD,pe.V],isEditable:!1}),SAVE:Be.createAndAdd({id:"GLOBAL.SAVE",name:"Save",shortcut:[ue.CTRL,pe.S],macShortcut:[ue.CMD,pe.S],isEditable:!1}),SELECT_ALL:Be.createAndAdd({id:"GLOBAL.SELECT_ALL",name:"Select All",shortcut:[ue.CTRL,pe.A],macShortcut:[ue.CMD,pe.A],isEditable:!1}),LINKER:Be.createAndAdd({id:"GLOBAL.LINKER",name:"Linker",shortcut:[ue.CTRL,pe.L],macShortcut:[ue.CMD,pe.L]}),LINKER_CLOSE:Be.createAndAdd({id:"GLOBAL.LINKER_CLOSE",name:"Close Linker Overlay",shortcut:[pe.ESCAPE],macShortcut:[pe.ESCAPE],isEditable:!1})};const gl=Y.forwardRef((t,e)=>{const{children:n,className:s,disabled:i,isLinked:o,isLinkedSource:r,isInvalid:l,onClick:a,onMouseEnter:d,onMouseLeave:c,style:u,"data-testid":m}=t;return v("button",{ref:e,type:"button",className:W("btn-socketed",{"btn-socketed-linked":o!==void 0&&o||r},{"btn-socketed-linked-source":r},{"is-invalid":l},s),onClick:a,onMouseEnter:d,onMouseLeave:c,style:u,disabled:i,"data-testid":m,children:[n,h(q,{icon:td,className:"linked btn-socketed-icon",transform:"down-1"}),h(q,{icon:Ff,className:"is-invalid btn-socketed-icon"})]})});gl.displayName="SocketedButton";gl.defaultProps={children:void 0,className:"",disabled:!1,isLinked:!1,isLinkedSource:!1,isInvalid:!1,onClick:void 0,onMouseEnter:void 0,onMouseLeave:void 0,style:void 0,"data-testid":void 0};const MC="_track_xvu02_28",NC="_handle_xvu02_11",FC="_ticks_xvu02_96",Nu={"handle-size":"15px","popover-width":"90px","time-slider":"_time-slider_xvu02_1","time-slider-popovers":"_time-slider-popovers_xvu02_6","handle-popper":"_handle-popper_xvu02_11","flex-spacer":"_flex-spacer_xvu02_24",track:MC,"track-fills":"_track-fills_xvu02_35","track-fill":"_track-fill_xvu02_35","track-fill-start":"_track-fill-start_xvu02_53","track-fill-middle":"_track-fill-middle_xvu02_54","track-fill-end":"_track-fill-end_xvu02_57","handle-track":"_handle-track_xvu02_60",handle:NC,ticks:FC,"tick-labels":"_tick-labels_xvu02_114","tick-label":"_tick-label_xvu02_114","tick-label-wrapper":"_tick-label-wrapper_xvu02_130"};parseInt(Nu["handle-size"],10);parseInt(Nu["popover-width"],10);Object.freeze({ERROR:"error"});const{dh:M}=globalThis,fl=R.exports.shape({name:R.exports.string.isRequired,type:R.exports.string.isRequired,description:R.exports.string,constituentType:R.exports.string}),Fu=R.exports.shape({not:R.exports.func.isRequired,and:R.exports.func.isRequired,or:R.exports.func.isRequired}),xC=R.exports.shape({asc:R.exports.func.isRequired,desc:R.exports.func.isRequired,abs:R.exports.func.isRequired,column:fl.isRequired,direction:R.exports.string.isRequired,isAbs:R.exports.bool.isRequired}),_C=R.exports.shape({columns:R.exports.arrayOf(fl).isRequired,customColumns:R.exports.arrayOf(R.exports.string).isRequired,filter:R.exports.arrayOf(Fu),addEventListener:R.exports.func.isRequired,removeEventListener:R.exports.func.isRequired,size:R.exports.number.isRequired,sort:R.exports.arrayOf(R.exports.any),copy:R.exports.func.isRequired,applyFilter:R.exports.func.isRequired,applySort:R.exports.func.isRequired,applyCustomColumns:R.exports.func.isRequired,description:R.exports.string}),kC=R.exports.shape({columns:R.exports.arrayOf(fl),filter:R.exports.arrayOf(R.exports.any),isExpanded:R.exports.func.isRequired,saveExpandedState:R.exports.func.isRequired,addEventListener:R.exports.func.isRequired,removeEventListener:R.exports.func.isRequired,size:R.exports.number.isRequired,sort:R.exports.arrayOf(R.exports.any),applyFilter:R.exports.func.isRequired,applySort:R.exports.func.isRequired}),Fr=R.exports.shape({name:R.exports.string.isRequired,type:R.exports.string.isRequired}),LC=R.exports.shape({created:R.exports.arrayOf(Fr).isRequired,updated:R.exports.arrayOf(Fr).isRequired,removed:R.exports.arrayOf(Fr).isRequired}),OC=R.exports.shape({groupingColumns:R.exports.arrayOf(R.exports.string),aggregations:R.exports.shape({}),includeConstituents:R.exports.bool,includeOriginalColumns:R.exports.bool,includeDescriptions:R.exports.bool}),AC=R.exports.shape({addEventListener:R.exports.func.isRequired,removeEventListener:R.exports.func.isRequired,onLogMessage:R.exports.func,getTable:R.exports.func.isRequired,runCode:R.exports.func.isRequired});Object.freeze({Column:fl,FilterCondition:Fu,IdeSession:AC,RollupConfig:OC,Sort:xC,Table:_C,TreeTable:kC,VariableChanges:LC,VariableDefinition:Fr});const xu=({type:t})=>{switch(t){case M.VariableType.TABLE:case M.VariableType.TABLEMAP:case M.VariableType.TREETABLE:return h(q,{icon:dd});case M.VariableType.FIGURE:return h(q,{icon:eu});case M.VariableType.PANDAS:return h(q,{icon:Uf});default:return h(q,{icon:va})}};class Cl extends S.exports.Component{constructor(e){super(e),this.container=null}componentDidMount(){this.colorize()}colorize(){const{children:e}=this.props;this.container&&e!=null&&ds.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 _u{static get LANGUAGE_MAP(){return new Map([["python","Python"],["groovy","Groovy"],["scala","Scala"]])}}class Ui{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)?[]:zp.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}static isWidgetType(e){return e===M.VariableType.FIGURE||e===M.VariableType.OTHERWIDGET||e===M.VariableType.PANDAS}static isOpenableType(e){return Ui.isTableType(e)||Ui.isWidgetType(e)}static isFigureType(e){return e===M.VariableType.FIGURE}static isPandas(e){return e===M.VariableType.PANDAS}}const ku=({children:t})=>v("div",{className:"console-history-item-result",children:[h("div",{className:"console-history-gutter",children:"-"}),h("div",{className:"console-history-content",children:t})]});ku.propTypes={children:R.exports.node.isRequired};class Lu extends S.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:W("console-history-result-in-progress",{disabled:e}),children:v("span",{className:"badge",children:[h(_n,{}),"\xA0Running... ",In.formatElapsedTime(s),"\xA0",v("button",{type:"button",onClick:n,disabled:e,children:[h(q,{icon:Ho}),h(Ie,{children:"Cancel"})]})]})})}}Lu.defaultProps={disabled:!1};const ya=class extends S.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)>=ya.mouseDragThreshold||Math.abs(t.clientY-this.mouseY)>=ya.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;A(n);const s=n.indexOf(`
|
|
6
|
+
`),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 v("div",{className:W("error-message",{expanded:t}),children:[i&&v(he,{children:[h("div",{className:"error-gutter",children:h("button",{type:"button",onClick:this.handleToggleError,className:l,tabIndex:-1,children:h(q,{icon:t?as:ru,transform:"left-3"})})}),v("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 md=ya;md.defaultProps={message:""};md.mouseDragThreshold=5;const kc=X.module("ConsoleHistoryItem");class Ou extends S.exports.PureComponent{constructor(e){super(e),this.handleCancelClick=this.handleCancelClick.bind(this),this.handleObjectClick=this.handleObjectClick.bind(this)}handleObjectClick(e){kc.debug("handleObjectClick",e);const{openObject:n}=this.props;n(e)}handleCancelClick(){const{item:e}=this.props;e!=null&&e.cancelResult&&(kc.debug(`Cancelling command: ${e.command}`),e.cancelResult())}render(){var d;const{disabled:e,item:n,language:s}=this.props,{disabledObjects:i,result:o}=n;let r=null;n.command!=null&&n.command!==""&&(r=v("div",{className:"console-history-item-command",children:[h("div",{className:"console-history-gutter",children:">"}),h("div",{className:"console-history-content",children:h(Cl,{language:s,children:n.command})})]}));const l=[];if(o){const{error:c,message:u,changes:m}=o;if(m){const{created:p,updated:g}=m;[...p,...g].forEach(f=>{const{title:b}=f,C=`${b}`,w=e===void 0||e||(i!=null?i:[]).indexOf(C)>=0,T=v(Vi,{onClick:()=>this.handleObjectClick(f),className:"btn-primary btn-console btn-console-object",disabled:w,children:[h(xu,{type:f.type})," ",b]},C);l.push(T)})}if(c!=null&&n.command==null){let p=`${(d=c.message)!=null?d:c}`;p||(p=c);const g=h(md,{message:p},"result-error");l.push(g)}if(u!==void 0&&u!==""){const p=h("div",{className:"log-message",children:u},"log-message");l.push(p)}}else{const c=h(Lu,{onCancelClick:this.handleCancelClick,disabled:e},"in_progress");l.push(c)}let a=null;return l.length>0&&(a=h(ku,{children:l})),v("div",{className:"container-fluid",children:[r,a]})}}Ou.defaultProps={disabled:!1};const Au=class extends S.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(Ou,{disabled:t,item:r,openObject:s,language:n},Au.itemKey(o,r));i.push(l)}return h("div",{className:"container-fluid console-history",children:i})}};let Pu=Au;Pu.defaultProps={disabled:!1};const PC={name:"Console",CLEAR:Be.createAndAdd({id:"CONSOLE.CLEAR",name:"Clear",shortcut:[ue.CTRL,pe.L],macShortcut:[ue.CTRL,pe.C]}),FOCUS_HISTORY:Be.createAndAdd({id:"CONSOLE.FOCUS_HISTORY",name:"Focus History",shortcut:[ue.CTRL,pe.H],macShortcut:[ue.CTRL,ue.OPTION,pe.H]})},HC={name:"Command History",FOCUS_HISTORY:Be.createAndAdd({id:"COMMAND_HISTORY.FOCUS_HISTORY",name:"Focus History Search",shortcut:[ue.CTRL,pe.H],macShortcut:[ue.CTRL,ue.OPTION,pe.H]}),SEND_TO_CONSOLE:Be.createAndAdd({id:"COMMAND_HISTORY.SEND_TO_CONSOLE",name:"Send to Console",shortcut:[pe.ENTER],macShortcut:[pe.ENTER]}),SEND_TO_NOTEBOOK:Be.createAndAdd({id:"COMMAND_HISTORY.SEND_TO_NOTEBOOK",name:"Send to Notebook",shortcut:[ue.CTRL,pe.ENTER],macShortcut:[ue.CMD,pe.ENTER]}),RUN:Be.createAndAdd({id:"COMMAND_HISTORY.RUN",name:"Run",shortcut:[ue.ALT,pe.R],macShortcut:[ue.OPTION,pe.R]})},VC={name:"Notebook",RUN:Be.createAndAdd({id:"NOTEBOOK.RUN",name:"Run",shortcut:[ue.ALT,pe.R],macShortcut:[ue.OPTION,pe.R]}),RUN_SELECTED:Be.createAndAdd({id:"NOTEBOOK.RUN_SELECTED",name:"Run Selected",shortcut:[ue.ALT,ue.SHIFT,pe.R],macShortcut:[ue.OPTION,ue.SHIFT,pe.R]}),FIND:Be.createAndAdd({id:"NOTEBOOK.FIND",name:"Find",shortcut:[ue.CTRL,pe.F],macShortcut:[ue.CMD,pe.F],isEditable:!1})},Nn={CONSOLE:PC,COMMAND_HISTORY:HC,NOTEBOOK:VC},bt=Object.freeze({FATAL:"FATAL",STDERR:"STDERR",ERROR:"ERROR",WARN:"WARN",STDOUT:"STDOUT",INFO:"INFO",DEBUG:"DEBUG",TRACE:"TRACE"}),UC="#2d2a2e",BC="#fcfcfa",$C="#fcd65b",WC="#b2b1b2",zC="#9edc6f",GC="#76d9e4",KC="#f95d84",qC="#aa9af4",YC="#f95d84",XC="#fcfcfa",jC="#7c7b7c",we={"error-foreground":"#f95d84",background:UC,foreground:BC,"line-height":"19px",string:$C,"string-delim":"#929192",delimiter:WC,predefined:zC,keyword:GC,storage:KC,number:qC,operator:YC,identifier:XC,"namespace-identifier":"#f95d84","identifier-js":"#fcd65b",comment:jC,"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"},QC="python",ZC={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:new RegExp("^\\s*(?:def|class|for|if|elif|else|while|try|with|finally|except|async).*?:\\s*$"),action:{indentAction:1}}],folding:{offSide:!0,markers:{start:new RegExp("^\\s*#region\\b"),end:new RegExp("^\\s*#endregion\\b")}}},JC={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"]]}},eb={id:QC,conf:ZC,language:JC},tb="groovy",nb={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:new RegExp("^\\s*(?:def|class|for|if|elif|else|while|try|with|finally|except|async).*?:\\s*$"),action:{indentAction:1}}],folding:{offSide:!0,markers:{start:new RegExp("^\\s*#region\\b"),end:new RegExp("^\\s*#endregion\\b")}}},sb={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"]]}},ib={id:tb,conf:nb,language:sb},ob="scala",rb={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:new RegExp("^\\s*//\\s*(?:(?:#?region\\b)|(?:<editor-fold\\b))"),end:new RegExp("^\\s*//\\s*(?:(?:#?endregion\\b)|(?:</editor-fold>))")}}},lb={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"]]}},ab={id:ob,conf:rb,language:lb},db="deephavenDb",cb={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:new RegExp("^\\s*(?:def|class|for|if|elif|else|while|try|with|finally|except|async).*?:\\s*$"),action:{indentAction:1}}],folding:{offSide:!0,markers:{start:new RegExp("^\\s*#region\\b"),end:new RegExp("^\\s*#endregion\\b")}}},hb={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"]]}},ub={id:db,conf:cb,language:hb},mb="log",pb={},gb={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"}]]}},fb={id:mb,conf:pb,language:gb},An=X.module("MonacoUtils");window.MonacoEnvironment={getWorker(){return new ag}};class rt{static init(){An.debug("Initializing Monaco...");const{registerLanguages:e,removeHashtag:n}=rt,s=[{token:"",foreground:n(we.foreground)},{token:"string",foreground:n(we.string)},{token:"string.delim",foreground:n(we["string-delim"])},{token:"keyword",foreground:n(we.keyword)},{token:"identifier.js",foreground:n(we["identifier-js"])},{token:"delimiter",foreground:n(we.delimiter)},{token:"comment",foreground:n(we.comment)},{token:"number",foreground:n(we.number)},{token:"storage",foreground:n(we.storage)},{token:"identifier",foreground:n(we.identifier)},{token:"namespace.identifier",foreground:n(we["namespace-identifier"])},{token:"operator",foreground:n(we.operator)},{token:"predefined",foreground:n(we.predefined)},{token:"error.log",foreground:we["log-error"].substring(1)},{token:"warn.log",foreground:n(we["log-warn"])},{token:"info.log",foreground:n(we["log-info"])},{token:"stdout.log",foreground:n(we["log-stdout"])},{token:"trace.log",foreground:n(we["log-trace"])},{token:"debug.log",foreground:n(we["log-debug"])},{token:"date.log",foreground:n(we["log-date"])}],i={errorForeground:we["error-foreground"],"inputOption.activeBorder":we["input-option-active-border"],"editor.background":we.background,"editor.foreground":we.foreground,"editor.lineHighlightBackground":we["editor-line-highlight-bg"],"editorLineNumber.foreground":we["editor-line-number-foreground"],"editor.selectionBackground":we["editor-selection-background"],"editor.findMatchBackground":we["editor-find-match-background"],"editor.findMatchHighlightBackground":we["editor-find-match-highlight-background"],"editorSuggestWidget.background":we["editor-suggest-widget-background"],"editorSuggestWidget.border":we["editor-suggest-widget-border"],"editorSuggestWidget.foreground":we["editor-suggest-widget-foreground"],"editorSuggestWidget.selectedBackground":we["editor-suggest-widget-selected-background"],"editorSuggestWidget.highlightForeground":we["editor-suggest-widget-highlightForeground"],"list.hoverBackground":we["list-hover-background"],"dropdown.background":we["context-menu-background"],"dropdown.foreground":we["context-menu-foreground"],"menu.selectionBackground":we["menu-selection-background"],"list.focusBackground":we["menu-selection-background"],"editorWidget.background":we["editor-widget-background"],"inputOption.activeBackground":we["input-option-active-background"],"inputOption.activeForeground":we["input-option-active-foreground"],focusBorder:we["focus-border"],"input.background":we["input-background"],"input.foreground":we["input-foreground"],"input.border":we["input-border"]};ds.defineTheme("dh-dark",{base:"vs-dark",inherit:!0,rules:s,colors:i}),An.debug2("monaco theme: ",we),ds.setTheme("dh-dark"),e([ub,eb,ib,fb,ab]),An.debug("Monaco initialized.")}static removeHashtag(e){return e.substring(1)}static registerLanguages(e){const n=e.map(({id:s})=>s);Ri.getLanguages().filter(({id:s})=>n.includes(s)).forEach(s=>{const i=s;An.debug2("Overriding default language loader:",i.id)}),e.forEach(s=>{rt.registerLanguage(s)})}static registerLanguage(e){An.debug2("Registering language: ",e.id),Ri.register(e),Ri.onLanguage(e.id,()=>{Ri.setLanguageConfiguration(e.id,e.conf),Ri.setMonarchTokensProvider(e.id,e.language)})}static setEOL(e,n=ds.EndOfLineSequence.LF){var s;(s=e.getModel())==null||s.setEOL(n)}static openDocument(e,n){const s=e.getModel();A(s);const i={textDocument:{uri:`${s.uri}`,languageId:s.getLanguageId(),version:s.getVersionId(),text:s.getValue()}};return An.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};An.debug2("didChangeDocumentParams",c),n.changeDocument(c)}})}static closeDocument(e,n){const s=e.getModel();A(s);const i={textDocument:{uri:`${s.uri}`}};n.closeDocument(i)}static registerPasteHandler(e){e.onDidPaste(n=>{const s=/“|”/g,i=/\u200b/g,o=e.getModel();A(o);const r=o.getValueInRange(n.range);(s.test(r)||i.test(r))&&o.applyEdits([{range:n.range,text:r.replace(s,'"').replace(i,"")}])})}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){An.error(s)}}static removeKeybinding(e,n){if(n===void 0)return;const s=e._standaloneKeybindingService._getResolver()._map.get(n);s!=null?s.forEach(i=>{An.debug2(`Removing Monaco keybinding ${n} for ${i.command}`),e._standaloneKeybindingService.addDynamicKeybinding(`-${i.command}`,null,()=>{})}):An.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?gn.CtrlCmd:0)|(n.shiftKey?gn.Shift:0)|(n.altKey?gn.Alt:0)|(n.ctrlKey?gn.WinCtrl:0)|pc.fromString(s):(n.ctrlKey?gn.CtrlCmd:0)|(n.shiftKey?gn.Shift:0)|(n.altKey?gn.Alt:0)|(n.metaKey?gn.WinCtrl:0)|pc.fromString(s)}}const Lc=X.module("MonacoCompletionProvider");class Hu extends S.exports.PureComponent{constructor(e){super(e),this.handleCompletionRequest=this.handleCompletionRequest.bind(this)}componentDidMount(){const{language:e}=this.props;this.registeredCompletionProvider=Ri.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}`},position:{line:n.lineNumber-1,character:n.column-1},context:s},l=o.getCompletionItems(r);return Lc.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:w,insertTextFormat:T}=u,{start:E,end:y}=w.range,I={startLineNumber:E.line+1,startColumn:E.character+1,endLineNumber:y.line+1,endColumn:y.character+1};return{label:m,kind:p,detail:g,documentation:f,sortText:b,filterText:C,insertText:w.text,insertTextRules:T===2?4:T,range:I}});return{incomplete:!0,suggestions:c}}).catch(d=>(Lc.error("There was an error retrieving completion items",d),{suggestions:[]}))}render(){return null}}const ea=X.module("ConsoleInput"),$r=parseInt(we["line-height"],10),Vu=6,Uu=6,Cb=$r+Vu+Uu,ta=100,Bu=class extends S.exports.PureComponent{constructor(t){super(t),this.handleWindowResize=this.handleWindowResize.bind(this),this.commandContainer=Y.createRef(),this.commandHistoryIndex=null,this.timestamp=Date.now(),this.bufferIndex=0,this.history=[],this.modifiedCommands=new Map,this.state={commandEditorHeight:$r,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||(ea.debug("Command received: ",t),this.commandHistoryIndex=null,(s=this.commandEditor)==null||s.setValue(t),e&&this.focusEnd(),this.updateDimensions(),n&&this.processCommand())}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:$r,lineDecorationsWidth:3,lineNumbers:"off",minimap:{enabled:!1},renderLineHighlight:"none",scrollBeyondLastLine:!1,scrollbar:{arrowSize:0,horizontal:"hidden",horizontalScrollbarSize:0},padding:{top:Vu,bottom:Uu},tabCompletion:"on",value:"",wordWrap:"on"},s=this.commandContainer.current;A(s),this.commandEditor=ds.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;const{commandEditor:o,commandHistoryIndex:r}=this,l=o==null?void 0:o.getPosition();A(l);const{lineNumber:a}=l,d=o==null?void 0:o.getModel();if(i.keyCode===Bn.UpArrow&&!this.isSuggestionMenuPopulated()&&a===1){r!=null?this.loadCommand(r+1):this.loadCommand(0),this.focusStart(),i.stopPropagation(),i.preventDefault();return}if(i.keyCode===Bn.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}!i.altKey&&!i.shiftKey&&!i.metaKey&&(i.keyCode===Bn.Enter?this.isSuggestionMenuPopulated()||(i.stopPropagation(),i.preventDefault(),this.processCommand()):i.keyCode===Bn.Tab&&(this.isSuggestionMenuActive()?this.isSuggestionMenuPopulated()||(i.stopPropagation(),i.preventDefault()):(i.stopPropagation(),i.preventDefault(),(c=this.commandEditor)==null||c.trigger("Tab key trigger suggestions","editor.action.triggerSuggest",{}))))}),this.commandEditor.addCommand(gn.CtrlCmd|Bn.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();A(t);const e=t.getLineLength(1)+1,n=(i=this.commandEditor)==null?void 0:i.getTopForPosition(1,e);A(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();A(t);const e=t.getLineCount(),n=t.getLineLength(e)+1,s=(o=this.commandEditor)==null?void 0:o.getTopForPosition(e,n);A(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-ta&&this.loadMoreHistory()}async loadMoreHistory(){try{if(this.loadingPromise!=null||this.bufferIndex==null)return;const{commandHistoryStorage:t,language:e,scope:n}=this.props;this.loadingPromise=Ee.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+ta-1}),this.loadingPromise=Ee.makeCancelable(s.getViewportData(),()=>s.close());const i=await this.loadingPromise;this.bufferIndex+=ta,this.bufferIndex>=s.size&&(this.bufferIndex=null),this.history=[...i==null?void 0: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,Ee.isCanceled(t)){ea.debug2("Promise canceled, not loading history");return}ea.error("Error fetching history",t)}}processCommand(){var n,s;this.commandHistoryIndex=null,this.modifiedCommands.clear();const t=(n=this.commandEditor)==null?void 0:n.getValue().trim();A(t),t!==""&&(this.history.length===0||t!==this.history[this.history.length-1])&&this.history.push(t),(s=this.commandEditor)==null||s.setValue(""),this.updateDimensions();const{onSubmit:e}=this.props;e(t)}updateDimensions(){if(!this.commandEditor)return;const{maxHeight:t}=this.props;A(t);const e=this.commandEditor.getContentHeight(),n=Math.max(Math.min(e,t),Cb),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:W("console-input-wrapper",{disabled:t}),children:v("div",{className:W("console-input-inner-wrapper",{focus:i}),children:[h("div",{className:Bu.INPUT_CLASS_NAME,ref:this.commandContainer,style:{height:s}}),o&&h(Hu,{model:o,language:e,session:n})]})})}};let Wr=Bu;Wr.defaultProps={maxHeight:$r*10,scope:null,disabled:!1};Wr.INPUT_CLASS_NAME="console-input";const Oc="pasted values",bb=[/^audio.*/,/^font.*/,/^image.*/,/^video.*/],na=[".csv",".tsv",".tab",".psv",".dsv",".txt"],Ac=[".zip"],Di=class extends S.exports.Component{constructor(t){super(t),this.getValidExtensions=ge(e=>e?[...na,...Ac]:[...na]),this.getAcceptString=ge(e=>this.getValidExtensions(e).join(", ")),this.getFileTypeErrorString=ge(e=>tn.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=Y.createRef(),this.divElem=Y.createRef(),this.state={selectedFileName:""}}static isValidDropItem(t){return t!=null&&t.kind==="file"&&!bb.find(e=>e.test(t.type))}static isValidExtension(t,e=!1){return na.some(n=>t.endsWith(n))||e&&Ac.some(n=>t.endsWith(n))}static handleDragOver(t){t.preventDefault(),t.stopPropagation()}static getIcon(t){return t===Oc?bc:t.endsWith(".csv")?xf:t.endsWith(".zip")?lf:Lf}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();A(i),Di.isValidExtension(i.name,e)?this.handleFile(i):this.setState({dropError:Di.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:Oc,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:bc,action:this.handleMenuPaste,shortcut:ks.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 v("div",{ref:this.divElem,className:"csv-overlay fill-parent-absolute",onDragOver:Di.handleDragOver,onDrop:this.handleDrop,tabIndex:-1,children:[h(ie,{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==="")&&v("div",{className:"message-content",children:[h("div",{className:"message-icon",children:h(q,{icon:_f})}),h("label",{children:"Drop file (or paste values) here to import"}),h("div",{className:"message-small",children:h("label",{children:"or"})}),h(Q,{kind:"primary",onClick:this.handleSelectFile,children:"Select File..."})]}),s&&(o===void 0||o==="")&&v("div",{className:"selected-content",children:[h("div",{className:"selected-icon",children:h(q,{icon:Di.getIcon(s)})}),v("div",{className:"selected-text",children:[h("label",{children:"Selected File"}),v("label",{className:"selected-name",children:[s,!n&&h(Q,{kind:"ghost",className:"ml-2",onClick:this.unstageFile,icon:xn,tooltip:"Remove"})]})]})]}),Boolean(o)&&v("div",{className:"message-content",children:[h("div",{className:"message-icon",children:h(q,{icon:cs})}),h("label",{children:o}),o===Di.FILE_TYPE_ERROR&&h("div",{className:"message-small",children:h("label",{children:this.getFileTypeErrorString(t)})})]})]})}};let ls=Di;ls.defaultProps={allowZip:!1,dragError:null};ls.MULTIPLE_FILE_ERROR="Please select only one file";ls.FILE_TYPE_ERROR="Filetype not supported.";class De{}De.INTEGER="int";De.LONG="long";De.DOUBLE="double";De.BOOLEAN="bool";De.STRING="string";De.DATE_TIME="datetime";De.LOCAL_TIME="localtime";const Pc="unknown",Sb=2147483647,wb=-2147483648,Hc=/^[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]+)?$/,Vc=/^([0-9]+T)?([0-9]+):([0-9]+)(:[0-9]+)?(?:\.[0-9]{1,9})?$/;class Dt{static determineType(e,n,s){if(!e||e===s)return n;switch(n){case De.STRING:return De.STRING;case De.INTEGER:return Dt.checkInteger(e);case De.LONG:return Dt.checkLong(e);case De.DOUBLE:return Dt.checkDouble(e);case De.BOOLEAN:return Dt.checkBoolean(e);case De.DATE_TIME:return Dt.checkDateTime(e);case De.LOCAL_TIME:return Dt.checkLocalTime(e);default:return Dt.getTypeFromUnknown(e)}}static isNotParsableNumber(e){return isNaN(e)||e==="Infinity"||e==="-Infinity"}static checkInteger(e){const n=e.replace(/,/g,"");return Dt.isNotParsableNumber(n)?De.STRING:Dt.getNumberType(n)}static checkLong(e){const n=e.replace(/,/g,"");return Dt.isNotParsableNumber(n)?De.STRING:n.includes(".")?De.DOUBLE:De.LONG}static checkDouble(e){const n=e.replace(/,/g,"");return Dt.isNotParsableNumber(n)?De.STRING:De.DOUBLE}static checkBoolean(e){const n=e.toLowerCase();return n==="true"||n==="false"?De.BOOLEAN:De.STRING}static checkDateTime(e){return Hc.test(e)?De.DATE_TIME:De.STRING}static checkLocalTime(e){return Vc.test(e)?De.LOCAL_TIME:De.STRING}static getTypeFromUnknown(e){const n=e.replace(/,/g,"");if(Dt.isNotParsableNumber(n)){const s=e.toLowerCase();return s==="true"||s==="false"?De.BOOLEAN:Hc.test(e)&&e.includes(":")?De.DATE_TIME:Vc.test(e)?De.LOCAL_TIME:De.STRING}return Dt.getNumberType(n)}static getNumberType(e){if(e.includes("."))return De.DOUBLE;const n=e.startsWith("-")?11:10;if(e.length>n)return De.LONG;const s=parseInt(e,10);return s>Sb||s<wb?De.LONG:De.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;Ca.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(Pc),this.readHeaders&&(s=s.slice(1))}A(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]=Dt.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.
|
|
7
|
+
Expected length ${i.length} but found ${l.length}.
|
|
8
|
+
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;A(n),(e==null||!e.meta.aborted)&&s(n.map(i=>i===Pc?De.STRING:i))}handleError(e){const{onError:n}=this;n(e)}handleNodeUpdate(e){this.zipProgress=e.percent}}const ur=X.module("CsvParser"),vb=650,zr=class{static generateHeaderRecursive(t){let e="",n=t;return t>=26&&(e=e.concat(zr.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/Ca.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}
|
|
9
|
+
${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,Ca.parse(s,this.config)};new Dt(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){ur.debug2("CSV parser cancelled."),e.abort(),r.forEach(d=>d.close());return}let{data:l}=t;this.headers||(n?(this.headers=ms.legalizeColumnNames(l[0]),l=l.slice(1)):this.headers=zr.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>=vb||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,A(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(),A(this.headers),A(l),s.newTable(this.headers,l,e,this.timeZone).then(c=>{if(this.isCancelled){ur.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),ur.debug2(`CSV parser progress ${u}`),a(u),this.isComplete&&i.length===this.chunks&&(ur.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 $u=zr;$u.generateHeaders=t=>{const e=[];for(let n=0;n<t;n+=1)e.push(zr.generateHeaderRecursive(n));return e};class xs{static fromExtension(e){return e.endsWith(".csv")?"DEFAULT_CSV":e.endsWith(".tsv")||e.endsWith(".tab")?"TSV":e.endsWith(".psv")?"PIPE_SV":"AUTODETECT"}}xs.DEFAULT_TYPE="DEFAULT_CSV";xs.AUTO="AUTODETECT";xs.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
|
|
10
|
+
`,escapeChar:'"',shouldTrim:!0,skipEmptyLines:!0,nullString:null},EXCEL_CSV:{name:"Excel csv (strict)",delimiter:",",newline:`\r
|
|
11
|
+
`,escapeChar:'"',shouldTrim:!0,skipEmptyLines:!1,nullString:null},MY_SQL_CSV:{name:"MySQL csv",delimiter:" ",newline:`
|
|
12
|
+
`,escapeChar:"\\",shouldTrim:!0,skipEmptyLines:!1,nullString:"\\N"},RFC4180_CSV:{name:"RFC4180 csv",delimiter:",",newline:`\r
|
|
13
|
+
`,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 Uc=X.module("CsvInputBar"),Tb=Object.entries(xs.TYPES).map(([t,e])=>h("option",{value:t,children:e.name},t));class Wu extends S.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=Y.createRef(),this.state={tableName:"",tableNameSet:!1,isFirstRowHeaders:!0,showProgress:!1,progressValue:0,type:xs.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=ms.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:xs.fromExtension(n.name)}):s!=null&&s!==""&&(e.paste===void 0||e.paste==="")&&this.setState({type:xs.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;Uc.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){Uc.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 $u({onFileCompleted:d,session:s,file:e,type:xs.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(ls.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 v("div",{className:"csv-input-bar",children:[!o&&v("form",{onSubmit:this.handleUpload,className:"csv-input-bar-container form-inline",children:[v("div",{className:"form-group",children:[h("label",{htmlFor:"tableNameInput",children:"Table name"}),h("input",{ref:this.inputRef,id:"tableNameInput",type:"text",className:W("form-control",{"is-invalid":a}),value:s,onChange:this.handleTableName})]}),v("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:Tb})]}),h(Pt,{className:"firstRowHeaders",checked:i,onChange:this.toggleFirstRowHeaders,children:"First row is column headers"}),v("div",{className:"csv-input-buttons form-group",children:[h(Q,{kind:"secondary",onClick:this.handleCancel,children:"Cancel"}),h(Q,{kind:"primary",type:"submit",disabled:!(e!==null||n!==void 0&&n!=="")||!s,children:"Upload"})]})]}),o&&v("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})}),v("label",{children:[r,"%"]}),h(Q,{kind:"primary",onClick:this.handleCancelInProgress,children:"Cancel"})]})]})}}Wu.defaultProps={file:null,paste:null,unzip:null};const Bc=X.module("ConsoleMenu");class Gr extends S.exports.PureComponent{constructor(e){super(e),this.makeTableActions=ge((n,s,i)=>{const o=n.filter(r=>Ui.isTableType(r.type));return Gr.makeItemActions(o,s,r=>{this.tableSearchField=r},this.handleTableFilterChange,i)}),this.makeWidgetActions=ge((n,s,i)=>{const o=n.filter(r=>Ui.isWidgetType(r.type));return Gr.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(gs,{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){Bc.debug("filtering tables..."),this.setState({tableFilterText:e.target.value})}handleTableMenuClosed(){this.setState({tableFilterText:""})}handleTableMenuOpened(){var e;(e=this.tableSearchField)==null||e.focus()}handleWidgetFilterChange(e){Bc.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"};return v("div",{className:"console-pane-menu",children:[v(Q,{kind:"ghost",className:"btn-link-icon",disabled:r.length===0,onClick:()=>{},children:[v("div",{className:"fa-md fa-layers",children:[h(q,{mask:dd,icon:as,transform:"right-5 down-5"}),h(q,{icon:as,transform:"right-8 down-6"})]}),h(Ie,{children:"Tables"}),h(Wn,{actions:r,onMenuOpened:this.handleTableMenuOpened,onMenuClosed:this.handleTableMenuClosed,options:{initialKeyboardIndex:1},popperOptions:a},"table-actions ")]}),v(Q,{kind:"ghost",className:"btn-link-icon",disabled:l.length===0,onClick:()=>{},children:[v("div",{className:"fa-md fa-layers",children:[h(q,{mask:eu,icon:as,transform:"right-5 down-5"}),h(q,{icon:as,transform:"right-8 down-6"})]}),h(Ie,{children:"Widgets"}),h(Wn,{actions:l,onMenuOpened:this.handleWidgetMenuOpened,onMenuClosed:this.handleWidgetMenuClosed,options:{initialKeyboardIndex:1},popperOptions:a},"table-actions")]}),h(Q,{kind:"ghost",className:"btn-overflow btn-link-icon",icon:tu,tooltip:"More Actions...",onClick:()=>{},children:h(Wn,{actions:e,popperOptions:a})})]})}}class zu extends S.exports.PureComponent{constructor(e){super(e),this.handleCommandStarted=this.handleCommandStarted.bind(this),this.handleCommandCompleted=this.handleCommandCompleted.bind(this),this.pending=new ps,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 ai||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"),v("div",{className:"console-pane-status-bar",children:[v("div",{children:[h("div",{className:W("console-status-icon",l)}),h(Ie,{children:a})]}),e,h(Gr,{overflowActions:s,openObject:n,objects:i})]})}}zu.defaultProps={children:null};const Cs=X.module("Console"),$c={isAutoLaunchPanelsEnabled:!0,isPrintStdOutEnabled:!0,isClosePanelsOnDisconnectEnabled:!0},So=class extends S.exports.PureComponent{constructor(t){super(t),this.processLogMessageQueue=ui(()=>{this.scrollConsoleHistoryToBottom(),this.setState(s=>{Cs.debug2("processLogMessageQueue",this.queuedLogMessages.length," items");let{consoleHistory:i}=s;return i=i.concat(this.queuedLogMessages),this.queuedLogMessages=[],{consoleHistory:i}})},So.LOG_THROTTLE),this.getObjects=ge(s=>[...s.values()]),this.getContextActions=ge(s=>[...s,{action:this.handleClearShortcut,shortcut:Nn.CONSOLE.CLEAR},{action:this.handleFocusHistory,shortcut:Nn.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=Y.createRef(),this.consoleInput=Y.createRef(),this.consoleHistoryScrollPane=Y.createRef(),this.pending=new ps,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,...$c,...n}}static isErrorLevel(t){return t===bt.STDERR||t===bt.ERROR||t===bt.FATAL}static isOutputLevel(t){return t===bt.STDOUT||So.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=>{Cs.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;s.wrappedResult=void 0,s.cancelResult=void 0,t&&(s.result=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){const s=e;if(s.wrappedResult=void 0,s.cancelResult=void 0,Ee.isCanceled(t)){Cs.debug("Called handleCommandError on a cancelled promise result");return}this.updateWorkspaceHistoryItem({error:`${t}`},n),this.setState(i=>{const o=i.consoleHistory.concat(),r=o.lastIndexOf(s);return s.endTime=Date.now(),s.result={error:t},o[r]={...s},{consoleHistory:o}})}handleFocusHistory(t){t.preventDefault(),t.stopPropagation();const{focusCommandHistory:e}=this.props;e()}handleLogMessage(t){const{isPrintStdOutEnabled:e}=this.state;!e||So.isOutputLevel(t.logLevel)&&this.queueLogMessage(t.message,t.logLevel)}queueLogMessage(t,e){const n={};So.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)){Cs.debug2("updateKnownObjects no changes");return}this.setState(n=>{const s=n.consoleHistory.concat(),i=s.lastIndexOf(t);if(i<0)return Cs.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;A(c);const u=o.get(c);u!=null&&u>=0&&(s[u].disabledObjects=[...(m=s[u].disabledObjects)!=null?m:[],c]),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;A(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=>{Cs.warn("Error updating command history storage",a)})}).catch(i=>{Cs.debug("Error updating workspace history item",i)})}scrollConsoleHistoryToBottom(t=!1){const e=this.consoleHistoryScrollPane.current;A(e),!(!t&&e.scrollTop<e.scrollHeight-e.offsetHeight)&&window.requestAnimationFrame(()=>{e.scrollTop=e.scrollHeight})}handleScrollPaneScroll(){const t=this.consoleHistoryScrollPane.current;A(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:ls.MULTIPLE_FILE_ERROR});return}const n=e[0];ls.isValidDropItem(n)?this.setState({dragError:null}):this.setState({dragError:ls.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:ie.groups.high,icon:n?li:void 0,order:10},{title:"Auto Launch Panels",action:this.handleToggleAutoLaunchPanels,group:ie.groups.high,icon:t?li:void 0,order:20},{title:"Close Panels on Disconnect",action:this.handleToggleClosePanelsOnDisconnect,group:ie.groups.high,icon:e?li:void 0,order:30},{title:"Upload Table from File",action:this.handleUploadCsv,group:ie.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=>{Cs.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($c),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:w,csvUploadInProgress:T}=this.state,E=this.getObjects(g),y=Math.round(u*.7),I=this.getContextActions(t);return v("div",{role:"presentation",className:W("iris-console","h-100","w-100",{disabled:d}),children:[v("div",{className:"console-pane",ref:this.consolePane,children:[h(zu,{session:o,overflowActions:this.handleOverflowActions(),openObject:i,objects:E,children:s}),v("div",{className:"console-csv-container",onDragOver:ls.handleDragOver,onDragEnter:this.handleDragEnter,onDragLeave:this.handleDragLeave,children:[f&&h(ls,{onCancel:this.handleCsvFileCanceled,onFileOpened:this.handleCsvFileOpened,onPaste:this.handleCsvPaste,clearDragError:this.handleClearDragError,dragError:w,onError:this.handleCsvError,uploadInProgress:T,allowZip:c!=null}),v("div",{role:"presentation",className:W("scroll-pane no-scroll-x",{"scroll-decoration":p}),onScroll:this.handleScrollPaneScroll,ref:this.consoleHistoryScrollPane,children:[h(Pu,{items:m,openObject:i,language:n,disabled:d}),e]})]}),!f&&h(Wr,{ref:this.consoleInput,session:o,language:n,scope:r,onSubmit:this.handleCommandSubmit,maxHeight:y,commandHistoryStorage:l}),f&&h(Wu,{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(ie,{actions:I,ignoreClassNames:[Wr.INPUT_CLASS_NAME]})]})}};let pd=So;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 bl extends S.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();A(n),ds.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:"false",fixedOverflowWidgets:!0,folding:!1,fontFamily:"Fira Mono",glyphMargin:!1,language:"python",lineNumbersMinChars:3,minimap:{enabled:!1},scrollBeyondLastLine:!1,tabCompletion:"on",value:"",wordWrap:"off",...n},A(this.container),this.editor=ds.create(this.container,n),this.editor.addAction({id:"find",label:"Find",keybindings:[gn.CtrlCmd|Bn.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;A(this.editor),e(this.editor),this.editor.dispose(),this.editor=void 0}render(){const{className:e}=this.props;return h("div",{className:W("editor-container",e),ref:n=>{this.container=n}})}}bl.defaultProps={className:"fill-parent-absolute",onEditorInitialized:()=>{},onEditorWillDestroy:()=>{},settings:{}};const mn=X.module("ScriptEditor");class Gu extends S.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=Y.createRef(),this.state={model:null}}componentDidMount(){Be.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)&&(mn.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)&&(mn.debug("De-init completion and context actions"),this.deInitContextActions(),this.deInitCodeCompletion()),(n!=null&&e.sessionLanguage==null&&l||n!==void 0&&!a&&l)&&(mn.debug("Init completion and context actions"),this.initContextActions(),this.initCodeCompletion())}componentWillUnmount(){Be.removeEventListener("onUpdate",this.updateShortcuts)}getValue(){return this.editor?this.editor.getValue():(mn.error("Editor not initialized"),null)}getSelectedCommand(){var d,c;const e=(d=this.editor)==null?void 0:d.getSelection();A(e);const n=(c=this.editor)==null?void 0:c.getModel();A(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,settings:i,session:o,sessionLanguage:r}=this.props;mn.debug("handleEditorInitialized",r,o,i),this.editor=e,this.setState({model:this.editor.getModel()}),rt.setEOL(e),rt.registerPasteHandler(e),o!=null&&i&&r===i.language&&(this.initContextActions(),this.initCodeCompletion()),e.onDidChangeModelContent(s),n!=null&&n&&e.focus()}handleEditorWillDestroy(){mn.debug("handleEditorWillDestroy"),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){mn.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(Nn.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(Nn.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){mn.error("Code completion already initialized.");return}const{session:e}=this.props;mn.debug("initCodeCompletion",this.editor,e),this.editor&&e!=null&&(this.completionCleanup=rt.openDocument(this.editor,e))}deInitCodeCompletion(){const{session:e}=this.props;mn.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){A(this.editor);const s=this.editor.getModel();A(s);const i=s.getValue();i?s.setValue(`${i}
|
|
14
|
+
${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(){mn.debug("updateDimensions"),this.editor&&this.editor.layout()}focus(){mn.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(){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?r.language:null,c=l&&i&&d===o;return v(he,{children:[(e||s)&&h("div",{className:"h-100 w-100 position-relative",children:h(ml,{errorMessage:a,isLoading:s,isLoaded:n})}),n&&h("div",{className:"h-100 w-100 script-editor",children:r&&v(he,{children:[h(bl,{ref:this.editorComponent,settings:r,onEditorInitialized:this.handleEditorInitialized,onEditorWillDestroy:this.handleEditorWillDestroy}),c!=null&&c&&h(Hu,{model:l,language:d,session:i})]})})]})}}Gu.defaultProps={error:null,isLoading:!1,isLoaded:!1,focusOnMount:!0,onChange:()=>{},session:null,sessionLanguage:null,settings:null};const Eb={groovy:"Groovy",python:"Python",scala:"Scala"};class Wc{static normalizeScriptLanguage(e){return Eb[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 yb=250,Ib=2500,Ku=class extends S.exports.Component{constructor(t){super(t),this.loadData=Xe(()=>{const{commandHistoryStorage:e,item:n,language:s}=this.props,{id:i}=n;this.cleanup=e.listenItem(s,i,this.handleUpdate,this.handleError)},yb),this.getPreviewText=Te(e=>e.split(`
|
|
15
|
+
`,Ib).join(`
|
|
16
|
+
`),{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":In.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=Ku.getTimeString(r,l!=null?l:n),c=this.getPreviewText(t),u=Boolean(d);return v("div",{className:"command-history-item-tooltip",children:[v("div",{className:"scroll-container",children:[h(Cl,{language:e,children:c}),c.length<t.length&&h("p",{children:"Preview Truncated..."})]}),v("div",{className:"result-info",children:[v("div",{className:"d-flex justify-content-between",children:[Boolean(a)&&v("div",{className:"text-danger mr-1",children:[h(q,{icon:cs})," Executed with errors"]}),v("div",{className:"time-wrapper",children:["Elapsed time:"," ",u?h("span",{className:"time-string",children:d}):h(_n,{})]})]}),Boolean(a)&&h("div",{className:"error-message",children:a})]})]})}};let qu=Ku;qu.defaultProps={onUpdate:()=>{}};const Rb=512,Yu=t=>{const{item:e,language:n,isSelected:s,commandHistoryStorage:i}=t,o=e.name.substring(0,Rb),r=S.exports.useRef(null),l=S.exports.useCallback(()=>{var a;(a=r.current)==null||a.update()},[r]);return v("div",{className:W("command-history-item",{selected:s}),children:[o,h(Ie,{ref:r,interactive:!0,options:{placement:"left",modifiers:{preventOverflow:{enabled:!0,boundariesElement:"viewport",order:825}}},popperClassName:"command-history-item-popper",children:h(qu,{item:e,language:n,onUpdate:l,commandHistoryStorage:i})})]})};Yu.defaultProps={isSelected:!1};class Kr extends S.exports.Component{static itemKey(e,n){return`${n.title}`}static renderContent(e){return e.selectionRequired!==void 0&&e.selectionRequired?v("div",{className:"fa-md fa-layers",children:[h(q,{icon:Fo,mask:e.icon,transform:"right-5 down-5 shrink-4"}),h(q,{icon:Qg,transform:"shrink-3 right-7 down-6"})]}):h(q,{icon:e.icon})}render(){const{actions:e,hasSelection:n}=this.props;return h("div",{className:"command-history-actions",children:e.map((s,i)=>h(Q,{kind:"inline",className:W(s.className),onClick:s.action,tooltip:s.description,disabled:s.selectionRequired!==void 0&&s.selectionRequired&&!n,icon:Kr.renderContent(s)},Kr.itemKey(i,s)))})}}const Db=150,zc=3,Gc=X.module("CommandHistoryViewportUpdater");function Mb({table:t,columns:e,top:n=0,bottom:s=0,search:i,isReversed:o=!1,onUpdate:r}){const l=S.exports.useMemo(()=>ui(a=>{const d=a.bottom-a.top,c=Math.max(0,a.top-d*zc),u=a.bottom+d*zc;t.setViewport({top:c,bottom:u,columns:a.columns})},Db),[t]);return S.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()=>{Gc.debug("onUpdate cleanup"),d()}},[t,r]),S.exports.useEffect(function(){t.setSearch(i!=null?i:"")},[t,i]),S.exports.useEffect(function(){l({top:n,bottom:s,columns:e})},[l,n,s,e,i,o]),S.exports.useEffect(()=>()=>{Gc.debug2("Cancel throttledUpdateViewport"),l.cancel()},[l]),null}const bs=X.module("CommandHistory"),ss=class extends S.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:af,shortcut:ks.COPY,action:this.copySelectedCommands,group:ie.groups.edit},{title:"Send to Console",description:"Open selected commands in the console",icon:wc,shortcut:Nn.COMMAND_HISTORY.SEND_TO_CONSOLE,action:this.sendToConsole,group:ss.menuGroups.send,order:10},{title:"Run in Console",description:"Run selected commands in the console",icon:Br,shortcut:Nn.COMMAND_HISTORY.RUN,action:this.runInConsole,group:ss.menuGroups.send,order:10},{title:"Send to Active Notebook",description:"Open selected commands in a notebook",icon:Sc,shortcut:Nn.COMMAND_HISTORY.SEND_TO_NOTEBOOK,action:this.sendToNotebook,group:ss.menuGroups.send,order:20},{title:"Send to New Notebook",description:"Open selected commands in a new notebook",icon:su,action:this.createNotebook,group:ss.menuGroups.send,order:30}],this.historyActions=[{title:"Send to Console",icon:wc,selectionRequired:!0,description:"Open selected commands in the console",action:this.sendToConsole},{title:"Send to Notebook",icon:Sc,selectionRequired:!0,description:"Open selected commands in a notebook",action:this.sendToNotebook}],this.pending=new ps,this.searchInputRef=Y.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 ss.getCommandsFromViewport(t,e,s);const{table:i}=this.props;return this.pending.add(ss.getCommandsFromSnapshot(i,s))}getSelectedCommandText(){return this.getSelectedCommands().then(t=>t.join(`
|
|
17
|
+
`))}updateActions(){this.setState(t=>{const{selectedRanges:e}=t,n=e.reduce((s,i)=>s+i[1]-i[0]+1,0);return n>0&&n<ss.MAX_SELECTION_COUNT?(bs.debug("Updating actions",this.itemActions),{actions:this.itemActions}):(bs.debug("Disabling actions",n),{actions:[]})})}copySelectedCommands(){this.getSelectedCommandText().then(Ne.copyToClipboard).catch(bs.error)}createNotebook(){this.getSelectedCommandText().then(t=>{const{language:e,sendToNotebook:n}=this.props;n({value:t,language:e},!0)}).catch(bs.error)}sendToNotebook(){this.getSelectedCommandText().then(t=>{const{language:e,sendToNotebook:n}=this.props;n({value:t,language:e})}).catch(bs.error)}sendToConsole(){const{sendToConsole:t}=this.props;this.getSelectedCommandText().then(t).catch(bs.error)}runInConsole(){this.getSelectedCommandText().then(t=>{const{sendToConsole:e}=this.props;e(t,!0,!0)}).catch(bs.error)}handleSelect(t){const{sendToConsole:e}=this.props,{items:n,offset:s}=this.state;if(t<s||t>=s+n.length){bs.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(Yu,{isSelected:n,item:t,language:s,commandHistoryStorage:i})}focus(){this.searchInputRef.current&&this.searchInputRef.current.focus()}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=_u.LANGUAGE_MAP.get(t))!=null?m:"";return v("div",{className:"command-history",children:[v("div",{className:"command-history-search-bar",children:[h(gs,{ref:this.searchInputRef,value:i,placeholder:`${u} Command History`,onChange:this.handleSearchChange}),h(Kr,{actions:s,hasSelection:c.length>0})]}),v("div",{className:"command-history-list",children:[h(bn,{itemCount:a,items:l,offset:d,selectedRanges:c,onSelect:this.handleSelect,onSelectionChange:this.handleSelectionChange,onViewportChange:this.handleViewportChange,renderItem:this.renderItem,rowHeight:ss.ITEM_HEIGHT,isDoubleClickSelect:!0,isMultiSelect:!0,isStickyBottom:!0}),h(Mb,{table:e,top:o,bottom:r,search:i,onUpdate:this.handleViewportUpdate}),h(ie,{actions:n})]})]})}};let Sl=ss;Sl.ITEM_HEIGHT=29;Sl.MAX_SELECTION_COUNT=1e4;Sl.menuGroups={send:ie.groups.medium+100};class Nb extends S.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 v("div",{className:W("log-level-menu-item",e),children:[h(Ru,{on:n,onClick:this.handleSwitchClick}),e]})}}const Lt=class extends S.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`${Ui.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<Lt.AllLogLevels.length;n+=1){const s=Lt.AllLogLevels[n],i=t[s]!=null?t[s]:!1;e.push({title:s,group:1,order:n+100,menuElement:h(Nb,{logLevel:s,on:i,onClick:this.handleMenuItemClick,ref:o=>{o!=null&&(this.logLevelMenuItems[s]=o)}})})}return e.push({group:1,order:1e3,menuElement:v("div",{className:"log-level-menu-controls",children:[h(Q,{kind:"ghost",className:"log-level-toggle-all",onClick:this.handleToggleAllClick,children:"Toggle All"}),h(Q,{kind:"ghost",onClick:this.handleResetClick,children:"Reset"})]})}),e}resetLogLevels(){const t={};for(let e=0;e<Lt.AllLogLevels.length;e+=1){const n=Lt.AllLogLevels[e],s=Lt.DefaultLogLevels.indexOf(n)>=0;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(){A(this.editorContainer),this.editor=ds.create(this.editorContainer,{copyWithSyntaxHighlighting:!1,fixedOverflowWidgets:!0,folding:!1,fontFamily:"Fira Mono",glyphMargin:!1,language:"log",lineDecorationsWidth:0,lineNumbersMinChars:0,minimap:{enabled:!1},readOnly:!0,renderLineHighlight:"none",scrollBeyondLastLine:!1,value:"",wordWrap:"on"}),this.editor.addCommand(Bn.Escape,()=>{}),this.editor.addCommand(gn.Shift|Bn.Escape,()=>{}),this.editor.addCommand(Bn.Escape,()=>{var e,n;const t=(e=this.editor)==null?void 0:e.getPosition();A(t),(n=this.editor)==null||n.setPosition(t)},"findWidgetVisible && editorTextFocus"),this.editor.addCommand(gn.Shift|Bn.Escape,()=>{var e,n;const t=(e=this.editor)==null?void 0:e.getPosition();A(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<Lt.AllLogLevels.length;n+=1){const s=Lt.AllLogLevels[n];if(!t[s]){e=!1;break}}if(e)this.setState({shownLogLevels:{}});else{const n={};for(let s=0;s<Lt.AllLogLevels.length;s+=1){const i=Lt.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();A(n);let s=e==null?void 0:e.getLineLength(n);A(s);const i=this.isBottomVisible(),o=[];if(s>0&&(o.push({range:{startLineNumber:n,startColumn:s+1,endLineNumber:n,endColumn:s+1},text:`
|
|
18
|
+
`,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();A(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=Lt.getLogText(o);r.length>0&&(n+=r,r.charAt(r.length-1)!==`
|
|
19
|
+
`&&(n+=`
|
|
20
|
+
`))}}if(n=n.trimRight(),this.editor.setValue(n),e){const i=(s=this.editor.getModel())==null?void 0:s.getLineCount();A(i),this.editor.revealLine(i,1)}this.stopFlushTimer(),this.bufferedMessages=[]}truncateLogIfNecessary(){this.messages.length>Lt.maxLogSize&&(this.messages=this.messages.splice(this.messages.length-Lt.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();A(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 A(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=Lt.getLogText(n);t+=s,s.charAt(s.length-1)!==`
|
|
21
|
+
`&&(t+=`
|
|
22
|
+
`)}this.bufferedMessages=[],this.appendLogText(t)}queue(t){this.bufferedMessages.push(t),this.bufferedMessages.length===1&&(this.flushTimer=setTimeout(this.handleFlushTimeout,Lt.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 v("div",{className:"log-pane h-100 w-100",children:[v("div",{className:"log-pane-menu",children:[h(Q,{kind:"ghost",className:"btn-clear-logs",onClick:this.handleClearClick,icon:Yf,tooltip:"Clear log"}),h(Q,{kind:"ghost",className:"btn-link-icon btn-overflow",icon:Vo,tooltip:"Log Settings",onClick:()=>{},children:h(Wn,{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 Yi=Lt;Yi.DefaultLogLevels=[bt.STDOUT,bt.ERROR,bt.FATAL,bt.STDERR,bt.WARN];Yi.AllLogLevels=[bt.INFO,bt.STDOUT,bt.ERROR,bt.FATAL,bt.STDERR,bt.WARN,bt.DEBUG,bt.TRACE];Yi.bufferTimeout=16;Yi.maxLogSize=131072;Yi.truncateSize=65536;class Je{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""}}Je.TYPE_GLOBAL="type-global";Je.TYPE_CONTEXT_PRESET="type-context-preset";Je.TYPE_CONTEXT_CUSTOM="type-context-custom";class Fb extends Je{format(e){switch(e){case 1:case!0:return"true";case 0:case!1:return"false";default:return""}}}class xb extends Je{format(e){return String.fromCharCode(e)}}const Kc=X.module("DateTimeColumnFormatter"),Xs=class extends Je{constructor({timeZone:t="",showTimeZone:e=!0,showTSeparator:n=!1,defaultDateTimeFormatString:s=Xs.DEFAULT_DATETIME_FORMAT_STRING}={}){super();const i=t||Xs.DEFAULT_TIME_ZONE_ID;try{this.dhTimeZone=M.i18n.TimeZone.getTimeZone(i)}catch{Kc.error("Unsupported time zone id",i),this.dhTimeZone=M.i18n.TimeZone.getTimeZone(Xs.DEFAULT_TIME_ZONE_ID)}this.defaultDateTimeFormatString=s,this.showTimeZone=e,this.showTSeparator=n,this.formatStringMap=Xs.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=Je.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[...Xs.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[...Xs.makeFormatStringMap(t,e).keys()]}getEffectiveFormatString(t){var e;return(e=this.formatStringMap.get(t))!=null?e:t}format(t,e){const n=e&&e.formatString||this.defaultDateTimeFormatString,s=this.getEffectiveFormatString(n);try{return M.i18n.DateTimeFormat.format(s,t,this.dhTimeZone)}catch{Kc.error("Invalid format arguments")}return""}};let lt=Xs;lt.DEFAULT_DATETIME_FORMAT_STRING="yyyy-MM-dd HH:mm:ss.SSS";lt.DEFAULT_TIME_ZONE_ID="America/New_York";const _b=X.module("DecimalColumnFormatter"),zn=class extends Je{constructor({defaultFormatString:t=zn.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=Je.TYPE_CONTEXT_PRESET,s){return{label:t,type:n,formatString:e,multiplier:s}}static makePresetFormat(t,e="",n){return zn.makeFormat(t,e,Je.TYPE_CONTEXT_PRESET,n)}static makeCustomFormat(t="",e){return zn.makeFormat("Custom Format",t,Je.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&&e.formatString||this.defaultFormatString,s=e&&e.multiplier!==void 0&&e.multiplier!==0?t*e.multiplier:t;try{return M.i18n.NumberFormat.format(n,s)}catch{_b.error("Invalid format arguments")}return""}};let Ue=zn;Ue.DEFAULT_FORMAT_STRING="###,##0.0000";Ue.FORMAT_PERCENT=zn.makePresetFormat("Percent","##0.00%");Ue.FORMAT_BASIS_POINTS=zn.makePresetFormat("Basis Points","###,##0 bp",1e4);Ue.FORMAT_MILLIONS=zn.makePresetFormat("Millions","###,##0.000 mm",1e-6);Ue.FORMAT_ROUND=zn.makePresetFormat("Round","###,##0");Ue.FORMAT_ROUND_TWO_DECIMALS=zn.makePresetFormat("0.00","###,##0.00");Ue.FORMAT_ROUND_FOUR_DECIMALS=zn.makePresetFormat("0.0000","###,##0.0000");class kb extends Je{format(e){return`${e}`}}const Lb=X.module("IntegerColumnFormatter"),yo=class extends Je{constructor({defaultFormatString:t=yo.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=Je.TYPE_CONTEXT_PRESET,s){return{label:t,type:n,formatString:e,multiplier:s}}static makePresetFormat(t,e="",n){return yo.makeFormat(t,e,Je.TYPE_CONTEXT_PRESET,n)}static makeCustomFormat(t="",e){return yo.makeFormat("Custom Format",t,Je.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&&e.formatString||this.defaultFormatString,s=e&&e.multiplier!==void 0&&e.multiplier!==0?t*e.multiplier:t;try{return M.i18n.NumberFormat.format(n,s)}catch{Lb.error("Invalid format arguments")}return""}};let dt=yo;dt.DEFAULT_FORMAT_STRING="###,##0";dt.FORMAT_MILLIONS=yo.makePresetFormat("Millions","###,##0.000 mm",1e-6);class Ob extends Je{format(e){return e}}const $t=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($t.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=$t.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 $t.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<$t.months.length;s+=1)if($t.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=$t.makeDateWrapper(e,l.getFullYear(),l.getMonth(),l.getDate()),d=$t.makeDateWrapper(e,l.getFullYear(),l.getMonth(),l.getDate()+1);return[a,d]}if(n==="yesterday"){const l=new Date(Date.now()),a=$t.makeDateWrapper(e,l.getFullYear(),l.getMonth(),l.getDate()-1),d=$t.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=$t.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=$t.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=$t.makeDateWrapper(e,i.year,i.month,i.date,i.hours,i.minutes,i.seconds,i.nanos),r=$t.getNextDate(s,i,e);return[o,r]}static getJsDate(t){return typeof t=="number"?new Date(t):t.asDate()}};let us=$t;us.FULL_DATE_FORMAT="yyyy-MM-dd HH:mm:ss.SSSSSSSSS";us.months=["january","february","march","april","may","june","july","august","september","october","november","december"];class zt{}zt.not="not";zt.and="and";zt.or="or";function Ab(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 Pb(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 Hb(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 Vb(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 Ub(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 es=X.module("TableUtils"),ne=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=ne.getSortIndex(t,e);return n!=null?t[n]:null}static getFilterText(t){return t?t.toString():null}static getFilterTypes(t){return ne.isBooleanType(t)?[K.isTrue,K.isFalse,K.isNull]:ne.isCharType(t)||ne.isNumberType(t)||ne.isDateType(t)?[K.eq,K.notEq,K.greaterThan,K.greaterThanOrEqualTo,K.lessThan,K.lessThanOrEqualTo]:ne.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=ne.getSortForColumn(e,n);return s===null?t[n].sort().asc():s.direction===ne.sortDirection.ascending?s.desc():null}static makeColumnSort(t,e,n,s){if(t==null||e<0||e>=t.length||n===ne.sortDirection.none)return null;let i=t[e].sort();switch(n){case ne.sortDirection.ascending:i=i.asc();break;case ne.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=ne.getNextSort(e,t,n);return ne.setSortForColumn(t,n,i,s)}static sortColumn(t,e,n,s,i,o){if(t==null||n<0||n>=e.length)return[];const r=ne.makeColumnSort(e,n,s,i);return ne.setSortForColumn(t,n,r,o)}static setSortForColumn(t,e,n,s=!1){const i=ne.getSortIndex(t,e);let o=[];return s&&(o=o.concat(t.filter(({direction:r})=>r!==ne.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 ne.dataType.BOOLEAN:return ne.dataType.BOOLEAN;case"char":case"java.lang.Character":case ne.dataType.CHAR:return ne.dataType.CHAR;case"java.lang.String":case ne.dataType.STRING:return ne.dataType.STRING;case"io.deephaven.db.tables.utils.DBDateTime":case"io.deephaven.time.DateTime":case"com.illumon.iris.db.tables.utils.DBDateTime":case ne.dataType.DATETIME:return ne.dataType.DATETIME;case"double":case"java.lang.Double":case"float":case"java.lang.Float":case"java.math.BigDecimal":case ne.dataType.DECIMAL:return ne.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 ne.dataType.INT:return ne.dataType.INT;default:return ne.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 ne.isIntegerType(t)||ne.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 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 ne.getNormalizedType(t)===ne.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=ne.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 ne.isNumberType(s)?this.makeQuickNumberFilter(t,e):ne.isBooleanType(s)?this.makeQuickBooleanFilter(t,e):n!=null&&ne.isDateType(s)?this.makeQuickDateFilter(t,e,n):ne.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=ne.removeCommas(a),ne.isLongType(t.type))try{a=M.FilterValue.ofNumber(M.LongWrapper.ofString(`${l!=null?"-":""}${a}`))}catch(u){return es.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(),ne.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=ne.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 ne.makeQuickDateFilterWithOperation(t,l,a,n)}static makeQuickDateFilterWithOperation(t,e,n=K.eq,s){if(t==null)throw new Error("Column is null");const[i,o]=us.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(ne.isRangeOperation(o)?ne.quoteValue(r):r);return ne.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 Ee.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 cu(`Event "${e}" timed out.`))},n),i=t.addEventListener(e,c=>{if(s!=null&&!s(c)){es.debug2("Event triggered, but matcher returned false.");return}es.debug2("Event triggered, resolving."),i(),clearTimeout(o),r=!1,a(c)})});return l.cancel=()=>{if(r){es.debug2("Pending promise cleanup."),i(),clearTimeout(o),r=!1;return}es.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=ne.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===zt.and)l=l.and(p);else if(g===zt.or)l=l.or(p);else{es.error("Unexpected filter operator",g,p),l=null;break}}}else es.debug2("Empty filter ignored for",u,m)}catch(p){es.error("Unable to create filter",p),l=null;break}}const a=ne.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=ne.getBaseType(t);return ne.isTextType(n)?M.FilterValue.ofString(e):ne.isLongType(n)?M.FilterValue.ofNumber(M.LongWrapper.ofString(ne.removeCommas(e))):M.FilterValue.ofNumber(ne.removeCommas(e))}static makeFilterRawValue(t,e){return ne.isTextType(t)?M.FilterValue.ofString(e):ne.isBooleanType(t)?M.FilterValue.ofBoolean(e):M.FilterValue.ofNumber(e)}static makeValue(t,e,n){if(e==null||e==="null")return null;if(ne.isTextType(t))return e;if(ne.isLongType(t))return M.LongWrapper.ofString(ne.removeCommas(e));if(ne.isBooleanType(t))return ne.makeBooleanValue(e,!0);if(ne.isDateType(t)){const[s]=us.parseDateRange(e,n);return s}return ne.isNumberType(t)?ne.makeNumberValue(e):(es.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=ne.removeCommas(e);if(ne.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(ne.isDateType(t.type))return ne.makeQuickDateFilterWithOperation(t,n,e,s);if(ne.isNumberType(t.type)||ne.isCharType(t.type))return ne.makeQuickFilter(t,`${ne.getFilterOperatorString(e)}${n}`);const i=ne.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;ne.isTextType(t.type)?o=M.FilterValue.ofString("a"):ne.isBooleanType(t.type)?o=M.FilterValue.ofBoolean(!0):ne.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:ne.isTextType(t.type)?s.push(M.FilterValue.ofString(typeof r=="number"?String.fromCharCode(r):r)):ne.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 tn.sort(i,o,e)})}};let P=ne;P.dataType={BOOLEAN:"boolean",CHAR:"char",DATETIME:"datetime",DECIMAL:"decimal",INT:"int",STRING:"string",UNKNOWN:"unknown"};P.sortDirection={ascending:"ASC",descending:"DESC",reverse:"REVERSE",none:null};P.REVERSE_TYPE=Object.freeze({NONE:"none",PRE_SORT:"pre-sort",POST_SORT:"post-sort"});P.NUMBER_REGEX=/^-?\d+(\.\d+)?$/;class hn{static makeColumnFormatMap(e){return e==null?new Map:e.reduce((n,s)=>{const i=P.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 kb,this.typeFormatterMap=new Map([[P.dataType.BOOLEAN,new Fb],[P.dataType.CHAR,new xb],[P.dataType.DATETIME,new lt(n)],[P.dataType.DECIMAL,new Ue(s)],[P.dataType.INT,new dt(i)],[P.dataType.STRING,new Ob]]),this.columnFormatMap=hn.makeColumnFormatMap(e),this.truncateNumbersWithPound=o}getColumnFormatMapForType(e,n=!1){const s=P.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=P.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(P.dataType.DATETIME);return(n=e==null?void 0:e.dhTimeZone)==null?void 0:n.id}}function Bb(t){if(t&&t.formatter){const{formatter:e}=t;return e}}function $b(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 Wb(t,e,n){const s=t.getColumnFormat(n,e);return s!=null&&(s.type===Je.TYPE_CONTEXT_PRESET||s.type===Je.TYPE_CONTEXT_CUSTOM)}const hs={getColumnFormats:Bb,getDateTimeFormatterOptions:$b,isCustomColumnFormatDefined:Wb};Hr.register([cg,hg,ug,mg,pg,gg]);const Xu=typeof Ql=="function"?Ql(Hr):Ql.default(Hr),is=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(is.EVENT_UPDATED,{detail:t}))}fireDisconnect(){this.fireEvent(new CustomEvent(is.EVENT_DISCONNECT))}fireReconnect(){this.fireEvent(new CustomEvent(is.EVENT_RECONNECT))}fireDownsampleStart(t){this.fireEvent(new CustomEvent(is.EVENT_DOWNSAMPLESTARTED,{detail:t}))}fireDownsampleFinish(t){this.fireEvent(new CustomEvent(is.EVENT_DOWNSAMPLEFINISHED,{detail:t}))}fireDownsampleFail(t){this.fireEvent(new CustomEvent(is.EVENT_DOWNSAMPLEFAILED,{detail:t}))}fireDownsampleNeeded(t){this.fireEvent(new CustomEvent(is.EVENT_DOWNSAMPLENEEDED,{detail:t}))}fireLoadFinished(){this.fireEvent(new CustomEvent(is.EVENT_LOADFINISHED))}};let St=is;St.EVENT_UPDATED="ChartModel.EVENT_UPDATED";St.EVENT_DISCONNECT="ChartModel.EVENT_DISCONNECT";St.EVENT_RECONNECT="ChartModel.EVENT_RECONNECT";St.EVENT_DOWNSAMPLESTARTED="ChartModel.EVENT_DOWNSAMPLESTARTED";St.EVENT_DOWNSAMPLEFINISHED="ChartModel.EVENT_DOWNSAMPLEFINISHED";St.EVENT_DOWNSAMPLEFAILED="ChartModel.EVENT_DOWNSAMPLEFAILED";St.EVENT_DOWNSAMPLENEEDED="ChartModel.EVENT_DOWNSAMPLENEEDED";St.EVENT_LOADFINISHED="ChartModel.EVENT_LOADFINISHED";const zb="#76d9e4 #9edc6f #fcd65b #aa9af4 #f37e3f #f95d84 #f0f0ee",Gb="#403e41",Kb="#5b5a5c",qb="#c0bfbf",Yb="#4878ea",Xb="rgba(91, 90, 92, 0.7)",yt={"paper-bgcolor":"#2d2a2e","plot-bgcolor":"#322f33","title-color":"#f0f0ee",colorway:zb,gridcolor:Gb,linecolor:Kb,zerolinecolor:qb,activecolor:Yb,rangebgcolor:Xb,"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"},rn=Object.freeze({paper_bgcolor:yt["paper-bgcolor"],plot_bgcolor:yt["plot-bgcolor"],title_color:yt["title-color"],colorway:yt.colorway,gridcolor:yt.gridcolor,linecolor:yt.linecolor,zerolinecolor:yt.zerolinecolor,activecolor:yt.activecolor,rangebgcolor:yt.rangebgcolor,area_color:yt["area-color"],trend_color:yt["trend-color"],line_color:yt["line-color"],error_band_line_color:yt["error-band-line-color"],error_band_fill_color:yt["error-band-fill-color"],ohlc_increasing:yt["ohlc-increasing"],ohlc_decreasing:yt["ohlc-decreasing"]}),mr=X.module("ChartUtils"),Ss=Object.freeze(M.calendar.DayOfWeek.values()),qc="io.deephaven.time.DateTime",jb=36e5,Qb=1e6;function Zb(t){return t.asDate!==void 0}function Jb(t){return t.asNumber!==void 0}function Yc(t){return t.dhTimeZone!==void 0}function eS(t){return t!=null&&t.range&&(t.autorange===!1||t.autorange===void 0)}const re=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?re.ORIENTATION.HORIZONTAL:re.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&&Yc(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*)(%?)(.*)/);A(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,w=a.length+d.length,E=`0${p}${f}.${w}${C}`,y=re.convertNumberPrefix(o),I=re.convertNumberPrefix(m);return{tickformat:E,tickprefix:y,ticksuffix:I,automargin:!0}}static getPlotlyAxisFormat(t,e=null){const{axis:n,columnType:s}=t,{formatPattern:i}=n;let o=null;return P.isDateType(s)?(o=re.getPlotlyDateFormat(e,s,i),o=re.addTickSpacing(o,n,!0)):P.isNumberType(s)&&(o=re.getPlotlyNumberFormat(e,s,i),o=re.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/Qb),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=re.ORIENTATION.VERTICAL){return{type:t,mode:e,name:n,orientation:s}}static makeSeriesDataFromSeries(t,e,n,s=rn){const{name:i,plotStyle:o,lineColor:r,shapeColor:l,sources:a}=t,d=a.some(g=>{var f;return(f=g.axis)==null?void 0:f.businessCalendar}),c=re.getChartType(o,d),u=re.getPlotlyChartMode(o),m=re.getPlotlySeriesOrientation(t),p=re.makeSeriesData(c,u,i,m);return re.addSourcesToSeriesData(p,o,a,e),re.addStylingToSeriesData(p,o,s,r,l,n),p}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=re.getPlotlyProperty(e,a);Wh(i,d,[]);const c=l!=null?re.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=rn,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},{charts:i}=t;for(let o=0;o<i.length;o+=1){const r=i[o],l=re.groupArray(r.axes,"type");for(let a=0;a<r.series.length;a+=1){const d=r.series[a],{sources:c}=d,u=c.filter(m=>m.axis);for(let m=0;m<u.length;m+=1){const p=u[m],{axis:g}=p,{type:f}=g,b=l.get(f);A(b);const C=b.indexOf(g),w=re.getAxisPropertyName(f);if(w!=null){const T=re.getAxisLayoutProperty(w,C);if(n.has(T))mr.debug(`${T} already added.`);else{mr.debug(`Adding ${T} to axisFormats.`);const E=re.getPlotlyAxisFormat(p,e);if(E===null)n.set(T,s);else{n.set(T,E);const{businessCalendar:y}=g;if(y!=null){const I=[],{businessPeriods:D,businessDays:N,holidays:x,timeZone:U}=y,$=e==null?void 0:e.getColumnTypeFormatter(qc);let L;Yc($)&&(L=$.dhTimeZone);const H=L?(U.standardOffset-L.standardOffset)/60:0;x.length>0&&I.push(...re.createRangeBreakValuesFromHolidays(x,U,L)),D.forEach(O=>I.push({pattern:"hour",bounds:[re.periodToDecimal(O.close)+H,re.periodToDecimal(O.open)+H]})),N.length<Ss.length&&re.createBoundsFromDays(N).forEach(O=>I.push({pattern:"day of week",bounds:O})),E.rangebreaks=I}if(n.size===r.axes.length)return n}}}}}}return n}static getChartType(t,e){switch(t){case M.plot.SeriesPlotStyle.HISTOGRAM:return"bar";default:return re.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 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];eS(o)&&(e[i]=[...o.range])}return e}static updateLayoutAxes(t,e,n=0,s=0,i=null,o=rn){const r=n>0?Math.max(re.MIN_AXIS_SIZE,Math.min(re.AXIS_SIZE_PX/s,re.MAX_AXIS_SIZE)):re.DEFAULT_AXIS_SIZE,l=s>0?Math.max(re.MIN_AXIS_SIZE,Math.min(re.AXIS_SIZE_PX/n,re.MAX_AXIS_SIZE)):re.DEFAULT_AXIS_SIZE,a={left:0,bottom:0,top:1,right:1},d=re.groupArray(e,"position");(d.get(M.plot.AxisPosition.RIGHT)||[]).length>0&&(n>0?a.right=1-Math.max(0,Math.min(re.LEGEND_WIDTH_PX/n,re.MAX_LEGEND_SIZE)):a.right=1-re.DEFAULT_AXIS_SIZE);const u=t,m=re.groupArray(e,"type"),p=[...m.keys()];for(let g=0;g<p.length;g+=1){const f=p[g],b=re.getAxisPropertyName(f);if(b!=null){const C=m.get(f),T=f===M.plot.AxisType.Y?s:n;A(C);let E=0;for(E=0;E<C.length;E+=1){const I=C[E],D=re.getAxisLayoutProperty(b,E);u[D]==null&&(u[D]=re.makeLayoutAxis(f,o));const N=u[D];if(N!=null){re.updateLayoutAxis(N,I,E,d,r,l,a);const{range:x,autorange:U}=N;if(i!=null&&x!==void 0&&(U===void 0||U===!1)){const $=i(I),[L,H]=$(x);mr.debug("Setting downsample range",T,L,H),I.range(T,L,H)}else I.range(T)}}let y=re.getAxisLayoutProperty(b,E);for(;u[y]!=null;)delete u[y],E+=1,y=re.getAxisLayoutProperty(b,E)}}}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=re.getAxisSide(e.position),n>0){d.overlaying=(m=re.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=>Ss.indexOf(o)),n=Ss.filter(o=>!t.includes(o)).map(o=>Ss.indexOf(o)),s=new Set;n.forEach(o=>{for(let r=o+1;r<o+Ss.length;r+=1){const l=r%Ss.length;if(e.includes(l)){s.add(l);break}}});const i=[];return s.forEach(o=>{for(let r=o-1;r>o-Ss.length;r-=1){const l=r<0?r+Ss.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(...re.createPartialHoliday(o,e,n)):s.push(re.createFullHoliday(o,e,n))}),[{values:s},...i]}static createFullHoliday(t,e,n){return re.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=[re.adjustDateForTimeZone(`${s} ${l}:00.000000`,e,n)],c=jb*(re.periodToDecimal(a)-re.periodToDecimal(l));o.push({values:d,dvalue:c})}}return o}static adjustDateForTimeZone(t,e,n){return n&&n.standardOffset!==e.standardOffset?re.unwrapValue(re.wrapValue(t,qc,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(Zb(t))return M.i18n.DateTimeFormat.format(re.DATE_FORMAT,t,e);if(Jb(t))return t.asNumber()}return t}static wrapValue(t,e,n=null){if(P.isDateType(e)&&typeof t=="string"){const s=t,i=re.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=rn){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=rn){let e=[];return t.colorway&&(Array.isArray(t.colorway)?e=t.colorway:typeof t.colorway=="string"?e=t.colorway.split(" "):mr.warn(`Unable to handle colorway property: ${t.colorway}`)),e}static makeDefaultLayout(t=rn){const e={...t,autosize:!0,colorway:re.getColorwayFromTheme(t),font:{family:"'Fira Sans', sans-serif"},title:{font:{color:t.title_color},yanchor:"top",pad:{...re.DEFAULT_TITLE_PADDING},y:1},legend:{font:{color:t.title_color}},margin:{...re.DEFAULT_MARGIN},xaxis:re.makeLayoutAxis(M.plot.AxisType.X,t),yaxis:re.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=re.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 Le=re;Le.DEFAULT_AXIS_SIZE=.15;Le.MIN_AXIS_SIZE=.025;Le.MAX_AXIS_SIZE=.2;Le.AXIS_SIZE_PX=75;Le.LEGEND_WIDTH_PX=50;Le.MAX_LEGEND_SIZE=.25;Le.ORIENTATION=Object.freeze({HORIZONTAL:"h",VERTICAL:"v"});Le.DATE_FORMAT="yyyy-MM-dd HH:mm:ss.SSSSSS";Le.DEFAULT_MARGIN=Object.freeze({l:60,r:50,t:30,b:60,pad:0});Le.DEFAULT_TITLE_PADDING=Object.freeze({t:8});Le.SUBTITLE_LINE_HEIGHT=25;const ws=X.module("Chart"),wo=class extends S.exports.Component{constructor(t){super(t),this.getCachedConfig=ge((e,n,s,i)=>{const o=[],r=Boolean(e);if(r&&o.push({name:`Downsampling failed: ${e}`,click:()=>{},icon:wo.convertIcon(au),attr:"fill-warning"}),n||s||i||r){const l=wo.downsampleButtonTitle(s,i),a=wo.downsampleButtonAttr(s,i),d=s?nu:Pf;o.push({name:l,icon:wo.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=Y.createRef(),this.plotWrapper=Y.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){ws.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(ws.debug2("Received data update",e,n),e){case St.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 St.EVENT_LOADFINISHED:{const{onUpdate:i}=this.props;this.isLoadedFired=!0,i({isLoading:!1});break}case St.EVENT_DISCONNECT:{const{onDisconnect:i}=this.props;i();break}case St.EVENT_RECONNECT:{const{onReconnect:i}=this.props;i();break}case St.EVENT_DOWNSAMPLESTARTED:{this.setState({isDownsampleFinished:!1,isDownsampleInProgress:!0,downsamplingError:null});break}case St.EVENT_DOWNSAMPLEFINISHED:{this.setState({isDownsampleFinished:!0,isDownsampleInProgress:!1,downsamplingError:null});break}case St.EVENT_DOWNSAMPLENEEDED:case St.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:ws.debug("Unknown event type",e,t)}}handlePlotUpdate(t){const{layout:e}=t,n=Le.getLayoutRanges(e);!ct(n,this.ranges)&&(this.ranges=n,this.updateModelDimensions(!0))}handleRelayout(t){if(ws.debug("handleRelayout",t),t.hiddenlabels!=null){const{onSettingsChanged:e}=this.props,n=[...t.hiddenlabels];e({hiddenSeries:n})}this.updateModelDimensions()}handleRestyle([t,e]){if(ws.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){ws.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=hs.getColumnFormats(t),n=hs.getDateTimeFormatterOptions(t),{decimalFormatOptions:s={},integerFormatOptions:i={}}=t;(!ct(this.columnFormats,e)||!ct(this.dateTimeFormatterOptions,n)||!ct(this.decimalFormatOptions,s)||!ct(this.integerFormatOptions,i))&&(this.columnFormats=hs.getColumnFormats(t),this.dateTimeFormatterOptions=n,this.decimalFormatOptions=s,this.integerFormatOptions=i,this.updateFormatter())}updateFormatter(){const t=new hn(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&&Hr.relayout(this.plot.current.el,{autosize:!0}).catch(e=>{ws.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(Xu,{ref:this.plot,data:t,layout:o,revision:r,config:l,onAfterPlot:this.handleAfterPlot,onError:ws.error,onRelayout:this.handleRelayout,onUpdate:this.handlePlotUpdate,onRestyle:this.handleRestyle,useResizeHandler:!0,style:{height:"100%",width:"100%"}})})}};let ju=wo;ju.defaultProps={isActive:!0,settings:{timeZone:"America/New_York",defaultDateTimeFormat:us.FULL_DATE_FORMAT,showTimeZone:!1,showTSeparator:!0,formatter:[]},onDisconnect:()=>{},onReconnect:()=>{},onUpdate:()=>{},onError:()=>{},onSettingsChanged:()=>{}};const It=X.module("FigureChartModel"),Qu=class extends St{constructor(t,e={},n=rn){super(),this.addPendingSeries=Xe(()=>{const{pendingSeries:s}=this;for(let i=0;i<s.length;i+=1){const o=s[i];this.addSeries(o),o.subscribe()}this.pendingSeries=[]},Qu.ADD_SERIES_DEBOUNCE),this.getTimeZone=Te((s,i)=>{if(i!=null){const o=i.getColumnTypeFormatter(s);if(o!=null)return o.dhTimeZone}return null}),this.getValueTranslator=Te((s,i)=>{const o=this.getTimeZone(s,i);return r=>Le.unwrapValue(r,o)}),this.getValueParser=Te((s,i)=>{const o=this.getTimeZone(s,i);return r=>Le.wrapValue(r,s,o)}),this.getRangeParser=Te((s,i)=>o=>{let[r,l]=o;const a=this.getValueParser(s,i);return r=a(r),l=a(l),[r,l]}),this.getAxisRangeParser=Te((s,i)=>o=>{const r=Le.getSourceForAxis(s,o);return r?this.getRangeParser(r.columnType,i):l=>l}),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=[],this.layout=Le.makeDefaultLayout(n),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=[];for(let i=0;i<t.length;i+=1){const o=t[i];for(let r=0;r<o.series.length;r+=1){const l=o.series[r];e.push(l.name),this.addSeries(l)}}const s=[...this.seriesDataMap.keys()].filter(i=>e.indexOf(i)<0);for(let i=0;i<s.length;i+=1){const o=s[i];this.seriesDataMap.delete(o)}this.seriesToProcess=new Set([...this.seriesDataMap.keys()])}addSeries(t){const e=Le.getChartForSeries(this.figure,t);if(e==null){It.error("Unable to find matching chart for series",t);return}const n=Le.groupArray(e.axes,"type"),s=Le.makeSeriesDataFromSeries(t,n,Le.getSeriesVisibility(t.name,this.settings),this.theme);if(this.seriesDataMap.set(t.name,s),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=Le.getHiddenLabels(this.settings)),this.layout.showlegend=this.data.length>1||t.plotStyle===M.plot.SeriesPlotStyle.PIE,t.oneClick!=null){const{oneClick:i}=t,{columns:o}=i;for(let r=0;r<o.length;r+=1)this.filterColumnMap.set(o[r].name,o[r]);this.oneClicks.push(i)}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){It.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){It.debug("Downsample started",t),this.fireDownsampleStart(t.detail)}handleDownsampleFinish(t){It.debug("Downsample finished",t),this.fireDownsampleFinish(t.detail)}handleDownsampleFail(t){It.error("Downsample failed",t),this.fireDownsampleFail(t.detail)}handleDownsampleNeeded(t){It.info("Downsample needed",t),this.fireDownsampleNeeded(t.detail)}handleFigureUpdated(t){const{detail:e}=t,{series:n}=e;It.debug2("handleFigureUpdated",n);for(let i=0;i<n.length;i+=1){const o=n[i];It.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){It.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){It.debug("Figure disconnected",t),this.isConnected=!1,this.listeners.length>0&&this.unsubscribeFigure(),this.fireDisconnect()}handleFigureReconnected(t){It.debug("Figure reconnected",t),this.isConnected=!0,this.initAllSeries(),this.fireReconnect(),this.listeners.length>0&&this.subscribeFigure()}handleFigureSeriesAdded(t){const{detail:e}=t;It.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=Le.DEFAULT_MARGIN.t+e*Le.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=Le.DEFAULT_TITLE_PADDING.t+e*Le.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();for(let n=0;n<this.figure.charts.length;n+=1){const s=this.figure.charts[n],i=this.getAxisRangeParser(s,this.formatter);Le.updateLayoutAxes(this.layout,s.axes,t,e,i,this.theme)}}updateLayoutFormats(){if(!this.formatter)return;Le.getAxisFormats(this.figure,this.formatter).forEach((e,n)=>{It.debug(`Assigning ${n}`,this.layout[n],e);const s=this.layout[n];s!=null?Object.assign(s,e):It.debug(`Ignoring null layout.${n}`)})}setDataArrayForSeries(t,e,n){const{name:s,plotStyle:i}=t,o=this.seriesDataMap.get(s),r=Le.getPlotlyProperty(i,e);o&&Wh(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=Le.getPlotlyErrorBars(i,o,r)),a&&d&&a!==l&&(s.error_y=Le.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){It.warn("Trying to set a filter, but no one click!");return}It.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 Ia=Qu;Ia.ADD_SERIES_DEBOUNCE=50;class Bi{static async makeModelFromSettings(e,n,s=rn){const i=await Bi.makeFigureFromSettings(e,n);return new Ia(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(Le.makeFigureSettings(e,s))}static async makeModel(e,n,s=rn){return new Ia(n,e,s)}}function Xc(t){return t.setFigure!==void 0}const tS=({connection:t,defaultUpdateInterval:e,hoverUpdateInterval:n,bgMonitoring:s=!0,monitorDuration:i})=>{var U;const[o,r]=S.exports.useState({freeMemory:0,maximumHeapSize:999,totalHeapSize:0}),[l,a]=S.exports.useState(!1),d=S.exports.useRef({timestamps:[],usages:[]});S.exports.useEffect(function(){const L=async()=>{const O=await t.getWorkerHeapInfo();if(r(O),s||l){const F=(O.totalHeapSize-O.freeMemory)/O.maximumHeapSize,_=Date.now(),{timestamps:k,usages:V}=d.current;for(;k.length!==0&&_-k[0]>i*1.5;)k.shift(),V.shift();k.push(_),V.push(F)}else d.current={timestamps:[],usages:[]}};L();const H=setInterval(L,l?n:e);return()=>{clearInterval(H)}},[l,n,t,e,i,s]);const c=($,L)=>Math.round($*10**L)/10**L,u=2,m=1024**3,{freeMemory:p,totalHeapSize:g,maximumHeapSize:f}=o,b=c(p/m,u),C=c(g/m,u),w=c(f/m,u),T=C-b,E=($,L,H=!1)=>v("div",{className:W("heap-usage-info-row",{"heading-bottom-border":H}),children:[h("div",{className:"font-weight-bold",children:$}),h("div",{children:L})]}),{timestamps:y,usages:I}=d.current,D=(U=y[y.length-1])!=null?U:0,N=g/f,x=(g-p)/f;return v(he,{children:[v("div",{className:"max-memory",children:[h("div",{className:"total-memory",style:{width:`calc(${N*100}% - ${N*2}px`}}),h("div",{className:W("used-memory",{"heap-overflow":(g-p)/f>.95}),style:{width:`calc(${x*100}% - ${x*2}px`}}),v("div",{className:"memory-text",children:[w.toFixed(1)," GB"]})]}),h(Ie,{onEntered:()=>a(!0),onExited:()=>a(!1),interactive:!0,children:v("div",{className:"heap-tooltip",children:[E("In use:",`${T.toFixed(u)} of ${w.toFixed(u)} GB`,!0),E("Free:",`${b.toFixed(u)} GB`),E("Total:",`${C.toFixed(u)} GB`),E("Max:",`${w.toFixed(u)} GB`),h("div",{className:"heap-plot",children:h(Xu,{data:[{x:[...y],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:rn.linecolor,range:[D-i,D],linecolor:rn.linecolor,linewidth:2,mirror:!0},yaxis:{dtick:.2,gridcolor:rn.linecolor,range:[0,1],linecolor:rn.linecolor,linewidth:2,mirror:!0}}})}),v("div",{className:"heap-utilisation-text",children:["% utilization over ",Math.round(i/1e3/60)," min."]})]})})]})},Zu=Object.freeze({}),nS=new Map,Ju=t=>t.user,gd=t=>t.storage,em=t=>gd(t).commandHistoryStorage,tm=t=>gd(t).fileStorage,sS=t=>gd(t).workspaceStorage,wl=t=>t.workspace,Kt=t=>wl(t).data.settings,iS=t=>Kt(t).defaultDateTimeFormat,oS=t=>{var e;return(e=Kt(t).defaultDecimalFormatOptions)!=null?e:Zu},rS=t=>{var e;return(e=Kt(t).defaultIntegerFormatOptions)!=null?e:Zu},lS=t=>Kt(t).formatter,vl=t=>Kt(t).timeZone,aS=t=>Kt(t).showTimeZone,dS=t=>Kt(t).showTSeparator,cS=t=>Kt(t).truncateNumbersWithPound,hS=t=>Kt(t).shortcutOverrides,Tl=t=>t.activeTool,uS=t=>{var e;return(e=t.plugins)!=null?e:nS},nm="SET_ACTIVE_TOOL",sm="SET_COMMAND_HISTORY_STORAGE",im="SET_FILE_STORAGE",om="SET_PLUGINS",rm="SET_USER",lm="SET_WORKSPACE",am="SET_WORKSPACE_STORAGE",mS=t=>({type:rm,payload:t}),dm=t=>({type:lm,payload:t}),pS=t=>({type:am,payload:t}),gS=t=>({type:sm,payload:t}),fS=t=>({type:im,payload:t}),CS=t=>(e,n)=>{e(dm(t));const{storage:s}=n(),{workspaceStorage:i}=s;return i.save(t)},cm=t=>(e,n)=>{const{workspace:s}=n(),{data:i}=s,o={...s,data:{...i,...t}};return e(CS(o))},hm=t=>e=>e(cm({settings:t})),El=t=>({type:nm,payload:t}),bS=t=>({type:om,payload:t});function um(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 SS(t,e={},n=!0){return(s=e,i)=>{switch(i.type){case t:{const{id:o,payload:r}=i;return n&&ct({payload:r},{payload:s[o]})?s:{...s,[o]:r}}default:return s}}}function fi(t,e){return(n=e,s)=>{switch(s.type){case t:return s.payload;default:return n}}}const wS=fi(nm,null),vS=fi(om,null),TS=fi(sm,null),ES=fi(im,null),yS=fi(am,null),IS=Ya({commandHistoryStorage:TS,fileStorage:ES,workspaceStorage:yS}),RS=um(rm,null),DS=um(lm,null),MS={activeTool:wS,plugins:vS,storage:IS,user:RS,workspace:DS};class NS{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 Xi=new NS,jc=X.module("redux-logger"),FS=t=>e=>n=>{jc.debug("dispatching",n);const s=e(n);return jc.debug("next state",t.getState()),s},xS=X.module("redux-crashReporter"),_S=t=>e=>n=>{try{return e(n)}catch(s){throw xS.error("Error executing",n," with state ",t.getState(),":",s),s}},kS=[FS,_S,Gp];Object.entries(MS).map(([t,e])=>Xi.register(t,e));var $h;const LS=($h=window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__)!=null?$h:Yp,yl=Kp(Ya(Xi.reducers),LS(qp(...kS)));Xi.setListener(t=>{yl.replaceReducer(Ya(t))});const mm=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 pm(t){return t.componentName!==void 0}function OS(t){return t.component!==void 0}const gm=Object.freeze({type:"default",isClosable:!0,isFocusOnShow:!0,reorderEnabled:!0,title:""}),AS=Object.freeze(Object.defineProperty({__proto__:null,defaultConfig:mm,isGLComponentConfig:pm,isReactComponentConfig:OS,itemDefaultConfig:gm},Symbol.toStringTag,{value:"Module"})),Ra=class{constructor(){this.off=this.unbind,this.trigger=this.emit,this._mSubscriptions={},this._mSubscriptions[Ra.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[Ra.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 Sn=Ra;Sn.ALL_EVENT="__all";class Da extends Sn{constructor(e,n,s){super(),this.isHidden=!1,this._element=ce(['<div class="lm_item_container">','<div class="lm_content" tabindex="-1"></div>',"</div>"].join("")),this.title=pm(e)?e.componentName:"",this.parent=n,this.layoutManager=s,this._config=e,this._contentElement=this._element.find(".lm_content")}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(){this._config.isClosable&&(this.emit("close"),this.parent.close())}getState(){return this._config.componentState}extendState(e){this.setState(ce.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 PS=Object.freeze(Object.defineProperty({__proto__:null,ItemContainer:Da,Container:Da},Symbol.toStringTag,{value:"Module"}));function fm(t){var e=location.hash.match(new RegExp(t+"=([^&]*)"));return e?e[1]:null}function Cm(t){if(window.location.hash)return fm(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 Il(t){return window.requestAnimationFrame(t)}function HS(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 fd(){return(Math.random()*1e15).toString(36).replace(".","")}function VS(t,e){var n=t.replace(/javascript/gi,"javascript").replace(/expression/gi,"expression").replace(/onload/gi,"onload").replace(/script/gi,"script").replace(/onerror/gi,"onerror");return e===!0?n:n.replace(/>/g,">").replace(/</g,"<")}function Cd(t){return ce.trim(t.replace(/(<([^>]+)>)/gi,""))}class Uo extends Sn{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=ce(document),this._eBody=ce(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){const n=e.originalEvent instanceof TouchEvent?e.originalEvent.touches[0]:e;return{x:n.pageX,y:n.pageY}}}class bm{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(){hi.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(){hi.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=ce.extend(e,this._container._config.props);return Y.createElement(this._reactClass,n)}}const qr=["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"],US=[!0,!1,"row","column","stack","component","close","maximise","minimise","open in new window"];function bd(t){if(qr.length>36)throw new Error("Too many keys in config minifier map");const e={};return Sd(t,e,"_min"),e}function Ma(t){if(qr.length>36)throw new Error("Too many keys in config minifier map");const e={};return Sd(t,e,"_max"),e}function Sd(t,e,n){const s=n==="_min"?BS:$S;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,qr);e[l]=r}Sd(o,r,n)}else{const r=s(o,US);if(Array.isArray(e))e[Number.parseInt(i,10)]=r;else{const l=s(i,qr);e[l]=r}}}}function BS(t,e){if(typeof t=="string"&&t.length===1)return"___"+t;var n=e.indexOf(t);return n===-1?t:n.toString(36)}function $S(t,e){return typeof t=="string"&&t.length===1?e[parseInt(t,36)]:typeof t=="string"&&t.substr(0,3)==="___"?t[3]:t}class Na{constructor(e,n){this.name=e,this.origin=n,this.isPropagationStopped=!1}stopPropagation(){this.isPropagationStopped=!0}}class Sm extends Sn{constructor(e){super(),this._layoutManager=e,this._dontPropagateToParent=null,this._childEventSource=null,this.on(Sn.ALL_EVENT,this._onEventFromThis.bind(this)),this._boundOnEventFromChild=this._onEventFromChild.bind(this),ce(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(){ce(window).off("gl_child_event",this._boundOnEventFromChild)}}const WS=Object.freeze(Object.defineProperty({__proto__:null,EventEmitter:Sn,DragListener:Uo,ReactComponentHandler:bm,BubblingEvent:Na,EventHub:Sm,getHashValue:fm,getQueryStringParam:Cm,animFrame:Il,removeFromArray:HS,getUniqueId:fd,filterXss:VS,stripTags:Cd,minifyConfig:bd,unminifyConfig:Ma},Symbol.toStringTag,{value:"Module"}));class wm extends Sn{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=ce.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;ce(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-"+fd();e=bd(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 vm=class extends Sn{constructor(t,e,n,s,i,o){var l,a,d,c,u,m,p,g,f,b,C,w;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=ce(vm._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",Cd((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(),ce(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=(w=this.element.height())!=null?w:0,this._setDropPosition(t,e),this._layoutManager.emit("itemPickedUp",this._contentItem)}_onDrag(t,e,n){var l,a;const s=n.originalEvent instanceof TouchEvent?n.originalEvent.touches[0]:n,i=(l=s.pageX)!=null?l:0,o=(a=s.pageY)!=null?a:0;!(i>this._minX&&i<this._maxX&&o>this._minY&&o<this._maxY)&&this._layoutManager.config.settings.constrainDragToContainer===!0||this._setDropPosition(i,o)}_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 Bo=vm;Bo._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 Tm{constructor(e,n,s){this._element=e,this._itemConfig=n,this._layoutManager=s,this._dragListener=this._createDragListener()}_createDragListener(){return this._dragListener=new Uo(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(ce.extend(!0,{},s)),o=new Bo(e,n,this._dragListener,this._layoutManager,i,null);(r=this._layoutManager.transitionIndicator)==null||r.transitionElements(this._element,o.element)}}class Em{constructor(e,n,s){this._element=ce(window),this._itemConfig=e,this._layoutManager=n,this._createDragListener(s)}_createDragListener(e){this._dragListener&&this._dragListener.destroy(),this._element&&(this._dragListener=new Uo(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(ce.extend(!0,{},s));new Bo(e,n,this._dragListener,this._layoutManager,i,null)}}}const ym=class{constructor(){this.element=ce(ym._template),ce(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=ym;wd._template='<div class="lm_dropTargetIndicator"><div class="lm_inner"></div></div>';class vo{constructor(e,n,s,i){this._header=e,this.element=ce('<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 si extends Error{constructor(e,n){super(),this.name="Configuration Error",this.message=e,this.node=n}}const zS=Object.freeze(Object.defineProperty({__proto__:null,ConfigurationError:si},Symbol.toStringTag,{value:"Module"}));function xo(t){return t.isStack}function yn(t){return t.isComponent}function Im(t){return t.isRoot}class vt extends Sn{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(Sn.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,xo(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&&yn(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 Na(e,this);this.emit(e,n)}_createContentItems(e){var n;if(!(e.content instanceof Array))throw new si("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(gm)){const i=n;e[i]===void 0&&(e[i]=s)}return e}_propagateEvent(e,n){n instanceof Na&&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,Il(this._propagateEventToLayoutManager.bind(this,e,n)))}_propagateEventToLayoutManager(e,n){this._pendingEventPropagations[e]=!1,this.layoutManager.emit(e,n)}}class Rm extends vt{constructor(e,n,s){super(e,n,s,ce()),this.config=n,this.parent=s;const i=e.getComponent(this.config.componentName)||e.getFallbackComponent(),o=ce.extend(!0,{},this.config.componentState||{});if(i==null)throw new si('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 Da(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(){vt.prototype._$init.call(this),this.container.emit("open")}_$hide(){this.container.hide(),vt.prototype._$hide.call(this)}_$show(){this.container.show(),this.container._config.isFocusOnShow&&this.container._contentElement[0].focus({preventScroll:!0}),vt.prototype._$show.call(this)}_$destroy(){this.container.emit("destroy",this),vt.prototype._$destroy.call(this)}_$getArea(){return null}}class Yr extends vt{constructor(e,n,s,i){super(n,s,i,ce('<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),vt.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));vt.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(vt.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 Mm(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}),Il(this.callDownwards.bind(this,"setSize",void 0,void 0,void 0))}}class Fa extends vt{constructor(e,n,s){super(e,{...n,type:"root"},null,ce('<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(yn(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 Yr)||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 xa extends vt{constructor(e,n,s){var o,r,l,a,d,c,u,m,p;super(e,n,s,ce('<div class="lm_item lm_stack"></div>')),this._activeContentItem=null,this.childElementContainer=ce('<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 $o(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(){vt.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(yn(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,w,T,E,y,I,D,N,x,U,$,L,H,O,F,_,k,V,z,j;const n=this.header.tabs.length;if(n===0){const ee=this.header.element.offset();(w=this.layoutManager.dropTargetIndicator)==null||w.highlightArea({x1:(u=ee==null?void 0:ee.left)!=null?u:0,x2:((m=ee==null?void 0:ee.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=(T=this.header.tabsContainer.get(0))==null?void 0:T.getBoundingClientRect(),o=(E=this.layoutManager.tabDropPlaceholder.get(0))==null?void 0:E.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=(y=r.get(0))==null?void 0:y.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=(D=this.layoutManager.tabDropPlaceholder.offset())==null?void 0:D.left)!=null?N:0;d=Math.max(d,(U=(x=this.header.tabsContainer.offset())==null?void 0:x.left)!=null?U:0);var c=d+(($=this.layoutManager.tabDropPlaceholder.width())!=null?$:0);c=Math.min(c,((H=(L=this.header.tabsContainer.offset())==null?void 0:L.left)!=null?H:0)+((O=this.header.tabsContainer.innerWidth())!=null?O:0)),(j=this.layoutManager.dropTargetIndicator)==null||j.highlightArea({x1:d,x2:c,y1:(_=(F=this.header.element.offset())==null?void 0:F.top)!=null?_:0,y2:((V=(k=this.header.element.offset())==null?void 0:k.top)!=null?V:0)+((z=this.header.element.innerHeight())!=null?z: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 GS=Object.freeze(Object.defineProperty({__proto__:null,AbstractContentItem:vt,ContentItem:vt,Component:Rm,Root:Fa,RowOrColumn:Yr,Stack:xa,isStack:xo,isComponent:yn,isRoot:Im},Symbol.toStringTag,{value:"Module"})),Dm=class{constructor(t,e){var n;this.element=ce(Dm._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 Uo(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),yn(this.contentItem)&&(this.contentItem.container._contentElement.on("focusin click",this._onTabContentFocusIn).on("focusout",this._onTabContentFocusOut),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),yn(this.contentItem)&&this.contentItem.container._contentElement.off(),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 Bo(t,e,this._dragListener,this._layoutManager,this.contentItem,this.header.parent)}_onTabContentFocusIn(){yn(this.contentItem)&&!this.contentItem.container._contentElement[0].contains(document.activeElement)&&this.contentItem.container._contentElement[0].focus(),this.element.addClass("lm_focusin")}_onTabContentFocusOut(){yn(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&&yn(this.contentItem)?(this.header.parent.setActiveContentItem(this.contentItem),this.contentItem.container.emit("tabClicked")):yn(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(),yn(this.contentItem)?this.contentItem.container.close():this.header.parent.removeChild(this.contentItem)}_onCloseMousedown(t){t.stopPropagation()}};let vd=Dm;vd._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 xr=class extends Sn{constructor(t,e){var n,s;super(),this.element=ce(xr._template),this.tabDropdownList=null,this.tabs=[],this.activeContentItem=null,this.closeButton=null,this.tabDropdownButton=null,this.tabNextButton=ce(xr._nextButtonTemplate),this.tabPreviousButton=ce(xr._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 vd(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(),ce(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"),ce(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(),ce(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=ce(window).scrollTop())!=null?i:0);e+t>((o=ce(window).height())!=null?o:0)&&this.tabDropdownContainer.css("max-height",((r=ce(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 $o=xr;$o._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("");$o._previousButtonTemplate=['<ul class="lm_controls">','<li class="lm_tabpreviousbutton"></li>',"</ul>"].join("");$o._nextButtonTemplate=['<li class="lm_tabnextbutton"></li>'].join("");class Mm{constructor(e,n,s){this._isVertical=e,this._size=n,this._grabSize=s<n?n:s,this.element=this._createElement(),this._dragListener=new Uo(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=ce('<div class="lm_drag_handle"></div>'),n=ce('<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 Nm{constructor(){this._element=ce('<div class="lm_transition_indicator"></div>'),this._toElement=null,this._fromDimensions={},this._totalAnimationDuration=200,this._animationStartTime=null,ce(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),Il(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 KS=Object.freeze(Object.defineProperty({__proto__:null,BrowserPopout:wm,DragProxy:Bo,DragSource:Tm,DragSourceFromEvent:Em,DropTargetIndicator:wd,Header:$o,HeaderButton:vo,Splitter:Mm,Tab:vd,TransitionIndicator:Nm},Symbol.toStringTag,{value:"Module"})),qS={config:AS,container:PS,controls:KS,errors:zS,items:GS,utils:WS};class Td extends Sn{constructor(e,n){super(),this.isInitialised=!1,this._isFullPage=!1,this._components={"lm-react-component":bm},this._itemAreas=[],this._maximisedItem=null,this._maximisePlaceholder=ce('<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 Sm(this),this.dropTargetIndicator=null,this.transitionIndicator=null,this.tabDropPlaceholder=ce('<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&&ce("body").css("visibility","hidden"),this._typeToItem={column:Yr.bind(this,!0),row:Yr.bind(this,!1),stack:xa,component:Rm}}static minifyConfig(e){return bd(e)}static unminifyConfig(e){return Ma(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 vt))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){ce(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 Nm,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(),ce(window).off("resize",this._onResize),ce(window).off("unload beforeunload",this._onUnload),ce(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 si("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 si(s);return e.type==="component"&&!(n instanceof xa)&&!!n&&!(this.isSubWindow===!0&&n instanceof Fa)&&(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 vt,l=this;if(r){o=this.toConfig(e).content,s=fd();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 wm(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 Tm(e,n,this);return this._dragSources.push(s),s}createDragSourceFromEvent(e,n){return this.config.settings.constrainDragToContainer=!1,new Em(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(!xo(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 vt)return e;if(ce.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&&ce(window).resize(this._onResize),ce(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=Cm("gl-window");n&&(this.isSubWindow=!0,e=JSON.parse(localStorage.getItem(n)||"{}"),e=Ma(e),localStorage.removeItem(n)),e=ce.extend(!0,{},mm,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=ce('<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=Cd((n=this.config.content[0].title)!=null?n:""),ce("head").append(ce("body link, body style, template, .gl_keep")),this.container=ce("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?ce(this._originalContainer):ce("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,ce("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 si(n,e);if(e.content.length>1)throw n="Top level content can't contain more then one element.",new si(n,e);this.root=new Fa(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=>{xo(s)?e.push(s):s.isComponent||this._findAllStackContainersRecursive(e,s)})}}Td.__lm=qS;const YS="_lm_root_1mdia_1",XS="_lm_row_1mdia_5",jS="_lm_item_1mdia_5",QS="_lm_content_1mdia_9",ZS="_lm_dragging_1mdia_15",JS="_lm_maximised_1mdia_21",e0="_lm_maximise_placeholder_1mdia_28",t0="_lm_splitter_1mdia_32",n0="_lm_vertical_1mdia_39",s0="_lm_drag_handle_1mdia_39",i0="_lm_horizontal_1mdia_44",o0="_lm_header_1mdia_54",r0="_lm_dropdown_open_1mdia_61",l0="_lm_controls_1mdia_67",a0="_lm_tabs_1mdia_87",d0="_lm_tab_1mdia_87",c0="_lm_title_1mdia_102",h0="_lm_close_tab_1mdia_109",u0="_lm_stack_1mdia_118",m0="_lm_left_1mdia_118",p0="_lm_right_1mdia_119",g0="_lm_dragProxy_1mdia_123",f0="_lm_items_1mdia_146",C0="_lm_tabdropdown_list_1mdia_163",b0="_lm_bottom_1mdia_190",S0="_lm_drop_tab_placeholder_1mdia_205",w0="_lm_tabdropdown_1mdia_163",v0="_lm_dropTargetIndicator_1mdia_256",T0="_lm_inner_1mdia_262",E0="_lm_transition_indicator_1mdia_270",y0="_lm_popin_1mdia_280",I0="_lm_bg_1mdia_295",R0="_lm_icon_1mdia_298",D0="_lm_goldenlayout_1mdia_302",M0="_lm_selectable_1mdia_338",N0="_lm_active_1mdia_368",F0="_lm_selected_1mdia_386",x0="_lm_keyboard_active_1mdia_395",_0="_lm_popout_1mdia_414",k0="_lm_maximise_1mdia_21",L0="_lm_close_1mdia_109",O0="_lm_tabnextbutton_1mdia_423",A0="_lm_tabpreviousbutton_1mdia_426",P0="_lm_title_before_1mdia_542",H0="_lm_focusin_1mdia_566",V0="_lm_window_blur_1mdia_571",U0="_lm_tabdropdown_search_1mdia_629",B0="_march_1mdia_1",$0="_app_1mdia_710",W0="_plotly_1mdia_719",Qc={"tab-height":"28px","drag-border-width":"5px",lm_root:YS,lm_row:XS,lm_item:jS,lm_content:QS,lm_dragging:ZS,lm_maximised:JS,lm_maximise_placeholder:e0,lm_splitter:t0,lm_vertical:n0,lm_drag_handle:s0,lm_horizontal:i0,lm_header:o0,lm_dropdown_open:r0,lm_controls:l0,lm_tabs:a0,lm_tab:d0,lm_title:c0,lm_close_tab:h0,lm_stack:u0,lm_left:m0,lm_right:p0,lm_dragProxy:g0,lm_items:f0,lm_tabdropdown_list:C0,lm_bottom:b0,lm_drop_tab_placeholder:S0,lm_tabdropdown:w0,lm_dropTargetIndicator:v0,lm_inner:T0,lm_transition_indicator:E0,lm_popin:y0,lm_bg:I0,lm_icon:R0,lm_goldenlayout:D0,lm_selectable:M0,lm_active:N0,lm_selected:F0,lm_keyboard_active:x0,lm_popout:_0,lm_maximise:k0,lm_close:L0,lm_tabnextbutton:O0,lm_tabpreviousbutton:A0,lm_title_before:P0,"editor-unsaved-indicator":"_editor-unsaved-indicator_1mdia_546","is-unsaved":"_is-unsaved_1mdia_554",lm_focusin:H0,lm_window_blur:V0,lm_tabdropdown_search:U0,march:B0,app:$0,"js-plotly-plot":"_js-plotly-plot_1mdia_719",plotly:W0},Zc=Object.freeze({tabHeight:parseInt(Qc["tab-height"],10),dragBorderWidth:parseInt(Qc["drag-border-width"],10)}),vs=X.module("LayoutUtils");function Fm(t){return t.componentName!==void 0}function xi(t){const e=t;return(Fm(t)&&t.componentName==="lm-react-component"||t.type==="react-component")&&e.component!==void 0}function pr(t){return t.focus!==void 0}function Jc(t){return t.type==="stack"}const We=class{static activateTab(t,e){const n=We.getStackForRoot(t,e,!1);if(!n){vs.error("Could not find stack for config",e);return}const s=We.getContentItemInStack(n,e);s&&n.setActiveContentItem(s)}static isActiveTab(t,e){const n=We.getStackForRoot(t,e,!1);if(!n)return vs.error("Could not find stack for config",e),!1;const s=We.getContentItemInStack(n,e);return n.getActiveContentItem()===s}static addStack(t,e=!0){const n=e?"column":"row";if(Im(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&&xo(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&&hc(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=We.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&&hc(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):vs.debug2(`dehydrateLayoutConfig: skipping unmapped component "${o}"`)}else if(r){const l={...i,content:We.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?(Jc(n)&&delete n.activeItemIndex,We.dropLayoutMinorChange(s)):xi(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=We.cloneLayout(t),i=We.cloneLayout(e);return We.dropLayoutMinorChange(s),We.dropLayoutMinorChange(i),ct(s,i)}return ct(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(xi(o)){const{component:r,props:l={}}=o;n.push({...o,id:(s=o==null?void 0:o.id)!=null?s:ze(),props:e(r,l)})}else if(o.content!==void 0){const r=We.hydrateLayoutConfig(o.content,e);Jc(o)&&o.activeItemIndex!=null&&o.activeItemIndex>=r.length&&(vs.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=ze.generate()),r){t==null||t.layoutManager.createDragSourceFromEvent(a,r);return}const d=s||{id:a.id,component:a.component};A(t);const c=i?We.addStack(t):We.getStackForRoot(t,d);A(c);const u=We.getContentItemInStack(c,d);if(o!=null){const m=p=>{vs.debug("Component created, focusing element",o),c.off("componentCreated",m);const{element:g}=p.origin;requestAnimationFrame(()=>{We.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=We.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){const n=We.getStackForRoot(t,e,!1,!1,!1);if(!n){vs.warn("Cannot find stack for component, ignoring close",e);return}const s=We.getContentItemInStack(n,e),i=document.activeElement;s&&(s.isComponent?s.container.close():n.removeChild(s)),i&&document.contains(i)&&pr(i)&&i.focus()}static renameComponent(t,e,n){const s=We.getStackForRoot(t,e,!1);if(!s){vs.error("Could not find stack for config",e);return}const i=We.getContentItemInStack(s,e);i&&i.setTitle(n)}static cloneComponent(t,e){const n=We.getStackForRoot(t,e,!1);if(!n)return vs.error("Could not find stack for config",e),null;const{props:s={}}=e,i=We.getPanelComponentState(e),o={type:"react-component",component:e.component,props:{...s,panelState:i},title:`${e.title} Copy`,id:ze.generate()};return We.openComponentInStack(n,o),o}static getPanelComponentState(t){var e,n;return Fm(t)?(e=t.componentState)==null?void 0:e.panelState:xi(t)?(n=t.props)==null?void 0:n.panelState:null}static makeDefaultLayout(){return{dimensions:{headerHeight:Zc.tabHeight,borderWidth:Zc.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=We.getComponentConfigFromContainer(t);return e?e.id:null}static getIdFromPanel(t){const{glContainer:e}=t.props;return We.getIdFromContainer(e)}static getComponentNameFromPanel(t){var s;const{glContainer:e}=t.props,n=We.getComponentConfigFromContainer(e);return n&&xi(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=We.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 te=We;te.DEFAULT_FOCUS_SELECTOR="input, select, textarea, button";const z0=Y.forwardRef((t,e)=>{const n=te.getComponentNameFromPanel({props:t});return v("div",{ref:e,className:"panel-placeholder",children:['Component "',n,'" is not registered.']})}),Me=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"});function G0(t){return(t==null?void 0:t.WrappedComponent)!==void 0}function K0(t){return typeof t.id=="string"&&t.layout instanceof Td&&t.panelManager instanceof Ed&&typeof t.registerComponent=="function"}function Os(t){if(!K0(t))throw new Error(`Expected dashboard plugin props, but instead received ${t}`)}const pn=X.module("PanelManager");class Ed{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(Me.FOCUS,this.handleFocus),e.on(Me.MOUNT,this.handleMount),e.on(Me.UNMOUNT,this.handleUnmount),e.on(Me.REOPEN,this.handleReopen),e.on(Me.DELETE,this.handleDeleted),e.on(Me.CLOSED,this.handleClosed),e.on(Me.CLOSE,this.handleControlClose)}stopListening(){const{eventHub:e}=this.layout;e.off(Me.FOCUS,this.handleFocus),e.off(Me.MOUNT,this.handleMount),e.off(Me.UNMOUNT,this.handleUnmount),e.off(Me.REOPEN,this.handleReopen),e.off(Me.DELETE,this.handleDeleted),e.off(Me.CLOSED,this.handleClosed),e.off(Me.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 te.getComponentConfigFromContainer(n)})}getOpenedPanelConfigsOfType(e){return this.getOpenedPanelConfigs().filter(n=>n!=null&&xi(n)&&n.component===e)}getOpenedPanelById(e){return this.openedMap.get(e)}getContainerByPanelId(e){var s;const n=te.getStackForConfig(this.layout.root,{id:e});return(s=n&&te.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=>n instanceof s||G0(s)&&s.WrappedComponent&&n instanceof s.WrappedComponent))}updatePanel(e){const n=te.getIdFromPanel(e);if(n==null){pn.error("updatePanel Panel did not have an ID",e);return}pn.debug2(`Updating panel ID ${n} in open panels map`),this.openedMap.delete(n),this.openedMap.set(n,e)}removePanel(e){const n=te.getIdFromPanel(e);if(n==null){pn.error("removePanel Panel did not have an ID",e);return}if(!this.openedMap.has(n)){pn.error(`Missing panel ID ${n} in open panels map`);return}if(this.openedMap.get(n)!==e){pn.debug(`Panel argument doesn't match the open panels map entry for ${n}, removePanel ignored`);return}pn.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&&s.id===e.id);n>=0&&this.closed.splice(n,1)}handleFocus(e){pn.debug2("Focus: ",e),this.updatePanel(e)}handleMount(e){pn.debug2("Mount: ",e),this.updatePanel(e),this.sendUpdate()}handleUnmount(e){pn.debug2("Unmount: ",e),this.removePanel(e),this.sendUpdate()}handleReopen(e,n){pn.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;te.openComponent({root:r,config:o,replaceConfig:n})}handleDeleted(e){pn.debug2("Deleted:",e),this.removeClosedPanelConfig(e),this.sendUpdate()}handleClosed(e,n){pn.debug2("Closed: ",e),this.addClosedPanel(n),this.sendUpdate()}handleControlClose(e){const n={id:e},{root:s}=this.layout;te.closeComponent(s,n)}addClosedPanel(e){const n=te.getComponentConfigFromContainer(e);if(n&&xi(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)})}}Ed.MAX_CLOSED_PANEL_COUNT=100;const q0=X.module("PanelErrorBoundary");class Y0 extends S.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=te.getIdFromContainer(e);q0.debug("componentWillUnmount",s),n.emit(Me.CLOSED,s,e)}render(){const{children:e}=this.props,{error:n}=this.state;return n!=null?h("div",{className:"panel-error-boundary",children:h(ml,{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 Id(t,e=""){return{metadata:{},...t,localDashboardId:e}}const _a={dehydrate:yd,hydrate:Id},X0=R.exports.shape({on:R.exports.func,off:R.exports.func,isHidden:R.exports.bool,tab:R.exports.shape({header:R.exports.shape({tabs:R.exports.arrayOf(R.exports.shape({contentItem:R.exports.shape({})}))})}),title:R.exports.string,setTitle:R.exports.func,close:R.exports.func}),xm=R.exports.shape({on:R.exports.func,off:R.exports.func,emit:R.exports.func}),j0=R.exports.shape({registerComponent:R.exports.func,root:R.exports.shape({addChild:R.exports.func}),on:R.exports.func,off:R.exports.func,eventHub:xm}),_m=Object.freeze({Container:X0,EventHub:xm,Layout:j0}),Ke=(t,e,n)=>S.exports.useEffect(function(){return t.on(e,n),()=>{t.off(e,n)}},[t,e,n]),km="SET_DASHBOARD_DATA",Q0=SS(km,{},!1),Z0={dashboardData:Q0},J0=new Map,ew=Object.freeze({}),tw=Object.freeze([]),nw=t=>t.dashboardData,qt=(t,e)=>{var n;return(n=nw(t)[e])!=null?n:ew},sw=(t,e)=>{var n;return(n=qt(t,e).closed)!=null?n:tw},Lm=(t,e)=>{var n;return(n=qt(t,e).openedMap)!=null?n:J0},Om=(t,e)=>({type:km,id:t,payload:e}),qn=(t,e)=>(n,s)=>n(Om(t,{...qt(s(),t),...e}));Object.entries(Z0).map(([t,e])=>Xi.register(t,e));const gr=X.module("DashboardLayout"),iw=Object.freeze({}),ow=[],eh=()=>{},th=t=>t,Am=({id:t,children:e,emptyDashboard:n=h("div",{children:"Dashboard is empty."}),layout:s,layoutConfig:i=ow,onLayoutChange:o=eh,onLayoutInitialized:r=eh,hydrate:l=Id,dehydrate:a=yd})=>{var _,k;const d=Xa(),c=(_=Xp(V=>qt(V,t)))!=null?_:iw,[u,m]=S.exports.useState(!1),[p,g]=S.exports.useState(!1),[f,b]=S.exports.useState(),[C]=S.exports.useState((k=c==null?void 0:c.closed)!=null?k:[]),[w,T]=S.exports.useState(!1),E=S.exports.useMemo(()=>new Map,[]),y=S.exports.useMemo(()=>new Map,[]),I=jp(),D=S.exports.useCallback((V,z,j=l,ee=a)=>{gr.debug2("registerComponent",V,z,j,ee);function ve(Oe,J){const me=z,{glContainer:fe,glEventHub:xe}=Oe;return h(zh,{store:I,children:h(Y0,{glContainer:fe,glEventHub:xe,children:h(me,{...Oe,ref:J})})})}const le=Y.forwardRef(ve),Se=s.registerComponent(V,le);return E.set(V,j),y.set(V,ee),Se},[l,a,E,y,s,I]),N=S.exports.useCallback((V,z)=>{var j;return((j=E.get(V))!=null?j:th)(z,t)},[E,t]),x=S.exports.useCallback((V,z)=>{var j;return((j=y.get(V))!=null?j:th)(z,t)},[y,t]),U=S.exports.useMemo(()=>new Ed(s,N,x,new Map,C,({closed:V,openedMap:z})=>{d(qn(t,{closed:V,openedMap:z}))}),[x,d,N,t,C,s]),$=S.exports.useCallback(()=>{if(p)return;w||(r(),T(!0));const z=s.toConfig().content,j=te.dehydrateLayoutConfig(z,x),ee=f==null||!te.isEqual(f,j);gr.debug("handleLayoutStateChanged",ee,z,j),ee&&(m(s.root.contentItems.length===0),b(j),o(j))},[x,w,p,f,s,o,r]),L=S.exports.useCallback(()=>{g(!0)},[]),H=S.exports.useCallback(()=>{g(!1)},[]),O=S.exports.useCallback(V=>{if(gr.debug2("handleComponentCreated",V),V==null||V.config==null||V.config.component==null||V.element==null)return;const j=`${V.config.component.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}-component`;V.element.addClass(j)},[]);Ke(s,"stateChanged",$),Ke(s,"itemPickedUp",L),Ke(s,"itemDropped",H),Ke(s,"componentCreated",O),Ke(s.eventHub,Me.TITLE_CHANGED,$);const F=hl(i);return S.exports.useEffect(function(){if(F!==i&&i!==f){gr.debug("Setting new layout content...");const z=te.hydrateLayoutConfig(i,N);for(;s.root.contentItems.length>0;)s.root.contentItems[0].remove();for(let j=0;j<z.length;j+=1)s.root.addChild(z[j]);m(s.root.contentItems.length===0)}},[N,s,i,f,U,F]),v(he,{children:[u&&n,Y.Children.map(e,V=>V!=null?Y.cloneElement(V,{id:t,layout:s,panelManager:U,registerComponent:D}):null)]})};Am.propTypes={id:R.exports.string.isRequired,children:R.exports.node,data:R.exports.shape({}),emptyDashboard:R.exports.node,layout:_m.Layout.isRequired,layoutConfig:R.exports.arrayOf(R.exports.shape({})),onLayoutChange:R.exports.func,onLayoutInitialized:R.exports.func};const rw=100,sa=()=>{},lw=Object.freeze({}),aw=({id:t="default",children:e,emptyDashboard:n,layoutConfig:s,layoutSettings:i=lw,onLayoutConfigChange:o=sa,onGoldenLayoutChange:r=sa,onLayoutInitialized:l=sa,fallbackComponent:a=z0,hydrate:d,dehydrate:c})=>{const u=S.exports.useRef(null),[m,p]=S.exports.useState(!1),[g,f]=S.exports.useState();S.exports.useEffect(function(){if(!u.current){f(void 0);return}const w={...te.makeDefaultLayout()};w.settings===void 0&&(w.settings={}),Object.assign(w.settings,i),w.content=[];const T=new Td(w,u.current),E=()=>{T.off("initialised",E),p(!0)};return T.on("initialised",E),a!=null&&T.setFallbackComponent(a),T.init(),f(T),r(T),()=>{T.destroy()}},[i,a,r,p,f]);const b=S.exports.useMemo(()=>ui(()=>{g!=null&&g.isInitialised&&(g==null||g.updateSize())},rw),[g]);return S.exports.useEffect(function(){return window.addEventListener("resize",b),()=>{window.removeEventListener("resize",b)}},[b]),v("div",{className:"dashboard-container w-100 h-100",children:[h("div",{className:"w-100 h-100",ref:u}),m&&g&&h(Am,{emptyDashboard:n,id:t,layout:g,layoutConfig:s,onLayoutChange:o,onLayoutInitialized:l,hydrate:d,dehydrate:c,children:e})]})},Rn="default";var mi=(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))(mi||{});const dw=Object.freeze([[mi.FILTER_CONTROL_CHANGE_CLEARS_ALL_FILTERS,!1],[mi.LINK_CHANGE_CLEARS_ALL_FILTERS,!1]]),cw={DEFAULTS:dw};var Ae=(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))(Ae||{});const hw=t=>{switch(t){default:return!1}},uw=(t,e)=>{switch(t){case Ae.COUNT:case Ae.FIRST:case Ae.LAST:case Ae.COUNT_DISTINCT:case Ae.DISTINCT:case Ae.UNIQUE:return!0;case Ae.MIN:case Ae.MAX:return P.isNumberType(e)||P.isDateType(e)||P.isTextType(e);case Ae.SUM:case Ae.ABS_SUM:case Ae.VAR:case Ae.AVG:case Ae.STD:return P.isNumberType(e);case Ae.SKIP:return!1}},Rd=(t,e)=>t.filter(n=>uw(e,n.type)),mw=(t,e,n,s)=>Rd(t,e).map(({name:i})=>i).filter(i=>n.includes(i)?!s:s),_s={isRollupOperation:hw,filterValidColumns:Rd,getOperationColumnNames:mw};const nh=X.module("Aggregations"),pw=[Ae.SUM,Ae.ABS_SUM,Ae.MIN,Ae.MAX,Ae.VAR,Ae.AVG,Ae.STD,Ae.FIRST,Ae.LAST,Ae.COUNT_DISTINCT,Ae.DISTINCT,Ae.COUNT,Ae.UNIQUE],gw=({isRollup:t,settings:e,onChange:n,onEdit:s})=>{const{aggregations:i,showOnTop:o}=e,r=S.exports.useMemo(()=>pw.filter(x=>!i.some(U=>U.operation===x)),[i]),[l,a]=S.exports.useState(r[0]),[d,c]=S.exports.useState([]),u=S.exports.useCallback(x=>{n({...e,...x})},[n,e]),m=S.exports.useCallback(x=>{u({aggregations:x})},[u]),p=S.exports.useCallback(x=>{u({showOnTop:x})},[u]),g=S.exports.useCallback(()=>{nh.debug("handleDragStart"),Gt.startDragging()},[]),f=S.exports.useCallback(({destination:x,source:U})=>{if(nh.debug("handleDragEnd",x,U),Gt.stopDragging(),x===null)return;let $=x.index;U.index<x.index&&($+=1);const L=[...i],H=Gt.reorder(L,d,L,$),O=Gt.adjustDestinationIndex($,d),F=[[O,O+H.length-1]];m(L),c(F)},[m,i,d,c]),b=S.exports.useCallback(x=>{a(x)},[a]),C=S.exports.useCallback(()=>{m([...i,{operation:l,selected:[],invert:!0}])},[i,l,m]),w=S.exports.useCallback(x=>{m(i.filter((U,$)=>$!==x))},[i,m]),T=S.exports.useCallback(x=>{c(x)},[c]),E=S.exports.useCallback(x=>{const U=i[x];_s.isRollupOperation(U.operation)||s(U)},[i,s]),y=S.exports.useCallback(x=>{p(x.target.value==="true")},[p]);S.exports.useEffect(function(){r.length>0&&!r.includes(l)&&a(r[0])},[r,l]);const I=S.exports.useCallback(({item:x,itemIndex:U,isClone:$=!1,selectedCount:L})=>{const H=x.operation,O=$?`${L}`:void 0,F=$?"item-list-item-clone":void 0,_=_s.isRollupOperation(x.operation),k=!$&&!_;return v(he,{children:[v("div",{className:W("item-list-item-content","draggable-item-list-item-content",F),children:[v("span",{className:"title",children:[H,!t&&_&&v("span",{className:"small text-warning",children:[h(q,{icon:au})," Requires rollup"]})]}),nn.renderBadge({text:O}),nn.renderHandle()]}),!$&&v(he,{children:[h(Q,{kind:"ghost",className:"btn-edit",icon:ll,tooltip:"Edit Columns",onClick:()=>s(x),disabled:!k}),h(Q,{kind:"ghost",className:"btn-delete",icon:xn,tooltip:"Delete Aggregation",onClick:()=>w(U)})]})]})},[w,s,t]),D=r.length>0,N=i.length>0;return v("div",{className:"aggregations",children:[D&&v("div",{className:"form-inline",children:[h(IC,{onChange:b,value:l,children:r.map(x=>h(yC,{value:x,children:x},x))}),v("button",{type:"button",className:"btn btn-link btn-add",onClick:C,children:[h(q,{icon:Ls}),"Add Aggregation"]})]}),D&&N&&h("hr",{}),N&&v(he,{children:[!t&&v("div",{className:"form-inline",children:[h("label",{children:"Placement:\xA0"}),v(pl,{onChange:y,value:`${o}`,children:[h(Mn,{value:"true",children:"Top"}),h(Mn,{value:"false",children:"Bottom"})]})]}),h(Lo,{onDragStart:g,onDragEnd:f,children:h(nn,{className:"selected-aggregations",itemCount:i.length,items:i,renderItem:I,offset:0,onSelectionChange:T,onSelect:E,selectedRanges:d,isMultiSelect:!0})})]})]})};const fw=30,Cw=({aggregation:t,columns:e,onChange:n})=>{const[s,i]=S.exports.useState(-1),[o,r]=S.exports.useState(-1),[l,a]=S.exports.useState(0),{invert:d,selected:c}=t,u=S.exports.useRef(null),m=S.exports.useCallback(y=>c.includes(y)?!d:d,[d,c]),p=S.exports.useMemo(()=>{let y=Rd(e,t.operation);return l!==0&&(y=P.sortColumns(y,l===1)),y},[e,t.operation,l]),g=S.exports.useMemo(()=>s>=0?p.slice(s,o+1).map(y=>({value:y.name,displayValue:y.name,isSelected:m(y.name)})):[],[p,m,o,s]),f=S.exports.useCallback(y=>{const{name:I}=p[y],D=c.indexOf(I);let N=[...c],x=d;D>=0?N.splice(D,1):(N.push(I),N.length===p.length&&(N=[],x=!d)),n({...t,selected:N,invert:x})},[t,d,p,c,n]),b=S.exports.useCallback(()=>{a(0),n({...t,selected:[],invert:!0})},[t,n]),C=S.exports.useCallback((y,I)=>{i(y),r(I)},[i,r]),w=S.exports.useCallback(()=>{c.length===0?n({...t,invert:!d}):n({...t,selected:[],invert:!0})},[t,d,n,c]),T=c.length===0?d:null,E=c.length!==0||!d||l!==0;return v("div",{role:"menu",className:"aggregation-edit",children:[h("div",{className:"top-menu",children:v("div",{className:"form-inline",children:[h(Pt,{checked:T,onChange:w,children:"Toggle All"}),h("div",{className:"spacer"}),h(ht,{in:E,timeout:Tt.transitionSlowMs,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,children:h(Q,{kind:"ghost",className:"btn-reset",onClick:b,children:"Reset"})}),h(Q,{kind:"ghost",className:W({active:l===1}),icon:rd,tooltip:"Sort ascending",onClick:()=>a(1)}),h(Q,{kind:"ghost",className:W({active:l===2}),icon:ld,tooltip:"Sort descending",onClick:()=>a(2)})]})}),h("div",{className:"aggregation-edit-item-list",children:h(bn,{itemCount:p.length,items:g,offset:s,renderItem:({item:y})=>h(Pt,{checked:m(y.value),children:y.displayValue}),onSelect:f,onViewportChange:C,rowHeight:fw,focusSelector:"input",ref:u})})]})};function bw(t){return h("svg",{width:48,height:48,xmlns:"http://www.w3.org/2000/svg",...t,children:v("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 Sw(t){return h("svg",{width:48,height:48,xmlns:"http://www.w3.org/2000/svg",...t,children:v("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 ww(t){return h("svg",{width:48,height:48,xmlns:"http://www.w3.org/2000/svg",...t,children:v("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 vw(t){return h("svg",{width:48,height:48,xmlns:"http://www.w3.org/2000/svg",...t,children:v("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 Tw(t){return h("svg",{width:48,height:48,xmlns:"http://www.w3.org/2000/svg",...t,children:v("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 Ew(t){return v("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 yw(t){return v("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 sh=X.module("ChartBuilder"),pt=class extends S.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(ww,{});case M.plot.SeriesPlotStyle.BAR:return h(bw,{});case M.plot.SeriesPlotStyle.SCATTER:return h(Tw,{});case M.plot.SeriesPlotStyle.PIE:return h(vw,{});case M.plot.SeriesPlotStyle.HISTOGRAM:return h(Sw,{});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:ze.generate(),value:t}}static makeDefaultSeriesItems(t,e){if(pt.getMaxSeriesCount(t)===0||e==null||e.length===0)return[];const s=e.length>1?e[1].name:e[0].name;return[pt.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=pt.types[0],i=pt.getDefaultXAxis(s,n),o=pt.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:ze.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=pt.types[0],s=pt.getDefaultXAxis(n,e),i=pt.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=pt.types[s];sh.debug2("handleTypeSelect",i),this.setState(o=>{const r=pt.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=pt.makeDefaultSeriesItems(i,d)}return{type:i,seriesItems:l}},this.sendChange)}handleXAxisChange(t){const e=t.target.value;sh.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=pt.getMaxSeriesCount(s),l=pt.getXAxisLabel(s),a=pt.getSeriesLabel(s),d=n.length>0,c=n.length<r;return h("div",{className:"chart-builder",children:v("form",{onSubmit:this.handleSubmit,children:[v("div",{className:"form-row",children:[h("label",{children:"Select Chart Type"}),h("div",{className:"form-row",children:pt.types.map((u,m)=>{const p=u;return h("div",{className:"col col-chart-type",children:v("button",{type:"button",className:W("btn","btn-icon","btn-chart-type",{active:u===s}),"data-index":m,onClick:this.handleTypeClick,children:[pt.getTypeIcon(u),pt.getTypeName(u)]})},p)})})]}),h("hr",{}),v("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)=>v("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("button",{type:"button",className:"btn btn-link btn-link-icon btn-delete-series ml-2 px-2","data-index":m,"data-testid":`delete-series-${m}`,onClick:this.handleSeriesDeleteClick,children:h(q,{icon:xn})})]},u.id)),c&&v("div",{className:"form-row",children:[h("div",{className:"col-2"}),v("button",{type:"button",className:"btn btn-link btn-add-series mt-1",onClick:this.handleAddSeries,children:[h(q,{icon:Ls}),"Add Series"]})]}),v("div",{className:"form-row chart-builder-link",children:[h("label",{className:"col-2 label-right",children:v("div",{className:"fa-md fa-layers",children:[h(q,{mask:dd,icon:Fo,transform:"right-5 down-5"}),h(q,{icon:o?td:Xf,transform:"grow-2 right-8 down-6"})]})}),v(pl,{onChange:this.handleLinkStateChange,value:`${o}`,children:[h(Mn,{value:"true",children:"Sync State"}),h(Mn,{value:"false",children:"Freeze State"})]})]}),v("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."})]}),v("div",{className:W("form-row","justify-content-end","my-3"),children:[h("button",{type:"button",className:"btn btn-outline-primary btn-reset",onClick:this.handleReset,children:"Reset"}),h("button",{type:"submit",className:"btn btn-primary btn-submit",children:"Create"})]})]})})}};let Pm=pt;Pm.types=[M.plot.SeriesPlotStyle.LINE,M.plot.SeriesPlotStyle.BAR,M.plot.SeriesPlotStyle.SCATTER,M.plot.SeriesPlotStyle.PIE];class Hm extends S.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=ds.create(this.editorContainer,s),this.editor.layout(),(i=this.editor.getModel())==null||i.updateOptions({tabSize:0}),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!==""&&n!==void 0&&this.setState({isEditorEmpty:n.length===0}),e(n)}handleEditorFocus(){this.setState({isEditorFocused:!0})}handleEditorBlur(){var n,s;const e=(s=(n=this.editor)==null?void 0:n.getModel())==null?void 0:s.getValue();if(e===void 0||e==="")throw new Error("value is undefined");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.key==="Tab"&&n(s,e.shiftKey)}render(){const{value:e,invalid:n}=this.props,{isEditorFocused:s,isEditorEmpty:i}=this.state;return v("div",{className:W("input-editor-wrapper",{focused:s,invalid:n}),onKeyDown:this.handleKeyDown,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"})]})}}Hm.defaultProps={value:"",onContentChanged:()=>{},editorSettings:{},editorIndex:0,onTab:()=>{},invalid:!1};const ka=class extends S.exports.PureComponent{constructor(t){super(t),this.handleFormulaEditorContentChanged=this.handleFormulaEditorContentChanged.bind(this)}handleFormulaEditorContentChanged(t){const{onChange:e,eventKey:n}=this.props;t!==void 0&&t!==""&&(t.replace(/(\r\n|\n|\r)/gm,""),e(n,ka.INPUT_TYPE.FORMULA,t))}render(){const{eventKey:t,name:e,formula:n,onChange:s,onDeleteColumn:i,inputIndex:o,onTabInEditor:r,invalid:l}=this.props;return h(ol,{draggableId:t,index:o,disableInteractiveElementBlocking:!0,children:(a,d)=>v("div",{className:W("draggable-container",{dragging:d.isDragging}),ref:a.innerRef,...a.draggableProps,children:[v("div",{className:"custom-column-input-container",children:[v("div",{className:"d-flex flex-row pb-3 custom-column-name",children:[h("input",{className:W("form-control custom-column-input",{"is-invalid":l}),placeholder:"Column Name",value:e,onChange:c=>{s(t,ka.INPUT_TYPE.NAME,c.target.value)}}),v("button",{type:"button",className:"btn btn-link btn-link-icon ml-1 px-2",onClick:()=>{i(t)},children:[h(Ie,{children:"Delete custom column"}),h(q,{icon:xn})]}),v("button",{type:"button",className:"btn btn-link btn-link-icon px-2 btn-drag-handle",...a.dragHandleProps,children:[h(Ie,{children:"Drag column to re-order"}),h(q,{icon:al})]})]}),h(Hm,{editorSettings:{language:"deephavenDb"},editorIndex:o,value:n,onContentChanged:this.handleFormulaEditorContentChanged,onTab:r,invalid:l})]}),h("hr",{})]})})}};let Dd=ka;Dd.INPUT_TYPE={NAME:"name",FORMULA:"formula"};Dd.defaultProps={name:"",inputIndex:0,formula:"",onChange:()=>{},onDeleteColumn:()=>{},onTabInEditor:()=>{},invalid:!1};class Vm extends Error{constructor(){super(...arguments),this.isAssertionFailed=!0}}function ih(t){if(t==null)throw new Vm(`Expected 'val' to be defined, but received ${t}`)}class ia extends Error{constructor(){super(...arguments),this.isPasteError=!0}}function Ze(t){return(t==null?void 0:t.isEditable)!==void 0}function oh(t){if(!Ze(t))throw new Vm(`Expected 'model' to be editable, but received ${t}`)}function gt(t){return(t==null?void 0:t.hasExpandableRows)!==void 0}var Dn=(t=>(t.DOWN="DOWN",t.UP="UP",t.LEFT="LEFT",t.RIGHT="RIGHT",t))(Dn||{});const ye=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 ye(...ye.normalize(t,e,n,s))}static makeCell(t,e){return new ye(t,e,t,e)}static makeColumn(t){return new ye(t,null,t,null)}static makeRow(t){return new ye(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=ye.minOrNull(i.startColumn,r.startColumn),c=ye.maxOrNull(i.endColumn,r.endColumn);n=!0,e[s]=new ye(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=ye.minOrNull(i.startRow,r.startRow),c=ye.maxOrNull(i.endRow,r.endRow);n=!0,e[s]=new ye(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 ye(n,s,i,o)}static subtractFromRange(t,e){const n=[],s=ye.intersection(t,e);return s==null?[t]:(s.startRow!=null&&(t.startRow==null||t.startRow<s.startRow)&&n.push(new ye(t.startColumn,t.startRow,t.endColumn,s.startRow-1)),s.startColumn!=null&&(t.startColumn==null||t.startColumn<s.startColumn)&&n.push(new ye(t.startColumn,s.startRow,s.startColumn-1,s.endRow)),s.endColumn!=null&&(t.endColumn==null||t.endColumn>s.endColumn)&&n.push(new ye(s.endColumn+1,s.startRow,t.endColumn,s.endRow)),s.endRow!=null&&(t.endRow==null||t.endRow>s.endRow)&&n.push(new ye(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(...ye.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=ye.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 ye.isBounded(t)?t:new ye((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=>ye.boundedRange(s,e,n))}static offset(t,e,n){return new ye(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=ye.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 ye.SELECTION_DIRECTION.DOWN:case ye.SELECTION_DIRECTION.RIGHT:{const o=i<t.length-1?i+1:0;return t[o].startCell(s)}case ye.SELECTION_DIRECTION.LEFT:case ye.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=ye.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 ye.isAxisRangeTouching(this.startRow,this.endRow,t.startRow,t.endRow)&&ye.isAxisRangeTouching(this.startColumn,this.endColumn,t.startColumn,t.endColumn)}subtract(t){return ye.subtractFromRange(this,t)}startCell(t=ye.SELECTION_DIRECTION.DOWN){if(!ye.isBounded(this))throw new Error("Cannot get the startCell of an unbounded range");switch(t){case ye.SELECTION_DIRECTION.DOWN:case ye.SELECTION_DIRECTION.RIGHT:return{column:this.startColumn,row:this.startRow};case ye.SELECTION_DIRECTION.LEFT:case ye.SELECTION_DIRECTION.UP:return{column:this.endColumn,row:this.endRow};default:throw new Error(`Invalid direction: ${t}`)}}nextCell(t,e,n){if(!ye.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 ye.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 ye.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 ye.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 ye.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=ye.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 oe=ye;oe.SELECTION_DIRECTION=Dn;function Iw(t){return Array.isArray(t)&&t.length===2&&(t[0]===null||typeof t[0]=="number")&&(t[1]===null||typeof t[1]=="number")}function oa(t){return Iw(t)&&t[0]!=null&&t[1]!=null}const Fe=class{static getGridPointFromXY(t,e,n){const s=Fe.getColumnAtX(t,n),i=Fe.getRowAtY(e,n),o=Fe.getColumnHeaderDepthAtY(e,n);return{x:t,y:e,row:i,column:s,columnHeaderDepth:o}}static getCellInfoFromXY(t,e,n){const{row:s,column:i}=Fe.getGridPointFromXY(t,e,n),{visibleColumnWidths:o,visibleRowHeights:r,visibleColumnXs:l,visibleRowYs: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=Fe.getRowAtY(t,e),{columnHeaderHeight:s,columnHeaderMaxDepth:i}=e;if(n===null&&t<=s*i)return At(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=Fe.iterateFloatingStart(t,n,s);return i!==void 0?i:Fe.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=Fe.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:Fe.iterateFloating(n,s,e,d=>{if(Fe.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(Fe.isInItem(c,o,r,t))return c}return null}static getColumnAtX(t,e,n=!1){const{columnCount:s,floatingLeftColumnCount:i,floatingRightColumnCount:o,visibleColumns:r,visibleColumnXs:l,visibleColumnWidths: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,visibleRowYs:r,visibleRowHeights: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 Fe.getNextShownItem(t,n,s,i)}static getNextShownRow(t,e){const{modelRows:n,visibleRows:s,userRowHeights:i}=e;return Fe.getNextShownItem(t,n,s,i)}static getColumnSeparatorIndex(t,e,n,s){var C,w,T,E;const{rowHeaderWidth:i,columnHeaderHeight:o,floatingColumns:r,floatingLeftWidth:l,visibleColumns:a,visibleColumnXs:d,visibleColumnWidths: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 y=r.length-1;y>=0;y-=1){const I=r[y],D=(C=d.get(I))!=null?C:0,N=(w=c.get(I))!=null?w:0,x=N===0;if(!b||!x){let U=D+N;x?U+=f:b&&(U-=f);const $=U-f,L=U+f;if($<=g&&g<=L)return I;b=x}}b=!1;for(let y=a.length-1;y>=0;y-=1){const I=a[y],D=(T=d.get(I))!=null?T:0,N=(E=c.get(I))!=null?E:0,x=N===0;if(D<l-N)return null;if(!b||!x){let U=D+N;x?U+=f:b&&(U-=f);const $=U-f,L=U+f;if($<=g&&g<=L)return I;b=x}}return null}static isItemHidden(t,e){return e.get(t)===0}static isColumnHidden(t,e){const{visibleColumnWidths:n}=e;return Fe.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(!Fe.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(!Fe.isItemHidden(r,e))break;s.push(r)}return s}static getHiddenColumns(t,e){const{visibleColumns:n,visibleColumnWidths:s}=e;return Fe.getHiddenItems(t,s,n)}static getRowSeparatorIndex(t,e,n,s){var g,f;const{rowHeaderWidth:i,columnHeaderHeight:o,visibleRows:r,visibleRowYs:l,visibleRowHeights: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],w=(g=l.get(C))!=null?g:0,T=(f=a.get(C))!=null?f:0,E=T===0;if(!p||!E){let y=w+T;E?y+=m:p&&(y-=m);const I=y-m,D=y+m;if(I<=u&&u<=D)return C;p=E}}return null}static isRowHidden(t,e){const{visibleRowHeights:n}=e;return Fe.isItemHidden(t,n)}static getHiddenRows(t,e){const{visibleRows:n,visibleRowHeights:s}=e;return Fe.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&&!oa(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){if(t[0]===e)return n;const s=[...n],i=s[s.length-1];return i!=null&&oa(i.from)&&i.from[1]-i.from[0]===t[1]-t[0]&&i.to===t[0]?i.from[0]===e?s.pop():s[s.length-1]={...i,to:e}:s.push({from:t,to:e}),s[s.length-1].from===s[s.length-1].to&&s.pop(),s}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;oa(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 w=(o=i[C][0])!=null?o:Number.NEGATIVE_INFINITY,T=(r=i[C][1])!=null?r:Number.POSITIVE_INFINITY;let E;const y=[[w,m-1],[m,p],[p+1,T]].map(([I,D])=>[Math.max(I,w),Math.min(D,T)]).filter(([I,D])=>I<=D).map(I=>{const[D,N]=I;return m<=D&&p>=N?(E=[D+f,N+f],E):p<D?[D-c,N-c]:I}).map(I=>{const[D,N]=I;return g>D&&g<=N?[[D,g-1],[g+c,N+c]]:I===E?[I]:g<=D?[[D+c,N+c]]:[I]}).flat();b.push(...y)}i=b.map(([C,w])=>[Number.isFinite(C)?C:null,Number.isFinite(w)?w:null])}return i}static translateRange(t,e,n,s){const i=Fe.applyItemMoves(t.startColumn,t.endColumn,e,s),o=Fe.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 oe(a[0],c[0],a[1],c[1]))}}return r}static getModelIndex(t,e){return Fe.applyItemMoves(t,t,e,!0)[0][0]}static getModelIndexes(t,e){return t.map(n=>Fe.getModelIndex(n,e))}static getModelRangeIndexes(t,e,n){return Fe.applyItemMoves(t,e,n,!0)}static getModelRange(t,e=[],n=[]){return Fe.translateRange(t,e,n,!0)}static getModelRanges(t,e=[],n=[]){const s=[];for(let i=0;i<t.length;i+=1)s.push(...Fe.getModelRange(t[i],e,n));return s}static getVisibleRangeIndexes(t,e,n){return Fe.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(...Fe.getVisibleRange(t[i],e,n));return s}static getVisibleIndex(t,e){return Fe.applyItemMoves(t,t,e)[0][0]}static getVisibleIndexes(t,e){return t.map(n=>Fe.getVisibleIndex(n,e))}static isMacPlatform(){const{platform:t}=window.navigator;return t.startsWith("Mac")}static getModifierKey(){return Fe.isMacPlatform()?"metaKey":"ctrlKey"}static isModifierKeyDown(t){const e=Fe.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,w=i,T=o,E=r;return n!=null&&(n>d&&(C+=u),n<f-c&&(T-=m)),e!=null&&(e>l&&(w+=p),e<b-a&&(E-=g)),{x1:C,y1:w,x2:T,y2:E}}static getScrollDelta(t,e=1024,n=768,s=20,i=20){let{deltaX:o,deltaY:r}=t;return!Fe.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&&(Fe.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 G=Fe;G.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 fr(t,e=Wo.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 rh(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 Um=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:w}=l;d!==this.movedRows&&(this.movedRows=d,this.modelRows.clear()),c!==this.movedColumns&&(this.movedColumns=c,this.modelColumns.clear());const{columnCount:T,rowCount:E,floatingTopRowCount:y,floatingBottomRowCount:I,floatingLeftColumnCount:D,floatingRightColumnCount:N,columnHeaderMaxDepth:x}=a,U=this.getFirstRow(t),$=this.getFirstColumn(t),L=this.getGridX(t),H=this.getGridY(t),O=gt(a)&&a.hasExpandableRows?this.calculateTreePaddingX(t):0,F=0;let _=this.getVisibleRowHeights(t),k=this.getVisibleColumnWidths(t,$,O);const V=Array.from(_.keys()),z=Array.from(k.keys());_=new Map([..._,...this.getFloatingRowHeights(t)]),k=new Map([...k,...this.getFloatingColumnWidths(t)]);let j=this.getVisibleColumnXs(k,z,s),ee=this.getVisibleRowYs(_,V,i);const ve=V.length>0?V[V.length-1]:n,le=z.length>0?z[z.length-1]:e,Se=this.getBottomViewport(t,V,ee,_),Oe=this.getRightViewport(t,z,j,k),J=this.getFloatingTopHeight(t,_),me=this.getFloatingBottomHeight(t,_),fe=this.getFloatingLeftWidth(t,k),xe=this.getFloatingRightWidth(t,k),_e=Array.from(k.values()),un=Array.from(_.values()),Xn=_e.reduce((ut,Si)=>ut+Si,0)-s,wn=un.reduce((ut,Si)=>ut+Si,0)-i,Ct=this.getLastLeft(t,null,o-L-w-g),Re=this.getLastTop(t,null,r-H-w-me),nt=s+Xn+g,st=i+wn,Nt=o-L,Yt=r-H,Xt=Ct>0||nt>Nt,Ft=Xt?w:0,jn=Re>0||st>Yt-Ft,Ht=jn?w:0,Vt=o-p-Ht,kn=r-b-Ft,Vl=p,Ul=b,Bl=T===1?Vt/nt:(T-Ct)/T,Yo=E===1?kn/st:(E-Re)/E,Xo=Xt?At(Vt*Bl,C,Vt-1):0,jo=jn?At(kn*Yo,C,kn-1):0,Qo=B(k,e,0),Zo=B(_,n,0),Jo=Qo>0?s/Qo:0,er=Zo>0?i/Zo:0,$l=T===1?s/(nt-Nt):(e+Jo)/Ct,Wl=E===1?i/(st-Yt):(n+er)/Re,As=Xt?$l*(Vt-Xo):0,zl=jn?Wl*(kn-jo):0;let bi=[];(y>0||I>0)&&(bi=[...Array(y).keys(),...[...Array(I).keys()].map(ut=>E-ut-1)],ee=new Map([...ee,...this.getFloatingRowYs(t,_,Math.floor(r-H-Ft))]));let no=[];(D>0||N>0)&&(no=[...Array(D).keys(),...[...Array(N).keys()].map(ut=>T-ut-1)],j=new Map([...j,...this.getFloatingColumnXs(t,k,Math.floor(o-L-Ht))]));const tr=[];if(u)for(let ut=u.range[0];ut<=u.range[1];ut+=1)tr.push(ut),k.has(ut)||k.set(ut,this.getVisibleColumnWidth(ut,t)),j.has(ut)||j.set(ut,0);const nr=V.concat(bi),so=z.concat(no).concat(tr),io=this.getModelRows(nr,t),Gl=this.getModelColumns(so,t),Kl=this.getVisibleRowTreeBoxes(_,io,t),sr=this.getTopVisible(t,ee,_,V),ql=this.getLeftVisible(t,j,k,z),ir=Re>0?this.getBottomVisible(t,ee,_,V,H):ve,or=Ct>0?this.getRightVisible(t,j,k,z,L):le,{fontWidths:rr,userColumnWidths:lr,userRowHeights:ar,calculatedRowHeights:Yl,calculatedColumnWidths:Xl}=this;return{rowHeight:m,rowHeaderWidth:p,rowFooterWidth:g,rowCount:E,columnWidth:f,columnCount:T,columnHeaderHeight:b,floatingTopRowCount:y,floatingBottomRowCount:I,floatingLeftColumnCount:D,floatingRightColumnCount:N,gridX:L,gridY:H,firstRow:U,firstColumn:$,treePaddingX:O,treePaddingY:F,left:e,top:n,bottom:ve,right:le,topOffset:i,leftOffset:s,topVisible:sr,leftVisible:ql,bottomVisible:ir,rightVisible:or,bottomViewport:Se,rightViewport:Oe,width:o,height:r,maxX:Xn,maxY:wn,lastLeft:Ct,lastTop:Re,barHeight:kn,barTop:Ul,barWidth:Vt,barLeft:Vl,handleHeight:jo,handleWidth:Xo,hasHorizontalBar:Xt,hasVerticalBar:jn,verticalBarWidth:Ht,horizontalBarHeight:Ft,scrollX:As,scrollY:zl,scrollableContentWidth:nt,scrollableContentHeight:st,scrollableViewportWidth:Nt,scrollableViewportHeight:Yt,visibleRows:V,visibleColumns:z,floatingRows:bi,floatingColumns:no,allRows:nr,allColumns:so,visibleRowHeights:_,visibleColumnWidths:k,floatingTopHeight:J,floatingBottomHeight:me,floatingLeftWidth:fe,floatingRightWidth:xe,visibleRowYs:ee,visibleColumnXs:j,visibleRowTreeBoxes:Kl,modelRows:io,modelColumns:Gl,movedRows:d,movedColumns:c,fontWidths:rr,userColumnWidths:lr,userRowHeights:ar,calculatedRowHeights:Yl,calculatedColumnWidths:Xl,columnHeaderMaxDepth:x}}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=null,n=this.getVisibleWidth(t)){const{model:s}=t,{columnCount:i}=s;let o=i-1;e!=null&&(o=e);let r=0;for(;o>=0;){if(r+=this.getVisibleColumnWidth(o,t),r>=n)return Math.min(o+1,i-1);o-=1}return 0}getLastTop(t,e=null,n=this.getVisibleHeight(t)){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 Math.min(r+1,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 rh(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 rh(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=G.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=G.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)),fr(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),fr(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),w=s/m,T=Math.ceil(n+w);return G.iterateAllItems(n,T,l,a,d,E=>{const y=this.getModelRow(E,e),I=o.textForCell(t,y);if(I){const D=u*2;b=Math.max(b,I.length*C+D)}}),b=Math.max(Math.min(b,(i-p-f-g)*Um.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)),fr(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)),fr(n),this.userRowHeights=n}resetRowHeight(t){const e=new Map(this.userRowHeights);e.delete(t),this.userRowHeights=e,this.calculatedRowHeights.delete(t)}};let Wo=Um;Wo.CACHE_SIZE=1e4;Wo.MAX_COLUMN_WIDTH=.8;const Rw=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=Te(t,{...e,dispose:()=>{n||(n=!0,s.clear(),n=!1)}});return s};function Dw(t,e,n=6){const s=ba.hex.lab.raw(t);return s[0]=Math.max(s[0]-s[0]/n*e,0),`#${ba.lab.hex(s)}`}function Mw(t,e){const[n,s,i]=ba.hex.rgb(t);return`rgba(${n}, ${s}, ${i}, ${e})`}const lh={colorWithAlpha:Mw,darkenForDepth:Dw};class Et{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 Bm extends Et{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,w=B(c,g),T=this.targetSizes.get(w),E=this.resizingItems.length>1,y=this.hiddenItems.indexOf(g);let I=B(d,w);g===u&&(I+=m);let D=C;Math.abs(C-I)<=r.headerResizeSnapThreshold?D=null:T!==void 0&&C>T&&(E&&y!==0||y>0)?D=T:C<=r.headerResizeHiddenSnapThreshold&&(D=0),D!==I?p.set(w,D):p.set(w,null),C<-r.headerResizeSnapThreshold&&D===0?y>=0&&E?(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))):T!==void 0&&C>T+r.headerResizeSnapThreshold&&D===T?y>0?(this.dragOffset+=D,g=this.hiddenItems[y-1],this.resizingItems.push(g),this.addTargetSize(o,g)):E?(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 Rl extends Bm{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=G.getHiddenColumns,this.getNextShownItem=G.getNextShownColumn,this.getSeparator=Rl.getColumnSeparator}static getColumnSeparator(e,n,s,i){if(!i.allowColumnResize)return null;const{x:o,y:r,columnHeaderDepth:l}=e,{modelColumns:a}=n,d=G.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 os=class{constructor(){this.getCachedTruncatedString=ln((t,e,n,s,i)=>os.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(lh.darkenForDepth(n,i,e));return s}),{max:1e3}),this.getCachedColorWithAlpha=ln((t,e)=>lh.colorWithAlpha(t,e),{max:1e3}),this.getCachedColorIsDark=ln(t=>cl.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=os.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=os.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 os.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,visibleRowYs:u,visibleRowHeights: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,visibleColumnXs:f,visibleColumnWidths:b,width:C,height:w}=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,w),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 T=0;T<c.length;T+=1){const E=c[T];for(let y=0;y<g.length;y+=1){const I=g[y];this.drawCellContent(t,e,E,I)}}}}drawFloatingBorders(t,e){const{metrics:n,theme:s}=e,{floatingTopRowCount:i,floatingBottomRowCount:o,floatingLeftColumnCount:r,floatingRightColumnCount:l,rowCount:a,columnCount:d,visibleRowYs:c,visibleColumnXs:u,visibleRowHeights:m,visibleColumnWidths:p,maxX:g,maxY:f}=n,{floatingDividerOuterColor:b,floatingDividerInnerColor:C}=s;if(t.lineWidth=3,t.beginPath(),t.strokeStyle=b,i>0){const w=B(c,i-1)+B(m,i-1)+.5;t.moveTo(0,w),t.lineTo(g,w)}if(o>0){const w=B(c,a-o)-.5;t.moveTo(0,w),t.lineTo(g,w)}if(r>0){const w=B(u,r-1)+B(p,r-1)+.5;t.moveTo(w,0),t.lineTo(w,f)}if(l>0){const w=B(u,d-l)-.5;t.moveTo(w,0),t.lineTo(w,f)}if(t.stroke(),t.beginPath(),t.lineWidth=1,t.strokeStyle=C,i>0){const w=B(c,i-1)+B(m,i-1)+.5;t.moveTo(0,w),t.lineTo(g,w)}if(o>0){const w=B(c,a-o)-.5;t.moveTo(0,w),t.lineTo(g,w)}if(r>0){const w=B(u,r-1)+B(p,r-1)+.5;t.moveTo(w,0),t.lineTo(w,f)}if(l>0){const w=B(u,d-l)-.5;t.moveTo(w,0),t.lineTo(w,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,visibleRowHeights:m,visibleRowYs:p,visibleColumnXs:g,visibleColumnWidths: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),{visibleRowYs:p,visibleRowHeights:g}=l,f=new Map,b=[],C=[],w=(T,E)=>{const y=gt(a)?a.depthForRow(T):0,I=m[T%m.length],D=I[Math.min(y,I.length-1)];if(f.has(D)||f.set(D,[]),f.get(D).push(T),E!=null){const N=gt(a)?a.depthForRow(E):0;N<y?b.push(T):N>y&&C.push(E)}};for(let T=0;T<n.length;T+=1){const E=n[T],y=T>0?n[T-1]:void 0;w(E,y)}if(f.forEach((T,E)=>{t.fillStyle=E,t.beginPath();for(let y=0;y<T.length;y+=1){const I=T[y],D=B(p,I),N=B(g,I);t.rect(i,D,o,N)}t.fill()}),b.length>0){t.save();const T=this.getCachedColorWithAlpha(u,.15),E=this.getCachedColorWithAlpha(u,0),y=t.createLinearGradient(0,0,0,c);y.addColorStop(0,T),y.addColorStop(1,E),t.fillStyle=y;for(let I=0;I<b.length;I+=1){const D=b[I],N=B(p,D);t.translate(0,N),t.fillRect(i,0,o,c),t.translate(0,-N)}t.restore()}if(C.length>0){t.save();const T=this.getCachedColorWithAlpha(u,0),E=this.getCachedColorWithAlpha(u,.15),y=t.createLinearGradient(0,0,0,c);y.addColorStop(0,T),y.addColorStop(1,E),t.fillStyle=y;for(let I=0;I<C.length;I+=1){const D=C[I],N=B(p,D),x=B(g,D),U=N+x-c;t.translate(0,U),t.fillRect(i,0,o,c),t.translate(0,-U)}t.restore()}}drawMouseColumnHover(t,e){const{mouseX:n,mouseY:s,theme:i,metrics:o}=e;if(n==null||s==null)return;const r=G.getColumnAtX(n,o);if(r==null||i.columnHoverBackgroundColor==null)return;const{visibleColumnWidths:l,visibleColumnXs: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=G.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=G.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,{visibleRowHeights:r,visibleRowYs: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,{visibleColumnXs: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,{visibleRowYs: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,visibleColumnXs:u,visibleColumnWidths:m,visibleRowYs:p,visibleRowHeights:g}=o,f=B(c,s),b=B(d,n),C=r.backgroundColorForCell(b,f,l),w=n===a,T=gt(r)&&r.hasExpandableRows;if(C!=null){const E=B(u,n)+1,y=B(p,s)+1,I=B(m,n)-1,D=B(g,s)-1;t.fillStyle=C,t.fillRect(E,y,I,D)}w&&T&&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,{visibleColumnXs:i,visibleColumnWidths: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,visibleColumnXs:d,visibleColumnWidths:c,visibleRowYs:u,visibleRowHeights:m}=o,{cellHorizontalPadding:p,treeDepthIndent:g,treeHorizontalPadding:f}=l,b=B(d,n),C=B(u,s),w=B(c,n),T=B(m,s),E=n===a;let y=0;gt(r)&&r.hasExpandableRows&&E&&(y=g*(r.depthForRow(s)+1)+f);const I=w-y;let D=b+p;const N=C+T*.5;return i==="right"?D=b+I-p:i==="center"&&(D=b+I*.5),D+=y,{width:I-p*2,x:D,y:N}}drawCellContent(t,e,n,s,i){var E;const{metrics:o,model:r,theme:l}=e,{firstColumn:a,fontWidths:d,modelColumns:c,modelRows:u,visibleRowHeights: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),w=r.truncationCharForCell(b,f),T=n===a;if(C&&g>0){const y=r.textAlignForCell(b,f)||"left";t.textAlign=y;const I=r.colorForCell(b,f,l)||p;t.fillStyle=I;const{width:D,x:N,y:x}=this.getTextRenderMetrics(t,e,n,s),U=(E=d.get(t.font))!=null?E:os.DEFAULT_FONT_WIDTH,$=this.getCachedTruncatedString(t,C,D,U,w);$&&t.fillText($,N,x)}T&>(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,visibleColumnXs:u,visibleColumnWidths:m,visibleRowYs:p,visibleRowHeights:g,visibleRowTreeBoxes:f}=s,{treeMarkerColor:b,treeMarkerHoverColor:C}=l,w=B(u,a),T=B(m,a),E=B(p,n),y=B(g,n);if(!gt(i)||!i.isRowExpandable(n))return;const I=B(f,n),D=o!=null&&r!=null&&o>=d+w&&o<=d+w+T&&r>=c+E&&r<=c+E+y?C:b;this.drawTreeMarker(t,e,w,E,I,D,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,visibleColumnXs:d,visibleRowYs:c,visibleRowHeights:u}=i,{treeDepthIndent:m,treeHorizontalPadding:p,treeLineColor:g}=r,f=B(d,a),b=B(c,n),C=B(u,n),w=s!==void 0?o.depthForRow(s):0,T=l>w?l-w:0;if(t.strokeStyle=g,t.lineWidth=1,l-T>0){t.beginPath();for(let E=0;E<l-T;E+=1){const y=f+E*m+m*.5+p+.5;t.moveTo(y,b),t.lineTo(y,b+C)}t.stroke()}if(T>0){t.beginPath();for(let E=l-T;E<l;E+=1){const y=f+E*m+m*.5+p+.5;t.moveTo(y,b),t.lineTo(y,b+Math.ceil(C/2)),t.moveTo(y-.5,b+Math.ceil(C/2)+.5),t.lineTo(y+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,visibleColumnWidths:g,visibleColumnXs:f,floatingLeftColumnCount:b,floatingLeftWidth:C,floatingRightWidth:w,modelColumns:T,columnHeaderMaxDepth:E}=o;if(d<=0)return;const{headerHiddenSeparatorSize:y,headerHiddenSeparatorHoverColor:I,headerSeparatorColor:D,headerSeparatorHoverColor:N}=i,x=d*.5,U=d*(E-1)+d*.5-x*.5,$=b>0;if(t.save(),this.drawColumnHeadersForRange(t,e,[p[0],p[p.length-1]],{minX:u+C,maxX:m-w}),$&&this.drawColumnHeadersForRange(t,e,[c[0],c[c.length-1]],{minX:u,maxX:u+C}),D){t.strokeStyle=D;const L=[...g.entries()].filter(([H,O])=>O===0).map(([H])=>H);t.beginPath(),t.fillStyle=D;for(let H=0;H<L.length;H+=1){const O=L[H],F=B(f,O),_=B(g,O),k=u+F+_+.5-y*.5;t.rect(k,U,y,x)}t.fill()}if(N){let{index:L,depth:H}=r!=null?r:{};if(L==null&&n!=null&&s!=null){const F=Rl.getColumnSeparator(G.getGridPointFromXY(n,s,o),o,a,i);L=F==null?void 0:F.index,H=F==null?void 0:F.depth}let O;if(L==null)O=!1;else{const F=T.get(L),_=T.get(L+1);F==null||_==null?O=!1:O=a.textForColumnHeader(F,H)!==a.textForColumnHeader(_,H)}if(O&&L!=null&&H!=null&&(!l||r!=null)){t.strokeStyle=N;const F=B(f,L),_=B(g,L),k=u+F+_+.5,V=p.indexOf(L),z=V<p.length-1?p[V+1]:null,j=z!=null?g.get(z):null,ee=_===0,ve=j!=null&&j===0;ee?(t.strokeStyle=I,t.fillStyle=I,t.fillRect(k,U,y*.5,x)):ve&&(t.fillStyle=N,t.fillRect(k-y*.5,U,y*.5,x)),t.beginPath(),t.moveTo(k,(E-H-1)*d),t.lineTo(k,(E-H)*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 D,N,x,U,$,L;const{metrics:o,model:r,theme:l}=e,{modelColumns:a,visibleColumnXs:d,gridX:c,calculatedColumnWidths:u,userColumnWidths:m,visibleColumnWidths:p,movedColumns:g}=o,{columnHeaderHeight:f,columnWidth:b}=l,{columnHeaderMaxDepth:C}=r,{minX:w,maxX:T}=s,E=T-w;if(C===0)return;const y=n[0],I=n[1];if(t.save(),t.translate(0,(C-i-1)*f),i===0){this.drawColumnHeader(t,e,"",w,T);for(let H=y;H<=I;H+=1)this.drawColumnHeaderAtIndex(t,e,H,s)}if(i>0){let H=y;for(;H<=I;){const{columnCount:O}=o,F=B(a,H),_=r.textForColumnHeader(F,i),k=r.colorForColumnHeader(F,i);let V=B(d,H)+c,z=V+B(p,H);if(_!=null){let j=H-1;for(;j>=0&&(z-V<E||V>w);){const Se=(D=a.get(j))!=null?D:G.getModelIndex(j,g);if(Se==null||r.textForColumnHeader(Se,i)!==_)break;V-=(x=(N=m.get(Se))!=null?N:u.get(Se))!=null?x:b,j-=1}let ee=H+1;for(;ee<O&&(z-V<E||z<T);){const Se=(U=a.get(ee))!=null?U:G.getModelIndex(ee,g);if(r.textForColumnHeader(Se,i)!==_)break;z+=(L=($=m.get(Se))!=null?$:u.get(Se))!=null?L:b,ee+=1}H=ee-1;const ve=z-V>=E;let le=V;ve&&(z<T?le=z-E:V<w&&(le=w)),this.drawColumnHeader(t,e,_,le,Math.min(z-V,E),{backgroundColor:k!=null?k:void 0},s)}H+=1}}t.restore()}drawColumnHeaderAtIndex(t,e,n,s){var g;const{metrics:i,model:o}=e,{modelColumns:r,visibleColumnWidths:l,visibleColumnXs: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 ee;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,w=(ee=b.get(t.font))!=null?ee:os.DEFAULT_FONT_WIDTH,E=(i-d*2)/w,{backgroundColor:y=u,separatorColor:I=p}=o!=null?o:{};let{textColor:D=m}=o!=null?o:{};try{const ve=this.getCachedColorIsDark(y),le=this.getCachedColorIsDark(D);ve&&le?D=f:!ve&&!le&&(D=g)}catch{}let{minX:N=0,maxX:x=C}=r!=null?r:{};t.save(),t.rect(N,0,x-N,c),t.clip(),y!=null&&(t.fillStyle=y,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=D;let U=n;E<=0?U="":U.length>E&&(U=`${U.substring(0,E-1)}\u2026`);const $=U.length*w;let L=s+i*.5;const H=c*.5;N+=d,x-=d;const O=s+d,F=At(O,N,x),_=s+i-d,V=At(_,N,x)-F,z=L-$*.5<N,j=L+$*.5>x;z?$<V?L=N+$*.5:L=_-$*.5:j&&($<V?L=x-$*.5:L=O+$*.5),t.textAlign="center",t.fillText(U,L,H),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,visibleRowHeights:u,visibleRowYs:m}=i;if(a<=0)return;const{headerBackgroundColor:p,headerColor:g,headerHiddenSeparatorSize:f,headerHiddenSeparatorHoverColor:b,headerSeparatorColor:C,headerSeparatorHoverColor:w}=o,T=a*.5,E=a*.5-T*.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 y=[];let I=!1;for(let D=0;D<c.length;D+=1){const N=c[D],x=B(m,N),U=B(u,N);if(U>0){const $=l+x+U+.5;t.moveTo(0,$),t.lineTo(a,$),I=!1}else I||(I=!0,y.push(N))}t.moveTo(a-.5,0),t.lineTo(a-.5,d),t.stroke(),t.beginPath(),t.fillStyle=C;for(let D=0;D<y.length;D+=1){const N=y[D],x=B(m,N),U=B(u,N),$=l+x+U+.5-f*.5;t.rect(E,$,T,f)}t.fill()}if(w){let{index:y=null}=r!=null?r:{};if(y==null&&n!=null&&s!=null&&(y=G.getRowSeparatorIndex(n,s,i,o)),y!=null){t.strokeStyle=w;const I=B(m,y),D=B(u,y),N=l+I+D+.5,x=c.indexOf(y),U=x<c.length-1?c[x+1]:null,$=U!=null?u.get(U):null,L=D===0,H=$!=null&&$===0;L?(t.strokeStyle=b,t.fillStyle=b,t.fillRect(E,N,T,f*.5)):H&&(t.fillStyle=w,t.fillRect(E,N-f*.5,T,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 y=0;y<c.length;y+=1){const I=c[y],D=B(u,I),N=B(m,I)+l;this.drawRowHeader(t,e,I,N,D)}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,visibleRowHeights:b,visibleRowYs:C,width:w}=i;if(m<=0)return;const{cellHorizontalPadding:T,headerBackgroundColor:E,headerColor:y,headerHiddenSeparatorSize:I,headerHiddenSeparatorHoverColor:D,headerSeparatorColor:N,headerSeparatorHoverColor:x}=r,U=m*.5,$=m*.5-U*.5,L=Math.min(d+c,w-m-g);if(t.save(),t.beginPath(),t.fillStyle=E,t.fillRect(L,a,m,p),N){t.strokeStyle=N,t.beginPath(),t.moveTo(L,a+.5),t.lineTo(m,a+.5);const O=[];let F=!1;for(let _=0;_<f.length;_+=1){const k=f[_],V=B(C,k),z=B(b,k);if(z>0){const j=a+V+z+.5;t.moveTo(L+.5,j),t.lineTo(L+m-.5,j),F=!1}else F||(F=!0,O.push(k))}t.moveTo(L+.5,a),t.lineTo(L+.5,p),t.stroke(),t.beginPath(),t.fillStyle=N;for(let _=0;_<O.length;_+=1){const k=O[_],V=B(C,k),z=B(b,k),j=a+V+z+.5-I*.5;t.rect(L+$,j,U,I)}t.fill()}if(x){let{index:O=null}=l!=null?l:{};if(O==null&&n!=null&&s!=null&&(O=G.getRowSeparatorIndex(n,s,i,r)),O!=null){t.strokeStyle=x;const F=B(C,O),_=B(b,O),k=a+F+_+.5,V=f.indexOf(O),z=V<f.length-1?f[V+1]:null,j=z!=null?b.get(z):null,ee=_===0,ve=j!=null&&j===0;ee?(t.strokeStyle=D,t.fillStyle=D,t.fillRect($,k,U,I*.5)):ve&&(t.fillStyle=x,t.fillRect($,k-I*.5,U,I*.5)),t.beginPath(),t.moveTo(L+.5,k),t.lineTo(L+m+.5,k),t.stroke()}}t.beginPath(),t.rect(L,a,m,p),t.clip(),t.fillStyle=y,t.textAlign="left";const H=L+T;for(let O=0;O<f.length;O+=1){const F=f[O],_=B(b,F);if(_>0){const k=B(C,F)+a,V=B(u,F),z=k+_*.5;t.fillText(o.textForRowFooter(V),H,z)}}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,{visibleColumnWidths:m,visibleColumnXs:p,visibleRowHeights:g,visibleRowYs:f,width:b,height:C}=a,{left:w=a.left,top:T=a.top,right:E=a.right,bottom:y=a.bottom,minY:I=-10,maxY:D=C+10,minX:N=-10,maxX:x=b+10}=n;if(c.length===0)return;const U=Ze(d)&&d.isEditable&&l==null&&o==null&&r==null&&s!=null&&i!=null&&p.has(s)&&f.has(i);if(U){const $=B(p,s),L=B(f,i),H=B(m,s),O=B(g,i);t.save(),t.beginPath(),t.rect(0,0,b,C),t.rect($,L,H,O),t.clip("evenodd")}t.beginPath();for(let $=0;$<c.length;$+=1){const L=c[$],H=L.startColumn!==null?L.startColumn:w,O=L.startRow!==null?L.startRow:T,F=L.endColumn!==null?L.endColumn:E,_=L.endRow!==null?L.endRow:y;if(_>=T&&y>=O&&F>=w&&E>=H){const k=H>=w&&p.has(H)?Math.round(B(p,H))+.5:N,V=O>=T&&f.has(O)?Math.max(Math.round(B(f,O))+.5,.5):I,z=F<=E&&p.has(F)?Math.round(B(p,F)+B(m,F))-.5:x,j=_<=y&&f.has(_)?Math.round(B(f,_)+B(g,_))-.5:D;t.rect(k,V,z-k,j-V)}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()}U&&s!=null&&i!=null&&(t.restore(),this.drawActiveCell(t,e,s,i))}drawActiveCell(t,e,n,s,i=os.ACTIVE_CELL_BORDER_WIDTH){const{metrics:o,theme:r}=e,{visibleColumnWidths:l,visibleColumnXs:a,visibleRowHeights:d,visibleRowYs: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,w=g+i;f<=0&&(C+=f-1,f=1),b<=0&&(w+=b-1,b=1);const{lineWidth:T}=t;t.beginPath(),t.lineWidth=i,t.strokeStyle=r.selectionOutlineColor,this.drawRoundedRect(t,f,b,C,w),t.stroke(),t.lineWidth=T}drawRoundedRect(t,e,n,s,i,o=os.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 j;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,visibleColumnXs:u,visibleColumnWidths:m,height:p,width:g,columnHeaderMaxDepth:f,columnHeaderHeight:b,movedColumns:C,modelColumns:w,floatingLeftWidth:T}=s,E=(j=w.get(l[0]))!=null?j:G.getModelIndex(l[0],C),y=r.getColumnHeaderGroup(E,a);if(a>0&&!y)return;const[I,D]=l,N=B(u,I),U=B(u,D)+B(m,D)-N,$=n.left,{backgroundColor:L,font:H,headerFont:O,reorderOffset:F,shadowBlur:_,shadowColor:k}=o,V=(f-a-1)*b;t.save(),t.translate(d,0),t.save(),t.beginPath(),t.rect(T,0,g,p),t.clip(),t.fillStyle=L,t.fillRect(N,V,U,p),t.restore(),t.translate(0,F),t.save(),t.shadowColor=k,t.shadowBlur=_,t.fillStyle=L,t.fillRect(n.left,V+F,n.width,p),t.restore(),t.beginPath(),t.rect(n.left,V,n.width+1,p),t.clip(),t.translate($-N,0),t.font=O;const z=[];for(let ee=n.range[0];ee<=n.range[1];ee+=1)z.push(ee);this.drawColumnHeaders(t,e),this.drawColumnHeadersForRange(t,e,[z[0],z[z.length-1]],{minX:N,maxX:g}),t.translate(0,c),t.font=H,this.drawGridBackground(t,e);for(let ee=I;ee<=D;ee+=1)this.drawColumnCellContents(t,e,ee);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,visibleRowYs:d,visibleRowHeights:c,width:u}=i,m=B(d,n),p=B(c,n)+1,{backgroundColor:g,font:f,headerFont:b,reorderOffset:C,shadowBlur:w,shadowColor:T}=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=T,t.shadowBlur=w,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{rowHeaderWidth:d,columnHeaderHeight:c,width:u,height:m,handleHeight:p,handleWidth:g,scrollX:f,scrollY:b,hasHorizontalBar:C,hasVerticalBar:w,barWidth:T,barHeight:E}=o,{scrollBarBackgroundColor:y,scrollBarHoverBackgroundColor:I,scrollBarCasingColor:D,scrollBarCornerColor:N,scrollBarColor:x,scrollBarHoverColor:U,scrollBarActiveColor:$,scrollBarSize:L,scrollBarHoverSize:H,scrollBarCasingWidth:O,scrollBarSelectionTick:F,scrollBarSelectionTickColor:_,scrollBarActiveSelectionTickColor:k,autoSelectRow:V,autoSelectColumn:z}=a,j=r!=null&&l!=null&&r<=u&&l<=m,ee=s||w&&!n&&!i&&r!=null&&l!=null&&r>=u-H&&l<=E+c&&j,ve=n||C&&!s&&!i&&!ee&&r!=null&&l!=null&&l>=m-H&&r<=T-d&&j,le=ve?H:L,Se=ee?H:L;if(t.translate(d,c),C&&w&&(t.fillStyle=D,t.fillRect(u-d-L,m-c-L,L,L),t.fillStyle=N,t.fillRect(u-d-L+O,m-c-L+O,L-O,L-O)),C){const Oe=f,J=m-c-le;if(t.fillStyle=D,t.fillRect(0,J,T,le-O),t.fillStyle=ve?I:y,t.fillRect(0,J+O,T,le-O),n?t.fillStyle=$:ve?t.fillStyle=U:t.fillStyle=x,t.fillRect(Oe,J+O,g,le-O),!V&&F&&_!=null&&k!=null){t.fillStyle=_;const{selectedRanges:me,cursorColumn:fe}=e,{lastLeft:xe,columnCount:_e}=o,Xn=[...me].filter(Re=>Re.startColumn!=null&&Re.endColumn!=null).map(Re=>[Re.startColumn,Re.endColumn]).sort(G.compareRanges),wn=G.mergeSortedRanges(Xn),Ct=Re=>Re<=xe?Re/xe*(T-g):T-g+(Re-xe)/(_e-xe)*g;for(let Re=0;Re<wn.length;Re+=1){const nt=wn[Re],st=nt[0],Nt=nt[1];if(st!=null&&Nt!=null&&(st!==fe||Nt!==fe)){const Yt=Ct(st),Xt=Math.max(1,Math.round(Ct(Nt+1)-Yt)),Ft=le-O;t.fillRect(Yt,J+O+Math.round(Ft/3),Xt,Math.round(Ft/3))}}if(fe!=null){const Re=Ct(fe),nt=2,st=le-O;t.fillStyle=k,t.fillRect(Re,J+O,nt,st)}}}if(w){const Oe=u-d-Se,J=b;if(t.fillStyle=D,t.fillRect(Oe,0,Se-O,E),t.fillStyle=ee?I:y,t.fillRect(Oe+O,0,Se-O,E),s?t.fillStyle=$:ee?t.fillStyle=U:t.fillStyle=x,t.fillRect(Oe+O,J,Se-O,p),!z&&F&&_!=null&&k!=null){const{selectedRanges:me,cursorRow:fe}=e,{lastTop:xe,rowCount:_e}=o,un=Re=>Re<=xe?Re/xe*(E-p):E-p+(Re-xe)/(_e-xe)*p;t.fillStyle=_;const wn=[...me].filter(Re=>Re.startRow!=null&&Re.endRow!=null).map(Re=>[Re.startRow,Re.endRow]).sort(G.compareRanges),Ct=G.mergeSortedRanges(wn);for(let Re=0;Re<Ct.length;Re+=1){const nt=Ct[Re],st=nt[0],Nt=nt[1];if(st!=null&&Nt!=null&&(st!==fe||Nt!==fe)){const Yt=un(st),Xt=Se-O,Ft=Math.max(1,Math.round(un(Nt+1)-Yt));t.fillRect(Oe+O+Math.round(Xt/3),Yt,Math.round(Xt/3),Ft)}}if(fe!=null){const Re=Math.round(un(fe)),nt=Se-O,st=2;t.fillStyle=k,t.fillRect(Oe+O,Re,nt,st)}}}t.translate(-d,-c)}};let $i=os;$i.DEFAULT_FONT_WIDTH=10;$i.DEFAULT_EDGE_RADIUS=2;$i.ACTIVE_CELL_BORDER_WIDTH=2;const ah=100;class Nw extends Et{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=G.isModifierKeyDown(s),b=s.shiftKey;f||(b?n.trimSelectedRanges():n.clearSelectedRanges());const C=n.getTheme(),{autoSelectRow:w,autoSelectColumn:T}=C;return(r!==null||!T)&&(l!==null||!w)&&(n.focus(),n.moveCursorToPosition(r,l,b,!1,b&&f)),this.startPoint=e,this.hasExtendedFloating=!1,this.dragBounds=G.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=G.getScrollDragBounds(d,s,i);let C=0,w=0;if(c<u&&(o<b.x1?C=o-b.x1:o>b.x2&&(C=o-b.x2)),m<p&&(r<b.y1?w=r-b.y1:r>b.y2&&(w=r-b.y2)),C!==0||w!==0)this.startTimer(n,e,C>0?Math.ceil(C/g):Math.floor(C/g),w>0?Math.ceil(w/f):Math.floor(w/f));else if(l!=null&&a!=null){const{floatingTopRowCount:T,floatingBottomRowCount:E,floatingLeftColumnCount:y,floatingRightColumnCount:I,columnCount:D,rowCount:N,bottom:x,right:U,topVisible:$,bottomVisible:L,leftVisible:H,rightVisible:O}=d;this.hasExtendedFloating||(s!==null&&s<T&&l>=T?(l=T,this.hasExtendedFloating=!0):s!==null&&s>=N-E&&l<N-E&&(l=N-E-1,this.hasExtendedFloating=!0),i!==null&&i<y&&a>=y?(a=y,this.hasExtendedFloating=!0):i!==null&&i>=D-I&&a<D-I&&(a=D-I-1,this.hasExtendedFloating=!0)),s!==null&&!G.isFloatingRow(s,d)&&G.isFloatingRow(l,d)&&(s>l&&l<m?l=$-1:s<l&&l>x&&(l=L+1)),i!==null&&!G.isFloatingColumn(i,d)&&G.isFloatingColumn(a,d)&&(i>a&&a<c?a=H-1:i<a&&a>U&&(a=O+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?ah-Math.min(ah,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 ch=5,Fw=1e3/60,Cr=10;function Ts(t,e,n,s){var T,E,y,I,D,N,x;const{modelColumns:i,movedColumns:o,visibleColumnXs:r,columnCount:l,visibleColumnWidths:a,userColumnWidths:d,calculatedColumnWidths:c,floatingLeftWidth:u,maxX:m}=n;if(e==null||t==null||t>l||t<0)return null;const p=(T=i.get(t))!=null?T:G.getModelIndex(t,o),g=s.getColumnHeaderGroup(p,e),f=g!=null;let b,C,w;if(g!=null){const[U,$]=g.getVisibleRange(o);b=(E=r.get(U))!=null?E:u,C=((y=r.get($))!=null?y:m)+((I=a.get($))!=null?I:0),w=[U,$]}else{const U=r.get(t);if(U==null)return null;b=U,C=b+((x=(N=(D=a.get(t))!=null?D:d.get(p))!=null?N:c.get(p))!=null?x:0),w=[t,t]}return{visibleIndex:t,modelIndex:p,left:b,right:C,width:C-b,isColumnGroup:f,range:w,depth:e}}class xw extends Et{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,visibleColumnWidths:c}=s;let u=i,m=r;if(n==="left")for(m-=Cr;m<0;){u-=1;const C=G.getModelIndex(i-1,d),w=(f=l.get(C))!=null?f:a.get(C);w===void 0?m=0:m+=w,u<0&&(m=0,u=0)}else{m+=Cr;let C=c.get(i);for(;C!==void 0&&m>C;){u+=1,m-=C;const w=G.getModelIndex(i+1,d);C=(b=l.get(w))!=null?b:a.get(w),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"?-Cr:Cr),e.setState({left:u,leftOffset:m}),(n==="left"&&u===0&&r===0||n==="right"&&u===o)&&this.clearScrollInterval())},Fw))}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=Ts(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)<ch&&Math.abs(this.initialGridPoint.y-o)<ch)return!1;if(a==null){const c=Ts(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=Ts(a.range[0],0,d,l),m=Ts(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 D,N,x,U,$;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,visibleColumnXs:u}=l,m=s<0,p=Ts(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=Ts(G.getColumnAtX(At(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 L=C.getVisibleRange(r);if(b.visibleIndex<L[0]){const H=this.moveColumn(p,L[0],r);this.draggingOffset=e-((D=u.get(L[0]))!=null?D:0),this.draggingColumn={...this.draggingColumn,left:e-this.draggingOffset},this.clearScrollInterval(),n.setState({draggingColumn:this.draggingColumn,movedColumns:H});return}if(b.visibleIndex>L[1]){const H=this.moveColumn(p,L[1]-(p.range[1]-p.range[0]),r),{right:O=0}=(N=Ts(L[1],0,l,o))!=null?N:{};this.draggingOffset=e-(O-p.width),this.draggingColumn={...this.draggingColumn,left:e-this.draggingOffset},this.clearScrollInterval(),n.setState({draggingColumn:this.draggingColumn,movedColumns:H});return}}if(!o.isColumnMovable(b.modelIndex)){let L=b.visibleIndex;if(m)for(L+=1;L<p.visibleIndex&&!o.isColumnMovable(G.getModelIndex(L,r));)L+=1;else for(L-=1;L>p.visibleIndex&&!o.isColumnMovable(G.getModelIndex(L,r));)L-=1;if(L!==p.visibleIndex){m||(L-=p.range[1]-p.range[0]);const O=this.moveColumn(p,L,r);n.setState({movedColumns:O,draggingColumn:this.draggingColumn})}const H=Ts(L,0,l,o);m?this.draggingOffset=e-((x=H==null?void 0:H.left)!=null?x:0):this.draggingOffset=e-(((U=H==null?void 0:H.right)!=null?U: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 w=b.left+b.width*.5,T=o.getColumnHeaderParentGroup(p.modelIndex,p.depth);let E,y=(($=T==null?void 0:T.depth)!=null?$:c)-1;for(;y>=0&&E===void 0;)E=o.getColumnHeaderGroup(b.modelIndex,y),y-=1;let I;m&&g<w&&(!E||b.visibleIndex===E.getVisibleRange(r)[0])&&(I=this.moveColumn(p,b.range[0],r)),!m&&f>w&&(!E||b.visibleIndex===E.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?G.moveRange(e.range,n,s):G.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 Md extends Et{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.visibleColumnWidths.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=At((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 Md.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 _w extends Et{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,visibleRowYs: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,visibleRowHeights:g,visibleRowYs:f,height:b}=l;let C=p;if(a<i){const I=i-1;C=B(f,I)+B(g,I)*.5+p}let w=b;if(i<c){const I=i+1;w=B(f,I)+B(g,I)*.5+p}let{movedRows:T}=n.state;r<C&&i>0&&s.isRowMovable(i-1)?(T=G.moveItem(i,i-1,T),i-=1):w<r&&i<m-1&&s.isRowMovable(i+1)&&(T=G.moveItem(i,i+1,T),i+=1),n.setState({movedRows:T,draggingRow:i});const E=p+B(g,a)*.5,y=p+B(f,u)+B(g,u)*.5;return r<E&&a>0?n.setState({top:a-1}):r>y&&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 Nd extends Bm{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=G.getHiddenRows,this.getNextShownItem=G.getNextShownRow,this.getSeparator=Nd.getRowSeparator}static getRowSeparator(e,n,s,i){if(!i.allowRowResize)return null;const{x:o,y:r}=e,l=G.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 Xr extends Et{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,visibleColumnXs:u,visibleColumnWidths:m,visibleRowHeights:p,visibleRowYs: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),w=B(g,i),T=B(p,i);if(o>=a+b&&o<=a+b+C&&r>=d+w&&r<=d+w+T)return!0}return!1}onDown(e,n){return Xr.isInTreeBox(e,n)}onClick(e,n){if(Xr.isInTreeBox(e,n)){const{row:s}=e;if(s!==null)return n.toggleRowExpanded(s),!0}return!1}}class kw extends Et{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 Fd extends Et{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.visibleRowHeights.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=At((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 Fd.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 Lw extends Et{onDoubleClick({column:e,row:n},s){const{model:i}=s.props;return Ze(i)&&e!=null&&n!=null&&i.isEditableRange(oe.makeCell(e,n))?(s.startEditing(e,n),!0):!1}}class Ci{constructor(e=5e3){this.order=e}onDown(e,n){return!1}}class Ow extends Ci{onDown(e,n){switch(e.key){case"a":if(G.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 G.isModifierKeyDown(e)?!1:this.handlePageUp(e,n);case"j":case"J":return G.isModifierKeyDown(e)?!1:this.handlePageDown(e,n);case"h":case"H":return G.isModifierKeyDown(e)?!1:(e.shiftKey||n.clearSelectedRanges(),n.moveCursorToPosition(0,n.state.cursorRow,e.shiftKey),!0);case"l":case"L":{if(G.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(G.isModifierKeyDown(e)?n.state.cursorColumn:0,G.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(G.isModifierKeyDown(e)?n.state.cursorColumn:i-1,G.isModifierKeyDown(e)?o-1:n.state.cursorRow,e.shiftKey,!0,!0),!0}case"Escape":return n.clearSelectedRanges(),!0;case"Enter":if(n.state.selectedRanges.length>0)return n.moveCursorInDirection(e.shiftKey?oe.SELECTION_DIRECTION.UP:oe.SELECTION_DIRECTION.DOWN),!0;break;case"Tab":if(n.state.selectedRanges.length>0)return n.moveCursorInDirection(e.shiftKey?oe.SELECTION_DIRECTION.LEFT:oe.SELECTION_DIRECTION.RIGHT),!0;break}return!1}handleArrowMove(e,n,s,i){const o=s.shiftKey,r=G.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,w=null;e<0?(C=0,w=m):e>0?(C=g-1,w=m):n<0?(C=u,w=0):n>0&&(C=u,w=f-1),C!=null&&w!=null&&i.moveCursorToPosition(C,w,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=At(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=At(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 Aw extends Ci{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)&>(o)&&o.isRowExpandable(a))return n.toggleRowExpanded(r),!0}}}return!1}}class Pw extends Ci{onDown(e,n){if(G.isModifierKeyDown(e))return!1;const{model:s}=n.props,{cursorColumn:i,cursorRow:o}=n.state;if(i==null||o==null||!Ze(s)||!s.isEditableRange(oe.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 Hw(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 Vw(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 Uw(t){var s,i;const e=t.querySelector("table");if(e!=null)return Hw(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(`
|
|
23
|
+
`).map(a=>a.split(" ")):o.length>1||l?Vw(t.childNodes):n}return null}class Bw extends Ci{onDown(e,n){switch(e.key){case"v":if(G.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=Uw(s);o!=null&&n.pasteValue(o)};return s.addEventListener("input",i),s.focus(),{preventDefault:!1,stopPropagation:!0}}break}return!1}}const $w=t=>{switch(t){case"ArrowDown":return Dn.DOWN;case"ArrowUp":return Dn.UP;case"ArrowLeft":return Dn.LEFT;case"ArrowRight":return Dn.RIGHT;default:return}},xd=({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=S.exports.useRef(null),u=S.exports.useRef(!1),[m]=S.exports.useState(s),[p,g]=S.exports.useState(!1),[f,b]=S.exports.useState(i),[C,w]=S.exports.useState(s);S.exports.useEffect(function(){const{current:L}=c;L!=null&&(L.focus(),t?L.setSelectionRange(t[0],t[1]):L.setSelectionRange(L.value.length,L.value.length))},[t]);const T=S.exports.useCallback($=>{o($)},[o]),E=S.exports.useCallback($=>{const{value:L}=$.target;w(L),g(!0),T(L)},[T,w,g]),y=S.exports.useCallback(()=>{u.current=!0,p&&T(m),g(!1),r()},[m,p,r,T]),I=S.exports.useCallback(()=>{b(!1)},[b]),D=S.exports.useCallback(($,L=!1)=>{l(C,{direction:$,fillRange:L})},[l,C]),N=S.exports.useCallback(()=>{u.current||D(null)},[u,D]),x=S.exports.useCallback($=>{switch($.stopPropagation(),$.key){case"Escape":$.preventDefault(),y();break;case"Enter":if($.preventDefault(),G.isModifierKeyDown($))D(void 0,!0);else if($.altKey){const L=`${C}
|
|
24
|
+
`;w(L),g(!0),T(L)}else D($.shiftKey?Dn.UP:Dn.DOWN);break;case"Tab":$.preventDefault(),D($.shiftKey?Dn.LEFT:Dn.RIGHT);break;case"ArrowDown":case"ArrowUp":case"ArrowLeft":case"ArrowRight":f&&($.preventDefault(),D($w($.key)));break}},[y,D,f,w,g,T,C]),U=S.exports.useCallback($=>{a($)},[a]);return h("textarea",{ref:c,className:W("grid-cell-input-field",e),value:C,onBlur:N,onChange:E,onKeyDown:x,onContextMenu:U,onClick:I,autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:"false",disabled:n,style:d})};xd.propTypes={selectionRange:R.exports.arrayOf(R.exports.number),className:R.exports.string,disabled:R.exports.bool,isQuickEdit:R.exports.bool,value:R.exports.string,onChange:R.exports.func,onCancel:R.exports.func,onDone:R.exports.func,onContextMenu:R.exports.func,style:R.exports.shape({})};xd.defaultProps={selectionRange:null,className:"",disabled:!1,value:"",isQuickEdit:!0,onChange:()=>{},onCancel:()=>{},onDone:()=>{},onContextMenu:()=>{},style:{}};const Ww=Y.createContext({}),js=class extends S.exports.PureComponent{constructor(t){super(t),this.getCachedKeyHandlers=ge(l=>[...l,...this.keyHandlers].sort((a,d)=>a.order-d.order)),this.getCachedMouseHandlers=ge(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 $i,this.metricCalculator=s||new Wo,this.canvas=null,this.canvasContext=null,this.animationFrame=null,this.prevMetrics=null,this.metrics=null,this.documentCursor=null,this.dragTimer=null,this.keyHandlers=[new Pw(400),new Bw(450),new Ow(500),new Aw(900)],this.mouseHandlers=[new Nd(100),new Rl(200),new _w(300),new xw(400),new Lw(450),new Fd(500),new Md(600),new kw(700),new Xr(800),new Nw(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){const e=window.devicePixelRatio||1,n=t,s=n.webkitBackingStorePixelRatio||n.mozBackingStorePixelRatio||n.msBackingStorePixelRatio||n.oBackingStorePixelRatio||n.backingStorePixelRatio||1;return e/s}static getCursorClassName(t){return t!=null&&t!==""?`grid-cursor-${t}`:null}componentDidMount(){var t;this.initContext(),(t=this.canvas)==null||t.addEventListener("wheel",this.handleWheel,{passive:!1}),window.addEventListener("resize",this.handleResize),this.updateCanvasScale(),this.updateCanvas()}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:w,movedRows:T}=this.state;if(m!==i&&this.setState({movedColumns:i}),p!==o&&this.setState({movedRows:o}),g!==w&&r(w),e.draggingColumn!=null&&b==null&&l(w),f!==T&&a(T),e.draggingRow!=null&&C==null&&d(T),n!==c&&this.setState({isStuckToBottom:!1}),s!==u&&this.setState({isStuckToRight:!1}),this.updateMetrics(),this.requestUpdateCanvas(),!this.metrics||!this.prevMetrics)return;const{bottomVisible:E,rightVisible:y,rowCount:I,columnCount:D,top:N,left:x,height:U,width:$}=this.metrics,{rowCount:L,columnCount:H,height:O,width:F}=this.prevMetrics,_=this.getMetricState();if(L!==I||U!==O){const k=this.metricCalculator.getLastTop(_),{isStuckToBottom:V}=this.state;(V&&E<I-1&&E>0||N>k)&&this.setState({top:k})}if(H!==D||$!==F){const k=this.metricCalculator.getLastLeft(_),{isStuckToRight:V}=this.state;(V&&y<D-1&&y>0||x>k)&&this.setState({left:k})}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 js.getTheme(this.context,t)}getGridPointFromEvent(t){ih(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 G.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})}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=oe.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=js.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)}updateMetrics(t=this.state){this.prevMetrics=this.metrics;const{metricCalculator:e}=this,n=this.getMetricState(t);return this.metrics=e.getMetrics(n),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 w=o[o.length-1];let T=null,E=null,y=null,I=null;s?(T=d!==void 0&&d?null:Math.min(t!=null?t:0,(g=w.startColumn)!=null?g:0),E=c!==void 0&&c?null:Math.min(e!=null?e:0,(f=w.startRow)!=null?f:0),y=d!==void 0&&d?null:Math.max(t!=null?t:0,(b=w.endColumn)!=null?b:0),I=c!==void 0&&c?null:Math.max(e!=null?e:0,(C=w.endRow)!=null?C:0)):(T=w.startColumn,E=w.startRow,(l!=null||r!=null)&&((d===void 0||!d)&&(T=l),(c===void 0||!c)&&(E=r)),y=d!==void 0&&d?null:t,I=c!==void 0&&c?null:e);const D=oe.makeNormalized(T,E,y,I);if(w.equals(D))return null;const N=[...o];return N[N.length-1]=D,{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(oe.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?oe.rowCount(s)===1:oe.cellCount(s)===1)&&oe.rangeArraysEqual(s,i))return{selectedRanges:[],lastSelectedRanges:[],cursorColumn:r,cursorRow:o};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=oe.consolidate(l)}let a=r,d=o;if(!oe.containsCell(l,r,o)){const{model:c}=this.props,{columnCount:u,rowCount:m}=c,p=oe.nextCell(oe.boundedRanges(s,u,m));p!=null?{column:a,row:d}=p:(a=null,d=null)}return{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 oe(null,t,null,t)]});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 oe(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=At(l+t,0,c-1),p=At(a+e,0,u-1);this.moveCursorToPosition(m,p,n)}}moveCursorInDirection(t=oe.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:[oe.makeCell(o,i)];let a=null;if(l.length===1&&oe.cellCount(l)===1){const c=new oe(0,0,n-1,s-1);a=(d=c.nextCell(o,i,t))!=null?d:c.startCell(t)}else a=oe.nextCell(oe.boundedRanges(l,n,s),o,i,t);if(a!=null){const{column:c,row:u}=a;this.setState({cursorColumn:c,cursorRow:u}),oe.containsCell(r,c,u)||this.setState({selectedRanges:[oe.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&&!G.isFloatingRow(e,this.metrics)&&(e<o?(a=n.getTopForTopVisible(l,e),c=0):e>s&&(a=n.getTopForBottomVisible(l,e),c=0)),t!=null&&!G.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(!Ze(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 Ze(s)&&s.isValidForCell(i,o,n)}async pasteValue(t){const{model:e}=this.props,{movedColumns:n,movedRows:s,selectedRanges:i}=this.state;try{if(oh(e),!e.isEditable||!i.every(u=>e.isEditableRange(u)))throw new ia("Can't paste in to read-only area.");if(i.length<=0)throw new ia("Select an area to paste to.");if(typeof t=="string"){const u=[],m=G.getModelRanges(i,n,s);oe.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 oe.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 oe(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=>oe.rowCount([u])===o&&oe.columnCount([u])===r))throw new ia("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;oh(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=G.getModelRanges(t,s,i);Ze(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!==js.getCursorClassName(t)&&(this.documentCursor!=null&&document.documentElement.classList.remove(this.documentCursor),this.documentCursor=js.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)},js.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{left:e,top:n,cursorColumn:s,cursorRow:i,draggingColumn:o,draggingColumnSeparator:r,draggingRow:l,draggingRowOffset:a,draggingRowSeparator:d,editingCell:c,isDraggingHorizontalScrollBar:u,isDraggingVerticalScrollBar:m,isDragging:p,mouseX:g,mouseY:f,selectedRanges:b}=this.state,{model:C,stateOverride:w}=this.props,{renderer:T}=this,E=this.canvasContext,y=this.getTheme(),I=this.canvas.clientWidth,D=this.canvas.clientHeight,N={left:e,top:n,width:I,height:D,context:E,theme:y,model:C,metrics:t,mouseX:g,mouseY:f,selectedRanges:b,draggingColumn:o,draggingColumnSeparator:r,draggingRow:l,draggingRowOffset:a,draggingRowSeparator:d,editingCell:c,isDraggingHorizontalScrollBar:u,isDraggingVerticalScrollBar:m,isDragging:p,cursorColumn:s,cursorRow:i,...w};E.save(),T.drawCanvas(N),E.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");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}),this.forceUpdate()}handleWheel(t){var y,I,D,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 w=this.getTheme();let{deltaX:T,deltaY:E}=G.getScrollDelta(t,n.barWidth,n.barHeight,n.rowHeight,n.rowHeight);for(;m&&T!==0;){if(C+=T,T=0,r>1){if(C>0&&f>=o||C<0&&f<=0){C=0;break}}else{if(C<=0){C=0;break}const x=a-d;if(C>=x){C=x;break}}if(C>0){const x=(y=n.visibleColumnWidths.get(f))!=null?y:e.getVisibleColumnWidth(f,s);C>=x?(T=C-x,C=0,f+=1):w.scrollSnapToColumn&&r>1&&(C=0,f+=1)}else if(C<0){const x=(I=n.visibleColumnWidths.get(f-1))!=null?I:e.getVisibleColumnWidth(f-1,s);Math.abs(C)<=x&&w.scrollSnapToColumn&&r>1?(C=0,f-=1):(T=C+x,C=0,f-=1)}}for(;p&&E!==0;){if(b+=E,E=0,l>1){if(b>0&&g>=i||b<0&&g<=0){b=0;break}}else{if(b<=0){b=0;break}const x=c-u;if(b>=x){b=x;break}}if(b>0){const x=(D=n.visibleRowHeights.get(g))!=null?D:e.getVisibleRowHeight(g,s);b>=x?(E=b-x,b=0,g+=1):w.scrollSnapToRow&&l>1&&(b=0,g+=1)}else if(b<0){const x=(N=n.visibleRowHeights.get(g-1))!=null?N:e.getVisibleRowHeight(g-1,s);Math.abs(b)<=x&&w.scrollSnapToRow&&l>1?(b=0,g-=1):(E=b+x,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 ih(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=Dn.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||!Ze(t))return null;const{selectionRange:s,value:i,isQuickEdit:o}=e,{column:r,row:l}=e,{gridX:a,gridY:d,visibleColumnXs:c,visibleRowYs:u,visibleColumnWidths:m,visibleRowHeights:p}=n,g=c.get(r),f=u.get(l),b=m.get(r),C=p.get(l),w=g!=null&&f!=null&&b!=null&&C!=null?{position:"absolute",left:a+g,top:d+f,width:b,height:C}:{opacity:0},T=this.getModelColumn(r),E=this.getModelRow(l),y=T!=null&&E!=null?{textAlign:t.textAlignForCell(T,E)}:void 0,I=t.isValidForCell(T,E,i);return h("div",{style:w,children:h(xd,{selectionRange:s,className:W({error:!I}),onCancel:this.handleEditCellCancel,onChange:this.handleEditCellChange,onDone:this.handleEditCellCommit,isQuickEdit:o,style:y,value:i},`${r},${l}`)})}render(){const{cursor:t}=this.state;return v(he,{children:[h("canvas",{className:W("grid-canvas",js.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 ji=js;ji.contextType=Ww;ji.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}};ji.pixelsPerLine=100/3;ji.dragTimeout=1e3;ji.getTheme=ge((t,e)=>({...Rw,...t,...e}));class $m extends il{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 zw extends $m{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){oe.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 Qs=class extends zw{constructor({rowCount:t=Qs.DEFAULT_ROW_COUNT,columnCount:e=Qs.DEFAULT_COLUMN_COUNT,children:n=new Map,childRowCount:s=Math.ceil(Math.max(Qs.MIN_CHILD_ROW_COUNT,t*Qs.DEFAULT_CHILD_ROW_COUNT_FACTOR)),maxDepth:i=Qs.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 Qs({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 zo=Qs;zo.DEFAULT_ROW_COUNT=1e9;zo.DEFAULT_COLUMN_COUNT=100;zo.DEFAULT_CHILD_ROW_COUNT_FACTOR=.01;zo.MIN_CHILD_ROW_COUNT=10;zo.MAX_DEPTH=10;class be extends $m{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 movedColumns(){return[]}get movedRows(){return[]}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}}be.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 Mi=class extends S.exports.Component{constructor(t){super(t),this.getInput=ge((e,n)=>e.find(s=>s.eventKey===n)),this.getInputIndex=ge((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 ze.generate()}static createCustomColumnInput(){return{eventKey:ze.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(be.EVENT.COLUMNS_CHANGED,this.handleCustomColumnUpdated),t.addEventListener(be.EVENT.UPDATED,this.handleCustomColumnUpdated),t.addEventListener(be.EVENT.REQUEST_FAILED,this.handleRequestFailed)}stopListening(){const{model:t}=this.props;t.removeEventListener(be.EVENT.COLUMNS_CHANGED,this.handleCustomColumnUpdated),t.removeEventListener(be.EVENT.UPDATED,this.handleCustomColumnUpdated),t.removeEventListener(be.EVENT.REQUEST_FAILED,this.handleRequestFailed)}parseCustomColumns(t){if(t.length>0){const e=t.map(n=>{const s=n.split(/=(.+)/,2);return{eventKey:Mi.makeCustomColumnInputEventKey(),name:s[0],formula:s[1]}});this.setState({inputs:e})}else this.setState({inputs:[Mi.createCustomColumnInput()]})}handleAddColumnClick(){const{inputs:t}=this.state,e=[...t];e.push(Mi.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(Mi.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}),Mi.SUCCESS_SHOW_DURATION)})}handleRequestFailed(t){const e=t,{isCustomColumnApplying:n}=this.state;!n||this.setState({isCustomColumnApplying:!1,errorMessage:v(he,{children:[v("p",{children:[h(q,{icon:cs})," Failed to apply custom columns."]}),v("div",{className:"error-box",children:[e.detail.errorMessage,h("br",{}),"Table configuration:"," ",JSON.stringify(e.detail.configuration)]})]}),hasRequestFailed:!0})}handleDragEnd(t){if(Gt.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;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)((i=this.container)==null?void 0:i.querySelectorAll(".btn-add-column")[t]).focus();else{const r=t+1;((o=this.container)==null?void 0:o.querySelectorAll(".custom-column-input")[r]).focus()}}handleSaveClick(){const{onSave:t}=this.props,{inputs:e,isCustomColumnApplying:n}=this.state;if(n)return;const s=[];e.forEach(i=>{const{name:o,formula:r}=i;o&&r&&s.push(`${o}=${r}`)}),this.resetErrorMessage(),this.setState({isCustomColumnApplying:!0}),t(s)}resetRequestFailed(){this.setState(({hasRequestFailed:t})=>t?{hasRequestFailed:!1}:null)}renderInputs(){const{inputs:t,hasRequestFailed:e}=this.state;return t.map((n,s)=>{const{eventKey:i,name:o,formula:r}=n;return h(Dd,{inputIndex:s,eventKey:i,name:o,formula:r,onChange:this.handleInputChange,onDeleteColumn:this.handleDeleteColumn,onTabInEditor:this.handleEditorTabNavigation,invalid:e},i)})}renderSaveButton(){const{inputs:t,isCustomColumnApplying:e,isSuccessShowing:n}=this.state,s=t.length>1?"Save Columns":"Save Column";return v("button",{type:"button",className:W("btn btn-apply",{"btn-spinner":e},n?"btn-success":"btn-primary"),disabled:n||e,onClick:this.handleSaveClick,children:[e&&v("span",{children:[h(_n,{}),h("span",{className:"btn-normal-content",children:"Applying"}),h("span",{className:"btn-hover-content",children:"Applying"})]}),!n&&!e&&s,n&&v(he,{children:[h(q,{icon:sd})," Success"]})]})}render(){const{onCancel:t}=this.props,{errorMessage:e}=this.state;return v("div",{role:"presentation",className:"custom-column-builder-container",ref:n=>{this.container=n},onClick:this.resetRequestFailed,onFocus:this.resetRequestFailed,children:[h("div",{className:"section-title",children:"Custom Column Name and Formula"}),h("hr",{}),h(Lo,{onDragStart:Gt.startDragging,onDragEnd:this.handleDragEnd,children:h(ko,{droppableId:"droppable-custom-columns",children:(n,s)=>v("div",{ref:n.innerRef,...n.droppableProps,className:W("droppable-container",{dragging:s.draggingFromThisWith}),children:[this.renderInputs(),n.placeholder]})})}),h("div",{className:"pt-1 px-3",children:v("button",{type:"button",className:"btn btn-link btn-add-column",onClick:this.handleAddColumnClick,children:[h(q,{icon:Ls}),"Add Another Column"]})}),v("div",{className:"custom-column-builder-footer",children:[e&&h("div",{className:"error-message",children:e}),v("div",{className:"d-flex justify-content-end",children:[h("button",{type:"button",className:"btn btn-outline-primary mr-2",onClick:t,children:"Cancel"}),this.renderSaveButton()]})]})]})}};let _d=Mi;_d.SUCCESS_SHOW_DURATION=750;_d.defaultProps={customColumns:[],onSave:()=>{},onCancel:()=>{}};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 lo=X.module("RollupRows"),Gw=150,br="grouped-rollup-rows",Sr="ungrouped-rollup-rows",En=class extends S.exports.Component{constructor(t){super(t),this.search=Xe(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]));A(a),this.setState({ungroupedSelectedRanges:l}),l.length>0&&this.ungroupedList.current&&this.ungroupedList.current.scrollToItem(a)},Gw),this.getCachedUngroupedColumns=Te((o,r)=>o.filter(l=>En.isGroupable(l)&&r.find(a=>a===l.name)!=null)),this.getCachedSortedColumns=Te((o,r)=>r==null?[...o]:P.sortColumns(o,r===En.SORT.ASCENDING)),this.search=this.search.bind(this),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=Y.createRef(),this.groupedList=Y.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 nn.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!P.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===En.SORT.ASCENDING?null:En.SORT.ASCENDING}))}handleSortDescending(){this.setState(({sort:t})=>({sort:t===En.SORT.DESCENDING?null:En.SORT.DESCENDING}))}resetSelection(){this.setState({ungroupedSelectedRanges:[],groupedSelectedRanges:[]})}handleDragStart(t){lo.debug("handleDragStart",t),document.documentElement.classList.add("drag-pointer-events-none"),this.setState({dragSource:t.source})}handleDragEnd(t){lo.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===Sr){this.setState(({groupedSelectedRanges:o,columns:r})=>{const l=[...r];return Gt.reorder(l,o,[],0),{columns:l,ungroupedSelectedRanges:[],groupedSelectedRanges:[]}});return}const s=n.droppableId===br;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=Gt.reorder(d,c,a,i),m=s?Gt.adjustDestinationIndex(i,l):i,p=[[m,m+u.length-1]];return{columns:a,ungroupedSelectedRanges:[],groupedSelectedRanges:p}}),this.resetSelection()}handleUngroupedSelect(t){lo.debug("handleUngroupedSelect"),this.setState(({columns:e})=>({columns:En.addGroupings(e,[this.getSortedUngroupedColumns()[t].name]),ungroupedSelectedRanges:[],groupedSelectedRanges:[]}))}handleUngroupedSelectionChange(t){lo.debug2("handleUngroupedSelectionChange",t),this.setState(({ungroupedSelectedRanges:e})=>t===e?null:{ungroupedSelectedRanges:t,groupedSelectedRanges:[]})}handleGroupedSelectionChange(t){lo.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 v(he,{children:[nn.renderTextItem({text:o,badgeText:r,className:l}),(n===void 0||!n)&&h(Q,{kind:"ghost",className:"btn btn-link btn-link-icon btn-delete-grouping float-right",onClick:()=>this.handleDeleteClicked(e),children:h(q,{icon:xn})})]})}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*nn.DEFAULT_ROW_HEIGHT;(e==null?void 0:e.droppableId)===Sr&&(d+=nn.DEFAULT_ROW_HEIGHT);const c=a.length*nn.DEFAULT_ROW_HEIGHT+10,u=Math.min(3*nn.DEFAULT_ROW_HEIGHT,c);return h("div",{role:"menu",className:W("rollup-rows",{"is-dragging":e!=null}),tabIndex:0,children:v(Lo,{onDragEnd:this.handleDragEnd,onDragStart:this.handleDragStart,children:[v("div",{className:"rollup-rows-group-by",children:[h("div",{className:"section-title",children:"Group By"}),t.length===0&&h(ko,{isDropDisabled:!0,droppableId:"placeholder",children:(m,p)=>h("div",{className:W("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(nn,{draggingItemClassName:"rollup-rows-dragging-grouped-item",draggablePrefix:br,droppableId:br,itemCount:t.length,items:t,offset:0,onSelectionChange:this.handleGroupedSelectionChange,ref:this.groupedList,renderItem:this.renderGroupedItem,selectedRanges:s,style:{height:d},isMultiSelect:!0})]}),v("div",{className:"rollup-rows-available-columns",children:[h("div",{className:"section-title",children:"Available Grouping Columns"}),v("div",{className:"top-menu",children:[h(gs,{className:"w-100",value:n,matchCount:n?i.length:void 0,placeholder:"Find column...",onChange:this.handleSearchChange}),v(Q,{kind:"ghost",className:W("btn-link btn-link-icon",{active:l===En.SORT.ASCENDING}),onClick:this.handleSortAscending,children:[h(q,{icon:rd}),h(Ie,{children:"Sort ascending"})]}),v(Q,{kind:"ghost",className:W("btn-link btn-link-icon",{active:l===En.SORT.DESCENDING}),onClick:this.handleSortDescending,children:[h(q,{icon:ld}),h(Ie,{children:"Sort descending"})]})]}),h(nn,{className:"rollup-available-grouping-columns",draggablePrefix:Sr,droppableId:Sr,itemCount:a.length,items:a,renderItem:En.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)!==br,isMultiSelect:!0}),v("div",{className:"bottom-menu",children:[h("div",{className:"label",children:"Show:"}),h(Pt,{checked:o,onChange:this.handleShowConstituentsChange,children:"Constituents"}),h(Pt,{checked:r,onChange:this.handleShowNonAggregatedColumnsChange,children:"Non-Aggregated Columns"})]})]})]})})}};let kd=En;kd.SORT=Object.freeze({ASCENDING:"ASC",DESCENDING:"DESC"});kd.defaultProps={config:null,onChange:()=>{}};const Kw=X.module("TableCsvExporter"),qe=class extends S.exports.Component{static getDateString(){return M.i18n.DateTimeFormat.format(qe.FILENAME_DATE_FORMAT,new Date)}constructor(t){super(t),this.handleDownloadClick=this.handleDownloadClick.bind(this),this.handleDownloadOptionChanged=this.handleDownloadOptionChanged.bind(this),this.handleCustomizedDownloadOptionChanged=this.handleCustomizedDownloadOptionChanged.bind(this),this.handleCustomizedDownloadRowsChanged=this.handleCustomizedDownloadRowsChanged.bind(this);const{name:e}=t;this.state={fileName:`${e}-${qe.getDateString()}.csv`,downloadOption:qe.DOWNLOAD_OPTIONS.ALL_ROWS,customizedDownloadOption:qe.CUSTOMIZED_ROWS_OPTIONS.FIRST,customizedDownloadRows:qe.DEFAULT_DOWNLOAD_ROWS,errorMessage:null,id:ze.generate()}}getSnapshotRanges(){const{model:t,selectedRanges:e}=this.props,{downloadOption:n,customizedDownloadOption:s,customizedDownloadRows:i}=this.state,{rowCount:o}=t;let r=[];switch(n){case qe.DOWNLOAD_OPTIONS.ALL_ROWS:r.push(new oe(null,0,null,o-1));break;case qe.DOWNLOAD_OPTIONS.SELECTED_ROWS:r=[...e].sort((l,a)=>l.startRow!=null&&a.startRow!=null?l.startRow-a.startRow:0);break;case qe.DOWNLOAD_OPTIONS.CUSTOMIZED_ROWS:switch(s){case qe.CUSTOMIZED_ROWS_OPTIONS.FIRST:r.push(new oe(null,0,null,Math.min(i-1,o-1)));break;case qe.CUSTOMIZED_ROWS_OPTIONS.LAST:r.push(new oe(null,Math.max(0,o-i),null,o-1));break}break}return r}resetDownloadState(){this.setState({errorMessage:null})}async handleDownloadClick(){const{model:t,isDownloading:e,onDownloadStart:n,onDownload:s,onCancel:i}=this.props,{fileName:o}=this.state;if(e){i();return}this.resetDownloadState();const r=this.getSnapshotRanges();if(this.validateOptionInput()){n();try{const l=await t.export(),a=l.setViewport(0,0);await a.getViewportData(),s(o,l,a,r)}catch(l){Kw.error("CSV download failed",l),this.setState({errorMessage:v("p",{children:[h(q,{icon:cs})," ",`${l}`]})}),i()}}}handleDownloadOptionChanged(t){this.setState({downloadOption:t.target.value})}handleCustomizedDownloadOptionChanged(t){this.setState({customizedDownloadOption:t.target.value})}handleCustomizedDownloadRowsChanged(t){this.setState({customizedDownloadRows:parseInt(t.target.value,10)})}validateOptionInput(){const{selectedRanges:t}=this.props,{downloadOption:e,customizedDownloadRows:n}=this.state;return e===qe.DOWNLOAD_OPTIONS.SELECTED_ROWS&&t.length===0?(this.setState({errorMessage:v("p",{children:[h(q,{icon:cs})," No rows selected. Please select some rows in the table."]})}),!1):e===qe.DOWNLOAD_OPTIONS.CUSTOMIZED_ROWS&&n<=0?(this.setState({errorMessage:v("p",{children:[h(q,{icon:cs})," 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,downloadOption:l,customizedDownloadOption:a,customizedDownloadRows:d,errorMessage:c,id:u}=this.state,{rowCount:m}=t;return v("div",{className:"table-csv-exporter",children:[h("div",{className:"section-title",children:"Download Rows"}),h("div",{className:"form-group",children:v(pl,{onChange:this.handleDownloadOptionChanged,value:l,disabled:e,children:[v(Mn,{value:qe.DOWNLOAD_OPTIONS.ALL_ROWS,"data-testid":"radio-csv-exporter-download-all",children:["All Rows",h("span",{className:"text-muted ml-2",children:`(${m.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1,")} rows)`})]}),v(Mn,{value:qe.DOWNLOAD_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?`(${oe.rowCount(i).toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1,")} rows)`:null})]}),h(Mn,{value:qe.DOWNLOAD_OPTIONS.CUSTOMIZED_ROWS,"data-testid":"radio-csv-exporter-customized-rows",children:v("div",{className:"radio-input-row",role:"presentation",onClick:()=>{this.setState({downloadOption:qe.DOWNLOAD_OPTIONS.CUSTOMIZED_ROWS})},children:[v("select",{value:a,"data-testid":"select-csv-exporter-customized-rows",className:"custom-select",disabled:e,onChange:this.handleCustomizedDownloadOptionChanged,children:[h("option",{value:"FIRST",children:"First"}),h("option",{value:"LAST",children:"Last"})]}),h("input",{type:"number",className:"form-control",id:`customizedRows-${u}`,"data-testid":"input-csv-exporter-customized-rows",name:`customizedRows-${u}`,placeholder:"100",value:d,disabled:e,onChange:this.handleCustomizedDownloadRowsChanged}),h("div",{children:"Rows"})]})})]})}),v("div",{className:"form-group",children:[h("label",{htmlFor:`customizedRows-${u}`,children:"File Name"}),h("input",{type:"text",className:"form-control",id:`filename-${u}`,"data-testid":"input-csv-exporter-file-name",name:`filename-${u}`,value:r,onChange:p=>{this.setState({fileName:p.target.value})},disabled:e})]}),v("div",{className:"section-footer flex-column",children:[c!=null&&h("div",{className:"error-message",children:c}),o&&v("div",{className:"download-status",children:[(o===qe.DOWNLOAD_STATUS.DOWNLOADING||o===qe.DOWNLOAD_STATUS.INITIATING)&&v(he,{children:[o===qe.DOWNLOAD_STATUS.INITIATING&&h("div",{className:"text-muted",children:"Starting Download..."}),o===qe.DOWNLOAD_STATUS.DOWNLOADING&&v("div",{className:"text-muted d-flex justify-content-between",children:[h("span",{children:s||s===0?`Estimated time: ${In.formatElapsedTime(s)}`:null}),h("span",{children:`${n}%`})]})]}),o===qe.DOWNLOAD_STATUS.FINISHED&&h("div",{className:"text-muted text-right",children:"Download Completed"}),o===qe.DOWNLOAD_STATUS.CANCELED&&h("div",{className:"text-muted",children:"Download Canceled"}),(o===qe.DOWNLOAD_STATUS.DOWNLOADING||o===qe.DOWNLOAD_STATUS.INITIATING)&&h("div",{className:"progress",children:h("div",{className:"progress-bar progress-bar-striped progress-bar-animated",style:{width:`${n}%`}})}),o===qe.DOWNLOAD_STATUS.FINISHED&&h("div",{className:"progress",children:h("div",{className:"progress-bar bg-success",style:{width:`${n}%`}})})]}),v("button",{type:"button","data-testid":"btn-csv-exporter-download",className:W("btn btn-primary btn-downloading",{"btn-spinner btn-cancelable":e}),onClick:this.handleDownloadClick,children:[e&&v("span",{children:[h(_n,{}),h("span",{className:"btn-normal-content",children:"Downloading"}),h("span",{className:"btn-hover-content",children:"Cancel"})]}),!e&&"Download"]})]})]})}};let on=qe;on.FILENAME_DATE_FORMAT="yyyy-MM-dd-HHmmss";on.DOWNLOAD_STATUS={INITIATING:"INITIATING",DOWNLOADING:"DOWNLOADING",FINISHED:"FINISHED",CANCELED:"CANCELED"};on.DOWNLOAD_OPTIONS={ALL_ROWS:"ALL_ROWS",SELECTED_ROWS:"SELECTED_ROWS",CUSTOMIZED_ROWS:"CUSTOMIZED_ROWS"};on.CUSTOMIZED_ROWS_OPTIONS={FIRST:"FIRST",LAST:"LAST"};on.DEFAULT_DOWNLOAD_ROWS=100;on.defaultProps={onDownloadStart:()=>{},isDownloading:!1,tableDownloadStatus:"",tableDownloadProgress:0,tableDownloadEstimatedTime:null,selectedRanges:[]};const ts=X.module("TableSaver");function qw(t){return t.added!==void 0}function Yw(t){if(!qw(t))throw new Error("event is not UpdateEventData")}const Ns=class extends S.exports.PureComponent{constructor(t){var e,n;super(t),this.WritableStream=(e=window.WritableStream)!=null?e:uc,this.getCachedCustomColumnFormatFlag=ln(hs.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.snapshotsTotal=0,this.snapshotCounter=0,this.snapshotsBuffer=new Map,this.currentSnapshotIndex=0,this.snapshotPending=0,this.cancelableSnapshots=[],this.WritableStream=(n=window.WritableStream)!=null?n:uc,this.iframes=[],this.useBlobFallback=!1}static csvEscapeString(t){return`"${t.replace(/"/g,'""')}"`}componentDidMount(){const{getDownloadWorker:t}=this.props;t().then(e=>{ts.info("found active service worker"),this.sw=e,this.sw.postMessage("ping")}).catch(e=>{ts.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=>{A(s),r.header!==void 0&&n.push(s(r.header)),r.rows!==void 0&&n.push(s(r.rows))},o.close=()=>{A(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){const{isDownloading:i}=this.props;if(i)return;this.downloadStartTime=Date.now(),ts.info(`start downloading ${t}`),this.table=e,this.columns=e.columns,this.tableSubscription=n,this.gridRanges=s;const o=encodeURIComponent(t.replace(/\//g,":")).replace(/['()]/g,escape).replace(/\*/g,"%2A"),r=new MessageChannel;if(this.port=r.port1,this.fileName=t,this.fileWriter=this.createWriterStream(this.port).getWriter(),this.useBlobFallback){this.writeCsvTable();return}this.sw&&this.sw.postMessage({encodedFileName:o},[r.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&&ts.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.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(){ts.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?`
|
|
25
|
+
`:",";(e=this.fileWriter)==null||e.write({header:t}).then(()=>null)}startWriteTableBody(){this.columns&&this.gridRanges!=null&&(this.chunkRows=Math.floor(Ns.DOWNLOAD_CELL_CHUNK/this.columns.length),this.rangedSnapshotsTotal=this.gridRanges.map(t=>(A(t.endRow),A(t.startRow),A(this.chunkRows),Math.ceil((t.endRow-t.startRow+1)/this.chunkRows))),this.snapshotsTotal=this.rangedSnapshotsTotal.reduce((t,e)=>t+e),ts.info("start writing table, total snapshots: ",this.snapshotsTotal),this.makeSnapshot(Math.min(Ns.SNAPSHOT_BUFFER_SIZE,this.snapshotsTotal)))}writeCsvTable(){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);A(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&&(ts.debug2(`
|
|
26
|
+
current range index: ${this.gridRangeCounter},
|
|
27
|
+
snapshotIndexCounter: ${this.snapshotCounter},
|
|
28
|
+
currentRangedSnapshotIndex : ${this.rangedSnapshotCounter},
|
|
29
|
+
snapshotpending: ${this.snapshotPending},
|
|
30
|
+
buffered ${this.snapshotsBuffer.size}
|
|
31
|
+
making ${Math.min(Ns.SNAPSHOT_BUFFER_SIZE-this.snapshotsBuffer.size-this.snapshotPending,this.snapshotsTotal-this.snapshotCounter)} more snapshots
|
|
32
|
+
`),this.makeSnapshot(Math.min(Ns.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 o;let e="";const n=t.added.iterator(),{formatter:s}=this.props,i=[];for(;n.hasNext();)i.push(n.next().value);A(this.columns);for(let r=0;r<i.length;r+=1){const l=i[r];for(let a=0;a<this.columns.length;a+=1){const{type:d,name:c}=this.columns[a],u=this.getCachedCustomColumnFormatFlag(s,c,d);let m=null;if(!u){const g=t.getFormat(l,this.columns[a]);m=(g==null?void 0:g.formatString)!=null?g:null}let p=null;m?p=s.getFormattedString(t.getData(l,this.columns[a]),d,c,m):p=s.getFormattedString(t.getData(l,this.columns[a]),d,c),e+=Ns.csvEscapeString(p),e+=a===((o=this.columns)==null?void 0:o.length)-1?`
|
|
33
|
+
`:","}}return e}makeSnapshot(t){if(t<=0)return;A(this.gridRangeCounter);let e=0,n=this.gridRanges[this.gridRangeCounter];for(A(this.tableSubscription),A(this.columns);e<t;){A(n),A(n.startRow),A(n.endRow),A(this.rangedSnapshotCounter),A(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(Ee.makeCancelable(this.tableSubscription.snapshot(M.RangeSet.ofRange(s,i),this.columns).then(r=>(Yw(r),this.handleSnapshotResolved(r,o,s,i),o)).catch(r=>{ts.error(r)}),r=>{ts.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;this.useBlobFallback||(e!=null&&(this.makeIframe(`${e}`),this.writeCsvTable()),n!=null&&(this.useBlobFallback||(this.streamTimeout!=null&&clearTimeout(this.streamTimeout),this.streamTimeout=setTimeout(this.handleDownloadTimeout,Ns.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},Ns.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 Qi=Ns;Qi.DOWNLOAD_CELL_CHUNK=6e3;Qi.SNAPSHOT_BUFFER_SIZE=5;Qi.STREAM_TIMEOUT=8e3;Qi.SNAPSHOT_HANDLER_TIMEOUT=5;Qi.defaultProps={getDownloadWorker:()=>Promise.reject(new Error("Download worker not provided")),isDownloading:!1,onDownloadCompleted:()=>{},onDownloadCanceled:()=>{},onDownloadProgressUpdate:()=>{}};const Xw=X.module("VisibilityOrderingBuilder"),jw=150,Qe=class extends S.exports.Component{constructor(t){super(t),this.debouncedSearchColumns=Xe(this.searchColumns,jw),this.getFirstMovableIndex=Te((e,n)=>{for(let s=0;s<n.length;s+=1)if(e.isColumnMovable(s))return s;return null}),this.getLastMovableIndex=Te((e,n)=>{for(let s=n.length-1;s>=0;s-=1)if(e.isColumnMovable(s))return s;return null}),this.renderImmovableItem=Te(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.renderVisibilityOrderingItem=Te((e,n,s,i,o,r,l,a)=>h(ol,{draggableId:`${n}`,index:s,disableInteractiveElementBlocking:!0,children:d=>v("div",{className:"visibility-ordering-list-item",ref:d.innerRef,...d.draggableProps,children:[h("button",{type:"button",className:"visibility btn btn-link btn-link-icon",onMouseDown:c=>{this.handleVisibilityDraggingStart(n,i?Qe.VISIBILITY_OPTIONS.SHOW:Qe.VISIBILITY_OPTIONS.HIDE,c)},onMouseEnter:c=>{this.handleMouseEnter(n,c)},onMouseUp:c=>{this.handleVisibilityDraggingEnd(c)},onClick:c=>{this.handleItemClick(n,c,!1)},onKeyDown:c=>{(c.key==="Enter"||c.key===" ")&&(this.handleVisibilityKeyDown(n,i?Qe.VISIBILITY_OPTIONS.SHOW:Qe.VISIBILITY_OPTIONS.HIDE),c.stopPropagation(),c.preventDefault())},children:h(q,{icon:i?vc:Ta})}),v("div",{role:"menuitem",tabIndex:0,className:W("ordering column-item",{isSelected:o},{isDragging:r},{isDragged:l},{"two-dragged":a===2},{"multiple-dragged":a!=null&&a>2}),onClick:c=>{this.handleItemClick(n,c)},...d.dragHandleProps,children:[h("span",{className:"column-name",children:e}),v("div",{children:[a!=null&&a!==0&&h("span",{className:"number-badge",children:a}),h(Ie,{children:"Drag to re-order"}),h(q,{icon:al})]})]})]})},e)),this.handleSearchInputChange=this.handleSearchInputChange.bind(this),this.searchColumns=this.searchColumns.bind(this),this.handleOrderDraggingStart=this.handleOrderDraggingStart.bind(this),this.handleOrderDraggingEnd=this.handleOrderDraggingEnd.bind(this),this.state={selectedColumns:[],lastSelectedColumns:[],isDraggingVisibility:!1,visibilityDraggingOption:void 0,visibilityDraggingStartColumn:null,isDraggingOrder:!1,orderDraggingColumn:null,searchFilter:""},this.list=null}componentWillUnmount(){this.debouncedSearchColumns.cancel()}resetVisibilityOrdering(){const{model:t,onColumnVisibilityChanged:e,onMovedColumnsChanged:n}=this.props,{columns:s}=t;e(s.map(i=>{const o=t.getColumnIndexByName(i.name);return A(o),o}),Qe.VISIBILITY_OPTIONS.SHOW),this.setState({selectedColumns:[],lastSelectedColumns:[],searchFilter:""}),n([])}resetSelection(){const{isDraggingOrder:t}=this.state;t||this.setState({selectedColumns:[],lastSelectedColumns:[]})}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 r;const{model:e,movedColumns:n}=this.props,{columns:s}=e,i=[];let o=s.length;if(s.forEach((l,a)=>{const d=l.name.toLowerCase();e.isColumnMovable(a)&&d.includes(t.toLowerCase())&&(i.push(a),o=Math.min(o,G.getVisibleIndex(a,n)))}),this.addColumnToSelected(i,!1),i.length>0){const l=(r=this.list)==null?void 0:r.querySelectorAll(".column-item")[o];l==null||l.scrollIntoView({block:"center"})}}handleVisibilityKeyDown(t,e){const{onColumnVisibilityChanged:n}=this.props;n([t],e)}handleVisibilityDraggingStart(t,e,n){const{onColumnVisibilityChanged:s,movedColumns:i}=this.props,o=G.isModifierKeyDown(n),r=n.shiftKey;if(o||r)return;s([t],e);const l=G.getVisibleIndex(t,i);this.setState({isDraggingVisibility:!0,visibilityDraggingOption:e,visibilityDraggingStartColumn:l}),this.addColumnToSelected([t])}handleVisibilityDraggingEnd(t=null){t&&t.target.focus();const{isDraggingVisibility:e}=this.state;e&&this.setState({isDraggingVisibility:!1,visibilityDraggingOption:void 0,visibilityDraggingStartColumn:null})}handleOrderDraggingStart(t){var o;document.documentElement.classList.add("drag-pointer-events-none");const{selectedColumns:e}=this.state,{draggableId:n,source:{index:s}}=t,i=parseInt(n,10);if(((o=this.list)==null?void 0:o.querySelectorAll(".column-item")[s]).focus(),!e.includes(i)){this.setState({isDraggingOrder:!0,orderDraggingColumn:i,selectedColumns:[i]});return}this.setState({isDraggingOrder:!0,orderDraggingColumn:i})}handleOrderDraggingEnd(t){document.documentElement.classList.remove("drag-pointer-events-none");const{movedColumns:e,onMovedColumnsChanged:n}=this.props,{selectedColumns:s,orderDraggingColumn:i}=this.state;if(this.setState({isDraggingOrder:!1,orderDraggingColumn:null}),!t.destination)return;const{index:o}=t.destination,r=[...s].sort((m,p)=>G.getVisibleIndex(m,e)-G.getVisibleIndex(p,e));let l=[...e];A(i);const a=G.getVisibleIndex(i,l),d=[],c=[];l=G.moveItem(a,o,l),r.forEach(m=>{const p=G.getVisibleIndex(m,l);m!==i&&(p<o?d.push(m):c.push(m))}),d.forEach(m=>{const p=G.getVisibleIndex(m,l);l=G.moveItem(p,o,l)});const u=d.length>0||a>o?o+1:o;c.reverse().forEach(m=>{const p=G.getVisibleIndex(m,l);l=G.moveItem(p,u,l)}),n(l),Xw.debug("move column order by drag & drop",l)}handleMouseEnter(t,e){const{onColumnVisibilityChanged:n,movedColumns:s,userColumnWidths:i}=this.props,{isDraggingVisibility:o,visibilityDraggingOption:r,visibilityDraggingStartColumn:l}=this.state,a=G.getVisibleIndex(t,s),d=G.isModifierKeyDown(e),c=e.shiftKey;if(!o||d||c)return;e.target.focus();const u=[t];A(l);const m=a>l;for(let p=l;m?p<a:p>a;m?p+=1:p-=1){const g=G.getModelIndex(p,s),f=G.checkColumnHidden(g,i);(f&&r===Qe.VISIBILITY_OPTIONS.SHOW||!f&&r===Qe.VISIBILITY_OPTIONS.HIDE)&&u.push(g)}this.addColumnToSelected(u,!0),n(u,r)}handleMoveColumns(t){const{movedColumns:e,onMovedColumnsChanged:n,model:s}=this.props,{columns:i}=s,{selectedColumns:o}=this.state;if(o.length===0)return;const r=this.getFirstMovableIndex(s,i),l=this.getLastMovableIndex(s,i);if(r==null||l==null)return;const a=[...o].sort((u,m)=>t===Qe.MOVE_OPTIONS.TOP||t===Qe.MOVE_OPTIONS.UP?G.getVisibleIndex(u,e)-G.getVisibleIndex(m,e):G.getVisibleIndex(m,e)-G.getVisibleIndex(u,e));let d=[],c=()=>{};switch(t){case Qe.MOVE_OPTIONS.TOP:a.forEach((u,m)=>{const p=G.getVisibleIndex(u,e);d=G.moveItem(p,r+m,d)}),c=()=>{A(this.list),this.list.scrollTop=0};break;case Qe.MOVE_OPTIONS.BOTTOM:a.forEach((u,m)=>{const p=G.getVisibleIndex(u,e);d=G.moveItem(p,l-m,d)}),c=()=>{A(this.list),this.list.scrollTop=this.list.scrollHeight};break;case Qe.MOVE_OPTIONS.UP:G.getVisibleIndex(a[0],e)!==r&&a.forEach(u=>{const m=G.getVisibleIndex(u,e);d=G.moveItem(m,m-1,d)});break;case Qe.MOVE_OPTIONS.DOWN:G.getVisibleIndex(a[0],e)!==l&&a.forEach(u=>{const m=G.getVisibleIndex(u,e);d=G.moveItem(m,m+1,d)});break}d.length>0&&n(e.concat(d),c)}handleSortColumns(t){const{model:e,onMovedColumnsChanged:n}=this.props,{columns:s}=e,i=[],o=[];for(let c=0;c<s.length;c+=1)e.isColumnMovable(c)?i.push(c):o.push(c);const r=i.sort((c,u)=>{const m=t===Qe.SORTING_OPTIONS.ASC,p=s[c].name.toUpperCase(),g=s[u].name.toUpperCase();return tn.sort(p,g,m)}),l=[];for(let c=0;c<o.length;c+=1){const u=o[c];l[u]=u}let a=0;for(let c=0;c<r.length;c+=1){for(;l[a]!=null;)a+=1;l[a]=r[c]}let d=[];l.forEach((c,u)=>{const m=G.getVisibleIndex(c,d);d=G.moveItem(m,u,d)}),n(d)}handleItemClick(t,e,n=!0){e.stopPropagation(),e.currentTarget.focus();const{selectedColumns:s,lastSelectedColumns:i}=this.state,o=G.isModifierKeyDown(e),r=e.shiftKey,l=s.includes(t),a=[t];if(l&&o){this.removeColumnFromSelected(t);return}if(l&&s.length===1&&n){this.removeColumnFromSelected(t);return}if(r){const{movedColumns:d}=this.props,c=i[i.length-1],u=G.getVisibleIndex(c,d),m=G.getVisibleIndex(t,d),p=m>u,g=[];for(let f=u;p?f<m:f>m;p?f+=1:f-=1)g.push(G.getModelIndex(f,d));g.forEach(f=>{s.includes(f)||a.push(f)})}this.addColumnToSelected(a,o||r)}addColumnToSelected(t,e=!1){const{selectedColumns:n,lastSelectedColumns:s}=this.state,i=e?n.concat(t):t,o=e?s.concat(t):t;this.setState({selectedColumns:i,lastSelectedColumns:o})}removeColumnFromSelected(t){const{selectedColumns:e,lastSelectedColumns:n}=this.state,s=[...e];s.splice(s.findIndex(r=>r===t),1);const i=n[n.length-1],o=[...n];i===t&&o.pop(),this.setState({selectedColumns:s,lastSelectedColumns:o})}makeVisibilityOrderingList(){const{model:t,userColumnWidths:e,movedColumns:n}=this.props,{columns:s}=t,{selectedColumns:i,isDraggingOrder:o,orderDraggingColumn:r}=this.state,l=[];let a=!1;for(let d=0;d<s.length;d+=1){const c=G.getModelIndex(d,n),u=s[c],m=t.isColumnMovable(c);if(d>0&&m!==a&&l.push(h("hr",{})),m){const p=e.get(c)===0,g=i.includes(c),f=r===c,b=o&&f&&i.length>1?i.length:null;l.push(this.renderVisibilityOrderingItem(u.name,c,d,p,g,o,f,b))}else l.push(this.renderImmovableItem(u.name));a=m}return l}render(){const{model:t,userColumnWidths:e,onColumnVisibilityChanged:n}=this.props,{selectedColumns:s,searchFilter:i}=this.state,{columns:o}=t,r=s.length===0,l=r?o.map((u,m)=>m).filter(u=>t.isColumnMovable(u)):[...s],a=G.checkAllColumnsHidden(l,e),d=a?"Show Selected":"Hide Selected",c=this.makeVisibilityOrderingList();return v("div",{role:"menu",className:"visibility-ordering-builder",tabIndex:0,onMouseUp:()=>{this.handleVisibilityDraggingEnd()},onMouseLeave:()=>{this.handleVisibilityDraggingEnd()},children:[v("div",{className:"top-menu",children:[v("button",{type:"button",className:"btn btn-link",onClick:()=>{n(l,a?Qe.VISIBILITY_OPTIONS.SHOW:Qe.VISIBILITY_OPTIONS.HIDE)},children:[h(q,{icon:a?vc:Ta}),h(Ie,{children:"Toggle column visibility"}),r?"Toggle All":d]}),v("div",{children:[v("button",{type:"button",className:"btn btn-link text-muted",onClick:()=>{this.resetVisibilityOrdering()},children:["Reset",h(Ie,{children:"Reset to default"})]}),v("button",{type:"button",className:"btn btn-link btn-link-icon",onClick:()=>{this.handleSortColumns(Qe.SORTING_OPTIONS.ASC)},children:[h(q,{icon:rd}),h(Ie,{children:"Sort ascending"})]}),v("button",{type:"button",className:"btn btn-link btn-link-icon",onClick:()=>{this.handleSortColumns(Qe.SORTING_OPTIONS.DSC)},children:[h(q,{icon:ld}),h(Ie,{children:"Sort descending"})]}),h("span",{className:"vertical-divider"}),v("button",{type:"button",className:"btn btn-link btn-link-icon",onClick:()=>{this.handleMoveColumns(Qe.MOVE_OPTIONS.UP)},disabled:r,children:[h(q,{icon:tf}),h(Ie,{children:"Move selection up"})]}),v("button",{type:"button",className:"btn btn-link btn-link-icon",onClick:()=>{this.handleMoveColumns(Qe.MOVE_OPTIONS.DOWN)},disabled:r,children:[h(q,{icon:Jg}),h(Ie,{children:"Move selection down"})]}),v("button",{type:"button",className:"btn btn-link btn-link-icon",onClick:()=>{this.handleMoveColumns(Qe.MOVE_OPTIONS.TOP)},disabled:r,children:[h(q,{icon:Mf}),h(Ie,{children:"Move selection to top"})]}),v("button",{type:"button",className:"btn btn-link btn-link-icon",onClick:()=>{this.handleMoveColumns(Qe.MOVE_OPTIONS.BOTTOM)},disabled:r,children:[h(q,{icon:Df}),h(Ie,{children:"Move selection to bottom"})]})]})]}),h("div",{className:"top-menu",children:h(gs,{className:"w-100",value:i,matchCount:i?s.length:void 0,onChange:this.handleSearchInputChange})}),h(Lo,{onDragStart:this.handleOrderDraggingStart,onDragEnd:this.handleOrderDraggingEnd,children:h(ko,{droppableId:"droppable-visibility-order-list",children:(u,m)=>h("div",{role:"menu",className:W("visibility-ordering-list",{isDragging:m.draggingFromThisWith}),ref:u.innerRef,...u.droppableProps,children:v("div",{className:"column-list",ref:p=>{this.list=p},children:[c,u.placeholder]})})})})]})}};let pi=Qe;pi.VISIBILITY_OPTIONS={SHOW:"SHOW",HIDE:"HIDE"};pi.SORTING_OPTIONS={DSC:"DSC",ASC:"ASC"};pi.MOVE_OPTIONS={TOP:"TOP",BOTTOM:"BOTTOM",UP:"UP",DOWN:"DOWN"};pi.COLUMN_CHANGE_OPTIONS={ALL:"ALL",SELECTION:"SELECTION"};pi.defaultProps={movedColumns:[],onColumnVisibilityChanged:()=>{},onMovedColumnsChanged:()=>{}};const wr=X.module("AdvancedFilterCreatorFilterItem");class Ld extends S.exports.PureComponent{constructor(e){super(e),this.getCachedIsValid=ge((o,r,l,a)=>{try{return!l||P.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(P.isNumberType(e)||P.isCharType(e))return Hb(n);if(P.isTextType(e))return Pb(n);if(P.isDateType(e))return Vb(n);if(P.isBooleanType(e))return Ub(n);throw new Error(`Unrecognized column type: ${e}`)}catch(s){return wr.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;wr.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){wr.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(){wr.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=!P.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=Ld.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:v("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:W("form-control",{error:!a}),placeholder:"Enter value",value:o,onChange:this.handleValueChange})})}),h("div",{className:"form-group col-1 px-0",children:v("button",{type:"button",className:"btn btn-link btn-link-icon w-100 h-100 p-0 m-0",onClick:this.handleDelete,children:[h(q,{icon:xn}),h(Ie,{children:"Remove Filter"})]})})]})})}}const hh=X.module("AdvancedFilterCreatorSelectValueList"),La=class extends S.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=La.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})}hh.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=La.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);hh.debug2("Setting viewport",o,",",r),s.setViewport(o,r)}render(){const{offset:t,isLoading:e,items:n,itemCount:s}=this.state;return v("div",{className:"select-value-list-wrapper",children:[h(Mu,{itemCount:s,items:n,offset:t,onSelect:this.handleSelect,onViewportChange:this.handleViewportChange,ref:i=>{this.list=i}}),h(ht,{in:e,timeout:250,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,children:h("div",{className:"loading-list",children:h(_n,{className:"loading-spinner-large"})})})]})}};let Wm=La;Wm.defaultProps={invertSelection:!0,selectedValues:[],onChange:()=>{}};const zm=class extends S.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,zm.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;P.isCharType(s.type)?r=P.makeQuickFilter(s,e):P.isTextType(s.type)?r=P.makeQuickFilter(s,`~${e}`,n):r=P.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 v("div",{className:"advanced-filter-creator-select-value",children:[v("div",{className:l?"form-group":"",children:[h("label",{htmlFor:"advanced-filter-creator-select-value-input",children:"Select Values"}),l&&h("input",{type:"text",className:W("form-control",{"is-invalid":t!=null}),id:"advanced-filter-creator-select-value-input",placeholder:c,value:i,onChange:this.handleSearchChange})]}),h(Wm,{table:o,filters:e,invertSelection:n,selectedValues:s,formatter:r,onChange:this.handleListChange}),v("div",{className:"advanced-filter-creator-select-meta-row",children:[v("div",{children:[h("button",{type:"button",className:"btn btn-link",onClick:this.handleSelectAllClick,children:"Select All"}),h("button",{type:"button",className:"btn btn-link",onClick:this.handleClearAllClick,children:"Clear"})]}),h(ht,{in:d!=null,timeout:250,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,children:h("div",{className:"row-count-info",children:d})})]})]})}};let Od=zm;Od.searchDebounceTime=250;Od.defaultProps={invertSelection:!0,selectedValues:[],onChange:()=>{},showSearch:!0};const ao=X.module("AdvancedFilterCreator"),Zs=class extends S.exports.PureComponent{constructor(t){var r,l;super(t),this.getFilterTypes=ge(a=>P.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=Y.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:ze()})))!=null?l:[];o.length===0&&o.push(Zs.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:ze()}}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){ao.debug("No values table for this model, just ignore");return}this.valuesTablePromise=P.makeCancelableTablePromise(t.valuesTable(e)),this.valuesTablePromise.then(n=>{const s=n.columns[0].sort().asc();n.applySort([s]),this.setState({valuesTable:n})}).catch(n=>{Ee.isCanceled(n)||(ao.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(Zs.makeFilterItem()),e=e.concat(zt.and),this.setState({filterItems:t,filterOperators:e})}handleAddOr(){let{filterItems:t,filterOperators:e}=this.state;t=t.concat(Zs.makeFilterItem()),e=e.concat(zt.or),this.setState({filterItems:t,filterOperators:e})}handleChangeFilterOperator(t){const e=t.currentTarget,{operator:n,index:s}=e.dataset;A(s);const i=parseInt(s,10);let{filterOperators:o}=this.state;o=[...o],Ab(n),o[i]=n,this.setState({filterOperators:o}),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(Zs.makeFilterItem()),this.setState({filterItems:e,filterOperators:n}),this.startUpdateTimer()}handleSelectValueChange(t,e){this.setState({selectedValues:t,invertSelection:e}),this.startUpdateTimer()}handleReset(){ao.debug("Resetting Advanced Filter"),this.setState({filterItems:[Zs.makeFilterItem()],filterOperators:[],selectedValues:[],invertSelection:!0}),this.startUpdateTimer()}handleSortDown(t){const e=Ne.isModifierKeyDown(t);this.sortTable(P.sortDirection.descending,e)}handleSortUp(t){const e=Ne.isModifierKeyDown(t);this.sortTable(P.sortDirection.ascending,e)}handleSubmit(t){ao.debug("Submitting Advanced Filter"),this.stopUpdateTimer(),this.sendUpdate(),t.preventDefault()}handleDone(t){ao.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,Zs.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=P.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=P.isBooleanType(t.type),m=P.isDateType(t.type),p=this.getFilterTypes(t.type),g=t.type.substring(t.type.lastIndexOf(".")+1),f=[];if(!u&&p.length)for(let w=0;w<i.length;w+=1){const T=i[w],{key:E,selectedType:y,value:I}=T,D=h(Ld,{column:t,filterTypes:p,onChange:this.getFilterChangeHandler(w),onDelete:this.getFilterDeleteHandler(w),selectedType:y,value:I,formatter:s},E);if(f.push(D),w<o.length){const x=o[w]===zt.and,U=v("div",{className:"form-row justify-content-end advanced-filter-creator-filter-operator",children:[h("button",{type:"button",className:W("btn btn-link filter-operator",{active:x}),onClick:this.handleChangeFilterOperator,"data-index":w,"data-operator":zt.and,children:"AND"}),h("button",{type:"button",className:W("btn btn-link filter-operator",{active:!x}),onClick:this.handleChangeFilterOperator,"data-index":w,"data-operator":zt.or,children:"OR"})]},`filterOperator${E}`);f.push(U)}}const b=this.shouldShowAddFilter(),C=v("div",{className:W("form-row justify-content-end add-filter-item",{hidden:!b}),children:[h("span",{className:"text-muted",children:h(q,{icon:Ls})}),v("button",{type:"button",className:"btn btn-link btn-filter-item",onClick:this.handleAddAnd,disabled:!b,children:["AND",h(Ie,{children:"Add filter with AND"})]}),v("button",{type:"button",className:"btn btn-link btn-filter-item",onClick:this.handleAddOr,disabled:!b,children:["OR",h(Ie,{children:"Add filter with OR"})]})]},"addFilterItem");return f.push(C),v("div",{className:"advanced-filter-creator",role:"presentation",children:[h("div",{tabIndex:0,onFocus:this.handleFocusTrapStart}),v("form",{onSubmit:this.handleSubmit,ref:this.focusTrapContainer,children:[v("div",{className:"title-bar",children:[h("h6",{className:"advanced-filter-title",children:"Advanced Filters"}),v("div",{className:"advanced-filter-menu-buttons",children:[v("button",{type:"button",className:W("btn btn-link btn-link-icon sort-operator",{active:n===P.sortDirection.descending}),onClick:this.handleSortDown,children:[h(q,{icon:Tc}),v(Ie,{children:["Sort ",t.name," Descending"]})]}),v("button",{type:"button",className:W("btn btn-link btn-link-icon sort-operator",{active:n===P.sortDirection.ascending}),onClick:this.handleSortUp,children:[h(q,{rotation:180,icon:Tc}),v(Ie,{children:["Sort ",t.name," Ascending"]})]})]})]}),h("hr",{}),v("div",{className:"advanced-filter-column-name",children:[t.name,"\xA0",v("span",{className:"column-type",children:["(",g,")"]})]}),f,c&&d==null&&v(he,{children:[!u&&h("hr",{}),h("div",{className:"form-group",children:h(Od,{table:a,onChange:this.handleSelectValueChange,invertSelection:r,selectedValues:l,formatter:s,showSearch:!m,timeZone:s.timeZone})})]}),v("div",{className:"form-row justify-content-end",children:[h("button",{type:"button",className:"btn btn-outline-primary mr-2",onClick:this.handleReset,children:"Reset"}),h("button",{type:"button",className:"btn btn-primary",onClick:this.handleDone,children:"Done"})]})]}),h("div",{tabIndex:0,onFocus:this.handleFocusTrapEnd})]})}};let Ad=Zs;Ad.debounceFilterUpdate=250;Ad.defaultProps={options:{filterItems:null,filterOperators:null,invertSelection:!0,selectedValues:[]},sortDirection:null};function Qw(t,e){const n=ev(t);return n===void 0?void 0:`${rv(t)} ? ${n} : ${e}`}function Zw(t){return dh.Column.formatRowColor(t)}function Jw(t,e){return t.formatColor(e)}const ra=X.module("ConditionalFormattingUtils");var Kn=(t=>(t.CONDITIONAL="conditional",t.ROWS="rows",t))(Kn||{}),Ye=(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))(Ye||{}),sn=(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))(sn||{}),Ot=(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))(Ot||{}),To=(t=>(t.IS_TRUE="is-true",t.IS_FALSE="is-false",t.IS_NULL="is-null",t.IS_NOT_NULL="is-not-null",t))(To||{}),ii=(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))(ii||{}),Vn=(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))(Vn||{});function uh(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 jr(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 Qr(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 ev(t){const e=Qr(t.style),n=jr(t.style);if(!(e===void 0||n===void 0))return`bgfg(\`${n}\`, \`${e}\`)`}function tv(t){const{column:e,value:n,start:s,end:i}=t;return bv(e.name,t.condition,n,s,i)}function nv(t){const{column:e,value:n}=t;return Sv(e.name,t.condition,n)}function sv(t){const{column:e,value:n}=t;return wv(e.name,t.condition,n)}function iv(t){const{column:e}=t;return vv(e.name,t.condition)}function ov(t){const{column:e,value:n}=t;return Tv(e.name,t.condition,n)}function rv(t){const{column:e}=t;if(P.isNumberType(e.type))return tv(t);if(P.isCharType(e.type))return ov(t);if(P.isStringType(e.type))return nv(t);if(P.isDateType(e.type))return sv(t);if(P.isBooleanType(e.type))return iv(t);throw new Error("Invalid column type")}function lv(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 av(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 dv(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 cv(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 hv(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 Gm(t){if(P.isNumberType(t)||P.isCharType(t))return"is-equal";if(P.isStringType(t)||P.isDateType(t))return"is-exactly";if(P.isBooleanType(t))return"is-true";throw new Error("Invalid column type")}function uv(t){if(P.isCharType(t)||P.isStringType(t))return""}function Km(t){const{condition:e,value:n,start:s,end:i}=t;return{condition:e,value:n,start:s,end:i}}function Dl(t){return{condition:Gm(t),value:uv(t),start:void 0,end:void 0}}function qm(){return{type:"no-formatting"}}function mv(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 pv(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 gv(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 fv(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 Cv(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 bv(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 Sv(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 wv(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 vv(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 Tv(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 Ev(t,e){if(P.isNumberType(t))return Cv(e);if(P.isCharType(t))return fv(e);if(P.isStringType(t))return mv(e);if(P.isDateType(t))return pv(e);if(P.isBooleanType(t))return gv(e);throw new Error("Invalid column type")}function yv(t,e){if(e===void 0)return ra.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){ra.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=Qw(o,d);if(u===void 0){ra.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"?Jw(a,u):Zw(u);n.push(p),r==="conditional"?i.set(a.name,[u,p]):s=[u,p]}),n}function Iv({type:t}){return P.isNumberType(t)||P.isCharType(t)||P.isStringType(t)||P.isDateType(t)||P.isBooleanType(t)}const Ml=({animation:t="iris-grid-bottom-bar-slide-up",children:e,className:n,isShown:s,onClick:i,onEntering:o,onEntered:r,onExiting:l,onExited:a})=>h(ht,{in:s,timeout:Tt.transitionMs,classNames:t,onEntering:o,onEntered:r,onExiting:l,onExited:a,mountOnEnter:!0,unmountOnExit:!0,children:h("div",{className:W("iris-grid-bottom-bar",n),role:"presentation",onClick:i,onKeyPress:i,children:e})});const Rv=3e3,Dv=5,Mv=({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]=S.exports.useState(!1),[g,f]=S.exports.useState(!1),b=S.exports.useRef(),C=hl(t),w=S.exports.useMemo(()=>r.size===0?o:r.size<=Dv?`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]);S.exports.useEffect(function(){C!=null&&C&&!t&&w==null&&(p(!0),f(!0),b.current=setTimeout(()=>{p(!1)},Rv))},[w,t,C]),S.exports.useEffect(function(){b.current&&l.size>0&&(clearTimeout(b.current),p(!1),f(!1))},[l]),S.exports.useEffect(function(){return()=>b.current?clearTimeout(b.current):void 0},[]);const T=l.size;let E;return t?E=h(_n,{}):g&&(E=sd),v(Ml,{className:"pending-data-bottom-bar",isShown:T>0||m||w!=null,onEntering:a,onEntered:d,onExiting:c,onExited:()=>{f(!1),u&&u()},children:[w!=null&&w!==""&&v("div",{className:"error-message",children:[h(q,{icon:cs}),h("span",{children:`${w}`})]}),(w==null||w==="")&&h("div",{className:"status-message",children:T>0&&h("span",{children:`${T} row${T>1?"s":""} pending`})}),v("div",{className:"buttons-container",children:[!t&&!g&&h(Q,{kind:"secondary",onClick:n,tooltip:s,children:"Discard"}),v(Q,{kind:g?"success":"primary",onClick:e,icon:E,disabled:t||g||w!=null,tooltip:i,children:[t&&"Committing...",!t&&g&&"Success",!t&&!g&&"Commit"]})]})]})},co=X.module("IrisGridUtils");function Es(t,e){return t>=0&&t<e.length}class se{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})=>Es(a,l)&&(typeof d=="number"&&Es(d,l)||Array.isArray(d)&&Es(d[0],l)&&Es(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=se.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})=>Es(u,c)&&(typeof m=="number"&&Es(m,c)||Array.isArray(m)&&Es(m[0],c)&&Es(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:w,pendingDataMap:T=new Map,frozenColumns:E}=n;A(l);const{userColumnWidths:y,userRowHeights:I}=l,{columns:D}=e;return{advancedFilters:se.dehydrateAdvancedFilters(D,i),aggregationSettings:s,customColumnFormatMap:[...o],isFilterBarShown:r,quickFilters:se.dehydrateQuickFilters(a),sorts:se.dehydrateSort(C),userColumnWidths:[...y].filter(([N])=>N!=null&&N>=0&&N<D.length).map(([N,x])=>[D[N].name,x]),userRowHeights:[...I],customColumns:[...d],conditionalFormats:[...c],reverseType:u,rollupConfig:m,showSearchBar:p,searchValue:g,selectDistinctColumns:[...f],selectedSearchColumns:b,invertSearchColumns:w,pendingDataMap:se.dehydratePendingDataMap(D,T),frozenColumns:E}}static hydrateIrisGridState(e,n){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:w,invertSearchColumns:T=!0,pendingDataMap:E=[],frozenColumns:y}=n,{columns:I,formatter:D}=e;return{advancedFilters:se.hydrateAdvancedFilters(I,s,D.timeZone),aggregationSettings:i,customColumnFormatMap:new Map(o),isFilterBarShown:r,quickFilters:se.hydrateQuickFilters(I,l,D.timeZone),sorts:se.hydrateSort(I,a),userColumnWidths:new Map(u.map(([N,x])=>typeof N=="string"||N instanceof String?[I.findIndex(({name:U})=>U===N),x]:[N,x]).filter(([N])=>N!=null&&N>=0&&N<I.length)),customColumns:d,conditionalFormats:c,userRowHeights:new Map(m),reverseType:p,rollupConfig:g,showSearchBar:f,searchValue:b,selectDistinctColumns:C,selectedSearchColumns:w,invertSearchColumns:T,pendingDataMap:se.hydratePendingDataMap(I,E),frozenColumns:y}}static dehydrateIrisGridPanelState(e,n){const{isSelectingPartition:s,partition:i,partitionColumn:o}=n;return{isSelectingPartition:s,partition:i,partitionColumn:o!=null?o.name:null}}static hydrateIrisGridPanelState(e,n){const{isSelectingPartition:s,partition:i,partitionColumn:o}=n,{columns:r}=e;return{isSelectingPartition:s,partition:i,partitionColumn:o!=null?se.getColumnByName(r,o):void 0}}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=se.getColumn(e,o);d!=null&&(a=P.makeQuickFilter(d,l,s))}catch(d){co.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=se.getColumn(e,s);A(o);const r=se.dehydrateAdvancedFilterOptions(o,i.options);return[s,{options:r}]})}static hydrateAdvancedFilters(e,n,s){const i=n.map(([o,r])=>{const l=se.getColumn(e,o);A(l);const a=se.hydrateAdvancedFilterOptions(l,r.options);let d=null;try{se.getColumn(e,o)!=null&&(d=P.makeAdvancedFilter(l,a,s))}catch(c){co.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=>se.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=>se.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,se.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 A(d),[(c=i(l))!=null?c:null,se.hydrateValue(a,e[d].type)]}))}]))}static dehydrateValue(e,n){return P.isDateType(n)?se.dehydrateDateTime(e):P.isLongType(n)?se.dehydrateLong(e):e}static hydrateValue(e,n){return P.isDateType(n)?se.hydrateDateTime(e):P.isLongType(n)?se.hydrateLong(e):e}static dehydrateDateTime(e){return e!=null?M.i18n.DateTimeFormat.format(us.FULL_DATE_FORMAT,e):null}static hydrateDateTime(e){return e!=null?M.i18n.DateTimeFormat.parse(us.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===P.sortDirection.reverse)return M.Table.reverse();const l=se.getColumn(e,i);if(l!=null){let a=l.sort();return o&&(a=a.abs()),r===P.sortDirection.descending?a=a.desc():a=a.asc(),a}return null}).filter(s=>s!=null&&s.direction!==P.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=se.getFiltersFromFilterMap(se.hydrateQuickFilters(i,n.quickFilters,s)));let r=[];n.advancedFilters&&(r=se.getFiltersFromFilterMap(se.hydrateAdvancedFilters(i,n.advancedFilters,s)));const l=se.getFiltersFromInputFilters(i,n.inputFilters,s);let a=[];n.sorts&&(a=se.hydrateSort(i,n.sorts));let d=[...o,...r];const{partition:c,partitionColumn:u}=n;if(c!=null&&u!=null){const m=se.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 P.makeQuickFilter(l,r,s)}catch(a){co.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=se.parseCustomColumnNames(e),i=se.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=G.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=G.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=G.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=G.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=se.getVisibleColumnsInRange(e,n,s,i,o),d=a.length*l,c=se.getPrevVisibleColumns(e,n-1,d,i,o),u=se.getNextVisibleColumns(e,s+1,d,i,o),m=[...c,...a,...u];return se.getColumnsToFetch(e,m,r)}static rangeSetFromRanges(e){const n=e.slice().sort((s,i)=>(A(s.startRow),A(i.startRow),s.startRow-i.startRow)).map(s=>{const{startRow:i,endRow:o}=s;return A(i),A(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];A(l.startColumn),A(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})=>_s.isRollupOperation(g)?[]:_s.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[Ae.FIRST])!=null?p:[];c[Ae.FIRST]=[...f,...g]}}return{groupingColumns:i,includeConstituents:o,includeDescriptions:l,aggregations:c}}static getPendingErrors(e){e.forEach((n,s)=>{if(!se.isValidIndex(s))throw new Error(`Invalid rowIndex ${s}`);const{data:i}=n;i.forEach((o,r)=>{if(!se.isValidIndex(r))throw new Error(`Invalid columnIndex ${r}`)})})}static getColumn(e,n){return n<e.length?e[n]:(co.error("Unable to retrieve column",n,">=",e.length),null)}static getColumnByName(e,n){const s=e.find(({name:i})=>i===n);return s==null&&co.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)}}const Zt=X.module("IrisGridCopyHandler"),Ve=class extends S.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:Ve.COPY_STATES.IDLE,buttonState:Ve.BUTTON_STATES.COPY,isShown:!1,rowCount:0}}static getStatusMessageText(t,e){switch(t){case Ve.COPY_STATES.CONFIRMATION_REQUIRED:return`Are you sure you want to copy ${e.toLocaleString()} rows to your clipboard?`;case Ve.COPY_STATES.CLICK_REQUIRED:return`Fetched ${e.toLocaleString()} rows!`;case Ve.COPY_STATES.FETCH_ERROR:return"Unable to copy data.";case Ve.COPY_STATES.FETCH_IN_PROGRESS:return`Fetching ${e.toLocaleString()} rows for clipboard...`;case Ve.COPY_STATES.DONE:return"Copied to Clipboard!";default:return""}}static getCopyButtonText(t){switch(t){case Ve.BUTTON_STATES.FETCH_IN_PROGRESS:return"Fetching";case Ve.BUTTON_STATES.CLICK_TO_COPY:return"Click to Copy";case Ve.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(){Zt.debug2("startCopy"),this.stopCopy();const{copyOperation:t}=this.props;if(t==null){Zt.debug2("No copy operation set, cancelling out"),this.setState({isShown:!1});return}const{ranges:e,error:n}=t;if(n!=null){Zt.debug("Showing copy error",n),this.setState({isShown:!0,copyState:Ve.COPY_STATES.DONE,error:n}),this.startHideTimer();return}const s=oe.rowCount(e);this.setState({rowCount:s,isShown:!0,error:void 0}),s>Ve.NO_PROMPT_THRESHOLD?this.setState({buttonState:Ve.BUTTON_STATES.COPY,copyState:Ve.COPY_STATES.CONFIRMATION_REQUIRED}):this.startFetch()}stopCopy(){this.textData=void 0,this.stopFetch(),this.stopHideTimer()}handleBackgroundClick(){Zt.debug2("handleBackgroundClick");const{copyState:t}=this.state;t===Ve.COPY_STATES.DONE&&this.setState({isShown:!1})}handleCancelClick(){Zt.debug2("handleCancelClick"),this.stopFetch(),this.setState({isShown:!1})}handleCopyClick(){Zt.debug2("handleCopyClick"),this.textData!=null?this.copyText(this.textData):this.startFetch()}handleHideTimeout(){Zt.debug2("handleHideTimeout"),this.stopHideTimer(),this.setState({isShown:!1})}copyText(t){Zt.debug2("copyText",t),this.textData=t,Ne.copyToClipboard(t).then(()=>{this.setState({copyState:Ve.COPY_STATES.DONE}),this.startHideTimer()},e=>{Zt.error("copyText error",e),this.setState({buttonState:Ve.BUTTON_STATES.CLICK_TO_COPY,copyState:Ve.COPY_STATES.CLICK_REQUIRED})})}startFetch(){this.stopFetch(),this.setState({buttonState:Ve.BUTTON_STATES.FETCH_IN_PROGRESS,copyState:Ve.COPY_STATES.FETCH_IN_PROGRESS});const{model:t,copyOperation:e}=this.props,{ranges:n,includeHeaders:s,userColumnWidths:i,movedColumns:o,formatValues:r}=e;Zt.debug("startFetch",n);const l=se.getHiddenColumns(i);let a=G.getModelRanges(n,o);if(l.length>0){const c=l.map(oe.makeColumn);a=oe.subtractRangesFromRanges(a,c)}const d=r!=null&&r?(c,u)=>t.displayString(c,u.type,u.name):c=>`${c}`;this.fetchPromise=Ee.makeCancelable(t.textSnapshot(a,s,d)),this.fetchPromise.then(c=>{this.fetchPromise=void 0,this.copyText(c)}).catch(c=>{c instanceof ai?Zt.debug("User cancelled copy."):(Zt.error("Error fetching contents",c),this.fetchPromise=void 0,this.setState({buttonState:Ve.BUTTON_STATES.RETRY,copyState:Ve.COPY_STATES.FETCH_ERROR}))})}stopFetch(){this.fetchPromise&&(Zt.debug2("stopFetch"),this.fetchPromise.cancel(),this.fetchPromise=void 0)}startHideTimer(){this.stopHideTimer(),this.hideTimer=setTimeout(this.handleHideTimeout,Ve.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===Ve.COPY_STATES.DONE?"fade":"copy-slide-up",c=Ve.getCopyButtonText(i),u=a!=null?a:Ve.getStatusMessageText(o,l),m=o!==Ve.COPY_STATES.DONE,p=i===Ve.BUTTON_STATES.FETCH_IN_PROGRESS,g=o===Ve.COPY_STATES.DONE;return v(Ml,{animation:d,isShown:r,className:W("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(ht,{in:m,timeout:Tt.transitionMs,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,children:v("div",{className:"buttons-container",children:[h("button",{type:"button",className:"btn btn-outline-secondary btn-cancel",onClick:this.handleCancelClick,children:"Cancel"}),v("button",{type:"button",className:W("btn","btn-copy",{"btn-primary":!p,"btn-secondary":p,"btn-spinner":p}),onClick:this.handleCopyClick,disabled:p,children:[p&&h(_n,{}),c]})]})})]})}};let Zi=Ve;Zi.NO_PROMPT_THRESHOLD=1e4;Zi.HIDE_TIMEOUT=3e3;Zi.COPY_STATES={IDLE:"IDLE",CONFIRMATION_REQUIRED:"CONFIRMATION_REQUIRED",FETCH_IN_PROGRESS:"FETCH_IN_PROGRESS",FETCH_ERROR:"FETCH_ERROR",CLICK_REQUIRED:"CLICK_REQUIRED",DONE:"DONE"};Zi.BUTTON_STATES={COPY:"COPY",FETCH_IN_PROGRESS:"FETCH_IN_PROGRESS",CLICK_TO_COPY:"CLICK_TO_COPY",RETRY:"RETRY"};Zi.defaultProps={copyOperation:null,onEntering:()=>{},onEntered:()=>{},onExiting:()=>{},onExited:()=>{}};class Ym extends S.exports.PureComponent{constructor(e){super(e);const{debounceMs:n}=e;this.debouncedSendUpdate=Xe(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=Xe(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 v("div",{style:n,className:"iris-grid-input-autosized-wrapper","data-value":o,children:[h("input",{ref:r=>{this.inputField=r},className:W("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("button",{type:"button",className:W("btn btn-link btn-link-icon advanced-filter-button",{"filter-set":s}),onClick:i,onContextMenu:this.handleContextMenu,children:v("div",{className:"fa-layers ",children:[h(q,{icon:id,className:"filter-solid"}),h(q,{icon:Ur,className:"filter-light"})]})})})]})}}Ym.defaultProps={style:{},className:"",value:"",isAdvancedFilterSet:!1,onAdvancedFiltersTriggered:()=>{},onChange:()=>{},onDone:()=>{},onTab:()=>{},onContextMenu:()=>{},debounceMs:150};class Nv extends Ci{constructor(e){super(),this.irisGrid=e}onDown(e){const{selectedRanges:n}=this.irisGrid.state;return e.key==="c"&&Ne.isModifierKeyDown(e)?(se.isValidSnapshotRanges(n)?this.irisGrid.copyRanges(n):this.irisGrid.copyRanges(n,!1,!1,"Invalid copy ranges"),!0):!1}}const Fv={TOGGLE_QUICK_FILTER:Be.createAndAdd({id:"TABLE.TOGGLE_QUICK_FILTER",name:"Toggle Quick Filter",shortcut:[ue.CTRL,pe.F],macShortcut:[ue.CMD,pe.F]}),CLEAR_ALL_FILTERS:Be.createAndAdd({id:"TABLE.CLEAR_ALL_FILTERS",name:"Clear All Table Filters",shortcut:[ue.CTRL,pe.E],macShortcut:[ue.CMD,pe.E]}),CLEAR_FILTERS:Be.createAndAdd({id:"TABLE.CLEAR_FILTERS",name:"Clear Active Table Filters",shortcut:[ue.CTRL,ue.SHIFT,pe.E],macShortcut:[ue.CMD,ue.SHIFT,pe.E]}),REVERSE:Be.createAndAdd({id:"TABLE.REVERSE",name:"Reverse",shortcut:[ue.CTRL,pe.I],macShortcut:[ue.CMD,pe.I]}),TOGGLE_SEARCH:Be.createAndAdd({id:"TABLE.TOGGLE_SEARCH",name:"Toggle Search",shortcut:[ue.CTRL,ue.SHIFT,pe.F],macShortcut:[ue.CMD,ue.SHIFT,pe.F]}),GOTO_ROW:Be.createAndAdd({id:"TABLE.GOTO_ROW",name:"GOTO_ROW",shortcut:[ue.CTRL,pe.G],macShortcut:[ue.CMD,pe.G]})},xv={COMMIT:Be.createAndAdd({id:"INPUT_TABLE.COMMIT",name:"Commit",shortcut:[ue.CTRL,pe.S],macShortcut:[ue.CMD,pe.S]}),DISCARD:Be.createAndAdd({id:"INPUT_TABLE.DISCARD",name:"Discard",shortcut:[ue.CTRL,ue.ALT,pe.S],macShortcut:[ue.CMD,ue.OPTION,pe.S]})},an={TABLE:Fv,INPUT_TABLE:xv};class _v extends Ci{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===P.REVERSE_TYPE.NONE?this.irisGrid.reverse(P.REVERSE_TYPE.POST_SORT):this.irisGrid.reverse(P.REVERSE_TYPE.NONE),!0}return!1}}class kv extends Ci{constructor(e){super(),this.irisGrid=e}onDown(e){return an.TABLE.CLEAR_FILTERS.matchesEvent(e)?(this.irisGrid.clearAllFilters(),!0):!1}}class Lv extends Et{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);ct(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 Ov extends Et{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 Av extends Et{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 Xm=class extends S.exports.Component{constructor(t=Xm.defaultProps){super(t),this.handleInputChange=this.handleInputChange.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.inputRef=Y.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=nC.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 v("div",{className:"form-group flex-grow mb-0",children:[v("div",{className:"custom-format-title",children:[h("span",{className:"icon",children:o}),v("label",{className:"title mb-0",htmlFor:"custom-format-input",children:[s,i!=null&&h(Ie,{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 jm=Xm;jm.defaultProps={formatString:"",forwardedProps:{menuItem:{},closeMenu(t){},iconElement:null},placeholder:"",title:"",onChange(t){}};class dn{static isDefaultSelected(e){return!e||![Je.TYPE_CONTEXT_CUSTOM,Je.TYPE_CONTEXT_PRESET].includes(e.type)}static isCustomSelected(e){return e!=null&&e.type===Je.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(jm,{formatString:e.formatString,title:e.label,placeholder:s,onChange:o})}}}const Un=class{static getOptions(t,e){const n=new Date,i=[{group:Un.dateGroup,formatString:"yyyy-MM-dd"},{group:Un.dateGroup,formatString:"MM-dd-yyyy"},{group:Un.timeGroup,formatString:"HH:mm:ss"},{group:Un.timeGroup,formatString:"HH:mm:ss.SSS"},{group:Un.timeGroup,formatString:"HH:mm:ss.SSSSSSSSS"},{group:Un.dateTimeGroup,formatString:"yyyy-MM-dd HH:mm:ss"},{group:Un.dateTimeGroup,formatString:"yyyy-MM-dd HH:mm:ss.SSS"},{group:Un.dateTimeGroup,formatString:"yyyy-MM-dd HH:mm:ss.SSSSSSSSS"}].map(r=>{const l=lt.makeFormat("",r.formatString,lt.TYPE_CONTEXT_PRESET),a=t.getFormattedString(n,P.dataType.DATETIME,"",l);return dn.makeOption(a,l,r.group,lt.isSameFormat(l,e))});return[dn.makeOption("Default",null,Un.dateGroup,dn.isDefaultSelected(e)),...i]}};let Nl=Un;Nl.dateGroup=10;Nl.timeGroup=20;Nl.dateTimeGroup=30;const rs=class{static getOptions(t,e){const n=[{format:Ue.FORMAT_PERCENT,group:rs.presetGroup},{format:Ue.FORMAT_BASIS_POINTS,group:rs.presetGroup},{format:Ue.FORMAT_MILLIONS,group:rs.presetGroup},{format:Ue.FORMAT_ROUND,group:rs.presetRoundGroup},{format:Ue.FORMAT_ROUND_TWO_DECIMALS,group:rs.presetRoundGroup},{format:Ue.FORMAT_ROUND_FOUR_DECIMALS,group:rs.presetRoundGroup}],s=dn.makeOption("Default",null,rs.defaultGroup,dn.isDefaultSelected(t)),i=n.map(a=>dn.makeOption(a.format.label,a.format,a.group,Ue.isSameFormat(a.format,t))),o=dn.isCustomSelected(t),r=o?t:Ue.makeCustomFormat(),l=dn.makeCustomFormatOption(r,rs.customGroup,Ue.DEFAULT_FORMAT_STRING,o,a=>{if(a!=null){const d=Ue.makeCustomFormat(a);Ue.isValid(d)&&e(d)}else e(null)});return[s,...i,l]}};let Go=rs;Go.defaultGroup=10;Go.presetGroup=20;Go.presetRoundGroup=30;Go.customGroup=40;const _r=class{static getOptions(t,e){const n=[{format:dt.FORMAT_MILLIONS,group:_r.presetGroup}],s=dn.makeOption("Default",null,_r.defaultGroup,dn.isDefaultSelected(t)),i=n.map(a=>dn.makeOption(a.format.label,a.format,a.group,dt.isSameFormat(a.format,t))),o=dn.isCustomSelected(t),r=o?t:dt.makeCustomFormat(),l=dn.makeCustomFormatOption(r,_r.customGroup,dt.DEFAULT_FORMAT_STRING,o,a=>{if(a!=null){const d=dt.makeCustomFormat(a);dt.isValid(d)&&e(d)}else e(null)});return[s,...i,l]}};let Fl=_r;Fl.defaultGroup=10;Fl.presetGroup=20;Fl.customGroup=30;const mh=X.module("IrisGridContextMenuHandler"),Pv=150,ph="yyyy-MM-dd HH:mm:ss.SSSSSSSSS",Z=class extends Et{constructor(t){super(),this.debouncedUpdateCustomFormat=Xe(t.handleFormatSelection,Pv),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=Z.getFilterValueForNumberOrChar(t.type,e);return n.eq(s)}static getFilterValueForNumberOrChar(t,e){return P.isCharType(t)?M.FilterValue.ofString(String.fromCharCode(e)):M.FilterValue.ofNumber(e)}componentWillUnmount(){this.debouncedUpdateCustomFormat.flush()}getHeaderActions(t,e){var N;const{irisGrid:n}=this,{column:s}=e;A(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();A(a);const{filterIconColor:g,filterBarActiveColor:f,contextMenuSortIconColor:b,contextMenuReverseIconColor:C}=p,w=i.sort,T=P.getSortForColumn(w,t),E=d!==P.REVERSE_TYPE.NONE,{userColumnWidths:y}=a,I=[...y.values()].some(x=>x===0),D=i.isColumnFrozen(s);return l.push({title:"Hide Column",group:Z.GROUP_HIDE_COLUMNS,action:()=>{this.irisGrid.hideColumnByVisibleIndex(s)}}),l.push({title:D?"Unfreeze Column":"Freeze Column",group:Z.GROUP_HIDE_COLUMNS,action:()=>{D?this.irisGrid.unFreezeColumnByColumnName(r.name):this.irisGrid.freezeColumnByColumnName(r.name)},order:10}),l.push({title:"Show All Columns",group:Z.GROUP_HIDE_COLUMNS,action:()=>{this.irisGrid.showAllColumns()},disabled:!I}),l.push({title:"Quick Filters",icon:Jn,iconColor:f,shortcut:an.TABLE.TOGGLE_QUICK_FILTER,group:Z.GROUP_FILTER,order:10,action:()=>{this.irisGrid.toggleFilterBar(s)}}),l.push({title:"Advanced Filters",icon:u.get(t)?id:Ur,iconColor:g,group:Z.GROUP_FILTER,order:20,action:()=>{this.irisGrid.handleAdvancedMenuOpened(s)}}),l.push({title:"Clear Table Filters",group:Z.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:Jn,iconColor:b,group:Z.GROUP_SORT,order:10,actions:this.sortByActions(r,t,T)}),l.push({title:"Add Additional Sort",disabled:T&&w.length===1||E&&w.length===1||T&&E&&w.length===2||w.length===0,group:Z.GROUP_SORT,order:20,actions:this.additionalSortActions(r,t)}),l.push({title:"Clear Table Sorting",disabled:w.length===0||E&&w.length===1,group:Z.GROUP_SORT,action:()=>{this.irisGrid.sortColumn(s,Z.COLUMN_SORT_DIRECTION.none)},order:30}),l.push({title:d===P.REVERSE_TYPE.NONE?"Reverse Table":"Clear Reverse Table",icon:Jn,iconColor:C,group:Z.GROUP_SORT,order:40,disabled:!i.isReversible,shortcut:an.TABLE.REVERSE,action:()=>{d===P.REVERSE_TYPE.NONE?this.irisGrid.reverse(P.REVERSE_TYPE.POST_SORT):this.irisGrid.reverse(P.REVERSE_TYPE.NONE)}}),l.push({title:"Copy Column Name",group:Z.GROUP_COPY,action:()=>{var x;Ne.copyToClipboard((x=i.textForColumnHeader(t))!=null?x:"").catch(U=>mh.error("Unable to copy header",U))}}),P.isDateType(r.type)?l.push({title:"Date/Time Format",group:Z.GROUP_FORMAT,actions:this.dateFormatActions(r)}):P.isNumberType(r.type)&&l.push({title:"Number Format",group:Z.GROUP_FORMAT,actions:(N=this.numberFormatActions(r))!=null?N:void 0}),l}getCellActions(t,e,n){A(t);const{irisGrid:s}=this,{column:i,row:o}=n,{model:r,canCopy:l}=s.props,{columns:a}=r,d=s.getModelRow(o);A(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,w=new lt({timeZone:C==null?void 0:C.timeZone,showTimeZone:!1,showTSeparator:!0,defaultDateTimeFormatString:ph}),T=new lt({timeZone:C==null?void 0:C.timeZone,showTimeZone:C==null?void 0:C.showTimeZone,showTSeparator:C==null?void 0:C.showTSeparator,defaultDateTimeFormatString:ph});if(m==null||o==null)return p;if(r.isFilterable(t)){const y={title:"Filter By Value",icon:Jn,iconColor:b,group:Z.GROUP_FILTER,order:10,actions:[]};if(c==null)g.get(t)&&y.actions.push({title:"And",actions:this.nullFilterActions(m,g.get(t),"&&"),order:2,group:ie.groups.high}),y.actions.push(...this.nullFilterActions(m));else if(P.isBooleanType(m.type))g.get(t)&&y.actions.push({title:"Or",actions:this.booleanFilterActions(m,u,g.get(t),"||"),order:2,group:ie.groups.high}),y.actions.push(...this.booleanFilterActions(m,u));else if(P.isNumberType(m.type)||P.isCharType(m.type)){A(t);const I=P.isCharType(m.type)?String.fromCharCode(c):`${c}`;g.get(t)&&y.actions.push({title:"And",actions:this.numberFilterActions(m,I,c,g.get(t),"&&"),order:2,group:ie.groups.high}),y.actions.push(...this.numberFilterActions(m,I,c,g.get(t)))}else if(P.isDateType(m.type)){const I=w.format(c),D=T.format(c);g.get(t)&&y.actions.push({title:"And",actions:this.dateFilterActions(m,I,D,c,g.get(t),"&&"),order:2,group:ie.groups.high}),y.actions.push(...this.dateFilterActions(m,I,D,c,g.get(t)))}else g.get(t)&&y.actions.push({title:"And",actions:this.stringFilterActions(m,u,c,g.get(t),"&&"),order:2,group:ie.groups.high}),y.actions.push(...this.stringFilterActions(m,u,c));y.actions!=null&&y.actions.length>0&&p.push(y)}const E={title:"Go to",iconColor:b,shortcut:an.TABLE.GOTO_ROW,group:Z.GROUP_GOTO,order:10,action:()=>this.irisGrid.toggleGotoRow(`${o+1}`)};return p.push(E),l&&(p.push({title:"Copy Cell",group:Z.GROUP_COPY,order:10,action:()=>{s.copyCell(i,o)}}),p.push({title:"Copy Cell Unformatted",group:Z.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;A(p);const{columnHeaderHeight:w,gridY:T,columnHeaderMaxDepth:E}=p,y=[];if(a!=null&&d!=null){const I=c.valueForCell(a,d),D=c.textForCell(a,d),N=m[a],{onContextMenu:x}=s.props;N!=null&&y.push(x({model:c,value:I,valueText:D,column:N,rowIndex:r,columnIndex:o,modelRow:d,modelColumn:a}))}return a!=null&&c.isFilterable(a)&&y.push({title:"Clear Column Filter",group:Z.GROUP_FILTER,order:30,action:()=>{this.irisGrid.removeColumnFilter(a)},disabled:!(f.has(a)||b.has(a))}),(g?i<=T:i<=w*E&&l===0)?a!=null&&y.push(...this.getHeaderActions(a,t)):(a!=null&&d!=null&&y.push(...this.getCellActions(a,e,t)),u&&C.length>0&&(y.push({title:"Copy Selection",shortcut:ks.COPY,group:Z.GROUP_COPY,order:30,action:()=>{s.copyRanges(C)}}),y.push({title:"Copy Selection w/ Headers",group:Z.GROUP_COPY,order:40,action:()=>{s.copyRanges(C,!0)}})),Ze(c)&&c.isEditable&&C.length>0&&y.push({title:"Delete Selected Rows",group:Z.GROUP_EDIT,order:50,action:()=>{this.irisGrid.deleteRanges(C)}})),y.length===0?!1:(A(s.gridWrapper),ie.triggerMenu(s.gridWrapper,n.pageX,n.pageY,y),!0)}dateFormatActions(t){const{model:e}=this.irisGrid.props,{formatter:n}=e,s=n.getColumnFormat(t.type,t.name),i=Nl.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?li:void 0,group:d,order:r,action:()=>{const m=e.getColumnIndexByName(t.name);A(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(P.isDecimalType(t.type))i=Go.getOptions(s,l=>{A(o),this.debouncedUpdateCustomFormat(o,l)});else if(P.isIntegerType(t.type))i=Fl.getOptions(s,l=>{A(o),this.debouncedUpdateCustomFormat(o,l)});else return mh.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?li:void 0,order:l,action:()=>{o===void 0&&a&&a.type===Je.TYPE_CONTEXT_CUSTOM||(A(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 A(u),d.push({menuElement:v("div",{className:"iris-grid-filter-menu-item-value",children:[i?Z.getOperatorAsText(i):""," ",'"',e,'"']}),order:1,group:ie.groups.high}),d.push({title:"text is exactly",description:`Show only rows where ${t.name} is ${n} (case sensitive)`,action:()=>{this.irisGrid.setQuickFilter(u,Z.getQuickFilterCondition(l,t.filter().eq(o),i),Z.getQuickFilterText(a,`=${e}`,i))},order:10,group:ie.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,Z.getQuickFilterCondition(l,t.filter().notEq(o),i),Z.getQuickFilterText(a,`!=${e}`,i))},order:20,group:ie.groups.low}),d.push({title:"text contains",description:`Show only rows where ${t.name} contains ${e}`,action:()=>{this.irisGrid.setQuickFilter(u,Z.getQuickFilterCondition(l,t.filter().contains(o),i),Z.getQuickFilterText(a,`~${e}`,i))},order:30,group:ie.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,Z.getQuickFilterCondition(l,t.filter().contains(o).not(),i),Z.getQuickFilterText(a,`!~${e}`,i))},order:40,group:ie.groups.low}),d.push({title:"text starts with",description:`Show only rows where ${t.name} starts with ${e}`,action:()=>{this.irisGrid.setQuickFilter(u,Z.getQuickFilterCondition(l,t.filter().invoke("startsWith",o),i),Z.getQuickFilterText(a,`${e}*`,i))},order:50,group:ie.groups.low}),d.push({title:"text ends with",description:`Show only rows where ${t.name} ends with ${e}`,action:()=>{this.irisGrid.setQuickFilter(u,Z.getQuickFilterCondition(l,t.filter().invoke("endsWith",o),i),Z.getQuickFilterText(a,`*${e}`,i))},order:60,group:ie.groups.low}),d}numberFilterActions(t,e,n,s,i){const o=Z.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 A(u),a.push({menuElement:v("div",{className:"iris-grid-filter-menu-item-value",children:[i?Z.getOperatorAsText(i):""," ",'"',e,'"']}),order:1,group:ie.groups.high}),a.push({title:"is equal to",description:`Show only rows where ${t.name} is ${e}`,action:()=>{const m=Z.getNumberValueEqualsFilter(t,n);this.irisGrid.setQuickFilter(u,Z.getQuickFilterCondition(r,m,i),Z.getQuickFilterText(l,`=${e}`,i))},order:10,group:ie.groups.low}),a.push({title:"is not equal to",description:`Show only rows where ${t.name} is not ${e}`,action:()=>{const m=Z.getNumberValueEqualsFilter(t,n).not();this.irisGrid.setQuickFilter(u,Z.getQuickFilterCondition(r,m,i),Z.getQuickFilterText(l,`!=${e}`,i))},order:20,group:ie.groups.low}),d&&!P.isCharType(t.type)&&(a.push({title:"greater than",description:`Show only rows where ${t.name} is greater than ${e}`,action:()=>{this.irisGrid.setQuickFilter(u,Z.getQuickFilterCondition(r,t.filter().greaterThan(o),i),Z.getQuickFilterText(l,`>${e}`,i))},order:30,group:ie.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,Z.getQuickFilterCondition(r,t.filter().greaterThanOrEqualTo(o),i),Z.getQuickFilterText(l,`>=${e}`,i))},order:40,group:ie.groups.low}),a.push({title:"less than",description:`Show only rows where ${t.name} is less than ${e}`,action:()=>{this.irisGrid.setQuickFilter(u,Z.getQuickFilterCondition(r,t.filter().lessThan(o),i),Z.getQuickFilterText(l,`<${e}`,i))},order:50,group:ie.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,Z.getQuickFilterCondition(r,t.filter().lessThanOrEqualTo(o),i),Z.getQuickFilterText(l,`<=${e}`,i))},order:60,group:ie.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 A(a),i.push({menuElement:v("div",{className:"iris-grid-filter-menu-item-value",children:[s?Z.getOperatorAsText(s):""," ",'"',e!=null?e:"null",'"']}),order:1,group:ie.groups.high}),i.push({title:"true",description:`Show only rows where ${t.name} is true`,action:()=>{this.irisGrid.setQuickFilter(a,Z.getQuickFilterCondition(r,t.filter().isTrue(),s),Z.getQuickFilterText(l,"true",s))},order:10,group:ie.groups.low}),i.push({title:"false",description:`Show only rows where ${t.name} is false`,action:()=>{this.irisGrid.setQuickFilter(a,Z.getQuickFilterCondition(r,t.filter().isFalse(),s),Z.getQuickFilterText(l,"false",s))},order:20,group:ie.groups.low}),i.push({title:"is null",description:`Show only rows where ${t.name} is null`,action:()=>{this.irisGrid.setQuickFilter(a,Z.getQuickFilterCondition(r,t.filter().isNull(),s),Z.getQuickFilterText(l,"null",s))},order:30,group:ie.groups.low}),i.push({title:"is not null",description:`Show only rows where ${t.name} is not null`,action:()=>{this.irisGrid.setQuickFilter(a,Z.getQuickFilterCondition(r,t.filter().isNull().not(),s),Z.getQuickFilterText(l,"!null",s))},order:40,group:ie.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);A(c);const u=[];return u.push({menuElement:v("div",{className:"iris-grid-filter-menu-item-value",children:[o?Z.getOperatorAsText(o):""," ",'"',n,'"']}),order:1,group:ie.groups.high}),u.push({title:"date is",description:`Show only rows where ${t.name} is ${n}`,action:()=>{this.irisGrid.setQuickFilter(c,Z.getQuickFilterCondition(l,t.filter().eq(r),o),Z.getQuickFilterText(a,`=${e}`,o))},order:10,group:ie.groups.low}),u.push({title:"date is not",description:`Show only rows where ${t.name} is not ${n}`,action:()=>{this.irisGrid.setQuickFilter(c,Z.getQuickFilterCondition(l,t.filter().notEq(r),o),Z.getQuickFilterText(a,`!=${e}`,o))},order:20,group:ie.groups.low}),u.push({title:"date is before",description:`Show only rows where ${t.name} is before ${n}`,action:()=>{this.irisGrid.setQuickFilter(c,Z.getQuickFilterCondition(l,t.filter().lessThan(r),o),Z.getQuickFilterText(a,`<${e}`,o))},order:30,group:ie.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,Z.getQuickFilterCondition(l,t.filter().lessThanOrEqualTo(r),o),Z.getQuickFilterText(a,`<=${e}`,o))},order:40,group:ie.groups.low}),u.push({title:"date is after",description:`Show only rows where ${t.name} is greater than ${n}`,action:()=>{this.irisGrid.setQuickFilter(c,Z.getQuickFilterCondition(l,t.filter().greaterThan(r),o),Z.getQuickFilterText(a,`>${e}`,o))},order:50,group:ie.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,Z.getQuickFilterCondition(l,t.filter().greaterThanOrEqualTo(r),o),Z.getQuickFilterText(a,`>=${e}`,o))},order:60,group:ie.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 A(l),o.push({menuElement:v("div",{className:"iris-grid-filter-menu-item-value",children:[n?Z.getOperatorAsText(n):""," ",'"null"']}),order:1,group:ie.groups.high}),o.push({title:"is null",description:`Show only rows where ${t.name} is null`,action:()=>{this.irisGrid.setQuickFilter(l,Z.getQuickFilterCondition(s,t.filter().isNull(),n),Z.getQuickFilterText(i,"null",n))},order:10,group:ie.groups.low}),o.push({title:"is not null",description:`Show only rows where ${t.name} is not null`,action:()=>{this.irisGrid.setQuickFilter(l,Z.getQuickFilterCondition(s,t.filter().isNull().not(),n),Z.getQuickFilterText(i,"!null",n))},order:20,group:ie.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,Z.COLUMN_SORT_DIRECTION.ascending)},icon:this.checkColumnSort(n,Z.COLUMN_SORT_DIRECTION.ascending)?Jn:void 0,iconColor:i},{title:`${t.name} Descending`,order:20,action:()=>{this.irisGrid.sortColumn(e,Z.COLUMN_SORT_DIRECTION.descending)},icon:this.checkColumnSort(n,Z.COLUMN_SORT_DIRECTION.descending)?Jn:void 0,iconColor:i},{title:"Remove Sort",order:50,action:()=>{this.irisGrid.sortColumn(e,Z.COLUMN_SORT_DIRECTION.none,!1,!0)},disabled:!n}];return P.isNumberType(t.type)&&(o.push({title:`ABS(${t.name}) Ascending`,order:30,action:()=>{this.irisGrid.sortColumn(e,Z.COLUMN_SORT_DIRECTION.ascending,!0)},icon:this.checkColumnSort(n,Z.COLUMN_SORT_DIRECTION.ascending,!0)?Jn:void 0,iconColor:i}),o.push({title:`ABS(${t.name}) Descending`,order:40,action:()=>{this.irisGrid.sortColumn(e,Z.COLUMN_SORT_DIRECTION.descending,!0)},icon:this.checkColumnSort(n,Z.COLUMN_SORT_DIRECTION.descending,!0)?Jn:void 0,iconColor:i})),o}additionalSortActions(t,e){const n=this.irisGrid.getTheme(),{contextMenuSortIconColor:s}=n,i=[{title:"Add Sort By",menuElement:v("div",{className:"btn-context-menu menu-title",children:[h("span",{className:"icon",children:h(q,{icon:Jn,style:{color:s!=null?s:void 0}})}),h("span",{className:"title",children:"Add Additional Sort"}),h("span",{className:"shortcut",children:Ne.isMacPlatform()?"\u2318Click":"^Click"})]}),order:1},{title:`${t.name} Ascending`,order:10,action:()=>{this.irisGrid.sortColumn(e,Z.COLUMN_SORT_DIRECTION.ascending,!1,!0)}},{title:`${t.name} Descending`,order:20,action:()=>{this.irisGrid.sortColumn(e,Z.COLUMN_SORT_DIRECTION.descending,!1,!0)}}];return P.isNumberType(t.type)&&(i.push({title:`ABS(${t.name}) Ascending`,order:30,action:()=>{this.irisGrid.sortColumn(e,Z.COLUMN_SORT_DIRECTION.ascending,!0,!0)}}),i.push({title:`ABS(${t.name}) Descending`,order:40,action:()=>{this.irisGrid.sortColumn(e,Z.COLUMN_SORT_DIRECTION.descending,!0,!0)}})),i}checkColumnSort(t,e=null,n=!1){return t?t.direction===e&&t.isAbs===n:!1}};let fs=Z;fs.GROUP_EDIT=ie.groups.high+10;fs.GROUP_HIDE_COLUMNS=ie.groups.high+25;fs.GROUP_FILTER=ie.groups.high+50;fs.GROUP_GOTO=ie.groups.high+51;fs.GROUP_SORT=ie.groups.high+75;fs.GROUP_COPY=ie.groups.high+100;fs.GROUP_FORMAT=ie.groups.high+150;fs.COLUMN_SORT_DIRECTION={ascending:"ASC",descending:"DESC",none:null};class Hv extends Et{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 Vv extends Et{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 Uv extends Et{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=Ne.isModifierKeyDown(s);return this.irisGrid.toggleSort(i,o),!0}return!1}}class Bv extends Et{constructor(e){super(),this.irisGrid=e}onWheel(e,n,s){const{irisGrid:i}=this,{model:o}=i.props,{metrics:r,pendingRowCount:l}=i.state;A(r);const{bottom:a,rowCount:d,rowHeight:c}=r,{deltaY:u}=G.getScrollDelta(s);return Ze(o)&&o.isEditable&&a>=d-1&&u>0&&i.setState({pendingRowCount:l+Math.ceil(u/c)}),!1}}const $v=3e3,Wv=({children:t=null,onEntering:e,onEntered:n,onExiting:s,onExited:i})=>{const[o,r]=S.exports.useState(!1),l=S.exports.useRef(),a=hl(t),d=S.exports.useCallback(()=>{r(!0),l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{r(!1)},$v)},[r,l]);return S.exports.useEffect(()=>{a!==t&&t!=null&&d()},[t,a,r,d]),S.exports.useEffect(()=>()=>l.current?clearTimeout(l.current):void 0,[]),h(Ml,{className:"toast-bottom-bar",isShown:o,onEntering:e,onEntered:n,onExiting:s,onExited:i,children:t})};class zv extends Wo{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!==P.REVERSE_TYPE.NONE&&l!=null&&l.length>0&&(n+=i.reverseHeaderBarHeight),n}getUserColumnWidths(){return this.userColumnWidths}}const Gv=1,Qm=Y.memo(({model:t,modelColumns:e,top:n,bottom:s,left:i,right:o,filter:r,formatter:l,reverseType:a=P.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:w=new Map,frozenColumns:T,formatColumns:E})=>{const y=S.exports.useMemo(()=>se.getModelViewportColumns(e,i,o,u,m,p,Gv),[e,i,o,u,m,p]);return S.exports.useEffect(function(){t.filter=r},[t,r]),S.exports.useEffect(function(){const D=[...d];a!==P.REVERSE_TYPE.NONE&&D.push(M.Table.reverse()),t.sort=D},[t,d,a]),S.exports.useEffect(function(){t.formatter=l},[t,l]),S.exports.useEffect(function(){t.isCustomColumnsAvailable&&(t.customColumns=c)},[t,c]),S.exports.useEffect(function(){t.isFormatColumnsAvailable&&(t.formatColumns=E)},[t,E]),S.exports.useEffect(function(){t.setViewport(n,s,y)},[t,n,s,y]),S.exports.useEffect(function(){t.isRollupAvailable&&(t.rollupConfig=g)},[t,t.isRollupAvailable,g]),S.exports.useEffect(function(){t.isSelectDistinctAvailable&&(t.selectDistinctColumns=b)},[t,b]),S.exports.useEffect(function(){t.isTotalsAvailable&&(t.totalsConfig=f)},[t,t.isTotalsAvailable,f]),S.exports.useEffect(function(){t.pendingRowCount=C},[t,C]),S.exports.useEffect(function(){t.pendingDataMap=w},[t,w]),S.exports.useEffect(function(){T&&t.updateFrozenColumns(T)},[t,T]),null});Qm.displayName="IrisGridModelUpdater";const Pn=Object.freeze({SORT_UP:"sortUp",SORT_DOWN:"sortDown",CARET_DOWN:"caretDown",CARET_RIGHT:"caretRight",CELL_OVERFLOW:"cellOverflow"}),la=16;class Io extends $i{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(Pn.SORT_UP,qf),this.setIcon(Pn.SORT_DOWN,Kf),this.setIcon(Pn.CARET_DOWN,as),this.setIcon(Pn.CARET_RIGHT,ru),this.setIcon(Pn.CELL_OVERFLOW,pf)}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:la/n.icon[0],d:la/n.icon[1]};o.addPath(i,r),this.icons[e]=o}getIcon(e){return this.icons[e]}getSortIcon(e){return e?e.direction===P.sortDirection.ascending?this.getIcon(Pn.SORT_UP):e.direction===P.sortDirection.descending?this.getIcon(Pn.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(P.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,visibleColumnWidths:d,visibleColumnXs: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,{visibleRowYs: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{visibleColumnWidths:r,visibleColumnXs:l,maxY:a}=i,d=l.get(o),c=r.get(o);A(d),A(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.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!==P.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!==P.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 H;super.drawColumnHeaderAtIndex(e,n,s,i);const{metrics:o,model:r,theme:l}=n,{modelColumns:a,visibleColumnWidths:d,visibleColumnXs: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 w=P.getSortForColumn(r.sort,C);if(!w)return;const T=this.getSortIcon(w);if(!T)return;const E=r.textForColumnHeader(C);if(E===void 0)return;const y=(H=p.get(e.font))!=null?H:$i.DEFAULT_FONT_WIDTH;A(y);const I=E.length*y,D=u+b+I+g;let{maxX:N}=i;N-=g;const x=u+b+f-g-1,U=D>N?D+1:Math.min(N,x),$=w.direction===P.sortDirection.ascending?-6:-12,L=m*.5+$;e.save(),e.beginPath(),e.rect(b,0,f,m),e.clip(),e.fillStyle=l.headerSortBarColor,e.translate(U,L),e.fill(T),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,visibleColumnWidths:g,visibleColumnXs: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 w=0;w<p.length;w+=1){const T=p[w],E=B(m,T),y=B(f,T),I=B(g,T);if(i.isFilterable(E)&&I>0){const D=d+(y!=null?y:0);e.rect(D+.5,C+.5,I,a-2)}}e.stroke();for(let w=0;w<p.length;w+=1){const T=p[w],E=B(g,T),I=B(f,T)+d;this.drawExpandedFilterHeader(e,n,T,I,E)}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,w=c.get(s);if(w===void 0)return;const T=a.get(w),E=d.get(w);if(T==null&&E==null)return;let y=null;if(T!=null){const{text:D}=T;if(y=D,y||(y=P.getFilterText(T.filter)),y!=null){const{fontWidths:N}=r;let x=N.get(e.font);(x==null||x===0)&&(x=e.measureText("8").width,x||(x=10));const U=(o-f*2)/x;U<=0?y="":y.length>U&&(y=`${y.substring(0,U-1)}\u2026`)}}if(e.save(),Io.isFilterValid(E,T)&&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 D=i+2,N=C+2,x=o-3,U=m-5;e.strokeRect(D,N,x,U)}if(y!=null&&y!==""){const D=i+f,N=C+m*.5+1;e.fillStyle=b,e.fillText(y,D,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,visibleColumnWidths:u,visibleColumnXs: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 w=C+l;this.drawCollapsedFilterHeader(e,n,f,w,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:w}=l;e.save();const T=Io.isFilterValid(g,p);C!=null&&p==null&&g==null?e.fillStyle=C:b!=null&&T?e.fillStyle=b:w!=null&&(e.fillStyle=w);const E=i+1,y=u-f,I=o-1,D=f-1;e.fillRect(E,y,I,D),e.restore()}drawTreeMarker(e,n,s,i,o,r,l){e.save();const{x1:a,y1:d}=o,c=l?this.getIcon(Pn.CARET_DOWN):this.getIcon(Pn.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:w,visibleRowHeights:T,visibleRowYs:E,width:y}=s;if(f<=0||g.length===0)return;const{cellHorizontalPadding:I,floatingGridRowColor:D,floatingRowBackgroundColors:N,headerColor:x,rowHoverBackgroundColor:U}=l;e.translate(d,a),e.beginPath();const $=Math.min(c,y-f-w-d);e.fillStyle=N,m>0&&e.rect($,0,f,m),p>0&&e.rect($,b-a-C-p,f,p),e.fill();const L=o!=null&&r!=null&&o>=d&&o<=c+f?G.getRowAtY(r,s):null;if(U!=null&&L!==null&&g.includes(L)){e.fillStyle=U;const O=E.get(L),F=T.get(L);A(O),A(F),e.fillRect($,O,f,F)}if(e.beginPath(),D!=null&&(e.strokeStyle=D),m>0&&(e.moveTo($+.5,.5),e.lineTo($+.5,m-.5)),p>0){const O=b-a-C-p;e.moveTo($-.5,O+.5),e.lineTo($-.5,O+p-.5)}e.stroke(),e.fillStyle=x,e.textAlign="left";const H=$+I;for(let O=0;O<g.length;O+=1){const F=g[O],_=T.get(F),k=E.get(F),V=u.get(F);if(k!=null&&_!=null&&V!=null){const z=k+_*.5;e.fillText(i.textForRowFooter(V),H,z)}}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}=G.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}=G.getCellInfoFromXY(s,i,o);if(a==null||d==null||c==null||u==null||!P.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:Io.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}=G.getCellInfoFromXY(e,n,s);A(a),A(l),A(d);const{width:c,verticalBarWidth:u}=s,{cellHorizontalPadding:m}=i,p=la+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(Pn.CELL_OVERFLOW);r!=null&&l!=null&&n.translate(r+c,l+2),n.fill(p),n.restore()}}const Kv="12px Fira Sans, sans-serif",qv="#f0f0ee",Yv="#1a171a",ae={"grid-bg":"#211f22",font:Kv,white:qv,black:Yv,"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":"#5b5a5c","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"},Zm=Object.freeze({backgroundColor:ae["grid-bg"],white:ae.white,black:ae.black,font:ae.font,headerBackgroundColor:ae["header-bg"],headerColor:ae["header-color"],headerSeparatorColor:ae["header-separator-color"],headerSeparatorHoverColor:ae["header-separator-hover-color"],headerHiddenSeparatorHoverColor:ae["header-hidden-separator-hover-color"],headerSortBarColor:ae["header-sort-bar-color"],headerReverseBarColor:ae["header-reverse-bar-color"],headerBarCasingColor:ae["header-bar-casing-color"],headerFont:ae["header-font"],rowBackgroundColors:ae["row-background-colors"],rowHoverBackgroundColor:ae["row-hover-bg"],selectionColor:ae["selection-color"],selectionOutlineColor:ae["selection-outline-color"],selectionOutlineCasingColor:ae["selection-outline-casing-color"],selectedRowHoverBackgroundColor:ae["selected-row-hover-bg"],scrollBarBackgroundColor:ae["scroll-bar-bg"],scrollBarHoverBackgroundColor:ae["scroll-bar-hover-bg"],scrollBarCasingColor:ae["scroll-bar-casing-color"],scrollBarCornerColor:ae["scroll-bar-corner-color"],scrollBarColor:ae["scroll-bar-color"],scrollBarHoverColor:ae["scroll-bar-hover-color"],scrollBarActiveColor:ae["scroll-bar-active-color"],scrollBarSelectionTickColor:ae["selected-row-hover-bg"],scrollBarActiveSelectionTickColor:ae["scroll-bar-active-selection-tick-color"],textColor:ae["text-color"],positiveNumberColor:ae["positive-number-color"],negativeNumberColor:ae["negative-number-color"],zeroNumberColor:ae["zero-number-color"],dateColor:ae["date-color"],pendingTextColor:ae["pending-text-color"],errorTextColor:ae["error-text-color"],nullStringColor:ae["null-string-color"],filterBarActiveBackgroundColor:ae["filter-bar-active-bg"],filterBarExpandedBackgroundColor:ae["filter-bar-expanded-bg"],filterBarExpandedActiveBackgroundColor:ae["filter-bar-expanded-active-bg"],filterBarExpandedActiveCellBackgroundColor:ae["filter-bar-expanded-active-cell-bg"],filterBarSeparatorColor:ae["filter-bar-separator-color"],filterBarActiveColor:ae["filter-bar-active-color"],filterBarErrorColor:ae["filter-bar-error-color"],filterIconColor:ae["filter-icon-color"],scrimColor:ae["scrim-color"],contextMenuSortIconColor:ae["context-menu-sort-icon-color"],contextMenuReverseIconColor:ae["context-menu-reverse-icon-color"],allowRowResize:!1,autoSelectRow:!0,gridColumnColor:null,gridRowColor:null,groupedColumnDividerColor:ae["grouped-column-divider-color"],columnHoverBackgroundColor:null,headerHorizontalPadding:12,scrollBarSize:13,scrollBarHoverSize:16,minScrollHandleSize:24,rowHeight:parseInt(ae["row-height"],10)||19,columnWidth:100,rowHeaderWidth:0,rowFooterWidth:60,columnHeaderHeight:parseInt(ae["header-height"],10)||30,filterBarHeight:30,filterBarCollapsedHeight:5,sortHeaderBarHeight:2,reverseHeaderBarHeight:4,filterBarHorizontalPadding:4,scrimBlurSize:25,minScrimTransitionTime:150,maxScrimTransitionTime:350,scrollSnapToRow:!0,linkerColumnHoverBackgroundColor:ae["linker-column-hover-bg"],treeLineColor:ae["tree-line-color"],treeMarkerColor:ae["tree-marker-color"],treeMarkerHoverColor:ae["tree-marker-hover-color"],floatingGridColumnColor:null,floatingGridRowColor:ae["floating-grid-row-color"],floatingRowBackgroundColors:ae["floating-row-background-colors"],floatingDividerInnerColor:ae["floating-divider-inner-color"],floatingDividerOuterColor:ae["floating-divider-outer-color"],overflowButtonColor:ae["overflow-button-color"],overflowButtonHoverColor:ae["overflow-button-hover-color"]});const vr=X.module("ColumnStatistics"),Xv={SIZE:"Number of Rows"},Oa=class extends S.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.handleCopyHeader=this.handleCopyHeader.bind(this),this.cancelablePromise=null,this.state={error:null,loading:!1,statistics:null,numRows:0,copied:!1}}static getStatsLabel(t){var e;return(e=Xv[t])!=null?e:t.split(" ").map(n=>n[0].toUpperCase()+n.substr(1).toLowerCase()).join(" ")}componentDidMount(){this.maybeGenerateStatistics()}componentWillUnmount(){this.cancelablePromise&&this.cancelablePromise.cancel()}handleCopyHeader(){this.setState({copied:!0})}maybeGenerateStatistics(){const{model:t}=this.props,e=t.rowCount;this.setState({numRows:e}),t.isColumnStatisticsAvailable?e<Oa.AUTO_GENERATE_LIMIT&&this.handleGenerateStatistics():this.setState({loading:!1})}handleGenerateStatistics(){this.setState({loading:!0});const{column:t,model:e}=this.props;this.cancelablePromise=Ee.makeCancelable(e.columnStatistics(t)),this.cancelablePromise.then(this.handleStatistics).catch(this.handleError)}handleStatistics(t){vr.debug("Received statistics",t);const{model:e,onStatistics:n}=this.props,s=[];t.statisticsMap.forEach((i,o)=>{s.push({operation:Oa.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}),n()}handleError(t){if(t!=null&&Ee.isCanceled(t)){vr.debug("Called handleError on a cancelled promise result");return}vr.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,copied:r}=this.state,l=!s&&n==null&&i==null&&e.isColumnStatisticsAvailable,a=[],d=t.type.substring(t.type.lastIndexOf(".")+1),c=t.description===null?null:t.description;if(i!=null)for(let g=0;g<i.length;g+=1){const{operation:f,className:b,value:C,type:w}=i[g],T=w?e.displayString(C,w):e.displayString(C,t.type,t.name),E=v(Y.Fragment,{children:[h("div",{className:W("column-statistic-operation",b),children:f}),h("div",{className:"column-statistic-value",children:T})]},f);a.push(E)}const u=gt(e)&&e.hasExpandableRows?"Expanded Rows":"Number of Rows",m=e.displayString(o,"long"),p=e.getColumnIndexByName(t.name);return v("div",{className:"column-statistics",children:[v("div",{className:"column-statistics-title",children:[t.name,v("span",{className:"column-statistics-type",children:["\xA0(",d,")"]}),h(Q,{kind:"ghost",className:"column-statistics-copy",icon:r?nd:ed,onClick:()=>{Ne.copyToClipboard(t.name).then(this.handleCopyHeader).catch(g=>vr.error("Unable to column name",g))},tooltip:r?"Copied text":"Copy column name"})]}),c!=null&&h("div",{className:"column-statistics-description",children:c}),p!=null&&!e.isColumnMovable(p)&&v("div",{className:"column-statistics-status",children:[h(q,{icon:e.isColumnFrozen(p)?Af:ff,className:"mr-1"}),e.isColumnFrozen(p)?"Frozen":"Not movable"]}),v("div",{className:"column-statistics-grid",children:[i==null&&v(he,{children:[h("div",{className:"column-statistic-operation",children:u}),h("div",{className:"column-statistic-value",children:m})]}),a]}),l&&h("button",{type:"button",className:"btn btn-link px-0",onClick:this.handleGenerateStatistics,children:"Generate Stats"}),n!=null&&h("div",{className:"error-message",children:`${n}`}),i&&!s&&v("button",{type:"button",className:"btn btn-link px-0",onClick:this.handleGenerateStatistics,children:[h(q,{icon:od,className:"mr-1"}),"Refresh"]}),s&&v("div",{className:"column-statistics-loading",children:[h(_n,{className:"mr-2"}),"Calculating Stats..."]})]})}};let Jm=Oa;Jm.AUTO_GENERATE_LIMIT=1e5;class Tr extends S.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=Y.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=>P.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=v(he,{children:[h(q,{icon:Ec,mask:Jl,transform:"shrink-2 down-5 right-7"}),h(q,{icon:Nf,className:"text-primary",transform:"shrink-4 down-5 right-7"})]}):l?a=v(he,{children:[h(q,{icon:Fo,mask:Jl,transform:"shrink-1 down-5 right-7"}),h(q,{icon:yc,className:"text-danger",transform:"shrink-4 down-5 right-7"})]}):a=v(he,{children:[h(q,{icon:Ec,mask:Jl,transform:"shrink-2 down-5 right-7"}),h(q,{icon:Wf,className:"text-primary",transform:"shrink-4 down-5 right-7"})]}),v("div",{className:"cross-column-container",children:[h(gs,{className:"cross-column-search",placeholder:"Search Data...",value:e,onChange:this.handleSearchValueChange,ref:this.searchField}),v("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(Ie,{children:"Configure Columns"}),h(Fn,{isShown:o,className:"cross-column-popper",onExited:()=>{this.setState({isConfigureColumnsShown:!1})},closeOnBlur:!0,interactive:!0,children:v("div",{className:"cross-column-popup",children:["Searched Columns",h("div",{className:"cross-column-scroll",children:i.map(d=>v(Y.Fragment,{children:[h(Pt,{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))}),v("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&&v("p",{className:"text-danger",children:[h(q,{icon:yc})," Select at least one column to search."]})]})})]})]})}}const ys=X.module("PartitionSelectorSearch"),jv=150,ep=class extends S.exports.Component{constructor(t){super(t),this.debounceUpdateFilter=Xe(()=>{this.updateFilter()},jv),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 ai||ys.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(){ys.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){ys.debug2("handleSelect",t);const{onSelect:e}=this.props,{offset:n,items:s}=this.state,i=t-n;if(i<0||s.length<=i){ys.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;ys.debug2("handleTableUpdate",l,n,s.length),this.setState({itemCount:l,items:s,offset:n,isLoading:!1})}handleTextChange(t){ys.debug2("handleTextChange");const{value:e}=t.target;this.setState({text:e}),this.debounceUpdateFilter()}handleViewportChange(t,e){ys.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)}ys.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,ep.MAX_VISIBLE_ITEMS)*bn.DEFAULT_ROW_HEIGHT+11;return v("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(bn,{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&&v("div",{className:"iris-grid-partition-selector-loading",children:[h(_n,{}),"\xA0Loading..."]})]})}};let xl=ep;xl.MAX_VISIBLE_ITEMS=12;xl.defaultProps={initialPageSize:100,onSelect:()=>{},onListResized:()=>{}};xl.propTypes={getFormattedString:R.exports.func.isRequired,table:R.exports.shape({addEventListener:R.exports.func.isRequired,removeEventListener:R.exports.func.isRequired,columns:R.exports.arrayOf(R.exports.shape({name:R.exports.string.isRequired,type:R.exports.string.isRequired,filter:R.exports.func.isRequired})),size:R.exports.number.isRequired,applyFilter:R.exports.func.isRequired,setViewport:R.exports.func.isRequired}).isRequired,initialPageSize:R.exports.number,onSelect:R.exports.func,onListResized:R.exports.func};const Ei=X.module("IrisGridPartitionSelector"),Qv=250;class tp extends S.exports.Component{constructor(e){super(e),this.debounceUpdate=Xe(()=>{this.sendUpdate()},Qv),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(){Ei.debug2("handleAppendClick");const{onAppend:e}=this.props,{partition:n}=this.state;e(n)}handleCloseClick(){Ei.debug2("handleCloseClick"),this.sendDone()}handleIgnoreClick(){Ei.debug2("handleIgnoreClick"),this.sendFetchAll()}handlePartitionChange(e){Ei.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(){Ei.debug2("sendUpdate");const{onChange:e}=this.props,{partition:n}=this.state;e(n)}sendFetchAll(){Ei.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(xl,{getFormattedString:n,table:i,onSelect:this.handlePartitionSelect,onListResized:this.handlePartitionListResized,ref:l=>{this.selectorSearch=l}},"search");return v("div",{className:"iris-grid-partition-selector",children:[h("div",{className:"status-message",children:v("span",{children:['Filtering "',e,'" partition to']})}),v("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:v("button",{type:"button",className:"btn btn-outline-primary",children:[h(q,{icon:as}),h(Ie,{children:"Partitions"}),h(Wn,{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(q,{icon:Ho})})]})}}tp.defaultProps={onAppend:()=>{},onChange:()=>{},onFetchAll:()=>{},onDone:()=>{},partition:""};const Zv=X.module("SelectDistinctBuilder");class np extends S.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!=="");ct(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){Zv.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 v("div",{className:"form-inline px-3 pb-3",children:[v("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!=="")&&v("button",{type:"button",className:"btn btn-link btn-link-icon ml-1 px-2",onClick:()=>{this.handleDeleteColumn(i)},children:[h(Ie,{children:"Delete column"}),h(q,{icon:xn,transform:"grow-3"})]})]},i)})}render(){const{columns:e,inputs:n}=this.state,s=n.length>=e.length;return v("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:v("button",{type:"button",className:"btn btn-link btn-add-column",onClick:this.handleAddColumnClick,disabled:s,children:[h(q,{icon:Ls}),"Add Additional Column"]})}),h("div",{className:"select-distinct-builder-footer",children:v("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."]})})]})}}np.defaultProps={selectDistinctColumns:[],onChange:()=>{}};const Pd=({items:t,onChange:e=()=>{}})=>h(Du,{items:Array.from(t.entries()).map(([n,s])=>({title:Pd.getAdvancedSettingsTitleForKey(n),isOn:s,onChange:i=>e(n,i)}))});Pd.getAdvancedSettingsTitleForKey=t=>{switch(t){case mi.FILTER_CONTROL_CHANGE_CLEARS_ALL_FILTERS:return"Control filters clear existing table filters";case mi.LINK_CHANGE_CLEARS_ALL_FILTERS:return"Inbound links clear existing table filters"}};const gh=X.module("ConditionalFormattingMenu"),aa=()=>{};function Jv(t){const{column:{type:e}}=t;if(P.isNumberType(e))return t.condition===Ye.IS_NULL||t.condition===Ye.IS_NOT_NULL?"":`${t.value}`;if(P.isCharType(e))return t.condition===Ot.IS_NULL||t.condition===Ot.IS_NOT_NULL?"":`${t.value}`;if(P.isStringType(e))return t.condition===sn.IS_NULL||t.condition===sn.IS_NOT_NULL?"":`"${t.value}"`;if(P.isDateType(e))return t.condition===Ot.IS_NULL||t.condition===Ot.IS_NOT_NULL?"":`${t.value}`;if(P.isBooleanType(e))return"";throw new Error(`Invalid column type ${e} in getRuleValue`)}function eT(t){return P.isNumberType(t.column.type)&&t.condition===Ye.IS_BETWEEN?`${t.start} < ${t.column.name} < ${t.end}`:`${t.column.name} ${Ev(t.column.type,t.condition)}
|
|
34
|
+
${Jv(t)}`}const tT=t=>{const{rules:e=[],onChange:n=aa,onCreate:s=aa,onSelect:i=aa}=t,o=S.exports.useCallback((d,c,u)=>{d.stopPropagation(),gh.debug("Rule clicked",c,u),i(u)},[i]),r=S.exports.useCallback((d,c,u)=>{d.stopPropagation(),gh.debug("Delete button clicked",c,u);const m=[...e];m.splice(u,1),n(m)},[n,e]),l=S.exports.useCallback(d=>{d.stopPropagation()},[]),a=S.exports.useCallback(d=>{if(Gt.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 v("div",{className:"conditional-formatting-rules",children:[h(Lo,{onDragStart:Gt.startDragging,onDragEnd:a,children:h(ko,{droppableId:"droppable-custom-columns",children:(d,c)=>v("div",{ref:d.innerRef,...d.droppableProps,className:W("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(ol,{draggableId:`${m}-${u.type}`,index:m,disableInteractiveElementBlocking:!0,children:(p,g)=>h("div",{role:"menuitem",tabIndex:0,onClick:f=>o(f,u,m),className:W("draggable-container",{dragging:g.isDragging}),ref:p.innerRef,...p.draggableProps,children:h("div",{className:"conditional-formatting-list-item",children:v("div",{className:"formatting-item",children:[h("div",{className:"rule-icon",children:h("span",{className:"rule-icon-bg",style:{backgroundColor:jr(u.config.style),color:Qr(u.config.style)},children:u.type===Kn.ROWS?"row":"col"})}),h("div",{className:"rule-title",children:eT(u.config)}),v("button",{type:"button",className:"btn btn-link btn-link-icon ml-1 px-2",onClick:f=>r(f,u,m),children:[h(Ie,{children:"Delete rule"}),h(q,{icon:xn})]}),v("button",{type:"button",className:"btn btn-link btn-link-icon px-2 btn-drag-handle",onClick:l,...p.dragHandleProps,children:[h(Ie,{children:"Drag to re-order"}),h(q,{icon:al})]})]})})})},`${m}-${u.type}`)),d.placeholder]})})}),h("hr",{}),h(Q,{kind:"ghost",onClick:s,icon:Ls,children:"Add New Rule"})]})},yi=X.module("ConditionEditor"),nT=()=>{},sT=[Ye.IS_EQUAL,Ye.IS_NOT_EQUAL,Ye.IS_BETWEEN,Ye.GREATER_THAN,Ye.GREATER_THAN_OR_EQUAL,Ye.LESS_THAN,Ye.LESS_THAN_OR_EQUAL,Ye.IS_NULL,Ye.IS_NOT_NULL].map(t=>h("option",{value:t,children:lv(t)},t)),iT=[sn.IS_EXACTLY,sn.IS_NOT_EXACTLY,sn.CONTAINS,sn.DOES_NOT_CONTAIN,sn.STARTS_WITH,sn.ENDS_WITH,sn.IS_NULL,sn.IS_NOT_NULL].map(t=>h("option",{value:t,children:av(t)},t)),oT=[Ot.IS_EXACTLY,Ot.IS_NOT_EXACTLY,Ot.IS_BEFORE,Ot.IS_BEFORE_OR_EQUAL,Ot.IS_AFTER,Ot.IS_AFTER_OR_EQUAL,Ot.IS_NULL,Ot.IS_NOT_NULL].map(t=>h("option",{value:t,children:dv(t)},t)),rT=[To.IS_TRUE,To.IS_FALSE,To.IS_NULL,To.IS_NOT_NULL].map(t=>h("option",{value:t,children:cv(t)},t)),lT=[ii.IS_EQUAL,ii.IS_NOT_EQUAL,ii.IS_NULL,ii.IS_NOT_NULL].map(t=>h("option",{value:t,children:hv(t)},t));function aT(t,e,n,s){return t===Ye.IS_NULL||t===Ye.IS_NOT_NULL||t===Ye.IS_BETWEEN&&n!=null&&n!==""&&!Number.isNaN(Number.parseFloat(n))&&s!=null&&s!==""&&!Number.isNaN(Number.parseFloat(s))||t!==Ye.IS_BETWEEN&&e!==void 0&&e!==""&&!Number.isNaN(Number.parseFloat(e))}function dT(t,e,n,s,i,o,r){switch(t){case Ye.IS_EQUAL:case Ye.IS_NOT_EQUAL:case Ye.GREATER_THAN:case Ye.GREATER_THAN_OR_EQUAL:case Ye.LESS_THAN:case Ye.LESS_THAN_OR_EQUAL:return h("input",{type:"number",className:"form-control",placeholder:"Enter value",value:i!=null?i:"",onChange:e});case Ye.IS_BETWEEN:return v("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 Ye.IS_NULL:case Ye.IS_NOT_NULL:return null}}function cT(t,e,n){switch(t){case sn.IS_NULL:case sn.IS_NOT_NULL:return null;default:return h("input",{type:"text",className:"form-control",placeholder:"Enter value",value:n!=null?n:"",onChange:e})}}function hT(t,e,n){switch(t){case Ot.IS_NULL:case Ot.IS_NOT_NULL:return null;default:return h("input",{type:"text",className:"form-control",placeholder:"Enter value",value:n!=null?n:"",onChange:e})}}function uT(){return null}function mT(t,e,n){switch(t){case ii.IS_NULL:case ii.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})}}const sp=t=>{const{column:e,config:n,onChange:s=nT}=t,i=e.type,[o,r]=S.exports.useState(i),[l,a]=S.exports.useState(n.condition),[d,c]=S.exports.useState(n.value),[u,m]=S.exports.useState(n.start),[p,g]=S.exports.useState(n.end);i!==o&&(a(Gm(i)),c(void 0),m(void 0),g(void 0),r(i));const f=S.exports.useMemo(()=>{if(i===void 0)return[];if(P.isNumberType(i))return sT;if(P.isCharType(i))return lT;if(P.isStringType(i))return iT;if(P.isDateType(i))return oT;if(P.isBooleanType(i))return rT},[i]),b=S.exports.useCallback(y=>{const{value:I}=y.target;yi.debug("handleConditionChange",I),a(I)},[]),C=S.exports.useCallback(y=>{const{value:I}=y.target;yi.debug("handleValueChange",I),c(I)},[]),w=S.exports.useCallback(y=>{const{value:I}=y.target;yi.debug("handleStartValueChange",I),m(I)},[]),T=S.exports.useCallback(y=>{const{value:I}=y.target;yi.debug("handleEndValueChange",I),g(I)},[]);S.exports.useEffect(function(){let I=!0;l===void 0&&(yi.debug("Unable to create formatting rule. Condition is not selected."),I=!1),P.isNumberType(e.type)&&!aT(l,d,u,p)&&(yi.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 E=S.exports.useMemo(()=>{if(i===void 0)return null;if(P.isNumberType(i))return dT(l,C,w,T,d,u,p);if(P.isCharType(i))return mT(l,C,d);if(P.isStringType(i))return cT(l,C,d);if(P.isDateType(i))return hT(l,C,d);if(P.isBooleanType(i))return uT()},[i,l,d,u,p,C,w,T]);return v("div",{className:"condition-editor mb-2",children:[h("select",{value:l,id:"condition-select",className:"custom-select mb-2",onChange:b,children:f}),E]})};const pT=X.module("StyleEditor"),gT="#fcfcfa",fT="#f0f0ee",CT="#1a171a",bT=200,ST=()=>{},ip=t=>{var T,E;const{config:e,onChange:n=ST}=t,[s,i]=S.exports.useState(e.type),[o,r]=S.exports.useState((E=(T=e.customConfig)==null?void 0:T.background)!=null?E:gT),[l,a]=S.exports.useState(!1),[d,c]=S.exports.useState(bT),u=S.exports.useRef(null),m=S.exports.useCallback(y=>{const{value:I}=y.target;pT.debug("handleBackgroundChange",I),r(I)},[]),p=S.exports.useCallback(()=>{l&&a(!1)},[l]),g=S.exports.useCallback(()=>{l||b(),a(!l)},[l]),f=S.exports.useMemo(()=>[Vn.NO_FORMATTING,Vn.POSITIVE,Vn.NEGATIVE,Vn.WARN,Vn.NEUTRAL,Vn.ACCENT_1,Vn.ACCENT_2,Vn.CUSTOM],[]);function b(){u.current&&c(u.current.getBoundingClientRect().width)}S.exports.useEffect(function(){n({type:s,customConfig:{color:cl.isDark(o)?fT:CT,background:o}})},[n,s,o]);const C=S.exports.useCallback(()=>{const y=[];for(let I=0;I<f.length;I+=1){const D=f[I],N=`option-${I}-${D}`;y.push(v(Q,{kind:"inline",className:"style-option-btn",onClick:()=>{i(D),a(!1)},style:{color:Qr({type:D}),background:jr({type:D})},children:[D===s&&h(q,{icon:li,className:"mr-2"}),D!==s&&h("span",{className:"mr-4"}),uh(D)]},N))}return y},[f,s]),w=S.exports.useCallback(()=>h("div",{className:"style-menu-container",role:"presentation",style:{width:d},children:h("div",{className:"style-options",children:C()})}),[d,C]);return v("div",{className:"style-editor",children:[v("div",{className:"mb-2",ref:u,children:[h("label",{className:"mb-0",children:"Style"}),v(Q,{kind:"inline",className:"cs-dropdown",style:{color:Qr({type:s}),background:jr({type:s})},onClick:g,children:[uh(s),h("span",{children:h(q,{icon:ad,className:"cs-caret"})}),h(Wn,{isShown:l,actions:{menuElement:w()},popperOptions:{placement:"bottom-start"},popperClassName:"style-dropdown-menu",onMenuClosed:p,menuStyle:{maxWidth:"100rem"}})]})]}),s===Vn.CUSTOM&&v("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})]})]})},ho=X.module("ColumnFormatEditor"),wT=()=>{};function vT(t){const{type:e,name:n}=t[0];return{column:{type:e,name:n},style:qm(),...Dl(e)}}const TT=t=>{var b;const{columns:e,config:n=vT(e),onChange:s=wT}=t,[i,o]=S.exports.useState((b=e.find(C=>C.name===n.column.name&&C.type===n.column.type))!=null?b:e[0]),[r,l]=S.exports.useState(Km(n)),[a,d]=S.exports.useState(!1),[c,u]=S.exports.useState(n.style),m=S.exports.useCallback(C=>{const w=e.find(({name:T})=>T===C);w!==void 0?(o(w),i.type!==w.type&&(l(Dl(w.type)),d(!1))):ho.error(`Column ${C} not found.`)},[e,i]),p=S.exports.useCallback((C,w)=>{ho.debug("handleConditionChange",C,w),l(C),d(w)},[]),g=S.exports.useCallback(C=>{ho.debug("handleStyleChange",C),u(C)},[]);S.exports.useEffect(function(){if(i===void 0){ho.debug("Column is not selected, skip update.");return}if(c===void 0){ho.debug("Style is not selected, skip update.");return}const{type:w,name:T}=i;s({column:{type:w,name:T},style:c,...r},a)},[s,i,c,r,a]);const f=e.map(({name:C})=>({title:C,value:C}));return v("div",{className:"conditional-rule-editor form",children:[v("div",{className:"mb-2",children:[h("label",{className:"mb-0",children:"Format Cell If"}),h(qi,{defaultValue:i==null?void 0:i.name,options:f,inputPlaceholder:"Select a column",spellCheck:!1,onChange:m,searchPlaceholder:"Filter columns"})]}),i!==void 0&&v(he,{children:[h(sp,{column:i,config:r,onChange:p}),h(ip,{config:c,onChange:g})]})]})},uo=X.module("RowFormatEditor"),ET=()=>{};function yT(t){const{type:e,name:n}=t[0];return{column:{type:e,name:n},style:qm(),...Dl(e)}}const IT=t=>{var b;const{columns:e,config:n=yT(e),onChange:s=ET}=t,[i,o]=S.exports.useState((b=e.find(C=>C.name===n.column.name&&C.type===n.column.type))!=null?b:e[0]),[r,l]=S.exports.useState(Km(n)),[a,d]=S.exports.useState(!1),[c,u]=S.exports.useState(n.style),m=S.exports.useCallback(C=>{const w=e.find(({name:T})=>T===C);w!==void 0?(o(w),i.type!==w.type&&(l(Dl(w.type)),d(!1))):uo.error(`Column ${C} not found.`)},[e,i]),p=S.exports.useCallback((C,w)=>{uo.debug("handleConditionChange",C,w),l(C),d(w)},[]),g=S.exports.useCallback(C=>{uo.debug("handleStyleChange",C),u(C)},[]);S.exports.useEffect(function(){if(i===void 0){uo.debug("Column is not selected, skip update.");return}if(c===void 0){uo.debug("Style is not selected, skip update.");return}const{type:w,name:T}=i;s({column:{type:w,name:T},style:c,...r},a)},[s,i,c,r,a]);const f=e.map(({name:C})=>({title:C,value:C}));return v("div",{className:"conditional-rule-editor form",children:[v("div",{className:"mb-2",children:[h("label",{className:"mb-0",children:"Format Row If"}),h(qi,{defaultValue:i==null?void 0:i.name,options:f,inputPlaceholder:"Select a column",spellCheck:!1,onChange:m,searchPlaceholder:"Filter columns"})]}),i!==void 0&&v(he,{children:[h(sp,{column:i,config:r,onChange:p}),h(ip,{config:c,onChange:g})]})]})};const da=X.module("ConditionalFormatEditor"),ca=()=>{};function RT(t){switch(t){case Kn.CONDITIONAL:return h(Ew,{});case Kn.ROWS:return h(yw,{})}}function DT(t){switch(t){case Kn.CONDITIONAL:return"Conditional";case Kn.ROWS:return"Rows"}}const fh=[Kn.CONDITIONAL,Kn.ROWS],MT=t=>{var C;const{columns:e,onSave:n=ca,onUpdate:s=ca,onCancel:i=ca,rule:o}=t,r=e.filter(Iv),[l,a]=S.exports.useState((C=o==null?void 0:o.type)!=null?C:fh[0]),[d,c]=S.exports.useState(o),[u,m]=S.exports.useState(!1),p=S.exports.useCallback(()=>{i()},[i]),g=S.exports.useCallback(()=>{if(d===void 0){da.error("Rule is not defined.");return}n(d)},[n,d]),f=S.exports.useCallback(w=>{da.debug("handleFormatterChange",w),a(w)},[]),b=S.exports.useCallback((w,T)=>{da.debug("handleRuleChange",w,T,l);const E={type:l,config:w};c(E),m(T),s(T?E:void 0)},[s,l]);return v("div",{className:"conditional-format-editor form",children:[v("div",{className:"mb-2",children:[h("label",{className:"mb-0",htmlFor:"formatter-select",children:"Select Formatter"}),h("div",{className:"formatter-list",children:fh.map((w,T)=>h("div",{className:"formatter-type",children:v("button",{type:"button",className:W("btn","btn-icon","btn-formatter-type",{active:w===l}),"data-index":T,onClick:()=>f(w),children:[RT(w),DT(w)]})},w))})]}),l===Kn.CONDITIONAL&&h(TT,{columns:r,config:d==null?void 0:d.config,onChange:b}),l===Kn.ROWS&&h(IT,{columns:r,config:d==null?void 0:d.config,onChange:b}),h("hr",{}),v("div",{className:"d-flex justify-content-end my-3",children:[h(Q,{kind:"secondary",onClick:p,className:"mr-2",children:"Cancel"}),h(Q,{kind:"primary",onClick:g,disabled:d===void 0||!u,children:"Done"})]})]})};function NT({text:t,isOpen:e,onClose:n}){const[s,i]=S.exports.useState(!1),[o,r]=S.exports.useState(0),[l,a]=S.exports.useState(!1),[d,c]=S.exports.useState(!1),[u,m]=S.exports.useState(!1),p=S.exports.useRef(),g=S.exports.useRef(null),[f,b]=S.exports.useState(!1);S.exports.useEffect(function(){if(!!e){try{JSON.parse(t),m(!0)}catch{m(!1)}c(!1)}},[e,t]),S.exports.useEffect(function(){p.current&&p.current.layout()},[o]),S.exports.useEffect(function(){p.current&&p.current.updateOptions({lineNumbers:l?"on":"off"})},[l]),S.exports.useEffect(()=>(g.current&&clearTimeout(g.current),g.current=setTimeout(()=>{b(!1)},1e3),()=>{g.current&&clearTimeout(g.current)}),[f]);function C(){var D,N;Ne.copyToClipboard((N=(D=p.current)==null?void 0:D.getValue())!=null?N:t).then(()=>{b(!0)})}function w(){a(!l)}function T(){var N;const D=(N=p.current)==null?void 0:N.getModel();!u||!D||(d?(D.setValue(t),c(!1)):(D.setValue(JSON.stringify(JSON.parse(t),void 0,2)),c(!0)),E())}function E(){var N,x;const D=p.current;!D||a(((x=(N=D.getModel())==null?void 0:N.getLineCount())!=null?x:0)>1)}function y(){s&&(p.current=void 0,n())}function I(D){p.current=D,D.onDidContentSizeChange(({contentHeight:N})=>r(N)),E()}return!e&&!s?null:v(Oo,{isOpen:e,centered:!0,keyboard:!0,toggle:y,onOpened:()=>i(!0),onClosed:()=>{i(!1),r(0)},className:"theme-bg-dark cell-overflow-modal",children:[v(Po,{toggle:n,children:[h("h5",{className:"overflow-modal-title",children:"Cell Contents"}),h(Q,{kind:"inline",icon:f?nd:ed,tooltip:f?"Copied contents":"Copy contents",onClick:C}),h(Q,{kind:"inline",active:l,icon:gf,tooltip:"Toggle line numbers",onClick:w}),u&&h(Q,{kind:"inline",icon:uf,active:d,tooltip:"Format as JSON",onClick:T})]}),h(Ao,{style:{height:o},children:h(bl,{onEditorInitialized:I,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"}}})})]})}const FT="###,##0",xT=({gotoRow:t,gotoRowError:e,onSubmit:n,isShown:s,onEntering:i,onEntered:o,onExiting:r,onExited:l,model:a,onGotoRowNumberChanged:d,onClose:c})=>{const u=S.exports.useRef(null),m="Row number",{rowCount:p}=a;return S.exports.useEffect(()=>{var g;document.activeElement!==u.current&&((g=u.current)==null||g.select())},[t]),h(Ml,{isShown:s,className:W("goto-row"),onEntering:i,onEntered:()=>{var g;o(),(g=u.current)==null||g.select()},onExiting:r,onExited:l,children:v(he,{children:[v("div",{className:"goto-row-wrapper",children:[h("div",{className:"goto-row-text",children:"Go to row"}),h("div",{className:"goto-row-input",children:h("input",{ref:u,type:"number",onKeyDown:g=>{g.key==="Enter"&&(g.stopPropagation(),g.preventDefault(),n())},className:W("form-control",{"is-invalid":e!==""}),placeholder:m,onChange:g=>{d(g)},value:t})}),v("div",{className:"goto-row-text",children:["of ",dh.i18n.NumberFormat.format(FT,p)]}),e&&h("div",{className:"goto-row-error text-danger",children:e})]}),h("div",{className:"goto-row-close",children:h(Q,{kind:"ghost",onClick:c,children:h(q,{icon:Ho,style:{marginRight:"0"}})})})]})})},Ce=X.module("IrisGrid"),_T=500,kT=250,LT=250,op=Object.freeze({aggregations:[],showOnTop:!1});function Ch({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===P.REVERSE_TYPE.NONE&&o==null&&r==null&&l.length===0&&a.length===0}const Js=class extends S.exports.Component{constructor(t){super(t),this.getAdvancedMenuOpenedHandler=Te(F=>this.handleAdvancedMenuOpened.bind(this,F),{max:100}),this.getCachedAdvancedFilterMenuActions=Te((F,_,k,V,z)=>h(Ad,{model:F,column:_,onFilterChange:this.handleAdvancedFilterChange,onSortChange:this.handleAdvancedFilterSortChange,onDone:this.handleAdvancedFilterDone,options:k,sortDirection:V,formatter:z}),{max:50}),this.getCachedOptionItems=Te((F,_,k,V,z,j,ee,ve,le,Se,Oe,J,me,fe,xe)=>{const _e=[];return F&&_e.push({type:ke.CHART_BUILDER,title:"Chart Builder",icon:Hf}),_e.push({type:ke.VISIBILITY_ORDERING_BUILDER,title:"Column Visibility & Ordering",icon:Ta}),k&&_e.push({type:ke.CONDITIONAL_FORMATTING,title:"Conditional Formatting",icon:ll}),_&&_e.push({type:ke.CUSTOM_COLUMN_BUILDER,title:"Manage Custom Columns",icon:Ef}),V&&_e.push({type:ke.ROLLUP_ROWS,title:"Rollup Rows",icon:lu}),z&&_e.push({type:ke.AGGREGATIONS,title:"Aggregate Columns",icon:yf}),j&&_e.push({type:ke.SELECT_DISTINCT,title:"Select Distinct Values",icon:Tf}),ee&&me&&_e.push({type:ke.TABLE_EXPORTER,title:"Download CSV",icon:of}),_e.push({type:ke.ADVANCED_SETTINGS,title:"Advanced Settings",icon:If}),_e.push({type:ke.QUICK_FILTERS,title:"Quick Filters",subtitle:ve.shortcut.getDisplayText(),icon:Ur,isOn:Oe,onChange:ve.action}),fe&&_e.push({type:ke.SEARCH_BAR,title:"Search Bar",subtitle:le.shortcut.getDisplayText(),icon:ou,isOn:J,onChange:le.action}),_e.push({type:ke.GOTO,title:"Go to",subtitle:Se.shortcut.getDisplayText(),icon:vf,isOn:xe,onChange:Se.action}),_e},{max:1}),this.getCachedHiddenColumns=Te(F=>F,{max:1,normalizer:([F])=>F.join()}),this.getAggregationMap=Te((F,_)=>{const k={};return _.forEach(({operation:V,selected:z,invert:j})=>{k[V]=_s.getOperationColumnNames(F,V,z,j)}),k}),this.getOperationMap=Te((F,_)=>{const k={};return _.filter(V=>!_s.isRollupOperation(V.operation)).forEach(({operation:V,selected:z,invert:j})=>{_s.getOperationColumnNames(F,V,z,j).forEach(ee=>{var le;const ve=[...(le=k[ee])!=null?le:[],V];k[ee]=ve})}),k}),this.getOperationOrder=Te(F=>F.map(_=>_.operation).filter(_=>!_s.isRollupOperation(_))),this.getCachedFormatColumns=Te((F,_)=>yv(F,_)),this.getCachedModelColumns=Te((F,_)=>F.columns),this.getCachedPreviewFormatColumns=Te((F,_,k,V)=>{if(Ce.debug("getCachedPreviewFormatColumns",_,k,V),k!==void 0&&V!==void 0){const z=[..._];return z[V]=k,this.getCachedFormatColumns(F,z)}return this.getCachedFormatColumns(F,_)}),this.getModelRollupConfig=Te((F,_,k)=>se.getModelRollupConfig(F,_,k)),this.getModelTotalsConfig=Te((F,_,k)=>{var ve,le,Se;const{aggregations:V,showOnTop:z}=k;if(((le=(ve=_==null?void 0:_.columns)==null?void 0:ve.length)!=null?le:0)>0||((Se=V==null?void 0:V.length)!=null?Se:0)===0)return null;const j=this.getOperationMap(F,V),ee=this.getOperationOrder(V);return{operationMap:j,operationOrder:ee,showOnTop:z}}),this.getCachedStateOverride=Te((F,_,k,V,z,j,ee,ve,le,Se)=>({hoverSelectColumn:F,isFilterBarShown:_,isSelectingColumn:k,loadingScrimProgress:V,quickFilters:z,advancedFilters:j,sorts:ee,reverseType:ve,rollupConfig:le,isMenuShown:Se}),{max:1}),this.getCachedFilter=Te((F,_,k,V,z)=>[...F!=null?F:[],...V!=null?V:[],...se.getFiltersFromFilterMap(_),...se.getFiltersFromFilterMap(k),...z!=null?z:[]],{max:1}),this.getCachedTheme=Te((F,_)=>({...Zm,...F,autoSelectRow:!_}),{max:1}),this.getAlwaysFetchColumns=Te((F,_,k,V,z,j)=>{const ee=[];for(let le=0;le<V;le+=1)ee.push(_[G.getModelIndex(le,k)].name);for(let le=0;le<z;le+=1)ee.push(_[G.getModelIndex(_.length-1-le,k)].name);if(j)for(let le=j[0];le<=j[1];le+=1)ee.push(_[G.getModelIndex(le,k)].name);return[...new Set([...F,...ee])]}),this.updateSearchFilter=Xe((F,_,k,V)=>{const z=Tr.createSearchFilter(F,_,k,V);this.setState({searchFilter:z})},kT),this.handleConditionalFormatEditorUpdate=Xe(F=>{this.setState({conditionalFormatPreview:F})},LT),this.handleDownloadProgressUpdate=ui((F,_)=>{const{tableDownloadStatus:k}=this.state;k===on.DOWNLOAD_STATUS.DOWNLOADING&&this.setState({tableDownloadProgress:F,tableDownloadEstimatedTime:_})},_T),this.getOverflowButtonTooltip=Te(F=>{if(F==null)return null;const _={position:"absolute",...F,pointerEvents:"none"};return h("div",{style:_,children:h(Ie,{options:{placement:"left",modifiers:{flip:{behavior:["left","right"]}}},ref:this.handleTooltipRef,children:"View full contents"},Date.now())})}),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.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.grid=null,this.gridWrapper=null,this.lastLoadedConfig=null,this.pending=new ps,this.globalColumnFormats=[],this.decimalFormatOptions={},this.integerFormatOptions={},this.truncateNumbersWithPound=!1,this.renderer=new Io,this.tableSaver=null,this.crossColumnRef=Y.createRef(),this.isAnimating=!1,this.filterInputRef=Y.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:F}=this.props;Ze(F)&&F.isEditable&&F.pendingDataMap.size>0&&this.discardPending().catch(Ce.error)},shortcut:an.INPUT_TABLE.DISCARD},this.commitAction={action:()=>{const{model:F}=this.props;Ze(F)&&F.isEditable&&F.pendingDataMap.size>0&&F.pendingDataErrors.size===0&&this.commitPending().catch(Ce.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:w,quickFilters:T,selectDistinctColumns:E,pendingDataMap:y,canCopy:I,frozenColumns:D}=t,N=[new _v(this),new kv(this)];I&&N.push(new Nv(this));const x=[new Lv(this),new Ov(this),new Av(this),new Uv(this),new Vv(this),new fs(this),new Hv(this),new Bv(this)],U=l.length>0?l:r.movedColumns,$=a.length>0?a:r.movedRows,L=new zv({userColumnWidths:new Map(m),userRowHeights:new Map(p),movedColumns:U}),H=b!=null?b:[],O=Tr.createSearchFilter(f,H,r.columns,C);this.state={isFilterBarShown:i,isSelectingPartition:o,focusedFilterBarColumn:null,metricCalculator:L,metrics:void 0,keyHandlers:N,mouseHandlers:x,partition:d,partitionColumn:c,partitionTable:null,partitionFilters:[],quickFilters:T?new Map(T):new Map,advancedFilters:new Map(w),shownAdvancedFilter:null,hoverAdvancedFilter:null,sorts:[],reverseType:P.REVERSE_TYPE.NONE,customColumns:[],selectDistinctColumns:E,selectedRanges:[],copyOperation:null,loadingText:null,loadingScrimProgress:null,loadingSpinnerShown:!1,movedColumns:U,movedRows:$,shownColumnTooltip:null,formatter:new hn,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:O,searchValue:f,selectedSearchColumns:H,invertSearchColumns:C,rollupConfig:u,rollupSelectedColumns:[],aggregationSettings:e,selectedAggregation:null,openOptions:[],pendingRowCount:0,pendingDataMap:y!=null?y:new Map,pendingDataErrors:new Map,pendingSavePromise:null,pendingSaveError:null,toastMessage:null,frozenColumns:D,showOverflowModal:!1,overflowText:"",overflowButtonTooltipProps:null,isGotoRowShown:!1,gotoRow:"",gotoRowError:""}}static makeQuickFilter(t,e,n){try{return P.makeQuickFilter(t,e,n)}catch(s){Ce.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(mi.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?(Ce.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);return n&&i!=null&&o!=null?s.valueForCell(i,o):n?null:i!=null&&o!=null?s.textForCell(i,o):""}getModelColumn(t){const{metrics:e}=this.state;A(e);const{modelColumns:n}=e;return n==null?null:t!=null?n.get(t):null}getModelRow(t){const{metrics:e}=this.state;A(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=Ze(t)&&t.isEditable)!=null?n:!1)}getVisibleColumn(t){const{movedColumns:e}=this.state;return G.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):Ce.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 Ce.debug2("Ignoring change to existing filter"),!1}return n.set(t,{text:e,filter:Js.makeQuickFilter(o,e,i.timeZone)}),!0}return n.delete(t)}setAdvancedFilterMap(t){this.setState({advancedFilters:t})}setAdvancedFilter(t,e,n){Ce.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){Ce.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;Ce.debug("setFilterMap",t);const{advancedSettings:e}=this.props;((i=e.get(mi.LINK_CHANGE_CLEARS_ALL_FILTERS))!=null?i:!1)&&this.clearAllFilters();const{model:s}=this.props;t.forEach(({columnType:o,text:r,value:l},a)=>{const d=s.columns.find(u=>u.name===a&&u.type===o);if(d==null)return;const c=s.getColumnIndexByName(d.name);if(A(c),l===null)this.setQuickFilter(c,d.filter().isNull(),"=null");else{const u=P.isTextType(o)?M.FilterValue.ofString(l):M.FilterValue.ofNumber(l);this.setQuickFilter(c,d.filter().eq(u),`${r}`)}})}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}})}clearAllFilters(){Ce.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(){Ce.debug("Clearing cross-column search"),this.setState({searchValue:"",searchFilter:void 0})}clearGridInputField(){this.filterInputRef.current!=null&&this.filterInputRef.current.setValue("")}rebuildFilters(){Ce.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=P.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:Js.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=hs.getColumnFormats(t),s=hs.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=!ct(this.globalColumnFormats,n),a=!ct(this.dateTimeFormatterOptions,s),d=!ct(this.decimalFormatOptions,t==null?void 0:t.defaultDecimalFormatOptions),c=!ct(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 hn(i,this.dateTimeFormatterOptions,this.decimalFormatOptions,this.integerFormatOptions,this.truncateNumbersWithPound);Ce.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=Tr.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 Ce.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));Ne.copyToClipboard(i).catch(o=>Ce.error("Unable to copy cell",o))}else Ce.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:oe.boundedRanges(t,i.columnCount,i.rowCount),includeHeaders:e,formatValues:n,movedColumns:l,userColumnWidths:a,error:s};this.setState({copyOperation:d})}else Ce.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;A(o),A(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})},Js.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){Ce.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 Ce.debug("remove all sorts, filters, and custom columns"),this.setState({advancedFilters:new Map,aggregationSettings:op,customColumns:[],quickFilters:new Map,reverseType:P.REVERSE_TYPE.NONE,rollupConfig:void 0,selectDistinctColumns:[],sorts:[]})}canRollback(){return this.lastLoadedConfig!=null||!Ch(this.state)}startListening(t){t.addEventListener(be.EVENT.UPDATED,this.handleUpdate),t.addEventListener(be.EVENT.REQUEST_FAILED,this.handleRequestFailed),t.addEventListener(be.EVENT.COLUMNS_CHANGED,this.handleCustomColumnsChanged),t.addEventListener(be.EVENT.PENDING_DATA_UPDATED,this.handlePendingDataUpdated)}stopListening(t){t.removeEventListener(be.EVENT.UPDATED,this.handleUpdate),t.removeEventListener(be.EVENT.REQUEST_FAILED,this.handleRequestFailed),t.removeEventListener(be.EVENT.COLUMNS_CHANGED,this.handleCustomColumnsChanged),t.removeEventListener(be.EVENT.PENDING_DATA_UPDATED,this.handlePendingDataUpdated)}focus(){var t;(t=this.grid)==null||t.focus()}focusFilterBar(t){var c,u,m;const{model:e}=this.props,{columnCount:n}=e,s=this.getModelColumn(t);if(t==null||s==null||t<0||n<=t||!e.isFilterable(s)){this.setState({focusedFilterBarColumn:null});return}const{metricCalculator:i,metrics:o}=this.state;A(o);const{gridX:r,left:l,rightVisible:a,lastLeft:d}=o;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();A(p);const g=i.getLastLeft(p,t,r);(m=this.grid)==null||m.setViewState({left:Math.min(g,d)},!0)}this.lastFocusedFilterBarColumn=t,this.setState({focusedFilterBarColumn:t,isFilterBarShown:!0})}hideColumnByVisibleIndex(t){var s;const{metricCalculator:e,movedColumns:n}=this.state;e.setColumnWidth(G.getModelIndex(t,n),0),(s=this.grid)==null||s.forceUpdate()}freezeColumnByColumnName(t){const{frozenColumns:e,movedColumns:n}=this.state,{model:s}=this.props;Ce.debug2("freezing column",t);const i=e==null?new Set(s.frozenColumns):new Set(e);i.add(t);const o=s.getColumnIndexByName(t);A(o);const r=G.getVisibleIndex(o,n),l=G.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;Ce.debug2("unfreezing column",t);const i=e==null?new Set(s.frozenColumns):new Set(e);i.delete(t);const o=s.getColumnIndexByName(t);A(o);const r=G.getVisibleIndex(o,n),l=G.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===pi.VISIBILITY_OPTIONS.SHOW?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(){Ce.debug2("handleAnimationStart"),this.isAnimating=!0,this.animationFrame=requestAnimationFrame(this.handleAnimationLoop)}handleAnimationEnd(){Ce.debug2("handleAnimationEnd"),this.isAnimating=!1}handlePartitionAppend(t){const{onPartitionAppend:e}=this.props,{partitionColumn:n}=this.state;e(n,t)}handlePartitionChange(t){const{partitionColumn:e}=this.state;this.updatePartition(t,e)}handlePartitionFetchAll(){this.setState({partitionFilters:[],isSelectingPartition:!1})}handlePartitionDone(){this.setState({isSelectingPartition:!1})}handleTableLoadError(t){if(Ee.isCanceled(t))return;Ce.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){Ce.info("Toggling sort for column",t);const{model:n}=this.props,{sorts:s}=this.state,i=this.getModelColumn(t);A(i);const o=P.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=P.sortDirection.none,n=!1,s=!1){var r;A(t);const{model:i}=this.props,o=P.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&&P.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=""){const{isGotoRowShown:e}=this.state;if(t){this.setState({isGotoRowShown:!0,gotoRow:t,gotoRowError:""});return}this.setState({isGotoRowShown:!e,gotoRow:"",gotoRowError:""})}async commitPending(){var i,o;const{model:t}=this.props;if(!Ze(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 Oi("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=>{Ee.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}=n,i={};for(let r=0;r<s.length;r+=1){const l=s[r],{name:a,type:d}=l,c=n.valueForCell(r,e),u=n.textForCell(r,e);i[a]={value:c,text:u,type:d}}const{onDataSelected:o}=this.props;o(e,i)}handleAdvancedFilterChange(t,e,n){const{model:s}=this.props,i=s.getColumnIndexByName(t.name);A(i),this.setAdvancedFilter(i,e,n)}handleAdvancedFilterSortChange(t,e,n=!1){var a;const{model:s}=this.props,i=s.getColumnIndexByName(t.name);A(i);const o=P.getSortForColumn(s.sort,i);let r=null;(o==null||o.direction!==e)&&(e===P.sortDirection.descending?r=t.sort().desc():r=t.sort().asc());const l=P.setSortForColumn(s.sort,i,r,n);Ce.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({isGotoRowShown:!0})}handleGotoRowClosed(){this.setState({isGotoRowShown:!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){Ce.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);A(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;A(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=P.getNormalizedType(s.type);A(r);const l=hn.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(Ce.error("request failed:",e.detail),this.stopLoading(),this.canRollback())this.startLoading("Rolling back changes...",!0),this.rollback();else{Ce.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(),Ce.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};Ch(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(Ze(e)&&e.isEditable){A(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){A(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=()=>null){this.setState({movedColumns:t},e)}handleTooltipRef(t){t!=null&&t.startTimer(),this.tooltip=t}handleConditionalFormatsChange(t){Ce.debug("Updated conditional formats",t),this.setState({conditionalFormats:t})}handleConditionalFormatCreate(){Ce.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){Ce.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){Ce.debug("Save conditional format changes",t),this.setState(e=>{if(e.conditionalFormatEditIndex===null)return Ce.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){Ce.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=se.getRemovedCustomColumnNames(a,t);if(d.length>0){const c=se.removeSortsInColumns(s,d),u=se.removeFiltersInColumns(l,i,d),m=se.removeFiltersInColumns(l,o,d),p=se.removeColumnFromMovedColumns(l,n,d),g=se.removeColumnsFromSelectDistinctColumns(r,d);c.length!==s.length&&(Ce.debug("removing sorts from removed custom columns..."),this.setState({sorts:c})),(u.size!==i.size||m.size!==o.size)&&(Ce.debug("removing filters from removed custom columns..."),this.setState({quickFilters:u,advancedFilters:m})),ct(n,p)||(Ce.debug("change moved columns for removed custom columns",p),this.setState({movedColumns:p})),ct(r,g)||(Ce.debug("change selectDistinct columns for removed custom columns",p),this.setState({selectDistinctColumns:g}))}this.setState({customColumns:t}),this.startLoading("Applying custom columns...")}handleCustomColumnsChanged(){var e;Ce.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;Ce.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){Ce.debug("handleAggregationsChange",t),this.startLoading(`Aggregating ${t.aggregations.map(e=>e.operation).join(", ")}...`),this.setState({aggregationSettings:t})}handleAggregationChange(t){Ce.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){Ce.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;Ce.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:P.REVERSE_TYPE.NONE,selectDistinctColumns:[]})}handleSelectDistinctChanged(t){Ce.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:P.REVERSE_TYPE.NONE})}handleDownloadTableStart(){const{canDownloadCsv:t}=this.props;t?this.setState({isTableDownloading:!0,tableDownloadProgress:0,tableDownloadEstimatedTime:null,tableDownloadStatus:on.DOWNLOAD_STATUS.INITIATING}):Ce.error("Attempted to handleDownloadTableStart for user without download CSV permission.")}handleDownloadTable(t,e,n,s){const{canDownloadCsv:i}=this.props;i?(Ce.info("start table downloading",t,e,n,s),this.setState(()=>(this.tableSaver&&this.tableSaver.startDownload(t,e,n,s),{tableDownloadStatus:on.DOWNLOAD_STATUS.DOWNLOADING}))):Ce.error("Attempted to handleDownloadTable for user without download CSV permission.")}handleCancelDownloadTable(){var t;(t=this.tableSaver)==null||t.cancelDownload(),this.setState({isTableDownloading:!1})}handleDownloadCompleted(){this.setState({isTableDownloading:!1,tableDownloadProgress:100,tableDownloadStatus:on.DOWNLOAD_STATUS.FINISHED})}handleDownloadCanceled(){this.setState({isTableDownloading:!1,tableDownloadProgress:0,tableDownloadStatus:on.DOWNLOAD_STATUS.CANCELED})}deleteRanges(t){const{model:e}=this.props;this.pending.add(e.delete(t)).catch(n=>{Ee.isCanceled(n)||Ce.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;A(t),A(e);const n=(m=this.gridWrapper)==null?void 0:m.getBoundingClientRect(),s=20;A(n);const{columnHeaderHeight:i,visibleColumnXs:o,visibleColumnWidths:r,width:l,columnHeaderMaxDepth:a}=t,d=o.get(e),c=r.get(e);A(d),A(c);const u=n.left+At(d+c/2,s,l-s);return{top:n.top+(a-1)*i,left:n.left+At(d+c/2,s,l-s),bottom:n.top+a*i,right:n.left+At(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:""});return}const s=parseInt(t,10);s>n||s<-n?this.setState({gotoRowError:"Invalid row index"}):s===0?(this.setState({gotoRowError:""}),(i=this.grid)==null||i.setFocusRow(0)):s<0?(this.setState({gotoRowError:""}),(o=this.grid)==null||o.setFocusRow(s+n)):((r=this.grid)==null||r.setFocusRow(s-1),this.setState({gotoRowError:""}))}handleGotoRowSelectedRowNumberChanged(t){const e=t.target.value;this.focusRowInGrid(e)}getColumnTooltip(t,e,n){const{columnHeaderHeight:s,columnHeaderMaxDepth:i,visibleColumnXs:o,visibleColumnWidths: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(Ie,{timeout:400,interactive:!0,options:g,ref:this.handleTooltipRef,referenceObject:p,onExited:()=>{this.setState({shownColumnTooltip:null})},children:h(Jm,{model:n,column:b,onStatistics:()=>{var C;(C=this.tooltip)==null||C.update()}})},b.name)})}render(){var ut,Si,sc,ic,oc,rc,lc,ac,dc;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:w,isReady:T,copyOperation:E,focusedFilterBarColumn:y,loadingText:I,loadingScrimProgress:D,loadingSpinnerShown:N,keyHandlers:x,mouseHandlers:U,shownColumnTooltip:$,hoverAdvancedFilter:L,shownAdvancedFilter:H,hoverSelectColumn:O,quickFilters:F,advancedFilters:_,partition:k,partitionFilters:V,partitionTable:z,partitionColumn:j,searchFilter:ee,selectDistinctColumns:ve,movedColumns:le,movedRows:Se,formatter:Oe,conditionalFormats:J,conditionalFormatPreview:me,conditionalFormatEditIndex:fe,sorts:xe,reverseType:_e,customColumns:un,selectedRanges:Xn,isTableDownloading:wn,tableDownloadStatus:Ct,tableDownloadProgress:Re,tableDownloadEstimatedTime:nt,showSearchBar:st,searchValue:Nt,selectedSearchColumns:Yt,invertSearchColumns:Xt,aggregationSettings:Ft,selectedAggregation:jn,rollupConfig:Ht,openOptions:Vt,pendingSavePromise:kn,pendingSaveError:Vl,pendingRowCount:Ul,pendingDataErrors:Bl,pendingDataMap:Yo,toastMessage:Xo,frozenColumns:jo,showOverflowModal:Qo,overflowText:Zo,overflowButtonTooltipProps:Jo,isGotoRowShown:er,gotoRow:$l,gotoRowError:Wl}=this.state;if(!T)return null;const As=this.getTheme(),zl=this.getCachedFilter(e,F,_,V,ee),bi=g.getUserColumnWidths(),no=this.getCachedStateOverride(O,b,s,D,F,_,xe,_e,Ht,w),tr=f?f.top:0,nr=f?f.bottomViewport:0;let so=null,io=null;a&&(so=f?f.left:0,io=f?f.right:0);const Gl=f!=null&&f.width>0&&f.height>0,Kl=((Si=(ut=Ht==null?void 0:Ht.columns)==null?void 0:ut.length)!=null?Si:0)>0;let sr=null;const ql=f?Math.min(Math.max(Js.minDebounce,Math.round(f.rowCount/200)),Js.maxDebounce):Js.maxDebounce;if(b&&y!=null&&f!=null){const{gridX:je,gridY:jt,visibleColumnXs:Ln,visibleColumnWidths:Ps}=f,Hs=Ln.get(y),On=Ps.get(y);if(Hs!=null&&On!=null){const Qt=je+Hs,Ut=jt-((sc=As.filterBarHeight)!=null?sc:0),Qn=On+1,Vs=((ic=As.filterBarHeight)!=null?ic:0)-1,Us={top:Ut,left:Qt,minWidth:Qn,height:Vs};let wi="",Zn=!0;const Bs=this.getModelColumn(y);A(Bs);const $s=F.get(Bs),oo=_.get(Bs);$s!=null&&(wi=$s.text,Zn=$s.filter!=null);const Ws=F.size!==0||_.size!==0;sr=h(Ym,{ref:this.filterInputRef,style:Us,className:W({error:!Zn,active:wi!==""||oo!=null,"iris-grid-has-filter":Ws}),isAdvancedFilterSet:oo!=null,onAdvancedFiltersTriggered:()=>{this.setState({shownAdvancedFilter:y})},onChange:this.handleFilterBarChange,onDone:this.handleFilterBarDone,onTab:this.handleFilterBarTab,onContextMenu:(oc=this.grid)==null?void 0:oc.handleContextMenu,debounceMs:ql,value:wi},y)}}let ir=null;if(I!=null){const je=h("div",{className:"iris-grid-loading-status",children:I}),jt=h(SC,{show:N}),Ln=h("button",{type:"button",onClick:this.handleCancel,className:W("btn btn-secondary btn-cancelable iris-grid-btn-cancel",{show:N}),children:"Cancel"}),Ps=f?f.gridY:0;ir=v("div",{className:"iris-grid-loading",style:{top:Ps},children:[je,jt,Ln]})}let or=null;$!=null&&f&&(or=this.getColumnTooltip($,f,r),(rc=this.tooltip)==null||rc.update());const rr=[];if(f&&b){const{gridX:je,gridY:jt,visibleColumns:Ln,visibleColumnXs:Ps,visibleColumnWidths:Hs}=f,{filterBarHeight:On}=As;for(let Qt=0;Qt<Ln.length;Qt+=1){const Ut=Ln[Qt],Qn=Ps.get(Ut),Vs=Hs.get(Ut),Us=this.getModelColumn(Ut);if(Us!=null&&r.isFilterable(Us)&&Qn!=null&&Vs!=null&&Vs>0){const Zn=je+Qn+Vs-24,Bs=jt-(On!=null?On:0)+2,$s={position:"absolute",top:Bs,left:Zn},Ws=_.get(Us)!=null,dr=Ut===L||Ut===y||Ws,jl=h("div",{className:W("advanced-filter-button-container",{hidden:!dr}),style:$s,children:dr&&h("button",{type:"button",className:W("btn btn-link btn-link-icon advanced-filter-button",{"filter-set":Ws}),onClick:()=>{this.setState({shownAdvancedFilter:Ut})},onContextMenu:Vp=>{var cc;(cc=this.grid)==null||cc.handleContextMenu(Vp)},onMouseEnter:()=>{this.setState({hoverAdvancedFilter:Ut})},onMouseLeave:()=>{this.setState({hoverAdvancedFilter:null})},children:v("div",{className:"fa-layers",children:[h(q,{icon:id,className:"filter-solid"}),h(q,{icon:Ur,className:"filter-light"})]})})},Ut);rr.push(jl)}}}const lr=[];if(f){const{gridX:je,visibleColumns:jt,visibleColumnXs:Ln,visibleColumnWidths:Ps,columnHeaderHeight:Hs}=f;for(let On=0;On<jt.length;On+=1){const Qt=jt[On],Ut=Ln.get(Qt),Qn=Ps.get(Qt);if(Ut!=null&&Qn!=null&&Qn>0){const Vs=je+Ut,Us=je+Ut+Qn-20,wi=b?{position:"absolute",top:Hs,left:Us,width:20,height:As.filterBarHeight}:{position:"absolute",top:0,left:Vs,width:Qn,height:Hs},Zn=this.getModelColumn(Qt);if(Zn!=null){const Bs=r.columns[Zn],$s=_.get(Zn),{options:oo}=$s||{},Ws=P.getSortForColumn(r.sort,Zn),dr=Ws?Ws.direction:null,jl=h("div",{className:"advanced-filter-menu-container",style:wi,children:h(Fn,{className:"advanced-filter-menu-popper",onEntered:this.getAdvancedMenuOpenedHandler(Qt),onExited:()=>{this.handleAdvancedMenuClosed(Qt)},isShown:H===Qt,interactive:!0,closeOnBlur:!0,children:this.getCachedAdvancedFilterMenuActions(r,Bs,oo,dr,Oe)})},Qt);lr.push(jl)}}}}const ar=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,st,m,this.isTableSearchAvailable(),er),Yl=Vt.map(je=>{switch(je.type){case ke.CHART_BUILDER:return h(Pm,{model:r,onChange:this.handleChartChange,onSubmit:this.handleChartCreate},ke.CHART_BUILDER);case ke.VISIBILITY_ORDERING_BUILDER:return h(pi,{model:r,movedColumns:le,userColumnWidths:bi,onColumnVisibilityChanged:this.handleColumnVisibilityChanged,onMovedColumnsChanged:this.handleMovedColumnsChanged},ke.VISIBILITY_ORDERING_BUILDER);case ke.CONDITIONAL_FORMATTING:return h(tT,{rules:J,onChange:this.handleConditionalFormatsChange,onCreate:this.handleConditionalFormatCreate,onSelect:this.handleConditionalFormatEdit});case ke.CONDITIONAL_FORMATTING_EDIT:return A(r.columns),A(this.handleConditionalFormatEditorUpdate),h(MT,{columns:r.columns,rule:me,onUpdate:this.handleConditionalFormatEditorUpdate,onSave:this.handleConditionalFormatEditorSave,onCancel:this.handleConditionalFormatEditorCancel});case ke.CUSTOM_COLUMN_BUILDER:return h(_d,{model:r,customColumns:un,onSave:this.handleUpdateCustomColumns,onCancel:this.handleMenuBack},ke.CUSTOM_COLUMN_BUILDER);case ke.ROLLUP_ROWS:return h(kd,{model:r,onChange:this.handleRollupChange,config:Ht},ke.ROLLUP_ROWS);case ke.AGGREGATIONS:return h(gw,{settings:Ft,isRollup:Kl,onChange:this.handleAggregationsChange,onEdit:this.handleAggregationEdit});case ke.AGGREGATION_EDIT:return jn&&h(Cw,{aggregation:jn,columns:r.originalColumns,onChange:this.handleAggregationChange});case ke.TABLE_EXPORTER:return h(on,{model:r,name:l,isDownloading:wn,tableDownloadStatus:Ct,tableDownloadProgress:Re,tableDownloadEstimatedTime:nt!=null?nt:void 0,onDownload:this.handleDownloadTable,onDownloadStart:this.handleDownloadTableStart,onCancel:this.handleCancelDownloadTable,selectedRanges:Xn},ke.TABLE_EXPORTER);case ke.SELECT_DISTINCT:return h(np,{model:r,selectDistinctColumns:ve,onChange:this.handleSelectDistinctChanged});case ke.ADVANCED_SETTINGS:return h(Pd,{items:c,onChange:u});default:throw Error(`Unexpected option type ${je.type}`)}}),Xl=this.getCachedHiddenColumns(se.getHiddenColumns(bi));return v("div",{className:"iris-grid",role:"presentation",children:[v("div",{className:"iris-grid-column",children:[t!=null&&h("div",{className:"iris-grid-bar",children:t}),h(ht,{in:C,timeout:Tt.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:z&&j&&h(tp,{table:z,getFormattedString:(je,jt,Ln)=>r.displayString(je,jt,Ln),columnName:j.name,partition:k,onChange:this.handlePartitionChange,onFetchAll:this.handlePartitionFetchAll,onAppend:this.handlePartitionAppend,onDone:this.handlePartitionDone})})}),h(ht,{in:st,timeout:Tt.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(Tr,{value:Nt,selectedColumns:Yt,invertSelection:Xt,onChange:this.handleCrossColumnSearch,columns:r.columns,ref:this.crossColumnRef})})}),v("div",{className:"grid-wrapper",ref:je=>{this.gridWrapper=je},children:[h(ji,{ref:je=>{this.grid=je},isStickyBottom:!Ze(r)||!r.isEditable,isStuckToBottom:i,isStuckToRight:o,metricCalculator:g,model:r,keyHandlers:x,mouseHandlers:U,movedColumns:le,movedRows:Se,onError:this.handleGridError,onViewChanged:this.handleViewChanged,onSelectionChanged:this.handleSelectionChanged,onMovedColumnsChanged:this.handleMovedColumnsChanged,renderer:this.renderer,stateOverride:no,theme:As}),h(NT,{isOpen:Qo,text:Zo,onClose:this.handleOverflowClose}),Gl&&h(Qm,{model:r,modelColumns:r.columns,top:tr,bottom:nr,left:so,right:io,filter:zl,formatter:Oe,sorts:xe,reverseType:_e,movedColumns:le,customColumns:un,hiddenColumns:Xl,alwaysFetchColumns:this.getAlwaysFetchColumns(d,r.columns,le,r.floatingLeftColumnCount,r.floatingRightColumnCount,(ac=(lc=this.grid)==null?void 0:lc.state.draggingColumn)==null?void 0:ac.range),formatColumns:this.getCachedPreviewFormatColumns(this.getCachedModelColumns(r,un),J,me,((dc=Vt[Vt.length-1])==null?void 0:dc.type)===ke.CONDITIONAL_FORMATTING_EDIT&&fe!=null?fe:void 0),rollupConfig:this.getModelRollupConfig(r.originalColumns,Ht,Ft),totalsConfig:this.getModelTotalsConfig(r.columns,Ht,Ft),selectDistinctColumns:ve,pendingRowCount:Ul,pendingDataMap:Yo,frozenColumns:jo}),!w&&h("div",{className:"grid-settings-button",children:h("button",{type:"button","data-testid":`btn-iris-grid-settings-button-${l}`,className:"btn btn-link btn-link-icon",onClick:this.handleMenu,children:h(q,{icon:bf,transform:"up-1"})})}),sr,ir,rr,or,lr,Jo&&this.getOverflowButtonTooltip(Jo)]}),h(xT,{model:r,isShown:er,gotoRow:$l,gotoRowError:Wl,onSubmit:this.handleGotoRowSelectedRowNumberSubmit,onGotoRowNumberChanged:this.handleGotoRowSelectedRowNumberChanged,onClose:this.handleGotoRowClosed,onEntering:this.handleAnimationStart,onEntered:this.handleAnimationEnd,onExiting:()=>{this.handleAnimationStart(),this.focus()},onExited:this.handleAnimationEnd}),h(Mv,{error:Vl,isSaving:kn!=null,saveTooltip:`Commit (${this.commitAction.shortcut.getDisplayText()})`,discardTooltip:`Discard (${this.discardAction.shortcut.getDisplayText()})`,pendingDataErrors:Bl,pendingDataMap:Yo,onEntering:this.handleAnimationStart,onEntered:this.handleAnimationEnd,onExiting:this.handleAnimationStart,onExited:this.handleAnimationEnd,onSave:this.handlePendingCommitClicked,onDiscard:this.handlePendingDiscardClicked}),h(Wv,{children:Xo}),h(Zi,{model:r,copyOperation:E!=null?E:void 0,onEntering:this.handleAnimationStart,onEntered:this.handleAnimationEnd,onExiting:this.handleAnimationStart,onExited:this.handleAnimationEnd}),h(Qi,{ref:je=>{this.tableSaver=je},getDownloadWorker:n,onDownloadCompleted:this.handleDownloadCompleted,onDownloadCanceled:this.handleDownloadCanceled,onDownloadProgressUpdate:this.handleDownloadProgressUpdate,isDownloading:Ct===on.DOWNLOAD_STATUS.DOWNLOADING,formatter:Oe})]}),h(ht,{in:w,timeout:Tt.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:v(EC,{children:[h(Fc,{title:"Table Options",onClose:this.handleMenuClose,children:h(Du,{onSelect:je=>this.handleMenuSelect(ar[je]),items:ar})}),Yl.map((je,jt)=>h(Fc,{title:Vt[jt].title,onBack:this.handleMenuBack,onClose:this.handleMenuClose,children:je},Vt[jt].type))]})})}),h(ie,{actions:this.contextActions})]})}};let Ji=Js;Ji.minDebounce=150;Ji.maxDebounce=500;Ji.loadingSpinnerDelay=800;Ji.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:P.REVERSE_TYPE.NONE,customColumns:[],aggregationSettings:op,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:us.FULL_DATE_FORMAT,showTimeZone:!1,showTSeparator:!0,truncateNumbersWithPound:!1,formatter:[],decimalFormatOptions:R.exports.shape({defaultFormatString:R.exports.string}),integerFormatOptions:R.exports.shape({defaultFormatString:R.exports.string})},canCopy:!0,canDownloadCsv:!0,frozenColumns:null,theme:Zm,canToggleSearch:!0};class OT 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 AT=X.module("ColumnHeaderGroup");function bh(t){return t instanceof rp}class rp{constructor({name:e,children:n,color:s,depth:i,childIndexes:o}){this.getVisibleRange=ge(r=>{const l=this.childIndexes.flat(),a=G.getVisibleIndexes(l,r),d=Math.min(...a),c=Math.max(...a);return c-d!==l.length-1&&AT.warn(`Column header group ${this.name} is not contiguous`),[d,c]}),this.name=e,this.children=n,this.color=s,this.depth=i,this.childIndexes=o}}const et=X.module("IrisGridTableModel"),PT=150,HT=0;function oi(t){return t.table!==void 0}const Aa=class extends be{constructor(t,e=new hn,n=null){super(),this.pendingNewRowCount=0,this.columnHeaderGroupMap=new Map,this.columnHeaderParentMap=new Map,this._columnHeaderMaxDepth=null,this._columnHeaderGroups=[],this.getMemoizedColumnMap=ge(s=>{const i=new Map;return s.forEach(o=>i.set(o.name,o)),i}),this.getColumnIndicesByNameMap=ge(s=>{const i=new Map;return s.forEach(({name:o},r)=>i.set(o,r)),i}),this.setViewport=ui((s,i,o)=>{if(i<s){et.error("Invalid viewport",s,i);return}const{viewport:r}=this;if(r!=null&&r.top===s&&r.bottom===i&&r.columns===o){et.debug2("Ignoring duplicate viewport",r);return}this.viewport={top:s,bottom:i,columns:o},et.debug2("setViewport",this.viewport),this.applyViewport()},PT),this.applyViewport=ui(()=>{if(!this.viewport)return;et.debug2("applyViewport",this.viewport);const{top:s,bottom:i,columns:o}=this.viewport,[r,l]=this.getCachedViewportRowRange(s,i);this.applyBufferedViewport(r,l,o)},HT,{leading:!1}),this.getCachedFormattedString=ln((s,i,o,r,l)=>s.getFormattedString(i,o,r,l),{max:1e4}),this.getCachedCustomColumnFormatFlag=ln(hs.isCustomColumnFormatDefined,{max:1e4}),this.getCachedViewportRowRange=ge((s,i)=>{const o=i-s,r=Math.max(0,s-o*Aa.ROW_BUFFER_PAGES),l=i+o*Aa.ROW_BUFFER_PAGES;return[r,l]}),this.getCachedPendingErrors=ge((s,i,o)=>{const r=new Map;return s.forEach((l,a)=>{var c;const{data:d}=l;for(let u=0;u<o;u+=1)d.has(u)||(r.has(a)||r.set(a,[]),(c=r.get(a))==null||c.push(new OT(a,i[u].name)))}),r}),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.pendingNewDataErrors=null,this.pendingNewRowCount=0}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 Ge(be.EVENT.DISCONNECT))}handleTableReconnect(){this.dispatchEvent(new Ge(be.EVENT.RECONNECT))}handleTableUpdate(t){this.copyViewportData(t.detail),this.dispatchEvent(new Ge(be.EVENT.UPDATED))}handleTotalsUpdate(t){this.copyTotalsData(t.detail),this.dispatchEvent(new Ge(be.EVENT.UPDATED))}handleRequestFailed(t){this.dispatchEvent(new Ge(be.EVENT.REQUEST_FAILED,t))}handleCustomColumnsChanged(){this.dispatchEvent(new Ge(be.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(!se.isValidIndex(n))throw new Error(`Invalid rowIndex ${n}`);const{data:s}=e;s.forEach((i,o)=>{if(!se.isValidIndex(o))throw new Error(`Invalid columnIndex ${o}`)})}),this.pendingNewDataMap=t,this.pendingNewRowCount=Math.max(this.pendingNewRowCount,this.maxPendingDataRow),this.formattedStringData=[],this.dispatchEvent(new Ge(be.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 Ge(be.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(P.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 A(n.nullStringColor),n.nullStringColor;if(o&&o.color)return o.color;if(this.isPendingRow(e))return A(n.pendingTextColor),n.pendingTextColor;if(r!=null){const l=(i=this.totalsColumn(t,e))!=null?i:this.columns[t];if(P.isDateType(l.type)||l.name==="Date")return A(n.dateColor),n.dateColor;if(P.isNumberType(l.type))return r>0?(A(n.positiveNumberColor),n.positiveNumberColor):r<0?(A(n.negativeNumberColor),n.negativeNumberColor):(A(n.zeroNumberColor),n.zeroNumberColor)}}else if(this.isPendingRow(e)&&this.isKeyColumn(t))return A(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 P.isNumberType(n)?"right":P.isDateType(n)||e.name==="Date"?"center":"left"}textForColumnHeader(t,e=0){var n,s;return(s=(n=this.columnAtDepth(t,e))==null?void 0:n.name)!=null?s:void 0}colorForColumnHeader(t,e=0){var s;const n=this.columnAtDepth(t,e);return bh(n)&&(s=n.color)!=null?s:null}getColumnHeaderGroup(t,e){const n=this.columnAtDepth(t,e);if(bh(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 movedColumns(){var i;let t=[];const e=(o,r)=>{const l=this.getColumnIndexByName(o);if(l==null)throw new Error(`Unknown layout hint column: ${o}`);const a=G.getVisibleIndex(l,t);t=G.moveItem(a,r,t)},n=(o,r)=>{const l=this.columnHeaderGroupMap.get(o);if(!l)throw new Error(`Unknown layout hint group: ${o}`);const a=l.getVisibleRange(t);t=G.moveRange(a,r,t)};if(this.frontColumns.length||this.backColumns.length||this.frozenColumns.length){const o=new Set;let r=0;this.frozenColumns.forEach(a=>{if(o.has(a))throw new Error(`Column specified in multiple layout hints: ${a}`);e(a,r),r+=1}),this.frontColumns.forEach(a=>{if(o.has(a))throw new Error(`Column specified in multiple layout hints: ${a}`);e(a,r),r+=1});let l=this.columnMap.size-1;this.backColumns.forEach(a=>{if(o.has(a))throw new Error(`Column specified in multiple layout hints: ${a}`);e(a,l),l-=1})}const s=(i=this.layoutHints)==null?void 0:i.columnGroups;if(s){this.setColumnHeaderGroups(s);const o=[...this.columnHeaderGroupMap.values()];o.sort((r,l)=>r.depth-l.depth),o.forEach(r=>{const l=r.children[0],a=this.getColumnIndexByName(l);let d;if(a!=null)d=G.getVisibleIndex(a,t);else{const c=this.columnHeaderGroupMap.get(l);if(!c)throw new Error(`Unknown column ${l} in group ${r.name}`);[,d]=c.getVisibleRange(t)}for(let c=1;c<r.children.length;c+=1){const u=r.children[c],m=this.columnHeaderGroupMap.get(u),p=this.getColumnIndexByName(u);if(m){const f=m.getVisibleRange(t)[0]<d?d-m.childIndexes.length+1:d+1;n(u,f),d=f+m.childIndexes.length-1}else if(p!=null){const f=G.getVisibleIndex(p,t)<d?d:d+1;e(u,f),d=f}}})}return t}get columnMap(){return this.getMemoizedColumnMap(this.table.columns)}get columnHeaderMaxDepth(){var t,e;return this._columnHeaderMaxDepth==null&&this.setColumnHeaderGroups((t=this.layoutHints)==null?void 0:t.columnGroups),(e=this._columnHeaderMaxDepth)!=null?e:1}set columnHeaderMaxDepth(t){this._columnHeaderMaxDepth=t}setColumnHeaderGroups(t){if(t===this._columnHeaderGroups||(this._columnHeaderGroups=t!=null?t:[],this.columnHeaderMaxDepth=1,this.columnHeaderParentMap=new Map,this.columnHeaderGroupMap=new Map,!t||t.length===0))return;const e=new Map(t.map(o=>[o.name,o])),n=new Set,s=o=>{const{name:r}=o;if(this.getColumnIndexByName(r)!=null)throw new Error(`Column header group has same name as column: ${r}`);const l=this.columnHeaderGroupMap.get(r);if(l)return l;const a=[];let d=1;o.children.forEach(u=>{if(n.has(u))throw new Error(`Column group child ${u} specified in multiple groups`);n.add(u);const m=e.get(u),p=this.getColumnIndexByName(u);if(m){const g=s(m);a.push(g.childIndexes.flat()),d=Math.max(d,g.depth+1)}else if(p!=null)a.push(p),d=Math.max(d,1);else throw new Error(`Unknown child ${u} in group ${r}`)});const c=new rp({...o,depth:d,childIndexes:a});return this.columnHeaderGroupMap.set(r,c),o.children.forEach(u=>this.columnHeaderParentMap.set(u,c)),this.columnHeaderMaxDepth=Math.max(this.columnHeaderMaxDepth,c.depth+1),c},i=new Set;t.forEach(o=>{const{name:r}=o;if(i.has(r))throw new Error(`Duplicate column group name: ${r}`);i.add(r),s(o)})}get groupedColumns(){return[]}row(t){var l,a,d,c,u,m,p,g,f,b,C,w,T,E;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 y=(m=this.totals)==null?void 0:m.operationOrder[s];return A(y),(g=(p=this.totalsDataMap)==null?void 0:p.get(y))!=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(E=(T=(w=this.viewportData)==null?void 0:w.rows)==null?void 0:T[r])!=null?E: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:Ae.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){et.warn("invalid data!");return}this.viewportData=this.extractViewportData(t),this.formattedStringData=[]}copyTotalsData(t){var l,a,d,c,u;if(t==null){et.warn("invalid data!");return}const{columns:e,rows:n}=t;if(n.length!==1){et.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:Ae.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(w=>w.name===g);b.set(C,{value:i.get(p),format:i.getFormat(p)})}et.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);A(o),n.set(o,{value:t.get(i),format:t.getFormat(i)})}return{data:n}}closeSubscription(){et.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 Ge(be.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(et.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 Ge(be.EVENT.UPDATED));return}this.totalsTablePromise=Ee.makeCancelable(this.table.getTotalsTable(t),e=>e.close()),this.totalsTablePromise.then(e=>{this.totalsTablePromise=null,this.setTotalsTable(e)}).catch(e=>{Ee.isCanceled(e)||(et.error("Unable to set next totalsTable",e),this.totalsTablePromise=null,this.dispatchEvent(new Ge(be.EVENT.REQUEST_FAILED,{detail:e})))})}}setTotalsTable(t){et.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){et.debug2("applyBufferedViewport",t,e,n),this.subscription==null?(et.debug2("applyBufferedViewport creating new subscription"),this.subscription=this.table.setViewport(t,e,n)):(et.debug2("applyBufferedViewport using existing subscription"),this.subscription.setViewport(t,e,n))}async snapshot(t,e=!1,n=s=>s){if(this.subscription==null)throw new Error("No subscription available");const s=oe.consolidate(t);if(!se.isValidSnapshotRanges(s))throw new Error(`Invalid snapshot ranges ${t}`);const i=new Set,o=[],r=new Set;for(let u=0;u<s.length;u+=1){const m=s[u];A(m.endRow),A(m.startRow);for(let p=m.startRow;p<=m.endRow&&p<this.floatingTopRowCount;p+=1)i.add(p);m.endRow>=this.floatingTopRowCount&&m.startRow<=this.floatingTopRowCount+this.table.size&&o.push(new oe(m.startColumn,Math.min(Math.max(0,m.startRow-this.floatingTopRowCount)),m.endColumn,Math.min(Math.max(0,m.endRow-this.floatingTopRowCount),this.table.size-this.floatingTopRowCount)));for(let p=Math.max(m.startRow,this.floatingTopRowCount+this.table.size);p<=m.endRow&&p<this.floatingTopRowCount+this.table.size+this.floatingBottomRowCount;p+=1)r.add(p)}const l=se.columnsFromRanges(s,this.columns),a=[];e&&a.push(l.map(u=>u.name));const d=[...i].sort();for(let u=0;u<d.length;u+=1){const m=d[u],p=l.map(g=>{const f=this.getColumnIndexByName(g.name);return A(f),n(this.valueForCell(f,m),g)});e&&p.push(this.textForRowFooter(m)),a.push(p)}if(o.length>0){const u=se.rangeSetFromRanges(o),m=await this.subscription.snapshot(u,l);a.push(...m.rows.map(p=>l.map(g=>n(p.get(g),g))))}const c=[...r].sort();for(let u=0;u<c.length;u+=1){const m=c[u],p=l.map(g=>{const f=this.getColumnIndexByName(g.name);return A(f),n(this.valueForCell(f,m),g)});e&&p.push(this.textForRowFooter(m)),a.push(p)}return a}async textSnapshot(t,e=!1,n=s=>`${s}`){return et.debug2("textSnapshot",t,e),(await this.snapshot(t,e,n)).map(i=>i.join(" ")).join(`
|
|
35
|
+
`)}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&&oe.isBounded(t)&&(this.isPendingRow(t.startRow)&&this.isPendingRow(t.endRow)||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 oe(null,this.floatingTopRowCount,null,this.floatingTopRowCount+this.table.size-1)}getPendingAreaRange(){return new oe(null,this.floatingTopRowCount+this.table.size,null,this.floatingTopRowCount+this.table.size+this.pendingNewRowCount-1)}async setValueForCell(t,e,n){return this.setValueForRanges([new oe(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=[];oe.forEachCell(t,(d,c)=>{const u=this.columns[d];if(s.add(u),i[d]===void 0){const m=P.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=>oe.intersection(o,d)).filter(d=>d!=null).map(d=>(A(d),oe.offset(d,0,-(this.floatingTopRowCount+this.table.size))));if(r.length>0){const d=new Map(this.pendingNewDataMap);oe.forEachCell(r,(c,u)=>{d.has(u)||d.set(u,{data:new Map});const m=this.columns[c],p=d.get(u);A(p);const{data:g}=p,f=new Map(g),b=P.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 Ge(be.EVENT.UPDATED));const l=this.getTableAreaRange(),a=t.map(d=>oe.intersection(l,d)).filter(d=>d!=null);if(a.length>0){const c=(await this.snapshot(a.map(m=>{var p,g;return new oe(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]=P.makeValue(g.type,e,this.formatter.timeZone)}),p}),u=await((n=this.inputTable)==null?void 0:n.addRows(c));et.debug("setValueForRanges(",t,",",e,") set tableRanges",a,"result",u)}oe.forEachCell(t,(d,c)=>{const u=i[d];A(u),this.cacheFormattedValue(d,c,u)})}catch(s){et.error("Unable to set ranges",t,e,s)}finally{oe.forEachCell(t,(s,i)=>{this.clearPendingValue(s,i)})}}async setValues(t=[]){var e;if(et.debug("setValues(",t,")"),!t.every(n=>{var s,i;return this.isEditableRange(oe.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=P.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);A(C);const{data:w}=C,T=new Map(w);m!=null?T.set(d,{value:m}):T.delete(d),T.size>0?n.set(g,{...C,data:T}):n.delete(g)}}),this.pendingDataMap=n,this.dispatchEvent(new Ge(be.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=oe.consolidate(t.map(l=>{var a,d;return oe.makeCell((a=l.column)!=null?a:l.x,(d=l.row)!=null?d:l.y)})),o=this.getTableAreaRange(),r=i.map(l=>oe.intersection(o,l)).filter(l=>l!=null);if(r.length>0){const a=(await this.snapshot(r.map(c=>(A(c),new oe(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];A(C);const w=oe.rowCount([C]);if(p<w){A(C.startRow),m=C.startRow+p;break}p-=w}const g={};for(let b=0;b<this.columns.length;b+=1)g[this.columns[b].name]=c[b];A(m);const f=s.get(m);return f!=null&&f.forEach(b=>{var w;const C=this.columns[(w=b.column)!=null?w:b.x];g[C.name]=P.makeValue(C.type,b.text,this.formatter.timeZone)}),g});et.info("setValues setting tableRanges",r);const d=await((e=this.inputTable)==null?void 0:e.addRows(a));et.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=P.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));et.debug("commitPending()",this.pendingNewDataMap,"result",i),this.pendingNewDataMap=new Map,this.pendingNewDataErrors=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 Ge(be.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}`);A(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=>oe.intersection(n,c)).filter(c=>c!=null).map(c=>(A(c),oe.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];A(m.startRow),A(m.endRow);for(let p=m.startRow;p<=m.endRow;p+=1)c.delete(p)}this.pendingNewDataMap=c,this.formattedStringData=[],this.dispatchEvent(new Ge(be.EVENT.PENDING_DATA_UPDATED)),this.dispatchEvent(new Ge(be.EVENT.UPDATED))}const i=this.getTableAreaRange(),o=t.map(c=>oe.intersection(i,c)).filter(c=>c!=null);if(o.length<=0)return;const[r,l]=await Promise.all([this.snapshot(o.map(c=>(A(c),new oe(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=P.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 P.makeValue(s.type,n,this.formatter.timeZone),!0}catch{return!1}}};let Hd=Aa;Hd.ROW_BUFFER_PAGES=1;const Is=X.module("IrisGridTableModel"),ha=Object.freeze([]);class lp extends Hd{constructor(e,n=new hn,s=null){super(e,n,s),this.getMemoizedFrontColumns=ge(i=>i!=null?i:ha),this.getMemoizedBackColumns=ge(i=>i!=null?i:ha),this.getMemoizedFrozenColumns=ge((i,o)=>{var r;return(r=o!=null?o:i)!=null?r:ha}),this.getCachedFilterableColumnSet=ge(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(Is.debug2("set customColumns",e,this.customColumnList,e===this.customColumnList),this.customColumnList.length===0&&e.length===0){Is.debug("Ignore empty initial customColumns"),this.customColumnList=e;return}if(this.customColumnList===e){Is.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(Is.debug2("set formatColumns",e,this.formatColumnList,e===this.formatColumnList),this.formatColumnList.length===0&&e.length===0){Is.debug("Ignore empty initial formatColumns"),this.formatColumnList=e;return}if(this.formatColumnList===e){Is.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 Ge(be.EVENT.TABLE_CHANGED,{detail:this.table}))}set totalsConfig(e){if(Is.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 Ge(be.EVENT.UPDATED));return}this.totalsTablePromise=Ee.makeCancelable(this.table.getTotalsTable(e),n=>n.close()),this.totalsTablePromise.then(n=>{this.totalsTablePromise=null,this.setTotalsTable(n)}).catch(n=>{Ee.isCanceled(n)||(Is.error("Unable to set next totalsTable",n),this.totalsTablePromise=null,this.dispatchEvent(new Ge(be.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}`);A(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=>oe.intersection(s,m)).filter(m=>m!=null).map(m=>(A(m),oe.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];A(g.startRow),A(g.endRow);for(let f=g.startRow;f<=g.endRow;f+=1)m.delete(f)}super.pendingDataMap=m,this.formattedStringData=[],this.dispatchEvent(new Ge(be.EVENT.PENDING_DATA_UPDATED)),this.dispatchEvent(new Ge(be.EVENT.UPDATED))}const o=this.getTableAreaRange(),r=e.map(m=>oe.intersection(o,m)).filter(m=>m!=null);if(r.length<=0)return;const[l,a]=await Promise.all([this.snapshot(r.map(m=>(A(m),new oe(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=P.makeFilterRawValue(f.type,b),w=f.filter().eq(C);p.push(w)}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()}}class VT extends Hd{constructor(){super(...arguments),this.getCachedFilterableColumnSet=ge((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,d,c;A(this.viewport),A(this.viewportData);const{columns:i}=this.viewport,o=[];n!=null&&n&&o.push(i.map(u=>u.name));const r=new oe(0,(l=this.viewportData)==null?void 0:l.offset,i.length,((a=this.viewportData)==null?void 0:a.offset)+((d=this.viewportData)==null?void 0:d.rows.length));for(let u=0;u<e.length;u+=1){const m=oe.intersection(r,e[u]);A(m),A(m.startRow),A(m.endRow);for(let p=m.startRow;p<=m.endRow;p+=1){const g=[],f=this.viewportData.rows[p-this.viewportData.offset];A(m.startColumn),A(m.endColumn);for(let b=m.startColumn;b<=m.endColumn;b+=1)A(s),g.push(s((c=f.data.get(b))==null?void 0:c.value,this.columns[b]));o.push(g)}}return o}get groupedColumns(){return[]}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 Rs=X.module("IrisGridProxyModel");function ua(t,e,n){return P.isTreeTable(t)?new VT(t,e):new lp(t,e,n)}class UT extends be{constructor(e,n=new hn,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)=>Ze(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)=>(Ze(this.model)&&this.model.editValueForCell(...o),""),this.setValueForCell=(...o)=>Ze(this.model)?this.model.setValueForCell(...o):Promise.reject(new Error("Model is not editable")),this.setValueForRanges=(...o)=>Ze(this.model)?this.model.setValueForRanges(...o):Promise.reject(new Error("Model is not editable")),this.setValues=(...o)=>Ze(this.model)?this.model.setValues(...o):Promise.resolve(),this.isValidForCell=(...o)=>Ze(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=ua(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){Rs.debug2("handleModelEvent",e);const{detail:n,type:s}=e;this.dispatchEvent(new Ge(s,{detail:n}))}setModel(e){Rs.debug("setModel",e);const n=this.model;n!==this.originalModel&&n.close(),this.model=e,this.listenerCount>0&&this.addListeners(e),this.dispatchEvent(new Ge(be.EVENT.COLUMNS_CHANGED,{detail:e.columns})),oi(e)&&this.dispatchEvent(new Ge(be.EVENT.TABLE_CHANGED,{detail:e.table}))}setNextModel(e){Rs.debug2("setNextModel"),this.modelPromise&&this.modelPromise.cancel(),this.listenerCount>0&&this.removeListeners(this.model),this.modelPromise=Ee.makeCancelable(e,n=>n.close()),this.modelPromise.then(n=>{this.modelPromise=null,this.setModel(n)}).catch(n=>{if(Ee.isCanceled(n)){Rs.debug2("setNextModel cancelled");return}Rs.error("Unable to set next model",n),this.modelPromise=null,this.dispatchEvent(new Ge(be.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(be.EVENT);for(let s=0;s<n.length;s+=1)e.addEventListener(n[s],this.handleModelEvent)}removeListeners(e){const n=Object.keys(be.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 movedColumns(){return this.model.movedColumns}get movedRows(){return this.model.movedRows}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 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(Rs.debug("set rollupConfig",e),!this.isRollupAvailable)throw new Error("Rollup Rows are not available");if(ct(e,this.rollup))return;this.rollup=e;let n=Promise.resolve(this.originalModel);oi(this.originalModel)&&e!=null&&(n=this.originalModel.table.rollup(e).then(s=>ua(s,this.formatter))),this.setNextModel(n)}get selectDistinctColumns(){return this.selectDistinct}set selectDistinctColumns(e){if(Rs.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){Rs.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);oi(this.originalModel)&&n.length>0&&(s=this.originalModel.table.selectDistinct(n).then(i=>ua(i,this.formatter))),this.setNextModel(s)}get table(){if(oi(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 Ze(this.model)&&this.model.isEditable}export(){if(P.isTreeTable(this.model))throw new Error("TreeTable has no 'export' property");return this.model.export()}columnStatistics(e){if(P.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)}}class Vd{static async makeModel(e,n=new hn){let s=null;return!P.isTreeTable(e)&&e.hasInputTable&&(s=await e.inputTable()),new UT(e,n,s)}}class Wi{}Wi.OPEN="ChartEvent.OPEN";Wi.CLOSE="ChartEvent.CLOSE";Wi.COLUMN_SELECTED="ChartEvent.COLUMN_SELECTED";class ft{}ft.SESSION_OPENED="ConsoleEvent.SESSION_OPENED";ft.SESSION_CLOSED="ConsoleEvent.SESSION_CLOSED";ft.FOCUS_HISTORY="ConsoleEvent.FOCUS_HISTORY";ft.SEND_COMMAND="ConsoleEvent.SEND_COMMAND";ft.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 wt{}wt.OPEN_GRID="IrisGridEvent.OPEN_GRID";wt.CLOSE_GRID="IrisGridEvent.CLOSE_GRID";wt.DATA_SELECTED="IrisGridEvent.DATA_SELECTED";wt.COLUMN_SELECTED="IrisGridEvent.COLUMN_SELECTED";wt.STATE_CHANGED="IrisGridEvent.STATE_CHANGED";wt.CREATE_CHART="IrisGridevent.CREATE_CHART";const ap=Object.freeze({OPEN:"MarkdownEvent.OPEN"});class He{}He.CREATE_NOTEBOOK="NotebookEvent.createNotebook";He.SELECT_NOTEBOOK="NotebookEvent.selectNotebook";He.CLOSE_FILE="NotebookEvent.closeFile";He.RENAME="NotebookEvent.rename";He.RENAME_FILE="NotebookEvent.renameFile";He.REGISTER_FILE="NotebookEvent.registerFile";He.SEND_TO_NOTEBOOK="NotebookEvent.sendToNotebook";He.UNREGISTER_FILE="NotebookEvent.unregisterFile";class $n{}$n.focus="TabEvent.focus";$n.blur="TabEvent.blur";$n.openPQObject="TabEvent.openPQObject";$n.openControl="TabEvent.openControl";$n.reload="TabEvent.reload";$n.clearAllFilters="TabEvent.clearAllFilters";class dp extends S.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:ie.groups.low,action:this.handleCloseTab,disabled:i===void 0||!i}),s.push(()=>({title:"Close Tabs to Right",order:20,group:ie.groups.low,action:this.handleCloseTabsRight,disabled:this.canCloseTabsRight()})),s.push(()=>({title:"Close All",order:30,group:ie.groups.low,action:this.handleCloseTabsAll,disabled:this.canCloseAny()})),h(ie,{actions:s})}}dp.defaultProps={additionalActions:[]};class cp extends S.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=Y.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 v("form",{className:W("p-3",{"was-validated":o}),onSubmit:this.handleRenameSubmit,noValidate:!0,role:"presentation",onMouseDown:r=>{r.stopPropagation()},onMouseUp:r=>{r.stopPropagation()},children:[v("div",{className:"form-group",children:[v("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}),v("div",{className:"invalid-feedback",children:[s," name cannot be empty"]}),(e||!n)&&v("div",{className:"pt-2",children:["Renaming this ",s," will rename for all users."]})]}),v("div",{className:"text-right",children:[h(Q,{kind:"secondary",className:"mr-2",onClick:this.handleRenameCancel,children:"Cancel"}),h(Q,{kind:"primary",type:"submit",children:"Rename"})]})]})}render(){const{isShown:e,onCancel:n}=this.props;return h(Fn,{isShown:e,onEntered:this.handleRenameDialogOpened,onExited:n,options:{placement:"bottom",modifiers:{preventOverflow:{boundariesElement:"viewport"}}},interactive:!0,closeOnBlur:!0,children:this.renderRenameDialog()})}}cp.defaultProps={isShared:!1,isOwner:!0,itemType:"Item",value:""};const BT=X.module("Panel");class Yn extends S.exports.PureComponent{constructor(e){super(e),this.getAdditionActions=ge((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:te.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(ft.SESSION_CLOSED,this.handleSessionClosed),s.on(ft.SESSION_OPENED,this.handleSessionOpened),s.on($n.focus,this.handleTabFocus),s.on($n.blur,this.handleTabBlur),s.on(Pe.CLEAR_ALL_FILTERS,this.handleClearAllFilters),s.emit(Me.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(ft.SESSION_CLOSED,this.handleSessionClosed),s.off(ft.SESSION_OPENED,this.handleSessionOpened),s.off($n.focus,this.handleTabFocus),s.off($n.blur,this.handleTabBlur),s.off(Pe.CLEAR_ALL_FILTERS,this.handleClearAllFilters),s.emit(Me.UNMOUNT,e)}handleTab(e){e!=null&&this.setState({title:te.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(Me.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=te.getRootFromContainer(n),i=te.getComponentConfigFromContainer(n);A(i),te.renameComponent(s,i,e)}handleCopyPanel(){const{glContainer:e,glEventHub:n}=this.props,s=te.getRootFromContainer(e),i=te.getComponentConfigFromContainer(e);if(i==null){BT.error("Could not get component config from container",e);return}const o=te.cloneComponent(s,i);o!==null&&n.emit(Me.CLONED,this,o)}getCloneAction(){return{title:"Copy Panel",order:10,group:ie.groups.high,action:this.handleCopyPanel}}getRenameAction(){return{title:"Rename",order:10,group:ie.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 v("div",{className:W("h-100 w-100 iris-panel",n),onFocusCapture:this.handleFocus,onBlurCapture:this.handleBlur,children:[e,h(ml,{errorMessage:r,isLoaded:l,isLoading:a}),u!=null&&hi.createPortal(v(he,{children:[h(dp,{glContainer:i,additionalActions:this.getAdditionActions(o,d,c)}),c&&h(cp,{isShown:m,value:p,itemType:"Panel",onCancel:this.handleRenameCancel,onSubmit:this.handleRenameSubmit}),s!=null&&h(Ie,{interactive:!0,options:{placement:"bottom"},popperClassName:"panel-tab-popper",children:s()})]}),u.element[0])]})}}Yn.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};const $T=X.module("WidgetPanelTooltip"),_l=t=>{const{widgetType:e,widgetName:n,glContainer:s,description:i,children:o}=t,r=te.getTitleFromContainer(s),[l,a]=S.exports.useState(!1);return v("div",{className:"tab-tooltip-container",children:[v("div",{className:"row flex-nowrap align-items-start",children:[h("span",{className:"tab-tooltip-title",children:v("b",{children:[e," Name "]})}),h("span",{className:"tab-tooltip-name",children:n}),h(Q,{kind:"ghost",className:"tab-tooltip-copy",icon:l?nd:ed,onClick:()=>{Ne.copyToClipboard(n).then(()=>a(!0)).catch(d=>$T.error("Unable to column name",d))},tooltip:l?"Copied text":"Copy name"})]}),n!==r&&v("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]})};_l.propTypes={glContainer:_m.Container.isRequired,widgetType:R.exports.string,widgetName:R.exports.string,description:R.exports.string,children:R.exports.node};_l.defaultProps={widgetType:"",widgetName:"",description:null,children:null};class kl extends S.exports.PureComponent{constructor(e){super(e),this.getCachedRenderTabTooltip=ge((n,s,i,o,r)=>n?()=>h(_l,{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;Ne.copyToClipboard(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.
|
|
36
|
+
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.
|
|
37
|
+
${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:w,onBlur:T,onResize:E,onShow:y,onTabBlur:I,onTabFocus:D,onTabClicked:N}=this.props,{isPanelDisconnected:x,isWidgetDisconnected:U,isPanelInactive:$}=this.state,L=this.getErrorMessage(),H=m!=null?m:this.getCachedRenderTabTooltip(u,r,p,g,f),O=[{title:`Copy ${p} Name`,group:ie.groups.medium,order:20,action:this.handleCopyName}];return v(Yn,{className:W(n,{disconnected:x||U||a,inactive:$}),componentPanel:s,glContainer:r,glEventHub:l,onClearAllFilters:b,onHide:C,onFocus:w,onBlur:T,onResize:E,onShow:y,onSessionClose:this.handleSessionClosed,onSessionOpen:this.handleSessionOpened,onTabBlur:I,onTabFocus:D,onTabClicked:N,renderTabTooltip:H,errorMessage:L,isLoaded:i,isLoading:o,isClonable:d,isRenamable:c,additionalActions:O,children:[e,$&&h("div",{className:"fill-parent-absolute"})]})}}kl.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 cn=Object.freeze({DEFAULT:"DEFAULT",LINKER:"LINKER"}),WT="SET_SESSION_WRAPPER",zT=fi(WT,null),GT={sessionWrapper:zT},KT=new Map,Ll=Object.freeze([]),hp=(t,e)=>{var n;return(n=qt(t,e).columns)!=null?n:Ll},qT=(t,e)=>{var n;return(n=qt(t,e).filterSets)!=null?n:Ll},Ud=(t,e)=>{var n;return(n=qt(t,e).filters)!=null?n:Ll},Bd=(t,e)=>{var n;return(n=qt(t,e).tableMap)!=null?n:KT},$d=(t,e)=>qt(t,e).isolatedLinkerPanelId,eo=(t,e)=>{var n;return(n=qt(t,e).links)!=null?n:Ll},Wd=(t,e)=>qt(t,e).columnSelectionValidator,YT=(t,e)=>qt(t,e).connection,gi=(t,e)=>qt(t,e).sessionWrapper,XT=(t,e)=>n=>n(qn(t,{connection:e})),jT=(t,e)=>n=>n(qn(t,{sessionWrapper:e})),zd=(t,e)=>n=>n(qn(t,{links:e})),QT=(t,e)=>(n,s)=>{const i=eo(s(),t),o=e.filter(r=>i.findIndex(l=>ct(l.start,r.start)&&ct(l.end,r.end))<0);return n(zd(t,i.concat(o)))},ZT=(t,e)=>(n,s)=>{const o=eo(s(),t).filter(r=>!e.includes(r.id));return n(zd(t,o))},up=(t,e)=>n=>n(qn(t,{isolatedLinkerPanelId:e})),JT=(t,e)=>n=>n(qn(t,{columnSelectionValidator:e})),eE=(t,e)=>n=>n(qn(t,{consoleSettings:e})),tE=(t,e)=>n=>n(qn(t,{filterSets:e}));Object.entries(GT).map(([t,e])=>Xi.register(t,e));const mp=({columnMap:t,inputFilterMap:e,linkedColumnMap:n,onAdd:s,onOpenLinker:i,waitingFilterMap:o,waitingInputMap:r})=>{const l=S.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=tn.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=S.exports.useMemo(()=>Array.from(t.values()),[t]),d=S.exports.useCallback(p=>{p.stopPropagation(),p.preventDefault(),s(Array.from(o.values()))},[s,o]),c=S.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:v("div",{className:W("chart-panel-overlay-content chart-filter-overlay-content",{"chart-filter-waiting-filter":u},{"chart-filter-waiting-input":m}),children:[u&&v(he,{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?cs:sd;return v("div",{className:W("waiting-filter-item",{"is-invalid":g}),children:[h(q,{icon:f}),p.name]},p.name)})}),v("div",{children:[h(Vi,{onClick:d,className:"btn-primary",children:"Add Input Filters"}),h(Vi,{onClick:c,className:"btn-primary",children:"Open Linker Tool"})]})]}),m&&v(he,{children:[h("div",{className:"info-message",children:"Waiting for User Input"}),h("div",{className:"",children:l})]})]})})};mp.propTypes={columnMap:R.exports.instanceOf(Map).isRequired,inputFilterMap:R.exports.instanceOf(Map).isRequired,linkedColumnMap:R.exports.instanceOf(Map).isRequired,onAdd:R.exports.func.isRequired,onOpenLinker:R.exports.func.isRequired,waitingFilterMap:R.exports.instanceOf(Map).isRequired,waitingInputMap:R.exports.instanceOf(Map).isRequired};const _o=({columns:t,onColumnSelected:e,onMouseEnter:n,onMouseLeave:s})=>h("div",{className:"chart-panel-overlay chart-column-selector-overlay",children:h("div",{className:W("chart-panel-overlay-content"),children:v(he,{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(gl,{className:W("btn-chart-column-selector",_o.makeButtonClassName(i.name)),onClick:()=>e(i.name),onMouseEnter:()=>{n&&n(i)},onMouseLeave:s,disabled:!i.isValid,isLinked:i.isActive,children:i.name},i.name))})]})})});_o.makeButtonClassName=t=>`btn-chart-column-selector-${t}`;_o.defaultProps={onMouseEnter:()=>{},onMouseLeave:()=>{}};const Jt=X.module("ChartPanel"),nE=150;function kr(t){return t.settings!==void 0}function sE(t){return t.inputFilters!=null}function iE(t){return t.panelState!=null}class Ol extends S.exports.Component{constructor(e){super(e),this.getWaitingInputMap=ge((r,l,a)=>{if(!r)return new Map;const d=new Map(l);return a.forEach((c,u)=>{d.delete(u)}),d}),this.getWaitingFilterMap=ge((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=ge((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=ge((r,l)=>{const a=new Map,d=te.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);A(p),a.set(m,p)}}return a}),this.getSelectorColumns=ge((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=Xe(this.updateModelFromSource.bind(this),nE),this.handleClearAllFilters=this.handleClearAllFilters.bind(this),this.panelContainer=Y.createRef(),this.chart=Y.createRef(),this.pending=new ps;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&&kr(n)&&n.settings&&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&&Xc(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){Jt.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){Jt.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(Wi.COLUMN_SELECTED,this,s.get(e))}handleColumnMouseEnter({type:e,name:n}){const{columnSelectionValidator:s}=this.props;Jt.debug("handleColumnMouseEnter",s,e,n),s&&s(this,{type:e,name:n})}handleColumnMouseLeave(){const{columnSelectionValidator:e}=this.props;Jt.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(cn.LINKER)}handleReconnect(){this.setState({isDisconnected:!1,error:void 0}),this.sendColumnChange(),this.updateColumnFilters()}handleLoadSuccess(e){Jt.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){Ee.isCanceled(e)||(Jt.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){Jt.debug2("updateModelFromSource ignoring",s,i,n);return}if(this.pending.cancel(),kr(e)){const{settings:o}=e;this.pending.add(M.plot.Figure.create(Le.makeFigureSettings(o,n))).then(r=>{Xc(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&&sE(e.props)&&iE(e.state)){const{inputFilters:r}=e.props,{panelState:l}=e.state;l!=null&&(o=se.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 Jt.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=_o.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){Jt.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 Jt.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 Jt.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;A(s);const i=this.getWaitingInputMap(s.isFilterRequired(),e,n);if(s.setFilter(n),n.size>0&&i.size===0){const o=s.getDefaultTitle(),r=tn.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),Jt.debug2("updateFilters filters set",n),this.setState({isLoading:!0})}else Jt.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;kr(l)?C=l.table:C=l.figure;const w=this.getInputFilterColumnMap(d,i),T=this.getLinkedColumnMap(d,r),E=m!=null?this.getWaitingInputMap(m.isFilterRequired(),d,c):new Map,y=m!=null?this.getWaitingFilterMap(m.isFilterRequired(),d,c,T,w):new Map,I=u!=null?`Unable to open chart. ${u}`:void 0,D=E.size>0,N=d.size>0&&o;return h(kl,{className:W("iris-chart-panel",{"input-required":D}),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:v("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(ju,{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(ht,{in:D&&!N&&!b,timeout:Tt.transitionMs,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,children:h(mp,{inputFilterMap:w,linkedColumnMap:T,onAdd:this.handleFilterAdd,onOpenLinker:this.handleOpenLinker,columnMap:d,waitingFilterMap:y,waitingInputMap:E})}),h(ht,{in:N,timeout:Tt.transitionMs,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,children:h(_o,{columns:this.getSelectorColumns(d,T,e),onColumnSelected:this.handleColumnSelected,onMouseEnter:this.handleColumnMouseEnter,onMouseLeave:this.handleColumnMouseLeave})})]})})}}Ol.defaultProps={columnSelectionValidator:null,isLinkerActive:!1,source:null,sourcePanel:null,panelState:null,settings:{}};Ol.displayName="ChartPanel";Ol.COMPONENT="ChartPanel";const oE=(t,e)=>{const{localDashboardId:n,metadata:s}=e;let i;s!=null&&(i=s.sourcePanelId);const o=Bd(t,n),r=Lm(t,n),l=Tl(t),a=$d(t,n),d=l===cn.LINKER&&a===void 0;return{columnSelectionValidator:Wd(t,n),isLinkerActive:d,inputFilters:Ud(t,n),links:eo(t,n),source:i!=null?o.get(i):void 0,sourcePanel:i!=null?r.get(i):void 0,settings:Kt(t)}},Pi=Mt(oE,{setActiveTool:El,setDashboardIsolatedLinkerPanelId:up},null,{forwardRef:!0})(Ol);const Er=X.module("CommandHistoryPanel"),pp=class extends S.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.handleSendToConsole=this.handleSendToConsole.bind(this),this.handleSendToNotebook=this.handleSendToNotebook.bind(this),this.container=Y.createRef(),this.pending=new ps;const{session:e,sessionId:n,language:s}=t;this.state={panelState:{},session:e,sessionId:n,language:s,contextActions:[{action:this.handleFocusHistory,shortcut:Nn.COMMAND_HISTORY.FOCUS_HISTORY}]}}static handleError(t){Er.error(t)}componentDidMount(){const{glEventHub:t,session:e}=this.props;t.on(ft.FOCUS_HISTORY,this.handleFocusHistory),e!=null&&this.loadTable()}componentWillUnmount(){const{glEventHub:t}=this.props;t.off(ft.FOCUS_HISTORY,this.handleFocusHistory),this.pending.cancel()}handleFocusHistory(){this.container.current&&this.container.current.focus()}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(Er.debug("handleSendToNotebook",n,t),!n){Er.error("Session is not connected.");return}const{glEventHub:i}=this.props;i.emit(e?He.CREATE_NOTEBOOK:He.SEND_TO_NOTEBOOK,n,s,t)}handleSendToConsole(t,e=!0,n=!1){Er.debug("handleSendToConsole",t);const{glEventHub:s}=this.props;s.emit(ft.SEND_COMMAND,t,e,n)}loadTable(){const{commandHistoryStorage:t}=this.props,{language:e,sessionId:n}=this.state;A(e),A(n),this.pending.add(t.getTable(e,n,Date.now()),s=>s.close()).then(s=>{this.setState({table:s})}).catch(pp.handleError)}render(){const{glContainer:t,glEventHub:e,commandHistoryStorage:n}=this.props,{language:s,contextActions:i,table:o}=this.state;return v(Yn,{className:"command-history-pane",componentPanel:this,glContainer:t,glEventHub:e,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,children:[!o&&h("div",{className:"command-history-disconnected-message",children:"Waiting for console connection"}),o&&s&&v(he,{children:[h(Sl,{ref:this.container,language:s,sendToNotebook:this.handleSendToNotebook,sendToConsole:this.handleSendToConsole,table:o,commandHistoryStorage:n}),h(ie,{actions:i})]})]})}};let Gd=pp;Gd.COMPONENT="CommandHistoryPanel";Gd.TITLE="Command History";const rE=(t,e)=>{const n=em(t),s=gi(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}},Zr=Mt(rE,null,null,{forwardRef:!0})(Gd);const yr=X.module("ConsolePanel"),lE=500,aE=Object.freeze({consoleSettings:{},itemIds:[]});class Kd extends S.exports.PureComponent{constructor(e){super(e),this.savePanelState=Xe(()=>{const{consoleSettings:r,itemIds:l}=this.state,a={consoleSettings:r,itemIds:[...l]};yr.debug("Saving panel state",a),this.setState({panelState:a})},lE),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=Y.createRef();const{panelState:n}=e,s={...aE,...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(Me.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(Me.MOUNT,this.handlePanelMount),(n=this.objectSubscriptionCleanup)==null||n.call(this)}subscribeToFieldUpdates(){const{sessionWrapper:e}=this.props,{session:n}=e;this.objectSubscriptionCleanup=n.subscribeToFieldUpdates(s=>{yr.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=ze.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(ft.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(Me.CLOSE,s)}}handleSettingsChange(e){const{glEventHub:n}=this.props;yr.debug("handleSettingsChange",e),this.setState({consoleSettings:e}),n.emit(ft.SETTINGS_CHANGED,e)}openWidget(e,n){const{glEventHub:s}=this.props,{title:i}=e;A(i);const o=this.getItemId(i),r={fetch:()=>n.getObject(e),panelId:o,widget:e};yr.debug("openWidget",r),s.emit(Me.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(Me.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(Yn,{componentPanel:this,glContainer:n,glEventHub:s,onResize:this.handleResize,onShow:this.handleShow,onTabFocus:this.handleTabFocus,errorMessage:a!=null?`${a}`:void 0,children:h(he,{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:v(he,{children:[h("div",{children:"\xA0"}),h("div",{children:_u.LANGUAGE_MAP.get(g)}),h("div",{children:"\xA0"}),h("div",{children:h(tS,{connection:m,defaultUpdateInterval:10*1e3,hoverUpdateInterval:3*1e3,monitorDuration:10*60*1e3})}),h("div",{children:"\xA0"})]}),scope:p,timeZone:o,objectMap:d,unzip:r})})})}}Kd.COMPONENT="ConsolePanel";Kd.TITLE="Console";const dE=(t,e)=>({commandHistoryStorage:em(t),sessionWrapper:gi(t,e.localDashboardId),timeZone:vl(t)}),_i=Mt(dE,null,null,{forwardRef:!0})(Kd);const mo=X.module("DropdownFilter"),cE=150,Lr=class extends S.exports.Component{constructor(t){super(t),this.getCompatibleColumns=ge((i,o)=>i!=null?o.filter(({type:r})=>r!==void 0&&P.isCompatibleType(r,i.columnType)):[]),this.getColumnOptions=ge((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=ge((i,o)=>i.indexOf(o)),this.getValueOptions=ge(i=>[h("option",{value:"-1",children:Lr.PLACEHOLDER},"-1"),...i.map((o,r)=>h("option",{value:r,children:o},`${r}/${o}`))]),this.getItemLabel=Te((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=Xe(()=>{const{onChange:i}=this.props,{column:o,value:r,isValueShown:l}=this.state;i({column:o,isValueShown:l,value:r!=null?r:void 0})},cE),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=Y.createRef();const{column:e,isValueShown:n,value:s}=t;this.state={column:e,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(mo.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(),mo.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;if(n===-1)mo.debug2("Selected default item");else if(n>=0&&n<i.length)s=i[n];else{mo.error("Invalid index",n,i);return}mo.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()}handleMouseEnter(){const{onSourceMouseEnter:t}=this.props;t()}handleMouseLeave(){const{onSourceMouseLeave:t}=this.props;t()}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(){this.dropdownRef.current!==null&&this.dropdownRef.current.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({column:i,value:n,isValueShown:s})}render(){var U;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,isValueShown:m,selectedColumn:p,value:g}=this.state,f=i===null,b=this.getCompatibleColumns(i,t),C=i!=null,w=(U=i==null?void 0:i.columnName)!=null?U:Lr.SOURCE_BUTTON_PLACEHOLDER,T=c!=null?`${c.name} Filter`:null,[E,y]=this.getColumnOptions(b,p),I=this.getValueOptions(a),D=this.getSelectedOptionIndex(a,g),N=!C||p==null;return v(Ja,{className:"dropdown-filter fill-parent-absolute",isFlipped:m&&!n,children:[h("div",{className:"dropdown-filter-settings-card",children:v("div",{className:"dropdown-filter-card-content",children:[v("div",{className:"dropdown-filter-settings-grid",children:[h("label",{children:"Source Column"}),h(gl,{isLinked:C,onClick:o,onMouseEnter:r,onMouseLeave:l,className:Lr.SOURCE_BUTTON_CLASS_NAME,disabled:e,children:w}),h("div",{className:"text-muted small",children:"Select a source column for the list by linking to a table."}),h("label",{children:"Filter Column"}),h("select",{value:y,className:"custom-select",onChange:this.handleColumnChange,disabled:f,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}),C&&v("div",{className:"dropdown-filter-settings-buttons",children:[h(Q,{kind:"secondary",type:"button",onClick:this.handleSettingsCancel,disabled:u||m||n,tooltip:n?"Cancel disabled while linker open":void 0,children:"Cancel"}),h(Q,{kind:"primary",type:"button",className:"ml-2",onClick:this.handleSettingsSave,disabled:N||m||n,tooltip:n?"Save disabled while linker open":void 0,children:"Save"})]})]})}),h("div",{className:"dropdown-filter-value-card",onClick:this.handleBackgroundClick,children:s&&v(he,{children:[h("div",{className:"dropdown-filter-column",children:h("div",{className:"dropdown-filter-column-title",children:T})}),v("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:D,ref:this.dropdownRef,onChange:this.handleValueChange,onKeyPress:this.handleDropdownKeyPress,children:I})}),d&&h("div",{className:"error-message mt-3 text-center",children:d})]}),h("div",{className:"dropdown-filter-menu",children:h(Q,{kind:"ghost",className:"m-2 px-2",onClick:this.handleSettingsClick,icon:h(q,{icon:Vo,transform:"grow-4"}),tooltip:"Dropdown Filter Settings"})})]})})]})}};let zi=Lr;zi.defaultProps={column:null,disableLinking:!1,isLinkerActive:!1,isLoaded:!1,isValueShown:!1,settingsError:null,source:null,value:"",values:[],onColumnSelected:()=>{},onSourceMouseEnter:()=>{},onSourceMouseLeave:()=>{}};zi.PLACEHOLDER="Select a value...";zi.SOURCE_BUTTON_CLASS_NAME="btn-dropdown-filter-selector";zi.SOURCE_BUTTON_PLACEHOLDER="Select a column";const tt=X.module("DropdownFilterPanel"),hE=250,ei=class extends S.exports.Component{constructor(t){super(t),this.getCachedValues=ge((d,{type:c,name:u},m)=>c!==void 0&&P.isDateType(c)?d.map(p=>ei.DATETIME_FORMATTER.format(p)):d.map(p=>p!=null&&c!=null?m.getFormattedString(p,c,u):null)),this.getCachedPanelLinks=ge((d,c)=>{const u=te.getIdFromPanel(c);return tt.debug("getCachedPanelLinks",d,u),d.filter(m=>{var p;return((p=m.end)==null?void 0:p.panelId)===u})}),this.getCachedSource=ge(d=>{tt.debug("getCachedSource",d);let c=null;if(d.length>0){const[u]=d;c=u.start,d.length>1&&tt.error("Filter has more that one link",d)}return c}),this.getCachedSourceTable=ge((d,c)=>{var m;if(tt.debug("getCachedSourceTable",d,c),c==null)return null;const{panelId:u}=c;return(m=d.get(u))!=null?m:null}),this.getCachedSourceColumn=ge((d,c)=>{var u;return tt.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=Xe(this.handleChange.bind(this),hE),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=Y.createRef(),this.panelContainer=Y.createRef(),this.pending=new ps;const{panelState:e,settings:n}=t;this.columnFormats=hs.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 hn(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{column:t,value:e,timestamp:n}=this.state,s=this.getSourceTable();if(s!==null&&this.startListeningToSource(s),t!=null){const{name:i,type:o}=t;this.sendUpdate(i,o,e,n)}}componentDidUpdate(t,e){const{valuesTable:n}=this.state,{settings:s}=this.props,i=this.getSource(),o=this.getSourceTable(),r=this.getSource(t),l=this.getSourceTable(t);s!==t.settings&&s!==void 0&&this.updateFormatterSettings(s),n!==e.valuesTable&&e.valuesTable!=null&&(tt.debug("Table in state modified, closing the old table."),e.valuesTable.close()),(o!==l||i!==r)&&this.updateValuesTable(),o!==l&&(l!==null&&this.stopListeningToSource(l),o!==null&&this.startListeningToSource(o))}componentWillUnmount(){const{valuesTable:t}=this.state,e=this.getSourceTable();this.pending.cancel(),e!==null&&this.stopListeningToSource(e),this.cleanup&&this.cleanup(),t!=null&&t.close()}getCoordinateForColumn(){var i;if(this.panelContainer.current==null)return null;const t=this.panelContainer.current.querySelector(`.${zi.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>ei.MAX_TABLE_SIZE)return`Table too large, must have fewer than ${ei.MAX_TABLE_SIZE} options.`}getPanelErrorMessage(){const{error:t}=this.state;return t!=null?`${t}`:void 0}getSource(t=this.props){const{dashboardLinks:e}=t,n=this.getCachedPanelLinks(e,this);return this.getCachedSource(n)}getSourceTable(t=this.props){const{panelTableMap:e}=t,n=this.getSource(t);return this.getCachedSourceTable(e,n)}getValuesColumn(t){const e=this.getSource();return this.getCachedSourceColumn(t,e)}startListeningToSource(t){tt.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){tt.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,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(){tt.debug("handleColumnSelected");const{glEventHub:t}=this.props;t.emit(Pe.COLUMN_SELECTED,this,ei.SOURCE_COLUMN)}handleClearAllFilters(){var t,e;(e=(t=this.dropdownFilterRef)==null?void 0:t.current)==null||e.clearFilter()}setPanelState(t,e=!1){var n,s;if(this.getSource()==null){tt.debug("Ignore state update for unlinked filter",t);return}this.setState({skipUpdate:!e}),(s=(n=this.dropdownFilterRef)==null?void 0:n.current)==null||s.setFilterState(t)}sendUpdate(t,e,n,s){var l;const{glEventHub:i}=this.props,o=(l=this.getSource())==null?void 0:l.panelId,r=o===null?[]:[o];tt.debug("sendUpdate",{name:t,type:e,value:n,timestamp:s,excludePanelIds:r}),i.emit(Pe.FILTERS_CHANGED,this,{name:t,type:e,value:n!=null?n:"=null",timestamp:s,excludePanelIds:r})}updateValuesTable(){const t=this.getSource(),e=this.getSourceTable();if(tt.debug("updateValuesTable",t,e),this.setState({values:[],valuesTable:void 0,error:null}),t==null){tt.debug("Filter unlinked."),this.setState({isLoading:!1,isLoaded:!0,isValueShown:!1,sourceSize:0});return}this.setState({isLoading:!0}),e!=null&&(this.setState({isLoaded:!1,sourceSize:e.size}),this.pending.add(e.copy(),n=>n.close()).then(n=>{this.updateViewportListener(n),this.setState({valuesTable:n})}).catch(n=>{Ee.isCanceled(n)||(tt.error(n),this.setState({isLoading:!1,error:n}))}))}applySourceSorts(){const{valuesTable:t}=this.state,e=this.getSourceTable();if(tt.debug("applySourceSorts",e.sort),t==null){tt.debug("Table not initialized");return}const n=[...e.sort];t.applySort(n),this.setViewport(t)}applySourceFilters(){const{valuesTable:t}=this.state,e=this.getSourceTable();if(tt.debug("applySourceFilters",e.filter),t==null){tt.debug("Table not initialized");return}const n=[...e.filter];t.applyFilter(n),this.setViewport(t)}updateViewportListener(t){if(tt.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 e=this.getValuesColumn(t);if(!e){tt.error("values column is null");return}t.setViewport(0,ei.MAX_TABLE_SIZE-1,[e])}updateFormatterSettings(t){const e=hs.getColumnFormats(t);ct(this.columnFormats,e)||(this.columnFormats=e,this.setState({formatter:new hn(e)}))}handleValuesTableUpdate({detail:t}){const{rows:e}=t,{valuesTable:n}=this.state;if(!n){tt.error("valuesTable is null");return}const s=this.getValuesColumn(n);if(!s){tt.error("Values column not found");return}const i=e.map(o=>o.get(s));this.setState({values:i,isLoading:!1,isLoaded:!0,valuesColumn:s})}handleSourceMouseEnter(){const{columnSelectionValidator:t}=this.props;!t||t(this,ei.SOURCE_COLUMN)}handleSourceMouseLeave(){const{columnSelectionValidator:t}=this.props;!t||t(this,void 0)}render(){const{columns:t,disableLinking:e,glContainer:n,glEventHub:s,isLinkerActive:i}=this.props,{column:o,formatter:r,isDisconnected:l,isValueShown:a,value:d,values:c,valuesColumn:u,isLoading:m,isLoaded:p}=this.state,g=this.getSource(),f=this.getSettingsErrorMessage(),b=this.getPanelErrorMessage(),C=p&&u!=null?this.getCachedValues(c,u,r):[];return h(kl,{errorMessage:b,isLoading:m,isLoaded:p,isDisconnected:l,className:"iris-dropdown-filter-panel",componentPanel:this,glContainer:n,glEventHub:s,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(zi,{ref:this.dropdownFilterRef,column:o,columns:t,isValueShown:a,isLinkerActive:i,disableLinking:e,isLoaded:p,settingsError:f,source:g,value:d,values:C,onChange:this.handleChange,onColumnSelected:this.handleColumnSelected,onSourceMouseEnter:this.handleSourceMouseEnter,onSourceMouseLeave:this.handleSourceMouseLeave})})})}};let to=ei;to.displayName="DropdownFilterPanel";to.COMPONENT="DropdownFilterPanel";to.MAX_TABLE_SIZE=256;to.DATETIME_FORMATTER=new lt({showTimeZone:!1,showTSeparator:!0,defaultDateTimeFormatString:"yyyy-MM-dd HH:mm:ss.SSSSSSSSS"});to.SOURCE_COLUMN=Object.freeze({name:"FilterSource",type:null});const uE=(t,e)=>{const{localDashboardId:n}=e,s=te.getIdFromPanel({props:e}),i=Bd(t,n),o=eo(t,n),r=Tl(t),l=$d(t,n),a=r===cn.LINKER&&(l===void 0||l===s),d=r===cn.LINKER&&l!==void 0&&l!==s;return{columns:hp(t,n),columnSelectionValidator:Wd(t,n),isLinkerActive:a,disableLinking:d,settings:Kt(t),panelTableMap:i,dashboardLinks:o}},di=Mt(uE,null,null,{forwardRef:!0})(to);function Gn(t){return t.type==="directory"}var gp=(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))(gp||{});class de{static fileExtensionToString(e=""){return e.length===0?"":`.${e}`}static getDepth(e){var s;if(!de.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(!de.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(!de.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=de.fileExtensionToString(n);return`${i}${o}`}static validateName(e){var o;const n=[".",".."],s=/[\\/\0]/g,i=new Map([["\0","null"]]);if(!e)throw new Oi("Name cannot be empty");if(n.includes(e))throw new Oi(`"${e}" is a reserved name`);if(s.test(e))throw new Oi(`Invalid characters in name: "${((o=e.match(s))!=null?o:[]).reduce((r,l)=>r.includes(l)?r:[...r,l],[]).map(r=>i.has(r)?i.get(r):r).join('", "')}"`)}static reducePaths(e){const n=e.filter(s=>de.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 xt=X.module("FileList"),Pa=t=>Gn(t)?de.makePath(t.filename):de.getPath(t.filename),qd=26,mE=500,Sh="item-list-scroll-pane",Ha=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(D=>D.id===r.id))!=null?I:!1,g=Pa(r),f=s&&a?Pa(a):null,b=s&&i&&Gn(r)&&f===g,C=s&&i&&f===g,w=s&&!i&&f===g,T=pE(r),E=de.getDepth(r.filename),y=Array(E).fill(null).map((D,N)=>h("span",{className:"file-list-depth-line"},N));return v("div",{className:W("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":w,"is-selected":o}),onDragStart:D=>d(l,D),onDragOver:D=>c(l,D),onDragEnd:D=>u(l,D),onDrop:D=>m(l,D),draggable:!0,role:"presentation","aria-label":r.basename,children:[y," ",h(q,{icon:T,className:"item-icon",fixedWidth:!0})," ",v("span",{className:"truncation-wrapper",children:[e!=null?e:r.basename,h(Ie,{options:{modifiers:{preventOverflow:{boundariesElement:"window"}},placement:"left"},children:e!=null?e:r.basename})]})]})};function pE(t){if(Gn(t))return t.isExpanded?df:cf;switch(de.getMimeType(t.basename)){case gp.PYTHON:return $f;default:return rf}}function wh(t,e){if(t.length===0||e==null)throw new Error("No items to move");const n=Pa(e);if(t.some(({filename:s})=>de.getPath(s)===n))throw new Error("File already in the destination folder");if(t.some(s=>Gn(s)&&n.startsWith(de.makePath(s.filename))))throw new Error("Destination folder cannot be a child of a dragged folder");return{files:t,targetPath:n}}const gE=t=>{const{isMultiSelect:e=!1,table:n,onFocusChange:s=()=>{},onMove:i,onSelect:o,onSelectionChange:r=()=>{},renderItem:l=Ha,rowHeight:a=qd,overscanCount:d=bn.DEFAULT_OVERSCAN}=t,[c,u]=S.exports.useState(()=>({items:[],offset:0,itemCount:0})),[m,p]=S.exports.useState({top:0,bottom:0}),[g,f]=S.exports.useState(),[b,C]=S.exports.useState(),[w,T]=S.exports.useState(),[E,y]=S.exports.useState([]),I=S.exports.useRef(null),D=S.exports.useRef(null),N=S.exports.useCallback(J=>{if(J.length===0||c==null)return[];const me=[];for(let fe=0;fe<J.length;fe+=1){const xe=J[fe];for(let _e=xe[0];_e<=xe[1];_e+=1)_e>=c.offset&&_e<c.offset+c.items.length&&me.push(c.items[_e-c.offset])}return me},[c]),x=S.exports.useCallback(J=>{const me=N([[J,J]]);if(me.length>0)return me[0]},[N]),U=S.exports.useCallback(()=>{const J=fn.count(E);if(J===0)return null;if(J===1){const me=E[0][0],fe=x(me);if(fe!=null)return fe.filename}return`${J} items`},[x,E]),$=S.exports.useCallback(J=>{var me;if(!(!b||!g)){xt.debug("dropItems",b,"to",J);try{const{files:fe,targetPath:xe}=wh(b,g);i(fe,xe),J!=null&&(y([[J,J]]),(me=I.current)==null||me.focusItem(J))}catch(fe){xt.error("Unable to complete move",fe)}}},[b,g,i]),L=S.exports.useCallback((J,me)=>{const fe=c.items[J-c.offset];fe!==void 0&&(xt.debug("handleItemClick",fe),o(fe,me),Gn(fe)&&(n==null||n.setExpanded(fe.filename,!fe.isExpanded)))},[c,o,n]),H=S.exports.useCallback((J,me)=>{var _e;xt.debug2("handleItemDragStart",J,E);let fe=E;fn.isSelected(E,J)||(fe=[[J,J]],y(fe)),C(N(fe)),(_e=I.current)==null||_e.resetMouseState();const xe=document.createElement("div");xe.innerHTML=`<div class="dnd-placeholder-content">${U()}</div>`,xe.className="file-list-dnd-placeholder",document.body.appendChild(xe),me.dataTransfer.setDragImage(xe,0,0),me.dataTransfer.effectAllowed="move",T(xe)},[U,N,E]),O=S.exports.useCallback((J,me)=>{me.preventDefault(),xt.debug2("handleItemDragOver",me),f(x(J))},[x]),F=S.exports.useCallback((J,me)=>{xt.debug("handleItemDragEnd",J),w==null||w.remove(),C(void 0),f(void 0),T(void 0)},[w]),_=S.exports.useCallback((J,me)=>{$(J)},[$]),k=S.exports.useCallback(()=>{xt.debug2("handleItemDragExit"),f(void 0)},[]),V=S.exports.useCallback(J=>{J.target instanceof Element&&J.target.classList.contains(Sh)&&(J.preventDefault(),xt.debug2("handleListDragOver",J),f({type:"directory",filename:"/",basename:"/",id:"/"}))},[]),z=S.exports.useCallback(J=>{J.target instanceof Element&&J.target.classList.contains(Sh)&&(xt.debug("handleListDrop"),$())},[$]),j=S.exports.useCallback(J=>{if(xt.debug2("handleSelectionChange",J),J!==E){y(J);const me=N(J);r(me)}},[N,r,E]),ee=S.exports.useCallback(J=>{if(xt.debug2("handleFocusChange",J),J!=null){const[me]=N([[J,J]]);s(me)}else s()},[N,s]),ve=S.exports.useCallback((J,me)=>{xt.debug("handleViewportChange",J,me),(J!==m.top||me!==m.bottom)&&p({top:J,bottom:me})},[m]),le=S.exports.useMemo(()=>{if(!b||!g)return!1;try{return wh(b,g),xt.debug("handleValidateDropTarget true"),!0}catch{return xt.debug("handleValidateDropTarget false"),!1}},[b,g]),{focusedPath:Se}=t;S.exports.useEffect(()=>{Se!==void 0&&(Se==="/"?n.collapseAll():(n.setExpanded(Se,!1),n.setExpanded(Se,!0)))},[n,Se]),S.exports.useEffect(function(){xt.debug("updating table viewport",m),n==null||n.setViewport({top:Math.max(0,m.top-d),bottom:m.bottom+d})},[d,n,m]),S.exports.useEffect(function(){const me=n.onUpdate(fe=>{u({items:fe.items.map(xe=>({...xe,itemName:xe.basename})),offset:fe.offset,itemCount:n.size})});return()=>{me()}},[n]),S.exports.useEffect(function(){if(g!=null&&Gn(g)&&g.filename!=="/"){const me=setTimeout(()=>{g.isExpanded||n==null||n.setExpanded(g.filename,!0)},mE);return()=>clearTimeout(me)}},[g,n]);const Oe=S.exports.useCallback(J=>l({...J,isDragInProgress:b!=null,dropTargetItem:g,draggedItems:b,isDropTargetValid:le,onDragStart:H,onDragEnd:F,onDragOver:O,onDragExit:k,onDrop:_}),[F,k,O,H,_,b,g,le,l]);return h("div",{ref:D,className:W("file-list",{"is-dragging":b!=null}),onDragOver:V,onDrop:z,children:h(bn,{ref:I,items:c.items,itemCount:c.itemCount,offset:c.offset,onFocusChange:ee,onSelect:L,onSelectionChange:j,onViewportChange:ve,selectedRanges:E,renderItem:Oe,rowHeight:a,isMultiSelect:e,isDragSelect:!1,isDeselectOnClick:!1})})};const fE={name:"File Explorer",DELETE:Be.createAndAdd({id:"FILE_EXPLORER.DELETE",name:"Delete",shortcut:[pe.DELETE],macShortcut:[ue.CMD,pe.BACKSPACE]}),RENAME:Be.createAndAdd({id:"FILE_EXPLORER.RENAME",name:"Rename",shortcut:[pe.ENTER],macShortcut:[pe.ENTER]})},vh={FILE_EXPLORER:fE};const Th=X.module("FileListItemEditor"),CE=({item:t,onCancel:e,onSubmit:n,validate:s=()=>Promise.resolve()})=>{const i=S.exports.useRef(null),[o,r]=S.exports.useState(t.basename),[l,a]=S.exports.useState(),[d,c]=S.exports.useState(Promise.resolve()),u=S.exports.useCallback(()=>{var C;(C=i.current)==null||C.focus()},[i]),m=S.exports.useCallback(C=>C.stopPropagation(),[]),p=S.exports.useCallback(()=>{d.then(()=>{n(o)}).catch(C=>Th.info("Unable to validate name",C))},[n,o,d]);S.exports.useEffect(function(){const w=Ee.makeCancelable(s(o));return w.then(()=>a(void 0)).catch(T=>{Ee.isCanceled(T)||a(T)}),c(w),()=>w.cancel()},[s,o]),S.exports.useEffect(function(){u()},[u]);const g=S.exports.useCallback(()=>{Th.debug2("handleBlur"),p()},[p]),f=S.exports.useCallback(C=>{const{value:w}=C.target;r(w)},[]),b=S.exports.useCallback(C=>{C.stopPropagation();const{key:w}=C;switch(w){case"Enter":{p();break}case"Escape":{e();break}}},[e,p]);return v("div",{className:"file-list-item-editor",children:[h("input",{type:"text",className:W("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}`})]})},fp=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=qd,validateRename:g=()=>Promise.resolve()}=t,[f,b]=S.exports.useState(),[C,w]=S.exports.useState([]),[T,E]=S.exports.useState(),y=S.exports.useCallback(k=>{w(k),u==null||u(k)},[u]),I=S.exports.useCallback(k=>{E(k)},[]),D=S.exports.useCallback(()=>{T&&(r==null||r(T))},[T,r]),N=S.exports.useCallback(()=>{C.length>0&&(l==null||l(C))},[l,C]),x=S.exports.useCallback(()=>{i==null||i()},[i]),U=S.exports.useCallback(()=>{T&&(o==null||o(de.getPath(T.filename)))},[T,o]),$=S.exports.useCallback(()=>{T&&b(T)},[T]),L=S.exports.useCallback(()=>{b(void 0)},[]),H=S.exports.useCallback(k=>{f&&(d==null||d(f,k),b(void 0))},[d,f]),O=S.exports.useMemo(()=>{if(f)return[];const k=[];return i&&k.push({title:"New File",description:"Create new file",action:x,group:ie.groups.medium}),o&&k.push({title:"New Folder",description:"Create new folder",action:U,group:ie.groups.medium}),r&&k.push({title:"Copy",description:"Copy",action:D,group:ie.groups.low,disabled:T==null||Gn(T)}),l&&C.length>0&&k.push({title:"Delete",description:"Delete",shortcut:vh.FILE_EXPLORER.DELETE,action:N,group:ie.groups.low}),d&&k.push({title:"Rename",description:"Rename",shortcut:vh.FILE_EXPLORER.RENAME,action:$,group:ie.groups.low,disabled:T==null}),k},[D,N,x,U,$,T,r,i,o,l,d,C,f]),F=S.exports.useCallback(k=>f?g(f,k):Promise.reject(new Error("No rename item")),[f,g]),_=S.exports.useCallback(k=>{const{item:V}=k;return f&&f.filename===V.filename?Ha({...k,children:h(CE,{item:V,validate:F,onSubmit:H,onCancel:L})}):Ha(k)},[L,H,f,F]);return v("div",{className:"file-list-container",children:[m!=null&&h(gE,{onMove:a,onSelect:c,onSelectionChange:y,onFocusChange:I,renderItem:_,rowHeight:p,table:m,isMultiSelect:e,focusedPath:n}),s&&h(ie,{actions:O})]})};fp.displayName="FileListContainer";class Or extends Oi{constructor(e){super("Name already exists"),this.isExistingFile=!0,this.info=e}}class Yd extends Error{constructor(){super("No file exists at the path specified"),this.isFileNotFound=!0}}const zs=X.module("FileExplorer"),Xd=t=>{const{storage:e,isMultiSelect:n=!1,focusedPath:s,onDelete:i=()=>{},onRename:o=()=>{},onSelect:r,onSelectionChange:l,rowHeight:a=qd}=t,[d,c]=S.exports.useState([]),[u,m]=S.exports.useState();S.exports.useEffect(function(){let D;async function N(){zs.debug("initTable"),D=Ee.makeCancelable(e.getTable(),x=>x.close());try{m(await D)}catch(x){Ee.isCanceled(x)||zs.error("Unable to initialize table",x)}}return N(),()=>{D.cancel()}},[e]);const p=S.exports.useCallback(I=>{Ee.isCanceled(I)||zs.error(I)},[]),g=S.exports.useCallback(I=>{zs.debug("handleDelete, pending confirmation",I),c(I)},[]),f=S.exports.useCallback(()=>{zs.debug("handleDeleteConfirm",d),d.forEach(I=>e.deleteFile(Gn(I)?de.makePath(I.filename):I.filename)),i(d),c([])},[d,i,e]),b=S.exports.useCallback(()=>{zs.debug("handleDeleteCancel"),c([])},[]),C=S.exports.useCallback((I,D)=>{de.reducePaths(I.map(x=>Gn(x)?de.makePath(x.filename):x.filename)).forEach(x=>{const U=de.isPath(x)?`${D}${de.getBaseName(x.substring(0,x.length-1))}/`:`${D}${de.getBaseName(x)}`;e.moveFile(x,U).then(()=>{o(x,U)}).catch(p)})},[p,o,e]),w=S.exports.useCallback((I,D)=>{let N=I.filename;const x=Gn(I);x&&!N.endsWith("/")&&(N=`${N}/`);let U=`${de.getParent(N)}${D}`;x&&!U.endsWith("/")&&(U=`${U}/`),zs.debug2("handleRename",N,U),e.moveFile(N,U).catch(p),o(N,U)},[p,o,e]),T=S.exports.useCallback(async(I,D)=>{if(D===I.basename)return;de.validateName(D);const N=`${de.getPath(I.filename)}${D}`;try{const x=await e.info(N);throw new Or(x)}catch(x){if(!(x instanceof Yd))throw x}},[e]),E=d.length>0,y=S.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 v("div",{className:"file-explorer",children:[u&&h(fp,{isMultiSelect:n,focusedPath:s,showContextMenu:!0,onMove:C,onDelete:g,onRename:w,onSelect:r,onSelectionChange:l,rowHeight:a,table:u,validateRename:T}),h(Hi,{isOpen:E,headerText:y,bodyText:"You cannot undo this action.",onCancel:b,onConfirm:f,confirmButtonText:"Delete"})]})};Xd.displayName="FileExplorer";const Gs=X.module("NewItemModal"),Ar=class extends S.exports.PureComponent{constructor(t){super(t),this.inputRef=Y.createRef(),this.pending=new ps,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=de.hasPath(e)?de.getPath(e):"/";this.state={isSubmitting:!1,path:n,prevExtension:de.getExtension(e),showExtensionChangeModal:!1,showOverwriteModal:!1,value:de.getBaseName(e)}}static getValidationMessage(t){return t instanceof Or&&t.info.type==="directory"?"Error: Cannot overwrite existing directory":`${t}`}static handleError(t){Ee.isCanceled(t)||Gs.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=de.hasPath(t)?de.getPath(t):"/";this.setState({path:e,value:de.getBaseName(t),validationError:void 0,prevExtension:de.getExtension(t),isSubmitting:!1})}getValidationPromise(t,e,n=!1){return this.cancelableValidatePromise&&this.cancelableValidatePromise.cancel(),this.cancelableValidatePromise=Ee.makeCancelable(this.validateName(t,e,n)),this.cancelableValidatePromise}async validateName(t,e,n){de.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 Or(r)}catch(r){if(!(r instanceof Yd))throw r}}return e}updateValidationStatus(t,e){this.getValidationPromise(t,e).then(()=>{this.setState({validationError:void 0})}).catch(this.handleValidationError).catch(Ar.handleError)}handleModalOpened(){this.focusRenameInput()}handleModalSubmit(){this.submitModal()}handleChange(t){const{value:e}=t.target;this.setState({value:e})}handleSelect(t){if(Gs.debug("handleSelect",t),t.type==="directory")this.setState({path:de.makePath(t.filename)});else{const e=t.basename,n=de.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 Oi))throw t;Gs.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;Gs.debug("handleOverwriteConfirm",e,n),t(`${e}${n}`)}handleExtensionChangeCancel(){Gs.debug("handleExtensionChangeCancel"),this.setState(({value:t,prevExtension:e})=>{const n=de.replaceExtension(t,e);return{showExtensionChangeModal:!1,value:n}}),this.submitModal(!0)}handleExtensionChangeConfirm(){Gs.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;Gs.debug("submitModal",e,n);const r=de.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 Or&&o!=="directory"&&l.info.type!=="directory"){this.setState({showOverwriteModal:!0});return}throw l}).catch(l=>{throw Ee.isCanceled(l)&&this.setState({isSubmitting:!1}),l}).catch(this.handleValidationError).catch(Ar.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}/`,v(Y.Fragment,{children:[h(Q,{kind:"ghost",className:"directory-breadcrumbs",onClick:()=>this.handleBreadcrumbSelect(i),"aria-label":s===0?"Home":void 0,icon:s===0?h(q,{icon:hf,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=de.fileExtensionToString(m),b=de.fileExtensionToString(p),C=g?"Create":"Save",w=g?"New folder name":"Save file as";return v(he,{children:[v(Oo,{isOpen:e,toggle:n,onOpened:this.handleModalOpened,className:"modal-dialog-centered new-file-modal theme-bg-dark",children:[h(Po,{toggle:n,children:i}),h(Ao,{children:h("form",{children:v("div",{className:"d-flex flex-column new-file-modal-content",children:[v("div",{className:"flex-grow-0 mb-4",children:[h("label",{htmlFor:"file-name-input",children:w}),h("input",{id:"file-name-input",type:"text",autoComplete:"off",autoCapitalize:"none",autoCorrect:"off",spellCheck:"false",className:W("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:Ar.getValidationMessage(c)})]}),v("div",{className:"flex-grow-0",children:[h("label",{children:"Directory: /"}),this.renderPathButtons(l)]}),h("div",{className:"flex-grow-1 file-explorer-container",children:h(Xd,{onSelect:this.handleSelect,storage:t,focusedPath:l})})]})})}),v(Za,{children:[h(Q,{kind:"secondary",onClick:n,children:"Cancel"}),h(Q,{kind:"primary",disabled:r,onClick:this.handleModalSubmit,children:C})]})]}),h(Hi,{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(Hi,{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 Al=Ar;Al.propTypes={isOpen:R.exports.bool,title:R.exports.string.isRequired,defaultValue:R.exports.string,type:R.exports.oneOf(["file","directory"]).isRequired,onSubmit:R.exports.func,onCancel:R.exports.func,placeholder:R.exports.string,storage:R.exports.shape({}).isRequired,notifyOnExtensionChange:R.exports.bool};Al.defaultProps={isOpen:!1,defaultValue:"/",notifyOnExtensionChange:!1,placeholder:"",onSubmit:t=>{},onCancel:()=>{}};const bE=({createFile:t,createFolder:e,onSearchChange:n,defaultSearchText:s=""})=>v("div",{className:"file-explorer-toolbar",children:[v("div",{className:"file-explorer-toolbar-buttons",children:[h(Q,{kind:"ghost",icon:su,tooltip:"New notebook",onClick:t,"aria-label":"New notebook"}),h(Q,{kind:"ghost",icon:Sf,tooltip:"New folder",onClick:e,"aria-label":"New folder"})]}),n&&h("div",{className:"file-explorer-toolbar-search",children:h(Eu,{value:s,onChange:n,placeholder:"Search by name"})})]});const Ii=X.module("FileExplorerPanel"),SE=(t,e)=>{const n=tm(t),s=gi(t,e.localDashboardId),{session:i,config:o}=s!=null?s:{},r=o==null?void 0:o.type;return{fileStorage:n,language:r,session:i}},wE=Mt(SE,null,null,{forwardRef:!0});function vE(t){const e=t;return e!=null&&typeof e.button=="number"}const Va=class extends Y.Component{static handleError(t){Ii.error(t)}static isFocusEvent(t){return vE(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:""};Ii.debug("handleCreateFile",e,n,s),t.emit(He.CREATE_NOTEBOOK,e,n,s)}handleCreateDirectory(t){this.setState({showCreateFolder:!0})}handleCreateDirectoryCancel(){Ii.debug("handleCreateDirectoryCancel"),this.setState({showCreateFolder:!1})}handleCreateDirectorySubmit(t){Ii.debug("handleCreateDirectorySubmit",t),this.setState({showCreateFolder:!1});const{fileStorage:e}=this.props;e.createDirectory(t).catch(Va.handleError)}handleDelete(t){const{glEventHub:e}=this.props;t.forEach(n=>{e.emit(He.CLOSE_FILE,{id:n.filename,itemName:n.filename})})}handleSelectionChange(t){let e="/";t.length===1&&(t[0].type==="directory"?e=de.makePath(t[0].filename):e=de.getPath(t[0].filename)),this.setState({focusedFilePath:e})}handleFileSelect(t,e){if(Ii.debug("fileSelect",t),t.type==="directory")return;const n=Va.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(He.SELECT_NOTEBOOK,o,r,l,s,n)}handleRename(t,e){const{glEventHub:n}=this.props;Ii.debug("handleRename",t,e),n.emit(He.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 v(Yn,{className:"file-explorer-panel",componentPanel:this,glContainer:e,glEventHub:n,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,onShow:this.handleShow,children:[h(bE,{createFile:this.handleCreateFile,createFolder:this.handleCreateDirectory}),s&&h(Xd,{isMultiSelect:!0,storage:t,onDelete:this.handleDelete,onRename:this.handleRename,onSelect:this.handleFileSelect,onSelectionChange:this.handleSelectionChange}),h(Al,{isOpen:i,type:"directory",title:"Create New Folder",storage:t,onSubmit:this.handleCreateDirectorySubmit,onCancel:this.handleCreateDirectoryCancel,defaultValue:o})]})}};let jd=Va;jd.COMPONENT="FileExplorerPanel";jd.TITLE="File Explorer";const Jr=wE(jd);const it=X.module("FilterSetManager"),TE="Enter name...",Eh="No Available Filter Sets";class el extends S.exports.Component{constructor(e){super(e),this.renameInputRef=Y.createRef(),this.dropdownRef=Y.createRef(),this.editDropdownRef=Y.createRef(),this.isRenamingExistingSet=ge((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;it.debug("initSettingsScreen",e,n),this.setState({modifiedFilterSets:[...e],editId:n})}updateSelectedId(){const{isValueShown:e,filterSets:n,selectedId:s,onChange:i}=this.props;if(it.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:[]}),it.debug("Update sets",s,i),n(s),s.length>0&&e({isValueShown:!0,selectedId:i})}handleCaptureNewSet(){const{getFilterState:e}=this.props;el.animateScreenFlash();const n=ze(),s=e(),i={id:n,title:"",panels:s};it.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 it.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 it.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){it.error("Renamed set undefined.");return}const o=this.getNameError(e);if(it.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,it.debug("Renamed existing set",d)):(d.push(l),it.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 it.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 it.debug("Deleted selected set",n,s,o),it.debug("New selection",r,l),{modifiedFilterSets:o,editId:l}})}handleSetUpdate(){const{getFilterState:e}=this.props;el.animateScreenFlash();const n=e();this.setState(({modifiedFilterSets:s,editId:i})=>{if(i===void 0)return it.error("Filter for update not selected."),null;const o=[...s],r=o.findIndex(({id:l})=>l===i);return r<0?(it.error("Selected set for update not found."),null):(o[r]={...o[r],panels:n},it.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 it.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){it.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){it.debug("No filter selected");return}const i=s.find(({id:o})=>o===e);if(i===void 0){it.debug("Selected id not found in filterSets",e,s);return}it.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=v("div",{className:"fa-layers mr-3",children:[h(q,{icon:Fo,mask:wa,transform:"shrink-1 down-5 right-7"}),h(q,{icon:Ls,className:"text-primary",transform:"shrink-6 down-5 right-7"})]}),b=v("div",{className:"fa-layers",children:[h(q,{icon:Fo,mask:wa,transform:"shrink-1 down-5 right-7"}),h(q,{icon:Sa,transform:"shrink-1 down-5 right-7"})]});return h("div",{className:"filter-set-manager fill-parent-absolute",children:v(Ja,{className:"w-100 h-100",isFlipped:l,children:[h("div",{className:"filter-set-manager-settings-card fill-parent-absolute",children:v("div",{className:"filter-set-manager-card-content",children:[p&&v("div",{children:[h(Q,{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&&v("div",{className:"d-flex flex-column justify-content-center","data-testid":"edit-filter-set-container",children:[v("div",{className:"form-group",children:[h("label",{children:u?"Edit set":"Name captured set"}),v("div",{className:"name-input-container",children:[h("input",{type:"text",className:"input-set-name form-control",placeholder:TE,value:e,ref:this.renameInputRef,onChange:this.handleNameInputChange,onKeyPress:this.handleNameInputKeyPress,spellCheck:"false"}),h(Q,{"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:iu}),h(Q,{"data-testid":"rename-cancel-button",kind:"ghost",className:"btn btn-link no-underline pt-2 pb-2",onClick:this.handleRenameCancel,tooltip:"Cancel",icon:sf})]}),n!==void 0&&h("div",{className:"error-message",children:n})]}),h("div",{className:"form-group",children:v(pl,{onChange:this.handleRestoreFullStateChange,value:`${r}`,children:[h(Mn,{value:"false",children:"Restore only filters"}),h(Mn,{value:"true",children:"Restore full table state"})]})})]}),g&&v("div",{className:"filter-set-manager-settings-grid-1",children:[v("div",{className:"form-group",children:[h("label",{children:"Edit filter sets"}),v("div",{className:"filter-select-container",children:[v("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:Eh}),o.map(({id:C,title:w})=>h("option",{value:C,children:w},C))]}),h(Q,{kind:"ghost",onClick:this.handleSetUpdate,disabled:m,icon:b,tooltip:"Update"}),h(Q,{kind:"ghost",onClick:this.handleSetEdit,disabled:m,icon:ll,tooltip:"Edit"}),h(Q,{kind:"ghost",onClick:this.handleSetDelete,disabled:m,icon:xn,tooltip:"Delete"})]})]}),h("div",{children:h(Q,{kind:"ghost",className:"btn btn-link no-underline",onClick:this.handleCaptureNewSet,icon:f,children:"Capture new filter set"})}),v("div",{className:"py-3 text-right",children:[h(Q,{kind:"secondary",onClick:this.handleSettingsCancel,children:"Cancel"}),"\xA0",h(Q,{kind:"primary",onClick:this.handleSettingsSave,children:"Save"})]})]})]})},"front"),h("div",{className:"filter-set-manager-value-card fill-parent-absolute",onClick:this.handleBackgroundClick,children:v(he,{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:v("div",{className:"filter-select-container",children:[v("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:Eh}),a.map(({id:C,title:w})=>h("option",{value:C,children:w},C))]}),h(Q,{"data-testid":"filter-apply-button",kind:"ghost",onClick:this.handleFilterApply,icon:od,tooltip:"Apply Filter Set"})]})})}),h("div",{className:"filter-set-manager-menu",children:h(Q,{kind:"ghost",className:"btn btn-link btn-link-icon m-2 px-2",onClick:this.handleSettingsClick,tooltip:"Settings",icon:h(q,{icon:Vo,transform:"grow-4"})})})]})},"back")]})})}}const Hn=X.module("IrisGridPanel"),EE=500,yE={IrisGrid:Ji,IrisGridTableModel:lp,ContextMenuRoot:mu};class Gi extends S.exports.PureComponent{constructor(e){super(e),this.getGridInputFilters=ge((s,i)=>se.getInputFiltersForColumns(s,i.filter(({value:o,excludePanelIds:r})=>{const l=te.getIdFromPanel(this);return o!=null&&(r==null||l!=null&&!r.includes(l))}))),this.getAlwaysFetchColumns=ge((s,i)=>{const o=te.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=ge((s,i,o,r,l)=>!i||!oi(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:yE,onStateChange:this.handlePluginStateChange,pluginState:l})})),this.getDehydratedIrisGridPanelState=ge((s,i,o,r)=>se.dehydrateIrisGridPanelState(s,{isSelectingPartition:i,partition:o,partitionColumn:r})),this.getDehydratedIrisGridState=ge((s,i,o,r,l,a,d,c,u,m,p,g,f,b,C,w,T,E,y,I)=>se.dehydrateIrisGridState(s,{advancedFilters:o,aggregationSettings:T,customColumnFormatMap:r,isFilterBarShown:l,metrics:{userColumnWidths:C,userRowHeights:w},quickFilters:a,customColumns:d,reverseType:c,rollupConfig:u,showSearchBar:m,searchValue:p,selectDistinctColumns:g,selectedSearchColumns:f,sorts:i,invertSearchColumns:b,pendingDataMap:E,frozenColumns:y,conditionalFormats:I})),this.getDehydratedGridState=ge((s,i,o,r,l)=>se.dehydrateGridState(s,{isStuckToBottom:r,isStuckToRight:l,movedColumns:i,movedRows:o})),this.getCachedPanelState=ge((s,i,o,r)=>({irisGridPanelState:s,irisGridState:i,gridState:o,pluginState:r})),this.savePanelState=Xe(()=>{const{irisGridState:s,gridState:i,pluginState:o}=this;A(s);const{onPanelStateUpdate:r}=this.props,{model:l,panelState:a,isSelectingPartition:d,partition:c,partitionColumn:u}=this.state,{advancedFilters:m,aggregationSettings:p,customColumnFormatMap:g,isFilterBarShown:f,quickFilters:b,customColumns:C,reverseType:w,rollupConfig:T,showSearchBar:E,searchValue:y,selectDistinctColumns:I,selectedSearchColumns:D,sorts:N,invertSearchColumns:x,metrics:U,pendingDataMap:$,frozenColumns:L,conditionalFormats:H}=s;A(U);const{userColumnWidths:O,userRowHeights:F}=U;A(i);const{isStuckToBottom:_,isStuckToRight:k,movedColumns:V,movedRows:z}=i,j=this.getCachedPanelState(this.getDehydratedIrisGridPanelState(l,d,c,u),this.getDehydratedIrisGridState(l,N,m,g,f,b,C,w,T,E,y,I,D,x,O,F,p,$,L,H),this.getDehydratedGridState(l,V,z,_,k),o);j!==a&&(Hn.debug("Saving panel state",this,j),this.setState({panelState:j}),r==null||r(j))},EE),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=Y.createRef(),this.pluginRef=Y.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(cw.DEFAULTS),customColumns:[],customColumnFormatMap:new Map,isFilterBarShown:!1,quickFilters:new Map,sorts:[],userColumnWidths:new Map,userRowHeights:new Map,reverseType:P.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=Ee.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=se.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();Hn.debug("initModelQueue",i),i&&i(s),this.setState({modelQueue:n})}handleAdvancedSettingsChange(e,n){Hn.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;A(n);const{columns:s,formatter:i}=n,o=se.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(wt.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):(A(s),this.initModelQueue(s,i))}handleTableChanged(e){Hn.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(ft.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=te.getIdFromPanel(this);let d;l&&(d=se.extractTableSettings(l,i)),s.emit(wt.CREATE_CHART,{metadata:{settings:e,sourcePanelId:a,table:r,tableSettings:d},table:oi(n)?n.table:void 0})})}handleColumnSelected(e){const{glEventHub:n}=this.props;n.emit(wt.COLUMN_SELECTED,this,e)}handleDataSelected(e,n){const{glEventHub:s}=this.props;s.emit(wt.DATA_SELECTED,this,n)}handleResize(){this.updateGrid()}handleShow(){this.updateGrid()}handleTabClicked(){this.irisGrid.current&&this.irisGrid.current.focus()}handleError(e){Hn.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){Ee.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}),oi(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){Hn.debug2("sendColumnsChange",e);const{glEventHub:n}=this.props;n.emit(Pe.COLUMNS_CHANGED,this,e)}startModelListening(e){e.addEventListener(be.EVENT.DISCONNECT,this.handleDisconnect),e.addEventListener(be.EVENT.RECONNECT,this.handleReconnect),e.addEventListener(be.EVENT.COLUMNS_CHANGED,this.handleColumnsChanged),e.addEventListener(be.EVENT.TABLE_CHANGED,this.handleTableChanged)}stopModelListening(e){e.removeEventListener(be.EVENT.DISCONNECT,this.handleDisconnect),e.removeEventListener(be.EVENT.RECONNECT,this.handleReconnect),e.removeEventListener(be.EVENT.COLUMNS_CHANGED,this.handleColumnsChanged),e.removeEventListener(be.EVENT.TABLE_CHANGED,this.handleTableChanged)}getCoordinateForColumn(e){var w,T,E;const{model:n}=this.state;if(!n)return null;const s=this.irisGrid.current,{gridWrapper:i}=s||{},o=(w=i==null?void 0:i.getBoundingClientRect())!=null?w:null;if(o==null||o.width<=0||o.height<=0)return null;A(s);const{metrics:r}=s.state;A(r);const{columnHeaderHeight:l,visibleColumnXs:a,visibleColumnWidths:d,right:c,columnHeaderMaxDepth:u}=r,m=n.getColumnIndexByName(e);A(m);const p=s.getVisibleColumn(m),g=(T=a.get(p))!=null?T:0,f=(E=d.get(p))!=null?E: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}){Hn.debug("setFilters",e,n);const{model:s,isDisconnected:i}=this.state,o=this.irisGrid.current;if(o==null||i){Hn.debug("Ignore setFilters, model disconnected");return}A(s);const{columns:r,formatter:l}=s,a=se.changeFilterColumnNamesToIndexes(s.columns,e).filter(([c])=>s.isFilterable(c)),d=se.changeFilterColumnNamesToIndexes(s.columns,n).filter(([c])=>s.isFilterable(c));o.clearAllFilters(),o.setFilters({quickFilters:se.hydrateQuickFilters(r,a,l.timeZone),advancedFilters:se.hydrateAdvancedFilters(r,d,l.timeZone)})}setStateOverrides(e){Hn.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=se.changeFilterColumnNamesToIndexes(e.columns,d)),c&&(a.advancedFilters=se.changeFilterColumnNamesToIndexes(e.columns,c));const{isSelectingPartition:u,partition:m,partitionColumn:p}=se.hydrateIrisGridPanelState(e,l),{advancedFilters:g,customColumns:f,customColumnFormatMap:b,isFilterBarShown:C,quickFilters:w,reverseType:T,rollupConfig:E,aggregationSettings:y,sorts:I,userColumnWidths:D,userRowHeights:N,showSearchBar:x,searchValue:U,selectDistinctColumns:$,selectedSearchColumns:L,invertSearchColumns:H,pendingDataMap:O,frozenColumns:F,conditionalFormats:_}=se.hydrateIrisGridState(e,{...r,...a}),{isStuckToBottom:k,isStuckToRight:V,movedColumns:z,movedRows:j}=se.hydrateGridState(e,{...o,...i},r.customColumns);this.setState({advancedFilters:g,conditionalFormats:_,customColumns:f,customColumnFormatMap:b,isFilterBarShown:C,isSelectingPartition:u,movedColumns:z,movedRows:j,partition:m,partitionColumn:p,quickFilters:w,reverseType:T,rollupConfig:E,aggregationSettings:y,sorts:I,userColumnWidths:D,userRowHeights:N,showSearchBar:x,searchValue:U,selectDistinctColumns:$,selectedSearchColumns:L,invertSearchColumns:H,pendingDataMap:O,frozenColumns:F,isStuckToBottom:k,isStuckToRight:V})}catch(o){Hn.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 Ht,Vt,kn;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:w,customColumnFormatMap:T,error:E,isDisconnected:y,isFilterBarShown:I,isSelectingPartition:D,isStuckToBottom:N,isStuckToRight:x,isLoaded:U,isLoading:$,isModelReady:L,model:H,movedColumns:O,movedRows:F,partition:_,partitionColumn:k,quickFilters:V,reverseType:z,rollupConfig:j,sorts:ee,userColumnWidths:ve,userRowHeights:le,showSearchBar:Se,searchValue:Oe,selectDistinctColumns:J,selectedSearchColumns:me,invertSearchColumns:fe,Plugin:xe,pluginFilters:_e,pluginFetchColumns:un,pendingDataMap:Xn,frozenColumns:wn}=this.state,Ct=E!=null?`Unable to open table. ${E}`:void 0,{table:Re}=a,nt=(Ht=H==null?void 0:H.description)!=null?Ht:void 0,st=(Vt=d==null?void 0:d.pluginState)!=null?Vt:null,Nt=e!=null?e:this.getPluginContent(xe,H,c,u,st),{permissions:Yt}=c,{canCopy:Xt,canDownloadCsv:Ft}=Yt,jn=H==null?void 0:H.displayString((kn=H==null?void 0:H.rowCount)!=null?kn:0,"long");return v(kl,{errorMessage:Ct,isDisconnected:y,isLoading:$,isLoaded:U,className:"iris-grid-panel",glContainer:n,glEventHub:s,onClearAllFilters:this.handleClearAllFilters,onResize:this.handleResize,onShow:this.handleShow,onTabFocus:this.handleShow,onTabClicked:this.handleTabClicked,widgetName:Re,widgetType:"Table",description:nt,componentPanel:this,renderTabTooltip:()=>h(_l,{widgetType:"Table",widgetName:Re,glContainer:n,description:nt,children:v("div",{className:"column-statistics-grid",children:[h("span",{className:"column-statistic-operation",children:"Number of Rows"}),h("span",{className:"column-statistic-value",children:jn})]})}),children:[L&&H&&h(Ji,{advancedFilters:g,aggregationSettings:f,advancedSettings:b,alwaysFetchColumns:this.getAlwaysFetchColumns(l,un),columnAllowedCursor:"linker",columnNotAllowedCursor:"not-allowed",customColumns:w,customColumnFormatMap:T,columnSelectionValidator:this.isColumnSelectionValid,conditionalFormats:C,inputFilters:this.getGridInputFilters(H.columns,r),applyInputFiltersOnInit:d==null,isFilterBarShown:I,isSelectingColumn:i!=null,isSelectingPartition:D,isStuckToBottom:N,isStuckToRight:x,movedColumns:O,movedRows:F,partition:_,partitionColumn:k,quickFilters:V,reverseType:z,rollupConfig:j,settings:m,sorts:ee,userColumnWidths:ve,userRowHeights:le,model:H,showSearchBar:Se,searchValue:Oe,selectedSearchColumns:me,selectDistinctColumns:J,invertSearchColumns:fe,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:_e,pendingDataMap:Xn,canCopy:Xt,canDownloadCsv:Ft,ref:this.irisGrid,getDownloadWorker:o,frozenColumns:wn,theme:p,children:Nt}),!L&&h(he,{})]})}}Gi.defaultProps={onStateChange:()=>{},onPanelStateUpdate:()=>{}};Gi.displayName="IrisGridPanel";Gi.COMPONENT="IrisGridPanel";const IE=(t,{localDashboardId:e=Rn})=>({inputFilters:Ud(t,e),links:eo(t,e),columnSelectionValidator:Wd(t,e),user:Ju(t),workspace:wl(t),settings:Kt(t)}),ci=Mt(IE,null,null,{forwardRef:!0})(Gi);const yh=X.module("InputFilter"),RE=150,Ua=class extends S.exports.Component{constructor(t){super(t),this.getItemLabel=Te((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=Xe(()=>{const{onChange:i}=this.props,{column:o,value:r,isValueShown:l}=this.state;i({column:o,isValueShown:l,value:r})},RE),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=Y.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)];yh.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;yh.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?Ua.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 v(Ja,{className:"input-filter fill-parent-absolute",isFlipped:n!=null?n:!1,children:[h("div",{className:"input-filter-settings-card",children:v("div",{className:"input-filter-settings-content",children:[v("div",{className:"input-filter-settings-grid",children:[h("label",{children:"Filter Column"}),v("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."})]}),v("div",{className:"input-filter-settings-buttons",children:[h(Q,{kind:"secondary",onClick:this.handleSettingsCancel,disabled:e==null,children:"Cancel"}),h(Q,{kind:"primary",className:"ml-2",onClick:this.handleSettingsSave,disabled:s==null,children:"Save"})]})]})}),v("div",{className:"input-filter-value-card",onClick:this.handleBackgroundClick,children:[h("div",{className:"input-filter-column",children:v("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:Ua.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(Q,{kind:"ghost",className:"m-2 px-2",onClick:this.handleSettingsClick,icon:h(q,{icon:Vo,transform:"grow-4"}),tooltip:"Input Filter Settings"})})]})]})}};let Qd=Ua;Qd.PLACEHOLDER="Enter value...";Qd.defaultProps={column:null,isValueShown:!1,value:null};const DE=250;class Pl extends S.exports.Component{constructor(e){super(e),this.handleChange=Xe(this.handleChange.bind(this),DE),this.handleClearAllFilters=this.handleClearAllFilters.bind(this),this.inputFilterRef=Y.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,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(Yn,{className:"iris-input-filter-panel",componentPanel:this,glContainer:e,glEventHub:n,onClearAllFilters:this.handleClearAllFilters,isClonable:!0,isRenamable:!0,children:h(Qd,{ref:this.inputFilterRef,column:s,columns:i,onChange:this.handleChange,isValueShown:o,value:r})})}}Pl.defaultProps={panelState:null};Pl.COMPONENT="InputFilterPanel";Pl.displayName="InputFilterPanel";const ME=(t,e)=>{const{localDashboardId:n}=e;return{columns:hp(t,n)}},Ro=Mt(ME,null,null,{forwardRef:!0})(Pl);const Rt=X.module("FilterSetManagerPanel");function NE(t){return t.setPanelState!=null}const Ba=class extends S.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){Rt.error("Could not get panel",s);return}const i=te.getComponentNameFromPanel(s),o=te.getIdFromPanel(s);Rt.debug("Panel:",s,i);const{glContainer:r=null}=s.props;if(r==null){Rt.error("Could not get panel container",s);return}const l=te.getComponentConfigFromContainer(r);if(l==null){Rt.error("Could not get component config from container",r);return}const a=te.getPanelComponentState(l);if(a==null){Rt.debug(`Panel state is null ${o}`);return}switch(i){case te.getComponentName(Gi):{let d;o!=null&&(d=this.getIrisGridPanelFilters(o,a)),d!=null&&e.push({panelId:o,type:i,state:d});break}case te.getComponentName(Ro):case te.getComponentName(di):{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 Rt.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=Ba.changeFilterIndexesToColumnNames(s,r));let d;return l&&(d=Ba.changeFilterIndexesToColumnNames(s,l)),{irisGridState:{...i,advancedFilters:a,quickFilters:d},gridState:{...o}}}handleGetFilterState(){return this.getFilterState()}handleChange({isValueShown:t,selectedId:e}){Rt.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;Rt.debug("Apply filters from filter set",t),n.forEach(({panelId:i,type:o,state:r})=>{if(i==null){Rt.debug("panel is null",i);return}if(!e.has(i)){Rt.debug("Ignore closed panel",i);return}Rt.debug("Apply panel filters",i,o,r);const l=e.get(i);switch(o){case te.getComponentName(Gi):this.restoreIrisGridFilters(l,r,s);break;case te.getComponentName(Ro):case te.getComponentName(di):this.restoreInputFilterState(l,r);break}})}handleSetsUpdate(t){const{setDashboardFilterSets:e,localDashboardId:n}=this.props;Rt.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=te.getIdFromPanel(t);if(d==null){Rt.error("Panel Id is null.");return}if(a.get(d)==null){Rt.error(`Unable to get table for panel ${d}.`);return}Rt.debug("restoreIrisGridFilters",d,e,n),n?t.setStateOverrides(e):t.setFilters({quickFilters:l,advancedFilters:r})}restoreInputFilterState(t,e){const n={...e};delete n.isValueShown,Rt.debug("restoreInputFilterState",t,n),t&&NE(t)&&t.setPanelState(n)}render(){const{glContainer:t,glEventHub:e,filterSets:n}=this.props,{isValueShown:s,selectedId:i}=this.state;return h(Yn,{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(el,{onChange:this.handleChange,onApply:this.handleFilterApply,onUpdateSets:this.handleSetsUpdate,isValueShown:s,filterSets:n,selectedId:i,getFilterState:this.handleGetFilterState})})})}};let Zd=Ba;Zd.defaultProps={panelState:null};Zd.COMPONENT="FilterSetManagerPanel";const FE=(t,e)=>{const{localDashboardId:n}=e;return{filterSets:qT(t,n),dashboardOpenedPanelMap:Lm(t,n),dashboardInputFilters:Ud(t,n),panelTableMap:Bd(t,n)}},ma=Mt(FE,{setDashboardFilterSets:tE},null,{forwardRef:!0})(Zd);const Ih=X.module("LogPanel");class Hl extends S.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){Ih.debug("Session opened",[e]),this.setState({session:e})}handleSessionClosed(e){Ih.debug("Session closed",e)}updateDimensions(){this.logView&&this.logView.updateDimensions()}render(){const{glContainer:e,glEventHub:n}=this.props,{session:s}=this.state;return v(Yn,{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(Yi,{session:s,ref:i=>{this.logView=i}})]})}}Hl.defaultProps={session:null};Hl.COMPONENT="LogPanel";Hl.TITLE="Log";const xE=(t,e)=>{var n;return{session:(n=gi(t,e.localDashboardId))==null?void 0:n.session}},tl=Mt(xE,null,null,{forwardRef:!0})(Hl);class Cp extends S.exports.PureComponent{render(){const{isEditing:e,children:n,onDoubleClick:s}=this.props;return v("div",{className:"markdown-editor-container h-100 w-100",onDoubleClick:s,children:[h("div",{className:W("text-muted","edit-hint",{viewing:e===void 0||!e}),children:v("span",{children:["double-click to edit ",h(q,{icon:ll})]})}),n]})}}Cp.defaultProps={isEditing:!1};const _E=X.module("MarkdownStartPage");class bp extends S.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(_E.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:v("div",{className:"markdown-panel-start-page-container",children:[v("div",{className:"markdown-panel-start-list",children:[h("h3",{className:"list-title",children:"Start"}),h("div",{className:"list-item",children:h(Q,{kind:"ghost",className:"title",onClick:s,children:"New Markdown Note"})})]}),v("div",{className:"markdown-panel-start-list",children:[h("h3",{className:"list-title",children:"Recently Closed from Dashboard"}),e.map(r=>v("div",{className:"list-item",children:[h(Q,{kind:"ghost",className:"title",onClick:()=>n(r),children:r.title}),h("button",{className:"btn-link icon",type:"button",onClick:()=>{this.handleDeleteButtonClick(r)},children:h(q,{icon:xn})})]},r.id)),v(Oo,{isOpen:i,toggle:this.handleDeleteModalClose,className:"modal-dialog-centered markdown-delete-modal theme-bg-light",children:[h(Po,{children:"Are you sure you want to permanently delete this note?"}),h(Ao,{children:"You can't undo this action."}),v(Za,{children:[h(Q,{kind:"secondary",onClick:this.handleDeleteModalClose,children:"Cancel"}),h(Q,{kind:"danger",onClick:()=>{this.handleDeleteMarkdown(o)},children:"Delete"})]})]})]})]})})}}bp.defaultProps={closedMarkdowns:[],onOpen:()=>{},onCreate:()=>{},onDelete:()=>{}};class Sp extends S.exports.PureComponent{constructor(e){super(e),this.renderMarkdown=n=>{const{children:s,className:i}=n,o=i!==void 0&&(i==null?void 0:i.startsWith("language-"))?i.substring(9):"plaintext";return h("pre",{children:h("code",{children:h(Cl,{language:o,children:Y.Children.map(s,r=>typeof r=="string"?r.trim():r)})})})},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(bl,{settings:{language:"markdown",value:n,lineNumbers:"off"},onEditorInitialized:s}):h(Gh,{components:{code:this.renderMarkdown},children:n})})}}Sp.defaultProps={isEditing:!1,content:""};const Ir=X.module("MarkdownPanel");class Jd extends S.exports.Component{constructor(e){super(e),this.getClosedMarkdowns=ge(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;A(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){Ir.debug("Markdown Editor Initialized..."),this.editor=e}handleCreateMarkdown(){Ir.debug("create markdown..."),this.setState({isStartPageShown:!1,content:"",isEditing:!0,panelState:{content:""}},()=>{this.editor!=null&&this.editor.focus!=null&&this.editor.focus()})}handleOpenMarkdown(e){Ir.debug("open markdown...",e);const{glContainer:n,glEventHub:s}=this.props,i=te.getComponentConfigFromContainer(n);s.emit(Me.REOPEN,e,i)}handleDeleteMarkdown(e){const{glEventHub:n}=this.props;n.emit(Me.DELETE,e)}handleEditorBlur(e){var i;Ir.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(Yn,{glContainer:e,glEventHub:n,className:"markdown-panel",componentPanel:this,onResize:this.handleEditorResize,onBlur:this.handleEditorBlur,isClonable:!0,isRenamable:!0,children:o?h(bp,{closedMarkdowns:l,onCreate:this.handleCreateMarkdown,onOpen:this.handleOpenMarkdown,onDelete:this.handleDeleteMarkdown}):h(Cp,{isEditing:i,onDoubleClick:this.handleContainerDoubleClick,children:h(Sp,{ref:a=>{this.markdownEditor=a},isEditing:i,content:r!=null?r:void 0,onEditorInitialized:this.handleEditorInitialized})})})}}Jd.defaultProps={panelState:null};Jd.COMPONENT="MarkdownPanel";const kE=(t,e)=>{const{localDashboardId:n}=e;return{closedPanels:sw(t,n)}},po=Mt(kE,null,null,{forwardRef:!0})(Jd);class wp extends S.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=Y.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;A(d);const{start:c}=d,{line:u}=c,m=a[0].value,p=Y.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),v("div",{className:W("markdown-notebook-code-block",{"is-selected":f}),ref:p,onClick:()=>{this.setState({nextStartLine:u})},role:"presentation",children:[h(Q,{kind:"ghost",icon:Br,className:"btn-play-block",onClick:C=>{C.stopPropagation(),C.preventDefault(),this.runCode(m),this.setState({nextStartLine:u})},tooltip:"Run code"}),h("code",{children:h(Cl,{language:b,children:Y.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 v("div",{className:"markdown-notebook",children:[h("div",{className:"markdown-notebook-toolbar",children:h(Q,{className:W("btn-play-selected-cell",{flashing:i&&!o}),kind:"ghost",icon:Br,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(Gh,{components:{code:this.renderCodeBlock,a:this.renderLink},linkTarget:"_blank",remarkPlugins:[Qp],transformLinkUri:s,transformImageUri:n,includeElementIndex:!0,children:e})})]})}}wp.defaultProps={onRunCode:()=>{}};const $e=X.module("NotebookPanel"),Rh=400,Ni=class extends S.exports.Component{constructor(t){super(t),this.getOverflowActions=ge(()=>[{title:"Find",icon:kf,action:this.handleFind,group:ie.groups.high,shortcut:Nn.NOTEBOOK.FIND,order:10}]),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.handleEditorChange=this.handleEditorChange.bind(this),this.handleFind=this.handleFind.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.pending=new ps,this.debouncedSavePanelState=Xe(this.savePanelState.bind(this),Rh),this.debouncedLoad=Xe(this.load.bind(this),Rh),this.notebook=null,this.tabTitleElement=null,this.tabInitOnce=!1,this.shouldPromptClose=!0;const{isDashboardActive:e,session:n,sessionLanguage:s,panelState:i}=t;let o={value:"",language:""},r=null,{isPreview:l}=t;i!=null&&({fileMetadata:r=r,isPreview:l=l,settings:o=o}=i);const a=r!=null&&de.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:""},$e.debug("constructor",t,this.state)}static handleError(t){Ee.isCanceled(t)||$e.error(t)}static languageFromFileName(t){switch(de.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(He.RENAME_FILE,this.handleRenameFile),t.on("tabClicked",this.handlePanelTabClick)}componentDidUpdate(t,e){const{isPreview:n}=this.state;n!==e.isPreview&&this.setPreviewStatus()}componentWillUnmount(){this.debouncedSavePanelState.flush(),this.pending.cancel();const{glContainer:t,glEventHub:e}=this.props,{fileMetadata:n,isPreview:s}=this.state;e.off(He.RENAME_FILE,this.handleRenameFile),t.off("tabClicked",this.handlePanelTabClick),e.emit(He.UNREGISTER_FILE,n,s)}initTab(t){this.tabInitOnce||(this.tabInitOnce=!0,this.initTabCloseOverride()),this.initTabClasses(t)}initTabCloseOverride(){const{glContainer:t}=this.props,e=t.close.bind(t);t.close=()=>{const{changeCount:n,savedChangeCount:s}=this.state;return n!==s&&this.shouldPromptClose?this.setState({showCloseModal:!0}):e(),!0}}initTabClasses(t){const e=t.element.get(0);A(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){$e.debug("Init content from file"),this.registerFileMetadata(t,n),this.load();return}if(e.value!=null){$e.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(He.CLOSE_FILE,{id:t})}registerFileMetadata(t,e){const{glEventHub:n,metadata:s}=this.props,{id:i}=s;n.emit(He.REGISTER_FILE,i,t,e)}renameTab(t,e){const{glEventHub:n}=this.props;n.emit(He.RENAME,t,e)}load(){const{fileMetadata:t,settings:e}=this.state;A(t);const{id:n}=t,{fileStorage:s}=this.props;this.pending.add(s.loadFile(n)).then(i=>{var a;$e.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,de.getBaseName(o))}const l={...e,language:(a=Ni.languageFromFileName(o))!=null?a:""};e.value==null&&(l.value=i.content),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&&de.hasPath(t.itemName)){const e=this.getNotebookValue();return e!=null?(this.saveContent(t.itemName,e),!0):!1}return this.setState({showSaveAsModal:!0}),!1}saveContent(t,e){$e.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;$e.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:null,a={...o,value:r},c={settings:{...o,value:l},fileMetadata:s,isPreview:i};return $e.debug("Saving panel state",c),{settings:a,panelState:c}})}handleCloseDiscard(){this.shouldPromptClose=!1,this.setState({showCloseModal:!1});const{glContainer:t}=this.props;t.close()}handleCloseSave(){if(this.shouldPromptClose=!1,this.setState({showCloseModal:!1}),this.save()){const{glContainer:t}=this.props;t.close()}}handleCloseCancel(){this.shouldPromptClose=!0,this.setState({showCloseModal:!1})}handleCopy(){const{fileMetadata:t,settings:e}=this.state;A(t);const n=this.getNotebookValue(),{language:s}=e,{itemName:i}=t,o=de.getCopyFileName(i);$e.debug("handleCopy",t,i,o),this.createNotebook(o,s,n!=null?n:void 0)}handleEditorChange(t){$e.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()}handleBlur(){$e.debug("handleBlur"),this.setState({isFocused:!1})}handleFocus(){$e.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==="/"){$e.debug("Ignoring invalid notebook link",o);return}$e.debug("Notebook link clicked, opening",o);const{glEventHub:r}=this.props,l={value:null,language:s},a={id:o,itemName:o};r.emit(He.SELECT_NOTEBOOK,n,s,l,a)}handleLoadSuccess(){this.setState({error:void 0,isLoaded:!0,isLoading:!1})}handleLoadError(t){let e=t;Ee.isCanceled(e)||(Ee.isTimedOut(e)&&(e=new Error("File not found.")),$e.error(e),this.setState({error:e,isLoading:!1}))}handleSave(){$e.debug("handleSave"),this.save()}handleSaveSuccess(t){var i;const{fileStorage:e}=this.props,n={id:t.filename,itemName:t.filename},s=(i=Ni.languageFromFileName(t.filename))!=null?i:"";this.setState(o=>{const{fileMetadata:r}=o,l={...o.settings,language:s};return $e.debug("handleSaveSuccess",n,r,l),r&&de.hasPath(r.itemName)&&r.itemName!==n.itemName&&($e.debug("handleSaveSuccess deleting old file",r.itemName),e.deleteFile(r.itemName).catch(Ni.handleError)),{fileMetadata:n,settings:l,isPreview:!1}}),this.debouncedSavePanelState(),this.registerFileMetadata(n,!1)}handleSaveError(t){Ee.isCanceled(t)||(this.setState({savedChangeCount:0}),$e.error(t))}handleSaveAsCancel(){this.setState({showSaveAsModal:!1})}handleSaveAsSubmit(t){var i;$e.debug("handleSaveAsSubmit",t);const{fileMetadata:e}=this.state;if(!e)return;const{itemName:n}=e,s=(i=this.getNotebookValue())!=null?i:"";if(this.setState({showSaveAsModal:!1}),de.getBaseName(n)!==de.getBaseName(t)){const{metadata:o}=this.props,{id:r}=o;this.renameTab(r,de.getBaseName(t))}this.saveContent(t,s)}handleRenameFile(t,e){const{fileMetadata:n}=this.state;n&&n.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){$e.error("Editor is not initialized.");return}this.runCommand((t=this.notebook.getValue())!=null?t:void 0)}handleRunSelected(){if(!this.notebook){$e.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;$e.debug("handleShow"),(t=this.notebook)==null||t.updateDimensions()}handleShowRename(){this.setState({showSaveAsModal:!0})}handleTab(t){$e.debug("NotebookPanel tab event",t),this.initTab(t)}handleTabFocus(...t){$e.debug("handleTabFocus",...t);const{glContainer:e}=this.props;this.setState({isDashboardActive:!0}),this.notebook&&!e.isHidden&&this.notebook.updateDimensions()}handleTabBlur(){$e.debug("handleTabBlur"),this.setState({isDashboardActive:!1})}handlePanelTabClick(){$e.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};$e.debug("handleCreateNotebook",i,o,l,a),s.emit(He.CREATE_NOTEBOOK,i,o,l,a)}runCommand(t){if(t===void 0){$e.debug("Ignoring empty command.");return}this.removePreviewStatus();const{glEventHub:e}=this.props;e.emit(ft.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})}render(){var _,k;const{fileStorage:t,glContainer:e,glContainer:{tab:n},glEventHub:s}=this.props,{changeCount:i,savedChangeCount:o,error:r,isDashboardActive:l,isLoaded:a,isLoading:d,isPreview:c,fileMetadata:u,session:m,sessionLanguage:p,settings:g,showCloseModal:f,showSaveAsModal:b}=this.state,C=l&&!e.isHidden&&!c,w=(_=u==null?void 0:u.itemName)!=null?_:Ni.DEFAULT_NAME,T=w.endsWith(".md"),E=(u==null?void 0:u.id)!=null,y=this.getOverflowActions(),I={...g},D=m!=null,N=p===I.language,x=!a||!D||!N,U=!a,$=[{action:this.handleSave,shortcut:ks.SAVE}],L=Wc.getDisabledRunTooltip(D,N,"Notebook extension","Run"),H=Wc.getDisabledRunTooltip(D,N,"Notebook extension","Run Selected"),O=[{title:E?"Rename":"Save As\u2026",order:10,group:ie.groups.high,action:this.handleShowRename},{title:"Copy File",action:this.handleCopy,group:ie.groups.high,order:20}],F=n==null?void 0:n.element.find(".lm_title_before").get(0);return v(he,{children:[F&&hi.createPortal(h("span",{className:W("editor-unsaved-indicator",{"is-unsaved":i!==o})}),F),v(Yn,{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:O,renderTabTooltip:()=>w,children:[!T&&v(he,{children:[v("div",{className:"notebook-toolbar",children:[v("span",{children:[h(Q,{kind:"ghost",className:"btn-play",onClick:this.handleRunAll,disabled:x,icon:h(q,{icon:Br,transform:"grow-4"}),tooltip:`Run ${Nn.NOTEBOOK.RUN.getDisplayText()}`}),L!=null&&h(Ie,{children:L})]}),v("span",{children:[h(Q,{kind:"ghost",className:"btn-play",onClick:this.handleRunSelected,disabled:x,icon:h(q,{icon:zf,transform:"grow-4"}),tooltip:`Run Selected
|
|
38
|
+
${Nn.NOTEBOOK.RUN_SELECTED.getDisplayText()}`}),H!=null&&h(Ie,{children:H})]}),h(Q,{kind:"ghost",className:"mr-auto",disabled:U,onClick:this.handleSave,icon:iu,tooltip:"Save"}),h(Q,{kind:"ghost",className:"btn-overflow btn-link-icon",disabled:U,icon:tu,tooltip:"More Actions...",children:h(Wn,{actions:y,popperOptions:Ni.POPPER_OPTIONS})})]}),h(Gu,{isLoaded:a,isLoading:d,error:r,onChange:this.handleEditorChange,onRunCommand:this.handleRunCommand,session:m,sessionLanguage:p,settings:I,focusOnMount:C,ref:V=>{this.notebook=V}})]}),T&&h(wp,{content:(k=I.value)!=null?k:"",onLinkClick:this.handleLinkClick,onRunCode:this.handleRunCommand,transformImageUri:this.handleTransformLinkUri,transformLinkUri:this.handleTransformLinkUri}),h(Al,{isOpen:b,type:"file",defaultValue:w,title:E?"Rename":"Save file as",onSubmit:this.handleSaveAsSubmit,onCancel:this.handleSaveAsCancel,notifyOnExtensionChange:!0,storage:t}),h(Hi,{isOpen:f,headerText:`Do you want to save the changes you made to ${w}?`,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(ie,{actions:$})]})]})}};let Ko=Ni;Ko.COMPONENT="NotebookPanel";Ko.POPPER_OPTIONS={placement:"bottom-end"};Ko.DEFAULT_NAME="Untitled";Ko.defaultProps={isDashboardActive:!0,isPreview:!1,session:null,sessionLanguage:null};const LE=(t,e)=>{const n=tm(t),s=gi(t,e.localDashboardId),{session:i,config:o}=s!=null?s:{},{type:r}=o!=null?o:{};return{fileStorage:n,session:i,sessionLanguage:r}},Ks=Mt(LE,null,null,{forwardRef:!0})(Ko);class Do extends S.exports.Component{constructor(e){super(e),this.irisGridRef=Y.createRef(),this.buttonRef=Y.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:v(Q,{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",v("span",{children:[h(q,{icon:od,transform:"shrink-1",className:"mr-1"}),"Reload"]})]})})}}Do.defaultProps={panelState:null};Do.COMPONENT="PandasPanel";const OE=t=>{Os(t);const{id:e,layout:n,registerComponent:s,hydrate:i}=t,o=S.exports.useCallback(({dragEvent:r,fetch:l,panelId:a=ze.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=>Bi.makeModel(void 0,b)),g={type:"react-component",component:Pi.COMPONENT,props:{localDashboardId:e,id:a,metadata:m,makeModel:p},title:c,id:a},{root:f}=n;te.openComponent({root:f,config:g,dragEvent:r})},[e,n]);return S.exports.useEffect(function(){const l=[s(Pi.COMPONENT,Pi,i)];return()=>{l.forEach(a=>a())}},[i,s]),Ke(n.eventHub,Me.OPEN,o),h(he,{})},AE=t=>{Os(t);const{id:e,layout:n}=t,s=S.exports.useCallback(({metadata:i,panelId:o=ze.generate(),table:r})=>{const{settings:l}=i,a=()=>Bi.makeModelFromSettings(l,r),d=Le.titleFromSettings(l),c={type:"react-component",component:Pi.COMPONENT,props:{localDashboardId:e,id:o,metadata:i,makeModel:a},title:d,id:o},{root:u}=n;te.openComponent({root:u,config:c})},[e,n]);return Ke(n.eventHub,wt.CREATE_CHART,s),h(he,{})},at=X.module("ConsolePlugin");function Dh(t){return t.notebook!==void 0}function PE(t){Os(t)}const HE=t=>{PE(t);const{id:e,hydrateConsole:n,layout:s,panelManager:i,registerComponent:o,notebooksUrl:r}=t,l=S.exports.useRef(0),[a]=S.exports.useState(new Map),[d]=S.exports.useState(new Map),c=Xa(),u=S.exports.useCallback(()=>i.getLastUsedPanelOfType(_i),[i]),m=S.exports.useCallback((F,_=!0,k=!0)=>{if(!(F&&F.trim()))at.info("Ignoring empty code");else{const z=u();if(!z||!(z instanceof _i.WrappedComponent)){at.error("Console panel not found");return}at.debug("Send command: ",F,_,k),z.addCommand(F,_,k)}},[u]),p=S.exports.useCallback(F=>{c(eE(e,F))},[c,e]),g=S.exports.useCallback(({language:F})=>{const _=F==="python"?"py":F;let k=null;return _==null?(at.debug("No extension for language",F),k=`Untitled-${l.current}`):k=`Untitled-${l.current}.${_}`,l.current+=1,k},[]),f=S.exports.useCallback((F,_=!0)=>{const{id:k}=F;return k!=null&&a.has(k)?a.get(k):k!=null&&d.has(k)?d.get(k):_?ze.generate():null},[a,d]),b=S.exports.useCallback((F,_)=>{te.renameComponent(s.root,{id:F},_)},[s.root]),C=S.exports.useCallback((F,_)=>{at.debug("Rename file panel",F,_);let k;if(a.has(F)&&(k=a.get(F),a.delete(F),k!=null&&a.set(_,k)),d.has(F)&&(k=d.get(F),d.delete(F),k!=null&&d.set(_,k)),k===void 0){at.debug2(`File ${F} isn't open, no need to rename the tab`);return}b(k,de.getBaseName(_))},[a,d,b]),w=S.exports.useCallback(F=>{const _=f(F,!1);if(_==null){at.error("Could not find panel id for file metadata",F);return}te.activateTab(s.root,{id:_})},[f,s.root]),T=S.exports.useCallback((F,_,k)=>{if(at.debug("registerFilePanel",F,_,k),_==null||_.id==null){at.debug("Ignore empty file id",_);return}const{id:V}=_;if(k){d.set(V,F);return}if(a.has(V)){const z=a.get(V);if(F===z){at.debug(`Update tab title for file ${V}`);const{itemName:j}=_;C(V,de.getBaseName(j))}else at.error(`File ${V} already associated with a different tab ${z}`);return}a.set(V,F),d.has(V)&&d.delete(V)},[a,d,C]),E=S.exports.useCallback((F,_)=>{if(at.debug("unregisterFileTab",F,_),F==null||F.id==null){at.debug("Ignore empty file id",F);return}const{id:k}=F;if(_){d.delete(k);return}a.delete(k)},[a,d]),y=S.exports.useCallback(F=>{at.debug("closeFilePanel",F);const{id:_}=F;let k=null,V=!1;if(a.has(_))k=a.get(_);else if(d.has(_))k=d.get(_),V=!0;else{at.debug(`File ${_} isn't open, ignore close event`);return}E(F,V),te.closeComponent(s.root,{id:k})},[s.root,a,d,E]),I=S.exports.useCallback(F=>{const{itemName:_}=F;return de.getBaseName(_)},[]),D=S.exports.useCallback(F=>{const{id:_}=F;return at.debug("fileIsOpen",F,_,a),_!=null&&a.has(_)},[a]),N=S.exports.useCallback(F=>{const{id:_}=F;return at.debug("fileIsOpenAsPreview",F,_,d),_!=null&&d.has(_)},[d]),x=S.exports.useCallback(F=>{if(F==null)return;const _=i.getOpenedPanelById(F);_&&Dh(_)&&_.focus()},[i]),U=S.exports.useCallback(({id:F,settings:_,fileMetadata:k,session:V,sessionLanguage:z,isPreview:j=!1})=>{const ee={settings:_,fileMetadata:k},ve=I(k);return{type:"react-component",component:Ks.COMPONENT,isFocusOnShow:!1,props:{localDashboardId:e,metadata:{id:F},session:V,sessionLanguage:z,panelState:ee,isPreview:j,notebooksUrl:r},title:ve,id:F}},[I,e,r]),$=S.exports.useCallback((F,_,k,V={id:null,itemName:g(k)})=>{const z=f(V);if(D(V)&&z!=null){at.debug("File is already open, focus panel"),w(V),x(z);return}const j=te.getStackForComponentTypes(s.root,[Ks.COMPONENT]),ee=U({id:z,settings:k,fileMetadata:V,session:F,sessionLanguage:_});at.debug("createNotebook",ee,a),te.openComponentInStack(j,ee)},[D,x,g,f,s.root,U,a,w]),L=S.exports.useCallback((F,_,k,V,z=!1)=>{at.debug("selectNotebook",V,z);const j=D(V),ee=N(V);if(j){if(w(V),z){const J=f(V);x(J)}return}if(ee&&!z){w(V);return}const[ve]=Array.from(d.values());let le=null,Se=null;ve!=null&&(le=ve,Se=te.getStackForConfig(s.root,{component:Ks.COMPONENT,id:le})),Se==null&&(le=f(V),Se=te.getStackForComponentTypes(s.root,[Ks.COMPONENT]));const Oe=U({id:le,settings:k,fileMetadata:V,session:F,sessionLanguage:_,isPreview:!z});te.openComponentInStack(Se,Oe),z&&x(le)},[w,D,N,x,f,s.root,U,d]),H=S.exports.useCallback((F,_,k={},V=!0)=>{const z=i.getLastUsedPanelOfType(Ks);z&&Dh(z)?k!=null&&k.value!=null&&z.notebook!=null&&z.notebook.append(k.value):V&&$(F,_,k)},[$,i]),O=S.exports.useCallback((F,_)=>_a.hydrate({...F,notebooksUrl:r},_),[r]);return S.exports.useEffect(function(){const _=[o(_i.COMPONENT,_i,n),o(Zr.COMPONENT,Zr),o(Jr.COMPONENT,Jr),o(tl.COMPONENT,tl),o(Ks.COMPONENT,Ks,O)];return()=>{_.forEach(k=>k())}},[o,n,O]),Ke(s.eventHub,ft.SEND_COMMAND,m),Ke(s.eventHub,ft.SETTINGS_CHANGED,p),Ke(s.eventHub,He.CLOSE_FILE,y),Ke(s.eventHub,He.CREATE_NOTEBOOK,$),Ke(s.eventHub,He.SELECT_NOTEBOOK,L),Ke(s.eventHub,He.RENAME,b),Ke(s.eventHub,He.RENAME_FILE,C),Ke(s.eventHub,He.SEND_TO_NOTEBOOK,H),Ke(s.eventHub,He.REGISTER_FILE,T),Ke(s.eventHub,He.UNREGISTER_FILE,E),h(he,{})},go=X.module("FilterPlugin");function Mh(t,e){return t.concat(e)}const VE=t=>{Os(t);const{id:e,layout:n,registerComponent:s}=t,i=Xa(),[o]=S.exports.useState(()=>new Map),[r]=S.exports.useState(()=>new Map),[l]=S.exports.useState(()=>new Map),a=S.exports.useCallback(()=>{const b=Array.from(o.values()).reduce(Mh,[]).sort((T,E)=>{const y=tn.toLower(T.name),I=tn.toLower(E.name);if(y!==I)return y>I?1:-1;const D=tn.toLower(T.type),N=tn.toLower(E.type);return D!==N?D>N?1:-1:0}).reduce((T,E)=>((T.length===0||tn.toLower(T[T.length-1].name)!==tn.toLower(E.name)||tn.toLower(T[T.length-1].type)!==tn.toLower(E.type))&&T.push(E),T),[]),C=Array.from(r.values()).reduce(Mh,[]).sort((T,E)=>T.timestamp-E.timestamp),w=new Map(l);go.debug("sendUpdate",{columns:b,filters:C,tableMap:w}),i(qn(e,{columns:b,filters:C,tableMap:w}))},[i,e,o,r,l]),d=S.exports.useCallback((b,C)=>{go.debug2("handleColumnsChanged",b,C),o.set(b,[].concat(C)),a()},[o,a]),c=S.exports.useCallback((b,C)=>{go.debug2("handleFiltersChanged",b,C),r.set(b,[].concat(C)),a()},[r,a]),u=S.exports.useCallback((b,C)=>{go.debug2("handleTableChanged",b,C),l.set(te.getIdFromPanel(b),C),a()},[l,a]),m=S.exports.useCallback(b=>{go.debug2("handlePanelUnmount",b),o.delete(b),r.delete(b),l.delete(te.getIdFromPanel(b)),a()},[o,r,l,a]),p=S.exports.useCallback(({title:b="DropdownFilter",metadata:C={},panelState:w=null,id:T=ze.generate(),focusElement:E=te.DEFAULT_FOCUS_SELECTOR,createNewStack:y=!1,dragEvent:I=null})=>{const D={type:"react-component",component:di.COMPONENT,props:{id:T,metadata:C,panelState:w,localDashboardId:e},title:b,id:T},{root:N}=n;te.openComponent({root:N,config:D,focusElement:E,createNewStack:y,dragEvent:I})},[n,e]),g=S.exports.useCallback(({title:b="InputFilter",metadata:C={},panelState:w=null,id:T=ze.generate(),focusElement:E=te.DEFAULT_FOCUS_SELECTOR,createNewStack:y=!1,dragEvent:I=null})=>{const D={type:"react-component",component:Ro.COMPONENT,props:{id:T,metadata:C,panelState:w,localDashboardId:e},title:b,id:T},{root:N}=n;te.openComponent({root:N,config:D,focusElement:E,createNewStack:y,dragEvent:I})},[n,e]),f=S.exports.useCallback(({title:b="FilterSets",metadata:C={},panelState:w=null,id:T=ze.generate(),focusElement:E=te.DEFAULT_FOCUS_SELECTOR,createNewStack:y=!1,dragEvent:I=null})=>{const D={type:"react-component",component:ma.COMPONENT,props:{id:T,metadata:C,panelState:w,localDashboardId:e},title:b,id:T},{root:N}=n;te.openComponent({root:N,config:D,focusElement:E,createNewStack:y,dragEvent:I})},[n,e]);return S.exports.useEffect(function(){const C=[s(di.COMPONENT,di),s(Ro.COMPONENT,Ro),s(ma.COMPONENT,ma)];return()=>{C.forEach(w=>w())}},[s]),Ke(n.eventHub,Pe.COLUMNS_CHANGED,d),Ke(n.eventHub,Pe.FILTERS_CHANGED,c),Ke(n.eventHub,Pe.TABLE_CHANGED,u),Ke(n.eventHub,Pe.OPEN_DROPDOWN,p),Ke(n.eventHub,Pe.OPEN_INPUT,g),Ke(n.eventHub,Pe.OPEN_FILTER_SET_MANAGER,f),Ke(n.eventHub,Me.UNMOUNT,m),h(he,{})},UE=[dh.VariableType.TABLE,dh.VariableType.TREETABLE],BE=t=>{Os(t);const{getDownloadWorker:e,loadPlugin:n,id:s,layout:i,registerComponent:o,hydrate:r,theme:l}=t,a=S.exports.useCallback(({dragEvent:d,fetch:c,panelId:u=ze.generate(),widget:m})=>{const{name:p,type:g}=m;if(!UE.includes(g))return;const f={name:p,table:p},b=()=>c().then(T=>Vd.makeModel(T)),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:w}=i;te.openComponent({root:w,config:C,dragEvent:d})},[e,s,i,n,l]);return S.exports.useEffect(function(){const c=[o(ci.COMPONENT,ci,r)];return()=>{c.forEach(u=>u())}},[r,o]),Ke(i.eventHub,Me.OPEN,a),h(he,{})};function vp(t){return typeof t.getCoordinateForColumn=="function"}function Nh(t){const e=t;return vp(t)&&typeof e.setFilterMap=="function"&&typeof e.unsetFilterValue=="function"}const fo=X.module("LinkerUtils"),Tp=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 fo.debug2("Incompatible panel ids",t,e,n),"invalid";if(t.panelComponent==null||e.panelComponent==null)return fo.error("PanelComponent should not be null",t,e),"invalid";const s=(l=Tp.ALLOWED_LINKS.get(t.panelComponent))==null?void 0:l.includes(e.panelComponent);if(s===void 0||!s)return fo.debug2("Incompatible panel components",t,e),"invalid";const{columnType:i}=t,{columnType:o}=e;if(!(o===null||P.isCompatibleType(i,o)))return fo.debug2("Incompatible type",i,o),"invalid";switch(e.panelComponent){case te.getComponentName(Pi):case te.getComponentName(ci):return"tableLink";case te.getComponentName(di):return"filterSource"}return fo.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:ze.generate(),start:{...i.start,panelId:n}}):((o=i.end)==null?void 0:o.panelId)===e&&s.push({...i,id:ze.generate(),end:{...i.end,panelId:n}})}),s}};let ti=Tp;ti.ALLOWED_LINKS=new Map([[te.getComponentName(ci),[te.getComponentName(ci),te.getComponentName(Pi),te.getComponentName(di)]]]);const Fh=.015,xh=1.5,Ep=12,yp=12,_h=2,Rr=Math.sqrt((yp*.5)**2+Ep**2),kh=Math.asin(yp*.5/Ep),Lh=15,$a=class extends S.exports.PureComponent{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`}constructor(t){super(t),this.handleClick=this.handleClick.bind(this)}handleClick(t){t.stopPropagation(),t.preventDefault();const{id:e,onClick:n}=this.props;n(e)}render(){const{className:t,x1:e,y1:n,x2:s,y2:i,id:o}=this.props,r=Math.sqrt((e-s)**2+(n-i)**2),l=Math.atan2(i-n,s-e),a=Math.sin(l),d=Math.cos(l)+2,c=window.innerWidth,u=window.innerHeight,m=0,p=0,g=Math.max(m,Math.min(e+(s-e)/2+a*(r*Fh)**xh,c)),f=Math.max(p,Math.min(n+(i-n)/2+d*(r*Fh)**xh,u)),b=`M ${e} ${n} Q ${g} ${f} ${s} ${i}`,C=`M ${m} ${p} L ${m} ${u} L ${c} ${u} L ${c} ${p} z
|
|
39
|
+
${$a.makeCirclePath(e,n,Lh)}
|
|
40
|
+
${$a.makeCirclePath(s,i,Lh)}`,w=`link-select-clip-${o}`,T=Math.atan2(i-f,s-g),E=T-kh+Math.PI,y=T+kh+Math.PI,I=s+Math.cos(T)*_h,D=i+Math.sin(T)*_h,N=I+Math.cos(E)*Rr,x=D+Math.sin(E)*Rr,U=I+Math.cos(y)*Rr,$=D+Math.sin(y)*Rr,L=`${I},${D} ${N},${x} ${U},${$}`;return v("svg",{className:t,children:[h("clipPath",{id:w,children:h("path",{d:C,clipRule:"evenodd"})}),h("path",{className:"link-select",d:b,onClick:this.handleClick,clipPath:`url(#${w})`}),h("path",{className:"link-background",d:b}),h("path",{className:"link-foreground",d:b}),h("circle",{className:"link-dot",cx:e,cy:n,r:"5"}),h("polygon",{className:"link-triangle",points:L})]})}};let Ip=$a;Ip.defaultProps={className:"",onClick(){}};const pa=X.module("LinkerOverlayContent");class Rp extends S.exports.Component{constructor(e){super(e),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleEscapePressed=this.handleEscapePressed.bind(this),this.state={mouseX:void 0,mouseY:void 0}}componentDidMount(){window.addEventListener("mousemove",this.handleMouseMove,!0)}componentDidCatch(e,n){pa.error("componentDidCatch",e,n)}componentWillUnmount(){window.removeEventListener("mousemove",this.handleMouseMove,!0)}getPointFromLinkPoint(e){const{panelManager:n}=this.props,{panelId:s,columnName:i}=e,o=n.getOpenedPanelById(s);if(o!=null){if(!vp(o))throw new Error(`Panel does not have getCoordinateForColumn method: ${s}`);try{const l=o.getCoordinateForColumn(i);if(l!=null)return l}catch{pa.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 te.getTabPoint(r)}handleMouseMove(e){this.setState({mouseX:e.clientX,mouseY:e.clientY})}handleEscapePressed(){const{onCancel:e}=this.props;e()}render(){const{disabled:e,links:n,messageText:s,onLinkDeleted:i,onAllLinksDeleted:o,onDone:r}=this.props,{mouseX:l,mouseY:a}=this.state,d=n.map(c=>{try{const{id:u,type:m,isReversed:p,start:g,end:f}=c;let[b,C]=this.getPointFromLinkPoint(g),w=l!=null?l:b,T=a!=null?a:C;if(f!=null&&([w,T]=this.getPointFromLinkPoint(f)),p!=null&&p){const[y,I]=[b,C];[b,C]=[w,T],[w,T]=[y,I]}const E=W("linker-link",{disabled:e},{"link-filter-source":m==="filterSource"},{"link-invalid":m==="invalid"},{interactive:c.end==null});return{x1:b,y1:C,x2:w,y2:T,id:u,className:E}}catch(u){return pa.error("Unable to get point for link",c,u),null}}).filter(c=>c!=null);return v("div",{className:"linker-overlay",children:[h("svg",{children:d.map(({x1:c,y1:u,x2:m,y2:p,id:g,className:f})=>h(Ip,{className:f,id:g,x1:c,y1:u,x2:m,y2:p,onClick:i},g))}),v("div",{className:"linker-toast-dialog",children:[h("div",{className:"toast-body",children:s}),v("div",{className:"toast-footer",children:[h(Q,{kind:"secondary",onClick:o,children:"Clear All"}),h(Q,{kind:"primary",onClick:r,children:"Done"})]})]}),h(ie,{actions:[{action:this.handleEscapePressed,shortcut:ks.LINKER_CLOSE,isGlobal:!0}]})]})}}Rp.defaultProps={disabled:"false"};const Bt=X.module("Linker"),$E=(t,e)=>({activeTool:Tl(t),isolatedLinkerPanelId:$d(t,e.localDashboardId),links:eo(t,e.localDashboardId),timeZone:vl(t)}),WE=Mt($E,{setActiveTool:El,setDashboardLinks:zd,addDashboardLinks:QT,deleteDashboardLinks:ZT,setDashboardIsolatedLinkerPanelId:up,setDashboardColumnSelectionValidator:JT});class zE extends S.exports.Component{constructor(e){super(e),this.getCachedLinks=ge((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.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.isColumnSelectionValid=this.isColumnSelectionValid.bind(this),this.state={linkInProgress:void 0}}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()}componentDidCatch(e,n){Bt.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(wt.COLUMN_SELECTED,this.handleGridColumnSelect),n.on(wt.DATA_SELECTED,this.handleUpdateValues),n.on(wt.STATE_CHANGED,this.handleStateChange),n.on(Wi.COLUMN_SELECTED,this.handleChartColumnSelect),n.on(Me.CLONED,this.handlePanelCloned),n.on(Pe.COLUMN_SELECTED,this.handleFilterColumnSelect),n.on(Pe.COLUMNS_CHANGED,this.handleColumnsChanged),n.on(Me.CLOSED,this.handlePanelClosed)}stopListening(e){e.off("stateChanged",this.handleLayoutStateChanged);const{eventHub:n}=e;n.off(wt.COLUMN_SELECTED,this.handleGridColumnSelect),n.off(wt.DATA_SELECTED,this.handleUpdateValues),n.off(wt.STATE_CHANGED,this.handleStateChange),n.off(Wi.COLUMN_SELECTED,this.handleChartColumnSelect),n.off(Me.CLONED,this.handlePanelCloned),n.off(Pe.COLUMN_SELECTED,this.handleFilterColumnSelect),n.off(Pe.COLUMNS_CHANGED,this.handleColumnsChanged),n.off(Me.CLOSED,this.handlePanelClosed)}handleCancel(){const{linkInProgress:e}=this.state;if(e==null){const{setActiveTool:n}=this.props;n(cn.DEFAULT)}this.setState({linkInProgress:void 0})}handleDone(){const{setActiveTool:e}=this.props;e(cn.DEFAULT),this.setState({linkInProgress:void 0})}handleChartColumnSelect(e,n){this.columnSelected(e,n,!0)}handleFilterColumnSelect(e,n){Bt.debug("handleFilterColumnSelect",this.isOverlayShown());const{links:s,localDashboardId:i,setActiveTool:o,setDashboardIsolatedLinkerPanelId:r}=this.props,l=te.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(cn.LINKER),r(i,l),a.length===0&&this.columnSelected(e,n,!0,l);return}this.columnSelected(e,n,!0)}handleColumnsChanged(e,n){Bt.debug("handleColumnsChanged",e,n);const{links:s}=this.props,i=te.getIdFromPanel(e);if(i==null){Bt.error("Invalid panelId",e);return}const o=s.filter(({start:r,end:l})=>r.panelId===i&&ti.findColumn(n,r)==null||l!=null&&l.panelId===i&&ti.findColumn(n,l)==null);this.deleteLinks(o)}handleGridColumnSelect(e,n){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=te.getIdFromPanel(e);if(l==null)return;const a=te.getComponentNameFromPanel(e),{name:d,type:c}=n;if(r==null||r.start==null){const u={id:ze.generate(),start:{panelId:l,panelComponent:a,columnName:d,columnType:c},type:"invalid",isReversed:s};Bt.debug("starting link",u),this.setState({linkInProgress:u})}else{const{start:u,id:m,isReversed:p}=r,g={panelId:l,panelComponent:a,columnName:d,columnType:c},f=ti.getLinkType(p!==void 0&&p?g:u,p!==void 0&&p?u:g,i!=null?i:o);switch(f){case"invalid":Bt.debug("Ignore invalid link connection",r,g);return;case"filterSource":{const{links:C}=this.props,w=p!==void 0&&p?u.panelId:g.panelId,T=C.filter(({end:E})=>(E==null?void 0:E.panelId)===w);this.deleteLinks(T);break}}const b={start:p!==void 0&&p?g:u,end:p!==void 0&&p?u:g,id:m,type:f};Bt.info("creating link",b),this.setState({linkInProgress:void 0},()=>{this.addLinks([b])})}}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?Nh(l)?l.unsetFilterValue(o,r):Bt.debug("endPanel.unsetFilterValue not implemented",l):Bt.debug("endPanel no longer exists, ignoring unsetFilterValue",i)}}setPanelFilterMap(e,n){Bt.debug("Set filter data for panel:",e,n);const{panelManager:s}=this.props,i=s.getOpenedPanelById(e);i?Nh(i)?i.setFilterMap(n):Bt.debug("panel.setFilterMap not implemented",e,i):Bt.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.setState({linkInProgress:void 0})}handleLinkDeleted(e){const{links:n}=this.props,s=n.find(i=>i.id===e);s?this.deleteLinks([s]):Bt.error("Unable to find link to delete",e)}handleUpdateValues(e,n){const s=te.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}=i[l];if(a.panelId===s&&d!=null){const{panelId:c,columnName:u,columnType:m}=d,p=r.has(c)?r.get(c):new Map,{value:g}=n[a.columnName];let f=`${g}`;m!=null&&P.isDateType(m)&&(f=new lt({timeZone:o,showTimeZone:!1,showTSeparator:!0,defaultDateTimeFormatString:us.FULL_DATE_FORMAT}).format(g)),p.set(u,{columnType:m,text:f,value:g}),r.set(c,p)}}r.forEach((l,a)=>{this.setPanelFilterMap(a,l)})}handlePanelCloned(e,n){const{links:s}=this.props,i=te.getIdFromPanel(e),o=n.id;if(i!=null){const r=ti.cloneLinksForPanel(s,i,o);this.addLinks(r)}}handlePanelClosed(e){Bt.debug(`Panel ${e} closed, deleting links.`),this.deleteLinksForPanelId(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===cn.LINKER}updateSelectionValidators(){const{activeTool:e,setDashboardColumnSelectionValidator:n,localDashboardId:s}=this.props;switch(e){case cn.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((s==null?void 0:s.start)==null)return!0;if(n==null)return this.updateLinkInProgressType(s),!1;const{isReversed:o,start:r}=s,l=te.getIdFromPanel(e);if(l==null)return!1;const a={panelId:l,panelComponent:te.getComponentNameFromPanel(e),columnName:n.name,columnType:n.type},d=o!==void 0&&o?ti.getLinkType(a,r,i):ti.getLinkType(r,a,i);return this.updateLinkInProgressType(s,d),d!=="invalid"}render(){const{links:e,isolatedLinkerPanelId:n,panelManager:s}=this.props,{linkInProgress:i}=this.state,o=this.isOverlayShown(),r=i!=null&&i.start!=null,l=n===void 0?"Click a column source, then click a column target to create a filter link. Remove a filter link by clicking again to erase. Click done when finished.":"Create a link between the source column button and a table column by clicking on one, then the other. Remove the link by clicking it directly. Click done when finished.";return h(he,{children:h(ht,{in:o,timeout:Tt.transitionMs,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,onExited:this.handleExited,children:h(Rp,{disabled:r,panelManager:s,links:this.getCachedLinks(e,i,n),messageText:l,onLinkDeleted:this.handleLinkDeleted,onAllLinksDeleted:this.handleAllLinksDeleted,onDone:this.handleDone,onCancel:this.handleCancel})})})}}const GE=WE(zE),KE=t=>{Os(t);const{id:e,layout:n,panelManager:s}=t;return h(GE,{layout:n,localDashboardId:e,panelManager:s})},Wa=class{static getNewMarkdownTitle(t){let e=`${Wa.DEFAULT_TITLE}`,n=0;for(;t.indexOf(e)>=0;)n+=1,e=`${Wa.DEFAULT_TITLE}-${n}`;return e}};let Mo=Wa;Mo.DEFAULT_TITLE="Note";Mo.DEFAULT_CONTENT=`# Markdown Note
|
|
41
|
+
|
|
42
|
+
This note can be edited using **markdown** for styling.`;const qE=t=>{Os(t);const{id:e,layout:n,panelManager:s,registerComponent:i}=t,o=S.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===Mo.DEFAULT_CONTENT?null:yd(l)},[]),r=S.exports.useCallback(({title:l="",metadata:a={},id:d=ze.generate(),focusElement:c=te.DEFAULT_FOCUS_SELECTOR,createNewStack:u=!1,dragEvent:m=null}={})=>{const p=s.getOpenedPanelConfigsOfType(po.COMPONENT),g=s.getClosedPanelConfigsOfType(po.COMPONENT),f=p.map(E=>{var y;return(y=E.title)!=null?y:""}),b=l!=null&&l!==""?l:Mo.getNewMarkdownTitle(f),C=g.length>0?null:Mo.DEFAULT_CONTENT,w={type:"react-component",component:po.COMPONENT,props:{id:d,metadata:a,panelState:{content:C},localDashboardId:e},title:b,id:d},{root:T}=n;te.openComponent({root:T,config:w,focusElement:c,createNewStack:u,dragEvent:m})},[e,n,s]);return S.exports.useEffect(function(){const a=[i(po.COMPONENT,po,Id,o)];return()=>{a.forEach(d=>d())}},[o,i]),Ke(n.eventHub,ap.OPEN,r),h(he,{})},YE=t=>{Os(t);const{hydrate:e,id:n,layout:s,registerComponent:i}=t,o=S.exports.useCallback(({dragEvent:r,fetch:l,panelId:a=ze.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=>Vd.makeModel(b)),g={type:"react-component",component:Do.COMPONENT,props:{localDashboardId:n,id:a,metadata:m,makeModel:p},title:c,id:a},{root:f}=s;te.openComponent({root:f,config:g,dragEvent:r})},[n,s]);return S.exports.useEffect(function(){const l=[i(Do.COMPONENT,Do,e)];return()=>{l.forEach(a=>a())}},[e,i]),Ke(s.eventHub,Me.OPEN,o),h(he,{})};class Cn{}Cn.DROPDOWN_FILTER="ControlType.DROPDOWN_FILTER";Cn.INPUT_FILTER="ControlType.INPUT_FILTER";Cn.MARKDOWN="ControlType.MARKDOWN";Cn.FILTER_SET_MANAGER="ControlType.FILTER_SET_MANAGER";const XE=R.exports.shape({state:R.exports.shape({panelState:R.exports.shape({})})}),jE=R.exports.shape({panelId:R.exports.string.isRequired,columnName:R.exports.string.isRequired,columnType:R.exports.string.isRequired}),Oh=R.exports.shape({panelId:R.exports.string.isRequired,columnName:R.exports.string.isRequired}),Dp=R.exports.shape({start:Oh,end:Oh,id:R.exports.string,isReversed:R.exports.bool}),QE=R.exports.arrayOf(Dp),ZE=R.exports.shape({name:R.exports.string.isRequired,operateAs:R.exports.string.isRequired,groups:R.exports.arrayOf(R.exports.string).isRequired,permissions:R.exports.shape({isSuperUser:R.exports.bool.isRequired,isQueryViewOnly:R.exports.bool.isRequired,isNonInteractive:R.exports.bool.isRequired,canUsePanels:R.exports.bool.isRequired,canCreateDashboard:R.exports.bool.isRequired,canCreateCodeStudio:R.exports.bool.isRequired,canCreateQueryMonitor:R.exports.bool.isRequired,canCopy:R.exports.bool.isRequired,canDownloadCsv:R.exports.bool.isRequired}).isRequired});Object.freeze({LinkPoint:jE,Link:Dp,Links:QE,Panel:XE,User:ZE});const JE=(t,e)=>t[e]===null?null:R.exports.bool,e1=(t,e)=>t[e]===null?null:R.exports.string;Object.freeze({nullableBoolean:JE,nullableString:e1});const Mp="SET_LAYOUT_STORAGE",t1=t=>({type:Mp,payload:t}),Np="/ide/assets/community-wordmark-app.d2c5c1eb.svg";const Ds=X.module("FormattingSectionContent");function n1(t){return t.formatString!=null}const ot=class extends S.exports.PureComponent{constructor(t){super(t),this.getCachedColumnTypeOptions=Te(()=>ot.renderColumnTypeOptions()),this.getCachedDateTimeFormatOptions=Te((c,u,m,p=!1,g=null)=>{const{timestampAtMenuOpen:f}=this.state;return ot.renderDateTimeOptions(f,c,u,m,p,g)}),this.debouncedCommitChanges=Xe(this.commitChanges.bind(this),ot.inputDebounceTime),this.handleDefaultDateTimeFormatChange=this.handleDefaultDateTimeFormatChange.bind(this),this.handleDefaultDecimalFormatChange=this.handleDefaultDecimalFormatChange.bind(this),this.handleDefaultIntegerFormatChange=this.handleDefaultIntegerFormatChange.bind(this),this.handleFormatRuleEntered=this.handleFormatRuleEntered.bind(this),this.handleFormatRuleChange=this.handleFormatRuleChange.bind(this),this.handleFormatRuleCreate=this.handleFormatRuleCreate.bind(this),this.handleFormatRuleDelete=this.handleFormatRuleDelete.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=Y.createRef(),this.addFormatRuleButtonRef=Y.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}}static focusFirstInputInContainer(t){const e=t==null?void 0:t.querySelector("input, select, textarea");e&&e.focus()}static isSameOptions(t,e){return t.defaultFormatString===e.defaultFormatString}static isSameDecimalOptions(t,e){return ot.isSameOptions(t,e)}static isSameIntegerOptions(t,e){return ot.isSameOptions(t,e)}static isValidColumnName(t){return t!==""&&ms.isValidColumnName(t)}static isValidFormat(t,e){if(!t||e.formatString==null||!n1(e))return!1;switch(t){case"datetime":return lt.isValid(e);case"decimal":return Ue.isValid(e);case"int":return dt.isValid(e);default:return Ds.warn("Trying to validate format of unknown type"),!0}}static removeFormatRuleExtraProps(t){const{id:e,isNewRule:n,...s}=t;return s}static isFormatRuleValidForSave(t){return ot.isValidColumnName(t.columnName)&&ot.isValidFormat(t.columnType,t.format)}static renderTimeZoneOptions(){return In.TIME_ZONES.map(e=>{const{label:n,value:s}=e;return h("option",{value:s,children:n},s)})}static renderColumnTypeOptions(){const e=[{value:P.dataType.DATETIME,label:"DateTime"},{value:P.dataType.DECIMAL,label:"Decimal"},{value:P.dataType.INT,label:"Integer"}].map(n=>h("option",{value:n.value,children:n.label},`key-columnType-${n.value}`));return v(he,{children:[h("option",{disabled:!0,value:"",children:"Select Type"},"key-columnType-placeholder"),e]})}static renderDateTimeOptions(t,e,n,s,i,o){const r=new hn([],{timeZone:e,showTimeZone:n,showTSeparator:s}),l=i?lt.getGlobalFormats(n,s):lt.getFormats(n,s);return o&&!l.includes(o)&&l.unshift(o),l.map(a=>{const d=lt.makeFormat("",a,lt.TYPE_GLOBAL);return h("option",{value:a,children:r.getFormattedString(t,P.dataType.DATETIME,"",d)},a)})}componentDidMount(){ot.focusFirstInputInContainer(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}handleDefaultDateTimeFormatChange(t){Ds.debug("handleDefaultDateTimeFormatChange",t.target.value),this.setState({defaultDateTimeFormat:t.target.value},()=>{this.debouncedCommitChanges()})}handleDefaultDecimalFormatChange(t){Ds.debug("handleDefaultDecimalFormatChange",t.target.value),this.setState({defaultDecimalFormatOptions:{defaultFormatString:t.target.value}},()=>{this.debouncedCommitChanges()})}handleDefaultIntegerFormatChange(t){Ds.debug("handleDefaultIntegerFormatChange",t.target.value),this.setState({defaultIntegerFormatOptions:{defaultFormatString:t.target.value}},()=>{this.debouncedCommitChanges()})}handleFormatRuleChange(t,e,n){this.setState(s=>{const{formatSettings:i}=s;A(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:P.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()})}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;Ds.debug("handleResetDateTimeFormat"),this.setState({defaultDateTimeFormat:e,showTimeZone:n,showTSeparator:s},()=>{this.debouncedCommitChanges()})}handleResetTimeZone(){const{defaults:t}=this.props,{timeZone:e}=t;Ds.debug("handleResetTimeZone"),this.setState({timeZone:e},()=>{this.debouncedCommitChanges()})}handleResetDecimalFormat(){const{defaults:t}=this.props,{defaultDecimalFormatOptions:e}=t;Ds.debug("handleResetDecimalFormat"),this.setState({defaultDecimalFormatOptions:e},()=>{this.debouncedCommitChanges()})}handleResetIntegerFormat(){const{defaults:t}=this.props,{defaultIntegerFormatOptions:e}=t;Ds.debug("handleResetIntegerFormat"),this.setState({defaultIntegerFormatOptions:e},()=>{this.debouncedCommitChanges()})}handleTruncateNumbersWithPoundChange(){this.setState(t=>({truncateNumbersWithPound:!t.truncateNumbersWithPound}),()=>{this.debouncedCommitChanges()})}handleFormatRuleEntered(t){this.scrollToFormatBlockBottom(),ot.focusFirstInputInContainer(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(ot.isFormatRuleValidForSave).map(ot.removeFormatRuleExtraProps))!=null?m:[],{settings:d,saveSettings:c}=this.props,u={...d,formatter:a,defaultDateTimeFormat:e,showTimeZone:n,showTSeparator:s,timeZone:i,truncateNumbersWithPound:l};ot.isValidFormat(P.dataType.DECIMAL,Ue.makeCustomFormat(o.defaultFormatString))&&(u.defaultDecimalFormatOptions=o),ot.isValidFormat(P.dataType.INT,dt.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.")),ot.isValidColumnName(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!=null?(e.hasFormatError=!0,n.push("Empty formatting rule.")):ot.isValidFormat(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 v("fieldset",{className:"container-fluid format-rule-container",children:[v("div",{className:"form-row",children:[v("div",{className:"form-group col-7 mb-2",children:[h("label",{htmlFor:n,children:"Column Name"}),h("input",{id:n,className:W("form-control",{"is-invalid":d.hasColumnNameError}),"data-lpignore":!0,type:"text",value:e.columnName,onChange:r,onBlur:l})]}),v("div",{className:"form-group col mb-2",children:[h(Q,{kind:"ghost",className:"btn-delete-format-rule float-right",tabIndex:-1,onClick:()=>this.handleFormatRuleDelete(t),icon:xn,tooltip:"Delete"}),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:v("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(P.getNormalizedType(e)){case P.dataType.DATETIME:return this.renderDateTimeFormatRuleInput(t,n,s,i);case P.dataType.DECIMAL:return this.renderDecimalFormatRuleInput(t,n,s,i);case P.dataType.INT:return this.renderIntegerFormatRuleInput(t,n,s,i);default:return null}}renderDateTimeFormatRuleInput(t,e,n,s){const{showTimeZone:i,showTSeparator:o,timeZone:r}=this.state,l=n!=null&&n.formatString||"";return v("select",{className:W("custom-select",{"is-invalid":s}),value:l,id:e,onChange:a=>{const d=lt.makeFormat("",a.target.value,lt.TYPE_GLOBAL);this.handleFormatRuleChange(t,"format",d)},children:[h("option",{value:"",disabled:!0,children:"Select format"},"default"),this.getCachedDateTimeFormatOptions(r,i,o)]})}renderIntegerFormatRuleInput(t,e,n,s){const i=n!=null&&n.formatString||"";return h("input",{className:W("form-control","flex-grow-1",{"is-invalid":s}),"data-lpignore":!0,id:e,placeholder:dt.DEFAULT_FORMAT_STRING,type:"text",value:i,onChange:o=>{const r=dt.makeFormat("",o.target.value,dt.TYPE_GLOBAL,void 0);this.handleFormatRuleChange(t,"format",r)}})}renderDecimalFormatRuleInput(t,e,n,s){const i=n!=null&&n.formatString||"";return h("input",{className:W("form-control","flex-grow-1",{"is-invalid":s}),"data-lpignore":!0,id:e,placeholder:Ue.DEFAULT_FORMAT_STRING,type:"text",value:i,onChange:o=>{const r=Ue.makeFormat("",o.target.value,Ue.TYPE_GLOBAL,void 0);this.handleFormatRuleChange(t,"format",r)}})}render(){const{defaults:t}=this.props,{formatRulesChanged:e,formatSettings:n,defaultDateTimeFormat:s,defaultDecimalFormatOptions:i,defaultIntegerFormatOptions:o,timeZone:r,showTimeZone:l,showTSeparator:a,truncateNumbersWithPound:d}=this.state,{defaultFormatString:c=Ue.DEFAULT_FORMAT_STRING}=i!=null?i:{},{defaultFormatString:u=dt.DEFAULT_FORMAT_STRING}=o!=null?o:{},m=n.map((w,T)=>h(ht,{classNames:"fade",timeout:Tt.transitionMs,onEnter:this.handleFormatRuleEntered,children:this.renderFormatRule(T,w)},w.id)),p=h(Q,{kind:"ghost",className:"mb-3",onClick:this.handleFormatRuleCreate,ref:this.addFormatRuleButtonRef,icon:Ls,children:"Add New Rule"}),g=r===t.timeZone,f=a===t.showTSeparator&&l===t.showTimeZone&&s===t.defaultDateTimeFormat,b=ot.isSameDecimalOptions(i,t.defaultDecimalFormatOptions),C=ot.isSameIntegerOptions(o,t.defaultIntegerFormatOptions);return v("div",{className:"app-settings-formatting-section",ref:this.containerRef,children:[v("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."}),v("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:r,onChange:this.handleTimeZoneChange,id:"select-reset-timezone",children:ot.renderTimeZoneOptions()})}),h("div",{className:"col-1 btn-col",children:h(Q,{kind:"ghost",icon:Fi,onClick:this.handleResetTimeZone,tooltip:"Reset Time Zone",className:W("btn-reset","btn-reset-time-zone",{hidden:g})})})]}),v("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:s,onChange:this.handleDefaultDateTimeFormatChange,id:"select-default-time-format",children:this.getCachedDateTimeFormatOptions(r,l,a,!0,s)})}),h("div",{className:"col-1 btn-col",children:h(Q,{kind:"ghost",icon:Fi,onClick:this.handleResetDateTimeFormat,tooltip:"Reset DateTime Options",className:W("btn-reset","btn-reset-date-time",{hidden:f})})})]}),h("div",{className:"form-row",children:h("div",{className:"offset-3 col-9",children:h(Pt,{checked:l!=null?l: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(Pt,{checked:a!=null?a:null,onChange:this.handleShowTSeparatorChange,children:"Show 'T' separator"})})}),v("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:W("form-control","flex-grow-1","default-decimal-format-input",{"is-invalid":!ot.isValidFormat(P.dataType.DECIMAL,Ue.makeCustomFormat(c))}),"data-lpignore":!0,placeholder:Ue.DEFAULT_FORMAT_STRING,type:"text",id:"default-decimal-format-input",value:c,onChange:this.handleDefaultDecimalFormatChange})}),h("div",{className:"col-1 btn-col",children:h(Q,{kind:"ghost",icon:Fi,onClick:this.handleResetDecimalFormat,tooltip:"Reset Decimal Formatting",className:W("btn-reset","btn-reset-decimal",{hidden:b}),"data-testid":"btn-reset-decimal"})})]}),v("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:W("form-control","flex-grow-1","default-integer-format-input",{"is-invalid":!ot.isValidFormat(P.dataType.INT,dt.makeCustomFormat(u))}),"data-lpignore":!0,placeholder:dt.DEFAULT_FORMAT_STRING,type:"text",id:"default-integer-format-input",value:u,onChange:this.handleDefaultIntegerFormatChange})}),h("div",{className:"col-1 btn-col",children:h(Q,{kind:"ghost",icon:Fi,onClick:this.handleResetIntegerFormat,tooltip:"Reset Integer Formatting",className:W("btn-reset","btn-reset-integer",{hidden:C}),"data-testid":"btn-reset-integer"})})]}),h("div",{className:"form-row mb-3",children:h("div",{className:"offset-3 col-9",children:h(Pt,{checked:d!=null?d:null,onChange:this.handleTruncateNumbersWithPoundChange,children:"Truncate numbers with #"})})})]}),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(Zp,{appear:e,enter:e,exit:e,children:m}),p]})}};let ec=ot;ec.defaultProps={scrollTo:()=>{},defaults:{defaultDateTimeFormat:lt.DEFAULT_DATETIME_FORMAT_STRING,defaultDecimalFormatOptions:{defaultFormatString:Ue.DEFAULT_FORMAT_STRING},defaultIntegerFormatOptions:{defaultFormatString:dt.DEFAULT_FORMAT_STRING},showTimeZone:!1,showTSeparator:!0,timeZone:lt.DEFAULT_TIME_ZONE_ID}};ec.inputDebounceTime=250;const s1=t=>({formatter:lS(t),defaultDateTimeFormat:iS(t),defaultDecimalFormatOptions:oS(t),defaultIntegerFormatOptions:rS(t),showTimeZone:aS(t),showTSeparator:dS(t),truncateNumbersWithPound:cS(t),timeZone:vl(t),settings:Kt(t)}),i1=Mt(s1,{saveSettings:hm})(ec),o1=()=>{const[t,e]=S.exports.useState(!1),n=()=>{e(!t)};return v(Q,{kind:"ghost",onClick:n,icon:mf,children:["Legal Notices",v(Oo,{isOpen:t,toggle:n,className:"theme-bg-light",children:[h(Po,{toggle:n,children:"Legal Notice"}),v(Ao,{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."}),v("p",{children:["\xA9 2016-",new Date().getFullYear()," Deephaven Data Labs LLC. Patent Pending."]})]})]})]})},nl=t=>{const{children:e,isExpanded:n,sectionKey:s,title:i,onToggle:o}=t;return v(he,{children:[h("div",{children:v(Q,{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(q,{transform:n?"flip-v":"",icon:as})})]})}),h(cd,{in:n,autoFocusOnShow:!0,children:e})]})};nl.propTypes={children:R.exports.node,isExpanded:R.exports.bool.isRequired,sectionKey:R.exports.string.isRequired,title:R.exports.node.isRequired,onToggle:R.exports.func};nl.defaultProps={children:null,onToggle:()=>{}};function r1({shortcut:t,displayText:e,categoryName:n,onChange:s}){const[i,o]=S.exports.useState(e),[r,l]=S.exports.useState(t.getKeyState()),[a,d]=S.exports.useState(!1),[c,u]=S.exports.useState("");S.exports.useEffect(function(){o(e),l(t.getKeyState())},[e,t]),S.exports.useEffect(function(){o(Wt.getDisplayText(r)),t.matchesKeyState(r)&&d(!1)},[r,t]),S.exports.useEffect(function(){if(a){if(!Wt.isValidKeyState(r)){Wt.isAllowedKey(r.keyValue)?u("Must contain a modifier key"):u("Must contain an allowed action key");return}const E=Be.getConflictingShortcuts(r).filter(y=>y.id.startsWith(n)&&y!==t).map(y=>y.name);if(E.length){u(`Conflicts with ${E.join(", ")}`);return}u("")}else u("")},[a,r,n,t]);function m(T){if(T.stopPropagation(),T.preventDefault(),t.isEditable&&!T.repeat){const E=Wt.getKeyStateFromEvent(T),y=Wt.createKeyState([pe.BACKSPACE]);Wt.doKeyStatesMatch(E,y)?l(Wt.NULL_KEY_STATE):l(E)}}function p(T){T.stopPropagation(),T.preventDefault(),t.matchesKeyState(r)||d(!0)}function g(){Ne.disableAllActions()}function f(){Ne.enableAllActions()}function b(){t.setKeyState(r),d(!1),s(t)}function C(){const T=t.getKeyState();l(T),d(!1)}function w(){d(!0),l(t.getDefaultKeyState())}return v(he,{children:[v("div",{className:"shortcut-item-container",children:[v("label",{className:"shortcut-item-name",children:[t.name,t.tooltip!==void 0&&h(Ie,{children:t.tooltip})]}),v("div",{className:"shortcut-item-input-container",children:[h("input",{className:W("form-control",{"is-invalid":c}),onKeyDown:m,onKeyUp:p,onFocus:g,onBlur:f,disabled:!t.isEditable,value:i,readOnly:!0}),!Wt.doKeyStatesMatch(r,t.getDefaultKeyState())&&!c&&h(Q,{className:"reset-to-default-button",kind:"ghost",icon:h(q,{icon:Fi,transform:{rotate:90,flipX:!0}}),tooltip:"Reset to default",onClick:w})]})]}),a&&v("div",{className:W("shortcut-item-message-container",{"is-invalid":c}),children:[h("div",{className:"shortcut-item-message",children:c}),v("div",{className:"shortcut-item-message-buttons",children:[Wt.isValidKeyState(r)&&h(Q,{kind:"ghost",onClick:b,children:"Confirm"}),h(Q,{kind:"ghost",onClick:C,children:"Undo"})]})]})]})}function l1({shortcutOverrides:t={},settings:e,saveSettings:n}){const s=S.exports.useCallback(l=>{const a=Wt.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(Be.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),v(he,{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(a1,{name:l.name,shortcuts:l.shortcuts,saveShortcutOverrides:s},l.name))]})}function a1({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]=S.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=S.exports.useMemo(()=>i.map(a=>a.getDisplayText()),[i]);return v("div",{className:"mt-3",children:[h("div",{className:"font-weight-bold",children:s(t)}),i.map((a,d)=>h(r1,{shortcut:a,displayText:l[d],categoryName:t,onChange:r},a.id))]})}const d1=t=>({settings:Kt(t),shortcutOverrides:hS(t)}),c1={saveSettings:hm},h1=Mt(d1,c1)(l1),za=new $g,Ga=new Vr(za);function u1(){X.setLogLevel(parseInt("2",10)),za.enable(),Ga.enable(),window!=null&&(window.DHLog=X,window.DHLogProxy=za,window.DHLogHistory=Ga)}const m1="yyyy-MM-dd-HHmmss";function Fp(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]=Fp(o,a,n)}}}),s}function p1(){const t=yl.getState();return JSON.stringify(Fp(t),null,2)}function g1(){const t={uiVersion:"0.20.0",userAgent:navigator.userAgent};return JSON.stringify(t,null,2)}async function f1(t=`${M.i18n.DateTimeFormat.format(m1,new Date)}_support_logs`){const e=new Kh,n=e.folder(t);n.file("console.txt",Ga.getFormattedHistory()),n.file("redux.json",p1()),n.file("metadata.json",g1());const s=await e.generateAsync({type:"blob"}),i=document.createElement("a");i.href=URL.createObjectURL(s),i.download=`${t}.zip`,i.click()}const Fs=class extends S.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.menuContentRef=Y.createRef(),this.state={expandedSectionKey:Fs.FORMATTING_SECTION_KEY}}static focusFirstInputInContainer(t){const e=t==null?void 0:t.querySelector("input, select, textarea");e&&e.focus()}static handleExportSupportLogs(){f1()}componentDidMount(){Fs.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()}render(){const t="0.20.0",e="https://github.com/deephaven/web-client-ui/",n="https://deephaven.io/core/docs/";return v("div",{className:"app-settings-menu",children:[v("header",{className:"app-settings-menu-header",children:[h("div",{className:"flex-spacer"}),h(Q,{kind:"ghost",className:"btn-close-settings-menu",onClick:this.handleClose,icon:h(q,{icon:Ho,transform:"grow-4"}),tooltip:"Close"})]}),v("div",{className:"app-settings-menu-content",ref:this.menuContentRef,children:[h("h5",{children:"Settings"}),h("hr",{className:"my-0"}),h(nl,{sectionKey:Fs.FORMATTING_SECTION_KEY,isExpanded:this.isSectionExpanded(Fs.FORMATTING_SECTION_KEY),title:v(he,{children:[h(q,{icon:Rf,transform:"grow-4",className:"mr-2"}),"Formatting & Time zone"]}),onToggle:this.handleSectionToggle,children:h(i1,{scrollTo:this.handleScrollTo})}),h(nl,{sectionKey:Fs.SHORTCUT_SECTION_KEY,isExpanded:this.isSectionExpanded(Fs.SHORTCUT_SECTION_KEY),title:v(he,{children:[h(q,{icon:wf,transform:"grow-2"})," ","Keyboard Shortcuts"]}),onToggle:this.handleSectionToggle,children:h(h1,{})}),v("div",{className:"app-settings-footer",children:[v("div",{className:"app-settings-footer-section",children:[v("div",{className:"app-settings-footer-item",children:[h("div",{className:"font-weight-bold",children:"Support"}),v("div",{children:["GitHub:\xA0",h("a",{href:e,className:"custom-link",target:"_blank",rel:"noopener noreferrer",children:e})]}),h(Q,{kind:"tertiary",className:"mt-2 py-2",onClick:Fs.handleExportSupportLogs,children:"Export Logs"})]}),v("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})]}),h("div",{className:"app-settings-footer-item",children:v("div",{className:"text-muted",children:["Version ",t]})}),h("div",{className:"app-settings-footer-item",children:h(o1,{})})]}),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:Np,alt:"Deephaven Data Labs",width:"230px"})})})})]})]})]})}};let qo=Fs;qo.defaultProps={onDone:()=>{}};qo.FORMATTING_SECTION_KEY="SettingsMenu.formatting";qo.APPLICATION_SECTION_KEY="ApplicationMenu.settings";qo.SHORTCUT_SECTION_KEY="SettingsMenu.shortcuts";const Ah=10,ki=t=>{const{forwardedProps:{menuItem:{action:e,title:n,disabled:s},iconElement:i,displayShortcut:o,isMouseSelected:r,isKeyboardSelected:l,closeMenu:a}}=t,d=S.exports.useRef(),c=S.exports.useRef(),u=S.exports.useRef(null),[m,p]=S.exports.useState(!1),g=S.exports.useCallback(C=>{d.current!=null&&c.current!=null&&u.current&&(Math.abs(d.current-C.clientX)>=Ah||Math.abs(c.current-C.clientY)>=Ah)&&(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 S.exports.useEffect(function(){return function(){return window.removeEventListener("mousemove",g)}},[g]),v("button",{type:"button",className:W("btn-context-menu",{disabled:s},{active:r&&!s},{"keyboard-active":l&&!s}),onMouseDown:f,onMouseUp:b,disabled:m,children:[h("span",{className:W("icon"),children:i}),h("span",{className:"title",children:n}),h("span",{className:"shortcut",children:o})]})},tc=t=>{const{handleControlSelect:e,handleToolSelect:n,onClearFilter:s}=t,i=S.exports.useMemo(()=>[{title:"Input Filter",icon:Vf,menuElement:h(ki,{}),action:o=>{e(Cn.INPUT_FILTER,o)},order:10},{title:"Dropdown Filter",icon:lu,menuElement:h(ki,{}),action:o=>{e(Cn.DROPDOWN_FILTER,o)},order:15},{title:"Markdown Widget",icon:Cf,menuElement:h(ki,{}),action:o=>{e(Cn.MARKDOWN,o)},order:20},{title:"Filter Sets",icon:wa,menuElement:h(ki,{}),action:o=>{e(Cn.FILTER_SET_MANAGER,o)},order:25},{disabled:!0,menuElement:h("div",{className:"context-menu-group-header",children:"Tools"}),order:30},{title:"Linker",icon:td,action:()=>{n(cn.LINKER)},order:40,shortcut:ks.LINKER},{disabled:!0,menuElement:h("div",{className:"context-menu-group-header",children:"Actions"}),order:50},{title:"Clear All Filters",icon:Of,action:()=>{s()},order:60,shortcut:an.TABLE.CLEAR_ALL_FILTERS}],[e,n,s]);return h(Wn,{popperClassName:"controls-menu-popper",actions:i})};tc.propTypes={handleControlSelect:R.exports.func,handleToolSelect:R.exports.func,onClearFilter:R.exports.func};tc.defaultProps={handleControlSelect:()=>{},handleToolSelect:()=>{},onClearFilter:()=>{}};ki.propTypes={forwardedProps:R.exports.shape({iconElement:R.exports.node,displayShortcut:R.exports.string,isMouseSelected:R.exports.bool.isRequired,isKeyboardSelected:R.exports.bool.isRequired,closeMenu:R.exports.func.isRequired,menuItem:R.exports.shape({action:R.exports.func,title:R.exports.string,disabled:R.exports.bool}).isRequired})};ki.defaultProps={forwardedProps:null};const C1=fi(Mp,null),b1={layoutStorage:C1},S1=t=>t.layoutStorage;Object.entries(b1).map(([t,e])=>Xi.register(t,e));const Ph=10,w1=t=>{const{onExportLayout:e,onImportLayout:n,onResetLayout:s,onSelect:i,widgets:o=[]}=t,[r,l]=S.exports.useState(!1),[a,d]=S.exports.useState(""),c=S.exports.useRef(null),u=S.exports.useRef(),m=S.exports.useCallback((E,y)=>{E!=null&&i(E,y)},[i]),p=S.exports.useCallback(E=>{d(E.target.value)},[]),g=S.exports.useCallback(E=>{u.current!=null&&(Math.abs(u.current.x-E.clientX)>=Ph||Math.abs(u.current.y-E.clientY)>=Ph)&&(l(!0),window.removeEventListener("mousemove",g),m(u.current.widget,E),u.current=void 0)},[u,m]),f=S.exports.useCallback((E,y)=>{u.current={x:E.clientX,y:E.clientY,widget:y},window.addEventListener("mousemove",g)},[g]),b=S.exports.useCallback((E,y)=>{var I;window.removeEventListener("mousemove",g),((I=u.current)==null?void 0:I.widget)===y&&(l(!0),m(y)),u.current=void 0},[g,u,m]),C=S.exports.useMemo(()=>o.filter(E=>{var y;return a?(y=E.name)==null?void 0:y.toLowerCase().includes(a.toLowerCase()):!0}),[a,o]).sort((E,y)=>{var I,D,N;return(N=(D=E.name)==null?void 0:D.localeCompare((I=y.name)!=null?I:""))!=null?N:0}),w=S.exports.useMemo(()=>C.map(E=>{var y,I;return h("li",{children:v(Q,{kind:"ghost","data-testid":`panel-list-item-${(y=E.name)!=null?y:""}-button`,onMouseDown:D=>{f(D,E)},onMouseUp:D=>{b(D,E)},onKeyDown:D=>{(D.key==="Enter"||D.key===" ")&&m(E)},disabled:r,onClick:()=>{},children:[h(xu,{type:E.type})," ",(I=E.name)!=null?I:""]})},E.name)}),[C,r,f,b,m]),T=S.exports.useMemo(()=>w.length===0?h("span",{children:"No bound variables found."}):null,[w]);return v("div",{className:"widget-list-container d-flex flex-column",children:[h("div",{className:"widget-list-header",children:h(gs,{value:a,placeholder:"Find Table, Plot or Widget",onChange:p,ref:c})}),v("ul",{className:"widget-list flex-grow-1",children:[T&&h("li",{className:"widget-list-message",children:T}),!T&&w]}),h("div",{children:h("hr",{})}),v("div",{className:"widget-list-footer",children:[v(Q,{kind:"ghost",onClick:e,children:[v("div",{className:"fa-md fa-layers",children:[h(q,{mask:va,icon:Cc,transform:"right-5 down-5"}),h(q,{icon:Cc,transform:"right-8 down-6"})]}),"Export Layout"]}),v(Q,{kind:"ghost",onClick:n,children:[v("div",{className:"fa-md fa-layers",children:[h(q,{mask:va,icon:Sa,transform:"right-5 down-5"}),h(q,{icon:Sa,transform:"right-8 down-6"})]}),"Import Layout"]}),h(Q,{kind:"ghost",icon:Fi,onClick:s,tooltip:"Reset Layout"})]})]})},v1=async(t,e,n)=>{let s,i,o,r;if(kr(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 Bi.makeModel(s,c)}const l={title:o,name:i,type:M.VariableType.TABLE},a=await t.getObject(l);return se.applyTableSettings(a,r,vl(yl.getState())),Bi.makeModelFromSettings(s,a)},T1=async(t,e,n=M.VariableType.TABLE)=>{const{table:s}=e,i={title:s,name:s,type:n},o=await t.getObject(i);return Vd.makeModel(o)};const E1=({onAutoFillClick:t=()=>{}})=>v("div",{className:"empty-dashboard-container",children:[v("div",{className:"hint-container",children:[h(q,{icon:Zg})," ",h("br",{}),"Use the panel list to add objects from a query."]}),v("div",{className:"empty-dashboard",children:[h("div",{className:"add-panels-hint",children:"Drag Panels Here"}),h(Q,{kind:"tertiary",onClick:t,children:"Auto fill objects"})]})]});function y1(t){return t.version===2}function I1(t){return Array.isArray(t)}const Dr=X.module("UserLayoutUtils"),R1={layoutConfig:[{type:"column",content:[{type:"row",content:[{type:"stack",content:[{type:"react-component",component:_i.COMPONENT,title:_i.TITLE,isClosable:!1},{type:"react-component",component:tl.COMPONENT,title:tl.TITLE,isClosable:!1}]},{type:"stack",width:25,content:[{type:"react-component",component:Zr.COMPONENT,title:Zr.TITLE,isClosable:!1},{type:"react-component",component:Jr.COMPONENT,title:Jr.TITLE,isClosable:!1}]}]},{type:"row",content:[{type:"stack",title:"Notebooks",content:[]}]}]}],links:[],filterSets:[],version:2},D1={layoutConfig:[],links:[],filterSets:[],version:2};function xp(t){if(y1(t))return t;if(I1(t))return{layoutConfig:t,links:[],filterSets:[],version:2};throw new Error(`Unexpected layout import format: ${t}`)}async function M1(t,e=!0){try{const n=await t.getLayouts();if(n.length>0)try{const s=await t.getLayout(n[0]);return xp(s)}catch(s){Dr.error("Unable to load layout",n[0],":",s),Dr.warn("No valid layouts found, falling back to default layout")}}catch(n){Dr.error("Unable to fetch layout list",n),Dr.warn("Falling back to default layout")}return e?R1:D1}function N1(t){const{filterSets:e,layoutConfig:n,links:s}=t;return{filterSets:e,layoutConfig:n,links:s,version:2}}const Pr={exportLayout:N1,getDefaultLayout:M1,normalizeLayout:xp},Mr=X.module("DownloadServiceWorkerUtils"),_p=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(),Mr.info("Registering service worker on ",e,n)}).catch(n=>{Mr.error("Failed to register service worker",n)})}):Mr.info("Service worker is not supported."))}static async getServiceWorker(){if("serviceWorker"in navigator){const e=(await navigator.serviceWorker.getRegistrations()).find(n=>n.scope.endsWith(_p.DOWNLOAD_PATH));if(e&&e.active)return Mr.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 sl=_p;sl.DOWNLOAD_PATH="/download/";const kp={react:Y},F1=Jp(kp),x1=eg({requires:F1}),_1=tg.createRequires(kp),k1=ng({requires:_1}),L1=X.module("PluginUtils");class Ka{static loadComponentPlugin(e){if("".split(",").includes(e)){const o=Y.lazy(()=>dg(()=>import(`./internal/${e}`),[])),r=Y.forwardRef((l,a)=>h(S.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=Y.forwardRef((o,r)=>h(x1,{url:s,render:({err:l,Component:a})=>{if(l!=null&&l!==""){const d=`Error loading plugin ${e} from ${s} due to ${l}`;return L1.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 k1(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 _t=X.module("AppMainContainer");class No extends S.exports.Component{constructor(e){super(e),this.getDashboardPlugins=ge(n=>[...n.entries()].filter(([,{DashboardPlugin:s}])=>s).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=Y.createRef(),this.state={contextActions:[{action:()=>{this.handleToolSelect(cn.LINKER)},shortcut:ks.LINKER,isGlobal:!0},{action:()=>{this.sendClearFilter()},shortcut:an.TABLE.CLEAR_ALL_FILTERS,isGlobal:!0},{action:()=>{_t.debug("Consume unhandled save shortcut")},shortcut:ks.SAVE,isGlobal:!0}],isPanelsMenuShown:!1,isSettingsMenuShown:!1,widgets:[]}}static handleWindowBeforeUnload(e){e.preventDefault(),e.returnValue=""}static hydrateConsole(e,n){return _a.hydrate({...e,unzip:s=>Kh.loadAsync(s).then(i=>Object.values(i.files))},n)}componentDidMount(){this.initWidgets(),window.addEventListener("beforeunload",No.handleWindowBeforeUnload)}componentDidUpdate(e){const{dashboardData:n}=this.props;e.dashboardData!==n&&this.handleDataChange(n)}componentWillUnmount(){this.deinitWidgets(),window.removeEventListener("beforeunload",No.handleWindowBeforeUnload)}initWidgets(){const{connection:e}=this.props;if(e.subscribeToFieldUpdates==null){_t.warn("subscribeToFieldUpdates not supported, not initializing widgets");return}this.widgetListenerRemover=e.subscribeToFieldUpdates(n=>{_t.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){_t.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(He.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){Ee.isCanceled(e)||_t.error(e)}handleSettingsMenuHide(){this.setState({isSettingsMenuShown:!1})}handleSettingsMenuShow(){this.setState({isSettingsMenuShown:!0})}handleControlSelect(e,n=null){switch(_t.debug("handleControlSelect",e),e){case Cn.DROPDOWN_FILTER:this.emitLayoutEvent(Pe.OPEN_DROPDOWN,{title:"DropdownFilter",type:e,createNewStack:!0,dragEvent:n});break;case Cn.INPUT_FILTER:this.emitLayoutEvent(Pe.OPEN_INPUT,{title:"InputFilter",type:e,createNewStack:!0,dragEvent:n});break;case Cn.MARKDOWN:this.emitLayoutEvent(ap.OPEN,{title:"Markdown",type:e,dragEvent:n});break;case Cn.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){_t.debug("handleToolSelect",e);const{activeTool:n,setActiveTool:s}=this.props;s(n===e?cn.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}),_t.debug("handleWidgetSelect",e,n),this.openWidget(e,n)}handleWidgetsMenuClose(){this.setState({isPanelsMenuShown:!1})}handleAutoFillClick(){const{widgets:e}=this.state;_t.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(){_t.info("handleExportLayoutClick"),this.setState({isPanelsMenuShown:!1});try{const{workspace:e}=this.props,{data:n}=e,s=Pr.exportLayout(n);_t.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){_t.error("Unable to export layout",e)}}handleImportLayoutClick(){_t.info("handleImportLayoutClick"),this.setState({isPanelsMenuShown:!1}),this.importElement.current!=null&&(this.importElement.current.value="",this.importElement.current.click())}handleResetLayoutClick(){_t.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}=Pr.normalizeLayout(o);s({layoutConfig:l}),n(Rn,{filterSets:r,links:a})}catch(n){_t.error("Unable to import layout",n)}}async resetLayout(){const{layoutStorage:e,session:n}=this.props,{filterSets:s,layoutConfig:i,links:o}=await Pr.getDefaultLayout(e,n!==void 0),{updateDashboardData:r,updateWorkspaceData:l}=this.props;l({layoutConfig:i}),r(Rn,{filterSets:s,links:o})}handlePaste(e){let n=e.currentTarget.parentElement;for(;n!=null;){if(n.classList.contains("monaco-editor"))return;n=n.parentElement}const{clipboardData:s}=e,i=s.getData("Text"),o=/“|”/g;o.test(i)&&(e.preventDefault(),e.stopPropagation(),document.execCommand("insertText",!1,i.replace(o,'"')))}handleLoadTablePlugin(e){const{plugins:n}=this.props,s=n.get(e);return s!=null&&s.TablePlugin!=null?s.TablePlugin:Ka.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 _a.hydrate(e,n)}hydrateGrid(e,n){return this.hydrateTable(e,n,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:sl.getServiceWorker,loadPlugin:this.handleLoadTablePlugin,localDashboardId:n,makeModel:()=>T1(i,e.metadata,s)}}hydrateChart(e,n){const{connection:s}=this.props;return{...e,localDashboardId:n,makeModel:()=>{const{metadata:i,panelState:o}=e;return v1(s,i,o)}}}openWidget(e,n){const{connection:s}=this.props;this.emitLayoutEvent(Me.OPEN,{dragEvent:n,fetch:()=>s.getObject(e),widget:e})}render(){const{activeTool:e,plugins:n,user:s,workspace:i}=this.props,{data:o}=i,{layoutConfig:r}=o,{permissions:l}=s,{canUsePanels:a}=l,{contextActions:d,isPanelsMenuShown:c,isSettingsMenuShown:u,widgets:m}=this.state,p=this.getDashboardPlugins(n);return v("div",{className:W("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:v("div",{className:"app-main-top-nav-menus",children:[h("img",{src:Np,alt:"Deephaven Data Labs",width:"115px",className:"ml-1"}),v("div",{children:[v(Q,{kind:"ghost",className:"btn-panels-menu",icon:Gf,onClick:()=>{},children:["Controls",h(tc,{handleControlSelect:this.handleControlSelect,handleToolSelect:this.handleToolSelect,onClearFilter:this.handleClearFilter})]}),a&&v(Q,{kind:"ghost",className:"btn-panels-menu btn-show-panels","data-testid":"app-main-panels-button",onClick:this.handleWidgetMenuClick,icon:Bf,children:["Panels",h(Fn,{isShown:c,className:"panels-menu-popper",onExited:this.handleWidgetsMenuClose,closeOnBlur:!0,interactive:!0,children:h(w1,{widgets:m,onExportLayout:this.handleExportLayoutClick,onImportLayout:this.handleImportLayoutClick,onResetLayout:this.handleResetLayoutClick,onSelect:this.handleWidgetSelect})})]}),h(Q,{kind:"ghost",className:W("btn-settings-menu",{"text-warning":s.operateAs!==s.name}),onClick:this.handleSettingsMenuShow,icon:h(q,{icon:Vo,transform:"grow-3 right-1 down-1"}),tooltip:"User Settings"})]})]})}),v(aw,{emptyDashboard:h(E1,{onAutoFillClick:this.handleAutoFillClick}),id:Rn,layoutConfig:r,onGoldenLayoutChange:this.handleGoldenLayoutChange,onLayoutConfigChange:this.handleLayoutConfigChange,onLayoutInitialized:this.openNotebookFromURL,hydrate:this.hydrateDefault,children:[h(BE,{hydrate:this.hydrateGrid,getDownloadWorker:sl.getServiceWorker,loadPlugin:this.handleLoadTablePlugin}),h(OE,{hydrate:this.hydrateChart}),h(AE,{}),h(HE,{hydrateConsole:No.hydrateConsole,notebooksUrl:new URL("/notebooks/",`${window.location}`).href}),h(VE,{}),h(YE,{hydrate:this.hydratePandas}),h(qE,{}),h(KE,{}),p]}),h(ht,{in:u,timeout:Tt.transitionMidMs,classNames:"slide-left",mountOnEnter:!0,unmountOnExit:!0,children:h(qo,{onDone:this.handleSettingsMenuHide})}),h(ie,{actions:d}),h("input",{ref:this.importElement,type:"file",accept:".json",style:{display:"none"},onChange:this.handleImportLayoutFiles})]})}}const O1=t=>{var e,n;return{activeTool:Tl(t),dashboardData:qt(t,Rn),layoutStorage:S1(t),plugins:uS(t),connection:YT(t,Rn),session:(e=gi(t,Rn))==null?void 0:e.session,sessionConfig:(n=gi(t,Rn))==null?void 0:n.config,user:Ju(t),workspace:wl(t)}},A1=Mt(O1,{setActiveTool:El,updateDashboardData:qn,updateWorkspaceData:cm})(sg(No)),P1=()=>v("div",{className:"app",children:[h(A1,{}),h(mu,{})]});X.module("StorageTableViewportUpdater");class Hh{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(zt.and)}),{filterItems:n,filterOperators:s}}static combineFilterConfigs(e,n,s=zt.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 ga=X.module("PouchStorageTable"),H1="Deephaven.";qh.plugin(ig);function V1(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 U1(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]:V1(l,a)};if(i===0)s=d;else if(s!==null&&i-1<n.length){const c=n[i-1];if(c===zt.and)s={$and:[s,d]};else if(c===zt.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 fa(t=[]){return{$and:[...t.map(e=>U1(e)),{name:{$gt:null}},{id:{$gt:null}}]}}function B1(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 $1{constructor(e){this.listeners=[],this.itemListeners=new Map,this.currentSize=0,this.currentReverse=!1,this.currentFilter=null,this.currentSort=null,this.db=new qh(`${H1}${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){ga.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=Ee.makeCancelable(this.db.find({selector:fa((n=this.currentFilter)!=null?n:[]),fields:[]}));const s=await this.infoUpdatePromise;this.currentSize=s.docs.length,this.sendUpdate()}catch(s){if(!Ee.isCanceled(s))throw ga.error("Unable to refreshInfo",s),s}}async refreshData(){var e,n;if(!!this.currentViewport)try{const{currentViewport:s}=this,i=B1(this.currentSort,this.currentReverse);(e=this.viewportUpdatePromise)==null||e.cancel(),this.viewportUpdatePromise=Ee.makeCancelable(this.db.find({selector:fa((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(!Ee.isCanceled(s))throw ga.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:fa((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 Vh extends $1{constructor(e){super(`CommandHistoryStorage.${e}`)}setSearch(e){this.setFilters(e?[Hh.makeFilterConfig([Hh.makeFilterItem("name",K.contains,e)])]:[])}}const Uh=X.module("PouchCommandHistoryStorage");class W1{constructor(){this.updateTableMap=new Map}getUpdateTable(e){return this.updateTableMap.has(e)||this.updateTableMap.set(e,new Vh(e)),this.updateTableMap.get(e)}async getTable(e){return new Vh(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 Uh.debug("Updating item",o),await s.put(o),Uh.debug("Update saved"),n}listenItem(e,n,s){return this.getUpdateTable(e).onItemUpdate(n,s)}}const z1=X.module("LocalWorkspaceStorage"),Eo=class{static async makeDefaultWorkspaceData(t,e){const{filterSets:n,links:s,layoutConfig:i}=await Pr.getDefaultLayout(t,e==null?void 0:e.isConsoleAvailable);return{settings:{defaultDateTimeFormat:lt.DEFAULT_DATETIME_FORMAT_STRING,formatter:[],timeZone:lt.DEFAULT_TIME_ZONE_ID,showTimeZone:!1,showTSeparator:!0,disableMoveConfirmation:!1,defaultDecimalFormatOptions:{defaultFormatString:Ue.DEFAULT_FORMAT_STRING},defaultIntegerFormatOptions:{defaultFormatString:dt.DEFAULT_FORMAT_STRING},truncateNumbersWithPound:!1},layoutConfig:i,closed:[{}],links:s,filterSets:n}}static async makeDefaultWorkspace(t,e){return{data:await Eo.makeDefaultWorkspaceData(t,e)}}constructor(t){this.layoutStorage=t}async load(t){var e;try{return JSON.parse((e=localStorage.getItem(Eo.STORAGE_KEY))!=null?e:"")}catch{return z1.info("Unable to load workspace data, initializing to default data"),Eo.makeDefaultWorkspace(this.layoutStorage,t)}}async save(t){return localStorage.setItem(Eo.STORAGE_KEY,JSON.stringify(t)),t}};let Lp=Eo;Lp.STORAGE_KEY="deephaven.WorkspaceStorage";class G1 extends Error{constructor(){super(...arguments),this.isNoConsolesError=!0}}function K1(t){return t.isNoConsolesError}const Li=X.module("SessionUtils");function q1(){return new URL("/jsapi",`${window.location}`)}function Op(){const t=q1();return`${t.protocol}//${t.host}`}function Y1(){const t=Op();return Li.info(`Starting connection to '${t}'...`),new M.IdeConnection(t)}async function X1(t){Li.info("Getting console types...");const e=await t.getConsoleTypes();if(Li.info("Available types:",e),e.length===0)throw new G1("No console types available");const n=e[0];Li.info("Starting session with type",n);const s=await t.startSession(n),i={type:n,id:ze.generate()};return Li.info("Console session established",i),{session:s,config:i,connection:t}}function j1(){const t=Op();return Li.info("createCoreClient",t),new M.CoreClient(t)}class Q1{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 Co=X.module("GrpcFileStorageTable"),qa=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=Xe(this.doRefresh.bind(this),qa.REFRESH_DEBOUNCE))}removeBaseRoot(t){return de.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 qa(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){Co.debug2("doRefresh",this.root),t(this.fetchData())}refresh(){var n;Co.debug2("refresh",this.root),(n=this.viewportUpdatePromise)==null||n.cancel();const t=new Promise(s=>{this.doRefresh(s)}),e=Ee.makeCancelable(t.then(s=>{if(this.viewportUpdatePromise!==e)throw new ai;return this.currentViewportData=s,this.sendUpdate(),s}));e.catch(s=>{Ee.isCanceled(s)||Co.error("Error updating viewport",s)}),this.viewportUpdatePromise=e}refreshInternal(){try{this.refresh()}catch(t){Ee.isCanceled(t)||Co.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,Co.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 Ap=qa;Ap.REFRESH_DEBOUNCE=50;const Z1=X.module("GrpcFileStorage"),Pp=class{constructor(t,e=""){this.tables=[],this.refreshTables=ui(()=>{this.tables.every(n=>n.refresh().catch(()=>{}))},Pp.REFRESH_THROTTLE),this.storageService=t,this.root=e}removeRoot(t){return de.removeRoot(this.root,t)}addRoot(t){return de.addRoot(this.root,t)}async createDirectory(t){return await this.storageService.createDirectory(this.addRoot(t)),this.refreshTables(),{type:"directory",id:t,filename:t,basename:de.getBaseName(t)}}async getTable(){const t=new Ap(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:de.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(de.getPath(t)),de.getBaseName(t));if(e.length===0)throw new Yd;if(e.length>1)throw Z1.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:this.removeRoot(n.basename),id:this.removeRoot(n.filename),type:n.type}}};let Hp=Pp;Hp.REFRESH_THROTTLE=150;const ri=X.module("AppInit");async function J1(){ri.debug("Loading plugins...");try{const t=await Ka.loadJson("/js-plugins/manifest.json");ri.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(Ka.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 ri.info("Plugins loaded:",s),s}catch(t){return ri.error("Unable to load plugins:",t),new Map}}async function e2(t){let e;try{e=await X1(t)}catch(n){if(!K1(n))throw n}return e}const 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}=t,[p,g]=S.exports.useState(),[f,b]=S.exports.useState(!0),C=S.exports.useCallback(async()=>{var I,D;try{ri.info("Initializing Web UI","0.20.0",navigator.userAgent);const N=await J1(),x=Y1(),U=await e2(x);x.addEventListener(M.IdeConnection.HACK_CONNECTION_FAILURE,J=>{var fe;const{detail:me}=J;ri.error("Connection failure",me),g(`Unable to connect: ${(fe=me.details)!=null?fe:"Unknown Error"}`)});const $="user",L={name:$,operateAs:$,groups:[],permissions:{isSuperUser:!1,isQueryViewOnly:!1,isNonInteractive:!1,canUsePanels:!0,canCreateDashboard:!0,canCreateCodeStudio:!0,canCreateQueryMonitor:!0,canCopy:!0,canDownloadCsv:!0}},H=j1();await H.login({type:M.CoreClient.LOGIN_TYPE_ANONYMOUS});const O=H.getStorageService(),F=new Q1(O,"/layouts"),_=new Hp(O,"/notebooks"),k=new Lp(F),V=new W1,z=await k.load({isConsoleAvailable:U!==void 0}),{data:j}=z,{settings:ee}=j;ee.defaultDecimalFormatOptions===void 0&&(ee.defaultDecimalFormatOptions={defaultFormatString:Ue.DEFAULT_FORMAT_STRING}),ee.defaultIntegerFormatOptions===void 0&&(ee.defaultIntegerFormatOptions={defaultFormatString:dt.DEFAULT_FORMAT_STRING}),ee.truncateNumbersWithPound===void 0&&(ee.truncateNumbersWithPound=!1);const{shortcutOverrides:ve={}}=ee,Se=Wt.isMacPlatform?(I=ve.mac)!=null?I:{}:(D=ve.windows)!=null?D:{};Object.entries(Se).forEach(([J,me])=>{var fe;(fe=Be.get(J))==null||fe.setKeyState(me)});const Oe={filterSets:j.filterSets,links:j.links};n(cn.DEFAULT),s(V),i(Rn,Oe),o(_),r(F),l(Rn,x),U!==void 0&&a(Rn,U),d(N),c(L),m(k),u(z)}catch(N){ri.error(N),g(N)}},[n,s,i,o,r,l,a,d,c,u,m]),w=S.exports.useCallback(()=>{document.fonts!=null?document.fonts.ready.then(()=>{b(!1)}):b(!1)},[]);S.exports.useEffect(function(){C(),w()},[C,w]);const T=e==null&&p==null||f,E=!T&&p==null,y=p!=null?`${p}`:null;return v(he,{children:[E&&h(P1,{}),h(ml,{isLoading:T,isLoaded:E,errorMessage:y}),v("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:R.exports.shape({}),workspaceStorage:R.exports.shape({close:R.exports.func}),setActiveTool:R.exports.func.isRequired,setCommandHistoryStorage:R.exports.func.isRequired,setDashboardData:R.exports.func.isRequired,setFileStorage:R.exports.func.isRequired,setLayoutStorage:R.exports.func.isRequired,setDashboardConnection:R.exports.func.isRequired,setDashboardSessionWrapper:R.exports.func.isRequired,setPlugins:R.exports.func.isRequired,setUser:R.exports.func.isRequired,setWorkspace:R.exports.func.isRequired,setWorkspaceStorage:R.exports.func.isRequired};nc.defaultProps={workspace:null,workspaceStorage:null};const t2=t=>({workspace:wl(t),workspaceStorage:sS(t)}),Bh=Mt(t2,{setActiveTool:El,setCommandHistoryStorage:gS,setDashboardData:Om,setFileStorage:fS,setLayoutStorage:t1,setDashboardConnection:XT,setDashboardSessionWrapper:jT,setPlugins:bS,setUser:mS,setWorkspace:dm,setWorkspaceStorage:pS})(nc),n2=()=>h(og,{basename:"/ide/",children:v(rg,{children:[h(mc,{exact:!0,path:"/",component:Bh}),h(mc,{path:"/notebook/:notebookPath+",component:Bh}),h(lg,{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 s2(){"serviceWorker"in navigator&&navigator.serviceWorker.getRegistrations().then(t=>{t.forEach(e=>{e.scope.endsWith("/download/")||e.unregister()})})}u1();hi.render(h(zh,{store:yl,children:h(n2,{})}),document.getElementById("root"));s2();sl.registerOnLoaded();rt.init();window["__react-beautiful-dnd-disable-dev-warnings"]=!0;
|
|
44
|
+
//# sourceMappingURL=index.82e99c26.js.map
|