@deephaven/embed-grid 0.29.1-relative-base-url.1 → 0.29.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
import{B as D,A as T,R as te,P as Oc,C as h,D as dt,E as B,F as R,G as ar,H as he,I as ft,J as Z,K as Fe,L as sn,M as kc,N as Lc,O as cr,Q as pi,S as Pc,T as dr,U as ze,V as Ji,W as Ie,X as ct,Y as gi,Z as jr,_ as Hc,$ as en,a0 as _c,a1 as Vc,a2 as Uc,a3 as Bc,a4 as er,a5 as Gc,a6 as zc,a7 as Wc,a8 as Zr,a9 as $c,aa as qc,ab as Jr,ac as Kc,ad as Xc,ae as Yc,af as Qc,ag as jc,ah as Zn,ai as Zc,aj as tr,ak as Zl}from"./vendor.1aa3c569.js";import{e as vn,l as As,K as Ft,a as el,b as Zt}from"./monaco.b3653ac5.js";import{P as si,b as Jc,h as ed,p as td,o as nd,s as sd,t as od,c as Hi}from"./plotly.f816e168.js";import"./helpers.162e09a8.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))s(o);new MutationObserver(o=>{for(const i of o)if(i.type==="childList")for(const r of i.addedNodes)r.tagName==="LINK"&&r.rel==="modulepreload"&&s(r)}).observe(document,{childList:!0,subtree:!0});function n(o){const i={};return o.integrity&&(i.integrity=o.integrity),o.referrerpolicy&&(i.referrerPolicy=o.referrerpolicy),o.crossorigin==="use-credentials"?i.credentials="include":o.crossorigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function s(o){if(o.ep)return;o.ep=!0;const i=n(o);fetch(o.href,i)}})();const id="#1a171a",rd="#f0f0ee",ld="#fcd65b",ad="#9edc6f",cd="#76d9e4",dd="#aa9af4",ud="#f37e3f",hd="#f95d84",md="#4878ea",pd="#5b5a5c",gd="#9edc6f",fd="#fcd65b",Cd="#f37e3f",wd="#f95d84",Sd="#fcfcfa",bd="#929192",vd="#373438",Td="#1a171a",Ed="#f0f0ee",Rd="0.15s",yd={"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:id,white:rd,yellow:ld,green:ad,blue:cd,purple:dd,orange:ud,red:hd,primary:md,"primary-hover":"#235de6","primary-dark":"#343e5d",secondary:pd,success:gd,info:fd,warning:Cd,danger:wd,light:Sd,mid:bd,dark:vd,"text-muted":"#929192","content-bg":"#2d2a2e",background:Td,foreground:Ed,transition:Rd},Id={transitionMs:150,transitionMidMs:200,transitionLongMs:300,transitionSlowMs:1e3},Le=Object.freeze({...Id,...yd});class Rn extends T.exports.Component{constructor(t){super(t),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=te.createRef(),this.rAF=0;const{isShown:n}=this.props;this.state={show:n,popper:null}}componentDidUpdate(t){const{isShown:n}=this.props;t.isShown!==n&&(n?(cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{this.show()})):this.hide())}componentWillUnmount(){this.destroyPopper(!1)}getVisibleElement(t){return t==null||t.clientHeight>0||t.clientWidth>0?t:this.getVisibleElement(t.parentElement)}initPopper(){let{popper:t}=this.state;const{closeOnBlur:n,referenceObject:s}=this.props;if(t||this.container.current===null)return;let{options:o}=this.props;o={placement:"auto",modifiers:{preventOverflow:{boundariesElement:"viewport"}},...o},document.body.appendChild(this.element);let i=this.getVisibleElement(this.container.current);i==null&&(i=this.container.current),t=new Oc(s||i,this.element,o),t.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:t})}destroyPopper(t=!0){cancelAnimationFrame(this.rAF);const{popper:n}=this.state;!n||(n.destroy(),document.body.contains(this.element)&&document.body.removeChild(this.element),t&&this.setState({popper:null}))}show(){this.initPopper(),this.setState({show:!0})}hide(){this.setState({show:!1})}scheduleUpdate(){const{popper:t}=this.state;t&&t.scheduleUpdate()}handleBlur(t){t.relatedTarget instanceof HTMLElement&&(this.element.contains(t.relatedTarget)||this.hide())}handleEnter(){const{onEntered:t}=this.props;t()}handleExit(){const{onExited:t}=this.props,{show:n}=this.state;n||this.destroyPopper(),t()}renderContent(){const{className:t,children:n,timeout:s,interactive:o,closeOnBlur:i}=this.props,{show:r}=this.state;return h(dt,{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:B("popper",{interactive:o},t),onBlur:i?this.handleBlur:void 0,tabIndex:i?-1:void 0,role:"presentation",children:R("div",{className:"popper-content",children:[n,h("div",{className:"popper-arrow","x-arrow":""})]})})})}render(){const{popper:t}=this.state,{"data-testid":n}=this.props;return h("div",{className:"popper-parent-container",ref:this.container,style:{display:"none"},"data-testid":n,children:t&&ar.createPortal(this.renderContent(),this.element)})}}Rn.propTypes={children:D.exports.node.isRequired,options:D.exports.shape({}),className:D.exports.string,timeout:D.exports.number,onEntered:D.exports.func,onExited:D.exports.func,isShown:D.exports.bool,closeOnBlur:D.exports.bool,interactive:D.exports.bool,referenceObject:D.exports.shape({}),"data-testid":D.exports.string};Rn.defaultProps={options:{},className:"",timeout:Le.transitionMs,onEntered(){},onExited(){},isShown:!1,interactive:!1,closeOnBlur:!1,referenceObject:null,"data-testid":void 0};const Md=-1,Jl=0,ea=1,ur=2,ta=3,na=4;Object.freeze({SILENT:Md,ERROR:Jl,WARN:ea,INFO:ur,DEBUG:ta,DEBUG2:na});const xt=()=>{};class tl{constructor(t,n){this.name=t,this.prefix=t!=null?`[${t}]`:"",this.error=xt,this.warn=xt,this.log=xt,this.info=xt,this.debug=xt,this.debug2=xt,this.level=n,this.setLogLevel(n)}setLogLevel(t){if(!Number.isFinite(t)){console.warn(`Expected a number for log level. Received: ${t}. Ignoring`);return}this.level=t,this.error=t>=Jl?console.error.bind(console,this.prefix):xt,this.warn=t>=ea?console.warn.bind(console,this.prefix):xt,this.log=t>=ur?console.log.bind(console,this.prefix):xt,this.info=this.log,this.debug=t>=ta?console.debug.bind(console,this.prefix):xt,this.debug2=t>=na?console.debug.bind(console,this.prefix):xt}}class Dd extends tl{constructor(t=ur){super(null,t),this.modules={}}module(t){return this.modules[t]==null&&(this.modules[t]=new tl(t,this.level)),this.modules[t]}setLogLevel(t){if(super.setLogLevel(t),this.modules==null)return;const n=Object.keys(this.modules);for(let s=0;s<n.length;s+=1)this.modules[n[s]].setLogLevel(t)}}const se=new Dd,Nd=se.module("Tooltip"),St=class extends T.exports.Component{constructor(e){super(e),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.handleWindowMouseMove=this.handleWindowMouseMove.bind(this),this.handleWheel=this.handleWheel.bind(this),this.handleTimeout=this.handleTimeout.bind(this),this.handleExited=this.handleExited.bind(this),this.stopShowingTooltip=this.stopShowingTooltip.bind(this),this.container=te.createRef(),this.popper=te.createRef(),this.parent=null,this.timer=null,this.state={isShown:!1}}static handleHidden(){St.shownTooltipCount-=1,St.shownTooltipCount===0&&(St.lastHiddenTime=Date.now())}static handleShown(){St.shownTooltipCount+=1}componentDidMount(){this.startListening();const{timeout:e}=this.props;e===0&&this.show()}componentDidUpdate(e,t){const{isShown:n}=t,{isShown:s}=this.state;s!==n&&(s?St.handleShown():St.handleHidden())}componentWillUnmount(){this.stopListening(),this.stopListeningWindow(),this.stopTimer();const{isShown:e}=this.state;e&&St.handleHidden()}startListening(){if(!this.container.current||!this.container.current.parentElement){Nd.error("Tooltip doesn't have a container or a parent set!");return}this.parent=this.container.current.parentElement,this.parent.addEventListener("mousemove",this.handleMouseMove),this.parent.addEventListener("mouseleave",this.handleMouseLeave),this.parent.addEventListener("mousedown",this.stopShowingTooltip)}stopListening(){!this.parent||(this.parent.removeEventListener("mousemove",this.handleMouseMove),this.parent.removeEventListener("mouseleave",this.handleMouseLeave),this.parent.removeEventListener("mousedown",this.stopShowingTooltip))}startListeningWindow(){window.addEventListener("mousemove",this.handleWindowMouseMove,!0),window.addEventListener("contextmenu",this.stopShowingTooltip,!0),window.addEventListener("wheel",this.handleWheel)}stopListeningWindow(){window.removeEventListener("mousemove",this.handleWindowMouseMove,!0),window.removeEventListener("contextmenu",this.stopShowingTooltip,!0),window.removeEventListener("wheel",this.handleWheel)}handleMouseMove(){this.startTimer()}handleWheel(){const{isShown:e}=this.state;this.popper.current&&this.parent&&e&&!this.popper.current.element.matches(":hover")&&!this.parent.matches(":hover")&&(this.stopTimer(),this.hide())}handleMouseLeave(){const{isShown:e}=this.state;this.stopTimer();const{interactive:t}=this.props;!t&&e&&this.hide()}handleTimeout(){this.show()}handleWindowMouseMove(e){const t=e.clientX,n=e.clientY,{isShown:s}=this.state;if(!this.popper.current||!this.parent)return;const o=this.popper.current.element.getBoundingClientRect(),i=this.parent.getBoundingClientRect();t>=o.left&&t<=o.left+o.width&&n>=o.top&&n<=o.top+o.height?this.handleMouseMove():t>=i.left&&t<=i.left+i.width&&n>=i.top&&n<=i.top+i.height?this.handleMouseMove():s&&(this.stopTimer(),this.hide())}startTimer(){this.stopTimer();const{timeout:e,reshowTimeout:t}=this.props;let n=e;(St.shownTooltipCount>0||Date.now()-St.lastHiddenTime<St.triggerReshowThreshold)&&(n=t),this.timer=window.setTimeout(this.handleTimeout,n)}stopTimer(){this.timer!=null&&(clearTimeout(this.timer),this.timer=null)}show(){var t;const{isShown:e}=this.state;if(this.stopTimer(),!e){(t=this.popper.current)==null||t.show(),this.setState({isShown:!0});const{interactive:n}=this.props;n&&this.startListeningWindow()}}hide(){var e;(e=this.popper.current)==null||e.hide(),this.stopListeningWindow()}update(){var e;(e=this.popper.current)==null||e.scheduleUpdate()}handleExited(){this.setState({isShown:!1});const{onExited:e}=this.props;e()}stopShowingTooltip(){const{isShown:e}=this.state;this.stopTimer(),e&&this.hide()}render(){const{interactive:e,children:t,referenceObject:n,popperClassName:s,"data-testid":o,onEntered:i}=this.props,{isShown:r}=this.state;let{options:l}=this.props;return l={placement:"bottom",...l},h("div",{ref:this.container,style:{display:"none"},"data-testid":o,children:h(Rn,{className:B(s),options:l,ref:this.popper,onEntered:i,onExited:this.handleExited,interactive:e,referenceObject:n,children:R("div",{className:"tooltip-content",children:[" ",r&&t]})})})}};let We=St;We.defaultTimeout=500;We.defaultReshowTimeout=100;We.triggerReshowThreshold=300;We.shownTooltipCount=0;We.lastHiddenTime=Date.now();We.defaultProps={interactive:!1,options:{},popperClassName:"",reshowTimeout:St.defaultReshowTimeout,timeout:St.defaultTimeout,onEntered:()=>{},onExited:()=>{},"data-testid":void 0};const Fd=100;var sa=(e=>(e.UP="UP",e.DOWN="DOWN",e))(sa||{});const is=class extends T.exports.Component{constructor(e){super(e),this.getCachedFilteredOptions=he((n,s)=>n.filter(o=>o.title.toLowerCase().indexOf(s.toLowerCase())>=0));let{popperOptions:t}=this.props;t={placement:"bottom-end",modifiers:{preventOverflow:{enabled:!1}},...t},this.state={title:"",filteredOptions:[],keyboardOptionIndex:0,menuIsOpen:!1,inputWidth:100,invalid:!1,popperOptions:t},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=ft(this.updateInputValue,Fd),this.handleOptionClick=this.handleOptionClick.bind(this),this.handleMenuOpened=this.handleMenuOpened.bind(this),this.handleMenuExited=this.handleMenuExited.bind(this),this.popper=te.createRef(),this.cbContainer=te.createRef(),this.menuContainer=te.createRef(),this.input=te.createRef()}setInputWidth(){this.cbContainer.current&&this.setState({inputWidth:this.cbContainer.current.getBoundingClientRect().width})}getValueAndValidate(e){if(!e)return this.setState({invalid:!1}),{value:e,isValid:!1};const{options:t}=this.props,n=t.filter(s=>s.title.toLowerCase()===e.toLowerCase());return n.length<1?(this.setState({invalid:!0}),{value:e,isValid:!1}):(this.setState({invalid:!1}),{value:n[0].value,isValid:!0})}updateInputValue(e){const{menuIsOpen:t}=this.state,{value:n,isValid:s}=this.getValueAndValidate(e);t&&this.processFilterChange(e),this.fireOnChange(n,s)}fireOnChange(e,t=!0){const{onChange:n}=this.props;n(e,t)}processFilterChange(e){var i;const{options:t}=this.props,{menuIsOpen:n}=this.state,s=e?this.getCachedFilteredOptions(t,e):t,o=s.length===1&&s[0].title===e;if(this.setState({filteredOptions:s,keyboardOptionIndex:0}),o&&n){this.closeMenu();return}(i=this.popper.current)==null||i.scheduleUpdate()}resetValue(){this.setState({title:""}),this.fireOnChange("")}handleResize(){this.setInputWidth()}handleMenuKeyDown(e){var o;const{filteredOptions:t,keyboardOptionIndex:n}=this.state,s=t[n];switch(e.key){case"Enter":case"ArrowRight":e.stopPropagation(),e.preventDefault(),s!=null&&(this.setState({title:s.title,invalid:!1}),this.fireOnChange(s.value)),this.closeMenu(),(o=this.input.current)==null||o.focus();break;case"ArrowUp":e.stopPropagation(),e.preventDefault(),this.navigateMenu(is.MENU_NAVIGATION_DIRECTION.UP);break;case"ArrowDown":e.stopPropagation(),e.preventDefault(),this.navigateMenu(is.MENU_NAVIGATION_DIRECTION.DOWN);break;case"Tab":if(e.stopPropagation(),e.preventDefault(),e.shiftKey){this.navigateMenu(is.MENU_NAVIGATION_DIRECTION.UP);break}this.navigateMenu(is.MENU_NAVIGATION_DIRECTION.DOWN);break;case"Escape":e.preventDefault(),e.stopPropagation(),this.closeMenu();break}}navigateMenu(e){const{filteredOptions:t,keyboardOptionIndex:n}=this.state;let s=n;e===is.MENU_NAVIGATION_DIRECTION.UP?n>0?(s=(s-1)%t.length,this.setState({keyboardOptionIndex:s})):n===0&&(s=t.length-1,this.setState({keyboardOptionIndex:s})):e===is.MENU_NAVIGATION_DIRECTION.DOWN&&n<t.length&&(s=(s+1)%t.length,this.setState({keyboardOptionIndex:s})),this.scrollOptionIntoView(s)}handleInputKeyDown(e){const{onEnter:t}=this.props,{menuIsOpen:n}=this.state;n?this.handleMenuKeyDown(e):e.key==="Enter"?t():e.key==="Escape"?(this.resetValue(),e.preventDefault(),e.stopPropagation()):e.key==="ArrowRight"||e.key==="ArrowLeft"||e.key==="Tab"||e.key==="Shift"||this.openMenu()}handleInputChange(e){this.setState({title:e.target.value}),this.updateInputValue(e.target.value)}handleOptionClick(e){var t;this.setState({title:e.title,invalid:!1}),this.fireOnChange(e.value),this.closeMenu(),(t=this.input.current)==null||t.focus()}handelInputFocus(){const{menuIsOpen:e}=this.state;e||this.openMenu()}handleInputClick(){const{menuIsOpen:e}=this.state;e||this.openMenu()}handleInputBlur(e){const{menuIsOpen:t}=this.state;t&&e.relatedTarget instanceof Element&&this.popper.current!==null&&this.popper.current.element.contains(e.relatedTarget)||this.closeMenu(!1)}handleMenuBlur(e){e.relatedTarget===this.input.current||e.relatedTarget instanceof Element&&this.popper.current!==null&&this.popper.current.element.contains(e.relatedTarget)||this.closeMenu(!1)}handleMenuOpened(){var e;(e=this.input.current)==null||e.focus()}handleMenuExited(){const{menuIsOpen:e}=this.state;e&&this.setState({menuIsOpen:!1,keyboardOptionIndex:0})}openMenu(){const{title:e}=this.state;this.processFilterChange(e),this.setInputWidth(),this.setState({menuIsOpen:!0}),window.requestAnimationFrame(()=>{var t;(t=this.popper.current)==null||t.show()})}closeMenu(e=!0){var t,n;this.setState({menuIsOpen:!1,keyboardOptionIndex:0}),e&&((t=this.input.current)==null||t.focus()),(n=this.popper.current)==null||n.hide()}scrollOptionIntoView(e){var t;this.menuContainer.current&&((t=this.menuContainer.current.children.item(e))==null||t.scrollIntoView({behavior:"smooth",block:"nearest"}))}renderMenuElement(){const{inputWidth:e}=this.state;return h("div",{className:B("aci-options"),ref:this.menuContainer,role:"presentation",onKeyDown:this.handleMenuKeyDown,style:{width:e},onBlur:this.handleMenuBlur,children:this.renderOptions()})}renderOptions(){const{noMatchText:e}=this.props,{title:t,filteredOptions:n}=this.state;return t&&n.length===0?h("div",{className:"no-match",children:e}):n.map((s,o)=>this.renderOption(s,o))}renderOption(e,t){const{keyboardOptionIndex:n}=this.state,s=`option-${t}-${e.value}`;return h("button",{type:"button",className:B("aci-option-btn",{"keyboard-active":n===t}),onClick:()=>this.handleOptionClick(e),onFocus:()=>this.setState({keyboardOptionIndex:t}),children:e.title},s)}render(){const{options:e,inputPlaceholder:t,disabled:n,className:s,defaultTitle:o,spellCheck:i,"data-testid":r}=this.props,{title:l,menuIsOpen:a,popperOptions:c,invalid:d}=this.state;return R("div",{className:"aci-container",ref:this.cbContainer,children:[h("input",{value:l||o,className:B("form-control",s,"aci-input",{"is-invalid":d&&!a}),ref:this.input,onChange:this.handleInputChange,placeholder:t||e[0].title,disabled:n,onFocus:this.handelInputFocus,onClick:this.handleInputClick,onBlur:this.handleInputBlur,onKeyDown:this.handleInputKeyDown,spellCheck:i,"data-testid":r}),h(Rn,{ref:this.popper,options:c,className:B("aci-options-popper interactive"),onEntered:this.handleMenuOpened,onExited:this.handleMenuExited,children:this.renderMenuElement()})]})}};let hr=is;hr.propTypes={options:D.exports.arrayOf(D.exports.shape({title:D.exports.string.isRequired,value:D.exports.string.isRequired})).isRequired,popperOptions:D.exports.shape({}),onChange:D.exports.func,inputPlaceholder:D.exports.string,disabled:D.exports.bool,className:D.exports.string,defaultTitle:D.exports.string,spellCheck:D.exports.bool,onEnter:D.exports.func,noMatchText:D.exports.string,"data-testid":D.exports.string};hr.defaultProps={onChange(){},inputPlaceholder:"",disabled:!1,className:"",defaultTitle:"",popperOptions:null,spellCheck:!0,onEnter(){},noMatchText:"No matching items found","data-testid":void 0};hr.MENU_NAVIGATION_DIRECTION=sa;D.exports.string.isRequired,D.exports.func.isRequired,D.exports.string,D.exports.string,D.exports.bool,D.exports.bool,D.exports.string,D.exports.string,D.exports.string;D.exports.node.isRequired,D.exports.string,D.exports.object,D.exports.string;const xd=["primary","secondary","tertiary","success","danger","inline","ghost"],Ad=["group-end"];function Od(e,t){switch(e){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 B("btn-link",{"btn-link-icon":t,"btn-link-icon-only":t})}}function kd(e){switch(e){case"group-end":return B("pl-2","pr-3")}}const X=te.forwardRef((e,t)=>{const{kind:n,variant:s,type:o,tooltip:i,icon:r,disabled:l=!1,active:a,onClick:c,onContextMenu:d,onMouseDown:u,onMouseUp:m,onMouseEnter:p,onMouseLeave:g,onKeyDown:f,className:w,style:C,children:S,tabIndex:b,"data-testid":E,"aria-label":v}=e,y=Boolean(r&&S==null),M=Od(n,y);let A;s&&(A=kd(s));let F;r&&(F=te.isValidElement(r)?r:h(Z,{icon:r}));let V;i!==void 0&&(V=typeof i=="string"?h(We,{children:i}):i);let H=v;v===void 0&&y&&i!=null&&typeof i=="string"&&(H=i);const N=R("button",{"data-testid":E,ref:t,type:o,className:B("btn",M,A,{active:a},w),onClick:c,onContextMenu:d,onMouseUp:m,onMouseDown:u,onMouseEnter:p,onMouseLeave:g,onKeyDown:f,style:C,disabled:l,tabIndex:b,"aria-label":H,children:[r&&F,S,i!=null&&!l&&V]});return l?R("span",{className:"btn-disabled-wrapper",children:[N,i!==void 0&&V]}):N});X.displayName="Button";X.propTypes={kind:D.exports.oneOf(xd).isRequired,variant:D.exports.oneOf(Ad),type:D.exports.oneOf(["submit","reset","button"]),tooltip(e){const{tooltip:t,icon:n,children:s}=e;return t===void 0&&n!=null&&s==null?new Error("Tooltip is required for icon only buttons"):null},icon(e){const{children:t,icon:n}=e;return n==null&&t==null?new Error("Icon is required if no children are provided"):t==null&&!te.isValidElement(n)&&(n==null||n.iconName===""||n.iconName==null)?new Error("Icon must be react element or fontawesome IconDefinition"):null},disabled:D.exports.bool,active:D.exports.bool,onClick(e){const{onClick:t,type:n}=e;return n==="button"&&typeof t!="function"?new Error("type button requires an onClick function"):t!==void 0&&typeof t!="function"?new Error("onClick must be a function"):null},onContextMenu:D.exports.func,onMouseUp:D.exports.func,onMouseDown:D.exports.func,onMouseEnter:D.exports.func,onMouseLeave:D.exports.func,onKeyDown:D.exports.func,tabIndex:D.exports.number,children:D.exports.node,className:D.exports.string,style:D.exports.object,"data-testid":D.exports.string};X.defaultProps={type:"button",onClick:void 0,onContextMenu:void 0,onMouseUp:void 0,onMouseDown:void 0,onMouseEnter:void 0,onMouseLeave:void 0,onKeyDown:void 0,variant:void 0,tooltip:void 0,icon:void 0,disabled:!1,active:void 0,tabIndex:void 0,children:void 0,className:void 0,style:{},"data-testid":void 0};function Ld({className:e="theme-bg-light",children:t,role:n="role",keyboard:s=!0,isOpen:o=!1,centered:i=!1,size:r,onOpened:l,onClosed:a,toggle:c,"data-testid":d}){const u=T.exports.useRef(),m=T.exports.useRef(null),[p,g]=T.exports.useState(!1),f=T.exports.useCallback(C=>{switch(C.key){case"Escape":c==null||c();break}},[c]);T.exports.useEffect(function(){if(o&&s)return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[f,o,s]),T.exports.useEffect(function(){o&&l&&l()},[l,o]),T.exports.useEffect(function(){!o&&a&&a()},[a,o]),o&&!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 w=()=>{u.current&&(document.body.removeChild(u.current),u.current=void 0)};return u.current?ar.createPortal(R(Fe,{children:[h(dt,{appear:!0,mountOnEnter:!0,unmountOnExit:!0,in:o,classNames:{appearActive:"show",appearDone:"show"},timeout:Le.transitionMs,onExited:w,children:h("div",{className:B("modal-backdrop fade"),style:{zIndex:1050}})}),h(dt,{appear:!0,mountOnEnter:!0,unmountOnExit:!0,in:o,classNames:{appearDone:"show"},timeout:Le.transitionMs,onExited:w,children:h("div",{ref:m,className:"modal fade",onMouseDown:C=>{C.target===m.current?g(!0):g(!1)},onMouseUp:C=>{p&&C.target===m.current&&c!==void 0&&c()},role:"dialog",style:{display:"block"},children:h("div",{className:B(`modal-dialog ${e}`,{"modal-lg":r==="lg","modal-sm":r==="sm","modal-xl":r==="xl","modal-dialog-centered":i}),style:{zIndex:1040},children:h("div",{className:"modal-content",role:"presentation","data-testid":d,children:t})})})})]}),u.current):null}function Pd({className:e="modal-body",style:t,children:n,"data-testid":s}){return h("div",{className:e,"data-testid":s,style:t,children:n})}function Hd({className:e,children:t,closeButton:n=!0,style:s,toggle:o,"data-testid":i}){return R("div",{className:`modal-header ${e}`,style:s,children:[h("h5",{className:"modal-title",children:t}),n&&h("button",{type:"button",className:"close","data-dismiss":"modal","aria-label":"Close",onClick:o,children:h("span",{"aria-hidden":"true",children:"\xD7"})})]})}D.exports.bool.isRequired,D.exports.string.isRequired,D.exports.oneOfType([D.exports.string,D.exports.func]).isRequired,D.exports.func,D.exports.func.isRequired,D.exports.func,D.exports.func,D.exports.string,D.exports.string,D.exports.string,D.exports.node,D.exports.string;const mr=te.forwardRef((e,t)=>{const{children:n,className:s,disabled:o,onClick:i,style:r,id:l}=e;return h("button",{ref:t,type:"button",className:B("btn",s),onClick:i,style:r,disabled:o,id:l,children:n})});mr.displayName="Button";mr.propTypes={children:D.exports.node,className:D.exports.string,disabled:D.exports.bool,onClick:D.exports.func,style:D.exports.shape({}),id:D.exports.string};mr.defaultProps={children:null,className:"",disabled:!1,onClick:()=>null,style:{},id:""};function _i(e){return e.then!==void 0}const Os=class{static disableAllActions(){Os.actionsDisabled=!0}static enableAllActions(){Os.actionsDisabled=!1}static isContextActionEvent(e){return Array.isArray(e.contextActions)}static compareActions(e,t){var n,s,o,i,r,l;return e.group!==t.group?((n=e.group)!=null?n:0)>((s=t.group)!=null?s:0)?1:-1:e.order!==t.order?((o=e.order)!=null?o:0)>((i=t.order)!=null?i:0)?1:-1:e.title!==t.title?((r=e.title)!=null?r:"")>((l=t.title)!=null?l:"")?1:-1:e!==t?e>t?1:-1:0}static sortActions(e){if(e==null||!Array.isArray(e))return[];const t=e.slice();return t.sort(Os.compareActions),t}static isMacPlatform(){const{platform:e}=window.navigator;return e.startsWith("Mac")}static getModifierKey(){return Os.isMacPlatform()?"metaKey":"ctrlKey"}static isModifierKeyDown(e){const t=Os.getModifierKey();return e[t]}static getMenuItems(e,t=!0){let n=[],s=e;Array.isArray(s)||(s=[s]);for(let o=0;o<s.length;o+=1){const i=s[o];let r;typeof i=="function"?r=i():r=i,r!=null&&(r instanceof Promise?t&&n.push(r):Array.isArray(r)?n=n.concat(r):n.push(r))}return n=n.filter(o=>o.title!==void 0||o.then!=null||o.menuElement),n}static getNextMenuItem(e,t,n){let s=e;s<0&&t<0&&(s=n.length);for(let o=1;o<n.length+1;o+=1){const i=(s+t*o+n.length)%n.length,r=n[i];if(!(r instanceof Promise)&&r.disabled!==!0)return i}return e}};let Ne=Os;Ne.actionsDisabled=!1;const nl=se.module("GlobalContextAction");class _d extends T.exports.Component{constructor(t){super(t),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(t){const n=t;n.contextActions==null&&(n.contextActions=[]);const{action:s}=this.props;s.title==null&&!s.menuElement||(n.contextActions==null&&(n.contextActions=[]),n.contextActions.push(s),nl.debug("Received context menu event at global action! Menu items are now: ",n.contextActions))}handleKeyDown(t){var s;const{action:n}=this.props;!Ne.actionsDisabled&&n.shortcut!==void 0&&n.shortcut.matchesEvent(t)&&(nl.debug("Global hotkey matched!",t),(s=n.action)==null||s.call(n,t),t.preventDefault(),t.stopPropagation())}render(){return null}}class Vd extends T.exports.Component{render(){const{actions:t,"data-testid":n}=this.props,s=[];for(let o=0;o<t.length;o+=1){const i=t[o],{shortcut:r}=i;if(i.title!=null||i.menuElement||r){const l=h(_d,{action:i,"data-testid":n},`${i.title}.${r==null?void 0:r.id}`);s.push(l)}}return s}}const zo=se.module("ContextActions");class re extends T.exports.Component{constructor(t){super(t),this.handleContextMenu=this.handleContextMenu.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.container=te.createRef(),this.state={globalActions:[],keyboardActions:[]}}static triggerMenu(t,n,s,o){if(o.length===0)return;const i=new MouseEvent("contextmenu",{clientX:n,clientY:s,bubbles:!0,cancelable:!0});i.contextActions=o,t.dispatchEvent(i)}static getDerivedStateFromProps(t){if(t.actions==null||!Array.isArray(t.actions))return{globalActions:[],keyboardActions:[]};const n=t.actions.filter(o=>!_i(o)&&typeof o!="function"&&o.isGlobal),s=t.actions.filter(o=>!_i(o)&&typeof o!="function"&&(o.isGlobal===void 0||!o.isGlobal)&&o.shortcut!=null);return{globalActions:n,keyboardActions:s}}componentDidMount(){var t;(t=this.container.current)!=null&&t.parentElement&&(this.container.current.parentElement.addEventListener("contextmenu",this.handleContextMenu),this.container.current.parentElement.addEventListener("keydown",this.handleKeyDown))}componentWillUnmount(){var t;(t=this.container.current)!=null&&t.parentElement&&(this.container.current.parentElement.removeEventListener("contextmenu",this.handleContextMenu),this.container.current.parentElement.removeEventListener("keydown",this.handleKeyDown))}handleContextMenu(t){const{ignoreClassNames:n=[]}=this.props;if(n.length>0){let o=t.target;for(;o!=null;){const{classList:i}=o,r=n.find(l=>i.contains(l));if(r!==void 0){zo.debug2(`Contextmenu event ignored based on the target className "${r}"`);return}o=o.parentElement}}if(Ne.isContextActionEvent(t)||(t.contextActions=[]),!Ne.isContextActionEvent(t))return;const{actions:s}=this.props;if(s!=null){let o=s;Array.isArray(o)&&(o=o.filter(i=>_i(i)||typeof i=="function"||i.isGlobal===void 0||!i.isGlobal)),t.contextActions=t.contextActions.concat(o)}zo.debug("Received context menu event! Menu items are now: ",t.contextActions)}handleKeyDown(t){var s;const{keyboardActions:n}=this.state;for(let o=0;o<n.length;o+=1){const i=n[o];!Ne.actionsDisabled&&i.shortcut!=null&&i.shortcut.matchesEvent(t)&&(zo.debug("Context hotkey matched!",t),(s=i.action)==null||s.call(i,t),t.stopPropagation(),t.preventDefault(),zo.debug2("Matched hotkey returned false, key event not consumed"))}}render(){const{"data-testid":t}=this.props,{globalActions:n}=this.state;return h("div",{className:"context-actions-listener",ref:this.container,"data-testid":t,children:h(Vd,{actions:n})})}}re.groups={default:null,high:100,medium:5e3,low:1e4,global:1e5,edit:100};var Ud={prefix:"vs",iconName:"add",icon:[512,512,[],"f000","M448 224v32H256v192H224V256H32V224h192V32h32v192h192z"]},Bd={prefix:"vs",iconName:"arrow-down",icon:[512,512,[],"f000","m100.704 288 160 160h22.624l160 -160 -22.624 -22.624L288 398.048V64H256v334.08L123.328 265.344 100.704 288z"]},Gd={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"]},zd={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"]},Xn={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"]},Wd={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"]},$d={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"]},oa={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"]},qd={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"]},Kd={prefix:"vs",iconName:"chrome-close",icon:[512,512,[],"f000","m227.712 256 -145.856 145.856 28.288 28.288L256 284.288l145.856 145.856 28.288 -28.288L284.288 256l145.856 -145.856 -28.288 -28.288L256 227.712 110.144 81.856l-28.288 28.288L227.712 256z"]},fi={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"]},Xd={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"]},sl={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"]},go={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"]},Yd={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"]},Qd={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"]},pr={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"]},ol={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"]},jd={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"]},Zd={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"]},oi={prefix:"vs",iconName:"filter",icon:[512,512,[],"f000","M480 64v53.44l-160 152.288V448H192V269.728l-160 -152.32V64h448zM224 256v160h64V256l160 -152.32V96H64v7.68L224 256z"]},Jd={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"]},ia={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"]},Ci={prefix:"vs",iconName:"gripper",icon:[512,512,[],"f000","M160 96h64v64H160zm0 128h64v64H160zm0 128h64v64H160zm128 -256h64v64H288zm0 128h64v64H288zm0 128h64v64H288z"]},eu={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"]},nu={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"]},ra={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"]},su={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"]},la={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"]},ou={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"]},iu={prefix:"vs",iconName:"menu",icon:[512,512,[],"f000","M512 160H0V128h512v32zm0 256H0v-32h512v32zm0 -128.256H0V256h512v31.744z"]},ru={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"]},lu={prefix:"vs",iconName:"paintcan",icon:[512,512,[],"f000","m465.28 377.952 -36.48 -99.84v-1.92l-157.12 -157.12v-39.68a53.12 53.12 0 0 0 -3.52 -18.56 47.36 47.36 0 0 0 -26.56 -25.6 45.44 45.44 0 0 0 -18.56 -3.2 47.04 47.04 0 0 0 -47.36 47.36v104.32l-97.92 96a48.64 48.64 0 0 0 0 67.84l116.16 116.16c4.48 4.512 9.824 8.096 15.68 10.56a48.96 48.96 0 0 0 36.48 0 48.32 48.32 0 0 0 15.68 -10.56l157.76 -157.44 -21.12 70.4a38.08 38.08 0 0 0 0 14.72c1.056 4.864 3.136 9.472 6.08 13.44 3.136 3.872 6.912 7.136 11.2 9.6 4.48 2.24 9.408 3.52 14.4 3.84a32 32 0 0 0 15.36 -2.88 36.48 36.48 0 0 0 12.48 -9.28 31.36 31.36 0 0 0 7.04 -14.08c1.024 -4.64 1.12 -9.408 0.32 -14.08zm-256 -298.56a14.72 14.72 0 0 1 0 -6.4 16.64 16.64 0 0 1 3.84 -5.44 20.48 20.48 0 0 1 5.76 -3.2 16 16 0 0 1 6.72 0 16 16 0 0 1 10.24 4.8 16 16 0 0 1 3.84 10.56v40.32l-32 32 1.6 -72.64zm32 363.2a11.52 11.52 0 0 1 -5.12 3.52 15.04 15.04 0 0 1 -12.16 0 11.552 11.552 0 0 1 -5.12 -3.52l-116.16 -115.84a16 16 0 0 1 0 -22.72l139.2 -139.2v91.2a23.68 23.68 0 0 0 -7.68 17.6 24 24 0 1 0 37.44 -17.6v-90.56l123.2 123.84 -153.6 153.28z"]},au={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"]},aa={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"]},cu={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"]},du={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"]},uu={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"]},dn={prefix:"vs",iconName:"remove",icon:[512,512,[],"f000","M480 256H32V224h448v32z"]},hu={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"]},mu={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"]},ca={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"]},pu={prefix:"vs",iconName:"split-horizontal",icon:[512,512,[],"f000","M448 32H96L64 64v352l32 32h352l32 -32V64l-32 -32zM256 416H96V64h160v352zm192 0H288V64h160v352z"]},gu={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"]},fu={prefix:"vs",iconName:"symbol-structure",icon:[512,512,[],"f000","M64 64 32 96v96l32 32h384l32 -32V96l-32 -32H64zm0 32h384v96H64V96zm-32 224 32 -32h96l32 32v96l-32 32H64l-32 -32v-96zm64 0H64v96h96v-96H96zm224 0 32 -32h96l32 32v96l-32 32h-96l-32 -32v-96zm64 0h-32v96h96v-96h-64z"]},il={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"]},Cu={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"]},yn={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"]},$n={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"]},da={prefix:"vs",iconName:"triangle-right",icon:[512,512,[],"f000","M177.92 448 160 434.784V76.576L177.28 64 352 244.064v26.464L177.92 448z"]},Yn={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"]},wu={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"]},Su={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"]},bu={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"]},vu={prefix:"dh",iconName:"exclamation",icon:[512,512,[],"f000","M275.2 384v-32H236.8v32h38.4zm-38.4 -64V128h38.4v192H236.8z"]},ua={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"]},gr={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"]},Tu={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"]},Eu={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"]},Ru={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"]},fr={prefix:"dh",iconName:"filter-filled",icon:[512,512,[],"f000","M480 64v54.4l-160 153.6V448H192V268.8L32 118.4V64h448z"]},yu={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"]},Vi={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"]},Iu={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"]},Mu={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"]},Bs={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"]},Du={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"]},Nu={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"]},Fu={prefix:"dh",iconName:"remove-square-filled",icon:[512,512,[],"f000","M432 32h-384l-16 16v384l16 16h384l16 -16v-384l-16 -16zM352 256H128V224h224v32z"]},Cr={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"]},wr={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"]},rl={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"]},xu={prefix:"dh",iconName:"sort-down",icon:[512,512,[],"f000","m128 288 -12.8 25.6 128 118.4h25.6l128 -118.4L384 288H128z"]},Au={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"]},Sr={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"]},ii={prefix:"dh",iconName:"square-filled",icon:[512,512,[],"f000","M432 32h-384l-16 16v384l16 16h384l16 -16v-384l-16 -16z"]},br={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"]},Ou={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"]},ku={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"]},Lu={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"]},ll={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"]},ha={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 wi=te.forwardRef((e,t)=>{var w,C;function n(S){const{menuItem:b,onMenuItemClick:E}=e;E(b,S)}function s(S){const{menuItem:b,onMenuItemMouseMove:E}=e;E(b,S)}function o(S){const{menuItem:b,onMenuItemContextMenu:E}=e;E(b,S)}function i(S,b,E){if(typeof S.type=="string")return S;const{closeMenu:v,menuItem:y,isKeyboardSelected:M,isMouseSelected:A,"data-testid":F}=e,V={menuItem:y,closeMenu:v,isKeyboardSelected:M,isMouseSelected:A,iconElement:b,displayShortcut:E,"data-testid":F};return te.cloneElement(S,{forwardedProps:V})}const{children:r,menuItem:l,isKeyboardSelected:a=!1,isMouseSelected:c=!1,"data-testid":d}=e,u=(w=l.shortcut)==null?void 0:w.getDisplayText();let m=null;if(l.icon){const S=l.icon;if(te.isValidElement(S))m=S;else{let b;l.iconColor!=null&&(l.disabled===void 0||!l.disabled)&&(b={color:l.iconColor}),m=h(Z,{icon:S,style:b})}}let p=null;const g=Boolean(r);l.actions&&(p=h(Z,{icon:oa}));let f=null;if(l.menuElement)f=h("div",{className:"custom-menu-item",onMouseMove:s,children:i(l.menuElement,m,u)});else{const S=l.disabled,b=l.iconOutline;f=h("button",{type:"button",className:B("btn-context-menu",{disabled:S},{active:(g||c)&&(S===void 0||!S)},{"keyboard-active":a&&(S===void 0||!S)}),onClick:n,onMouseMove:s,onContextMenu:o,title:(C=l.description)!=null?C:"",children:R("div",{className:"btn-context-menu-wrapper",children:[h("span",{className:B("icon",{outline:b}),children:m}),h("span",{className:"title",children:l.title}),u!==void 0&&h("span",{className:"shortcut",children:u}),p&&h("span",{className:B("submenu-indicator",{disabled:S}),children:p})]})})}return R("div",{className:"context-menu-item",ref:t,"data-testid":d,children:[r,f]})});wi.displayName="ContextMenuItem";wi.defaultProps={children:null,isKeyboardSelected:!1,isMouseSelected:!1,"data-testid":void 0};const ye=Object.freeze([]),Sn=new Map;class po extends Error{constructor(){super(...arguments),this.isCanceled=!0}}class Si{static isDark(t){const n=document.createElement("div");n.style.display="none",n.style.color=t;const s=getComputedStyle(document.body.appendChild(n)).color,o=s.match(/\d+/g);let i=[];if(o)i=o.map(l=>parseInt(l,10));else throw new Error(`Invalid color received. Got ${s}`);return document.body.removeChild(n),Si.getBrightness(i)<125}static getBrightness(t){return Math.round((t[0]*299+t[1]*587+t[2]*114)/1e3)}}async function fo(e){const{clipboard:t}=navigator;if(t!==void 0)try{return navigator.clipboard.writeText(e)}catch{return al(e)}al(e)}function al(e){const t=document.activeElement,n=document.createElement("textarea");n.value=e,document.body.appendChild(n),n.focus(),n.select();const s=document.execCommand("copy");if(document.body.removeChild(n),t instanceof HTMLElement&&t.focus(),!s)throw new Error("Unable to execute copy command")}const Pu="table_",ma="column_",Hu=new Set(["in","not","i","ii","k"]),_u=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"]),Vu=/[^a-zA-Z0-9_$+@-]/g,Uu=/[^A-Za-z0-9_$]/g,Gs=class{};let _t=Gs;_t.legalize=(e,t,n,s,o)=>{let i=e.trim().replace(/[- ]/g,"_");return s&&(Hu.has(i)||_u.has(i))&&(i=t+i),i=i.replace(n,""),i||(i=t+o),Number.isNaN(Number(i.charAt(0)))||(i=t+i),i};_t.legalizeTableName=e=>Gs.legalize(e,Pu,Vu,!1,0);_t.legalizeColumnNames=e=>{const t=[];return e.forEach((n,s)=>{let o=Gs.legalizeColumnName(n,s);t.includes(o)&&(o=ma+s),t.push(o)}),t};_t.legalizeColumnName=(e,t=0)=>Gs.legalize(e,ma,Uu,!0,t);_t.isValidTableName=e=>Gs.legalizeTableName(e)===e;_t.isValidColumnName=e=>Gs.legalizeColumnName(e)===e;function Bu(e,t){return e?e.closest(`.${t}`):null}const Gu={getClosestByClassName:Bu};class Me extends CustomEvent{constructor(t,n){super(t,n)}}class vr extends Error{constructor(){super(...arguments),this.isTimeout=!0}}class Ue{static makeCancelable(t,n){let s=!1,o,i;const r=new Promise((l,a)=>{i=a,Promise.resolve(t).then(c=>{s?n&&n(c):(o=c,l(c))}).catch(c=>a(c))});return r.cancel=()=>{s=!0,i(new po),o!=null&&n&&n(o)},r}static isCanceled(t){return t instanceof po}static isTimedOut(t){return t instanceof vr}}class bi{constructor(){this.pending=[],this.resolved=[]}add(t,n){const s=Ue.makeCancelable(t,n);return this.pending.push(s),s.then(()=>{this.resolve(s)},()=>{this.resolve(s)}),s}remove(t){for(let n=0;n<this.pending.length;n+=1)if(this.pending[n]===t){this.pending.splice(n,1);return}}resolve(t){this.remove(t),this.resolved.push(t)}cancel(){const t=[...this.pending,...this.resolved];for(let n=0;n<t.length;n+=1)t[n].cancel();this.pending=[],this.resolved=[]}}function O(e){if(e==null)throw new Error("Value is null or undefined")}class Qt{static isValidRange(t){return t!=null&&t.length===2&&Number.isInteger(t[0])&&Number.isInteger(t[1])&&t[0]<=t[1]}static validateRange(t){if(!Qt.isValidRange(t))throw new Error(`Invalid range! ${t}`)}static isSelected(t,n){for(let s=0;s<t.length;s+=1){const o=t[s],i=o[0],r=o[1];if(i<=n&&n<=r)return!0}return!1}static selectRange(t,n){let[s,o]=n;const i=[...t];for(let r=i.length-1;r>=0;r-=1){const l=i[r],a=l[0],c=l[1];if(a<=s&&o<=c)return i;s<=c&&a<=o&&(s=Math.min(s,a),o=Math.max(o,c),i.splice(r,1))}return i.push([s,o]),i}static deselectRange(t,n){const[s,o]=n,i=[...t];for(let r=i.length-1;r>=0;r-=1){const l=i[r],a=l[0],c=l[1];if(!(o<a||c<s))if(a<s&&o<c){i[r]=[a,s-1],i.splice(r+1,0,[o+1,c]);break}else s<=a&&c<=o?i.splice(r,1):a<s?i[r]=[a,s-1]:i[r]=[o+1,c]}return i}static count(t){return t.reduce((n,s)=>n+(s[1]-s[0]+1),0)}static getItemsInRanges(t,n){return n.reduce((s,o)=>{const i=[...s];for(let r=o[0];r<=o[1];r+=1)i.push(t[r]);return i},[])}}class Tr{static join(t,n="and"){if(t==null||t.length===0)return"";if(t.length===1)return t[0];if(t.length===2)return`${t[0]} ${n} ${t[1]}`;const s=t.slice(0,t.length-1).join(", "),o=t[t.length-1];return`${s}, ${n} ${o}`}static toLower(t,n=!0){if(t==null){if(n)return"";throw new Error("Null string passed in to TextUtils.toLower")}return t.toLowerCase()}static sort(t,n,s=!0){return t<n?s?-1:1:t>n?s?1:-1:0}}const pa=class{static formatElapsedTime(e){if(typeof e!="number"||!Number.isInteger(e))throw new Error(`${e} is not a number that can be expressed as a formatted time`);const t=Math.floor(e/3600),n=Math.floor(e%3600/60),s=e%60;return`${t>0?`${t}h `:""}${n>0||t>0?`${n}m `:""}${e>=60?`${s}s`.padStart(3,"0"):`${s}s`}`}static formatTime(e){if(typeof e!="number"||!Number.isInteger(e)||e<0)throw new Error(`${e} is not a number that can be expressed as a formatted time`);const t=String(Math.floor(e/(60*60))).padStart(2,"0"),n=e%(60*60),s=String(Math.floor(n/60)).padStart(2,"0"),o=n%60,i=String(Math.ceil(o)).padStart(2,"0");return`${t}:${s}:${i}`}static isTimeString(e){return new RegExp(pa.TIME_PATTERN).test(e)}static parseTime(e){if(e==null||typeof e!="string")throw new Error(`${e} is not a valid string`);const t=e.split(":");if(t.length!==3)throw new Error(`${e} is not a time string that can be parsed`);return Number(t[0])*60*60+Number(t[1])*60+Number(t[2])}};let tn=pa;tn.TIME_PATTERN="([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]";tn.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 zu extends Error{constructor(){super(...arguments),this.isInvalid=!0}}function Vt({className:e="","data-testid":t}){return R("div",{className:B("loading-spinner fa-layers",e),"data-testid":t,children:[h(Z,{icon:Xd,className:"text-white-50"}),h(Z,{icon:la,className:"text-primary",spin:!0})]})}const cl=se.module("ContextMenu"),nr=class extends T.exports.PureComponent{constructor(e){super(e),this.handleBlur=this.handleBlur.bind(this),this.handleCloseSubMenu=this.handleCloseSubMenu.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleMenuItemClick=this.handleMenuItemClick.bind(this),this.handleMenuItemContextMenu=this.handleMenuItemContextMenu.bind(this),this.handleMenuItemMouseMove=this.handleMenuItemMouseMove.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.handleWindowResize=this.handleWindowResize.bind(this),this.container=te.createRef(),this.oldFocus=document.activeElement,this.activeSubMenuRef=te.createRef(),this.subMenuTimer=0,this.rAF=0,this.initialPosition={top:e.top,left:e.left},this.state={menuItems:[],pendingItems:[],activeSubMenu:null,hasOverflow:!1,subMenuTop:null,subMenuLeft:null,subMenuParentWidth:0,subMenuParentHeight:0,keyboardIndex:-1,mouseIndex:-1}}static handleContextMenu(e){e.metaKey||(e.stopPropagation(),e.preventDefault())}componentDidMount(){this.initMenu(),this.verifyPosition(),window.addEventListener("resize",this.handleWindowResize),this.rAF=window.requestAnimationFrame(()=>{var t;(t=this.container.current)==null||t.focus();const{onMenuOpened:e}=this.props;e(this)})}componentDidUpdate(e,t){var o,i;const{actions:n}=this.props,{activeSubMenu:s}=this.state;s!==t.activeSubMenu&&(s==null?(o=this.container.current)==null||o.focus():this.setActiveSubMenuPosition()),e.actions!==n&&(this.initMenu(),(this.container.current==null||!this.container.current.contains(document.activeElement))&&((i=this.container.current)==null||i.focus())),this.verifyPosition()}componentWillUnmount(){this.cancelPromises(),window.removeEventListener("resize",this.handleWindowResize),cancelAnimationFrame(this.rAF)}getKeyboardIndex(){const{options:e}=this.props;if(e.separateKeyboardMouse!==void 0&&e.separateKeyboardMouse){const{keyboardIndex:t}=this.state;return t}return this.getMouseIndex()}setKeyboardIndex(e){const{options:t}=this.props;t.separateKeyboardMouse!==void 0&&t.separateKeyboardMouse?this.setState({keyboardIndex:e}):this.setMouseIndex(e)}getMouseIndex(){const{mouseIndex:e}=this.state;return e}setMouseIndex(e){this.setState({mouseIndex:e})}initMenu(){this.cancelPromises(),cancelAnimationFrame(this.rAF);const{options:e}=this.props;let t=e.initialKeyboardIndex;t===void 0&&(t=-1);const{actions:n}=this.props,s=Ne.getMenuItems(n),o=[];for(let i=s.length-1;i>=0;i-=1){const r=s[i];r instanceof Promise?this.initMenuPromise(r):o.push(r)}this.setState({mouseIndex:-1,keyboardIndex:t,activeSubMenu:null,menuItems:Ne.sortActions(o)})}initMenuPromise(e){const t=Ue.makeCancelable(e);this.setState(n=>({pendingItems:n.pendingItems.concat(t)})),t.then(n=>{this.setState(s=>{const o=s.pendingItems.indexOf(t);if(o>=0){const i=s.pendingItems.slice();return i.splice(o,1),{menuItems:Ne.sortActions(s.menuItems.concat(n)),pendingItems:i}}return null})},n=>{Ue.isCanceled(n)||(this.setState(s=>{const o=s.pendingItems.indexOf(t);if(o>=0){const i=s.pendingItems.slice();return i.splice(o,1),{pendingItems:i}}return null}),cl.error(n))})}cancelPromises(){const{pendingItems:e}=this.state;e.map(t=>t.cancel())}setActiveSubMenuPosition(){if(this.activeSubMenuRef.current===null)return;const e=this.activeSubMenuRef.current.getBoundingClientRect();this.setState({subMenuTop:e.top,subMenuLeft:e.right,subMenuParentHeight:e.height,subMenuParentWidth:e.width})}verifyPosition(){var u,m,p,g;const{options:e,updatePosition:t,subMenuParentWidth:n,subMenuParentHeight:s,top:o,left:i}=this.props;if(!this.container.current||e.doNotVerifyPosition!=null&&e.doNotVerifyPosition)return;let{top:r,left:l}=this.initialPosition;const{width:a,height:c}=(m=(u=this.container.current)==null?void 0:u.getBoundingClientRect())!=null?m:{width:0,height:0},d=((g=(p=this.container.current)==null?void 0:p.scrollHeight)!=null?g:0)>window.innerHeight;c===0||a===0||(r+c>window.innerHeight&&(r-c-s>0?r-=c-s:r=window.innerHeight-c),l+a>window.innerWidth&&(l=l-a-n),(i!==l||o!==r)&&(this.setState({hasOverflow:d}),t(r,l)))}handleWindowResize(){!this.container.current||this.closeMenu(!0)}handleBlur(e){if(!this.container.current){cl.warn("Container is null!");return}if(!this.container.current.contains(e.relatedTarget)){let t=e.relatedTarget,n=!1;for(;t&&!n;)n=t.hasAttribute("data-dh-context-menu"),t=t.parentElement;n||this.closeMenu(!0)}}isEscapeKey(e){const{left:t}=this.props;return e==="Escape"||t<0&&e==="ArrowRight"||e==="ArrowLeft"}handleKeyDown(e){const{menuItems:t}=this.state,n=this.getKeyboardIndex();let s=n,o=!1;if(e.key==="Enter"||e.key===" "){n>=0&&n<t.length&&this.handleMenuItemClick(t[n],e);return}if(e.key==="ArrowRight"?n>=0&&n<=t.length?o=!0:s=0:this.isEscapeKey(e.key)?s=null:e.key==="ArrowUp"||e.shiftKey&&e.key==="Tab"?s=Ne.getNextMenuItem(s,-1,t):(e.key==="ArrowDown"||e.key==="Tab")&&(s=Ne.getNextMenuItem(s,1,t)),o){this.openSubMenu(n),e.preventDefault(),e.stopPropagation();return}n!==s&&(s!==null?this.setKeyboardIndex(s):(this.closeMenu(),this.oldFocus instanceof HTMLElement&&this.oldFocus.focus()),e.preventDefault(),e.stopPropagation())}openSubMenu(e){const{menuItems:t,activeSubMenu:n}=this.state,s=t[e].actions?e:null;n!==s&&this.setState({activeSubMenu:s,subMenuTop:null,subMenuLeft:null})}closeMenu(e=!1){const{closeMenu:t,onMenuClosed:n}=this.props;cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{t(e),n(this)})}closeSubMenu(){this.setState({activeSubMenu:null})}handleCloseSubMenu(e){e?this.closeMenu(!0):this.closeSubMenu()}handleMenuItemClick(e,t){t.preventDefault(),t.stopPropagation();const{menuItems:n}=this.state;e!=null&&(e.disabled===void 0||!e.disabled)&&(e.actions!=null?this.openSubMenu(n.indexOf(e)):e.action!=null&&(e.action(),this.closeMenu(!0)))}handleMenuItemContextMenu(e,t){t.metaKey||this.handleMenuItemClick(e,t)}handleMenuItemMouseMove(e){const{menuItems:t}=this.state,n=t.indexOf(e);this.setMouseIndex(n),n>=0&&n<t.length&&(e.disabled===void 0||!e.disabled)&&this.openSubMenu(n)}handleMouseLeave(){this.setMouseIndex(-1)}render(){const e=[],{top:t,left:n}=this.props,{activeSubMenu:s,hasOverflow:o,keyboardIndex:i,menuItems:r,mouseIndex:l,pendingItems:a,subMenuTop:c,subMenuLeft:d,subMenuParentWidth:u,subMenuParentHeight:m}=this.state;for(let C=0;C<r.length;C+=1){const S=r[C];C>0&&S.group!==r[C-1].group&&e.push(h("hr",{},`${C}.separator`));const b=h(wi,{ref:s===C?this.activeSubMenuRef:null,isKeyboardSelected:i===C,isMouseSelected:l===C,menuItem:S,closeMenu:this.handleCloseSubMenu,onMenuItemClick:this.handleMenuItemClick,onMenuItemMouseMove:this.handleMenuItemMouseMove,onMenuItemContextMenu:this.handleMenuItemContextMenu},C);e.push(b)}let p=null;a.length>0&&(p=h("div",{className:"loading",children:h(Vt,{})}));const{menuStyle:g,"data-testid":f}=this.props,w=s!==null&&c!==null&&d!==null;return R(Fe,{children:[R("div",{className:B({"has-overflow":o},"context-menu-container"),style:{top:t,left:n,...g},ref:this.container,"data-dh-context-menu":!0,onBlur:this.handleBlur,onKeyDown:this.handleKeyDown,onMouseLeave:this.handleMouseLeave,onContextMenu:nr.handleContextMenu,role:"menuitem",tabIndex:0,"data-testid":f,children:[e,p]}),w&&s!==null&&c!==null&&d!==null&&h(nr,{actions:r[s].actions||[],closeMenu:this.handleCloseSubMenu,top:c,left:d,updatePosition:(C,S)=>{this.setState({subMenuTop:C,subMenuLeft:S})},subMenuParentWidth:u,subMenuParentHeight:m},`sub-${s}`)]})}};let ga=nr;ga.defaultProps={subMenuParentWidth:0,subMenuParentHeight:0,closeMenu(){},onMenuOpened(){},onMenuClosed(){},options:{},menuStyle:{},"data-testid":void 0};class Wu extends T.exports.Component{constructor(t){super(t),this.handleMenuClose=this.handleMenuClose.bind(this),this.handleContextMenu=this.handleContextMenu.bind(this),this.container=te.createRef(),this.openMenu=te.createRef(),this.state={actions:null,left:0,top:0}}componentDidMount(){var t;(t=this.container.current)!=null&&t.parentElement&&this.container.current.parentElement.addEventListener("contextmenu",this.handleContextMenu)}componentWillUnmount(){var t;(t=this.container.current)!=null&&t.parentElement&&this.container.current.parentElement.removeEventListener("contextmenu",this.handleContextMenu)}handleContextMenu(t){if(!Ne.isContextActionEvent(t)||!this.container.current||t.metaKey||t.ctrlKey)return;const n=Ne.getMenuItems(t.contextActions),s=this.container.current.getBoundingClientRect(),o=t.clientY-s.top,i=t.clientX-s.left;if(n.length===0){if(t.target===this.container.current){t.preventDefault(),this.setState({actions:null},()=>{const r=document.elementFromPoint(i,o),l=new MouseEvent("contextmenu",{clientX:t.clientX,clientY:t.clientY,bubbles:!0,cancelable:!0});r==null||r.dispatchEvent(l)});return}return}t.preventDefault(),this.setState({actions:n,top:o,left:i})}handleMenuClose(t){t===this.openMenu.current&&this.setState({actions:null})}render(){let t=null;const{"data-testid":n}=this.props,{actions:s,top:o,left:i}=this.state;return s&&(t=h(ga,{ref:this.openMenu,actions:s,onMenuClosed:this.handleMenuClose,top:o,left:i,updatePosition:(r,l)=>{this.setState({top:r,left:l})},"data-testid":n})),h("div",{className:B("context-menu-root",{active:s}),ref:this.container,children:t})}}const rs=class extends T.exports.Component{static handleEnter(e){const t=e;t.style.height="0"}static handleEntering(e){const t=e;t.style.height=`${rs.getHeight(t)}px`}static handleExiting(e){const t=e;t.style.height="0"}static handleExit(e){const t=e;t.style.height=`${rs.getHeight(t)}px`}static getHeight(e){const t=e.scrollWidth-e.clientWidth;return e.scrollHeight-t}constructor(e){super(e),this.handleEntered=this.handleEntered.bind(this)}handleEntered(e){const t=e;t.style.height="";const{autoFocusOnShow:n}=this.props;if(n!==void 0&&n){const s=t.querySelector("input, select, textarea");s!=null&&s.focus()}}render(){const{children:e,className:t,in:n,"data-testid":s}=this.props;return h(dt,{in:n,classNames:{enterActive:"collapsing",enterDone:"collapse show",exitActive:"collapsing",exitDone:"collapse"},onEnter:rs.handleEnter,onEntering:rs.handleEntering,onEntered:this.handleEntered,onExit:rs.handleExit,onExiting:rs.handleExiting,timeout:350,children:o=>h("div",{className:B({collapse:o==="exited"},t),"data-testid":s,children:e})})}};let fa=rs;fa.propTypes={className:D.exports.string,in:D.exports.bool.isRequired,children:D.exports.node.isRequired,autoFocusOnShow:D.exports.bool,"data-testid":D.exports.string};fa.defaultProps={className:"",autoFocusOnShow:!1,"data-testid":void 0};function Er(e){const t=T.exports.useRef();return T.exports.useEffect(function(){t.current=e}),t.current}function Ca(e){const t=T.exports.useRef(null);return T.exports.useEffect(function(){!e||(typeof e=="function"?e(t.current):e.current=t.current)}),t}const $u=3500,qu=se.module("useCopyToClipboard");function Ku(){const[e,t]=T.exports.useState(!1),n=T.exports.useRef(null),s=T.exports.useCallback(o=>{fo(o).then(()=>{t(!0)}).catch(i=>qu.error(`Unable to copy ${o}`,`
|
|
2
|
-
`,i))},[]);return T.exports.useEffect(()=>(n.current&&clearTimeout(n.current),e&&(n.current=setTimeout(()=>{t(!1)},$u)),()=>{n.current&&clearTimeout(n.current)}),[e]),[e,s]}const ut=te.forwardRef((e,t)=>{const{checked:n=!1,children:s,className:o,disabled:i,inputClassName:r,isInvalid:l,labelClassName:a,name:c,onChange:d,"data-testid":u}=e,[m]=T.exports.useState(sn()),p=Ca(t);T.exports.useEffect(function(){p.current&&(p.current.indeterminate=n===null)},[p,n]);const g=T.exports.useCallback(f=>{p.current&&(p.current.indeterminate=n===null),d&&d(f)},[p,n,d]);return R("div",{className:B("custom-control custom-checkbox",o),children:[h("input",{type:"checkbox",ref:p,checked:n!=null?n:!1,className:B("custom-control-input",r,{"is-invalid":l}),disabled:i,id:m,name:c,onChange:g,"data-testid":u}),h("label",{className:B("custom-control-label",a),htmlFor:m,children:s})]})});ut.displayName="Checkbox";ut.propTypes={checked:(e,t)=>{const{[t]:n}=e;return n!==null&&typeof n!="boolean"?new Error("Checked must be a boolean or null for indeterminate"):null},children:D.exports.node.isRequired,className:D.exports.string,disabled:D.exports.bool,inputClassName:D.exports.string,isInvalid:D.exports.bool,labelClassName:D.exports.string,name:D.exports.string,onChange:D.exports.func,"data-testid":D.exports.string};ut.defaultProps={checked:!1,className:"",disabled:!1,inputClassName:"",isInvalid:!1,labelClassName:"",name:void 0,onChange:void 0,"data-testid":void 0};class Jn extends T.exports.PureComponent{constructor(t){super(t),this.inputField=te.createRef()}focus(){var t;(t=this.inputField.current)==null||t.focus()}render(){const{value:t,placeholder:n,onBlur:s,onChange:o,className:i,disabled:r,matchCount:l,id:a,onKeyDown:c,"data-testid":d}=this.props;return R("div",{className:B("search-group",i),children:[h("input",{type:"search",value:t,onBlur:s,onChange:o,onKeyDown:c,className:"form-control",disabled:r,placeholder:n,ref:this.inputField,id:a,"data-testid":d}),l!=null&&h("span",{className:"search-match",children:l}),h("span",{className:"search-icon",children:h(Z,{icon:ca})})]})}}Jn.defaultProps={placeholder:"Search",className:"",matchCount:null,onKeyDown(){},id:"","data-testid":void 0};var wa=(e=>(e.UP="UP",e.DOWN="DOWN",e))(wa||{});const ro=class extends T.exports.Component{constructor(e){super(e),this.getCachedFilteredOptions=he((t,n)=>t.filter(s=>s.title.toLowerCase().indexOf(n.toLowerCase())>=0||s.value.toLowerCase().indexOf(n.toLowerCase())>=0)),this.state={value:"",filter:"",filteredOptions:e.options,keyboardOptionIndex:-1,menuIsOpen:!1,inputWidth:100},this.toggleMenu=this.toggleMenu.bind(this),this.handleMenuKeyDown=this.handleMenuKeyDown.bind(this),this.handleMenuBlur=this.handleMenuBlur.bind(this),this.closeMenu=this.closeMenu.bind(this),this.handleInputChange=this.handleInputChange.bind(this),this.handleInputKeyDown=this.handleInputKeyDown.bind(this),this.handleInputBlur=this.handleInputBlur.bind(this),this.handleFilterChange=this.handleFilterChange.bind(this),this.handleOptionClick=this.handleOptionClick.bind(this),this.handleOptionFocus=this.handleOptionFocus.bind(this),this.handleMenuOpened=this.handleMenuOpened.bind(this),this.handleMenuExited=this.handleMenuExited.bind(this),this.popper=te.createRef(),this.cbContainer=te.createRef(),this.toggleButton=te.createRef(),this.menuContainer=te.createRef(),this.input=te.createRef(),this.searchInput=te.createRef()}componentDidUpdate(){const{menuIsOpen:e,keyboardOptionIndex:t}=this.state;e&&t>=0&&this.scrollOptionIntoView()}setInputWidth(){this.cbContainer.current&&this.setState({inputWidth:this.cbContainer.current.getBoundingClientRect().width})}focus(){var e;(e=this.input.current)==null||e.focus()}resetValue(){this.setState({value:""})}updateInputValue(e){const{onChange:t}=this.props;this.setState({value:e}),t(e)}handleResize(){this.setInputWidth()}handleMenuKeyDown(e){var r,l;const{filter:t,filteredOptions:n,keyboardOptionIndex:s}=this.state,{options:o}=this.props,i=t?n:o;switch(e.key){case"Enter":((r=i[s])==null?void 0:r.value)!=null&&this.updateInputValue(i[s].value),this.closeMenu(),(l=this.input.current)==null||l.focus(),e.stopPropagation(),e.preventDefault();break;case"ArrowUp":this.handleMenuNavigation(ro.MENU_NAVIGATION_DIRECTION.UP),e.stopPropagation(),e.preventDefault();break;case"ArrowDown":this.handleMenuNavigation(ro.MENU_NAVIGATION_DIRECTION.DOWN),e.stopPropagation(),e.preventDefault();break;case"Escape":t!==""?(this.setState({filter:""}),e.stopPropagation()):this.closeMenu();break;case"Tab":!e.shiftKey&&s===i.length-1&&this.closeMenu();break}}handleMenuNavigation(e){const{filter:t,filteredOptions:n,keyboardOptionIndex:s}=this.state,{options:o}=this.props,r=(t?n:o).length;let l=0;switch(e){case ro.MENU_NAVIGATION_DIRECTION.UP:l=-1;break;case ro.MENU_NAVIGATION_DIRECTION.DOWN:l=1;break}l!==0&&this.setState({keyboardOptionIndex:(s+l+r)%r})}handleInputKeyDown(e){const{onEnter:t}=this.props,{menuIsOpen:n}=this.state;e.key==="ArrowDown"||e.key==="ArrowUp"?n||this.openMenu():e.key==="Enter"&&t()}handleInputChange(e){this.updateInputValue(e.target.value)}handleOptionClick(e){var r;const t=Number(e.currentTarget.value),{filter:n,filteredOptions:s}=this.state,{options:o}=this.props,i=n?s:o;this.updateInputValue(i[t].value),this.closeMenu(),(r=this.input.current)==null||r.focus()}handleOptionFocus(e){this.setState({keyboardOptionIndex:Number(e.target.value)})}handleFilterChange(e){var o;const{options:t}=this.props,n=e.target.value,s=this.getCachedFilteredOptions(t,n);this.setState({filter:n,filteredOptions:s,keyboardOptionIndex:0}),(o=this.popper.current)==null||o.scheduleUpdate()}handleMenuBlur(e){e.relatedTarget instanceof Element&&this.popper.current!=null&&this.popper.current.element.contains(e.relatedTarget)||e.relatedTarget===this.toggleButton.current||this.closeMenu(!1)}handleInputBlur(e){const{menuIsOpen:t}=this.state;t&&e.relatedTarget instanceof Element&&this.popper.current!=null&&this.popper.current.element.contains(e.relatedTarget)||this.closeMenu(!1)}handleMenuOpened(){var e;this.scrollOptionIntoView(),(e=this.searchInput.current)==null||e.focus()}handleMenuExited(){var t;const{menuIsOpen:e}=this.state;e&&(this.setState({menuIsOpen:!1}),(t=this.popper.current)==null||t.hide()),this.setState({filter:""})}toggleMenu(e){const{menuIsOpen:t}=this.state;t?this.closeMenu():this.openMenu(),e.stopPropagation()}openMenu(){this.updateKeyboardIndex(),this.setInputWidth(),this.setState({menuIsOpen:!0}),window.requestAnimationFrame(()=>{var e;(e=this.popper.current)==null||e.show()})}closeMenu(e=!0){var t,n;this.setState({menuIsOpen:!1}),e&&((t=this.input.current)==null||t.focus()),(n=this.popper.current)==null||n.hide()}updateKeyboardIndex(){const{value:e,filter:t,filteredOptions:n}=this.state,{options:s}=this.props,i=(t?n:s).findIndex(r=>r.value===e);this.setState({keyboardOptionIndex:i})}scrollOptionIntoView(){var t;const e=(t=this.menuContainer.current)==null?void 0:t.querySelector(".cb-option-btn.keyboard-active");e instanceof HTMLElement&&e.scrollIntoView({block:"nearest",inline:"nearest"})}renderMenuElement(){const{searchPlaceholder:e}=this.props,{filter:t,inputWidth:n}=this.state;return R("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(Jn,{value:t,ref:this.searchInput,onChange:this.handleFilterChange,className:"cb-search-input",placeholder:e})}),h("div",{className:"cb-options-container",children:h("div",{className:"cb-options",children:this.renderOptions()})})]})}renderOptions(){const{options:e}=this.props,{keyboardOptionIndex:t,filter:n,filteredOptions:s}=this.state;return(n?s:e).map((i,r)=>{const l=`option-${r}-${i.value}`;return h("button",{type:"button",value:r,className:B("cb-option-btn",{"keyboard-active":t===r}),onClick:this.handleOptionClick,onFocus:this.handleOptionFocus,children:i.title},l)})}render(){const{options:e,inputPlaceholder:t,disabled:n,className:s,defaultValue:o,spellCheck:i,"data-testid":r}=this.props,{value:l}=this.state;let{popperOptions:a}=this.props;return a={placement:"bottom-end",modifiers:{preventOverflow:{enabled:!1}},...a},R("div",{className:"input-group cb-container",ref:this.cbContainer,children:[h("input",{value:l||o,className:B("form-control",s,"cb-input"),ref:this.input,onChange:this.handleInputChange,placeholder:t||(e[0]!=null?e[0].title:void 0),disabled:n,onBlur:this.handleInputBlur,onKeyDown:this.handleInputKeyDown,spellCheck:i,"data-testid":r!==void 0?`${r}-input`:void 0}),h("div",{className:"input-group-append cb-dropdown",children:R("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(Z,{icon:$n}),h(Rn,{ref:this.popper,options:a,className:B("combobox interactive"),onEntered:this.handleMenuOpened,onExited:this.handleMenuExited,children:this.renderMenuElement()})]})})]})}};let zs=ro;zs.MENU_NAVIGATION_DIRECTION=wa;zs.DROP_DOWN_MENU_HEIGHT=200;zs.propTypes={options:D.exports.arrayOf(D.exports.shape({title:D.exports.string.isRequired,value:D.exports.string.isRequired})).isRequired,popperOptions:D.exports.shape({title:D.exports.string.isRequired,value:D.exports.string.isRequired}),onChange:D.exports.func,inputPlaceholder:D.exports.string,searchPlaceholder:D.exports.string,disabled:D.exports.bool,className:D.exports.string,defaultValue:D.exports.string,spellCheck:D.exports.bool,onEnter:D.exports.func,"data-testid":D.exports.string};zs.defaultProps={onChange(){},inputPlaceholder:"",searchPlaceholder:"Search",disabled:!1,className:"",defaultValue:"",popperOptions:null,spellCheck:!0,onEnter(){},"data-testid":void 0};function Sa({copy:e,kind:t="ghost",tooltip:n="Copy",className:s,"data-testid":o,children:i}){const[r,l]=Ku();return h(X,{kind:t,className:s,"data-testid":o,icon:r?au:Qd,tooltip:r?"Copied":n,onClick:()=>{l(typeof e=="function"?e():e)},children:i})}const At=se.module("MaskedInput"),Is={FORWARD:"forward",BACKWARD:"backward",NONE:"none"},Wo="\u2007";function Rr(e,t,n){return e.substring(0,t)+n+e.substring(t+1)}function Xu(e,t,n){return e.length<n?`${e}${t.substring(e.length,n)}`:e}function dl(e,t){let{length:n}=e;for(let s=e.length-1;s>=0&&t[s]===e[s];s-=1)n=s;return e.substring(0,n)}const vi=te.forwardRef((e,t)=>{const{className:n,example:s,getNextSegmentValue:o=(N,P,k)=>k,getPreferredReplacementString:i=Rr,onChange:r=()=>!1,onSelect:l=()=>!1,pattern:a,placeholder:c,selection:d,value:u,onFocus:m=()=>!1,onBlur:p=()=>!1,"data-testid":g}=e,f=Ca(t),w=T.exports.useMemo(()=>Array.isArray(s)?s:[s],[s]),C=T.exports.useMemo(()=>w[0].replace(/[a-zA-Z0-9]/g,Wo),[w]);T.exports.useEffect(function(){var P;if(d!=null){At.debug("setting selection...",d);const{selectionStart:k,selectionEnd:z,selectionDirection:K}=d;(P=f.current)==null||P.setSelectionRange(k,z,K),At.debug("selection set!")}},[d,f]);const S=T.exports.useCallback(N=>{let P=N,k=N;const z=w.length>0?w[0]:u;for(let G=P-1;G>=0&&/[a-zA-Z0-9]/g.test(z.charAt(G));G-=1)P=G;for(let G=k;G<z.length&&/[a-zA-Z0-9]/g.test(z.charAt(G));G+=1)k=G+1;const K=P===k?Is.NONE:Is.BACKWARD;return{selectionStart:P,selectionEnd:k,selectionDirection:K}},[w,u]);function b(N,P,k=N.length){let z="";for(let K=0;K<k;K+=1)N.charAt(K)!==Wo?z=z.concat(N[K]):z=z.concat(P[K]);return z=z.concat(P.substring(k)),z}function E(N,P=N.length){const k=new RegExp(`^${a}$`);if(k.test(N))return!0;for(let z=0;z<w.length;z+=1){const K=b(N,w[z],P);if(k.test(K))return!0}return!1}function v(N){const P=S(N),k=P.selectionEnd+1;return k>=u.length?P:S(k)}function y(N){const P=S(N),k=P.selectionStart-1;return k<=0?P:S(k)}function M(N,P){const k=S(N),z=u.substring(k.selectionStart,k.selectionEnd),K=o(k,P,z,u),G=u.substring(0,k.selectionStart)+K+u.substring(k.selectionEnd);E(G,k.selectionEnd)&&(r(G),l(k))}const A=T.exports.useCallback(N=>{const{selectionStart:P=0,selectionEnd:k=0,selectionDirection:z="none"}=N.target;if(P===null||k===null||z===null){At.error("Selection attempted on non-text input element",N.target);return}if(At.debug2("handleSelect",P,k,z),!(d!=null&&P===d.selectionStart&&k===d.selectionEnd)){if(d!=null&&P===u.length&&k===u.length&&N.nativeEvent.type!=="mouseup"){l({...d});return}if(P===k){const K=S(P);At.debug("Selection segment from ",P,k,"=>",K),l(K)}else l({selectionStart:P,selectionEnd:k,selectionDirection:z})}},[S,l,d,u]),F=T.exports.useCallback(N=>{var k;if(!f.current)return;At.debug("handleSelectCapture",N);const P=(k=f.current.selectionStart)!=null?k:0;P===u.length&&d!=null&&P!==d.selectionStart&&(N.preventDefault(),N.stopPropagation())},[f,d,u]);function V(N){if(N.preventDefault(),N.stopPropagation(),!f.current)return;const{key:P}=N,{selectionStart:k=0,selectionEnd:z=0}=f.current;if(k===null||z===null){At.error("Selection arrow nvaigation attempted on non-text input element",N.target);return}P==="ArrowLeft"?l(y(k)):P==="ArrowRight"?l(v(z)):P==="ArrowUp"?M(k,-1):P==="ArrowDown"&&M(k,1)}function H(N){if(!f.current)return;At.debug("handleKeyDown",N);const{key:P}=N,{selectionStart:k=0,selectionEnd:z=0}=f.current;if(k===null||z===null){At.error("Selection key event on non-text input element",N.target);return}if(P.startsWith("Arrow")){V(N);return}if(P==="Delete"||P==="Backspace"){if(N.preventDefault(),N.stopPropagation(),z>=dl(u,C).length){const G=u.substring(0,k===z?k-1:k),_=dl(G,C);_!==u&&(r(_),l({selectionStart:_.length,selectionEnd:_.length,selectionDirection:Is.NONE}));return}if(k!==z){const G=u.substring(0,k)+u.substring(k,z).replace(/[a-zA-Z0-9]/g,Wo)+u.substring(z);At.debug("Range ",k,z,"deleted, setting value",G),r(G),l({selectionStart:k,selectionEnd:k,selectionDirection:Is.NONE})}else if(k>0)for(let G=k-1;G>=0;G-=1){const _=u.substring(0,G)+u.substring(G,k).replace(/[a-zA-Z0-9]/g,Wo)+u.substring(k);if(_!==u){r(_),l({selectionStart:G,selectionEnd:G,selectionDirection:Is.NONE});return}}return}if(N.altKey||N.metaKey||N.ctrlKey||P.length>1)return;N.preventDefault(),N.stopPropagation();const K=Array.from(new Set([P,P.toUpperCase(),P.toLowerCase()]));for(let G=0;G<K.length;G+=1){const _=K[G],q=/[a-zA-Z0-9]/g.test(_)?w[0].length-1:k;for(let Y=k;Y<=q;Y+=1){const J=Xu(u,w[0],Y+1),de=i(J,Y,_,k,z);if(E(de,Y+1)){const pe=S(Y),ge=Y+1;let Te={selectionStart:ge,selectionEnd:ge,selectionDirection:Is.NONE};if(ge>=pe.selectionEnd){const fe=v(Y);fe.selectionStart!==pe.selectionStart&&(Te=fe)}At.debug("handleKeyDown",P,"=>",de,Te),r(de),l(Te);return}}}}return h("input",{ref:f,className:B("form-control masked-input",n),type:"text",pattern:a,placeholder:c,value:u,onChange:()=>{},onKeyDown:H,onSelect:A,onSelectCapture:F,onFocus:m,onBlur:p,"data-testid":g})});vi.defaultProps={className:"",placeholder:void 0,onChange(){},onSelect(){},getNextSegmentValue:(e,t,n)=>n,getPreferredReplacementString:Rr,selection:void 0,onFocus(){},onBlur(){},"data-testid":void 0};const Yu=se.module("TimeInput"),Qu="([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]",ju=["00:00:00","12:34:56","23:59:59"],ba=te.forwardRef((e,t)=>{const{allowValueWrapping:n=!0,className:s="",onChange:o=()=>!1,value:i=0,onFocus:r=()=>!1,onBlur:l=()=>!1,onSelect:a=()=>!1,"data-testid":c}=e,[d,u]=T.exports.useState(tn.formatTime(i)),[m,p]=T.exports.useState(),g=T.exports.useRef(null);T.exports.useImperativeHandle(t,()=>({focus:()=>{var b;(b=g.current)==null||b.focus()},setSelection:b=>{var E;(E=g.current)==null||E.focus(),p(b)}}),[]),T.exports.useEffect(function(){u(tn.formatTime(i))},[i]);function f(b,E,v){const y=b.selectionStart===0?24:60;let M=parseInt(v,10)-E;return Number.isNaN(M)?M=0:n?M=(M%y+y)%y:M=Math.min(Math.max(0,M),y-1),`${M}`.padStart(2,"0")}function w(b,E,v,y,M){return y===0&&M===2&&E===1&&parseInt(v,10)>1?`0${v}${b.substring(2)}`:Rr(b,E,v)}function C(b){Yu.debug("handleChange",b),u(b),tn.isTimeString(b)&&o(tn.parseTime(b))}const S=T.exports.useCallback(b=>{p(b),a(b)},[a]);return h(vi,{ref:g,className:s,example:ju,getNextSegmentValue:f,getPreferredReplacementString:w,onChange:C,onSelect:S,pattern:Qu,selection:m,value:d,onFocus:r,onBlur:l,"data-testid":c})});ba.defaultProps={allowValueWrapping:!0,className:"",onChange:()=>!1,onSelect:()=>!1,value:0,onFocus:()=>!1,onBlur:()=>!1,"data-testid":void 0};class va extends T.exports.PureComponent{constructor(t){var o;super(t),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=te.createRef(),this.oldFocus=document.activeElement,this.rAF=0;const{options:n}=t,s=(o=n.initialKeyboardIndex)!=null?o:-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:t}=this.props;t(this)})}componentDidUpdate(t){const{actions:n}=this.props;t.actions!==n&&this.initMenu()}componentWillUnmount(){cancelAnimationFrame(this.rAF)}getKeyboardIndex(){const{options:t}=this.props;if(t.separateKeyboardMouse!==void 0&&t.separateKeyboardMouse){const{keyboardIndex:n}=this.state;return n}return this.getMouseIndex()}setKeyboardIndex(t){const{options:n}=this.props;n.separateKeyboardMouse!==void 0&&n.separateKeyboardMouse?this.setState({keyboardIndex:t}):this.setMouseIndex(t)}getMouseIndex(){const{mouseIndex:t}=this.state;return t}setMouseIndex(t){this.setState({mouseIndex:t})}initMenu(){cancelAnimationFrame(this.rAF),this.setState({menuItems:[]});const{actions:t}=this.props,n=Ne.getMenuItems(t,!1);n.length>0&&this.setState(s=>({menuItems:Ne.sortActions(s.menuItems.concat(n))}))}handleKeyDown(t){const{menuItems:n}=this.state,s=this.getKeyboardIndex();let o=s;if(t.key==="Enter"||t.key===" "){s!=null&&s>=0&&s<n.length&&this.handleMenuItemClick(n[s],t);return}t.key==="Escape"?o=null:t.key==="ArrowUp"||t.key==="Tab"&&t.shiftKey===!0?o=Ne.getNextMenuItem(o!=null?o:0,-1,n):(t.key==="ArrowDown"||t.key==="Tab"&&t.shiftKey===!1)&&(o=Ne.getNextMenuItem(o!=null?o:0,1,n)),s!==o&&(o!==null?this.setKeyboardIndex(o):(this.closeMenu(),this.oldFocus instanceof HTMLElement&&this.oldFocus.focus()),t.preventDefault(),t.stopPropagation())}closeMenu(t=!1){const{closeMenu:n,onMenuClosed:s}=this.props;cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{n(t),s(this)})}handleCloseMenu(){this.closeMenu()}handleMenuItemClick(t,n){n.preventDefault(),n.stopPropagation(),t!=null&&(t.disabled===void 0||!t.disabled)&&t.action!=null&&(t.action(),this.closeMenu(!0))}handleMenuItemMouseMove(t){const{menuItems:n}=this.state,s=n.indexOf(t);this.setMouseIndex(s)}handleMouseLeave(){this.setMouseIndex(-1)}render(){const t=[],{"data-testid":n}=this.props,{keyboardIndex:s,menuItems:o,mouseIndex:i}=this.state;for(let l=0;l<o.length;l+=1){const a=o[l];l>0&&a.group!==o[l-1].group&&t.push(h("hr",{},`${l}.separator`));const c=h(wi,{isKeyboardSelected:s===l,isMouseSelected:i===l,menuItem:a,closeMenu:this.handleCloseMenu,onMenuItemClick:this.handleMenuItemClick,onMenuItemMouseMove:this.handleMenuItemMouseMove,onMenuItemContextMenu:()=>!1},l);t.push(c)}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:t})}}va.defaultProps={closeMenu(){},onMenuOpened(){},onMenuClosed(){},options:{},menuStyle:{},"data-testid":void 0};class Qn extends T.exports.PureComponent{constructor(t){super(t),this.handleClick=this.handleClick.bind(this),this.handleCloseMenu=this.handleCloseMenu.bind(this),this.handleExited=this.handleExited.bind(this),this.container=te.createRef(),this.parent=null,this.popper=te.createRef(),this.isOpen=!1}componentDidMount(){var n;const{isShown:t}=this.props;t===null?(n=this.container.current)!=null&&n.parentElement&&(this.parent=this.container.current.parentElement,this.parent.addEventListener("click",this.handleClick)):t&&this.openMenu()}componentDidUpdate(t){const{isShown:n}=this.props;t.isShown!==n&&(n!==null&&n?window.requestAnimationFrame(()=>{this.openMenu()}):this.closeMenu())}componentWillUnmount(){this.parent&&this.parent.removeEventListener("click",this.handleClick)}closeMenu(){var t;(t=this.popper.current)==null||t.hide()}openMenu(){this.popper.current&&!this.isOpen&&(this.popper.current.show(),this.isOpen=!0)}scheduleUpdate(){var t;(t=this.popper.current)==null||t.scheduleUpdate()}handleClick(t){t.preventDefault(),t.stopPropagation(),this.openMenu()}handleCloseMenu(){this.closeMenu()}handleExited(){this.isOpen=!1;const{onMenuClosed:t}=this.props;t()}render(){const{actions:t,onMenuOpened:n,popperClassName:s,"data-testid":o}=this.props,{menuStyle:i}=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":o,children:h(Rn,{ref:this.popper,options:l,className:B("menu-popper",s),onExited:this.handleExited,closeOnBlur:!0,interactive:!0,children:h(va,{actions:t,closeMenu:this.handleCloseMenu,onMenuOpened:n,options:r,menuStyle:i})})})}}Qn.defaultProps={isShown:null,onMenuClosed(){},onMenuOpened(){},options:{},popperOptions:{},popperClassName:"",menuStyle:{},"data-testid":void 0};const ul=-1;var Ta=(e=>(e.UP="UP",e.DOWN="DOWN",e))(Ta||{});const gn=class extends T.exports.Component{constructor(e){super(e);const{value:t,valueToTime:n}=e;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=te.createRef(),this.menuContainer=te.createRef(),this.button=te.createRef(),this.input=te.createRef(),this.state={keyboardOptionIndex:0,menuIsOpen:!1,inputWidth:100,customTime:n(t),inputFocused:!1}}getSelectedText(){const{options:e,value:t,placeholder:n}=this.props,{customTime:s}=this.state;if(t===null)return n;for(let o=0;o<e.length;o+=1){const i=e[o];if(i.value===t)return i.title}return tn.formatTime(s)}setInputWidth(){this.csContainer.current&&this.setState({inputWidth:this.csContainer.current.getBoundingClientRect().width})}focus(){var e;(e=this.button.current)==null||e.focus()}updateInputValue(e){const{onChange:t}=this.props;t(e)}handleResize(){this.setInputWidth()}handleMenuKeyDown(e){var o;const{keyboardOptionIndex:t,inputFocused:n}=this.state,{options:s}=this.props;switch(e.key){case"Enter":case" ":n?this.updateFromCustom():this.updateInputValue(s[t].value),this.closeMenu(),(o=this.button.current)==null||o.focus(),e.stopPropagation(),e.preventDefault();break;case"Tab":e.shiftKey?this.handleMenuNavigation(gn.MENU_NAVIGATION_DIRECTION.UP):this.handleMenuNavigation(gn.MENU_NAVIGATION_DIRECTION.DOWN),e.stopPropagation(),e.preventDefault();break;case"ArrowUp":this.handleMenuNavigation(gn.MENU_NAVIGATION_DIRECTION.UP),e.stopPropagation(),e.preventDefault();break;case"ArrowDown":this.handleMenuNavigation(gn.MENU_NAVIGATION_DIRECTION.DOWN),e.stopPropagation(),e.preventDefault();break;case"Escape":this.closeMenu();break}}handleMenuNavigation(e){const{keyboardOptionIndex:t,inputFocused:n}=this.state,{options:s}=this.props,o=s.length;let i=t;switch(e){case gn.MENU_NAVIGATION_DIRECTION.UP:if(!n&&t===0){this.focusInput();break}else n&&this.focusOption(t);t>0&&!n?(i=(i-1)%o,this.setState({keyboardOptionIndex:i})):t===0&&(i=o-1,this.setState({keyboardOptionIndex:i})),this.scrollOptionIntoView(i);break;case gn.MENU_NAVIGATION_DIRECTION.DOWN:if(!n&&t===o-1){this.focusInput();break}else n&&this.focusOption(t);t<o&&!(n&&t===0)&&(i=(i+1)%o,this.setState({keyboardOptionIndex:i})),this.scrollOptionIntoView(i);break}}handleOptionClick(e){const t=Number(e.currentTarget.value),{options:n,timeToValue:s}=this.props,{customTime:o}=this.state;if(t===ul){const i=s(o);this.updateAndClose(i)}else this.updateAndClose(n[t].value)}updateAndClose(e){var t;this.updateInputValue(e),this.closeMenu(),(t=this.button.current)==null||t.focus()}handleOptionFocus(e){this.setState({keyboardOptionIndex:Number(e.target.value)})}handleMenuOpened(){var i;const{options:e,value:t}=this.props,{keyboardOptionIndex:n}=this.state;this.scrollOptionIntoView(n);const s=(i=this.menuContainer.current)==null?void 0:i.querySelector(".cs-option-btn.keyboard-active");if(s instanceof HTMLElement&&s.focus(),t===null)return;e.map(r=>r.value).indexOf(t)<0&&this.focusInput()}focusInput(){var e;(e=this.input.current)==null||e.focus()}focusOption(e){var n;const t=(n=this.menuContainer.current)==null?void 0:n.querySelector(".cs-options");if(t&&t.children!=null){const s=t.children.item(e);s instanceof HTMLElement&&s.focus()}}handleMenuExited(){const{menuIsOpen:e}=this.state;e&&this.setState({menuIsOpen:!1,keyboardOptionIndex:0})}handleCustomInput(e){const{timeToValue:t}=this.props,n=t(e);this.updateInputValue(n),this.setState({customTime:e})}updateFromCustom(){const{timeToValue:e}=this.props,{customTime:t}=this.state,n=e(t);this.updateInputValue(n)}toggleMenu(e){const{menuIsOpen:t}=this.state;t?this.closeMenu():this.openMenu(),e.stopPropagation()}openMenu(){this.updateKeyboardIndex(),this.setInputWidth(),this.setState({menuIsOpen:!0})}closeMenu(e=!0){var t;this.setState({menuIsOpen:!1}),e&&((t=this.button.current)==null||t.focus())}updateKeyboardIndex(){const{options:e,value:t}=this.props;if(t===null)return;const n=e.map(s=>s.value).indexOf(t);n>0&&this.setState({keyboardOptionIndex:n})}scrollOptionIntoView(e){var n;const t=(n=this.menuContainer.current)==null?void 0:n.querySelector(".cs-options");if(t&&t.children!=null){const s=t.children.item(e);s instanceof HTMLElement&&s.offsetTop>gn.DROP_DOWN_MENU_HEIGHT?t.scrollTop=s.offsetTop-gn.DROP_DOWN_MENU_HEIGHT:(s instanceof HTMLElement&&s.offsetTop<0||e===0)&&(t.scrollTop=0)}}renderMenuElement(){const{inputWidth:e}=this.state;return h("div",{className:"cs-menu-container",ref:this.menuContainer,role:"presentation",onKeyDown:this.handleMenuKeyDown,onClick:t=>{t.stopPropagation()},style:{width:e},children:h("div",{className:"cs-options-container",children:h("div",{className:"cs-options",children:this.renderOptions()})})})}renderOptions(){const{options:e,value:t,icon:n,customText:s}=this.props,{keyboardOptionIndex:o,customTime:i,inputFocused:r}=this.state;let l=!1;const a=[];for(let c=0;c<e.length;c+=1){const d=e[c],u=`option-${c}-${d.value}`;l=l||d.value===t,a.push(R("button",{type:"button",value:c,className:B("cs-option-btn",{"keyboard-active":o===c&&!r}),onClick:this.handleOptionClick,onFocus:this.handleOptionFocus,children:[d.value===t&&h(Z,{icon:n,className:"mr-2"}),d.value!==t&&h("span",{className:"mr-4"}),d.title]},u))}return a.push(h("hr",{className:"cs-divider"},"option-divider")),a.push(R("button",{type:"button",value:ul,className:B("cs-option-btn",{"keyboard-active":r}),onClick:this.handleOptionClick,onFocus:this.handleOptionFocus,children:[!l&&t!==null?h(Z,{icon:n,className:"mr-2"}):h("span",{className:"mr-4"}),s]},"option-custom-label")),a.push(R("div",{className:"cs-custom-container",children:[h("span",{className:"mr-2"}),h(ba,{ref:this.input,onChange:this.handleCustomInput,value:i,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:e,invalid:t,value:n,"data-testid":s}=this.props,{menuIsOpen:o}=this.state;let{popperOptions:i}=this.props;return i={placement:"bottom-end",modifiers:{preventOverflow:{enabled:!1}},...i},h("div",{className:"input-group cs-container context-menu",ref:this.csContainer,"data-testid":s,children:h("div",{className:B("input-group-append cs-dropdown",{"cs-dropdown-invalid":t}),children:R("button",{type:"button",className:B("btn cs-btn form-control",{"cs-btn-invalid":t}),ref:this.button,onClick:this.toggleMenu,disabled:e,children:[h("span",{className:B({"text-muted":n===null}),children:this.getSelectedText()}),h("span",{children:h(Z,{icon:Sr,className:"cs-caret"})}),h(Qn,{isShown:o,actions:{menuElement:this.renderMenuElement()},popperOptions:i,popperClassName:"CustomTimeSelect",onMenuOpened:this.handleMenuOpened,onMenuClosed:this.handleMenuExited,menuStyle:{maxWidth:"100rem"}})]})})})}};let yr=gn;yr.MENU_NAVIGATION_DIRECTION=Ta;yr.DROP_DOWN_MENU_HEIGHT=125;yr.defaultProps={onChange(){},value:null,disabled:!1,popperOptions:{},icon:Xn,customText:"Custom",placeholder:"Select a time",valueToTime:e=>e===null?0:Math.round(e/1e3),timeToValue:e=>e*1e3,invalid:!1,"data-testid":void 0};function Ms(e,t,n,s,o){const i=s-n+1;return`${((parseInt(t,10)-e-n)%i+i)%i+n}`.padStart(o,"0")}function Ea(e,t,n){const{selectionStart:s}=e;return s===0?Ms(t,n,1900,2099,4):s===5?Ms(t,n,1,12,2):s===8?Ms(t,n,1,31,2):s===11?Ms(t,n,0,23,2):s===17||s===14?Ms(t,n,0,59,2):s===20||s===24||s===28?Ms(t,n,0,999,3):n}const Zu=se.module("DateTimeInput"),Ju="[12][0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])",eh="([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}",th=`${Ju} ${eh}`,ei="2022-01-01",Ra=`${ei} 00:00:00.000000000`,nh="YYYY-MM-DD HH:MM:SS.SSSSSSSSS";function hl(e){return e!=null&&e.length>=ei.length?`${e.substring(0,ei.length)}${e.substring(ei.length).replace(/\u2007/g,"0")}${Ra.substring(e.length)}`:e}function sr(e){const t=e.substring(0,23),n=e.substring(23,26),s=e.substring(26);return[t,n,s].filter(o=>o!=="").join("\u200B")}const ml=e=>e.replace(/\u200B/g,""),sh=[sr(Ra)],Ir=te.forwardRef((e,t)=>{const{className:n="",onChange:s=()=>{},defaultValue:o="",onFocus:i=()=>{},onBlur:r=()=>{},"data-testid":l}=e,[a,c]=T.exports.useState(o.length>0?sr(o):""),[d,u]=T.exports.useState(),m=T.exports.useCallback(g=>{Zu.debug("handleChange",g),c(g),s(hl(ml(g)))},[s]),p=T.exports.useCallback(()=>{const g=ml(a),f=hl(g);f!==g&&c(sr(f)),r()},[a,r]);return h("div",{className:"d-flex flex-row align-items-center",children:h(vi,{ref:t,className:B(n),example:sh,getNextSegmentValue:Ea,onChange:m,onSelect:u,pattern:th,placeholder:nh,selection:d,value:a,onFocus:i,onBlur:p,"data-testid":l})})});Ir.displayName="DateTimeInput";Ir.defaultProps={className:"",onChange:()=>{},defaultValue:"",onFocus:()=>{},onBlur:()=>{},"data-testid":void 0};const oh=se.module("DateInput"),ih="[12][0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])",rh=["2000-01-01","2022-12-31"],lh="YYYY-MM-DD",ya=te.forwardRef((e,t)=>{const{className:n="",onChange:s=()=>{},defaultValue:o="",onFocus:i=()=>{},onBlur:r=()=>{},"data-testid":l}=e,[a,c]=T.exports.useState(o),[d,u]=T.exports.useState(),m=T.exports.useCallback(p=>{oh.debug("handleChange",p),c(p),s(p)},[s]);return h("div",{className:"d-flex flex-row align-items-center",children:h(vi,{ref:t,className:B(n),example:rh,getNextSegmentValue:Ea,onChange:m,onSelect:u,pattern:ih,placeholder:lh,selection:d,value:a,onFocus:i,onBlur:r,"data-testid":l})})});ya.displayName="DateInput";ya.defaultProps={className:"",onChange:()=>!1,defaultValue:"",onFocus:()=>!1,onBlur:()=>!1,"data-testid":void 0};class ah extends T.exports.PureComponent{constructor(t){super(t),this.searchInput=te.createRef(),this.handleChange=this.handleChange.bind(this),this.sendUpdate=ft(this.sendUpdate.bind(this),t.debounceMs),this.state={value:t.value}}componentDidUpdate(t){const{value:n}=this.props;t.value!==n&&this.setState({value:n})}focus(){var t;(t=this.searchInput.current)==null||t.focus()}handleChange(t){this.setState({value:t.target.value},this.sendUpdate)}sendUpdate(){const{onChange:t}=this.props,{value:n}=this.state;t(n)}render(){const{placeholder:t,className:n,matchCount:s,id:o,"data-testid":i}=this.props,{value:r}=this.state;return h(Jn,{value:r,placeholder:t,onChange:this.handleChange,className:n,matchCount:s,ref:this.searchInput,id:o,"data-testid":i})}}ah.defaultProps={placeholder:"Search",className:"",matchCount:null,debounceMs:250,id:"","data-testid":void 0};const ch=se.module("ItemListItem"),Ia=class extends T.exports.Component{constructor(e){super(e),this.handleBlur=this.handleBlur.bind(this),this.handleFocus=this.handleFocus.bind(this),this.handleClick=this.handleClick.bind(this),this.handleContextMenu=this.handleContextMenu.bind(this),this.handleDragStart=this.handleDragStart.bind(this),this.handleDrag=this.handleDrag.bind(this),this.handleDragOver=this.handleDragOver.bind(this),this.handleDragEnd=this.handleDragEnd.bind(this),this.handleDrop=this.handleDrop.bind(this),this.handleDoubleClick=this.handleDoubleClick.bind(this),this.handleMouseDown=this.handleMouseDown.bind(this),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleMouseUp=this.handleMouseUp.bind(this),this.itemRef=te.createRef()}static handleKeyDown(){return ch.log("ItemListItem.handleKeyDown false"),!1}handleBlur(e){const{itemIndex:t,onBlur:n}=this.props;n(t,e)}handleFocus(e){const{itemIndex:t,onFocus:n}=this.props;n(t,e)}handleClick(e){const{itemIndex:t,onClick:n}=this.props;n(t,e)}handleContextMenu(e){const{itemIndex:t,onContextMenu:n}=this.props;n(t,e)}handleDragStart(e){const{itemIndex:t,onDragStart:n}=this.props;n(t,e)}handleDrag(e){const{itemIndex:t,onDrag:n}=this.props;n(t,e)}handleDragOver(e){e.preventDefault();const{itemIndex:t,onDragOver:n}=this.props;n(t,e)}handleDragEnd(e){const{itemIndex:t,onDragEnd:n}=this.props;n(t,e)}handleDrop(e){const{itemIndex:t,onDrop:n}=this.props;n(t,e)}handleDoubleClick(e){const{itemIndex:t,onDoubleClick:n}=this.props;n(t,e)}handleMouseMove(e){const{itemIndex:t,onMouseMove:n}=this.props;n(t,e)}handleMouseDown(e){const{itemIndex:t,onMouseDown:n}=this.props;n(t,e)}handleMouseUp(e){const{itemIndex:t,onMouseUp:n}=this.props;n(t,e)}render(){const{isDraggable:e,isFocused:t,isSelected:n,style:s,children:o,"data-testid":i}=this.props;return h("div",{className:B("item-list-item",{active:n},{"is-focused":t},{"is-draggable":e}),onKeyDown:Ia.handleKeyDown,onContextMenuCapture:this.handleContextMenu,onClick:this.handleClick,onDrag:this.handleDrag,onDragStart:this.handleDragStart,onDragOver:this.handleDragOver,onDragEnd:this.handleDragEnd,onDrop:this.handleDrop,onDoubleClick:this.handleDoubleClick,onMouseDown:this.handleMouseDown,onMouseMove:this.handleMouseMove,onMouseUp:this.handleMouseUp,tabIndex:-1,ref:this.itemRef,role:"listitem",style:s,onFocus:this.handleFocus,onBlur:this.handleBlur,draggable:e,"data-testid":i,children:o})}};let Ma=Ia;Ma.defaultProps={children:null,isDraggable:!1,isFocused:!1,isSelected:!1,itemIndex:0,"data-testid":void 0,onBlur(){},onClick(){},onContextMenu(){},onDragStart(){},onDrag(){},onDragOver(){},onDragEnd(){},onDrop(){},onDoubleClick(){},onFocus(){},onMouseDown(){},onMouseMove(){},onMouseUp(){},style:{}};const pl=se.module("ItemList"),Hs=class extends T.exports.PureComponent{constructor(e){super(e),this.getItemSelected=he((s,o)=>Qt.isSelected(o,s),{max:Hs.CACHE_SIZE}),this.getCachedItem=he((s,o,i,r,l,a,c,d)=>{const u=a({item:i,itemIndex:s,isFocused:r,isSelected:l,style:c});return h(Ma,{onContextMenu:this.handleItemContextMenu,onDoubleClick:this.handleItemDoubleClick,onMouseDown:this.handleItemMouseDown,onFocus:this.handleItemFocus,onBlur:this.handleItemBlur,disableSelect:d,onMouseMove:this.handleItemMouseMove,onMouseUp:this.handleItemMouseUp,isFocused:r,isSelected:l,itemIndex:s,style:c,children:u},o)},{max:Hs.CACHE_SIZE}),this.getOuterElement=he(s=>{const o=te.forwardRef((i,r)=>h("div",{ref:r,tabIndex:-1,onKeyDown:s,role:"presentation",...i}));return o.displayName="ItemListOuterElement",o}),this.getInnerElement=he(()=>{const s=te.forwardRef((o,i)=>h("div",{className:"item-list-inner-element",ref:i,...o}));return s.displayName="ItemListInnerElement",s}),this.getItemData=he((s,o,i)=>({items:s,selectedRanges:o,renderItem:i})),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=te.createRef(),this.listContainer=te.createRef();const{isStickyBottom:t,selectedRanges:n}=e;this.state={focusIndex:null,mouseDownIndex:null,selectedRanges:n,overscanStartIndex:0,height:null,isDragging:!1,isStuckToBottom:t,scrollOffset:null}}static renderItem({item:e}){var t,n;return h("div",{className:"item-list-item-content",children:e!=null&&((n=(t=e.displayValue)!=null?t:e.value)!=null?n:`${e}`)})}componentDidUpdate(e,t){const{selectedRanges:n,itemCount:s}=this.props,{focusIndex:o,isStuckToBottom:i,scrollOffset:r,height:l,selectedRanges:a}=this.state;if(i&&!this.isListAtBottom()&&s>0&&this.scrollToBottom(),(r!==t.scrollOffset||l!==t.height)&&this.sendViewportUpdate(),n!==e.selectedRanges&&n!==a)this.setSelectedRanges(n);else if(a!==t.selectedRanges){const{onSelectionChange:c}=this.props;c(a)}if(o!==t.focusIndex){const{onFocusChange:c}=this.props;c(o)}}componentWillUnmount(){window.removeEventListener("mouseup",this.handleWindowMouseUp)}focus(){var e;(e=this.listContainer.current)==null||e.focus()}restoreScrollPosition(){var t;const{scrollOffset:e}=this.state;e!=null&&((t=this.listContainer.current)==null||t.scrollTo(0,e))}getElement(e){if(this.listContainer.current==null)return null;const{focusSelector:t}=this.props,{overscanStartIndex:n}=this.state,s=this.listContainer.current.querySelectorAll(t),o=e-n;return s[o]}focusItem(e){const{disableSelect:t}=this.props;if(t)return;this.setState({focusIndex:e});const n=this.getElement(e);n instanceof HTMLElement&&n.focus()}scrollToItem(e){const t=this.getElement(e);t!=null&&t.scrollIntoView({block:"center"})}handleItemContextMenu(e,t){const{selectedRanges:n}=this.state,o=Qt.isSelected(n,e)||Ne.isModifierKeyDown(t);this.toggleSelect(e,t.shiftKey,o,!1)}handleItemDoubleClick(e,t){const{isDoubleClickSelect:n,onSelect:s}=this.props;n&&this.setState(({selectedRanges:o})=>({selectedRanges:Qt.selectRange(o,[e,e])}),()=>{s(e,t)})}handleItemMouseDown(e,t){const{selectedRanges:n}=this.state;if(!(t.target instanceof HTMLElement&&["button","select","input","textarea"].indexOf(t.target.tagName.toLowerCase())!==-1)){if(t.button===2&&n.length===0){this.focusItem(e),this.selectItem(e);return}t.button!=null&&t.button!==0||(this.setState({mouseDownIndex:e}),window.addEventListener("mouseup",this.handleWindowMouseUp))}}handleItemBlur(e,t){pl.debug2("item blur",e,t.currentTarget,t.relatedTarget),(!t.relatedTarget||this.listContainer.current&&t.relatedTarget instanceof HTMLElement&&!this.listContainer.current.contains(t.relatedTarget))&&this.setState({focusIndex:null})}handleItemFocus(e,t){pl.debug2("item focus",e,t.target),this.setState(n=>{const{focusIndex:s}=n;return s!==e?{focusIndex:e}:null})}handleItemMouseMove(e,t){const{isDragSelect:n,isMultiSelect:s,disableSelect:o}=this.props,{mouseDownIndex:i,selectedRanges:r}=this.state;i==null||o||(this.setState({isDragging:!0}),(n||i===e)&&(this.focusItem(e),s?(!n&&!this.getItemSelected(e,r)&&!Ne.isModifierKeyDown(t)&&this.deselectAll(),this.selectRange([Math.min(i,e),Math.max(i,e)])):this.toggleSelect(e,t.shiftKey,Ne.isModifierKeyDown(t),!1)))}handleItemMouseUp(e,t){const{isDeselectOnClick:n,isDoubleClickSelect:s,onSelect:o}=this.props,{mouseDownIndex:i,isDragging:r}=this.state;if(!(t.target instanceof HTMLElement&&["button","select","input","textarea"].indexOf(t.target.tagName.toLowerCase())!==-1)){if(i===e&&!r){const l=t.shiftKey,a=Ne.isModifierKeyDown(t);this.focusItem(e),this.toggleSelect(e,l,a,n),!s&&!l&&!a&&o(e,t)}this.resetMouseState()}}handleItemsRendered({overscanStartIndex:e}){this.setState({overscanStartIndex:e})}handleResize({height:e}){this.setState({height:e})}handleMouseLeave(){this.setState({mouseDownIndex:null})}handleWindowMouseUp(){this.resetMouseState(),window.removeEventListener("mouseup",this.handleWindowMouseUp)}handleKeyDown(e){var r;const{isMultiSelect:t,itemCount:n,onSelect:s}=this.props,{focusIndex:o}=this.state;let i=o;if(e.key==="Enter"||e.key===" "){!t&&i!=null&&this.setState({selectedRanges:[[i,i]]},()=>{i!=null&&s(i,e)});return}if(e.key==="ArrowUp")i!=null&&i>=0?i=Math.max(0,i-1):i=n-1;else if(e.key==="ArrowDown")i!=null&&i>=0?i=Math.min(i+1,n-1):i=0;else return;if(o!==i){e.stopPropagation(),e.preventDefault(),this.focusItem(i);const{selectedRanges:l}=this.state;if(e.shiftKey&&l.length>0){const a=l[l.length-1];this.selectRange([Math.min(i,a[0]),Math.max(i,a[1])])}else this.deselectAll(),i!==null?this.selectItem(i):(r=this.listContainer.current)==null||r.focus();this.scrollIntoView(i)}}handleScroll({scrollUpdateWasRequested:e,scrollOffset:t}){this.setState(n=>{if(e)return{scrollOffset:t};const{isStickyBottom:s}=this.props,{height:o}=n;return{isStuckToBottom:s&&this.isListAtBottom({scrollOffset:t,height:o}),scrollOffset:t}})}resetMouseState(){this.setState({mouseDownIndex:null,isDragging:!1})}scrollToBottom(){const{itemCount:e}=this.props;this.list.current&&this.list.current.scrollToItem(e)}scrollIntoView(e){this.list.current&&this.list.current.scrollToItem(e)}toggleSelect(e,t,n,s=!0){const{isMultiSelect:o}=this.props,{selectedRanges:i}=this.state;if(o&&t&&i.length>0){const r=i[i.length-1];this.selectRange([Math.min(r[0],e),Math.max(e,r[1])])}else o&&i.length===1&&i[0][0]===e&&i[0][1]===e?s&&this.deselectItem(e):o&&n?this.getItemSelected(e,i)?s&&this.deselectItem(e):this.selectItem(e):(this.deselectAll(),this.selectItem(e))}deselectAll(){const{itemCount:e}=this.props;this.deselectRange([0,e])}deselectItem(e){this.deselectRange([e,e])}deselectRange(e){Qt.validateRange(e),this.setState(({selectedRanges:t})=>({selectedRanges:Qt.deselectRange(t,e)}))}selectItem(e){const{disableSelect:t}=this.props;t||this.selectRange([e,e])}selectRange(e){Qt.validateRange(e),this.setState(({selectedRanges:t})=>({selectedRanges:Qt.selectRange(t,e)}))}setSelectedRanges(e){this.setState({selectedRanges:e})}sendViewportUpdate(){const{scrollOffset:e,height:t}=this.state;if(e!=null&&t!=null){const{onViewportChange:n,rowHeight:s}=this.props,o=Math.floor(e/s),i=o+Math.ceil(t/s);n(o,i)}}isListAtBottom({scrollOffset:e,height:t}=this.state){if(t==null||e==null)return!1;const{itemCount:n,rowHeight:s}=this.props;return e+t>=n*s}renderInnerElement({index:e,style:t}){const{items:n,offset:s,renderItem:o,disableSelect:i}=this.props,{focusIndex:r,selectedRanges:l}=this.state;if(e<s||e>=s+n.length)return null;const a=n[e-s];return this.getCachedItem(e,e,a,e===r&&!i,this.getItemSelected(e,l),o,t,i)}render(){const{items:e,itemCount:t,overscanCount:n,renderItem:s,rowHeight:o,"data-testid":i}=this.props,{selectedRanges:r,isStuckToBottom:l}=this.state;return h(kc,{className:"item-list-auto-sizer",onResize:this.handleResize,children:({width:a,height:c})=>h(Lc,{className:"item-list-scroll-pane",height:c,width:a,initialScrollOffset:l?t*o:0,itemCount:t,itemSize:o,itemData:this.getItemData(e,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":i,children:this.renderInnerElement})})}};let on=Hs;on.CACHE_SIZE=1e3;on.DEFAULT_ROW_HEIGHT=20;on.DEFAULT_OVERSCAN=10;on.defaultProps={offset:0,items:[],rowHeight:Hs.DEFAULT_ROW_HEIGHT,isDeselectOnClick:!0,isDoubleClickSelect:!1,isDragSelect:!0,isMultiSelect:!1,isStickyBottom:!1,disableSelect:!1,onFocusChange(){},onSelect(){},onSelectionChange(){},onViewportChange(){},overscanCount:Hs.DEFAULT_OVERSCAN,renderItem:Hs.renderItem,selectedRanges:[],focusSelector:".item-list-item","data-testid":void 0};const us=class extends T.exports.PureComponent{constructor(e){super(e),this.getCachedDraggableItem=he((t,n,s,o,i,r,l,a)=>h(cr,{draggableId:us.getDraggableId(t,o),index:o,isDragDisabled:l,children:c=>h("div",{role:"menuitem",className:"draggable-item-list-item",ref:c.innerRef,tabIndex:-1,...c.draggableProps,...c.dragHandleProps,children:n({item:s,itemIndex:o,isFocused:i,isSelected:r,style:a,isClone:!1})})},o),{max:on.CACHE_SIZE}),this.getCachedRenderDraggableItem=he((t,n,s)=>({item:o,itemIndex:i,isFocused:r,isSelected:l,style:a})=>this.getCachedDraggableItem(t,s,o,i,r,l,n,a),{max:1}),this.getCachedRenderClone=he((t,n,s,o)=>(i,r,l)=>{const{selectedCount:a}=this.state,{draggableProps:c,dragHandleProps:d,innerRef:u}=i,{index:m}=l.source,p=n[m-s];return h("div",{className:B("draggable-item-list-dragging-item-container",t),...c,...d,ref:u,children:h("div",{className:B("draggable-item-list-dragging-item",{"two-dragged":a===2},{"multiple-dragged":a>2}),children:o({item:p,itemIndex:m,isFocused:!1,isSelected:!0,style:{},isClone:!0,selectedCount:a})})})},{max:1}),this.handleSelectionChange=this.handleSelectionChange.bind(this),this.itemList=te.createRef(),this.state={selectedCount:0}}static renderHandle(){return R("div",{children:[h(We,{children:"Drag to re-order"}),h(Z,{icon:Ci})]})}static renderBadge({text:e}){return e!=null&&e.length>0?h("span",{className:"number-badge",children:e}):null}static renderTextItem({text:e,badgeText:t="",className:n=""}){return R("div",{className:B("item-list-item-content","draggable-item-list-item-content",n),children:[h("span",{className:"title",children:e}),us.renderBadge({text:t}),us.renderHandle()]})}static renderItem({item:e,isClone:t,selectedCount:n}){var r,l;const s=e!=null?(l=(r=e.displayValue)!=null?r:e.value)!=null?l:`${e}`:"",o=t!==void 0&&t?`${n}`:"",i=t!==void 0&&t?"item-list-item-clone":"";return us.renderTextItem({text:s,badgeText:o,className:i})}static getDraggableId(e,t){return`${e}/${t}`}static getDraggableIndex(e){const t=e.split("/").pop();return parseInt(t!==void 0?t:"",10)}selectItem(e){var t;(t=this.itemList.current)==null||t.selectItem(e)}focusItem(e){var t;(t=this.itemList.current)==null||t.focusItem(e)}scrollToItem(e){var t;(t=this.itemList.current)==null||t.scrollToItem(e)}handleSelectionChange(e){this.setState({selectedCount:Qt.count(e)});const{onSelectionChange:t}=this.props;t(e)}render(){const{className:e,draggablePrefix:t,draggingItemClassName:n,droppableId:s,isDoubleClickSelect:o,isDragDisabled:i,isDropDisabled:r,isMultiSelect:l,isStickyBottom:a,itemCount:c,items:d,offset:u,onFocusChange:m,onSelect:p,onViewportChange:g,renderItem:f,rowHeight:w,selectedRanges:C,style:S,"data-testid":b}=this.props;return h(pi,{isDropDisabled:r,droppableId:s,mode:"virtual",renderClone:this.getCachedRenderClone(n,d,u,f),"data-testid":b,children:(E,v)=>h("div",{role:"menu",className:B("draggable-item-list",e,{"is-drop-disabled":r,"is-drag-disabled":i,"is-dragging-from-this":v.draggingFromThisWith,"is-dragging-over":v.isDraggingOver,"is-dropping":v.draggingOverWith}),style:S,ref:E.innerRef,...E.droppableProps,children:h(on,{focusSelector:".draggable-item-list-item",isDoubleClickSelect:o,isDragSelect:!1,isMultiSelect:l,isStickyBottom:a,itemCount:c,items:d,onFocusChange:m,onSelect:p,onSelectionChange:this.handleSelectionChange,onViewportChange:g,offset:u,ref:this.itemList,renderItem:this.getCachedRenderDraggableItem(t,i,f),rowHeight:w,selectedRanges:C})})})}};let bt=us;bt.DEFAULT_ROW_HEIGHT=30;bt.defaultProps={className:"",draggingItemClassName:"",offset:0,items:[],rowHeight:us.DEFAULT_ROW_HEIGHT,isDeselectOnClick:!0,isDoubleClickSelect:!0,isDropDisabled:!1,isDragDisabled:!1,isMultiSelect:!1,isStickyBottom:!1,disableSelect:!1,style:null,onFocusChange(){},onSelect(){},onSelectionChange(){},onViewportChange(){},renderItem:us.renderItem,selectedRanges:[],draggablePrefix:"draggable-item",droppableId:"droppable-item-list","data-testid":void 0};class gt{static reorder(t,n,s,o){const i=t===s?gt.adjustDestinationIndex(o,n):o,r=gt.removeItems(t,n);return s.splice(i,0,...r),r}static removeItems(t,n){const s=[],o=n.map((i,r)=>({range:i,index:r})).sort((i,r)=>r.range[0]-i.range[0]);for(let i=0;i<o.length;i+=1){const{range:r,index:l}=o[i],[a,c]=r;s[l]=t.splice(a,c-a+1)}return Pc(s)}static adjustDestinationIndex(t,n){let s=t;for(let o=0;o<n.length;o+=1){const[i,r]=n[o];if(i>t)break;s-=Math.min(r,t-1)-i+1}return s}static startDragging(){document.documentElement.classList.add("drag-pointer-events-none")}static stopDragging(){document.documentElement.classList.remove("drag-pointer-events-none")}}const ti=class extends T.exports.Component{static isParentSelected(e,t){const n=t.get(e);if(n===void 0)return!1;if(typeof n=="boolean")return n;const s=Array.from(n.values()).includes(!0),o=Array.from(n.values()).includes(!1);return s&&o?null:s}constructor(e){super(e),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(e){e.stopPropagation(),e.preventDefault(),this.setState(t=>{const{menuIsOpen:n}=t;return{menuIsOpen:!n}})}toggleValueFor(e,t){const{valueMap:n,onUpdateValueMap:s}=this.props,o=new Map(n),i=o.get(e);if(i instanceof Map){const l=new Map(i);if(t!=null)l.set(t,i.get(t)===void 0);else{const a=ti.isParentSelected(e,o),c=a==null||!a;i.forEach((d,u)=>l.set(u,c))}o.set(e,l)}else o.set(e,i==null||!i);const r=o.get(e);if(t===void 0&&r!==void 0&&typeof r!="boolean"){const l=ti.isParentSelected(e,n);l!=null&&l?r.forEach((a,c)=>r.set(c,!1)):r.forEach((a,c)=>r.set(c,!0))}s(o)}setAllValues(e){const{valueMap:t,onUpdateValueMap:n}=this.props,s=new Map;t.forEach((o,i)=>{if(typeof o=="boolean")s.set(i,e);else{const r=new Map;o.forEach((l,a)=>r.set(a,e)),s.set(i,r)}}),n(s)}selectAll(){this.setAllValues(!0)}clear(){this.setAllValues(!1)}renderMenuElement(){const{valueMap:e,"data-testid":t}=this.props;return R("div",{className:"hcm-menu-container",children:[Array.from(e.entries()).map(([n,s])=>R("div",{children:[h(ut,{className:"hcm-parent",checked:ti.isParentSelected(n,e),onChange:()=>this.toggleValueFor(n),children:n}),s!==void 0&&typeof s!="boolean"&&Array.from(s.entries()).map(([o,i])=>h(ut,{className:"hcm-child",checked:i,onChange:()=>this.toggleValueFor(n,o),children:o},o))]},n)),h(X,{kind:"ghost",onClick:this.selectAll,"data-testid":t!==void 0?`${t}-btn-select-all`:void 0,children:"Select All"}),h(X,{kind:"ghost",onClick:this.clear,"data-testid":t!==void 0?`${t}-btn-clear`:void 0,children:"Clear"})]})}render(){const{menuText:e,className:t,icon:n,id:s,"data-testid":o}=this.props,{menuIsOpen:i}=this.state;return R("button",{type:"button",className:B("btn hcm-btn",t),onClick:this.toggleMenu,id:s,"data-testid":o,children:[R("span",{children:[n&&h(Z,{icon:n,className:"hcm-icon mr-1"}),e]}),h(Z,{icon:Sr,className:"hcm-icon ml-1"}),h(Rn,{options:{placement:"bottom"},isShown:i,onExited:()=>{this.setState({menuIsOpen:!1})},closeOnBlur:!0,interactive:!0,children:this.renderMenuElement()})]})}};let uh=ti;uh.defaultProps={className:"",icon:null,id:"","data-testid":void 0};function Da({isLoaded:e=!1,isLoading:t=!0,errorMessage:n=null,"data-testid":s}){return h(dt,{in:Boolean(n)||!e||t,timeout:Le.transitionMs,classNames:e?"fade":"",mountOnEnter:!0,unmountOnExit:!0,children:h("div",{className:"fill-parent-absolute","data-testid":s,children:h("div",{className:B("iris-panel-message-overlay","fill-parent-absolute",{"iris-panel-scrim-background":e}),children:R("div",{className:"message-content",children:[R("div",{className:"message-icon",children:[t&&h(Vt,{}),!t&&n!=null&&h(Z,{icon:Yn})]}),h("div",{className:"message-text",children:n})]})})})})}function Na({on:e,id:t,className:n,isInvalid:s,disabled:o=!1,onClick:i,"data-testid":r}){return h("button",{type:"button",className:B("btn","btn-switch",n,{active:e},{"is-invalid":s}),id:t,onClick:i,disabled:o,"data-testid":r,children:h("div",{className:"handle"})})}function gl(e){return e.isOn!==void 0}function hh({item:e,onSelect:t=()=>{},"data-testid":n}){const{icon:s,subtitle:o,title:i}=e,r=T.exports.useMemo(()=>gl(e)?()=>{e.onChange(!e.isOn)}:t,[e,t]);return R("div",{className:"btn btn-navigation-menu-item","data-testid":`menu-item-${i}`,onClick:r,onKeyDown:l=>{(l.key==="Enter"||l.key===" ")&&r()},tabIndex:0,role:"menuitem",children:[s!==void 0&&h("div",{className:"icon",children:h(Z,{icon:s})}),h("div",{className:"title",children:i}),o!==void 0&&h("div",{className:"shortcut",children:o}),h("div",{className:"accessory","data-testid":n,children:gl(e)?h(Na,{on:e.isOn,onClick:l=>{l.stopPropagation(),r()}}):h(Z,{icon:oa})})]})}function Fa({items:e,onSelect:t=()=>{},"data-testid":n}){return h("div",{className:"navigation-menu-view","data-testid":n,children:h("ul",{className:"navigation-menu-list",children:e.map((s,o)=>h("li",{children:h(hh,{item:s,onSelect:()=>{t(o)}})},s.title))})})}function fl({children:e,onBack:t,onClose:n,title:s,"data-testid":o}){return R("div",{className:"navigation-page","data-testid":o,children:[R("div",{className:"navigation-title-bar",children:[h("div",{className:"navigation-left-buttons",children:t!==void 0&&h(X,{kind:"ghost",className:"btn-back","data-testid":"btn-page-back",onClick:t,icon:$d,children:"Back"})}),h("div",{className:"navigation-title",children:s}),h("div",{className:"navigation-right-buttons",children:n!==void 0&&h(X,{kind:"ghost",className:"btn-close px-2 m-1","data-testid":"btn-page-close",onClick:n,icon:go,tooltip:"Close"})})]}),h("div",{className:"navigation-content",children:e})]})}function mh({children:e,"data-testid":t}){const n=T.exports.useMemo(()=>te.Children.toArray(e),[e]),s=Er(n),[o,i]=T.exports.useState(n[n.length-1]),[r,l]=T.exports.useState(null),[a,c]=T.exports.useState(null);T.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!==o&&i(p):n.length>s.length?l(p):n.length<s.length&&(i(p),c(s[s.length-1]))},[n,s,r,a,o]);const d=T.exports.useCallback(()=>{i(r),l(null)},[r]),u=T.exports.useCallback(()=>{c(null)},[]);return R("div",{className:"navigation-stack",children:[h("div",{className:"main-view","data-testid":t,children:o}),h(dt,{in:a!=null,timeout:Le.transitionMidMs,classNames:"slide-right",onEntered:u,children:h(Fe,{children:a!=null&&h("div",{className:"popping-view",children:a})})}),h(dt,{in:r!=null,timeout:Le.transitionMidMs,classNames:"slide-left",onEntered:d,children:h(Fe,{children:r!=null&&h("div",{className:"pushing-view",children:r})})})]})}function ph({children:e,disabled:t,value:n,"data-testid":s}){return h("option",{value:n,disabled:t,"data-testid":s,children:e})}function Mr(e){const{children:t,disabled:n=!1,name:s,onChange:o,value:i="","data-testid":r}=e,[l]=T.exports.useState(s!=null?s:sn());return h(Fe,{children:te.Children.map(t,a=>{var c,d;return a?te.cloneElement(a,{name:l,onChange:(c=a.props.onChange)!=null?c:o,checked:i===a.props.value,disabled:(d=a.props.disabled)!=null?d:n,"data-testid":r}):null})})}const Tn=te.forwardRef((e,t)=>{const{checked:n,children:s,className:o="",disabled:i=!1,inputClassName:r="",isInvalid:l=!1,labelClassName:a="",name:c,onChange:d,value:u,"data-testid":m}=e,[p]=T.exports.useState(sn());return R("div",{className:B("custom-control custom-radio",o),children:[h("input",{type:"radio",id:p,"data-testid":m,name:c,ref:t,className:B("custom-control-input",r,{"is-invalid":l}),checked:n,disabled:i,value:u,onChange:d}),h("label",{className:B("custom-control-label",a),htmlFor:p,children:s})]})});Tn.displayName="RadioItem";Tn.defaultProps={checked:void 0,className:"",disabled:!1,inputClassName:"",isInvalid:!1,labelClassName:"",name:void 0,onChange:void 0,"data-testid":void 0};function gh({children:e,onBlur:t,onChange:n,className:s,defaultValue:o,name:i,value:r,disabled:l,"data-testid":a}){const c=T.exports.useCallback(d=>{n(d.target.value)},[n]);return h("select",{className:B("custom-select",s),onBlur:t,onChange:c,defaultValue:o,value:r,name:i,disabled:l,"data-testid":a,children:e})}class xa extends T.exports.PureComponent{constructor(t){super(t),this.getCachedItem=he((n,s,o,i,r,l,a)=>{const c={height:r},d=i!=null?i:o;return h("li",{className:"value-list-item",style:c,tabIndex:-1,children:h(ut,{checked:l,disabled:a,onChange:()=>this.handleSelect(n),children:d})},s)},{max:1e3}),this.getCachedItems=he((n,s,o,i)=>{const r=[];for(let l=0;l<n.length;l+=1){const a=n[l],{value:c,displayValue:d,isSelected:u}=a,m=o+l,p=m,g=this.getCachedItem(m,p,c,d,s,u,i);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=te.createRef(),this.topRow=null,this.bottomRow=null}componentDidMount(){this.sendViewportUpdate()}componentDidUpdate(){this.sendViewportUpdate()}handleBlur(t){if(!t.relatedTarget||this.list.current&&t.relatedTarget instanceof HTMLElement&&!this.list.current.contains(t.relatedTarget)){const{onBlur:n}=this.props;n==null||n(t)}}handleScroll(){this.sendViewportUpdate()}handleSelect(t){const{items:n,offset:s,onSelect:o}=this.props,i=t-s;if(i>=0&&i<n.length){const r=n[i],{value:l}=r;o(t,l)}else o(t,null)}sendViewportUpdate(){if(!this.list.current||this.list.current.clientHeight===0)return;const{onViewportChange:t,rowHeight:n}=this.props,s=this.list.current.scrollTop,o=s+this.list.current.clientHeight,i=Math.floor(s/n),r=Math.ceil(o/n);(this.topRow!==i||this.bottomRow!==r)&&(this.topRow=i,this.bottomRow=r,t(i,r))}getElement(t){return this.list.current==null?null:this.list.current.querySelectorAll(".value-list-item")[t]}scrollIntoView(t){const n=this.getElement(t);n==null||n.scrollIntoView({block:"center"})}render(){const{className:t,disabled:n,isInvalid:s,items:o,itemCount:i,offset:r,rowHeight:l,"data-testid":a}=this.props,c=this.getCachedItems(o,l,r,n);return h("div",{className:B("select-value-list-scroll-pane h-100 w-100",{"is-invalid":s},t),onBlur:this.handleBlur,onScroll:this.handleScroll,ref:this.list,"data-testid":a,children:h("div",{className:"select-value-list",style:{height:i*l},children:h("ol",{className:"select-value-list-content",style:{position:"absolute",height:o.length*l,top:r*l,left:0},children:c})})})}}xa.defaultProps={disabled:!1,rowHeight:21,onBlur:()=>{},"data-testid":void 0};const Cl=se.module("Shortcut");var ie=(e=>(e.CTRL="MODIFIER_CTRL",e.CMD="MODIFIER_CMD",e.ALT="MODIFIER_ALT",e.OPTION="MODIFIER_OPTION",e.SHIFT="MODIFIER_SHIFT",e))(ie||{}),ae=(e=>(e.A="A",e.B="B",e.C="C",e.D="D",e.E="E",e.F="F",e.G="G",e.H="H",e.I="I",e.J="J",e.K="K",e.L="L",e.M="M",e.N="N",e.O="O",e.P="P",e.Q="Q",e.R="R",e.S="S",e.T="T",e.U="U",e.V="V",e.W="W",e.X="X",e.Y="Y",e.Z="Z",e.ZERO="0",e.ONE="1",e.TWO="2",e.THREE="3",e.FOUR="4",e.FIVE="5",e.SIX="6",e.SEVEN="7",e.EIGHT="8",e.NINE="9",e.BACKSPACE="Backspace",e.ESCAPE="Escape",e.ENTER="Enter",e.DELETE="Delete",e.SLASH="/",e.QUESTION_MARK="?",e.BACKSLASH="\\",e.PIPE="|",e.MINUS="-",e.UNDERSCORE="_",e.EQUALS="=",e.PLUS="+",e.BACKTICK="`",e.TILDE="~",e.COMMA=",",e.LEFT_CHEVRON="<",e.PERIOD=".",e.RIGHT_CHEVRON=">",e.SEMICOLON=";",e.COLON=":",e.SINGLE_QUOTE="'",e.DOUBLE_QUOTE='"',e.LEFT_BRACKET="[",e.RIGHT_BRACKET="]",e.LEFT_CURLY="{",e.RIGHT_CURLY="}",e.F1="F1",e.F2="F2",e.F3="F3",e.F4="F4",e.F5="F5",e.F6="F6",e.F7="F7",e.F8="F8",e.F9="F9",e.F10="F10",e.F11="F11",e.F12="F12",e))(ae||{});const fh=new Set(["Enter","Delete","F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12"]),Xe=class extends dr{constructor({id:e,shortcut:t,macShortcut:n,isEditable:s=!0,name:o,tooltip:i}){super(),this.id=e,this.name=o,this.tooltip=i,this.isEditable=s;const l=Xe.isMacPlatform?n:t;this.defaultKeyState=Xe.createKeyState(l),this.keyState=this.defaultKeyState}static isAllowedKey(e){return Object.values(ae).includes(e)}static isValidKeyState(e){const{keyValue:t}=e;return t===null?!0:!Xe.isMacPlatform&&e.metaKey||!Xe.isAllowedKey(t)?!1:!(!e.altKey&&!e.ctrlKey&&!e.metaKey&&!e.shiftKey)||fh.has(t)}static createKeyState(e){const t={altKey:!1,ctrlKey:!1,metaKey:!1,shiftKey:!1,keyValue:e[e.length-1]};return e.forEach(n=>{switch(n){case"MODIFIER_CTRL":t.ctrlKey=!0;break;case"MODIFIER_ALT":case"MODIFIER_OPTION":t.altKey=!0;break;case"MODIFIER_CMD":t.metaKey=!0;break;case"MODIFIER_SHIFT":t.shiftKey=!0;break}}),t}static getKeyStateFromEvent(e){const{key:t,keyCode:n}=e;let s="";return t==="Shift"||t==="Meta"||t==="Control"||t==="Alt"?s="":!Xe.isAllowedKey(t)&&Xe.isAllowedKey(String.fromCharCode(n))?s=String.fromCharCode(n):s=t,{keyValue:s,altKey:e.altKey,ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey}}static getWindowsDisplayText(e){let t="";return e.ctrlKey&&(t+="Ctrl+"),e.altKey&&(t+="Alt+"),e.shiftKey&&(t+="Shift+"),e.keyValue==="Escape"?t+="Esc":e.keyValue!==null&&(t+=e.keyValue),t}static getMacDisplayText(e){let t="";switch(e.ctrlKey&&(t+="\u2303"),e.altKey&&(t+="\u2325"),e.shiftKey&&(t+="\u21E7"),e.metaKey&&(t+="\u2318"),e.keyValue){case"Enter":t+="\u23CE";break;case"Escape":t+="\u238B";break;case"Backspace":t+="\u232B";break;case"Delete":t+="\u2326";break;case null:break;default:t+=e.keyValue}return t}static doKeyStatesMatch(e,t){var n,s;return((n=e.keyValue)==null?void 0:n.toUpperCase())===((s=t.keyValue)==null?void 0:s.toUpperCase())&&e.altKey===t.altKey&&e.ctrlKey===t.ctrlKey&&e.metaKey===t.metaKey&&e.shiftKey===t.shiftKey}static getDisplayText(e){return e.keyValue===null?"":Xe.isMacPlatform?Xe.getMacDisplayText(e):Xe.getWindowsDisplayText(e)}getDisplayText(){return Xe.getDisplayText(this.keyState)}getKeyState(){return this.keyState}setKeyState(e){Xe.isValidKeyState(e)?(Cl.debug2(`Shortcut ${this.id} updated to ${JSON.stringify(e)}`),this.keyState=e,this.dispatchEvent(new Me("onUpdate",{detail:this}))):Cl.debug2(`Shortcut ${this.id} tried to update to invalid keyState ${JSON.stringify(e)}`)}getDefaultKeyState(){return this.defaultKeyState}isDefault(){return Xe.doKeyStatesMatch(this.getDefaultKeyState(),this.getKeyState())}setToNull(){this.setKeyState(Xe.NULL_KEY_STATE)}isNull(){return Xe.doKeyStatesMatch(this.keyState,Xe.NULL_KEY_STATE)}setToDefault(){this.setKeyState(this.defaultKeyState)}matchesKeyState(e){return Xe.doKeyStatesMatch(e,this.keyState)}matchesEvent(e){return this.matchesKeyState(Xe.getKeyStateFromEvent(e))}};let Dr=Xe;Dr.NULL_KEY_STATE={metaKey:!1,shiftKey:!1,altKey:!1,ctrlKey:!1,keyValue:null};Dr.isMacPlatform=Ne.isMacPlatform();const wl=se.module("ShortcutRegistry");class Ch extends dr{constructor(){super(...arguments),this.shortcutMap=new Map,this.shortcutsByCategory=new Map}createAndAdd(t){const n=new Dr(t);return this.add(n)}add(t){var o;const n=this.shortcutMap.get(t.id);if(n)return wl.warn(`Skipping attempt to add duplicate shortcut ID to registry: ${t.id}`),n;wl.debug2(`Adding shortcut to registry: ${t.id}`),t.addEventListener("onUpdate",({detail:i})=>this.dispatchEvent(new Me("onUpdate",{detail:i})));const s=t.id.split(".")[0];return this.shortcutMap.set(t.id,t),this.shortcutsByCategory.has(s)?(o=this.shortcutsByCategory.get(s))==null||o.push(t):this.shortcutsByCategory.set(s,[t]),t}get(t){return this.shortcutMap.get(t)}getConflictingShortcuts(t){return Array.from(this.shortcutMap.values()).filter(n=>!n.isNull()&&n.matchesKeyState(t))}}const De=Object.freeze(new Ch),Nr={COPY:De.createAndAdd({id:"GLOBAL.COPY",name:"Copy",shortcut:[ie.CTRL,ae.C],macShortcut:[ie.CMD,ae.C],isEditable:!1}),PASTE:De.createAndAdd({id:"GLOBAL.PASTE",name:"Paste",shortcut:[ie.CTRL,ae.V],macShortcut:[ie.CMD,ae.V],isEditable:!1}),SAVE:De.createAndAdd({id:"GLOBAL.SAVE",name:"Save",shortcut:[ie.CTRL,ae.S],macShortcut:[ie.CMD,ae.S],isEditable:!1}),SELECT_ALL:De.createAndAdd({id:"GLOBAL.SELECT_ALL",name:"Select All",shortcut:[ie.CTRL,ae.A],macShortcut:[ie.CMD,ae.A],isEditable:!1}),LINKER:De.createAndAdd({id:"GLOBAL.LINKER",name:"Linker",shortcut:[ie.CTRL,ae.L],macShortcut:[ie.CMD,ae.L]}),LINKER_CLOSE:De.createAndAdd({id:"GLOBAL.LINKER_CLOSE",name:"Close Linker Overlay",shortcut:[ae.ESCAPE],macShortcut:[ae.ESCAPE],isEditable:!1})};const Aa=te.forwardRef((e,t)=>{const{children:n,className:s,disabled:o,id:i,isLinked:r,isLinkedSource:l,isInvalid:a,onClick:c,onMouseEnter:d,onMouseLeave:u,style:m,"data-testid":p}=e;return R("button",{ref:t,type:"button",className:B("btn-socketed",{"btn-socketed-linked":r!==void 0&&r||l},{"btn-socketed-linked-source":l},{"is-invalid":a},s),id:i,onClick:c,onMouseEnter:d,onMouseLeave:u,style:m,disabled:o,"data-testid":p,children:[n,h(Z,{icon:ra,className:"linked btn-socketed-icon",transform:"down-1"}),h(Z,{icon:vu,className:"is-invalid btn-socketed-icon"})]})});Aa.displayName="SocketedButton";Aa.defaultProps={children:void 0,className:"",disabled:!1,id:void 0,isLinked:!1,isLinkedSource:!1,isInvalid:!1,onClick:void 0,onMouseEnter:void 0,onMouseLeave:void 0,style:void 0,"data-testid":void 0};const wh="_track_535ju_30",Sh="_handle_535ju_13",bh="_ticks_535ju_98",Oa={"handle-size":"15px","popover-width":"90px","time-slider":"_time-slider_535ju_3","time-slider-popovers":"_time-slider-popovers_535ju_8","handle-popper":"_handle-popper_535ju_13","flex-spacer":"_flex-spacer_535ju_26",track:wh,"track-fills":"_track-fills_535ju_37","track-fill":"_track-fill_535ju_37","track-fill-start":"_track-fill-start_535ju_55","track-fill-middle":"_track-fill-middle_535ju_56","track-fill-end":"_track-fill-end_535ju_59","handle-track":"_handle-track_535ju_62",handle:Sh,ticks:bh,"tick-labels":"_tick-labels_535ju_116","tick-label":"_tick-label_535ju_116","tick-label-wrapper":"_tick-label-wrapper_535ju_132"};parseInt(Oa["handle-size"],10);parseInt(Oa["popover-width"],10);Object.freeze({ERROR:"error"});class ka extends Error{constructor(){super(...arguments),this.isAssertionFailed=!0}}function Sl(e){if(e==null)throw new ka(`Expected 'val' to be defined, but received ${e}`)}class Ui extends Error{constructor(){super(...arguments),this.isPasteError=!0}}function He(e){return(e==null?void 0:e.isEditable)!==void 0}function bl(e){if(!He(e))throw new ka(`Expected 'model' to be editable, but received ${e}`)}function ke(e){return(e==null?void 0:e.hasExpandableRows)!==void 0}var Pt=(e=>(e.DOWN="DOWN",e.UP="UP",e.LEFT="LEFT",e.RIGHT="RIGHT",e))(Pt||{});const ue=class{static normalize(e,t,n,s){let o=e,i=t,r=n,l=s;return o!=null&&r!=null&&r<o&&(o=r,r=e),i!=null&&l!=null&&l<i&&(i=l,l=t),[o,i,r,l]}static makeNormalized(e,t,n,s){return new ue(...ue.normalize(e,t,n,s))}static makeCell(e,t){return new ue(e,t,e,t)}static makeColumn(e){return new ue(e,null,e,null)}static makeRow(e){return new ue(null,e,null,e)}static minOrNull(e,t){return e==null||t==null?null:Math.min(e,t)}static maxOrNull(e,t){return e==null||t==null?null:Math.max(e,t)}static consolidate(e){const t=e.slice();let n=!0;for(;n;){n=!1;for(let s=0;s<t.length&&!n;s+=1){const o=t[s];for(let i=t.length-1;i>s;i-=1){const r=t[i];if(o.contains(r))t.splice(i,1);else if(r.contains(o)){n=!0,t[s]=r,t.splice(i,1);break}else if(o.startRow===r.startRow&&o.endRow===r.endRow){if(o.touches(r)){const{startRow:l,endRow:a}=o,c=ue.minOrNull(o.startColumn,r.startColumn),d=ue.maxOrNull(o.endColumn,r.endColumn);n=!0,t[s]=new ue(c,l,d,a),t.splice(i,1);break}}else if(o.startColumn===r.startColumn&&o.endColumn===r.endColumn&&o.touches(r)){const{startColumn:l,endColumn:a}=o,c=ue.minOrNull(o.startRow,r.startRow),d=ue.maxOrNull(o.endRow,r.endRow);n=!0,t[s]=new ue(l,c,a,d),t.splice(i,1);break}}}}return t}static isAxisRangeTouching(e,t,n,s){return e==null?t==null||n==null?!0:n<=t+1:t==null?s==null?!0:s>=e-1:n==null?s==null?!0:e<=s+1:s==null?t>=n-1:n>=e-1?n<=t+1:s>=e-1}static rangeArraysEqual(e,t){if(e===t)return!0;if(e==null||t==null||e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(!e[n].equals(t[n]))return!1;return!0}static intersection(e,t){if(e.equals(t))return e;let{startColumn:n,startRow:s,endColumn:o,endRow:i}=e;return n=n!=null&&t.startColumn!=null?Math.max(n,t.startColumn):n!=null?n:t.startColumn,o=o!=null&&t.endColumn!=null?Math.min(o,t.endColumn):o!=null?o:t.endColumn,s=s!=null&&t.startRow!=null?Math.max(s,t.startRow):s!=null?s:t.startRow,i=i!=null&&t.endRow!=null?Math.min(i,t.endRow):i!=null?i:t.endRow,n!=null&&n>(o!=null?o:-1)||s!=null&&s>(i!=null?i:-1)?null:new ue(n,s,o,i)}static subtractFromRange(e,t){const n=[],s=ue.intersection(e,t);return s==null?[e]:(s.startRow!=null&&(e.startRow==null||e.startRow<s.startRow)&&n.push(new ue(e.startColumn,e.startRow,e.endColumn,s.startRow-1)),s.startColumn!=null&&(e.startColumn==null||e.startColumn<s.startColumn)&&n.push(new ue(e.startColumn,s.startRow,s.startColumn-1,s.endRow)),s.endColumn!=null&&(e.endColumn==null||e.endColumn>s.endColumn)&&n.push(new ue(s.endColumn+1,s.startRow,e.endColumn,s.endRow)),s.endRow!=null&&(e.endRow==null||e.endRow>s.endRow)&&n.push(new ue(e.startColumn,s.endRow+1,e.endColumn,e.endRow)),n)}static subtractFromRanges(e,t){const n=[];for(let s=0;s<e.length;s+=1)n.push(...ue.subtractFromRange(e[s],t));return n}static subtractRangesFromRanges(e,t){let n=[...e];for(let s=0;s<t.length;s+=1)n=ue.subtractFromRanges(n,t[s]);return n}static isBounded(e){return e.startRow!=null&&e.startColumn!=null&&e.endRow!=null&&e.endColumn!=null}static boundedRange(e,t,n){var s,o,i,r;return ue.isBounded(e)?e:new ue((s=e.startColumn)!=null?s:0,(o=e.startRow)!=null?o:0,(i=e.endColumn)!=null?i:t-1,(r=e.endRow)!=null?r:n-1)}static boundedRanges(e,t,n){return e.map(s=>ue.boundedRange(s,t,n))}static offset(e,t,n){return new ue(e.startColumn!=null?e.startColumn+t:null,e.startRow!=null?e.startRow+n:null,e.endColumn!=null?e.endColumn+t:null,e.endRow!=null?e.endRow+n:null)}static nextCell(e,t=null,n=null,s=ue.SELECTION_DIRECTION.DOWN){if(e.length===0)return null;let o=-1;if(t!=null&&n!=null&&(o=e.findIndex(i=>i.containsCell(t,n)),o>=0)){const r=e[o].nextCell(t,n,s);if(r!=null)return r}switch(s){case ue.SELECTION_DIRECTION.DOWN:case ue.SELECTION_DIRECTION.RIGHT:{const i=o<e.length-1?o+1:0;return e[i].startCell(s)}case ue.SELECTION_DIRECTION.LEFT:case ue.SELECTION_DIRECTION.UP:{const i=o>0?o-1:e.length-1;return e[i].startCell(s)}default:throw new Error(`Invalid direction: ${s}`)}}static cellCount(e){return e.reduce((t,n)=>{var s,o,i,r;return t+(((s=n.endRow)!=null?s:NaN)-((o=n.startRow)!=null?o:NaN)+1)*(((i=n.endColumn)!=null?i:NaN)-((r=n.startColumn)!=null?r:NaN)+1)},0)}static rowCount(e){return e.reduce((t,n)=>{var s,o;return t+((s=n.endRow)!=null?s:NaN)-((o=n.startRow)!=null?o:NaN)+1},0)}static columnCount(e){return e.reduce((t,n)=>{var s,o;return t+((s=n.endColumn)!=null?s:NaN)-((o=n.startColumn)!=null?o:NaN)+1},0)}static containsCell(e,t,n){for(let s=0;s<e.length;s+=1)if(e[s].containsCell(t,n))return!0;return!1}static forEachCell(e,t,n=ue.SELECTION_DIRECTION.RIGHT){for(let s=0;s<e.length;s+=1)e[s].forEach(t,n)}constructor(e,t,n,s){this.startColumn=e,this.startRow=t,this.endColumn=n,this.endRow=s}equals(e){return this.startColumn===e.startColumn&&this.startRow===e.startRow&&this.endColumn===e.endColumn&&this.endRow===e.endRow}contains(e){return(this.startColumn==null||e.startColumn!=null&&this.startColumn<=e.startColumn)&&(this.startRow==null||e.startRow!=null&&this.startRow<=e.startRow)&&(this.endColumn==null||e.endColumn!=null&&this.endColumn>=e.endColumn)&&(this.endRow==null||e.endRow!=null&&this.endRow>=e.endRow)}containsCell(e,t){return e==null||t==null?!1:(this.startColumn==null||this.startColumn<=e)&&(this.endColumn==null||this.endColumn>=e)&&(this.startRow==null||this.startRow<=t)&&(this.endRow==null||this.endRow>=t)}touches(e){return ue.isAxisRangeTouching(this.startRow,this.endRow,e.startRow,e.endRow)&&ue.isAxisRangeTouching(this.startColumn,this.endColumn,e.startColumn,e.endColumn)}subtract(e){return ue.subtractFromRange(this,e)}startCell(e=ue.SELECTION_DIRECTION.DOWN){if(!ue.isBounded(this))throw new Error("Cannot get the startCell of an unbounded range");switch(e){case ue.SELECTION_DIRECTION.DOWN:case ue.SELECTION_DIRECTION.RIGHT:return{column:this.startColumn,row:this.startRow};case ue.SELECTION_DIRECTION.LEFT:case ue.SELECTION_DIRECTION.UP:return{column:this.endColumn,row:this.endRow};default:throw new Error(`Invalid direction: ${e}`)}}nextCell(e,t,n){if(!ue.isBounded(this))throw new Error("Bounded range required");if(e==null||t==null)throw new Error("Require a non-null cursor");const{startColumn:s,endColumn:o,startRow:i,endRow:r}=this;switch(n){case ue.SELECTION_DIRECTION.DOWN:if(t<r)return{column:e,row:Math.max(t+1,i)};if(e<o)return{column:Math.max(e+1,s),row:i};break;case ue.SELECTION_DIRECTION.UP:if(t>i)return{column:e,row:Math.min(t-1,r)};if(e>s)return{column:Math.min(e-1,o),row:r};break;case ue.SELECTION_DIRECTION.RIGHT:if(e<o)return{column:Math.max(e+1,s),row:t};if(t<r)return{column:s,row:Math.max(t+1,i)};break;case ue.SELECTION_DIRECTION.LEFT:if(e>s)return{column:Math.min(e-1,o),row:t};if(t>i)return{column:o,row:Math.min(t-1,r)};break;default:throw new Error(`Invalid direction: ${n}`)}return null}forEach(e,t=ue.SELECTION_DIRECTION.RIGHT){var i;let n=0,{column:s,row:o}=this.startCell(t);for(;s!=null&&o!=null;)e(s,o,n),n+=1,{column:s,row:o}=(i=this.nextCell(s,o,t))!=null?i:{}}};let ee=ue;ee.SELECTION_DIRECTION=Pt;function vh(e){return Array.isArray(e)&&e.length===2&&(e[0]===null||typeof e[0]=="number")&&(e[1]===null||typeof e[1]=="number")}function $o(e){return vh(e)&&e[0]!=null&&e[1]!=null}const Ce=class{static getGridPointFromXY(e,t,n){const s=Ce.getColumnAtX(e,n),o=Ce.getRowAtY(t,n),i=Ce.getColumnHeaderDepthAtY(t,n);return{x:e,y:t,row:o,column:s,columnHeaderDepth:i}}static getCellInfoFromXY(e,t,n){const{row:s,column:o}=Ce.getGridPointFromXY(e,t,n),{allColumnWidths:i,allRowHeights:r,allColumnXs:l,allRowYs:a,modelColumns:c,modelRows:d}=n,u=s!==null?d.get(s):null,m=o!==null?c.get(o):null,p=o!==null?l.get(o):null,g=s!==null?a.get(s):null,f=o!==null?i.get(o):null,w=s!==null?r.get(s):null;return{row:s,column:o,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:w!=null?w:null}}static getColumnHeaderDepthAtY(e,t){const n=Ce.getRowAtY(e,t),{columnHeaderHeight:s,columnHeaderMaxDepth:o}=t;if(n===null&&e<=s*o)return ze(o-Math.ceil(e/s),0,o-1)}static iterateFloatingStart(e,t,n){for(let s=0;s<e&&s<t;s+=1){const o=n(s);if(o!==void 0)return o}}static iterateFloatingEnd(e,t,n){for(let s=0;s<e&&t-(e-s)>=0;s+=1){const o=n(t-(e-s));if(o!==void 0)return o}}static iterateFloating(e,t,n,s){const o=Ce.iterateFloatingStart(e,n,s);return o!==void 0?o:Ce.iterateFloatingEnd(t,n,s)}static iterateAllItems(e,t,n,s,o,i){const r=Math.max(e,n),l=Math.min(t,o-s-1);let a=Ce.iterateFloating(n,s,o,i);if(a!==void 0)return a;for(let c=r;c<=l;c+=1)if(a=i(c),a!==void 0)return a}static isInItem(e,t,n,s){var r,l;const o=(r=t.get(e))!=null?r:0,i=(l=n.get(e))!=null?l:0;return o<=s&&s<=o+i}static getItemAtOffset(e,t,n,s,o,i,r,l=!1){const a=l?void 0:Ce.iterateFloating(n,s,t,c=>{if(Ce.isInItem(c,i,r,e))return c});if(!l&&a!==void 0)return a;for(let c=0;c<o.length;c+=1){const d=o[c];if(Ce.isInItem(d,i,r,e))return d}return null}static getColumnAtX(e,t,n=!1){const{columnCount:s,floatingLeftColumnCount:o,floatingRightColumnCount:i,visibleColumns:r,allColumnXs:l,allColumnWidths:a,gridX:c}=t;return e<c?null:this.getItemAtOffset(e-c,s,o,i,r,l,a,n)}static getRowAtY(e,t){const{floatingTopRowCount:n,floatingBottomRowCount:s,rowCount:o,visibleRows:i,allRowYs:r,allRowHeights:l,gridY:a}=t;return e<a?null:this.getItemAtOffset(e-a,o,n,s,i,r,l)}static getNextShownItem(e,t,n,s){let o=n.findIndex(i=>i===e)||0;for(o-=1;o!=null&&o>=0;){const i=n[o],r=t.get(i);if(r!=null&&s.get(r)!==0)return i;o-=1}return null}static getNextShownColumn(e,t){const{modelColumns:n,visibleColumns:s,userColumnWidths:o}=t;return Ce.getNextShownItem(e,n,s,o)}static getNextShownRow(e,t){const{modelRows:n,visibleRows:s,userRowHeights:o}=t;return Ce.getNextShownItem(e,n,s,o)}static getColumnSeparatorIndex(e,t,n,s){var C,S,b,E;const{rowHeaderWidth:o,columnHeaderHeight:i,floatingColumns:r,floatingLeftWidth:l,visibleColumns:a,allColumnXs:c,allColumnWidths:d,columnHeaderMaxDepth:u}=n,{allowColumnResize:m,headerSeparatorHandleSize:p}=s;if(u*i<t||!m||p<=0)return null;const g=e-o,f=p*.5;let w=!1;for(let v=r.length-1;v>=0;v-=1){const y=r[v],M=(C=c.get(y))!=null?C:0,A=(S=d.get(y))!=null?S:0,F=A===0;if(!w||!F){let V=M+A;F?V+=f:w&&(V-=f);const H=V-f,N=V+f;if(H<=g&&g<=N)return y;w=F}}w=!1;for(let v=a.length-1;v>=0;v-=1){const y=a[v],M=(b=c.get(y))!=null?b:0,A=(E=d.get(y))!=null?E:0,F=A===0;if(M<l-A)return null;if(!w||!F){let V=M+A;F?V+=f:w&&(V-=f);const H=V-f,N=V+f;if(H<=g&&g<=N)return y;w=F}}return null}static isItemHidden(e,t){return t.get(e)===0}static isColumnHidden(e,t){const{allColumnWidths:n}=t;return Ce.isItemHidden(e,n)}static isFloatingRow(e,t){if(e==null)return!1;const{floatingTopRowCount:n,floatingBottomRowCount:s,rowCount:o}=t;return e<n||e>=o-s}static isFloatingColumn(e,t){if(e==null)return!1;const{floatingLeftColumnCount:n,floatingRightColumnCount:s,columnCount:o}=t;return e<n||e>=o-s}static getHiddenItems(e,t,n){if(!Ce.isItemHidden(e,t))return[];const s=[e],o=n.findIndex(i=>i===e);for(let i=o-1;i>=0;i-=1){const r=n[i];if(!Ce.isItemHidden(r,t))break;s.push(r)}return s}static getHiddenColumns(e,t){const{visibleColumns:n,allColumnWidths:s}=t;return Ce.getHiddenItems(e,s,n)}static getRowSeparatorIndex(e,t,n,s){var g,f;const{rowHeaderWidth:o,columnHeaderHeight:i,visibleRows:r,allRowYs:l,allRowHeights:a}=n,{allowRowResize:c,headerSeparatorHandleSize:d}=s;if(o<e||!c||d<=0)return null;const u=t-i,m=d*.5;let p=!1;for(let w=r.length-1;w>=0;w-=1){const C=r[w],S=(g=l.get(C))!=null?g:0,b=(f=a.get(C))!=null?f:0,E=b===0;if(!p||!E){let v=S+b;E?v+=m:p&&(v-=m);const y=v-m,M=v+m;if(y<=u&&u<=M)return C;p=E}}return null}static isRowHidden(e,t){const{allRowHeights:n}=t;return Ce.isItemHidden(e,n)}static getHiddenRows(e,t){const{visibleRows:n,allRowHeights:s}=t;return Ce.getHiddenItems(e,s,n)}static moveItem(e,t,n){if(e===t)return[...n];const s=[...n],o=s[s.length-1];return o!=null&&!$o(o.from)&&o.to===e?o.from===t?s.pop():s[s.length-1]={...o,to:t}:s.push({from:e,to:t}),s}static moveRange(e,t,n,s=!1){if(e[0]===e[1])return Ce.moveItem(e[0],t,n);let o=t;if(s&&e[0]<t&&(o-=e[1]-e[0]),e[0]===o)return[...n];const i=[...n],r=i[i.length-1];r!=null&&$o(r.from)&&r.from[1]-r.from[0]===e[1]-e[0]&&r.to===e[0]?i[i.length-1]={...r,to:o}:i.push({from:e,to:o});const l=i[i.length-1];return $o(l.from)&&l.from[0]===l.to&&i.pop(),i}static moveItemOrRange(e,t,n,s=!1){return Array.isArray(e)?Ce.moveRange(e,t,n,s):Ce.moveItem(e,t,n)}static applyItemMoves(e,t,n,s=!1){var i,r;let o=[[e,t]];for(let l=s?n.length-1:0;s?l>=0:l<n.length;s?l-=1:l+=1){const{from:a,to:c}=n[l];let d=1,u;$o(a)?(d=a[1]-a[0]+1,[u]=a):u=a;const m=s?c:u,p=m+d-1,g=s?u:c,f=g-m,w=[];for(let C=0;C<o.length;C+=1){const S=(i=o[C][0])!=null?i:Number.NEGATIVE_INFINITY,b=(r=o[C][1])!=null?r:Number.POSITIVE_INFINITY;let E;const v=[[S,m-1],[m,p],[p+1,b]].map(([y,M])=>[Math.max(y,S),Math.min(M,b)]).filter(([y,M])=>y<=M).map(y=>{const[M,A]=y;return m<=M&&p>=A?(E=[M+f,A+f],E):p<M?[M-d,A-d]:y}).map(y=>{const[M,A]=y;return g>M&&g<=A?[[M,g-1],[g+d,A+d]]:y===E?[y]:g<=M?[[M+d,A+d]]:[y]}).flat();w.push(...v)}o=w.map(([C,S])=>[Number.isFinite(C)?C:null,Number.isFinite(S)?S:null])}return o}static translateRange(e,t,n,s){const o=Ce.applyItemMoves(e.startColumn,e.endColumn,t,s),i=Ce.applyItemMoves(e.startRow,e.endRow,n,s),r=[];for(let l=0;l<o.length;l+=1){const a=o[l];for(let c=0;c<i.length;c+=1){const d=i[c];r.push(new ee(a[0],d[0],a[1],d[1]))}}return r}static getModelIndex(e,t){return Ce.applyItemMoves(e,e,t,!0)[0][0]}static getModelIndexes(e,t){return e.map(n=>Ce.getModelIndex(n,t))}static getModelRangeIndexes(e,t,n){return Ce.applyItemMoves(e,t,n,!0)}static getModelRange(e,t=ye,n=ye){return Ce.translateRange(e,t,n,!0)}static getModelRanges(e,t=ye,n=ye){const s=[];for(let o=0;o<e.length;o+=1)s.push(...Ce.getModelRange(e[o],t,n));return s}static getVisibleRangeIndexes(e,t,n){return Ce.applyItemMoves(e,t,n,!1)}static getVisibleRange(e,t=ye,n=ye){return this.translateRange(e,t,n,!1)}static getVisibleRanges(e,t=ye,n=ye){const s=[];for(let o=0;o<e.length;o+=1)s.push(...Ce.getVisibleRange(e[o],t,n));return s}static getVisibleIndex(e,t){return Ce.applyItemMoves(e,e,t)[0][0]}static getVisibleIndexes(e,t){return e.map(n=>Ce.getVisibleIndex(n,t))}static isMacPlatform(){const{platform:e}=window.navigator;return e.startsWith("Mac")}static getModifierKey(){return Ce.isMacPlatform()?"metaKey":"ctrlKey"}static isModifierKeyDown(e){const t=Ce.getModifierKey();return e[t]}static checkColumnHidden(e,t){return t.get(e)===0}static checkAllColumnsHidden(e,t){return t.size===0?!1:e.every(n=>t.get(n)===0)}static getScrollDragBounds(e,t,n){const{gridX:s,gridY:o,width:i,height:r,floatingTopRowCount:l,floatingBottomRowCount:a,floatingLeftColumnCount:c,floatingRightColumnCount:d,floatingLeftWidth:u,floatingRightWidth:m,floatingTopHeight:p,floatingBottomHeight:g,columnCount:f,rowCount:w}=e;let C=s,S=o,b=i,E=r;return n!=null&&(n>c&&(C+=u),n<f-d&&(b-=m)),t!=null&&(t>l&&(S+=p),t<w-a&&(E-=g)),{x1:C,y1:S,x2:b,y2:E}}static getScrollDelta(e,t=1024,n=768,s=20,o=20){let{deltaX:i,deltaY:r}=e;return!Ce.isMacPlatform()&&e.shiftKey&&e.deltaX===0&&e.deltaY!==0&&(i=e.deltaY,r=e.deltaX),(e==null?void 0:e.deltaMode)===WheelEvent.DOM_DELTA_PAGE?(i*=t,r*=n):(e==null?void 0:e.deltaMode)===WheelEvent.DOM_DELTA_LINE&&(Ce.isMacPlatform()?(i=Math.round(i*s),r=Math.round(r*o)):(i=Math.round(i*this.PIXELS_PER_LINE),r=Math.round(r*this.PIXELS_PER_LINE))),{deltaX:i,deltaY:r}}static compareRanges(e,t){return e[0]==null||e[1]==null||t[0]==null||t[1]==null?0:e[0]!==t[0]?e[0]-t[0]:e[1]-t[1]}static mergeSortedRanges(e){const t=[];for(let n=0;n<e.length;n+=1){const s=e[n],o=s[0],i=s[1];n===0?t.push([o,i]):o-1<=t[t.length-1][1]?t[t.length-1][1]=Math.max(t[t.length-1][1],i):t.push([o,i])}return t}};let W=Ce;W.PIXELS_PER_LINE=100/3;function L(e,t,n=void 0){var o;const s=(o=e.get(t))!=null?o:n;if(s!==void 0)return s;throw new Error(`Missing value for key ${t}`)}function qo(e,t=Co.CACHE_SIZE,n=Math.floor(t/2)){if(e.size>t){const s=e.keys();for(;e.size>n;)e.delete(s.next().value)}}function vl(e,t,n,s,o){const i=new Map;let r=0;for(let l=0;l<e&&l<n;l+=1)i.set(l,r),r+=L(o,l);r=s;for(let l=0;l<t&&n-l-1>=0;l+=1)r-=L(o,n-l-1),i.set(n-l-1,r);return i}const La=class{constructor({userColumnWidths:e=new Map,userRowHeights:t=new Map,calculatedColumnWidths:n=new Map,calculatedRowHeights:s=new Map,fontWidths:o=new Map,modelRows:i=new Map,modelColumns:r=new Map,movedRows:l=[],movedColumns:a=[],initialRowHeights:c=new Map,initialColumnWidths:d=new Map}={}){this.userColumnWidths=e,this.userRowHeights=t,this.calculatedRowHeights=s,this.calculatedColumnWidths=n,this.fontWidths=o,this.modelRows=i,this.modelColumns=r,this.movedRows=l,this.movedColumns=a,this.initialRowHeights=c,this.initialColumnWidths=d}getMetrics(e){const{left:t,top:n,leftOffset:s,topOffset:o,width:i,height:r,theme:l,model:a,movedRows:c,movedColumns:d,draggingColumn:u}=e,{rowHeight:m,rowHeaderWidth:p,rowFooterWidth:g,columnWidth:f,columnHeaderHeight:w,minScrollHandleSize:C,scrollBarSize:S}=l;c!==this.movedRows&&(this.movedRows=c,this.modelRows.clear()),d!==this.movedColumns&&(this.movedColumns=d,this.modelColumns.clear());const{columnCount:b,rowCount:E,floatingTopRowCount:v,floatingBottomRowCount:y,floatingLeftColumnCount:M,floatingRightColumnCount:A,columnHeaderMaxDepth:F}=a,V=this.getFirstRow(e),H=this.getFirstColumn(e),N=this.getGridX(e),P=this.getGridY(e),k=ke(a)&&a.hasExpandableRows?this.calculateTreePaddingX(e):0,z=0,K=this.getVisibleRowHeights(e),G=this.getVisibleColumnWidths(e,H,k),_=Array.from(K.keys()),q=Array.from(G.keys()),Y=new Map([...K,...this.getFloatingRowHeights(e)]),J=new Map([...G,...this.getFloatingColumnWidths(e)]),de=this.getVisibleColumnXs(J,q,s),pe=this.getVisibleRowYs(Y,_,o),ge=_.length>0?_[_.length-1]:n,Te=q.length>0?q[q.length-1]:t,fe=this.getBottomViewport(e,_,pe,Y),nt=this.getRightViewport(e,q,de,J),je=this.getFloatingTopHeight(e,Y),qe=this.getFloatingBottomHeight(e,Y),Ut=this.getFloatingLeftWidth(e,J),yt=this.getFloatingRightWidth(e,J),In=Array.from(J.values()),Bt=Array.from(Y.values()),xe=In.reduce(($e,vs)=>$e+vs,0)-s,we=Bt.reduce(($e,vs)=>$e+vs,0)-o,Ze=s+xe+g,Ke=o+we,ht=i-N,It=r-P,Mn=this.getLastLeft(e,null,ht-g),Gt=this.getLastLeft(e,null,ht-g-S),To=this.getLastTop(e,null,It-qe),an=this.getLastTop(e,null,It-qe-S);let Mt=Gt,Dn=an;Mn===0&&To===0&&(Mt=0,Dn=0);const ws=Mt>0,Ks=ws?S:0,Ss=Dn>0,bs=Ss?S:0,Eo=N,Ro=F*w,Nn=i-Eo-bs,es=r-Ro-Ks,Ni=b===1?Nn/Ze:(b-Mt)/b,yo=E===1?es/Ke:(E-Dn)/E,Xs=ws?ze(Nn*Ni,C,Nn-1):0,Ys=Ss?ze(es*yo,C,es-1):0,Io=L(J,t,0),Mo=L(Y,n,0),Fi=Io>0?s/Io:0,xi=Mo>0?o/Mo:0,Ai=b===1?s/(Ze-ht):(t+Fi)/Mt,ts=E===1?o/(Ke-It):(n+xi)/Dn,Oi=ws?Ai*(Nn-Xs):0,Do=Ss?ts*(es-Ys):0,No=[...Array(v).keys(),...[...Array(y).keys()].map($e=>E-$e-1)],Qs=new Map([...pe,...this.getFloatingRowYs(e,Y,Math.floor(r-P-Ks))]),Fo=[...Array(M).keys(),...[...Array(A).keys()].map($e=>b-$e-1)],Fn=new Map([...de,...this.getFloatingColumnXs(e,J,Math.floor(i-N-bs))]),js=[];if(u)for(let $e=u.range[0];$e<=u.range[1];$e+=1)js.push($e),J.has($e)||J.set($e,this.getVisibleColumnWidth($e,e)),Fn.has($e)||Fn.set($e,0);const xo=_.concat(No),Ao=q.concat(Fo).concat(js),Zs=this.getModelRows(xo,e),ki=this.getModelColumns(Ao,e),Oo=this.getVisibleRowTreeBoxes(Y,Zs,e),ko=this.getTopVisible(e,Qs,Y,_),Lo=this.getLeftVisible(e,Fn,J,q),Po=Dn>0?this.getBottomVisible(e,Qs,Y,_,P):ge,Ho=Mt>0?this.getRightVisible(e,Fn,J,q,N):Te,{fontWidths:_o,userColumnWidths:Li,userRowHeights:Vo,calculatedRowHeights:Uo,calculatedColumnWidths:Bo}=this;return{rowHeight:m,rowHeaderWidth:p,rowFooterWidth:g,rowCount:E,columnWidth:f,columnCount:b,columnHeaderHeight:w,floatingTopRowCount:v,floatingBottomRowCount:y,floatingLeftColumnCount:M,floatingRightColumnCount:A,gridX:N,gridY:P,firstRow:V,firstColumn:H,treePaddingX:k,treePaddingY:z,left:t,top:n,bottom:ge,right:Te,topOffset:o,leftOffset:s,topVisible:ko,leftVisible:Lo,bottomVisible:Po,rightVisible:Ho,bottomViewport:fe,rightViewport:nt,width:i,height:r,maxX:xe,maxY:we,lastLeft:Mt,lastTop:Dn,barHeight:es,barTop:Ro,barWidth:Nn,barLeft:Eo,handleHeight:Ys,handleWidth:Xs,hasHorizontalBar:ws,hasVerticalBar:Ss,verticalBarWidth:bs,horizontalBarHeight:Ks,scrollX:Oi,scrollY:Do,scrollableContentWidth:Ze,scrollableContentHeight:Ke,scrollableViewportWidth:ht,scrollableViewportHeight:It,visibleRows:_,visibleColumns:q,visibleRowHeights:K,visibleColumnWidths:G,floatingRows:No,floatingColumns:Fo,allRows:xo,allColumns:Ao,allRowHeights:Y,allColumnWidths:J,floatingTopHeight:je,floatingBottomHeight:qe,floatingLeftWidth:Ut,floatingRightWidth:yt,visibleRowYs:pe,visibleColumnXs:de,allRowYs:Qs,allColumnXs:Fn,visibleRowTreeBoxes:Oo,modelRows:Zs,modelColumns:ki,movedRows:c,movedColumns:d,fontWidths:_o,userColumnWidths:Li,userRowHeights:Vo,calculatedRowHeights:Uo,calculatedColumnWidths:Bo,columnHeaderMaxDepth:F}}getGridX(e){const{theme:t}=e,{rowHeaderWidth:n}=t;return n}getGridY(e){const{theme:t,model:n}=e,{columnHeaderHeight:s}=t,{columnHeaderMaxDepth:o}=n;return o*s}getVisibleHeight(e,t=this.getFloatingRowHeights(e)){const{height:n,theme:s}=e,{scrollBarSize:o}=s,i=this.getGridY(e),r=this.getFloatingBottomHeight(e,t),l=this.getFloatingTopHeight(e,t);return n-r-l-i-o}getVisibleWidth(e,t=this.getFloatingColumnWidths(e)){const{width:n,theme:s}=e,{scrollBarSize:o,rowFooterWidth:i}=s,r=this.getGridX(e),l=this.getFloatingRightWidth(e,t),a=this.getFloatingLeftWidth(e,t);return n-a-l-r-o-i}getFirstIndex(e,t,n){const s=e.size+1;for(let o=0;o<s;o+=1){const i=t(o,n);if(e.get(i)!==0)return o}return 0}getFirstColumn(e){return this.getFirstIndex(this.userColumnWidths,this.getModelColumn.bind(this),e)}getFirstRow(e){return this.getFirstIndex(this.userRowHeights,this.getModelRow.bind(this),e)}getLastLeft(e,t,n){const{model:s}=e,{columnCount:o,floatingRightColumnCount:i}=s;let r=Math.max(0,o-i-1);t!=null&&(r=t);let l=0;for(;r>=0;){if(l+=this.getVisibleColumnWidth(r,e),l>=n)return ze(r+1,0,t!=null?t:o-1);r-=1}return 0}getLastTop(e,t,n){const{model:s}=e,{rowCount:o,floatingBottomRowCount:i}=s;let r=Math.max(0,o-i-1);t!=null&&(r=t);let l=0;for(;r>=0;){if(l+=this.getVisibleRowHeight(r,e),l>=n)return ze(r+1,0,o-1);r-=1}return 0}getTopForTopVisible(e,t){const n=this.getFloatingTopHeight(e);let s=t,o=0;for(;s>0&&o<n;)s-=1,o+=this.getVisibleRowHeight(s,e);return s}getTopForBottomVisible(e,t){const{height:n}=e,s=this.getGridY(e),o=this.getFloatingBottomHeight(e),i=n-s-o;return this.getLastTop(e,t,i)}getLeftForLeftVisible(e,t){const n=this.getFloatingLeftWidth(e);let s=t,o=0;for(;s>0&&o<n;)s-=1,o+=this.getVisibleColumnWidth(s,e);return s}getLeftForRightVisible(e,t){const{width:n}=e,s=this.getGridX(e),o=this.getFloatingRightWidth(e),i=n-s-o;return this.getLastLeft(e,t,i)}getFloatingRowHeights(e){const{model:t}=e,{floatingTopRowCount:n,floatingBottomRowCount:s,rowCount:o}=t,i=new Map;for(let r=0;r<n&&r<o;r+=1)i.set(r,this.getVisibleRowHeight(r,e));for(let r=0;r<s&&o-r-1>=0;r+=1){const l=o-r-1;i.set(l,this.getVisibleRowHeight(l,e))}return i}getVisibleRowHeights(e){const{top:t,topOffset:n,height:s,model:o}=e;let i=0,r=t;const l=new Map,{rowCount:a}=o;for(;i<s+n&&r<a;){const c=this.getVisibleRowHeight(r,e);l.set(r,c),i+=c,r+=1}return l}getFloatingColumnWidths(e,t=this.getFirstColumn(e),n=this.calculateTreePaddingX(e)){const{model:s}=e,{columnCount:o,floatingLeftColumnCount:i,floatingRightColumnCount:r}=s,l=new Map;for(let a=0;a<i&&a<o;a+=1)l.set(a,this.getVisibleColumnWidth(a,e,t,n));for(let a=0;a<r&&o-a-1>=0;a+=1){const c=o-a-1;l.set(c,this.getVisibleColumnWidth(c,e,t,n))}return l}getVisibleColumnWidths(e,t=this.getFirstColumn(e),n=this.calculateTreePaddingX(e)){const{left:s,leftOffset:o,width:i,model:r}=e;let l=0,a=s;const c=new Map,{columnCount:d}=r;for(;l<i+o&&a<d;){const u=this.getVisibleColumnWidth(a,e,t,n);c.set(a,u),l+=u,a+=1}return c}getFloatingColumnXs(e,t,n){const{model:s}=e,{columnCount:o,floatingLeftColumnCount:i,floatingRightColumnCount:r}=s;return vl(i,r,o,n,t)}getVisibleColumnXs(e,t,n){const s=new Map;let o=-n;for(let i=0;i<t.length;i+=1){const r=t[i],l=L(e,r);s.set(r,o),o+=l}return s}getFloatingRowYs(e,t,n){const{model:s}=e,{floatingTopRowCount:o,floatingBottomRowCount:i,rowCount:r}=s;return vl(o,i,r,n,t)}getVisibleRowYs(e,t,n){const s=new Map;let o=-n;for(let i=0;i<t.length;i+=1){const r=t[i],l=L(e,r);s.set(r,o),o+=l}return s}getVisibleRowTreeBoxes(e,t,n){const s=new Map,{model:o,theme:i}=n,{treeDepthIndent:r,treeHorizontalPadding:l}=i;return ke(o)&&o.hasExpandableRows&&e.forEach((a,c)=>{const d=L(t,c);if(o.isRowExpandable(d)){const u=o.depthForRow(d),m=u*r+l,p=(u+1)*r+l,g=0,f=a;s.set(c,{x1:m,y1:g,x2:p,y2:f})}}),s}getFloatingLeftWidth(e,t=this.getFloatingColumnWidths(e)){const{model:n}=e,{floatingLeftColumnCount:s}=n;let o=0;for(let i=0;i<s;i+=1)o+=L(t,i);return o}getFloatingRightWidth(e,t=this.getFloatingColumnWidths(e)){const{model:n}=e,{floatingRightColumnCount:s,columnCount:o}=n;let i=0;for(let r=0;r<s;r+=1)i+=L(t,o-r-1);return i}getFloatingTopHeight(e,t=this.getFloatingRowHeights(e)){const{model:n}=e,{floatingTopRowCount:s}=n;let o=0;for(let i=0;i<s;i+=1)o+=L(t,i);return o}getFloatingBottomHeight(e,t=this.getFloatingRowHeights(e)){const{model:n}=e,{floatingBottomRowCount:s,rowCount:o}=n;let i=0;for(let r=0;r<s;r+=1)i+=L(t,o-r-1);return i}getTopVisible(e,t,n,s){const o=this.getFloatingTopHeight(e,n);for(let i=0;i<s.length;i+=1){const r=s[i];if(L(t,r)>=o)return r}return 0}getLeftVisible(e,t,n,s){const o=this.getFloatingLeftWidth(e,n);for(let i=0;i<s.length;i+=1){const r=s[i];if(L(t,r)>=o)return r}return 0}getBottomVisible(e,t,n,s,o){const{height:i,theme:r}=e,{scrollBarSize:l}=r,a=this.getFloatingBottomHeight(e,n),c=i-o-l-a;for(let d=s.length-1;d>=0;d-=1){const u=s[d],m=L(t,u),p=L(n,u);if(m+p<=c)return u}return 0}getRightVisible(e,t,n,s,o){const{width:i,theme:r}=e,{scrollBarSize:l}=r,a=this.getFloatingRightWidth(e,n),c=i-o-l-a;for(let d=s.length-1;d>=0;d-=1){const u=s[d],m=L(t,u),p=L(n,u);if(m+p<=c)return u}return 0}getBottomViewport(e,t,n,s){const{height:o,theme:i}=e,{rowHeight:r}=i;return this.getLastIndexViewport(t,n,s,o,r)}getRightViewport(e,t,n,s){const{width:o,theme:i}=e,{columnWidth:r}=i;return this.getLastIndexViewport(t,n,s,o,r)}getLastIndexViewport(e,t,n,s,o){let i=0,r=0;return e.length>0&&(i=e[e.length-1],r=L(t,i)+L(n,i)),r<s&&(i+=Math.ceil((s-r)/o)),i}getVisibleItemSize(e,t,n){var s;return(s=t.get(e))!=null?s:n()}getVisibleRowHeight(e,t){const n=this.getModelRow(e,t),s=this.calculateRowHeight(e,n,t);return this.getVisibleItemSize(n,this.userRowHeights,()=>{const o=this.initialRowHeights.get(n);return o!==void 0?o:s})}getVisibleColumnWidth(e,t,n=this.getFirstColumn(t),s=this.calculateTreePaddingX(t)){const o=this.getModelColumn(e,t),i=this.calculateColumnWidth(e,o,t,n,s);return this.getVisibleItemSize(o,this.userColumnWidths,()=>{const r=this.initialColumnWidths.get(o);return r!==void 0?r:i})}getModelRows(e,t){const n=new Map;for(let s=0;s<e.length;s+=1){const o=e[s],i=this.getModelRow(o,t);n.set(o,i)}return n}getModelRow(e,t){if(this.modelRows.has(e))return L(this.modelRows,e);const{movedRows:n}=t,s=W.getModelIndex(e,n);return this.modelRows.set(e,s),s}getModelColumns(e,t){const n=new Map;for(let s=0;s<e.length;s+=1){const o=e[s],i=this.getModelColumn(o,t);n.set(o,i)}return n}getModelColumn(e,t){if(this.modelColumns.has(e))return L(this.modelColumns,e);const{movedColumns:s}=t,o=W.getModelIndex(e,s);return this.modelColumns.set(e,o),o}calculateRowHeight(e,t,n){const{theme:s}=n,{autoSizeRows:o,rowHeight:i}=s;if(!o)return i;const r=this.calculatedRowHeights.get(t);return r!=null?r:(this.calculatedRowHeights.set(t,Math.ceil(i)),qo(this.calculatedRowHeights),i)}calculateColumnWidth(e,t,n,s=this.getFirstColumn(n),o=this.calculateTreePaddingX(n)){const{theme:i}=n,{autoSizeColumns:r,minColumnWidth:l}=i;if(!r){const{columnWidth:m}=i;return m}const a=this.calculateColumnHeaderWidth(t,n),c=this.calculateColumnDataWidth(t,n),d=this.calculatedColumnWidths.get(t);let u=Math.ceil(Math.max(a,c));return u=Math.max(l,u),d!=null&&d>u?u=d:(this.calculatedColumnWidths.set(t,u),qo(this.calculatedColumnWidths)),e===s&&(u+=o),u}calculateColumnHeaderWidth(e,t){const{model:n,theme:s}=t,{headerFont:o,headerHorizontalPadding:i}=s,r=n.textForColumnHeader(e,0);if(r!==void 0&&r!==""){const l=this.getWidthForFont(o,t);return r.length*l+i*2}return i*2}calculateColumnDataWidth(e,t){const{top:n,height:s,width:o,model:i,theme:r}=t,{floatingTopRowCount:l,floatingBottomRowCount:a,rowCount:c}=i,{font:d,cellHorizontalPadding:u,rowHeight:m,rowHeaderWidth:p,rowFooterWidth:g,scrollBarSize:f}=r;let w=0;const C=this.getWidthForFont(d,t),S=s/m,b=Math.ceil(n+S);return W.iterateAllItems(n,b,l,a,c,E=>{const v=this.getModelRow(E,t),y=i.textForCell(e,v);if(y){const M=u*2;w=Math.max(w,y.length*C+M)}}),w=Math.max(Math.min(w,(o-p-f-g)*La.MAX_COLUMN_WIDTH),u*2),w}calculateTreePaddingX(e){const{top:t,height:n,model:s,theme:o}=e,{rowHeight:i,treeDepthIndent:r}=o;if(!ke(s)||!s.hasExpandableRows)return 0;let l=0;const a=n/i,c=Math.ceil(t+a);for(let d=t;d<=c;d+=1){const u=this.getModelRow(d,e),m=s.depthForRow(u);l=Math.max(l,r*(m+1))}return l}getWidthForFont(e,t){if(this.fontWidths.has(e))return L(this.fontWidths,e);const{context:n}=t;n.font=e;const s=n.measureText("8"),{width:o}=s;return this.fontWidths.set(e,o),this.fontWidths.set(n.font,o),o}setColumnWidth(e,t){const n=new Map(this.userColumnWidths);n.set(e,Math.ceil(t)),qo(n),this.userColumnWidths=n}resetColumnWidth(e){const t=new Map(this.userColumnWidths);t.delete(e),this.userColumnWidths=t}setRowHeight(e,t){const n=new Map(this.userRowHeights);n.set(e,Math.ceil(t)),qo(n),this.userRowHeights=n}resetRowHeight(e){const t=new Map(this.userRowHeights);t.delete(e),this.userRowHeights=t,this.calculatedRowHeights.delete(e)}};let Co=La;Co.CACHE_SIZE=1e4;Co.MAX_COLUMN_WIDTH=.8;const Th=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"}),Et=(e,t)=>{let n=!1;const s=he(e,{...t,dispose:()=>{n||(n=!0,s.clear(),n=!1)}});return s};function Eh(e,t,n=6){const s=Ji.hex.lab.raw(e);return s[0]=Math.max(s[0]-s[0]/n*t,0),`#${Ji.lab.hex(s)}`}function Rh(e,t){const[n,s,o]=Ji.hex.rgb(e);return`rgba(${n}, ${s}, ${o}, ${t})`}const Tl={colorWithAlpha:Rh,darkenForDepth:Eh};class Qe{constructor(t=5e3){this.cursor=null,this.order=t}onDown(t,n,s){return!1}onMove(t,n,s){return!1}onDrag(t,n,s){return!1}onLeave(t,n,s){return!1}onClick(t,n,s){return!1}onContextMenu(t,n,s){return!1}onDoubleClick(t,n,s){return!1}onUp(t,n,s){return!1}onWheel(t,n,s){return!1}}class Pa extends Qe{constructor(){super(...arguments),this.resizingItems=[],this.hiddenItems=[],this.targetSizes=new Map,this.dragOffset=0}onDown(t,n){const{metrics:s}=n,{model:o}=n.props,i=n.getTheme();if(!s)throw new Error("metrics not set");const r=this.getSeparator(t,s,o,i);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(t,n){const{metrics:s}=n,{model:o}=n.props,i=n.getTheme();if(!s)throw new Error("metrics not set");const r=this.getSeparator(t,s,o,i);return r!=null?(this.updateCursor(s,r.index),!0):!1}onDrag(t,n){var f;if(this.draggingIndex==null)return!1;const s=t[this.pointProperty],{metricCalculator:o,metrics:i}=n;if(!i)throw new Error("metrics not set");const r=n.getTheme(),l=i[this.visibleOffsetProperty],a=i[this.marginProperty],c=i[this.calculatedSizesProperty],d=i[this.modelIndexesProperty],u=i[this.firstIndexProperty],m=i[this.treePaddingProperty],p=new Map;let g=this.resizingItems[this.resizingItems.length-1];for(;g!=null;){const w=L(l,g),C=s-a-w-this.dragOffset,S=L(d,g),b=this.targetSizes.get(S),E=this.resizingItems.length>1,v=this.hiddenItems.indexOf(g);let y=L(c,S);g===u&&(y+=m);let M=C;Math.abs(C-y)<=r.headerResizeSnapThreshold?M=y:b!==void 0&&C>b&&(E&&v!==0||v>0)?M=b:C<=r.headerResizeHiddenSnapThreshold&&(M=0),p.set(S,M),C<-r.headerResizeSnapThreshold&&M===0?v>=0&&E?(this.resizingItems.pop(),this.removeTargetSize(i,g),g=this.resizingItems[this.resizingItems.length-1],this.dragOffset-=(f=this.targetSizes.get(L(d,g)))!=null?f:0):(g=this.getNextShownItem(g,i),g!==null&&(this.resizingItems.push(g),this.addTargetSize(i,g))):b!==void 0&&C>b+r.headerResizeSnapThreshold&&M===b?v>0?(this.dragOffset+=M,g=this.hiddenItems[v-1],this.resizingItems.push(g),this.addTargetSize(i,g)):E?(this.resizingItems.pop(),this.removeTargetSize(i,g),g=this.resizingItems[this.resizingItems.length-1]):g=null:g=null}return p.forEach((w,C)=>{var b;const S=(b=o[this.initialSizesProperty].get(C))!=null?b:c.get(C);w===S?this.resetSize(o,C):this.setSize(o,C,w)}),this.updateCursor(i,this.draggingIndex),!0}onUp(t,n){return this.draggingIndex!=null&&(this.draggingIndex=void 0,this.resizingItems=[],this.hiddenItems=[],this.targetSizes.clear(),this.updateSeparator(n,null)),!1}onDoubleClick(t,n){const{metrics:s,metricCalculator:o}=n,{model:i}=n.props,r=n.getTheme();if(!s)throw new Error("metrics not set");const l=this.getSeparator(t,s,i,r);if(l!=null){const a=s[this.modelIndexesProperty],c=L(a,l.index),d=L(s[this.calculatedSizesProperty],c),u=o[this.initialSizesProperty].get(c);return d===u?this.resetSize(o,c):this.setSize(o,c,d),n.forceUpdate(),!0}return!1}updateCursor(t,n){const s=t[this.visibleSizesProperty];L(s,n)===0?this.cursor=this.hiddenCursor:this.cursor=this.defaultCursor}addTargetSize(t,n){const s=t[this.modelIndexesProperty],o=t[this.userSizesProperty],i=t[this.calculatedSizesProperty],r=n===0?t[this.treePaddingProperty]:0,l=L(s,n);let a=o.get(l);(a==null||a===0)&&(a=L(i,l)+r),this.targetSizes.set(l,a)}removeTargetSize(t,n){const s=t[this.modelIndexesProperty],o=L(s,n);this.targetSizes.delete(o)}}class Ti extends Pa{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.initialSizesProperty="initialColumnWidths",this.modelIndexesProperty="modelColumns",this.firstIndexProperty="firstColumn",this.treePaddingProperty="treePaddingX",this.getHiddenItems=W.getHiddenColumns,this.getNextShownItem=W.getNextShownColumn,this.getSeparator=Ti.getColumnSeparator}static getColumnSeparator(t,n,s,o){if(!o.allowColumnResize)return null;const{x:i,y:r,columnHeaderDepth:l}=t,{modelColumns:a}=n,c=W.getColumnSeparatorIndex(i,r,n,o);return c==null||l==null||l>0?null:a.get(c)!=null?{index:c,depth:0}:null}setSize(t,n,s){t.setColumnWidth(n,s)}resetSize(t,n){t.resetColumnWidth(n)}updateSeparator(t,n){t.setState({draggingColumnSeparator:n,isDragging:n!==null})}}const fn=class{constructor(){this.getCachedTruncatedString=Et((e,t,n,s,o)=>fn.truncateToWidth(e,t,n,s,o),{max:1e4}),this.getCachedBackgroundColors=Et((e,t)=>e.split(" ").map(n=>{const s=[];for(let o=0;o<t;o+=1)s.push(Tl.darkenForDepth(n,o,t));return s}),{max:1e3}),this.getCachedColorWithAlpha=Et((e,t)=>Tl.colorWithAlpha(e,t),{max:1e3}),this.getCachedColorIsDark=Et(e=>Si.isDark(e),{max:1e3})}static truncate(e,t){return t<e.length?e.substr(0,t)+"\u2026":e}static binaryTruncateToWidth(e,t,n,s=0,o=t.length,i){if(o>=t.length&&e.measureText(t).width<=n)return t;if(i!==void 0){const c=e.measureText(i).width;return i.repeat(Math.max(1,Math.floor(n/c)))}let r=s,l=Math.min(t.length-1,o),a=t;for(;l>=r;){const c=Math.ceil((l+r)/2),d=fn.truncate(t,c);if(e.measureText(d).width<=n){if(a=d,r===c)break;r=c}else if(c===0){a=d;break}else l=c-1}return a}static truncateToWidth(e,t,n,s=fn.DEFAULT_FONT_WIDTH,o){if(n<=0||t.length<=0)return"";const i=Math.min(Math.max(0,Math.floor(n/s/2)-5),t.length),r=Math.min(Math.ceil(n/s*2),t.length);return fn.binaryTruncateToWidth(e,t,n,i,r,o)}drawCanvas(e){const{context:t}=e;t.save(),this.configureContext(t,e),this.drawBackground(t,e),this.drawGrid(t,e),this.drawHeaders(t,e),this.drawFooters(t,e),this.drawDraggingColumn(t,e),this.drawDraggingRow(t,e),this.drawScrollBars(t,e),t.restore()}configureContext(e,t){const{theme:n}=t;e.font=n.font,e.textBaseline="middle",e.lineCap="butt"}drawBackground(e,t){const{theme:n,metrics:s}=t,{width:o,height:i}=s;e.fillStyle=n.backgroundColor,e.fillRect(0,0,o,i)}drawGrid(e,t){const{metrics:n,draggingRow:s,draggingColumn:o}=t,{gridX:i,gridY:r}=n;e.translate(i,r),this.drawGridBackground(e,t,s==null&&o==null),this.drawCellContents(e,t),this.drawFloatingRows(e,t),this.drawFloatingColumns(e,t),e.translate(-i,-r)}drawFloatingRows(e,t){const{draggingRow:n,draggingColumn:s,metrics:o,theme:i}=t,{floatingTopRowCount:r,floatingBottomRowCount:l,floatingRows:a,rowCount:c,visibleColumns:d,allRowYs:u,allRowHeights:m}=o;if(a.length!==0){i.floatingRowBackgroundColors&&this.drawRowStripesForRows(e,t,a,i.floatingRowBackgroundColors),n==null&&s==null&&this.drawFloatingMouseRowHover(e,t),this.drawGridLinesForItems(e,t,d,a,i.floatingGridColumnColor,i.floatingGridRowColor),this.drawCellBackgroundsForItems(e,t,d,a),this.drawFloatingBorders(e,t),r>0&&this.drawSelectedRanges(e,t,{top:0,bottom:r-1,maxY:L(u,r-1)+L(m,r-1)-.5}),l>0&&this.drawSelectedRanges(e,t,{top:c-l-1,bottom:c-1,minY:L(u,c-l)+.5,maxY:L(u,c-1)+L(m,c-1)-.5});for(let p=0;p<d.length;p+=1){const g=d[p];for(let f=0;f<a.length;f+=1){const w=a[f];this.drawCellContent(e,t,g,w)}}}}drawFloatingColumns(e,t){const{draggingRow:n,draggingColumn:s,metrics:o,theme:i}=t,{floatingLeftColumnCount:r,floatingRightColumnCount:l,floatingLeftWidth:a,floatingRightWidth:c,floatingColumns:d,gridX:u,maxX:m,columnCount:p,visibleRows:g,allColumnXs:f,allColumnWidths:w,width:C,height:S}=o;if(d.length!==0){i.floatingRowBackgroundColors&&(this.drawRowStripesForRows(e,t,g,i.floatingRowBackgroundColors,0,a),this.drawRowStripesForRows(e,t,g,i.floatingRowBackgroundColors,C-u-c,m)),n==null&&s==null&&this.drawFloatingMouseRowHover(e,t),e.save(),e.beginPath(),e.rect(0,0,a,S),e.clip(),this.drawGridLinesForItems(e,t,d,g,i.floatingGridColumnColor,i.floatingGridRowColor),e.restore(),this.drawCellBackgroundsForItems(e,t,d,g),this.drawFloatingBorders(e,t),r>0&&this.drawSelectedRanges(e,t,{left:0,maxX:L(f,r-1)+L(w,r-1)}),l>0&&this.drawSelectedRanges(e,t,{left:p-l,right:p-1,minX:L(f,p-l)+.5,maxX:L(f,p-1)+L(w,p-1)});for(let b=0;b<d.length;b+=1){const E=d[b];for(let v=0;v<g.length;v+=1){const y=g[v];this.drawCellContent(e,t,E,y)}}}}drawFloatingBorders(e,t){const{metrics:n,theme:s}=t,{floatingTopRowCount:o,floatingBottomRowCount:i,floatingLeftColumnCount:r,floatingRightColumnCount:l,rowCount:a,columnCount:c,allRowYs:d,allColumnXs:u,allRowHeights:m,allColumnWidths:p,maxX:g,maxY:f}=n,{floatingDividerOuterColor:w,floatingDividerInnerColor:C}=s;if(e.lineWidth=3,e.beginPath(),e.strokeStyle=w,o>0){const S=L(d,o-1)+L(m,o-1)+.5;e.moveTo(0,S),e.lineTo(g,S)}if(i>0){const S=L(d,a-i)-.5;e.moveTo(0,S),e.lineTo(g,S)}if(r>0){const S=L(u,r-1)+L(p,r-1)+.5;e.moveTo(S,0),e.lineTo(S,f)}if(l>0){const S=L(u,c-l)-.5;e.moveTo(S,0),e.lineTo(S,f)}if(e.stroke(),e.beginPath(),e.lineWidth=1,e.strokeStyle=C,o>0){const S=L(d,o-1)+L(m,o-1)+.5;e.moveTo(0,S),e.lineTo(g,S)}if(i>0){const S=L(d,a-i)-.5;e.moveTo(0,S),e.lineTo(g,S)}if(r>0){const S=L(u,r-1)+L(p,r-1)+.5;e.moveTo(S,0),e.lineTo(S,f)}if(l>0){const S=L(u,c-l)-.5;e.moveTo(S,0),e.lineTo(S,f)}e.stroke()}drawGridBackground(e,t,n=!1){this.drawRowStripes(e,t),n&&(this.drawMouseColumnHover(e,t),this.drawMouseRowHover(e,t)),this.drawGridLines(e,t),this.drawCellBackgrounds(e,t);const{metrics:s}=t,{bottom:o,right:i,floatingBottomRowCount:r,floatingLeftColumnCount:l,floatingRightColumnCount:a,floatingTopRowCount:c,columnCount:d,rowCount:u,allRowHeights:m,allRowYs:p,allColumnXs:g,allColumnWidths:f,width:w,height:C}=s;this.drawSelectedRanges(e,t,{bottom:Math.min(o,u-r-1),right:Math.min(i,d-a-1),minX:l>0&&g.has(l+1)?L(g,l+1):-10,minY:c>0&&p.has(c+1)?L(p,c+1):-10,maxX:a>0&&g.has(d-a-1)?L(g,d-a-1)+L(f,d-a-1)-.5:w+10,maxY:r>0&&p.has(u-r-1)?L(p,u-r-1)+L(m,u-r-1)-.5:C+10})}drawRowStripes(e,t){const{metrics:n,theme:s}=t,{visibleRows:o}=n,{rowBackgroundColors:i}=s;!i||this.drawRowStripesForRows(e,t,o,i)}drawRowStripesForRows(e,t,n,s,o=0,i=t.metrics.maxX){const{theme:r,metrics:l,model:a}=t,{maxDepth:c,shadowBlur:d,shadowColor:u}=r,m=this.getCachedBackgroundColors(s,c),{allRowYs:p,allRowHeights:g}=l,f=new Map,w=[],C=[],S=(b,E)=>{const v=ke(a)?a.depthForRow(b):0,y=m[b%m.length],M=y[Math.min(v,y.length-1)];if(f.has(M)||f.set(M,[]),f.get(M).push(b),E!=null){const A=ke(a)?a.depthForRow(E):0;A<v?w.push(b):A>v&&C.push(E)}};for(let b=0;b<n.length;b+=1){const E=n[b],v=b>0?n[b-1]:void 0;S(E,v)}if(f.forEach((b,E)=>{e.fillStyle=E,e.beginPath();for(let v=0;v<b.length;v+=1){const y=b[v],M=L(p,y),A=L(g,y);e.rect(o,M,i,A)}e.fill()}),w.length>0){e.save();const b=this.getCachedColorWithAlpha(u,.15),E=this.getCachedColorWithAlpha(u,0),v=e.createLinearGradient(0,0,0,d);v.addColorStop(0,b),v.addColorStop(1,E),e.fillStyle=v;for(let y=0;y<w.length;y+=1){const M=w[y],A=L(p,M);e.translate(0,A),e.fillRect(o,0,i,d),e.translate(0,-A)}e.restore()}if(C.length>0){e.save();const b=this.getCachedColorWithAlpha(u,0),E=this.getCachedColorWithAlpha(u,.15),v=e.createLinearGradient(0,0,0,d);v.addColorStop(0,b),v.addColorStop(1,E),e.fillStyle=v;for(let y=0;y<C.length;y+=1){const M=C[y],A=L(p,M),F=L(g,M),V=A+F-d;e.translate(0,V),e.fillRect(o,0,i,d),e.translate(0,-V)}e.restore()}}drawMouseColumnHover(e,t){const{mouseX:n,mouseY:s,theme:o,metrics:i}=t;if(n==null||s==null)return;const r=W.getColumnAtX(n,i);if(r==null||o.columnHoverBackgroundColor==null)return;const{allColumnWidths:l,allColumnXs:a,maxY:c}=i;if(s>c)return;const d=L(a,r),u=L(l,r);e.fillStyle=o.columnHoverBackgroundColor,e.fillRect(d,0,u,c)}drawMouseRowHover(e,t){const{mouseX:n,mouseY:s,theme:o,metrics:i}=t;if(n==null||s==null)return;const{maxX:r}=i;if(n>r||o.rowHoverBackgroundColor==null)return;const l=W.getRowAtY(s,i);l!=null&&this.drawMouseRowHoverForRow(e,t,l)}drawFloatingMouseRowHover(e,t){const{mouseX:n,mouseY:s,theme:o,metrics:i}=t,{maxX:r,floatingTopRowCount:l,floatingBottomRowCount:a,rowCount:c,rowFooterWidth:d}=i;if(n==null||s==null||n>r+d||o.rowHoverBackgroundColor==null)return;const u=W.getRowAtY(s,i);u!=null&&(u<l||c-a<=u)&&this.drawMouseRowHoverForRow(e,t,u)}drawMouseRowHoverForRow(e,t,n){const{metrics:s,selectedRanges:o,theme:i}=t,{allRowHeights:r,allRowYs:l,maxX:a}=s,c=L(l,n),d=L(r,n);i.rowHoverBackgroundColor!=null&&(e.fillStyle=i.rowHoverBackgroundColor);for(let u=0;u<o.length;u+=1){const{startRow:m,endRow:p}=o[u];if(m!=null&&p!=null&&m<=n&&p>=n){i.selectedRowHoverBackgroundColor!=null&&(e.fillStyle=i.selectedRowHoverBackgroundColor);break}}e.fillRect(0,c,a,d)}drawGridLines(e,t){const{metrics:n,theme:s}=t,{visibleColumns:o,visibleRows:i}=n;this.drawGridLinesForItems(e,t,o,i,s.gridColumnColor,s.gridRowColor)}drawGridLinesForItems(e,t,n,s,o,i){o==null&&i==null||(e.lineWidth=1,e.beginPath(),o!=null&&(e.strokeStyle=o,this.drawGridLinesForColumns(e,t,n)),i!=null&&(e.strokeStyle=i,this.drawGridLinesForRows(e,t,s)),e.stroke())}drawGridLinesForColumns(e,t,n){const{metrics:s}=t,{allColumnXs:o,maxY:i}=s;for(let r=0;r<n.length;r+=1){const l=n[r],a=L(o,l)+.5;e.moveTo(a,0),e.lineTo(a,i)}}drawGridLinesForRows(e,t,n){const{metrics:s}=t,{allRowYs:o,maxX:i}=s,r=i;for(let l=0;l<n.length;l+=1){const a=n[l],c=L(o,a)+.5;e.moveTo(.5,c),e.lineTo(r-.5,c)}}drawCellBackgrounds(e,t){const{metrics:n}=t,{visibleColumns:s,visibleRows:o}=n;this.drawCellBackgroundsForItems(e,t,s,o)}drawCellBackgroundsForItems(e,t,n,s){e.save();for(let o=0;o<n.length;o+=1){const i=n[o];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(e,t,i,l,a)}}e.restore()}drawCellBackground(e,t,n,s,o){const{metrics:i,model:r,theme:l}=t,{firstColumn:a,modelColumns:c,modelRows:d,allColumnXs:u,allColumnWidths:m,allRowYs:p,allRowHeights:g}=i,f=L(d,s),w=L(c,n),C=r.backgroundColorForCell(w,f,l),S=n===a,b=ke(r)&&r.hasExpandableRows;if(C!=null){const E=L(u,n)+1,v=L(p,s)+1,y=L(m,n)-1,M=L(g,s)-1;e.fillStyle=C,e.fillRect(E,v,y,M)}S&&b&&this.drawCellRowTreeDepthLines(e,t,s,o)}drawCellContents(e,t){const{metrics:n}=t,{visibleColumns:s}=n;for(let o=0;o<s.length;o+=1){const i=s[o];this.drawColumnCellContents(e,t,i)}}drawColumnCellContents(e,t,n){const{metrics:s}=t,{allColumnXs:o,allColumnWidths:i,visibleRows:r,height:l}=s,a=L(o,n),c=L(i,n);e.save(),e.beginPath(),e.rect(a,0,c,l),e.clip();for(let d=0;d<r.length;d+=1){const u=r[d];this.drawCellContent(e,t,n,u)}e.restore()}getTextRenderMetrics(e,t,n,s){const{textAlign:o}=e,{metrics:i,model:r,theme:l}=t,{firstColumn:a,allColumnXs:c,allColumnWidths:d,allRowYs:u,allRowHeights:m}=i,{cellHorizontalPadding:p,treeDepthIndent:g,treeHorizontalPadding:f}=l,w=L(c,n),C=L(u,s),S=L(d,n),b=L(m,s),E=n===a;let v=0;ke(r)&&r.hasExpandableRows&&E&&(v=g*(r.depthForRow(s)+1)+f);const y=S-v;let M=w+p;const A=C+b*.5;return o==="right"?M=w+y-p:o==="center"&&(M=w+y*.5),M+=v,{width:y-p*2,x:M,y:A}}drawCellContent(e,t,n,s,o){var E;const{metrics:i,model:r,theme:l}=t,{firstColumn:a,fontWidths:c,modelColumns:d,modelRows:u,allRowHeights:m}=i,{textColor:p}=l,g=L(m,s),f=L(u,s),w=L(d,n),C=o!=null?o:r.textForCell(w,f),S=r.truncationCharForCell(w,f),b=n===a;if(C&&g>0){const v=r.textAlignForCell(w,f)||"left";e.textAlign=v;const y=r.colorForCell(w,f,l)||p;e.fillStyle=y;const{width:M,x:A,y:F}=this.getTextRenderMetrics(e,t,n,s),V=(E=c.get(e.font))!=null?E:fn.DEFAULT_FONT_WIDTH,H=this.getCachedTruncatedString(e,C,M,V,S);H&&e.fillText(H,A,F)}b&&ke(r)&&r.hasExpandableRows&&this.drawCellRowTreeMarker(e,t,s)}drawCellRowTreeMarker(e,t,n){const{metrics:s,model:o,mouseX:i,mouseY:r,theme:l}=t,{firstColumn:a,gridX:c,gridY:d,allColumnXs:u,allColumnWidths:m,allRowYs:p,allRowHeights:g,visibleRowTreeBoxes:f}=s,{treeMarkerColor:w,treeMarkerHoverColor:C}=l,S=L(u,a),b=L(m,a),E=L(p,n),v=L(g,n);if(!ke(o)||!o.isRowExpandable(n))return;const y=L(f,n),M=i!=null&&r!=null&&i>=c+S&&i<=c+S+b&&r>=d+E&&r<=d+E+v?C:w;this.drawTreeMarker(e,t,S,E,y,M,o.isRowExpanded(n))}drawTreeMarker(e,t,n,s,o,i,r){const{x1:l,y1:a,x2:c,y2:d}=o,u=r?"\u229F":"\u229E",m=n+(l+c)*.5+.5,p=s+(a+d)*.5+.5;e.fillStyle=i,e.textAlign="center",e.fillText(u,m,p)}drawCellRowTreeDepthLines(e,t,n,s){const{metrics:o,model:i,theme:r}=t;if(!ke(i))return;const l=i.depthForRow(n);if(l===0)return;const{firstColumn:a,allColumnXs:c,allRowYs:d,allRowHeights:u}=o,{treeDepthIndent:m,treeHorizontalPadding:p,treeLineColor:g}=r,f=L(c,a),w=L(d,n),C=L(u,n),S=s!==void 0?i.depthForRow(s):0,b=l>S?l-S:0;if(e.strokeStyle=g,e.lineWidth=1,l-b>0){e.beginPath();for(let E=0;E<l-b;E+=1){const v=f+E*m+m*.5+p+.5;e.moveTo(v,w),e.lineTo(v,w+C)}e.stroke()}if(b>0){e.beginPath();for(let E=l-b;E<l;E+=1){const v=f+E*m+m*.5+p+.5;e.moveTo(v,w),e.lineTo(v,w+Math.ceil(C/2)),e.moveTo(v-.5,w+Math.ceil(C/2)+.5),e.lineTo(v+m-.5,w+Math.ceil(C/2)+.5)}e.stroke()}}drawHeaders(e,t){const{theme:n}=t;e.font=n.headerFont,this.drawColumnHeaders(e,t),this.drawRowHeaders(e,t)}drawFooters(e,t){const{theme:n}=t;e.font=n.headerFont,this.drawRowFooters(e,t)}drawColumnHeaders(e,t){const{mouseX:n,mouseY:s,theme:o,metrics:i,draggingColumnSeparator:r,isDragging:l,model:a}=t,{columnHeaderHeight:c,floatingColumns:d,gridX:u,width:m,visibleColumns:p,allColumnWidths:g,allColumnXs:f,floatingLeftColumnCount:w,floatingLeftWidth:C,floatingRightWidth:S,modelColumns:b,columnHeaderMaxDepth:E}=i;if(c<=0)return;const{headerHiddenSeparatorSize:v,headerHiddenSeparatorHoverColor:y,headerSeparatorColor:M,headerSeparatorHoverColor:A}=o,F=c*.5,V=c*(E-1)+c*.5-F*.5,H=w>0;if(e.save(),this.drawColumnHeadersForRange(e,t,[p[0],p[p.length-1]],{minX:u+C,maxX:m-S}),H&&this.drawColumnHeadersForRange(e,t,[d[0],d[d.length-1]],{minX:u,maxX:u+C}),M){e.strokeStyle=M;const N=[...g.entries()].filter(([P,k])=>k===0).map(([P])=>P);e.beginPath(),e.fillStyle=M;for(let P=0;P<N.length;P+=1){const k=N[P],z=L(f,k),K=L(g,k),G=u+z+K+.5-v*.5;e.rect(G,V,v,F)}e.fill()}if(A){let{index:N,depth:P}=r!=null?r:{};if(N==null&&n!=null&&s!=null){const z=Ti.getColumnSeparator(W.getGridPointFromXY(n,s,i),i,a,o);N=z==null?void 0:z.index,P=z==null?void 0:z.depth}let k;if(N==null)k=!1;else{const z=b.get(N),K=b.get(N+1);z==null||K==null?k=!1:k=a.textForColumnHeader(z,P)!==a.textForColumnHeader(K,P)}if(k&&N!=null&&P!=null&&(!l||r!=null)){e.strokeStyle=A;const z=L(f,N),K=L(g,N),G=u+z+K+.5,_=p.indexOf(N),q=_<p.length-1?p[_+1]:null,Y=q!=null?g.get(q):null,J=K===0,de=Y!=null&&Y===0;J?(e.strokeStyle=y,e.fillStyle=y,e.fillRect(G,V,v*.5,F)):de&&(e.fillStyle=A,e.fillRect(G-v*.5,V,v*.5,F)),e.beginPath(),e.moveTo(G,(E-P-1)*c),e.lineTo(G,(E-P)*c-1),e.stroke()}}e.restore()}drawColumnHeadersForRange(e,t,n,s){const{model:o}=t,{columnHeaderMaxDepth:i}=o;if(i!==0)for(let r=0;r<=i;r+=1)this.drawColumnHeadersAtDepth(e,t,n,s,r)}drawColumnHeadersAtDepth(e,t,n,s,o){var M,A,F,V,H,N;const{metrics:i,model:r,theme:l}=t,{modelColumns:a,allColumnXs:c,gridX:d,calculatedColumnWidths:u,userColumnWidths:m,allColumnWidths:p,movedColumns:g}=i,{columnHeaderHeight:f,columnWidth:w}=l,{columnHeaderMaxDepth:C}=r,{minX:S,maxX:b}=s,E=b-S;if(C===0)return;const v=n[0],y=n[1];if(e.save(),e.translate(0,(C-o-1)*f),o===0){this.drawColumnHeader(e,t,"",S,b);for(let P=v;P<=y;P+=1)this.drawColumnHeaderAtIndex(e,t,P,s)}if(o>0){let P=v;for(;P<=y;){const{columnCount:k}=i,z=L(a,P),K=r.textForColumnHeader(z,o),G=r.colorForColumnHeader(z,o);let _=L(c,P)+d,q=_+L(p,P);if(K!=null){let Y=P-1;for(;Y>=0&&(q-_<E||_>S);){const ge=(M=a.get(Y))!=null?M:W.getModelIndex(Y,g);if(ge==null||r.textForColumnHeader(ge,o)!==K)break;_-=(F=(A=m.get(ge))!=null?A:u.get(ge))!=null?F:w,Y-=1}let J=P+1;for(;J<k&&(q-_<E||q<b);){const ge=(V=a.get(J))!=null?V:W.getModelIndex(J,g);if(r.textForColumnHeader(ge,o)!==K)break;q+=(N=(H=m.get(ge))!=null?H:u.get(ge))!=null?N:w,J+=1}P=J-1;const de=q-_>=E;let pe=_;de&&(q<b?pe=q-E:_<S&&(pe=S)),this.drawColumnHeader(e,t,K,pe,Math.min(q-_,E),{backgroundColor:G!=null?G:void 0},s)}P+=1}}e.restore()}drawColumnHeaderAtIndex(e,t,n,s){var g;const{metrics:o,model:i}=t,{modelColumns:r,allColumnWidths:l,allColumnXs:a,gridX:c}=o,d=L(l,n),u=L(a,n)+c,m=L(r,n),p=i.textForColumnHeader(m);p!=null&&this.drawColumnHeader(e,t,p,u,d,{backgroundColor:(g=i.colorForColumnHeader(m))!=null?g:void 0},s)}drawColumnHeader(e,t,n,s,o,i,r){var J;if(o<=0)return;const{metrics:l,theme:a}=t,{headerHorizontalPadding:c,columnHeaderHeight:d,headerBackgroundColor:u,headerColor:m,headerSeparatorColor:p,black:g,white:f}=a,{fontWidths:w,width:C}=l,S=(J=w.get(e.font))!=null?J:fn.DEFAULT_FONT_WIDTH,E=(o-c*2)/S,{backgroundColor:v=u,separatorColor:y=p}=i!=null?i:{};let{textColor:M=m}=i!=null?i:{};try{const de=this.getCachedColorIsDark(v),pe=this.getCachedColorIsDark(M);de&&pe?M=f:!de&&!pe&&(M=g)}catch{}let{minX:A=0,maxX:F=C}=r!=null?r:{};e.save(),e.rect(A,0,F-A,d),e.clip(),v!=null&&(e.fillStyle=v,e.fillRect(s,0,o,d)),y!=null&&(e.strokeStyle=y,e.beginPath(),s>0&&(e.moveTo(s+.5,0),e.lineTo(s+.5,d)),e.moveTo(s+o+.5,0),e.lineTo(s+o+.5,d),e.moveTo(s,d-.5),e.lineTo(s+o,d-.5),e.stroke()),e.beginPath(),e.rect(s,0,o,d),e.clip(),e.fillStyle=M;let V=n;E<=0?V="":V.length>E&&(V=`${V.substring(0,E-1)}\u2026`);const H=V.length*S;let N=s+o*.5;const P=d*.5;A+=c,F-=c;const k=s+c,z=ze(k,A,F),K=s+o-c,_=ze(K,A,F)-z,q=N-H*.5<A,Y=N+H*.5>F;q?H<_?N=A+H*.5:N=K-H*.5:Y&&(H<_?N=F-H*.5:N=k+H*.5),e.textAlign="center",e.fillText(V,N,P),e.restore()}drawRowHeaders(e,t){const{mouseX:n,mouseY:s,metrics:o,theme:i,draggingRowSeparator:r}=t,{gridY:l,rowHeaderWidth:a,height:c,visibleRows:d,allRowHeights:u,allRowYs:m}=o;if(a<=0)return;const{headerBackgroundColor:p,headerColor:g,headerHiddenSeparatorSize:f,headerHiddenSeparatorHoverColor:w,headerSeparatorColor:C,headerSeparatorHoverColor:S}=i,b=a*.5,E=a*.5-b*.5;if(e.save(),e.beginPath(),e.fillStyle=p,e.fillRect(0,0,a,c),C){e.strokeStyle=C,e.beginPath(),e.moveTo(0,l+.5),e.lineTo(a,l+.5);const v=[];let y=!1;for(let M=0;M<d.length;M+=1){const A=d[M],F=L(m,A),V=L(u,A);if(V>0){const H=l+F+V+.5;e.moveTo(0,H),e.lineTo(a,H),y=!1}else y||(y=!0,v.push(A))}e.moveTo(a-.5,0),e.lineTo(a-.5,c),e.stroke(),e.beginPath(),e.fillStyle=C;for(let M=0;M<v.length;M+=1){const A=v[M],F=L(m,A),V=L(u,A),H=l+F+V+.5-f*.5;e.rect(E,H,b,f)}e.fill()}if(S){let{index:v=null}=r!=null?r:{};if(v==null&&n!=null&&s!=null&&(v=W.getRowSeparatorIndex(n,s,o,i)),v!=null){e.strokeStyle=S;const y=L(m,v),M=L(u,v),A=l+y+M+.5,F=d.indexOf(v),V=F<d.length-1?d[F+1]:null,H=V!=null?u.get(V):null,N=M===0,P=H!=null&&H===0;N?(e.strokeStyle=w,e.fillStyle=w,e.fillRect(E,A,b,f*.5)):P&&(e.fillStyle=S,e.fillRect(E,A-f*.5,b,f*.5)),e.beginPath(),e.moveTo(.5,A),e.lineTo(a+.5,A),e.stroke()}}e.beginPath(),e.rect(0,l,a,c),e.clip(),e.fillStyle=g,e.textAlign="right";for(let v=0;v<d.length;v+=1){const y=d[v],M=L(u,y),A=L(m,y)+l;this.drawRowHeader(e,t,y,A,M)}e.restore()}drawRowHeader(e,t,n,s,o){if(o<=0)return;const{metrics:i,model:r,theme:l}=t,{modelRows:a,rowHeaderWidth:c}=i,d=L(a,n),u=c-l.cellHorizontalPadding,m=s+o*.5;e.fillText(r.textForRowHeader(d),u,m)}drawRowFooters(e,t){const{mouseX:n,mouseY:s,metrics:o,model:i,theme:r,draggingRowSeparator:l}=t,{gridY:a,gridX:c,maxX:d,modelRows:u,rowFooterWidth:m,height:p,verticalBarWidth:g,visibleRows:f,allRowHeights:w,allRowYs:C,width:S}=o;if(m<=0)return;const{cellHorizontalPadding:b,headerBackgroundColor:E,headerColor:v,headerHiddenSeparatorSize:y,headerHiddenSeparatorHoverColor:M,headerSeparatorColor:A,headerSeparatorHoverColor:F}=r,V=m*.5,H=m*.5-V*.5,N=Math.min(c+d,S-m-g);if(e.save(),e.beginPath(),e.fillStyle=E,e.fillRect(N,a,m,p),A){e.strokeStyle=A,e.beginPath(),e.moveTo(N,a+.5),e.lineTo(m,a+.5);const k=[];let z=!1;for(let K=0;K<f.length;K+=1){const G=f[K],_=L(C,G),q=L(w,G);if(q>0){const Y=a+_+q+.5;e.moveTo(N+.5,Y),e.lineTo(N+m-.5,Y),z=!1}else z||(z=!0,k.push(G))}e.moveTo(N+.5,a),e.lineTo(N+.5,p),e.stroke(),e.beginPath(),e.fillStyle=A;for(let K=0;K<k.length;K+=1){const G=k[K],_=L(C,G),q=L(w,G),Y=a+_+q+.5-y*.5;e.rect(N+H,Y,V,y)}e.fill()}if(F){let{index:k=null}=l!=null?l:{};if(k==null&&n!=null&&s!=null&&(k=W.getRowSeparatorIndex(n,s,o,r)),k!=null){e.strokeStyle=F;const z=L(C,k),K=L(w,k),G=a+z+K+.5,_=f.indexOf(k),q=_<f.length-1?f[_+1]:null,Y=q!=null?w.get(q):null,J=K===0,de=Y!=null&&Y===0;J?(e.strokeStyle=M,e.fillStyle=M,e.fillRect(H,G,V,y*.5)):de&&(e.fillStyle=F,e.fillRect(H,G-y*.5,V,y*.5)),e.beginPath(),e.moveTo(N+.5,G),e.lineTo(N+m+.5,G),e.stroke()}}e.beginPath(),e.rect(N,a,m,p),e.clip(),e.fillStyle=v,e.textAlign="left";const P=N+b;for(let k=0;k<f.length;k+=1){const z=f[k],K=L(w,z);if(K>0){const G=L(C,z)+a,_=L(u,z),q=G+K*.5;e.fillText(i.textForRowFooter(_),P,q)}}e.restore()}drawSelectedRanges(e,t,n={}){const{cursorColumn:s,cursorRow:o,draggingRow:i,draggingColumn:r,editingCell:l,metrics:a,model:c,selectedRanges:d,theme:u}=t,{allColumnWidths:m,allColumnXs:p,allRowHeights:g,allRowYs:f,width:w,height:C}=a,{left:S=a.left,top:b=a.top,right:E=a.right,bottom:v=a.bottom,minY:y=-10,maxY:M=C+10,minX:A=-10,maxX:F=w+10}=n;if(d.length===0)return;const V=He(c)&&c.isEditable&&l==null&&i==null&&r==null&&s!=null&&o!=null&&p.has(s)&&f.has(o);if(V){const H=L(p,s),N=L(f,o),P=L(m,s),k=L(g,o);e.save(),e.beginPath(),e.rect(0,0,w,C),e.rect(H,N,P,k),e.clip("evenodd")}e.beginPath();for(let H=0;H<d.length;H+=1){const N=d[H],P=N.startColumn!==null?N.startColumn:S,k=N.startRow!==null?N.startRow:b,z=N.endColumn!==null?N.endColumn:E,K=N.endRow!==null?N.endRow:v;if(K>=b&&v>=k&&z>=S&&E>=P){const G=P>=S&&p.has(P)?Math.round(L(p,P))+.5:A,_=k>=b&&f.has(k)?Math.max(Math.round(L(f,k))+.5,.5):y,q=z<=E&&p.has(z)?Math.round(L(p,z)+L(m,z))-.5:F,Y=K<=v&&f.has(K)?Math.round(L(f,K)+L(g,K))-.5:M;e.rect(G,_,q-G,Y-_)}e.fillStyle=u.selectionColor,e.fill(),e.save(),e.clip(),e.strokeStyle=u.selectionOutlineCasingColor,e.lineWidth=3,e.stroke(),e.restore(),e.strokeStyle=u.selectionOutlineColor,e.lineWidth=1,e.stroke()}V&&s!=null&&o!=null&&(e.restore(),this.drawActiveCell(e,t,s,o))}drawActiveCell(e,t,n,s,o=fn.ACTIVE_CELL_BORDER_WIDTH){const{metrics:i,theme:r}=t,{allColumnWidths:l,allColumnXs:a,allRowHeights:c,allRowYs:d}=i,u=L(a,n),m=L(d,s),p=L(l,n),g=L(c,s);let f=u-o*.5,w=m-o*.5,C=p+o,S=g+o;f<=0&&(C+=f-1,f=1),w<=0&&(S+=w-1,w=1);const{lineWidth:b}=e;e.beginPath(),e.lineWidth=o,e.strokeStyle=r.selectionOutlineColor,this.drawRoundedRect(e,f,w,C,S),e.stroke(),e.lineWidth=b}drawRoundedRect(e,t,n,s,o,i=fn.DEFAULT_EDGE_RADIUS){e.beginPath(),e.moveTo(t+i,n),e.lineTo(t+s-i,n),e.quadraticCurveTo(t+s,n,t+s,n+i),e.lineTo(t+s,n+o-i),e.quadraticCurveTo(t+s,n+o,t+s-i,n+o),e.lineTo(t+i,n+o),e.quadraticCurveTo(t,n+o,t,n+o-i),e.lineTo(t,n+i),e.quadraticCurveTo(t,n,t+i,n),e.closePath()}drawDraggingColumn(e,t){var Y;const{draggingColumn:n,metrics:s,mouseX:o,theme:i,model:r}=t;if(n==null||o==null)return;const{range:l,depth:a}=n,{gridX:c,gridY:d,allColumnXs:u,allColumnWidths:m,height:p,width:g,columnHeaderMaxDepth:f,columnHeaderHeight:w,movedColumns:C,modelColumns:S,floatingLeftWidth:b}=s,E=(Y=S.get(l[0]))!=null?Y:W.getModelIndex(l[0],C),v=r.getColumnHeaderGroup(E,a);if(a>0&&!v)return;const[y,M]=l,A=L(u,y),V=L(u,M)+L(m,M)-A,H=n.left,{backgroundColor:N,font:P,headerFont:k,reorderOffset:z,shadowBlur:K,shadowColor:G}=i,_=(f-a-1)*w;e.save(),e.translate(c,0),e.save(),e.beginPath(),e.rect(b,0,g,p),e.clip(),e.fillStyle=N,e.fillRect(A,_,V,p),e.restore(),e.translate(0,z),e.save(),e.shadowColor=G,e.shadowBlur=K,e.fillStyle=N,e.fillRect(n.left,_+z,n.width,p),e.restore(),e.beginPath(),e.rect(n.left,_,n.width+1,p),e.clip(),e.translate(H-A,0),e.font=k;const q=[];for(let J=n.range[0];J<=n.range[1];J+=1)q.push(J);this.drawColumnHeaders(e,t),this.drawColumnHeadersForRange(e,t,[q[0],q[q.length-1]],{minX:A,maxX:g}),e.translate(0,d),e.font=P,this.drawGridBackground(e,t);for(let J=y;J<=M;J+=1)this.drawColumnCellContents(e,t,J);e.restore()}drawDraggingRow(e,t){const{draggingRow:n,draggingRowOffset:s,metrics:o,mouseY:i,theme:r}=t;if(n==null||i==null)return;const{gridX:l,gridY:a,allRowYs:c,allRowHeights:d,width:u}=o,m=L(c,n),p=L(d,n)+1,{backgroundColor:g,font:f,headerFont:w,reorderOffset:C,shadowBlur:S,shadowColor:b}=r;e.save(),e.translate(0,a),e.fillStyle=g,e.fillRect(0,m,u,p),e.translate(l+C,i-m-a-(s!=null?s:0)),e.save(),e.shadowColor=b,e.shadowBlur=S,e.fillStyle=g,e.fillRect(-l,m,u,p),e.restore(),e.beginPath(),e.rect(-l,m,u,p),e.clip(),e.font=f,this.drawGridBackground(e,t),this.drawCellContents(e,t),e.translate(-l,-a),e.font=w,this.drawRowHeaders(e,t),e.restore()}drawScrollBars(e,t){const{isDraggingHorizontalScrollBar:n,isDraggingVerticalScrollBar:s,isDragging:o,metrics:i,mouseX:r,mouseY:l,theme:a}=t;if(a.scrollBarSize<=0)return;const{width:c,height:d,handleHeight:u,handleWidth:m,scrollX:p,scrollY:g,hasHorizontalBar:f,hasVerticalBar:w,barWidth:C,barHeight:S,barLeft:b,barTop:E}=i,{scrollBarBackgroundColor:v,scrollBarHoverBackgroundColor:y,scrollBarCasingColor:M,scrollBarCornerColor:A,scrollBarColor:F,scrollBarHoverColor:V,scrollBarActiveColor:H,scrollBarSize:N,scrollBarHoverSize:P,scrollBarCasingWidth:k,scrollBarSelectionTick:z,scrollBarSelectionTickColor:K,scrollBarActiveSelectionTickColor:G,autoSelectRow:_,autoSelectColumn:q}=a,Y=r!=null&&l!=null&&r<=c&&l<=d,J=s||w&&!n&&!o&&r!=null&&l!=null&&r>=c-P&&l>=E&&Y,de=n||f&&!s&&!o&&!J&&r!=null&&l!=null&&l>=d-P&&r>=b&&Y,pe=de?P:N,ge=J?P:N;if(e.translate(b,E),f&&w&&(e.fillStyle=M,e.fillRect(c-b-N,d-E-N,N,N),e.fillStyle=A,e.fillRect(c-b-N+k,d-E-N+k,N-k,N-k)),f){const Te=p,fe=d-E-pe;if(e.fillStyle=M,e.fillRect(0,fe,C,pe-k),e.fillStyle=de?y:v,e.fillRect(0,fe+k,C,pe-k),n?e.fillStyle=H:de?e.fillStyle=V:e.fillStyle=F,e.fillRect(Te,fe+k,m,pe-k),!_&&z&&K!=null&&G!=null){e.fillStyle=K;const{selectedRanges:nt,cursorColumn:je}=t,{lastLeft:qe,columnCount:Ut}=i,In=[...nt].filter(we=>we.startColumn!=null&&we.endColumn!=null).map(we=>[we.startColumn,we.endColumn]).sort(W.compareRanges),Bt=W.mergeSortedRanges(In),xe=we=>we<=qe?we/qe*(C-m):C-m+(we-qe)/(Ut-qe)*m;for(let we=0;we<Bt.length;we+=1){const Ze=Bt[we],Ke=Ze[0],ht=Ze[1];if(Ke!=null&&ht!=null&&(Ke!==je||ht!==je)){const It=xe(Ke),Mn=Math.max(1,Math.round(xe(ht+1)-It)),Gt=pe-k;e.fillRect(It,fe+k+Math.round(Gt/3),Mn,Math.round(Gt/3))}}if(je!=null){const we=xe(je),Ze=2,Ke=pe-k;e.fillStyle=G,e.fillRect(we,fe+k,Ze,Ke)}}}if(w){const Te=c-b-ge,fe=g;if(e.fillStyle=M,e.fillRect(Te,0,ge-k,S),e.fillStyle=J?y:v,e.fillRect(Te+k,0,ge-k,S),s?e.fillStyle=H:J?e.fillStyle=V:e.fillStyle=F,e.fillRect(Te+k,fe,ge-k,u),!q&&z&&K!=null&&G!=null){const{selectedRanges:nt,cursorRow:je}=t,{lastTop:qe,rowCount:Ut}=i,yt=we=>we<=qe?we/qe*(S-u):S-u+(we-qe)/(Ut-qe)*u;e.fillStyle=K;const Bt=[...nt].filter(we=>we.startRow!=null&&we.endRow!=null).map(we=>[we.startRow,we.endRow]).sort(W.compareRanges),xe=W.mergeSortedRanges(Bt);for(let we=0;we<xe.length;we+=1){const Ze=xe[we],Ke=Ze[0],ht=Ze[1];if(Ke!=null&&ht!=null&&(Ke!==je||ht!==je)){const It=yt(Ke),Mn=ge-k,Gt=Math.max(1,Math.round(yt(ht+1)-It));e.fillRect(Te+k+Math.round(Mn/3),It,Math.round(Mn/3),Gt)}}if(je!=null){const we=Math.round(yt(je)),Ze=ge-k,Ke=2;e.fillStyle=G,e.fillRect(Te+k,we,Ze,Ke)}}}e.translate(-b,-E)}};let gs=fn;gs.DEFAULT_FONT_WIDTH=10;gs.DEFAULT_EDGE_RADIUS=2;gs.ACTIVE_CELL_BORDER_WIDTH=2;const El=100;class yh extends Qe{constructor(){super(...arguments),this.hasExtendedFloating=!1}onDown(t,n,s){const{x:o,y:i,column:r,row:l}=t,{metrics:a}=n;if(!a)throw new Error("metrics not set");const{gridX:c,gridY:d,maxX:u,maxY:m}=a,p=o-c,g=i-d;if(p<0||g<0||r==null&&p>u||l==null&&g>m)return!1;const f=W.isModifierKeyDown(s),w=s.shiftKey;f||(w?n.trimSelectedRanges():n.clearSelectedRanges());const C=n.getTheme(),{autoSelectRow:S,autoSelectColumn:b}=C;return(r!==null||!b)&&(l!==null||!S)&&(n.focus(),n.moveCursorToPosition(r,l,w,!1,w&&f)),this.startPoint=t,this.hasExtendedFloating=!1,this.dragBounds=W.getScrollDragBounds(a,l,r),!0}onDrag(t,n){if(this.startPoint===void 0)return!1;this.stopTimer();const{row:s,column:o}=this.startPoint,{x:i,y:r}=t;let{row:l,column:a}=t;const{metrics:c}=n;if(!c)throw new Error("metrics not set");const{left:d,lastLeft:u,top:m,lastTop:p,columnWidth:g,rowHeight:f}=c,w=W.getScrollDragBounds(c,s,o);let C=0,S=0;if(d<u&&(i<w.x1?C=i-w.x1:i>w.x2&&(C=i-w.x2)),m<p&&(r<w.y1?S=r-w.y1:r>w.y2&&(S=r-w.y2)),C!==0||S!==0)this.startTimer(n,t,C>0?Math.ceil(C/g):Math.floor(C/g),S>0?Math.ceil(S/f):Math.floor(S/f));else if(l!=null&&a!=null){const{floatingTopRowCount:b,floatingBottomRowCount:E,floatingLeftColumnCount:v,floatingRightColumnCount:y,columnCount:M,rowCount:A,bottom:F,right:V,topVisible:H,bottomVisible:N,leftVisible:P,rightVisible:k}=c;this.hasExtendedFloating||(s!==null&&s<b&&l>=b?(l=b,this.hasExtendedFloating=!0):s!==null&&s>=A-E&&l<A-E&&(l=A-E-1,this.hasExtendedFloating=!0),o!==null&&o<v&&a>=v?(a=v,this.hasExtendedFloating=!0):o!==null&&o>=M-y&&a<M-y&&(a=M-y-1,this.hasExtendedFloating=!0)),s!==null&&!W.isFloatingRow(s,c)&&W.isFloatingRow(l,c)&&(s>l&&l<m?l=H-1:s<l&&l>F&&(l=N+1)),o!==null&&!W.isFloatingColumn(o,c)&&W.isFloatingColumn(a,c)&&(o>a&&a<d?a=P-1:o<a&&a>V&&(a=k+1)),n.moveCursorToPosition(a,l,!0,!0)}return!0}onUp(t,n){return this.startPoint!==void 0&&(this.startPoint=void 0,this.dragBounds=void 0,this.stopTimer(),n.commitSelection()),!1}moveSelection(t,n,s,o){const{row:i,column:r}=n,{metrics:l}=t;if(!l)throw new Error("metrics not set");const{selectionEndRow:a,selectionEndColumn:c}=t.state;if(a==null||c==null)throw new Error("selection not set");const{rowCount:d,columnCount:u}=l,m=s<0&&r!=null?r:0,p=s>0&&r!=null?r:u-1,g=o<0&&i!=null?i:0,f=o>0&&i!=null?i:d-1;t.moveCursorToPosition(Math.min(Math.max(m,c+s),p),Math.min(Math.max(g,a+o),f),!0),this.lastTriggerTime=Date.now()}startTimer(t,n,s,o){this.stopTimer();const i=this.lastTriggerTime!=null?El-Math.min(El,Date.now()-this.lastTriggerTime):0;this.timer=setTimeout(()=>{this.moveSelection(t,n,s,o),this.startTimer(t,n,s,o)},i)}stopTimer(){this.timer!==void 0&&(clearTimeout(this.timer),this.timer=void 0)}}const Rl=5,Ih=1e3/60,Ko=10;function On(e,t,n,s){var b,E,v,y,M,A,F;const{modelColumns:o,movedColumns:i,allColumnXs:r,columnCount:l,allColumnWidths:a,userColumnWidths:c,calculatedColumnWidths:d,floatingLeftWidth:u,maxX:m}=n;if(t==null||e==null||e>l||e<0)return null;const p=(b=o.get(e))!=null?b:W.getModelIndex(e,i),g=s.getColumnHeaderGroup(p,t),f=g!=null;let w,C,S;if(g!=null){const[V,H]=g.getVisibleRange(i);w=(E=r.get(V))!=null?E:u,C=((v=r.get(H))!=null?v:m)+((y=a.get(H))!=null?y:0),S=[V,H]}else{const V=r.get(e);if(V==null)return null;w=V,C=w+((F=(A=(M=a.get(e))!=null?M:c.get(p))!=null?A:d.get(p))!=null?F:0),S=[e,e]}return{visibleIndex:e,modelIndex:p,left:w,right:C,width:C-w,isColumnGroup:f,range:S,depth:t}}class Mh extends Qe{constructor(){super(...arguments),this.cursor=null,this.draggingColumn=null}setScrollInterval(t,n){this.scrollingInterval!=null&&n===this.scrollingDirection||(this.scrollingDirection=n,this.scrollingInterval=window.setInterval(()=>{var f,w;const{metrics:s}=t;if(!s)return;const{left:o,lastLeft:i,leftOffset:r,userColumnWidths:l,calculatedColumnWidths:a,movedColumns:c,allColumnWidths:d}=s;let u=o,m=r;if(n==="left")for(m-=Ko;m<0;){u-=1;const C=W.getModelIndex(o-1,c),S=(f=l.get(C))!=null?f:a.get(C);S===void 0?m=0:m+=S,u<0&&(m=0,u=0)}else{m+=Ko;let C=d.get(o);for(;C!==void 0&&m>C;){u+=1,m-=C;const S=W.getModelIndex(o+1,c);C=(w=l.get(S))!=null?w:a.get(S),u>i&&(m=0,u=i)}}const{mouseX:p,mouseY:g}=t.state;s==null||p==null||g==null||(this.moveDraggingColumn(p,t,n==="left"?-Ko:Ko),t.setState({left:u,leftOffset:m}),(n==="left"&&u===0&&r===0||n==="right"&&u===i)&&this.clearScrollInterval())},Ih))}clearScrollInterval(){this.scrollingDirection=void 0,window.clearInterval(this.scrollingInterval),this.scrollingInterval=void 0}onLeave(){return this.clearScrollInterval(),!1}onDown(t,n){const{model:s}=n.props,{x:o,column:i,columnHeaderDepth:r}=t,{metrics:l}=n;if(!l)throw new Error("Metrics not set");const a=On(i,r,l,s);if(i==null||a==null||r==null||r>0&&!a.isColumnGroup)return!1;const{rowHeaderWidth:c}=l;return this.initialGridPoint=t,this.draggingColumn=null,this.cursor=null,a.modelIndex!=null&&r!=null&&s.isColumnMovable(a.modelIndex,r)&&(this.draggingOffset=o-a.left-c,this.initialOffset=this.draggingOffset),!1}onDrag(t,n,s){if(this.draggingOffset===void 0||this.initialGridPoint===void 0||this.initialOffset===void 0)return!1;const{x:o,y:i}=t,{columnHeaderDepth:r}=this.initialGridPoint,{model:l}=n.props;let{draggingColumn:a}=this;const{metrics:c}=n;if(!c)throw new Error("Metrics not set");if(!a&&Math.abs(this.initialGridPoint.x-o)<Rl&&Math.abs(this.initialGridPoint.y-i)<Rl)return!1;if(a==null){const d=On(this.initialGridPoint.column,r,c,l);if(!d||r==null||!l.isColumnMovable(d.modelIndex)||r>0&&!d.isColumnGroup||d.range[0]==null)return!1;a={range:d.range,depth:r,left:d.left,width:d.width};const u=On(a.range[0],0,c,l),m=On(a.range[1],0,c,l);if(!u||!m)return!1;this.draggingColumn=a,n.setState({draggingColumn:a,isDragging:!0})}return this.cursor="move",this.moveDraggingColumn(t.x,n,s.movementX),!0}moveDraggingColumn(t,n,s){var M,A,F,V,H;if(this.draggingOffset===void 0||this.initialGridPoint===void 0||this.initialOffset===void 0||this.draggingColumn==null||s===0)return;if(this.initialOffset!==this.draggingOffset){this.draggingOffset<this.initialOffset&&this.initialOffset<this.draggingOffset+s||this.draggingOffset>this.initialOffset&&this.initialOffset>this.draggingOffset+s?this.draggingOffset=this.initialOffset:this.draggingOffset+=s,this.draggingColumn={...this.draggingColumn,left:t-this.draggingOffset},n.setState({draggingColumn:this.draggingColumn});return}const{depth:o}=this.draggingColumn,{model:i}=n.props,{movedColumns:r}=n.state,{metrics:l}=n;if(!l)throw new Error("Metrics not set");const{floatingLeftWidth:a,width:c,columnHeaderMaxDepth:d,allColumnXs:u}=l,m=s<0,p=On(this.draggingColumn.range[0],o,l,i);if(!p)return;const g=t-this.draggingOffset,f=g+p.width;this.draggingColumn={...this.draggingColumn,left:g},n.setState({draggingColumn:this.draggingColumn});const w=On(W.getColumnAtX(ze(m?g:f,a,c),l,!0),o,l,i),C=i.getColumnHeaderParentGroup(p.modelIndex,p.depth);if(!w)return;if(C!==void 0){const N=C.getVisibleRange(r);if(w.visibleIndex<N[0]){const P=this.moveColumn(p,N[0],r);this.draggingOffset=t-((M=u.get(N[0]))!=null?M:0),this.draggingColumn={...this.draggingColumn,left:t-this.draggingOffset},this.clearScrollInterval(),n.setState({draggingColumn:this.draggingColumn,movedColumns:P});return}if(w.visibleIndex>N[1]){const P=this.moveColumn(p,N[1]-(p.range[1]-p.range[0]),r),{right:k=0}=(A=On(N[1],0,l,i))!=null?A:{};this.draggingOffset=t-(k-p.width),this.draggingColumn={...this.draggingColumn,left:t-this.draggingOffset},this.clearScrollInterval(),n.setState({draggingColumn:this.draggingColumn,movedColumns:P});return}}if(!i.isColumnMovable(w.modelIndex)){let N=w.visibleIndex;if(m)for(N+=1;N<p.visibleIndex&&!i.isColumnMovable(W.getModelIndex(N,r));)N+=1;else for(N-=1;N>p.visibleIndex&&!i.isColumnMovable(W.getModelIndex(N,r));)N-=1;if(N!==p.visibleIndex){m||(N-=p.range[1]-p.range[0]);const k=this.moveColumn(p,N,r);n.setState({movedColumns:k,draggingColumn:this.draggingColumn})}const P=On(N,0,l,i);m?this.draggingOffset=t-((F=P==null?void 0:P.left)!=null?F:0):this.draggingOffset=t-(((V=P==null?void 0:P.right)!=null?V:0)-p.width),this.draggingColumn={...this.draggingColumn,left:t-this.draggingOffset},n.setState({draggingColumn:this.draggingColumn});return}if(g<=a?this.setScrollInterval(n,"left"):f>c?this.setScrollInterval(n,"right"):this.clearScrollInterval(),w.visibleIndex===p.visibleIndex||m&&p.visibleIndex<w.visibleIndex||!m&&p.visibleIndex>w.visibleIndex)return;const S=w.left+w.width*.5,b=i.getColumnHeaderParentGroup(p.modelIndex,p.depth);let E,v=((H=b==null?void 0:b.depth)!=null?H:d)-1;for(;v>=0&&E===void 0;)E=i.getColumnHeaderGroup(w.modelIndex,v),v-=1;let y;m&&g<S&&(!E||w.visibleIndex===E.getVisibleRange(r)[0])&&(y=this.moveColumn(p,w.range[0],r)),!m&&f>S&&(!E||w.visibleIndex===E.getVisibleRange(r)[1])&&(y=this.moveColumn(p,w.range[1]-(p.range[1]-p.range[0]),r)),y&&(this.draggingColumn={...this.draggingColumn,left:g},n.setState({movedColumns:y,draggingColumn:this.draggingColumn}))}moveColumn(t,n,s){const o=t.isColumnGroup?W.moveRange(t.range,n,s):W.moveItem(t.visibleIndex,n,s),i=n-t.range[0],r=[t.range[0]+i,t.range[1]+i];return this.draggingColumn&&(this.draggingColumn={...this.draggingColumn,range:r}),o}onUp(t,n){return this.cursor=null,this.clearScrollInterval(),this.draggingOffset!=null?(this.draggingOffset=void 0,n.setState({draggingColumn:null,isDragging:!1}),!0):!1}}class Fr extends Qe{constructor(){super(...arguments),this.cursor="default"}static getLeftWithOffsetFromRawLeft(t,n){const s=t.getTheme(),{metrics:o,metricCalculator:i}=t;if(!o)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=o.allColumnWidths.get(r);if(a==null){const d=t.getMetricState();a=i.getVisibleColumnWidth(r,d)}const c=a*l;return{left:r,leftOffset:c}}isInScrollBar(t,n){const s=n.getTheme(),{scrollBarSize:o,scrollBarHoverSize:i}=s,{metrics:r}=n;if(!r)throw new Error("metrics not set");const{x:l,y:a}=t,{barLeft:c,barWidth:d,height:u,hasHorizontalBar:m}=r;return m&&o>0&&a>=u-i&&a<u&&l>c&&l<c+d}getLeftWithOffset(t,n){var f;const{metrics:s}=n;if(!s)throw new Error("metrics not set");const{x:o}=t,{barWidth:i,handleWidth:r,lastLeft:l,barLeft:a,columnCount:c,scrollableContentWidth:d,scrollableViewportWidth:u}=s,m=o-a,p=ze((m-((f=this.dragOffset)!=null?f:0))/(i-r),0,1);if(c===1)return{left:0,leftOffset:p*(d-u)};const g=p*l;return Fr.getLeftWithOffsetFromRawLeft(n,g)}onDown(t,n){const{metrics:s}=n;if(!s)throw new Error("metrics not set");const{x:o}=t,{handleWidth:i,barLeft:r,scrollX:l}=s;if(!this.isInScrollBar(t,n))return!1;const a=o-r;if(a>=l&&a<=l+i)this.dragOffset=a-l,n.setState({isDraggingHorizontalScrollBar:!0});else{this.dragOffset=0;const{left:c,leftOffset:d}=this.getLeftWithOffset(t,n);n.setViewState({left:c,leftOffset:d,isDraggingHorizontalScrollBar:!0,isDragging:!0})}return!0}onDrag(t,n){if(this.dragOffset!=null){const{left:s,leftOffset:o}=this.getLeftWithOffset(t,n);return n.setViewState({left:s,leftOffset:o,isDraggingHorizontalScrollBar:!0,isDragging:!0}),!0}return!1}onMove(t,n){return this.isInScrollBar(t,n)}onUp(t,n){return this.dragOffset!==void 0&&(this.dragOffset=void 0,n.setState({isDraggingHorizontalScrollBar:!1,isDragging:!1})),this.isInScrollBar(t,n)}onClick(t,n){return this.isInScrollBar(t,n)}}class Dh extends Qe{constructor(){super(...arguments),this.cursor="move"}onDown(t,n){const{model:s}=n.props,{x:o,y:i,row:r}=t,{metrics:l}=n;if(!l)throw new Error("metrics not set");const{columnHeaderHeight:a,rowHeaderWidth:c,allRowYs:d}=l;if(o<=c&&r!==null&&s.isRowMovable(r)){const u=L(d,r);this.draggingOffset=i-u-a,n.setState({draggingRowOffset:this.draggingOffset})}return!1}onDrag(t,n){if(this.draggingOffset==null)return!1;const{model:s}=n.props;let{draggingRow:o}=n.state;const{mouseX:i,mouseY:r}=n.state;if(i==null||r==null)return!1;if(o==null){const{row:y}=n.getGridPointFromXY(i,r);if(y!=null&&!s.isRowMovable(y)||(o=y,n.setState({draggingRow:o,isDragging:!0}),o==null))return!1}const{metrics:l}=n;if(!l)throw new Error("metrics not set");const{top:a,lastTop:c,bottom:d,bottomVisible:u,rowCount:m,columnHeaderHeight:p,allRowHeights:g,allRowYs:f,height:w}=l;let C=p;if(a<o){const y=o-1;C=L(f,y)+L(g,y)*.5+p}let S=w;if(o<d){const y=o+1;S=L(f,y)+L(g,y)*.5+p}let{movedRows:b}=n.state;r<C&&o>0&&s.isRowMovable(o-1)?(b=W.moveItem(o,o-1,b),o-=1):S<r&&o<m-1&&s.isRowMovable(o+1)&&(b=W.moveItem(o,o+1,b),o+=1),n.setState({movedRows:b,draggingRow:o});const E=p+L(g,a)*.5,v=p+L(f,u)+L(g,u)*.5;return r<E&&a>0?n.setState({top:a-1}):r>v&&a<c&&n.setState({top:a+1}),!0}onUp(t,n){return this.draggingOffset!==void 0?(this.draggingOffset=void 0,n.setState({draggingRowOffset:null,draggingRow:null,isDragging:!1}),!0):!1}}class xr extends Pa{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.initialSizesProperty="initialRowHeights",this.modelIndexesProperty="modelRows",this.firstIndexProperty="firstRow",this.treePaddingProperty="treePaddingY",this.getHiddenItems=W.getHiddenRows,this.getNextShownItem=W.getNextShownRow,this.getSeparator=xr.getRowSeparator}static getRowSeparator(t,n,s,o){if(!o.allowRowResize)return null;const{x:i,y:r}=t,l=W.getRowSeparatorIndex(i,r,n,o);return l!=null?{index:l,depth:0}:null}setSize(t,n,s){t.setRowHeight(n,s)}resetSize(t,n){t.resetRowHeight(n)}updateSeparator(t,n){t.setState({draggingRowSeparator:n,isDragging:n!==null})}}class Vs extends Qe{static isInTreeBox(t,n){const{column:s,row:o,x:i,y:r}=t,{metrics:l}=n;if(!l)throw new Error("metrics not set");const{gridX:a,gridY:c,firstColumn:d,allColumnXs:u,allColumnWidths:m,allRowHeights:p,allRowYs:g,visibleRowTreeBoxes:f}=l;if(s===d&&o!=null&&f.get(o)!=null&&i>a&&r>c){const w=L(u,s),C=L(m,s),S=L(g,o),b=L(p,o);if(i>=a+w&&i<=a+w+C&&r>=c+S&&r<=c+S+b)return!0}return!1}onDown(t,n){return Vs.isInTreeBox(t,n)}onClick(t,n,s){if(Vs.isInTreeBox(t,n)){const{row:o}=t;if(o!==null)return n.toggleRowExpanded(o,W.isModifierKeyDown(s)),!0}return!1}}class Nh extends Qe{isInCorner(t,n){const s=n.getTheme(),{scrollBarSize:o}=s,{metrics:i}=n;if(!i)throw new Error("metrics not set");const{x:r,y:l}=t,{width:a,height:c,hasVerticalBar:d,hasHorizontalBar:u}=i;return o>0&&d&&u&&r>=a-o&&l>=c-o&&r<=a&&l<=c}onDown(t,n){return this.isInCorner(t,n)}onUp(t,n){return this.isInCorner(t,n)}onClick(t,n){return this.isInCorner(t,n)}}class Ar extends Qe{constructor(){super(...arguments),this.cursor="default"}static getTopWithOffsetFromRawTop(t,n){const s=t.getTheme(),{metrics:o,metricCalculator:i}=t;if(!o)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=o.allRowHeights.get(r);if(a==null){const d=t.getMetricState();a=i.getVisibleRowHeight(r,d)}const c=a*l;return{top:r,topOffset:c}}isInScrollBar(t,n){const s=n.getTheme(),{scrollBarSize:o,scrollBarHoverSize:i}=s,{metrics:r}=n;if(!r)throw new Error("metrics not set");const{x:l,y:a}=t,{barTop:c,barHeight:d,width:u,hasVerticalBar:m}=r;return m&&o>0&&l>=u-i&&l<u&&a>c&&a<c+d}getTopWithOffset(t,n){var f;const{metrics:s}=n;if(!s)throw new Error("metrics not set");const{y:o}=t,{barHeight:i,handleHeight:r,lastTop:l,barTop:a,rowCount:c,scrollableContentHeight:d,scrollableViewportHeight:u}=s,m=o-a,p=ze((m-((f=this.dragOffset)!=null?f:0))/(i-r),0,1);if(c===1)return{top:0,topOffset:p*(d-u)};const g=p*l;return Ar.getTopWithOffsetFromRawTop(n,g)}onDown(t,n){const{metrics:s}=n;if(!s)throw new Error("metrics not set");const{y:o}=t,{handleHeight:i,barTop:r,scrollY:l}=s;if(!this.isInScrollBar(t,n))return!1;const a=o-r;if(a>=l&&a<=l+i)this.dragOffset=a-l,n.setState({isDraggingVerticalScrollBar:!0});else{this.dragOffset=0;const{top:c,topOffset:d}=this.getTopWithOffset(t,n);n.setViewState({top:c,topOffset:d,isDraggingVerticalScrollBar:!0,isDragging:!0})}return!0}onMove(t,n){return this.isInScrollBar(t,n)}onDrag(t,n){if(this.dragOffset!=null){const{top:s,topOffset:o}=this.getTopWithOffset(t,n);return n.setViewState({top:s,topOffset:o,isDraggingVerticalScrollBar:!0,isDragging:!0}),!0}return!1}onUp(t,n){return this.dragOffset!==void 0&&(this.dragOffset=void 0,n.setState({isDraggingVerticalScrollBar:!1,isDragging:!1})),this.isInScrollBar(t,n)}onClick(t,n){return this.isInScrollBar(t,n)}}class Fh extends Qe{onDoubleClick({column:t,row:n},s){const{model:o}=s.props;return He(o)&&t!=null&&n!=null&&o.isEditableRange(ee.makeCell(t,n))?(s.startEditing(t,n),!0):!1}}class Cs{constructor(t=5e3){this.order=t}onDown(t,n){return!1}}class xh extends Cs{onDown(t,n){switch(t.key){case"a":if(W.isModifierKeyDown(t))return n.selectAll(),!0;break;case"ArrowUp":return this.handleArrowMove(0,-1,t,n);case"ArrowDown":return this.handleArrowMove(0,1,t,n);case"ArrowRight":return this.handleArrowMove(1,0,t,n);case"ArrowLeft":return this.handleArrowMove(-1,0,t,n);case"k":case"K":return W.isModifierKeyDown(t)?!1:this.handlePageUp(t,n);case"j":case"J":return W.isModifierKeyDown(t)?!1:this.handlePageDown(t,n);case"h":case"H":return W.isModifierKeyDown(t)?!1:(t.shiftKey||n.clearSelectedRanges(),n.moveCursorToPosition(0,n.state.cursorRow,t.shiftKey),!0);case"l":case"L":{if(W.isModifierKeyDown(t))return!1;const{model:s}=n.props,{columnCount:o}=s;return t.shiftKey||n.clearSelectedRanges(),n.moveCursorToPosition(o-1,n.state.cursorRow,t.shiftKey),!0}case"PageDown":return this.handlePageDown(t,n);case"PageUp":return this.handlePageUp(t,n);case"Home":return t.shiftKey||n.clearSelectedRanges(),n.moveCursorToPosition(W.isModifierKeyDown(t)?n.state.cursorColumn:0,W.isModifierKeyDown(t)?0:n.state.cursorRow,t.shiftKey,!0,!0),!0;case"End":{const{model:s}=n.props,{columnCount:o,rowCount:i}=s;return t.shiftKey||n.clearSelectedRanges(),n.moveCursorToPosition(W.isModifierKeyDown(t)?n.state.cursorColumn:o-1,W.isModifierKeyDown(t)?i-1:n.state.cursorRow,t.shiftKey,!0,!0),!0}case"Escape":return n.clearSelectedRanges(),{preventDefault:!1,stopPropagation:!1};case"Enter":if(n.state.selectedRanges.length>0)return n.moveCursorInDirection(t.shiftKey?ee.SELECTION_DIRECTION.UP:ee.SELECTION_DIRECTION.DOWN),!0;break;case"Tab":if(n.state.selectedRanges.length>0)return n.moveCursorInDirection(t.shiftKey?ee.SELECTION_DIRECTION.LEFT:ee.SELECTION_DIRECTION.RIGHT),!0;break}return!1}handleArrowMove(t,n,s,o){const i=s.shiftKey,r=W.isModifierKeyDown(s);i?o.trimSelectedRanges():o.clearSelectedRanges();const{cursorRow:l,cursorColumn:a,selectionEndColumn:c,selectionEndRow:d}=o.state,u=i?c:a,m=i?d:l;if(r){const{model:p}=o.props,{columnCount:g,rowCount:f}=p,w=r&&i;let C=null,S=null;t<0?(C=0,S=m):t>0?(C=g-1,S=m):n<0?(C=u,S=0):n>0&&(C=u,S=f-1),C!=null&&S!=null&&o.moveCursorToPosition(C,S,i,!0,w)}else{if(!o.metrics)throw new Error("grid.metrics are not set");const{theme:p}=o.props,{autoSelectRow:g=!1,autoSelectColumn:f=!1}=p;if(g&&t!==0){const{lastLeft:w}=o.metrics;let{left:C}=o.state;C=ze(C+t,0,w),o.moveCursorToPosition(C,l,i,!1),o.setViewState({left:C})}else if(f&&n!==0){const{lastTop:w}=o.metrics;let{top:C}=o.state;C=ze(C+n,0,w),o.moveCursorToPosition(C,a,i,!1),o.setViewState({top:C})}else o.moveCursor(t,n,i)}return!0}handlePageUp(t,n){const s=t.shiftKey;s?n.trimSelectedRanges():n.clearSelectedRanges();const{cursorColumn:o,selectionEndRow:i}=n.state,r=i,l=o;if(r==null)return!1;const a=n.getMetricState(),{metricCalculator:c}=n,{bottomVisible:d,topVisible:u,hasHorizontalBar:m}=c.getMetrics(a);let p=r-(d-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(t,n){const s=t.shiftKey;s?n.trimSelectedRanges():n.clearSelectedRanges();const{selectionEndRow:o,cursorColumn:i}=n.state,r=o,l=i;if(r===null)return!1;const a=n.getMetricState(),{metricCalculator:c}=n,{bottomVisible:d,topVisible:u,hasHorizontalBar:m,rowCount:p,lastTop:g}=c.getMetrics(a),f=p-1;let w=d-u+r;w+=m?0:1,w=Math.min(w,f);const C=Math.min(g,w-(r-u));return n.moveCursorToPosition(l,w,s,!1),n.setViewState({top:C}),!0}}class Ah extends Cs{onDown(t,n){switch(t.key){case"Enter":case" ":return this.handleExpandKey(t,n)}return!1}handleExpandKey(t,n){const{selectedRanges:s}=n.state;if(s.length===1){const o=s[0];if(o.startRow===o.endRow&&o.startColumn===o.endColumn){if(!n.metrics)throw new Error("grid.metrics not set");const{model:i}=n.props,{startRow:r,startColumn:l}=o;if(r!=null){const a=n.getModelRow(r);if((l===0||l==null)&&ke(i)&&i.isRowExpandable(a))return n.toggleRowExpanded(r),!0}}}return!1}}class Oh extends Cs{onDown(t,n){if(W.isModifierKeyDown(t))return!1;const{model:s}=n.props,{cursorColumn:o,cursorRow:i}=n.state;if(o==null||i==null||!He(s)||!s.isEditableRange(ee.makeCell(o,i)))return!1;const r=o,l=i;return r==null||l==null?!1:t.key.length===1?(n.startEditing(r,l,!0,[1,1],t.key),!0):t.key==="F2"?(n.startEditing(r,l),!0):t.key==="Backspace"?(n.startEditing(r,l,!0,void 0,""),!0):t.key==="Delete"?(n.setValueForCell(r,l,""),!0):!1}}function kh(e){var s,o;const t=[],n=e.querySelectorAll("tr");for(let i=0;i<n.length;i+=1){const l=n[i].querySelectorAll("td"),a=[];for(let c=0;c<l.length;c+=1){const d=l[c];a.push((o=(s=d.textContent)==null?void 0:s.trim())!=null?o:"")}t.push(a)}return t}function Lh(e){const t=[];return e.forEach(n=>{var o;const s=(o=n.textContent)!=null?o:"";s.length>0&&t.push(s.split(/\t|\u00a0\u00a0 \u00a0/))}),t}function Ph(e){var s,o;const t=e.querySelector("table");if(t!=null)return kh(t);const n=(o=(s=e.textContent)==null?void 0:s.trim())!=null?o:"";if(n.length>0){const{childNodes:i}=e,r=n.includes(" "),l=n.includes("\xA0\xA0 \xA0");return r&&i.length!==0&&(i.length===1||i.length>1&&(i[0].textContent==null||!i[0].textContent.includes(" ")))?n.split(`
|
|
1
|
+
import{B as D,A as T,R as te,P as Oc,C as h,D as dt,E as B,F as R,G as ar,H as he,I as ft,J as Z,K as Fe,L as nn,M as kc,N as Lc,O as cr,Q as pi,S as Pc,T as dr,U as ze,V as Ji,W as Ie,X as ct,Y as gi,Z as jr,_ as Hc,$ as Jt,a0 as _c,a1 as Vc,a2 as Uc,a3 as Bc,a4 as er,a5 as Gc,a6 as zc,a7 as Wc,a8 as Zr,a9 as $c,aa as qc,ab as Jr,ac as Kc,ad as Xc,ae as Yc,af as Qc,ag as jc,ah as Zn,ai as Zc,aj as tr,ak as Zl}from"./vendor.1aa3c569.js";import{e as bn,l as As,K as Ft,a as el,b as Wn}from"./monaco.b3653ac5.js";import{P as si,b as Jc,h as ed,p as td,o as nd,s as sd,t as od,c as Hi}from"./plotly.f816e168.js";import"./helpers.162e09a8.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))s(o);new MutationObserver(o=>{for(const i of o)if(i.type==="childList")for(const r of i.addedNodes)r.tagName==="LINK"&&r.rel==="modulepreload"&&s(r)}).observe(document,{childList:!0,subtree:!0});function n(o){const i={};return o.integrity&&(i.integrity=o.integrity),o.referrerpolicy&&(i.referrerPolicy=o.referrerpolicy),o.crossorigin==="use-credentials"?i.credentials="include":o.crossorigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function s(o){if(o.ep)return;o.ep=!0;const i=n(o);fetch(o.href,i)}})();const id="#1a171a",rd="#f0f0ee",ld="#fcd65b",ad="#9edc6f",cd="#76d9e4",dd="#aa9af4",ud="#f37e3f",hd="#f95d84",md="#4878ea",pd="#5b5a5c",gd="#9edc6f",fd="#fcd65b",Cd="#f37e3f",wd="#f95d84",Sd="#fcfcfa",bd="#929192",vd="#373438",Td="#1a171a",Ed="#f0f0ee",Rd="0.15s",yd={"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:id,white:rd,yellow:ld,green:ad,blue:cd,purple:dd,orange:ud,red:hd,primary:md,"primary-hover":"#235de6","primary-dark":"#343e5d",secondary:pd,success:gd,info:fd,warning:Cd,danger:wd,light:Sd,mid:bd,dark:vd,"text-muted":"#929192","content-bg":"#2d2a2e",background:Td,foreground:Ed,transition:Rd},Id={transitionMs:150,transitionMidMs:200,transitionLongMs:300,transitionSlowMs:1e3},Le=Object.freeze({...Id,...yd});class En extends T.exports.Component{constructor(t){super(t),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=te.createRef(),this.rAF=0;const{isShown:n}=this.props;this.state={show:n,popper:null}}componentDidUpdate(t){const{isShown:n}=this.props;t.isShown!==n&&(n?(cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{this.show()})):this.hide())}componentWillUnmount(){this.destroyPopper(!1)}getVisibleElement(t){return t==null||t.clientHeight>0||t.clientWidth>0?t:this.getVisibleElement(t.parentElement)}initPopper(){let{popper:t}=this.state;const{closeOnBlur:n,referenceObject:s}=this.props;if(t||this.container.current===null)return;let{options:o}=this.props;o={placement:"auto",modifiers:{preventOverflow:{boundariesElement:"viewport"}},...o},document.body.appendChild(this.element);let i=this.getVisibleElement(this.container.current);i==null&&(i=this.container.current),t=new Oc(s||i,this.element,o),t.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:t})}destroyPopper(t=!0){cancelAnimationFrame(this.rAF);const{popper:n}=this.state;!n||(n.destroy(),document.body.contains(this.element)&&document.body.removeChild(this.element),t&&this.setState({popper:null}))}show(){this.initPopper(),this.setState({show:!0})}hide(){this.setState({show:!1})}scheduleUpdate(){const{popper:t}=this.state;t&&t.scheduleUpdate()}handleBlur(t){t.relatedTarget instanceof HTMLElement&&(this.element.contains(t.relatedTarget)||this.hide())}handleEnter(){const{onEntered:t}=this.props;t()}handleExit(){const{onExited:t}=this.props,{show:n}=this.state;n||this.destroyPopper(),t()}renderContent(){const{className:t,children:n,timeout:s,interactive:o,closeOnBlur:i}=this.props,{show:r}=this.state;return h(dt,{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:B("popper",{interactive:o},t),onBlur:i?this.handleBlur:void 0,tabIndex:i?-1:void 0,role:"presentation",children:R("div",{className:"popper-content",children:[n,h("div",{className:"popper-arrow","x-arrow":""})]})})})}render(){const{popper:t}=this.state,{"data-testid":n}=this.props;return h("div",{className:"popper-parent-container",ref:this.container,style:{display:"none"},"data-testid":n,children:t&&ar.createPortal(this.renderContent(),this.element)})}}En.propTypes={children:D.exports.node.isRequired,options:D.exports.shape({}),className:D.exports.string,timeout:D.exports.number,onEntered:D.exports.func,onExited:D.exports.func,isShown:D.exports.bool,closeOnBlur:D.exports.bool,interactive:D.exports.bool,referenceObject:D.exports.shape({}),"data-testid":D.exports.string};En.defaultProps={options:{},className:"",timeout:Le.transitionMs,onEntered(){},onExited(){},isShown:!1,interactive:!1,closeOnBlur:!1,referenceObject:null,"data-testid":void 0};const Md=-1,Jl=0,ea=1,ur=2,ta=3,na=4;Object.freeze({SILENT:Md,ERROR:Jl,WARN:ea,INFO:ur,DEBUG:ta,DEBUG2:na});const xt=()=>{};class tl{constructor(t,n){this.name=t,this.prefix=t!=null?`[${t}]`:"",this.error=xt,this.warn=xt,this.log=xt,this.info=xt,this.debug=xt,this.debug2=xt,this.level=n,this.setLogLevel(n)}setLogLevel(t){if(!Number.isFinite(t)){console.warn(`Expected a number for log level. Received: ${t}. Ignoring`);return}this.level=t,this.error=t>=Jl?console.error.bind(console,this.prefix):xt,this.warn=t>=ea?console.warn.bind(console,this.prefix):xt,this.log=t>=ur?console.log.bind(console,this.prefix):xt,this.info=this.log,this.debug=t>=ta?console.debug.bind(console,this.prefix):xt,this.debug2=t>=na?console.debug.bind(console,this.prefix):xt}}class Dd extends tl{constructor(t=ur){super(null,t),this.modules={}}module(t){return this.modules[t]==null&&(this.modules[t]=new tl(t,this.level)),this.modules[t]}setLogLevel(t){if(super.setLogLevel(t),this.modules==null)return;const n=Object.keys(this.modules);for(let s=0;s<n.length;s+=1)this.modules[n[s]].setLogLevel(t)}}const se=new Dd,Nd=se.module("Tooltip"),St=class extends T.exports.Component{constructor(e){super(e),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.handleWindowMouseMove=this.handleWindowMouseMove.bind(this),this.handleWheel=this.handleWheel.bind(this),this.handleTimeout=this.handleTimeout.bind(this),this.handleExited=this.handleExited.bind(this),this.stopShowingTooltip=this.stopShowingTooltip.bind(this),this.container=te.createRef(),this.popper=te.createRef(),this.parent=null,this.timer=null,this.state={isShown:!1}}static handleHidden(){St.shownTooltipCount-=1,St.shownTooltipCount===0&&(St.lastHiddenTime=Date.now())}static handleShown(){St.shownTooltipCount+=1}componentDidMount(){this.startListening();const{timeout:e}=this.props;e===0&&this.show()}componentDidUpdate(e,t){const{isShown:n}=t,{isShown:s}=this.state;s!==n&&(s?St.handleShown():St.handleHidden())}componentWillUnmount(){this.stopListening(),this.stopListeningWindow(),this.stopTimer();const{isShown:e}=this.state;e&&St.handleHidden()}startListening(){if(!this.container.current||!this.container.current.parentElement){Nd.error("Tooltip doesn't have a container or a parent set!");return}this.parent=this.container.current.parentElement,this.parent.addEventListener("mousemove",this.handleMouseMove),this.parent.addEventListener("mouseleave",this.handleMouseLeave),this.parent.addEventListener("mousedown",this.stopShowingTooltip)}stopListening(){!this.parent||(this.parent.removeEventListener("mousemove",this.handleMouseMove),this.parent.removeEventListener("mouseleave",this.handleMouseLeave),this.parent.removeEventListener("mousedown",this.stopShowingTooltip))}startListeningWindow(){window.addEventListener("mousemove",this.handleWindowMouseMove,!0),window.addEventListener("contextmenu",this.stopShowingTooltip,!0),window.addEventListener("wheel",this.handleWheel)}stopListeningWindow(){window.removeEventListener("mousemove",this.handleWindowMouseMove,!0),window.removeEventListener("contextmenu",this.stopShowingTooltip,!0),window.removeEventListener("wheel",this.handleWheel)}handleMouseMove(){this.startTimer()}handleWheel(){const{isShown:e}=this.state;this.popper.current&&this.parent&&e&&!this.popper.current.element.matches(":hover")&&!this.parent.matches(":hover")&&(this.stopTimer(),this.hide())}handleMouseLeave(){const{isShown:e}=this.state;this.stopTimer();const{interactive:t}=this.props;!t&&e&&this.hide()}handleTimeout(){this.show()}handleWindowMouseMove(e){const t=e.clientX,n=e.clientY,{isShown:s}=this.state;if(!this.popper.current||!this.parent)return;const o=this.popper.current.element.getBoundingClientRect(),i=this.parent.getBoundingClientRect();t>=o.left&&t<=o.left+o.width&&n>=o.top&&n<=o.top+o.height?this.handleMouseMove():t>=i.left&&t<=i.left+i.width&&n>=i.top&&n<=i.top+i.height?this.handleMouseMove():s&&(this.stopTimer(),this.hide())}startTimer(){this.stopTimer();const{timeout:e,reshowTimeout:t}=this.props;let n=e;(St.shownTooltipCount>0||Date.now()-St.lastHiddenTime<St.triggerReshowThreshold)&&(n=t),this.timer=window.setTimeout(this.handleTimeout,n)}stopTimer(){this.timer!=null&&(clearTimeout(this.timer),this.timer=null)}show(){var t;const{isShown:e}=this.state;if(this.stopTimer(),!e){(t=this.popper.current)==null||t.show(),this.setState({isShown:!0});const{interactive:n}=this.props;n&&this.startListeningWindow()}}hide(){var e;(e=this.popper.current)==null||e.hide(),this.stopListeningWindow()}update(){var e;(e=this.popper.current)==null||e.scheduleUpdate()}handleExited(){this.setState({isShown:!1});const{onExited:e}=this.props;e()}stopShowingTooltip(){const{isShown:e}=this.state;this.stopTimer(),e&&this.hide()}render(){const{interactive:e,children:t,referenceObject:n,popperClassName:s,"data-testid":o,onEntered:i}=this.props,{isShown:r}=this.state;let{options:l}=this.props;return l={placement:"bottom",...l},h("div",{ref:this.container,style:{display:"none"},"data-testid":o,children:h(En,{className:B(s),options:l,ref:this.popper,onEntered:i,onExited:this.handleExited,interactive:e,referenceObject:n,children:R("div",{className:"tooltip-content",children:[" ",r&&t]})})})}};let We=St;We.defaultTimeout=500;We.defaultReshowTimeout=100;We.triggerReshowThreshold=300;We.shownTooltipCount=0;We.lastHiddenTime=Date.now();We.defaultProps={interactive:!1,options:{},popperClassName:"",reshowTimeout:St.defaultReshowTimeout,timeout:St.defaultTimeout,onEntered:()=>{},onExited:()=>{},"data-testid":void 0};const Fd=100;var sa=(e=>(e.UP="UP",e.DOWN="DOWN",e))(sa||{});const is=class extends T.exports.Component{constructor(e){super(e),this.getCachedFilteredOptions=he((n,s)=>n.filter(o=>o.title.toLowerCase().indexOf(s.toLowerCase())>=0));let{popperOptions:t}=this.props;t={placement:"bottom-end",modifiers:{preventOverflow:{enabled:!1}},...t},this.state={title:"",filteredOptions:[],keyboardOptionIndex:0,menuIsOpen:!1,inputWidth:100,invalid:!1,popperOptions:t},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=ft(this.updateInputValue,Fd),this.handleOptionClick=this.handleOptionClick.bind(this),this.handleMenuOpened=this.handleMenuOpened.bind(this),this.handleMenuExited=this.handleMenuExited.bind(this),this.popper=te.createRef(),this.cbContainer=te.createRef(),this.menuContainer=te.createRef(),this.input=te.createRef()}setInputWidth(){this.cbContainer.current&&this.setState({inputWidth:this.cbContainer.current.getBoundingClientRect().width})}getValueAndValidate(e){if(!e)return this.setState({invalid:!1}),{value:e,isValid:!1};const{options:t}=this.props,n=t.filter(s=>s.title.toLowerCase()===e.toLowerCase());return n.length<1?(this.setState({invalid:!0}),{value:e,isValid:!1}):(this.setState({invalid:!1}),{value:n[0].value,isValid:!0})}updateInputValue(e){const{menuIsOpen:t}=this.state,{value:n,isValid:s}=this.getValueAndValidate(e);t&&this.processFilterChange(e),this.fireOnChange(n,s)}fireOnChange(e,t=!0){const{onChange:n}=this.props;n(e,t)}processFilterChange(e){var i;const{options:t}=this.props,{menuIsOpen:n}=this.state,s=e?this.getCachedFilteredOptions(t,e):t,o=s.length===1&&s[0].title===e;if(this.setState({filteredOptions:s,keyboardOptionIndex:0}),o&&n){this.closeMenu();return}(i=this.popper.current)==null||i.scheduleUpdate()}resetValue(){this.setState({title:""}),this.fireOnChange("")}handleResize(){this.setInputWidth()}handleMenuKeyDown(e){var o;const{filteredOptions:t,keyboardOptionIndex:n}=this.state,s=t[n];switch(e.key){case"Enter":case"ArrowRight":e.stopPropagation(),e.preventDefault(),s!=null&&(this.setState({title:s.title,invalid:!1}),this.fireOnChange(s.value)),this.closeMenu(),(o=this.input.current)==null||o.focus();break;case"ArrowUp":e.stopPropagation(),e.preventDefault(),this.navigateMenu(is.MENU_NAVIGATION_DIRECTION.UP);break;case"ArrowDown":e.stopPropagation(),e.preventDefault(),this.navigateMenu(is.MENU_NAVIGATION_DIRECTION.DOWN);break;case"Tab":if(e.stopPropagation(),e.preventDefault(),e.shiftKey){this.navigateMenu(is.MENU_NAVIGATION_DIRECTION.UP);break}this.navigateMenu(is.MENU_NAVIGATION_DIRECTION.DOWN);break;case"Escape":e.preventDefault(),e.stopPropagation(),this.closeMenu();break}}navigateMenu(e){const{filteredOptions:t,keyboardOptionIndex:n}=this.state;let s=n;e===is.MENU_NAVIGATION_DIRECTION.UP?n>0?(s=(s-1)%t.length,this.setState({keyboardOptionIndex:s})):n===0&&(s=t.length-1,this.setState({keyboardOptionIndex:s})):e===is.MENU_NAVIGATION_DIRECTION.DOWN&&n<t.length&&(s=(s+1)%t.length,this.setState({keyboardOptionIndex:s})),this.scrollOptionIntoView(s)}handleInputKeyDown(e){const{onEnter:t}=this.props,{menuIsOpen:n}=this.state;n?this.handleMenuKeyDown(e):e.key==="Enter"?t():e.key==="Escape"?(this.resetValue(),e.preventDefault(),e.stopPropagation()):e.key==="ArrowRight"||e.key==="ArrowLeft"||e.key==="Tab"||e.key==="Shift"||this.openMenu()}handleInputChange(e){this.setState({title:e.target.value}),this.updateInputValue(e.target.value)}handleOptionClick(e){var t;this.setState({title:e.title,invalid:!1}),this.fireOnChange(e.value),this.closeMenu(),(t=this.input.current)==null||t.focus()}handelInputFocus(){const{menuIsOpen:e}=this.state;e||this.openMenu()}handleInputClick(){const{menuIsOpen:e}=this.state;e||this.openMenu()}handleInputBlur(e){const{menuIsOpen:t}=this.state;t&&e.relatedTarget instanceof Element&&this.popper.current!==null&&this.popper.current.element.contains(e.relatedTarget)||this.closeMenu(!1)}handleMenuBlur(e){e.relatedTarget===this.input.current||e.relatedTarget instanceof Element&&this.popper.current!==null&&this.popper.current.element.contains(e.relatedTarget)||this.closeMenu(!1)}handleMenuOpened(){var e;(e=this.input.current)==null||e.focus()}handleMenuExited(){const{menuIsOpen:e}=this.state;e&&this.setState({menuIsOpen:!1,keyboardOptionIndex:0})}openMenu(){const{title:e}=this.state;this.processFilterChange(e),this.setInputWidth(),this.setState({menuIsOpen:!0}),window.requestAnimationFrame(()=>{var t;(t=this.popper.current)==null||t.show()})}closeMenu(e=!0){var t,n;this.setState({menuIsOpen:!1,keyboardOptionIndex:0}),e&&((t=this.input.current)==null||t.focus()),(n=this.popper.current)==null||n.hide()}scrollOptionIntoView(e){var t;this.menuContainer.current&&((t=this.menuContainer.current.children.item(e))==null||t.scrollIntoView({behavior:"smooth",block:"nearest"}))}renderMenuElement(){const{inputWidth:e}=this.state;return h("div",{className:B("aci-options"),ref:this.menuContainer,role:"presentation",onKeyDown:this.handleMenuKeyDown,style:{width:e},onBlur:this.handleMenuBlur,children:this.renderOptions()})}renderOptions(){const{noMatchText:e}=this.props,{title:t,filteredOptions:n}=this.state;return t&&n.length===0?h("div",{className:"no-match",children:e}):n.map((s,o)=>this.renderOption(s,o))}renderOption(e,t){const{keyboardOptionIndex:n}=this.state,s=`option-${t}-${e.value}`;return h("button",{type:"button",className:B("aci-option-btn",{"keyboard-active":n===t}),onClick:()=>this.handleOptionClick(e),onFocus:()=>this.setState({keyboardOptionIndex:t}),children:e.title},s)}render(){const{options:e,inputPlaceholder:t,disabled:n,className:s,defaultTitle:o,spellCheck:i,"data-testid":r}=this.props,{title:l,menuIsOpen:a,popperOptions:c,invalid:d}=this.state;return R("div",{className:"aci-container",ref:this.cbContainer,children:[h("input",{value:l||o,className:B("form-control",s,"aci-input",{"is-invalid":d&&!a}),ref:this.input,onChange:this.handleInputChange,placeholder:t||e[0].title,disabled:n,onFocus:this.handelInputFocus,onClick:this.handleInputClick,onBlur:this.handleInputBlur,onKeyDown:this.handleInputKeyDown,spellCheck:i,"data-testid":r}),h(En,{ref:this.popper,options:c,className:B("aci-options-popper interactive"),onEntered:this.handleMenuOpened,onExited:this.handleMenuExited,children:this.renderMenuElement()})]})}};let hr=is;hr.propTypes={options:D.exports.arrayOf(D.exports.shape({title:D.exports.string.isRequired,value:D.exports.string.isRequired})).isRequired,popperOptions:D.exports.shape({}),onChange:D.exports.func,inputPlaceholder:D.exports.string,disabled:D.exports.bool,className:D.exports.string,defaultTitle:D.exports.string,spellCheck:D.exports.bool,onEnter:D.exports.func,noMatchText:D.exports.string,"data-testid":D.exports.string};hr.defaultProps={onChange(){},inputPlaceholder:"",disabled:!1,className:"",defaultTitle:"",popperOptions:null,spellCheck:!0,onEnter(){},noMatchText:"No matching items found","data-testid":void 0};hr.MENU_NAVIGATION_DIRECTION=sa;D.exports.string.isRequired,D.exports.func.isRequired,D.exports.string,D.exports.string,D.exports.bool,D.exports.bool,D.exports.string,D.exports.string,D.exports.string;D.exports.node.isRequired,D.exports.string,D.exports.object,D.exports.string;const xd=["primary","secondary","tertiary","success","danger","inline","ghost"],Ad=["group-end"];function Od(e,t){switch(e){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 B("btn-link",{"btn-link-icon":t,"btn-link-icon-only":t})}}function kd(e){switch(e){case"group-end":return B("pl-2","pr-3")}}const X=te.forwardRef((e,t)=>{const{kind:n,variant:s,type:o,tooltip:i,icon:r,disabled:l=!1,active:a,onClick:c,onContextMenu:d,onMouseDown:u,onMouseUp:m,onMouseEnter:p,onMouseLeave:g,onKeyDown:f,className:w,style:C,children:S,tabIndex:b,"data-testid":E,"aria-label":v}=e,y=Boolean(r&&S==null),M=Od(n,y);let A;s&&(A=kd(s));let F;r&&(F=te.isValidElement(r)?r:h(Z,{icon:r}));let V;i!==void 0&&(V=typeof i=="string"?h(We,{children:i}):i);let H=v;v===void 0&&y&&i!=null&&typeof i=="string"&&(H=i);const N=R("button",{"data-testid":E,ref:t,type:o,className:B("btn",M,A,{active:a},w),onClick:c,onContextMenu:d,onMouseUp:m,onMouseDown:u,onMouseEnter:p,onMouseLeave:g,onKeyDown:f,style:C,disabled:l,tabIndex:b,"aria-label":H,children:[r&&F,S,i!=null&&!l&&V]});return l?R("span",{className:"btn-disabled-wrapper",children:[N,i!==void 0&&V]}):N});X.displayName="Button";X.propTypes={kind:D.exports.oneOf(xd).isRequired,variant:D.exports.oneOf(Ad),type:D.exports.oneOf(["submit","reset","button"]),tooltip(e){const{tooltip:t,icon:n,children:s}=e;return t===void 0&&n!=null&&s==null?new Error("Tooltip is required for icon only buttons"):null},icon(e){const{children:t,icon:n}=e;return n==null&&t==null?new Error("Icon is required if no children are provided"):t==null&&!te.isValidElement(n)&&(n==null||n.iconName===""||n.iconName==null)?new Error("Icon must be react element or fontawesome IconDefinition"):null},disabled:D.exports.bool,active:D.exports.bool,onClick(e){const{onClick:t,type:n}=e;return n==="button"&&typeof t!="function"?new Error("type button requires an onClick function"):t!==void 0&&typeof t!="function"?new Error("onClick must be a function"):null},onContextMenu:D.exports.func,onMouseUp:D.exports.func,onMouseDown:D.exports.func,onMouseEnter:D.exports.func,onMouseLeave:D.exports.func,onKeyDown:D.exports.func,tabIndex:D.exports.number,children:D.exports.node,className:D.exports.string,style:D.exports.object,"data-testid":D.exports.string};X.defaultProps={type:"button",onClick:void 0,onContextMenu:void 0,onMouseUp:void 0,onMouseDown:void 0,onMouseEnter:void 0,onMouseLeave:void 0,onKeyDown:void 0,variant:void 0,tooltip:void 0,icon:void 0,disabled:!1,active:void 0,tabIndex:void 0,children:void 0,className:void 0,style:{},"data-testid":void 0};function Ld({className:e="theme-bg-light",children:t,role:n="role",keyboard:s=!0,isOpen:o=!1,centered:i=!1,size:r,onOpened:l,onClosed:a,toggle:c,"data-testid":d}){const u=T.exports.useRef(),m=T.exports.useRef(null),[p,g]=T.exports.useState(!1),f=T.exports.useCallback(C=>{switch(C.key){case"Escape":c==null||c();break}},[c]);T.exports.useEffect(function(){if(o&&s)return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[f,o,s]),T.exports.useEffect(function(){o&&l&&l()},[l,o]),T.exports.useEffect(function(){!o&&a&&a()},[a,o]),o&&!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 w=()=>{u.current&&(document.body.removeChild(u.current),u.current=void 0)};return u.current?ar.createPortal(R(Fe,{children:[h(dt,{appear:!0,mountOnEnter:!0,unmountOnExit:!0,in:o,classNames:{appearActive:"show",appearDone:"show"},timeout:Le.transitionMs,onExited:w,children:h("div",{className:B("modal-backdrop fade"),style:{zIndex:1050}})}),h(dt,{appear:!0,mountOnEnter:!0,unmountOnExit:!0,in:o,classNames:{appearDone:"show"},timeout:Le.transitionMs,onExited:w,children:h("div",{ref:m,className:"modal fade",onMouseDown:C=>{C.target===m.current?g(!0):g(!1)},onMouseUp:C=>{p&&C.target===m.current&&c!==void 0&&c()},role:"dialog",style:{display:"block"},children:h("div",{className:B(`modal-dialog ${e}`,{"modal-lg":r==="lg","modal-sm":r==="sm","modal-xl":r==="xl","modal-dialog-centered":i}),style:{zIndex:1040},children:h("div",{className:"modal-content",role:"presentation","data-testid":d,children:t})})})})]}),u.current):null}function Pd({className:e="modal-body",style:t,children:n,"data-testid":s}){return h("div",{className:e,"data-testid":s,style:t,children:n})}function Hd({className:e,children:t,closeButton:n=!0,style:s,toggle:o,"data-testid":i}){return R("div",{className:`modal-header ${e}`,style:s,children:[h("h5",{className:"modal-title",children:t}),n&&h("button",{type:"button",className:"close","data-dismiss":"modal","aria-label":"Close",onClick:o,children:h("span",{"aria-hidden":"true",children:"\xD7"})})]})}D.exports.bool.isRequired,D.exports.string.isRequired,D.exports.oneOfType([D.exports.string,D.exports.func]).isRequired,D.exports.func,D.exports.func.isRequired,D.exports.func,D.exports.func,D.exports.string,D.exports.string,D.exports.string,D.exports.node,D.exports.string;const mr=te.forwardRef((e,t)=>{const{children:n,className:s,disabled:o,onClick:i,style:r,id:l}=e;return h("button",{ref:t,type:"button",className:B("btn",s),onClick:i,style:r,disabled:o,id:l,children:n})});mr.displayName="Button";mr.propTypes={children:D.exports.node,className:D.exports.string,disabled:D.exports.bool,onClick:D.exports.func,style:D.exports.shape({}),id:D.exports.string};mr.defaultProps={children:null,className:"",disabled:!1,onClick:()=>null,style:{},id:""};function _i(e){return e.then!==void 0}const Os=class{static disableAllActions(){Os.actionsDisabled=!0}static enableAllActions(){Os.actionsDisabled=!1}static isContextActionEvent(e){return Array.isArray(e.contextActions)}static compareActions(e,t){var n,s,o,i,r,l;return e.group!==t.group?((n=e.group)!=null?n:0)>((s=t.group)!=null?s:0)?1:-1:e.order!==t.order?((o=e.order)!=null?o:0)>((i=t.order)!=null?i:0)?1:-1:e.title!==t.title?((r=e.title)!=null?r:"")>((l=t.title)!=null?l:"")?1:-1:e!==t?e>t?1:-1:0}static sortActions(e){if(e==null||!Array.isArray(e))return[];const t=e.slice();return t.sort(Os.compareActions),t}static isMacPlatform(){const{platform:e}=window.navigator;return e.startsWith("Mac")}static getModifierKey(){return Os.isMacPlatform()?"metaKey":"ctrlKey"}static isModifierKeyDown(e){const t=Os.getModifierKey();return e[t]}static getMenuItems(e,t=!0){let n=[],s=e;Array.isArray(s)||(s=[s]);for(let o=0;o<s.length;o+=1){const i=s[o];let r;typeof i=="function"?r=i():r=i,r!=null&&(r instanceof Promise?t&&n.push(r):Array.isArray(r)?n=n.concat(r):n.push(r))}return n=n.filter(o=>o.title!==void 0||o.then!=null||o.menuElement),n}static getNextMenuItem(e,t,n){let s=e;s<0&&t<0&&(s=n.length);for(let o=1;o<n.length+1;o+=1){const i=(s+t*o+n.length)%n.length,r=n[i];if(!(r instanceof Promise)&&r.disabled!==!0)return i}return e}};let Ne=Os;Ne.actionsDisabled=!1;const nl=se.module("GlobalContextAction");class _d extends T.exports.Component{constructor(t){super(t),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(t){const n=t;n.contextActions==null&&(n.contextActions=[]);const{action:s}=this.props;s.title==null&&!s.menuElement||(n.contextActions==null&&(n.contextActions=[]),n.contextActions.push(s),nl.debug("Received context menu event at global action! Menu items are now: ",n.contextActions))}handleKeyDown(t){var s;const{action:n}=this.props;!Ne.actionsDisabled&&n.shortcut!==void 0&&n.shortcut.matchesEvent(t)&&(nl.debug("Global hotkey matched!",t),(s=n.action)==null||s.call(n,t),t.preventDefault(),t.stopPropagation())}render(){return null}}class Vd extends T.exports.Component{render(){const{actions:t,"data-testid":n}=this.props,s=[];for(let o=0;o<t.length;o+=1){const i=t[o],{shortcut:r}=i;if(i.title!=null||i.menuElement||r){const l=h(_d,{action:i,"data-testid":n},`${i.title}.${r==null?void 0:r.id}`);s.push(l)}}return s}}const zo=se.module("ContextActions");class re extends T.exports.Component{constructor(t){super(t),this.handleContextMenu=this.handleContextMenu.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.container=te.createRef(),this.state={globalActions:[],keyboardActions:[]}}static triggerMenu(t,n,s,o){if(o.length===0)return;const i=new MouseEvent("contextmenu",{clientX:n,clientY:s,bubbles:!0,cancelable:!0});i.contextActions=o,t.dispatchEvent(i)}static getDerivedStateFromProps(t){if(t.actions==null||!Array.isArray(t.actions))return{globalActions:[],keyboardActions:[]};const n=t.actions.filter(o=>!_i(o)&&typeof o!="function"&&o.isGlobal),s=t.actions.filter(o=>!_i(o)&&typeof o!="function"&&(o.isGlobal===void 0||!o.isGlobal)&&o.shortcut!=null);return{globalActions:n,keyboardActions:s}}componentDidMount(){var t;(t=this.container.current)!=null&&t.parentElement&&(this.container.current.parentElement.addEventListener("contextmenu",this.handleContextMenu),this.container.current.parentElement.addEventListener("keydown",this.handleKeyDown))}componentWillUnmount(){var t;(t=this.container.current)!=null&&t.parentElement&&(this.container.current.parentElement.removeEventListener("contextmenu",this.handleContextMenu),this.container.current.parentElement.removeEventListener("keydown",this.handleKeyDown))}handleContextMenu(t){const{ignoreClassNames:n=[]}=this.props;if(n.length>0){let o=t.target;for(;o!=null;){const{classList:i}=o,r=n.find(l=>i.contains(l));if(r!==void 0){zo.debug2(`Contextmenu event ignored based on the target className "${r}"`);return}o=o.parentElement}}if(Ne.isContextActionEvent(t)||(t.contextActions=[]),!Ne.isContextActionEvent(t))return;const{actions:s}=this.props;if(s!=null){let o=s;Array.isArray(o)&&(o=o.filter(i=>_i(i)||typeof i=="function"||i.isGlobal===void 0||!i.isGlobal)),t.contextActions=t.contextActions.concat(o)}zo.debug("Received context menu event! Menu items are now: ",t.contextActions)}handleKeyDown(t){var s;const{keyboardActions:n}=this.state;for(let o=0;o<n.length;o+=1){const i=n[o];!Ne.actionsDisabled&&i.shortcut!=null&&i.shortcut.matchesEvent(t)&&(zo.debug("Context hotkey matched!",t),(s=i.action)==null||s.call(i,t),t.stopPropagation(),t.preventDefault(),zo.debug2("Matched hotkey returned false, key event not consumed"))}}render(){const{"data-testid":t}=this.props,{globalActions:n}=this.state;return h("div",{className:"context-actions-listener",ref:this.container,"data-testid":t,children:h(Vd,{actions:n})})}}re.groups={default:null,high:100,medium:5e3,low:1e4,global:1e5,edit:100};var Ud={prefix:"vs",iconName:"add",icon:[512,512,[],"f000","M448 224v32H256v192H224V256H32V224h192V32h32v192h192z"]},Bd={prefix:"vs",iconName:"arrow-down",icon:[512,512,[],"f000","m100.704 288 160 160h22.624l160 -160 -22.624 -22.624L288 398.048V64H256v334.08L123.328 265.344 100.704 288z"]},Gd={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"]},zd={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"]},Xn={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"]},Wd={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"]},$d={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"]},oa={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"]},qd={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"]},Kd={prefix:"vs",iconName:"chrome-close",icon:[512,512,[],"f000","m227.712 256 -145.856 145.856 28.288 28.288L256 284.288l145.856 145.856 28.288 -28.288L284.288 256l145.856 -145.856 -28.288 -28.288L256 227.712 110.144 81.856l-28.288 28.288L227.712 256z"]},fi={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"]},Xd={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"]},sl={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"]},go={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"]},Yd={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"]},Qd={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"]},pr={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"]},ol={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"]},jd={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"]},Zd={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"]},oi={prefix:"vs",iconName:"filter",icon:[512,512,[],"f000","M480 64v53.44l-160 152.288V448H192V269.728l-160 -152.32V64h448zM224 256v160h64V256l160 -152.32V96H64v7.68L224 256z"]},Jd={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"]},ia={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"]},Ci={prefix:"vs",iconName:"gripper",icon:[512,512,[],"f000","M160 96h64v64H160zm0 128h64v64H160zm0 128h64v64H160zm128 -256h64v64H288zm0 128h64v64H288zm0 128h64v64H288z"]},eu={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"]},nu={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"]},ra={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"]},su={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"]},la={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"]},ou={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"]},iu={prefix:"vs",iconName:"menu",icon:[512,512,[],"f000","M512 160H0V128h512v32zm0 256H0v-32h512v32zm0 -128.256H0V256h512v31.744z"]},ru={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"]},lu={prefix:"vs",iconName:"paintcan",icon:[512,512,[],"f000","m465.28 377.952 -36.48 -99.84v-1.92l-157.12 -157.12v-39.68a53.12 53.12 0 0 0 -3.52 -18.56 47.36 47.36 0 0 0 -26.56 -25.6 45.44 45.44 0 0 0 -18.56 -3.2 47.04 47.04 0 0 0 -47.36 47.36v104.32l-97.92 96a48.64 48.64 0 0 0 0 67.84l116.16 116.16c4.48 4.512 9.824 8.096 15.68 10.56a48.96 48.96 0 0 0 36.48 0 48.32 48.32 0 0 0 15.68 -10.56l157.76 -157.44 -21.12 70.4a38.08 38.08 0 0 0 0 14.72c1.056 4.864 3.136 9.472 6.08 13.44 3.136 3.872 6.912 7.136 11.2 9.6 4.48 2.24 9.408 3.52 14.4 3.84a32 32 0 0 0 15.36 -2.88 36.48 36.48 0 0 0 12.48 -9.28 31.36 31.36 0 0 0 7.04 -14.08c1.024 -4.64 1.12 -9.408 0.32 -14.08zm-256 -298.56a14.72 14.72 0 0 1 0 -6.4 16.64 16.64 0 0 1 3.84 -5.44 20.48 20.48 0 0 1 5.76 -3.2 16 16 0 0 1 6.72 0 16 16 0 0 1 10.24 4.8 16 16 0 0 1 3.84 10.56v40.32l-32 32 1.6 -72.64zm32 363.2a11.52 11.52 0 0 1 -5.12 3.52 15.04 15.04 0 0 1 -12.16 0 11.552 11.552 0 0 1 -5.12 -3.52l-116.16 -115.84a16 16 0 0 1 0 -22.72l139.2 -139.2v91.2a23.68 23.68 0 0 0 -7.68 17.6 24 24 0 1 0 37.44 -17.6v-90.56l123.2 123.84 -153.6 153.28z"]},au={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"]},aa={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"]},cu={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"]},du={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"]},uu={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"]},cn={prefix:"vs",iconName:"remove",icon:[512,512,[],"f000","M480 256H32V224h448v32z"]},hu={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"]},mu={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"]},ca={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"]},pu={prefix:"vs",iconName:"split-horizontal",icon:[512,512,[],"f000","M448 32H96L64 64v352l32 32h352l32 -32V64l-32 -32zM256 416H96V64h160v352zm192 0H288V64h160v352z"]},gu={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"]},fu={prefix:"vs",iconName:"symbol-structure",icon:[512,512,[],"f000","M64 64 32 96v96l32 32h384l32 -32V96l-32 -32H64zm0 32h384v96H64V96zm-32 224 32 -32h96l32 32v96l-32 32H64l-32 -32v-96zm64 0H64v96h96v-96H96zm224 0 32 -32h96l32 32v96l-32 32h-96l-32 -32v-96zm64 0h-32v96h96v-96h-64z"]},il={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"]},Cu={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"]},Rn={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"]},$n={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"]},da={prefix:"vs",iconName:"triangle-right",icon:[512,512,[],"f000","M177.92 448 160 434.784V76.576L177.28 64 352 244.064v26.464L177.92 448z"]},Yn={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"]},wu={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"]},Su={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"]},bu={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"]},vu={prefix:"dh",iconName:"exclamation",icon:[512,512,[],"f000","M275.2 384v-32H236.8v32h38.4zm-38.4 -64V128h38.4v192H236.8z"]},ua={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"]},gr={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"]},Tu={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"]},Eu={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"]},Ru={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"]},fr={prefix:"dh",iconName:"filter-filled",icon:[512,512,[],"f000","M480 64v54.4l-160 153.6V448H192V268.8L32 118.4V64h448z"]},yu={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"]},Vi={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"]},Iu={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"]},Mu={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"]},Bs={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"]},Du={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"]},Nu={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"]},Fu={prefix:"dh",iconName:"remove-square-filled",icon:[512,512,[],"f000","M432 32h-384l-16 16v384l16 16h384l16 -16v-384l-16 -16zM352 256H128V224h224v32z"]},Cr={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"]},wr={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"]},rl={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"]},xu={prefix:"dh",iconName:"sort-down",icon:[512,512,[],"f000","m128 288 -12.8 25.6 128 118.4h25.6l128 -118.4L384 288H128z"]},Au={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"]},Sr={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"]},ii={prefix:"dh",iconName:"square-filled",icon:[512,512,[],"f000","M432 32h-384l-16 16v384l16 16h384l16 -16v-384l-16 -16z"]},br={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"]},Ou={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"]},ku={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"]},Lu={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"]},ll={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"]},ha={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 wi=te.forwardRef((e,t)=>{var w,C;function n(S){const{menuItem:b,onMenuItemClick:E}=e;E(b,S)}function s(S){const{menuItem:b,onMenuItemMouseMove:E}=e;E(b,S)}function o(S){const{menuItem:b,onMenuItemContextMenu:E}=e;E(b,S)}function i(S,b,E){if(typeof S.type=="string")return S;const{closeMenu:v,menuItem:y,isKeyboardSelected:M,isMouseSelected:A,"data-testid":F}=e,V={menuItem:y,closeMenu:v,isKeyboardSelected:M,isMouseSelected:A,iconElement:b,displayShortcut:E,"data-testid":F};return te.cloneElement(S,{forwardedProps:V})}const{children:r,menuItem:l,isKeyboardSelected:a=!1,isMouseSelected:c=!1,"data-testid":d}=e,u=(w=l.shortcut)==null?void 0:w.getDisplayText();let m=null;if(l.icon){const S=l.icon;if(te.isValidElement(S))m=S;else{let b;l.iconColor!=null&&(l.disabled===void 0||!l.disabled)&&(b={color:l.iconColor}),m=h(Z,{icon:S,style:b})}}let p=null;const g=Boolean(r);l.actions&&(p=h(Z,{icon:oa}));let f=null;if(l.menuElement)f=h("div",{className:"custom-menu-item",onMouseMove:s,children:i(l.menuElement,m,u)});else{const S=l.disabled,b=l.iconOutline;f=h("button",{type:"button",className:B("btn-context-menu",{disabled:S},{active:(g||c)&&(S===void 0||!S)},{"keyboard-active":a&&(S===void 0||!S)}),onClick:n,onMouseMove:s,onContextMenu:o,title:(C=l.description)!=null?C:"",children:R("div",{className:"btn-context-menu-wrapper",children:[h("span",{className:B("icon",{outline:b}),children:m}),h("span",{className:"title",children:l.title}),u!==void 0&&h("span",{className:"shortcut",children:u}),p&&h("span",{className:B("submenu-indicator",{disabled:S}),children:p})]})})}return R("div",{className:"context-menu-item",ref:t,"data-testid":d,children:[r,f]})});wi.displayName="ContextMenuItem";wi.defaultProps={children:null,isKeyboardSelected:!1,isMouseSelected:!1,"data-testid":void 0};const ye=Object.freeze([]),wn=new Map;class po extends Error{constructor(){super(...arguments),this.isCanceled=!0}}class Si{static isDark(t){const n=document.createElement("div");n.style.display="none",n.style.color=t;const s=getComputedStyle(document.body.appendChild(n)).color,o=s.match(/\d+/g);let i=[];if(o)i=o.map(l=>parseInt(l,10));else throw new Error(`Invalid color received. Got ${s}`);return document.body.removeChild(n),Si.getBrightness(i)<125}static getBrightness(t){return Math.round((t[0]*299+t[1]*587+t[2]*114)/1e3)}}async function fo(e){const{clipboard:t}=navigator;if(t!==void 0)try{return navigator.clipboard.writeText(e)}catch{return al(e)}al(e)}function al(e){const t=document.activeElement,n=document.createElement("textarea");n.value=e,document.body.appendChild(n),n.focus(),n.select();const s=document.execCommand("copy");if(document.body.removeChild(n),t instanceof HTMLElement&&t.focus(),!s)throw new Error("Unable to execute copy command")}const Pu="table_",ma="column_",Hu=new Set(["in","not","i","ii","k"]),_u=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"]),Vu=/[^a-zA-Z0-9_$+@-]/g,Uu=/[^A-Za-z0-9_$]/g,Gs=class{};let _t=Gs;_t.legalize=(e,t,n,s,o)=>{let i=e.trim().replace(/[- ]/g,"_");return s&&(Hu.has(i)||_u.has(i))&&(i=t+i),i=i.replace(n,""),i||(i=t+o),Number.isNaN(Number(i.charAt(0)))||(i=t+i),i};_t.legalizeTableName=e=>Gs.legalize(e,Pu,Vu,!1,0);_t.legalizeColumnNames=e=>{const t=[];return e.forEach((n,s)=>{let o=Gs.legalizeColumnName(n,s);t.includes(o)&&(o=ma+s),t.push(o)}),t};_t.legalizeColumnName=(e,t=0)=>Gs.legalize(e,ma,Uu,!0,t);_t.isValidTableName=e=>Gs.legalizeTableName(e)===e;_t.isValidColumnName=e=>Gs.legalizeColumnName(e)===e;function Bu(e,t){return e?e.closest(`.${t}`):null}const Gu={getClosestByClassName:Bu};class Me extends CustomEvent{constructor(t,n){super(t,n)}}class vr extends Error{constructor(){super(...arguments),this.isTimeout=!0}}class Ue{static makeCancelable(t,n){let s=!1,o,i;const r=new Promise((l,a)=>{i=a,Promise.resolve(t).then(c=>{s?n&&n(c):(o=c,l(c))}).catch(c=>a(c))});return r.cancel=()=>{s=!0,i(new po),o!=null&&n&&n(o)},r}static isCanceled(t){return t instanceof po}static isTimedOut(t){return t instanceof vr}}class bi{constructor(){this.pending=[],this.resolved=[]}add(t,n){const s=Ue.makeCancelable(t,n);return this.pending.push(s),s.then(()=>{this.resolve(s)},()=>{this.resolve(s)}),s}remove(t){for(let n=0;n<this.pending.length;n+=1)if(this.pending[n]===t){this.pending.splice(n,1);return}}resolve(t){this.remove(t),this.resolved.push(t)}cancel(){const t=[...this.pending,...this.resolved];for(let n=0;n<t.length;n+=1)t[n].cancel();this.pending=[],this.resolved=[]}}function O(e){if(e==null)throw new Error("Value is null or undefined")}class Qt{static isValidRange(t){return t!=null&&t.length===2&&Number.isInteger(t[0])&&Number.isInteger(t[1])&&t[0]<=t[1]}static validateRange(t){if(!Qt.isValidRange(t))throw new Error(`Invalid range! ${t}`)}static isSelected(t,n){for(let s=0;s<t.length;s+=1){const o=t[s],i=o[0],r=o[1];if(i<=n&&n<=r)return!0}return!1}static selectRange(t,n){let[s,o]=n;const i=[...t];for(let r=i.length-1;r>=0;r-=1){const l=i[r],a=l[0],c=l[1];if(a<=s&&o<=c)return i;s<=c&&a<=o&&(s=Math.min(s,a),o=Math.max(o,c),i.splice(r,1))}return i.push([s,o]),i}static deselectRange(t,n){const[s,o]=n,i=[...t];for(let r=i.length-1;r>=0;r-=1){const l=i[r],a=l[0],c=l[1];if(!(o<a||c<s))if(a<s&&o<c){i[r]=[a,s-1],i.splice(r+1,0,[o+1,c]);break}else s<=a&&c<=o?i.splice(r,1):a<s?i[r]=[a,s-1]:i[r]=[o+1,c]}return i}static count(t){return t.reduce((n,s)=>n+(s[1]-s[0]+1),0)}static getItemsInRanges(t,n){return n.reduce((s,o)=>{const i=[...s];for(let r=o[0];r<=o[1];r+=1)i.push(t[r]);return i},[])}}class Tr{static join(t,n="and"){if(t==null||t.length===0)return"";if(t.length===1)return t[0];if(t.length===2)return`${t[0]} ${n} ${t[1]}`;const s=t.slice(0,t.length-1).join(", "),o=t[t.length-1];return`${s}, ${n} ${o}`}static toLower(t,n=!0){if(t==null){if(n)return"";throw new Error("Null string passed in to TextUtils.toLower")}return t.toLowerCase()}static sort(t,n,s=!0){return t<n?s?-1:1:t>n?s?1:-1:0}}const pa=class{static formatElapsedTime(e){if(typeof e!="number"||!Number.isInteger(e))throw new Error(`${e} is not a number that can be expressed as a formatted time`);const t=Math.floor(e/3600),n=Math.floor(e%3600/60),s=e%60;return`${t>0?`${t}h `:""}${n>0||t>0?`${n}m `:""}${e>=60?`${s}s`.padStart(3,"0"):`${s}s`}`}static formatTime(e){if(typeof e!="number"||!Number.isInteger(e)||e<0)throw new Error(`${e} is not a number that can be expressed as a formatted time`);const t=String(Math.floor(e/(60*60))).padStart(2,"0"),n=e%(60*60),s=String(Math.floor(n/60)).padStart(2,"0"),o=n%60,i=String(Math.ceil(o)).padStart(2,"0");return`${t}:${s}:${i}`}static isTimeString(e){return new RegExp(pa.TIME_PATTERN).test(e)}static parseTime(e){if(e==null||typeof e!="string")throw new Error(`${e} is not a valid string`);const t=e.split(":");if(t.length!==3)throw new Error(`${e} is not a time string that can be parsed`);return Number(t[0])*60*60+Number(t[1])*60+Number(t[2])}};let en=pa;en.TIME_PATTERN="([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]";en.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 zu extends Error{constructor(){super(...arguments),this.isInvalid=!0}}function Vt({className:e="","data-testid":t}){return R("div",{className:B("loading-spinner fa-layers",e),"data-testid":t,children:[h(Z,{icon:Xd,className:"text-white-50"}),h(Z,{icon:la,className:"text-primary",spin:!0})]})}const cl=se.module("ContextMenu"),nr=class extends T.exports.PureComponent{constructor(e){super(e),this.handleBlur=this.handleBlur.bind(this),this.handleCloseSubMenu=this.handleCloseSubMenu.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleMenuItemClick=this.handleMenuItemClick.bind(this),this.handleMenuItemContextMenu=this.handleMenuItemContextMenu.bind(this),this.handleMenuItemMouseMove=this.handleMenuItemMouseMove.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.handleWindowResize=this.handleWindowResize.bind(this),this.container=te.createRef(),this.oldFocus=document.activeElement,this.activeSubMenuRef=te.createRef(),this.subMenuTimer=0,this.rAF=0,this.initialPosition={top:e.top,left:e.left},this.state={menuItems:[],pendingItems:[],activeSubMenu:null,hasOverflow:!1,subMenuTop:null,subMenuLeft:null,subMenuParentWidth:0,subMenuParentHeight:0,keyboardIndex:-1,mouseIndex:-1}}static handleContextMenu(e){e.metaKey||(e.stopPropagation(),e.preventDefault())}componentDidMount(){this.initMenu(),this.verifyPosition(),window.addEventListener("resize",this.handleWindowResize),this.rAF=window.requestAnimationFrame(()=>{var t;(t=this.container.current)==null||t.focus();const{onMenuOpened:e}=this.props;e(this)})}componentDidUpdate(e,t){var o,i;const{actions:n}=this.props,{activeSubMenu:s}=this.state;s!==t.activeSubMenu&&(s==null?(o=this.container.current)==null||o.focus():this.setActiveSubMenuPosition()),e.actions!==n&&(this.initMenu(),(this.container.current==null||!this.container.current.contains(document.activeElement))&&((i=this.container.current)==null||i.focus())),this.verifyPosition()}componentWillUnmount(){this.cancelPromises(),window.removeEventListener("resize",this.handleWindowResize),cancelAnimationFrame(this.rAF)}getKeyboardIndex(){const{options:e}=this.props;if(e.separateKeyboardMouse!==void 0&&e.separateKeyboardMouse){const{keyboardIndex:t}=this.state;return t}return this.getMouseIndex()}setKeyboardIndex(e){const{options:t}=this.props;t.separateKeyboardMouse!==void 0&&t.separateKeyboardMouse?this.setState({keyboardIndex:e}):this.setMouseIndex(e)}getMouseIndex(){const{mouseIndex:e}=this.state;return e}setMouseIndex(e){this.setState({mouseIndex:e})}initMenu(){this.cancelPromises(),cancelAnimationFrame(this.rAF);const{options:e}=this.props;let t=e.initialKeyboardIndex;t===void 0&&(t=-1);const{actions:n}=this.props,s=Ne.getMenuItems(n),o=[];for(let i=s.length-1;i>=0;i-=1){const r=s[i];r instanceof Promise?this.initMenuPromise(r):o.push(r)}this.setState({mouseIndex:-1,keyboardIndex:t,activeSubMenu:null,menuItems:Ne.sortActions(o)})}initMenuPromise(e){const t=Ue.makeCancelable(e);this.setState(n=>({pendingItems:n.pendingItems.concat(t)})),t.then(n=>{this.setState(s=>{const o=s.pendingItems.indexOf(t);if(o>=0){const i=s.pendingItems.slice();return i.splice(o,1),{menuItems:Ne.sortActions(s.menuItems.concat(n)),pendingItems:i}}return null})},n=>{Ue.isCanceled(n)||(this.setState(s=>{const o=s.pendingItems.indexOf(t);if(o>=0){const i=s.pendingItems.slice();return i.splice(o,1),{pendingItems:i}}return null}),cl.error(n))})}cancelPromises(){const{pendingItems:e}=this.state;e.map(t=>t.cancel())}setActiveSubMenuPosition(){if(this.activeSubMenuRef.current===null)return;const e=this.activeSubMenuRef.current.getBoundingClientRect();this.setState({subMenuTop:e.top,subMenuLeft:e.right,subMenuParentHeight:e.height,subMenuParentWidth:e.width})}verifyPosition(){var u,m,p,g;const{options:e,updatePosition:t,subMenuParentWidth:n,subMenuParentHeight:s,top:o,left:i}=this.props;if(!this.container.current||e.doNotVerifyPosition!=null&&e.doNotVerifyPosition)return;let{top:r,left:l}=this.initialPosition;const{width:a,height:c}=(m=(u=this.container.current)==null?void 0:u.getBoundingClientRect())!=null?m:{width:0,height:0},d=((g=(p=this.container.current)==null?void 0:p.scrollHeight)!=null?g:0)>window.innerHeight;c===0||a===0||(r+c>window.innerHeight&&(r-c-s>0?r-=c-s:r=window.innerHeight-c),l+a>window.innerWidth&&(l=l-a-n),(i!==l||o!==r)&&(this.setState({hasOverflow:d}),t(r,l)))}handleWindowResize(){!this.container.current||this.closeMenu(!0)}handleBlur(e){if(!this.container.current){cl.warn("Container is null!");return}if(!this.container.current.contains(e.relatedTarget)){let t=e.relatedTarget,n=!1;for(;t&&!n;)n=t.hasAttribute("data-dh-context-menu"),t=t.parentElement;n||this.closeMenu(!0)}}isEscapeKey(e){const{left:t}=this.props;return e==="Escape"||t<0&&e==="ArrowRight"||e==="ArrowLeft"}handleKeyDown(e){const{menuItems:t}=this.state,n=this.getKeyboardIndex();let s=n,o=!1;if(e.key==="Enter"||e.key===" "){n>=0&&n<t.length&&this.handleMenuItemClick(t[n],e);return}if(e.key==="ArrowRight"?n>=0&&n<=t.length?o=!0:s=0:this.isEscapeKey(e.key)?s=null:e.key==="ArrowUp"||e.shiftKey&&e.key==="Tab"?s=Ne.getNextMenuItem(s,-1,t):(e.key==="ArrowDown"||e.key==="Tab")&&(s=Ne.getNextMenuItem(s,1,t)),o){this.openSubMenu(n),e.preventDefault(),e.stopPropagation();return}n!==s&&(s!==null?this.setKeyboardIndex(s):(this.closeMenu(),this.oldFocus instanceof HTMLElement&&this.oldFocus.focus()),e.preventDefault(),e.stopPropagation())}openSubMenu(e){const{menuItems:t,activeSubMenu:n}=this.state,s=t[e].actions?e:null;n!==s&&this.setState({activeSubMenu:s,subMenuTop:null,subMenuLeft:null})}closeMenu(e=!1){const{closeMenu:t,onMenuClosed:n}=this.props;cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{t(e),n(this)})}closeSubMenu(){this.setState({activeSubMenu:null})}handleCloseSubMenu(e){e?this.closeMenu(!0):this.closeSubMenu()}handleMenuItemClick(e,t){t.preventDefault(),t.stopPropagation();const{menuItems:n}=this.state;e!=null&&(e.disabled===void 0||!e.disabled)&&(e.actions!=null?this.openSubMenu(n.indexOf(e)):e.action!=null&&(e.action(),this.closeMenu(!0)))}handleMenuItemContextMenu(e,t){t.metaKey||this.handleMenuItemClick(e,t)}handleMenuItemMouseMove(e){const{menuItems:t}=this.state,n=t.indexOf(e);this.setMouseIndex(n),n>=0&&n<t.length&&(e.disabled===void 0||!e.disabled)&&this.openSubMenu(n)}handleMouseLeave(){this.setMouseIndex(-1)}render(){const e=[],{top:t,left:n}=this.props,{activeSubMenu:s,hasOverflow:o,keyboardIndex:i,menuItems:r,mouseIndex:l,pendingItems:a,subMenuTop:c,subMenuLeft:d,subMenuParentWidth:u,subMenuParentHeight:m}=this.state;for(let C=0;C<r.length;C+=1){const S=r[C];C>0&&S.group!==r[C-1].group&&e.push(h("hr",{},`${C}.separator`));const b=h(wi,{ref:s===C?this.activeSubMenuRef:null,isKeyboardSelected:i===C,isMouseSelected:l===C,menuItem:S,closeMenu:this.handleCloseSubMenu,onMenuItemClick:this.handleMenuItemClick,onMenuItemMouseMove:this.handleMenuItemMouseMove,onMenuItemContextMenu:this.handleMenuItemContextMenu},C);e.push(b)}let p=null;a.length>0&&(p=h("div",{className:"loading",children:h(Vt,{})}));const{menuStyle:g,"data-testid":f}=this.props,w=s!==null&&c!==null&&d!==null;return R(Fe,{children:[R("div",{className:B({"has-overflow":o},"context-menu-container"),style:{top:t,left:n,...g},ref:this.container,"data-dh-context-menu":!0,onBlur:this.handleBlur,onKeyDown:this.handleKeyDown,onMouseLeave:this.handleMouseLeave,onContextMenu:nr.handleContextMenu,role:"menuitem",tabIndex:0,"data-testid":f,children:[e,p]}),w&&s!==null&&c!==null&&d!==null&&h(nr,{actions:r[s].actions||[],closeMenu:this.handleCloseSubMenu,top:c,left:d,updatePosition:(C,S)=>{this.setState({subMenuTop:C,subMenuLeft:S})},subMenuParentWidth:u,subMenuParentHeight:m},`sub-${s}`)]})}};let ga=nr;ga.defaultProps={subMenuParentWidth:0,subMenuParentHeight:0,closeMenu(){},onMenuOpened(){},onMenuClosed(){},options:{},menuStyle:{},"data-testid":void 0};class Wu extends T.exports.Component{constructor(t){super(t),this.handleMenuClose=this.handleMenuClose.bind(this),this.handleContextMenu=this.handleContextMenu.bind(this),this.container=te.createRef(),this.openMenu=te.createRef(),this.state={actions:null,left:0,top:0}}componentDidMount(){var t;(t=this.container.current)!=null&&t.parentElement&&this.container.current.parentElement.addEventListener("contextmenu",this.handleContextMenu)}componentWillUnmount(){var t;(t=this.container.current)!=null&&t.parentElement&&this.container.current.parentElement.removeEventListener("contextmenu",this.handleContextMenu)}handleContextMenu(t){if(!Ne.isContextActionEvent(t)||!this.container.current||t.metaKey||t.ctrlKey)return;const n=Ne.getMenuItems(t.contextActions),s=this.container.current.getBoundingClientRect(),o=t.clientY-s.top,i=t.clientX-s.left;if(n.length===0){if(t.target===this.container.current){t.preventDefault(),this.setState({actions:null},()=>{const r=document.elementFromPoint(i,o),l=new MouseEvent("contextmenu",{clientX:t.clientX,clientY:t.clientY,bubbles:!0,cancelable:!0});r==null||r.dispatchEvent(l)});return}return}t.preventDefault(),this.setState({actions:n,top:o,left:i})}handleMenuClose(t){t===this.openMenu.current&&this.setState({actions:null})}render(){let t=null;const{"data-testid":n}=this.props,{actions:s,top:o,left:i}=this.state;return s&&(t=h(ga,{ref:this.openMenu,actions:s,onMenuClosed:this.handleMenuClose,top:o,left:i,updatePosition:(r,l)=>{this.setState({top:r,left:l})},"data-testid":n})),h("div",{className:B("context-menu-root",{active:s}),ref:this.container,children:t})}}const rs=class extends T.exports.Component{static handleEnter(e){const t=e;t.style.height="0"}static handleEntering(e){const t=e;t.style.height=`${rs.getHeight(t)}px`}static handleExiting(e){const t=e;t.style.height="0"}static handleExit(e){const t=e;t.style.height=`${rs.getHeight(t)}px`}static getHeight(e){const t=e.scrollWidth-e.clientWidth;return e.scrollHeight-t}constructor(e){super(e),this.handleEntered=this.handleEntered.bind(this)}handleEntered(e){const t=e;t.style.height="";const{autoFocusOnShow:n}=this.props;if(n!==void 0&&n){const s=t.querySelector("input, select, textarea");s!=null&&s.focus()}}render(){const{children:e,className:t,in:n,"data-testid":s}=this.props;return h(dt,{in:n,classNames:{enterActive:"collapsing",enterDone:"collapse show",exitActive:"collapsing",exitDone:"collapse"},onEnter:rs.handleEnter,onEntering:rs.handleEntering,onEntered:this.handleEntered,onExit:rs.handleExit,onExiting:rs.handleExiting,timeout:350,children:o=>h("div",{className:B({collapse:o==="exited"},t),"data-testid":s,children:e})})}};let fa=rs;fa.propTypes={className:D.exports.string,in:D.exports.bool.isRequired,children:D.exports.node.isRequired,autoFocusOnShow:D.exports.bool,"data-testid":D.exports.string};fa.defaultProps={className:"",autoFocusOnShow:!1,"data-testid":void 0};function Er(e){const t=T.exports.useRef();return T.exports.useEffect(function(){t.current=e}),t.current}function Ca(e){const t=T.exports.useRef(null);return T.exports.useEffect(function(){!e||(typeof e=="function"?e(t.current):e.current=t.current)}),t}const $u=3500,qu=se.module("useCopyToClipboard");function Ku(){const[e,t]=T.exports.useState(!1),n=T.exports.useRef(null),s=T.exports.useCallback(o=>{fo(o).then(()=>{t(!0)}).catch(i=>qu.error(`Unable to copy ${o}`,`
|
|
2
|
+
`,i))},[]);return T.exports.useEffect(()=>(n.current&&clearTimeout(n.current),e&&(n.current=setTimeout(()=>{t(!1)},$u)),()=>{n.current&&clearTimeout(n.current)}),[e]),[e,s]}const ut=te.forwardRef((e,t)=>{const{checked:n=!1,children:s,className:o,disabled:i,inputClassName:r,isInvalid:l,labelClassName:a,name:c,onChange:d,"data-testid":u}=e,[m]=T.exports.useState(nn()),p=Ca(t);T.exports.useEffect(function(){p.current&&(p.current.indeterminate=n===null)},[p,n]);const g=T.exports.useCallback(f=>{p.current&&(p.current.indeterminate=n===null),d&&d(f)},[p,n,d]);return R("div",{className:B("custom-control custom-checkbox",o),children:[h("input",{type:"checkbox",ref:p,checked:n!=null?n:!1,className:B("custom-control-input",r,{"is-invalid":l}),disabled:i,id:m,name:c,onChange:g,"data-testid":u}),h("label",{className:B("custom-control-label",a),htmlFor:m,children:s})]})});ut.displayName="Checkbox";ut.propTypes={checked:(e,t)=>{const{[t]:n}=e;return n!==null&&typeof n!="boolean"?new Error("Checked must be a boolean or null for indeterminate"):null},children:D.exports.node.isRequired,className:D.exports.string,disabled:D.exports.bool,inputClassName:D.exports.string,isInvalid:D.exports.bool,labelClassName:D.exports.string,name:D.exports.string,onChange:D.exports.func,"data-testid":D.exports.string};ut.defaultProps={checked:!1,className:"",disabled:!1,inputClassName:"",isInvalid:!1,labelClassName:"",name:void 0,onChange:void 0,"data-testid":void 0};class Jn extends T.exports.PureComponent{constructor(t){super(t),this.inputField=te.createRef()}focus(){var t;(t=this.inputField.current)==null||t.focus()}render(){const{value:t,placeholder:n,onBlur:s,onChange:o,className:i,disabled:r,matchCount:l,id:a,onKeyDown:c,"data-testid":d}=this.props;return R("div",{className:B("search-group",i),children:[h("input",{type:"search",value:t,onBlur:s,onChange:o,onKeyDown:c,className:"form-control",disabled:r,placeholder:n,ref:this.inputField,id:a,"data-testid":d}),l!=null&&h("span",{className:"search-match",children:l}),h("span",{className:"search-icon",children:h(Z,{icon:ca})})]})}}Jn.defaultProps={placeholder:"Search",className:"",matchCount:null,onKeyDown(){},id:"","data-testid":void 0};var wa=(e=>(e.UP="UP",e.DOWN="DOWN",e))(wa||{});const ro=class extends T.exports.Component{constructor(e){super(e),this.getCachedFilteredOptions=he((t,n)=>t.filter(s=>s.title.toLowerCase().indexOf(n.toLowerCase())>=0||s.value.toLowerCase().indexOf(n.toLowerCase())>=0)),this.state={value:"",filter:"",filteredOptions:e.options,keyboardOptionIndex:-1,menuIsOpen:!1,inputWidth:100},this.toggleMenu=this.toggleMenu.bind(this),this.handleMenuKeyDown=this.handleMenuKeyDown.bind(this),this.handleMenuBlur=this.handleMenuBlur.bind(this),this.closeMenu=this.closeMenu.bind(this),this.handleInputChange=this.handleInputChange.bind(this),this.handleInputKeyDown=this.handleInputKeyDown.bind(this),this.handleInputBlur=this.handleInputBlur.bind(this),this.handleFilterChange=this.handleFilterChange.bind(this),this.handleOptionClick=this.handleOptionClick.bind(this),this.handleOptionFocus=this.handleOptionFocus.bind(this),this.handleMenuOpened=this.handleMenuOpened.bind(this),this.handleMenuExited=this.handleMenuExited.bind(this),this.popper=te.createRef(),this.cbContainer=te.createRef(),this.toggleButton=te.createRef(),this.menuContainer=te.createRef(),this.input=te.createRef(),this.searchInput=te.createRef()}componentDidUpdate(){const{menuIsOpen:e,keyboardOptionIndex:t}=this.state;e&&t>=0&&this.scrollOptionIntoView()}setInputWidth(){this.cbContainer.current&&this.setState({inputWidth:this.cbContainer.current.getBoundingClientRect().width})}focus(){var e;(e=this.input.current)==null||e.focus()}resetValue(){this.setState({value:""})}updateInputValue(e){const{onChange:t}=this.props;this.setState({value:e}),t(e)}handleResize(){this.setInputWidth()}handleMenuKeyDown(e){var r,l;const{filter:t,filteredOptions:n,keyboardOptionIndex:s}=this.state,{options:o}=this.props,i=t?n:o;switch(e.key){case"Enter":((r=i[s])==null?void 0:r.value)!=null&&this.updateInputValue(i[s].value),this.closeMenu(),(l=this.input.current)==null||l.focus(),e.stopPropagation(),e.preventDefault();break;case"ArrowUp":this.handleMenuNavigation(ro.MENU_NAVIGATION_DIRECTION.UP),e.stopPropagation(),e.preventDefault();break;case"ArrowDown":this.handleMenuNavigation(ro.MENU_NAVIGATION_DIRECTION.DOWN),e.stopPropagation(),e.preventDefault();break;case"Escape":t!==""?(this.setState({filter:""}),e.stopPropagation()):this.closeMenu();break;case"Tab":!e.shiftKey&&s===i.length-1&&this.closeMenu();break}}handleMenuNavigation(e){const{filter:t,filteredOptions:n,keyboardOptionIndex:s}=this.state,{options:o}=this.props,r=(t?n:o).length;let l=0;switch(e){case ro.MENU_NAVIGATION_DIRECTION.UP:l=-1;break;case ro.MENU_NAVIGATION_DIRECTION.DOWN:l=1;break}l!==0&&this.setState({keyboardOptionIndex:(s+l+r)%r})}handleInputKeyDown(e){const{onEnter:t}=this.props,{menuIsOpen:n}=this.state;e.key==="ArrowDown"||e.key==="ArrowUp"?n||this.openMenu():e.key==="Enter"&&t()}handleInputChange(e){this.updateInputValue(e.target.value)}handleOptionClick(e){var r;const t=Number(e.currentTarget.value),{filter:n,filteredOptions:s}=this.state,{options:o}=this.props,i=n?s:o;this.updateInputValue(i[t].value),this.closeMenu(),(r=this.input.current)==null||r.focus()}handleOptionFocus(e){this.setState({keyboardOptionIndex:Number(e.target.value)})}handleFilterChange(e){var o;const{options:t}=this.props,n=e.target.value,s=this.getCachedFilteredOptions(t,n);this.setState({filter:n,filteredOptions:s,keyboardOptionIndex:0}),(o=this.popper.current)==null||o.scheduleUpdate()}handleMenuBlur(e){e.relatedTarget instanceof Element&&this.popper.current!=null&&this.popper.current.element.contains(e.relatedTarget)||e.relatedTarget===this.toggleButton.current||this.closeMenu(!1)}handleInputBlur(e){const{menuIsOpen:t}=this.state;t&&e.relatedTarget instanceof Element&&this.popper.current!=null&&this.popper.current.element.contains(e.relatedTarget)||this.closeMenu(!1)}handleMenuOpened(){var e;this.scrollOptionIntoView(),(e=this.searchInput.current)==null||e.focus()}handleMenuExited(){var t;const{menuIsOpen:e}=this.state;e&&(this.setState({menuIsOpen:!1}),(t=this.popper.current)==null||t.hide()),this.setState({filter:""})}toggleMenu(e){const{menuIsOpen:t}=this.state;t?this.closeMenu():this.openMenu(),e.stopPropagation()}openMenu(){this.updateKeyboardIndex(),this.setInputWidth(),this.setState({menuIsOpen:!0}),window.requestAnimationFrame(()=>{var e;(e=this.popper.current)==null||e.show()})}closeMenu(e=!0){var t,n;this.setState({menuIsOpen:!1}),e&&((t=this.input.current)==null||t.focus()),(n=this.popper.current)==null||n.hide()}updateKeyboardIndex(){const{value:e,filter:t,filteredOptions:n}=this.state,{options:s}=this.props,i=(t?n:s).findIndex(r=>r.value===e);this.setState({keyboardOptionIndex:i})}scrollOptionIntoView(){var t;const e=(t=this.menuContainer.current)==null?void 0:t.querySelector(".cb-option-btn.keyboard-active");e instanceof HTMLElement&&e.scrollIntoView({block:"nearest",inline:"nearest"})}renderMenuElement(){const{searchPlaceholder:e}=this.props,{filter:t,inputWidth:n}=this.state;return R("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(Jn,{value:t,ref:this.searchInput,onChange:this.handleFilterChange,className:"cb-search-input",placeholder:e})}),h("div",{className:"cb-options-container",children:h("div",{className:"cb-options",children:this.renderOptions()})})]})}renderOptions(){const{options:e}=this.props,{keyboardOptionIndex:t,filter:n,filteredOptions:s}=this.state;return(n?s:e).map((i,r)=>{const l=`option-${r}-${i.value}`;return h("button",{type:"button",value:r,className:B("cb-option-btn",{"keyboard-active":t===r}),onClick:this.handleOptionClick,onFocus:this.handleOptionFocus,children:i.title},l)})}render(){const{options:e,inputPlaceholder:t,disabled:n,className:s,defaultValue:o,spellCheck:i,"data-testid":r}=this.props,{value:l}=this.state;let{popperOptions:a}=this.props;return a={placement:"bottom-end",modifiers:{preventOverflow:{enabled:!1}},...a},R("div",{className:"input-group cb-container",ref:this.cbContainer,children:[h("input",{value:l||o,className:B("form-control",s,"cb-input"),ref:this.input,onChange:this.handleInputChange,placeholder:t||(e[0]!=null?e[0].title:void 0),disabled:n,onBlur:this.handleInputBlur,onKeyDown:this.handleInputKeyDown,spellCheck:i,"data-testid":r!==void 0?`${r}-input`:void 0}),h("div",{className:"input-group-append cb-dropdown",children:R("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(Z,{icon:$n}),h(En,{ref:this.popper,options:a,className:B("combobox interactive"),onEntered:this.handleMenuOpened,onExited:this.handleMenuExited,children:this.renderMenuElement()})]})})]})}};let zs=ro;zs.MENU_NAVIGATION_DIRECTION=wa;zs.DROP_DOWN_MENU_HEIGHT=200;zs.propTypes={options:D.exports.arrayOf(D.exports.shape({title:D.exports.string.isRequired,value:D.exports.string.isRequired})).isRequired,popperOptions:D.exports.shape({title:D.exports.string.isRequired,value:D.exports.string.isRequired}),onChange:D.exports.func,inputPlaceholder:D.exports.string,searchPlaceholder:D.exports.string,disabled:D.exports.bool,className:D.exports.string,defaultValue:D.exports.string,spellCheck:D.exports.bool,onEnter:D.exports.func,"data-testid":D.exports.string};zs.defaultProps={onChange(){},inputPlaceholder:"",searchPlaceholder:"Search",disabled:!1,className:"",defaultValue:"",popperOptions:null,spellCheck:!0,onEnter(){},"data-testid":void 0};function Sa({copy:e,kind:t="ghost",tooltip:n="Copy",className:s,"data-testid":o,children:i}){const[r,l]=Ku();return h(X,{kind:t,className:s,"data-testid":o,icon:r?au:Qd,tooltip:r?"Copied":n,onClick:()=>{l(typeof e=="function"?e():e)},children:i})}const At=se.module("MaskedInput"),Is={FORWARD:"forward",BACKWARD:"backward",NONE:"none"},Wo="\u2007";function Rr(e,t,n){return e.substring(0,t)+n+e.substring(t+1)}function Xu(e,t,n){return e.length<n?`${e}${t.substring(e.length,n)}`:e}function dl(e,t){let{length:n}=e;for(let s=e.length-1;s>=0&&t[s]===e[s];s-=1)n=s;return e.substring(0,n)}const vi=te.forwardRef((e,t)=>{const{className:n,example:s,getNextSegmentValue:o=(N,P,k)=>k,getPreferredReplacementString:i=Rr,onChange:r=()=>!1,onSelect:l=()=>!1,pattern:a,placeholder:c,selection:d,value:u,onFocus:m=()=>!1,onBlur:p=()=>!1,"data-testid":g}=e,f=Ca(t),w=T.exports.useMemo(()=>Array.isArray(s)?s:[s],[s]),C=T.exports.useMemo(()=>w[0].replace(/[a-zA-Z0-9]/g,Wo),[w]);T.exports.useEffect(function(){var P;if(d!=null){At.debug("setting selection...",d);const{selectionStart:k,selectionEnd:z,selectionDirection:K}=d;(P=f.current)==null||P.setSelectionRange(k,z,K),At.debug("selection set!")}},[d,f]);const S=T.exports.useCallback(N=>{let P=N,k=N;const z=w.length>0?w[0]:u;for(let G=P-1;G>=0&&/[a-zA-Z0-9]/g.test(z.charAt(G));G-=1)P=G;for(let G=k;G<z.length&&/[a-zA-Z0-9]/g.test(z.charAt(G));G+=1)k=G+1;const K=P===k?Is.NONE:Is.BACKWARD;return{selectionStart:P,selectionEnd:k,selectionDirection:K}},[w,u]);function b(N,P,k=N.length){let z="";for(let K=0;K<k;K+=1)N.charAt(K)!==Wo?z=z.concat(N[K]):z=z.concat(P[K]);return z=z.concat(P.substring(k)),z}function E(N,P=N.length){const k=new RegExp(`^${a}$`);if(k.test(N))return!0;for(let z=0;z<w.length;z+=1){const K=b(N,w[z],P);if(k.test(K))return!0}return!1}function v(N){const P=S(N),k=P.selectionEnd+1;return k>=u.length?P:S(k)}function y(N){const P=S(N),k=P.selectionStart-1;return k<=0?P:S(k)}function M(N,P){const k=S(N),z=u.substring(k.selectionStart,k.selectionEnd),K=o(k,P,z,u),G=u.substring(0,k.selectionStart)+K+u.substring(k.selectionEnd);E(G,k.selectionEnd)&&(r(G),l(k))}const A=T.exports.useCallback(N=>{const{selectionStart:P=0,selectionEnd:k=0,selectionDirection:z="none"}=N.target;if(P===null||k===null||z===null){At.error("Selection attempted on non-text input element",N.target);return}if(At.debug2("handleSelect",P,k,z),!(d!=null&&P===d.selectionStart&&k===d.selectionEnd)){if(d!=null&&P===u.length&&k===u.length&&N.nativeEvent.type!=="mouseup"){l({...d});return}if(P===k){const K=S(P);At.debug("Selection segment from ",P,k,"=>",K),l(K)}else l({selectionStart:P,selectionEnd:k,selectionDirection:z})}},[S,l,d,u]),F=T.exports.useCallback(N=>{var k;if(!f.current)return;At.debug("handleSelectCapture",N);const P=(k=f.current.selectionStart)!=null?k:0;P===u.length&&d!=null&&P!==d.selectionStart&&(N.preventDefault(),N.stopPropagation())},[f,d,u]);function V(N){if(N.preventDefault(),N.stopPropagation(),!f.current)return;const{key:P}=N,{selectionStart:k=0,selectionEnd:z=0}=f.current;if(k===null||z===null){At.error("Selection arrow nvaigation attempted on non-text input element",N.target);return}P==="ArrowLeft"?l(y(k)):P==="ArrowRight"?l(v(z)):P==="ArrowUp"?M(k,-1):P==="ArrowDown"&&M(k,1)}function H(N){if(!f.current)return;At.debug("handleKeyDown",N);const{key:P}=N,{selectionStart:k=0,selectionEnd:z=0}=f.current;if(k===null||z===null){At.error("Selection key event on non-text input element",N.target);return}if(P.startsWith("Arrow")){V(N);return}if(P==="Delete"||P==="Backspace"){if(N.preventDefault(),N.stopPropagation(),z>=dl(u,C).length){const G=u.substring(0,k===z?k-1:k),_=dl(G,C);_!==u&&(r(_),l({selectionStart:_.length,selectionEnd:_.length,selectionDirection:Is.NONE}));return}if(k!==z){const G=u.substring(0,k)+u.substring(k,z).replace(/[a-zA-Z0-9]/g,Wo)+u.substring(z);At.debug("Range ",k,z,"deleted, setting value",G),r(G),l({selectionStart:k,selectionEnd:k,selectionDirection:Is.NONE})}else if(k>0)for(let G=k-1;G>=0;G-=1){const _=u.substring(0,G)+u.substring(G,k).replace(/[a-zA-Z0-9]/g,Wo)+u.substring(k);if(_!==u){r(_),l({selectionStart:G,selectionEnd:G,selectionDirection:Is.NONE});return}}return}if(N.altKey||N.metaKey||N.ctrlKey||P.length>1)return;N.preventDefault(),N.stopPropagation();const K=Array.from(new Set([P,P.toUpperCase(),P.toLowerCase()]));for(let G=0;G<K.length;G+=1){const _=K[G],q=/[a-zA-Z0-9]/g.test(_)?w[0].length-1:k;for(let Y=k;Y<=q;Y+=1){const J=Xu(u,w[0],Y+1),de=i(J,Y,_,k,z);if(E(de,Y+1)){const pe=S(Y),ge=Y+1;let Te={selectionStart:ge,selectionEnd:ge,selectionDirection:Is.NONE};if(ge>=pe.selectionEnd){const fe=v(Y);fe.selectionStart!==pe.selectionStart&&(Te=fe)}At.debug("handleKeyDown",P,"=>",de,Te),r(de),l(Te);return}}}}return h("input",{ref:f,className:B("form-control masked-input",n),type:"text",pattern:a,placeholder:c,value:u,onChange:()=>{},onKeyDown:H,onSelect:A,onSelectCapture:F,onFocus:m,onBlur:p,"data-testid":g})});vi.defaultProps={className:"",placeholder:void 0,onChange(){},onSelect(){},getNextSegmentValue:(e,t,n)=>n,getPreferredReplacementString:Rr,selection:void 0,onFocus(){},onBlur(){},"data-testid":void 0};const Yu=se.module("TimeInput"),Qu="([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]",ju=["00:00:00","12:34:56","23:59:59"],ba=te.forwardRef((e,t)=>{const{allowValueWrapping:n=!0,className:s="",onChange:o=()=>!1,value:i=0,onFocus:r=()=>!1,onBlur:l=()=>!1,onSelect:a=()=>!1,"data-testid":c}=e,[d,u]=T.exports.useState(en.formatTime(i)),[m,p]=T.exports.useState(),g=T.exports.useRef(null);T.exports.useImperativeHandle(t,()=>({focus:()=>{var b;(b=g.current)==null||b.focus()},setSelection:b=>{var E;(E=g.current)==null||E.focus(),p(b)}}),[]),T.exports.useEffect(function(){u(en.formatTime(i))},[i]);function f(b,E,v){const y=b.selectionStart===0?24:60;let M=parseInt(v,10)-E;return Number.isNaN(M)?M=0:n?M=(M%y+y)%y:M=Math.min(Math.max(0,M),y-1),`${M}`.padStart(2,"0")}function w(b,E,v,y,M){return y===0&&M===2&&E===1&&parseInt(v,10)>1?`0${v}${b.substring(2)}`:Rr(b,E,v)}function C(b){Yu.debug("handleChange",b),u(b),en.isTimeString(b)&&o(en.parseTime(b))}const S=T.exports.useCallback(b=>{p(b),a(b)},[a]);return h(vi,{ref:g,className:s,example:ju,getNextSegmentValue:f,getPreferredReplacementString:w,onChange:C,onSelect:S,pattern:Qu,selection:m,value:d,onFocus:r,onBlur:l,"data-testid":c})});ba.defaultProps={allowValueWrapping:!0,className:"",onChange:()=>!1,onSelect:()=>!1,value:0,onFocus:()=>!1,onBlur:()=>!1,"data-testid":void 0};class va extends T.exports.PureComponent{constructor(t){var o;super(t),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=te.createRef(),this.oldFocus=document.activeElement,this.rAF=0;const{options:n}=t,s=(o=n.initialKeyboardIndex)!=null?o:-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:t}=this.props;t(this)})}componentDidUpdate(t){const{actions:n}=this.props;t.actions!==n&&this.initMenu()}componentWillUnmount(){cancelAnimationFrame(this.rAF)}getKeyboardIndex(){const{options:t}=this.props;if(t.separateKeyboardMouse!==void 0&&t.separateKeyboardMouse){const{keyboardIndex:n}=this.state;return n}return this.getMouseIndex()}setKeyboardIndex(t){const{options:n}=this.props;n.separateKeyboardMouse!==void 0&&n.separateKeyboardMouse?this.setState({keyboardIndex:t}):this.setMouseIndex(t)}getMouseIndex(){const{mouseIndex:t}=this.state;return t}setMouseIndex(t){this.setState({mouseIndex:t})}initMenu(){cancelAnimationFrame(this.rAF),this.setState({menuItems:[]});const{actions:t}=this.props,n=Ne.getMenuItems(t,!1);n.length>0&&this.setState(s=>({menuItems:Ne.sortActions(s.menuItems.concat(n))}))}handleKeyDown(t){const{menuItems:n}=this.state,s=this.getKeyboardIndex();let o=s;if(t.key==="Enter"||t.key===" "){s!=null&&s>=0&&s<n.length&&this.handleMenuItemClick(n[s],t);return}t.key==="Escape"?o=null:t.key==="ArrowUp"||t.key==="Tab"&&t.shiftKey===!0?o=Ne.getNextMenuItem(o!=null?o:0,-1,n):(t.key==="ArrowDown"||t.key==="Tab"&&t.shiftKey===!1)&&(o=Ne.getNextMenuItem(o!=null?o:0,1,n)),s!==o&&(o!==null?this.setKeyboardIndex(o):(this.closeMenu(),this.oldFocus instanceof HTMLElement&&this.oldFocus.focus()),t.preventDefault(),t.stopPropagation())}closeMenu(t=!1){const{closeMenu:n,onMenuClosed:s}=this.props;cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{n(t),s(this)})}handleCloseMenu(){this.closeMenu()}handleMenuItemClick(t,n){n.preventDefault(),n.stopPropagation(),t!=null&&(t.disabled===void 0||!t.disabled)&&t.action!=null&&(t.action(),this.closeMenu(!0))}handleMenuItemMouseMove(t){const{menuItems:n}=this.state,s=n.indexOf(t);this.setMouseIndex(s)}handleMouseLeave(){this.setMouseIndex(-1)}render(){const t=[],{"data-testid":n}=this.props,{keyboardIndex:s,menuItems:o,mouseIndex:i}=this.state;for(let l=0;l<o.length;l+=1){const a=o[l];l>0&&a.group!==o[l-1].group&&t.push(h("hr",{},`${l}.separator`));const c=h(wi,{isKeyboardSelected:s===l,isMouseSelected:i===l,menuItem:a,closeMenu:this.handleCloseMenu,onMenuItemClick:this.handleMenuItemClick,onMenuItemMouseMove:this.handleMenuItemMouseMove,onMenuItemContextMenu:()=>!1},l);t.push(c)}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:t})}}va.defaultProps={closeMenu(){},onMenuOpened(){},onMenuClosed(){},options:{},menuStyle:{},"data-testid":void 0};class Qn extends T.exports.PureComponent{constructor(t){super(t),this.handleClick=this.handleClick.bind(this),this.handleCloseMenu=this.handleCloseMenu.bind(this),this.handleExited=this.handleExited.bind(this),this.container=te.createRef(),this.parent=null,this.popper=te.createRef(),this.isOpen=!1}componentDidMount(){var n;const{isShown:t}=this.props;t===null?(n=this.container.current)!=null&&n.parentElement&&(this.parent=this.container.current.parentElement,this.parent.addEventListener("click",this.handleClick)):t&&this.openMenu()}componentDidUpdate(t){const{isShown:n}=this.props;t.isShown!==n&&(n!==null&&n?window.requestAnimationFrame(()=>{this.openMenu()}):this.closeMenu())}componentWillUnmount(){this.parent&&this.parent.removeEventListener("click",this.handleClick)}closeMenu(){var t;(t=this.popper.current)==null||t.hide()}openMenu(){this.popper.current&&!this.isOpen&&(this.popper.current.show(),this.isOpen=!0)}scheduleUpdate(){var t;(t=this.popper.current)==null||t.scheduleUpdate()}handleClick(t){t.preventDefault(),t.stopPropagation(),this.openMenu()}handleCloseMenu(){this.closeMenu()}handleExited(){this.isOpen=!1;const{onMenuClosed:t}=this.props;t()}render(){const{actions:t,onMenuOpened:n,popperClassName:s,"data-testid":o}=this.props,{menuStyle:i}=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":o,children:h(En,{ref:this.popper,options:l,className:B("menu-popper",s),onExited:this.handleExited,closeOnBlur:!0,interactive:!0,children:h(va,{actions:t,closeMenu:this.handleCloseMenu,onMenuOpened:n,options:r,menuStyle:i})})})}}Qn.defaultProps={isShown:null,onMenuClosed(){},onMenuOpened(){},options:{},popperOptions:{},popperClassName:"",menuStyle:{},"data-testid":void 0};const ul=-1;var Ta=(e=>(e.UP="UP",e.DOWN="DOWN",e))(Ta||{});const pn=class extends T.exports.Component{constructor(e){super(e);const{value:t,valueToTime:n}=e;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=te.createRef(),this.menuContainer=te.createRef(),this.button=te.createRef(),this.input=te.createRef(),this.state={keyboardOptionIndex:0,menuIsOpen:!1,inputWidth:100,customTime:n(t),inputFocused:!1}}getSelectedText(){const{options:e,value:t,placeholder:n}=this.props,{customTime:s}=this.state;if(t===null)return n;for(let o=0;o<e.length;o+=1){const i=e[o];if(i.value===t)return i.title}return en.formatTime(s)}setInputWidth(){this.csContainer.current&&this.setState({inputWidth:this.csContainer.current.getBoundingClientRect().width})}focus(){var e;(e=this.button.current)==null||e.focus()}updateInputValue(e){const{onChange:t}=this.props;t(e)}handleResize(){this.setInputWidth()}handleMenuKeyDown(e){var o;const{keyboardOptionIndex:t,inputFocused:n}=this.state,{options:s}=this.props;switch(e.key){case"Enter":case" ":n?this.updateFromCustom():this.updateInputValue(s[t].value),this.closeMenu(),(o=this.button.current)==null||o.focus(),e.stopPropagation(),e.preventDefault();break;case"Tab":e.shiftKey?this.handleMenuNavigation(pn.MENU_NAVIGATION_DIRECTION.UP):this.handleMenuNavigation(pn.MENU_NAVIGATION_DIRECTION.DOWN),e.stopPropagation(),e.preventDefault();break;case"ArrowUp":this.handleMenuNavigation(pn.MENU_NAVIGATION_DIRECTION.UP),e.stopPropagation(),e.preventDefault();break;case"ArrowDown":this.handleMenuNavigation(pn.MENU_NAVIGATION_DIRECTION.DOWN),e.stopPropagation(),e.preventDefault();break;case"Escape":this.closeMenu();break}}handleMenuNavigation(e){const{keyboardOptionIndex:t,inputFocused:n}=this.state,{options:s}=this.props,o=s.length;let i=t;switch(e){case pn.MENU_NAVIGATION_DIRECTION.UP:if(!n&&t===0){this.focusInput();break}else n&&this.focusOption(t);t>0&&!n?(i=(i-1)%o,this.setState({keyboardOptionIndex:i})):t===0&&(i=o-1,this.setState({keyboardOptionIndex:i})),this.scrollOptionIntoView(i);break;case pn.MENU_NAVIGATION_DIRECTION.DOWN:if(!n&&t===o-1){this.focusInput();break}else n&&this.focusOption(t);t<o&&!(n&&t===0)&&(i=(i+1)%o,this.setState({keyboardOptionIndex:i})),this.scrollOptionIntoView(i);break}}handleOptionClick(e){const t=Number(e.currentTarget.value),{options:n,timeToValue:s}=this.props,{customTime:o}=this.state;if(t===ul){const i=s(o);this.updateAndClose(i)}else this.updateAndClose(n[t].value)}updateAndClose(e){var t;this.updateInputValue(e),this.closeMenu(),(t=this.button.current)==null||t.focus()}handleOptionFocus(e){this.setState({keyboardOptionIndex:Number(e.target.value)})}handleMenuOpened(){var i;const{options:e,value:t}=this.props,{keyboardOptionIndex:n}=this.state;this.scrollOptionIntoView(n);const s=(i=this.menuContainer.current)==null?void 0:i.querySelector(".cs-option-btn.keyboard-active");if(s instanceof HTMLElement&&s.focus(),t===null)return;e.map(r=>r.value).indexOf(t)<0&&this.focusInput()}focusInput(){var e;(e=this.input.current)==null||e.focus()}focusOption(e){var n;const t=(n=this.menuContainer.current)==null?void 0:n.querySelector(".cs-options");if(t&&t.children!=null){const s=t.children.item(e);s instanceof HTMLElement&&s.focus()}}handleMenuExited(){const{menuIsOpen:e}=this.state;e&&this.setState({menuIsOpen:!1,keyboardOptionIndex:0})}handleCustomInput(e){const{timeToValue:t}=this.props,n=t(e);this.updateInputValue(n),this.setState({customTime:e})}updateFromCustom(){const{timeToValue:e}=this.props,{customTime:t}=this.state,n=e(t);this.updateInputValue(n)}toggleMenu(e){const{menuIsOpen:t}=this.state;t?this.closeMenu():this.openMenu(),e.stopPropagation()}openMenu(){this.updateKeyboardIndex(),this.setInputWidth(),this.setState({menuIsOpen:!0})}closeMenu(e=!0){var t;this.setState({menuIsOpen:!1}),e&&((t=this.button.current)==null||t.focus())}updateKeyboardIndex(){const{options:e,value:t}=this.props;if(t===null)return;const n=e.map(s=>s.value).indexOf(t);n>0&&this.setState({keyboardOptionIndex:n})}scrollOptionIntoView(e){var n;const t=(n=this.menuContainer.current)==null?void 0:n.querySelector(".cs-options");if(t&&t.children!=null){const s=t.children.item(e);s instanceof HTMLElement&&s.offsetTop>pn.DROP_DOWN_MENU_HEIGHT?t.scrollTop=s.offsetTop-pn.DROP_DOWN_MENU_HEIGHT:(s instanceof HTMLElement&&s.offsetTop<0||e===0)&&(t.scrollTop=0)}}renderMenuElement(){const{inputWidth:e}=this.state;return h("div",{className:"cs-menu-container",ref:this.menuContainer,role:"presentation",onKeyDown:this.handleMenuKeyDown,onClick:t=>{t.stopPropagation()},style:{width:e},children:h("div",{className:"cs-options-container",children:h("div",{className:"cs-options",children:this.renderOptions()})})})}renderOptions(){const{options:e,value:t,icon:n,customText:s}=this.props,{keyboardOptionIndex:o,customTime:i,inputFocused:r}=this.state;let l=!1;const a=[];for(let c=0;c<e.length;c+=1){const d=e[c],u=`option-${c}-${d.value}`;l=l||d.value===t,a.push(R("button",{type:"button",value:c,className:B("cs-option-btn",{"keyboard-active":o===c&&!r}),onClick:this.handleOptionClick,onFocus:this.handleOptionFocus,children:[d.value===t&&h(Z,{icon:n,className:"mr-2"}),d.value!==t&&h("span",{className:"mr-4"}),d.title]},u))}return a.push(h("hr",{className:"cs-divider"},"option-divider")),a.push(R("button",{type:"button",value:ul,className:B("cs-option-btn",{"keyboard-active":r}),onClick:this.handleOptionClick,onFocus:this.handleOptionFocus,children:[!l&&t!==null?h(Z,{icon:n,className:"mr-2"}):h("span",{className:"mr-4"}),s]},"option-custom-label")),a.push(R("div",{className:"cs-custom-container",children:[h("span",{className:"mr-2"}),h(ba,{ref:this.input,onChange:this.handleCustomInput,value:i,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:e,invalid:t,value:n,"data-testid":s}=this.props,{menuIsOpen:o}=this.state;let{popperOptions:i}=this.props;return i={placement:"bottom-end",modifiers:{preventOverflow:{enabled:!1}},...i},h("div",{className:"input-group cs-container context-menu",ref:this.csContainer,"data-testid":s,children:h("div",{className:B("input-group-append cs-dropdown",{"cs-dropdown-invalid":t}),children:R("button",{type:"button",className:B("btn cs-btn form-control",{"cs-btn-invalid":t}),ref:this.button,onClick:this.toggleMenu,disabled:e,children:[h("span",{className:B({"text-muted":n===null}),children:this.getSelectedText()}),h("span",{children:h(Z,{icon:Sr,className:"cs-caret"})}),h(Qn,{isShown:o,actions:{menuElement:this.renderMenuElement()},popperOptions:i,popperClassName:"CustomTimeSelect",onMenuOpened:this.handleMenuOpened,onMenuClosed:this.handleMenuExited,menuStyle:{maxWidth:"100rem"}})]})})})}};let yr=pn;yr.MENU_NAVIGATION_DIRECTION=Ta;yr.DROP_DOWN_MENU_HEIGHT=125;yr.defaultProps={onChange(){},value:null,disabled:!1,popperOptions:{},icon:Xn,customText:"Custom",placeholder:"Select a time",valueToTime:e=>e===null?0:Math.round(e/1e3),timeToValue:e=>e*1e3,invalid:!1,"data-testid":void 0};function Ms(e,t,n,s,o){const i=s-n+1;return`${((parseInt(t,10)-e-n)%i+i)%i+n}`.padStart(o,"0")}function Ea(e,t,n){const{selectionStart:s}=e;return s===0?Ms(t,n,1900,2099,4):s===5?Ms(t,n,1,12,2):s===8?Ms(t,n,1,31,2):s===11?Ms(t,n,0,23,2):s===17||s===14?Ms(t,n,0,59,2):s===20||s===24||s===28?Ms(t,n,0,999,3):n}const Zu=se.module("DateTimeInput"),Ju="[12][0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])",eh="([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}",th=`${Ju} ${eh}`,ei="2022-01-01",Ra=`${ei} 00:00:00.000000000`,nh="YYYY-MM-DD HH:MM:SS.SSSSSSSSS";function hl(e){return e!=null&&e.length>=ei.length?`${e.substring(0,ei.length)}${e.substring(ei.length).replace(/\u2007/g,"0")}${Ra.substring(e.length)}`:e}function sr(e){const t=e.substring(0,23),n=e.substring(23,26),s=e.substring(26);return[t,n,s].filter(o=>o!=="").join("\u200B")}const ml=e=>e.replace(/\u200B/g,""),sh=[sr(Ra)],Ir=te.forwardRef((e,t)=>{const{className:n="",onChange:s=()=>{},defaultValue:o="",onFocus:i=()=>{},onBlur:r=()=>{},"data-testid":l}=e,[a,c]=T.exports.useState(o.length>0?sr(o):""),[d,u]=T.exports.useState(),m=T.exports.useCallback(g=>{Zu.debug("handleChange",g),c(g),s(hl(ml(g)))},[s]),p=T.exports.useCallback(()=>{const g=ml(a),f=hl(g);f!==g&&c(sr(f)),r()},[a,r]);return h("div",{className:"d-flex flex-row align-items-center",children:h(vi,{ref:t,className:B(n),example:sh,getNextSegmentValue:Ea,onChange:m,onSelect:u,pattern:th,placeholder:nh,selection:d,value:a,onFocus:i,onBlur:p,"data-testid":l})})});Ir.displayName="DateTimeInput";Ir.defaultProps={className:"",onChange:()=>{},defaultValue:"",onFocus:()=>{},onBlur:()=>{},"data-testid":void 0};const oh=se.module("DateInput"),ih="[12][0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])",rh=["2000-01-01","2022-12-31"],lh="YYYY-MM-DD",ya=te.forwardRef((e,t)=>{const{className:n="",onChange:s=()=>{},defaultValue:o="",onFocus:i=()=>{},onBlur:r=()=>{},"data-testid":l}=e,[a,c]=T.exports.useState(o),[d,u]=T.exports.useState(),m=T.exports.useCallback(p=>{oh.debug("handleChange",p),c(p),s(p)},[s]);return h("div",{className:"d-flex flex-row align-items-center",children:h(vi,{ref:t,className:B(n),example:rh,getNextSegmentValue:Ea,onChange:m,onSelect:u,pattern:ih,placeholder:lh,selection:d,value:a,onFocus:i,onBlur:r,"data-testid":l})})});ya.displayName="DateInput";ya.defaultProps={className:"",onChange:()=>!1,defaultValue:"",onFocus:()=>!1,onBlur:()=>!1,"data-testid":void 0};class ah extends T.exports.PureComponent{constructor(t){super(t),this.searchInput=te.createRef(),this.handleChange=this.handleChange.bind(this),this.sendUpdate=ft(this.sendUpdate.bind(this),t.debounceMs),this.state={value:t.value}}componentDidUpdate(t){const{value:n}=this.props;t.value!==n&&this.setState({value:n})}focus(){var t;(t=this.searchInput.current)==null||t.focus()}handleChange(t){this.setState({value:t.target.value},this.sendUpdate)}sendUpdate(){const{onChange:t}=this.props,{value:n}=this.state;t(n)}render(){const{placeholder:t,className:n,matchCount:s,id:o,"data-testid":i}=this.props,{value:r}=this.state;return h(Jn,{value:r,placeholder:t,onChange:this.handleChange,className:n,matchCount:s,ref:this.searchInput,id:o,"data-testid":i})}}ah.defaultProps={placeholder:"Search",className:"",matchCount:null,debounceMs:250,id:"","data-testid":void 0};const ch=se.module("ItemListItem"),Ia=class extends T.exports.Component{constructor(e){super(e),this.handleBlur=this.handleBlur.bind(this),this.handleFocus=this.handleFocus.bind(this),this.handleClick=this.handleClick.bind(this),this.handleContextMenu=this.handleContextMenu.bind(this),this.handleDragStart=this.handleDragStart.bind(this),this.handleDrag=this.handleDrag.bind(this),this.handleDragOver=this.handleDragOver.bind(this),this.handleDragEnd=this.handleDragEnd.bind(this),this.handleDrop=this.handleDrop.bind(this),this.handleDoubleClick=this.handleDoubleClick.bind(this),this.handleMouseDown=this.handleMouseDown.bind(this),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleMouseUp=this.handleMouseUp.bind(this),this.itemRef=te.createRef()}static handleKeyDown(){return ch.log("ItemListItem.handleKeyDown false"),!1}handleBlur(e){const{itemIndex:t,onBlur:n}=this.props;n(t,e)}handleFocus(e){const{itemIndex:t,onFocus:n}=this.props;n(t,e)}handleClick(e){const{itemIndex:t,onClick:n}=this.props;n(t,e)}handleContextMenu(e){const{itemIndex:t,onContextMenu:n}=this.props;n(t,e)}handleDragStart(e){const{itemIndex:t,onDragStart:n}=this.props;n(t,e)}handleDrag(e){const{itemIndex:t,onDrag:n}=this.props;n(t,e)}handleDragOver(e){e.preventDefault();const{itemIndex:t,onDragOver:n}=this.props;n(t,e)}handleDragEnd(e){const{itemIndex:t,onDragEnd:n}=this.props;n(t,e)}handleDrop(e){const{itemIndex:t,onDrop:n}=this.props;n(t,e)}handleDoubleClick(e){const{itemIndex:t,onDoubleClick:n}=this.props;n(t,e)}handleMouseMove(e){const{itemIndex:t,onMouseMove:n}=this.props;n(t,e)}handleMouseDown(e){const{itemIndex:t,onMouseDown:n}=this.props;n(t,e)}handleMouseUp(e){const{itemIndex:t,onMouseUp:n}=this.props;n(t,e)}render(){const{isDraggable:e,isFocused:t,isSelected:n,style:s,children:o,"data-testid":i}=this.props;return h("div",{className:B("item-list-item",{active:n},{"is-focused":t},{"is-draggable":e}),onKeyDown:Ia.handleKeyDown,onContextMenuCapture:this.handleContextMenu,onClick:this.handleClick,onDrag:this.handleDrag,onDragStart:this.handleDragStart,onDragOver:this.handleDragOver,onDragEnd:this.handleDragEnd,onDrop:this.handleDrop,onDoubleClick:this.handleDoubleClick,onMouseDown:this.handleMouseDown,onMouseMove:this.handleMouseMove,onMouseUp:this.handleMouseUp,tabIndex:-1,ref:this.itemRef,role:"listitem",style:s,onFocus:this.handleFocus,onBlur:this.handleBlur,draggable:e,"data-testid":i,children:o})}};let Ma=Ia;Ma.defaultProps={children:null,isDraggable:!1,isFocused:!1,isSelected:!1,itemIndex:0,"data-testid":void 0,onBlur(){},onClick(){},onContextMenu(){},onDragStart(){},onDrag(){},onDragOver(){},onDragEnd(){},onDrop(){},onDoubleClick(){},onFocus(){},onMouseDown(){},onMouseMove(){},onMouseUp(){},style:{}};const pl=se.module("ItemList"),Hs=class extends T.exports.PureComponent{constructor(e){super(e),this.getItemSelected=he((s,o)=>Qt.isSelected(o,s),{max:Hs.CACHE_SIZE}),this.getCachedItem=he((s,o,i,r,l,a,c,d)=>{const u=a({item:i,itemIndex:s,isFocused:r,isSelected:l,style:c});return h(Ma,{onContextMenu:this.handleItemContextMenu,onDoubleClick:this.handleItemDoubleClick,onMouseDown:this.handleItemMouseDown,onFocus:this.handleItemFocus,onBlur:this.handleItemBlur,disableSelect:d,onMouseMove:this.handleItemMouseMove,onMouseUp:this.handleItemMouseUp,isFocused:r,isSelected:l,itemIndex:s,style:c,children:u},o)},{max:Hs.CACHE_SIZE}),this.getOuterElement=he(s=>{const o=te.forwardRef((i,r)=>h("div",{ref:r,tabIndex:-1,onKeyDown:s,role:"presentation",...i}));return o.displayName="ItemListOuterElement",o}),this.getInnerElement=he(()=>{const s=te.forwardRef((o,i)=>h("div",{className:"item-list-inner-element",ref:i,...o}));return s.displayName="ItemListInnerElement",s}),this.getItemData=he((s,o,i)=>({items:s,selectedRanges:o,renderItem:i})),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=te.createRef(),this.listContainer=te.createRef();const{isStickyBottom:t,selectedRanges:n}=e;this.state={focusIndex:null,mouseDownIndex:null,selectedRanges:n,overscanStartIndex:0,height:null,isDragging:!1,isStuckToBottom:t,scrollOffset:null}}static renderItem({item:e}){var t,n;return h("div",{className:"item-list-item-content",children:e!=null&&((n=(t=e.displayValue)!=null?t:e.value)!=null?n:`${e}`)})}componentDidUpdate(e,t){const{selectedRanges:n,itemCount:s}=this.props,{focusIndex:o,isStuckToBottom:i,scrollOffset:r,height:l,selectedRanges:a}=this.state;if(i&&!this.isListAtBottom()&&s>0&&this.scrollToBottom(),(r!==t.scrollOffset||l!==t.height)&&this.sendViewportUpdate(),n!==e.selectedRanges&&n!==a)this.setSelectedRanges(n);else if(a!==t.selectedRanges){const{onSelectionChange:c}=this.props;c(a)}if(o!==t.focusIndex){const{onFocusChange:c}=this.props;c(o)}}componentWillUnmount(){window.removeEventListener("mouseup",this.handleWindowMouseUp)}focus(){var e;(e=this.listContainer.current)==null||e.focus()}restoreScrollPosition(){var t;const{scrollOffset:e}=this.state;e!=null&&((t=this.listContainer.current)==null||t.scrollTo(0,e))}getElement(e){if(this.listContainer.current==null)return null;const{focusSelector:t}=this.props,{overscanStartIndex:n}=this.state,s=this.listContainer.current.querySelectorAll(t),o=e-n;return s[o]}focusItem(e){const{disableSelect:t}=this.props;if(t)return;this.setState({focusIndex:e});const n=this.getElement(e);n instanceof HTMLElement&&n.focus()}scrollToItem(e){const t=this.getElement(e);t!=null&&t.scrollIntoView({block:"center"})}handleItemContextMenu(e,t){const{selectedRanges:n}=this.state,o=Qt.isSelected(n,e)||Ne.isModifierKeyDown(t);this.toggleSelect(e,t.shiftKey,o,!1)}handleItemDoubleClick(e,t){const{isDoubleClickSelect:n,onSelect:s}=this.props;n&&this.setState(({selectedRanges:o})=>({selectedRanges:Qt.selectRange(o,[e,e])}),()=>{s(e,t)})}handleItemMouseDown(e,t){const{selectedRanges:n}=this.state;if(!(t.target instanceof HTMLElement&&["button","select","input","textarea"].indexOf(t.target.tagName.toLowerCase())!==-1)){if(t.button===2&&n.length===0){this.focusItem(e),this.selectItem(e);return}t.button!=null&&t.button!==0||(this.setState({mouseDownIndex:e}),window.addEventListener("mouseup",this.handleWindowMouseUp))}}handleItemBlur(e,t){pl.debug2("item blur",e,t.currentTarget,t.relatedTarget),(!t.relatedTarget||this.listContainer.current&&t.relatedTarget instanceof HTMLElement&&!this.listContainer.current.contains(t.relatedTarget))&&this.setState({focusIndex:null})}handleItemFocus(e,t){pl.debug2("item focus",e,t.target),this.setState(n=>{const{focusIndex:s}=n;return s!==e?{focusIndex:e}:null})}handleItemMouseMove(e,t){const{isDragSelect:n,isMultiSelect:s,disableSelect:o}=this.props,{mouseDownIndex:i,selectedRanges:r}=this.state;i==null||o||(this.setState({isDragging:!0}),(n||i===e)&&(this.focusItem(e),s?(!n&&!this.getItemSelected(e,r)&&!Ne.isModifierKeyDown(t)&&this.deselectAll(),this.selectRange([Math.min(i,e),Math.max(i,e)])):this.toggleSelect(e,t.shiftKey,Ne.isModifierKeyDown(t),!1)))}handleItemMouseUp(e,t){const{isDeselectOnClick:n,isDoubleClickSelect:s,onSelect:o}=this.props,{mouseDownIndex:i,isDragging:r}=this.state;if(!(t.target instanceof HTMLElement&&["button","select","input","textarea"].indexOf(t.target.tagName.toLowerCase())!==-1)){if(i===e&&!r){const l=t.shiftKey,a=Ne.isModifierKeyDown(t);this.focusItem(e),this.toggleSelect(e,l,a,n),!s&&!l&&!a&&o(e,t)}this.resetMouseState()}}handleItemsRendered({overscanStartIndex:e}){this.setState({overscanStartIndex:e})}handleResize({height:e}){this.setState({height:e})}handleMouseLeave(){this.setState({mouseDownIndex:null})}handleWindowMouseUp(){this.resetMouseState(),window.removeEventListener("mouseup",this.handleWindowMouseUp)}handleKeyDown(e){var r;const{isMultiSelect:t,itemCount:n,onSelect:s}=this.props,{focusIndex:o}=this.state;let i=o;if(e.key==="Enter"||e.key===" "){!t&&i!=null&&this.setState({selectedRanges:[[i,i]]},()=>{i!=null&&s(i,e)});return}if(e.key==="ArrowUp")i!=null&&i>=0?i=Math.max(0,i-1):i=n-1;else if(e.key==="ArrowDown")i!=null&&i>=0?i=Math.min(i+1,n-1):i=0;else return;if(o!==i){e.stopPropagation(),e.preventDefault(),this.focusItem(i);const{selectedRanges:l}=this.state;if(e.shiftKey&&l.length>0){const a=l[l.length-1];this.selectRange([Math.min(i,a[0]),Math.max(i,a[1])])}else this.deselectAll(),i!==null?this.selectItem(i):(r=this.listContainer.current)==null||r.focus();this.scrollIntoView(i)}}handleScroll({scrollUpdateWasRequested:e,scrollOffset:t}){this.setState(n=>{if(e)return{scrollOffset:t};const{isStickyBottom:s}=this.props,{height:o}=n;return{isStuckToBottom:s&&this.isListAtBottom({scrollOffset:t,height:o}),scrollOffset:t}})}resetMouseState(){this.setState({mouseDownIndex:null,isDragging:!1})}scrollToBottom(){const{itemCount:e}=this.props;this.list.current&&this.list.current.scrollToItem(e)}scrollIntoView(e){this.list.current&&this.list.current.scrollToItem(e)}toggleSelect(e,t,n,s=!0){const{isMultiSelect:o}=this.props,{selectedRanges:i}=this.state;if(o&&t&&i.length>0){const r=i[i.length-1];this.selectRange([Math.min(r[0],e),Math.max(e,r[1])])}else o&&i.length===1&&i[0][0]===e&&i[0][1]===e?s&&this.deselectItem(e):o&&n?this.getItemSelected(e,i)?s&&this.deselectItem(e):this.selectItem(e):(this.deselectAll(),this.selectItem(e))}deselectAll(){const{itemCount:e}=this.props;this.deselectRange([0,e])}deselectItem(e){this.deselectRange([e,e])}deselectRange(e){Qt.validateRange(e),this.setState(({selectedRanges:t})=>({selectedRanges:Qt.deselectRange(t,e)}))}selectItem(e){const{disableSelect:t}=this.props;t||this.selectRange([e,e])}selectRange(e){Qt.validateRange(e),this.setState(({selectedRanges:t})=>({selectedRanges:Qt.selectRange(t,e)}))}setSelectedRanges(e){this.setState({selectedRanges:e})}sendViewportUpdate(){const{scrollOffset:e,height:t}=this.state;if(e!=null&&t!=null){const{onViewportChange:n,rowHeight:s}=this.props,o=Math.floor(e/s),i=o+Math.ceil(t/s);n(o,i)}}isListAtBottom({scrollOffset:e,height:t}=this.state){if(t==null||e==null)return!1;const{itemCount:n,rowHeight:s}=this.props;return e+t>=n*s}renderInnerElement({index:e,style:t}){const{items:n,offset:s,renderItem:o,disableSelect:i}=this.props,{focusIndex:r,selectedRanges:l}=this.state;if(e<s||e>=s+n.length)return null;const a=n[e-s];return this.getCachedItem(e,e,a,e===r&&!i,this.getItemSelected(e,l),o,t,i)}render(){const{items:e,itemCount:t,overscanCount:n,renderItem:s,rowHeight:o,"data-testid":i}=this.props,{selectedRanges:r,isStuckToBottom:l}=this.state;return h(kc,{className:"item-list-auto-sizer",onResize:this.handleResize,children:({width:a,height:c})=>h(Lc,{className:"item-list-scroll-pane",height:c,width:a,initialScrollOffset:l?t*o:0,itemCount:t,itemSize:o,itemData:this.getItemData(e,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":i,children:this.renderInnerElement})})}};let sn=Hs;sn.CACHE_SIZE=1e3;sn.DEFAULT_ROW_HEIGHT=20;sn.DEFAULT_OVERSCAN=10;sn.defaultProps={offset:0,items:[],rowHeight:Hs.DEFAULT_ROW_HEIGHT,isDeselectOnClick:!0,isDoubleClickSelect:!1,isDragSelect:!0,isMultiSelect:!1,isStickyBottom:!1,disableSelect:!1,onFocusChange(){},onSelect(){},onSelectionChange(){},onViewportChange(){},overscanCount:Hs.DEFAULT_OVERSCAN,renderItem:Hs.renderItem,selectedRanges:[],focusSelector:".item-list-item","data-testid":void 0};const us=class extends T.exports.PureComponent{constructor(e){super(e),this.getCachedDraggableItem=he((t,n,s,o,i,r,l,a)=>h(cr,{draggableId:us.getDraggableId(t,o),index:o,isDragDisabled:l,children:c=>h("div",{role:"menuitem",className:"draggable-item-list-item",ref:c.innerRef,tabIndex:-1,...c.draggableProps,...c.dragHandleProps,children:n({item:s,itemIndex:o,isFocused:i,isSelected:r,style:a,isClone:!1})})},o),{max:sn.CACHE_SIZE}),this.getCachedRenderDraggableItem=he((t,n,s)=>({item:o,itemIndex:i,isFocused:r,isSelected:l,style:a})=>this.getCachedDraggableItem(t,s,o,i,r,l,n,a),{max:1}),this.getCachedRenderClone=he((t,n,s,o)=>(i,r,l)=>{const{selectedCount:a}=this.state,{draggableProps:c,dragHandleProps:d,innerRef:u}=i,{index:m}=l.source,p=n[m-s];return h("div",{className:B("draggable-item-list-dragging-item-container",t),...c,...d,ref:u,children:h("div",{className:B("draggable-item-list-dragging-item",{"two-dragged":a===2},{"multiple-dragged":a>2}),children:o({item:p,itemIndex:m,isFocused:!1,isSelected:!0,style:{},isClone:!0,selectedCount:a})})})},{max:1}),this.handleSelectionChange=this.handleSelectionChange.bind(this),this.itemList=te.createRef(),this.state={selectedCount:0}}static renderHandle(){return R("div",{children:[h(We,{children:"Drag to re-order"}),h(Z,{icon:Ci})]})}static renderBadge({text:e}){return e!=null&&e.length>0?h("span",{className:"number-badge",children:e}):null}static renderTextItem({text:e,badgeText:t="",className:n=""}){return R("div",{className:B("item-list-item-content","draggable-item-list-item-content",n),children:[h("span",{className:"title",children:e}),us.renderBadge({text:t}),us.renderHandle()]})}static renderItem({item:e,isClone:t,selectedCount:n}){var r,l;const s=e!=null?(l=(r=e.displayValue)!=null?r:e.value)!=null?l:`${e}`:"",o=t!==void 0&&t?`${n}`:"",i=t!==void 0&&t?"item-list-item-clone":"";return us.renderTextItem({text:s,badgeText:o,className:i})}static getDraggableId(e,t){return`${e}/${t}`}static getDraggableIndex(e){const t=e.split("/").pop();return parseInt(t!==void 0?t:"",10)}selectItem(e){var t;(t=this.itemList.current)==null||t.selectItem(e)}focusItem(e){var t;(t=this.itemList.current)==null||t.focusItem(e)}scrollToItem(e){var t;(t=this.itemList.current)==null||t.scrollToItem(e)}handleSelectionChange(e){this.setState({selectedCount:Qt.count(e)});const{onSelectionChange:t}=this.props;t(e)}render(){const{className:e,draggablePrefix:t,draggingItemClassName:n,droppableId:s,isDoubleClickSelect:o,isDragDisabled:i,isDropDisabled:r,isMultiSelect:l,isStickyBottom:a,itemCount:c,items:d,offset:u,onFocusChange:m,onSelect:p,onViewportChange:g,renderItem:f,rowHeight:w,selectedRanges:C,style:S,"data-testid":b}=this.props;return h(pi,{isDropDisabled:r,droppableId:s,mode:"virtual",renderClone:this.getCachedRenderClone(n,d,u,f),"data-testid":b,children:(E,v)=>h("div",{role:"menu",className:B("draggable-item-list",e,{"is-drop-disabled":r,"is-drag-disabled":i,"is-dragging-from-this":v.draggingFromThisWith,"is-dragging-over":v.isDraggingOver,"is-dropping":v.draggingOverWith}),style:S,ref:E.innerRef,...E.droppableProps,children:h(sn,{focusSelector:".draggable-item-list-item",isDoubleClickSelect:o,isDragSelect:!1,isMultiSelect:l,isStickyBottom:a,itemCount:c,items:d,onFocusChange:m,onSelect:p,onSelectionChange:this.handleSelectionChange,onViewportChange:g,offset:u,ref:this.itemList,renderItem:this.getCachedRenderDraggableItem(t,i,f),rowHeight:w,selectedRanges:C})})})}};let bt=us;bt.DEFAULT_ROW_HEIGHT=30;bt.defaultProps={className:"",draggingItemClassName:"",offset:0,items:[],rowHeight:us.DEFAULT_ROW_HEIGHT,isDeselectOnClick:!0,isDoubleClickSelect:!0,isDropDisabled:!1,isDragDisabled:!1,isMultiSelect:!1,isStickyBottom:!1,disableSelect:!1,style:null,onFocusChange(){},onSelect(){},onSelectionChange(){},onViewportChange(){},renderItem:us.renderItem,selectedRanges:[],draggablePrefix:"draggable-item",droppableId:"droppable-item-list","data-testid":void 0};class gt{static reorder(t,n,s,o){const i=t===s?gt.adjustDestinationIndex(o,n):o,r=gt.removeItems(t,n);return s.splice(i,0,...r),r}static removeItems(t,n){const s=[],o=n.map((i,r)=>({range:i,index:r})).sort((i,r)=>r.range[0]-i.range[0]);for(let i=0;i<o.length;i+=1){const{range:r,index:l}=o[i],[a,c]=r;s[l]=t.splice(a,c-a+1)}return Pc(s)}static adjustDestinationIndex(t,n){let s=t;for(let o=0;o<n.length;o+=1){const[i,r]=n[o];if(i>t)break;s-=Math.min(r,t-1)-i+1}return s}static startDragging(){document.documentElement.classList.add("drag-pointer-events-none")}static stopDragging(){document.documentElement.classList.remove("drag-pointer-events-none")}}const ti=class extends T.exports.Component{static isParentSelected(e,t){const n=t.get(e);if(n===void 0)return!1;if(typeof n=="boolean")return n;const s=Array.from(n.values()).includes(!0),o=Array.from(n.values()).includes(!1);return s&&o?null:s}constructor(e){super(e),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(e){e.stopPropagation(),e.preventDefault(),this.setState(t=>{const{menuIsOpen:n}=t;return{menuIsOpen:!n}})}toggleValueFor(e,t){const{valueMap:n,onUpdateValueMap:s}=this.props,o=new Map(n),i=o.get(e);if(i instanceof Map){const l=new Map(i);if(t!=null)l.set(t,i.get(t)===void 0);else{const a=ti.isParentSelected(e,o),c=a==null||!a;i.forEach((d,u)=>l.set(u,c))}o.set(e,l)}else o.set(e,i==null||!i);const r=o.get(e);if(t===void 0&&r!==void 0&&typeof r!="boolean"){const l=ti.isParentSelected(e,n);l!=null&&l?r.forEach((a,c)=>r.set(c,!1)):r.forEach((a,c)=>r.set(c,!0))}s(o)}setAllValues(e){const{valueMap:t,onUpdateValueMap:n}=this.props,s=new Map;t.forEach((o,i)=>{if(typeof o=="boolean")s.set(i,e);else{const r=new Map;o.forEach((l,a)=>r.set(a,e)),s.set(i,r)}}),n(s)}selectAll(){this.setAllValues(!0)}clear(){this.setAllValues(!1)}renderMenuElement(){const{valueMap:e,"data-testid":t}=this.props;return R("div",{className:"hcm-menu-container",children:[Array.from(e.entries()).map(([n,s])=>R("div",{children:[h(ut,{className:"hcm-parent",checked:ti.isParentSelected(n,e),onChange:()=>this.toggleValueFor(n),children:n}),s!==void 0&&typeof s!="boolean"&&Array.from(s.entries()).map(([o,i])=>h(ut,{className:"hcm-child",checked:i,onChange:()=>this.toggleValueFor(n,o),children:o},o))]},n)),h(X,{kind:"ghost",onClick:this.selectAll,"data-testid":t!==void 0?`${t}-btn-select-all`:void 0,children:"Select All"}),h(X,{kind:"ghost",onClick:this.clear,"data-testid":t!==void 0?`${t}-btn-clear`:void 0,children:"Clear"})]})}render(){const{menuText:e,className:t,icon:n,id:s,"data-testid":o}=this.props,{menuIsOpen:i}=this.state;return R("button",{type:"button",className:B("btn hcm-btn",t),onClick:this.toggleMenu,id:s,"data-testid":o,children:[R("span",{children:[n&&h(Z,{icon:n,className:"hcm-icon mr-1"}),e]}),h(Z,{icon:Sr,className:"hcm-icon ml-1"}),h(En,{options:{placement:"bottom"},isShown:i,onExited:()=>{this.setState({menuIsOpen:!1})},closeOnBlur:!0,interactive:!0,children:this.renderMenuElement()})]})}};let uh=ti;uh.defaultProps={className:"",icon:null,id:"","data-testid":void 0};function Da({isLoaded:e=!1,isLoading:t=!0,errorMessage:n=null,"data-testid":s}){return h(dt,{in:Boolean(n)||!e||t,timeout:Le.transitionMs,classNames:e?"fade":"",mountOnEnter:!0,unmountOnExit:!0,children:h("div",{className:"fill-parent-absolute","data-testid":s,children:h("div",{className:B("iris-panel-message-overlay","fill-parent-absolute",{"iris-panel-scrim-background":e}),children:R("div",{className:"message-content",children:[R("div",{className:"message-icon",children:[t&&h(Vt,{}),!t&&n!=null&&h(Z,{icon:Yn})]}),h("div",{className:"message-text",children:n})]})})})})}function Na({on:e,id:t,className:n,isInvalid:s,disabled:o=!1,onClick:i,"data-testid":r}){return h("button",{type:"button",className:B("btn","btn-switch",n,{active:e},{"is-invalid":s}),id:t,onClick:i,disabled:o,"data-testid":r,children:h("div",{className:"handle"})})}function gl(e){return e.isOn!==void 0}function hh({item:e,onSelect:t=()=>{},"data-testid":n}){const{icon:s,subtitle:o,title:i}=e,r=T.exports.useMemo(()=>gl(e)?()=>{e.onChange(!e.isOn)}:t,[e,t]);return R("div",{className:"btn btn-navigation-menu-item","data-testid":`menu-item-${i}`,onClick:r,onKeyDown:l=>{(l.key==="Enter"||l.key===" ")&&r()},tabIndex:0,role:"menuitem",children:[s!==void 0&&h("div",{className:"icon",children:h(Z,{icon:s})}),h("div",{className:"title",children:i}),o!==void 0&&h("div",{className:"shortcut",children:o}),h("div",{className:"accessory","data-testid":n,children:gl(e)?h(Na,{on:e.isOn,onClick:l=>{l.stopPropagation(),r()}}):h(Z,{icon:oa})})]})}function Fa({items:e,onSelect:t=()=>{},"data-testid":n}){return h("div",{className:"navigation-menu-view","data-testid":n,children:h("ul",{className:"navigation-menu-list",children:e.map((s,o)=>h("li",{children:h(hh,{item:s,onSelect:()=>{t(o)}})},s.title))})})}function fl({children:e,onBack:t,onClose:n,title:s,"data-testid":o}){return R("div",{className:"navigation-page","data-testid":o,children:[R("div",{className:"navigation-title-bar",children:[h("div",{className:"navigation-left-buttons",children:t!==void 0&&h(X,{kind:"ghost",className:"btn-back","data-testid":"btn-page-back",onClick:t,icon:$d,children:"Back"})}),h("div",{className:"navigation-title",children:s}),h("div",{className:"navigation-right-buttons",children:n!==void 0&&h(X,{kind:"ghost",className:"btn-close px-2 m-1","data-testid":"btn-page-close",onClick:n,icon:go,tooltip:"Close"})})]}),h("div",{className:"navigation-content",children:e})]})}function mh({children:e,"data-testid":t}){const n=T.exports.useMemo(()=>te.Children.toArray(e),[e]),s=Er(n),[o,i]=T.exports.useState(n[n.length-1]),[r,l]=T.exports.useState(null),[a,c]=T.exports.useState(null);T.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!==o&&i(p):n.length>s.length?l(p):n.length<s.length&&(i(p),c(s[s.length-1]))},[n,s,r,a,o]);const d=T.exports.useCallback(()=>{i(r),l(null)},[r]),u=T.exports.useCallback(()=>{c(null)},[]);return R("div",{className:"navigation-stack",children:[h("div",{className:"main-view","data-testid":t,children:o}),h(dt,{in:a!=null,timeout:Le.transitionMidMs,classNames:"slide-right",onEntered:u,children:h(Fe,{children:a!=null&&h("div",{className:"popping-view",children:a})})}),h(dt,{in:r!=null,timeout:Le.transitionMidMs,classNames:"slide-left",onEntered:d,children:h(Fe,{children:r!=null&&h("div",{className:"pushing-view",children:r})})})]})}function ph({children:e,disabled:t,value:n,"data-testid":s}){return h("option",{value:n,disabled:t,"data-testid":s,children:e})}function Mr(e){const{children:t,disabled:n=!1,name:s,onChange:o,value:i="","data-testid":r}=e,[l]=T.exports.useState(s!=null?s:nn());return h(Fe,{children:te.Children.map(t,a=>{var c,d;return a?te.cloneElement(a,{name:l,onChange:(c=a.props.onChange)!=null?c:o,checked:i===a.props.value,disabled:(d=a.props.disabled)!=null?d:n,"data-testid":r}):null})})}const vn=te.forwardRef((e,t)=>{const{checked:n,children:s,className:o="",disabled:i=!1,inputClassName:r="",isInvalid:l=!1,labelClassName:a="",name:c,onChange:d,value:u,"data-testid":m}=e,[p]=T.exports.useState(nn());return R("div",{className:B("custom-control custom-radio",o),children:[h("input",{type:"radio",id:p,"data-testid":m,name:c,ref:t,className:B("custom-control-input",r,{"is-invalid":l}),checked:n,disabled:i,value:u,onChange:d}),h("label",{className:B("custom-control-label",a),htmlFor:p,children:s})]})});vn.displayName="RadioItem";vn.defaultProps={checked:void 0,className:"",disabled:!1,inputClassName:"",isInvalid:!1,labelClassName:"",name:void 0,onChange:void 0,"data-testid":void 0};function gh({children:e,onBlur:t,onChange:n,className:s,defaultValue:o,name:i,value:r,disabled:l,"data-testid":a}){const c=T.exports.useCallback(d=>{n(d.target.value)},[n]);return h("select",{className:B("custom-select",s),onBlur:t,onChange:c,defaultValue:o,value:r,name:i,disabled:l,"data-testid":a,children:e})}class xa extends T.exports.PureComponent{constructor(t){super(t),this.getCachedItem=he((n,s,o,i,r,l,a)=>{const c={height:r},d=i!=null?i:o;return h("li",{className:"value-list-item",style:c,tabIndex:-1,children:h(ut,{checked:l,disabled:a,onChange:()=>this.handleSelect(n),children:d})},s)},{max:1e3}),this.getCachedItems=he((n,s,o,i)=>{const r=[];for(let l=0;l<n.length;l+=1){const a=n[l],{value:c,displayValue:d,isSelected:u}=a,m=o+l,p=m,g=this.getCachedItem(m,p,c,d,s,u,i);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=te.createRef(),this.topRow=null,this.bottomRow=null}componentDidMount(){this.sendViewportUpdate()}componentDidUpdate(){this.sendViewportUpdate()}handleBlur(t){if(!t.relatedTarget||this.list.current&&t.relatedTarget instanceof HTMLElement&&!this.list.current.contains(t.relatedTarget)){const{onBlur:n}=this.props;n==null||n(t)}}handleScroll(){this.sendViewportUpdate()}handleSelect(t){const{items:n,offset:s,onSelect:o}=this.props,i=t-s;if(i>=0&&i<n.length){const r=n[i],{value:l}=r;o(t,l)}else o(t,null)}sendViewportUpdate(){if(!this.list.current||this.list.current.clientHeight===0)return;const{onViewportChange:t,rowHeight:n}=this.props,s=this.list.current.scrollTop,o=s+this.list.current.clientHeight,i=Math.floor(s/n),r=Math.ceil(o/n);(this.topRow!==i||this.bottomRow!==r)&&(this.topRow=i,this.bottomRow=r,t(i,r))}getElement(t){return this.list.current==null?null:this.list.current.querySelectorAll(".value-list-item")[t]}scrollIntoView(t){const n=this.getElement(t);n==null||n.scrollIntoView({block:"center"})}render(){const{className:t,disabled:n,isInvalid:s,items:o,itemCount:i,offset:r,rowHeight:l,"data-testid":a}=this.props,c=this.getCachedItems(o,l,r,n);return h("div",{className:B("select-value-list-scroll-pane h-100 w-100",{"is-invalid":s},t),onBlur:this.handleBlur,onScroll:this.handleScroll,ref:this.list,"data-testid":a,children:h("div",{className:"select-value-list",style:{height:i*l},children:h("ol",{className:"select-value-list-content",style:{position:"absolute",height:o.length*l,top:r*l,left:0},children:c})})})}}xa.defaultProps={disabled:!1,rowHeight:21,onBlur:()=>{},"data-testid":void 0};const Cl=se.module("Shortcut");var ie=(e=>(e.CTRL="MODIFIER_CTRL",e.CMD="MODIFIER_CMD",e.ALT="MODIFIER_ALT",e.OPTION="MODIFIER_OPTION",e.SHIFT="MODIFIER_SHIFT",e))(ie||{}),ae=(e=>(e.A="A",e.B="B",e.C="C",e.D="D",e.E="E",e.F="F",e.G="G",e.H="H",e.I="I",e.J="J",e.K="K",e.L="L",e.M="M",e.N="N",e.O="O",e.P="P",e.Q="Q",e.R="R",e.S="S",e.T="T",e.U="U",e.V="V",e.W="W",e.X="X",e.Y="Y",e.Z="Z",e.ZERO="0",e.ONE="1",e.TWO="2",e.THREE="3",e.FOUR="4",e.FIVE="5",e.SIX="6",e.SEVEN="7",e.EIGHT="8",e.NINE="9",e.BACKSPACE="Backspace",e.ESCAPE="Escape",e.ENTER="Enter",e.DELETE="Delete",e.SLASH="/",e.QUESTION_MARK="?",e.BACKSLASH="\\",e.PIPE="|",e.MINUS="-",e.UNDERSCORE="_",e.EQUALS="=",e.PLUS="+",e.BACKTICK="`",e.TILDE="~",e.COMMA=",",e.LEFT_CHEVRON="<",e.PERIOD=".",e.RIGHT_CHEVRON=">",e.SEMICOLON=";",e.COLON=":",e.SINGLE_QUOTE="'",e.DOUBLE_QUOTE='"',e.LEFT_BRACKET="[",e.RIGHT_BRACKET="]",e.LEFT_CURLY="{",e.RIGHT_CURLY="}",e.F1="F1",e.F2="F2",e.F3="F3",e.F4="F4",e.F5="F5",e.F6="F6",e.F7="F7",e.F8="F8",e.F9="F9",e.F10="F10",e.F11="F11",e.F12="F12",e))(ae||{});const fh=new Set(["Enter","Delete","F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12"]),Xe=class extends dr{constructor({id:e,shortcut:t,macShortcut:n,isEditable:s=!0,name:o,tooltip:i}){super(),this.id=e,this.name=o,this.tooltip=i,this.isEditable=s;const l=Xe.isMacPlatform?n:t;this.defaultKeyState=Xe.createKeyState(l),this.keyState=this.defaultKeyState}static isAllowedKey(e){return Object.values(ae).includes(e)}static isValidKeyState(e){const{keyValue:t}=e;return t===null?!0:!Xe.isMacPlatform&&e.metaKey||!Xe.isAllowedKey(t)?!1:!(!e.altKey&&!e.ctrlKey&&!e.metaKey&&!e.shiftKey)||fh.has(t)}static createKeyState(e){const t={altKey:!1,ctrlKey:!1,metaKey:!1,shiftKey:!1,keyValue:e[e.length-1]};return e.forEach(n=>{switch(n){case"MODIFIER_CTRL":t.ctrlKey=!0;break;case"MODIFIER_ALT":case"MODIFIER_OPTION":t.altKey=!0;break;case"MODIFIER_CMD":t.metaKey=!0;break;case"MODIFIER_SHIFT":t.shiftKey=!0;break}}),t}static getKeyStateFromEvent(e){const{key:t,keyCode:n}=e;let s="";return t==="Shift"||t==="Meta"||t==="Control"||t==="Alt"?s="":!Xe.isAllowedKey(t)&&Xe.isAllowedKey(String.fromCharCode(n))?s=String.fromCharCode(n):s=t,{keyValue:s,altKey:e.altKey,ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey}}static getWindowsDisplayText(e){let t="";return e.ctrlKey&&(t+="Ctrl+"),e.altKey&&(t+="Alt+"),e.shiftKey&&(t+="Shift+"),e.keyValue==="Escape"?t+="Esc":e.keyValue!==null&&(t+=e.keyValue),t}static getMacDisplayText(e){let t="";switch(e.ctrlKey&&(t+="\u2303"),e.altKey&&(t+="\u2325"),e.shiftKey&&(t+="\u21E7"),e.metaKey&&(t+="\u2318"),e.keyValue){case"Enter":t+="\u23CE";break;case"Escape":t+="\u238B";break;case"Backspace":t+="\u232B";break;case"Delete":t+="\u2326";break;case null:break;default:t+=e.keyValue}return t}static doKeyStatesMatch(e,t){var n,s;return((n=e.keyValue)==null?void 0:n.toUpperCase())===((s=t.keyValue)==null?void 0:s.toUpperCase())&&e.altKey===t.altKey&&e.ctrlKey===t.ctrlKey&&e.metaKey===t.metaKey&&e.shiftKey===t.shiftKey}static getDisplayText(e){return e.keyValue===null?"":Xe.isMacPlatform?Xe.getMacDisplayText(e):Xe.getWindowsDisplayText(e)}getDisplayText(){return Xe.getDisplayText(this.keyState)}getKeyState(){return this.keyState}setKeyState(e){Xe.isValidKeyState(e)?(Cl.debug2(`Shortcut ${this.id} updated to ${JSON.stringify(e)}`),this.keyState=e,this.dispatchEvent(new Me("onUpdate",{detail:this}))):Cl.debug2(`Shortcut ${this.id} tried to update to invalid keyState ${JSON.stringify(e)}`)}getDefaultKeyState(){return this.defaultKeyState}isDefault(){return Xe.doKeyStatesMatch(this.getDefaultKeyState(),this.getKeyState())}setToNull(){this.setKeyState(Xe.NULL_KEY_STATE)}isNull(){return Xe.doKeyStatesMatch(this.keyState,Xe.NULL_KEY_STATE)}setToDefault(){this.setKeyState(this.defaultKeyState)}matchesKeyState(e){return Xe.doKeyStatesMatch(e,this.keyState)}matchesEvent(e){return this.matchesKeyState(Xe.getKeyStateFromEvent(e))}};let Dr=Xe;Dr.NULL_KEY_STATE={metaKey:!1,shiftKey:!1,altKey:!1,ctrlKey:!1,keyValue:null};Dr.isMacPlatform=Ne.isMacPlatform();const wl=se.module("ShortcutRegistry");class Ch extends dr{constructor(){super(...arguments),this.shortcutMap=new Map,this.shortcutsByCategory=new Map}createAndAdd(t){const n=new Dr(t);return this.add(n)}add(t){var o;const n=this.shortcutMap.get(t.id);if(n)return wl.warn(`Skipping attempt to add duplicate shortcut ID to registry: ${t.id}`),n;wl.debug2(`Adding shortcut to registry: ${t.id}`),t.addEventListener("onUpdate",({detail:i})=>this.dispatchEvent(new Me("onUpdate",{detail:i})));const s=t.id.split(".")[0];return this.shortcutMap.set(t.id,t),this.shortcutsByCategory.has(s)?(o=this.shortcutsByCategory.get(s))==null||o.push(t):this.shortcutsByCategory.set(s,[t]),t}get(t){return this.shortcutMap.get(t)}getConflictingShortcuts(t){return Array.from(this.shortcutMap.values()).filter(n=>!n.isNull()&&n.matchesKeyState(t))}}const De=Object.freeze(new Ch),Nr={COPY:De.createAndAdd({id:"GLOBAL.COPY",name:"Copy",shortcut:[ie.CTRL,ae.C],macShortcut:[ie.CMD,ae.C],isEditable:!1}),PASTE:De.createAndAdd({id:"GLOBAL.PASTE",name:"Paste",shortcut:[ie.CTRL,ae.V],macShortcut:[ie.CMD,ae.V],isEditable:!1}),SAVE:De.createAndAdd({id:"GLOBAL.SAVE",name:"Save",shortcut:[ie.CTRL,ae.S],macShortcut:[ie.CMD,ae.S],isEditable:!1}),SELECT_ALL:De.createAndAdd({id:"GLOBAL.SELECT_ALL",name:"Select All",shortcut:[ie.CTRL,ae.A],macShortcut:[ie.CMD,ae.A],isEditable:!1}),LINKER:De.createAndAdd({id:"GLOBAL.LINKER",name:"Linker",shortcut:[ie.CTRL,ae.L],macShortcut:[ie.CMD,ae.L]}),LINKER_CLOSE:De.createAndAdd({id:"GLOBAL.LINKER_CLOSE",name:"Close Linker Overlay",shortcut:[ae.ESCAPE],macShortcut:[ae.ESCAPE],isEditable:!1})};const Aa=te.forwardRef((e,t)=>{const{children:n,className:s,disabled:o,id:i,isLinked:r,isLinkedSource:l,isInvalid:a,onClick:c,onMouseEnter:d,onMouseLeave:u,style:m,"data-testid":p}=e;return R("button",{ref:t,type:"button",className:B("btn-socketed",{"btn-socketed-linked":r!==void 0&&r||l},{"btn-socketed-linked-source":l},{"is-invalid":a},s),id:i,onClick:c,onMouseEnter:d,onMouseLeave:u,style:m,disabled:o,"data-testid":p,children:[n,h(Z,{icon:ra,className:"linked btn-socketed-icon",transform:"down-1"}),h(Z,{icon:vu,className:"is-invalid btn-socketed-icon"})]})});Aa.displayName="SocketedButton";Aa.defaultProps={children:void 0,className:"",disabled:!1,id:void 0,isLinked:!1,isLinkedSource:!1,isInvalid:!1,onClick:void 0,onMouseEnter:void 0,onMouseLeave:void 0,style:void 0,"data-testid":void 0};const wh="_track_535ju_30",Sh="_handle_535ju_13",bh="_ticks_535ju_98",Oa={"handle-size":"15px","popover-width":"90px","time-slider":"_time-slider_535ju_3","time-slider-popovers":"_time-slider-popovers_535ju_8","handle-popper":"_handle-popper_535ju_13","flex-spacer":"_flex-spacer_535ju_26",track:wh,"track-fills":"_track-fills_535ju_37","track-fill":"_track-fill_535ju_37","track-fill-start":"_track-fill-start_535ju_55","track-fill-middle":"_track-fill-middle_535ju_56","track-fill-end":"_track-fill-end_535ju_59","handle-track":"_handle-track_535ju_62",handle:Sh,ticks:bh,"tick-labels":"_tick-labels_535ju_116","tick-label":"_tick-label_535ju_116","tick-label-wrapper":"_tick-label-wrapper_535ju_132"};parseInt(Oa["handle-size"],10);parseInt(Oa["popover-width"],10);Object.freeze({ERROR:"error"});class ka extends Error{constructor(){super(...arguments),this.isAssertionFailed=!0}}function Sl(e){if(e==null)throw new ka(`Expected 'val' to be defined, but received ${e}`)}class Ui extends Error{constructor(){super(...arguments),this.isPasteError=!0}}function He(e){return(e==null?void 0:e.isEditable)!==void 0}function bl(e){if(!He(e))throw new ka(`Expected 'model' to be editable, but received ${e}`)}function ke(e){return(e==null?void 0:e.hasExpandableRows)!==void 0}var Pt=(e=>(e.DOWN="DOWN",e.UP="UP",e.LEFT="LEFT",e.RIGHT="RIGHT",e))(Pt||{});const ue=class{static normalize(e,t,n,s){let o=e,i=t,r=n,l=s;return o!=null&&r!=null&&r<o&&(o=r,r=e),i!=null&&l!=null&&l<i&&(i=l,l=t),[o,i,r,l]}static makeNormalized(e,t,n,s){return new ue(...ue.normalize(e,t,n,s))}static makeCell(e,t){return new ue(e,t,e,t)}static makeColumn(e){return new ue(e,null,e,null)}static makeRow(e){return new ue(null,e,null,e)}static minOrNull(e,t){return e==null||t==null?null:Math.min(e,t)}static maxOrNull(e,t){return e==null||t==null?null:Math.max(e,t)}static consolidate(e){const t=e.slice();let n=!0;for(;n;){n=!1;for(let s=0;s<t.length&&!n;s+=1){const o=t[s];for(let i=t.length-1;i>s;i-=1){const r=t[i];if(o.contains(r))t.splice(i,1);else if(r.contains(o)){n=!0,t[s]=r,t.splice(i,1);break}else if(o.startRow===r.startRow&&o.endRow===r.endRow){if(o.touches(r)){const{startRow:l,endRow:a}=o,c=ue.minOrNull(o.startColumn,r.startColumn),d=ue.maxOrNull(o.endColumn,r.endColumn);n=!0,t[s]=new ue(c,l,d,a),t.splice(i,1);break}}else if(o.startColumn===r.startColumn&&o.endColumn===r.endColumn&&o.touches(r)){const{startColumn:l,endColumn:a}=o,c=ue.minOrNull(o.startRow,r.startRow),d=ue.maxOrNull(o.endRow,r.endRow);n=!0,t[s]=new ue(l,c,a,d),t.splice(i,1);break}}}}return t}static isAxisRangeTouching(e,t,n,s){return e==null?t==null||n==null?!0:n<=t+1:t==null?s==null?!0:s>=e-1:n==null?s==null?!0:e<=s+1:s==null?t>=n-1:n>=e-1?n<=t+1:s>=e-1}static rangeArraysEqual(e,t){if(e===t)return!0;if(e==null||t==null||e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(!e[n].equals(t[n]))return!1;return!0}static intersection(e,t){if(e.equals(t))return e;let{startColumn:n,startRow:s,endColumn:o,endRow:i}=e;return n=n!=null&&t.startColumn!=null?Math.max(n,t.startColumn):n!=null?n:t.startColumn,o=o!=null&&t.endColumn!=null?Math.min(o,t.endColumn):o!=null?o:t.endColumn,s=s!=null&&t.startRow!=null?Math.max(s,t.startRow):s!=null?s:t.startRow,i=i!=null&&t.endRow!=null?Math.min(i,t.endRow):i!=null?i:t.endRow,n!=null&&n>(o!=null?o:-1)||s!=null&&s>(i!=null?i:-1)?null:new ue(n,s,o,i)}static subtractFromRange(e,t){const n=[],s=ue.intersection(e,t);return s==null?[e]:(s.startRow!=null&&(e.startRow==null||e.startRow<s.startRow)&&n.push(new ue(e.startColumn,e.startRow,e.endColumn,s.startRow-1)),s.startColumn!=null&&(e.startColumn==null||e.startColumn<s.startColumn)&&n.push(new ue(e.startColumn,s.startRow,s.startColumn-1,s.endRow)),s.endColumn!=null&&(e.endColumn==null||e.endColumn>s.endColumn)&&n.push(new ue(s.endColumn+1,s.startRow,e.endColumn,s.endRow)),s.endRow!=null&&(e.endRow==null||e.endRow>s.endRow)&&n.push(new ue(e.startColumn,s.endRow+1,e.endColumn,e.endRow)),n)}static subtractFromRanges(e,t){const n=[];for(let s=0;s<e.length;s+=1)n.push(...ue.subtractFromRange(e[s],t));return n}static subtractRangesFromRanges(e,t){let n=[...e];for(let s=0;s<t.length;s+=1)n=ue.subtractFromRanges(n,t[s]);return n}static isBounded(e){return e.startRow!=null&&e.startColumn!=null&&e.endRow!=null&&e.endColumn!=null}static boundedRange(e,t,n){var s,o,i,r;return ue.isBounded(e)?e:new ue((s=e.startColumn)!=null?s:0,(o=e.startRow)!=null?o:0,(i=e.endColumn)!=null?i:t-1,(r=e.endRow)!=null?r:n-1)}static boundedRanges(e,t,n){return e.map(s=>ue.boundedRange(s,t,n))}static offset(e,t,n){return new ue(e.startColumn!=null?e.startColumn+t:null,e.startRow!=null?e.startRow+n:null,e.endColumn!=null?e.endColumn+t:null,e.endRow!=null?e.endRow+n:null)}static nextCell(e,t=null,n=null,s=ue.SELECTION_DIRECTION.DOWN){if(e.length===0)return null;let o=-1;if(t!=null&&n!=null&&(o=e.findIndex(i=>i.containsCell(t,n)),o>=0)){const r=e[o].nextCell(t,n,s);if(r!=null)return r}switch(s){case ue.SELECTION_DIRECTION.DOWN:case ue.SELECTION_DIRECTION.RIGHT:{const i=o<e.length-1?o+1:0;return e[i].startCell(s)}case ue.SELECTION_DIRECTION.LEFT:case ue.SELECTION_DIRECTION.UP:{const i=o>0?o-1:e.length-1;return e[i].startCell(s)}default:throw new Error(`Invalid direction: ${s}`)}}static cellCount(e){return e.reduce((t,n)=>{var s,o,i,r;return t+(((s=n.endRow)!=null?s:NaN)-((o=n.startRow)!=null?o:NaN)+1)*(((i=n.endColumn)!=null?i:NaN)-((r=n.startColumn)!=null?r:NaN)+1)},0)}static rowCount(e){return e.reduce((t,n)=>{var s,o;return t+((s=n.endRow)!=null?s:NaN)-((o=n.startRow)!=null?o:NaN)+1},0)}static columnCount(e){return e.reduce((t,n)=>{var s,o;return t+((s=n.endColumn)!=null?s:NaN)-((o=n.startColumn)!=null?o:NaN)+1},0)}static containsCell(e,t,n){for(let s=0;s<e.length;s+=1)if(e[s].containsCell(t,n))return!0;return!1}static forEachCell(e,t,n=ue.SELECTION_DIRECTION.RIGHT){for(let s=0;s<e.length;s+=1)e[s].forEach(t,n)}constructor(e,t,n,s){this.startColumn=e,this.startRow=t,this.endColumn=n,this.endRow=s}equals(e){return this.startColumn===e.startColumn&&this.startRow===e.startRow&&this.endColumn===e.endColumn&&this.endRow===e.endRow}contains(e){return(this.startColumn==null||e.startColumn!=null&&this.startColumn<=e.startColumn)&&(this.startRow==null||e.startRow!=null&&this.startRow<=e.startRow)&&(this.endColumn==null||e.endColumn!=null&&this.endColumn>=e.endColumn)&&(this.endRow==null||e.endRow!=null&&this.endRow>=e.endRow)}containsCell(e,t){return e==null||t==null?!1:(this.startColumn==null||this.startColumn<=e)&&(this.endColumn==null||this.endColumn>=e)&&(this.startRow==null||this.startRow<=t)&&(this.endRow==null||this.endRow>=t)}touches(e){return ue.isAxisRangeTouching(this.startRow,this.endRow,e.startRow,e.endRow)&&ue.isAxisRangeTouching(this.startColumn,this.endColumn,e.startColumn,e.endColumn)}subtract(e){return ue.subtractFromRange(this,e)}startCell(e=ue.SELECTION_DIRECTION.DOWN){if(!ue.isBounded(this))throw new Error("Cannot get the startCell of an unbounded range");switch(e){case ue.SELECTION_DIRECTION.DOWN:case ue.SELECTION_DIRECTION.RIGHT:return{column:this.startColumn,row:this.startRow};case ue.SELECTION_DIRECTION.LEFT:case ue.SELECTION_DIRECTION.UP:return{column:this.endColumn,row:this.endRow};default:throw new Error(`Invalid direction: ${e}`)}}nextCell(e,t,n){if(!ue.isBounded(this))throw new Error("Bounded range required");if(e==null||t==null)throw new Error("Require a non-null cursor");const{startColumn:s,endColumn:o,startRow:i,endRow:r}=this;switch(n){case ue.SELECTION_DIRECTION.DOWN:if(t<r)return{column:e,row:Math.max(t+1,i)};if(e<o)return{column:Math.max(e+1,s),row:i};break;case ue.SELECTION_DIRECTION.UP:if(t>i)return{column:e,row:Math.min(t-1,r)};if(e>s)return{column:Math.min(e-1,o),row:r};break;case ue.SELECTION_DIRECTION.RIGHT:if(e<o)return{column:Math.max(e+1,s),row:t};if(t<r)return{column:s,row:Math.max(t+1,i)};break;case ue.SELECTION_DIRECTION.LEFT:if(e>s)return{column:Math.min(e-1,o),row:t};if(t>i)return{column:o,row:Math.min(t-1,r)};break;default:throw new Error(`Invalid direction: ${n}`)}return null}forEach(e,t=ue.SELECTION_DIRECTION.RIGHT){var i;let n=0,{column:s,row:o}=this.startCell(t);for(;s!=null&&o!=null;)e(s,o,n),n+=1,{column:s,row:o}=(i=this.nextCell(s,o,t))!=null?i:{}}};let ee=ue;ee.SELECTION_DIRECTION=Pt;function vh(e){return Array.isArray(e)&&e.length===2&&(e[0]===null||typeof e[0]=="number")&&(e[1]===null||typeof e[1]=="number")}function $o(e){return vh(e)&&e[0]!=null&&e[1]!=null}const Ce=class{static getGridPointFromXY(e,t,n){const s=Ce.getColumnAtX(e,n),o=Ce.getRowAtY(t,n),i=Ce.getColumnHeaderDepthAtY(t,n);return{x:e,y:t,row:o,column:s,columnHeaderDepth:i}}static getCellInfoFromXY(e,t,n){const{row:s,column:o}=Ce.getGridPointFromXY(e,t,n),{allColumnWidths:i,allRowHeights:r,allColumnXs:l,allRowYs:a,modelColumns:c,modelRows:d}=n,u=s!==null?d.get(s):null,m=o!==null?c.get(o):null,p=o!==null?l.get(o):null,g=s!==null?a.get(s):null,f=o!==null?i.get(o):null,w=s!==null?r.get(s):null;return{row:s,column:o,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:w!=null?w:null}}static getColumnHeaderDepthAtY(e,t){const n=Ce.getRowAtY(e,t),{columnHeaderHeight:s,columnHeaderMaxDepth:o}=t;if(n===null&&e<=s*o)return ze(o-Math.ceil(e/s),0,o-1)}static iterateFloatingStart(e,t,n){for(let s=0;s<e&&s<t;s+=1){const o=n(s);if(o!==void 0)return o}}static iterateFloatingEnd(e,t,n){for(let s=0;s<e&&t-(e-s)>=0;s+=1){const o=n(t-(e-s));if(o!==void 0)return o}}static iterateFloating(e,t,n,s){const o=Ce.iterateFloatingStart(e,n,s);return o!==void 0?o:Ce.iterateFloatingEnd(t,n,s)}static iterateAllItems(e,t,n,s,o,i){const r=Math.max(e,n),l=Math.min(t,o-s-1);let a=Ce.iterateFloating(n,s,o,i);if(a!==void 0)return a;for(let c=r;c<=l;c+=1)if(a=i(c),a!==void 0)return a}static isInItem(e,t,n,s){var r,l;const o=(r=t.get(e))!=null?r:0,i=(l=n.get(e))!=null?l:0;return o<=s&&s<=o+i}static getItemAtOffset(e,t,n,s,o,i,r,l=!1){const a=l?void 0:Ce.iterateFloating(n,s,t,c=>{if(Ce.isInItem(c,i,r,e))return c});if(!l&&a!==void 0)return a;for(let c=0;c<o.length;c+=1){const d=o[c];if(Ce.isInItem(d,i,r,e))return d}return null}static getColumnAtX(e,t,n=!1){const{columnCount:s,floatingLeftColumnCount:o,floatingRightColumnCount:i,visibleColumns:r,allColumnXs:l,allColumnWidths:a,gridX:c}=t;return e<c?null:this.getItemAtOffset(e-c,s,o,i,r,l,a,n)}static getRowAtY(e,t){const{floatingTopRowCount:n,floatingBottomRowCount:s,rowCount:o,visibleRows:i,allRowYs:r,allRowHeights:l,gridY:a}=t;return e<a?null:this.getItemAtOffset(e-a,o,n,s,i,r,l)}static getNextShownItem(e,t,n,s){let o=n.findIndex(i=>i===e)||0;for(o-=1;o!=null&&o>=0;){const i=n[o],r=t.get(i);if(r!=null&&s.get(r)!==0)return i;o-=1}return null}static getNextShownColumn(e,t){const{modelColumns:n,visibleColumns:s,userColumnWidths:o}=t;return Ce.getNextShownItem(e,n,s,o)}static getNextShownRow(e,t){const{modelRows:n,visibleRows:s,userRowHeights:o}=t;return Ce.getNextShownItem(e,n,s,o)}static getColumnSeparatorIndex(e,t,n,s){var C,S,b,E;const{rowHeaderWidth:o,columnHeaderHeight:i,floatingColumns:r,floatingLeftWidth:l,visibleColumns:a,allColumnXs:c,allColumnWidths:d,columnHeaderMaxDepth:u}=n,{allowColumnResize:m,headerSeparatorHandleSize:p}=s;if(u*i<t||!m||p<=0)return null;const g=e-o,f=p*.5;let w=!1;for(let v=r.length-1;v>=0;v-=1){const y=r[v],M=(C=c.get(y))!=null?C:0,A=(S=d.get(y))!=null?S:0,F=A===0;if(!w||!F){let V=M+A;F?V+=f:w&&(V-=f);const H=V-f,N=V+f;if(H<=g&&g<=N)return y;w=F}}w=!1;for(let v=a.length-1;v>=0;v-=1){const y=a[v],M=(b=c.get(y))!=null?b:0,A=(E=d.get(y))!=null?E:0,F=A===0;if(M<l-A)return null;if(!w||!F){let V=M+A;F?V+=f:w&&(V-=f);const H=V-f,N=V+f;if(H<=g&&g<=N)return y;w=F}}return null}static isItemHidden(e,t){return t.get(e)===0}static isColumnHidden(e,t){const{allColumnWidths:n}=t;return Ce.isItemHidden(e,n)}static isFloatingRow(e,t){if(e==null)return!1;const{floatingTopRowCount:n,floatingBottomRowCount:s,rowCount:o}=t;return e<n||e>=o-s}static isFloatingColumn(e,t){if(e==null)return!1;const{floatingLeftColumnCount:n,floatingRightColumnCount:s,columnCount:o}=t;return e<n||e>=o-s}static getHiddenItems(e,t,n){if(!Ce.isItemHidden(e,t))return[];const s=[e],o=n.findIndex(i=>i===e);for(let i=o-1;i>=0;i-=1){const r=n[i];if(!Ce.isItemHidden(r,t))break;s.push(r)}return s}static getHiddenColumns(e,t){const{visibleColumns:n,allColumnWidths:s}=t;return Ce.getHiddenItems(e,s,n)}static getRowSeparatorIndex(e,t,n,s){var g,f;const{rowHeaderWidth:o,columnHeaderHeight:i,visibleRows:r,allRowYs:l,allRowHeights:a}=n,{allowRowResize:c,headerSeparatorHandleSize:d}=s;if(o<e||!c||d<=0)return null;const u=t-i,m=d*.5;let p=!1;for(let w=r.length-1;w>=0;w-=1){const C=r[w],S=(g=l.get(C))!=null?g:0,b=(f=a.get(C))!=null?f:0,E=b===0;if(!p||!E){let v=S+b;E?v+=m:p&&(v-=m);const y=v-m,M=v+m;if(y<=u&&u<=M)return C;p=E}}return null}static isRowHidden(e,t){const{allRowHeights:n}=t;return Ce.isItemHidden(e,n)}static getHiddenRows(e,t){const{visibleRows:n,allRowHeights:s}=t;return Ce.getHiddenItems(e,s,n)}static moveItem(e,t,n){if(e===t)return[...n];const s=[...n],o=s[s.length-1];return o!=null&&!$o(o.from)&&o.to===e?o.from===t?s.pop():s[s.length-1]={...o,to:t}:s.push({from:e,to:t}),s}static moveRange(e,t,n,s=!1){if(e[0]===e[1])return Ce.moveItem(e[0],t,n);let o=t;if(s&&e[0]<t&&(o-=e[1]-e[0]),e[0]===o)return[...n];const i=[...n],r=i[i.length-1];r!=null&&$o(r.from)&&r.from[1]-r.from[0]===e[1]-e[0]&&r.to===e[0]?i[i.length-1]={...r,to:o}:i.push({from:e,to:o});const l=i[i.length-1];return $o(l.from)&&l.from[0]===l.to&&i.pop(),i}static moveItemOrRange(e,t,n,s=!1){return Array.isArray(e)?Ce.moveRange(e,t,n,s):Ce.moveItem(e,t,n)}static applyItemMoves(e,t,n,s=!1){var i,r;let o=[[e,t]];for(let l=s?n.length-1:0;s?l>=0:l<n.length;s?l-=1:l+=1){const{from:a,to:c}=n[l];let d=1,u;$o(a)?(d=a[1]-a[0]+1,[u]=a):u=a;const m=s?c:u,p=m+d-1,g=s?u:c,f=g-m,w=[];for(let C=0;C<o.length;C+=1){const S=(i=o[C][0])!=null?i:Number.NEGATIVE_INFINITY,b=(r=o[C][1])!=null?r:Number.POSITIVE_INFINITY;let E;const v=[[S,m-1],[m,p],[p+1,b]].map(([y,M])=>[Math.max(y,S),Math.min(M,b)]).filter(([y,M])=>y<=M).map(y=>{const[M,A]=y;return m<=M&&p>=A?(E=[M+f,A+f],E):p<M?[M-d,A-d]:y}).map(y=>{const[M,A]=y;return g>M&&g<=A?[[M,g-1],[g+d,A+d]]:y===E?[y]:g<=M?[[M+d,A+d]]:[y]}).flat();w.push(...v)}o=w.map(([C,S])=>[Number.isFinite(C)?C:null,Number.isFinite(S)?S:null])}return o}static translateRange(e,t,n,s){const o=Ce.applyItemMoves(e.startColumn,e.endColumn,t,s),i=Ce.applyItemMoves(e.startRow,e.endRow,n,s),r=[];for(let l=0;l<o.length;l+=1){const a=o[l];for(let c=0;c<i.length;c+=1){const d=i[c];r.push(new ee(a[0],d[0],a[1],d[1]))}}return r}static getModelIndex(e,t){return Ce.applyItemMoves(e,e,t,!0)[0][0]}static getModelIndexes(e,t){return e.map(n=>Ce.getModelIndex(n,t))}static getModelRangeIndexes(e,t,n){return Ce.applyItemMoves(e,t,n,!0)}static getModelRange(e,t=ye,n=ye){return Ce.translateRange(e,t,n,!0)}static getModelRanges(e,t=ye,n=ye){const s=[];for(let o=0;o<e.length;o+=1)s.push(...Ce.getModelRange(e[o],t,n));return s}static getVisibleRangeIndexes(e,t,n){return Ce.applyItemMoves(e,t,n,!1)}static getVisibleRange(e,t=ye,n=ye){return this.translateRange(e,t,n,!1)}static getVisibleRanges(e,t=ye,n=ye){const s=[];for(let o=0;o<e.length;o+=1)s.push(...Ce.getVisibleRange(e[o],t,n));return s}static getVisibleIndex(e,t){return Ce.applyItemMoves(e,e,t)[0][0]}static getVisibleIndexes(e,t){return e.map(n=>Ce.getVisibleIndex(n,t))}static isMacPlatform(){const{platform:e}=window.navigator;return e.startsWith("Mac")}static getModifierKey(){return Ce.isMacPlatform()?"metaKey":"ctrlKey"}static isModifierKeyDown(e){const t=Ce.getModifierKey();return e[t]}static checkColumnHidden(e,t){return t.get(e)===0}static checkAllColumnsHidden(e,t){return t.size===0?!1:e.every(n=>t.get(n)===0)}static getScrollDragBounds(e,t,n){const{gridX:s,gridY:o,width:i,height:r,floatingTopRowCount:l,floatingBottomRowCount:a,floatingLeftColumnCount:c,floatingRightColumnCount:d,floatingLeftWidth:u,floatingRightWidth:m,floatingTopHeight:p,floatingBottomHeight:g,columnCount:f,rowCount:w}=e;let C=s,S=o,b=i,E=r;return n!=null&&(n>c&&(C+=u),n<f-d&&(b-=m)),t!=null&&(t>l&&(S+=p),t<w-a&&(E-=g)),{x1:C,y1:S,x2:b,y2:E}}static getScrollDelta(e,t=1024,n=768,s=20,o=20){let{deltaX:i,deltaY:r}=e;return!Ce.isMacPlatform()&&e.shiftKey&&e.deltaX===0&&e.deltaY!==0&&(i=e.deltaY,r=e.deltaX),(e==null?void 0:e.deltaMode)===WheelEvent.DOM_DELTA_PAGE?(i*=t,r*=n):(e==null?void 0:e.deltaMode)===WheelEvent.DOM_DELTA_LINE&&(Ce.isMacPlatform()?(i=Math.round(i*s),r=Math.round(r*o)):(i=Math.round(i*this.PIXELS_PER_LINE),r=Math.round(r*this.PIXELS_PER_LINE))),{deltaX:i,deltaY:r}}static compareRanges(e,t){return e[0]==null||e[1]==null||t[0]==null||t[1]==null?0:e[0]!==t[0]?e[0]-t[0]:e[1]-t[1]}static mergeSortedRanges(e){const t=[];for(let n=0;n<e.length;n+=1){const s=e[n],o=s[0],i=s[1];n===0?t.push([o,i]):o-1<=t[t.length-1][1]?t[t.length-1][1]=Math.max(t[t.length-1][1],i):t.push([o,i])}return t}};let W=Ce;W.PIXELS_PER_LINE=100/3;function L(e,t,n=void 0){var o;const s=(o=e.get(t))!=null?o:n;if(s!==void 0)return s;throw new Error(`Missing value for key ${t}`)}function qo(e,t=Co.CACHE_SIZE,n=Math.floor(t/2)){if(e.size>t){const s=e.keys();for(;e.size>n;)e.delete(s.next().value)}}function vl(e,t,n,s,o){const i=new Map;let r=0;for(let l=0;l<e&&l<n;l+=1)i.set(l,r),r+=L(o,l);r=s;for(let l=0;l<t&&n-l-1>=0;l+=1)r-=L(o,n-l-1),i.set(n-l-1,r);return i}const La=class{constructor({userColumnWidths:e=new Map,userRowHeights:t=new Map,calculatedColumnWidths:n=new Map,calculatedRowHeights:s=new Map,fontWidths:o=new Map,modelRows:i=new Map,modelColumns:r=new Map,movedRows:l=[],movedColumns:a=[],initialRowHeights:c=new Map,initialColumnWidths:d=new Map}={}){this.userColumnWidths=e,this.userRowHeights=t,this.calculatedRowHeights=s,this.calculatedColumnWidths=n,this.fontWidths=o,this.modelRows=i,this.modelColumns=r,this.movedRows=l,this.movedColumns=a,this.initialRowHeights=c,this.initialColumnWidths=d}getMetrics(e){const{left:t,top:n,leftOffset:s,topOffset:o,width:i,height:r,theme:l,model:a,movedRows:c,movedColumns:d,draggingColumn:u}=e,{rowHeight:m,rowHeaderWidth:p,rowFooterWidth:g,columnWidth:f,columnHeaderHeight:w,minScrollHandleSize:C,scrollBarSize:S}=l;c!==this.movedRows&&(this.movedRows=c,this.modelRows.clear()),d!==this.movedColumns&&(this.movedColumns=d,this.modelColumns.clear());const{columnCount:b,rowCount:E,floatingTopRowCount:v,floatingBottomRowCount:y,floatingLeftColumnCount:M,floatingRightColumnCount:A,columnHeaderMaxDepth:F}=a,V=this.getFirstRow(e),H=this.getFirstColumn(e),N=this.getGridX(e),P=this.getGridY(e),k=ke(a)&&a.hasExpandableRows?this.calculateTreePaddingX(e):0,z=0,K=this.getVisibleRowHeights(e),G=this.getVisibleColumnWidths(e,H,k),_=Array.from(K.keys()),q=Array.from(G.keys()),Y=new Map([...K,...this.getFloatingRowHeights(e)]),J=new Map([...G,...this.getFloatingColumnWidths(e)]),de=this.getVisibleColumnXs(J,q,s),pe=this.getVisibleRowYs(Y,_,o),ge=_.length>0?_[_.length-1]:n,Te=q.length>0?q[q.length-1]:t,fe=this.getBottomViewport(e,_,pe,Y),nt=this.getRightViewport(e,q,de,J),je=this.getFloatingTopHeight(e,Y),qe=this.getFloatingBottomHeight(e,Y),Ut=this.getFloatingLeftWidth(e,J),yt=this.getFloatingRightWidth(e,J),yn=Array.from(J.values()),Bt=Array.from(Y.values()),xe=yn.reduce(($e,vs)=>$e+vs,0)-s,we=Bt.reduce(($e,vs)=>$e+vs,0)-o,Ze=s+xe+g,Ke=o+we,ht=i-N,It=r-P,In=this.getLastLeft(e,null,ht-g),Gt=this.getLastLeft(e,null,ht-g-S),To=this.getLastTop(e,null,It-qe),ln=this.getLastTop(e,null,It-qe-S);let Mt=Gt,Mn=ln;In===0&&To===0&&(Mt=0,Mn=0);const ws=Mt>0,Ks=ws?S:0,Ss=Mn>0,bs=Ss?S:0,Eo=N,Ro=F*w,Dn=i-Eo-bs,es=r-Ro-Ks,Ni=b===1?Dn/Ze:(b-Mt)/b,yo=E===1?es/Ke:(E-Mn)/E,Xs=ws?ze(Dn*Ni,C,Dn-1):0,Ys=Ss?ze(es*yo,C,es-1):0,Io=L(J,t,0),Mo=L(Y,n,0),Fi=Io>0?s/Io:0,xi=Mo>0?o/Mo:0,Ai=b===1?s/(Ze-ht):(t+Fi)/Mt,ts=E===1?o/(Ke-It):(n+xi)/Mn,Oi=ws?Ai*(Dn-Xs):0,Do=Ss?ts*(es-Ys):0,No=[...Array(v).keys(),...[...Array(y).keys()].map($e=>E-$e-1)],Qs=new Map([...pe,...this.getFloatingRowYs(e,Y,Math.floor(r-P-Ks))]),Fo=[...Array(M).keys(),...[...Array(A).keys()].map($e=>b-$e-1)],Nn=new Map([...de,...this.getFloatingColumnXs(e,J,Math.floor(i-N-bs))]),js=[];if(u)for(let $e=u.range[0];$e<=u.range[1];$e+=1)js.push($e),J.has($e)||J.set($e,this.getVisibleColumnWidth($e,e)),Nn.has($e)||Nn.set($e,0);const xo=_.concat(No),Ao=q.concat(Fo).concat(js),Zs=this.getModelRows(xo,e),ki=this.getModelColumns(Ao,e),Oo=this.getVisibleRowTreeBoxes(Y,Zs,e),ko=this.getTopVisible(e,Qs,Y,_),Lo=this.getLeftVisible(e,Nn,J,q),Po=Mn>0?this.getBottomVisible(e,Qs,Y,_,P):ge,Ho=Mt>0?this.getRightVisible(e,Nn,J,q,N):Te,{fontWidths:_o,userColumnWidths:Li,userRowHeights:Vo,calculatedRowHeights:Uo,calculatedColumnWidths:Bo}=this;return{rowHeight:m,rowHeaderWidth:p,rowFooterWidth:g,rowCount:E,columnWidth:f,columnCount:b,columnHeaderHeight:w,floatingTopRowCount:v,floatingBottomRowCount:y,floatingLeftColumnCount:M,floatingRightColumnCount:A,gridX:N,gridY:P,firstRow:V,firstColumn:H,treePaddingX:k,treePaddingY:z,left:t,top:n,bottom:ge,right:Te,topOffset:o,leftOffset:s,topVisible:ko,leftVisible:Lo,bottomVisible:Po,rightVisible:Ho,bottomViewport:fe,rightViewport:nt,width:i,height:r,maxX:xe,maxY:we,lastLeft:Mt,lastTop:Mn,barHeight:es,barTop:Ro,barWidth:Dn,barLeft:Eo,handleHeight:Ys,handleWidth:Xs,hasHorizontalBar:ws,hasVerticalBar:Ss,verticalBarWidth:bs,horizontalBarHeight:Ks,scrollX:Oi,scrollY:Do,scrollableContentWidth:Ze,scrollableContentHeight:Ke,scrollableViewportWidth:ht,scrollableViewportHeight:It,visibleRows:_,visibleColumns:q,visibleRowHeights:K,visibleColumnWidths:G,floatingRows:No,floatingColumns:Fo,allRows:xo,allColumns:Ao,allRowHeights:Y,allColumnWidths:J,floatingTopHeight:je,floatingBottomHeight:qe,floatingLeftWidth:Ut,floatingRightWidth:yt,visibleRowYs:pe,visibleColumnXs:de,allRowYs:Qs,allColumnXs:Nn,visibleRowTreeBoxes:Oo,modelRows:Zs,modelColumns:ki,movedRows:c,movedColumns:d,fontWidths:_o,userColumnWidths:Li,userRowHeights:Vo,calculatedRowHeights:Uo,calculatedColumnWidths:Bo,columnHeaderMaxDepth:F}}getGridX(e){const{theme:t}=e,{rowHeaderWidth:n}=t;return n}getGridY(e){const{theme:t,model:n}=e,{columnHeaderHeight:s}=t,{columnHeaderMaxDepth:o}=n;return o*s}getVisibleHeight(e,t=this.getFloatingRowHeights(e)){const{height:n,theme:s}=e,{scrollBarSize:o}=s,i=this.getGridY(e),r=this.getFloatingBottomHeight(e,t),l=this.getFloatingTopHeight(e,t);return n-r-l-i-o}getVisibleWidth(e,t=this.getFloatingColumnWidths(e)){const{width:n,theme:s}=e,{scrollBarSize:o,rowFooterWidth:i}=s,r=this.getGridX(e),l=this.getFloatingRightWidth(e,t),a=this.getFloatingLeftWidth(e,t);return n-a-l-r-o-i}getFirstIndex(e,t,n){const s=e.size+1;for(let o=0;o<s;o+=1){const i=t(o,n);if(e.get(i)!==0)return o}return 0}getFirstColumn(e){return this.getFirstIndex(this.userColumnWidths,this.getModelColumn.bind(this),e)}getFirstRow(e){return this.getFirstIndex(this.userRowHeights,this.getModelRow.bind(this),e)}getLastLeft(e,t,n){const{model:s}=e,{columnCount:o,floatingRightColumnCount:i}=s;let r=Math.max(0,o-i-1);t!=null&&(r=t);let l=0;for(;r>=0;){if(l+=this.getVisibleColumnWidth(r,e),l>=n)return ze(r+1,0,t!=null?t:o-1);r-=1}return 0}getLastTop(e,t,n){const{model:s}=e,{rowCount:o,floatingBottomRowCount:i}=s;let r=Math.max(0,o-i-1);t!=null&&(r=t);let l=0;for(;r>=0;){if(l+=this.getVisibleRowHeight(r,e),l>=n)return ze(r+1,0,o-1);r-=1}return 0}getTopForTopVisible(e,t){const n=this.getFloatingTopHeight(e);let s=t,o=0;for(;s>0&&o<n;)s-=1,o+=this.getVisibleRowHeight(s,e);return s}getTopForBottomVisible(e,t){const{height:n}=e,s=this.getGridY(e),o=this.getFloatingBottomHeight(e),i=n-s-o;return this.getLastTop(e,t,i)}getLeftForLeftVisible(e,t){const n=this.getFloatingLeftWidth(e);let s=t,o=0;for(;s>0&&o<n;)s-=1,o+=this.getVisibleColumnWidth(s,e);return s}getLeftForRightVisible(e,t){const{width:n}=e,s=this.getGridX(e),o=this.getFloatingRightWidth(e),i=n-s-o;return this.getLastLeft(e,t,i)}getFloatingRowHeights(e){const{model:t}=e,{floatingTopRowCount:n,floatingBottomRowCount:s,rowCount:o}=t,i=new Map;for(let r=0;r<n&&r<o;r+=1)i.set(r,this.getVisibleRowHeight(r,e));for(let r=0;r<s&&o-r-1>=0;r+=1){const l=o-r-1;i.set(l,this.getVisibleRowHeight(l,e))}return i}getVisibleRowHeights(e){const{top:t,topOffset:n,height:s,model:o}=e;let i=0,r=t;const l=new Map,{rowCount:a}=o;for(;i<s+n&&r<a;){const c=this.getVisibleRowHeight(r,e);l.set(r,c),i+=c,r+=1}return l}getFloatingColumnWidths(e,t=this.getFirstColumn(e),n=this.calculateTreePaddingX(e)){const{model:s}=e,{columnCount:o,floatingLeftColumnCount:i,floatingRightColumnCount:r}=s,l=new Map;for(let a=0;a<i&&a<o;a+=1)l.set(a,this.getVisibleColumnWidth(a,e,t,n));for(let a=0;a<r&&o-a-1>=0;a+=1){const c=o-a-1;l.set(c,this.getVisibleColumnWidth(c,e,t,n))}return l}getVisibleColumnWidths(e,t=this.getFirstColumn(e),n=this.calculateTreePaddingX(e)){const{left:s,leftOffset:o,width:i,model:r}=e;let l=0,a=s;const c=new Map,{columnCount:d}=r;for(;l<i+o&&a<d;){const u=this.getVisibleColumnWidth(a,e,t,n);c.set(a,u),l+=u,a+=1}return c}getFloatingColumnXs(e,t,n){const{model:s}=e,{columnCount:o,floatingLeftColumnCount:i,floatingRightColumnCount:r}=s;return vl(i,r,o,n,t)}getVisibleColumnXs(e,t,n){const s=new Map;let o=-n;for(let i=0;i<t.length;i+=1){const r=t[i],l=L(e,r);s.set(r,o),o+=l}return s}getFloatingRowYs(e,t,n){const{model:s}=e,{floatingTopRowCount:o,floatingBottomRowCount:i,rowCount:r}=s;return vl(o,i,r,n,t)}getVisibleRowYs(e,t,n){const s=new Map;let o=-n;for(let i=0;i<t.length;i+=1){const r=t[i],l=L(e,r);s.set(r,o),o+=l}return s}getVisibleRowTreeBoxes(e,t,n){const s=new Map,{model:o,theme:i}=n,{treeDepthIndent:r,treeHorizontalPadding:l}=i;return ke(o)&&o.hasExpandableRows&&e.forEach((a,c)=>{const d=L(t,c);if(o.isRowExpandable(d)){const u=o.depthForRow(d),m=u*r+l,p=(u+1)*r+l,g=0,f=a;s.set(c,{x1:m,y1:g,x2:p,y2:f})}}),s}getFloatingLeftWidth(e,t=this.getFloatingColumnWidths(e)){const{model:n}=e,{floatingLeftColumnCount:s}=n;let o=0;for(let i=0;i<s;i+=1)o+=L(t,i);return o}getFloatingRightWidth(e,t=this.getFloatingColumnWidths(e)){const{model:n}=e,{floatingRightColumnCount:s,columnCount:o}=n;let i=0;for(let r=0;r<s;r+=1)i+=L(t,o-r-1);return i}getFloatingTopHeight(e,t=this.getFloatingRowHeights(e)){const{model:n}=e,{floatingTopRowCount:s}=n;let o=0;for(let i=0;i<s;i+=1)o+=L(t,i);return o}getFloatingBottomHeight(e,t=this.getFloatingRowHeights(e)){const{model:n}=e,{floatingBottomRowCount:s,rowCount:o}=n;let i=0;for(let r=0;r<s;r+=1)i+=L(t,o-r-1);return i}getTopVisible(e,t,n,s){const o=this.getFloatingTopHeight(e,n);for(let i=0;i<s.length;i+=1){const r=s[i];if(L(t,r)>=o)return r}return 0}getLeftVisible(e,t,n,s){const o=this.getFloatingLeftWidth(e,n);for(let i=0;i<s.length;i+=1){const r=s[i];if(L(t,r)>=o)return r}return 0}getBottomVisible(e,t,n,s,o){const{height:i,theme:r}=e,{scrollBarSize:l}=r,a=this.getFloatingBottomHeight(e,n),c=i-o-l-a;for(let d=s.length-1;d>=0;d-=1){const u=s[d],m=L(t,u),p=L(n,u);if(m+p<=c)return u}return 0}getRightVisible(e,t,n,s,o){const{width:i,theme:r}=e,{scrollBarSize:l}=r,a=this.getFloatingRightWidth(e,n),c=i-o-l-a;for(let d=s.length-1;d>=0;d-=1){const u=s[d],m=L(t,u),p=L(n,u);if(m+p<=c)return u}return 0}getBottomViewport(e,t,n,s){const{height:o,theme:i}=e,{rowHeight:r}=i;return this.getLastIndexViewport(t,n,s,o,r)}getRightViewport(e,t,n,s){const{width:o,theme:i}=e,{columnWidth:r}=i;return this.getLastIndexViewport(t,n,s,o,r)}getLastIndexViewport(e,t,n,s,o){let i=0,r=0;return e.length>0&&(i=e[e.length-1],r=L(t,i)+L(n,i)),r<s&&(i+=Math.ceil((s-r)/o)),i}getVisibleItemSize(e,t,n){var s;return(s=t.get(e))!=null?s:n()}getVisibleRowHeight(e,t){const n=this.getModelRow(e,t),s=this.calculateRowHeight(e,n,t);return this.getVisibleItemSize(n,this.userRowHeights,()=>{const o=this.initialRowHeights.get(n);return o!==void 0?o:s})}getVisibleColumnWidth(e,t,n=this.getFirstColumn(t),s=this.calculateTreePaddingX(t)){const o=this.getModelColumn(e,t),i=this.calculateColumnWidth(e,o,t,n,s);return this.getVisibleItemSize(o,this.userColumnWidths,()=>{const r=this.initialColumnWidths.get(o);return r!==void 0?r:i})}getModelRows(e,t){const n=new Map;for(let s=0;s<e.length;s+=1){const o=e[s],i=this.getModelRow(o,t);n.set(o,i)}return n}getModelRow(e,t){if(this.modelRows.has(e))return L(this.modelRows,e);const{movedRows:n}=t,s=W.getModelIndex(e,n);return this.modelRows.set(e,s),s}getModelColumns(e,t){const n=new Map;for(let s=0;s<e.length;s+=1){const o=e[s],i=this.getModelColumn(o,t);n.set(o,i)}return n}getModelColumn(e,t){if(this.modelColumns.has(e))return L(this.modelColumns,e);const{movedColumns:s}=t,o=W.getModelIndex(e,s);return this.modelColumns.set(e,o),o}calculateRowHeight(e,t,n){const{theme:s}=n,{autoSizeRows:o,rowHeight:i}=s;if(!o)return i;const r=this.calculatedRowHeights.get(t);return r!=null?r:(this.calculatedRowHeights.set(t,Math.ceil(i)),qo(this.calculatedRowHeights),i)}calculateColumnWidth(e,t,n,s=this.getFirstColumn(n),o=this.calculateTreePaddingX(n)){const{theme:i}=n,{autoSizeColumns:r,minColumnWidth:l}=i;if(!r){const{columnWidth:m}=i;return m}const a=this.calculateColumnHeaderWidth(t,n),c=this.calculateColumnDataWidth(t,n),d=this.calculatedColumnWidths.get(t);let u=Math.ceil(Math.max(a,c));return u=Math.max(l,u),d!=null&&d>u?u=d:(this.calculatedColumnWidths.set(t,u),qo(this.calculatedColumnWidths)),e===s&&(u+=o),u}calculateColumnHeaderWidth(e,t){const{model:n,theme:s}=t,{headerFont:o,headerHorizontalPadding:i}=s,r=n.textForColumnHeader(e,0);if(r!==void 0&&r!==""){const l=this.getWidthForFont(o,t);return r.length*l+i*2}return i*2}calculateColumnDataWidth(e,t){const{top:n,height:s,width:o,model:i,theme:r}=t,{floatingTopRowCount:l,floatingBottomRowCount:a,rowCount:c}=i,{font:d,cellHorizontalPadding:u,rowHeight:m,rowHeaderWidth:p,rowFooterWidth:g,scrollBarSize:f}=r;let w=0;const C=this.getWidthForFont(d,t),S=s/m,b=Math.ceil(n+S);return W.iterateAllItems(n,b,l,a,c,E=>{const v=this.getModelRow(E,t),y=i.textForCell(e,v);if(y){const M=u*2;w=Math.max(w,y.length*C+M)}}),w=Math.max(Math.min(w,(o-p-f-g)*La.MAX_COLUMN_WIDTH),u*2),w}calculateTreePaddingX(e){const{top:t,height:n,model:s,theme:o}=e,{rowHeight:i,treeDepthIndent:r}=o;if(!ke(s)||!s.hasExpandableRows)return 0;let l=0;const a=n/i,c=Math.ceil(t+a);for(let d=t;d<=c;d+=1){const u=this.getModelRow(d,e),m=s.depthForRow(u);l=Math.max(l,r*(m+1))}return l}getWidthForFont(e,t){if(this.fontWidths.has(e))return L(this.fontWidths,e);const{context:n}=t;n.font=e;const s=n.measureText("8"),{width:o}=s;return this.fontWidths.set(e,o),this.fontWidths.set(n.font,o),o}setColumnWidth(e,t){const n=new Map(this.userColumnWidths);n.set(e,Math.ceil(t)),qo(n),this.userColumnWidths=n}resetColumnWidth(e){const t=new Map(this.userColumnWidths);t.delete(e),this.userColumnWidths=t}setRowHeight(e,t){const n=new Map(this.userRowHeights);n.set(e,Math.ceil(t)),qo(n),this.userRowHeights=n}resetRowHeight(e){const t=new Map(this.userRowHeights);t.delete(e),this.userRowHeights=t,this.calculatedRowHeights.delete(e)}};let Co=La;Co.CACHE_SIZE=1e4;Co.MAX_COLUMN_WIDTH=.8;const Th=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"}),Et=(e,t)=>{let n=!1;const s=he(e,{...t,dispose:()=>{n||(n=!0,s.clear(),n=!1)}});return s};function Eh(e,t,n=6){const s=Ji.hex.lab.raw(e);return s[0]=Math.max(s[0]-s[0]/n*t,0),`#${Ji.lab.hex(s)}`}function Rh(e,t){const[n,s,o]=Ji.hex.rgb(e);return`rgba(${n}, ${s}, ${o}, ${t})`}const Tl={colorWithAlpha:Rh,darkenForDepth:Eh};class Qe{constructor(t=5e3){this.cursor=null,this.order=t}onDown(t,n,s){return!1}onMove(t,n,s){return!1}onDrag(t,n,s){return!1}onLeave(t,n,s){return!1}onClick(t,n,s){return!1}onContextMenu(t,n,s){return!1}onDoubleClick(t,n,s){return!1}onUp(t,n,s){return!1}onWheel(t,n,s){return!1}}class Pa extends Qe{constructor(){super(...arguments),this.resizingItems=[],this.hiddenItems=[],this.targetSizes=new Map,this.dragOffset=0}onDown(t,n){const{metrics:s}=n,{model:o}=n.props,i=n.getTheme();if(!s)throw new Error("metrics not set");const r=this.getSeparator(t,s,o,i);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(t,n){const{metrics:s}=n,{model:o}=n.props,i=n.getTheme();if(!s)throw new Error("metrics not set");const r=this.getSeparator(t,s,o,i);return r!=null?(this.updateCursor(s,r.index),!0):!1}onDrag(t,n){var f;if(this.draggingIndex==null)return!1;const s=t[this.pointProperty],{metricCalculator:o,metrics:i}=n;if(!i)throw new Error("metrics not set");const r=n.getTheme(),l=i[this.visibleOffsetProperty],a=i[this.marginProperty],c=i[this.calculatedSizesProperty],d=i[this.modelIndexesProperty],u=i[this.firstIndexProperty],m=i[this.treePaddingProperty],p=new Map;let g=this.resizingItems[this.resizingItems.length-1];for(;g!=null;){const w=L(l,g),C=s-a-w-this.dragOffset,S=L(d,g),b=this.targetSizes.get(S),E=this.resizingItems.length>1,v=this.hiddenItems.indexOf(g);let y=L(c,S);g===u&&(y+=m);let M=C;Math.abs(C-y)<=r.headerResizeSnapThreshold?M=y:b!==void 0&&C>b&&(E&&v!==0||v>0)?M=b:C<=r.headerResizeHiddenSnapThreshold&&(M=0),p.set(S,M),C<-r.headerResizeSnapThreshold&&M===0?v>=0&&E?(this.resizingItems.pop(),this.removeTargetSize(i,g),g=this.resizingItems[this.resizingItems.length-1],this.dragOffset-=(f=this.targetSizes.get(L(d,g)))!=null?f:0):(g=this.getNextShownItem(g,i),g!==null&&(this.resizingItems.push(g),this.addTargetSize(i,g))):b!==void 0&&C>b+r.headerResizeSnapThreshold&&M===b?v>0?(this.dragOffset+=M,g=this.hiddenItems[v-1],this.resizingItems.push(g),this.addTargetSize(i,g)):E?(this.resizingItems.pop(),this.removeTargetSize(i,g),g=this.resizingItems[this.resizingItems.length-1]):g=null:g=null}return p.forEach((w,C)=>{var b;const S=(b=o[this.initialSizesProperty].get(C))!=null?b:c.get(C);w===S?this.resetSize(o,C):this.setSize(o,C,w)}),this.updateCursor(i,this.draggingIndex),!0}onUp(t,n){return this.draggingIndex!=null&&(this.draggingIndex=void 0,this.resizingItems=[],this.hiddenItems=[],this.targetSizes.clear(),this.updateSeparator(n,null)),!1}onDoubleClick(t,n){const{metrics:s,metricCalculator:o}=n,{model:i}=n.props,r=n.getTheme();if(!s)throw new Error("metrics not set");const l=this.getSeparator(t,s,i,r);if(l!=null){const a=s[this.modelIndexesProperty],c=L(a,l.index),d=L(s[this.calculatedSizesProperty],c),u=o[this.initialSizesProperty].get(c);return d===u?this.resetSize(o,c):this.setSize(o,c,d),n.forceUpdate(),!0}return!1}updateCursor(t,n){const s=t[this.visibleSizesProperty];L(s,n)===0?this.cursor=this.hiddenCursor:this.cursor=this.defaultCursor}addTargetSize(t,n){const s=t[this.modelIndexesProperty],o=t[this.userSizesProperty],i=t[this.calculatedSizesProperty],r=n===0?t[this.treePaddingProperty]:0,l=L(s,n);let a=o.get(l);(a==null||a===0)&&(a=L(i,l)+r),this.targetSizes.set(l,a)}removeTargetSize(t,n){const s=t[this.modelIndexesProperty],o=L(s,n);this.targetSizes.delete(o)}}class Ti extends Pa{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.initialSizesProperty="initialColumnWidths",this.modelIndexesProperty="modelColumns",this.firstIndexProperty="firstColumn",this.treePaddingProperty="treePaddingX",this.getHiddenItems=W.getHiddenColumns,this.getNextShownItem=W.getNextShownColumn,this.getSeparator=Ti.getColumnSeparator}static getColumnSeparator(t,n,s,o){if(!o.allowColumnResize)return null;const{x:i,y:r,columnHeaderDepth:l}=t,{modelColumns:a}=n,c=W.getColumnSeparatorIndex(i,r,n,o);return c==null||l==null||l>0?null:a.get(c)!=null?{index:c,depth:0}:null}setSize(t,n,s){t.setColumnWidth(n,s)}resetSize(t,n){t.resetColumnWidth(n)}updateSeparator(t,n){t.setState({draggingColumnSeparator:n,isDragging:n!==null})}}const gn=class{constructor(){this.getCachedTruncatedString=Et((e,t,n,s,o)=>gn.truncateToWidth(e,t,n,s,o),{max:1e4}),this.getCachedBackgroundColors=Et((e,t)=>e.split(" ").map(n=>{const s=[];for(let o=0;o<t;o+=1)s.push(Tl.darkenForDepth(n,o,t));return s}),{max:1e3}),this.getCachedColorWithAlpha=Et((e,t)=>Tl.colorWithAlpha(e,t),{max:1e3}),this.getCachedColorIsDark=Et(e=>Si.isDark(e),{max:1e3})}static truncate(e,t){return t<e.length?e.substr(0,t)+"\u2026":e}static binaryTruncateToWidth(e,t,n,s=0,o=t.length,i){if(o>=t.length&&e.measureText(t).width<=n)return t;if(i!==void 0){const c=e.measureText(i).width;return i.repeat(Math.max(1,Math.floor(n/c)))}let r=s,l=Math.min(t.length-1,o),a=t;for(;l>=r;){const c=Math.ceil((l+r)/2),d=gn.truncate(t,c);if(e.measureText(d).width<=n){if(a=d,r===c)break;r=c}else if(c===0){a=d;break}else l=c-1}return a}static truncateToWidth(e,t,n,s=gn.DEFAULT_FONT_WIDTH,o){if(n<=0||t.length<=0)return"";const i=Math.min(Math.max(0,Math.floor(n/s/2)-5),t.length),r=Math.min(Math.ceil(n/s*2),t.length);return gn.binaryTruncateToWidth(e,t,n,i,r,o)}drawCanvas(e){const{context:t}=e;t.save(),this.configureContext(t,e),this.drawBackground(t,e),this.drawGrid(t,e),this.drawHeaders(t,e),this.drawFooters(t,e),this.drawDraggingColumn(t,e),this.drawDraggingRow(t,e),this.drawScrollBars(t,e),t.restore()}configureContext(e,t){const{theme:n}=t;e.font=n.font,e.textBaseline="middle",e.lineCap="butt"}drawBackground(e,t){const{theme:n,metrics:s}=t,{width:o,height:i}=s;e.fillStyle=n.backgroundColor,e.fillRect(0,0,o,i)}drawGrid(e,t){const{metrics:n,draggingRow:s,draggingColumn:o}=t,{gridX:i,gridY:r}=n;e.translate(i,r),this.drawGridBackground(e,t,s==null&&o==null),this.drawCellContents(e,t),this.drawFloatingRows(e,t),this.drawFloatingColumns(e,t),e.translate(-i,-r)}drawFloatingRows(e,t){const{draggingRow:n,draggingColumn:s,metrics:o,theme:i}=t,{floatingTopRowCount:r,floatingBottomRowCount:l,floatingRows:a,rowCount:c,visibleColumns:d,allRowYs:u,allRowHeights:m}=o;if(a.length!==0){i.floatingRowBackgroundColors&&this.drawRowStripesForRows(e,t,a,i.floatingRowBackgroundColors),n==null&&s==null&&this.drawFloatingMouseRowHover(e,t),this.drawGridLinesForItems(e,t,d,a,i.floatingGridColumnColor,i.floatingGridRowColor),this.drawCellBackgroundsForItems(e,t,d,a),this.drawFloatingBorders(e,t),r>0&&this.drawSelectedRanges(e,t,{top:0,bottom:r-1,maxY:L(u,r-1)+L(m,r-1)-.5}),l>0&&this.drawSelectedRanges(e,t,{top:c-l-1,bottom:c-1,minY:L(u,c-l)+.5,maxY:L(u,c-1)+L(m,c-1)-.5});for(let p=0;p<d.length;p+=1){const g=d[p];for(let f=0;f<a.length;f+=1){const w=a[f];this.drawCellContent(e,t,g,w)}}}}drawFloatingColumns(e,t){const{draggingRow:n,draggingColumn:s,metrics:o,theme:i}=t,{floatingLeftColumnCount:r,floatingRightColumnCount:l,floatingLeftWidth:a,floatingRightWidth:c,floatingColumns:d,gridX:u,maxX:m,columnCount:p,visibleRows:g,allColumnXs:f,allColumnWidths:w,width:C,height:S}=o;if(d.length!==0){i.floatingRowBackgroundColors&&(this.drawRowStripesForRows(e,t,g,i.floatingRowBackgroundColors,0,a),this.drawRowStripesForRows(e,t,g,i.floatingRowBackgroundColors,C-u-c,m)),n==null&&s==null&&this.drawFloatingMouseRowHover(e,t),e.save(),e.beginPath(),e.rect(0,0,a,S),e.clip(),this.drawGridLinesForItems(e,t,d,g,i.floatingGridColumnColor,i.floatingGridRowColor),e.restore(),this.drawCellBackgroundsForItems(e,t,d,g),this.drawFloatingBorders(e,t),r>0&&this.drawSelectedRanges(e,t,{left:0,maxX:L(f,r-1)+L(w,r-1)}),l>0&&this.drawSelectedRanges(e,t,{left:p-l,right:p-1,minX:L(f,p-l)+.5,maxX:L(f,p-1)+L(w,p-1)});for(let b=0;b<d.length;b+=1){const E=d[b];for(let v=0;v<g.length;v+=1){const y=g[v];this.drawCellContent(e,t,E,y)}}}}drawFloatingBorders(e,t){const{metrics:n,theme:s}=t,{floatingTopRowCount:o,floatingBottomRowCount:i,floatingLeftColumnCount:r,floatingRightColumnCount:l,rowCount:a,columnCount:c,allRowYs:d,allColumnXs:u,allRowHeights:m,allColumnWidths:p,maxX:g,maxY:f}=n,{floatingDividerOuterColor:w,floatingDividerInnerColor:C}=s;if(e.lineWidth=3,e.beginPath(),e.strokeStyle=w,o>0){const S=L(d,o-1)+L(m,o-1)+.5;e.moveTo(0,S),e.lineTo(g,S)}if(i>0){const S=L(d,a-i)-.5;e.moveTo(0,S),e.lineTo(g,S)}if(r>0){const S=L(u,r-1)+L(p,r-1)+.5;e.moveTo(S,0),e.lineTo(S,f)}if(l>0){const S=L(u,c-l)-.5;e.moveTo(S,0),e.lineTo(S,f)}if(e.stroke(),e.beginPath(),e.lineWidth=1,e.strokeStyle=C,o>0){const S=L(d,o-1)+L(m,o-1)+.5;e.moveTo(0,S),e.lineTo(g,S)}if(i>0){const S=L(d,a-i)-.5;e.moveTo(0,S),e.lineTo(g,S)}if(r>0){const S=L(u,r-1)+L(p,r-1)+.5;e.moveTo(S,0),e.lineTo(S,f)}if(l>0){const S=L(u,c-l)-.5;e.moveTo(S,0),e.lineTo(S,f)}e.stroke()}drawGridBackground(e,t,n=!1){this.drawRowStripes(e,t),n&&(this.drawMouseColumnHover(e,t),this.drawMouseRowHover(e,t)),this.drawGridLines(e,t),this.drawCellBackgrounds(e,t);const{metrics:s}=t,{bottom:o,right:i,floatingBottomRowCount:r,floatingLeftColumnCount:l,floatingRightColumnCount:a,floatingTopRowCount:c,columnCount:d,rowCount:u,allRowHeights:m,allRowYs:p,allColumnXs:g,allColumnWidths:f,width:w,height:C}=s;this.drawSelectedRanges(e,t,{bottom:Math.min(o,u-r-1),right:Math.min(i,d-a-1),minX:l>0&&g.has(l+1)?L(g,l+1):-10,minY:c>0&&p.has(c+1)?L(p,c+1):-10,maxX:a>0&&g.has(d-a-1)?L(g,d-a-1)+L(f,d-a-1)-.5:w+10,maxY:r>0&&p.has(u-r-1)?L(p,u-r-1)+L(m,u-r-1)-.5:C+10})}drawRowStripes(e,t){const{metrics:n,theme:s}=t,{visibleRows:o}=n,{rowBackgroundColors:i}=s;!i||this.drawRowStripesForRows(e,t,o,i)}drawRowStripesForRows(e,t,n,s,o=0,i=t.metrics.maxX){const{theme:r,metrics:l,model:a}=t,{maxDepth:c,shadowBlur:d,shadowColor:u}=r,m=this.getCachedBackgroundColors(s,c),{allRowYs:p,allRowHeights:g}=l,f=new Map,w=[],C=[],S=(b,E)=>{const v=ke(a)?a.depthForRow(b):0,y=m[b%m.length],M=y[Math.min(v,y.length-1)];if(f.has(M)||f.set(M,[]),f.get(M).push(b),E!=null){const A=ke(a)?a.depthForRow(E):0;A<v?w.push(b):A>v&&C.push(E)}};for(let b=0;b<n.length;b+=1){const E=n[b],v=b>0?n[b-1]:void 0;S(E,v)}if(f.forEach((b,E)=>{e.fillStyle=E,e.beginPath();for(let v=0;v<b.length;v+=1){const y=b[v],M=L(p,y),A=L(g,y);e.rect(o,M,i,A)}e.fill()}),w.length>0){e.save();const b=this.getCachedColorWithAlpha(u,.15),E=this.getCachedColorWithAlpha(u,0),v=e.createLinearGradient(0,0,0,d);v.addColorStop(0,b),v.addColorStop(1,E),e.fillStyle=v;for(let y=0;y<w.length;y+=1){const M=w[y],A=L(p,M);e.translate(0,A),e.fillRect(o,0,i,d),e.translate(0,-A)}e.restore()}if(C.length>0){e.save();const b=this.getCachedColorWithAlpha(u,0),E=this.getCachedColorWithAlpha(u,.15),v=e.createLinearGradient(0,0,0,d);v.addColorStop(0,b),v.addColorStop(1,E),e.fillStyle=v;for(let y=0;y<C.length;y+=1){const M=C[y],A=L(p,M),F=L(g,M),V=A+F-d;e.translate(0,V),e.fillRect(o,0,i,d),e.translate(0,-V)}e.restore()}}drawMouseColumnHover(e,t){const{mouseX:n,mouseY:s,theme:o,metrics:i}=t;if(n==null||s==null)return;const r=W.getColumnAtX(n,i);if(r==null||o.columnHoverBackgroundColor==null)return;const{allColumnWidths:l,allColumnXs:a,maxY:c}=i;if(s>c)return;const d=L(a,r),u=L(l,r);e.fillStyle=o.columnHoverBackgroundColor,e.fillRect(d,0,u,c)}drawMouseRowHover(e,t){const{mouseX:n,mouseY:s,theme:o,metrics:i}=t;if(n==null||s==null)return;const{maxX:r}=i;if(n>r||o.rowHoverBackgroundColor==null)return;const l=W.getRowAtY(s,i);l!=null&&this.drawMouseRowHoverForRow(e,t,l)}drawFloatingMouseRowHover(e,t){const{mouseX:n,mouseY:s,theme:o,metrics:i}=t,{maxX:r,floatingTopRowCount:l,floatingBottomRowCount:a,rowCount:c,rowFooterWidth:d}=i;if(n==null||s==null||n>r+d||o.rowHoverBackgroundColor==null)return;const u=W.getRowAtY(s,i);u!=null&&(u<l||c-a<=u)&&this.drawMouseRowHoverForRow(e,t,u)}drawMouseRowHoverForRow(e,t,n){const{metrics:s,selectedRanges:o,theme:i}=t,{allRowHeights:r,allRowYs:l,maxX:a}=s,c=L(l,n),d=L(r,n);i.rowHoverBackgroundColor!=null&&(e.fillStyle=i.rowHoverBackgroundColor);for(let u=0;u<o.length;u+=1){const{startRow:m,endRow:p}=o[u];if(m!=null&&p!=null&&m<=n&&p>=n){i.selectedRowHoverBackgroundColor!=null&&(e.fillStyle=i.selectedRowHoverBackgroundColor);break}}e.fillRect(0,c,a,d)}drawGridLines(e,t){const{metrics:n,theme:s}=t,{visibleColumns:o,visibleRows:i}=n;this.drawGridLinesForItems(e,t,o,i,s.gridColumnColor,s.gridRowColor)}drawGridLinesForItems(e,t,n,s,o,i){o==null&&i==null||(e.lineWidth=1,e.beginPath(),o!=null&&(e.strokeStyle=o,this.drawGridLinesForColumns(e,t,n)),i!=null&&(e.strokeStyle=i,this.drawGridLinesForRows(e,t,s)),e.stroke())}drawGridLinesForColumns(e,t,n){const{metrics:s}=t,{allColumnXs:o,maxY:i}=s;for(let r=0;r<n.length;r+=1){const l=n[r],a=L(o,l)+.5;e.moveTo(a,0),e.lineTo(a,i)}}drawGridLinesForRows(e,t,n){const{metrics:s}=t,{allRowYs:o,maxX:i}=s,r=i;for(let l=0;l<n.length;l+=1){const a=n[l],c=L(o,a)+.5;e.moveTo(.5,c),e.lineTo(r-.5,c)}}drawCellBackgrounds(e,t){const{metrics:n}=t,{visibleColumns:s,visibleRows:o}=n;this.drawCellBackgroundsForItems(e,t,s,o)}drawCellBackgroundsForItems(e,t,n,s){e.save();for(let o=0;o<n.length;o+=1){const i=n[o];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(e,t,i,l,a)}}e.restore()}drawCellBackground(e,t,n,s,o){const{metrics:i,model:r,theme:l}=t,{firstColumn:a,modelColumns:c,modelRows:d,allColumnXs:u,allColumnWidths:m,allRowYs:p,allRowHeights:g}=i,f=L(d,s),w=L(c,n),C=r.backgroundColorForCell(w,f,l),S=n===a,b=ke(r)&&r.hasExpandableRows;if(C!=null){const E=L(u,n)+1,v=L(p,s)+1,y=L(m,n)-1,M=L(g,s)-1;e.fillStyle=C,e.fillRect(E,v,y,M)}S&&b&&this.drawCellRowTreeDepthLines(e,t,s,o)}drawCellContents(e,t){const{metrics:n}=t,{visibleColumns:s}=n;for(let o=0;o<s.length;o+=1){const i=s[o];this.drawColumnCellContents(e,t,i)}}drawColumnCellContents(e,t,n){const{metrics:s}=t,{allColumnXs:o,allColumnWidths:i,visibleRows:r,height:l}=s,a=L(o,n),c=L(i,n);e.save(),e.beginPath(),e.rect(a,0,c,l),e.clip();for(let d=0;d<r.length;d+=1){const u=r[d];this.drawCellContent(e,t,n,u)}e.restore()}getTextRenderMetrics(e,t,n,s){const{textAlign:o}=e,{metrics:i,model:r,theme:l}=t,{firstColumn:a,allColumnXs:c,allColumnWidths:d,allRowYs:u,allRowHeights:m}=i,{cellHorizontalPadding:p,treeDepthIndent:g,treeHorizontalPadding:f}=l,w=L(c,n),C=L(u,s),S=L(d,n),b=L(m,s),E=n===a;let v=0;ke(r)&&r.hasExpandableRows&&E&&(v=g*(r.depthForRow(s)+1)+f);const y=S-v;let M=w+p;const A=C+b*.5;return o==="right"?M=w+y-p:o==="center"&&(M=w+y*.5),M+=v,{width:y-p*2,x:M,y:A}}drawCellContent(e,t,n,s,o){var E;const{metrics:i,model:r,theme:l}=t,{firstColumn:a,fontWidths:c,modelColumns:d,modelRows:u,allRowHeights:m}=i,{textColor:p}=l,g=L(m,s),f=L(u,s),w=L(d,n),C=o!=null?o:r.textForCell(w,f),S=r.truncationCharForCell(w,f),b=n===a;if(C&&g>0){const v=r.textAlignForCell(w,f)||"left";e.textAlign=v;const y=r.colorForCell(w,f,l)||p;e.fillStyle=y;const{width:M,x:A,y:F}=this.getTextRenderMetrics(e,t,n,s),V=(E=c.get(e.font))!=null?E:gn.DEFAULT_FONT_WIDTH,H=this.getCachedTruncatedString(e,C,M,V,S);H&&e.fillText(H,A,F)}b&&ke(r)&&r.hasExpandableRows&&this.drawCellRowTreeMarker(e,t,s)}drawCellRowTreeMarker(e,t,n){const{metrics:s,model:o,mouseX:i,mouseY:r,theme:l}=t,{firstColumn:a,gridX:c,gridY:d,allColumnXs:u,allColumnWidths:m,allRowYs:p,allRowHeights:g,visibleRowTreeBoxes:f}=s,{treeMarkerColor:w,treeMarkerHoverColor:C}=l,S=L(u,a),b=L(m,a),E=L(p,n),v=L(g,n);if(!ke(o)||!o.isRowExpandable(n))return;const y=L(f,n),M=i!=null&&r!=null&&i>=c+S&&i<=c+S+b&&r>=d+E&&r<=d+E+v?C:w;this.drawTreeMarker(e,t,S,E,y,M,o.isRowExpanded(n))}drawTreeMarker(e,t,n,s,o,i,r){const{x1:l,y1:a,x2:c,y2:d}=o,u=r?"\u229F":"\u229E",m=n+(l+c)*.5+.5,p=s+(a+d)*.5+.5;e.fillStyle=i,e.textAlign="center",e.fillText(u,m,p)}drawCellRowTreeDepthLines(e,t,n,s){const{metrics:o,model:i,theme:r}=t;if(!ke(i))return;const l=i.depthForRow(n);if(l===0)return;const{firstColumn:a,allColumnXs:c,allRowYs:d,allRowHeights:u}=o,{treeDepthIndent:m,treeHorizontalPadding:p,treeLineColor:g}=r,f=L(c,a),w=L(d,n),C=L(u,n),S=s!==void 0?i.depthForRow(s):0,b=l>S?l-S:0;if(e.strokeStyle=g,e.lineWidth=1,l-b>0){e.beginPath();for(let E=0;E<l-b;E+=1){const v=f+E*m+m*.5+p+.5;e.moveTo(v,w),e.lineTo(v,w+C)}e.stroke()}if(b>0){e.beginPath();for(let E=l-b;E<l;E+=1){const v=f+E*m+m*.5+p+.5;e.moveTo(v,w),e.lineTo(v,w+Math.ceil(C/2)),e.moveTo(v-.5,w+Math.ceil(C/2)+.5),e.lineTo(v+m-.5,w+Math.ceil(C/2)+.5)}e.stroke()}}drawHeaders(e,t){const{theme:n}=t;e.font=n.headerFont,this.drawColumnHeaders(e,t),this.drawRowHeaders(e,t)}drawFooters(e,t){const{theme:n}=t;e.font=n.headerFont,this.drawRowFooters(e,t)}drawColumnHeaders(e,t){const{mouseX:n,mouseY:s,theme:o,metrics:i,draggingColumnSeparator:r,isDragging:l,model:a}=t,{columnHeaderHeight:c,floatingColumns:d,gridX:u,width:m,visibleColumns:p,allColumnWidths:g,allColumnXs:f,floatingLeftColumnCount:w,floatingLeftWidth:C,floatingRightWidth:S,modelColumns:b,columnHeaderMaxDepth:E}=i;if(c<=0)return;const{headerHiddenSeparatorSize:v,headerHiddenSeparatorHoverColor:y,headerSeparatorColor:M,headerSeparatorHoverColor:A}=o,F=c*.5,V=c*(E-1)+c*.5-F*.5,H=w>0;if(e.save(),this.drawColumnHeadersForRange(e,t,[p[0],p[p.length-1]],{minX:u+C,maxX:m-S}),H&&this.drawColumnHeadersForRange(e,t,[d[0],d[d.length-1]],{minX:u,maxX:u+C}),M){e.strokeStyle=M;const N=[...g.entries()].filter(([P,k])=>k===0).map(([P])=>P);e.beginPath(),e.fillStyle=M;for(let P=0;P<N.length;P+=1){const k=N[P],z=L(f,k),K=L(g,k),G=u+z+K+.5-v*.5;e.rect(G,V,v,F)}e.fill()}if(A){let{index:N,depth:P}=r!=null?r:{};if(N==null&&n!=null&&s!=null){const z=Ti.getColumnSeparator(W.getGridPointFromXY(n,s,i),i,a,o);N=z==null?void 0:z.index,P=z==null?void 0:z.depth}let k;if(N==null)k=!1;else{const z=b.get(N),K=b.get(N+1);z==null||K==null?k=!1:k=a.textForColumnHeader(z,P)!==a.textForColumnHeader(K,P)}if(k&&N!=null&&P!=null&&(!l||r!=null)){e.strokeStyle=A;const z=L(f,N),K=L(g,N),G=u+z+K+.5,_=p.indexOf(N),q=_<p.length-1?p[_+1]:null,Y=q!=null?g.get(q):null,J=K===0,de=Y!=null&&Y===0;J?(e.strokeStyle=y,e.fillStyle=y,e.fillRect(G,V,v*.5,F)):de&&(e.fillStyle=A,e.fillRect(G-v*.5,V,v*.5,F)),e.beginPath(),e.moveTo(G,(E-P-1)*c),e.lineTo(G,(E-P)*c-1),e.stroke()}}e.restore()}drawColumnHeadersForRange(e,t,n,s){const{model:o}=t,{columnHeaderMaxDepth:i}=o;if(i!==0)for(let r=0;r<=i;r+=1)this.drawColumnHeadersAtDepth(e,t,n,s,r)}drawColumnHeadersAtDepth(e,t,n,s,o){var M,A,F,V,H,N;const{metrics:i,model:r,theme:l}=t,{modelColumns:a,allColumnXs:c,gridX:d,calculatedColumnWidths:u,userColumnWidths:m,allColumnWidths:p,movedColumns:g}=i,{columnHeaderHeight:f,columnWidth:w}=l,{columnHeaderMaxDepth:C}=r,{minX:S,maxX:b}=s,E=b-S;if(C===0)return;const v=n[0],y=n[1];if(e.save(),e.translate(0,(C-o-1)*f),o===0){this.drawColumnHeader(e,t,"",S,b);for(let P=v;P<=y;P+=1)this.drawColumnHeaderAtIndex(e,t,P,s)}if(o>0){let P=v;for(;P<=y;){const{columnCount:k}=i,z=L(a,P),K=r.textForColumnHeader(z,o),G=r.colorForColumnHeader(z,o);let _=L(c,P)+d,q=_+L(p,P);if(K!=null){let Y=P-1;for(;Y>=0&&(q-_<E||_>S);){const ge=(M=a.get(Y))!=null?M:W.getModelIndex(Y,g);if(ge==null||r.textForColumnHeader(ge,o)!==K)break;_-=(F=(A=m.get(ge))!=null?A:u.get(ge))!=null?F:w,Y-=1}let J=P+1;for(;J<k&&(q-_<E||q<b);){const ge=(V=a.get(J))!=null?V:W.getModelIndex(J,g);if(r.textForColumnHeader(ge,o)!==K)break;q+=(N=(H=m.get(ge))!=null?H:u.get(ge))!=null?N:w,J+=1}P=J-1;const de=q-_>=E;let pe=_;de&&(q<b?pe=q-E:_<S&&(pe=S)),this.drawColumnHeader(e,t,K,pe,Math.min(q-_,E),{backgroundColor:G!=null?G:void 0},s)}P+=1}}e.restore()}drawColumnHeaderAtIndex(e,t,n,s){var g;const{metrics:o,model:i}=t,{modelColumns:r,allColumnWidths:l,allColumnXs:a,gridX:c}=o,d=L(l,n),u=L(a,n)+c,m=L(r,n),p=i.textForColumnHeader(m);p!=null&&this.drawColumnHeader(e,t,p,u,d,{backgroundColor:(g=i.colorForColumnHeader(m))!=null?g:void 0},s)}drawColumnHeader(e,t,n,s,o,i,r){var J;if(o<=0)return;const{metrics:l,theme:a}=t,{headerHorizontalPadding:c,columnHeaderHeight:d,headerBackgroundColor:u,headerColor:m,headerSeparatorColor:p,black:g,white:f}=a,{fontWidths:w,width:C}=l,S=(J=w.get(e.font))!=null?J:gn.DEFAULT_FONT_WIDTH,E=(o-c*2)/S,{backgroundColor:v=u,separatorColor:y=p}=i!=null?i:{};let{textColor:M=m}=i!=null?i:{};try{const de=this.getCachedColorIsDark(v),pe=this.getCachedColorIsDark(M);de&&pe?M=f:!de&&!pe&&(M=g)}catch{}let{minX:A=0,maxX:F=C}=r!=null?r:{};e.save(),e.rect(A,0,F-A,d),e.clip(),v!=null&&(e.fillStyle=v,e.fillRect(s,0,o,d)),y!=null&&(e.strokeStyle=y,e.beginPath(),s>0&&(e.moveTo(s+.5,0),e.lineTo(s+.5,d)),e.moveTo(s+o+.5,0),e.lineTo(s+o+.5,d),e.moveTo(s,d-.5),e.lineTo(s+o,d-.5),e.stroke()),e.beginPath(),e.rect(s,0,o,d),e.clip(),e.fillStyle=M;let V=n;E<=0?V="":V.length>E&&(V=`${V.substring(0,E-1)}\u2026`);const H=V.length*S;let N=s+o*.5;const P=d*.5;A+=c,F-=c;const k=s+c,z=ze(k,A,F),K=s+o-c,_=ze(K,A,F)-z,q=N-H*.5<A,Y=N+H*.5>F;q?H<_?N=A+H*.5:N=K-H*.5:Y&&(H<_?N=F-H*.5:N=k+H*.5),e.textAlign="center",e.fillText(V,N,P),e.restore()}drawRowHeaders(e,t){const{mouseX:n,mouseY:s,metrics:o,theme:i,draggingRowSeparator:r}=t,{gridY:l,rowHeaderWidth:a,height:c,visibleRows:d,allRowHeights:u,allRowYs:m}=o;if(a<=0)return;const{headerBackgroundColor:p,headerColor:g,headerHiddenSeparatorSize:f,headerHiddenSeparatorHoverColor:w,headerSeparatorColor:C,headerSeparatorHoverColor:S}=i,b=a*.5,E=a*.5-b*.5;if(e.save(),e.beginPath(),e.fillStyle=p,e.fillRect(0,0,a,c),C){e.strokeStyle=C,e.beginPath(),e.moveTo(0,l+.5),e.lineTo(a,l+.5);const v=[];let y=!1;for(let M=0;M<d.length;M+=1){const A=d[M],F=L(m,A),V=L(u,A);if(V>0){const H=l+F+V+.5;e.moveTo(0,H),e.lineTo(a,H),y=!1}else y||(y=!0,v.push(A))}e.moveTo(a-.5,0),e.lineTo(a-.5,c),e.stroke(),e.beginPath(),e.fillStyle=C;for(let M=0;M<v.length;M+=1){const A=v[M],F=L(m,A),V=L(u,A),H=l+F+V+.5-f*.5;e.rect(E,H,b,f)}e.fill()}if(S){let{index:v=null}=r!=null?r:{};if(v==null&&n!=null&&s!=null&&(v=W.getRowSeparatorIndex(n,s,o,i)),v!=null){e.strokeStyle=S;const y=L(m,v),M=L(u,v),A=l+y+M+.5,F=d.indexOf(v),V=F<d.length-1?d[F+1]:null,H=V!=null?u.get(V):null,N=M===0,P=H!=null&&H===0;N?(e.strokeStyle=w,e.fillStyle=w,e.fillRect(E,A,b,f*.5)):P&&(e.fillStyle=S,e.fillRect(E,A-f*.5,b,f*.5)),e.beginPath(),e.moveTo(.5,A),e.lineTo(a+.5,A),e.stroke()}}e.beginPath(),e.rect(0,l,a,c),e.clip(),e.fillStyle=g,e.textAlign="right";for(let v=0;v<d.length;v+=1){const y=d[v],M=L(u,y),A=L(m,y)+l;this.drawRowHeader(e,t,y,A,M)}e.restore()}drawRowHeader(e,t,n,s,o){if(o<=0)return;const{metrics:i,model:r,theme:l}=t,{modelRows:a,rowHeaderWidth:c}=i,d=L(a,n),u=c-l.cellHorizontalPadding,m=s+o*.5;e.fillText(r.textForRowHeader(d),u,m)}drawRowFooters(e,t){const{mouseX:n,mouseY:s,metrics:o,model:i,theme:r,draggingRowSeparator:l}=t,{gridY:a,gridX:c,maxX:d,modelRows:u,rowFooterWidth:m,height:p,verticalBarWidth:g,visibleRows:f,allRowHeights:w,allRowYs:C,width:S}=o;if(m<=0)return;const{cellHorizontalPadding:b,headerBackgroundColor:E,headerColor:v,headerHiddenSeparatorSize:y,headerHiddenSeparatorHoverColor:M,headerSeparatorColor:A,headerSeparatorHoverColor:F}=r,V=m*.5,H=m*.5-V*.5,N=Math.min(c+d,S-m-g);if(e.save(),e.beginPath(),e.fillStyle=E,e.fillRect(N,a,m,p),A){e.strokeStyle=A,e.beginPath(),e.moveTo(N,a+.5),e.lineTo(m,a+.5);const k=[];let z=!1;for(let K=0;K<f.length;K+=1){const G=f[K],_=L(C,G),q=L(w,G);if(q>0){const Y=a+_+q+.5;e.moveTo(N+.5,Y),e.lineTo(N+m-.5,Y),z=!1}else z||(z=!0,k.push(G))}e.moveTo(N+.5,a),e.lineTo(N+.5,p),e.stroke(),e.beginPath(),e.fillStyle=A;for(let K=0;K<k.length;K+=1){const G=k[K],_=L(C,G),q=L(w,G),Y=a+_+q+.5-y*.5;e.rect(N+H,Y,V,y)}e.fill()}if(F){let{index:k=null}=l!=null?l:{};if(k==null&&n!=null&&s!=null&&(k=W.getRowSeparatorIndex(n,s,o,r)),k!=null){e.strokeStyle=F;const z=L(C,k),K=L(w,k),G=a+z+K+.5,_=f.indexOf(k),q=_<f.length-1?f[_+1]:null,Y=q!=null?w.get(q):null,J=K===0,de=Y!=null&&Y===0;J?(e.strokeStyle=M,e.fillStyle=M,e.fillRect(H,G,V,y*.5)):de&&(e.fillStyle=F,e.fillRect(H,G-y*.5,V,y*.5)),e.beginPath(),e.moveTo(N+.5,G),e.lineTo(N+m+.5,G),e.stroke()}}e.beginPath(),e.rect(N,a,m,p),e.clip(),e.fillStyle=v,e.textAlign="left";const P=N+b;for(let k=0;k<f.length;k+=1){const z=f[k],K=L(w,z);if(K>0){const G=L(C,z)+a,_=L(u,z),q=G+K*.5;e.fillText(i.textForRowFooter(_),P,q)}}e.restore()}drawSelectedRanges(e,t,n={}){const{cursorColumn:s,cursorRow:o,draggingRow:i,draggingColumn:r,editingCell:l,metrics:a,model:c,selectedRanges:d,theme:u}=t,{allColumnWidths:m,allColumnXs:p,allRowHeights:g,allRowYs:f,width:w,height:C}=a,{left:S=a.left,top:b=a.top,right:E=a.right,bottom:v=a.bottom,minY:y=-10,maxY:M=C+10,minX:A=-10,maxX:F=w+10}=n;if(d.length===0)return;const V=He(c)&&c.isEditable&&l==null&&i==null&&r==null&&s!=null&&o!=null&&p.has(s)&&f.has(o);if(V){const H=L(p,s),N=L(f,o),P=L(m,s),k=L(g,o);e.save(),e.beginPath(),e.rect(0,0,w,C),e.rect(H,N,P,k),e.clip("evenodd")}e.beginPath();for(let H=0;H<d.length;H+=1){const N=d[H],P=N.startColumn!==null?N.startColumn:S,k=N.startRow!==null?N.startRow:b,z=N.endColumn!==null?N.endColumn:E,K=N.endRow!==null?N.endRow:v;if(K>=b&&v>=k&&z>=S&&E>=P){const G=P>=S&&p.has(P)?Math.round(L(p,P))+.5:A,_=k>=b&&f.has(k)?Math.max(Math.round(L(f,k))+.5,.5):y,q=z<=E&&p.has(z)?Math.round(L(p,z)+L(m,z))-.5:F,Y=K<=v&&f.has(K)?Math.round(L(f,K)+L(g,K))-.5:M;e.rect(G,_,q-G,Y-_)}e.fillStyle=u.selectionColor,e.fill(),e.save(),e.clip(),e.strokeStyle=u.selectionOutlineCasingColor,e.lineWidth=3,e.stroke(),e.restore(),e.strokeStyle=u.selectionOutlineColor,e.lineWidth=1,e.stroke()}V&&s!=null&&o!=null&&(e.restore(),this.drawActiveCell(e,t,s,o))}drawActiveCell(e,t,n,s,o=gn.ACTIVE_CELL_BORDER_WIDTH){const{metrics:i,theme:r}=t,{allColumnWidths:l,allColumnXs:a,allRowHeights:c,allRowYs:d}=i,u=L(a,n),m=L(d,s),p=L(l,n),g=L(c,s);let f=u-o*.5,w=m-o*.5,C=p+o,S=g+o;f<=0&&(C+=f-1,f=1),w<=0&&(S+=w-1,w=1);const{lineWidth:b}=e;e.beginPath(),e.lineWidth=o,e.strokeStyle=r.selectionOutlineColor,this.drawRoundedRect(e,f,w,C,S),e.stroke(),e.lineWidth=b}drawRoundedRect(e,t,n,s,o,i=gn.DEFAULT_EDGE_RADIUS){e.beginPath(),e.moveTo(t+i,n),e.lineTo(t+s-i,n),e.quadraticCurveTo(t+s,n,t+s,n+i),e.lineTo(t+s,n+o-i),e.quadraticCurveTo(t+s,n+o,t+s-i,n+o),e.lineTo(t+i,n+o),e.quadraticCurveTo(t,n+o,t,n+o-i),e.lineTo(t,n+i),e.quadraticCurveTo(t,n,t+i,n),e.closePath()}drawDraggingColumn(e,t){var Y;const{draggingColumn:n,metrics:s,mouseX:o,theme:i,model:r}=t;if(n==null||o==null)return;const{range:l,depth:a}=n,{gridX:c,gridY:d,allColumnXs:u,allColumnWidths:m,height:p,width:g,columnHeaderMaxDepth:f,columnHeaderHeight:w,movedColumns:C,modelColumns:S,floatingLeftWidth:b}=s,E=(Y=S.get(l[0]))!=null?Y:W.getModelIndex(l[0],C),v=r.getColumnHeaderGroup(E,a);if(a>0&&!v)return;const[y,M]=l,A=L(u,y),V=L(u,M)+L(m,M)-A,H=n.left,{backgroundColor:N,font:P,headerFont:k,reorderOffset:z,shadowBlur:K,shadowColor:G}=i,_=(f-a-1)*w;e.save(),e.translate(c,0),e.save(),e.beginPath(),e.rect(b,0,g,p),e.clip(),e.fillStyle=N,e.fillRect(A,_,V,p),e.restore(),e.translate(0,z),e.save(),e.shadowColor=G,e.shadowBlur=K,e.fillStyle=N,e.fillRect(n.left,_+z,n.width,p),e.restore(),e.beginPath(),e.rect(n.left,_,n.width+1,p),e.clip(),e.translate(H-A,0),e.font=k;const q=[];for(let J=n.range[0];J<=n.range[1];J+=1)q.push(J);this.drawColumnHeaders(e,t),this.drawColumnHeadersForRange(e,t,[q[0],q[q.length-1]],{minX:A,maxX:g}),e.translate(0,d),e.font=P,this.drawGridBackground(e,t);for(let J=y;J<=M;J+=1)this.drawColumnCellContents(e,t,J);e.restore()}drawDraggingRow(e,t){const{draggingRow:n,draggingRowOffset:s,metrics:o,mouseY:i,theme:r}=t;if(n==null||i==null)return;const{gridX:l,gridY:a,allRowYs:c,allRowHeights:d,width:u}=o,m=L(c,n),p=L(d,n)+1,{backgroundColor:g,font:f,headerFont:w,reorderOffset:C,shadowBlur:S,shadowColor:b}=r;e.save(),e.translate(0,a),e.fillStyle=g,e.fillRect(0,m,u,p),e.translate(l+C,i-m-a-(s!=null?s:0)),e.save(),e.shadowColor=b,e.shadowBlur=S,e.fillStyle=g,e.fillRect(-l,m,u,p),e.restore(),e.beginPath(),e.rect(-l,m,u,p),e.clip(),e.font=f,this.drawGridBackground(e,t),this.drawCellContents(e,t),e.translate(-l,-a),e.font=w,this.drawRowHeaders(e,t),e.restore()}drawScrollBars(e,t){const{isDraggingHorizontalScrollBar:n,isDraggingVerticalScrollBar:s,isDragging:o,metrics:i,mouseX:r,mouseY:l,theme:a}=t;if(a.scrollBarSize<=0)return;const{width:c,height:d,handleHeight:u,handleWidth:m,scrollX:p,scrollY:g,hasHorizontalBar:f,hasVerticalBar:w,barWidth:C,barHeight:S,barLeft:b,barTop:E}=i,{scrollBarBackgroundColor:v,scrollBarHoverBackgroundColor:y,scrollBarCasingColor:M,scrollBarCornerColor:A,scrollBarColor:F,scrollBarHoverColor:V,scrollBarActiveColor:H,scrollBarSize:N,scrollBarHoverSize:P,scrollBarCasingWidth:k,scrollBarSelectionTick:z,scrollBarSelectionTickColor:K,scrollBarActiveSelectionTickColor:G,autoSelectRow:_,autoSelectColumn:q}=a,Y=r!=null&&l!=null&&r<=c&&l<=d,J=s||w&&!n&&!o&&r!=null&&l!=null&&r>=c-P&&l>=E&&Y,de=n||f&&!s&&!o&&!J&&r!=null&&l!=null&&l>=d-P&&r>=b&&Y,pe=de?P:N,ge=J?P:N;if(e.translate(b,E),f&&w&&(e.fillStyle=M,e.fillRect(c-b-N,d-E-N,N,N),e.fillStyle=A,e.fillRect(c-b-N+k,d-E-N+k,N-k,N-k)),f){const Te=p,fe=d-E-pe;if(e.fillStyle=M,e.fillRect(0,fe,C,pe-k),e.fillStyle=de?y:v,e.fillRect(0,fe+k,C,pe-k),n?e.fillStyle=H:de?e.fillStyle=V:e.fillStyle=F,e.fillRect(Te,fe+k,m,pe-k),!_&&z&&K!=null&&G!=null){e.fillStyle=K;const{selectedRanges:nt,cursorColumn:je}=t,{lastLeft:qe,columnCount:Ut}=i,yn=[...nt].filter(we=>we.startColumn!=null&&we.endColumn!=null).map(we=>[we.startColumn,we.endColumn]).sort(W.compareRanges),Bt=W.mergeSortedRanges(yn),xe=we=>we<=qe?we/qe*(C-m):C-m+(we-qe)/(Ut-qe)*m;for(let we=0;we<Bt.length;we+=1){const Ze=Bt[we],Ke=Ze[0],ht=Ze[1];if(Ke!=null&&ht!=null&&(Ke!==je||ht!==je)){const It=xe(Ke),In=Math.max(1,Math.round(xe(ht+1)-It)),Gt=pe-k;e.fillRect(It,fe+k+Math.round(Gt/3),In,Math.round(Gt/3))}}if(je!=null){const we=xe(je),Ze=2,Ke=pe-k;e.fillStyle=G,e.fillRect(we,fe+k,Ze,Ke)}}}if(w){const Te=c-b-ge,fe=g;if(e.fillStyle=M,e.fillRect(Te,0,ge-k,S),e.fillStyle=J?y:v,e.fillRect(Te+k,0,ge-k,S),s?e.fillStyle=H:J?e.fillStyle=V:e.fillStyle=F,e.fillRect(Te+k,fe,ge-k,u),!q&&z&&K!=null&&G!=null){const{selectedRanges:nt,cursorRow:je}=t,{lastTop:qe,rowCount:Ut}=i,yt=we=>we<=qe?we/qe*(S-u):S-u+(we-qe)/(Ut-qe)*u;e.fillStyle=K;const Bt=[...nt].filter(we=>we.startRow!=null&&we.endRow!=null).map(we=>[we.startRow,we.endRow]).sort(W.compareRanges),xe=W.mergeSortedRanges(Bt);for(let we=0;we<xe.length;we+=1){const Ze=xe[we],Ke=Ze[0],ht=Ze[1];if(Ke!=null&&ht!=null&&(Ke!==je||ht!==je)){const It=yt(Ke),In=ge-k,Gt=Math.max(1,Math.round(yt(ht+1)-It));e.fillRect(Te+k+Math.round(In/3),It,Math.round(In/3),Gt)}}if(je!=null){const we=Math.round(yt(je)),Ze=ge-k,Ke=2;e.fillStyle=G,e.fillRect(Te+k,we,Ze,Ke)}}}e.translate(-b,-E)}};let gs=gn;gs.DEFAULT_FONT_WIDTH=10;gs.DEFAULT_EDGE_RADIUS=2;gs.ACTIVE_CELL_BORDER_WIDTH=2;const El=100;class yh extends Qe{constructor(){super(...arguments),this.hasExtendedFloating=!1}onDown(t,n,s){const{x:o,y:i,column:r,row:l}=t,{metrics:a}=n;if(!a)throw new Error("metrics not set");const{gridX:c,gridY:d,maxX:u,maxY:m}=a,p=o-c,g=i-d;if(p<0||g<0||r==null&&p>u||l==null&&g>m)return!1;const f=W.isModifierKeyDown(s),w=s.shiftKey;f||(w?n.trimSelectedRanges():n.clearSelectedRanges());const C=n.getTheme(),{autoSelectRow:S,autoSelectColumn:b}=C;return(r!==null||!b)&&(l!==null||!S)&&(n.focus(),n.moveCursorToPosition(r,l,w,!1,w&&f)),this.startPoint=t,this.hasExtendedFloating=!1,this.dragBounds=W.getScrollDragBounds(a,l,r),!0}onDrag(t,n){if(this.startPoint===void 0)return!1;this.stopTimer();const{row:s,column:o}=this.startPoint,{x:i,y:r}=t;let{row:l,column:a}=t;const{metrics:c}=n;if(!c)throw new Error("metrics not set");const{left:d,lastLeft:u,top:m,lastTop:p,columnWidth:g,rowHeight:f}=c,w=W.getScrollDragBounds(c,s,o);let C=0,S=0;if(d<u&&(i<w.x1?C=i-w.x1:i>w.x2&&(C=i-w.x2)),m<p&&(r<w.y1?S=r-w.y1:r>w.y2&&(S=r-w.y2)),C!==0||S!==0)this.startTimer(n,t,C>0?Math.ceil(C/g):Math.floor(C/g),S>0?Math.ceil(S/f):Math.floor(S/f));else if(l!=null&&a!=null){const{floatingTopRowCount:b,floatingBottomRowCount:E,floatingLeftColumnCount:v,floatingRightColumnCount:y,columnCount:M,rowCount:A,bottom:F,right:V,topVisible:H,bottomVisible:N,leftVisible:P,rightVisible:k}=c;this.hasExtendedFloating||(s!==null&&s<b&&l>=b?(l=b,this.hasExtendedFloating=!0):s!==null&&s>=A-E&&l<A-E&&(l=A-E-1,this.hasExtendedFloating=!0),o!==null&&o<v&&a>=v?(a=v,this.hasExtendedFloating=!0):o!==null&&o>=M-y&&a<M-y&&(a=M-y-1,this.hasExtendedFloating=!0)),s!==null&&!W.isFloatingRow(s,c)&&W.isFloatingRow(l,c)&&(s>l&&l<m?l=H-1:s<l&&l>F&&(l=N+1)),o!==null&&!W.isFloatingColumn(o,c)&&W.isFloatingColumn(a,c)&&(o>a&&a<d?a=P-1:o<a&&a>V&&(a=k+1)),n.moveCursorToPosition(a,l,!0,!0)}return!0}onUp(t,n){return this.startPoint!==void 0&&(this.startPoint=void 0,this.dragBounds=void 0,this.stopTimer(),n.commitSelection()),!1}moveSelection(t,n,s,o){const{row:i,column:r}=n,{metrics:l}=t;if(!l)throw new Error("metrics not set");const{selectionEndRow:a,selectionEndColumn:c}=t.state;if(a==null||c==null)throw new Error("selection not set");const{rowCount:d,columnCount:u}=l,m=s<0&&r!=null?r:0,p=s>0&&r!=null?r:u-1,g=o<0&&i!=null?i:0,f=o>0&&i!=null?i:d-1;t.moveCursorToPosition(Math.min(Math.max(m,c+s),p),Math.min(Math.max(g,a+o),f),!0),this.lastTriggerTime=Date.now()}startTimer(t,n,s,o){this.stopTimer();const i=this.lastTriggerTime!=null?El-Math.min(El,Date.now()-this.lastTriggerTime):0;this.timer=setTimeout(()=>{this.moveSelection(t,n,s,o),this.startTimer(t,n,s,o)},i)}stopTimer(){this.timer!==void 0&&(clearTimeout(this.timer),this.timer=void 0)}}const Rl=5,Ih=1e3/60,Ko=10;function An(e,t,n,s){var b,E,v,y,M,A,F;const{modelColumns:o,movedColumns:i,allColumnXs:r,columnCount:l,allColumnWidths:a,userColumnWidths:c,calculatedColumnWidths:d,floatingLeftWidth:u,maxX:m}=n;if(t==null||e==null||e>l||e<0)return null;const p=(b=o.get(e))!=null?b:W.getModelIndex(e,i),g=s.getColumnHeaderGroup(p,t),f=g!=null;let w,C,S;if(g!=null){const[V,H]=g.getVisibleRange(i);w=(E=r.get(V))!=null?E:u,C=((v=r.get(H))!=null?v:m)+((y=a.get(H))!=null?y:0),S=[V,H]}else{const V=r.get(e);if(V==null)return null;w=V,C=w+((F=(A=(M=a.get(e))!=null?M:c.get(p))!=null?A:d.get(p))!=null?F:0),S=[e,e]}return{visibleIndex:e,modelIndex:p,left:w,right:C,width:C-w,isColumnGroup:f,range:S,depth:t}}class Mh extends Qe{constructor(){super(...arguments),this.cursor=null,this.draggingColumn=null}setScrollInterval(t,n){this.scrollingInterval!=null&&n===this.scrollingDirection||(this.scrollingDirection=n,this.scrollingInterval=window.setInterval(()=>{var f,w;const{metrics:s}=t;if(!s)return;const{left:o,lastLeft:i,leftOffset:r,userColumnWidths:l,calculatedColumnWidths:a,movedColumns:c,allColumnWidths:d}=s;let u=o,m=r;if(n==="left")for(m-=Ko;m<0;){u-=1;const C=W.getModelIndex(o-1,c),S=(f=l.get(C))!=null?f:a.get(C);S===void 0?m=0:m+=S,u<0&&(m=0,u=0)}else{m+=Ko;let C=d.get(o);for(;C!==void 0&&m>C;){u+=1,m-=C;const S=W.getModelIndex(o+1,c);C=(w=l.get(S))!=null?w:a.get(S),u>i&&(m=0,u=i)}}const{mouseX:p,mouseY:g}=t.state;s==null||p==null||g==null||(this.moveDraggingColumn(p,t,n==="left"?-Ko:Ko),t.setState({left:u,leftOffset:m}),(n==="left"&&u===0&&r===0||n==="right"&&u===i)&&this.clearScrollInterval())},Ih))}clearScrollInterval(){this.scrollingDirection=void 0,window.clearInterval(this.scrollingInterval),this.scrollingInterval=void 0}onLeave(){return this.clearScrollInterval(),!1}onDown(t,n){const{model:s}=n.props,{x:o,column:i,columnHeaderDepth:r}=t,{metrics:l}=n;if(!l)throw new Error("Metrics not set");const a=An(i,r,l,s);if(i==null||a==null||r==null||r>0&&!a.isColumnGroup)return!1;const{rowHeaderWidth:c}=l;return this.initialGridPoint=t,this.draggingColumn=null,this.cursor=null,a.modelIndex!=null&&r!=null&&s.isColumnMovable(a.modelIndex,r)&&(this.draggingOffset=o-a.left-c,this.initialOffset=this.draggingOffset),!1}onDrag(t,n,s){if(this.draggingOffset===void 0||this.initialGridPoint===void 0||this.initialOffset===void 0)return!1;const{x:o,y:i}=t,{columnHeaderDepth:r}=this.initialGridPoint,{model:l}=n.props;let{draggingColumn:a}=this;const{metrics:c}=n;if(!c)throw new Error("Metrics not set");if(!a&&Math.abs(this.initialGridPoint.x-o)<Rl&&Math.abs(this.initialGridPoint.y-i)<Rl)return!1;if(a==null){const d=An(this.initialGridPoint.column,r,c,l);if(!d||r==null||!l.isColumnMovable(d.modelIndex)||r>0&&!d.isColumnGroup||d.range[0]==null)return!1;a={range:d.range,depth:r,left:d.left,width:d.width};const u=An(a.range[0],0,c,l),m=An(a.range[1],0,c,l);if(!u||!m)return!1;this.draggingColumn=a,n.setState({draggingColumn:a,isDragging:!0})}return this.cursor="move",this.moveDraggingColumn(t.x,n,s.movementX),!0}moveDraggingColumn(t,n,s){var M,A,F,V,H;if(this.draggingOffset===void 0||this.initialGridPoint===void 0||this.initialOffset===void 0||this.draggingColumn==null||s===0)return;if(this.initialOffset!==this.draggingOffset){this.draggingOffset<this.initialOffset&&this.initialOffset<this.draggingOffset+s||this.draggingOffset>this.initialOffset&&this.initialOffset>this.draggingOffset+s?this.draggingOffset=this.initialOffset:this.draggingOffset+=s,this.draggingColumn={...this.draggingColumn,left:t-this.draggingOffset},n.setState({draggingColumn:this.draggingColumn});return}const{depth:o}=this.draggingColumn,{model:i}=n.props,{movedColumns:r}=n.state,{metrics:l}=n;if(!l)throw new Error("Metrics not set");const{floatingLeftWidth:a,width:c,columnHeaderMaxDepth:d,allColumnXs:u}=l,m=s<0,p=An(this.draggingColumn.range[0],o,l,i);if(!p)return;const g=t-this.draggingOffset,f=g+p.width;this.draggingColumn={...this.draggingColumn,left:g},n.setState({draggingColumn:this.draggingColumn});const w=An(W.getColumnAtX(ze(m?g:f,a,c),l,!0),o,l,i),C=i.getColumnHeaderParentGroup(p.modelIndex,p.depth);if(!w)return;if(C!==void 0){const N=C.getVisibleRange(r);if(w.visibleIndex<N[0]){const P=this.moveColumn(p,N[0],r);this.draggingOffset=t-((M=u.get(N[0]))!=null?M:0),this.draggingColumn={...this.draggingColumn,left:t-this.draggingOffset},this.clearScrollInterval(),n.setState({draggingColumn:this.draggingColumn,movedColumns:P});return}if(w.visibleIndex>N[1]){const P=this.moveColumn(p,N[1]-(p.range[1]-p.range[0]),r),{right:k=0}=(A=An(N[1],0,l,i))!=null?A:{};this.draggingOffset=t-(k-p.width),this.draggingColumn={...this.draggingColumn,left:t-this.draggingOffset},this.clearScrollInterval(),n.setState({draggingColumn:this.draggingColumn,movedColumns:P});return}}if(!i.isColumnMovable(w.modelIndex)){let N=w.visibleIndex;if(m)for(N+=1;N<p.visibleIndex&&!i.isColumnMovable(W.getModelIndex(N,r));)N+=1;else for(N-=1;N>p.visibleIndex&&!i.isColumnMovable(W.getModelIndex(N,r));)N-=1;if(N!==p.visibleIndex){m||(N-=p.range[1]-p.range[0]);const k=this.moveColumn(p,N,r);n.setState({movedColumns:k,draggingColumn:this.draggingColumn})}const P=An(N,0,l,i);m?this.draggingOffset=t-((F=P==null?void 0:P.left)!=null?F:0):this.draggingOffset=t-(((V=P==null?void 0:P.right)!=null?V:0)-p.width),this.draggingColumn={...this.draggingColumn,left:t-this.draggingOffset},n.setState({draggingColumn:this.draggingColumn});return}if(g<=a?this.setScrollInterval(n,"left"):f>c?this.setScrollInterval(n,"right"):this.clearScrollInterval(),w.visibleIndex===p.visibleIndex||m&&p.visibleIndex<w.visibleIndex||!m&&p.visibleIndex>w.visibleIndex)return;const S=w.left+w.width*.5,b=i.getColumnHeaderParentGroup(p.modelIndex,p.depth);let E,v=((H=b==null?void 0:b.depth)!=null?H:d)-1;for(;v>=0&&E===void 0;)E=i.getColumnHeaderGroup(w.modelIndex,v),v-=1;let y;m&&g<S&&(!E||w.visibleIndex===E.getVisibleRange(r)[0])&&(y=this.moveColumn(p,w.range[0],r)),!m&&f>S&&(!E||w.visibleIndex===E.getVisibleRange(r)[1])&&(y=this.moveColumn(p,w.range[1]-(p.range[1]-p.range[0]),r)),y&&(this.draggingColumn={...this.draggingColumn,left:g},n.setState({movedColumns:y,draggingColumn:this.draggingColumn}))}moveColumn(t,n,s){const o=t.isColumnGroup?W.moveRange(t.range,n,s):W.moveItem(t.visibleIndex,n,s),i=n-t.range[0],r=[t.range[0]+i,t.range[1]+i];return this.draggingColumn&&(this.draggingColumn={...this.draggingColumn,range:r}),o}onUp(t,n){return this.cursor=null,this.clearScrollInterval(),this.draggingOffset!=null?(this.draggingOffset=void 0,n.setState({draggingColumn:null,isDragging:!1}),!0):!1}}class Fr extends Qe{constructor(){super(...arguments),this.cursor="default"}static getLeftWithOffsetFromRawLeft(t,n){const s=t.getTheme(),{metrics:o,metricCalculator:i}=t;if(!o)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=o.allColumnWidths.get(r);if(a==null){const d=t.getMetricState();a=i.getVisibleColumnWidth(r,d)}const c=a*l;return{left:r,leftOffset:c}}isInScrollBar(t,n){const s=n.getTheme(),{scrollBarSize:o,scrollBarHoverSize:i}=s,{metrics:r}=n;if(!r)throw new Error("metrics not set");const{x:l,y:a}=t,{barLeft:c,barWidth:d,height:u,hasHorizontalBar:m}=r;return m&&o>0&&a>=u-i&&a<u&&l>c&&l<c+d}getLeftWithOffset(t,n){var f;const{metrics:s}=n;if(!s)throw new Error("metrics not set");const{x:o}=t,{barWidth:i,handleWidth:r,lastLeft:l,barLeft:a,columnCount:c,scrollableContentWidth:d,scrollableViewportWidth:u}=s,m=o-a,p=ze((m-((f=this.dragOffset)!=null?f:0))/(i-r),0,1);if(c===1)return{left:0,leftOffset:p*(d-u)};const g=p*l;return Fr.getLeftWithOffsetFromRawLeft(n,g)}onDown(t,n){const{metrics:s}=n;if(!s)throw new Error("metrics not set");const{x:o}=t,{handleWidth:i,barLeft:r,scrollX:l}=s;if(!this.isInScrollBar(t,n))return!1;const a=o-r;if(a>=l&&a<=l+i)this.dragOffset=a-l,n.setState({isDraggingHorizontalScrollBar:!0});else{this.dragOffset=0;const{left:c,leftOffset:d}=this.getLeftWithOffset(t,n);n.setViewState({left:c,leftOffset:d,isDraggingHorizontalScrollBar:!0,isDragging:!0})}return!0}onDrag(t,n){if(this.dragOffset!=null){const{left:s,leftOffset:o}=this.getLeftWithOffset(t,n);return n.setViewState({left:s,leftOffset:o,isDraggingHorizontalScrollBar:!0,isDragging:!0}),!0}return!1}onMove(t,n){return this.isInScrollBar(t,n)}onUp(t,n){return this.dragOffset!==void 0&&(this.dragOffset=void 0,n.setState({isDraggingHorizontalScrollBar:!1,isDragging:!1})),this.isInScrollBar(t,n)}onClick(t,n){return this.isInScrollBar(t,n)}}class Dh extends Qe{constructor(){super(...arguments),this.cursor="move"}onDown(t,n){const{model:s}=n.props,{x:o,y:i,row:r}=t,{metrics:l}=n;if(!l)throw new Error("metrics not set");const{columnHeaderHeight:a,rowHeaderWidth:c,allRowYs:d}=l;if(o<=c&&r!==null&&s.isRowMovable(r)){const u=L(d,r);this.draggingOffset=i-u-a,n.setState({draggingRowOffset:this.draggingOffset})}return!1}onDrag(t,n){if(this.draggingOffset==null)return!1;const{model:s}=n.props;let{draggingRow:o}=n.state;const{mouseX:i,mouseY:r}=n.state;if(i==null||r==null)return!1;if(o==null){const{row:y}=n.getGridPointFromXY(i,r);if(y!=null&&!s.isRowMovable(y)||(o=y,n.setState({draggingRow:o,isDragging:!0}),o==null))return!1}const{metrics:l}=n;if(!l)throw new Error("metrics not set");const{top:a,lastTop:c,bottom:d,bottomVisible:u,rowCount:m,columnHeaderHeight:p,allRowHeights:g,allRowYs:f,height:w}=l;let C=p;if(a<o){const y=o-1;C=L(f,y)+L(g,y)*.5+p}let S=w;if(o<d){const y=o+1;S=L(f,y)+L(g,y)*.5+p}let{movedRows:b}=n.state;r<C&&o>0&&s.isRowMovable(o-1)?(b=W.moveItem(o,o-1,b),o-=1):S<r&&o<m-1&&s.isRowMovable(o+1)&&(b=W.moveItem(o,o+1,b),o+=1),n.setState({movedRows:b,draggingRow:o});const E=p+L(g,a)*.5,v=p+L(f,u)+L(g,u)*.5;return r<E&&a>0?n.setState({top:a-1}):r>v&&a<c&&n.setState({top:a+1}),!0}onUp(t,n){return this.draggingOffset!==void 0?(this.draggingOffset=void 0,n.setState({draggingRowOffset:null,draggingRow:null,isDragging:!1}),!0):!1}}class xr extends Pa{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.initialSizesProperty="initialRowHeights",this.modelIndexesProperty="modelRows",this.firstIndexProperty="firstRow",this.treePaddingProperty="treePaddingY",this.getHiddenItems=W.getHiddenRows,this.getNextShownItem=W.getNextShownRow,this.getSeparator=xr.getRowSeparator}static getRowSeparator(t,n,s,o){if(!o.allowRowResize)return null;const{x:i,y:r}=t,l=W.getRowSeparatorIndex(i,r,n,o);return l!=null?{index:l,depth:0}:null}setSize(t,n,s){t.setRowHeight(n,s)}resetSize(t,n){t.resetRowHeight(n)}updateSeparator(t,n){t.setState({draggingRowSeparator:n,isDragging:n!==null})}}class Vs extends Qe{static isInTreeBox(t,n){const{column:s,row:o,x:i,y:r}=t,{metrics:l}=n;if(!l)throw new Error("metrics not set");const{gridX:a,gridY:c,firstColumn:d,allColumnXs:u,allColumnWidths:m,allRowHeights:p,allRowYs:g,visibleRowTreeBoxes:f}=l;if(s===d&&o!=null&&f.get(o)!=null&&i>a&&r>c){const w=L(u,s),C=L(m,s),S=L(g,o),b=L(p,o);if(i>=a+w&&i<=a+w+C&&r>=c+S&&r<=c+S+b)return!0}return!1}onDown(t,n){return Vs.isInTreeBox(t,n)}onClick(t,n,s){if(Vs.isInTreeBox(t,n)){const{row:o}=t;if(o!==null)return n.toggleRowExpanded(o,W.isModifierKeyDown(s)),!0}return!1}}class Nh extends Qe{isInCorner(t,n){const s=n.getTheme(),{scrollBarSize:o}=s,{metrics:i}=n;if(!i)throw new Error("metrics not set");const{x:r,y:l}=t,{width:a,height:c,hasVerticalBar:d,hasHorizontalBar:u}=i;return o>0&&d&&u&&r>=a-o&&l>=c-o&&r<=a&&l<=c}onDown(t,n){return this.isInCorner(t,n)}onUp(t,n){return this.isInCorner(t,n)}onClick(t,n){return this.isInCorner(t,n)}}class Ar extends Qe{constructor(){super(...arguments),this.cursor="default"}static getTopWithOffsetFromRawTop(t,n){const s=t.getTheme(),{metrics:o,metricCalculator:i}=t;if(!o)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=o.allRowHeights.get(r);if(a==null){const d=t.getMetricState();a=i.getVisibleRowHeight(r,d)}const c=a*l;return{top:r,topOffset:c}}isInScrollBar(t,n){const s=n.getTheme(),{scrollBarSize:o,scrollBarHoverSize:i}=s,{metrics:r}=n;if(!r)throw new Error("metrics not set");const{x:l,y:a}=t,{barTop:c,barHeight:d,width:u,hasVerticalBar:m}=r;return m&&o>0&&l>=u-i&&l<u&&a>c&&a<c+d}getTopWithOffset(t,n){var f;const{metrics:s}=n;if(!s)throw new Error("metrics not set");const{y:o}=t,{barHeight:i,handleHeight:r,lastTop:l,barTop:a,rowCount:c,scrollableContentHeight:d,scrollableViewportHeight:u}=s,m=o-a,p=ze((m-((f=this.dragOffset)!=null?f:0))/(i-r),0,1);if(c===1)return{top:0,topOffset:p*(d-u)};const g=p*l;return Ar.getTopWithOffsetFromRawTop(n,g)}onDown(t,n){const{metrics:s}=n;if(!s)throw new Error("metrics not set");const{y:o}=t,{handleHeight:i,barTop:r,scrollY:l}=s;if(!this.isInScrollBar(t,n))return!1;const a=o-r;if(a>=l&&a<=l+i)this.dragOffset=a-l,n.setState({isDraggingVerticalScrollBar:!0});else{this.dragOffset=0;const{top:c,topOffset:d}=this.getTopWithOffset(t,n);n.setViewState({top:c,topOffset:d,isDraggingVerticalScrollBar:!0,isDragging:!0})}return!0}onMove(t,n){return this.isInScrollBar(t,n)}onDrag(t,n){if(this.dragOffset!=null){const{top:s,topOffset:o}=this.getTopWithOffset(t,n);return n.setViewState({top:s,topOffset:o,isDraggingVerticalScrollBar:!0,isDragging:!0}),!0}return!1}onUp(t,n){return this.dragOffset!==void 0&&(this.dragOffset=void 0,n.setState({isDraggingVerticalScrollBar:!1,isDragging:!1})),this.isInScrollBar(t,n)}onClick(t,n){return this.isInScrollBar(t,n)}}class Fh extends Qe{onDoubleClick({column:t,row:n},s){const{model:o}=s.props;return He(o)&&t!=null&&n!=null&&o.isEditableRange(ee.makeCell(t,n))?(s.startEditing(t,n),!0):!1}}class Cs{constructor(t=5e3){this.order=t}onDown(t,n){return!1}}class xh extends Cs{onDown(t,n){switch(t.key){case"a":if(W.isModifierKeyDown(t))return n.selectAll(),!0;break;case"ArrowUp":return this.handleArrowMove(0,-1,t,n);case"ArrowDown":return this.handleArrowMove(0,1,t,n);case"ArrowRight":return this.handleArrowMove(1,0,t,n);case"ArrowLeft":return this.handleArrowMove(-1,0,t,n);case"k":case"K":return W.isModifierKeyDown(t)?!1:this.handlePageUp(t,n);case"j":case"J":return W.isModifierKeyDown(t)?!1:this.handlePageDown(t,n);case"h":case"H":return W.isModifierKeyDown(t)?!1:(t.shiftKey||n.clearSelectedRanges(),n.moveCursorToPosition(0,n.state.cursorRow,t.shiftKey),!0);case"l":case"L":{if(W.isModifierKeyDown(t))return!1;const{model:s}=n.props,{columnCount:o}=s;return t.shiftKey||n.clearSelectedRanges(),n.moveCursorToPosition(o-1,n.state.cursorRow,t.shiftKey),!0}case"PageDown":return this.handlePageDown(t,n);case"PageUp":return this.handlePageUp(t,n);case"Home":return t.shiftKey||n.clearSelectedRanges(),n.moveCursorToPosition(W.isModifierKeyDown(t)?n.state.cursorColumn:0,W.isModifierKeyDown(t)?0:n.state.cursorRow,t.shiftKey,!0,!0),!0;case"End":{const{model:s}=n.props,{columnCount:o,rowCount:i}=s;return t.shiftKey||n.clearSelectedRanges(),n.moveCursorToPosition(W.isModifierKeyDown(t)?n.state.cursorColumn:o-1,W.isModifierKeyDown(t)?i-1:n.state.cursorRow,t.shiftKey,!0,!0),!0}case"Escape":return n.clearSelectedRanges(),{preventDefault:!1,stopPropagation:!1};case"Enter":if(n.state.selectedRanges.length>0)return n.moveCursorInDirection(t.shiftKey?ee.SELECTION_DIRECTION.UP:ee.SELECTION_DIRECTION.DOWN),!0;break;case"Tab":if(n.state.selectedRanges.length>0)return n.moveCursorInDirection(t.shiftKey?ee.SELECTION_DIRECTION.LEFT:ee.SELECTION_DIRECTION.RIGHT),!0;break}return!1}handleArrowMove(t,n,s,o){const i=s.shiftKey,r=W.isModifierKeyDown(s);i?o.trimSelectedRanges():o.clearSelectedRanges();const{cursorRow:l,cursorColumn:a,selectionEndColumn:c,selectionEndRow:d}=o.state,u=i?c:a,m=i?d:l;if(r){const{model:p}=o.props,{columnCount:g,rowCount:f}=p,w=r&&i;let C=null,S=null;t<0?(C=0,S=m):t>0?(C=g-1,S=m):n<0?(C=u,S=0):n>0&&(C=u,S=f-1),C!=null&&S!=null&&o.moveCursorToPosition(C,S,i,!0,w)}else{if(!o.metrics)throw new Error("grid.metrics are not set");const{theme:p}=o.props,{autoSelectRow:g=!1,autoSelectColumn:f=!1}=p;if(g&&t!==0){const{lastLeft:w}=o.metrics;let{left:C}=o.state;C=ze(C+t,0,w),o.moveCursorToPosition(C,l,i,!1),o.setViewState({left:C})}else if(f&&n!==0){const{lastTop:w}=o.metrics;let{top:C}=o.state;C=ze(C+n,0,w),o.moveCursorToPosition(C,a,i,!1),o.setViewState({top:C})}else o.moveCursor(t,n,i)}return!0}handlePageUp(t,n){const s=t.shiftKey;s?n.trimSelectedRanges():n.clearSelectedRanges();const{cursorColumn:o,selectionEndRow:i}=n.state,r=i,l=o;if(r==null)return!1;const a=n.getMetricState(),{metricCalculator:c}=n,{bottomVisible:d,topVisible:u,hasHorizontalBar:m}=c.getMetrics(a);let p=r-(d-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(t,n){const s=t.shiftKey;s?n.trimSelectedRanges():n.clearSelectedRanges();const{selectionEndRow:o,cursorColumn:i}=n.state,r=o,l=i;if(r===null)return!1;const a=n.getMetricState(),{metricCalculator:c}=n,{bottomVisible:d,topVisible:u,hasHorizontalBar:m,rowCount:p,lastTop:g}=c.getMetrics(a),f=p-1;let w=d-u+r;w+=m?0:1,w=Math.min(w,f);const C=Math.min(g,w-(r-u));return n.moveCursorToPosition(l,w,s,!1),n.setViewState({top:C}),!0}}class Ah extends Cs{onDown(t,n){switch(t.key){case"Enter":case" ":return this.handleExpandKey(t,n)}return!1}handleExpandKey(t,n){const{selectedRanges:s}=n.state;if(s.length===1){const o=s[0];if(o.startRow===o.endRow&&o.startColumn===o.endColumn){if(!n.metrics)throw new Error("grid.metrics not set");const{model:i}=n.props,{startRow:r,startColumn:l}=o;if(r!=null){const a=n.getModelRow(r);if((l===0||l==null)&&ke(i)&&i.isRowExpandable(a))return n.toggleRowExpanded(r),!0}}}return!1}}class Oh extends Cs{onDown(t,n){if(W.isModifierKeyDown(t))return!1;const{model:s}=n.props,{cursorColumn:o,cursorRow:i}=n.state;if(o==null||i==null||!He(s)||!s.isEditableRange(ee.makeCell(o,i)))return!1;const r=o,l=i;return r==null||l==null?!1:t.key.length===1?(n.startEditing(r,l,!0,[1,1],t.key),!0):t.key==="F2"?(n.startEditing(r,l),!0):t.key==="Backspace"?(n.startEditing(r,l,!0,void 0,""),!0):t.key==="Delete"?(n.setValueForCell(r,l,""),!0):!1}}function kh(e){var s,o;const t=[],n=e.querySelectorAll("tr");for(let i=0;i<n.length;i+=1){const l=n[i].querySelectorAll("td"),a=[];for(let c=0;c<l.length;c+=1){const d=l[c];a.push((o=(s=d.textContent)==null?void 0:s.trim())!=null?o:"")}t.push(a)}return t}function Lh(e){const t=[];return e.forEach(n=>{var o;const s=(o=n.textContent)!=null?o:"";s.length>0&&t.push(s.split(/\t|\u00a0\u00a0 \u00a0/))}),t}function Ph(e){var s,o;const t=e.querySelector("table");if(t!=null)return kh(t);const n=(o=(s=e.textContent)==null?void 0:s.trim())!=null?o:"";if(n.length>0){const{childNodes:i}=e,r=n.includes(" "),l=n.includes("\xA0\xA0 \xA0");return r&&i.length!==0&&(i.length===1||i.length>1&&(i[0].textContent==null||!i[0].textContent.includes(" ")))?n.split(`
|
|
3
3
|
`).map(a=>a.split(" ")):i.length>1||l?Lh(e.childNodes):n}return null}class Hh extends Cs{onDown(t,n){switch(t.key){case"v":if(W.isModifierKeyDown(t)){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 o=()=>{s.removeEventListener("input",o),s.remove(),n.focus();const i=Ph(s);i!=null&&n.pasteValue(i)};return s.addEventListener("input",o),s.focus(),{preventDefault:!1,stopPropagation:!0}}break}return!1}}const _h=e=>{switch(e){case"ArrowDown":return Pt.DOWN;case"ArrowUp":return Pt.UP;case"ArrowLeft":return Pt.LEFT;case"ArrowRight":return Pt.RIGHT;default:return}};function Or({selectionRange:e=void 0,className:t="",disabled:n=!1,value:s="",isQuickEdit:o=!0,onChange:i=()=>{},onCancel:r=()=>{},onDone:l=()=>{},onContextMenu:a=()=>{},style:c={}}){const d=T.exports.useRef(null),u=T.exports.useRef(!1),[m]=T.exports.useState(s),[p,g]=T.exports.useState(!1),[f,w]=T.exports.useState(o),[C,S]=T.exports.useState(s);T.exports.useEffect(function(){const{current:N}=d;N!=null&&(N.focus(),e?N.setSelectionRange(e[0],e[1]):N.setSelectionRange(N.value.length,N.value.length))},[e]);const b=T.exports.useCallback(H=>{i(H)},[i]),E=T.exports.useCallback(H=>{const{value:N}=H.target;S(N),g(!0),b(N)},[b,S,g]),v=T.exports.useCallback(()=>{u.current=!0,p&&b(m),g(!1),r()},[m,p,r,b]),y=T.exports.useCallback(()=>{w(!1)},[w]),M=T.exports.useCallback((H,N=!1)=>{l(C,{direction:H,fillRange:N})},[l,C]),A=T.exports.useCallback(()=>{u.current||M(null)},[u,M]),F=T.exports.useCallback(H=>{switch(H.stopPropagation(),H.key){case"Escape":H.preventDefault(),v();break;case"Enter":if(H.preventDefault(),W.isModifierKeyDown(H))M(void 0,!0);else if(H.altKey){const N=`${C}
|
|
4
|
-
`;S(N),g(!0),b(N)}else M(H.shiftKey?Pt.UP:Pt.DOWN);break;case"Tab":H.preventDefault(),M(H.shiftKey?Pt.LEFT:Pt.RIGHT);break;case"ArrowDown":case"ArrowUp":case"ArrowLeft":case"ArrowRight":f&&(H.preventDefault(),M(_h(H.key)));break}},[v,M,f,S,g,b,C]),V=T.exports.useCallback(H=>{a(H)},[a]);return h("textarea",{ref:d,className:B("grid-cell-input-field",t),value:C,onBlur:A,onChange:E,onKeyDown:F,onContextMenu:V,onClick:y,autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:"false",disabled:n,style:c})}Or.propTypes={selectionRange:D.exports.arrayOf(D.exports.number),className:D.exports.string,disabled:D.exports.bool,isQuickEdit:D.exports.bool,value:D.exports.string,onChange:D.exports.func,onCancel:D.exports.func,onDone:D.exports.func,onContextMenu:D.exports.func,style:D.exports.shape({})};Or.defaultProps={selectionRange:null,className:"",disabled:!1,value:"",isQuickEdit:!0,onChange:()=>{},onCancel:()=>{},onDone:()=>{},onContextMenu:()=>{},style:{}};const Vh=te.createContext({}),ls=class extends T.exports.PureComponent{constructor(e){super(e),this.getCachedKeyHandlers=Ie(l=>[...l,...this.keyHandlers].sort((a,c)=>a.order-c.order)),this.getCachedMouseHandlers=Ie(l=>[...l,...this.mouseHandlers].sort((a,c)=>a.order-c.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:t,isStuckToRight:n,metricCalculator:s,movedColumns:o,movedRows:i,renderer:r}=e;this.renderer=r||new gs,this.metricCalculator=s||new Co,this.canvas=null,this.canvasContext=null,this.animationFrame=null,this.prevMetrics=null,this.metrics=null,this.documentCursor=null,this.dragTimer=null,this.keyHandlers=[new Oh(400),new Hh(450),new xh(500),new Ah(900)],this.mouseHandlers=[new xr(100),new Ti(200),new Dh(300),new Mh(400),new Fh(450),new Ar(500),new Fr(600),new Nh(700),new Vs(800),new yh(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:o,movedRows:i,cursorRow:null,cursorColumn:null,selectionStartRow:null,selectionStartColumn:null,selectionEndRow:null,selectionEndColumn:null,selectedRanges:ye,lastSelectedRanges:ye,cursor:null,editingCell:null,isStuckToBottom:t,isStuckToRight:n}}static getScale(e){var o,i,r,l,a;const t=window.devicePixelRatio||1,n=e,s=(a=(l=(r=(i=(o=n.webkitBackingStorePixelRatio)!=null?o:n.mozBackingStorePixelRatio)!=null?i:n.msBackingStorePixelRatio)!=null?r:n.oBackingStorePixelRatio)!=null?l:n.backingStorePixelRatio)!=null?a:1;return t/s}static getCursorClassName(e){return e!=null&&e!==""?`grid-cursor-${e}`:null}componentDidMount(){var n;this.initContext(),(n=this.canvas)==null||n.addEventListener("wheel",this.handleWheel,{passive:!1}),window.addEventListener("resize",this.handleResize),this.updateCanvasScale(),this.updateCanvas();const{isStuckToBottom:e,isStuckToRight:t}=this.props;e&&this.scrollToBottom(),t&&this.scrollToRight()}componentDidUpdate(e,t){const{isStickyBottom:n,isStickyRight:s,movedColumns:o,movedRows:i,onMovedColumnsChanged:r,onMoveColumnComplete:l,onMovedRowsChanged:a,onMoveRowComplete:c}=this.props,{isStickyBottom:d,isStickyRight:u,movedColumns:m,movedRows:p}=e,{movedColumns:g,movedRows:f}=t,{draggingColumn:w,draggingRow:C,movedColumns:S,movedRows:b}=this.state;if(m!==o&&this.setState({movedColumns:o}),p!==i&&this.setState({movedRows:i}),g!==S&&r(S),t.draggingColumn!=null&&w==null&&l(S),f!==b&&a(b),t.draggingRow!=null&&C==null&&c(b),n!==d&&this.setState({isStuckToBottom:!1}),s!==u&&this.setState({isStuckToRight:!1}),this.updateMetrics(),this.requestUpdateCanvas(),!this.metrics||!this.prevMetrics)return;const{rowCount:E,columnCount:v,height:y,width:M}=this.metrics,{rowCount:A,columnCount:F,height:V,width:H}=this.prevMetrics;if(A!==E||y!==V){const{isStuckToBottom:N}=this.state;N&&this.scrollToBottom()}if(F!==v||M!==H){const{isStuckToRight:N}=this.state;N&&this.scrollToRight()}this.validateSelection()&&this.checkSelectionChange(t)}componentWillUnmount(){var e;this.animationFrame!=null&&cancelAnimationFrame(this.animationFrame),(e=this.canvas)==null||e.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:e}=this.props;return ls.getTheme(this.context,e)}getGridPointFromEvent(e){Sl(this.canvas);const t=this.canvas.getBoundingClientRect(),n=e.clientX-t.left,s=e.clientY-t.top;return this.getGridPointFromXY(n,s)}getGridPointFromXY(e,t){if(!this.metrics)throw new Error("metrics must be set");return W.getGridPointFromXY(e,t,this.metrics)}getMetricState(e=this.state){const t=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 o=this.canvasContext,i=this.canvas.clientWidth,r=this.canvas.clientHeight,{left:l,top:a,leftOffset:c,topOffset:d,movedColumns:u,movedRows:m,isDraggingHorizontalScrollBar:p,isDraggingVerticalScrollBar:g,draggingColumn:f}=e;return{left:l,top:a,leftOffset:c,topOffset:d,width:i,height:r,context:o,theme:t,model:n,movedColumns:u,movedRows:m,isDraggingHorizontalScrollBar:p,isDraggingVerticalScrollBar:g,draggingColumn:f,...s}}getKeyHandlers(){const{keyHandlers:e}=this.props;return this.getCachedKeyHandlers(e)}getMouseHandlers(){const{mouseHandlers:e}=this.props;return this.getCachedMouseHandlers(e)}getModelColumn(e){var n,s;const t=(s=(n=this.metrics)==null?void 0:n.modelColumns)==null?void 0:s.get(e);if(t===void 0)throw new Error(`Unable to get ModelIndex for column ${e}`);return t}getModelRow(e){var n,s;const t=(s=(n=this.metrics)==null?void 0:n.modelRows)==null?void 0:s.get(e);if(t===void 0)throw new Error(`Unable to get ModelIndex for row ${e}`);return t}toggleRowExpanded(e,t=!1){const n=this.getModelRow(e),{model:s}=this.props;ke(s)&&s.isRowExpandable(n)&&s.setRowExpanded(n,!s.isRowExpanded(n),t),this.clearSelectedRanges(),this.commitSelection(),this.moveCursorToPosition(0,e),this.commitSelection(),this.setState({isStuckToBottom:!1})}scrollToBottom(){if(!this.metrics)return;const{bottomVisible:e,rowCount:t,top:n,lastTop:s}=this.metrics;(e<t-1&&e>0||n>s)&&this.setState({top:s})}scrollToRight(){if(!this.metrics)return;const{rightVisible:e,columnCount:t,left:n,lastLeft:s}=this.metrics;(e<t-1&&e>0||n>s)&&this.setState({left:s})}setSelectedRanges(e){const{model:t}=this.props,{columnCount:n,rowCount:s}=t,{cursorRow:o,cursorColumn:i,selectedRanges:r}=this.state;if(this.setState({selectedRanges:e,lastSelectedRanges:r}),e.length>0){const l=ee.boundedRange(e[0],n,s);let a=o,c=i;l.containsCell(i,o)||({row:a,column:c}=l.startCell()),this.setState({selectionStartColumn:l.startColumn,selectionStartRow:l.startRow,selectionEndColumn:l.endColumn,selectionEndRow:l.endRow,cursorColumn:c,cursorRow:a})}}initContext(){const{canvas:e}=this,{canvasOptions:t}=this.props;if(!e)throw new Error("Canvas not set");this.canvasContext=e.getContext("2d",t)}requestUpdateCanvas(){this.animationFrame==null&&(this.animationFrame=requestAnimationFrame(()=>{if(this.animationFrame=null,!this.metrics)throw new Error("Metrics not set");this.updateCanvas(this.metrics)}))}updateCanvas(e=this.updateMetrics()){this.updateCanvasScale();const{onViewChanged:t}=this.props;t(e),this.drawCanvas(e)}updateCanvasScale(){const{canvas:e,canvasContext:t}=this;if(!e)throw new Error("canvas not set");if(!t)throw new Error("canvasContext not set");if(!e.parentElement)throw new Error("Canvas has no parent element");const n=ls.getScale(t),s=e.parentElement.getBoundingClientRect(),o=Math.floor(s.width),i=Math.floor(s.height);e.style.width=`${o}px`,e.style.height=`${i}px`,e.width=o*n,e.height=i*n,t.scale(n,n)}updateScrollBounds(){if(!this.metrics)throw new Error("metrics not set");const{left:e,top:t}=this.state,{lastLeft:n,lastTop:s}=this.metrics;e>n&&this.setState({left:n,leftOffset:0}),t>s&&this.setState({top:s,topOffset:0})}updateMetrics(e=this.state){this.prevMetrics=this.metrics;const{metricCalculator:t}=this,n=this.getMetricState(e);return this.metrics=t.getMetrics(n),this.updateScrollBounds(),this.metrics}checkSelectionChange(e){const{selectedRanges:t}=e,{selectedRanges:n}=this.state;if(n!==t){const{onSelectionChanged:s}=this.props;s(n)}}validateSelection(){const{model:e}=this.props,{selectedRanges:t}=this.state,{columnCount:n,rowCount:s}=e;for(let o=0;o<t.length;o+=1){const i=t[o];if(i.endColumn!=null&&i.endColumn>=n||i.endRow!=null&&i.endRow>=s)return this.setState({selectedRanges:[],lastSelectedRanges:[]}),!1}return!0}clearSelectedRanges(){const{selectedRanges:e}=this.state;this.setState({selectedRanges:[],lastSelectedRanges:e})}trimSelectedRanges(){const{selectedRanges:e}=this.state;e.length>0&&this.setState({selectedRanges:e.slice(e.length-1)})}beginSelection(e,t){this.setState({selectionStartColumn:e,selectionStartRow:t,selectionEndColumn:e,selectionEndRow:t,cursorColumn:e,cursorRow:t})}moveSelection(e,t,n=!1,s=!1){this.setState(o=>{var g,f,w,C;const{selectedRanges:i,selectionStartRow:r,selectionStartColumn:l}=o,{theme:a}=this.props,{autoSelectRow:c,autoSelectColumn:d}=a;if(n&&i.length>0){const S=i[i.length-1];let b=null,E=null,v=null,y=null;s?(b=c!==void 0&&c?null:Math.min(e!=null?e:0,(g=S.startColumn)!=null?g:0),E=d!==void 0&&d?null:Math.min(t!=null?t:0,(f=S.startRow)!=null?f:0),v=c!==void 0&&c?null:Math.max(e!=null?e:0,(w=S.endColumn)!=null?w:0),y=d!==void 0&&d?null:Math.max(t!=null?t:0,(C=S.endRow)!=null?C:0)):(b=S.startColumn,E=S.startRow,(l!=null||r!=null)&&((c===void 0||!c)&&(b=l),(d===void 0||!d)&&(E=r)),v=c!==void 0&&c?null:e,y=d!==void 0&&d?null:t);const M=ee.makeNormalized(b,E,v,y);if(S.equals(M))return null;const A=[...i];return A[A.length-1]=M,{selectedRanges:A,selectionEndColumn:e,selectionEndRow:t}}const u=[...i],m=c!==void 0&&c?null:e,p=d!==void 0&&d?null:t;return u.push(ee.makeNormalized(m,p,m,p)),{selectedRanges:u,selectionEndColumn:e,selectionEndRow:t}})}commitSelection(){this.setState(e=>{const{theme:t}=this.props,{autoSelectRow:n}=t,{selectedRanges:s,lastSelectedRanges:o,cursorRow:i,cursorColumn:r}=e;if(s.length===1&&(n!==void 0&&n?ee.rowCount(s)===1:ee.cellCount(s)===1)&&ee.rangeArraysEqual(s,o))return{selectedRanges:[],lastSelectedRanges:[],cursorColumn:null,cursorRow:null};let l=s.slice();if(l.length>1){const d=l[l.length-1];for(let u=0;u<l.length-1;u+=1){const m=l[u];if(m.contains(d)){const p=m.subtract(d);l.pop(),l.splice(u,1),l=l.concat(p);break}}l=ee.consolidate(l)}let a=r,c=i;if(!ee.containsCell(l,r,i)){const{model:d}=this.props,{columnCount:u,rowCount:m}=d,p=ee.nextCell(ee.boundedRanges(s,u,m));p!=null?{column:a,row:c}=p:(a=null,c=null)}return l.length===0&&(a=null,c=null),{cursorRow:c,cursorColumn:a,selectedRanges:l,lastSelectedRanges:s}})}setFocusRow(e){var u;if(!this.metrics||!this.prevMetrics)return;const{gridY:t,height:n,lastTop:s,userRowHeights:o,rowHeight:i}=this.metrics,r=n-t,l=Math.round(r/2)+((u=o.get(e))!=null?u:i),a=this.getMetricState(),c=this.metricCalculator.getLastTop(a,e+1,l);this.setState({top:Math.min(s,c),selectedRanges:[new ee(null,e,null,e)],isStuckToBottom:!1});const{cursorColumn:d}=this.state;this.moveCursorToPosition(d,e,!1,!1)}selectAll(){const{model:e,theme:t}=this.props,{autoSelectRow:n,autoSelectColumn:s}=t,o=s!==void 0&&s?null:0,i=s!==void 0&&s?null:e.rowCount-1,r=n!==void 0&&n?null:0,l=n!==void 0&&n?null:e.columnCount-1;this.setSelectedRanges([new ee(r,o,l,i)])}moveCursor(e,t,n){const{cursorRow:s,cursorColumn:o,selectionEndColumn:i,selectionEndRow:r}=this.state,l=n?i:o,a=n?r:s;if(a===null||l===null){const{left:c,top:d}=this.state;this.moveCursorToPosition(c,d,n)}else{const{model:c}=this.props,{columnCount:d,rowCount:u}=c,m=ze(l+e,0,d-1),p=ze(a+t,0,u-1);this.moveCursorToPosition(m,p,n)}}moveCursorInDirection(e=ee.SELECTION_DIRECTION.DOWN){var c;const{model:t}=this.props,{columnCount:n,rowCount:s}=t,{cursorRow:o,cursorColumn:i,selectedRanges:r}=this.state,l=r.length>0?r:[ee.makeCell(i,o)];let a=null;if(l.length===1&&ee.cellCount(l)===1){const d=new ee(0,0,n-1,s-1);a=(c=d.nextCell(i,o,e))!=null?c:d.startCell(e)}else a=ee.nextCell(ee.boundedRanges(l,n,s),i,o,e);if(a!=null){const{column:d,row:u}=a;this.setState({cursorColumn:d,cursorRow:u}),ee.containsCell(r,d,u)||this.setState({selectedRanges:[ee.makeCell(d,u)],selectionStartColumn:d,selectionStartRow:u,selectionEndColumn:d,selectionEndRow:u}),this.moveViewToCell(a.column,a.row)}}moveCursorToPosition(e,t,n=!1,s=!0,o=!1){n||this.beginSelection(e,t),this.moveSelection(e,t,n,o),s&&this.moveViewToCell(e,t)}moveViewToCell(e,t){if(!this.metrics)throw new Error("metrics not set");const{metricCalculator:n}=this,{bottomVisible:s,rightVisible:o,topVisible:i,leftVisible:r}=this.metrics,l=this.getMetricState(this.state);let{top:a,left:c,topOffset:d,leftOffset:u}=this.state;t!=null&&!W.isFloatingRow(t,this.metrics)&&(t<i?(a=n.getTopForTopVisible(l,t),d=0):t>s&&(a=n.getTopForBottomVisible(l,t),d=0)),e!=null&&!W.isFloatingColumn(e,this.metrics)&&(e<r?(c=n.getLeftForLeftVisible(l,e),u=0):e>o&&(c=n.getLeftForRightVisible(l,e),u=0)),this.setViewState({top:a,left:c,topOffset:d,leftOffset:u})}setViewState(e,t=!1){if(!this.metrics)throw new Error("metrics not set");const{isStickyBottom:n,isStickyRight:s}=this.props,{top:o,left:i}=e,{lastTop:r,lastLeft:l}=this.metrics;o!=null&&this.setState({isStuckToBottom:n&&o>=r}),i!=null&&this.setState({isStuckToRight:s&&i>=l}),this.setState(e),t&&this.forceUpdate()}startEditing(e,t,n=!1,s,o){const{model:i}=this.props;if(!He(i))throw new Error("model is not editable");const r=this.getModelColumn(e),l=this.getModelRow(t),a={column:e,row:t,selectionRange:s,value:o!==void 0?o:i.editValueForCell(r,l),isQuickEdit:n};this.setState({editingCell:a,cursorColumn:e,cursorRow:t}),this.moveViewToCell(e,t)}isValidForCell(e,t,n){const{model:s}=this.props,o=this.getModelColumn(e),i=this.getModelRow(t);return He(s)&&s.isValidForCell(o,i,n)}async pasteValue(e){const{model:t}=this.props,{movedColumns:n,movedRows:s,selectedRanges:o}=this.state;try{if(bl(t),!t.isEditable||!o.every(u=>t.isEditableRange(u)))throw new Ui("Can't paste in to read-only area.");if(o.length<=0)throw new Ui("Select an area to paste to.");if(typeof e=="string"){const u=[],m=W.getModelRanges(o,n,s);ee.forEachCell(m,(p,g)=>{u.push({column:p,row:g,text:e})}),await t.setValues(u);return}const i=e.length,r=e[0].length,{columnCount:l,rowCount:a}=t;let c=o;if(c.every(u=>{var m,p;return ee.cellCount([u])===1&&((m=u.startColumn)!=null?m:0)+r<=l&&((p=u.startRow)!=null?p:0)+i<=a})&&(c=c.map(u=>{var m,p;return new ee(u.startColumn,u.startRow,((m=u.startColumn)!=null?m:0)+r-1,((p=u.startRow)!=null?p:0)+i-1)}),this.setSelectedRanges(c)),!c.every(u=>ee.rowCount([u])===i&&ee.columnCount([u])===r))throw new Ui("Copy and paste area are not same size.");const d=[];c.forEach(u=>{var m,p;for(let g=0;g<r;g+=1)for(let f=0;f<i;f+=1)d.push({column:((m=u.startColumn)!=null?m:0)+g,row:((p=u.startRow)!=null?p:0)+f,text:e[f][g]})}),await t.setValues(d)}catch(i){const{onError:r}=this.props;r(i instanceof Error?i:new Error(`${i}`))}}setValueForCell(e,t,n){const{model:s}=this.props;bl(s);const o=this.getModelColumn(e),i=this.getModelRow(t);return s.isValidForCell(o,i,n)?(s.setValueForCell(o,i,n),!0):!1}setValueForRanges(e,t){const{model:n}=this.props,{movedColumns:s,movedRows:o}=this.state,i=W.getModelRanges(e,s,o);He(n)&&n.setValueForRanges(i,t)}isSelected(e,t){var s,o;const{selectedRanges:n}=this.state;for(let i=0;i<n.length;i+=1){const r=n[i],l=r.startRow===null||r.startRow<=e&&e<=((s=r.endRow)!=null?s:0),a=r.startColumn===null||r.startColumn<=t&&t<=((o=r.endColumn)!=null?o:0);if(l&&a)return!0}return!1}addDocumentCursor(e=null){this.documentCursor!==ls.getCursorClassName(e)&&(this.documentCursor!=null&&document.documentElement.classList.remove(this.documentCursor),this.documentCursor=ls.getCursorClassName(e),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(e){this.stopDragTimer();const t=new MouseEvent("custom",e.nativeEvent);this.dragTimer=setTimeout(()=>{this.handleMouseDrag(t)},ls.dragTimeout)}stopDragTimer(){this.dragTimer&&(clearTimeout(this.dragTimer),this.dragTimer=null)}drawCanvas(e=this.updateMetrics()){if(!this.canvas)throw new Error("canvas is not set");if(!this.canvasContext)throw new Error("context not set");const{cursorColumn:t,cursorRow:n,draggingColumn:s,draggingColumnSeparator:o,draggingRow:i,draggingRowOffset:r,draggingRowSeparator:l,editingCell:a,isDraggingHorizontalScrollBar:c,isDraggingVerticalScrollBar:d,isDragging:u,mouseX:m,mouseY:p,selectedRanges:g}=this.state,{model:f,stateOverride:w}=this.props,{renderer:C}=this,S=this.canvasContext,b=this.getTheme(),E=this.canvas.clientWidth,v=this.canvas.clientHeight,y={width:E,height:v,context:S,theme:b,model:f,metrics:e,mouseX:m,mouseY:p,selectedRanges:g,draggingColumn:s,draggingColumnSeparator:o,draggingRow:i,draggingRowOffset:r,draggingRowSeparator:l,editingCell:a,isDraggingHorizontalScrollBar:c,isDraggingVerticalScrollBar:d,isDragging:u,cursorColumn:t,cursorRow:n,...w};S.save(),C.drawCanvas(y),S.restore()}focus(){var e;(e=this.canvas)==null||e.focus()}isFocused(){return document.activeElement===this.canvas}handleClick(e){var s;const t=this.getGridPointFromEvent(e),n=this.getMouseHandlers();for(let o=0;o<n.length;o+=1)if(n[o].onClick(t,this,e)!==!1){e.stopPropagation(),e.preventDefault();break}(s=this.canvas)==null||s.focus()}handleContextMenu(e){const t=this.getGridPointFromEvent(e),n=this.getMouseHandlers();for(let s=0;s<n.length;s+=1)if(n[s].onContextMenu(t,this,e)!==!1){e.stopPropagation(),e.preventDefault();break}}handleKeyDown(e){var n,s;const t=this.getKeyHandlers();for(let o=0;o<t.length;o+=1){const r=t[o].onDown(e,this);if(r!==!1){const l=r;((n=l==null?void 0:l.stopPropagation)==null||n)&&e.stopPropagation(),((s=l==null?void 0:l.preventDefault)==null||s)&&e.preventDefault();break}}}notifyMouseHandlers(e,t,n=!0,s=!1){var l,a;const o=this.getGridPointFromEvent(t),i=this.getMouseHandlers();let r=null;for(let c=0;c<i.length;c+=1){const d=i[c],u=d[e]!=null&&d[e](o,this,t);if(u!==!1){d.cursor!=null&&({cursor:r}=d,s&&this.addDocumentCursor(r));const m=u;((l=m==null?void 0:m.stopPropagation)==null||l)&&t.stopPropagation(),((a=m==null?void 0:m.preventDefault)==null||a)&&t.preventDefault();break}}if(this.setState({cursor:r}),n){const{x:c,y:d}=o;this.setState({mouseX:c,mouseY:d})}}handleMouseDown(e){window.addEventListener("mousemove",this.handleMouseDrag,!0),window.addEventListener("mouseup",this.handleMouseUp,!0),!(e.button!=null&&e.button!==0)&&(this.notifyMouseHandlers("onDown",e),this.startDragTimer(e))}handleDoubleClick(e){this.notifyMouseHandlers("onDoubleClick",e)}handleMouseMove(e){this.notifyMouseHandlers("onMove",e)}handleMouseLeave(e){this.notifyMouseHandlers("onLeave",e,!1),this.setState({mouseX:null,mouseY:null})}handleMouseDrag(e){this.setState({isDragging:!0}),this.notifyMouseHandlers("onDrag",e,!0,!0),this.stopDragTimer()}handleMouseUp(e){window.removeEventListener("mousemove",this.handleMouseDrag,!0),window.removeEventListener("mouseup",this.handleMouseUp,!0),!(e.button!=null&&e.button!==0)&&(this.notifyMouseHandlers("onUp",e,!1),this.stopDragTimer(),this.removeDocumentCursor())}handleResize(){if(this.updateCanvasScale(),this.updateCanvas(),!this.metrics)throw new Error("metrics not set");this.forceUpdate()}handleWheel(e){var v,y,M,A;if(this.notifyMouseHandlers("onWheel",e),e.defaultPrevented)return;const{metricCalculator:t,metrics:n}=this,s=this.getMetricState();if(!n)throw new Error("metrics not set");const{lastTop:o,lastLeft:i,columnCount:r,rowCount:l,scrollableContentWidth:a,scrollableViewportWidth:c,scrollableContentHeight:d,scrollableViewportHeight:u,hasHorizontalBar:m,hasVerticalBar:p}=n;let{top:g,left:f,topOffset:w,leftOffset:C}=n;const S=this.getTheme();let{deltaX:b,deltaY:E}=W.getScrollDelta(e,n.barWidth,n.barHeight,n.rowHeight,n.rowHeight);for(;m&&b!==0;){if(C+=b,b=0,r>1){if(C>0&&f>=i||C<0&&f<=0){C=0;break}}else{if(C<=0){C=0;break}const F=a-c;if(C>=F){C=F;break}}if(C>0){const F=(v=n.allColumnWidths.get(f))!=null?v:t.getVisibleColumnWidth(f,s);C>=F?(b=C-F,C=0,f+=1):S.scrollSnapToColumn&&r>1&&(C=0,f+=1)}else if(C<0){const F=(y=n.allColumnWidths.get(f-1))!=null?y:t.getVisibleColumnWidth(f-1,s);Math.abs(C)<=F&&S.scrollSnapToColumn&&r>1?(C=0,f-=1):(b=C+F,C=0,f-=1)}}for(;p&&E!==0;){if(w+=E,E=0,l>1){if(w>0&&g>=o||w<0&&g<=0){w=0;break}}else{if(w<=0){w=0;break}const F=d-u;if(w>=F){w=F;break}}if(w>0){const F=(M=n.allRowHeights.get(g))!=null?M:t.getVisibleRowHeight(g,s);w>=F?(E=w-F,w=0,g+=1):S.scrollSnapToRow&&l>1&&(w=0,g+=1)}else if(w<0){const F=(A=n.allRowHeights.get(g-1))!=null?A:t.getVisibleRowHeight(g-1,s);Math.abs(w)<=F&&S.scrollSnapToRow&&l>1?(w=0,g-=1):(E=w+F,w=0,g-=1)}}this.setViewState({top:g,left:f,leftOffset:C,topOffset:w}),e.stopPropagation(),e.preventDefault()}handleEditCellCancel(){this.setState({editingCell:null}),this.focus()}handleEditCellChange(e){this.setState(({editingCell:t})=>{try{return Sl(t),{editingCell:{...t,value:e}}}catch(n){const{onError:s}=this.props;return s(n instanceof Error?n:new Error(`${n}`)),null}})}handleEditCellCommit(e,{direction:t=Pt.DOWN,fillRange:n=!1}={}){const{editingCell:s,selectedRanges:o}=this.state;if(!s)throw new Error("editingCell not set");const{column:i,row:r}=s;if(!this.isValidForCell(i,r,e)){t===null&&this.setState({editingCell:null});return}n?this.setValueForRanges(o,e):this.setValueForCell(i,r,e),t!==null&&this.moveCursorInDirection(t),this.setState({editingCell:null}),this.focus()}renderInputField(){const{model:e}=this.props,{editingCell:t}=this.state,{metrics:n}=this;if(t==null||n==null||!He(e))return null;const{selectionRange:s,value:o,isQuickEdit:i}=t,{column:r,row:l}=t,{gridX:a,gridY:c,allColumnXs:d,allRowYs:u,allColumnWidths:m,allRowHeights:p}=n,g=d.get(r),f=u.get(l),w=m.get(r),C=p.get(l),S=g!=null&&f!=null&&w!=null&&C!=null?{position:"absolute",left:a+g,top:c+f,width:w,height:C}:{opacity:0},b=this.getModelColumn(r),E=this.getModelRow(l),v=b!=null&&E!=null?{textAlign:e.textAlignForCell(b,E)}:void 0,y=e.isValidForCell(b,E,o);return h("div",{style:S,children:h(Or,{selectionRange:s,className:B({error:!y}),onCancel:this.handleEditCellCancel,onChange:this.handleEditCellChange,onDone:this.handleEditCellCommit,isQuickEdit:i,style:v,value:o},`${r},${l}`)})}render(){const{cursor:e}=this.state;return R(Fe,{children:[h("canvas",{className:B("grid-canvas",ls.getCursorClassName(e)),ref:t=>{this.canvas=t},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 Ws=ls;Ws.contextType=Vh;Ws.defaultProps={canvasOptions:{alpha:!1},isStickyBottom:!1,isStickyRight:!1,isStuckToBottom:!1,isStuckToRight:!1,keyHandlers:ye,mouseHandlers:ye,movedColumns:ye,movedRows:ye,onError:()=>{},onSelectionChanged:()=>{},onMovedColumnsChanged:e=>{},onMoveColumnComplete:()=>{},onMovedRowsChanged:()=>{},onMoveRowComplete:()=>{},onViewChanged:()=>{},stateOverride:{},theme:{autoSelectColumn:!1,autoSelectRow:!1}};Ws.pixelsPerLine=100/3;Ws.dragTimeout=1e3;Ws.getTheme=Ie((e,t)=>({...Th,...e,...t}));class Ha extends dr{get floatingTopRowCount(){return 0}get floatingBottomRowCount(){return 0}get floatingLeftColumnCount(){return 0}get floatingRightColumnCount(){return 0}get columnHeaderMaxDepth(){return 1}truncationCharForCell(t,n){}textAlignForCell(t,n){return"left"}colorForCell(t,n,s){return s.textColor}backgroundColorForCell(t,n,s){return null}colorForColumnHeader(t,n=0){return null}textForRowHeader(t){return""}textForRowFooter(t){return""}isColumnMovable(t,n=0){return!0}isRowMovable(t){return!0}getColumnHeaderGroup(t,n){}getColumnHeaderParentGroup(t,n){}}class Uh extends Ha{constructor({rowCount:t=1e9,columnCount:n=100,floatingTopRowCount:s=0,floatingBottomRowCount:o=0,floatingLeftColumnCount:i=0,floatingRightColumnCount:r=0,isEditable:l=!1,editedData:a=[]}={}){super(),this.numRows=t,this.numColumns=n,this.floatingTop=s,this.floatingBottom=o,this.floatingLeft=i,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(t,n){var s,o;return(o=(s=this.editedData[t])==null?void 0:s[n])!=null?o:`${t},${n}`}colorForCell(t,n,s){return s.textColor}textForColumnHeader(t,n=0){return`${t}`}textForRowHeader(t){return`${t}`}textForRowFooter(t){return`${t}`}async setValueForCell(t,n,s){this.editedData[t]==null&&(this.editedData[t]=[]),this.editedData[t][n]=`${s}`}async setValueForRanges(t,n){ee.forEachCell(t,(s,o)=>{this.setValueForCell(s,o,n)})}async setValues(t){var n,s;for(let o=0;o<t.length;o+=1){const i=t[o];this.setValueForCell((n=i.column)!=null?n:i.x,(s=i.row)!=null?s:i.y,i.text)}}editValueForCell(t,n){return this.textForCell(t,n)}isValidForCell(t,n,s){return!0}isEditableRange(t){return this.isEditable}delete(t){throw new Error("Method not implemented.")}}const as=class extends Uh{constructor({rowCount:e=as.DEFAULT_ROW_COUNT,columnCount:t=as.DEFAULT_COLUMN_COUNT,children:n=new Map,childRowCount:s=Math.ceil(Math.max(as.MIN_CHILD_ROW_COUNT,e*as.DEFAULT_CHILD_ROW_COUNT_FACTOR)),maxDepth:o=as.MAX_DEPTH}={}){super({rowCount:e,columnCount:t}),this.getCachedModelRowOffset=Et((i,r)=>{let l=null,a=r;const c=[...i].sort((d,u)=>d[0]-u[0]);for(let d=0;d<c.length;d+=1){const[u,m]=c[d];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=Et((i,r)=>{const{key:l,offsetRow:a}=this.getCachedModelRowOffset(i,r);if(l!=null){const c=i.get(l);if(c!==void 0)return`${l}.${c.textForRowHeader(a)}`}return`${a}`}),this.getCachedTextForCell=Et((i,r,l)=>{const{key:a,offsetRow:c}=this.getCachedModelRowOffset(i,l);if(a!=null){const d=i.get(a);if(d!==void 0)return`${a}.${d.textForCell(r,c)}`}return`${r},${c}`}),this.getCachedIsRowExpandable=Et((i,r,l)=>this.getCachedDepthForRow(i,r)<l),this.getCachedIsRowExpanded=Et((i,r)=>{const{key:l,offsetRow:a}=this.getCachedModelRowOffset(i,r);if(l!=null){const c=i.get(l);if(c!==void 0)return c.isRowExpanded(a)}return i.has(a)}),this.getCachedDepthForRow=Et((i,r)=>{const{key:l,offsetRow:a}=this.getCachedModelRowOffset(i,r);if(l!=null){const c=i.get(l);if(c!==void 0)return c.depthForRow(a)+1}return 0}),this.children=n,this.childRowCount=s,this.maxDepth=o}textForCell(e,t){return this.getCachedTextForCell(this.children,e,t)}textForRowHeader(e){return this.getCachedTextForRowHeader(this.children,e)}isRowMovable(e){return!1}get hasExpandableRows(){return!0}get isExpandAllAvailable(){return!1}get floatingBottomRowCount(){return 0}isRowExpandable(e){return this.getCachedIsRowExpandable(this.children,e,this.maxDepth)}isRowExpanded(e){return this.getCachedIsRowExpanded(this.children,e)}setRowExpanded(e,t,n=!1){const{key:s,offsetRow:o}=this.getCachedModelRowOffset(this.children,e),i=new Map(this.children);if(s!=null){const r=this.children.get(s);if(r!==void 0){const{rowCount:l}=r;r.setRowExpanded(o,t,n),this.numRows+=r.rowCount-l}}else if(t){const r=new as({rowCount:this.childRowCount,columnCount:this.numColumns});i.set(o,r),this.numRows+=r.rowCount}else{const r=i.get(o);r!==void 0&&(this.numRows-=r.rowCount,i.delete(o))}this.children=i}expandAll(){throw new Error("Expand all not implemented.")}collapseAll(){throw new Error("Collapse all not implemented.")}depthForRow(e){return this.getCachedDepthForRow(this.children,e)}};let wo=as;wo.DEFAULT_ROW_COUNT=1e9;wo.DEFAULT_COLUMN_COUNT=100;wo.DEFAULT_CHILD_ROW_COUNT_FACTOR=.01;wo.MIN_CHILD_ROW_COUNT=10;wo.MAX_DEPTH=10;const{dh:I}=globalThis,Ei=D.exports.shape({name:D.exports.string.isRequired,type:D.exports.string.isRequired,description:D.exports.string,constituentType:D.exports.string}),_a=D.exports.shape({not:D.exports.func.isRequired,and:D.exports.func.isRequired,or:D.exports.func.isRequired}),Bh=D.exports.shape({asc:D.exports.func.isRequired,desc:D.exports.func.isRequired,abs:D.exports.func.isRequired,column:Ei.isRequired,direction:D.exports.string.isRequired,isAbs:D.exports.bool.isRequired}),Gh=D.exports.shape({columns:D.exports.arrayOf(Ei).isRequired,customColumns:D.exports.arrayOf(D.exports.string).isRequired,filter:D.exports.arrayOf(_a),addEventListener:D.exports.func.isRequired,removeEventListener:D.exports.func.isRequired,size:D.exports.number.isRequired,sort:D.exports.arrayOf(D.exports.any),copy:D.exports.func.isRequired,applyFilter:D.exports.func.isRequired,applySort:D.exports.func.isRequired,applyCustomColumns:D.exports.func.isRequired,description:D.exports.string}),zh=D.exports.shape({columns:D.exports.arrayOf(Ei),filter:D.exports.arrayOf(D.exports.any),isExpanded:D.exports.func.isRequired,saveExpandedState:D.exports.func.isRequired,addEventListener:D.exports.func.isRequired,removeEventListener:D.exports.func.isRequired,size:D.exports.number.isRequired,sort:D.exports.arrayOf(D.exports.any),applyFilter:D.exports.func.isRequired,applySort:D.exports.func.isRequired}),ni=D.exports.shape({name:D.exports.string.isRequired,type:D.exports.string.isRequired}),Wh=D.exports.shape({created:D.exports.arrayOf(ni).isRequired,updated:D.exports.arrayOf(ni).isRequired,removed:D.exports.arrayOf(ni).isRequired}),$h=D.exports.shape({groupingColumns:D.exports.arrayOf(D.exports.string),aggregations:D.exports.shape({}),includeConstituents:D.exports.bool,includeOriginalColumns:D.exports.bool,includeDescriptions:D.exports.bool}),qh=D.exports.shape({addEventListener:D.exports.func.isRequired,removeEventListener:D.exports.func.isRequired,onLogMessage:D.exports.func,getTable:D.exports.func.isRequired,runCode:D.exports.func.isRequired});Object.freeze({Column:Ei,FilterCondition:_a,IdeSession:qh,RollupConfig:$h,Sort:Bh,Table:Gh,TreeTable:zh,VariableChanges:Wh,VariableDefinition:ni});const Kh=1e4;function Xh(e,t,n=Kh){return new Promise((s,o)=>{let i;const r=setTimeout(()=>{i==null||i(),o(new vr(`Variable ${t} not found`))},n);function l(a){const c=a.created.find(d=>d.title===t);c!=null&&(clearTimeout(r),i==null||i(),s(c))}i=e.subscribeToFieldUpdates(l)})}class _e{static isValid(t){return!0}static isSameFormat(t,n){throw new Error("isSameFormat not implemented")}static makeFormat(t,n,s){return{label:t,formatString:n,type:s}}format(t,n){return""}}_e.TYPE_GLOBAL="type-global";_e.TYPE_CONTEXT_PRESET="type-context-preset";_e.TYPE_CONTEXT_CUSTOM="type-context-custom";class Yh extends _e{format(t){switch(t){case 1:case!0:return"true";case 0:case!1:return"false";default:return""}}}class Qh extends _e{format(t){return String.fromCharCode(t)}}const yl=se.module("DateTimeColumnFormatter"),cs=class extends _e{constructor({timeZone:e="",showTimeZone:t=!0,showTSeparator:n=!1,defaultDateTimeFormatString:s=cs.DEFAULT_DATETIME_FORMAT_STRING}={}){super();const o=e||cs.DEFAULT_TIME_ZONE_ID;try{this.dhTimeZone=I.i18n.TimeZone.getTimeZone(o)}catch{yl.error("Unsupported time zone id",o),this.dhTimeZone=I.i18n.TimeZone.getTimeZone(cs.DEFAULT_TIME_ZONE_ID)}this.defaultDateTimeFormatString=s,this.showTimeZone=t,this.showTSeparator=n,this.formatStringMap=cs.makeFormatStringMap(t,n)}static isValid(e){try{return I.i18n.DateTimeFormat.format(e.formatString,new Date),!0}catch{return!1}}static makeFormat(e,t,n=_e.TYPE_CONTEXT_PRESET){return{label:e,formatString:t,type:n}}static isSameFormat(e,t){return e===t||e!==null&&t!==null&&e.type===t.type&&e.formatString===t.formatString}static makeGlobalFormatStringMap(e,t){const n=t?"'T'":" ",s=e?" 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(e,t){return[...cs.makeGlobalFormatStringMap(e,t).keys()]}static makeFormatStringMap(e,t){const n=t!==void 0&&t?"'T'":" ",s=e!==void 0&&e?" 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(e,t){return[...cs.makeFormatStringMap(e,t).keys()]}getEffectiveFormatString(e){var t;return(t=this.formatStringMap.get(e))!=null?t:e}format(e,t={}){const n=t.formatString!=null&&t.formatString!==""?t.formatString:this.defaultDateTimeFormatString,s=this.getEffectiveFormatString(n);try{return I.i18n.DateTimeFormat.format(s,e,this.dhTimeZone)}catch{yl.error("Invalid format arguments")}return""}};let jn=cs;jn.DEFAULT_DATETIME_FORMAT_STRING="yyyy-MM-dd HH:mm:ss.SSS";jn.DEFAULT_TIME_ZONE_ID="America/New_York";const jh=se.module("DecimalColumnFormatter"),Ht=class extends _e{constructor({defaultFormatString:e=Ht.DEFAULT_FORMAT_STRING}={}){super(),this.defaultFormatString=e}static isValid(e){try{return I.i18n.NumberFormat.format(e.formatString,0),!0}catch{return!1}}static makeFormat(e,t,n=_e.TYPE_CONTEXT_PRESET,s){return{label:e,type:n,formatString:t,multiplier:s}}static makePresetFormat(e,t="",n){return Ht.makeFormat(e,t,_e.TYPE_CONTEXT_PRESET,n)}static makeCustomFormat(e="",t){return Ht.makeFormat("Custom Format",e,_e.TYPE_CONTEXT_CUSTOM,t)}static isSameFormat(e,t){return e===t||e!=null&&t!=null&&e.type===t.type&&e.formatString===t.formatString&&e.multiplier===t.multiplier}format(e,t={}){const n=t.formatString!=null&&t.formatString!==""?t.formatString:this.defaultFormatString,s=t.multiplier!==void 0&&t.multiplier!==0?e*t.multiplier:e;try{return I.i18n.NumberFormat.format(n,s)}catch{jh.error("Invalid format arguments")}return""}};let Be=Ht;Be.DEFAULT_FORMAT_STRING="###,##0.0000";Be.FORMAT_PERCENT=Ht.makePresetFormat("Percent","##0.00%");Be.FORMAT_BASIS_POINTS=Ht.makePresetFormat("Basis Points","###,##0 bp",1e4);Be.FORMAT_MILLIONS=Ht.makePresetFormat("Millions","###,##0.000 mm",1e-6);Be.FORMAT_SCIENTIFIC_NOTATION=Ht.makePresetFormat("Scientific Notation","0.0000E0");Be.FORMAT_ROUND=Ht.makePresetFormat("Round","###,##0");Be.FORMAT_ROUND_TWO_DECIMALS=Ht.makePresetFormat("0.00","###,##0.00");Be.FORMAT_ROUND_FOUR_DECIMALS=Ht.makePresetFormat("0.0000","###,##0.0000");class Zh extends _e{format(t){return`${t}`}}const Jh=se.module("IntegerColumnFormatter"),_s=class extends _e{constructor({defaultFormatString:e=_s.DEFAULT_FORMAT_STRING}={}){super(),this.defaultFormatString=e}static isValid(e){try{return I.i18n.NumberFormat.format(e.formatString,0),!0}catch{return!1}}static makeFormat(e,t,n=_e.TYPE_CONTEXT_PRESET,s){return{label:e,type:n,formatString:t,multiplier:s}}static makePresetFormat(e,t="",n){return _s.makeFormat(e,t,_e.TYPE_CONTEXT_PRESET,n)}static makeCustomFormat(e="",t){return _s.makeFormat("Custom Format",e,_e.TYPE_CONTEXT_CUSTOM,t)}static isSameFormat(e,t){return e===t||e!=null&&t!=null&&e.type===t.type&&e.formatString===t.formatString&&e.multiplier===t.multiplier}format(e,t={}){const n=t.formatString!=null&&t.formatString!==""?t.formatString:this.defaultFormatString,s=t.multiplier!==void 0&&t.multiplier!==0?e*t.multiplier:e;try{return I.i18n.NumberFormat.format(n,s)}catch{Jh.error("Invalid format arguments")}return""}};let kt=_s;kt.DEFAULT_FORMAT_STRING="###,##0";kt.FORMAT_MILLIONS=_s.makePresetFormat("Millions","###,##0.000 mm",1e-6);kt.FORMAT_SCIENTIFIC_NOTATION=_s.makePresetFormat("Scientific Notation","0.0000E0");class em extends _e{format(t){return t}}const pt=class{static makeDateWrapper(e,t,n=0,s=1,o=0,i=0,r=0,l=0){if(!e)throw new Error("No timezone provided");const a=`${t}`.padStart(4,"0"),c=`${n+1}`.padStart(2,"0"),d=`${s}`.padStart(2,"0"),u=`${o}`.padStart(2,"0"),m=`${i}`.padStart(2,"0"),p=`${r}`.padStart(2,"0"),g=`${l}`.padStart(9,"0"),f=`${a}-${c}-${d} ${u}:${m}:${p}.${g}`;return I.i18n.DateTimeFormat.parse(pt.FULL_DATE_FORMAT,f,I.i18n.TimeZone.getTimeZone(e))}static getNextNanos(e){const t=parseInt(e,10),n="0".repeat(9-e.length),s=`${t+1}${n}`;return parseInt(s,10)}static getNextDate(e,t,n){let{year:s,month:o,date:i,hours:r,minutes:l,seconds:a,nanos:c}=t;if(e.nanos!=null){if(e.nanos.length===9)return null;c=pt.getNextNanos(e.nanos),c>999999999&&(a+=1,c=0)}else e.seconds!=null?a+=1:e.minutes!=null?l+=1:e.hours!=null?r+=1:e.date!=null?i+=1:e.month!=null?o+=1:s+=1;const d=new Date(s,o,i,r,l,a);return pt.makeDateWrapper(n,d.getFullYear(),d.getMonth(),d.getDate(),d.getHours(),d.getMinutes(),d.getSeconds(),c)}static parseMonth(e){const t=parseInt(e,10);if(!Number.isNaN(t))return t>=1&&t<=12?t-1:NaN;const n=e.trim().toLowerCase();if(n.length>=3){for(let s=0;s<pt.months.length;s+=1)if(pt.months[s].startsWith(n))return s}return NaN}static parseDateValues(e,t,n,s,o,i,r){const l=parseInt(e,10),a=t!=null?this.parseMonth(t):0,c=n!=null?parseInt(n,10):1,d=s!=null?parseInt(s,10):0,u=o!=null?parseInt(o,10):0,m=i!=null?parseInt(i,10):0,p=r!=null?parseInt(r.padEnd(9,"0"),10):0;return Number.isNaN(l)||Number.isNaN(a)||Number.isNaN(c)||Number.isNaN(d)||Number.isNaN(u)||Number.isNaN(m)||Number.isNaN(p)?null:{year:l,month:a,date:c,hours:d,minutes:u,seconds:m,nanos:p}}static parseDateTimeString(e){const n=/\s*(\d{4})([-./]([\da-z]+))?([-./](\d{1,2}))?([tT\s](\d{2})([:](\d{2}))?([:](\d{2}))?([.](\d{1,9}))?)?(.*)/.exec(e);if(n==null)throw new Error(`Unexpected date string: ${e}`);const[,s,,o,,i,,r,,l,,a,,c,d]=n;if(d!=null&&d.length>0)throw new Error(`Unexpected characters after date string '${e}': ${d}`);return{year:s,month:o,date:i,hours:r,minutes:l,seconds:a,nanos:c}}static parseDateRange(e,t){const n=e.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=pt.makeDateWrapper(t,l.getFullYear(),l.getMonth(),l.getDate()),c=pt.makeDateWrapper(t,l.getFullYear(),l.getMonth(),l.getDate()+1);return[a,c]}if(n==="yesterday"){const l=new Date(Date.now()),a=pt.makeDateWrapper(t,l.getFullYear(),l.getMonth(),l.getDate()-1),c=pt.makeDateWrapper(t,l.getFullYear(),l.getMonth(),l.getDate());return[a,c]}if(n==="now"){const l=new Date(Date.now());return[I.DateWrapper.ofJsDate(l),null]}const s=pt.parseDateTimeString(n);if(s.year==null&&s.month==null&&s.date==null)throw new Error(`Unable to extract year, month, or day ${n}`);const o=pt.parseDateValues(s.year,s.month,s.date,s.hours,s.minutes,s.seconds,s.nanos);if(o==null)throw new Error(`Unable to extract date values from ${s}`);const i=pt.makeDateWrapper(t,o.year,o.month,o.date,o.hours,o.minutes,o.seconds,o.nanos),r=pt.getNextDate(s,o,t);return[i,r]}static getJsDate(e){return typeof e=="number"?new Date(e):e.asDate()}};let En=pt;En.FULL_DATE_FORMAT="yyyy-MM-dd HH:mm:ss.SSSSSSSSS";En.months=["january","february","march","april","may","june","july","august","september","october","november","december"];class Jt{}Jt.not="not";Jt.and="and";Jt.or="or";function tm(e){if(!(e==="not"||e==="and"||e==="or"))throw new Error("operator is not a valid FilterOperatorValue")}class U{}U.eq="eq";U.eqIgnoreCase="eqIgnoreCase";U.notEq="notEq";U.notEqIgnoreCase="notEqIgnoreCase";U.greaterThan="greaterThan";U.greaterThanOrEqualTo="greaterThanOrEqualTo";U.lessThan="lessThan";U.lessThanOrEqualTo="lessThanOrEqualTo";U.in="in";U.inIgnoreCase="inIgnoreCase";U.notIn="notIn";U.notInIgnoreCase="notInIgnoreCase";U.isTrue="isTrue";U.isFalse="isFalse";U.isNull="isNull";U.invoke="invoke";U.contains="contains";U.notContains="notContains";U.startsWith="startsWith";U.endsWith="endsWith";U.containsAny="containsAny";function nm(e){switch(e){case U.eq:return"is exactly";case U.eqIgnoreCase:return"is exactly (ignore case)";case U.notEq:return"is not exactly";case U.notEqIgnoreCase:return"is not exactly (ignore case)";case U.contains:return"contains";case U.notContains:return"does not contain";case U.startsWith:return"starts with";case U.endsWith:return"ends with";default:throw new Error(`Unrecognized text filter type ${e}`)}}function sm(e){switch(e){case U.eq:return"is equal to";case U.notEq:return"is not equal to";case U.greaterThan:return"greater than";case U.greaterThanOrEqualTo:return"greater than or equal to";case U.lessThan:return"less than";case U.lessThanOrEqualTo:return"less than or equal to";default:throw new Error(`Unrecognized number filter type ${e}`)}}function om(e){switch(e){case U.eq:return"date is";case U.notEq:return"date is not";case U.notEqIgnoreCase:case U.greaterThan:return"date is after";case U.greaterThanOrEqualTo:return"date is after or equal";case U.lessThan:return"date is before";case U.lessThanOrEqualTo:return"date is before or equal";default:throw new Error(`Unrecognized date filter type ${e}`)}}function im(e){switch(e){case U.isTrue:return"Is True";case U.isFalse:return"Is False";case U.isNull:return"Is Null";default:throw new Error(`Unrecognized boolean filter type ${e}`)}}const un=se.module("TableUtils"),j=class{static getSortIndex(e,t){var n;for(let s=0;s<e.length;s+=1)if(((n=e[s].column)==null?void 0:n.index)===t)return s;return null}static getSortForColumn(e,t){const n=j.getSortIndex(e,t);return n!=null?e[n]:null}static getFilterText(e){return e?e.toString():null}static getFilterTypes(e){return j.isBooleanType(e)?[U.isTrue,U.isFalse,U.isNull]:j.isCharType(e)||j.isNumberType(e)||j.isDateType(e)?[U.eq,U.notEq,U.greaterThan,U.greaterThanOrEqualTo,U.lessThan,U.lessThanOrEqualTo]:j.isTextType(e)?[U.eq,U.eqIgnoreCase,U.notEq,U.notEqIgnoreCase,U.contains,U.notContains,U.startsWith,U.endsWith]:[]}static getNextSort(e,t,n){if(e==null||n<0||n>=e.length)return null;const s=j.getSortForColumn(t,n);return s===null?e[n].sort().asc():s.direction===j.sortDirection.ascending?s.desc():null}static makeColumnSort(e,t,n,s){if(e==null||t<0||t>=e.length||n===j.sortDirection.none)return null;let o=e[t].sort();switch(n){case j.sortDirection.ascending:o=o.asc();break;case j.sortDirection.descending:o=o.desc();break}return s&&(o=o.abs()),o}static toggleSortForColumn(e,t,n,s=!1){if(n<0||n>=t.length)return[];const o=j.getNextSort(t,e,n);return j.setSortForColumn(e,n,o,s)}static sortColumn(e,t,n,s,o,i){if(e==null||n<0||n>=t.length)return[];const r=j.makeColumnSort(t,n,s,o);return j.setSortForColumn(e,n,r,i)}static setSortForColumn(e,t,n,s=!1){const o=j.getSortIndex(e,t);let i=[];return s&&(i=i.concat(e.filter(({direction:r})=>r!==j.sortDirection.reverse)),o!==null&&i.splice(o,1)),n!==null&&i.push(n),i}static getNormalizedType(e){switch(e){case"boolean":case"java.lang.Boolean":case j.dataType.BOOLEAN:return j.dataType.BOOLEAN;case"char":case"java.lang.Character":case j.dataType.CHAR:return j.dataType.CHAR;case"java.lang.String":case j.dataType.STRING:return j.dataType.STRING;case"io.deephaven.db.tables.utils.DBDateTime":case"io.deephaven.time.DateTime":case"com.illumon.iris.db.tables.utils.DBDateTime":case j.dataType.DATETIME:return j.dataType.DATETIME;case"double":case"java.lang.Double":case"float":case"java.lang.Float":case"java.math.BigDecimal":case j.dataType.DECIMAL:return j.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 j.dataType.INT:return j.dataType.INT;default:return j.dataType.UNKNOWN}}static isLongType(e){switch(e){case"long":case"java.lang.Long":return!0;default:return!1}}static isDateType(e){switch(e){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(e){return j.isIntegerType(e)||j.isDecimalType(e)}static isIntegerType(e){switch(e){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(e){switch(e){case"double":case"java.lang.Double":case"java.math.BigDecimal":case"float":case"java.lang.Float":return!0;default:return!1}}static isBigDecimalType(e){switch(e){case"java.math.BigDecimal":return!0;default:return!1}}static isBigIntegerType(e){switch(e){case"java.math.BigInteger":return!0;default:return!1}}static isBooleanType(e){switch(e){case"boolean":case"java.lang.Boolean":return!0;default:return!1}}static isCharType(e){switch(e){case"char":case"java.lang.Character":return!0;default:return!1}}static isStringType(e){switch(e){case"java.lang.String":return!0;default:return!1}}static isTextType(e){return this.isStringType(e)||this.isCharType(e)}static getBaseType(e){return e.split("[]")[0]}static isCompatibleType(e,t){return j.getNormalizedType(e)===j.getNormalizedType(t)}static makeQuickFilter(e,t,n){const s=t.split("||");let o=null;for(let i=0;i<s.length;i+=1){const l=s[i].split("&&");let a=null;for(let c=0;c<l.length;c+=1){const d=l[c].trim();if(d.length>0){const u=j.makeQuickFilterFromComponent(e,d,n);if(u)a?a=a.and(u):a=u;else throw new Error(`Unable to parse quick filter from text ${t}`)}}o&&a?o=o.or(a):o=a}return o}static makeQuickFilterFromComponent(e,t,n){const{type:s}=e;return j.isNumberType(s)?this.makeQuickNumberFilter(e,t):j.isBooleanType(s)?this.makeQuickBooleanFilter(e,t):n!=null&&j.isDateType(s)?this.makeQuickDateFilter(e,t,n):j.isCharType(s)?this.makeQuickCharFilter(e,t):this.makeQuickTextFilter(e,t)}static makeQuickNumberFilter(e,t){if(t==null)return null;const n=e.filter();let s=null;const i=/\s*(>=|<=|=>|=<|>|<|!=|=|!)?(\s*-\s*)?(\s*\d*(?:,\d{3})*(?:\.\d*)?\s*)?(null|nan|infinity|inf|\u221E)?(.*)/i.exec(t);let r=null,l=null,a=null,c=null,d=null;if(i!==null&&i.length>3&&([,r,l,a,c,d]=i),d!=null&&d.trim().length>0)return null;if(r==null&&(r="="),c!=null){if(!(r==="="||r==="!"||r==="!="))return null;switch(c=c.trim().toLowerCase(),c){case"null":s=n.isNull();break;case"nan":s=I.FilterCondition.invoke("isNaN",n);break;case"infinity":case"inf":case"\u221E":l!=null?s=I.FilterCondition.invoke("isInf",n).and(n.lessThan(I.FilterValue.ofNumber(0))):s=I.FilterCondition.invoke("isInf",n).and(n.greaterThan(I.FilterValue.ofNumber(0)));break}return s!==null&&(r==="!"||r==="!=")&&(s=s.not()),s}if(a==null)return null;if(a=j.removeCommas(a),j.isLongType(e.type))try{a=I.FilterValue.ofNumber(I.LongWrapper.ofString(`${l!=null?"-":""}${a}`))}catch(u){return un.warn("Unable to create long filter",u),null}else{if(a=parseFloat(a),a==null||Number.isNaN(a))return null;a=I.FilterValue.ofNumber(l!=null?0-a:a)}return s=e.filter(),j.makeRangeFilterWithOperation(s,r,a)}static makeQuickTextFilter(e,t){if(t==null)return null;const n=`${t}`.trim(),o=/^(!~|!=|~|=|!)?(.*)/.exec(n);let i=null,r=null;if(o!==null&&o.length>2&&([,i,r]=o,r!=null&&(r=r.trim())),r==null||r.length===0)return null;i==null&&(i="=");const l=e.filter();if(r.toLowerCase()==="null")switch(i){case"=":return l.isNull();case"!=":case"!":return l.isNull().not();default:return null}let a=null,c=null;switch(r.startsWith("*")?(a="*",r=r.substring(1)):r.endsWith("*")&&!r.endsWith("\\*")&&(c="*",r=r.substring(0,r.length-1)),r=r.replace("\\",""),i){case"~":return l.isNull().not().and(l.invoke("matches",I.FilterValue.ofString(`(?s)(?i).*\\Q${r}\\E.*`)));case"!~":return l.isNull().or(l.invoke("matches",I.FilterValue.ofString(`(?s)(?i).*\\Q${r}\\E.*`)).not());case"!=":return a==="*"?l.isNull().or(l.invoke("matches",I.FilterValue.ofString(`(?s)(?i).*\\Q${r}\\E$`)).not()):c==="*"?l.isNull().or(l.invoke("matches",I.FilterValue.ofString(`(?s)(?i)^\\Q${r}\\E.*`)).not()):l.notEqIgnoreCase(I.FilterValue.ofString(r.toLowerCase()));case"=":return a==="*"?l.isNull().not().and(l.invoke("matches",I.FilterValue.ofString(`(?s)(?i).*\\Q${r}\\E$`))):c==="*"?l.isNull().not().and(l.invoke("matches",I.FilterValue.ofString(`(?s)(?i)^\\Q${r}\\E.*`))):l.eqIgnoreCase(I.FilterValue.ofString(r.toLowerCase()))}return null}static makeQuickBooleanFilter(e,t){if(t==null)return null;const s=/^(!=|=|!)?(.*)/.exec(`${t}`.trim());if(s===null)return null;const[,o,i]=s,r=o==="!"||o==="!=",l=i.trim().toLowerCase();let a=e.filter();try{const c=j.makeBooleanValue(l);return c!=null&&c?a=a.isTrue():c===null?a=a.isNull():a=a.isFalse(),r?a.not():a}catch{return null}}static makeQuickDateFilter(e,t,n){const s=t.trim(),i=/\s*(>=|<=|=>|=<|>|<|!=|!|=)?(.*)/.exec(s);if(i==null||i.length<=2)throw new Error(`Unable to parse date filter: ${t}`);let r=null,l=null;[,r,l]=i;let a=U.eq;switch(r){case"<":a=U.lessThan;break;case"<=":case"=<":a=U.lessThanOrEqualTo;break;case">":a=U.greaterThan;break;case">=":case"=>":a=U.greaterThanOrEqualTo;break;case"!=":case"!":a=U.notEq;break;case"=":case"==":default:a=U.eq;break}return j.makeQuickDateFilterWithOperation(e,l,a,n)}static makeQuickDateFilterWithOperation(e,t,n,s){if(e==null)throw new Error("Column is null");const[o,i]=En.parseDateRange(t,s),r=o!=null?I.FilterValue.ofNumber(o):null,l=i!=null?I.FilterValue.ofNumber(i):null,a=e.filter();if(r==null)return n===U.notEq?a.isNull().not():a.isNull();switch(n){case U.eq:{if(l!=null){const c=a.greaterThanOrEqualTo(r),d=a.lessThan(l);return c.and(d)}return a.eq(r)}case U.lessThan:return a.lessThan(r);case U.lessThanOrEqualTo:return l!=null?a.lessThan(l):a.lessThanOrEqualTo(r);case U.greaterThan:return l!=null?a.greaterThanOrEqualTo(l):a.greaterThan(r);case U.greaterThanOrEqualTo:return a.greaterThanOrEqualTo(r);case U.notEq:{if(l!=null){const c=a.lessThan(r),d=a.greaterThanOrEqualTo(l);return c.or(d)}return a.notEq(r)}default:throw new Error(`Invalid operator: ${n}`)}}static quoteValue(e){return e.length>=2&&(e.charAt(0)==='"'&&e.charAt(e.length-1)==='"'||e.charAt(0)==="'"&&e.charAt(e.length-1)==="'")?e:`"${e}"`}static isRangeOperation(e){switch(e){case"<":case"<=":case"=<":case">":case">=":case"=>":return!0;default:return!1}}static makeQuickCharFilter(e,t){if(t==null)return null;const n=`${t}`.trim(),o=/^(>=|<=|=>|=<|>|<|!=|=|!)?(null|"."|'.'|.)?(.*)/.exec(n);let i=null,r=null,l=null;if(o!==null&&o.length>3&&([,i,r,l]=o),l!=null&&l.trim().length>0||r==null||r.length===0)return null;i==null&&(i="=");const a=e.filter();if(r.toLowerCase()==="null")switch(i){case"=":return a.isNull();case"!=":case"!":return a.isNull().not();default:return null}const c=I.FilterValue.ofString(j.isRangeOperation(i)?j.quoteValue(r):r);return j.makeRangeFilterWithOperation(a,i,c)}static makeRangeFilterWithOperation(e,t,n){switch(t){case"=":return e.eq(n);case"<":return e.lessThan(n);case"<=":case"=<":return e.lessThanOrEqualTo(n);case">":return e.greaterThan(n);case">=":case"=>":return e.greaterThanOrEqualTo(n);case"!=":case"!":return e.notEq(n);default:return null}}static makeCancelableTablePromise(e){return Ue.makeCancelable(e,t=>{t.close()})}static makeCancelableTableEventPromise(e,t,n=0,s=null){let o,i,r=!0;const l=new Promise((a,c)=>{i=setTimeout(()=>{o(),r=!1,c(new vr(`Event "${t}" timed out.`))},n),o=e.addEventListener(t,d=>{if(s!=null&&!s(d)){un.debug2("Event triggered, but matcher returned false.");return}un.debug2("Event triggered, resolving."),o(),clearTimeout(i),r=!1,a(d)})});return l.cancel=()=>{if(r){un.debug2("Pending promise cleanup."),o(),clearTimeout(i),r=!1;return}un.debug2("Ignoring non-pending promise cancel.")},l}static makeAdvancedFilter(e,t,n){const{filterItems:s,filterOperators:o,invertSelection:i,selectedValues:r}=t;let l=null;for(let c=0;c<s.length;c+=1){const d=s[c],{selectedType:u,value:m}=d;if(u!=null&&u.length>0&&m!=null&&m.length>0)try{const p=j.makeAdvancedValueFilter(e,u,m,n);if(p!=null){if(c===0)l=p;else if(l!==null&&c-1<o.length){const g=o[c-1];if(g===Jt.and)l=l.and(p);else if(g===Jt.or)l=l.or(p);else{un.error("Unexpected filter operator",g,p),l=null;break}}}else un.debug2("Empty filter ignored for",u,m)}catch(p){un.error("Unable to create filter",p),l=null;break}}const a=j.makeSelectValueFilter(e,r,i);return a!=null&&(l!=null?l=l.and(a):l=a),l}static removeCommas(e){return e.replace(/[\s|,]/g,"")}static makeFilterValue(e,t){const n=j.getBaseType(e);return j.isTextType(n)?I.FilterValue.ofString(t):j.isLongType(n)?I.FilterValue.ofNumber(I.LongWrapper.ofString(j.removeCommas(t))):I.FilterValue.ofNumber(j.removeCommas(t))}static makeFilterRawValue(e,t){return j.isTextType(e)?I.FilterValue.ofString(t):j.isBooleanType(e)?I.FilterValue.ofBoolean(t):I.FilterValue.ofNumber(t)}static makeValue(e,t,n){if(t==null||t==="null")return null;if(j.isTextType(e))return t;if(j.isLongType(e))return I.LongWrapper.ofString(j.removeCommas(t));if(j.isBooleanType(e))return j.makeBooleanValue(t,!0);if(j.isDateType(e)){const[s]=En.parseDateRange(t,n);return s}return j.isNumberType(e)?j.makeNumberValue(t):(un.error("Unexpected column type",e),null)}static makeBooleanValue(e,t=!1){if(e===""&&t)return null;switch(e==null?void 0:e.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 '${e}'`)}}static makeNumberValue(e){if(e==null||e==="null"||e==="")return null;const t=e.toLowerCase().trim();if(t==="\u221E"||t==="infinity"||t==="inf")return Number.POSITIVE_INFINITY;if(t==="-\u221E"||t==="-infinity"||t==="-inf")return Number.NEGATIVE_INFINITY;const n=j.removeCommas(t);if(j.NUMBER_REGEX.test(n))return parseFloat(n);throw new Error(`Invalid number '${e}'`)}static getFilterOperatorString(e){switch(e){case U.eq:return"=";case U.notEq:return"!=";case U.greaterThan:return">";case U.greaterThanOrEqualTo:return">=";case U.lessThan:return"<";case U.lessThanOrEqualTo:return"<=";case U.contains:return"~";case U.notContains:return"!~";default:throw new Error(`Unexpected filter type ${e}`)}}static makeAdvancedValueFilter(e,t,n,s){if(j.isDateType(e.type))return j.makeQuickDateFilterWithOperation(e,n,t,s);if(j.isNumberType(e.type)||j.isCharType(e.type))return j.makeQuickFilter(e,`${j.getFilterOperatorString(t)}${n}`);const o=j.makeFilterValue(e.type,n),i=e.filter();switch(t){case U.eq:return i.eq(o);case U.eqIgnoreCase:return i.eqIgnoreCase(o);case U.notEq:return i.notEq(o);case U.notEqIgnoreCase:return i.notEqIgnoreCase(o);case U.greaterThan:return i.greaterThan(o);case U.greaterThanOrEqualTo:return i.greaterThanOrEqualTo(o);case U.lessThan:return i.lessThan(o);case U.lessThanOrEqualTo:return i.lessThanOrEqualTo(o);case U.isTrue:return i.isTrue();case U.isFalse:return i.isFalse();case U.isNull:return i.isNull();case U.contains:return i.isNull().not().and(i.invoke("matches",I.FilterValue.ofString(`(?s)(?i).*\\Q${n}\\E.*`)));case U.notContains:return i.isNull().or(i.invoke("matches",I.FilterValue.ofString(`(?s)(?i).*\\Q${n}\\E.*`)).not());case U.startsWith:return i.isNull().not().and(i.invoke("matches",I.FilterValue.ofString(`(?s)(?i)^\\Q${n}\\E.*`)));case U.endsWith:return i.isNull().not().and(i.invoke("matches",I.FilterValue.ofString(`(?s)(?i).*\\Q${n}\\E$`)));case U.in:case U.inIgnoreCase:case U.notIn:case U.notInIgnoreCase:case U.invoke:default:throw new Error(`Unexpected filter operation: ${t}`)}}static makeSelectValueFilter(e,t,n){if(t.length===0){if(n)return null;let i=null;j.isTextType(e.type)?i=I.FilterValue.ofString("a"):j.isBooleanType(e.type)?i=I.FilterValue.ofBoolean(!0):j.isDateType(e.type)?i=I.FilterValue.ofNumber(I.DateWrapper.ofJsDate(new Date)):i=I.FilterValue.ofNumber(0);const r=e.filter().eq(i),l=e.filter().notEq(i);return r.and(l)}const s=[];let o=!1;for(let i=0;i<t.length;i+=1){const r=t[i];r==null?o=!0:j.isTextType(e.type)?s.push(I.FilterValue.ofString(typeof r=="number"?String.fromCharCode(r):r)):j.isBooleanType(e.type)?s.push(I.FilterValue.ofBoolean(Boolean(r))):s.push(I.FilterValue.ofNumber(r))}return o?s.length>0?n?e.filter().isNull().not().and(e.filter().notIn(s)):e.filter().isNull().or(e.filter().in(s)):n?e.filter().isNull().not():e.filter().isNull():n?e.filter().notIn(s):e.filter().in(s)}static isTreeTable(e){return e!=null&&e.expand!==void 0&&e.collapse!==void 0}static sortColumns(e,t=!0){return[...e].sort((n,s)=>{const o=n.name.toUpperCase(),i=s.name.toUpperCase();return Tr.sort(o,i,t)})}};let x=j;x.dataType={BOOLEAN:"boolean",CHAR:"char",DATETIME:"datetime",DECIMAL:"decimal",INT:"int",STRING:"string",UNKNOWN:"unknown"};x.sortDirection={ascending:"ASC",descending:"DESC",reverse:"REVERSE",none:null};x.REVERSE_TYPE=Object.freeze({NONE:"none",PRE_SORT:"pre-sort",POST_SORT:"post-sort"});x.NUMBER_REGEX=/^-?\d+(\.\d+)?$/;class nn{static makeColumnFormatMap(t){return t==null?new Map:t.reduce((n,s)=>{const o=x.getNormalizedType(s.columnType);if(o===null)return n;n.has(o)||n.set(o,new Map);const i=n.get(o);return i==null||i.set(s.columnName,s.format),n},new Map)}static makeColumnFormattingRule(t,n,s){return{columnType:t,columnName:n,format:s}}constructor(t=[],n,s,o,i=!1){this.defaultColumnFormatter=new Zh,this.typeFormatterMap=new Map([[x.dataType.BOOLEAN,new Yh],[x.dataType.CHAR,new Qh],[x.dataType.DATETIME,new jn(n)],[x.dataType.DECIMAL,new Be(s)],[x.dataType.INT,new kt(o)],[x.dataType.STRING,new em]]),this.columnFormatMap=nn.makeColumnFormatMap(t),this.truncateNumbersWithPound=i}getColumnFormatMapForType(t,n=!1){const s=x.getNormalizedType(t);if(s!==null)return n&&!this.columnFormatMap.has(s)&&this.columnFormatMap.set(s,new Map),this.columnFormatMap.get(s)}getColumnFormat(t,n){var o;const s=this.getColumnFormatMapForType(t);return(o=s==null?void 0:s.get(n))!=null?o:null}getColumnTypeFormatter(t){var o;const n=x.getNormalizedType(t);let s=this.defaultColumnFormatter;return n&&(s=(o=this.typeFormatterMap.get(n))!=null?o:s),s}getFormattedString(t,n,s="",o){if(t==null)return"";const i=this.getColumnTypeFormatter(n),r=o||this.getColumnFormat(n,s);return i.format(t,r!=null?r:void 0)}get timeZone(){var n;const t=this.typeFormatterMap.get(x.dataType.DATETIME);return(n=t==null?void 0:t.dhTimeZone)==null?void 0:n.id}}function rm(e){if(e&&e.formatter){const{formatter:t}=e;return t}}function lm(e){return{timeZone:e==null?void 0:e.timeZone,defaultDateTimeFormatString:e==null?void 0:e.defaultDateTimeFormat,showTimeZone:e==null?void 0:e.showTimeZone,showTSeparator:e==null?void 0:e.showTSeparator}}function am(e,t,n){const s=e.getColumnFormat(n,t);return s!=null&&(s.type===_e.TYPE_CONTEXT_PRESET||s.type===_e.TYPE_CONTEXT_CUSTOM)}const ms={getColumnFormats:rm,getDateTimeFormatterOptions:lm,isCustomColumnFormatDefined:am};function cm(e,t){const n=hm(e);return n===void 0?void 0:`${wm(e)} ? ${n} : ${t}`}function dm(e){return dh.Column.formatRowColor(e)}function um(e,t){return e.formatColor(t)}const Bi=se.module("ConditionalFormattingUtils");var rn=(e=>(e.CONDITIONAL="conditional",e.ROWS="rows",e))(rn||{}),Oe=(e=>(e.IS_EQUAL="is-equal",e.IS_NOT_EQUAL="is-not-equal",e.IS_BETWEEN="is-between",e.GREATER_THAN="greater-than",e.GREATER_THAN_OR_EQUAL="greater-than-or-equal",e.LESS_THAN="less-than",e.LESS_THAN_OR_EQUAL="less-than-or-equal",e.IS_NULL="is-null",e.IS_NOT_NULL="is-not-null",e))(Oe||{}),vt=(e=>(e.IS_EXACTLY="is-exactly",e.IS_NOT_EXACTLY="is-not-exactly",e.CONTAINS="contains",e.DOES_NOT_CONTAIN="does-not-contain",e.STARTS_WITH="starts-with",e.ENDS_WITH="ends-with",e.IS_NULL="is-null",e.IS_NOT_NULL="is-not-null",e))(vt||{}),at=(e=>(e.IS_EXACTLY="is-exactly",e.IS_NOT_EXACTLY="is-not-exactly",e.IS_BEFORE="is-before",e.IS_BEFORE_OR_EQUAL="is-before-or-equal",e.IS_AFTER="is-after",e.IS_AFTER_OR_EQUAL="is-after-or-equal",e.IS_NULL="is-null",e.IS_NOT_NULL="is-not-null",e))(at||{}),lo=(e=>(e.IS_TRUE="is-true",e.IS_FALSE="is-false",e.IS_NULL="is-null",e.IS_NOT_NULL="is-not-null",e))(lo||{}),hs=(e=>(e.IS_EQUAL="is-equal",e.IS_NOT_EQUAL="is-not-equal",e.IS_NULL="is-null",e.IS_NOT_NULL="is-not-null",e))(hs||{}),Kt=(e=>(e.NO_FORMATTING="no-formatting",e.POSITIVE="positive",e.NEGATIVE="negative",e.WARN="warn",e.NEUTRAL="neutral",e.ACCENT_1="accent-1",e.ACCENT_2="accent-2",e.CUSTOM="custom",e))(Kt||{});function Il(e){switch(e){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 ri(e){const{type:t,customConfig:n}=e;switch(t){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 li(e){const{type:t,customConfig:n}=e;switch(t){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 hm(e){const t=li(e.style),n=ri(e.style);if(!(t===void 0||n===void 0))return`bgfg(\`${n}\`, \`${t}\`)`}function mm(e){const{column:t,value:n,start:s,end:o}=e;return Fm(t.name,e.condition,n,s,o)}function pm(e){const{column:t,value:n}=e;return xm(t.name,e.condition,n)}function gm(e){const{column:t,value:n}=e;return Am(t.name,e.condition,n)}function fm(e){const{column:t}=e;return Om(t.name,e.condition)}function Cm(e){const{column:t,value:n}=e;return km(t.name,e.condition,n)}function wm(e){const{column:t}=e;if(x.isNumberType(t.type))return mm(e);if(x.isCharType(t.type))return Cm(e);if(x.isStringType(t.type))return pm(e);if(x.isDateType(t.type))return gm(e);if(x.isBooleanType(t.type))return fm(e);throw new Error("Invalid column type")}function Sm(e){switch(e){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 bm(e){switch(e){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 vm(e){switch(e){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 Tm(e){switch(e){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 Em(e){switch(e){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 Va(e){if(x.isNumberType(e)||x.isCharType(e))return"is-equal";if(x.isStringType(e)||x.isDateType(e))return"is-exactly";if(x.isBooleanType(e))return"is-true";throw new Error("Invalid column type")}function Rm(e){if(x.isCharType(e)||x.isStringType(e))return""}function Ua(e){const{condition:t,value:n,start:s,end:o}=e;return{condition:t,value:n,start:s,end:o}}function Ri(e){return{condition:Va(e),value:Rm(e),start:void 0,end:void 0}}function Ba(){return{type:"no-formatting"}}function ym(e){switch(e){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 Im(e){switch(e){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 Mm(e){switch(e){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 Dm(e){switch(e){case"is-equal":return"==";case"is-not-equal":return"!=";case"is-null":return"is null";case"is-not-null":return"is not null"}}function Nm(e){switch(e){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 Fm(e,t,n,s,o){switch(t){case"is-equal":return`${e} == ${n}`;case"is-not-equal":return`${e} != ${n}`;case"is-between":return`${e} > ${s} && ${e} < ${o}`;case"greater-than":return`${e} > ${n}`;case"greater-than-or-equal":return`${e} >= ${n}`;case"less-than":return`${e} < ${n}`;case"less-than-or-equal":return`${e} <= ${n}`;case"is-null":return`${e} == null`;case"is-not-null":return`${e} != null`}}function xm(e,t,n){switch(t){case"is-exactly":return`${e} == "${n}"`;case"is-not-exactly":return`${e} != "${n}"`;case"contains":return`${e} != null && ${e}.contains("${n}")`;case"does-not-contain":return`${e} != null && !${e}.contains("${n}")`;case"starts-with":return`${e} != null && ${e}.startsWith("${n}")`;case"ends-with":return`${e} != null && ${e}.endsWith("${n}")`;case"is-null":return`${e} == null`;case"is-not-null":return`${e} != null`}}function Am(e,t,n){switch(t){case"is-exactly":return`${e} == convertDateTime("${n}")`;case"is-not-exactly":return`${e} != convertDateTime(\`${n}\`)`;case"is-before":return`${e} < convertDateTime(\`${n}\`)`;case"is-before-or-equal":return`${e} <= convertDateTime("${n}")`;case"is-after":return`${e} > convertDateTime(\`${n}\`)`;case"is-after-or-equal":return`${e} >= convertDateTime(\`${n}\`)`;case"is-null":return`${e} == null`;case"is-not-null":return`${e} != null`}}function Om(e,t){switch(t){case"is-true":return`${e} == true`;case"is-false":return`${e} == false`;case"is-null":return`${e} == null`;case"is-not-null":return`${e} != null`}}function km(e,t,n){switch(t){case"is-equal":return`${e} == '${n}'`;case"is-not-equal":return`${e} != '${n}'`;case"is-null":return`isNull(${e})`;case"is-not-null":return`!isNull(${e})`}}function Lm(e,t){if(x.isNumberType(e))return Nm(t);if(x.isCharType(e))return Dm(t);if(x.isStringType(e))return ym(t);if(x.isDateType(e))return Im(t);if(x.isBooleanType(e))return Mm(t);throw new Error("Invalid column type")}function Pm(e,t){if(t===void 0)return Bi.debug("no rules passed."),[];const n=[];let s;const o=new Map;return t.forEach(({config:i,type:r})=>{var g;const{column:l}=i,a=e.find(({name:f,type:w})=>f===l.name&&w===l.type);if(a===void 0){Bi.debug(`Column ${l.name}:${l.type} not found. Ignoring format rule.`,i);return}const[c,d]=(g=r==="conditional"?o.get(a.name):s)!=null?g:["null",void 0],u=cm(i,c);if(u===void 0){Bi.debug("Ignoring format rule.",i);return}const m=d===void 0?-1:n.indexOf(d);m>-1&&n.splice(m,1);const p=r==="conditional"?um(a,u):dm(u);n.push(p),r==="conditional"?o.set(a.name,[u,p]):s=[u,p]}),n}function Hm({type:e}){return x.isNumberType(e)||x.isCharType(e)||x.isStringType(e)||x.isDateType(e)||x.isBooleanType(e)}function yi({animation:e="iris-grid-bottom-bar-slide-up",children:t,className:n,isShown:s,onClick:o,onEntering:i,onEntered:r,onExiting:l,onExited:a}){return h(dt,{in:s,timeout:Le.transitionMs,classNames:e,onEntering:i,onEntered:r,onExiting:l,onExited:a,mountOnEnter:!0,unmountOnExit:!0,children:h("div",{className:B("iris-grid-bottom-bar",n),role:"presentation",onClick:o,onKeyPress:o,children:t})})}const _m=3e3,Vm=5;function Um({isSaving:e=!1,onSave:t,onDiscard:n,discardTooltip:s,saveTooltip:o,error:i,pendingDataErrors:r,pendingDataMap:l,onEntering:a,onEntered:c,onExiting:d,onExited:u}){const[m,p]=T.exports.useState(!1),[g,f]=T.exports.useState(!1),w=T.exports.useRef(),C=Er(e),S=T.exports.useMemo(()=>r.size===0?i:r.size<=Vm?`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)`,[i,r]);T.exports.useEffect(function(){C!=null&&C&&!e&&S==null&&(p(!0),f(!0),w.current=setTimeout(()=>{p(!1)},_m))},[S,e,C]),T.exports.useEffect(function(){w.current&&l.size>0&&(clearTimeout(w.current),p(!1),f(!1))},[l]),T.exports.useEffect(function(){return()=>w.current?clearTimeout(w.current):void 0},[]);const b=l.size;let E;return e?E=h(Vt,{}):g&&(E=aa),R(yi,{className:"pending-data-bottom-bar",isShown:b>0||m||S!=null,onEntering:a,onEntered:c,onExiting:d,onExited:()=>{f(!1),u&&u()},children:[S!=null&&S!==""&&R("div",{className:"error-message",children:[h(Z,{icon:Yn}),h("span",{children:`${S}`})]}),(S==null||S==="")&&h("div",{className:"status-message",children:b>0&&h("span",{children:`${b} row${b>1?"s":""} pending`})}),R("div",{className:"buttons-container",children:[!e&&!g&&h(X,{kind:"secondary",onClick:n,tooltip:s,children:"Discard"}),R(X,{kind:g?"success":"primary",onClick:t,icon:E,disabled:e||g||S!=null,tooltip:o,children:[e&&"Committing...",!e&&g&&"Success",!e&&!g&&"Commit"]})]})]})}var Ee=(e=>(e.COUNT="Count",e.MIN="Min",e.MAX="Max",e.SUM="Sum",e.ABS_SUM="AbsSum",e.VAR="Var",e.AVG="Avg",e.STD="Std",e.FIRST="First",e.LAST="Last",e.SKIP="Skip",e.COUNT_DISTINCT="CountDistinct",e.DISTINCT="Distinct",e.UNIQUE="Unique",e))(Ee||{});const Bm=e=>{switch(e){default:return!1}},Gm=(e,t)=>{switch(e){case Ee.COUNT:case Ee.FIRST:case Ee.LAST:case Ee.COUNT_DISTINCT:case Ee.DISTINCT:case Ee.UNIQUE:return!0;case Ee.MIN:case Ee.MAX:return x.isNumberType(t)||x.isDateType(t)||x.isTextType(t);case Ee.SUM:case Ee.ABS_SUM:case Ee.VAR:case Ee.AVG:case Ee.STD:return x.isNumberType(t);case Ee.SKIP:return!1}},kr=(e,t)=>e.filter(n=>Gm(t,n.type)),zm=(e,t,n,s)=>kr(e,t).map(({name:o})=>o).filter(o=>n.includes(o)?!s:s),qn={isRollupOperation:Bm,filterValidColumns:kr,getOperationColumnNames:zm};var fs=(e=>(e.FILTER_CONTROL_CHANGE_CLEARS_ALL_FILTERS="filter-control-change-clears-all-filters",e.LINK_CHANGE_CLEARS_ALL_FILTERS="link-change-clears-all-filters",e))(fs||{});const Wm=Object.freeze([[fs.FILTER_CONTROL_CHANGE_CLEARS_ALL_FILTERS,!1],[fs.LINK_CHANGE_CLEARS_ALL_FILTERS,!1]]),$m={DEFAULTS:Wm},qm=se.module("ColumnHeaderGroup");function Gi(e){return e instanceof jt}const Ga=class{constructor({name:e,children:t,color:n,depth:s,childIndexes:o,parent:i}){this.getVisibleRange=Ie(r=>{const l=this.childIndexes.flat(),a=W.getVisibleIndexes(l,r),c=Math.min(...a),d=Math.max(...a);return d-c!==l.length-1&&qm.warn(`Column header group ${this.name} is not contiguous`),[c,d]}),this.name=e,this.children=t,this.color=n,this.depth=s,this.childIndexes=o,this.parent=i}setParent(e){this.parent=e}addChildren(e){const t=new Set(this.children.concat(e));this.children=[...t]}removeChildren(e){const t=new Set(this.children);e.forEach(n=>t.delete(n)),this.children=[...t]}get isNew(){return this.name.startsWith(Ga.NEW_GROUP_PREFIX)}};let jt=Ga;jt.NEW_GROUP_PREFIX=":newGroup";const eo=se.module("IrisGridUtils");function kn(e,t){return e>=0&&e<t.length}class ne{static dehydrateGridState(t,n){const{isStuckToBottom:s,isStuckToRight:o,movedColumns:i,movedRows:r}=n,{columns:l}=t;return{isStuckToBottom:s,isStuckToRight:o,movedColumns:[...i].filter(({to:a,from:c})=>kn(a,l)&&(typeof c=="number"&&kn(c,l)||Array.isArray(c)&&kn(c[0],l)&&kn(c[1],l))).map(({to:a,from:c})=>({to:l[a].name,from:Array.isArray(c)?[l[c[0]].name,l[c[1]].name]:l[c].name})),movedRows:[...r]}}static hydrateGridState(t,n,s=[]){const{isStuckToBottom:o,isStuckToRight:i,movedColumns:r,movedRows:l}=n,{columns:a}=t,c=ne.parseCustomColumnNames(s),d=a.map(({name:u})=>u).concat(c);return{isStuckToBottom:o,isStuckToRight:i,movedColumns:[...r].map(({to:u,from:m})=>{const p=g=>typeof g=="string"?d.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})=>kn(u,d)&&(typeof m=="number"&&kn(m,d)||Array.isArray(m)&&kn(m[0],d)&&kn(m[1],d))),movedRows:[...l]}}static dehydrateIrisGridState(t,n){const{aggregationSettings:s={aggregations:ye,showOnTop:!1},advancedFilters:o,customColumnFormatMap:i,isFilterBarShown:r,metrics:l,quickFilters:a,customColumns:c,conditionalFormats:d=ye,reverseType:u,rollupConfig:m=void 0,showSearchBar:p,searchValue:g,selectDistinctColumns:f=ye,selectedSearchColumns:w,sorts:C,invertSearchColumns:S,pendingDataMap:b=Sn,frozenColumns:E,columnHeaderGroups:v}=n;O(l);const{userColumnWidths:y,userRowHeights:M}=l,{columns:A}=t;return{advancedFilters:ne.dehydrateAdvancedFilters(A,o),aggregationSettings:s,customColumnFormatMap:[...i],isFilterBarShown:r,quickFilters:ne.dehydrateQuickFilters(a),sorts:ne.dehydrateSort(C),userColumnWidths:[...y].filter(([F])=>F!=null&&F>=0&&F<A.length).map(([F,V])=>[A[F].name,V]),userRowHeights:[...M],customColumns:[...c],conditionalFormats:[...d],reverseType:u,rollupConfig:m,showSearchBar:p,searchValue:g,selectDistinctColumns:[...f],selectedSearchColumns:w,invertSearchColumns:S,pendingDataMap:ne.dehydratePendingDataMap(A,b),frozenColumns:E,columnHeaderGroups:v==null?void 0:v.map(F=>({name:F.name,children:F.children,color:F.color}))}}static hydrateIrisGridState(t,n){var F,V;const{advancedFilters:s,aggregationSettings:o={aggregations:[],showOnTop:!1},customColumnFormatMap:i,isFilterBarShown:r,quickFilters:l,sorts:a,customColumns:c,conditionalFormats:d,userColumnWidths:u,userRowHeights:m,reverseType:p,rollupConfig:g=void 0,showSearchBar:f,searchValue:w,selectDistinctColumns:C,selectedSearchColumns:S,invertSearchColumns:b=!0,pendingDataMap:E=[],frozenColumns:v,columnHeaderGroups:y}=n,{columns:M,formatter:A}=t;return{advancedFilters:ne.hydrateAdvancedFilters(M,s,A.timeZone),aggregationSettings:o,customColumnFormatMap:new Map(i),isFilterBarShown:r,quickFilters:ne.hydrateQuickFilters(M,l,A.timeZone),sorts:ne.hydrateSort(M,a),userColumnWidths:new Map(u.map(([H,N])=>typeof H=="string"||H instanceof String?[M.findIndex(({name:P})=>P===H),N]:[H,N]).filter(([H])=>H!=null&&H>=0&&H<M.length)),customColumns:c,conditionalFormats:d,userRowHeights:new Map(m),reverseType:p,rollupConfig:g,showSearchBar:f,searchValue:w,selectDistinctColumns:C,selectedSearchColumns:S,invertSearchColumns:b,pendingDataMap:ne.hydratePendingDataMap(M,E),frozenColumns:v,columnHeaderGroups:ne.parseColumnHeaderGroups(t,(V=y!=null?y:(F=t.layoutHints)==null?void 0:F.columnGroups)!=null?V:[]).groups}}static dehydrateIrisGridPanelState(t,n){const{isSelectingPartition:s,partition:o,partitionColumn:i,advancedSettings:r}=n;return{isSelectingPartition:s,partition:o,partitionColumn:i!=null?i.name:void 0,advancedSettings:[...r]}}static hydrateIrisGridPanelState(t,n){const{isSelectingPartition:s,partition:o,partitionColumn:i,advancedSettings:r}=n,{columns:l}=t;return{isSelectingPartition:s,partition:o,partitionColumn:i!=null?ne.getColumnByName(l,i):void 0,advancedSettings:new Map([...$m.DEFAULTS,...r])}}static dehydrateQuickFilters(t){return[...t].map(([n,s])=>{const{text:o}=s;return[n,{text:o}]})}static hydrateQuickFilters(t,n,s){const o=n.map(([i,r])=>{const{text:l}=r;let a=null;try{const c=ne.getColumn(t,i);c!=null&&(a=x.makeQuickFilter(c,l,s))}catch(c){eo.error("hydrateQuickFilters error with",l,c)}return[i,{text:l,filter:a}]});return new Map(o)}static dehydrateAdvancedFilters(t,n){return[...n].map(([s,o])=>{const i=ne.getColumn(t,s);O(i);const r=ne.dehydrateAdvancedFilterOptions(i,o.options);return[s,{options:r}]})}static hydrateAdvancedFilters(t,n,s){const o=n.map(([i,r])=>{const l=ne.getColumn(t,i);O(l);const a=ne.hydrateAdvancedFilterOptions(l,r.options);let c=null;try{ne.getColumn(t,i)!=null&&(c=x.makeAdvancedFilter(l,a,s))}catch(d){eo.error("hydrateAdvancedFilters error with",a,d)}return[i,{options:a,filter:c}]});return new Map(o)}static dehydrateAdvancedFilterOptions(t,n){const{selectedValues:s,...o}=n;return{selectedValues:s==null?void 0:s.map(i=>ne.dehydrateValue(i,t==null?void 0:t.type)),...o}}static hydrateAdvancedFilterOptions(t,n){const{selectedValues:s,...o}=n;return{selectedValues:s==null?void 0:s.map(i=>ne.hydrateValue(i,t==null?void 0:t.type)),...o}}static dehydratePendingDataMap(t,n){return[...n].map(([s,{data:o}])=>[s,{data:[...o].map(([i,r])=>[t[i].name,ne.dehydrateValue(r,t[i].type)])}])}static hydratePendingDataMap(t,n){const s=new Map,o=i=>(s.has(i)||s.set(i,t.findIndex(({name:r})=>r===i)),s.get(i));return new Map(n.map(([i,{data:r}])=>[i,{data:new Map(r.map(([l,a])=>{var d;const c=o(l);return O(c),[(d=o(l))!=null?d:null,ne.hydrateValue(a,t[c].type)]}))}]))}static dehydrateValue(t,n){return x.isDateType(n)?ne.dehydrateDateTime(t):x.isLongType(n)?ne.dehydrateLong(t):t}static hydrateValue(t,n){return x.isDateType(n)?ne.hydrateDateTime(t):x.isLongType(n)?ne.hydrateLong(t):t}static dehydrateDateTime(t){return t!=null?I.i18n.DateTimeFormat.format(En.FULL_DATE_FORMAT,t):null}static hydrateDateTime(t){return t!=null?I.i18n.DateTimeFormat.parse(En.FULL_DATE_FORMAT,t):null}static dehydrateLong(t){return t!=null?`${t}`:null}static hydrateLong(t){return t!=null?I.LongWrapper.ofString(t):null}static dehydrateSort(t){return t.map(n=>{const{column:s,isAbs:o,direction:i}=n;return{column:s.index,isAbs:o,direction:i}})}static hydrateSort(t,n){return n.map(s=>{const{column:o,isAbs:i,direction:r}=s;if(r===x.sortDirection.reverse)return I.Table.reverse();const l=ne.getColumn(t,o);if(l!=null){let a=l.sort();return i&&(a=a.abs()),r===x.sortDirection.descending?a=a.desc():a=a.asc(),a}return null}).filter(s=>s!=null&&s.direction!==x.sortDirection.reverse)}static extractTableSettings(t,n=[]){const{irisGridPanelState:s,irisGridState:o}=t,{partitionColumn:i,partition:r}=s,{advancedFilters:l,quickFilters:a,sorts:c}=o;return{advancedFilters:l,inputFilters:n,partition:r,partitionColumn:i,quickFilters:a,sorts:c}}static applyTableSettings(t,n,s){const{columns:o}=t;let i=[];n.quickFilters&&(i=ne.getFiltersFromFilterMap(ne.hydrateQuickFilters(o,n.quickFilters,s)));let r=[];n.advancedFilters&&(r=ne.getFiltersFromFilterMap(ne.hydrateAdvancedFilters(o,n.advancedFilters,s)));const l=ne.getFiltersFromInputFilters(o,n.inputFilters,s);let a=[];n.sorts&&(a=ne.hydrateSort(o,n.sorts));let c=[...i,...r];const{partition:d,partitionColumn:u}=n;if(d!=null&&u!=null){const m=ne.getColumnByName(o,u);m&&(c=[m.filter().eq(I.FilterValue.ofString(d)),...c])}c=[...l,...c],t.applyFilter(c),t.applySort(a)}static getInputFiltersForColumns(t,n=[]){return n.filter(({name:s,type:o})=>t.find(({name:i,type:r})=>i===s&&r===o))}static getFiltersFromInputFilters(t,n=[],s){return n.map(({name:o,type:i,value:r})=>{const l=t.find(({name:a,type:c})=>a===o&&c===i);if(l)try{return x.makeQuickFilter(l,r,s)}catch(a){eo.debug("Unable to create input filter",a)}return null}).filter(o=>o!=null)}static getFiltersFromFilterMap(t){const n=[],s=Array.from(t.keys());for(let o=0;o<s.length;o+=1){const i=s[o],r=t.get(i);(r==null?void 0:r.filter)!=null&&n.push(r.filter)}return n}static getHiddenColumns(t){return[...t.entries()].filter(([,n])=>n===0).map(([n])=>n)}static parseCustomColumnNames(t){return t.map(n=>n.split("=")[0])}static getRemovedCustomColumnNames(t,n){const s=ne.parseCustomColumnNames(t),o=ne.parseCustomColumnNames(n);return s.filter(i=>!o.includes(i))}static removeSortsInColumns(t,n){return t.filter(s=>!n.includes(s.column.name))}static removeFiltersInColumns(t,n,s){const o=t.map(({name:r})=>r),i=new Map(n);return s.forEach(r=>i.delete(o.indexOf(r))),i}static removeColumnFromMovedColumns(t,n,s){const o=t.map(({name:r})=>r);let i=[...n];for(let r=0;r<s.length;r+=1){const l=s[r];let a=o.findIndex(d=>d===l);const c=[];for(let d=0;d<i.length;d+=1){const u=i[d],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?c.push({...m,from:p}):c.push({...m,from:[p,g]})),a=W.applyItemMoves(a,a,[u])[0][0]}i=c,o.splice(o.findIndex(d=>d===l),1)}return i}static removeColumnsFromSelectDistinctColumns(t,n){return t.filter(s=>!n.includes(s))}static getVisibleColumnsInRange(t,n,s,o,i){const r=[];for(let l=n;l<=s;l+=1){const a=W.getModelIndex(l,o);a>=0&&a<t.length&&!i.includes(a)&&r.push(t[a])}return r}static getPrevVisibleColumns(t,n,s,o,i){const r=[];let l=n;for(;l>=0&&r.length<s;){const a=W.getModelIndex(l,o);a>=0&&a<t.length&&!i.includes(a)&&r.unshift(t[a]),l-=1}return r}static getNextVisibleColumns(t,n,s,o,i){const r=[];let l=n;for(;l<t.length&&r.length<s;){const a=W.getModelIndex(l,o);a>=0&&a<t.length&&!i.includes(a)&&r.push(t[a]),l+=1}return r}static getColumnsToFetch(t,n,s){const o=[...n];return s.forEach(i=>{const r=t.find(({name:l})=>l===i);r!=null&&!n.includes(r)&&o.push(r)}),o}static getModelViewportColumns(t,n,s,o,i=[],r=[],l=0){if(n==null||s==null)return null;const a=ne.getVisibleColumnsInRange(t,n,s,o,i),c=a.length*l,d=ne.getPrevVisibleColumns(t,n-1,c,o,i),u=ne.getNextVisibleColumns(t,s+1,c,o,i),m=[...d,...a,...u];return ne.getColumnsToFetch(t,m,r)}static rangeSetFromRanges(t){const n=t.slice().sort((s,o)=>(O(s.startRow),O(o.startRow),s.startRow-o.startRow)).map(s=>{const{startRow:o,endRow:i}=s;return O(o),O(i),I.RangeSet.ofRange(o,i)});return I.RangeSet.ofRanges(n)}static isValidSnapshotRanges(t){if(t==null||t.length===0)return!1;const n=new Map;for(let i=0;i<t.length;i+=1){const r=t[i],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()],o=n.get(s[0]).sort().join(",");for(let i=1;i<s.length;i+=1)if(n.get(s[i]).sort().join(",")!==o)return!1;return!0}static isValidIndex(t){return!Number.isInteger(t)||typeof t!="number"?!1:t>=0}static columnsFromRanges(t,n){var o,i;if(t==null||t.length===0)return[];if(t[0].startColumn===null&&t[0].endColumn===null)return[...n];const s=new Set;for(let r=0;r<t.length;r+=1){const l=t[r];O(l.startColumn),O(l.endColumn);for(let a=(o=l.startColumn)!=null?o:0;a<=((i=l.endColumn)!=null?i:n.length-1);a+=1)s.add(a)}return[...s].map(r=>n[r])}static snapshotDataToMatrix(t){const{columns:n,rows:s}=t,o=[];for(let i=0;i<s.length;i+=1){const r=s[i],l=[];for(let a=0;a<n.length;a+=1){const c=n[a],d=r.get(c);l.push(d)}o.push(l)}return o}static getModelRollupConfig(t,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:o=[],showConstituents:i=!0,showNonAggregatedColumns:r=!0,includeDescriptions:l=!0}=n!=null?n:{},{aggregations:a=[]}=s!=null?s:{},c=a.map(({operation:g,selected:f,invert:w})=>qn.isRollupOperation(g)?[]:qn.getOperationColumnNames(t,g,f,w)),d={};for(let g=0;g<a.length;g+=1)d[a[g].operation]=c[g];if(r){const g=new Set(t.map(f=>f.name).filter(f=>!o.includes(f)));if(c.forEach(f=>{f.forEach(w=>g.delete(w))}),g.size>0){const f=(p=d[Ee.FIRST])!=null?p:[];d[Ee.FIRST]=[...f,...g]}}return{groupingColumns:o,includeConstituents:i,includeDescriptions:l,aggregations:d}}static getPendingErrors(t){t.forEach((n,s)=>{if(!ne.isValidIndex(s))throw new Error(`Invalid rowIndex ${s}`);const{data:o}=n;o.forEach((i,r)=>{if(!ne.isValidIndex(r))throw new Error(`Invalid columnIndex ${r}`)})})}static getColumn(t,n){return n<t.length?t[n]:(eo.error("Unable to retrieve column",n,">=",t.length),null)}static getColumnByName(t,n){const s=t.find(({name:o})=>o===n);return s==null&&eo.error("Unable to retrieve column by name",n,t.map(({name:o})=>o)),s}static changeFilterColumnNamesToIndexes(t,n){return n.map(({name:s,filter:o})=>{const i=t.findIndex(r=>r.name===s);return i<0?null:[i,o]}).filter(s=>s!=null)}static combineFiltersFromList(t,n){n.sort((o,i)=>o.operator==="eq"&&i.operator!=="eq"?1:o.operator!=="eq"&&i.operator==="eq"?-1:o.startColumnIndex-i.startColumnIndex);let s="";for(let o=0;o<n.length;o+=1){const{text:i,value:r,operator:l}=n[o];if(r!==void 0){let a="";l!==void 0&&(r==null&&l==="eq"?a="=":l!=="eq"&&(l==="startsWith"||l==="endsWith"?a="*":a=x.getFilterOperatorString(l)));let c=`${a}${i}`;l==="startsWith"&&(c=`${i}${a}`),t!=null&&r!==null&&x.isCharType(t)&&(c=`${a}${String.fromCharCode(parseInt(i,10))}`),o!==0&&(s+=l==="eq"?" || ":" && "),s+=c}}return s}static parseColumnHeaderGroups(t,n){let s=1;const o=new Map,i=new Map,r=n==null?void 0:n.filter(({children:u})=>u.length>0);if(r.length===0)return{groups:[],maxDepth:s,parentMap:o,groupMap:i};const l=new Map(r.map(u=>[u.name,u])),a=new Set,c=u=>{const{name:m}=u;if(t.getColumnIndexByName(m)!=null)throw new Error(`Column header group has same name as column: ${m}`);const p=i.get(m);if(p)return p;const g=[];let f=1;u.children.forEach(C=>{if(a.has(C))throw new Error(`Column group child ${C} specified in multiple groups`);a.add(C);const S=l.get(C),b=t.getColumnIndexByName(C);if(S){const E=c(S);g.push(...E.childIndexes),f=Math.max(f,E.depth+1)}else if(b!=null)g.push(b),f=Math.max(f,1);else throw new Error(`Unknown child ${C} in group ${m}`)});const w=new jt({...u,depth:f,childIndexes:g.flat()});return i.set(m,w),u.children.forEach(C=>o.set(C,w)),s=Math.max(s,w.depth+1),w},d=new Set;return r.forEach(u=>{const{name:m}=u;if(d.has(m))throw new Error(`Duplicate column group name: ${m}`);d.add(m),c(u)}),i.forEach(u=>{var m;u.setParent((m=o.get(u.name))==null?void 0:m.name)}),{groups:[...i.values()],maxDepth:s,groupMap:i,parentMap:o}}}const wt=se.module("IrisGridCopyHandler"),Re=class extends T.exports.Component{constructor(e){super(e),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:Re.COPY_STATES.IDLE,buttonState:Re.BUTTON_STATES.COPY,isShown:!1,rowCount:0}}static getStatusMessageText(e,t){switch(e){case Re.COPY_STATES.CONFIRMATION_REQUIRED:return`Are you sure you want to copy ${t.toLocaleString()} rows to your clipboard?`;case Re.COPY_STATES.CLICK_REQUIRED:return`Fetched ${t.toLocaleString()} rows!`;case Re.COPY_STATES.FETCH_ERROR:return"Unable to copy data.";case Re.COPY_STATES.FETCH_IN_PROGRESS:return`Fetching ${t.toLocaleString()} rows for clipboard...`;case Re.COPY_STATES.DONE:return"Copied to Clipboard!";default:return""}}static getCopyButtonText(e){switch(e){case Re.BUTTON_STATES.FETCH_IN_PROGRESS:return"Fetching";case Re.BUTTON_STATES.CLICK_TO_COPY:return"Click to Copy";case Re.BUTTON_STATES.RETRY:return"Retry";default:return"Copy"}}componentDidMount(){const{copyOperation:e}=this.props;e!=null&&this.startCopy()}componentDidUpdate(e){const{copyOperation:t}=this.props;e.copyOperation!==t&&this.startCopy()}componentWillUnmount(){this.stopCopy()}startCopy(){wt.debug2("startCopy"),this.stopCopy();const{copyOperation:e}=this.props;if(e==null){wt.debug2("No copy operation set, cancelling out"),this.setState({isShown:!1});return}const{ranges:t,error:n}=e;if(n!=null){wt.debug("Showing copy error",n),this.setState({isShown:!0,copyState:Re.COPY_STATES.DONE,error:n}),this.startHideTimer();return}const s=ee.rowCount(t);this.setState({rowCount:s,isShown:!0,error:void 0}),s>Re.NO_PROMPT_THRESHOLD?this.setState({buttonState:Re.BUTTON_STATES.COPY,copyState:Re.COPY_STATES.CONFIRMATION_REQUIRED}):this.startFetch()}stopCopy(){this.textData=void 0,this.stopFetch(),this.stopHideTimer()}handleBackgroundClick(){wt.debug2("handleBackgroundClick");const{copyState:e}=this.state;e===Re.COPY_STATES.DONE&&this.setState({isShown:!1})}handleCancelClick(){wt.debug2("handleCancelClick"),this.stopFetch(),this.setState({isShown:!1})}handleCopyClick(){wt.debug2("handleCopyClick"),this.textData!=null?this.copyText(this.textData):this.startFetch()}handleHideTimeout(){wt.debug2("handleHideTimeout"),this.stopHideTimer(),this.setState({isShown:!1})}copyText(e){wt.debug2("copyText",e),this.textData=e,fo(e).then(()=>{this.setState({copyState:Re.COPY_STATES.DONE}),this.startHideTimer()},t=>{wt.error("copyText error",t),this.setState({buttonState:Re.BUTTON_STATES.CLICK_TO_COPY,copyState:Re.COPY_STATES.CLICK_REQUIRED})})}startFetch(){this.stopFetch(),this.setState({buttonState:Re.BUTTON_STATES.FETCH_IN_PROGRESS,copyState:Re.COPY_STATES.FETCH_IN_PROGRESS});const{model:e,copyOperation:t}=this.props,{ranges:n,includeHeaders:s,userColumnWidths:o,movedColumns:i,formatValues:r}=t;wt.debug("startFetch",n);const l=ne.getHiddenColumns(o);let a=W.getModelRanges(n,i);if(l.length>0){const d=l.map(ee.makeColumn);a=ee.subtractRangesFromRanges(a,d)}const c=r!=null&&r?(d,u)=>e.displayString(d,u.type,u.name):d=>`${d}`;this.fetchPromise=Ue.makeCancelable(e.textSnapshot(a,s,c)),this.fetchPromise.then(d=>{this.fetchPromise=void 0,this.copyText(d)}).catch(d=>{d instanceof po?wt.debug("User cancelled copy."):(wt.error("Error fetching contents",d),this.fetchPromise=void 0,this.setState({buttonState:Re.BUTTON_STATES.RETRY,copyState:Re.COPY_STATES.FETCH_ERROR}))})}stopFetch(){this.fetchPromise&&(wt.debug2("stopFetch"),this.fetchPromise.cancel(),this.fetchPromise=void 0)}startHideTimer(){this.stopHideTimer(),this.hideTimer=setTimeout(this.handleHideTimeout,Re.HIDE_TIMEOUT)}stopHideTimer(){this.hideTimer!=null&&(clearTimeout(this.hideTimer),this.hideTimer=void 0)}render(){const{onEntering:e,onEntered:t,onExiting:n,onExited:s}=this.props,{buttonState:o,copyState:i,isShown:r,rowCount:l,error:a}=this.state,c=i===Re.COPY_STATES.DONE?"fade":"copy-slide-up",d=Re.getCopyButtonText(o),u=a!=null?a:Re.getStatusMessageText(i,l),m=i!==Re.COPY_STATES.DONE,p=o===Re.BUTTON_STATES.FETCH_IN_PROGRESS,g=i===Re.COPY_STATES.DONE;return R(yi,{animation:c,isShown:r,className:B("iris-grid-copy-handler",{"copy-done":g}),onClick:this.handleBackgroundClick,onEntering:e,onEntered:t,onExiting:n,onExited:s,children:[h("div",{className:"status-message",children:h("span",{children:u})}),h(dt,{in:m,timeout:Le.transitionMs,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,children:R("div",{className:"buttons-container",children:[h("button",{type:"button",className:"btn btn-outline-secondary btn-cancel",onClick:this.handleCancelClick,children:"Cancel"}),R(X,{kind:p?"tertiary":"primary",className:B("btn-copy",{"btn-spinner":p}),onClick:this.handleCopyClick,disabled:p,children:[p&&h(Vt,{}),d]})]})})]})}};let $s=Re;$s.NO_PROMPT_THRESHOLD=1e4;$s.HIDE_TIMEOUT=3e3;$s.COPY_STATES={IDLE:"IDLE",CONFIRMATION_REQUIRED:"CONFIRMATION_REQUIRED",FETCH_IN_PROGRESS:"FETCH_IN_PROGRESS",FETCH_ERROR:"FETCH_ERROR",CLICK_REQUIRED:"CLICK_REQUIRED",DONE:"DONE"};$s.BUTTON_STATES={COPY:"COPY",FETCH_IN_PROGRESS:"FETCH_IN_PROGRESS",CLICK_TO_COPY:"CLICK_TO_COPY",RETRY:"RETRY"};$s.defaultProps={copyOperation:null,onEntering:()=>{},onEntered:()=>{},onExiting:()=>{},onExited:()=>{}};class za extends T.exports.PureComponent{constructor(t){super(t);const{debounceMs:n}=t;this.debouncedSendUpdate=ft(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}=t;this.initialValue=s,this.state={isChanged:!1,value:s}}componentDidMount(){var t;(t=this.inputField)==null||t.focus()}componentDidUpdate(t){const{debounceMs:n}=this.props;t.debounceMs!==n&&(this.debouncedSendUpdate.flush(),this.debouncedSendUpdate=ft(this.sendUpdate.bind(this),n))}componentWillUnmount(){this.debouncedSendUpdate.cancel()}setValue(t){this.initialValue=t,this.setState({value:t})}focus(){var t;(t=this.inputField)==null||t.focus()}handleChange(t){const{value:n}=t.target;this.setState({value:n,isChanged:!0}),this.debouncedSendUpdate(n)}handleCancel(){this.debouncedSendUpdate.cancel();const{initialValue:t}=this,{isChanged:n}=this.state;n&&this.sendUpdate(t);const{onDone:s}=this.props;s()}handleCommit(t=!0,n=!0){this.debouncedSendUpdate.flush();const{onDone:s}=this.props;s(t,n)}handleFocus(){var t;(t=this.inputField)==null||t.select()}handleBlur(t){const{relatedTarget:n}=t;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(t=!1){this.debouncedSendUpdate.flush();const{onTab:n}=this.props;n(t)}handleKeyDown(t){switch(t.key){case"Escape":t.stopPropagation(),t.preventDefault(),this.handleCancel();break;case"Enter":t.stopPropagation(),t.preventDefault(),this.handleCommit();break;case"Tab":t.stopPropagation(),t.preventDefault(),this.handleTab(t.shiftKey);break}}handleContextMenu(t){const{onContextMenu:n}=this.props;n(t)}sendUpdate(t){const{onChange:n}=this.props;n(t)}render(){const{className:t,style:n,isAdvancedFilterSet:s,onAdvancedFiltersTriggered:o}=this.props,{value:i}=this.state;return R("div",{style:n,className:"iris-grid-input-autosized-wrapper","data-value":i,children:[h("input",{ref:r=>{this.inputField=r},className:B("iris-grid-input-field",t),type:"text",value:i,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(X,{kind:"ghost",className:B("btn-link-icon advanced-filter-button",{"filter-set":s}),onClick:o,onContextMenu:this.handleContextMenu,children:R("div",{className:"fa-layers ",children:[h(Z,{icon:fr,className:"filter-solid"}),h(Z,{icon:oi,className:"filter-light"})]})})})]})}}za.defaultProps={style:{},className:"",value:"",isAdvancedFilterSet:!1,onAdvancedFiltersTriggered:()=>{},onChange:()=>{},onDone:()=>{},onTab:()=>{},onContextMenu:()=>{},debounceMs:150};class Km extends Cs{constructor(t){super(),this.irisGrid=t}onDown(t){const{selectedRanges:n}=this.irisGrid.state;return t.key==="c"&&Ne.isModifierKeyDown(t)?(ne.isValidSnapshotRanges(n)?this.irisGrid.copyRanges(n):this.irisGrid.copyRanges(n,!1,!1,"Invalid copy ranges"),!0):!1}}const Xm={TOGGLE_QUICK_FILTER:De.createAndAdd({id:"TABLE.TOGGLE_QUICK_FILTER",name:"Toggle Quick Filter",shortcut:[ie.CTRL,ae.F],macShortcut:[ie.CMD,ae.F]}),CLEAR_ALL_FILTERS:De.createAndAdd({id:"TABLE.CLEAR_ALL_FILTERS",name:"Clear All Table Filters",shortcut:[ie.CTRL,ae.E],macShortcut:[ie.CMD,ae.E]}),CLEAR_FILTERS:De.createAndAdd({id:"TABLE.CLEAR_FILTERS",name:"Clear Active Table Filters",shortcut:[ie.CTRL,ie.SHIFT,ae.E],macShortcut:[ie.CMD,ie.SHIFT,ae.E]}),REVERSE:De.createAndAdd({id:"TABLE.REVERSE",name:"Reverse",shortcut:[ie.CTRL,ae.I],macShortcut:[ie.CMD,ae.I]}),TOGGLE_SEARCH:De.createAndAdd({id:"TABLE.TOGGLE_SEARCH",name:"Toggle Search",shortcut:[ie.CTRL,ie.SHIFT,ae.F],macShortcut:[ie.CMD,ie.SHIFT,ae.F]}),GOTO_ROW:De.createAndAdd({id:"TABLE.GOTO_ROW",name:"Go to Row",shortcut:[ie.CTRL,ae.G],macShortcut:[ie.CMD,ae.G]})},Ym={COMMIT:De.createAndAdd({id:"INPUT_TABLE.COMMIT",name:"Commit",shortcut:[ie.CTRL,ae.S],macShortcut:[ie.CMD,ae.S]}),DISCARD:De.createAndAdd({id:"INPUT_TABLE.DISCARD",name:"Discard",shortcut:[ie.CTRL,ie.ALT,ae.S],macShortcut:[ie.CMD,ie.OPTION,ae.S]})},Lt={TABLE:Xm,INPUT_TABLE:Ym};class Qm extends Cs{constructor(t){super(),this.irisGrid=t}onDown(t){if(Lt.TABLE.REVERSE.matchesEvent(t)){if(!this.irisGrid.isReversible())return!1;const{reverseType:n}=this.irisGrid.state;return n===x.REVERSE_TYPE.NONE?this.irisGrid.reverse(x.REVERSE_TYPE.POST_SORT):this.irisGrid.reverse(x.REVERSE_TYPE.NONE),!0}return!1}}class jm extends Cs{constructor(t){super(),this.irisGrid=t}onDown(t){return Lt.TABLE.CLEAR_FILTERS.matchesEvent(t)?(this.irisGrid.clearAllFilters(),!0):!1}}class Zm extends Qe{constructor(t){super(850),this.irisGrid=t}destroyColumnTooltip(){this.irisGrid.setState({overflowButtonTooltipProps:null})}setCursor(t){return this.isHoveringOverflowButton(t)?(this.cursor="pointer",{stopPropagation:!1,preventDefault:!1}):(this.cursor=null,!1)}getButtonPosition({x:t,y:n,column:s,row:o}){if(s==null||o==null)return null;const{renderer:i,grid:r,state:l,props:a}=this.irisGrid;if(!r)return null;const{metrics:c}=l,{model:d}=a,{canvasContext:u}=r,m=r.getTheme(),p={context:u,mouseX:t,mouseY:n,metrics:c,model:d,theme:m},{left:g,top:f,width:w,height:C}=i.getCellOverflowButtonPosition(p);return g==null||w==null||f==null||C==null?null:{left:g,top:f,width:w,height:C}}isHoveringOverflowButton(t){var C;const{x:n,y:s}=t,{left:o,top:i,width:r,height:l}=(C=this.getButtonPosition(t))!=null?C:{};if(o==null||r==null||i==null||l==null)return!1;const{renderer:a,grid:c,state:d,props:u}=this.irisGrid;if(!c)return!1;const{metrics:m}=d,{model:p}=u,{canvasContext:g}=c,f=c.getTheme(),w={context:g,mouseX:n,mouseY:s,metrics:m,model:p,theme:f};return a.shouldRenderOverflowButton(w)&&n>=o&&n<=o+r&&s>=i&&s<=i+l}onMove(t){if(this.isHoveringOverflowButton(t)){const{overflowButtonTooltipProps:n}=this.irisGrid.state,s=this.getButtonPosition(t);ct(n,s)||this.irisGrid.setState({overflowButtonTooltipProps:s})}else this.destroyColumnTooltip();return this.setCursor(t)}onWheel(t){return this.destroyColumnTooltip(),this.onMove(t)}onDown(t){this.destroyColumnTooltip();const{column:n,row:s}=t;return this.isHoveringOverflowButton(t)&&this.irisGrid.setState({showOverflowModal:!0,overflowText:this.irisGrid.getValueForCell(n,s)}),!1}onContextMenu(){return this.destroyColumnTooltip(),!1}onLeave(){return this.destroyColumnTooltip(),!1}}class Jm extends Qe{constructor(t){super(),this.irisGrid=t,this.cursor=null}isActive(){const{isSelectingColumn:t}=this.irisGrid.props;return t}isValidColumn(t){if(t==null)return!1;const{columnSelectionValidator:n}=this.irisGrid.props;return n!=null?n(t):!0}updateColumnSelectionStatus(){const{columnSelectionValidator:t}=this.irisGrid.props;t!=null&&t(null)}getTableColumn(t){if(t==null)return null;const{model:n}=this.irisGrid.props,s=this.irisGrid.getModelColumn(t);return s==null?null:n.columns[s]}onMove(t){if(!this.isActive())return!1;const{columnAllowedCursor:n,columnNotAllowedCursor:s}=this.irisGrid.props,{column:o}=t,i=this.getTableColumn(o);return this.isValidColumn(i)?(this.cursor=n,this.irisGrid.setState({hoverSelectColumn:o})):(this.cursor=s,this.irisGrid.setState({hoverSelectColumn:null})),!0}onWheel(t){if(!this.isActive())return!1;const{columnAllowedCursor:n,columnNotAllowedCursor:s}=this.irisGrid.props,{column:o}=t,i=this.getTableColumn(o);return this.isValidColumn(i)?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(t){if(!this.isActive())return!1;const{column:n}=t,s=this.getTableColumn(n);return s!=null&&this.isValidColumn(s)&&this.irisGrid.selectColumn(s),!0}}class ep extends Qe{constructor(t){super(),this.irisGrid=t}hideColumnTooltip(){const{tooltip:t}=this.irisGrid;t&&(t.stopTimer(),t.hide())}onDown(){return this.hideColumnTooltip(),!1}onContextMenu(){return this.hideColumnTooltip(),!1}onWheel(){return this.hideColumnTooltip(),!1}onLeave(t,n,s){const{relatedTarget:o}=s instanceof MouseEvent?s:s.nativeEvent,{tooltip:i}=this.irisGrid;if(!i)return!1;const r=i.popper.current;return r&&o instanceof Element&&r.element.contains(o)||this.hideColumnTooltip(),!1}onMove(t){const{column:n,row:s,columnHeaderDepth:o}=t,{shownColumnTooltip:i}=this.irisGrid.state;let r=null;return n!==null&&s===null&&o===0&&(r=n),r!==i&&this.irisGrid.setState({shownColumnTooltip:r}),!1}}const Wa=class extends T.exports.Component{constructor(e=Wa.defaultProps){super(e),this.handleInputChange=this.handleInputChange.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.inputRef=te.createRef()}handleInputChange(){const{onChange:e}=this.props;this.inputRef.current&&e(this.inputRef.current.value)}closeContextMenu(){const{forwardedProps:e}=this.props,{closeMenu:t}=e;t(!0)}revertToDefault(){const{onChange:e}=this.props;e(null)}returnFocusToContextMenu(){const e=Gu.getClosestByClassName(this.inputRef.current,"context-menu-container");e instanceof HTMLElement&&e.focus()}handleKeyDown(e){switch(e.key){case"Enter":e.stopPropagation(),this.closeContextMenu();break;case"Escape":e.stopPropagation(),this.revertToDefault(),this.closeContextMenu();break;case"ArrowRight":case"ArrowLeft":e.stopPropagation();break;case"ArrowUp":case"ArrowDown":this.returnFocusToContextMenu();break;default:e.stopPropagation()}}render(){const{formatString:e,forwardedProps:t,placeholder:n,title:s}=this.props,{menuItem:{description:o},iconElement:i}=t;return R("div",{className:"form-group flex-grow mb-0",children:[R("div",{className:"custom-format-title",children:[h("span",{className:"icon",children:i}),R("label",{className:"title mb-0",htmlFor:"custom-format-input",children:[s,o!=null&&h(We,{children:o})]})]}),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:e,ref:this.inputRef,placeholder:n,onKeyDown:this.handleKeyDown,onChange:this.handleInputChange,autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:"false"})})]})}};let $a=Wa;$a.defaultProps={formatString:"",forwardedProps:{menuItem:{},closeMenu(e){},iconElement:null},placeholder:"",title:"",onChange(e){}};class Rt{static isDefaultSelected(t){return!t||![_e.TYPE_CONTEXT_CUSTOM,_e.TYPE_CONTEXT_PRESET].includes(t.type)}static isCustomSelected(t){return t!=null&&t.type===_e.TYPE_CONTEXT_CUSTOM}static makeOption(t,n,s,o){return{title:t,description:t,group:s,format:n,isSelected:o}}static makeCustomFormatOption(t,n,s,o,i){return{title:t.label,description:t.label,format:t,group:n,isSelected:o,menuElement:h($a,{formatString:t.formatString,title:t.label,placeholder:s,onChange:i})}}}const Xt=class{static getOptions(e,t){const n=new Date,o=[{group:Xt.dateGroup,formatString:"yyyy-MM-dd"},{group:Xt.dateGroup,formatString:"MM-dd-yyyy"},{group:Xt.timeGroup,formatString:"HH:mm:ss"},{group:Xt.timeGroup,formatString:"HH:mm:ss.SSS"},{group:Xt.timeGroup,formatString:"HH:mm:ss.SSSSSSSSS"},{group:Xt.dateTimeGroup,formatString:"yyyy-MM-dd HH:mm:ss"},{group:Xt.dateTimeGroup,formatString:"yyyy-MM-dd HH:mm:ss.SSS"},{group:Xt.dateTimeGroup,formatString:"yyyy-MM-dd HH:mm:ss.SSSSSSSSS"}].map(r=>{const l=jn.makeFormat("",r.formatString,jn.TYPE_CONTEXT_PRESET),a=e.getFormattedString(n,x.dataType.DATETIME,"",l);return Rt.makeOption(a,l,r.group,jn.isSameFormat(l,t))});return[Rt.makeOption("Default",null,Xt.dateGroup,Rt.isDefaultSelected(t)),...o]}};let Ii=Xt;Ii.dateGroup=10;Ii.timeGroup=20;Ii.dateTimeGroup=30;const Yt=class{static getOptions(e,t){const n=[{format:Be.FORMAT_PERCENT,group:Yt.presetGroup},{format:Be.FORMAT_BASIS_POINTS,group:Yt.presetGroup},{format:Be.FORMAT_MILLIONS,group:Yt.presetGroup},{format:Be.FORMAT_SCIENTIFIC_NOTATION,group:Yt.presetGroup},{format:Be.FORMAT_ROUND,group:Yt.presetRoundGroup},{format:Be.FORMAT_ROUND_TWO_DECIMALS,group:Yt.presetRoundGroup},{format:Be.FORMAT_ROUND_FOUR_DECIMALS,group:Yt.presetRoundGroup}],s=Rt.makeOption("Default",null,Yt.defaultGroup,Rt.isDefaultSelected(e)),o=n.map(a=>Rt.makeOption(a.format.label,a.format,a.group,Be.isSameFormat(a.format,e))),i=Rt.isCustomSelected(e),r=i?e:Be.makeCustomFormat(),l=Rt.makeCustomFormatOption(r,Yt.customGroup,Be.DEFAULT_FORMAT_STRING,i,a=>{if(a!=null){const c=Be.makeCustomFormat(a);Be.isValid(c)&&t(c)}else t(null)});return[s,...o,l]}};let So=Yt;So.defaultGroup=10;So.presetGroup=20;So.presetRoundGroup=30;So.customGroup=40;const ao=class{static getOptions(e,t){const n=[{format:kt.FORMAT_MILLIONS,group:ao.presetGroup},{format:kt.FORMAT_SCIENTIFIC_NOTATION,group:ao.presetGroup}],s=Rt.makeOption("Default",null,ao.defaultGroup,Rt.isDefaultSelected(e)),o=n.map(a=>Rt.makeOption(a.format.label,a.format,a.group,kt.isSameFormat(a.format,e))),i=Rt.isCustomSelected(e),r=i?e:kt.makeCustomFormat(),l=Rt.makeCustomFormatOption(r,ao.customGroup,kt.DEFAULT_FORMAT_STRING,i,a=>{if(a!=null){const c=kt.makeCustomFormat(a);kt.isValid(c)&&t(c)}else t(null)});return[s,...o,l]}};let Mi=ao;Mi.defaultGroup=10;Mi.presetGroup=20;Mi.customGroup=30;const Ml=se.module("IrisGridContextMenuHandler"),tp=150,Dl="yyyy-MM-dd HH:mm:ss.SSSSSSSSS",$=class extends Qe{constructor(e){super(),this.debouncedUpdateCustomFormat=ft(e.handleFormatSelection,tp),this.irisGrid=e}static getQuickFilterCondition(e,t,n){return e&&n==="&&"?e.and(t):e&&n==="||"?e.or(t):t}static getQuickFilterText(e,t,n){return n&&e!=null?`${e} ${n} ${t}`:t}static getOperatorAsText(e){return e==="&&"?"And":"Or"}static getNumberValueEqualsFilter(e,t){const n=e.filter();if(t===Number.POSITIVE_INFINITY)return I.FilterCondition.invoke("isInf",n).and(n.greaterThan(I.FilterValue.ofNumber(0)));if(t===Number.NEGATIVE_INFINITY)return I.FilterCondition.invoke("isInf",n).and(n.lessThan(I.FilterValue.ofNumber(0)));if(Number.isNaN(t))return I.FilterCondition.invoke("isNaN",n);const s=$.getFilterValueForNumberOrChar(e.type,t);return n.eq(s)}static getFilterValueForNumberOrChar(e,t){return x.isCharType(e)?I.FilterValue.ofString(String.fromCharCode(t)):I.FilterValue.ofNumber(t)}static getRowOptionFormatted(e,t,n=30){return`${e} "${gs.truncate(t,n-e.length-3)}"`}componentWillUnmount(){this.debouncedUpdateCustomFormat.flush()}getHeaderActions(e,t){var F;const{irisGrid:n}=this,{column:s}=t;O(s);const{model:o}=n.props,{columns:i}=o,r=i[e],l=[],{metrics:a,reverseType:c,quickFilters:d,advancedFilters:u,searchFilter:m}=n.state,p=n.getTheme();O(a);const{filterIconColor:g,filterBarActiveColor:f,contextMenuSortIconColor:w,contextMenuReverseIconColor:C}=p,S=o.sort,b=x.getSortForColumn(S,e),E=c!==x.REVERSE_TYPE.NONE,{userColumnWidths:v}=a,y=[...v.values()].some(V=>V===0),M=o.getColumnHeaderParentGroup(e,0)===void 0,A=o.isColumnFrozen(e);return l.push({title:"Hide Column",group:$.GROUP_HIDE_COLUMNS,action:()=>{this.irisGrid.hideColumnByVisibleIndex(s)}}),l.push({title:A?"Unfreeze Column":"Freeze Column",group:$.GROUP_HIDE_COLUMNS,disabled:!M,action:()=>{A?this.irisGrid.unFreezeColumnByColumnName(r.name):this.irisGrid.freezeColumnByColumnName(r.name)},order:10}),l.push({title:"Show All Columns",group:$.GROUP_HIDE_COLUMNS,action:()=>{this.irisGrid.showAllColumns()},disabled:!y}),l.push({title:"Quick Filters",icon:dn,iconColor:f,shortcut:Lt.TABLE.TOGGLE_QUICK_FILTER,group:$.GROUP_FILTER,order:10,action:()=>{this.irisGrid.toggleFilterBar(s)}}),l.push({title:"Advanced Filters",icon:u.get(e)?fr:oi,iconColor:g,group:$.GROUP_FILTER,order:20,action:()=>{this.irisGrid.handleAdvancedMenuOpened(s)}}),l.push({title:"Clear Table Filters",group:$.GROUP_FILTER,order:40,shortcut:Lt.TABLE.CLEAR_FILTERS,action:()=>{this.irisGrid.clearAllFilters()},disabled:!(d.size>0||u.size>0||m!=null)}),l.push({title:"Sort by",icon:dn,iconColor:w,group:$.GROUP_SORT,order:10,actions:this.sortByActions(r,e,b)}),l.push({title:"Add Additional Sort",disabled:b&&S.length===1||E&&S.length===1||b&&E&&S.length===2||S.length===0,group:$.GROUP_SORT,order:20,actions:this.additionalSortActions(r,e)}),l.push({title:"Clear Table Sorting",disabled:S.length===0||E&&S.length===1,group:$.GROUP_SORT,action:()=>{this.irisGrid.sortColumn(s,$.COLUMN_SORT_DIRECTION.none)},order:30}),l.push({title:c===x.REVERSE_TYPE.NONE?"Reverse Table":"Clear Reverse Table",icon:dn,iconColor:C,group:$.GROUP_SORT,order:40,disabled:!o.isReversible,shortcut:Lt.TABLE.REVERSE,action:()=>{c===x.REVERSE_TYPE.NONE?this.irisGrid.reverse(x.REVERSE_TYPE.POST_SORT):this.irisGrid.reverse(x.REVERSE_TYPE.NONE)}}),l.push({title:"Copy Column Name",group:$.GROUP_COPY,action:()=>{var V;fo((V=o.textForColumnHeader(e))!=null?V:"").catch(H=>Ml.error("Unable to copy header",H))}}),x.isDateType(r.type)?l.push({title:"Date/Time Format",group:$.GROUP_FORMAT,actions:this.dateFormatActions(r)}):x.isNumberType(r.type)&&l.push({title:"Number Format",group:$.GROUP_FORMAT,actions:(F=this.numberFormatActions(r))!=null?F:void 0}),l}getCellActions(e,t,n){O(e);const{irisGrid:s}=this,{column:o,row:i}=n,{model:r,canCopy:l}=s.props,{columns:a}=r,c=s.getModelRow(i);O(c);const d=r.valueForCell(e,c),u=r.textForCell(e,c),m=a[e],p=[],{quickFilters:g}=s.state,f=s.getTheme(),{filterIconColor:w}=f,{settings:C}=s.props,S=new jn({timeZone:C==null?void 0:C.timeZone,showTimeZone:!1,showTSeparator:!0,defaultDateTimeFormatString:Dl}),b=new jn({timeZone:C==null?void 0:C.timeZone,showTimeZone:C==null?void 0:C.showTimeZone,showTSeparator:C==null?void 0:C.showTSeparator,defaultDateTimeFormatString:Dl});if(m==null||i==null)return p;if(r.isFilterable(e)){const v={title:"Filter by Value",icon:dn,iconColor:w,group:$.GROUP_FILTER,order:10,actions:[]};if(d==null)g.get(e)&&v.actions.push({title:"And",actions:this.nullFilterActions(m,g.get(e),"&&"),order:2,group:re.groups.high}),v.actions.push(...this.nullFilterActions(m));else if(x.isBooleanType(m.type))g.get(e)&&v.actions.push({title:"Or",actions:this.booleanFilterActions(m,u,g.get(e),"||"),order:2,group:re.groups.high}),v.actions.push(...this.booleanFilterActions(m,u));else if(x.isNumberType(m.type)||x.isCharType(m.type)){O(e);const y=x.isCharType(m.type)?String.fromCharCode(d):`${d}`;g.get(e)&&v.actions.push({title:"And",actions:this.numberFilterActions(m,y,d,g.get(e),"&&"),order:2,group:re.groups.high}),v.actions.push(...this.numberFilterActions(m,y,d,g.get(e)))}else if(x.isDateType(m.type)){const y=S.format(d),M=b.format(d);g.get(e)&&v.actions.push({title:"And",actions:this.dateFilterActions(m,y,M,d,g.get(e),"&&"),order:2,group:re.groups.high}),v.actions.push(...this.dateFilterActions(m,y,M,d,g.get(e)))}else g.get(e)&&v.actions.push({title:"And",actions:this.stringFilterActions(m,u,d,g.get(e),"&&"),order:2,group:re.groups.high}),v.actions.push(...this.stringFilterActions(m,u,d));v.actions!=null&&v.actions.length>0&&p.push(v)}if(ke(r)&&r.isRowExpandable(c)){const v=r.groupedColumns.length>0?r.depthForRow(c)-1:0,M=r.valueForCell(v,c)==null?"null":r.textForCell(v,c);p.push({title:$.getRowOptionFormatted(r.isRowExpanded(c)?"Collapse":"Expand",M),group:$.GROUP_EXPAND_COLLAPSE,order:10,action:()=>{r.setRowExpanded(c,!r.isRowExpanded(c))}}),r.isExpandAllAvailable===!0&&p.push({title:$.getRowOptionFormatted("Expand All in",M),group:$.GROUP_EXPAND_COLLAPSE,order:20,action:()=>{r.setRowExpanded(c,!0,!0)}})}ke(r)&&r.hasExpandableRows&&r.isExpandAllAvailable===!0&&(p.push({title:"Expand Entire Table",group:$.GROUP_EXPAND_COLLAPSE,order:30,action:()=>{r.expandAll()}}),p.push({title:"Collapse Entire Table",group:$.GROUP_EXPAND_COLLAPSE,order:40,action:()=>{r.collapseAll()}}));const E={title:"Go to",iconColor:w,shortcut:Lt.TABLE.GOTO_ROW,group:$.GROUP_GOTO,order:10,action:()=>this.irisGrid.toggleGotoRow(`${i+1}`,`${d}`,m.name)};return p.push(E),l&&(p.push({title:"Copy Cell",group:$.GROUP_COPY,order:10,action:()=>{s.copyCell(o,i)}}),p.push({title:"Copy Cell Unformatted",group:$.GROUP_COPY,order:20,action:()=>{s.copyCell(o,i,!0)}})),p}onContextMenu(e,t,n){const{irisGrid:s}=this,{y:o,column:i,row:r,columnHeaderDepth:l}=e,a=s.getModelColumn(i),c=s.getModelRow(r),{model:d,canCopy:u}=s.props,{columns:m}=d,{metrics:p,isFilterBarShown:g,quickFilters:f,advancedFilters:w,selectedRanges:C}=s.state;O(p);const{columnHeaderHeight:S,gridY:b,columnHeaderMaxDepth:E}=p,v=[];if(a!=null&&c!=null){const y=d.valueForCell(a,c),M=d.textForCell(a,c),A=m[a],{onContextMenu:F}=s.props;A!=null&&v.push(F({model:d,value:y,valueText:M,column:A,rowIndex:r,columnIndex:i,modelRow:c,modelColumn:a}))}return a!=null&&d.isFilterable(a)&&v.push({title:"Clear Column Filter",group:$.GROUP_FILTER,order:30,action:()=>{this.irisGrid.removeColumnFilter(a)},disabled:!(f.has(a)||w.has(a))}),(g?o<=b:o<=S*E&&l===0)?a!=null&&v.push(...this.getHeaderActions(a,e)):(a!=null&&c!=null&&v.push(...this.getCellActions(a,t,e)),u&&C.length>0&&(v.push({title:"Copy Selection",shortcut:Nr.COPY,group:$.GROUP_COPY,order:30,action:()=>{s.copyRanges(C)}}),v.push({title:"Copy Selection w/ Headers",group:$.GROUP_COPY,order:40,action:()=>{s.copyRanges(C,!0)}})),He(d)&&d.isEditable&&C.length>0&&v.push({title:"Delete Selected Rows",group:$.GROUP_EDIT,order:50,action:()=>{this.irisGrid.deleteRanges(C)}})),v.length===0?!1:(O(s.gridWrapper),re.triggerMenu(s.gridWrapper,n.pageX,n.pageY,v),!0)}dateFormatActions(e){const{model:t}=this.irisGrid.props,{formatter:n}=t,s=n.getColumnFormat(e.type,e.name),o=Ii.getOptions(n,s),i=[];for(let r=0;r<o.length;r+=1){const{description:l,format:a,group:c,isSelected:d,title:u}=o[r];i.push({title:u,description:l,icon:d?Xn:void 0,group:c,order:r,action:()=>{const m=t.getColumnIndexByName(e.name);O(m),this.irisGrid.handleFormatSelection(m,a)}})}return i}numberFormatActions(e){const{model:t}=this.irisGrid.props,{formatter:n}=t,s=n.getColumnFormat(e.type,e.name);let o;const i=t.getColumnIndexByName(e.name);if(x.isDecimalType(e.type))o=So.getOptions(s,l=>{O(i),this.debouncedUpdateCustomFormat(i,l)});else if(x.isIntegerType(e.type))o=Mi.getOptions(s,l=>{O(i),this.debouncedUpdateCustomFormat(i,l)});else return Ml.error("Invalid column type in numberFormatActions"),null;const r=[];for(let l=0;l<o.length;l+=1){const{format:a,isSelected:c}=o[l];r.push({...o[l],icon:c?Xn:void 0,order:l,action:()=>{i===void 0&&a&&a.type===_e.TYPE_CONTEXT_CUSTOM||(O(i),this.irisGrid.handleFormatSelection(i,a))}})}return r}stringFilterActions(e,t,n,s,o){const i=I.FilterValue.ofString(n);let r=s;r||(r={filter:null,text:null});const{filter:l,text:a}=r,c=[],{model:d}=this.irisGrid.props,u=d.getColumnIndexByName(e.name);return O(u),c.push({menuElement:R("div",{className:"iris-grid-filter-menu-item-value",children:[o?$.getOperatorAsText(o):""," ",'"',t,'"']}),order:1,group:re.groups.high}),c.push({title:"text is exactly",description:`Show only rows where ${e.name} is ${n} (case sensitive)`,action:()=>{this.irisGrid.setQuickFilter(u,$.getQuickFilterCondition(l,e.filter().eq(i),o),$.getQuickFilterText(a,`=${t}`,o))},order:10,group:re.groups.low}),c.push({title:"text is not exactly",description:`Show only rows where ${e.name} is not ${t} (case sensitive)`,action:()=>{this.irisGrid.setQuickFilter(u,$.getQuickFilterCondition(l,e.filter().notEq(i),o),$.getQuickFilterText(a,`!=${t}`,o))},order:20,group:re.groups.low}),c.push({title:"text contains",description:`Show only rows where ${e.name} contains ${t}`,action:()=>{this.irisGrid.setQuickFilter(u,$.getQuickFilterCondition(l,e.filter().contains(i),o),$.getQuickFilterText(a,`~${t}`,o))},order:30,group:re.groups.low}),c.push({title:"text does not contain",description:`Show only rows where ${e.name} does not contain ${n}`,action:()=>{this.irisGrid.setQuickFilter(u,$.getQuickFilterCondition(l,e.filter().contains(i).not(),o),$.getQuickFilterText(a,`!~${t}`,o))},order:40,group:re.groups.low}),c.push({title:"text starts with",description:`Show only rows where ${e.name} starts with ${t}`,action:()=>{this.irisGrid.setQuickFilter(u,$.getQuickFilterCondition(l,e.filter().invoke("startsWith",i),o),$.getQuickFilterText(a,`${t}*`,o))},order:50,group:re.groups.low}),c.push({title:"text ends with",description:`Show only rows where ${e.name} ends with ${t}`,action:()=>{this.irisGrid.setQuickFilter(u,$.getQuickFilterCondition(l,e.filter().invoke("endsWith",i),o),$.getQuickFilterText(a,`*${t}`,o))},order:60,group:re.groups.low}),c}numberFilterActions(e,t,n,s,o){const i=$.getFilterValueForNumberOrChar(e.type,n);let r=null,l=null;s&&(r=s.filter,l=s.text);const a=[],c=n!==Number.POSITIVE_INFINITY&&n!==Number.NEGATIVE_INFINITY&&!Number.isNaN(n),{model:d}=this.irisGrid.props,u=d.getColumnIndexByName(e.name);return O(u),a.push({menuElement:R("div",{className:"iris-grid-filter-menu-item-value",children:[o?$.getOperatorAsText(o):""," ",'"',t,'"']}),order:1,group:re.groups.high}),a.push({title:"is equal to",description:`Show only rows where ${e.name} is ${t}`,action:()=>{const m=$.getNumberValueEqualsFilter(e,n);this.irisGrid.setQuickFilter(u,$.getQuickFilterCondition(r,m,o),$.getQuickFilterText(l,`=${t}`,o))},order:10,group:re.groups.low}),a.push({title:"is not equal to",description:`Show only rows where ${e.name} is not ${t}`,action:()=>{const m=$.getNumberValueEqualsFilter(e,n).not();this.irisGrid.setQuickFilter(u,$.getQuickFilterCondition(r,m,o),$.getQuickFilterText(l,`!=${t}`,o))},order:20,group:re.groups.low}),c&&!x.isCharType(e.type)&&(a.push({title:"greater than",description:`Show only rows where ${e.name} is greater than ${t}`,action:()=>{this.irisGrid.setQuickFilter(u,$.getQuickFilterCondition(r,e.filter().greaterThan(i),o),$.getQuickFilterText(l,`>${t}`,o))},order:30,group:re.groups.low}),a.push({title:"greater than or equal to",description:`Show only rows where ${e.name} is greater than or equal to ${t}`,action:()=>{this.irisGrid.setQuickFilter(u,$.getQuickFilterCondition(r,e.filter().greaterThanOrEqualTo(i),o),$.getQuickFilterText(l,`>=${t}`,o))},order:40,group:re.groups.low}),a.push({title:"less than",description:`Show only rows where ${e.name} is less than ${t}`,action:()=>{this.irisGrid.setQuickFilter(u,$.getQuickFilterCondition(r,e.filter().lessThan(i),o),$.getQuickFilterText(l,`<${t}`,o))},order:50,group:re.groups.low}),a.push({title:"less than or equal to",description:`Show only rows where ${e.name} is less than or equal to ${t}`,action:()=>{this.irisGrid.setQuickFilter(u,$.getQuickFilterCondition(r,e.filter().lessThanOrEqualTo(i),o),$.getQuickFilterText(l,`<=${t}`,o))},order:60,group:re.groups.low})),a}booleanFilterActions(e,t,n,s){const o=[],{model:i}=this.irisGrid.props,{filter:r,text:l}=n||{},a=i.getColumnIndexByName(e.name);return O(a),o.push({menuElement:R("div",{className:"iris-grid-filter-menu-item-value",children:[s?$.getOperatorAsText(s):""," ",'"',t!=null?t:"null",'"']}),order:1,group:re.groups.high}),o.push({title:"true",description:`Show only rows where ${e.name} is true`,action:()=>{this.irisGrid.setQuickFilter(a,$.getQuickFilterCondition(r,e.filter().isTrue(),s),$.getQuickFilterText(l,"true",s))},order:10,group:re.groups.low}),o.push({title:"false",description:`Show only rows where ${e.name} is false`,action:()=>{this.irisGrid.setQuickFilter(a,$.getQuickFilterCondition(r,e.filter().isFalse(),s),$.getQuickFilterText(l,"false",s))},order:20,group:re.groups.low}),o.push({title:"is null",description:`Show only rows where ${e.name} is null`,action:()=>{this.irisGrid.setQuickFilter(a,$.getQuickFilterCondition(r,e.filter().isNull(),s),$.getQuickFilterText(l,"null",s))},order:30,group:re.groups.low}),o.push({title:"is not null",description:`Show only rows where ${e.name} is not null`,action:()=>{this.irisGrid.setQuickFilter(a,$.getQuickFilterCondition(r,e.filter().isNull().not(),s),$.getQuickFilterText(l,"!null",s))},order:40,group:re.groups.low}),o}dateFilterActions(e,t,n,s,o,i){const r=I.FilterValue.ofNumber(s);let l=null,a=null;o&&(l=o.filter,a=o.text);const{model:c}=this.irisGrid.props,d=c.getColumnIndexByName(e.name);O(d);const u=[];return u.push({menuElement:R("div",{className:"iris-grid-filter-menu-item-value",children:[i?$.getOperatorAsText(i):""," ",'"',n,'"']}),order:1,group:re.groups.high}),u.push({title:"date is",description:`Show only rows where ${e.name} is ${n}`,action:()=>{this.irisGrid.setQuickFilter(d,$.getQuickFilterCondition(l,e.filter().eq(r),i),$.getQuickFilterText(a,`=${t}`,i))},order:10,group:re.groups.low}),u.push({title:"date is not",description:`Show only rows where ${e.name} is not ${n}`,action:()=>{this.irisGrid.setQuickFilter(d,$.getQuickFilterCondition(l,e.filter().notEq(r),i),$.getQuickFilterText(a,`!=${t}`,i))},order:20,group:re.groups.low}),u.push({title:"date is before",description:`Show only rows where ${e.name} is before ${n}`,action:()=>{this.irisGrid.setQuickFilter(d,$.getQuickFilterCondition(l,e.filter().lessThan(r),i),$.getQuickFilterText(a,`<${t}`,i))},order:30,group:re.groups.low}),u.push({title:"date is before or equal",description:`Show only rows where ${e.name} is before or equal to ${n}`,action:()=>{this.irisGrid.setQuickFilter(d,$.getQuickFilterCondition(l,e.filter().lessThanOrEqualTo(r),i),$.getQuickFilterText(a,`<=${t}`,i))},order:40,group:re.groups.low}),u.push({title:"date is after",description:`Show only rows where ${e.name} is greater than ${n}`,action:()=>{this.irisGrid.setQuickFilter(d,$.getQuickFilterCondition(l,e.filter().greaterThan(r),i),$.getQuickFilterText(a,`>${t}`,i))},order:50,group:re.groups.low}),u.push({title:"date is after or equal",description:`Show only rows where ${e.name} is after or equal to ${n}`,action:()=>{this.irisGrid.setQuickFilter(d,$.getQuickFilterCondition(l,e.filter().greaterThanOrEqualTo(r),i),$.getQuickFilterText(a,`>=${t}`,i))},order:60,group:re.groups.low}),u}nullFilterActions(e,t,n){let s=null,o=null;t&&(s=t.filter,o=t.text);const i=[],{model:r}=this.irisGrid.props,l=r.getColumnIndexByName(e.name);return O(l),i.push({menuElement:R("div",{className:"iris-grid-filter-menu-item-value",children:[n?$.getOperatorAsText(n):""," ",'"null"']}),order:1,group:re.groups.high}),i.push({title:"is null",description:`Show only rows where ${e.name} is null`,action:()=>{this.irisGrid.setQuickFilter(l,$.getQuickFilterCondition(s,e.filter().isNull(),n),$.getQuickFilterText(o,"null",n))},order:10,group:re.groups.low}),i.push({title:"is not null",description:`Show only rows where ${e.name} is not null`,action:()=>{this.irisGrid.setQuickFilter(l,$.getQuickFilterCondition(s,e.filter().isNull().not(),n),$.getQuickFilterText(o,"!null",n))},order:20,group:re.groups.low}),i}sortByActions(e,t,n){const s=this.irisGrid.getTheme(),{contextMenuSortIconColor:o}=s,i=[{title:`${e.name} Ascending`,order:10,action:()=>{this.irisGrid.sortColumn(t,$.COLUMN_SORT_DIRECTION.ascending)},icon:this.checkColumnSort(n,$.COLUMN_SORT_DIRECTION.ascending)?dn:void 0,iconColor:o},{title:`${e.name} Descending`,order:20,action:()=>{this.irisGrid.sortColumn(t,$.COLUMN_SORT_DIRECTION.descending)},icon:this.checkColumnSort(n,$.COLUMN_SORT_DIRECTION.descending)?dn:void 0,iconColor:o},{title:"Remove Sort",order:50,action:()=>{this.irisGrid.sortColumn(t,$.COLUMN_SORT_DIRECTION.none,!1,!0)},disabled:!n}];return x.isNumberType(e.type)&&(i.push({title:`ABS(${e.name}) Ascending`,order:30,action:()=>{this.irisGrid.sortColumn(t,$.COLUMN_SORT_DIRECTION.ascending,!0)},icon:this.checkColumnSort(n,$.COLUMN_SORT_DIRECTION.ascending,!0)?dn:void 0,iconColor:o}),i.push({title:`ABS(${e.name}) Descending`,order:40,action:()=>{this.irisGrid.sortColumn(t,$.COLUMN_SORT_DIRECTION.descending,!0)},icon:this.checkColumnSort(n,$.COLUMN_SORT_DIRECTION.descending,!0)?dn:void 0,iconColor:o})),i}additionalSortActions(e,t){const n=this.irisGrid.getTheme(),{contextMenuSortIconColor:s}=n,o=[{title:"Add Sort By",menuElement:R("div",{className:"btn-context-menu menu-title",children:[h("span",{className:"icon",children:h(Z,{icon:dn,style:{color:s!=null?s:void 0}})}),h("span",{className:"title",children:"Add Additional Sort"}),h("span",{className:"shortcut",children:Ne.isMacPlatform()?"\u2318Click":"Ctrl+Click"})]}),order:1},{title:`${e.name} Ascending`,order:10,action:()=>{this.irisGrid.sortColumn(t,$.COLUMN_SORT_DIRECTION.ascending,!1,!0)}},{title:`${e.name} Descending`,order:20,action:()=>{this.irisGrid.sortColumn(t,$.COLUMN_SORT_DIRECTION.descending,!1,!0)}}];return x.isNumberType(e.type)&&(o.push({title:`ABS(${e.name}) Ascending`,order:30,action:()=>{this.irisGrid.sortColumn(t,$.COLUMN_SORT_DIRECTION.ascending,!0,!0)}}),o.push({title:`ABS(${e.name}) Descending`,order:40,action:()=>{this.irisGrid.sortColumn(t,$.COLUMN_SORT_DIRECTION.descending,!0,!0)}})),o}checkColumnSort(e,t=null,n=!1){return e?e.direction===t&&e.isAbs===n:!1}};let ln=$;ln.GROUP_EDIT=re.groups.high+10;ln.GROUP_HIDE_COLUMNS=re.groups.high+25;ln.GROUP_FILTER=re.groups.high+50;ln.GROUP_EXPAND_COLLAPSE=re.groups.high+55;ln.GROUP_GOTO=re.groups.high+60;ln.GROUP_SORT=re.groups.high+75;ln.GROUP_COPY=re.groups.high+100;ln.GROUP_FORMAT=re.groups.high+150;ln.COLUMN_SORT_DIRECTION={ascending:"ASC",descending:"DESC",none:null};class np extends Qe{constructor(t){super(),this.irisGrid=t}onDoubleClick(t){const{column:n,row:s}=t;return s==null||n==null?!1:(this.irisGrid.selectData(n,s),!0)}}class sp extends Qe{constructor(t){super(),this.irisGrid=t}onDown(t){const{y:n,column:s,row:o}=t;if(s!==null&&o===null){const{isFilterBarShown:i,metrics:r}=this.irisGrid.state;if(!r)throw new Error("Metrics not set");const{columnHeaderMaxDepth:l}=r,a=this.irisGrid.getTheme();if(i&&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(t){const{y:n,column:s}=t,{isFilterBarShown:o,hoverAdvancedFilter:i,metrics:r}=this.irisGrid.state;if(!r)throw new Error("Metrics not set");const{columnHeaderMaxDepth:l}=r,a=this.irisGrid.getTheme();let c=null;return o&&a.columnHeaderHeight!=null&&a.filterBarHeight!=null&&s!==null&&n>=a.columnHeaderHeight*l&&n<=a.columnHeaderHeight*l+a.filterBarHeight&&(c=s),c!==i&&this.irisGrid.setState({hoverAdvancedFilter:c}),!1}onLeave(t){const{column:n}=t,{hoverAdvancedFilter:s}=this.irisGrid.state;return s!==null&&n!==s&&this.irisGrid.setState({hoverAdvancedFilter:null}),!1}}class op extends Qe{constructor(t){super(750),this.irisGrid=t}destroyTooltip(){this.irisGrid.setState({expandCellTooltipProps:null})}setCursor(t,n){return Vs.isInTreeBox(t,n)?(this.cursor="pointer",{stopPropagation:!1,preventDefault:!1}):(this.cursor=null,!1)}getButtonPosition({x:t,y:n,column:s,row:o}){if(s==null||o==null)return null;const{renderer:i,grid:r,state:l,props:a}=this.irisGrid;if(!r)return null;const{metrics:c}=l,{model:d}=a,{canvasContext:u}=r,m=r.getTheme(),p={context:u,mouseX:t,mouseY:n,metrics:c,model:d,theme:m},g=ke(d)?d.depthForRow(o):null,{left:f,top:w,width:C,height:S}=i.getExpandButtonPosition(p,g);return f==null||C==null||w==null||S==null?null:{left:f,top:w,width:C,height:S}}onMove(t,n){if(Vs.isInTreeBox(t,n)){const{expandCellTooltipProps:s}=this.irisGrid.state,{model:o}=this.irisGrid.props,i=this.getButtonPosition(t),{row:r}=t;O(r);const l=ke(o)&&o.isRowExpanded(r);ct(s,i)||this.irisGrid.setState({expandCellTooltipProps:i,expandTooltipDisplayValue:l?"collapse":"expand"})}else this.destroyTooltip();return this.setCursor(t,n)}onDown(){return this.destroyTooltip(),!1}onContextMenu(){return this.destroyTooltip(),!1}onWheel(){return this.destroyTooltip(),!1}onLeave(){return this.destroyTooltip(),!1}}class ip extends Qe{constructor(t){super(),this.column=null,this.irisGrid=t}getColumnFromGridPoint(t){const{column:n,row:s,columnHeaderDepth:o}=t;return n!==null&&s===null&&o===0?n:null}onDown(t){return this.column=this.getColumnFromGridPoint(t),!1}onClick(t,n,s){const o=this.getColumnFromGridPoint(t);if(o!=null&&o===this.column){const i=Ne.isModifierKeyDown(s);return this.irisGrid.toggleSort(o,i),!0}return!1}}class rp extends Qe{constructor(t){super(),this.irisGrid=t}onWheel(t,n,s){const{irisGrid:o}=this,{model:i}=o.props,{metrics:r,pendingRowCount:l}=o.state;O(r);const{bottom:a,rowCount:c,rowHeight:d}=r,{deltaY:u}=W.getScrollDelta(s);return He(i)&&i.isEditable&&a>=c-1&&u>0&&o.setState({pendingRowCount:l+Math.ceil(u/d)}),!1}}const lp=3e3;function ap({children:e=null,onEntering:t,onEntered:n,onExiting:s,onExited:o}){const[i,r]=T.exports.useState(!1),l=T.exports.useRef(),a=Er(e),c=T.exports.useCallback(()=>{r(!0),l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{r(!1)},lp)},[r,l]);return T.exports.useEffect(()=>{a!==e&&e!=null&&c()},[e,a,r,c]),T.exports.useEffect(()=>()=>l.current?clearTimeout(l.current):void 0,[]),h(yi,{className:"toast-bottom-bar",isShown:i,onEntering:t,onEntered:n,onExiting:s,onExited:o,children:e})}class cp extends Co{getGridY(t){let n=super.getGridY(t);const{isFilterBarShown:s,theme:o,advancedFilters:i,quickFilters:r,sorts:l,reverseType:a}=t;return s?n+=o.filterBarHeight:(r!=null&&r.size>0||i!=null&&i.size>0)&&(n+=o.filterBarCollapsedHeight),a!==x.REVERSE_TYPE.NONE&&l!=null&&l.length>0&&(n+=o.reverseHeaderBarHeight),n}getUserColumnWidths(){return this.userColumnWidths}}const dp=1,qa=te.memo(({model:e,modelColumns:t,top:n,bottom:s,left:o,right:i,filter:r,formatter:l,reverseType:a=x.REVERSE_TYPE.NONE,sorts:c,customColumns:d,movedColumns:u,hiddenColumns:m,alwaysFetchColumns:p,rollupConfig:g=null,totalsConfig:f=null,selectDistinctColumns:w=ye,pendingRowCount:C=0,pendingDataMap:S=Sn,frozenColumns:b,formatColumns:E,columnHeaderGroups:v})=>{const y=T.exports.useMemo(()=>ne.getModelViewportColumns(t,o,i,u,m,p,dp),[t,o,i,u,m,p]);return T.exports.useEffect(function(){e.filter=r},[e,r]),T.exports.useEffect(function(){const A=[...c];a!==x.REVERSE_TYPE.NONE&&A.push(I.Table.reverse()),e.sort=A},[e,c,a]),T.exports.useEffect(function(){e.formatter=l},[e,l]),T.exports.useEffect(function(){e.isCustomColumnsAvailable&&(e.customColumns=d)},[e,d]),T.exports.useEffect(function(){e.isFormatColumnsAvailable&&(e.formatColumns=E)},[e,E]),T.exports.useEffect(function(){e.setViewport(n,s,y)},[e,n,s,y]),T.exports.useEffect(function(){e.isRollupAvailable&&(e.rollupConfig=g)},[e,e.isRollupAvailable,g]),T.exports.useEffect(function(){e.isSelectDistinctAvailable&&(e.selectDistinctColumns=w)},[e,w]),T.exports.useEffect(function(){e.isTotalsAvailable&&(e.totalsConfig=f)},[e,e.isTotalsAvailable,f]),T.exports.useEffect(function(){e.pendingRowCount=C},[e,C]),T.exports.useEffect(function(){e.pendingDataMap=S},[e,S]),T.exports.useEffect(function(){b&&e.updateFrozenColumns(b)},[e,b]),T.exports.useEffect(function(){e.columnHeaderGroups=v},[e,v]),null});qa.displayName="IrisGridModelUpdater";const $t=Object.freeze({SORT_UP:"sortUp",SORT_DOWN:"sortDown",CARET_DOWN:"caretDown",CARET_RIGHT:"caretRight",CELL_OVERFLOW:"cellOverflow"}),Nl=10,zi=16;class mo extends gs{constructor(){super(),this.icons={},this.initIcons()}static isFilterValid(t,n){const s=t==null||t.filter!=null,o=n==null||n.filter!=null;return s&&o}initIcons(){this.setIcon($t.SORT_UP,Au),this.setIcon($t.SORT_DOWN,xu),this.setIcon($t.CARET_DOWN,$n),this.setIcon($t.CARET_RIGHT,da),this.setIcon($t.CELL_OVERFLOW,nu)}setIcon(t,n){const s=Array.isArray(n.icon[4])?n.icon[4][0]:n.icon[4],o=new Path2D(s),i=new Path2D,r={a:zi/n.icon[0],d:zi/n.icon[1]};i.addPath(o,r),this.icons[t]=i}getIcon(t){return this.icons[t]}getSortIcon(t){return t?t.direction===x.sortDirection.ascending?this.getIcon($t.SORT_UP):t.direction===x.sortDirection.descending?this.getIcon($t.SORT_DOWN):null:null}drawCanvas(t){super.drawCanvas(t),this.drawScrim(t)}drawGrid(t,n){super.drawGrid(t,n),this.drawCellOverflowButton(n)}drawGridLines(t,n){super.drawGridLines(t,n),this.drawGroupedColumnLine(t,n),this.drawPendingRowLine(t,n)}drawCellContent(t,n,s,o){var m;const{metrics:i,model:r}=n,{modelColumns:l,modelRows:a}=i,c=L(a,o),d=l.get(s);if(d===void 0)return;const u=r.valueForCell(d,c);if(x.isTextType((m=r.columns[d])==null?void 0:m.type)&&(u===null||u==="")){const p=t.font;t.font=`italic ${p}`;const g=u===null?"null":"empty";super.drawCellContent(t,n,s,o,g),t.font=p;return}super.drawCellContent(t,n,s,o)}drawGroupedColumnLine(t,n){const{metrics:s,model:o,theme:i}=n,{groupedColumns:r,columns:l}=o,{maxY:a,allColumnWidths:c,allColumnXs:d}=s;if(r.length===0||i.groupedColumnDividerColor==null)return;const u=r[r.length-1],m=l.findIndex(w=>w.name===u.name),p=d.get(m),g=c.get(m);if(p==null||g==null)return;const f=p+g+.5;t.strokeStyle=i.groupedColumnDividerColor,t.lineWidth=1,t.beginPath(),t.moveTo(f,0),t.lineTo(f,a),t.stroke()}drawPendingRowLine(t,n){const{metrics:s,model:o,theme:i}=n,{allRowYs:r,maxX:l}=s,{pendingRowCount:a}=o;if(a<=0)return;const c=o.rowCount-o.pendingRowCount-o.floatingBottomRowCount;let d=r.get(c);d!=null&&(d-=.5,t.save(),t.setLineDash([4,2]),t.strokeStyle=i.pendingTextColor,t.lineWidth=1,t.beginPath(),t.moveTo(0,d),t.lineTo(l,d),t.stroke(),t.restore())}drawMouseColumnHover(t,n){const{theme:s,metrics:o,hoverSelectColumn:i}=n;if(i==null||s.linkerColumnHoverBackgroundColor==null)return;const{allColumnWidths:r,allColumnXs:l,maxY:a}=o,c=l.get(i),d=r.get(i);O(c),O(d),t.fillStyle=s.linkerColumnHoverBackgroundColor,t.fillRect(c,0,d,a)}drawMouseRowHover(t,n){const{isSelectingColumn:s}=n;s||super.drawMouseRowHover(t,n)}drawScrim(t){const{context:n,loadingScrimProgress:s,metrics:o,theme:i}=t;if(s==null)return;const{width:r,height:l,gridY:a}=o,{scrimBlurSize:c,scrimColor:d}=i;n.save(),n.globalCompositeOperation="color",n.filter=`blur(${c}px)`,d!=null&&(n.fillStyle=d),n.beginPath(),n.rect(0,a,r,l-a),n.clip(),n.fillRect(-c,-c+a,c*2+r,(c*2+(l-a))*s),n.globalCompositeOperation="overlay",n.filter=`blur(${c}px) opacity(15%)`,n.fillRect(-c,-c+a,c*2+r,(c*2+(l-a))*s),n.restore()}drawColumnHeaders(t,n){super.drawColumnHeaders(t,n);const{theme:s,metrics:o,model:i,reverseType:r}=n,{columnHeaderHeight:l}=o;if(this.drawFilterHeaders(t,n),l<=0)return;const{sort:a}=i;if(a.length===1){const c=r!==x.REVERSE_TYPE.NONE;let d;c?d=s.headerReverseBarColor:d=s.headerSortBarColor,this.drawHeaderBar(t,n,d,c?s.reverseHeaderBarHeight:s.sortHeaderBarHeight)}else a.length>1&&(r!==x.REVERSE_TYPE.NONE&&this.drawHeaderBar(t,n,s.headerReverseBarColor,s.reverseHeaderBarHeight,!1),this.drawHeaderBar(t,n,s.headerSortBarColor,s.sortHeaderBarHeight))}drawHeaderBar(t,n,s,o,i=!0){const{theme:r,metrics:l,model:a}=n,{columnHeaderHeight:c,width:d}=l;let u=0;i||(u=o),t.fillStyle=r.headerBarCasingColor,t.fillRect(0,a.columnHeaderMaxDepth*c-o-2+u,d,o+2),t.fillStyle=s,t.fillRect(0,a.columnHeaderMaxDepth*c-o-1+u,d,o)}drawColumnHeadersAtDepth(t,n,s,o,i){const{metrics:r,model:l,isMenuShown:a}=n,{columnHeaderMaxDepth:c}=l,{width:d}=r,u={...o,maxX:i===c-1&&o.maxX===d?d-(a?0:30):o.maxX};super.drawColumnHeadersAtDepth(t,n,s,u,i)}drawColumnHeaderAtIndex(t,n,s,o){var P;super.drawColumnHeaderAtIndex(t,n,s,o);const{metrics:i,model:r,theme:l}=n,{modelColumns:a,allColumnWidths:c,allColumnXs:d,gridX:u,columnHeaderHeight:m,fontWidths:p}=i,{headerHorizontalPadding:g}=l,f=L(c,s,0),w=L(d,s)+u,C=a.get(s);if(C==null)return;const S=x.getSortForColumn(r.sort,C);if(!S)return;const b=this.getSortIcon(S);if(!b)return;const E=r.textForColumnHeader(C);if(E===void 0)return;const v=(P=p.get(t.font))!=null?P:gs.DEFAULT_FONT_WIDTH;O(v);const y=E.length*v,M=u+w+y+g;let{maxX:A}=o;A-=g;const F=u+w+f-g-1,V=M>A?M+1:Math.min(A,F),H=S.direction===x.sortDirection.ascending?-6:-12,N=m*.5+H;t.save(),t.beginPath(),t.rect(w,0,f,m),t.clip(),t.fillStyle=l.headerSortBarColor,t.translate(V,N),t.fill(b),t.restore()}drawFilterHeaders(t,n){const{isFilterBarShown:s,quickFilters:o,advancedFilters:i}=n;s?this.drawExpandedFilterHeaders(t,n):(o!=null&&o.size>0||i!=null&&i.size>0)&&this.drawCollapsedFilterHeaders(t,n)}drawExpandedFilterHeaders(t,n){const{metrics:s,model:o,theme:i,quickFilters:r,advancedFilters:l}=n,{filterBarHeight:a}=i;if(a<=0)return;const{gridX:c,gridY:d,maxX:u,modelColumns:m,visibleColumns:p,allColumnWidths:g,allColumnXs:f}=s,w=d-a;t.save(),t.font=i.font,t.textAlign="left",r!=null&&r.size>0||l!=null&&l.size>0?t.fillStyle=i.filterBarExpandedActiveBackgroundColor:t.fillStyle=i.filterBarExpandedBackgroundColor,t.fillRect(c,w,u,a-1),t.fillStyle=i.headerBarCasingColor,t.fillRect(c,w+a-1,u,1);const C=w;t.strokeStyle=i.filterBarSeparatorColor,t.beginPath();for(let S=0;S<p.length;S+=1){const b=p[S],E=L(m,b),v=L(f,b),y=L(g,b);if(o.isFilterable(E)&&y>0){const M=c+(v!=null?v:0);t.rect(M+.5,C+.5,y,a-2)}}t.stroke();for(let S=0;S<p.length;S+=1){const b=p[S],E=L(g,b),y=L(f,b)+c;this.drawExpandedFilterHeader(t,n,b,y,E)}t.restore()}drawExpandedFilterHeader(t,n,s,o,i){if(i<=0)return;const{metrics:r,theme:l,quickFilters:a,advancedFilters:c}=n,{modelColumns:d,gridY:u}=r,{filterBarHeight:m,filterBarExpandedActiveCellBackgroundColor:p,filterBarErrorColor:g,filterBarHorizontalPadding:f,headerColor:w}=l,C=u-m,S=d.get(s);if(S===void 0)return;const b=a.get(S),E=c.get(S);if(b==null&&E==null)return;let v=null;if(b!=null){const{text:M}=b;if(v=M,v||(v=x.getFilterText(b.filter)),v!=null){const{fontWidths:A}=r;let F=A.get(t.font);(F==null||F===0)&&(F=t.measureText("8").width,F||(F=10));const V=(i-f*2)/F;V<=0?v="":v.length>V&&(v=`${v.substring(0,V-1)}\u2026`)}}if(t.save(),mo.isFilterValid(E,b)&&p!=null)t.fillStyle=p,t.fillRect(o+1,C+1,i-1,m-3);else if(g!=null){t.fillStyle=g,t.lineWidth=2,t.strokeStyle=g;const M=o+2,A=C+2,F=i-3,V=m-5;t.strokeRect(M,A,F,V)}if(v!=null&&v!==""){const M=o+f,A=C+m*.5+1;t.fillStyle=w,t.fillText(v,M,A)}t.restore()}drawCollapsedFilterHeaders(t,n){const{metrics:s,theme:o}=n,{headerSeparatorColor:i,filterBarCollapsedHeight:r}=o;if(r<=0)return;const{gridX:l,gridY:a,maxX:c,visibleColumns:d,allColumnWidths:u,allColumnXs:m}=s,p=a-r;t.save(),t.fillStyle=i,t.fillRect(l,p,c,r);for(let g=0;g<d.length;g+=1){const f=d[g],w=u.get(f),C=m.get(f);if(C!=null&&w!=null){const S=C+l;this.drawCollapsedFilterHeader(t,n,f,S,w)}}t.restore()}drawCollapsedFilterHeader(t,n,s,o,i){if(i<=0)return;const{metrics:r,theme:l,quickFilters:a,advancedFilters:c}=n,{modelColumns:d,gridY:u}=r,m=d.get(s);if(m===void 0)return;const p=a.get(m),g=c.get(m),{filterBarCollapsedHeight:f,filterBarActiveColor:w,filterBarActiveBackgroundColor:C,filterBarErrorColor:S}=l;t.save();const b=mo.isFilterValid(g,p);C!=null&&p==null&&g==null?t.fillStyle=C:w!=null&&b?t.fillStyle=w:S!=null&&(t.fillStyle=S);const E=o+1,v=u-f,y=i-1,M=f-1;t.fillRect(E,v,y,M),t.restore()}drawTreeMarker(t,n,s,o,i,r,l){t.save();const{x1:a,y1:c}=i,d=l?this.getIcon($t.CARET_DOWN):this.getIcon($t.CARET_RIGHT),u=s+a-2,m=o+c+2.5;t.fillStyle=r,t.textAlign="center",t.translate(u,m),t.fill(d),t.restore()}drawRowFooters(t,n){const{metrics:s,model:o,mouseX:i,mouseY:r,theme:l}=n,{gridY:a,gridX:c,maxX:d,modelRows:u,floatingTopHeight:m,floatingBottomHeight:p,floatingRows:g,rowFooterWidth:f,height:w,horizontalBarHeight:C,verticalBarWidth:S,allRowHeights:b,allRowYs:E,width:v}=s;if(f<=0||g.length===0)return;const{cellHorizontalPadding:y,floatingGridRowColor:M,floatingRowBackgroundColors:A,headerColor:F,rowHoverBackgroundColor:V}=l;t.translate(c,a),t.beginPath();const H=Math.min(d,v-f-S-c);t.fillStyle=A,m>0&&t.rect(H,0,f,m),p>0&&t.rect(H,w-a-C-p,f,p),t.fill();const N=i!=null&&r!=null&&i>=c&&i<=d+f?W.getRowAtY(r,s):null;if(V!=null&&N!==null&&g.includes(N)){t.fillStyle=V;const k=E.get(N),z=b.get(N);O(k),O(z),t.fillRect(H,k,f,z)}if(t.beginPath(),M!=null&&(t.strokeStyle=M),m>0&&(t.moveTo(H+.5,.5),t.lineTo(H+.5,m-.5)),p>0){const k=w-a-C-p;t.moveTo(H-.5,k+.5),t.lineTo(H-.5,k+p-.5)}t.stroke(),t.fillStyle=F,t.textAlign="left";const P=H+y;for(let k=0;k<g.length;k+=1){const z=g[k],K=b.get(z),G=E.get(z),_=u.get(z);if(G!=null&&K!=null&&_!=null){const q=G+K*.5;t.fillText(o.textForRowFooter(_),P,q)}}t.translate(-c,-a)}getTextRenderMetrics(t,n,s,o){const i=super.getTextRenderMetrics(t,n,s,o),{mouseX:r,mouseY:l,metrics:a}=n;if(r==null||l==null)return i;const{column:c,row:d}=W.getGridPointFromXY(r,l,a);if(s===c&&o===d){const{left:u}=this.getCellOverflowButtonPosition(n);this.shouldRenderOverflowButton(n)&&u!=null&&(i.width=u-a.gridX-i.x)}return i}shouldRenderOverflowButton(t){var w,C;const{context:n,mouseX:s,mouseY:o,metrics:i,model:r,theme:l}=t;if(s==null||o==null)return!1;const{row:a,column:c,modelRow:d,modelColumn:u}=W.getCellInfoFromXY(s,o,i);if(a==null||c==null||d==null||u==null||!x.isStringType(r.columns[u].type))return!1;const m=(w=r.textForCell(u,d))!=null?w:"",{width:p}=super.getTextRenderMetrics(n,t,c,a),g=(C=i.fontWidths.get(l.font))!=null?C:mo.DEFAULT_FONT_WIDTH;n.save(),n.font=l.font;const f=this.getCachedTruncatedString(n,m,p,g,r.truncationCharForCell(u,d));return n.restore(),m!==""&&f!==m}getCellOverflowButtonPosition({mouseX:t,mouseY:n,metrics:s,theme:o}){const i={left:null,top:null,width:null,height:null};if(t==null||n==null||!s)return i;const{rowHeight:r,columnWidth:l,left:a,top:c}=W.getCellInfoFromXY(t,n,s);O(a),O(l),O(c);const{width:d,verticalBarWidth:u}=s,{cellHorizontalPadding:m}=o,p=zi+2*m,g=r,w=Math.min(s.gridX+a+l,d-u)-p,C=s.gridY+c;return{left:w,top:C,width:p,height:g}}drawCellOverflowButton(t){const{context:n,mouseX:s,mouseY:o,theme:i}=t;if(s==null||o==null||!this.shouldRenderOverflowButton(t))return;const{left:r,top:l,width:a,height:c}=this.getCellOverflowButtonPosition(t),{cellHorizontalPadding:d,overflowButtonColor:u,overflowButtonHoverColor:m}=i;n.save(),m!=null&&r!=null&&a!=null&&l!=null&&c!=null&&s>=r&&s<=r+a&&o>=l&&o<=l+c?n.fillStyle=m:u!=null&&(n.fillStyle=u);const p=this.getIcon($t.CELL_OVERFLOW);r!=null&&l!=null&&n.translate(r+d,l+2),n.fill(p),n.restore()}getExpandButtonPosition({mouseX:t,mouseY:n,metrics:s,theme:o},i){const r={left:null,top:null,width:null,height:null};if(t==null||n==null||i==null||!s)return r;const{rowHeight:l,left:a,top:c}=W.getCellInfoFromXY(t,n,s);O(a),O(l),O(c);const{cellHorizontalPadding:d}=o,u=Nl+2*d,m=Math.max(a+Nl*i,s.gridX),p=s.gridY+c;return{left:m,top:p,width:u,height:l}}}const up="12px Fira Sans, sans-serif",hp="#f0f0ee",mp="#1a171a",oe={"grid-bg":"#211f22",font:up,white:hp,black:mp,"header-bg":"#2d2a2e","header-color":"#f0f0ee","header-height":"30px","header-separator-color":"#211f22","header-separator-hover-color":"#929192","header-hidden-separator-hover-color":"#4878ea","header-sort-bar-color":"#aa9af4","header-reverse-bar-color":"#548d29","header-bar-casing-color":"#211f22","header-font":"600 12px Fira Sans, sans-serif","row-height":"19px","row-background-colors":"#373438 #2d2a2e","selection-color":"rgba(118, 217, 228, 0.09)","selection-outline-color":"#76d9e4","selection-outline-casing-color":"#211f22","row-hover-bg":"#4b494c","selected-row-hover-bg":"rgba(118, 217, 228, 0.25)","scroll-bar-active-selection-tick-color":"rgba(118, 217, 228, 0.5)","scroll-bar-bg":"#322f33","scroll-bar-hover-bg":"#373438","scroll-bar-casing-color":"#555356","scroll-bar-corner-color":"#322f33","scroll-bar-color":"#5b5a5c","scroll-bar-hover-color":"#929192","scroll-bar-active-color":"#c0bfbf","text-color":"#f0f0ee","positive-number-color":"#9edc6f","negative-number-color":"#f95d84","zero-number-color":"#fcd65b","date-color":"#fcd65b","pending-text-color":"#fde38d","error-text-color":"#f95d84","null-string-color":"#929192","filter-bar-active-bg":"#425175","filter-bar-active-color":"#4878ea","filter-bar-expanded-bg":"#373438","filter-bar-expanded-active-bg":"#313849","filter-bar-expanded-active-cell-bg":"#374d80","filter-bar-separator-color":"#929192","filter-bar-error-color":"#f95d84","filter-icon-color":"#4878ea","scrim-color":"#211f22","context-menu-sort-icon-color":"#aa9af4","context-menu-reverse-icon-color":"#548d29","linker-column-hover-bg":"rgba(118, 217, 228, 0.09)","tree-line-color":"#5b5a5c","tree-marker-color":"#c0bfbf","tree-marker-hover-color":"#fcfcfa","grouped-column-divider-color":"#1a171a","floating-grid-row-color":"#555356","floating-row-background-colors":"#403e41","floating-divider-inner-color":"#403e41","floating-divider-outer-color":"#211f22","overflow-button-color":"#c0bfbf","overflow-button-hover-color":"#fcfcfa"},Ka=Object.freeze({backgroundColor:oe["grid-bg"],white:oe.white,black:oe.black,font:oe.font,headerBackgroundColor:oe["header-bg"],headerColor:oe["header-color"],headerSeparatorColor:oe["header-separator-color"],headerSeparatorHoverColor:oe["header-separator-hover-color"],headerHiddenSeparatorHoverColor:oe["header-hidden-separator-hover-color"],headerSortBarColor:oe["header-sort-bar-color"],headerReverseBarColor:oe["header-reverse-bar-color"],headerBarCasingColor:oe["header-bar-casing-color"],headerFont:oe["header-font"],rowBackgroundColors:oe["row-background-colors"],rowHoverBackgroundColor:oe["row-hover-bg"],selectionColor:oe["selection-color"],selectionOutlineColor:oe["selection-outline-color"],selectionOutlineCasingColor:oe["selection-outline-casing-color"],selectedRowHoverBackgroundColor:oe["selected-row-hover-bg"],scrollBarBackgroundColor:oe["scroll-bar-bg"],scrollBarHoverBackgroundColor:oe["scroll-bar-hover-bg"],scrollBarCasingColor:oe["scroll-bar-casing-color"],scrollBarCornerColor:oe["scroll-bar-corner-color"],scrollBarColor:oe["scroll-bar-color"],scrollBarHoverColor:oe["scroll-bar-hover-color"],scrollBarActiveColor:oe["scroll-bar-active-color"],scrollBarSelectionTickColor:oe["selected-row-hover-bg"],scrollBarActiveSelectionTickColor:oe["scroll-bar-active-selection-tick-color"],textColor:oe["text-color"],positiveNumberColor:oe["positive-number-color"],negativeNumberColor:oe["negative-number-color"],zeroNumberColor:oe["zero-number-color"],dateColor:oe["date-color"],pendingTextColor:oe["pending-text-color"],errorTextColor:oe["error-text-color"],nullStringColor:oe["null-string-color"],filterBarActiveBackgroundColor:oe["filter-bar-active-bg"],filterBarExpandedBackgroundColor:oe["filter-bar-expanded-bg"],filterBarExpandedActiveBackgroundColor:oe["filter-bar-expanded-active-bg"],filterBarExpandedActiveCellBackgroundColor:oe["filter-bar-expanded-active-cell-bg"],filterBarSeparatorColor:oe["filter-bar-separator-color"],filterBarActiveColor:oe["filter-bar-active-color"],filterBarErrorColor:oe["filter-bar-error-color"],filterIconColor:oe["filter-icon-color"],scrimColor:oe["scrim-color"],contextMenuSortIconColor:oe["context-menu-sort-icon-color"],contextMenuReverseIconColor:oe["context-menu-reverse-icon-color"],allowRowResize:!1,autoSelectRow:!0,gridColumnColor:null,gridRowColor:null,groupedColumnDividerColor:oe["grouped-column-divider-color"],columnHoverBackgroundColor:null,headerHorizontalPadding:12,scrollBarSize:13,scrollBarHoverSize:16,minScrollHandleSize:24,rowHeight:parseInt(oe["row-height"],10)||19,columnWidth:100,rowHeaderWidth:0,rowFooterWidth:60,columnHeaderHeight:parseInt(oe["header-height"],10)||30,filterBarHeight:30,filterBarCollapsedHeight:5,sortHeaderBarHeight:2,reverseHeaderBarHeight:4,filterBarHorizontalPadding:4,scrimBlurSize:25,minScrimTransitionTime:150,maxScrimTransitionTime:350,scrollSnapToRow:!0,linkerColumnHoverBackgroundColor:oe["linker-column-hover-bg"],treeLineColor:oe["tree-line-color"],treeMarkerColor:oe["tree-marker-color"],treeMarkerHoverColor:oe["tree-marker-hover-color"],floatingGridColumnColor:null,floatingGridRowColor:oe["floating-grid-row-color"],floatingRowBackgroundColors:oe["floating-row-background-colors"],floatingDividerInnerColor:oe["floating-divider-inner-color"],floatingDividerOuterColor:oe["floating-divider-outer-color"],overflowButtonColor:oe["overflow-button-color"],overflowButtonHoverColor:oe["overflow-button-hover-color"]});const Wi=se.module("ColumnStatistics"),pp={SIZE:"Number of Rows"},or=class extends T.exports.Component{constructor(e){super(e),this.handleError=this.handleError.bind(this),this.handleGenerateStatistics=this.handleGenerateStatistics.bind(this),this.handleStatistics=this.handleStatistics.bind(this),this.cancelablePromise=null,this.state={error:null,loading:!1,statistics:null,numRows:0}}static getStatsLabel(e){var t;return(t=pp[e])!=null?t:e.split(" ").map(n=>n[0].toUpperCase()+n.substr(1).toLowerCase()).join(" ")}componentDidMount(){this.maybeGenerateStatistics()}componentWillUnmount(){this.cancelablePromise&&this.cancelablePromise.cancel()}maybeGenerateStatistics(){const{model:e}=this.props,t=e.rowCount-e.pendingRowCount;this.setState({numRows:t}),e.isColumnStatisticsAvailable?t<or.AUTO_GENERATE_LIMIT&&this.handleGenerateStatistics():this.setState({loading:!1})}handleGenerateStatistics(){this.setState({loading:!0});const{column:e,model:t}=this.props;this.cancelablePromise=Ue.makeCancelable(t.columnStatistics(e)),this.cancelablePromise.then(this.handleStatistics).catch(this.handleError)}handleStatistics(e){Wi.debug("Received statistics",e);const{model:t,onStatistics:n}=this.props,s=[];e.statisticsMap.forEach((o,i)=>{s.push({operation:or.getStatsLabel(i),value:o,type:e.getType(i)})}),e.uniqueValues.forEach((o,i)=>{s.push({operation:i,className:"column-statistics-unique-value",value:o,type:"long"})}),this.setState({loading:!1,statistics:s,numRows:t.rowCount-t.pendingRowCount}),n()}handleError(e){if(e!=null&&Ue.isCanceled(e)){Wi.debug("Called handleError on a cancelled promise result");return}Wi.error("Error generating statistics",e),this.setState({error:e,loading:!1,statistics:null})}render(){const{column:e,model:t}=this.props,{error:n,loading:s,statistics:o,numRows:i}=this.state,r=!s&&n==null&&o==null&&t.isColumnStatisticsAvailable,l=[],a=e.type.substring(e.type.lastIndexOf(".")+1),c=e.description===null?null:e.description;if(o!=null)for(let p=0;p<o.length;p+=1){const{operation:g,className:f,value:w,type:C}=o[p],S=C?t.displayString(w,C):t.displayString(w,e.type,e.name),b=R(te.Fragment,{children:[h("div",{className:B("column-statistic-operation",f),children:g}),h("div",{className:"column-statistic-value",children:S})]},g);l.push(b)}const d=ke(t)&&t.hasExpandableRows?"Expanded Rows":"Number of Rows",u=t.displayString(i,"long"),m=t.getColumnIndexByName(e.name);return R("div",{className:"column-statistics",children:[R("div",{className:"column-statistics-title",children:[e.name,R("span",{className:"column-statistics-type",children:["\xA0(",a,")"]}),h(Sa,{className:"column-statistics-copy",tooltip:"Copy column name",copy:e.name})]}),c!=null&&h("div",{className:"column-statistics-description",children:c}),m!=null&&!t.isColumnMovable(m)&&R("div",{className:"column-statistics-status",children:[h(Z,{icon:t.isColumnFrozen(m)?yu:ou,className:"mr-1"}),t.isColumnFrozen(m)?"Frozen":"Not movable"]}),R("div",{className:"column-statistics-grid",children:[o==null&&R(Fe,{children:[h("div",{className:"column-statistic-operation",children:d}),h("div",{className:"column-statistic-value",children:u})]}),l]}),r&&h(X,{kind:"ghost",className:"px-0",onClick:this.handleGenerateStatistics,children:"Generate Stats"}),n!=null&&h("div",{className:"error-message",children:`${n}`}),o&&!s&&h(X,{kind:"ghost",className:"px-0",onClick:this.handleGenerateStatistics,icon:h(Z,{icon:Nu,className:"mr-1"}),children:"Refresh"}),s&&R("div",{className:"column-statistics-loading",children:[h(Vt,{className:"mr-2"}),"Calculating Stats..."]})]})}};let Xa=or;Xa.AUTO_GENERATE_LIMIT=1e5;const Xo=se.module("AdvancedFilterCreatorFilterItem");class Lr extends T.exports.PureComponent{constructor(t){super(t),this.getCachedIsValid=Ie((i,r,l,a)=>{try{return!l||x.makeAdvancedValueFilter(i,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:o=s[0]}=t;this.state={selectedType:o,value:n}}static getLabelForFilter(t,n){try{if(x.isNumberType(t)||x.isCharType(t))return sm(n);if(x.isTextType(t))return nm(n);if(x.isDateType(t))return om(n);if(x.isBooleanType(t))return im(n);throw new Error(`Unrecognized column type: ${t}`)}catch(s){return Xo.warn(s),""}}componentDidMount(){var t;(t=this.typeDropdown)==null||t.focus()}componentDidUpdate(t){const{value:n,selectedType:s}=this.props;s!==void 0&&t.selectedType!==s&&this.setState({selectedType:s}),n!==void 0&&t.value!==n&&this.setState({value:n})}handleTypeChange(t){const n=t.target.value;Xo.debug2("typeChange",n),this.setState({selectedType:n});const{onChange:s}=this.props,{value:o}=this.state;o!=null&&o.length>0&&s(n,o)}handleValueChange(t){Xo.debug2("valueChange");const{value:n}=t.target;this.setState({value:n});const{onChange:s}=this.props,{selectedType:o}=this.state;o!=null&&s(o,n)}handleDelete(){Xo.debug("delete");const{onDelete:t}=this.props;t()}render(){const{column:t,filterTypes:n,formatter:s}=this.props,{selectedType:o,value:i}=this.state,r=!x.isBooleanType(t.type),l=[],a=this.getCachedIsValid(t,o,i,s.timeZone);for(let c=0;c<n.length;c+=1){const d=n[c],u=Lr.getLabelForFilter(t.type,d),m=h("option",{value:d,children:u},d);l.push(m)}return h("div",{className:"advanced-filter-creator-filter-item",children:R("div",{className:"form-row",children:[h("div",{className:"form-group col",children:h("select",{className:"form-control custom-select",value:o,onChange:this.handleTypeChange,ref:c=>{this.typeDropdown=c},children:l})}),r&&h("div",{className:"form-group col",children:h("div",{className:"input-group",children:h("input",{type:"text",className:B("form-control",{error:!a}),placeholder:"Enter value",value:i,onChange:this.handleValueChange})})}),h("div",{className:"form-group col-1 px-0",children:h(X,{kind:"ghost",className:"w-100 h-100 p-0 m-0",onClick:this.handleDelete,icon:yn,tooltip:"Remove Filter"})})]})})}}const Fl=se.module("AdvancedFilterCreatorSelectValueList"),ir=class extends T.exports.PureComponent{constructor(e){super(e),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:t}=this.props;this.state={itemCount:0,items:[],offset:0,selectedValues:t,isLoading:!0}}static indexOf(e,t){for(let n=0;n<t.length;n+=1){const s=t[n];if(s===e||s!=null&&s.valueOf!=null&&e!=null&&e.valueOf!=null&&s.valueOf()===e.valueOf())return n}return-1}componentDidMount(){const{table:e}=this.props;e&&this.startListening(e)}componentDidUpdate(e){const{filters:t,invertSelection:n,selectedValues:s,table:o}=this.props;e.table!==o&&(e.table&&this.stopListening(e.table),o&&this.startListening(o),this.resetViewport()),e.invertSelection!==n&&this.setState({selectedValues:[]},this.handleSelectionUpdate),e.selectedValues!==s&&this.setState({selectedValues:s},this.handleSelectionUpdate),e.filters!==t&&(o==null||o.applyFilter(t),this.resetViewport())}componentWillUnmount(){const{table:e}=this.props;e&&this.stopListening(e)}handleSelect(e,t){const{invertSelection:n}=this.props;let{selectedValues:s}=this.state;s=[...s];const o=ir.indexOf(t,s);o>=0?s.splice(o,1):s.push(t);let i=o<0;n&&(i=!i);const{offset:r}=this.state;let{items:l}=this.state;l=[...l];const a=e-r;a>=0&&a<l.length&&(l[a].isSelected=i),this.setState({items:l,selectedValues:s});const{onChange:c}=this.props;c(s,n)}handleViewportChange(e,t){this.updateViewport(e,t)}handleSelectionUpdate(){this.updateItemSelection()}handleTableUpdate(e){const{table:t,formatter:n}=this.props;if(!t)return;const s=e.detail,{offset:o}=s,i=[],r=t.columns[0];for(let a=0;a<s.rows.length;a+=1){const d=s.rows[a].get(r),u=n.getFormattedString(d,r.type,r.name),m=this.isValueSelected(d);i.push({displayValue:u,value:d,isSelected:m})}Fl.debug2("Received table update:",o,i.length);const l=t.size;this.setState({itemCount:l,items:i,offset:o,isLoading:!1})}isValueSelected(e){const{invertSelection:t}=this.props,{selectedValues:n}=this.state,s=ir.indexOf(e,n);return t?s<0:s>=0}startListening(e){e.addEventListener(I.Table.EVENT_UPDATED,this.handleTableUpdate)}stopListening(e){e.removeEventListener(I.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:e}=this.state;e=[...e];for(let t=0;t<e.length;t+=1){const n=e[t],{value:s}=n;n.isSelected=this.isValueSelected(s)}this.setState({items:e})}updateViewport(e,t,n=!1){const{table:s}=this.props;if(s==null)return;n&&this.setState({isLoading:!0});const o=t-e+1,i=Math.max(0,e-o*3),r=Math.max(i,t+o*3);Fl.debug2("Setting viewport",i,",",r),s.setViewport(i,r)}render(){const{offset:e,isLoading:t,items:n,itemCount:s}=this.state;return R("div",{className:"select-value-list-wrapper",children:[h(xa,{itemCount:s,items:n,offset:e,onSelect:this.handleSelect,onViewportChange:this.handleViewportChange,ref:o=>{this.list=o}}),h(dt,{in:t,timeout:250,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,children:h("div",{className:"loading-list",children:h(Vt,{className:"loading-spinner-large"})})})]})}};let Ya=ir;Ya.defaultProps={invertSelection:!0,selectedValues:[],onChange:()=>{}};const Qa=class extends T.exports.PureComponent{constructor(e){super(e),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:t,selectedValues:n}=e;this.state={filters:[],invertSelection:t,selectedValues:n,searchText:""}}componentDidMount(){this.initSearchTable()}componentDidUpdate(e,t){const{invertSelection:n,selectedValues:s,table:o}=this.props;e.table!==o&&this.initSearchTable(),e.invertSelection!==n&&this.setState({invertSelection:n}),e.selectedValues!==s&&this.setState({selectedValues:s});const{table:i,searchText:r}=this.state;i!==t.table&&(t.table!=null&&t.table.close(),i!=null&&this.startUpdateFilterTimer()),r!==t.searchText&&this.startUpdateFilterTimer()}componentWillUnmount(){const{table:e}=this.state;e!=null&&e.close(),this.searchTablePromise=void 0,this.stopUpdateFilterTimer()}getColumnName(){const{table:e}=this.props;return e!=null?e.columns[0].name:""}getDisplayedValuesCount(){const{invertSelection:e,selectedValues:t,table:n}=this.state;return n==null?null:e?n.totalSize-t.length:t.length}getDisplayedValueText(){const e=this.getDisplayedValuesCount(),{table:t}=this.state,{formatter:n}=this.props;if(e!=null&&t!=null){const s=n.getFormattedString(e,"long"),o=n.getFormattedString(t.totalSize,"long");let i="";return e<1e6&&(i="Displaying "),`${i}${s} of ${o}`}return null}initSearchTable(){const{table:e}=this.props;if(e==null)return;const t=e.copy();this.searchTablePromise=t,this.searchTablePromise.then(n=>{this.searchTablePromise===t?(this.setState({table:n}),this.searchTablePromise=void 0):n.close()})}handleListChange(e,t){this.setState({selectedValues:e,invertSelection:t});const{onChange:n}=this.props;n(e,t)}handleSearchChange(e){const t=e.target.value;this.setState({searchText:t})}handleSelectAllClick(){this.resetSelection(!0)}handleClearAllClick(){this.resetSelection(!1)}handleUpdateFilterTimeout(){this.updateFilterTimer=void 0,this.updateTableFilter()}resetSelection(e){const t=[];this.setState({invertSelection:e,selectedValues:t});const{onChange:n}=this.props;n(t,e)}startUpdateFilterTimer(){this.stopUpdateFilterTimer(),this.updateFilterTimer=setTimeout(this.handleUpdateFilterTimeout,Qa.searchDebounceTime)}stopUpdateFilterTimer(){this.updateFilterTimer!=null&&(clearTimeout(this.updateFilterTimer),this.updateFilterTimer=void 0)}updateTableFilter(){const{table:e,searchText:t}=this.state,{timeZone:n}=this.props,s=e==null?void 0:e.columns[0],o=[];if(s==null)return;let i;if(t.length>0){let r=null;x.isCharType(s.type)?r=x.makeQuickFilter(s,t):x.isTextType(s.type)?r=x.makeQuickFilter(s,`~${t}`,n):r=x.makeQuickFilter(s,`>=${t}`,n),r!=null?o.push(r):i="Invalid search text"}this.setState({filters:o,error:i})}render(){const{error:e,filters:t,invertSelection:n,selectedValues:s,searchText:o,table:i}=this.state,{formatter:r,showSearch:l}=this.props,a=this.getColumnName(),c=this.getDisplayedValueText(),d=a?`Find ${a}...`:"";return R("div",{className:"advanced-filter-creator-select-value",children:[R("div",{className:l?"form-group":"",children:[h("label",{htmlFor:"advanced-filter-creator-select-value-input",children:"Select Values"}),l&&h("input",{type:"text",className:B("form-control",{"is-invalid":e!=null}),id:"advanced-filter-creator-select-value-input",placeholder:d,value:o,onChange:this.handleSearchChange})]}),h(Ya,{table:i,filters:t,invertSelection:n,selectedValues:s,formatter:r,onChange:this.handleListChange}),R("div",{className:"advanced-filter-creator-select-meta-row",children:[R("div",{children:[h(X,{kind:"ghost",onClick:this.handleSelectAllClick,children:"Select All"}),h(X,{kind:"ghost",onClick:this.handleClearAllClick,children:"Clear"})]}),h(dt,{in:c!=null,timeout:250,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,children:h("div",{className:"row-count-info",children:c})})]})]})}};let Pr=Qa;Pr.searchDebounceTime=250;Pr.defaultProps={invertSelection:!0,selectedValues:[],onChange:()=>{},showSearch:!0};const to=se.module("AdvancedFilterCreator"),ds=class extends T.exports.PureComponent{constructor(e){var r,l;super(e),this.getFilterTypes=Ie(a=>x.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=te.createRef();const{options:t}=e;let{filterOperators:n,invertSelection:s,selectedValues:o}=t;const i=(l=(r=t.filterItems)==null?void 0:r.map(({selectedType:a,value:c})=>({selectedType:a,value:c,key:sn()})))!=null?l:[];i.length===0&&i.push(ds.makeFilterItem()),n==null&&(n=[]),s==null&&(s=!0),o==null&&(o=[]),this.state={filterItems:i,filterOperators:n,invertSelection:s,selectedValues:o,valuesTableError:null,valuesTable:void 0}}static makeFilterItem(){return{key:sn()}}componentDidMount(){this.initValuesTable()}componentWillUnmount(){this.debounceTimeout!=null&&(clearTimeout(this.debounceTimeout),this.sendUpdate()),this.valuesTablePromise!=null&&this.valuesTablePromise.cancel()}getFilterChangeHandler(e){return this.handleFilterChange.bind(this,e)}getFilterDeleteHandler(e){return this.handleFilterDelete.bind(this,e)}initValuesTable(){const{model:e,column:t}=this.props;if(!e.isValuesTableAvailable){to.debug("No values table for this model, just ignore");return}this.valuesTablePromise=x.makeCancelableTablePromise(e.valuesTable(t)),this.valuesTablePromise.then(n=>{const s=n.columns[0].sort().asc();n.applySort([s]),this.setState({valuesTable:n})}).catch(n=>{Ue.isCanceled(n)||(to.error("Unable to open values table",n),this.setState({valuesTableError:n}))})}handleFocusTrapEnd(){var e,t;((t=(e=this.focusTrapContainer)==null?void 0:e.current)==null?void 0:t.querySelector("button,select,input,textarea")).focus()}handleFocusTrapStart(){var t,n;const e=(n=(t=this.focusTrapContainer)==null?void 0:t.current)==null?void 0:n.querySelectorAll("button,select,input,textarea");e&&e.length>0&&e[e.length-1].focus()}handleAddAnd(){let{filterItems:e,filterOperators:t}=this.state;e=e.concat(ds.makeFilterItem()),t=t.concat(Jt.and),this.setState({filterItems:e,filterOperators:t})}handleAddOr(){let{filterItems:e,filterOperators:t}=this.state;e=e.concat(ds.makeFilterItem()),t=t.concat(Jt.or),this.setState({filterItems:e,filterOperators:t})}handleChangeFilterOperator(e,t){let{filterOperators:n}=this.state;n=[...n],tm(t),n[e]=t,this.setState({filterOperators:n}),this.startUpdateTimer()}handleFilterChange(e,t,n){let{filterItems:s}=this.state;s=[...s];const{key:o}=s[e];s[e]={key:o,selectedType:t,value:n},this.setState({filterItems:s}),this.startUpdateTimer()}handleFilterDelete(e){let{filterItems:t,filterOperators:n}=this.state;t=[...t],n=[...n],e<t.length&&t.splice(e,1),e<n.length?n.splice(e,1):e===n.length&&n.splice(n.length-1,1),t.length===0&&t.push(ds.makeFilterItem()),this.setState({filterItems:t,filterOperators:n}),this.startUpdateTimer()}handleSelectValueChange(e,t){this.setState({selectedValues:e,invertSelection:t}),this.startUpdateTimer()}handleReset(){to.debug("Resetting Advanced Filter"),this.setState({filterItems:[ds.makeFilterItem()],filterOperators:[],selectedValues:[],invertSelection:!0}),this.startUpdateTimer()}handleSortDown(e){const t=Ne.isModifierKeyDown(e);this.sortTable(x.sortDirection.descending,t)}handleSortUp(e){const t=Ne.isModifierKeyDown(e);this.sortTable(x.sortDirection.ascending,t)}handleSubmit(e){to.debug("Submitting Advanced Filter"),this.stopUpdateTimer(),this.sendUpdate(),e.preventDefault()}handleDone(e){to.debug("Submitting and Closing Advanced Filter"),this.stopUpdateTimer(),this.sendUpdate();const{onDone:t}=this.props;t(),e.preventDefault()}handleUpdateTimeout(){this.debounceTimeout=void 0,this.sendUpdate()}shouldShowAddFilter(){const{filterItems:e}=this.state;if(e.length===0)return!1;const t=e[e.length-1],{selectedType:n,value:s}=t;return n!=null&&n.length>0&&s!=null&&s.length>0}sortTable(e,t=!1){const{column:n,onSortChange:s}=this.props;s(n,e,t)}startUpdateTimer(){this.stopUpdateTimer(),this.debounceTimeout=setTimeout(this.handleUpdateTimeout,ds.debounceFilterUpdate)}stopUpdateTimer(){this.debounceTimeout!==void 0&&(clearTimeout(this.debounceTimeout),this.debounceTimeout=void 0)}sendUpdate(){const{filterItems:e,filterOperators:t,invertSelection:n,selectedValues:s}=this.state,{column:o,onFilterChange:i,model:r}=this.props,{formatter:l}=r,a=e.filter(({selectedType:m,value:p})=>m!=null&&p!=null&&p!==""),c=t.filter((m,p)=>m!=null&&e[p].selectedType!=null&&e[p].value!=null&&e[p].value!=="").slice(0,a.length-1),d={filterItems:a,filterOperators:c,invertSelection:n,selectedValues:s},u=x.makeAdvancedFilter(o,d,l.timeZone);i(o,u,d)}render(){const{column:e,model:t,sortDirection:n,formatter:s}=this.props,{filterItems:o,filterOperators:i,invertSelection:r,selectedValues:l,valuesTable:a,valuesTableError:c}=this.state,{isValuesTableAvailable:d}=t,u=x.isBooleanType(e.type),m=x.isDateType(e.type),p=this.getFilterTypes(e.type),g=e.type.substring(e.type.lastIndexOf(".")+1),f=[];if(!u&&p.length)for(let S=0;S<o.length;S+=1){const b=o[S],{key:E,selectedType:v,value:y}=b,M=h(Lr,{column:e,filterTypes:p,onChange:this.getFilterChangeHandler(S),onDelete:this.getFilterDeleteHandler(S),selectedType:v,value:y,formatter:s},E);if(f.push(M),S<i.length){const F=i[S]===Jt.and,V=R("div",{className:"form-row justify-content-end advanced-filter-creator-filter-operator",children:[h(X,{kind:"ghost",className:B("filter-operator",{active:F}),onClick:()=>this.handleChangeFilterOperator(S,Jt.and),children:"AND"}),h(X,{kind:"ghost",className:B("filter-operator",{active:!F}),onClick:()=>this.handleChangeFilterOperator(S,Jt.or),children:"OR"})]},`filterOperator${E}`);f.push(V)}}const w=this.shouldShowAddFilter(),C=R("div",{className:B("form-row justify-content-end add-filter-item",{hidden:!w}),children:[h("span",{className:"text-muted",children:h(Z,{icon:Bs})}),h(X,{kind:"ghost",className:"btn-filter-item",onClick:this.handleAddAnd,disabled:!w,tooltip:"Add filter with AND",children:"AND"}),h(X,{kind:"ghost",className:"btn-filter-item",onClick:this.handleAddOr,disabled:!w,tooltip:"Add filter with OR",children:"OR"})]},"addFilterItem");return f.push(C),R("div",{className:"advanced-filter-creator",role:"presentation",children:[h("div",{tabIndex:0,onFocus:this.handleFocusTrapStart}),R("form",{onSubmit:this.handleSubmit,ref:this.focusTrapContainer,children:[R("div",{className:"title-bar",children:[h("h6",{className:"advanced-filter-title",children:"Advanced Filters"}),R("div",{className:"advanced-filter-menu-buttons",children:[h(X,{kind:"ghost",className:B("sort-operator",{active:n===x.sortDirection.descending}),onClick:this.handleSortDown,icon:rl,tooltip:`Sort ${e.name} Descending`}),h(X,{kind:"ghost",className:B("sort-operator",{active:n===x.sortDirection.ascending}),onClick:this.handleSortUp,icon:h(Z,{icon:rl,rotation:180}),tooltip:`Sort ${e.name} Ascending`})]})]}),h("hr",{}),R("div",{className:"advanced-filter-column-name",children:[e.name,"\xA0",R("span",{className:"column-type",children:["(",g,")"]})]}),f,d&&c==null&&R(Fe,{children:[!u&&h("hr",{}),h("div",{className:"form-group",children:h(Pr,{table:a,onChange:this.handleSelectValueChange,invertSelection:r,selectedValues:l,formatter:s,showSearch:!m,timeZone:s.timeZone})})]}),R("div",{className:"form-row justify-content-end",children:[h(X,{kind:"secondary",className:"mr-2",onClick:this.handleReset,children:"Reset"}),h(X,{kind:"primary",onClick:this.handleDone,children:"Done"})]})]}),h("div",{tabIndex:0,onFocus:this.handleFocusTrapEnd})]})}};let Hr=ds;Hr.debounceFilterUpdate=250;Hr.defaultProps={options:{filterItems:null,filterOperators:null,invertSelection:!0,selectedValues:[]},sortDirection:null};const xl=se.module("Aggregations"),gp=[Ee.SUM,Ee.ABS_SUM,Ee.MIN,Ee.MAX,Ee.VAR,Ee.AVG,Ee.STD,Ee.FIRST,Ee.LAST,Ee.COUNT_DISTINCT,Ee.DISTINCT,Ee.COUNT,Ee.UNIQUE];function fp({isRollup:e,settings:t,onChange:n,onEdit:s}){const{aggregations:o,showOnTop:i}=t,r=T.exports.useMemo(()=>gp.filter(F=>!o.some(V=>V.operation===F)),[o]),[l,a]=T.exports.useState(r[0]),[c,d]=T.exports.useState([]),u=T.exports.useCallback(F=>{n({...t,...F})},[n,t]),m=T.exports.useCallback(F=>{u({aggregations:F})},[u]),p=T.exports.useCallback(F=>{u({showOnTop:F})},[u]),g=T.exports.useCallback(()=>{xl.debug("handleDragStart"),gt.startDragging()},[]),f=T.exports.useCallback(({destination:F,source:V})=>{if(xl.debug("handleDragEnd",F,V),gt.stopDragging(),F===null)return;let H=F.index;V.index<F.index&&(H+=1);const N=[...o],P=gt.reorder(N,c,N,H),k=gt.adjustDestinationIndex(H,c),z=[[k,k+P.length-1]];m(N),d(z)},[m,o,c,d]),w=T.exports.useCallback(F=>{a(F)},[a]),C=T.exports.useCallback(()=>{m([...o,{operation:l,selected:[],invert:!0}])},[o,l,m]),S=T.exports.useCallback(F=>{m(o.filter((V,H)=>H!==F))},[o,m]),b=T.exports.useCallback(F=>{d(F)},[d]),E=T.exports.useCallback(F=>{const V=o[F];qn.isRollupOperation(V.operation)||s(V)},[o,s]),v=T.exports.useCallback(F=>{p(F.target.value==="true")},[p]);T.exports.useEffect(function(){r.length>0&&!r.includes(l)&&a(r[0])},[r,l]);const y=T.exports.useCallback(({item:F,itemIndex:V,isClone:H=!1,selectedCount:N})=>{const P=F.operation,k=H?`${N}`:void 0,z=H?"item-list-item-clone":void 0,K=qn.isRollupOperation(F.operation),G=!H&&!K;return R(Fe,{children:[R("div",{className:B("item-list-item-content","draggable-item-list-item-content",z),children:[R("span",{className:"title",children:[P,!e&&K&&R("span",{className:"small text-warning",children:[h(Z,{icon:ha})," Requires rollup"]})]}),bt.renderBadge({text:k}),bt.renderHandle()]}),!H&&R(Fe,{children:[h(X,{kind:"ghost",className:"btn-edit",icon:pr,tooltip:"Edit Columns",onClick:()=>s(F),disabled:!G}),h(X,{kind:"ghost",className:"btn-delete",icon:yn,tooltip:"Delete Aggregation",onClick:()=>S(V)})]})]})},[S,s,e]),M=r.length>0,A=o.length>0;return R("div",{className:"aggregations",children:[M&&R("div",{className:"form-inline",children:[h(gh,{onChange:w,value:l,children:r.map(F=>h(ph,{value:F,children:F},F))}),R("button",{type:"button",className:"btn btn-link btn-add",onClick:C,children:[h(Z,{icon:Bs}),"Add Aggregation"]})]}),M&&A&&h("hr",{}),A&&R(Fe,{children:[!e&&R("div",{className:"form-inline",children:[h("label",{children:"Placement:\xA0"}),R(Mr,{onChange:v,value:`${i}`,children:[h(Tn,{value:"true",children:"Top"}),h(Tn,{value:"false",children:"Bottom"})]})]}),h(gi,{onDragStart:g,onDragEnd:f,children:h(bt,{className:"selected-aggregations",itemCount:o.length,items:o,renderItem:y,offset:0,onSelectionChange:b,onSelect:E,selectedRanges:c,isMultiSelect:!0})})]})]})}const Cp=30;function wp({aggregation:e,columns:t,onChange:n}){const[s,o]=T.exports.useState(-1),[i,r]=T.exports.useState(-1),[l,a]=T.exports.useState(0),{invert:c,selected:d}=e,u=T.exports.useRef(null),m=T.exports.useCallback(v=>d.includes(v)?!c:c,[c,d]),p=T.exports.useMemo(()=>{let v=kr(t,e.operation);return l!==0&&(v=x.sortColumns(v,l===1)),v},[t,e.operation,l]),g=T.exports.useMemo(()=>s>=0?p.slice(s,i+1).map(v=>({value:v.name,displayValue:v.name,isSelected:m(v.name)})):[],[p,m,i,s]),f=T.exports.useCallback(v=>{const{name:y}=p[v],M=d.indexOf(y);let A=[...d],F=c;M>=0?A.splice(M,1):(A.push(y),A.length===p.length&&(A=[],F=!c)),n({...e,selected:A,invert:F})},[e,c,p,d,n]),w=T.exports.useCallback(()=>{a(0),n({...e,selected:[],invert:!0})},[e,n]),C=T.exports.useCallback((v,y)=>{o(v),r(y)},[o,r]),S=T.exports.useCallback(()=>{d.length===0?n({...e,invert:!c}):n({...e,selected:[],invert:!0})},[e,c,n,d]),b=d.length===0?c:null,E=d.length!==0||!c||l!==0;return R("div",{role:"menu",className:"aggregation-edit",children:[h("div",{className:"top-menu",children:R("div",{className:"form-inline",children:[h(ut,{checked:b,onChange:S,children:"Toggle All"}),h("div",{className:"spacer"}),h(dt,{in:E,timeout:Le.transitionSlowMs,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,children:h(X,{kind:"ghost",className:"btn-reset",onClick:w,children:"Reset"})}),h(X,{kind:"ghost",className:B({active:l===1}),icon:Cr,tooltip:"Sort ascending",onClick:()=>a(1)}),h(X,{kind:"ghost",className:B({active:l===2}),icon:wr,tooltip:"Sort descending",onClick:()=>a(2)})]})}),h("div",{className:"aggregation-edit-item-list",children:h(on,{itemCount:p.length,items:g,offset:s,renderItem:({item:v})=>h(ut,{checked:m(v.value),children:v.displayValue}),onSelect:f,onViewportChange:C,rowHeight:Cp,focusSelector:"input",ref:u})})]})}function Sp(e){return h("svg",{width:48,height:48,xmlns:"http://www.w3.org/2000/svg",...e,children:R("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 bp(e){return h("svg",{width:48,height:48,xmlns:"http://www.w3.org/2000/svg",...e,children:R("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 vp(e){return h("svg",{width:48,height:48,xmlns:"http://www.w3.org/2000/svg",...e,children:R("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 Tp(e){return h("svg",{width:48,height:48,xmlns:"http://www.w3.org/2000/svg",...e,children:R("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 Ep(e){return h("svg",{width:48,height:48,xmlns:"http://www.w3.org/2000/svg",...e,children:R("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 Rp(e){return R("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,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 yp(e){return R("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,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 Al=se.module("ChartBuilder"),Ye=class extends T.exports.PureComponent{static getTypeName(e){switch(e){case I.plot.SeriesPlotStyle.LINE:return"Line";case I.plot.SeriesPlotStyle.BAR:return"Bar";case I.plot.SeriesPlotStyle.SCATTER:return"Scatter";case I.plot.SeriesPlotStyle.PIE:return"Pie";case I.plot.SeriesPlotStyle.HISTOGRAM:return"Histogram";default:return e}}static getTypeIcon(e){switch(e){case I.plot.SeriesPlotStyle.LINE:return h(vp,{});case I.plot.SeriesPlotStyle.BAR:return h(Sp,{});case I.plot.SeriesPlotStyle.SCATTER:return h(Ep,{});case I.plot.SeriesPlotStyle.PIE:return h(Tp,{});case I.plot.SeriesPlotStyle.HISTOGRAM:return h(bp,{});default:return null}}static getMaxSeriesCount(e){switch(e){case I.plot.SeriesPlotStyle.PIE:return 1;case I.plot.SeriesPlotStyle.HISTOGRAM:return 0;default:return 100}}static getXAxisLabel(e){switch(e){case I.plot.SeriesPlotStyle.PIE:return"Labels";case I.plot.SeriesPlotStyle.HISTOGRAM:return"Data";default:return"X-Axis"}}static getSeriesLabel(e){switch(e){case I.plot.SeriesPlotStyle.PIE:return"Values";default:return"Series"}}static makeSeriesItem(e){return{id:sn.generate(),value:e}}static makeDefaultSeriesItems(e,t){if(Ye.getMaxSeriesCount(e)===0||t==null||t.length===0)return[];const s=t.length>1?t[1].name:t[0].name;return[Ye.makeSeriesItem(s)]}static getDefaultXAxis(e,t){return t!=null&&t.length>0?t[0].name:null}constructor(e){super(e),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:t}=e,{columns:n}=t,s=Ye.types[0],o=Ye.getDefaultXAxis(s,n),i=Ye.makeDefaultSeriesItems(s,n);this.state={type:s,seriesItems:i,xAxis:o,isLinked:!0}}handleAddSeries(){this.setState(e=>{const{seriesItems:t}=e,n=[...t],{model:s}=this.props,{columns:o}=s;return n.push({id:sn.generate(),value:o[0].name}),{seriesItems:n}},this.sendChange)}handleLinkStateChange(e){this.setState({isLinked:e.target.value==="true"},this.sendChange)}handleReset(){const{model:e}=this.props,{columns:t}=e,n=Ye.types[0],s=Ye.getDefaultXAxis(n,t),o=Ye.makeDefaultSeriesItems(n,t),i=!0;this.setState({type:n,seriesItems:o,xAxis:s,isLinked:i},this.sendChange)}handleSeriesChange(e){const{value:t}=e.target,n=e.target.getAttribute("data-index"),s=parseInt(n,10);this.setState(o=>{let{seriesItems:i}=o;return i=[...i],i[s].value=t,{seriesItems:i}},this.sendChange)}handleSeriesDeleteClick(e){const n=e.target.getAttribute("data-index"),s=parseInt(n,10);this.setState(o=>{const{seriesItems:i}=o,r=[...i];return r.splice(s,1),{seriesItems:r}},this.sendChange)}handleSubmit(e){e.preventDefault();const{onSubmit:t}=this.props,{type:n,seriesItems:s,xAxis:o,isLinked:i}=this.state,r=s.map(l=>l.value);t({type:`${n}`,series:r,xAxis:o,isLinked:i})}handleTypeClick(e){const n=e.target.getAttribute("data-index"),s=parseInt(n,10),o=Ye.types[s];Al.debug2("handleTypeSelect",o),this.setState(i=>{const r=Ye.getMaxSeriesCount(o);let{seriesItems:l}=i;if(l=l.slice(0,r),l.length===0&&r>0){const{model:a}=this.props,{columns:c}=a;l=Ye.makeDefaultSeriesItems(o,c)}return{type:o,seriesItems:l}},this.sendChange)}handleXAxisChange(e){const t=e.target.value;Al.debug2("x-axis change",t),this.setState({xAxis:t},this.sendChange)}sendChange(){const{onChange:e}=this.props,{isLinked:t,type:n,seriesItems:s,xAxis:o}=this.state,i=s.map(r=>r.value);e({type:n,series:i,xAxis:o,isLinked:t})}render(){const{model:e}=this.props,{columns:t}=e,{seriesItems:n,type:s,xAxis:o,isLinked:i}=this.state,r=Ye.getMaxSeriesCount(s),l=Ye.getXAxisLabel(s),a=Ye.getSeriesLabel(s),c=n.length>0,d=n.length<r;return h("div",{className:"chart-builder",children:R("form",{onSubmit:this.handleSubmit,children:[R("div",{className:"form-row",children:[h("label",{children:"Select Chart Type"}),h("div",{className:"form-row",children:Ye.types.map((u,m)=>{const p=u;return h("div",{className:"col col-chart-type",children:R("button",{type:"button",className:B("btn","btn-icon","btn-chart-type",{active:u===s}),"data-index":m,onClick:this.handleTypeClick,children:[Ye.getTypeIcon(u),Ye.getTypeName(u)]})},p)})})]}),h("hr",{}),R("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:o,onChange:this.handleXAxisChange,children:t.map(u=>h("option",{value:u.name,children:u.name},u.name))})]}),c&&h("hr",{}),n.map((u,m)=>R("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:t.map(p=>h("option",{value:p.name,"data-index":m,children:p.name},p.name))}),n.length>1&&h(X,{kind:"ghost",className:"btn-delete-series ml-2 px-2","data-index":m,"data-testid":`delete-series-${m}`,onClick:this.handleSeriesDeleteClick,icon:yn,tooltip:"Delete"})]},u.id)),d&&R("div",{className:"form-row",children:[h("div",{className:"col-2"}),h(X,{kind:"ghost",className:"btn-add-series mt-1",onClick:this.handleAddSeries,icon:Bs,children:"Add Series"})]}),R("div",{className:"form-row chart-builder-link",children:[h("label",{className:"col-2 label-right",children:R("div",{className:"fa-md fa-layers",children:[h(Z,{mask:br,icon:fi,transform:"right-5 down-5"}),h(Z,{icon:i?ra:Lu,transform:"grow-2 right-8 down-6"})]})}),R(Mr,{onChange:this.handleLinkStateChange,value:`${i}`,children:[h(Tn,{value:"true",children:"Sync State"}),h(Tn,{value:"false",children:"Freeze State"})]})]}),R("div",{className:"form-row",children:[h("div",{className:"col-2 label-right"}),h("div",{className:"col chart-builder-link-info",children:i?"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."})]}),R("div",{className:B("form-row","justify-content-end","my-3"),children:[h(X,{kind:"secondary",className:"btn-reset",onClick:this.handleReset,children:"Reset"}),h(X,{kind:"primary",type:"submit",className:"btn-submit",children:"Create"})]})]})})}};let ja=Ye;ja.types=[I.plot.SeriesPlotStyle.LINE,I.plot.SeriesPlotStyle.BAR,I.plot.SeriesPlotStyle.SCATTER,I.plot.SeriesPlotStyle.PIE];class Za extends T.exports.Component{constructor(t){super(t),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 o;const{value:t,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:t,wordWrap:"on",automaticLayout:!0,...n};if(!this.editorContainer)throw new Error("editorContainer is null");this.editor=vn.create(this.editorContainer,s),this.editor.layout(),(o=this.editor.getModel())==null||o.updateOptions({tabSize:0}),this.editor.onKeyDown(this.handleKeyDown),this.editor.onDidChangeModelContent(this.handleContentChanged),this.editor.onDidFocusEditorText(this.handleEditorFocus),this.editor.onDidBlurEditorText(this.handleEditorBlur)}destroyEditor(){var t;(t=this.editor)==null||t.dispose(),this.editor=void 0}handleContentChanged(){var s,o;const{onContentChanged:t}=this.props,n=(o=(s=this.editor)==null?void 0:s.getModel())==null?void 0:o.getValue();n!==void 0&&this.setState({isEditorEmpty:n.length===0}),t(n)}handleEditorFocus(){this.setState({isEditorFocused:!0})}handleEditorBlur(){var n,s,o;const t=(o=(s=(n=this.editor)==null?void 0:n.getModel())==null?void 0:s.getValue())!=null?o:"";this.setState({isEditorEmpty:t.length===0,isEditorFocused:!1})}handleContainerClick(){var n;const{isEditorFocused:t}=this.state;t||(n=this.editor)==null||n.focus()}handleKeyDown(t){const{onTab:n,editorIndex:s}=this.props;t.code==="Tab"&&(t.stopPropagation(),t.preventDefault(),n(s,t.shiftKey))}render(){const{value:t,invalid:n}=this.props,{isEditorFocused:s,isEditorEmpty:o}=this.state;return R("div",{className:B("input-editor-wrapper",{focused:s,invalid:n}),role:"presentation",onClick:this.handleContainerClick,children:[h("div",{className:"editor-container",ref:i=>{this.editorContainer=i}}),o&&!t&&h("div",{className:"editor-placeholder text-muted",children:"Column Formula"})]})}}Za.defaultProps={value:"",onContentChanged:()=>{},editorSettings:{},editorIndex:0,onTab:()=>{},invalid:!1};const Ol=Object.freeze({NAME:"name",FORMULA:"formula"}),Ip=()=>{};function Mp({eventKey:e,name:t,inputIndex:n,formula:s,onChange:o,onDeleteColumn:i,onTabInEditor:r,invalid:l,isDuplicate:a}){const c=t===""||_t.isValidColumnName(t),d=T.exports.useCallback(u=>{u!==void 0&&(u.replace(/(\r\n|\n|\r)/gm,""),o(e,Ol.FORMULA,u))},[o,e]);return h(cr,{draggableId:e,index:n,disableInteractiveElementBlocking:!0,children:(u,m)=>R("div",{className:B("draggable-container",{dragging:m.isDragging}),ref:u.innerRef,...u.draggableProps,children:[R("div",{className:"custom-column-input-container",children:[R("div",{className:"pb-3",children:[R("div",{className:"d-flex flex-row custom-column-name",children:[h("input",{className:B("form-control custom-column-input",{"is-invalid":l||!c||a}),placeholder:"Column Name",value:t,onChange:p=>{o(e,Ol.NAME,p.target.value)}}),h(X,{kind:"ghost",className:"ml-1 px-2",onClick:()=>{i(e)},icon:yn,tooltip:"Delete custom column"}),h(X,{kind:"ghost",className:"btn-drag-handle",onClick:Ip,...u.dragHandleProps,icon:Ci,tooltip:"Drag column to re-order"})]}),(!c||a)&&h("p",{className:"validate-label-error text-danger mb-0 mt-2 pl-1",children:c?"Duplicate name":"Invalid name"})]}),h(Za,{editorSettings:{language:"deephavenDb"},editorIndex:n,value:s,onContentChanged:d,onTab:r,invalid:l})]}),h("hr",{})]})})}const $i=[];class me extends Ha{constructor(){super(),this.listenerCount=0}addEventListener(t,n,s){super.addEventListener(t,n,s),this.listenerCount+=1,this.listenerCount===1&&this.startListening()}removeEventListener(t,n,s){super.removeEventListener(t,n,s),this.listenerCount-=1,this.listenerCount===0&&this.stopListening()}startListening(){}stopListening(){}get originalColumns(){return this.columns}get layoutHints(){return null}get frontColumns(){return $i}get backColumns(){return $i}get frozenColumns(){return $i}isColumnFrozen(t){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(t){return!1}close(){}isRowMovable(){return!1}get isSeekRowAvailable(){return!1}}me.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 ks=class extends T.exports.Component{constructor(e){super(e),this.getInput=Ie((t,n)=>t.find(s=>s.eventKey===n)),this.getInputIndex=Ie((t,n)=>t.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 sn.generate()}static createCustomColumnInput(){return{eventKey:sn.generate(),name:"",formula:""}}componentDidMount(){const{customColumns:e}=this.props;this.parseCustomColumns(e),this.startListening()}componentWillUnmount(){this.stopListening(),this.successButtonTimer&&clearTimeout(this.successButtonTimer)}resetErrorMessage(){this.setState({errorMessage:null})}startListening(){const{model:e}=this.props;e.addEventListener(me.EVENT.COLUMNS_CHANGED,this.handleCustomColumnUpdated),e.addEventListener(me.EVENT.UPDATED,this.handleCustomColumnUpdated),e.addEventListener(me.EVENT.REQUEST_FAILED,this.handleRequestFailed)}stopListening(){const{model:e}=this.props;e.removeEventListener(me.EVENT.COLUMNS_CHANGED,this.handleCustomColumnUpdated),e.removeEventListener(me.EVENT.UPDATED,this.handleCustomColumnUpdated),e.removeEventListener(me.EVENT.REQUEST_FAILED,this.handleRequestFailed)}parseCustomColumns(e){if(e.length>0){const t=e.map(n=>{const s=n.split(/=(.+)/,2);return{eventKey:ks.makeCustomColumnInputEventKey(),name:s[0],formula:s[1]}});this.setState({inputs:t})}else this.setState({inputs:[ks.createCustomColumnInput()]})}handleAddColumnClick(){const{inputs:e}=this.state,t=[...e];t.push(ks.createCustomColumnInput()),this.setState({inputs:t})}handleDeleteColumn(e){const{inputs:t}=this.state,n=this.getInputIndex(t,e),s=[...t];s.splice(n,1),s.length===0&&s.push(ks.createCustomColumnInput()),this.setState({inputs:s})}handleInputChange(e,t,n){const{inputs:s}=this.state,o=this.getInputIndex(s,e),r={...this.getInput(s,e)};r[t]=n;const l=[...s];l.splice(o,1,r),this.setState({inputs:l})}handleCustomColumnUpdated(){const{isCustomColumnApplying:e}=this.state;!e||this.setState({isCustomColumnApplying:!1,isSuccessShowing:!0},()=>{this.successButtonTimer=setTimeout(()=>this.setState({isSuccessShowing:!1}),ks.SUCCESS_SHOW_DURATION)})}handleRequestFailed(e){const t=e,{isCustomColumnApplying:n}=this.state;!n||this.setState({isCustomColumnApplying:!1,errorMessage:R(Fe,{children:[R("p",{children:[h(Z,{icon:Yn})," Failed to apply custom columns."]}),R("div",{className:"error-box",children:[t.detail.errorMessage,h("br",{}),"Table configuration:"," ",JSON.stringify(t.detail.configuration)]})]}),hasRequestFailed:!0})}handleDragEnd(e){if(gt.stopDragging(),!e.destination)return;const{inputs:t}=this.state,n=e.source.index,s=e.destination.index,o=[...t],i=t[n];o.splice(n,1),o.splice(s,0,i),this.setState({inputs:o})}handleEditorTabNavigation(e,t){var s,o,i,r;const{inputs:n}=this.state;if(t){((s=this.container)==null?void 0:s.querySelectorAll(".btn-drag-handle")[e]).focus();return}if(e===n.length-1)(i=(o=this.container)==null?void 0:o.querySelector(".btn-add-column"))==null||i.focus();else{const l=e+1;((r=this.container)==null?void 0:r.querySelectorAll(".custom-column-input")[l]).focus()}}handleSaveClick(){const{onSave:e,customColumns:t}=this.props,{inputs:n,isCustomColumnApplying:s}=this.state;if(s)return;const o=[];n.forEach(i=>{const{name:r,formula:l}=i;r&&l&&o.push(`${r}=${l}`)}),this.resetErrorMessage(),this.setState({isCustomColumnApplying:o.length>0||t.length>0}),e(o)}resetRequestFailed(){this.setState(({hasRequestFailed:e})=>e?{hasRequestFailed:!1}:null)}renderInputs(){const{inputs:e,hasRequestFailed:t}=this.state,n=new Map;return e.forEach(({name:s})=>{var o;return n.set(s,((o=n.get(s))!=null?o:0)+1)}),e.map((s,o)=>{var c;const{eventKey:i,name:r,formula:l}=s,a=((c=n.get(r))!=null?c:0)>1;return h(Mp,{inputIndex:o,eventKey:i,name:r,formula:l,onChange:this.handleInputChange,onDeleteColumn:this.handleDeleteColumn,onTabInEditor:this.handleEditorTabNavigation,invalid:t,isDuplicate:a},i)})}renderSaveButton(){const{inputs:e,isCustomColumnApplying:t,isSuccessShowing:n}=this.state,s=e.length>1?"Save Columns":"Save Column",o=e.every(({name:l})=>l===""||_t.isValidColumnName(l)),i=e.filter(({name:l})=>l!=="").map(({name:l})=>l),r=new Set(i).size===i.length;return R(X,{kind:n?"success":"primary",className:B("btn-apply",{"btn-spinner":t}),disabled:n||t||!o||!r,onClick:this.handleSaveClick,children:[t&&R("span",{children:[h(Vt,{}),h("span",{className:"btn-normal-content",children:"Applying"})]}),!n&&!t&&s,n&&R(Fe,{children:[h(Z,{icon:aa})," Success"]})]})}render(){const{onCancel:e}=this.props,{errorMessage:t}=this.state;return R("div",{role:"presentation",className:"custom-column-builder-container",ref:n=>{this.container=n},onClick:this.resetRequestFailed,onFocus:this.resetRequestFailed,children:[h("hr",{}),h(gi,{onDragStart:gt.startDragging,onDragEnd:this.handleDragEnd,children:h(pi,{droppableId:"droppable-custom-columns",children:(n,s)=>R("div",{ref:n.innerRef,...n.droppableProps,className:B("droppable-container",{dragging:s.draggingFromThisWith}),children:[this.renderInputs(),n.placeholder]})})}),h("div",{className:"pt-1 px-3",children:h(X,{kind:"ghost",className:"btn-add-column",onClick:this.handleAddColumnClick,icon:Bs,children:"Add Another Column"})}),R("div",{className:"custom-column-builder-footer",children:[t&&h("div",{className:"error-message",children:t}),R("div",{className:"d-flex justify-content-end",children:[h(X,{kind:"secondary",className:"mr-2",onClick:e,children:"Cancel"}),this.renderSaveButton()]})]})]})}};let Ja=ks;Ja.SUCCESS_SHOW_DURATION=750;var ve=(e=>(e.ADVANCED_SETTINGS="ADVANCED_SETTINGS",e.AGGREGATIONS="AGGREGATIONS",e.AGGREGATION_EDIT="AGGREGATIONS_EDIT",e.CHART_BUILDER="CHART_BUILDER",e.CUSTOM_COLUMN_BUILDER="CUSTOM_COLUMN_BUILDER",e.QUICK_FILTERS="QUICK_FILTERS",e.ROLLUP_ROWS="ROLLUP_ROWS",e.SEARCH_BAR="SEARCH_BAR",e.SELECT_DISTINCT="SELECT_DISTINCT",e.TABLE_EXPORTER="TABLE_EXPORTER",e.VISIBILITY_ORDERING_BUILDER="VISIBILITY_ORDERING_BUILDER",e.CONDITIONAL_FORMATTING="CONDITIONAL_FORMATTING",e.CONDITIONAL_FORMATTING_EDIT="CONDITIONAL_FORMATTING_EDIT",e.GOTO="GOTO",e))(ve||{});const no=se.module("RollupRows"),Dp=150,Yo="grouped-rollup-rows",Qo="ungrouped-rollup-rows",Ot=class extends T.exports.Component{constructor(e){super(e),this.search=ft(i=>{const r=this.getSortedUngroupedColumns(),l=[];let a=null;for(let c=0;c<r.length;c+=1)r[c].name.toLowerCase().includes(i.toLowerCase())&&(a==null&&(a=c),l.push([c,c]));O(a),this.setState({ungroupedSelectedRanges:l}),l.length>0&&this.ungroupedList.current&&this.ungroupedList.current.scrollToItem(a)},Dp),this.getCachedUngroupedColumns=he((i,r)=>i.filter(l=>Ot.isGroupable(l)&&r.find(a=>a===l.name)==null)),this.getCachedSortedColumns=he((i,r)=>r==null?[...i]:x.sortColumns(i,r===Ot.SORT.ASCENDING)),this.handleDeleteClicked=this.handleDeleteClicked.bind(this),this.handleSearchChange=this.handleSearchChange.bind(this),this.handleUngroupedSelect=this.handleUngroupedSelect.bind(this),this.handleUngroupedSelectionChange=this.handleUngroupedSelectionChange.bind(this),this.handleDragStart=this.handleDragStart.bind(this),this.handleDragEnd=this.handleDragEnd.bind(this),this.handleGroupedSelectionChange=this.handleGroupedSelectionChange.bind(this),this.handleShowConstituentsChange=this.handleShowConstituentsChange.bind(this),this.handleShowNonAggregatedColumnsChange=this.handleShowNonAggregatedColumnsChange.bind(this),this.handleSortAscending=this.handleSortAscending.bind(this),this.handleSortDescending=this.handleSortDescending.bind(this),this.renderGroupedItem=this.renderGroupedItem.bind(this),this.ungroupedList=te.createRef(),this.groupedList=te.createRef();const{config:t}=e,{columns:n=[],showConstituents:s=!0,showNonAggregatedColumns:o=!0}=t!=null?t:{};this.state={ungroupedSelectedRanges:[],columns:n,groupedSelectedRanges:[],searchFilter:"",showConstituents:s,showNonAggregatedColumns:o,dragSource:null,sort:null}}static renderColumn({item:e,isClone:t,selectedCount:n}){const s=e==null?void 0:e.name,o=t!==void 0&&t?`${n}`:void 0,i=t!==void 0&&t?"item-list-item-clone":"";return bt.renderTextItem({text:s,badgeText:o,className:i})}static addGroupings(e,t,n=e.length){if(t==null||t.length===0)return e;let s=n;const o=e.filter((i,r)=>t.includes(i)?(r<s&&(s-=1),!1):!0);return o.splice(s,0,...t),o}static isGroupable(e){return!x.isDecimalType(e.type)}componentDidUpdate(e,t){const{config:n}=this.props,{columns:s,showConstituents:o,showNonAggregatedColumns:i}=this.state;n!==e.config?this.updateFromConfig():(s!==t.columns||o!==t.showConstituents||i!==t.showNonAggregatedColumns)&&(n==null||s!==n.columns||o!==n.showConstituents||i!==n.showNonAggregatedColumns)&&this.sendChange()}componentWillUnmount(){this.search.cancel()}handleSearchChange(e){const t=e.target.value;if(this.setState({searchFilter:t}),!t){this.search.cancel(),this.resetSelection();return}this.search(t)}handleSortAscending(){this.setState(({sort:e})=>({sort:e===Ot.SORT.ASCENDING?null:Ot.SORT.ASCENDING}))}handleSortDescending(){this.setState(({sort:e})=>({sort:e===Ot.SORT.DESCENDING?null:Ot.SORT.DESCENDING}))}resetSelection(){this.setState({ungroupedSelectedRanges:[],groupedSelectedRanges:[]})}handleDragStart(e){no.debug("handleDragStart",e),document.documentElement.classList.add("drag-pointer-events-none"),this.setState({dragSource:e.source})}handleDragEnd(e){no.debug("handleDragEnd",e),document.documentElement.classList.remove("drag-pointer-events-none"),this.setState({dragSource:null});const{destination:t,source:n}=e;if(t==null||n==null)return;if(t.droppableId===Qo){this.setState(({groupedSelectedRanges:i,columns:r})=>{const l=[...r];return gt.reorder(l,i,[],0),{columns:l,ungroupedSelectedRanges:[],groupedSelectedRanges:[]}});return}const s=n.droppableId===Yo;let o=t.index;s&&n.index<t.index&&(o+=1),this.setState(({columns:i,ungroupedSelectedRanges:r,groupedSelectedRanges:l})=>{const a=[...i],c=s?a:this.getSortedUngroupedColumns().map(g=>g.name),d=s?l:r,u=gt.reorder(c,d,a,o),m=s?gt.adjustDestinationIndex(o,l):o,p=[[m,m+u.length-1]];return{columns:a,ungroupedSelectedRanges:[],groupedSelectedRanges:p}}),this.resetSelection()}handleUngroupedSelect(e){no.debug("handleUngroupedSelect"),this.setState(({columns:t})=>({columns:Ot.addGroupings(t,[this.getSortedUngroupedColumns()[e].name]),ungroupedSelectedRanges:[],groupedSelectedRanges:[]}))}handleUngroupedSelectionChange(e){no.debug2("handleUngroupedSelectionChange",e),this.setState(({ungroupedSelectedRanges:t})=>e===t?null:{ungroupedSelectedRanges:e,groupedSelectedRanges:[]})}handleGroupedSelectionChange(e){no.debug2("handleGroupedSelectedRanges",e),this.setState(({groupedSelectedRanges:t})=>e===t?null:{groupedSelectedRanges:e,ungroupedSelectedRanges:[]})}handleDeleteClicked(e){this.setState(({columns:t})=>{const n=t.slice();return n.splice(e,1),{columns:n}})}handleShowConstituentsChange(){this.setState(({showConstituents:e})=>({showConstituents:!e}))}handleShowNonAggregatedColumnsChange(){this.setState(({showNonAggregatedColumns:e})=>({showNonAggregatedColumns:!e}))}updateFromConfig(){const{config:e}=this.props,{columns:t=[],showConstituents:n=!0,showNonAggregatedColumns:s=!0}=e!=null?e:{};this.setState({columns:t,showConstituents:n,showNonAggregatedColumns:s})}sendChange(){const{onChange:e}=this.props,{columns:t,showConstituents:n,showNonAggregatedColumns:s}=this.state;e({columns:t,showConstituents:n,showNonAggregatedColumns:s})}getUngroupedColumns(){const{model:e}=this.props,{columns:t}=this.state,{originalColumns:n}=e;return this.getCachedUngroupedColumns(n,t)}getSortedUngroupedColumns(){const{sort:e}=this.state,t=this.getUngroupedColumns();return this.getCachedSortedColumns(t,e)}renderGroupedItem({item:e,itemIndex:t,isClone:n,selectedCount:s}){const i=`${n!==void 0&&n?"":"\xA0\xA0".repeat(t)}${e}`,r=n!==void 0&&n?`${s}`:void 0,l=n!==void 0&&n?"item-list-item-clone":"";return R(Fe,{children:[bt.renderTextItem({text:i,badgeText:r,className:l}),(n===void 0||!n)&&h(X,{kind:"ghost",className:"btn btn-link btn-link-icon btn-delete-grouping float-right",onClick:()=>this.handleDeleteClicked(t),children:h(Z,{icon:yn})})]})}render(){const{columns:e,dragSource:t,searchFilter:n,groupedSelectedRanges:s,ungroupedSelectedRanges:o,showConstituents:i,showNonAggregatedColumns:r,sort:l}=this.state,a=this.getSortedUngroupedColumns();let c=e.length*bt.DEFAULT_ROW_HEIGHT;(t==null?void 0:t.droppableId)===Qo&&(c+=bt.DEFAULT_ROW_HEIGHT);const d=a.length*bt.DEFAULT_ROW_HEIGHT+10,u=Math.min(3*bt.DEFAULT_ROW_HEIGHT,d);return h("div",{role:"menu",className:B("rollup-rows",{"is-dragging":t!=null}),tabIndex:0,children:R(gi,{onDragEnd:this.handleDragEnd,onDragStart:this.handleDragStart,children:[R("div",{className:"rollup-rows-group-by",children:[h("div",{className:"section-title",children:"Group By"}),e.length===0&&h(pi,{droppableId:"placeholder",children:(m,p)=>h("div",{className:B("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."})}),e.length>0&&h(bt,{draggingItemClassName:"rollup-rows-dragging-grouped-item",draggablePrefix:Yo,droppableId:Yo,itemCount:e.length,items:e,offset:0,onSelectionChange:this.handleGroupedSelectionChange,ref:this.groupedList,renderItem:this.renderGroupedItem,selectedRanges:s,style:{height:c},isMultiSelect:!0})]}),R("div",{className:"rollup-rows-available-columns",children:[h("div",{className:"section-title",children:"Available Grouping Columns"}),R("div",{className:"top-menu",children:[h(Jn,{className:"w-100",value:n,matchCount:n?o.length:void 0,placeholder:"Find column...",onChange:this.handleSearchChange}),R(X,{kind:"ghost",className:B("btn-link btn-link-icon",{active:l===Ot.SORT.ASCENDING}),onClick:this.handleSortAscending,children:[h(Z,{icon:Cr}),h(We,{children:"Sort ascending"})]}),R(X,{kind:"ghost",className:B("btn-link btn-link-icon",{active:l===Ot.SORT.DESCENDING}),onClick:this.handleSortDescending,children:[h(Z,{icon:wr}),h(We,{children:"Sort descending"})]})]}),h(bt,{className:"rollup-available-grouping-columns",draggablePrefix:Qo,droppableId:Qo,itemCount:a.length,items:a,renderItem:Ot.renderColumn,offset:0,onSelect:this.handleUngroupedSelect,onSelectionChange:this.handleUngroupedSelectionChange,ref:this.ungroupedList,selectedRanges:o,style:{maxHeight:d,minHeight:u},isDropDisabled:(t==null?void 0:t.droppableId)!==Yo,isMultiSelect:!0}),R("div",{className:"bottom-menu",children:[h("div",{className:"label",children:"Show:"}),h(ut,{checked:i,onChange:this.handleShowConstituentsChange,children:"Constituents"}),h(ut,{checked:r,onChange:this.handleShowNonAggregatedColumnsChange,children:"Non-Aggregated Columns"})]})]})]})})}};let _r=Ot;_r.SORT=Object.freeze({ASCENDING:"ASC",DESCENDING:"DESC"});_r.defaultProps={config:null,onChange:()=>{}};const Np=se.module("TableCsvExporter"),Ae=class extends T.exports.Component{static getDateString(){return I.i18n.DateTimeFormat.format(Ae.FILENAME_DATE_FORMAT,new Date)}constructor(e){super(e),this.handleDownloadClick=this.handleDownloadClick.bind(this),this.handleDownloadRowOptionChanged=this.handleDownloadRowOptionChanged.bind(this),this.handleCustomizedDownloadRowOptionChanged=this.handleCustomizedDownloadRowOptionChanged.bind(this),this.handleCustomizedDownloadRowsChanged=this.handleCustomizedDownloadRowsChanged.bind(this),this.handleIncludeColumnHeadersChanged=this.handleIncludeColumnHeadersChanged.bind(this),this.handleIncludeHiddenColumnsChanged=this.handleIncludeHiddenColumnsChanged.bind(this),this.handleUseUnformattedValuesChanged=this.handleUseUnformattedValuesChanged.bind(this);const{name:t}=e;this.state={fileName:`${t}-${Ae.getDateString()}.csv`,downloadRowOption:Ae.DOWNLOAD_ROW_OPTIONS.ALL_ROWS,customizedDownloadRowOption:Ae.CUSTOMIZED_ROWS_OPTIONS.FIRST,customizedDownloadRows:Ae.DEFAULT_DOWNLOAD_ROWS,includeColumnHeaders:!0,includeHiddenColumns:!1,useUnformattedValues:!1,errorMessage:null,id:sn.generate()}}getSnapshotRanges(){const{model:e,selectedRanges:t}=this.props,{downloadRowOption:n,customizedDownloadRowOption:s,customizedDownloadRows:o}=this.state,{rowCount:i,columnCount:r}=e;let l=[];switch(n){case Ae.DOWNLOAD_ROW_OPTIONS.ALL_ROWS:l.push(new ee(0,0,r-1,i-1));break;case Ae.DOWNLOAD_ROW_OPTIONS.SELECTED_ROWS:l=t.map(a=>({...a,startColumn:0,endColumn:r-1})).sort((a,c)=>a.startRow!=null&&c.startRow!=null?a.startRow-c.startRow:0);break;case Ae.DOWNLOAD_ROW_OPTIONS.CUSTOMIZED_ROWS:switch(s){case Ae.CUSTOMIZED_ROWS_OPTIONS.FIRST:l.push(new ee(0,0,r-1,Math.min(o-1,i-1)));break;case Ae.CUSTOMIZED_ROWS_OPTIONS.LAST:l.push(new ee(0,Math.max(0,i-o),r-1,i-1));break}break}return l}getModelRanges(e){const{userColumnWidths:t,movedColumns:n}=this.props,{includeHiddenColumns:s}=this.state,o=ne.getHiddenColumns(t);let i=W.getModelRanges(e,n);if(!s&&o.length>0){const r=o.map(ee.makeColumn);i=ee.subtractRangesFromRanges(i,r)}return i}resetDownloadState(){this.setState({errorMessage:null})}async handleDownloadClick(){const{model:e,isDownloading:t,onDownloadStart:n,onDownload:s,onCancel:o}=this.props,{fileName:i,includeColumnHeaders:r,useUnformattedValues:l}=this.state;if(t){o();return}this.resetDownloadState();const a=this.getSnapshotRanges(),c=this.getModelRanges(a);if(this.validateOptionInput()){n();try{const d=await e.export(),u=d.setViewport(0,0);await u.getViewportData(),s(i,d,u,a,c,r,l)}catch(d){Np.error("CSV download failed",d),this.setState({errorMessage:R("p",{children:[h(Z,{icon:Yn})," ",`${d}`]})}),o()}}}handleDownloadRowOptionChanged(e){this.setState({downloadRowOption:e.target.value})}handleCustomizedDownloadRowOptionChanged(e){this.setState({customizedDownloadRowOption:e.target.value})}handleCustomizedDownloadRowsChanged(e){this.setState({customizedDownloadRows:parseInt(e.target.value,10)})}handleIncludeColumnHeadersChanged(){this.setState(({includeColumnHeaders:e})=>({includeColumnHeaders:!e}))}handleIncludeHiddenColumnsChanged(){this.setState(({includeHiddenColumns:e})=>({includeHiddenColumns:!e}))}handleUseUnformattedValuesChanged(){this.setState(({useUnformattedValues:e})=>({useUnformattedValues:!e}))}validateOptionInput(){const{selectedRanges:e}=this.props,{downloadRowOption:t,customizedDownloadRows:n}=this.state;return t===Ae.DOWNLOAD_ROW_OPTIONS.SELECTED_ROWS&&e.length===0?(this.setState({errorMessage:R("p",{children:[h(Z,{icon:Yn})," No rows selected. Please select some rows in the table."]})}),!1):t===Ae.DOWNLOAD_ROW_OPTIONS.CUSTOMIZED_ROWS&&n<=0?(this.setState({errorMessage:R("p",{children:[h(Z,{icon:Yn})," Number of rows to output must be greater than 0"]})}),!1):!0}render(){const{model:e,isDownloading:t,tableDownloadProgress:n,tableDownloadEstimatedTime:s,selectedRanges:o,tableDownloadStatus:i}=this.props,{fileName:r,downloadRowOption:l,customizedDownloadRowOption:a,customizedDownloadRows:c,includeColumnHeaders:d,includeHiddenColumns:u,useUnformattedValues:m,errorMessage:p,id:g}=this.state,{rowCount:f}=e;return R("div",{className:"table-csv-exporter",children:[h("div",{className:"section-title",children:"Download Rows"}),h("div",{className:"form-group",children:R(Mr,{onChange:this.handleDownloadRowOptionChanged,value:l,disabled:t,children:[R(Tn,{value:Ae.DOWNLOAD_ROW_OPTIONS.ALL_ROWS,"data-testid":"radio-csv-exporter-download-all",children:["All Rows",h("span",{className:"text-muted ml-2",children:`(${f.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1,")} rows)`})]}),R(Tn,{value:Ae.DOWNLOAD_ROW_OPTIONS.SELECTED_ROWS,"data-testid":"radio-csv-exporter-only-selected",children:["Only Selected Rows",h("span",{className:"text-muted ml-2",children:o.length>0?`(${ee.rowCount(o).toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1,")} rows)`:null})]}),h(Tn,{value:Ae.DOWNLOAD_ROW_OPTIONS.CUSTOMIZED_ROWS,"data-testid":"radio-csv-exporter-customized-rows",children:R("div",{className:"radio-input-row",role:"presentation",onClick:()=>{this.setState({downloadRowOption:Ae.DOWNLOAD_ROW_OPTIONS.CUSTOMIZED_ROWS})},children:[R("select",{value:a,"data-testid":"select-csv-exporter-customized-rows",className:"custom-select",disabled:t,onChange:this.handleCustomizedDownloadRowOptionChanged,children:[h("option",{value:"FIRST",children:"First"}),h("option",{value:"LAST",children:"Last"})]}),h("input",{type:"number",className:"form-control",id:`customizedRows-${g}`,"data-testid":"input-csv-exporter-customized-rows",name:`customizedRows-${g}`,placeholder:"100",value:c,disabled:t,onChange:this.handleCustomizedDownloadRowsChanged}),h("div",{children:"Rows"})]})})]})}),R("div",{className:"form-group",children:[h("label",{htmlFor:`customizedRows-${g}`,children:"File Name"}),h("input",{type:"text",className:"form-control",id:`filename-${g}`,"data-testid":"input-csv-exporter-file-name",name:`filename-${g}`,value:r,onChange:w=>{this.setState({fileName:w.target.value})},disabled:t})]}),R("div",{className:"checkbox-options",children:[h(ut,{checked:d,onChange:this.handleIncludeColumnHeadersChanged,children:"Include column headers"}),h(ut,{checked:u,onChange:this.handleIncludeHiddenColumnsChanged,children:"Include hidden columns"}),h(ut,{checked:m,onChange:this.handleUseUnformattedValuesChanged,children:"Use unformatted values"})]}),R("div",{className:"section-footer flex-column",children:[p!=null&&h("div",{className:"error-message",children:p}),i&&R("div",{className:"download-status",children:[(i===Ae.DOWNLOAD_STATUS.DOWNLOADING||i===Ae.DOWNLOAD_STATUS.INITIATING)&&R(Fe,{children:[i===Ae.DOWNLOAD_STATUS.INITIATING&&h("div",{className:"text-muted",children:"Starting Download..."}),i===Ae.DOWNLOAD_STATUS.DOWNLOADING&&R("div",{className:"text-muted d-flex justify-content-between",children:[h("span",{children:s||s===0?`Estimated time: ${tn.formatElapsedTime(s)}`:null}),h("span",{children:`${n}%`})]})]}),i===Ae.DOWNLOAD_STATUS.FINISHED&&h("div",{className:"text-muted text-right",children:"Download Completed"}),i===Ae.DOWNLOAD_STATUS.CANCELED&&h("div",{className:"text-muted",children:"Download Canceled"}),(i===Ae.DOWNLOAD_STATUS.DOWNLOADING||i===Ae.DOWNLOAD_STATUS.INITIATING)&&h("div",{className:"progress",children:h("div",{className:"progress-bar progress-bar-striped progress-bar-animated",style:{width:`${n}%`}})}),i===Ae.DOWNLOAD_STATUS.FINISHED&&h("div",{className:"progress",children:h("div",{className:"progress-bar bg-success",style:{width:`${n}%`}})})]}),R(X,{kind:"primary","data-testid":"btn-csv-exporter-download",className:B("btn-downloading",{"btn-spinner btn-cancelable":t}),onClick:this.handleDownloadClick,children:[t&&R("span",{children:[h(Vt,{}),h("span",{className:"btn-normal-content",children:"Downloading"}),h("span",{className:"btn-hover-content",children:"Cancel"})]}),!t&&"Download"]})]})]})}};let Tt=Ae;Tt.FILENAME_DATE_FORMAT="yyyy-MM-dd-HHmmss";Tt.DOWNLOAD_STATUS={INITIATING:"INITIATING",DOWNLOADING:"DOWNLOADING",FINISHED:"FINISHED",CANCELED:"CANCELED"};Tt.DOWNLOAD_ROW_OPTIONS={ALL_ROWS:"ALL_ROWS",SELECTED_ROWS:"SELECTED_ROWS",CUSTOMIZED_ROWS:"CUSTOMIZED_ROWS"};Tt.CUSTOMIZED_ROWS_OPTIONS={FIRST:"FIRST",LAST:"LAST"};Tt.DEFAULT_DOWNLOAD_ROWS=100;Tt.defaultProps={onDownloadStart:()=>{},isDownloading:!1,tableDownloadStatus:"",tableDownloadProgress:0,tableDownloadEstimatedTime:null,selectedRanges:[]};const hn=se.module("TableSaver"),Fp="yyyy-MM-dd'T'HH:mm:ss.SSSSSSSSS z";function xp(e){return e.added!==void 0}function Ap(e){if(!xp(e))throw new Error("event is not UpdateEventData")}const Bn=class extends T.exports.PureComponent{constructor(e){var t,n;super(e),this.WritableStream=(t=window.WritableStream)!=null?t:jr,this.getCachedCustomColumnFormatFlag=Et(ms.isCustomColumnFormatDefined,{max:1e4}),this.handlePortMessage=this.handlePortMessage.bind(this),this.handleSnapshotResolved=this.handleSnapshotResolved.bind(this),this.handleDownloadTimeout=this.handleDownloadTimeout.bind(this),this.state={},this.gridRanges=[],this.gridRangeCounter=0,this.rangedSnapshotsTotal=[],this.rangedSnapshotCounter=0,this.includeColumnHeaders=!0,this.useUnformattedValues=!1,this.snapshotsTotal=0,this.snapshotCounter=0,this.snapshotsBuffer=new Map,this.currentSnapshotIndex=0,this.snapshotPending=0,this.cancelableSnapshots=[],this.WritableStream=(n=window.WritableStream)!=null?n:jr,this.iframes=[],this.useBlobFallback=!1}static csvEscapeString(e){return`"${e.replace(/"/g,'""')}"`}componentDidMount(){const{getDownloadWorker:e}=this.props;e().then(t=>{hn.info("found active service worker"),this.sw=t,this.sw.postMessage("ping")}).catch(t=>{hn.warn("Download csv is not optimized.",t),this.useBlobFallback=!0})}componentWillUnmount(){this.iframes.length>0&&this.iframes.forEach(e=>{e.remove()}),this.streamTimeout&&clearTimeout(this.streamTimeout),this.snapshotHandlerTimeout&&clearTimeout(this.snapshotHandlerTimeout)}createWriterStream(e){const t=this.useBlobFallback,n=[];let s=null;t&&(s=TextEncoder.prototype.encode.bind(new TextEncoder));const{fileName:o}=this,i={};return t?(i.write=r=>{O(s),r.header!==void 0&&n.push(s(r.header)),r.rows!==void 0&&n.push(s(r.rows))},i.close=()=>{O(o);const r=new Blob(n,{type:"application/octet-stream; charset=utf-8"}),l=document.createElement("a");l.href=URL.createObjectURL(r),l.download=o,l.click()},i.abort=()=>{e.postMessage({cancel:!0}),e.close()}):(i.write=r=>{e.postMessage(r)},i.close=()=>{e.postMessage({end:!0}),e.close()},i.abort=()=>{e.postMessage({cancel:!0}),e.close()}),new this.WritableStream(i)}startDownload(e,t,n,s,o,i,r){const{isDownloading:l}=this.props;if(l)return;this.downloadStartTime=Date.now(),hn.info(`start downloading ${e}`),this.table=t,this.columns=ne.columnsFromRanges(o,t.columns),this.tableSubscription=n,this.gridRanges=s,this.includeColumnHeaders=i,this.useUnformattedValues=r;const a=encodeURIComponent(e.replace(/\//g,":")).replace(/['()]/g,escape).replace(/\*/g,"%2A"),c=new MessageChannel;if(this.port=c.port1,this.fileName=e,this.fileWriter=this.createWriterStream(this.port).getWriter(),this.useBlobFallback){this.writeCsvTable(i);return}this.sw&&this.sw.postMessage({encodedFileName:a},[c.port2]),this.port.onmessage=this.handlePortMessage}finishDownload(){this.table&&this.table.close(),this.tableSubscription&&this.tableSubscription.close(),this.fileWriter&&this.fileWriter.close();const{onDownloadCompleted:e}=this.props;e(),this.resetTableSaver(),this.downloadStartTime!==void 0&&hn.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(t=>{t&&(t.catch(()=>null),t.cancel())});const{onDownloadCanceled:e}=this.props;e(),this.resetTableSaver()}resetTableSaver(){this.table=void 0,this.tableSubscription=void 0,this.columns=void 0,this.chunkRows=void 0,this.gridRanges=[],this.gridRangeCounter=0,this.rangedSnapshotsTotal=[],this.rangedSnapshotCounter=0,this.includeColumnHeaders=!0,this.useUnformattedValues=!1,this.snapshotsTotal=0,this.snapshotCounter=0,this.snapshotsBuffer=new Map,this.currentSnapshotIndex=0,this.snapshotPending=0,this.cancelableSnapshots=[],this.streamTimeout!=null&&clearTimeout(this.streamTimeout),this.snapshotHandlerTimeout!=null&&clearTimeout(this.snapshotHandlerTimeout),this.streamTimeout=void 0,this.snapshotHandlerTimeout=void 0}handleDownloadTimeout(){hn.info("download canceled"),this.cancelDownload()}writeTableHeader(){var t;let e="";if(this.columns)for(let n=0;n<this.columns.length;n+=1)e+=this.columns[n].name,e+=n===this.columns.length-1?`
|
|
5
|
-
`:",";(t=this.fileWriter)==null||t.write({header:e}).then(()=>null)}startWriteTableBody(){this.columns&&this.gridRanges!=null&&(this.chunkRows=Math.floor(
|
|
4
|
+
`;S(N),g(!0),b(N)}else M(H.shiftKey?Pt.UP:Pt.DOWN);break;case"Tab":H.preventDefault(),M(H.shiftKey?Pt.LEFT:Pt.RIGHT);break;case"ArrowDown":case"ArrowUp":case"ArrowLeft":case"ArrowRight":f&&(H.preventDefault(),M(_h(H.key)));break}},[v,M,f,S,g,b,C]),V=T.exports.useCallback(H=>{a(H)},[a]);return h("textarea",{ref:d,className:B("grid-cell-input-field",t),value:C,onBlur:A,onChange:E,onKeyDown:F,onContextMenu:V,onClick:y,autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:"false",disabled:n,style:c})}Or.propTypes={selectionRange:D.exports.arrayOf(D.exports.number),className:D.exports.string,disabled:D.exports.bool,isQuickEdit:D.exports.bool,value:D.exports.string,onChange:D.exports.func,onCancel:D.exports.func,onDone:D.exports.func,onContextMenu:D.exports.func,style:D.exports.shape({})};Or.defaultProps={selectionRange:null,className:"",disabled:!1,value:"",isQuickEdit:!0,onChange:()=>{},onCancel:()=>{},onDone:()=>{},onContextMenu:()=>{},style:{}};const Vh=te.createContext({}),ls=class extends T.exports.PureComponent{constructor(e){super(e),this.getCachedKeyHandlers=Ie(l=>[...l,...this.keyHandlers].sort((a,c)=>a.order-c.order)),this.getCachedMouseHandlers=Ie(l=>[...l,...this.mouseHandlers].sort((a,c)=>a.order-c.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:t,isStuckToRight:n,metricCalculator:s,movedColumns:o,movedRows:i,renderer:r}=e;this.renderer=r||new gs,this.metricCalculator=s||new Co,this.canvas=null,this.canvasContext=null,this.animationFrame=null,this.prevMetrics=null,this.metrics=null,this.documentCursor=null,this.dragTimer=null,this.keyHandlers=[new Oh(400),new Hh(450),new xh(500),new Ah(900)],this.mouseHandlers=[new xr(100),new Ti(200),new Dh(300),new Mh(400),new Fh(450),new Ar(500),new Fr(600),new Nh(700),new Vs(800),new yh(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:o,movedRows:i,cursorRow:null,cursorColumn:null,selectionStartRow:null,selectionStartColumn:null,selectionEndRow:null,selectionEndColumn:null,selectedRanges:ye,lastSelectedRanges:ye,cursor:null,editingCell:null,isStuckToBottom:t,isStuckToRight:n}}static getScale(e){var o,i,r,l,a;const t=window.devicePixelRatio||1,n=e,s=(a=(l=(r=(i=(o=n.webkitBackingStorePixelRatio)!=null?o:n.mozBackingStorePixelRatio)!=null?i:n.msBackingStorePixelRatio)!=null?r:n.oBackingStorePixelRatio)!=null?l:n.backingStorePixelRatio)!=null?a:1;return t/s}static getCursorClassName(e){return e!=null&&e!==""?`grid-cursor-${e}`:null}componentDidMount(){var n;this.initContext(),(n=this.canvas)==null||n.addEventListener("wheel",this.handleWheel,{passive:!1}),window.addEventListener("resize",this.handleResize),this.updateCanvasScale(),this.updateCanvas();const{isStuckToBottom:e,isStuckToRight:t}=this.props;e&&this.scrollToBottom(),t&&this.scrollToRight()}componentDidUpdate(e,t){const{isStickyBottom:n,isStickyRight:s,movedColumns:o,movedRows:i,onMovedColumnsChanged:r,onMoveColumnComplete:l,onMovedRowsChanged:a,onMoveRowComplete:c}=this.props,{isStickyBottom:d,isStickyRight:u,movedColumns:m,movedRows:p}=e,{movedColumns:g,movedRows:f}=t,{draggingColumn:w,draggingRow:C,movedColumns:S,movedRows:b}=this.state;if(m!==o&&this.setState({movedColumns:o}),p!==i&&this.setState({movedRows:i}),g!==S&&r(S),t.draggingColumn!=null&&w==null&&l(S),f!==b&&a(b),t.draggingRow!=null&&C==null&&c(b),n!==d&&this.setState({isStuckToBottom:!1}),s!==u&&this.setState({isStuckToRight:!1}),this.updateMetrics(),this.requestUpdateCanvas(),!this.metrics||!this.prevMetrics)return;const{rowCount:E,columnCount:v,height:y,width:M}=this.metrics,{rowCount:A,columnCount:F,height:V,width:H}=this.prevMetrics;if(A!==E||y!==V){const{isStuckToBottom:N}=this.state;N&&this.scrollToBottom()}if(F!==v||M!==H){const{isStuckToRight:N}=this.state;N&&this.scrollToRight()}this.validateSelection()&&this.checkSelectionChange(t)}componentWillUnmount(){var e;this.animationFrame!=null&&cancelAnimationFrame(this.animationFrame),(e=this.canvas)==null||e.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:e}=this.props;return ls.getTheme(this.context,e)}getGridPointFromEvent(e){Sl(this.canvas);const t=this.canvas.getBoundingClientRect(),n=e.clientX-t.left,s=e.clientY-t.top;return this.getGridPointFromXY(n,s)}getGridPointFromXY(e,t){if(!this.metrics)throw new Error("metrics must be set");return W.getGridPointFromXY(e,t,this.metrics)}getMetricState(e=this.state){const t=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 o=this.canvasContext,i=this.canvas.clientWidth,r=this.canvas.clientHeight,{left:l,top:a,leftOffset:c,topOffset:d,movedColumns:u,movedRows:m,isDraggingHorizontalScrollBar:p,isDraggingVerticalScrollBar:g,draggingColumn:f}=e;return{left:l,top:a,leftOffset:c,topOffset:d,width:i,height:r,context:o,theme:t,model:n,movedColumns:u,movedRows:m,isDraggingHorizontalScrollBar:p,isDraggingVerticalScrollBar:g,draggingColumn:f,...s}}getKeyHandlers(){const{keyHandlers:e}=this.props;return this.getCachedKeyHandlers(e)}getMouseHandlers(){const{mouseHandlers:e}=this.props;return this.getCachedMouseHandlers(e)}getModelColumn(e){var n,s;const t=(s=(n=this.metrics)==null?void 0:n.modelColumns)==null?void 0:s.get(e);if(t===void 0)throw new Error(`Unable to get ModelIndex for column ${e}`);return t}getModelRow(e){var n,s;const t=(s=(n=this.metrics)==null?void 0:n.modelRows)==null?void 0:s.get(e);if(t===void 0)throw new Error(`Unable to get ModelIndex for row ${e}`);return t}toggleRowExpanded(e,t=!1){const n=this.getModelRow(e),{model:s}=this.props;ke(s)&&s.isRowExpandable(n)&&s.setRowExpanded(n,!s.isRowExpanded(n),t),this.clearSelectedRanges(),this.commitSelection(),this.moveCursorToPosition(0,e),this.commitSelection(),this.setState({isStuckToBottom:!1})}scrollToBottom(){if(!this.metrics)return;const{bottomVisible:e,rowCount:t,top:n,lastTop:s}=this.metrics;(e<t-1&&e>0||n>s)&&this.setState({top:s})}scrollToRight(){if(!this.metrics)return;const{rightVisible:e,columnCount:t,left:n,lastLeft:s}=this.metrics;(e<t-1&&e>0||n>s)&&this.setState({left:s})}setSelectedRanges(e){const{model:t}=this.props,{columnCount:n,rowCount:s}=t,{cursorRow:o,cursorColumn:i,selectedRanges:r}=this.state;if(this.setState({selectedRanges:e,lastSelectedRanges:r}),e.length>0){const l=ee.boundedRange(e[0],n,s);let a=o,c=i;l.containsCell(i,o)||({row:a,column:c}=l.startCell()),this.setState({selectionStartColumn:l.startColumn,selectionStartRow:l.startRow,selectionEndColumn:l.endColumn,selectionEndRow:l.endRow,cursorColumn:c,cursorRow:a})}}initContext(){const{canvas:e}=this,{canvasOptions:t}=this.props;if(!e)throw new Error("Canvas not set");this.canvasContext=e.getContext("2d",t)}requestUpdateCanvas(){this.animationFrame==null&&(this.animationFrame=requestAnimationFrame(()=>{if(this.animationFrame=null,!this.metrics)throw new Error("Metrics not set");this.updateCanvas(this.metrics)}))}updateCanvas(e=this.updateMetrics()){this.updateCanvasScale();const{onViewChanged:t}=this.props;t(e),this.drawCanvas(e)}updateCanvasScale(){const{canvas:e,canvasContext:t}=this;if(!e)throw new Error("canvas not set");if(!t)throw new Error("canvasContext not set");if(!e.parentElement)throw new Error("Canvas has no parent element");const n=ls.getScale(t),s=e.parentElement.getBoundingClientRect(),o=Math.floor(s.width),i=Math.floor(s.height);e.style.width=`${o}px`,e.style.height=`${i}px`,e.width=o*n,e.height=i*n,t.scale(n,n)}updateScrollBounds(){if(!this.metrics)throw new Error("metrics not set");const{left:e,top:t}=this.state,{lastLeft:n,lastTop:s}=this.metrics;e>n&&this.setState({left:n,leftOffset:0}),t>s&&this.setState({top:s,topOffset:0})}updateMetrics(e=this.state){this.prevMetrics=this.metrics;const{metricCalculator:t}=this,n=this.getMetricState(e);return this.metrics=t.getMetrics(n),this.updateScrollBounds(),this.metrics}checkSelectionChange(e){const{selectedRanges:t}=e,{selectedRanges:n}=this.state;if(n!==t){const{onSelectionChanged:s}=this.props;s(n)}}validateSelection(){const{model:e}=this.props,{selectedRanges:t}=this.state,{columnCount:n,rowCount:s}=e;for(let o=0;o<t.length;o+=1){const i=t[o];if(i.endColumn!=null&&i.endColumn>=n||i.endRow!=null&&i.endRow>=s)return this.setState({selectedRanges:[],lastSelectedRanges:[]}),!1}return!0}clearSelectedRanges(){const{selectedRanges:e}=this.state;this.setState({selectedRanges:[],lastSelectedRanges:e})}trimSelectedRanges(){const{selectedRanges:e}=this.state;e.length>0&&this.setState({selectedRanges:e.slice(e.length-1)})}beginSelection(e,t){this.setState({selectionStartColumn:e,selectionStartRow:t,selectionEndColumn:e,selectionEndRow:t,cursorColumn:e,cursorRow:t})}moveSelection(e,t,n=!1,s=!1){this.setState(o=>{var g,f,w,C;const{selectedRanges:i,selectionStartRow:r,selectionStartColumn:l}=o,{theme:a}=this.props,{autoSelectRow:c,autoSelectColumn:d}=a;if(n&&i.length>0){const S=i[i.length-1];let b=null,E=null,v=null,y=null;s?(b=c!==void 0&&c?null:Math.min(e!=null?e:0,(g=S.startColumn)!=null?g:0),E=d!==void 0&&d?null:Math.min(t!=null?t:0,(f=S.startRow)!=null?f:0),v=c!==void 0&&c?null:Math.max(e!=null?e:0,(w=S.endColumn)!=null?w:0),y=d!==void 0&&d?null:Math.max(t!=null?t:0,(C=S.endRow)!=null?C:0)):(b=S.startColumn,E=S.startRow,(l!=null||r!=null)&&((c===void 0||!c)&&(b=l),(d===void 0||!d)&&(E=r)),v=c!==void 0&&c?null:e,y=d!==void 0&&d?null:t);const M=ee.makeNormalized(b,E,v,y);if(S.equals(M))return null;const A=[...i];return A[A.length-1]=M,{selectedRanges:A,selectionEndColumn:e,selectionEndRow:t}}const u=[...i],m=c!==void 0&&c?null:e,p=d!==void 0&&d?null:t;return u.push(ee.makeNormalized(m,p,m,p)),{selectedRanges:u,selectionEndColumn:e,selectionEndRow:t}})}commitSelection(){this.setState(e=>{const{theme:t}=this.props,{autoSelectRow:n}=t,{selectedRanges:s,lastSelectedRanges:o,cursorRow:i,cursorColumn:r}=e;if(s.length===1&&(n!==void 0&&n?ee.rowCount(s)===1:ee.cellCount(s)===1)&&ee.rangeArraysEqual(s,o))return{selectedRanges:[],lastSelectedRanges:[],cursorColumn:null,cursorRow:null};let l=s.slice();if(l.length>1){const d=l[l.length-1];for(let u=0;u<l.length-1;u+=1){const m=l[u];if(m.contains(d)){const p=m.subtract(d);l.pop(),l.splice(u,1),l=l.concat(p);break}}l=ee.consolidate(l)}let a=r,c=i;if(!ee.containsCell(l,r,i)){const{model:d}=this.props,{columnCount:u,rowCount:m}=d,p=ee.nextCell(ee.boundedRanges(s,u,m));p!=null?{column:a,row:c}=p:(a=null,c=null)}return l.length===0&&(a=null,c=null),{cursorRow:c,cursorColumn:a,selectedRanges:l,lastSelectedRanges:s}})}setFocusRow(e){var u;if(!this.metrics||!this.prevMetrics)return;const{gridY:t,height:n,lastTop:s,userRowHeights:o,rowHeight:i}=this.metrics,r=n-t,l=Math.round(r/2)+((u=o.get(e))!=null?u:i),a=this.getMetricState(),c=this.metricCalculator.getLastTop(a,e+1,l);this.setState({top:Math.min(s,c),selectedRanges:[new ee(null,e,null,e)],isStuckToBottom:!1});const{cursorColumn:d}=this.state;this.moveCursorToPosition(d,e,!1,!1)}selectAll(){const{model:e,theme:t}=this.props,{autoSelectRow:n,autoSelectColumn:s}=t,o=s!==void 0&&s?null:0,i=s!==void 0&&s?null:e.rowCount-1,r=n!==void 0&&n?null:0,l=n!==void 0&&n?null:e.columnCount-1;this.setSelectedRanges([new ee(r,o,l,i)])}moveCursor(e,t,n){const{cursorRow:s,cursorColumn:o,selectionEndColumn:i,selectionEndRow:r}=this.state,l=n?i:o,a=n?r:s;if(a===null||l===null){const{left:c,top:d}=this.state;this.moveCursorToPosition(c,d,n)}else{const{model:c}=this.props,{columnCount:d,rowCount:u}=c,m=ze(l+e,0,d-1),p=ze(a+t,0,u-1);this.moveCursorToPosition(m,p,n)}}moveCursorInDirection(e=ee.SELECTION_DIRECTION.DOWN){var c;const{model:t}=this.props,{columnCount:n,rowCount:s}=t,{cursorRow:o,cursorColumn:i,selectedRanges:r}=this.state,l=r.length>0?r:[ee.makeCell(i,o)];let a=null;if(l.length===1&&ee.cellCount(l)===1){const d=new ee(0,0,n-1,s-1);a=(c=d.nextCell(i,o,e))!=null?c:d.startCell(e)}else a=ee.nextCell(ee.boundedRanges(l,n,s),i,o,e);if(a!=null){const{column:d,row:u}=a;this.setState({cursorColumn:d,cursorRow:u}),ee.containsCell(r,d,u)||this.setState({selectedRanges:[ee.makeCell(d,u)],selectionStartColumn:d,selectionStartRow:u,selectionEndColumn:d,selectionEndRow:u}),this.moveViewToCell(a.column,a.row)}}moveCursorToPosition(e,t,n=!1,s=!0,o=!1){n||this.beginSelection(e,t),this.moveSelection(e,t,n,o),s&&this.moveViewToCell(e,t)}moveViewToCell(e,t){if(!this.metrics)throw new Error("metrics not set");const{metricCalculator:n}=this,{bottomVisible:s,rightVisible:o,topVisible:i,leftVisible:r}=this.metrics,l=this.getMetricState(this.state);let{top:a,left:c,topOffset:d,leftOffset:u}=this.state;t!=null&&!W.isFloatingRow(t,this.metrics)&&(t<i?(a=n.getTopForTopVisible(l,t),d=0):t>s&&(a=n.getTopForBottomVisible(l,t),d=0)),e!=null&&!W.isFloatingColumn(e,this.metrics)&&(e<r?(c=n.getLeftForLeftVisible(l,e),u=0):e>o&&(c=n.getLeftForRightVisible(l,e),u=0)),this.setViewState({top:a,left:c,topOffset:d,leftOffset:u})}setViewState(e,t=!1){if(!this.metrics)throw new Error("metrics not set");const{isStickyBottom:n,isStickyRight:s}=this.props,{top:o,left:i}=e,{lastTop:r,lastLeft:l}=this.metrics;o!=null&&this.setState({isStuckToBottom:n&&o>=r}),i!=null&&this.setState({isStuckToRight:s&&i>=l}),this.setState(e),t&&this.forceUpdate()}startEditing(e,t,n=!1,s,o){const{model:i}=this.props;if(!He(i))throw new Error("model is not editable");const r=this.getModelColumn(e),l=this.getModelRow(t),a={column:e,row:t,selectionRange:s,value:o!==void 0?o:i.editValueForCell(r,l),isQuickEdit:n};this.setState({editingCell:a,cursorColumn:e,cursorRow:t}),this.moveViewToCell(e,t)}isValidForCell(e,t,n){const{model:s}=this.props,o=this.getModelColumn(e),i=this.getModelRow(t);return He(s)&&s.isValidForCell(o,i,n)}async pasteValue(e){const{model:t}=this.props,{movedColumns:n,movedRows:s,selectedRanges:o}=this.state;try{if(bl(t),!t.isEditable||!o.every(u=>t.isEditableRange(u)))throw new Ui("Can't paste in to read-only area.");if(o.length<=0)throw new Ui("Select an area to paste to.");if(typeof e=="string"){const u=[],m=W.getModelRanges(o,n,s);ee.forEachCell(m,(p,g)=>{u.push({column:p,row:g,text:e})}),await t.setValues(u);return}const i=e.length,r=e[0].length,{columnCount:l,rowCount:a}=t;let c=o;if(c.every(u=>{var m,p;return ee.cellCount([u])===1&&((m=u.startColumn)!=null?m:0)+r<=l&&((p=u.startRow)!=null?p:0)+i<=a})&&(c=c.map(u=>{var m,p;return new ee(u.startColumn,u.startRow,((m=u.startColumn)!=null?m:0)+r-1,((p=u.startRow)!=null?p:0)+i-1)}),this.setSelectedRanges(c)),!c.every(u=>ee.rowCount([u])===i&&ee.columnCount([u])===r))throw new Ui("Copy and paste area are not same size.");const d=[];c.forEach(u=>{var m,p;for(let g=0;g<r;g+=1)for(let f=0;f<i;f+=1)d.push({column:((m=u.startColumn)!=null?m:0)+g,row:((p=u.startRow)!=null?p:0)+f,text:e[f][g]})}),await t.setValues(d)}catch(i){const{onError:r}=this.props;r(i instanceof Error?i:new Error(`${i}`))}}setValueForCell(e,t,n){const{model:s}=this.props;bl(s);const o=this.getModelColumn(e),i=this.getModelRow(t);return s.isValidForCell(o,i,n)?(s.setValueForCell(o,i,n),!0):!1}setValueForRanges(e,t){const{model:n}=this.props,{movedColumns:s,movedRows:o}=this.state,i=W.getModelRanges(e,s,o);He(n)&&n.setValueForRanges(i,t)}isSelected(e,t){var s,o;const{selectedRanges:n}=this.state;for(let i=0;i<n.length;i+=1){const r=n[i],l=r.startRow===null||r.startRow<=e&&e<=((s=r.endRow)!=null?s:0),a=r.startColumn===null||r.startColumn<=t&&t<=((o=r.endColumn)!=null?o:0);if(l&&a)return!0}return!1}addDocumentCursor(e=null){this.documentCursor!==ls.getCursorClassName(e)&&(this.documentCursor!=null&&document.documentElement.classList.remove(this.documentCursor),this.documentCursor=ls.getCursorClassName(e),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(e){this.stopDragTimer();const t=new MouseEvent("custom",e.nativeEvent);this.dragTimer=setTimeout(()=>{this.handleMouseDrag(t)},ls.dragTimeout)}stopDragTimer(){this.dragTimer&&(clearTimeout(this.dragTimer),this.dragTimer=null)}drawCanvas(e=this.updateMetrics()){if(!this.canvas)throw new Error("canvas is not set");if(!this.canvasContext)throw new Error("context not set");const{cursorColumn:t,cursorRow:n,draggingColumn:s,draggingColumnSeparator:o,draggingRow:i,draggingRowOffset:r,draggingRowSeparator:l,editingCell:a,isDraggingHorizontalScrollBar:c,isDraggingVerticalScrollBar:d,isDragging:u,mouseX:m,mouseY:p,selectedRanges:g}=this.state,{model:f,stateOverride:w}=this.props,{renderer:C}=this,S=this.canvasContext,b=this.getTheme(),E=this.canvas.clientWidth,v=this.canvas.clientHeight,y={width:E,height:v,context:S,theme:b,model:f,metrics:e,mouseX:m,mouseY:p,selectedRanges:g,draggingColumn:s,draggingColumnSeparator:o,draggingRow:i,draggingRowOffset:r,draggingRowSeparator:l,editingCell:a,isDraggingHorizontalScrollBar:c,isDraggingVerticalScrollBar:d,isDragging:u,cursorColumn:t,cursorRow:n,...w};S.save(),C.drawCanvas(y),S.restore()}focus(){var e;(e=this.canvas)==null||e.focus()}isFocused(){return document.activeElement===this.canvas}handleClick(e){var s;const t=this.getGridPointFromEvent(e),n=this.getMouseHandlers();for(let o=0;o<n.length;o+=1)if(n[o].onClick(t,this,e)!==!1){e.stopPropagation(),e.preventDefault();break}(s=this.canvas)==null||s.focus()}handleContextMenu(e){const t=this.getGridPointFromEvent(e),n=this.getMouseHandlers();for(let s=0;s<n.length;s+=1)if(n[s].onContextMenu(t,this,e)!==!1){e.stopPropagation(),e.preventDefault();break}}handleKeyDown(e){var n,s;const t=this.getKeyHandlers();for(let o=0;o<t.length;o+=1){const r=t[o].onDown(e,this);if(r!==!1){const l=r;((n=l==null?void 0:l.stopPropagation)==null||n)&&e.stopPropagation(),((s=l==null?void 0:l.preventDefault)==null||s)&&e.preventDefault();break}}}notifyMouseHandlers(e,t,n=!0,s=!1){var l,a;const o=this.getGridPointFromEvent(t),i=this.getMouseHandlers();let r=null;for(let c=0;c<i.length;c+=1){const d=i[c],u=d[e]!=null&&d[e](o,this,t);if(u!==!1){d.cursor!=null&&({cursor:r}=d,s&&this.addDocumentCursor(r));const m=u;((l=m==null?void 0:m.stopPropagation)==null||l)&&t.stopPropagation(),((a=m==null?void 0:m.preventDefault)==null||a)&&t.preventDefault();break}}if(this.setState({cursor:r}),n){const{x:c,y:d}=o;this.setState({mouseX:c,mouseY:d})}}handleMouseDown(e){window.addEventListener("mousemove",this.handleMouseDrag,!0),window.addEventListener("mouseup",this.handleMouseUp,!0),!(e.button!=null&&e.button!==0)&&(this.notifyMouseHandlers("onDown",e),this.startDragTimer(e))}handleDoubleClick(e){this.notifyMouseHandlers("onDoubleClick",e)}handleMouseMove(e){this.notifyMouseHandlers("onMove",e)}handleMouseLeave(e){this.notifyMouseHandlers("onLeave",e,!1),this.setState({mouseX:null,mouseY:null})}handleMouseDrag(e){this.setState({isDragging:!0}),this.notifyMouseHandlers("onDrag",e,!0,!0),this.stopDragTimer()}handleMouseUp(e){window.removeEventListener("mousemove",this.handleMouseDrag,!0),window.removeEventListener("mouseup",this.handleMouseUp,!0),!(e.button!=null&&e.button!==0)&&(this.notifyMouseHandlers("onUp",e,!1),this.stopDragTimer(),this.removeDocumentCursor())}handleResize(){if(this.updateCanvasScale(),this.updateCanvas(),!this.metrics)throw new Error("metrics not set");this.forceUpdate()}handleWheel(e){var v,y,M,A;if(this.notifyMouseHandlers("onWheel",e),e.defaultPrevented)return;const{metricCalculator:t,metrics:n}=this,s=this.getMetricState();if(!n)throw new Error("metrics not set");const{lastTop:o,lastLeft:i,columnCount:r,rowCount:l,scrollableContentWidth:a,scrollableViewportWidth:c,scrollableContentHeight:d,scrollableViewportHeight:u,hasHorizontalBar:m,hasVerticalBar:p}=n;let{top:g,left:f,topOffset:w,leftOffset:C}=n;const S=this.getTheme();let{deltaX:b,deltaY:E}=W.getScrollDelta(e,n.barWidth,n.barHeight,n.rowHeight,n.rowHeight);for(;m&&b!==0;){if(C+=b,b=0,r>1){if(C>0&&f>=i||C<0&&f<=0){C=0;break}}else{if(C<=0){C=0;break}const F=a-c;if(C>=F){C=F;break}}if(C>0){const F=(v=n.allColumnWidths.get(f))!=null?v:t.getVisibleColumnWidth(f,s);C>=F?(b=C-F,C=0,f+=1):S.scrollSnapToColumn&&r>1&&(C=0,f+=1)}else if(C<0){const F=(y=n.allColumnWidths.get(f-1))!=null?y:t.getVisibleColumnWidth(f-1,s);Math.abs(C)<=F&&S.scrollSnapToColumn&&r>1?(C=0,f-=1):(b=C+F,C=0,f-=1)}}for(;p&&E!==0;){if(w+=E,E=0,l>1){if(w>0&&g>=o||w<0&&g<=0){w=0;break}}else{if(w<=0){w=0;break}const F=d-u;if(w>=F){w=F;break}}if(w>0){const F=(M=n.allRowHeights.get(g))!=null?M:t.getVisibleRowHeight(g,s);w>=F?(E=w-F,w=0,g+=1):S.scrollSnapToRow&&l>1&&(w=0,g+=1)}else if(w<0){const F=(A=n.allRowHeights.get(g-1))!=null?A:t.getVisibleRowHeight(g-1,s);Math.abs(w)<=F&&S.scrollSnapToRow&&l>1?(w=0,g-=1):(E=w+F,w=0,g-=1)}}this.setViewState({top:g,left:f,leftOffset:C,topOffset:w}),e.stopPropagation(),e.preventDefault()}handleEditCellCancel(){this.setState({editingCell:null}),this.focus()}handleEditCellChange(e){this.setState(({editingCell:t})=>{try{return Sl(t),{editingCell:{...t,value:e}}}catch(n){const{onError:s}=this.props;return s(n instanceof Error?n:new Error(`${n}`)),null}})}handleEditCellCommit(e,{direction:t=Pt.DOWN,fillRange:n=!1}={}){const{editingCell:s,selectedRanges:o}=this.state;if(!s)throw new Error("editingCell not set");const{column:i,row:r}=s;if(!this.isValidForCell(i,r,e)){t===null&&this.setState({editingCell:null});return}n?this.setValueForRanges(o,e):this.setValueForCell(i,r,e),t!==null&&this.moveCursorInDirection(t),this.setState({editingCell:null}),this.focus()}renderInputField(){const{model:e}=this.props,{editingCell:t}=this.state,{metrics:n}=this;if(t==null||n==null||!He(e))return null;const{selectionRange:s,value:o,isQuickEdit:i}=t,{column:r,row:l}=t,{gridX:a,gridY:c,allColumnXs:d,allRowYs:u,allColumnWidths:m,allRowHeights:p}=n,g=d.get(r),f=u.get(l),w=m.get(r),C=p.get(l),S=g!=null&&f!=null&&w!=null&&C!=null?{position:"absolute",left:a+g,top:c+f,width:w,height:C}:{opacity:0},b=this.getModelColumn(r),E=this.getModelRow(l),v=b!=null&&E!=null?{textAlign:e.textAlignForCell(b,E)}:void 0,y=e.isValidForCell(b,E,o);return h("div",{style:S,children:h(Or,{selectionRange:s,className:B({error:!y}),onCancel:this.handleEditCellCancel,onChange:this.handleEditCellChange,onDone:this.handleEditCellCommit,isQuickEdit:i,style:v,value:o},`${r},${l}`)})}render(){const{cursor:e}=this.state;return R(Fe,{children:[h("canvas",{className:B("grid-canvas",ls.getCursorClassName(e)),ref:t=>{this.canvas=t},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 Ws=ls;Ws.contextType=Vh;Ws.defaultProps={canvasOptions:{alpha:!1},isStickyBottom:!1,isStickyRight:!1,isStuckToBottom:!1,isStuckToRight:!1,keyHandlers:ye,mouseHandlers:ye,movedColumns:ye,movedRows:ye,onError:()=>{},onSelectionChanged:()=>{},onMovedColumnsChanged:e=>{},onMoveColumnComplete:()=>{},onMovedRowsChanged:()=>{},onMoveRowComplete:()=>{},onViewChanged:()=>{},stateOverride:{},theme:{autoSelectColumn:!1,autoSelectRow:!1}};Ws.pixelsPerLine=100/3;Ws.dragTimeout=1e3;Ws.getTheme=Ie((e,t)=>({...Th,...e,...t}));class Ha extends dr{get floatingTopRowCount(){return 0}get floatingBottomRowCount(){return 0}get floatingLeftColumnCount(){return 0}get floatingRightColumnCount(){return 0}get columnHeaderMaxDepth(){return 1}truncationCharForCell(t,n){}textAlignForCell(t,n){return"left"}colorForCell(t,n,s){return s.textColor}backgroundColorForCell(t,n,s){return null}colorForColumnHeader(t,n=0){return null}textForRowHeader(t){return""}textForRowFooter(t){return""}isColumnMovable(t,n=0){return!0}isRowMovable(t){return!0}getColumnHeaderGroup(t,n){}getColumnHeaderParentGroup(t,n){}}class Uh extends Ha{constructor({rowCount:t=1e9,columnCount:n=100,floatingTopRowCount:s=0,floatingBottomRowCount:o=0,floatingLeftColumnCount:i=0,floatingRightColumnCount:r=0,isEditable:l=!1,editedData:a=[]}={}){super(),this.numRows=t,this.numColumns=n,this.floatingTop=s,this.floatingBottom=o,this.floatingLeft=i,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(t,n){var s,o;return(o=(s=this.editedData[t])==null?void 0:s[n])!=null?o:`${t},${n}`}colorForCell(t,n,s){return s.textColor}textForColumnHeader(t,n=0){return`${t}`}textForRowHeader(t){return`${t}`}textForRowFooter(t){return`${t}`}async setValueForCell(t,n,s){this.editedData[t]==null&&(this.editedData[t]=[]),this.editedData[t][n]=`${s}`}async setValueForRanges(t,n){ee.forEachCell(t,(s,o)=>{this.setValueForCell(s,o,n)})}async setValues(t){var n,s;for(let o=0;o<t.length;o+=1){const i=t[o];this.setValueForCell((n=i.column)!=null?n:i.x,(s=i.row)!=null?s:i.y,i.text)}}editValueForCell(t,n){return this.textForCell(t,n)}isValidForCell(t,n,s){return!0}isEditableRange(t){return this.isEditable}delete(t){throw new Error("Method not implemented.")}}const as=class extends Uh{constructor({rowCount:e=as.DEFAULT_ROW_COUNT,columnCount:t=as.DEFAULT_COLUMN_COUNT,children:n=new Map,childRowCount:s=Math.ceil(Math.max(as.MIN_CHILD_ROW_COUNT,e*as.DEFAULT_CHILD_ROW_COUNT_FACTOR)),maxDepth:o=as.MAX_DEPTH}={}){super({rowCount:e,columnCount:t}),this.getCachedModelRowOffset=Et((i,r)=>{let l=null,a=r;const c=[...i].sort((d,u)=>d[0]-u[0]);for(let d=0;d<c.length;d+=1){const[u,m]=c[d];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=Et((i,r)=>{const{key:l,offsetRow:a}=this.getCachedModelRowOffset(i,r);if(l!=null){const c=i.get(l);if(c!==void 0)return`${l}.${c.textForRowHeader(a)}`}return`${a}`}),this.getCachedTextForCell=Et((i,r,l)=>{const{key:a,offsetRow:c}=this.getCachedModelRowOffset(i,l);if(a!=null){const d=i.get(a);if(d!==void 0)return`${a}.${d.textForCell(r,c)}`}return`${r},${c}`}),this.getCachedIsRowExpandable=Et((i,r,l)=>this.getCachedDepthForRow(i,r)<l),this.getCachedIsRowExpanded=Et((i,r)=>{const{key:l,offsetRow:a}=this.getCachedModelRowOffset(i,r);if(l!=null){const c=i.get(l);if(c!==void 0)return c.isRowExpanded(a)}return i.has(a)}),this.getCachedDepthForRow=Et((i,r)=>{const{key:l,offsetRow:a}=this.getCachedModelRowOffset(i,r);if(l!=null){const c=i.get(l);if(c!==void 0)return c.depthForRow(a)+1}return 0}),this.children=n,this.childRowCount=s,this.maxDepth=o}textForCell(e,t){return this.getCachedTextForCell(this.children,e,t)}textForRowHeader(e){return this.getCachedTextForRowHeader(this.children,e)}isRowMovable(e){return!1}get hasExpandableRows(){return!0}get isExpandAllAvailable(){return!1}get floatingBottomRowCount(){return 0}isRowExpandable(e){return this.getCachedIsRowExpandable(this.children,e,this.maxDepth)}isRowExpanded(e){return this.getCachedIsRowExpanded(this.children,e)}setRowExpanded(e,t,n=!1){const{key:s,offsetRow:o}=this.getCachedModelRowOffset(this.children,e),i=new Map(this.children);if(s!=null){const r=this.children.get(s);if(r!==void 0){const{rowCount:l}=r;r.setRowExpanded(o,t,n),this.numRows+=r.rowCount-l}}else if(t){const r=new as({rowCount:this.childRowCount,columnCount:this.numColumns});i.set(o,r),this.numRows+=r.rowCount}else{const r=i.get(o);r!==void 0&&(this.numRows-=r.rowCount,i.delete(o))}this.children=i}expandAll(){throw new Error("Expand all not implemented.")}collapseAll(){throw new Error("Collapse all not implemented.")}depthForRow(e){return this.getCachedDepthForRow(this.children,e)}};let wo=as;wo.DEFAULT_ROW_COUNT=1e9;wo.DEFAULT_COLUMN_COUNT=100;wo.DEFAULT_CHILD_ROW_COUNT_FACTOR=.01;wo.MIN_CHILD_ROW_COUNT=10;wo.MAX_DEPTH=10;const{dh:I}=globalThis,Ei=D.exports.shape({name:D.exports.string.isRequired,type:D.exports.string.isRequired,description:D.exports.string,constituentType:D.exports.string}),_a=D.exports.shape({not:D.exports.func.isRequired,and:D.exports.func.isRequired,or:D.exports.func.isRequired}),Bh=D.exports.shape({asc:D.exports.func.isRequired,desc:D.exports.func.isRequired,abs:D.exports.func.isRequired,column:Ei.isRequired,direction:D.exports.string.isRequired,isAbs:D.exports.bool.isRequired}),Gh=D.exports.shape({columns:D.exports.arrayOf(Ei).isRequired,customColumns:D.exports.arrayOf(D.exports.string).isRequired,filter:D.exports.arrayOf(_a),addEventListener:D.exports.func.isRequired,removeEventListener:D.exports.func.isRequired,size:D.exports.number.isRequired,sort:D.exports.arrayOf(D.exports.any),copy:D.exports.func.isRequired,applyFilter:D.exports.func.isRequired,applySort:D.exports.func.isRequired,applyCustomColumns:D.exports.func.isRequired,description:D.exports.string}),zh=D.exports.shape({columns:D.exports.arrayOf(Ei),filter:D.exports.arrayOf(D.exports.any),isExpanded:D.exports.func.isRequired,saveExpandedState:D.exports.func.isRequired,addEventListener:D.exports.func.isRequired,removeEventListener:D.exports.func.isRequired,size:D.exports.number.isRequired,sort:D.exports.arrayOf(D.exports.any),applyFilter:D.exports.func.isRequired,applySort:D.exports.func.isRequired}),ni=D.exports.shape({name:D.exports.string.isRequired,type:D.exports.string.isRequired}),Wh=D.exports.shape({created:D.exports.arrayOf(ni).isRequired,updated:D.exports.arrayOf(ni).isRequired,removed:D.exports.arrayOf(ni).isRequired}),$h=D.exports.shape({groupingColumns:D.exports.arrayOf(D.exports.string),aggregations:D.exports.shape({}),includeConstituents:D.exports.bool,includeOriginalColumns:D.exports.bool,includeDescriptions:D.exports.bool}),qh=D.exports.shape({addEventListener:D.exports.func.isRequired,removeEventListener:D.exports.func.isRequired,onLogMessage:D.exports.func,getTable:D.exports.func.isRequired,runCode:D.exports.func.isRequired});Object.freeze({Column:Ei,FilterCondition:_a,IdeSession:qh,RollupConfig:$h,Sort:Bh,Table:Gh,TreeTable:zh,VariableChanges:Wh,VariableDefinition:ni});const Kh=1e4;function Xh(e,t,n=Kh){return new Promise((s,o)=>{let i;const r=setTimeout(()=>{i==null||i(),o(new vr(`Variable ${t} not found`))},n);function l(a){const c=a.created.find(d=>d.title===t);c!=null&&(clearTimeout(r),i==null||i(),s(c))}i=e.subscribeToFieldUpdates(l)})}class _e{static isValid(t){return!0}static isSameFormat(t,n){throw new Error("isSameFormat not implemented")}static makeFormat(t,n,s){return{label:t,formatString:n,type:s}}format(t,n){return""}}_e.TYPE_GLOBAL="type-global";_e.TYPE_CONTEXT_PRESET="type-context-preset";_e.TYPE_CONTEXT_CUSTOM="type-context-custom";class Yh extends _e{format(t){switch(t){case 1:case!0:return"true";case 0:case!1:return"false";default:return""}}}class Qh extends _e{format(t){return String.fromCharCode(t)}}const yl=se.module("DateTimeColumnFormatter"),cs=class extends _e{constructor({timeZone:e="",showTimeZone:t=!0,showTSeparator:n=!1,defaultDateTimeFormatString:s=cs.DEFAULT_DATETIME_FORMAT_STRING}={}){super();const o=e||cs.DEFAULT_TIME_ZONE_ID;try{this.dhTimeZone=I.i18n.TimeZone.getTimeZone(o)}catch{yl.error("Unsupported time zone id",o),this.dhTimeZone=I.i18n.TimeZone.getTimeZone(cs.DEFAULT_TIME_ZONE_ID)}this.defaultDateTimeFormatString=s,this.showTimeZone=t,this.showTSeparator=n,this.formatStringMap=cs.makeFormatStringMap(t,n)}static isValid(e){try{return I.i18n.DateTimeFormat.format(e.formatString,new Date),!0}catch{return!1}}static makeFormat(e,t,n=_e.TYPE_CONTEXT_PRESET){return{label:e,formatString:t,type:n}}static isSameFormat(e,t){return e===t||e!==null&&t!==null&&e.type===t.type&&e.formatString===t.formatString}static makeGlobalFormatStringMap(e,t){const n=t?"'T'":" ",s=e?" 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(e,t){return[...cs.makeGlobalFormatStringMap(e,t).keys()]}static makeFormatStringMap(e,t){const n=t!==void 0&&t?"'T'":" ",s=e!==void 0&&e?" 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(e,t){return[...cs.makeFormatStringMap(e,t).keys()]}getEffectiveFormatString(e){var t;return(t=this.formatStringMap.get(e))!=null?t:e}format(e,t={}){const n=t.formatString!=null&&t.formatString!==""?t.formatString:this.defaultDateTimeFormatString,s=this.getEffectiveFormatString(n);try{return I.i18n.DateTimeFormat.format(s,e,this.dhTimeZone)}catch{yl.error("Invalid format arguments")}return""}};let jn=cs;jn.DEFAULT_DATETIME_FORMAT_STRING="yyyy-MM-dd HH:mm:ss.SSS";jn.DEFAULT_TIME_ZONE_ID="America/New_York";const jh=se.module("DecimalColumnFormatter"),Ht=class extends _e{constructor({defaultFormatString:e=Ht.DEFAULT_FORMAT_STRING}={}){super(),this.defaultFormatString=e}static isValid(e){try{return I.i18n.NumberFormat.format(e.formatString,0),!0}catch{return!1}}static makeFormat(e,t,n=_e.TYPE_CONTEXT_PRESET,s){return{label:e,type:n,formatString:t,multiplier:s}}static makePresetFormat(e,t="",n){return Ht.makeFormat(e,t,_e.TYPE_CONTEXT_PRESET,n)}static makeCustomFormat(e="",t){return Ht.makeFormat("Custom Format",e,_e.TYPE_CONTEXT_CUSTOM,t)}static isSameFormat(e,t){return e===t||e!=null&&t!=null&&e.type===t.type&&e.formatString===t.formatString&&e.multiplier===t.multiplier}format(e,t={}){const n=t.formatString!=null&&t.formatString!==""?t.formatString:this.defaultFormatString,s=t.multiplier!==void 0&&t.multiplier!==0?e*t.multiplier:e;try{return I.i18n.NumberFormat.format(n,s)}catch{jh.error("Invalid format arguments")}return""}};let Be=Ht;Be.DEFAULT_FORMAT_STRING="###,##0.0000";Be.FORMAT_PERCENT=Ht.makePresetFormat("Percent","##0.00%");Be.FORMAT_BASIS_POINTS=Ht.makePresetFormat("Basis Points","###,##0 bp",1e4);Be.FORMAT_MILLIONS=Ht.makePresetFormat("Millions","###,##0.000 mm",1e-6);Be.FORMAT_SCIENTIFIC_NOTATION=Ht.makePresetFormat("Scientific Notation","0.0000E0");Be.FORMAT_ROUND=Ht.makePresetFormat("Round","###,##0");Be.FORMAT_ROUND_TWO_DECIMALS=Ht.makePresetFormat("0.00","###,##0.00");Be.FORMAT_ROUND_FOUR_DECIMALS=Ht.makePresetFormat("0.0000","###,##0.0000");class Zh extends _e{format(t){return`${t}`}}const Jh=se.module("IntegerColumnFormatter"),_s=class extends _e{constructor({defaultFormatString:e=_s.DEFAULT_FORMAT_STRING}={}){super(),this.defaultFormatString=e}static isValid(e){try{return I.i18n.NumberFormat.format(e.formatString,0),!0}catch{return!1}}static makeFormat(e,t,n=_e.TYPE_CONTEXT_PRESET,s){return{label:e,type:n,formatString:t,multiplier:s}}static makePresetFormat(e,t="",n){return _s.makeFormat(e,t,_e.TYPE_CONTEXT_PRESET,n)}static makeCustomFormat(e="",t){return _s.makeFormat("Custom Format",e,_e.TYPE_CONTEXT_CUSTOM,t)}static isSameFormat(e,t){return e===t||e!=null&&t!=null&&e.type===t.type&&e.formatString===t.formatString&&e.multiplier===t.multiplier}format(e,t={}){const n=t.formatString!=null&&t.formatString!==""?t.formatString:this.defaultFormatString,s=t.multiplier!==void 0&&t.multiplier!==0?e*t.multiplier:e;try{return I.i18n.NumberFormat.format(n,s)}catch{Jh.error("Invalid format arguments")}return""}};let kt=_s;kt.DEFAULT_FORMAT_STRING="###,##0";kt.FORMAT_MILLIONS=_s.makePresetFormat("Millions","###,##0.000 mm",1e-6);kt.FORMAT_SCIENTIFIC_NOTATION=_s.makePresetFormat("Scientific Notation","0.0000E0");class em extends _e{format(t){return t}}const pt=class{static makeDateWrapper(e,t,n=0,s=1,o=0,i=0,r=0,l=0){if(!e)throw new Error("No timezone provided");const a=`${t}`.padStart(4,"0"),c=`${n+1}`.padStart(2,"0"),d=`${s}`.padStart(2,"0"),u=`${o}`.padStart(2,"0"),m=`${i}`.padStart(2,"0"),p=`${r}`.padStart(2,"0"),g=`${l}`.padStart(9,"0"),f=`${a}-${c}-${d} ${u}:${m}:${p}.${g}`;return I.i18n.DateTimeFormat.parse(pt.FULL_DATE_FORMAT,f,I.i18n.TimeZone.getTimeZone(e))}static getNextNanos(e){const t=parseInt(e,10),n="0".repeat(9-e.length),s=`${t+1}${n}`;return parseInt(s,10)}static getNextDate(e,t,n){let{year:s,month:o,date:i,hours:r,minutes:l,seconds:a,nanos:c}=t;if(e.nanos!=null){if(e.nanos.length===9)return null;c=pt.getNextNanos(e.nanos),c>999999999&&(a+=1,c=0)}else e.seconds!=null?a+=1:e.minutes!=null?l+=1:e.hours!=null?r+=1:e.date!=null?i+=1:e.month!=null?o+=1:s+=1;const d=new Date(s,o,i,r,l,a);return pt.makeDateWrapper(n,d.getFullYear(),d.getMonth(),d.getDate(),d.getHours(),d.getMinutes(),d.getSeconds(),c)}static parseMonth(e){const t=parseInt(e,10);if(!Number.isNaN(t))return t>=1&&t<=12?t-1:NaN;const n=e.trim().toLowerCase();if(n.length>=3){for(let s=0;s<pt.months.length;s+=1)if(pt.months[s].startsWith(n))return s}return NaN}static parseDateValues(e,t,n,s,o,i,r){const l=parseInt(e,10),a=t!=null?this.parseMonth(t):0,c=n!=null?parseInt(n,10):1,d=s!=null?parseInt(s,10):0,u=o!=null?parseInt(o,10):0,m=i!=null?parseInt(i,10):0,p=r!=null?parseInt(r.padEnd(9,"0"),10):0;return Number.isNaN(l)||Number.isNaN(a)||Number.isNaN(c)||Number.isNaN(d)||Number.isNaN(u)||Number.isNaN(m)||Number.isNaN(p)?null:{year:l,month:a,date:c,hours:d,minutes:u,seconds:m,nanos:p}}static parseDateTimeString(e){const n=/\s*(\d{4})([-./]([\da-z]+))?([-./](\d{1,2}))?([tT\s](\d{2})([:](\d{2}))?([:](\d{2}))?([.](\d{1,9}))?)?(.*)/.exec(e);if(n==null)throw new Error(`Unexpected date string: ${e}`);const[,s,,o,,i,,r,,l,,a,,c,d]=n;if(d!=null&&d.length>0)throw new Error(`Unexpected characters after date string '${e}': ${d}`);return{year:s,month:o,date:i,hours:r,minutes:l,seconds:a,nanos:c}}static parseDateRange(e,t){const n=e.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=pt.makeDateWrapper(t,l.getFullYear(),l.getMonth(),l.getDate()),c=pt.makeDateWrapper(t,l.getFullYear(),l.getMonth(),l.getDate()+1);return[a,c]}if(n==="yesterday"){const l=new Date(Date.now()),a=pt.makeDateWrapper(t,l.getFullYear(),l.getMonth(),l.getDate()-1),c=pt.makeDateWrapper(t,l.getFullYear(),l.getMonth(),l.getDate());return[a,c]}if(n==="now"){const l=new Date(Date.now());return[I.DateWrapper.ofJsDate(l),null]}const s=pt.parseDateTimeString(n);if(s.year==null&&s.month==null&&s.date==null)throw new Error(`Unable to extract year, month, or day ${n}`);const o=pt.parseDateValues(s.year,s.month,s.date,s.hours,s.minutes,s.seconds,s.nanos);if(o==null)throw new Error(`Unable to extract date values from ${s}`);const i=pt.makeDateWrapper(t,o.year,o.month,o.date,o.hours,o.minutes,o.seconds,o.nanos),r=pt.getNextDate(s,o,t);return[i,r]}static getJsDate(e){return typeof e=="number"?new Date(e):e.asDate()}};let Tn=pt;Tn.FULL_DATE_FORMAT="yyyy-MM-dd HH:mm:ss.SSSSSSSSS";Tn.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 tm(e){if(!(e==="not"||e==="and"||e==="or"))throw new Error("operator is not a valid FilterOperatorValue")}class U{}U.eq="eq";U.eqIgnoreCase="eqIgnoreCase";U.notEq="notEq";U.notEqIgnoreCase="notEqIgnoreCase";U.greaterThan="greaterThan";U.greaterThanOrEqualTo="greaterThanOrEqualTo";U.lessThan="lessThan";U.lessThanOrEqualTo="lessThanOrEqualTo";U.in="in";U.inIgnoreCase="inIgnoreCase";U.notIn="notIn";U.notInIgnoreCase="notInIgnoreCase";U.isTrue="isTrue";U.isFalse="isFalse";U.isNull="isNull";U.invoke="invoke";U.contains="contains";U.notContains="notContains";U.startsWith="startsWith";U.endsWith="endsWith";U.containsAny="containsAny";function nm(e){switch(e){case U.eq:return"is exactly";case U.eqIgnoreCase:return"is exactly (ignore case)";case U.notEq:return"is not exactly";case U.notEqIgnoreCase:return"is not exactly (ignore case)";case U.contains:return"contains";case U.notContains:return"does not contain";case U.startsWith:return"starts with";case U.endsWith:return"ends with";default:throw new Error(`Unrecognized text filter type ${e}`)}}function sm(e){switch(e){case U.eq:return"is equal to";case U.notEq:return"is not equal to";case U.greaterThan:return"greater than";case U.greaterThanOrEqualTo:return"greater than or equal to";case U.lessThan:return"less than";case U.lessThanOrEqualTo:return"less than or equal to";default:throw new Error(`Unrecognized number filter type ${e}`)}}function om(e){switch(e){case U.eq:return"date is";case U.notEq:return"date is not";case U.notEqIgnoreCase:case U.greaterThan:return"date is after";case U.greaterThanOrEqualTo:return"date is after or equal";case U.lessThan:return"date is before";case U.lessThanOrEqualTo:return"date is before or equal";default:throw new Error(`Unrecognized date filter type ${e}`)}}function im(e){switch(e){case U.isTrue:return"Is True";case U.isFalse:return"Is False";case U.isNull:return"Is Null";default:throw new Error(`Unrecognized boolean filter type ${e}`)}}const dn=se.module("TableUtils"),j=class{static getSortIndex(e,t){var n;for(let s=0;s<e.length;s+=1)if(((n=e[s].column)==null?void 0:n.index)===t)return s;return null}static getSortForColumn(e,t){const n=j.getSortIndex(e,t);return n!=null?e[n]:null}static getFilterText(e){return e?e.toString():null}static getFilterTypes(e){return j.isBooleanType(e)?[U.isTrue,U.isFalse,U.isNull]:j.isCharType(e)||j.isNumberType(e)||j.isDateType(e)?[U.eq,U.notEq,U.greaterThan,U.greaterThanOrEqualTo,U.lessThan,U.lessThanOrEqualTo]:j.isTextType(e)?[U.eq,U.eqIgnoreCase,U.notEq,U.notEqIgnoreCase,U.contains,U.notContains,U.startsWith,U.endsWith]:[]}static getNextSort(e,t,n){if(e==null||n<0||n>=e.length)return null;const s=j.getSortForColumn(t,n);return s===null?e[n].sort().asc():s.direction===j.sortDirection.ascending?s.desc():null}static makeColumnSort(e,t,n,s){if(e==null||t<0||t>=e.length||n===j.sortDirection.none)return null;let o=e[t].sort();switch(n){case j.sortDirection.ascending:o=o.asc();break;case j.sortDirection.descending:o=o.desc();break}return s&&(o=o.abs()),o}static toggleSortForColumn(e,t,n,s=!1){if(n<0||n>=t.length)return[];const o=j.getNextSort(t,e,n);return j.setSortForColumn(e,n,o,s)}static sortColumn(e,t,n,s,o,i){if(e==null||n<0||n>=t.length)return[];const r=j.makeColumnSort(t,n,s,o);return j.setSortForColumn(e,n,r,i)}static setSortForColumn(e,t,n,s=!1){const o=j.getSortIndex(e,t);let i=[];return s&&(i=i.concat(e.filter(({direction:r})=>r!==j.sortDirection.reverse)),o!==null&&i.splice(o,1)),n!==null&&i.push(n),i}static getNormalizedType(e){switch(e){case"boolean":case"java.lang.Boolean":case j.dataType.BOOLEAN:return j.dataType.BOOLEAN;case"char":case"java.lang.Character":case j.dataType.CHAR:return j.dataType.CHAR;case"java.lang.String":case j.dataType.STRING:return j.dataType.STRING;case"io.deephaven.db.tables.utils.DBDateTime":case"io.deephaven.time.DateTime":case"com.illumon.iris.db.tables.utils.DBDateTime":case j.dataType.DATETIME:return j.dataType.DATETIME;case"double":case"java.lang.Double":case"float":case"java.lang.Float":case"java.math.BigDecimal":case j.dataType.DECIMAL:return j.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 j.dataType.INT:return j.dataType.INT;default:return j.dataType.UNKNOWN}}static isLongType(e){switch(e){case"long":case"java.lang.Long":return!0;default:return!1}}static isDateType(e){switch(e){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(e){return j.isIntegerType(e)||j.isDecimalType(e)}static isIntegerType(e){switch(e){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(e){switch(e){case"double":case"java.lang.Double":case"java.math.BigDecimal":case"float":case"java.lang.Float":return!0;default:return!1}}static isBigDecimalType(e){switch(e){case"java.math.BigDecimal":return!0;default:return!1}}static isBigIntegerType(e){switch(e){case"java.math.BigInteger":return!0;default:return!1}}static isBooleanType(e){switch(e){case"boolean":case"java.lang.Boolean":return!0;default:return!1}}static isCharType(e){switch(e){case"char":case"java.lang.Character":return!0;default:return!1}}static isStringType(e){switch(e){case"java.lang.String":return!0;default:return!1}}static isTextType(e){return this.isStringType(e)||this.isCharType(e)}static getBaseType(e){return e.split("[]")[0]}static isCompatibleType(e,t){return j.getNormalizedType(e)===j.getNormalizedType(t)}static makeQuickFilter(e,t,n){const s=t.split("||");let o=null;for(let i=0;i<s.length;i+=1){const l=s[i].split("&&");let a=null;for(let c=0;c<l.length;c+=1){const d=l[c].trim();if(d.length>0){const u=j.makeQuickFilterFromComponent(e,d,n);if(u)a?a=a.and(u):a=u;else throw new Error(`Unable to parse quick filter from text ${t}`)}}o&&a?o=o.or(a):o=a}return o}static makeQuickFilterFromComponent(e,t,n){const{type:s}=e;return j.isNumberType(s)?this.makeQuickNumberFilter(e,t):j.isBooleanType(s)?this.makeQuickBooleanFilter(e,t):n!=null&&j.isDateType(s)?this.makeQuickDateFilter(e,t,n):j.isCharType(s)?this.makeQuickCharFilter(e,t):this.makeQuickTextFilter(e,t)}static makeQuickNumberFilter(e,t){if(t==null)return null;const n=e.filter();let s=null;const i=/\s*(>=|<=|=>|=<|>|<|!=|=|!)?(\s*-\s*)?(\s*\d*(?:,\d{3})*(?:\.\d*)?\s*)?(null|nan|infinity|inf|\u221E)?(.*)/i.exec(t);let r=null,l=null,a=null,c=null,d=null;if(i!==null&&i.length>3&&([,r,l,a,c,d]=i),d!=null&&d.trim().length>0)return null;if(r==null&&(r="="),c!=null){if(!(r==="="||r==="!"||r==="!="))return null;switch(c=c.trim().toLowerCase(),c){case"null":s=n.isNull();break;case"nan":s=I.FilterCondition.invoke("isNaN",n);break;case"infinity":case"inf":case"\u221E":l!=null?s=I.FilterCondition.invoke("isInf",n).and(n.lessThan(I.FilterValue.ofNumber(0))):s=I.FilterCondition.invoke("isInf",n).and(n.greaterThan(I.FilterValue.ofNumber(0)));break}return s!==null&&(r==="!"||r==="!=")&&(s=s.not()),s}if(a==null)return null;if(a=j.removeCommas(a),j.isLongType(e.type))try{a=I.FilterValue.ofNumber(I.LongWrapper.ofString(`${l!=null?"-":""}${a}`))}catch(u){return dn.warn("Unable to create long filter",u),null}else{if(a=parseFloat(a),a==null||Number.isNaN(a))return null;a=I.FilterValue.ofNumber(l!=null?0-a:a)}return s=e.filter(),j.makeRangeFilterWithOperation(s,r,a)}static makeQuickTextFilter(e,t){if(t==null)return null;const n=`${t}`.trim(),o=/^(!~|!=|~|=|!)?(.*)/.exec(n);let i=null,r=null;if(o!==null&&o.length>2&&([,i,r]=o,r!=null&&(r=r.trim())),r==null||r.length===0)return null;i==null&&(i="=");const l=e.filter();if(r.toLowerCase()==="null")switch(i){case"=":return l.isNull();case"!=":case"!":return l.isNull().not();default:return null}let a=null,c=null;switch(r.startsWith("*")?(a="*",r=r.substring(1)):r.endsWith("*")&&!r.endsWith("\\*")&&(c="*",r=r.substring(0,r.length-1)),r=r.replace("\\",""),i){case"~":return l.isNull().not().and(l.invoke("matches",I.FilterValue.ofString(`(?s)(?i).*\\Q${r}\\E.*`)));case"!~":return l.isNull().or(l.invoke("matches",I.FilterValue.ofString(`(?s)(?i).*\\Q${r}\\E.*`)).not());case"!=":return a==="*"?l.isNull().or(l.invoke("matches",I.FilterValue.ofString(`(?s)(?i).*\\Q${r}\\E$`)).not()):c==="*"?l.isNull().or(l.invoke("matches",I.FilterValue.ofString(`(?s)(?i)^\\Q${r}\\E.*`)).not()):l.notEqIgnoreCase(I.FilterValue.ofString(r.toLowerCase()));case"=":return a==="*"?l.isNull().not().and(l.invoke("matches",I.FilterValue.ofString(`(?s)(?i).*\\Q${r}\\E$`))):c==="*"?l.isNull().not().and(l.invoke("matches",I.FilterValue.ofString(`(?s)(?i)^\\Q${r}\\E.*`))):l.eqIgnoreCase(I.FilterValue.ofString(r.toLowerCase()))}return null}static makeQuickBooleanFilter(e,t){if(t==null)return null;const s=/^(!=|=|!)?(.*)/.exec(`${t}`.trim());if(s===null)return null;const[,o,i]=s,r=o==="!"||o==="!=",l=i.trim().toLowerCase();let a=e.filter();try{const c=j.makeBooleanValue(l);return c!=null&&c?a=a.isTrue():c===null?a=a.isNull():a=a.isFalse(),r?a.not():a}catch{return null}}static makeQuickDateFilter(e,t,n){const s=t.trim(),i=/\s*(>=|<=|=>|=<|>|<|!=|!|=)?(.*)/.exec(s);if(i==null||i.length<=2)throw new Error(`Unable to parse date filter: ${t}`);let r=null,l=null;[,r,l]=i;let a=U.eq;switch(r){case"<":a=U.lessThan;break;case"<=":case"=<":a=U.lessThanOrEqualTo;break;case">":a=U.greaterThan;break;case">=":case"=>":a=U.greaterThanOrEqualTo;break;case"!=":case"!":a=U.notEq;break;case"=":case"==":default:a=U.eq;break}return j.makeQuickDateFilterWithOperation(e,l,a,n)}static makeQuickDateFilterWithOperation(e,t,n,s){if(e==null)throw new Error("Column is null");const[o,i]=Tn.parseDateRange(t,s),r=o!=null?I.FilterValue.ofNumber(o):null,l=i!=null?I.FilterValue.ofNumber(i):null,a=e.filter();if(r==null)return n===U.notEq?a.isNull().not():a.isNull();switch(n){case U.eq:{if(l!=null){const c=a.greaterThanOrEqualTo(r),d=a.lessThan(l);return c.and(d)}return a.eq(r)}case U.lessThan:return a.lessThan(r);case U.lessThanOrEqualTo:return l!=null?a.lessThan(l):a.lessThanOrEqualTo(r);case U.greaterThan:return l!=null?a.greaterThanOrEqualTo(l):a.greaterThan(r);case U.greaterThanOrEqualTo:return a.greaterThanOrEqualTo(r);case U.notEq:{if(l!=null){const c=a.lessThan(r),d=a.greaterThanOrEqualTo(l);return c.or(d)}return a.notEq(r)}default:throw new Error(`Invalid operator: ${n}`)}}static quoteValue(e){return e.length>=2&&(e.charAt(0)==='"'&&e.charAt(e.length-1)==='"'||e.charAt(0)==="'"&&e.charAt(e.length-1)==="'")?e:`"${e}"`}static isRangeOperation(e){switch(e){case"<":case"<=":case"=<":case">":case">=":case"=>":return!0;default:return!1}}static makeQuickCharFilter(e,t){if(t==null)return null;const n=`${t}`.trim(),o=/^(>=|<=|=>|=<|>|<|!=|=|!)?(null|"."|'.'|.)?(.*)/.exec(n);let i=null,r=null,l=null;if(o!==null&&o.length>3&&([,i,r,l]=o),l!=null&&l.trim().length>0||r==null||r.length===0)return null;i==null&&(i="=");const a=e.filter();if(r.toLowerCase()==="null")switch(i){case"=":return a.isNull();case"!=":case"!":return a.isNull().not();default:return null}const c=I.FilterValue.ofString(j.isRangeOperation(i)?j.quoteValue(r):r);return j.makeRangeFilterWithOperation(a,i,c)}static makeRangeFilterWithOperation(e,t,n){switch(t){case"=":return e.eq(n);case"<":return e.lessThan(n);case"<=":case"=<":return e.lessThanOrEqualTo(n);case">":return e.greaterThan(n);case">=":case"=>":return e.greaterThanOrEqualTo(n);case"!=":case"!":return e.notEq(n);default:return null}}static makeCancelableTablePromise(e){return Ue.makeCancelable(e,t=>{t.close()})}static makeCancelableTableEventPromise(e,t,n=0,s=null){let o,i,r=!0;const l=new Promise((a,c)=>{i=setTimeout(()=>{o(),r=!1,c(new vr(`Event "${t}" timed out.`))},n),o=e.addEventListener(t,d=>{if(s!=null&&!s(d)){dn.debug2("Event triggered, but matcher returned false.");return}dn.debug2("Event triggered, resolving."),o(),clearTimeout(i),r=!1,a(d)})});return l.cancel=()=>{if(r){dn.debug2("Pending promise cleanup."),o(),clearTimeout(i),r=!1;return}dn.debug2("Ignoring non-pending promise cancel.")},l}static makeAdvancedFilter(e,t,n){const{filterItems:s,filterOperators:o,invertSelection:i,selectedValues:r}=t;let l=null;for(let c=0;c<s.length;c+=1){const d=s[c],{selectedType:u,value:m}=d;if(u!=null&&u.length>0&&m!=null&&m.length>0)try{const p=j.makeAdvancedValueFilter(e,u,m,n);if(p!=null){if(c===0)l=p;else if(l!==null&&c-1<o.length){const g=o[c-1];if(g===Zt.and)l=l.and(p);else if(g===Zt.or)l=l.or(p);else{dn.error("Unexpected filter operator",g,p),l=null;break}}}else dn.debug2("Empty filter ignored for",u,m)}catch(p){dn.error("Unable to create filter",p),l=null;break}}const a=j.makeSelectValueFilter(e,r,i);return a!=null&&(l!=null?l=l.and(a):l=a),l}static removeCommas(e){return e.replace(/[\s|,]/g,"")}static makeFilterValue(e,t){const n=j.getBaseType(e);return j.isTextType(n)?I.FilterValue.ofString(t):j.isLongType(n)?I.FilterValue.ofNumber(I.LongWrapper.ofString(j.removeCommas(t))):I.FilterValue.ofNumber(j.removeCommas(t))}static makeFilterRawValue(e,t){return j.isTextType(e)?I.FilterValue.ofString(t):j.isBooleanType(e)?I.FilterValue.ofBoolean(t):I.FilterValue.ofNumber(t)}static makeValue(e,t,n){if(t==null||t==="null")return null;if(j.isTextType(e))return t;if(j.isLongType(e))return I.LongWrapper.ofString(j.removeCommas(t));if(j.isBooleanType(e))return j.makeBooleanValue(t,!0);if(j.isDateType(e)){const[s]=Tn.parseDateRange(t,n);return s}return j.isNumberType(e)?j.makeNumberValue(t):(dn.error("Unexpected column type",e),null)}static makeBooleanValue(e,t=!1){if(e===""&&t)return null;switch(e==null?void 0:e.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 '${e}'`)}}static makeNumberValue(e){if(e==null||e==="null"||e==="")return null;const t=e.toLowerCase().trim();if(t==="\u221E"||t==="infinity"||t==="inf")return Number.POSITIVE_INFINITY;if(t==="-\u221E"||t==="-infinity"||t==="-inf")return Number.NEGATIVE_INFINITY;const n=j.removeCommas(t);if(j.NUMBER_REGEX.test(n))return parseFloat(n);throw new Error(`Invalid number '${e}'`)}static getFilterOperatorString(e){switch(e){case U.eq:return"=";case U.notEq:return"!=";case U.greaterThan:return">";case U.greaterThanOrEqualTo:return">=";case U.lessThan:return"<";case U.lessThanOrEqualTo:return"<=";case U.contains:return"~";case U.notContains:return"!~";default:throw new Error(`Unexpected filter type ${e}`)}}static makeAdvancedValueFilter(e,t,n,s){if(j.isDateType(e.type))return j.makeQuickDateFilterWithOperation(e,n,t,s);if(j.isNumberType(e.type)||j.isCharType(e.type))return j.makeQuickFilter(e,`${j.getFilterOperatorString(t)}${n}`);const o=j.makeFilterValue(e.type,n),i=e.filter();switch(t){case U.eq:return i.eq(o);case U.eqIgnoreCase:return i.eqIgnoreCase(o);case U.notEq:return i.notEq(o);case U.notEqIgnoreCase:return i.notEqIgnoreCase(o);case U.greaterThan:return i.greaterThan(o);case U.greaterThanOrEqualTo:return i.greaterThanOrEqualTo(o);case U.lessThan:return i.lessThan(o);case U.lessThanOrEqualTo:return i.lessThanOrEqualTo(o);case U.isTrue:return i.isTrue();case U.isFalse:return i.isFalse();case U.isNull:return i.isNull();case U.contains:return i.isNull().not().and(i.invoke("matches",I.FilterValue.ofString(`(?s)(?i).*\\Q${n}\\E.*`)));case U.notContains:return i.isNull().or(i.invoke("matches",I.FilterValue.ofString(`(?s)(?i).*\\Q${n}\\E.*`)).not());case U.startsWith:return i.isNull().not().and(i.invoke("matches",I.FilterValue.ofString(`(?s)(?i)^\\Q${n}\\E.*`)));case U.endsWith:return i.isNull().not().and(i.invoke("matches",I.FilterValue.ofString(`(?s)(?i).*\\Q${n}\\E$`)));case U.in:case U.inIgnoreCase:case U.notIn:case U.notInIgnoreCase:case U.invoke:default:throw new Error(`Unexpected filter operation: ${t}`)}}static makeSelectValueFilter(e,t,n){if(t.length===0){if(n)return null;let i=null;j.isTextType(e.type)?i=I.FilterValue.ofString("a"):j.isBooleanType(e.type)?i=I.FilterValue.ofBoolean(!0):j.isDateType(e.type)?i=I.FilterValue.ofNumber(I.DateWrapper.ofJsDate(new Date)):i=I.FilterValue.ofNumber(0);const r=e.filter().eq(i),l=e.filter().notEq(i);return r.and(l)}const s=[];let o=!1;for(let i=0;i<t.length;i+=1){const r=t[i];r==null?o=!0:j.isTextType(e.type)?s.push(I.FilterValue.ofString(typeof r=="number"?String.fromCharCode(r):r)):j.isBooleanType(e.type)?s.push(I.FilterValue.ofBoolean(Boolean(r))):s.push(I.FilterValue.ofNumber(r))}return o?s.length>0?n?e.filter().isNull().not().and(e.filter().notIn(s)):e.filter().isNull().or(e.filter().in(s)):n?e.filter().isNull().not():e.filter().isNull():n?e.filter().notIn(s):e.filter().in(s)}static isTreeTable(e){return e!=null&&e.expand!==void 0&&e.collapse!==void 0}static sortColumns(e,t=!0){return[...e].sort((n,s)=>{const o=n.name.toUpperCase(),i=s.name.toUpperCase();return Tr.sort(o,i,t)})}};let x=j;x.dataType={BOOLEAN:"boolean",CHAR:"char",DATETIME:"datetime",DECIMAL:"decimal",INT:"int",STRING:"string",UNKNOWN:"unknown"};x.sortDirection={ascending:"ASC",descending:"DESC",reverse:"REVERSE",none:null};x.REVERSE_TYPE=Object.freeze({NONE:"none",PRE_SORT:"pre-sort",POST_SORT:"post-sort"});x.NUMBER_REGEX=/^-?\d+(\.\d+)?$/;class tn{static makeColumnFormatMap(t){return t==null?new Map:t.reduce((n,s)=>{const o=x.getNormalizedType(s.columnType);if(o===null)return n;n.has(o)||n.set(o,new Map);const i=n.get(o);return i==null||i.set(s.columnName,s.format),n},new Map)}static makeColumnFormattingRule(t,n,s){return{columnType:t,columnName:n,format:s}}constructor(t=[],n,s,o,i=!1){this.defaultColumnFormatter=new Zh,this.typeFormatterMap=new Map([[x.dataType.BOOLEAN,new Yh],[x.dataType.CHAR,new Qh],[x.dataType.DATETIME,new jn(n)],[x.dataType.DECIMAL,new Be(s)],[x.dataType.INT,new kt(o)],[x.dataType.STRING,new em]]),this.columnFormatMap=tn.makeColumnFormatMap(t),this.truncateNumbersWithPound=i}getColumnFormatMapForType(t,n=!1){const s=x.getNormalizedType(t);if(s!==null)return n&&!this.columnFormatMap.has(s)&&this.columnFormatMap.set(s,new Map),this.columnFormatMap.get(s)}getColumnFormat(t,n){var o;const s=this.getColumnFormatMapForType(t);return(o=s==null?void 0:s.get(n))!=null?o:null}getColumnTypeFormatter(t){var o;const n=x.getNormalizedType(t);let s=this.defaultColumnFormatter;return n&&(s=(o=this.typeFormatterMap.get(n))!=null?o:s),s}getFormattedString(t,n,s="",o){if(t==null)return"";const i=this.getColumnTypeFormatter(n),r=o||this.getColumnFormat(n,s);return i.format(t,r!=null?r:void 0)}get timeZone(){var n;const t=this.typeFormatterMap.get(x.dataType.DATETIME);return(n=t==null?void 0:t.dhTimeZone)==null?void 0:n.id}}function rm(e){if(e&&e.formatter){const{formatter:t}=e;return t}}function lm(e){return{timeZone:e==null?void 0:e.timeZone,defaultDateTimeFormatString:e==null?void 0:e.defaultDateTimeFormat,showTimeZone:e==null?void 0:e.showTimeZone,showTSeparator:e==null?void 0:e.showTSeparator}}function am(e,t,n){const s=e.getColumnFormat(n,t);return s!=null&&(s.type===_e.TYPE_CONTEXT_PRESET||s.type===_e.TYPE_CONTEXT_CUSTOM)}const ms={getColumnFormats:rm,getDateTimeFormatterOptions:lm,isCustomColumnFormatDefined:am};function cm(e,t){const n=hm(e);return n===void 0?void 0:`${wm(e)} ? ${n} : ${t}`}function dm(e){return dh.Column.formatRowColor(e)}function um(e,t){return e.formatColor(t)}const Bi=se.module("ConditionalFormattingUtils");var on=(e=>(e.CONDITIONAL="conditional",e.ROWS="rows",e))(on||{}),Oe=(e=>(e.IS_EQUAL="is-equal",e.IS_NOT_EQUAL="is-not-equal",e.IS_BETWEEN="is-between",e.GREATER_THAN="greater-than",e.GREATER_THAN_OR_EQUAL="greater-than-or-equal",e.LESS_THAN="less-than",e.LESS_THAN_OR_EQUAL="less-than-or-equal",e.IS_NULL="is-null",e.IS_NOT_NULL="is-not-null",e))(Oe||{}),vt=(e=>(e.IS_EXACTLY="is-exactly",e.IS_NOT_EXACTLY="is-not-exactly",e.CONTAINS="contains",e.DOES_NOT_CONTAIN="does-not-contain",e.STARTS_WITH="starts-with",e.ENDS_WITH="ends-with",e.IS_NULL="is-null",e.IS_NOT_NULL="is-not-null",e))(vt||{}),at=(e=>(e.IS_EXACTLY="is-exactly",e.IS_NOT_EXACTLY="is-not-exactly",e.IS_BEFORE="is-before",e.IS_BEFORE_OR_EQUAL="is-before-or-equal",e.IS_AFTER="is-after",e.IS_AFTER_OR_EQUAL="is-after-or-equal",e.IS_NULL="is-null",e.IS_NOT_NULL="is-not-null",e))(at||{}),lo=(e=>(e.IS_TRUE="is-true",e.IS_FALSE="is-false",e.IS_NULL="is-null",e.IS_NOT_NULL="is-not-null",e))(lo||{}),hs=(e=>(e.IS_EQUAL="is-equal",e.IS_NOT_EQUAL="is-not-equal",e.IS_NULL="is-null",e.IS_NOT_NULL="is-not-null",e))(hs||{}),Kt=(e=>(e.NO_FORMATTING="no-formatting",e.POSITIVE="positive",e.NEGATIVE="negative",e.WARN="warn",e.NEUTRAL="neutral",e.ACCENT_1="accent-1",e.ACCENT_2="accent-2",e.CUSTOM="custom",e))(Kt||{});function Il(e){switch(e){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 ri(e){const{type:t,customConfig:n}=e;switch(t){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 li(e){const{type:t,customConfig:n}=e;switch(t){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 hm(e){const t=li(e.style),n=ri(e.style);if(!(t===void 0||n===void 0))return`bgfg(\`${n}\`, \`${t}\`)`}function mm(e){const{column:t,value:n,start:s,end:o}=e;return Fm(t.name,e.condition,n,s,o)}function pm(e){const{column:t,value:n}=e;return xm(t.name,e.condition,n)}function gm(e){const{column:t,value:n}=e;return Am(t.name,e.condition,n)}function fm(e){const{column:t}=e;return Om(t.name,e.condition)}function Cm(e){const{column:t,value:n}=e;return km(t.name,e.condition,n)}function wm(e){const{column:t}=e;if(x.isNumberType(t.type))return mm(e);if(x.isCharType(t.type))return Cm(e);if(x.isStringType(t.type))return pm(e);if(x.isDateType(t.type))return gm(e);if(x.isBooleanType(t.type))return fm(e);throw new Error("Invalid column type")}function Sm(e){switch(e){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 bm(e){switch(e){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 vm(e){switch(e){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 Tm(e){switch(e){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 Em(e){switch(e){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 Va(e){if(x.isNumberType(e)||x.isCharType(e))return"is-equal";if(x.isStringType(e)||x.isDateType(e))return"is-exactly";if(x.isBooleanType(e))return"is-true";throw new Error("Invalid column type")}function Rm(e){if(x.isCharType(e)||x.isStringType(e))return""}function Ua(e){const{condition:t,value:n,start:s,end:o}=e;return{condition:t,value:n,start:s,end:o}}function Ri(e){return{condition:Va(e),value:Rm(e),start:void 0,end:void 0}}function Ba(){return{type:"no-formatting"}}function ym(e){switch(e){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 Im(e){switch(e){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 Mm(e){switch(e){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 Dm(e){switch(e){case"is-equal":return"==";case"is-not-equal":return"!=";case"is-null":return"is null";case"is-not-null":return"is not null"}}function Nm(e){switch(e){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 Fm(e,t,n,s,o){switch(t){case"is-equal":return`${e} == ${n}`;case"is-not-equal":return`${e} != ${n}`;case"is-between":return`${e} > ${s} && ${e} < ${o}`;case"greater-than":return`${e} > ${n}`;case"greater-than-or-equal":return`${e} >= ${n}`;case"less-than":return`${e} < ${n}`;case"less-than-or-equal":return`${e} <= ${n}`;case"is-null":return`${e} == null`;case"is-not-null":return`${e} != null`}}function xm(e,t,n){switch(t){case"is-exactly":return`${e} == "${n}"`;case"is-not-exactly":return`${e} != "${n}"`;case"contains":return`${e} != null && ${e}.contains("${n}")`;case"does-not-contain":return`${e} != null && !${e}.contains("${n}")`;case"starts-with":return`${e} != null && ${e}.startsWith("${n}")`;case"ends-with":return`${e} != null && ${e}.endsWith("${n}")`;case"is-null":return`${e} == null`;case"is-not-null":return`${e} != null`}}function Am(e,t,n){switch(t){case"is-exactly":return`${e} == convertDateTime("${n}")`;case"is-not-exactly":return`${e} != convertDateTime(\`${n}\`)`;case"is-before":return`${e} < convertDateTime(\`${n}\`)`;case"is-before-or-equal":return`${e} <= convertDateTime("${n}")`;case"is-after":return`${e} > convertDateTime(\`${n}\`)`;case"is-after-or-equal":return`${e} >= convertDateTime(\`${n}\`)`;case"is-null":return`${e} == null`;case"is-not-null":return`${e} != null`}}function Om(e,t){switch(t){case"is-true":return`${e} == true`;case"is-false":return`${e} == false`;case"is-null":return`${e} == null`;case"is-not-null":return`${e} != null`}}function km(e,t,n){switch(t){case"is-equal":return`${e} == '${n}'`;case"is-not-equal":return`${e} != '${n}'`;case"is-null":return`isNull(${e})`;case"is-not-null":return`!isNull(${e})`}}function Lm(e,t){if(x.isNumberType(e))return Nm(t);if(x.isCharType(e))return Dm(t);if(x.isStringType(e))return ym(t);if(x.isDateType(e))return Im(t);if(x.isBooleanType(e))return Mm(t);throw new Error("Invalid column type")}function Pm(e,t){if(t===void 0)return Bi.debug("no rules passed."),[];const n=[];let s;const o=new Map;return t.forEach(({config:i,type:r})=>{var g;const{column:l}=i,a=e.find(({name:f,type:w})=>f===l.name&&w===l.type);if(a===void 0){Bi.debug(`Column ${l.name}:${l.type} not found. Ignoring format rule.`,i);return}const[c,d]=(g=r==="conditional"?o.get(a.name):s)!=null?g:["null",void 0],u=cm(i,c);if(u===void 0){Bi.debug("Ignoring format rule.",i);return}const m=d===void 0?-1:n.indexOf(d);m>-1&&n.splice(m,1);const p=r==="conditional"?um(a,u):dm(u);n.push(p),r==="conditional"?o.set(a.name,[u,p]):s=[u,p]}),n}function Hm({type:e}){return x.isNumberType(e)||x.isCharType(e)||x.isStringType(e)||x.isDateType(e)||x.isBooleanType(e)}function yi({animation:e="iris-grid-bottom-bar-slide-up",children:t,className:n,isShown:s,onClick:o,onEntering:i,onEntered:r,onExiting:l,onExited:a}){return h(dt,{in:s,timeout:Le.transitionMs,classNames:e,onEntering:i,onEntered:r,onExiting:l,onExited:a,mountOnEnter:!0,unmountOnExit:!0,children:h("div",{className:B("iris-grid-bottom-bar",n),role:"presentation",onClick:o,onKeyPress:o,children:t})})}const _m=3e3,Vm=5;function Um({isSaving:e=!1,onSave:t,onDiscard:n,discardTooltip:s,saveTooltip:o,error:i,pendingDataErrors:r,pendingDataMap:l,onEntering:a,onEntered:c,onExiting:d,onExited:u}){const[m,p]=T.exports.useState(!1),[g,f]=T.exports.useState(!1),w=T.exports.useRef(),C=Er(e),S=T.exports.useMemo(()=>r.size===0?i:r.size<=Vm?`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)`,[i,r]);T.exports.useEffect(function(){C!=null&&C&&!e&&S==null&&(p(!0),f(!0),w.current=setTimeout(()=>{p(!1)},_m))},[S,e,C]),T.exports.useEffect(function(){w.current&&l.size>0&&(clearTimeout(w.current),p(!1),f(!1))},[l]),T.exports.useEffect(function(){return()=>w.current?clearTimeout(w.current):void 0},[]);const b=l.size;let E;return e?E=h(Vt,{}):g&&(E=aa),R(yi,{className:"pending-data-bottom-bar",isShown:b>0||m||S!=null,onEntering:a,onEntered:c,onExiting:d,onExited:()=>{f(!1),u&&u()},children:[S!=null&&S!==""&&R("div",{className:"error-message",children:[h(Z,{icon:Yn}),h("span",{children:`${S}`})]}),(S==null||S==="")&&h("div",{className:"status-message",children:b>0&&h("span",{children:`${b} row${b>1?"s":""} pending`})}),R("div",{className:"buttons-container",children:[!e&&!g&&h(X,{kind:"secondary",onClick:n,tooltip:s,children:"Discard"}),R(X,{kind:g?"success":"primary",onClick:t,icon:E,disabled:e||g||S!=null,tooltip:o,children:[e&&"Committing...",!e&&g&&"Success",!e&&!g&&"Commit"]})]})]})}var Ee=(e=>(e.COUNT="Count",e.MIN="Min",e.MAX="Max",e.SUM="Sum",e.ABS_SUM="AbsSum",e.VAR="Var",e.AVG="Avg",e.STD="Std",e.FIRST="First",e.LAST="Last",e.SKIP="Skip",e.COUNT_DISTINCT="CountDistinct",e.DISTINCT="Distinct",e.UNIQUE="Unique",e))(Ee||{});const Bm=e=>{switch(e){default:return!1}},Gm=(e,t)=>{switch(e){case Ee.COUNT:case Ee.FIRST:case Ee.LAST:case Ee.COUNT_DISTINCT:case Ee.DISTINCT:case Ee.UNIQUE:return!0;case Ee.MIN:case Ee.MAX:return x.isNumberType(t)||x.isDateType(t)||x.isTextType(t);case Ee.SUM:case Ee.ABS_SUM:case Ee.VAR:case Ee.AVG:case Ee.STD:return x.isNumberType(t);case Ee.SKIP:return!1}},kr=(e,t)=>e.filter(n=>Gm(t,n.type)),zm=(e,t,n,s)=>kr(e,t).map(({name:o})=>o).filter(o=>n.includes(o)?!s:s),qn={isRollupOperation:Bm,filterValidColumns:kr,getOperationColumnNames:zm};var fs=(e=>(e.FILTER_CONTROL_CHANGE_CLEARS_ALL_FILTERS="filter-control-change-clears-all-filters",e.LINK_CHANGE_CLEARS_ALL_FILTERS="link-change-clears-all-filters",e))(fs||{});const Wm=Object.freeze([[fs.FILTER_CONTROL_CHANGE_CLEARS_ALL_FILTERS,!1],[fs.LINK_CHANGE_CLEARS_ALL_FILTERS,!1]]),$m={DEFAULTS:Wm},qm=se.module("ColumnHeaderGroup");function Gi(e){return e instanceof jt}const Ga=class{constructor({name:e,children:t,color:n,depth:s,childIndexes:o,parent:i}){this.getVisibleRange=Ie(r=>{const l=this.childIndexes.flat(),a=W.getVisibleIndexes(l,r),c=Math.min(...a),d=Math.max(...a);return d-c!==l.length-1&&qm.warn(`Column header group ${this.name} is not contiguous`),[c,d]}),this.name=e,this.children=t,this.color=n,this.depth=s,this.childIndexes=o,this.parent=i}setParent(e){this.parent=e}addChildren(e){const t=new Set(this.children.concat(e));this.children=[...t]}removeChildren(e){const t=new Set(this.children);e.forEach(n=>t.delete(n)),this.children=[...t]}get isNew(){return this.name.startsWith(Ga.NEW_GROUP_PREFIX)}};let jt=Ga;jt.NEW_GROUP_PREFIX=":newGroup";const eo=se.module("IrisGridUtils");function On(e,t){return e>=0&&e<t.length}class ne{static dehydrateGridState(t,n){const{isStuckToBottom:s,isStuckToRight:o,movedColumns:i,movedRows:r}=n,{columns:l}=t;return{isStuckToBottom:s,isStuckToRight:o,movedColumns:[...i].filter(({to:a,from:c})=>On(a,l)&&(typeof c=="number"&&On(c,l)||Array.isArray(c)&&On(c[0],l)&&On(c[1],l))).map(({to:a,from:c})=>({to:l[a].name,from:Array.isArray(c)?[l[c[0]].name,l[c[1]].name]:l[c].name})),movedRows:[...r]}}static hydrateGridState(t,n,s=[]){const{isStuckToBottom:o,isStuckToRight:i,movedColumns:r,movedRows:l}=n,{columns:a}=t,c=ne.parseCustomColumnNames(s),d=a.map(({name:u})=>u).concat(c);return{isStuckToBottom:o,isStuckToRight:i,movedColumns:[...r].map(({to:u,from:m})=>{const p=g=>typeof g=="string"?d.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})=>On(u,d)&&(typeof m=="number"&&On(m,d)||Array.isArray(m)&&On(m[0],d)&&On(m[1],d))),movedRows:[...l]}}static dehydrateIrisGridState(t,n){const{aggregationSettings:s={aggregations:ye,showOnTop:!1},advancedFilters:o,customColumnFormatMap:i,isFilterBarShown:r,metrics:l,quickFilters:a,customColumns:c,conditionalFormats:d=ye,reverseType:u,rollupConfig:m=void 0,showSearchBar:p,searchValue:g,selectDistinctColumns:f=ye,selectedSearchColumns:w,sorts:C,invertSearchColumns:S,pendingDataMap:b=wn,frozenColumns:E,columnHeaderGroups:v}=n;O(l);const{userColumnWidths:y,userRowHeights:M}=l,{columns:A}=t;return{advancedFilters:ne.dehydrateAdvancedFilters(A,o),aggregationSettings:s,customColumnFormatMap:[...i],isFilterBarShown:r,quickFilters:ne.dehydrateQuickFilters(a),sorts:ne.dehydrateSort(C),userColumnWidths:[...y].filter(([F])=>F!=null&&F>=0&&F<A.length).map(([F,V])=>[A[F].name,V]),userRowHeights:[...M],customColumns:[...c],conditionalFormats:[...d],reverseType:u,rollupConfig:m,showSearchBar:p,searchValue:g,selectDistinctColumns:[...f],selectedSearchColumns:w,invertSearchColumns:S,pendingDataMap:ne.dehydratePendingDataMap(A,b),frozenColumns:E,columnHeaderGroups:v==null?void 0:v.map(F=>({name:F.name,children:F.children,color:F.color}))}}static hydrateIrisGridState(t,n){var F,V;const{advancedFilters:s,aggregationSettings:o={aggregations:[],showOnTop:!1},customColumnFormatMap:i,isFilterBarShown:r,quickFilters:l,sorts:a,customColumns:c,conditionalFormats:d,userColumnWidths:u,userRowHeights:m,reverseType:p,rollupConfig:g=void 0,showSearchBar:f,searchValue:w,selectDistinctColumns:C,selectedSearchColumns:S,invertSearchColumns:b=!0,pendingDataMap:E=[],frozenColumns:v,columnHeaderGroups:y}=n,{columns:M,formatter:A}=t;return{advancedFilters:ne.hydrateAdvancedFilters(M,s,A.timeZone),aggregationSettings:o,customColumnFormatMap:new Map(i),isFilterBarShown:r,quickFilters:ne.hydrateQuickFilters(M,l,A.timeZone),sorts:ne.hydrateSort(M,a),userColumnWidths:new Map(u.map(([H,N])=>typeof H=="string"||H instanceof String?[M.findIndex(({name:P})=>P===H),N]:[H,N]).filter(([H])=>H!=null&&H>=0&&H<M.length)),customColumns:c,conditionalFormats:d,userRowHeights:new Map(m),reverseType:p,rollupConfig:g,showSearchBar:f,searchValue:w,selectDistinctColumns:C,selectedSearchColumns:S,invertSearchColumns:b,pendingDataMap:ne.hydratePendingDataMap(M,E),frozenColumns:v,columnHeaderGroups:ne.parseColumnHeaderGroups(t,(V=y!=null?y:(F=t.layoutHints)==null?void 0:F.columnGroups)!=null?V:[]).groups}}static dehydrateIrisGridPanelState(t,n){const{isSelectingPartition:s,partition:o,partitionColumn:i,advancedSettings:r}=n;return{isSelectingPartition:s,partition:o,partitionColumn:i!=null?i.name:void 0,advancedSettings:[...r]}}static hydrateIrisGridPanelState(t,n){const{isSelectingPartition:s,partition:o,partitionColumn:i,advancedSettings:r}=n,{columns:l}=t;return{isSelectingPartition:s,partition:o,partitionColumn:i!=null?ne.getColumnByName(l,i):void 0,advancedSettings:new Map([...$m.DEFAULTS,...r])}}static dehydrateQuickFilters(t){return[...t].map(([n,s])=>{const{text:o}=s;return[n,{text:o}]})}static hydrateQuickFilters(t,n,s){const o=n.map(([i,r])=>{const{text:l}=r;let a=null;try{const c=ne.getColumn(t,i);c!=null&&(a=x.makeQuickFilter(c,l,s))}catch(c){eo.error("hydrateQuickFilters error with",l,c)}return[i,{text:l,filter:a}]});return new Map(o)}static dehydrateAdvancedFilters(t,n){return[...n].map(([s,o])=>{const i=ne.getColumn(t,s);O(i);const r=ne.dehydrateAdvancedFilterOptions(i,o.options);return[s,{options:r}]})}static hydrateAdvancedFilters(t,n,s){const o=n.map(([i,r])=>{const l=ne.getColumn(t,i);O(l);const a=ne.hydrateAdvancedFilterOptions(l,r.options);let c=null;try{ne.getColumn(t,i)!=null&&(c=x.makeAdvancedFilter(l,a,s))}catch(d){eo.error("hydrateAdvancedFilters error with",a,d)}return[i,{options:a,filter:c}]});return new Map(o)}static dehydrateAdvancedFilterOptions(t,n){const{selectedValues:s,...o}=n;return{selectedValues:s==null?void 0:s.map(i=>ne.dehydrateValue(i,t==null?void 0:t.type)),...o}}static hydrateAdvancedFilterOptions(t,n){const{selectedValues:s,...o}=n;return{selectedValues:s==null?void 0:s.map(i=>ne.hydrateValue(i,t==null?void 0:t.type)),...o}}static dehydratePendingDataMap(t,n){return[...n].map(([s,{data:o}])=>[s,{data:[...o].map(([i,r])=>[t[i].name,ne.dehydrateValue(r,t[i].type)])}])}static hydratePendingDataMap(t,n){const s=new Map,o=i=>(s.has(i)||s.set(i,t.findIndex(({name:r})=>r===i)),s.get(i));return new Map(n.map(([i,{data:r}])=>[i,{data:new Map(r.map(([l,a])=>{var d;const c=o(l);return O(c),[(d=o(l))!=null?d:null,ne.hydrateValue(a,t[c].type)]}))}]))}static dehydrateValue(t,n){return x.isDateType(n)?ne.dehydrateDateTime(t):x.isLongType(n)?ne.dehydrateLong(t):t}static hydrateValue(t,n){return x.isDateType(n)?ne.hydrateDateTime(t):x.isLongType(n)?ne.hydrateLong(t):t}static dehydrateDateTime(t){return t!=null?I.i18n.DateTimeFormat.format(Tn.FULL_DATE_FORMAT,t):null}static hydrateDateTime(t){return t!=null?I.i18n.DateTimeFormat.parse(Tn.FULL_DATE_FORMAT,t):null}static dehydrateLong(t){return t!=null?`${t}`:null}static hydrateLong(t){return t!=null?I.LongWrapper.ofString(t):null}static dehydrateSort(t){return t.map(n=>{const{column:s,isAbs:o,direction:i}=n;return{column:s.index,isAbs:o,direction:i}})}static hydrateSort(t,n){return n.map(s=>{const{column:o,isAbs:i,direction:r}=s;if(r===x.sortDirection.reverse)return I.Table.reverse();const l=ne.getColumn(t,o);if(l!=null){let a=l.sort();return i&&(a=a.abs()),r===x.sortDirection.descending?a=a.desc():a=a.asc(),a}return null}).filter(s=>s!=null&&s.direction!==x.sortDirection.reverse)}static extractTableSettings(t,n=[]){const{irisGridPanelState:s,irisGridState:o}=t,{partitionColumn:i,partition:r}=s,{advancedFilters:l,quickFilters:a,sorts:c}=o;return{advancedFilters:l,inputFilters:n,partition:r,partitionColumn:i,quickFilters:a,sorts:c}}static applyTableSettings(t,n,s){const{columns:o}=t;let i=[];n.quickFilters&&(i=ne.getFiltersFromFilterMap(ne.hydrateQuickFilters(o,n.quickFilters,s)));let r=[];n.advancedFilters&&(r=ne.getFiltersFromFilterMap(ne.hydrateAdvancedFilters(o,n.advancedFilters,s)));const l=ne.getFiltersFromInputFilters(o,n.inputFilters,s);let a=[];n.sorts&&(a=ne.hydrateSort(o,n.sorts));let c=[...i,...r];const{partition:d,partitionColumn:u}=n;if(d!=null&&u!=null){const m=ne.getColumnByName(o,u);m&&(c=[m.filter().eq(I.FilterValue.ofString(d)),...c])}c=[...l,...c],t.applyFilter(c),t.applySort(a)}static getInputFiltersForColumns(t,n=[]){return n.filter(({name:s,type:o})=>t.find(({name:i,type:r})=>i===s&&r===o))}static getFiltersFromInputFilters(t,n=[],s){return n.map(({name:o,type:i,value:r})=>{const l=t.find(({name:a,type:c})=>a===o&&c===i);if(l)try{return x.makeQuickFilter(l,r,s)}catch(a){eo.debug("Unable to create input filter",a)}return null}).filter(o=>o!=null)}static getFiltersFromFilterMap(t){const n=[],s=Array.from(t.keys());for(let o=0;o<s.length;o+=1){const i=s[o],r=t.get(i);(r==null?void 0:r.filter)!=null&&n.push(r.filter)}return n}static getHiddenColumns(t){return[...t.entries()].filter(([,n])=>n===0).map(([n])=>n)}static parseCustomColumnNames(t){return t.map(n=>n.split("=")[0])}static getRemovedCustomColumnNames(t,n){const s=ne.parseCustomColumnNames(t),o=ne.parseCustomColumnNames(n);return s.filter(i=>!o.includes(i))}static removeSortsInColumns(t,n){return t.filter(s=>!n.includes(s.column.name))}static removeFiltersInColumns(t,n,s){const o=t.map(({name:r})=>r),i=new Map(n);return s.forEach(r=>i.delete(o.indexOf(r))),i}static removeColumnFromMovedColumns(t,n,s){const o=t.map(({name:r})=>r);let i=[...n];for(let r=0;r<s.length;r+=1){const l=s[r];let a=o.findIndex(d=>d===l);const c=[];for(let d=0;d<i.length;d+=1){const u=i[d],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?c.push({...m,from:p}):c.push({...m,from:[p,g]})),a=W.applyItemMoves(a,a,[u])[0][0]}i=c,o.splice(o.findIndex(d=>d===l),1)}return i}static removeColumnsFromSelectDistinctColumns(t,n){return t.filter(s=>!n.includes(s))}static getVisibleColumnsInRange(t,n,s,o,i){const r=[];for(let l=n;l<=s;l+=1){const a=W.getModelIndex(l,o);a>=0&&a<t.length&&!i.includes(a)&&r.push(t[a])}return r}static getPrevVisibleColumns(t,n,s,o,i){const r=[];let l=n;for(;l>=0&&r.length<s;){const a=W.getModelIndex(l,o);a>=0&&a<t.length&&!i.includes(a)&&r.unshift(t[a]),l-=1}return r}static getNextVisibleColumns(t,n,s,o,i){const r=[];let l=n;for(;l<t.length&&r.length<s;){const a=W.getModelIndex(l,o);a>=0&&a<t.length&&!i.includes(a)&&r.push(t[a]),l+=1}return r}static getColumnsToFetch(t,n,s){const o=[...n];return s.forEach(i=>{const r=t.find(({name:l})=>l===i);r!=null&&!n.includes(r)&&o.push(r)}),o}static getModelViewportColumns(t,n,s,o,i=[],r=[],l=0){if(n==null||s==null)return null;const a=ne.getVisibleColumnsInRange(t,n,s,o,i),c=a.length*l,d=ne.getPrevVisibleColumns(t,n-1,c,o,i),u=ne.getNextVisibleColumns(t,s+1,c,o,i),m=[...d,...a,...u];return ne.getColumnsToFetch(t,m,r)}static rangeSetFromRanges(t){const n=t.slice().sort((s,o)=>(O(s.startRow),O(o.startRow),s.startRow-o.startRow)).map(s=>{const{startRow:o,endRow:i}=s;return O(o),O(i),I.RangeSet.ofRange(o,i)});return I.RangeSet.ofRanges(n)}static isValidSnapshotRanges(t){if(t==null||t.length===0)return!1;const n=new Map;for(let i=0;i<t.length;i+=1){const r=t[i],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()],o=n.get(s[0]).sort().join(",");for(let i=1;i<s.length;i+=1)if(n.get(s[i]).sort().join(",")!==o)return!1;return!0}static isValidIndex(t){return!Number.isInteger(t)||typeof t!="number"?!1:t>=0}static columnsFromRanges(t,n){var o,i;if(t==null||t.length===0)return[];if(t[0].startColumn===null&&t[0].endColumn===null)return[...n];const s=new Set;for(let r=0;r<t.length;r+=1){const l=t[r];O(l.startColumn),O(l.endColumn);for(let a=(o=l.startColumn)!=null?o:0;a<=((i=l.endColumn)!=null?i:n.length-1);a+=1)s.add(a)}return[...s].map(r=>n[r])}static snapshotDataToMatrix(t){const{columns:n,rows:s}=t,o=[];for(let i=0;i<s.length;i+=1){const r=s[i],l=[];for(let a=0;a<n.length;a+=1){const c=n[a],d=r.get(c);l.push(d)}o.push(l)}return o}static getModelRollupConfig(t,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:o=[],showConstituents:i=!0,showNonAggregatedColumns:r=!0,includeDescriptions:l=!0}=n!=null?n:{},{aggregations:a=[]}=s!=null?s:{},c=a.map(({operation:g,selected:f,invert:w})=>qn.isRollupOperation(g)?[]:qn.getOperationColumnNames(t,g,f,w)),d={};for(let g=0;g<a.length;g+=1)d[a[g].operation]=c[g];if(r){const g=new Set(t.map(f=>f.name).filter(f=>!o.includes(f)));if(c.forEach(f=>{f.forEach(w=>g.delete(w))}),g.size>0){const f=(p=d[Ee.FIRST])!=null?p:[];d[Ee.FIRST]=[...f,...g]}}return{groupingColumns:o,includeConstituents:i,includeDescriptions:l,aggregations:d}}static getPendingErrors(t){t.forEach((n,s)=>{if(!ne.isValidIndex(s))throw new Error(`Invalid rowIndex ${s}`);const{data:o}=n;o.forEach((i,r)=>{if(!ne.isValidIndex(r))throw new Error(`Invalid columnIndex ${r}`)})})}static getColumn(t,n){return n<t.length?t[n]:(eo.error("Unable to retrieve column",n,">=",t.length),null)}static getColumnByName(t,n){const s=t.find(({name:o})=>o===n);return s==null&&eo.error("Unable to retrieve column by name",n,t.map(({name:o})=>o)),s}static changeFilterColumnNamesToIndexes(t,n){return n.map(({name:s,filter:o})=>{const i=t.findIndex(r=>r.name===s);return i<0?null:[i,o]}).filter(s=>s!=null)}static combineFiltersFromList(t,n){n.sort((o,i)=>o.operator==="eq"&&i.operator!=="eq"?1:o.operator!=="eq"&&i.operator==="eq"?-1:o.startColumnIndex-i.startColumnIndex);let s="";for(let o=0;o<n.length;o+=1){const{text:i,value:r,operator:l}=n[o];if(r!==void 0){let a="";l!==void 0&&(r==null&&l==="eq"?a="=":l!=="eq"&&(l==="startsWith"||l==="endsWith"?a="*":a=x.getFilterOperatorString(l)));let c=`${a}${i}`;l==="startsWith"&&(c=`${i}${a}`),t!=null&&r!==null&&x.isCharType(t)&&(c=`${a}${String.fromCharCode(parseInt(i,10))}`),o!==0&&(s+=l==="eq"?" || ":" && "),s+=c}}return s}static parseColumnHeaderGroups(t,n){let s=1;const o=new Map,i=new Map,r=n==null?void 0:n.filter(({children:u})=>u.length>0);if(r.length===0)return{groups:[],maxDepth:s,parentMap:o,groupMap:i};const l=new Map(r.map(u=>[u.name,u])),a=new Set,c=u=>{const{name:m}=u;if(t.getColumnIndexByName(m)!=null)throw new Error(`Column header group has same name as column: ${m}`);const p=i.get(m);if(p)return p;const g=[];let f=1;u.children.forEach(C=>{if(a.has(C))throw new Error(`Column group child ${C} specified in multiple groups`);a.add(C);const S=l.get(C),b=t.getColumnIndexByName(C);if(S){const E=c(S);g.push(...E.childIndexes),f=Math.max(f,E.depth+1)}else if(b!=null)g.push(b),f=Math.max(f,1);else throw new Error(`Unknown child ${C} in group ${m}`)});const w=new jt({...u,depth:f,childIndexes:g.flat()});return i.set(m,w),u.children.forEach(C=>o.set(C,w)),s=Math.max(s,w.depth+1),w},d=new Set;return r.forEach(u=>{const{name:m}=u;if(d.has(m))throw new Error(`Duplicate column group name: ${m}`);d.add(m),c(u)}),i.forEach(u=>{var m;u.setParent((m=o.get(u.name))==null?void 0:m.name)}),{groups:[...i.values()],maxDepth:s,groupMap:i,parentMap:o}}}const wt=se.module("IrisGridCopyHandler"),Re=class extends T.exports.Component{constructor(e){super(e),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:Re.COPY_STATES.IDLE,buttonState:Re.BUTTON_STATES.COPY,isShown:!1,rowCount:0}}static getStatusMessageText(e,t){switch(e){case Re.COPY_STATES.CONFIRMATION_REQUIRED:return`Are you sure you want to copy ${t.toLocaleString()} rows to your clipboard?`;case Re.COPY_STATES.CLICK_REQUIRED:return`Fetched ${t.toLocaleString()} rows!`;case Re.COPY_STATES.FETCH_ERROR:return"Unable to copy data.";case Re.COPY_STATES.FETCH_IN_PROGRESS:return`Fetching ${t.toLocaleString()} rows for clipboard...`;case Re.COPY_STATES.DONE:return"Copied to Clipboard!";default:return""}}static getCopyButtonText(e){switch(e){case Re.BUTTON_STATES.FETCH_IN_PROGRESS:return"Fetching";case Re.BUTTON_STATES.CLICK_TO_COPY:return"Click to Copy";case Re.BUTTON_STATES.RETRY:return"Retry";default:return"Copy"}}componentDidMount(){const{copyOperation:e}=this.props;e!=null&&this.startCopy()}componentDidUpdate(e){const{copyOperation:t}=this.props;e.copyOperation!==t&&this.startCopy()}componentWillUnmount(){this.stopCopy()}startCopy(){wt.debug2("startCopy"),this.stopCopy();const{copyOperation:e}=this.props;if(e==null){wt.debug2("No copy operation set, cancelling out"),this.setState({isShown:!1});return}const{ranges:t,error:n}=e;if(n!=null){wt.debug("Showing copy error",n),this.setState({isShown:!0,copyState:Re.COPY_STATES.DONE,error:n}),this.startHideTimer();return}const s=ee.rowCount(t);this.setState({rowCount:s,isShown:!0,error:void 0}),s>Re.NO_PROMPT_THRESHOLD?this.setState({buttonState:Re.BUTTON_STATES.COPY,copyState:Re.COPY_STATES.CONFIRMATION_REQUIRED}):this.startFetch()}stopCopy(){this.textData=void 0,this.stopFetch(),this.stopHideTimer()}handleBackgroundClick(){wt.debug2("handleBackgroundClick");const{copyState:e}=this.state;e===Re.COPY_STATES.DONE&&this.setState({isShown:!1})}handleCancelClick(){wt.debug2("handleCancelClick"),this.stopFetch(),this.setState({isShown:!1})}handleCopyClick(){wt.debug2("handleCopyClick"),this.textData!=null?this.copyText(this.textData):this.startFetch()}handleHideTimeout(){wt.debug2("handleHideTimeout"),this.stopHideTimer(),this.setState({isShown:!1})}copyText(e){wt.debug2("copyText",e),this.textData=e,fo(e).then(()=>{this.setState({copyState:Re.COPY_STATES.DONE}),this.startHideTimer()},t=>{wt.error("copyText error",t),this.setState({buttonState:Re.BUTTON_STATES.CLICK_TO_COPY,copyState:Re.COPY_STATES.CLICK_REQUIRED})})}startFetch(){this.stopFetch(),this.setState({buttonState:Re.BUTTON_STATES.FETCH_IN_PROGRESS,copyState:Re.COPY_STATES.FETCH_IN_PROGRESS});const{model:e,copyOperation:t}=this.props,{ranges:n,includeHeaders:s,userColumnWidths:o,movedColumns:i,formatValues:r}=t;wt.debug("startFetch",n);const l=ne.getHiddenColumns(o);let a=W.getModelRanges(n,i);if(l.length>0){const d=l.map(ee.makeColumn);a=ee.subtractRangesFromRanges(a,d)}const c=r!=null&&r?(d,u)=>e.displayString(d,u.type,u.name):d=>`${d}`;this.fetchPromise=Ue.makeCancelable(e.textSnapshot(a,s,c)),this.fetchPromise.then(d=>{this.fetchPromise=void 0,this.copyText(d)}).catch(d=>{d instanceof po?wt.debug("User cancelled copy."):(wt.error("Error fetching contents",d),this.fetchPromise=void 0,this.setState({buttonState:Re.BUTTON_STATES.RETRY,copyState:Re.COPY_STATES.FETCH_ERROR}))})}stopFetch(){this.fetchPromise&&(wt.debug2("stopFetch"),this.fetchPromise.cancel(),this.fetchPromise=void 0)}startHideTimer(){this.stopHideTimer(),this.hideTimer=setTimeout(this.handleHideTimeout,Re.HIDE_TIMEOUT)}stopHideTimer(){this.hideTimer!=null&&(clearTimeout(this.hideTimer),this.hideTimer=void 0)}render(){const{onEntering:e,onEntered:t,onExiting:n,onExited:s}=this.props,{buttonState:o,copyState:i,isShown:r,rowCount:l,error:a}=this.state,c=i===Re.COPY_STATES.DONE?"fade":"copy-slide-up",d=Re.getCopyButtonText(o),u=a!=null?a:Re.getStatusMessageText(i,l),m=i!==Re.COPY_STATES.DONE,p=o===Re.BUTTON_STATES.FETCH_IN_PROGRESS,g=i===Re.COPY_STATES.DONE;return R(yi,{animation:c,isShown:r,className:B("iris-grid-copy-handler",{"copy-done":g}),onClick:this.handleBackgroundClick,onEntering:e,onEntered:t,onExiting:n,onExited:s,children:[h("div",{className:"status-message",children:h("span",{children:u})}),h(dt,{in:m,timeout:Le.transitionMs,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,children:R("div",{className:"buttons-container",children:[h("button",{type:"button",className:"btn btn-outline-secondary btn-cancel",onClick:this.handleCancelClick,children:"Cancel"}),R(X,{kind:p?"tertiary":"primary",className:B("btn-copy",{"btn-spinner":p}),onClick:this.handleCopyClick,disabled:p,children:[p&&h(Vt,{}),d]})]})})]})}};let $s=Re;$s.NO_PROMPT_THRESHOLD=1e4;$s.HIDE_TIMEOUT=3e3;$s.COPY_STATES={IDLE:"IDLE",CONFIRMATION_REQUIRED:"CONFIRMATION_REQUIRED",FETCH_IN_PROGRESS:"FETCH_IN_PROGRESS",FETCH_ERROR:"FETCH_ERROR",CLICK_REQUIRED:"CLICK_REQUIRED",DONE:"DONE"};$s.BUTTON_STATES={COPY:"COPY",FETCH_IN_PROGRESS:"FETCH_IN_PROGRESS",CLICK_TO_COPY:"CLICK_TO_COPY",RETRY:"RETRY"};$s.defaultProps={copyOperation:null,onEntering:()=>{},onEntered:()=>{},onExiting:()=>{},onExited:()=>{}};class za extends T.exports.PureComponent{constructor(t){super(t);const{debounceMs:n}=t;this.debouncedSendUpdate=ft(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}=t;this.initialValue=s,this.state={isChanged:!1,value:s}}componentDidMount(){var t;(t=this.inputField)==null||t.focus()}componentDidUpdate(t){const{debounceMs:n}=this.props;t.debounceMs!==n&&(this.debouncedSendUpdate.flush(),this.debouncedSendUpdate=ft(this.sendUpdate.bind(this),n))}componentWillUnmount(){this.debouncedSendUpdate.cancel()}setValue(t){this.initialValue=t,this.setState({value:t})}focus(){var t;(t=this.inputField)==null||t.focus()}handleChange(t){const{value:n}=t.target;this.setState({value:n,isChanged:!0}),this.debouncedSendUpdate(n)}handleCancel(){this.debouncedSendUpdate.cancel();const{initialValue:t}=this,{isChanged:n}=this.state;n&&this.sendUpdate(t);const{onDone:s}=this.props;s()}handleCommit(t=!0,n=!0){this.debouncedSendUpdate.flush();const{onDone:s}=this.props;s(t,n)}handleFocus(){var t;(t=this.inputField)==null||t.select()}handleBlur(t){const{relatedTarget:n}=t;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(t=!1){this.debouncedSendUpdate.flush();const{onTab:n}=this.props;n(t)}handleKeyDown(t){switch(t.key){case"Escape":t.stopPropagation(),t.preventDefault(),this.handleCancel();break;case"Enter":t.stopPropagation(),t.preventDefault(),this.handleCommit();break;case"Tab":t.stopPropagation(),t.preventDefault(),this.handleTab(t.shiftKey);break}}handleContextMenu(t){const{onContextMenu:n}=this.props;n(t)}sendUpdate(t){const{onChange:n}=this.props;n(t)}render(){const{className:t,style:n,isAdvancedFilterSet:s,onAdvancedFiltersTriggered:o}=this.props,{value:i}=this.state;return R("div",{style:n,className:"iris-grid-input-autosized-wrapper","data-value":i,children:[h("input",{ref:r=>{this.inputField=r},className:B("iris-grid-input-field",t),type:"text",value:i,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(X,{kind:"ghost",className:B("btn-link-icon advanced-filter-button",{"filter-set":s}),onClick:o,onContextMenu:this.handleContextMenu,children:R("div",{className:"fa-layers ",children:[h(Z,{icon:fr,className:"filter-solid"}),h(Z,{icon:oi,className:"filter-light"})]})})})]})}}za.defaultProps={style:{},className:"",value:"",isAdvancedFilterSet:!1,onAdvancedFiltersTriggered:()=>{},onChange:()=>{},onDone:()=>{},onTab:()=>{},onContextMenu:()=>{},debounceMs:150};class Km extends Cs{constructor(t){super(),this.irisGrid=t}onDown(t){const{selectedRanges:n}=this.irisGrid.state;return t.key==="c"&&Ne.isModifierKeyDown(t)?(ne.isValidSnapshotRanges(n)?this.irisGrid.copyRanges(n):this.irisGrid.copyRanges(n,!1,!1,"Invalid copy ranges"),!0):!1}}const Xm={TOGGLE_QUICK_FILTER:De.createAndAdd({id:"TABLE.TOGGLE_QUICK_FILTER",name:"Toggle Quick Filter",shortcut:[ie.CTRL,ae.F],macShortcut:[ie.CMD,ae.F]}),CLEAR_ALL_FILTERS:De.createAndAdd({id:"TABLE.CLEAR_ALL_FILTERS",name:"Clear All Table Filters",shortcut:[ie.CTRL,ae.E],macShortcut:[ie.CMD,ae.E]}),CLEAR_FILTERS:De.createAndAdd({id:"TABLE.CLEAR_FILTERS",name:"Clear Active Table Filters",shortcut:[ie.CTRL,ie.SHIFT,ae.E],macShortcut:[ie.CMD,ie.SHIFT,ae.E]}),REVERSE:De.createAndAdd({id:"TABLE.REVERSE",name:"Reverse",shortcut:[ie.CTRL,ae.I],macShortcut:[ie.CMD,ae.I]}),TOGGLE_SEARCH:De.createAndAdd({id:"TABLE.TOGGLE_SEARCH",name:"Toggle Search",shortcut:[ie.CTRL,ie.SHIFT,ae.F],macShortcut:[ie.CMD,ie.SHIFT,ae.F]}),GOTO_ROW:De.createAndAdd({id:"TABLE.GOTO_ROW",name:"Go to Row",shortcut:[ie.CTRL,ae.G],macShortcut:[ie.CMD,ae.G]})},Ym={COMMIT:De.createAndAdd({id:"INPUT_TABLE.COMMIT",name:"Commit",shortcut:[ie.CTRL,ae.S],macShortcut:[ie.CMD,ae.S]}),DISCARD:De.createAndAdd({id:"INPUT_TABLE.DISCARD",name:"Discard",shortcut:[ie.CTRL,ie.ALT,ae.S],macShortcut:[ie.CMD,ie.OPTION,ae.S]})},Lt={TABLE:Xm,INPUT_TABLE:Ym};class Qm extends Cs{constructor(t){super(),this.irisGrid=t}onDown(t){if(Lt.TABLE.REVERSE.matchesEvent(t)){if(!this.irisGrid.isReversible())return!1;const{reverseType:n}=this.irisGrid.state;return n===x.REVERSE_TYPE.NONE?this.irisGrid.reverse(x.REVERSE_TYPE.POST_SORT):this.irisGrid.reverse(x.REVERSE_TYPE.NONE),!0}return!1}}class jm extends Cs{constructor(t){super(),this.irisGrid=t}onDown(t){return Lt.TABLE.CLEAR_FILTERS.matchesEvent(t)?(this.irisGrid.clearAllFilters(),!0):!1}}class Zm extends Qe{constructor(t){super(850),this.irisGrid=t}destroyColumnTooltip(){this.irisGrid.setState({overflowButtonTooltipProps:null})}setCursor(t){return this.isHoveringOverflowButton(t)?(this.cursor="pointer",{stopPropagation:!1,preventDefault:!1}):(this.cursor=null,!1)}getButtonPosition({x:t,y:n,column:s,row:o}){if(s==null||o==null)return null;const{renderer:i,grid:r,state:l,props:a}=this.irisGrid;if(!r)return null;const{metrics:c}=l,{model:d}=a,{canvasContext:u}=r,m=r.getTheme(),p={context:u,mouseX:t,mouseY:n,metrics:c,model:d,theme:m},{left:g,top:f,width:w,height:C}=i.getCellOverflowButtonPosition(p);return g==null||w==null||f==null||C==null?null:{left:g,top:f,width:w,height:C}}isHoveringOverflowButton(t){var C;const{x:n,y:s}=t,{left:o,top:i,width:r,height:l}=(C=this.getButtonPosition(t))!=null?C:{};if(o==null||r==null||i==null||l==null)return!1;const{renderer:a,grid:c,state:d,props:u}=this.irisGrid;if(!c)return!1;const{metrics:m}=d,{model:p}=u,{canvasContext:g}=c,f=c.getTheme(),w={context:g,mouseX:n,mouseY:s,metrics:m,model:p,theme:f};return a.shouldRenderOverflowButton(w)&&n>=o&&n<=o+r&&s>=i&&s<=i+l}onMove(t){if(this.isHoveringOverflowButton(t)){const{overflowButtonTooltipProps:n}=this.irisGrid.state,s=this.getButtonPosition(t);ct(n,s)||this.irisGrid.setState({overflowButtonTooltipProps:s})}else this.destroyColumnTooltip();return this.setCursor(t)}onWheel(t){return this.destroyColumnTooltip(),this.onMove(t)}onDown(t){this.destroyColumnTooltip();const{column:n,row:s}=t;return this.isHoveringOverflowButton(t)&&this.irisGrid.setState({showOverflowModal:!0,overflowText:this.irisGrid.getValueForCell(n,s)}),!1}onContextMenu(){return this.destroyColumnTooltip(),!1}onLeave(){return this.destroyColumnTooltip(),!1}}class Jm extends Qe{constructor(t){super(),this.irisGrid=t,this.cursor=null}isActive(){const{isSelectingColumn:t}=this.irisGrid.props;return t}isValidColumn(t){if(t==null)return!1;const{columnSelectionValidator:n}=this.irisGrid.props;return n!=null?n(t):!0}updateColumnSelectionStatus(){const{columnSelectionValidator:t}=this.irisGrid.props;t!=null&&t(null)}getTableColumn(t){if(t==null)return null;const{model:n}=this.irisGrid.props,s=this.irisGrid.getModelColumn(t);return s==null?null:n.columns[s]}onMove(t){if(!this.isActive())return!1;const{columnAllowedCursor:n,columnNotAllowedCursor:s}=this.irisGrid.props,{column:o}=t,i=this.getTableColumn(o);return this.isValidColumn(i)?(this.cursor=n,this.irisGrid.setState({hoverSelectColumn:o})):(this.cursor=s,this.irisGrid.setState({hoverSelectColumn:null})),!0}onWheel(t){if(!this.isActive())return!1;const{columnAllowedCursor:n,columnNotAllowedCursor:s}=this.irisGrid.props,{column:o}=t,i=this.getTableColumn(o);return this.isValidColumn(i)?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(t){if(!this.isActive())return!1;const{column:n}=t,s=this.getTableColumn(n);return s!=null&&this.isValidColumn(s)&&this.irisGrid.selectColumn(s),!0}}class ep extends Qe{constructor(t){super(),this.irisGrid=t}hideColumnTooltip(){const{tooltip:t}=this.irisGrid;t&&(t.stopTimer(),t.hide())}onDown(){return this.hideColumnTooltip(),!1}onContextMenu(){return this.hideColumnTooltip(),!1}onWheel(){return this.hideColumnTooltip(),!1}onLeave(t,n,s){const{relatedTarget:o}=s instanceof MouseEvent?s:s.nativeEvent,{tooltip:i}=this.irisGrid;if(!i)return!1;const r=i.popper.current;return r&&o instanceof Element&&r.element.contains(o)||this.hideColumnTooltip(),!1}onMove(t){const{column:n,row:s,columnHeaderDepth:o}=t,{shownColumnTooltip:i}=this.irisGrid.state;let r=null;return n!==null&&s===null&&o===0&&(r=n),r!==i&&this.irisGrid.setState({shownColumnTooltip:r}),!1}}const Wa=class extends T.exports.Component{constructor(e=Wa.defaultProps){super(e),this.handleInputChange=this.handleInputChange.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.inputRef=te.createRef()}handleInputChange(){const{onChange:e}=this.props;this.inputRef.current&&e(this.inputRef.current.value)}closeContextMenu(){const{forwardedProps:e}=this.props,{closeMenu:t}=e;t(!0)}revertToDefault(){const{onChange:e}=this.props;e(null)}returnFocusToContextMenu(){const e=Gu.getClosestByClassName(this.inputRef.current,"context-menu-container");e instanceof HTMLElement&&e.focus()}handleKeyDown(e){switch(e.key){case"Enter":e.stopPropagation(),this.closeContextMenu();break;case"Escape":e.stopPropagation(),this.revertToDefault(),this.closeContextMenu();break;case"ArrowRight":case"ArrowLeft":e.stopPropagation();break;case"ArrowUp":case"ArrowDown":this.returnFocusToContextMenu();break;default:e.stopPropagation()}}render(){const{formatString:e,forwardedProps:t,placeholder:n,title:s}=this.props,{menuItem:{description:o},iconElement:i}=t;return R("div",{className:"form-group flex-grow mb-0",children:[R("div",{className:"custom-format-title",children:[h("span",{className:"icon",children:i}),R("label",{className:"title mb-0",htmlFor:"custom-format-input",children:[s,o!=null&&h(We,{children:o})]})]}),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:e,ref:this.inputRef,placeholder:n,onKeyDown:this.handleKeyDown,onChange:this.handleInputChange,autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:"false"})})]})}};let $a=Wa;$a.defaultProps={formatString:"",forwardedProps:{menuItem:{},closeMenu(e){},iconElement:null},placeholder:"",title:"",onChange(e){}};class Rt{static isDefaultSelected(t){return!t||![_e.TYPE_CONTEXT_CUSTOM,_e.TYPE_CONTEXT_PRESET].includes(t.type)}static isCustomSelected(t){return t!=null&&t.type===_e.TYPE_CONTEXT_CUSTOM}static makeOption(t,n,s,o){return{title:t,description:t,group:s,format:n,isSelected:o}}static makeCustomFormatOption(t,n,s,o,i){return{title:t.label,description:t.label,format:t,group:n,isSelected:o,menuElement:h($a,{formatString:t.formatString,title:t.label,placeholder:s,onChange:i})}}}const Xt=class{static getOptions(e,t){const n=new Date,o=[{group:Xt.dateGroup,formatString:"yyyy-MM-dd"},{group:Xt.dateGroup,formatString:"MM-dd-yyyy"},{group:Xt.timeGroup,formatString:"HH:mm:ss"},{group:Xt.timeGroup,formatString:"HH:mm:ss.SSS"},{group:Xt.timeGroup,formatString:"HH:mm:ss.SSSSSSSSS"},{group:Xt.dateTimeGroup,formatString:"yyyy-MM-dd HH:mm:ss"},{group:Xt.dateTimeGroup,formatString:"yyyy-MM-dd HH:mm:ss.SSS"},{group:Xt.dateTimeGroup,formatString:"yyyy-MM-dd HH:mm:ss.SSSSSSSSS"}].map(r=>{const l=jn.makeFormat("",r.formatString,jn.TYPE_CONTEXT_PRESET),a=e.getFormattedString(n,x.dataType.DATETIME,"",l);return Rt.makeOption(a,l,r.group,jn.isSameFormat(l,t))});return[Rt.makeOption("Default",null,Xt.dateGroup,Rt.isDefaultSelected(t)),...o]}};let Ii=Xt;Ii.dateGroup=10;Ii.timeGroup=20;Ii.dateTimeGroup=30;const Yt=class{static getOptions(e,t){const n=[{format:Be.FORMAT_PERCENT,group:Yt.presetGroup},{format:Be.FORMAT_BASIS_POINTS,group:Yt.presetGroup},{format:Be.FORMAT_MILLIONS,group:Yt.presetGroup},{format:Be.FORMAT_SCIENTIFIC_NOTATION,group:Yt.presetGroup},{format:Be.FORMAT_ROUND,group:Yt.presetRoundGroup},{format:Be.FORMAT_ROUND_TWO_DECIMALS,group:Yt.presetRoundGroup},{format:Be.FORMAT_ROUND_FOUR_DECIMALS,group:Yt.presetRoundGroup}],s=Rt.makeOption("Default",null,Yt.defaultGroup,Rt.isDefaultSelected(e)),o=n.map(a=>Rt.makeOption(a.format.label,a.format,a.group,Be.isSameFormat(a.format,e))),i=Rt.isCustomSelected(e),r=i?e:Be.makeCustomFormat(),l=Rt.makeCustomFormatOption(r,Yt.customGroup,Be.DEFAULT_FORMAT_STRING,i,a=>{if(a!=null){const c=Be.makeCustomFormat(a);Be.isValid(c)&&t(c)}else t(null)});return[s,...o,l]}};let So=Yt;So.defaultGroup=10;So.presetGroup=20;So.presetRoundGroup=30;So.customGroup=40;const ao=class{static getOptions(e,t){const n=[{format:kt.FORMAT_MILLIONS,group:ao.presetGroup},{format:kt.FORMAT_SCIENTIFIC_NOTATION,group:ao.presetGroup}],s=Rt.makeOption("Default",null,ao.defaultGroup,Rt.isDefaultSelected(e)),o=n.map(a=>Rt.makeOption(a.format.label,a.format,a.group,kt.isSameFormat(a.format,e))),i=Rt.isCustomSelected(e),r=i?e:kt.makeCustomFormat(),l=Rt.makeCustomFormatOption(r,ao.customGroup,kt.DEFAULT_FORMAT_STRING,i,a=>{if(a!=null){const c=kt.makeCustomFormat(a);kt.isValid(c)&&t(c)}else t(null)});return[s,...o,l]}};let Mi=ao;Mi.defaultGroup=10;Mi.presetGroup=20;Mi.customGroup=30;const Ml=se.module("IrisGridContextMenuHandler"),tp=150,Dl="yyyy-MM-dd HH:mm:ss.SSSSSSSSS",$=class extends Qe{constructor(e){super(),this.debouncedUpdateCustomFormat=ft(e.handleFormatSelection,tp),this.irisGrid=e}static getQuickFilterCondition(e,t,n){return e&&n==="&&"?e.and(t):e&&n==="||"?e.or(t):t}static getQuickFilterText(e,t,n){return n&&e!=null?`${e} ${n} ${t}`:t}static getOperatorAsText(e){return e==="&&"?"And":"Or"}static getNumberValueEqualsFilter(e,t){const n=e.filter();if(t===Number.POSITIVE_INFINITY)return I.FilterCondition.invoke("isInf",n).and(n.greaterThan(I.FilterValue.ofNumber(0)));if(t===Number.NEGATIVE_INFINITY)return I.FilterCondition.invoke("isInf",n).and(n.lessThan(I.FilterValue.ofNumber(0)));if(Number.isNaN(t))return I.FilterCondition.invoke("isNaN",n);const s=$.getFilterValueForNumberOrChar(e.type,t);return n.eq(s)}static getFilterValueForNumberOrChar(e,t){return x.isCharType(e)?I.FilterValue.ofString(String.fromCharCode(t)):I.FilterValue.ofNumber(t)}static getRowOptionFormatted(e,t,n=30){return`${e} "${gs.truncate(t,n-e.length-3)}"`}componentWillUnmount(){this.debouncedUpdateCustomFormat.flush()}getHeaderActions(e,t){var F;const{irisGrid:n}=this,{column:s}=t;O(s);const{model:o}=n.props,{columns:i}=o,r=i[e],l=[],{metrics:a,reverseType:c,quickFilters:d,advancedFilters:u,searchFilter:m}=n.state,p=n.getTheme();O(a);const{filterIconColor:g,filterBarActiveColor:f,contextMenuSortIconColor:w,contextMenuReverseIconColor:C}=p,S=o.sort,b=x.getSortForColumn(S,e),E=c!==x.REVERSE_TYPE.NONE,{userColumnWidths:v}=a,y=[...v.values()].some(V=>V===0),M=o.getColumnHeaderParentGroup(e,0)===void 0,A=o.isColumnFrozen(e);return l.push({title:"Hide Column",group:$.GROUP_HIDE_COLUMNS,action:()=>{this.irisGrid.hideColumnByVisibleIndex(s)}}),l.push({title:A?"Unfreeze Column":"Freeze Column",group:$.GROUP_HIDE_COLUMNS,disabled:!M,action:()=>{A?this.irisGrid.unFreezeColumnByColumnName(r.name):this.irisGrid.freezeColumnByColumnName(r.name)},order:10}),l.push({title:"Show All Columns",group:$.GROUP_HIDE_COLUMNS,action:()=>{this.irisGrid.showAllColumns()},disabled:!y}),l.push({title:"Quick Filters",icon:cn,iconColor:f,shortcut:Lt.TABLE.TOGGLE_QUICK_FILTER,group:$.GROUP_FILTER,order:10,action:()=>{this.irisGrid.toggleFilterBar(s)}}),l.push({title:"Advanced Filters",icon:u.get(e)?fr:oi,iconColor:g,group:$.GROUP_FILTER,order:20,action:()=>{this.irisGrid.handleAdvancedMenuOpened(s)}}),l.push({title:"Clear Table Filters",group:$.GROUP_FILTER,order:40,shortcut:Lt.TABLE.CLEAR_FILTERS,action:()=>{this.irisGrid.clearAllFilters()},disabled:!(d.size>0||u.size>0||m!=null)}),l.push({title:"Sort by",icon:cn,iconColor:w,group:$.GROUP_SORT,order:10,actions:this.sortByActions(r,e,b)}),l.push({title:"Add Additional Sort",disabled:b&&S.length===1||E&&S.length===1||b&&E&&S.length===2||S.length===0,group:$.GROUP_SORT,order:20,actions:this.additionalSortActions(r,e)}),l.push({title:"Clear Table Sorting",disabled:S.length===0||E&&S.length===1,group:$.GROUP_SORT,action:()=>{this.irisGrid.sortColumn(s,$.COLUMN_SORT_DIRECTION.none)},order:30}),l.push({title:c===x.REVERSE_TYPE.NONE?"Reverse Table":"Clear Reverse Table",icon:cn,iconColor:C,group:$.GROUP_SORT,order:40,disabled:!o.isReversible,shortcut:Lt.TABLE.REVERSE,action:()=>{c===x.REVERSE_TYPE.NONE?this.irisGrid.reverse(x.REVERSE_TYPE.POST_SORT):this.irisGrid.reverse(x.REVERSE_TYPE.NONE)}}),l.push({title:"Copy Column Name",group:$.GROUP_COPY,action:()=>{var V;fo((V=o.textForColumnHeader(e))!=null?V:"").catch(H=>Ml.error("Unable to copy header",H))}}),x.isDateType(r.type)?l.push({title:"Date/Time Format",group:$.GROUP_FORMAT,actions:this.dateFormatActions(r)}):x.isNumberType(r.type)&&l.push({title:"Number Format",group:$.GROUP_FORMAT,actions:(F=this.numberFormatActions(r))!=null?F:void 0}),l}getCellActions(e,t,n){O(e);const{irisGrid:s}=this,{column:o,row:i}=n,{model:r,canCopy:l}=s.props,{columns:a}=r,c=s.getModelRow(i);O(c);const d=r.valueForCell(e,c),u=r.textForCell(e,c),m=a[e],p=[],{quickFilters:g}=s.state,f=s.getTheme(),{filterIconColor:w}=f,{settings:C}=s.props,S=new jn({timeZone:C==null?void 0:C.timeZone,showTimeZone:!1,showTSeparator:!0,defaultDateTimeFormatString:Dl}),b=new jn({timeZone:C==null?void 0:C.timeZone,showTimeZone:C==null?void 0:C.showTimeZone,showTSeparator:C==null?void 0:C.showTSeparator,defaultDateTimeFormatString:Dl});if(m==null||i==null)return p;if(r.isFilterable(e)){const v={title:"Filter by Value",icon:cn,iconColor:w,group:$.GROUP_FILTER,order:10,actions:[]};if(d==null)g.get(e)&&v.actions.push({title:"And",actions:this.nullFilterActions(m,g.get(e),"&&"),order:2,group:re.groups.high}),v.actions.push(...this.nullFilterActions(m));else if(x.isBooleanType(m.type))g.get(e)&&v.actions.push({title:"Or",actions:this.booleanFilterActions(m,u,g.get(e),"||"),order:2,group:re.groups.high}),v.actions.push(...this.booleanFilterActions(m,u));else if(x.isNumberType(m.type)||x.isCharType(m.type)){O(e);const y=x.isCharType(m.type)?String.fromCharCode(d):`${d}`;g.get(e)&&v.actions.push({title:"And",actions:this.numberFilterActions(m,y,d,g.get(e),"&&"),order:2,group:re.groups.high}),v.actions.push(...this.numberFilterActions(m,y,d,g.get(e)))}else if(x.isDateType(m.type)){const y=S.format(d),M=b.format(d);g.get(e)&&v.actions.push({title:"And",actions:this.dateFilterActions(m,y,M,d,g.get(e),"&&"),order:2,group:re.groups.high}),v.actions.push(...this.dateFilterActions(m,y,M,d,g.get(e)))}else g.get(e)&&v.actions.push({title:"And",actions:this.stringFilterActions(m,u,d,g.get(e),"&&"),order:2,group:re.groups.high}),v.actions.push(...this.stringFilterActions(m,u,d));v.actions!=null&&v.actions.length>0&&p.push(v)}if(ke(r)&&r.isRowExpandable(c)){const v=r.groupedColumns.length>0?r.depthForRow(c)-1:0,M=r.valueForCell(v,c)==null?"null":r.textForCell(v,c);p.push({title:$.getRowOptionFormatted(r.isRowExpanded(c)?"Collapse":"Expand",M),group:$.GROUP_EXPAND_COLLAPSE,order:10,action:()=>{r.setRowExpanded(c,!r.isRowExpanded(c))}}),r.isExpandAllAvailable===!0&&p.push({title:$.getRowOptionFormatted("Expand All in",M),group:$.GROUP_EXPAND_COLLAPSE,order:20,action:()=>{r.setRowExpanded(c,!0,!0)}})}ke(r)&&r.hasExpandableRows&&r.isExpandAllAvailable===!0&&(p.push({title:"Expand Entire Table",group:$.GROUP_EXPAND_COLLAPSE,order:30,action:()=>{r.expandAll()}}),p.push({title:"Collapse Entire Table",group:$.GROUP_EXPAND_COLLAPSE,order:40,action:()=>{r.collapseAll()}}));const E={title:"Go to",iconColor:w,shortcut:Lt.TABLE.GOTO_ROW,group:$.GROUP_GOTO,order:10,action:()=>this.irisGrid.toggleGotoRow(`${i+1}`,`${d}`,m.name)};return p.push(E),l&&(p.push({title:"Copy Cell",group:$.GROUP_COPY,order:10,action:()=>{s.copyCell(o,i)}}),p.push({title:"Copy Cell Unformatted",group:$.GROUP_COPY,order:20,action:()=>{s.copyCell(o,i,!0)}})),p}onContextMenu(e,t,n){const{irisGrid:s}=this,{y:o,column:i,row:r,columnHeaderDepth:l}=e,a=s.getModelColumn(i),c=s.getModelRow(r),{model:d,canCopy:u}=s.props,{columns:m}=d,{metrics:p,isFilterBarShown:g,quickFilters:f,advancedFilters:w,selectedRanges:C}=s.state;O(p);const{columnHeaderHeight:S,gridY:b,columnHeaderMaxDepth:E}=p,v=[];if(a!=null&&c!=null){const y=d.valueForCell(a,c),M=d.textForCell(a,c),A=m[a],{onContextMenu:F}=s.props;A!=null&&v.push(F({model:d,value:y,valueText:M,column:A,rowIndex:r,columnIndex:i,modelRow:c,modelColumn:a}))}return a!=null&&d.isFilterable(a)&&v.push({title:"Clear Column Filter",group:$.GROUP_FILTER,order:30,action:()=>{this.irisGrid.removeColumnFilter(a)},disabled:!(f.has(a)||w.has(a))}),(g?o<=b:o<=S*E&&l===0)?a!=null&&v.push(...this.getHeaderActions(a,e)):(a!=null&&c!=null&&v.push(...this.getCellActions(a,t,e)),u&&C.length>0&&(v.push({title:"Copy Selection",shortcut:Nr.COPY,group:$.GROUP_COPY,order:30,action:()=>{s.copyRanges(C)}}),v.push({title:"Copy Selection w/ Headers",group:$.GROUP_COPY,order:40,action:()=>{s.copyRanges(C,!0)}})),He(d)&&d.isEditable&&C.length>0&&v.push({title:"Delete Selected Rows",group:$.GROUP_EDIT,order:50,action:()=>{this.irisGrid.deleteRanges(C)}})),v.length===0?!1:(O(s.gridWrapper),re.triggerMenu(s.gridWrapper,n.pageX,n.pageY,v),!0)}dateFormatActions(e){const{model:t}=this.irisGrid.props,{formatter:n}=t,s=n.getColumnFormat(e.type,e.name),o=Ii.getOptions(n,s),i=[];for(let r=0;r<o.length;r+=1){const{description:l,format:a,group:c,isSelected:d,title:u}=o[r];i.push({title:u,description:l,icon:d?Xn:void 0,group:c,order:r,action:()=>{const m=t.getColumnIndexByName(e.name);O(m),this.irisGrid.handleFormatSelection(m,a)}})}return i}numberFormatActions(e){const{model:t}=this.irisGrid.props,{formatter:n}=t,s=n.getColumnFormat(e.type,e.name);let o;const i=t.getColumnIndexByName(e.name);if(x.isDecimalType(e.type))o=So.getOptions(s,l=>{O(i),this.debouncedUpdateCustomFormat(i,l)});else if(x.isIntegerType(e.type))o=Mi.getOptions(s,l=>{O(i),this.debouncedUpdateCustomFormat(i,l)});else return Ml.error("Invalid column type in numberFormatActions"),null;const r=[];for(let l=0;l<o.length;l+=1){const{format:a,isSelected:c}=o[l];r.push({...o[l],icon:c?Xn:void 0,order:l,action:()=>{i===void 0&&a&&a.type===_e.TYPE_CONTEXT_CUSTOM||(O(i),this.irisGrid.handleFormatSelection(i,a))}})}return r}stringFilterActions(e,t,n,s,o){const i=I.FilterValue.ofString(n);let r=s;r||(r={filter:null,text:null});const{filter:l,text:a}=r,c=[],{model:d}=this.irisGrid.props,u=d.getColumnIndexByName(e.name);return O(u),c.push({menuElement:R("div",{className:"iris-grid-filter-menu-item-value",children:[o?$.getOperatorAsText(o):""," ",'"',t,'"']}),order:1,group:re.groups.high}),c.push({title:"text is exactly",description:`Show only rows where ${e.name} is ${n} (case sensitive)`,action:()=>{this.irisGrid.setQuickFilter(u,$.getQuickFilterCondition(l,e.filter().eq(i),o),$.getQuickFilterText(a,`=${t}`,o))},order:10,group:re.groups.low}),c.push({title:"text is not exactly",description:`Show only rows where ${e.name} is not ${t} (case sensitive)`,action:()=>{this.irisGrid.setQuickFilter(u,$.getQuickFilterCondition(l,e.filter().notEq(i),o),$.getQuickFilterText(a,`!=${t}`,o))},order:20,group:re.groups.low}),c.push({title:"text contains",description:`Show only rows where ${e.name} contains ${t}`,action:()=>{this.irisGrid.setQuickFilter(u,$.getQuickFilterCondition(l,e.filter().contains(i),o),$.getQuickFilterText(a,`~${t}`,o))},order:30,group:re.groups.low}),c.push({title:"text does not contain",description:`Show only rows where ${e.name} does not contain ${n}`,action:()=>{this.irisGrid.setQuickFilter(u,$.getQuickFilterCondition(l,e.filter().contains(i).not(),o),$.getQuickFilterText(a,`!~${t}`,o))},order:40,group:re.groups.low}),c.push({title:"text starts with",description:`Show only rows where ${e.name} starts with ${t}`,action:()=>{this.irisGrid.setQuickFilter(u,$.getQuickFilterCondition(l,e.filter().invoke("startsWith",i),o),$.getQuickFilterText(a,`${t}*`,o))},order:50,group:re.groups.low}),c.push({title:"text ends with",description:`Show only rows where ${e.name} ends with ${t}`,action:()=>{this.irisGrid.setQuickFilter(u,$.getQuickFilterCondition(l,e.filter().invoke("endsWith",i),o),$.getQuickFilterText(a,`*${t}`,o))},order:60,group:re.groups.low}),c}numberFilterActions(e,t,n,s,o){const i=$.getFilterValueForNumberOrChar(e.type,n);let r=null,l=null;s&&(r=s.filter,l=s.text);const a=[],c=n!==Number.POSITIVE_INFINITY&&n!==Number.NEGATIVE_INFINITY&&!Number.isNaN(n),{model:d}=this.irisGrid.props,u=d.getColumnIndexByName(e.name);return O(u),a.push({menuElement:R("div",{className:"iris-grid-filter-menu-item-value",children:[o?$.getOperatorAsText(o):""," ",'"',t,'"']}),order:1,group:re.groups.high}),a.push({title:"is equal to",description:`Show only rows where ${e.name} is ${t}`,action:()=>{const m=$.getNumberValueEqualsFilter(e,n);this.irisGrid.setQuickFilter(u,$.getQuickFilterCondition(r,m,o),$.getQuickFilterText(l,`=${t}`,o))},order:10,group:re.groups.low}),a.push({title:"is not equal to",description:`Show only rows where ${e.name} is not ${t}`,action:()=>{const m=$.getNumberValueEqualsFilter(e,n).not();this.irisGrid.setQuickFilter(u,$.getQuickFilterCondition(r,m,o),$.getQuickFilterText(l,`!=${t}`,o))},order:20,group:re.groups.low}),c&&!x.isCharType(e.type)&&(a.push({title:"greater than",description:`Show only rows where ${e.name} is greater than ${t}`,action:()=>{this.irisGrid.setQuickFilter(u,$.getQuickFilterCondition(r,e.filter().greaterThan(i),o),$.getQuickFilterText(l,`>${t}`,o))},order:30,group:re.groups.low}),a.push({title:"greater than or equal to",description:`Show only rows where ${e.name} is greater than or equal to ${t}`,action:()=>{this.irisGrid.setQuickFilter(u,$.getQuickFilterCondition(r,e.filter().greaterThanOrEqualTo(i),o),$.getQuickFilterText(l,`>=${t}`,o))},order:40,group:re.groups.low}),a.push({title:"less than",description:`Show only rows where ${e.name} is less than ${t}`,action:()=>{this.irisGrid.setQuickFilter(u,$.getQuickFilterCondition(r,e.filter().lessThan(i),o),$.getQuickFilterText(l,`<${t}`,o))},order:50,group:re.groups.low}),a.push({title:"less than or equal to",description:`Show only rows where ${e.name} is less than or equal to ${t}`,action:()=>{this.irisGrid.setQuickFilter(u,$.getQuickFilterCondition(r,e.filter().lessThanOrEqualTo(i),o),$.getQuickFilterText(l,`<=${t}`,o))},order:60,group:re.groups.low})),a}booleanFilterActions(e,t,n,s){const o=[],{model:i}=this.irisGrid.props,{filter:r,text:l}=n||{},a=i.getColumnIndexByName(e.name);return O(a),o.push({menuElement:R("div",{className:"iris-grid-filter-menu-item-value",children:[s?$.getOperatorAsText(s):""," ",'"',t!=null?t:"null",'"']}),order:1,group:re.groups.high}),o.push({title:"true",description:`Show only rows where ${e.name} is true`,action:()=>{this.irisGrid.setQuickFilter(a,$.getQuickFilterCondition(r,e.filter().isTrue(),s),$.getQuickFilterText(l,"true",s))},order:10,group:re.groups.low}),o.push({title:"false",description:`Show only rows where ${e.name} is false`,action:()=>{this.irisGrid.setQuickFilter(a,$.getQuickFilterCondition(r,e.filter().isFalse(),s),$.getQuickFilterText(l,"false",s))},order:20,group:re.groups.low}),o.push({title:"is null",description:`Show only rows where ${e.name} is null`,action:()=>{this.irisGrid.setQuickFilter(a,$.getQuickFilterCondition(r,e.filter().isNull(),s),$.getQuickFilterText(l,"null",s))},order:30,group:re.groups.low}),o.push({title:"is not null",description:`Show only rows where ${e.name} is not null`,action:()=>{this.irisGrid.setQuickFilter(a,$.getQuickFilterCondition(r,e.filter().isNull().not(),s),$.getQuickFilterText(l,"!null",s))},order:40,group:re.groups.low}),o}dateFilterActions(e,t,n,s,o,i){const r=I.FilterValue.ofNumber(s);let l=null,a=null;o&&(l=o.filter,a=o.text);const{model:c}=this.irisGrid.props,d=c.getColumnIndexByName(e.name);O(d);const u=[];return u.push({menuElement:R("div",{className:"iris-grid-filter-menu-item-value",children:[i?$.getOperatorAsText(i):""," ",'"',n,'"']}),order:1,group:re.groups.high}),u.push({title:"date is",description:`Show only rows where ${e.name} is ${n}`,action:()=>{this.irisGrid.setQuickFilter(d,$.getQuickFilterCondition(l,e.filter().eq(r),i),$.getQuickFilterText(a,`=${t}`,i))},order:10,group:re.groups.low}),u.push({title:"date is not",description:`Show only rows where ${e.name} is not ${n}`,action:()=>{this.irisGrid.setQuickFilter(d,$.getQuickFilterCondition(l,e.filter().notEq(r),i),$.getQuickFilterText(a,`!=${t}`,i))},order:20,group:re.groups.low}),u.push({title:"date is before",description:`Show only rows where ${e.name} is before ${n}`,action:()=>{this.irisGrid.setQuickFilter(d,$.getQuickFilterCondition(l,e.filter().lessThan(r),i),$.getQuickFilterText(a,`<${t}`,i))},order:30,group:re.groups.low}),u.push({title:"date is before or equal",description:`Show only rows where ${e.name} is before or equal to ${n}`,action:()=>{this.irisGrid.setQuickFilter(d,$.getQuickFilterCondition(l,e.filter().lessThanOrEqualTo(r),i),$.getQuickFilterText(a,`<=${t}`,i))},order:40,group:re.groups.low}),u.push({title:"date is after",description:`Show only rows where ${e.name} is greater than ${n}`,action:()=>{this.irisGrid.setQuickFilter(d,$.getQuickFilterCondition(l,e.filter().greaterThan(r),i),$.getQuickFilterText(a,`>${t}`,i))},order:50,group:re.groups.low}),u.push({title:"date is after or equal",description:`Show only rows where ${e.name} is after or equal to ${n}`,action:()=>{this.irisGrid.setQuickFilter(d,$.getQuickFilterCondition(l,e.filter().greaterThanOrEqualTo(r),i),$.getQuickFilterText(a,`>=${t}`,i))},order:60,group:re.groups.low}),u}nullFilterActions(e,t,n){let s=null,o=null;t&&(s=t.filter,o=t.text);const i=[],{model:r}=this.irisGrid.props,l=r.getColumnIndexByName(e.name);return O(l),i.push({menuElement:R("div",{className:"iris-grid-filter-menu-item-value",children:[n?$.getOperatorAsText(n):""," ",'"null"']}),order:1,group:re.groups.high}),i.push({title:"is null",description:`Show only rows where ${e.name} is null`,action:()=>{this.irisGrid.setQuickFilter(l,$.getQuickFilterCondition(s,e.filter().isNull(),n),$.getQuickFilterText(o,"null",n))},order:10,group:re.groups.low}),i.push({title:"is not null",description:`Show only rows where ${e.name} is not null`,action:()=>{this.irisGrid.setQuickFilter(l,$.getQuickFilterCondition(s,e.filter().isNull().not(),n),$.getQuickFilterText(o,"!null",n))},order:20,group:re.groups.low}),i}sortByActions(e,t,n){const s=this.irisGrid.getTheme(),{contextMenuSortIconColor:o}=s,i=[{title:`${e.name} Ascending`,order:10,action:()=>{this.irisGrid.sortColumn(t,$.COLUMN_SORT_DIRECTION.ascending)},icon:this.checkColumnSort(n,$.COLUMN_SORT_DIRECTION.ascending)?cn:void 0,iconColor:o},{title:`${e.name} Descending`,order:20,action:()=>{this.irisGrid.sortColumn(t,$.COLUMN_SORT_DIRECTION.descending)},icon:this.checkColumnSort(n,$.COLUMN_SORT_DIRECTION.descending)?cn:void 0,iconColor:o},{title:"Remove Sort",order:50,action:()=>{this.irisGrid.sortColumn(t,$.COLUMN_SORT_DIRECTION.none,!1,!0)},disabled:!n}];return x.isNumberType(e.type)&&(i.push({title:`ABS(${e.name}) Ascending`,order:30,action:()=>{this.irisGrid.sortColumn(t,$.COLUMN_SORT_DIRECTION.ascending,!0)},icon:this.checkColumnSort(n,$.COLUMN_SORT_DIRECTION.ascending,!0)?cn:void 0,iconColor:o}),i.push({title:`ABS(${e.name}) Descending`,order:40,action:()=>{this.irisGrid.sortColumn(t,$.COLUMN_SORT_DIRECTION.descending,!0)},icon:this.checkColumnSort(n,$.COLUMN_SORT_DIRECTION.descending,!0)?cn:void 0,iconColor:o})),i}additionalSortActions(e,t){const n=this.irisGrid.getTheme(),{contextMenuSortIconColor:s}=n,o=[{title:"Add Sort By",menuElement:R("div",{className:"btn-context-menu menu-title",children:[h("span",{className:"icon",children:h(Z,{icon:cn,style:{color:s!=null?s:void 0}})}),h("span",{className:"title",children:"Add Additional Sort"}),h("span",{className:"shortcut",children:Ne.isMacPlatform()?"\u2318Click":"Ctrl+Click"})]}),order:1},{title:`${e.name} Ascending`,order:10,action:()=>{this.irisGrid.sortColumn(t,$.COLUMN_SORT_DIRECTION.ascending,!1,!0)}},{title:`${e.name} Descending`,order:20,action:()=>{this.irisGrid.sortColumn(t,$.COLUMN_SORT_DIRECTION.descending,!1,!0)}}];return x.isNumberType(e.type)&&(o.push({title:`ABS(${e.name}) Ascending`,order:30,action:()=>{this.irisGrid.sortColumn(t,$.COLUMN_SORT_DIRECTION.ascending,!0,!0)}}),o.push({title:`ABS(${e.name}) Descending`,order:40,action:()=>{this.irisGrid.sortColumn(t,$.COLUMN_SORT_DIRECTION.descending,!0,!0)}})),o}checkColumnSort(e,t=null,n=!1){return e?e.direction===t&&e.isAbs===n:!1}};let rn=$;rn.GROUP_EDIT=re.groups.high+10;rn.GROUP_HIDE_COLUMNS=re.groups.high+25;rn.GROUP_FILTER=re.groups.high+50;rn.GROUP_EXPAND_COLLAPSE=re.groups.high+55;rn.GROUP_GOTO=re.groups.high+60;rn.GROUP_SORT=re.groups.high+75;rn.GROUP_COPY=re.groups.high+100;rn.GROUP_FORMAT=re.groups.high+150;rn.COLUMN_SORT_DIRECTION={ascending:"ASC",descending:"DESC",none:null};class np extends Qe{constructor(t){super(),this.irisGrid=t}onDoubleClick(t){const{column:n,row:s}=t;return s==null||n==null?!1:(this.irisGrid.selectData(n,s),!0)}}class sp extends Qe{constructor(t){super(),this.irisGrid=t}onDown(t){const{y:n,column:s,row:o}=t;if(s!==null&&o===null){const{isFilterBarShown:i,metrics:r}=this.irisGrid.state;if(!r)throw new Error("Metrics not set");const{columnHeaderMaxDepth:l}=r,a=this.irisGrid.getTheme();if(i&&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(t){const{y:n,column:s}=t,{isFilterBarShown:o,hoverAdvancedFilter:i,metrics:r}=this.irisGrid.state;if(!r)throw new Error("Metrics not set");const{columnHeaderMaxDepth:l}=r,a=this.irisGrid.getTheme();let c=null;return o&&a.columnHeaderHeight!=null&&a.filterBarHeight!=null&&s!==null&&n>=a.columnHeaderHeight*l&&n<=a.columnHeaderHeight*l+a.filterBarHeight&&(c=s),c!==i&&this.irisGrid.setState({hoverAdvancedFilter:c}),!1}onLeave(t){const{column:n}=t,{hoverAdvancedFilter:s}=this.irisGrid.state;return s!==null&&n!==s&&this.irisGrid.setState({hoverAdvancedFilter:null}),!1}}class op extends Qe{constructor(t){super(750),this.irisGrid=t}destroyTooltip(){this.irisGrid.setState({expandCellTooltipProps:null})}setCursor(t,n){return Vs.isInTreeBox(t,n)?(this.cursor="pointer",{stopPropagation:!1,preventDefault:!1}):(this.cursor=null,!1)}getButtonPosition({x:t,y:n,column:s,row:o}){if(s==null||o==null)return null;const{renderer:i,grid:r,state:l,props:a}=this.irisGrid;if(!r)return null;const{metrics:c}=l,{model:d}=a,{canvasContext:u}=r,m=r.getTheme(),p={context:u,mouseX:t,mouseY:n,metrics:c,model:d,theme:m},g=ke(d)?d.depthForRow(o):null,{left:f,top:w,width:C,height:S}=i.getExpandButtonPosition(p,g);return f==null||C==null||w==null||S==null?null:{left:f,top:w,width:C,height:S}}onMove(t,n){if(Vs.isInTreeBox(t,n)){const{expandCellTooltipProps:s}=this.irisGrid.state,{model:o}=this.irisGrid.props,i=this.getButtonPosition(t),{row:r}=t;O(r);const l=ke(o)&&o.isRowExpanded(r);ct(s,i)||this.irisGrid.setState({expandCellTooltipProps:i,expandTooltipDisplayValue:l?"collapse":"expand"})}else this.destroyTooltip();return this.setCursor(t,n)}onDown(){return this.destroyTooltip(),!1}onContextMenu(){return this.destroyTooltip(),!1}onWheel(){return this.destroyTooltip(),!1}onLeave(){return this.destroyTooltip(),!1}}class ip extends Qe{constructor(t){super(),this.column=null,this.irisGrid=t}getColumnFromGridPoint(t){const{column:n,row:s,columnHeaderDepth:o}=t;return n!==null&&s===null&&o===0?n:null}onDown(t){return this.column=this.getColumnFromGridPoint(t),!1}onClick(t,n,s){const o=this.getColumnFromGridPoint(t);if(o!=null&&o===this.column){const i=Ne.isModifierKeyDown(s);return this.irisGrid.toggleSort(o,i),!0}return!1}}class rp extends Qe{constructor(t){super(),this.irisGrid=t}onWheel(t,n,s){const{irisGrid:o}=this,{model:i}=o.props,{metrics:r,pendingRowCount:l}=o.state;O(r);const{bottom:a,rowCount:c,rowHeight:d}=r,{deltaY:u}=W.getScrollDelta(s);return He(i)&&i.isEditable&&a>=c-1&&u>0&&o.setState({pendingRowCount:l+Math.ceil(u/d)}),!1}}const lp=3e3;function ap({children:e=null,onEntering:t,onEntered:n,onExiting:s,onExited:o}){const[i,r]=T.exports.useState(!1),l=T.exports.useRef(),a=Er(e),c=T.exports.useCallback(()=>{r(!0),l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{r(!1)},lp)},[r,l]);return T.exports.useEffect(()=>{a!==e&&e!=null&&c()},[e,a,r,c]),T.exports.useEffect(()=>()=>l.current?clearTimeout(l.current):void 0,[]),h(yi,{className:"toast-bottom-bar",isShown:i,onEntering:t,onEntered:n,onExiting:s,onExited:o,children:e})}class cp extends Co{getGridY(t){let n=super.getGridY(t);const{isFilterBarShown:s,theme:o,advancedFilters:i,quickFilters:r,sorts:l,reverseType:a}=t;return s?n+=o.filterBarHeight:(r!=null&&r.size>0||i!=null&&i.size>0)&&(n+=o.filterBarCollapsedHeight),a!==x.REVERSE_TYPE.NONE&&l!=null&&l.length>0&&(n+=o.reverseHeaderBarHeight),n}getUserColumnWidths(){return this.userColumnWidths}}const dp=1,qa=te.memo(({model:e,modelColumns:t,top:n,bottom:s,left:o,right:i,filter:r,formatter:l,reverseType:a=x.REVERSE_TYPE.NONE,sorts:c,customColumns:d,movedColumns:u,hiddenColumns:m,alwaysFetchColumns:p,rollupConfig:g=null,totalsConfig:f=null,selectDistinctColumns:w=ye,pendingRowCount:C=0,pendingDataMap:S=wn,frozenColumns:b,formatColumns:E,columnHeaderGroups:v})=>{const y=T.exports.useMemo(()=>ne.getModelViewportColumns(t,o,i,u,m,p,dp),[t,o,i,u,m,p]);return T.exports.useEffect(function(){e.filter=r},[e,r]),T.exports.useEffect(function(){const A=[...c];a!==x.REVERSE_TYPE.NONE&&A.push(I.Table.reverse()),e.sort=A},[e,c,a]),T.exports.useEffect(function(){e.formatter=l},[e,l]),T.exports.useEffect(function(){e.isCustomColumnsAvailable&&(e.customColumns=d)},[e,d]),T.exports.useEffect(function(){e.isFormatColumnsAvailable&&(e.formatColumns=E)},[e,E]),T.exports.useEffect(function(){e.setViewport(n,s,y)},[e,n,s,y]),T.exports.useEffect(function(){e.isRollupAvailable&&(e.rollupConfig=g)},[e,e.isRollupAvailable,g]),T.exports.useEffect(function(){e.isSelectDistinctAvailable&&(e.selectDistinctColumns=w)},[e,w]),T.exports.useEffect(function(){e.isTotalsAvailable&&(e.totalsConfig=f)},[e,e.isTotalsAvailable,f]),T.exports.useEffect(function(){e.pendingRowCount=C},[e,C]),T.exports.useEffect(function(){e.pendingDataMap=S},[e,S]),T.exports.useEffect(function(){b&&e.updateFrozenColumns(b)},[e,b]),T.exports.useEffect(function(){e.columnHeaderGroups=v},[e,v]),null});qa.displayName="IrisGridModelUpdater";const $t=Object.freeze({SORT_UP:"sortUp",SORT_DOWN:"sortDown",CARET_DOWN:"caretDown",CARET_RIGHT:"caretRight",CELL_OVERFLOW:"cellOverflow"}),Nl=10,zi=16;class mo extends gs{constructor(){super(),this.icons={},this.initIcons()}static isFilterValid(t,n){const s=t==null||t.filter!=null,o=n==null||n.filter!=null;return s&&o}initIcons(){this.setIcon($t.SORT_UP,Au),this.setIcon($t.SORT_DOWN,xu),this.setIcon($t.CARET_DOWN,$n),this.setIcon($t.CARET_RIGHT,da),this.setIcon($t.CELL_OVERFLOW,nu)}setIcon(t,n){const s=Array.isArray(n.icon[4])?n.icon[4][0]:n.icon[4],o=new Path2D(s),i=new Path2D,r={a:zi/n.icon[0],d:zi/n.icon[1]};i.addPath(o,r),this.icons[t]=i}getIcon(t){return this.icons[t]}getSortIcon(t){return t?t.direction===x.sortDirection.ascending?this.getIcon($t.SORT_UP):t.direction===x.sortDirection.descending?this.getIcon($t.SORT_DOWN):null:null}drawCanvas(t){super.drawCanvas(t),this.drawScrim(t)}drawGrid(t,n){super.drawGrid(t,n),this.drawCellOverflowButton(n)}drawGridLines(t,n){super.drawGridLines(t,n),this.drawGroupedColumnLine(t,n),this.drawPendingRowLine(t,n)}drawCellContent(t,n,s,o){var m;const{metrics:i,model:r}=n,{modelColumns:l,modelRows:a}=i,c=L(a,o),d=l.get(s);if(d===void 0)return;const u=r.valueForCell(d,c);if(x.isTextType((m=r.columns[d])==null?void 0:m.type)&&(u===null||u==="")){const p=t.font;t.font=`italic ${p}`;const g=u===null?"null":"empty";super.drawCellContent(t,n,s,o,g),t.font=p;return}super.drawCellContent(t,n,s,o)}drawGroupedColumnLine(t,n){const{metrics:s,model:o,theme:i}=n,{groupedColumns:r,columns:l}=o,{maxY:a,allColumnWidths:c,allColumnXs:d}=s;if(r.length===0||i.groupedColumnDividerColor==null)return;const u=r[r.length-1],m=l.findIndex(w=>w.name===u.name),p=d.get(m),g=c.get(m);if(p==null||g==null)return;const f=p+g+.5;t.strokeStyle=i.groupedColumnDividerColor,t.lineWidth=1,t.beginPath(),t.moveTo(f,0),t.lineTo(f,a),t.stroke()}drawPendingRowLine(t,n){const{metrics:s,model:o,theme:i}=n,{allRowYs:r,maxX:l}=s,{pendingRowCount:a}=o;if(a<=0)return;const c=o.rowCount-o.pendingRowCount-o.floatingBottomRowCount;let d=r.get(c);d!=null&&(d-=.5,t.save(),t.setLineDash([4,2]),t.strokeStyle=i.pendingTextColor,t.lineWidth=1,t.beginPath(),t.moveTo(0,d),t.lineTo(l,d),t.stroke(),t.restore())}drawMouseColumnHover(t,n){const{theme:s,metrics:o,hoverSelectColumn:i}=n;if(i==null||s.linkerColumnHoverBackgroundColor==null)return;const{allColumnWidths:r,allColumnXs:l,maxY:a}=o,c=l.get(i),d=r.get(i);O(c),O(d),t.fillStyle=s.linkerColumnHoverBackgroundColor,t.fillRect(c,0,d,a)}drawMouseRowHover(t,n){const{isSelectingColumn:s}=n;s||super.drawMouseRowHover(t,n)}drawScrim(t){const{context:n,loadingScrimProgress:s,metrics:o,theme:i}=t;if(s==null)return;const{width:r,height:l,gridY:a}=o,{scrimBlurSize:c,scrimColor:d}=i;n.save(),n.globalCompositeOperation="color",n.filter=`blur(${c}px)`,d!=null&&(n.fillStyle=d),n.beginPath(),n.rect(0,a,r,l-a),n.clip(),n.fillRect(-c,-c+a,c*2+r,(c*2+(l-a))*s),n.globalCompositeOperation="overlay",n.filter=`blur(${c}px) opacity(15%)`,n.fillRect(-c,-c+a,c*2+r,(c*2+(l-a))*s),n.restore()}drawColumnHeaders(t,n){super.drawColumnHeaders(t,n);const{theme:s,metrics:o,model:i,reverseType:r}=n,{columnHeaderHeight:l}=o;if(this.drawFilterHeaders(t,n),l<=0)return;const{sort:a}=i;if(a.length===1){const c=r!==x.REVERSE_TYPE.NONE;let d;c?d=s.headerReverseBarColor:d=s.headerSortBarColor,this.drawHeaderBar(t,n,d,c?s.reverseHeaderBarHeight:s.sortHeaderBarHeight)}else a.length>1&&(r!==x.REVERSE_TYPE.NONE&&this.drawHeaderBar(t,n,s.headerReverseBarColor,s.reverseHeaderBarHeight,!1),this.drawHeaderBar(t,n,s.headerSortBarColor,s.sortHeaderBarHeight))}drawHeaderBar(t,n,s,o,i=!0){const{theme:r,metrics:l,model:a}=n,{columnHeaderHeight:c,width:d}=l;let u=0;i||(u=o),t.fillStyle=r.headerBarCasingColor,t.fillRect(0,a.columnHeaderMaxDepth*c-o-2+u,d,o+2),t.fillStyle=s,t.fillRect(0,a.columnHeaderMaxDepth*c-o-1+u,d,o)}drawColumnHeadersAtDepth(t,n,s,o,i){const{metrics:r,model:l,isMenuShown:a}=n,{columnHeaderMaxDepth:c}=l,{width:d}=r,u={...o,maxX:i===c-1&&o.maxX===d?d-(a?0:30):o.maxX};super.drawColumnHeadersAtDepth(t,n,s,u,i)}drawColumnHeaderAtIndex(t,n,s,o){var P;super.drawColumnHeaderAtIndex(t,n,s,o);const{metrics:i,model:r,theme:l}=n,{modelColumns:a,allColumnWidths:c,allColumnXs:d,gridX:u,columnHeaderHeight:m,fontWidths:p}=i,{headerHorizontalPadding:g}=l,f=L(c,s,0),w=L(d,s)+u,C=a.get(s);if(C==null)return;const S=x.getSortForColumn(r.sort,C);if(!S)return;const b=this.getSortIcon(S);if(!b)return;const E=r.textForColumnHeader(C);if(E===void 0)return;const v=(P=p.get(t.font))!=null?P:gs.DEFAULT_FONT_WIDTH;O(v);const y=E.length*v,M=u+w+y+g;let{maxX:A}=o;A-=g;const F=u+w+f-g-1,V=M>A?M+1:Math.min(A,F),H=S.direction===x.sortDirection.ascending?-6:-12,N=m*.5+H;t.save(),t.beginPath(),t.rect(w,0,f,m),t.clip(),t.fillStyle=l.headerSortBarColor,t.translate(V,N),t.fill(b),t.restore()}drawFilterHeaders(t,n){const{isFilterBarShown:s,quickFilters:o,advancedFilters:i}=n;s?this.drawExpandedFilterHeaders(t,n):(o!=null&&o.size>0||i!=null&&i.size>0)&&this.drawCollapsedFilterHeaders(t,n)}drawExpandedFilterHeaders(t,n){const{metrics:s,model:o,theme:i,quickFilters:r,advancedFilters:l}=n,{filterBarHeight:a}=i;if(a<=0)return;const{gridX:c,gridY:d,maxX:u,modelColumns:m,visibleColumns:p,allColumnWidths:g,allColumnXs:f}=s,w=d-a;t.save(),t.font=i.font,t.textAlign="left",r!=null&&r.size>0||l!=null&&l.size>0?t.fillStyle=i.filterBarExpandedActiveBackgroundColor:t.fillStyle=i.filterBarExpandedBackgroundColor,t.fillRect(c,w,u,a-1),t.fillStyle=i.headerBarCasingColor,t.fillRect(c,w+a-1,u,1);const C=w;t.strokeStyle=i.filterBarSeparatorColor,t.beginPath();for(let S=0;S<p.length;S+=1){const b=p[S],E=L(m,b),v=L(f,b),y=L(g,b);if(o.isFilterable(E)&&y>0){const M=c+(v!=null?v:0);t.rect(M+.5,C+.5,y,a-2)}}t.stroke();for(let S=0;S<p.length;S+=1){const b=p[S],E=L(g,b),y=L(f,b)+c;this.drawExpandedFilterHeader(t,n,b,y,E)}t.restore()}drawExpandedFilterHeader(t,n,s,o,i){if(i<=0)return;const{metrics:r,theme:l,quickFilters:a,advancedFilters:c}=n,{modelColumns:d,gridY:u}=r,{filterBarHeight:m,filterBarExpandedActiveCellBackgroundColor:p,filterBarErrorColor:g,filterBarHorizontalPadding:f,headerColor:w}=l,C=u-m,S=d.get(s);if(S===void 0)return;const b=a.get(S),E=c.get(S);if(b==null&&E==null)return;let v=null;if(b!=null){const{text:M}=b;if(v=M,v||(v=x.getFilterText(b.filter)),v!=null){const{fontWidths:A}=r;let F=A.get(t.font);(F==null||F===0)&&(F=t.measureText("8").width,F||(F=10));const V=(i-f*2)/F;V<=0?v="":v.length>V&&(v=`${v.substring(0,V-1)}\u2026`)}}if(t.save(),mo.isFilterValid(E,b)&&p!=null)t.fillStyle=p,t.fillRect(o+1,C+1,i-1,m-3);else if(g!=null){t.fillStyle=g,t.lineWidth=2,t.strokeStyle=g;const M=o+2,A=C+2,F=i-3,V=m-5;t.strokeRect(M,A,F,V)}if(v!=null&&v!==""){const M=o+f,A=C+m*.5+1;t.fillStyle=w,t.fillText(v,M,A)}t.restore()}drawCollapsedFilterHeaders(t,n){const{metrics:s,theme:o}=n,{headerSeparatorColor:i,filterBarCollapsedHeight:r}=o;if(r<=0)return;const{gridX:l,gridY:a,maxX:c,visibleColumns:d,allColumnWidths:u,allColumnXs:m}=s,p=a-r;t.save(),t.fillStyle=i,t.fillRect(l,p,c,r);for(let g=0;g<d.length;g+=1){const f=d[g],w=u.get(f),C=m.get(f);if(C!=null&&w!=null){const S=C+l;this.drawCollapsedFilterHeader(t,n,f,S,w)}}t.restore()}drawCollapsedFilterHeader(t,n,s,o,i){if(i<=0)return;const{metrics:r,theme:l,quickFilters:a,advancedFilters:c}=n,{modelColumns:d,gridY:u}=r,m=d.get(s);if(m===void 0)return;const p=a.get(m),g=c.get(m),{filterBarCollapsedHeight:f,filterBarActiveColor:w,filterBarActiveBackgroundColor:C,filterBarErrorColor:S}=l;t.save();const b=mo.isFilterValid(g,p);C!=null&&p==null&&g==null?t.fillStyle=C:w!=null&&b?t.fillStyle=w:S!=null&&(t.fillStyle=S);const E=o+1,v=u-f,y=i-1,M=f-1;t.fillRect(E,v,y,M),t.restore()}drawTreeMarker(t,n,s,o,i,r,l){t.save();const{x1:a,y1:c}=i,d=l?this.getIcon($t.CARET_DOWN):this.getIcon($t.CARET_RIGHT),u=s+a-2,m=o+c+2.5;t.fillStyle=r,t.textAlign="center",t.translate(u,m),t.fill(d),t.restore()}drawRowFooters(t,n){const{metrics:s,model:o,mouseX:i,mouseY:r,theme:l}=n,{gridY:a,gridX:c,maxX:d,modelRows:u,floatingTopHeight:m,floatingBottomHeight:p,floatingRows:g,rowFooterWidth:f,height:w,horizontalBarHeight:C,verticalBarWidth:S,allRowHeights:b,allRowYs:E,width:v}=s;if(f<=0||g.length===0)return;const{cellHorizontalPadding:y,floatingGridRowColor:M,floatingRowBackgroundColors:A,headerColor:F,rowHoverBackgroundColor:V}=l;t.translate(c,a),t.beginPath();const H=Math.min(d,v-f-S-c);t.fillStyle=A,m>0&&t.rect(H,0,f,m),p>0&&t.rect(H,w-a-C-p,f,p),t.fill();const N=i!=null&&r!=null&&i>=c&&i<=d+f?W.getRowAtY(r,s):null;if(V!=null&&N!==null&&g.includes(N)){t.fillStyle=V;const k=E.get(N),z=b.get(N);O(k),O(z),t.fillRect(H,k,f,z)}if(t.beginPath(),M!=null&&(t.strokeStyle=M),m>0&&(t.moveTo(H+.5,.5),t.lineTo(H+.5,m-.5)),p>0){const k=w-a-C-p;t.moveTo(H-.5,k+.5),t.lineTo(H-.5,k+p-.5)}t.stroke(),t.fillStyle=F,t.textAlign="left";const P=H+y;for(let k=0;k<g.length;k+=1){const z=g[k],K=b.get(z),G=E.get(z),_=u.get(z);if(G!=null&&K!=null&&_!=null){const q=G+K*.5;t.fillText(o.textForRowFooter(_),P,q)}}t.translate(-c,-a)}getTextRenderMetrics(t,n,s,o){const i=super.getTextRenderMetrics(t,n,s,o),{mouseX:r,mouseY:l,metrics:a}=n;if(r==null||l==null)return i;const{column:c,row:d}=W.getGridPointFromXY(r,l,a);if(s===c&&o===d){const{left:u}=this.getCellOverflowButtonPosition(n);this.shouldRenderOverflowButton(n)&&u!=null&&(i.width=u-a.gridX-i.x)}return i}shouldRenderOverflowButton(t){var w,C;const{context:n,mouseX:s,mouseY:o,metrics:i,model:r,theme:l}=t;if(s==null||o==null)return!1;const{row:a,column:c,modelRow:d,modelColumn:u}=W.getCellInfoFromXY(s,o,i);if(a==null||c==null||d==null||u==null||!x.isStringType(r.columns[u].type))return!1;const m=(w=r.textForCell(u,d))!=null?w:"",{width:p}=super.getTextRenderMetrics(n,t,c,a),g=(C=i.fontWidths.get(l.font))!=null?C:mo.DEFAULT_FONT_WIDTH;n.save(),n.font=l.font;const f=this.getCachedTruncatedString(n,m,p,g,r.truncationCharForCell(u,d));return n.restore(),m!==""&&f!==m}getCellOverflowButtonPosition({mouseX:t,mouseY:n,metrics:s,theme:o}){const i={left:null,top:null,width:null,height:null};if(t==null||n==null||!s)return i;const{rowHeight:r,columnWidth:l,left:a,top:c}=W.getCellInfoFromXY(t,n,s);O(a),O(l),O(c);const{width:d,verticalBarWidth:u}=s,{cellHorizontalPadding:m}=o,p=zi+2*m,g=r,w=Math.min(s.gridX+a+l,d-u)-p,C=s.gridY+c;return{left:w,top:C,width:p,height:g}}drawCellOverflowButton(t){const{context:n,mouseX:s,mouseY:o,theme:i}=t;if(s==null||o==null||!this.shouldRenderOverflowButton(t))return;const{left:r,top:l,width:a,height:c}=this.getCellOverflowButtonPosition(t),{cellHorizontalPadding:d,overflowButtonColor:u,overflowButtonHoverColor:m}=i;n.save(),m!=null&&r!=null&&a!=null&&l!=null&&c!=null&&s>=r&&s<=r+a&&o>=l&&o<=l+c?n.fillStyle=m:u!=null&&(n.fillStyle=u);const p=this.getIcon($t.CELL_OVERFLOW);r!=null&&l!=null&&n.translate(r+d,l+2),n.fill(p),n.restore()}getExpandButtonPosition({mouseX:t,mouseY:n,metrics:s,theme:o},i){const r={left:null,top:null,width:null,height:null};if(t==null||n==null||i==null||!s)return r;const{rowHeight:l,left:a,top:c}=W.getCellInfoFromXY(t,n,s);O(a),O(l),O(c);const{cellHorizontalPadding:d}=o,u=Nl+2*d,m=Math.max(a+Nl*i,s.gridX),p=s.gridY+c;return{left:m,top:p,width:u,height:l}}}const up="12px Fira Sans, sans-serif",hp="#f0f0ee",mp="#1a171a",oe={"grid-bg":"#211f22",font:up,white:hp,black:mp,"header-bg":"#2d2a2e","header-color":"#f0f0ee","header-height":"30px","header-separator-color":"#211f22","header-separator-hover-color":"#929192","header-hidden-separator-hover-color":"#4878ea","header-sort-bar-color":"#aa9af4","header-reverse-bar-color":"#548d29","header-bar-casing-color":"#211f22","header-font":"600 12px Fira Sans, sans-serif","row-height":"19px","row-background-colors":"#373438 #2d2a2e","selection-color":"rgba(118, 217, 228, 0.09)","selection-outline-color":"#76d9e4","selection-outline-casing-color":"#211f22","row-hover-bg":"#4b494c","selected-row-hover-bg":"rgba(118, 217, 228, 0.25)","scroll-bar-active-selection-tick-color":"rgba(118, 217, 228, 0.5)","scroll-bar-bg":"#322f33","scroll-bar-hover-bg":"#373438","scroll-bar-casing-color":"#555356","scroll-bar-corner-color":"#322f33","scroll-bar-color":"#5b5a5c","scroll-bar-hover-color":"#929192","scroll-bar-active-color":"#c0bfbf","text-color":"#f0f0ee","positive-number-color":"#9edc6f","negative-number-color":"#f95d84","zero-number-color":"#fcd65b","date-color":"#fcd65b","pending-text-color":"#fde38d","error-text-color":"#f95d84","null-string-color":"#929192","filter-bar-active-bg":"#425175","filter-bar-active-color":"#4878ea","filter-bar-expanded-bg":"#373438","filter-bar-expanded-active-bg":"#313849","filter-bar-expanded-active-cell-bg":"#374d80","filter-bar-separator-color":"#929192","filter-bar-error-color":"#f95d84","filter-icon-color":"#4878ea","scrim-color":"#211f22","context-menu-sort-icon-color":"#aa9af4","context-menu-reverse-icon-color":"#548d29","linker-column-hover-bg":"rgba(118, 217, 228, 0.09)","tree-line-color":"#5b5a5c","tree-marker-color":"#c0bfbf","tree-marker-hover-color":"#fcfcfa","grouped-column-divider-color":"#1a171a","floating-grid-row-color":"#555356","floating-row-background-colors":"#403e41","floating-divider-inner-color":"#403e41","floating-divider-outer-color":"#211f22","overflow-button-color":"#c0bfbf","overflow-button-hover-color":"#fcfcfa"},Ka=Object.freeze({backgroundColor:oe["grid-bg"],white:oe.white,black:oe.black,font:oe.font,headerBackgroundColor:oe["header-bg"],headerColor:oe["header-color"],headerSeparatorColor:oe["header-separator-color"],headerSeparatorHoverColor:oe["header-separator-hover-color"],headerHiddenSeparatorHoverColor:oe["header-hidden-separator-hover-color"],headerSortBarColor:oe["header-sort-bar-color"],headerReverseBarColor:oe["header-reverse-bar-color"],headerBarCasingColor:oe["header-bar-casing-color"],headerFont:oe["header-font"],rowBackgroundColors:oe["row-background-colors"],rowHoverBackgroundColor:oe["row-hover-bg"],selectionColor:oe["selection-color"],selectionOutlineColor:oe["selection-outline-color"],selectionOutlineCasingColor:oe["selection-outline-casing-color"],selectedRowHoverBackgroundColor:oe["selected-row-hover-bg"],scrollBarBackgroundColor:oe["scroll-bar-bg"],scrollBarHoverBackgroundColor:oe["scroll-bar-hover-bg"],scrollBarCasingColor:oe["scroll-bar-casing-color"],scrollBarCornerColor:oe["scroll-bar-corner-color"],scrollBarColor:oe["scroll-bar-color"],scrollBarHoverColor:oe["scroll-bar-hover-color"],scrollBarActiveColor:oe["scroll-bar-active-color"],scrollBarSelectionTickColor:oe["selected-row-hover-bg"],scrollBarActiveSelectionTickColor:oe["scroll-bar-active-selection-tick-color"],textColor:oe["text-color"],positiveNumberColor:oe["positive-number-color"],negativeNumberColor:oe["negative-number-color"],zeroNumberColor:oe["zero-number-color"],dateColor:oe["date-color"],pendingTextColor:oe["pending-text-color"],errorTextColor:oe["error-text-color"],nullStringColor:oe["null-string-color"],filterBarActiveBackgroundColor:oe["filter-bar-active-bg"],filterBarExpandedBackgroundColor:oe["filter-bar-expanded-bg"],filterBarExpandedActiveBackgroundColor:oe["filter-bar-expanded-active-bg"],filterBarExpandedActiveCellBackgroundColor:oe["filter-bar-expanded-active-cell-bg"],filterBarSeparatorColor:oe["filter-bar-separator-color"],filterBarActiveColor:oe["filter-bar-active-color"],filterBarErrorColor:oe["filter-bar-error-color"],filterIconColor:oe["filter-icon-color"],scrimColor:oe["scrim-color"],contextMenuSortIconColor:oe["context-menu-sort-icon-color"],contextMenuReverseIconColor:oe["context-menu-reverse-icon-color"],allowRowResize:!1,autoSelectRow:!0,gridColumnColor:null,gridRowColor:null,groupedColumnDividerColor:oe["grouped-column-divider-color"],columnHoverBackgroundColor:null,headerHorizontalPadding:12,scrollBarSize:13,scrollBarHoverSize:16,minScrollHandleSize:24,rowHeight:parseInt(oe["row-height"],10)||19,columnWidth:100,rowHeaderWidth:0,rowFooterWidth:60,columnHeaderHeight:parseInt(oe["header-height"],10)||30,filterBarHeight:30,filterBarCollapsedHeight:5,sortHeaderBarHeight:2,reverseHeaderBarHeight:4,filterBarHorizontalPadding:4,scrimBlurSize:25,minScrimTransitionTime:150,maxScrimTransitionTime:350,scrollSnapToRow:!0,linkerColumnHoverBackgroundColor:oe["linker-column-hover-bg"],treeLineColor:oe["tree-line-color"],treeMarkerColor:oe["tree-marker-color"],treeMarkerHoverColor:oe["tree-marker-hover-color"],floatingGridColumnColor:null,floatingGridRowColor:oe["floating-grid-row-color"],floatingRowBackgroundColors:oe["floating-row-background-colors"],floatingDividerInnerColor:oe["floating-divider-inner-color"],floatingDividerOuterColor:oe["floating-divider-outer-color"],overflowButtonColor:oe["overflow-button-color"],overflowButtonHoverColor:oe["overflow-button-hover-color"]});const Wi=se.module("ColumnStatistics"),pp={SIZE:"Number of Rows"},or=class extends T.exports.Component{constructor(e){super(e),this.handleError=this.handleError.bind(this),this.handleGenerateStatistics=this.handleGenerateStatistics.bind(this),this.handleStatistics=this.handleStatistics.bind(this),this.cancelablePromise=null,this.state={error:null,loading:!1,statistics:null,numRows:0}}static getStatsLabel(e){var t;return(t=pp[e])!=null?t:e.split(" ").map(n=>n[0].toUpperCase()+n.substr(1).toLowerCase()).join(" ")}componentDidMount(){this.maybeGenerateStatistics()}componentWillUnmount(){this.cancelablePromise&&this.cancelablePromise.cancel()}maybeGenerateStatistics(){const{model:e}=this.props,t=e.rowCount-e.pendingRowCount;this.setState({numRows:t}),e.isColumnStatisticsAvailable?t<or.AUTO_GENERATE_LIMIT&&this.handleGenerateStatistics():this.setState({loading:!1})}handleGenerateStatistics(){this.setState({loading:!0});const{column:e,model:t}=this.props;this.cancelablePromise=Ue.makeCancelable(t.columnStatistics(e)),this.cancelablePromise.then(this.handleStatistics).catch(this.handleError)}handleStatistics(e){Wi.debug("Received statistics",e);const{model:t,onStatistics:n}=this.props,s=[];e.statisticsMap.forEach((o,i)=>{s.push({operation:or.getStatsLabel(i),value:o,type:e.getType(i)})}),e.uniqueValues.forEach((o,i)=>{s.push({operation:i,className:"column-statistics-unique-value",value:o,type:"long"})}),this.setState({loading:!1,statistics:s,numRows:t.rowCount-t.pendingRowCount}),n()}handleError(e){if(e!=null&&Ue.isCanceled(e)){Wi.debug("Called handleError on a cancelled promise result");return}Wi.error("Error generating statistics",e),this.setState({error:e,loading:!1,statistics:null})}render(){const{column:e,model:t}=this.props,{error:n,loading:s,statistics:o,numRows:i}=this.state,r=!s&&n==null&&o==null&&t.isColumnStatisticsAvailable,l=[],a=e.type.substring(e.type.lastIndexOf(".")+1),c=e.description===null?null:e.description;if(o!=null)for(let p=0;p<o.length;p+=1){const{operation:g,className:f,value:w,type:C}=o[p],S=C?t.displayString(w,C):t.displayString(w,e.type,e.name),b=R(te.Fragment,{children:[h("div",{className:B("column-statistic-operation",f),children:g}),h("div",{className:"column-statistic-value",children:S})]},g);l.push(b)}const d=ke(t)&&t.hasExpandableRows?"Expanded Rows":"Number of Rows",u=t.displayString(i,"long"),m=t.getColumnIndexByName(e.name);return R("div",{className:"column-statistics",children:[R("div",{className:"column-statistics-title",children:[e.name,R("span",{className:"column-statistics-type",children:["\xA0(",a,")"]}),h(Sa,{className:"column-statistics-copy",tooltip:"Copy column name",copy:e.name})]}),c!=null&&h("div",{className:"column-statistics-description",children:c}),m!=null&&!t.isColumnMovable(m)&&R("div",{className:"column-statistics-status",children:[h(Z,{icon:t.isColumnFrozen(m)?yu:ou,className:"mr-1"}),t.isColumnFrozen(m)?"Frozen":"Not movable"]}),R("div",{className:"column-statistics-grid",children:[o==null&&R(Fe,{children:[h("div",{className:"column-statistic-operation",children:d}),h("div",{className:"column-statistic-value",children:u})]}),l]}),r&&h(X,{kind:"ghost",className:"px-0",onClick:this.handleGenerateStatistics,children:"Generate Stats"}),n!=null&&h("div",{className:"error-message",children:`${n}`}),o&&!s&&h(X,{kind:"ghost",className:"px-0",onClick:this.handleGenerateStatistics,icon:h(Z,{icon:Nu,className:"mr-1"}),children:"Refresh"}),s&&R("div",{className:"column-statistics-loading",children:[h(Vt,{className:"mr-2"}),"Calculating Stats..."]})]})}};let Xa=or;Xa.AUTO_GENERATE_LIMIT=1e5;const Xo=se.module("AdvancedFilterCreatorFilterItem");class Lr extends T.exports.PureComponent{constructor(t){super(t),this.getCachedIsValid=Ie((i,r,l,a)=>{try{return!l||x.makeAdvancedValueFilter(i,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:o=s[0]}=t;this.state={selectedType:o,value:n}}static getLabelForFilter(t,n){try{if(x.isNumberType(t)||x.isCharType(t))return sm(n);if(x.isTextType(t))return nm(n);if(x.isDateType(t))return om(n);if(x.isBooleanType(t))return im(n);throw new Error(`Unrecognized column type: ${t}`)}catch(s){return Xo.warn(s),""}}componentDidMount(){var t;(t=this.typeDropdown)==null||t.focus()}componentDidUpdate(t){const{value:n,selectedType:s}=this.props;s!==void 0&&t.selectedType!==s&&this.setState({selectedType:s}),n!==void 0&&t.value!==n&&this.setState({value:n})}handleTypeChange(t){const n=t.target.value;Xo.debug2("typeChange",n),this.setState({selectedType:n});const{onChange:s}=this.props,{value:o}=this.state;o!=null&&o.length>0&&s(n,o)}handleValueChange(t){Xo.debug2("valueChange");const{value:n}=t.target;this.setState({value:n});const{onChange:s}=this.props,{selectedType:o}=this.state;o!=null&&s(o,n)}handleDelete(){Xo.debug("delete");const{onDelete:t}=this.props;t()}render(){const{column:t,filterTypes:n,formatter:s}=this.props,{selectedType:o,value:i}=this.state,r=!x.isBooleanType(t.type),l=[],a=this.getCachedIsValid(t,o,i,s.timeZone);for(let c=0;c<n.length;c+=1){const d=n[c],u=Lr.getLabelForFilter(t.type,d),m=h("option",{value:d,children:u},d);l.push(m)}return h("div",{className:"advanced-filter-creator-filter-item",children:R("div",{className:"form-row",children:[h("div",{className:"form-group col",children:h("select",{className:"form-control custom-select",value:o,onChange:this.handleTypeChange,ref:c=>{this.typeDropdown=c},children:l})}),r&&h("div",{className:"form-group col",children:h("div",{className:"input-group",children:h("input",{type:"text",className:B("form-control",{error:!a}),placeholder:"Enter value",value:i,onChange:this.handleValueChange})})}),h("div",{className:"form-group col-1 px-0",children:h(X,{kind:"ghost",className:"w-100 h-100 p-0 m-0",onClick:this.handleDelete,icon:Rn,tooltip:"Remove Filter"})})]})})}}const Fl=se.module("AdvancedFilterCreatorSelectValueList"),ir=class extends T.exports.PureComponent{constructor(e){super(e),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:t}=this.props;this.state={itemCount:0,items:[],offset:0,selectedValues:t,isLoading:!0}}static indexOf(e,t){for(let n=0;n<t.length;n+=1){const s=t[n];if(s===e||s!=null&&s.valueOf!=null&&e!=null&&e.valueOf!=null&&s.valueOf()===e.valueOf())return n}return-1}componentDidMount(){const{table:e}=this.props;e&&this.startListening(e)}componentDidUpdate(e){const{filters:t,invertSelection:n,selectedValues:s,table:o}=this.props;e.table!==o&&(e.table&&this.stopListening(e.table),o&&this.startListening(o),this.resetViewport()),e.invertSelection!==n&&this.setState({selectedValues:[]},this.handleSelectionUpdate),e.selectedValues!==s&&this.setState({selectedValues:s},this.handleSelectionUpdate),e.filters!==t&&(o==null||o.applyFilter(t),this.resetViewport())}componentWillUnmount(){const{table:e}=this.props;e&&this.stopListening(e)}handleSelect(e,t){const{invertSelection:n}=this.props;let{selectedValues:s}=this.state;s=[...s];const o=ir.indexOf(t,s);o>=0?s.splice(o,1):s.push(t);let i=o<0;n&&(i=!i);const{offset:r}=this.state;let{items:l}=this.state;l=[...l];const a=e-r;a>=0&&a<l.length&&(l[a].isSelected=i),this.setState({items:l,selectedValues:s});const{onChange:c}=this.props;c(s,n)}handleViewportChange(e,t){this.updateViewport(e,t)}handleSelectionUpdate(){this.updateItemSelection()}handleTableUpdate(e){const{table:t,formatter:n}=this.props;if(!t)return;const s=e.detail,{offset:o}=s,i=[],r=t.columns[0];for(let a=0;a<s.rows.length;a+=1){const d=s.rows[a].get(r),u=n.getFormattedString(d,r.type,r.name),m=this.isValueSelected(d);i.push({displayValue:u,value:d,isSelected:m})}Fl.debug2("Received table update:",o,i.length);const l=t.size;this.setState({itemCount:l,items:i,offset:o,isLoading:!1})}isValueSelected(e){const{invertSelection:t}=this.props,{selectedValues:n}=this.state,s=ir.indexOf(e,n);return t?s<0:s>=0}startListening(e){e.addEventListener(I.Table.EVENT_UPDATED,this.handleTableUpdate)}stopListening(e){e.removeEventListener(I.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:e}=this.state;e=[...e];for(let t=0;t<e.length;t+=1){const n=e[t],{value:s}=n;n.isSelected=this.isValueSelected(s)}this.setState({items:e})}updateViewport(e,t,n=!1){const{table:s}=this.props;if(s==null)return;n&&this.setState({isLoading:!0});const o=t-e+1,i=Math.max(0,e-o*3),r=Math.max(i,t+o*3);Fl.debug2("Setting viewport",i,",",r),s.setViewport(i,r)}render(){const{offset:e,isLoading:t,items:n,itemCount:s}=this.state;return R("div",{className:"select-value-list-wrapper",children:[h(xa,{itemCount:s,items:n,offset:e,onSelect:this.handleSelect,onViewportChange:this.handleViewportChange,ref:o=>{this.list=o}}),h(dt,{in:t,timeout:250,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,children:h("div",{className:"loading-list",children:h(Vt,{className:"loading-spinner-large"})})})]})}};let Ya=ir;Ya.defaultProps={invertSelection:!0,selectedValues:[],onChange:()=>{}};const Qa=class extends T.exports.PureComponent{constructor(e){super(e),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:t,selectedValues:n}=e;this.state={filters:[],invertSelection:t,selectedValues:n,searchText:""}}componentDidMount(){this.initSearchTable()}componentDidUpdate(e,t){const{invertSelection:n,selectedValues:s,table:o}=this.props;e.table!==o&&this.initSearchTable(),e.invertSelection!==n&&this.setState({invertSelection:n}),e.selectedValues!==s&&this.setState({selectedValues:s});const{table:i,searchText:r}=this.state;i!==t.table&&(t.table!=null&&t.table.close(),i!=null&&this.startUpdateFilterTimer()),r!==t.searchText&&this.startUpdateFilterTimer()}componentWillUnmount(){const{table:e}=this.state;e!=null&&e.close(),this.searchTablePromise=void 0,this.stopUpdateFilterTimer()}getColumnName(){const{table:e}=this.props;return e!=null?e.columns[0].name:""}getDisplayedValuesCount(){const{invertSelection:e,selectedValues:t,table:n}=this.state;return n==null?null:e?n.totalSize-t.length:t.length}getDisplayedValueText(){const e=this.getDisplayedValuesCount(),{table:t}=this.state,{formatter:n}=this.props;if(e!=null&&t!=null){const s=n.getFormattedString(e,"long"),o=n.getFormattedString(t.totalSize,"long");let i="";return e<1e6&&(i="Displaying "),`${i}${s} of ${o}`}return null}initSearchTable(){const{table:e}=this.props;if(e==null)return;const t=e.copy();this.searchTablePromise=t,this.searchTablePromise.then(n=>{this.searchTablePromise===t?(this.setState({table:n}),this.searchTablePromise=void 0):n.close()})}handleListChange(e,t){this.setState({selectedValues:e,invertSelection:t});const{onChange:n}=this.props;n(e,t)}handleSearchChange(e){const t=e.target.value;this.setState({searchText:t})}handleSelectAllClick(){this.resetSelection(!0)}handleClearAllClick(){this.resetSelection(!1)}handleUpdateFilterTimeout(){this.updateFilterTimer=void 0,this.updateTableFilter()}resetSelection(e){const t=[];this.setState({invertSelection:e,selectedValues:t});const{onChange:n}=this.props;n(t,e)}startUpdateFilterTimer(){this.stopUpdateFilterTimer(),this.updateFilterTimer=setTimeout(this.handleUpdateFilterTimeout,Qa.searchDebounceTime)}stopUpdateFilterTimer(){this.updateFilterTimer!=null&&(clearTimeout(this.updateFilterTimer),this.updateFilterTimer=void 0)}updateTableFilter(){const{table:e,searchText:t}=this.state,{timeZone:n}=this.props,s=e==null?void 0:e.columns[0],o=[];if(s==null)return;let i;if(t.length>0){let r=null;x.isCharType(s.type)?r=x.makeQuickFilter(s,t):x.isTextType(s.type)?r=x.makeQuickFilter(s,`~${t}`,n):r=x.makeQuickFilter(s,`>=${t}`,n),r!=null?o.push(r):i="Invalid search text"}this.setState({filters:o,error:i})}render(){const{error:e,filters:t,invertSelection:n,selectedValues:s,searchText:o,table:i}=this.state,{formatter:r,showSearch:l}=this.props,a=this.getColumnName(),c=this.getDisplayedValueText(),d=a?`Find ${a}...`:"";return R("div",{className:"advanced-filter-creator-select-value",children:[R("div",{className:l?"form-group":"",children:[h("label",{htmlFor:"advanced-filter-creator-select-value-input",children:"Select Values"}),l&&h("input",{type:"text",className:B("form-control",{"is-invalid":e!=null}),id:"advanced-filter-creator-select-value-input",placeholder:d,value:o,onChange:this.handleSearchChange})]}),h(Ya,{table:i,filters:t,invertSelection:n,selectedValues:s,formatter:r,onChange:this.handleListChange}),R("div",{className:"advanced-filter-creator-select-meta-row",children:[R("div",{children:[h(X,{kind:"ghost",onClick:this.handleSelectAllClick,children:"Select All"}),h(X,{kind:"ghost",onClick:this.handleClearAllClick,children:"Clear"})]}),h(dt,{in:c!=null,timeout:250,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,children:h("div",{className:"row-count-info",children:c})})]})]})}};let Pr=Qa;Pr.searchDebounceTime=250;Pr.defaultProps={invertSelection:!0,selectedValues:[],onChange:()=>{},showSearch:!0};const to=se.module("AdvancedFilterCreator"),ds=class extends T.exports.PureComponent{constructor(e){var r,l;super(e),this.getFilterTypes=Ie(a=>x.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=te.createRef();const{options:t}=e;let{filterOperators:n,invertSelection:s,selectedValues:o}=t;const i=(l=(r=t.filterItems)==null?void 0:r.map(({selectedType:a,value:c})=>({selectedType:a,value:c,key:nn()})))!=null?l:[];i.length===0&&i.push(ds.makeFilterItem()),n==null&&(n=[]),s==null&&(s=!0),o==null&&(o=[]),this.state={filterItems:i,filterOperators:n,invertSelection:s,selectedValues:o,valuesTableError:null,valuesTable:void 0}}static makeFilterItem(){return{key:nn()}}componentDidMount(){this.initValuesTable()}componentWillUnmount(){this.debounceTimeout!=null&&(clearTimeout(this.debounceTimeout),this.sendUpdate()),this.valuesTablePromise!=null&&this.valuesTablePromise.cancel()}getFilterChangeHandler(e){return this.handleFilterChange.bind(this,e)}getFilterDeleteHandler(e){return this.handleFilterDelete.bind(this,e)}initValuesTable(){const{model:e,column:t}=this.props;if(!e.isValuesTableAvailable){to.debug("No values table for this model, just ignore");return}this.valuesTablePromise=x.makeCancelableTablePromise(e.valuesTable(t)),this.valuesTablePromise.then(n=>{const s=n.columns[0].sort().asc();n.applySort([s]),this.setState({valuesTable:n})}).catch(n=>{Ue.isCanceled(n)||(to.error("Unable to open values table",n),this.setState({valuesTableError:n}))})}handleFocusTrapEnd(){var e,t;((t=(e=this.focusTrapContainer)==null?void 0:e.current)==null?void 0:t.querySelector("button,select,input,textarea")).focus()}handleFocusTrapStart(){var t,n;const e=(n=(t=this.focusTrapContainer)==null?void 0:t.current)==null?void 0:n.querySelectorAll("button,select,input,textarea");e&&e.length>0&&e[e.length-1].focus()}handleAddAnd(){let{filterItems:e,filterOperators:t}=this.state;e=e.concat(ds.makeFilterItem()),t=t.concat(Zt.and),this.setState({filterItems:e,filterOperators:t})}handleAddOr(){let{filterItems:e,filterOperators:t}=this.state;e=e.concat(ds.makeFilterItem()),t=t.concat(Zt.or),this.setState({filterItems:e,filterOperators:t})}handleChangeFilterOperator(e,t){let{filterOperators:n}=this.state;n=[...n],tm(t),n[e]=t,this.setState({filterOperators:n}),this.startUpdateTimer()}handleFilterChange(e,t,n){let{filterItems:s}=this.state;s=[...s];const{key:o}=s[e];s[e]={key:o,selectedType:t,value:n},this.setState({filterItems:s}),this.startUpdateTimer()}handleFilterDelete(e){let{filterItems:t,filterOperators:n}=this.state;t=[...t],n=[...n],e<t.length&&t.splice(e,1),e<n.length?n.splice(e,1):e===n.length&&n.splice(n.length-1,1),t.length===0&&t.push(ds.makeFilterItem()),this.setState({filterItems:t,filterOperators:n}),this.startUpdateTimer()}handleSelectValueChange(e,t){this.setState({selectedValues:e,invertSelection:t}),this.startUpdateTimer()}handleReset(){to.debug("Resetting Advanced Filter"),this.setState({filterItems:[ds.makeFilterItem()],filterOperators:[],selectedValues:[],invertSelection:!0}),this.startUpdateTimer()}handleSortDown(e){const t=Ne.isModifierKeyDown(e);this.sortTable(x.sortDirection.descending,t)}handleSortUp(e){const t=Ne.isModifierKeyDown(e);this.sortTable(x.sortDirection.ascending,t)}handleSubmit(e){to.debug("Submitting Advanced Filter"),this.stopUpdateTimer(),this.sendUpdate(),e.preventDefault()}handleDone(e){to.debug("Submitting and Closing Advanced Filter"),this.stopUpdateTimer(),this.sendUpdate();const{onDone:t}=this.props;t(),e.preventDefault()}handleUpdateTimeout(){this.debounceTimeout=void 0,this.sendUpdate()}shouldShowAddFilter(){const{filterItems:e}=this.state;if(e.length===0)return!1;const t=e[e.length-1],{selectedType:n,value:s}=t;return n!=null&&n.length>0&&s!=null&&s.length>0}sortTable(e,t=!1){const{column:n,onSortChange:s}=this.props;s(n,e,t)}startUpdateTimer(){this.stopUpdateTimer(),this.debounceTimeout=setTimeout(this.handleUpdateTimeout,ds.debounceFilterUpdate)}stopUpdateTimer(){this.debounceTimeout!==void 0&&(clearTimeout(this.debounceTimeout),this.debounceTimeout=void 0)}sendUpdate(){const{filterItems:e,filterOperators:t,invertSelection:n,selectedValues:s}=this.state,{column:o,onFilterChange:i,model:r}=this.props,{formatter:l}=r,a=e.filter(({selectedType:m,value:p})=>m!=null&&p!=null&&p!==""),c=t.filter((m,p)=>m!=null&&e[p].selectedType!=null&&e[p].value!=null&&e[p].value!=="").slice(0,a.length-1),d={filterItems:a,filterOperators:c,invertSelection:n,selectedValues:s},u=x.makeAdvancedFilter(o,d,l.timeZone);i(o,u,d)}render(){const{column:e,model:t,sortDirection:n,formatter:s}=this.props,{filterItems:o,filterOperators:i,invertSelection:r,selectedValues:l,valuesTable:a,valuesTableError:c}=this.state,{isValuesTableAvailable:d}=t,u=x.isBooleanType(e.type),m=x.isDateType(e.type),p=this.getFilterTypes(e.type),g=e.type.substring(e.type.lastIndexOf(".")+1),f=[];if(!u&&p.length)for(let S=0;S<o.length;S+=1){const b=o[S],{key:E,selectedType:v,value:y}=b,M=h(Lr,{column:e,filterTypes:p,onChange:this.getFilterChangeHandler(S),onDelete:this.getFilterDeleteHandler(S),selectedType:v,value:y,formatter:s},E);if(f.push(M),S<i.length){const F=i[S]===Zt.and,V=R("div",{className:"form-row justify-content-end advanced-filter-creator-filter-operator",children:[h(X,{kind:"ghost",className:B("filter-operator",{active:F}),onClick:()=>this.handleChangeFilterOperator(S,Zt.and),children:"AND"}),h(X,{kind:"ghost",className:B("filter-operator",{active:!F}),onClick:()=>this.handleChangeFilterOperator(S,Zt.or),children:"OR"})]},`filterOperator${E}`);f.push(V)}}const w=this.shouldShowAddFilter(),C=R("div",{className:B("form-row justify-content-end add-filter-item",{hidden:!w}),children:[h("span",{className:"text-muted",children:h(Z,{icon:Bs})}),h(X,{kind:"ghost",className:"btn-filter-item",onClick:this.handleAddAnd,disabled:!w,tooltip:"Add filter with AND",children:"AND"}),h(X,{kind:"ghost",className:"btn-filter-item",onClick:this.handleAddOr,disabled:!w,tooltip:"Add filter with OR",children:"OR"})]},"addFilterItem");return f.push(C),R("div",{className:"advanced-filter-creator",role:"presentation",children:[h("div",{tabIndex:0,onFocus:this.handleFocusTrapStart}),R("form",{onSubmit:this.handleSubmit,ref:this.focusTrapContainer,children:[R("div",{className:"title-bar",children:[h("h6",{className:"advanced-filter-title",children:"Advanced Filters"}),R("div",{className:"advanced-filter-menu-buttons",children:[h(X,{kind:"ghost",className:B("sort-operator",{active:n===x.sortDirection.descending}),onClick:this.handleSortDown,icon:rl,tooltip:`Sort ${e.name} Descending`}),h(X,{kind:"ghost",className:B("sort-operator",{active:n===x.sortDirection.ascending}),onClick:this.handleSortUp,icon:h(Z,{icon:rl,rotation:180}),tooltip:`Sort ${e.name} Ascending`})]})]}),h("hr",{}),R("div",{className:"advanced-filter-column-name",children:[e.name,"\xA0",R("span",{className:"column-type",children:["(",g,")"]})]}),f,d&&c==null&&R(Fe,{children:[!u&&h("hr",{}),h("div",{className:"form-group",children:h(Pr,{table:a,onChange:this.handleSelectValueChange,invertSelection:r,selectedValues:l,formatter:s,showSearch:!m,timeZone:s.timeZone})})]}),R("div",{className:"form-row justify-content-end",children:[h(X,{kind:"secondary",className:"mr-2",onClick:this.handleReset,children:"Reset"}),h(X,{kind:"primary",onClick:this.handleDone,children:"Done"})]})]}),h("div",{tabIndex:0,onFocus:this.handleFocusTrapEnd})]})}};let Hr=ds;Hr.debounceFilterUpdate=250;Hr.defaultProps={options:{filterItems:null,filterOperators:null,invertSelection:!0,selectedValues:[]},sortDirection:null};const xl=se.module("Aggregations"),gp=[Ee.SUM,Ee.ABS_SUM,Ee.MIN,Ee.MAX,Ee.VAR,Ee.AVG,Ee.STD,Ee.FIRST,Ee.LAST,Ee.COUNT_DISTINCT,Ee.DISTINCT,Ee.COUNT,Ee.UNIQUE];function fp({isRollup:e,settings:t,onChange:n,onEdit:s}){const{aggregations:o,showOnTop:i}=t,r=T.exports.useMemo(()=>gp.filter(F=>!o.some(V=>V.operation===F)),[o]),[l,a]=T.exports.useState(r[0]),[c,d]=T.exports.useState([]),u=T.exports.useCallback(F=>{n({...t,...F})},[n,t]),m=T.exports.useCallback(F=>{u({aggregations:F})},[u]),p=T.exports.useCallback(F=>{u({showOnTop:F})},[u]),g=T.exports.useCallback(()=>{xl.debug("handleDragStart"),gt.startDragging()},[]),f=T.exports.useCallback(({destination:F,source:V})=>{if(xl.debug("handleDragEnd",F,V),gt.stopDragging(),F===null)return;let H=F.index;V.index<F.index&&(H+=1);const N=[...o],P=gt.reorder(N,c,N,H),k=gt.adjustDestinationIndex(H,c),z=[[k,k+P.length-1]];m(N),d(z)},[m,o,c,d]),w=T.exports.useCallback(F=>{a(F)},[a]),C=T.exports.useCallback(()=>{m([...o,{operation:l,selected:[],invert:!0}])},[o,l,m]),S=T.exports.useCallback(F=>{m(o.filter((V,H)=>H!==F))},[o,m]),b=T.exports.useCallback(F=>{d(F)},[d]),E=T.exports.useCallback(F=>{const V=o[F];qn.isRollupOperation(V.operation)||s(V)},[o,s]),v=T.exports.useCallback(F=>{p(F.target.value==="true")},[p]);T.exports.useEffect(function(){r.length>0&&!r.includes(l)&&a(r[0])},[r,l]);const y=T.exports.useCallback(({item:F,itemIndex:V,isClone:H=!1,selectedCount:N})=>{const P=F.operation,k=H?`${N}`:void 0,z=H?"item-list-item-clone":void 0,K=qn.isRollupOperation(F.operation),G=!H&&!K;return R(Fe,{children:[R("div",{className:B("item-list-item-content","draggable-item-list-item-content",z),children:[R("span",{className:"title",children:[P,!e&&K&&R("span",{className:"small text-warning",children:[h(Z,{icon:ha})," Requires rollup"]})]}),bt.renderBadge({text:k}),bt.renderHandle()]}),!H&&R(Fe,{children:[h(X,{kind:"ghost",className:"btn-edit",icon:pr,tooltip:"Edit Columns",onClick:()=>s(F),disabled:!G}),h(X,{kind:"ghost",className:"btn-delete",icon:Rn,tooltip:"Delete Aggregation",onClick:()=>S(V)})]})]})},[S,s,e]),M=r.length>0,A=o.length>0;return R("div",{className:"aggregations",children:[M&&R("div",{className:"form-inline",children:[h(gh,{onChange:w,value:l,children:r.map(F=>h(ph,{value:F,children:F},F))}),R("button",{type:"button",className:"btn btn-link btn-add",onClick:C,children:[h(Z,{icon:Bs}),"Add Aggregation"]})]}),M&&A&&h("hr",{}),A&&R(Fe,{children:[!e&&R("div",{className:"form-inline",children:[h("label",{children:"Placement:\xA0"}),R(Mr,{onChange:v,value:`${i}`,children:[h(vn,{value:"true",children:"Top"}),h(vn,{value:"false",children:"Bottom"})]})]}),h(gi,{onDragStart:g,onDragEnd:f,children:h(bt,{className:"selected-aggregations",itemCount:o.length,items:o,renderItem:y,offset:0,onSelectionChange:b,onSelect:E,selectedRanges:c,isMultiSelect:!0})})]})]})}const Cp=30;function wp({aggregation:e,columns:t,onChange:n}){const[s,o]=T.exports.useState(-1),[i,r]=T.exports.useState(-1),[l,a]=T.exports.useState(0),{invert:c,selected:d}=e,u=T.exports.useRef(null),m=T.exports.useCallback(v=>d.includes(v)?!c:c,[c,d]),p=T.exports.useMemo(()=>{let v=kr(t,e.operation);return l!==0&&(v=x.sortColumns(v,l===1)),v},[t,e.operation,l]),g=T.exports.useMemo(()=>s>=0?p.slice(s,i+1).map(v=>({value:v.name,displayValue:v.name,isSelected:m(v.name)})):[],[p,m,i,s]),f=T.exports.useCallback(v=>{const{name:y}=p[v],M=d.indexOf(y);let A=[...d],F=c;M>=0?A.splice(M,1):(A.push(y),A.length===p.length&&(A=[],F=!c)),n({...e,selected:A,invert:F})},[e,c,p,d,n]),w=T.exports.useCallback(()=>{a(0),n({...e,selected:[],invert:!0})},[e,n]),C=T.exports.useCallback((v,y)=>{o(v),r(y)},[o,r]),S=T.exports.useCallback(()=>{d.length===0?n({...e,invert:!c}):n({...e,selected:[],invert:!0})},[e,c,n,d]),b=d.length===0?c:null,E=d.length!==0||!c||l!==0;return R("div",{role:"menu",className:"aggregation-edit",children:[h("div",{className:"top-menu",children:R("div",{className:"form-inline",children:[h(ut,{checked:b,onChange:S,children:"Toggle All"}),h("div",{className:"spacer"}),h(dt,{in:E,timeout:Le.transitionSlowMs,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,children:h(X,{kind:"ghost",className:"btn-reset",onClick:w,children:"Reset"})}),h(X,{kind:"ghost",className:B({active:l===1}),icon:Cr,tooltip:"Sort ascending",onClick:()=>a(1)}),h(X,{kind:"ghost",className:B({active:l===2}),icon:wr,tooltip:"Sort descending",onClick:()=>a(2)})]})}),h("div",{className:"aggregation-edit-item-list",children:h(sn,{itemCount:p.length,items:g,offset:s,renderItem:({item:v})=>h(ut,{checked:m(v.value),children:v.displayValue}),onSelect:f,onViewportChange:C,rowHeight:Cp,focusSelector:"input",ref:u})})]})}function Sp(e){return h("svg",{width:48,height:48,xmlns:"http://www.w3.org/2000/svg",...e,children:R("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 bp(e){return h("svg",{width:48,height:48,xmlns:"http://www.w3.org/2000/svg",...e,children:R("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 vp(e){return h("svg",{width:48,height:48,xmlns:"http://www.w3.org/2000/svg",...e,children:R("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 Tp(e){return h("svg",{width:48,height:48,xmlns:"http://www.w3.org/2000/svg",...e,children:R("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 Ep(e){return h("svg",{width:48,height:48,xmlns:"http://www.w3.org/2000/svg",...e,children:R("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 Rp(e){return R("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,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 yp(e){return R("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,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 Al=se.module("ChartBuilder"),Ye=class extends T.exports.PureComponent{static getTypeName(e){switch(e){case I.plot.SeriesPlotStyle.LINE:return"Line";case I.plot.SeriesPlotStyle.BAR:return"Bar";case I.plot.SeriesPlotStyle.SCATTER:return"Scatter";case I.plot.SeriesPlotStyle.PIE:return"Pie";case I.plot.SeriesPlotStyle.HISTOGRAM:return"Histogram";default:return e}}static getTypeIcon(e){switch(e){case I.plot.SeriesPlotStyle.LINE:return h(vp,{});case I.plot.SeriesPlotStyle.BAR:return h(Sp,{});case I.plot.SeriesPlotStyle.SCATTER:return h(Ep,{});case I.plot.SeriesPlotStyle.PIE:return h(Tp,{});case I.plot.SeriesPlotStyle.HISTOGRAM:return h(bp,{});default:return null}}static getMaxSeriesCount(e){switch(e){case I.plot.SeriesPlotStyle.PIE:return 1;case I.plot.SeriesPlotStyle.HISTOGRAM:return 0;default:return 100}}static getXAxisLabel(e){switch(e){case I.plot.SeriesPlotStyle.PIE:return"Labels";case I.plot.SeriesPlotStyle.HISTOGRAM:return"Data";default:return"X-Axis"}}static getSeriesLabel(e){switch(e){case I.plot.SeriesPlotStyle.PIE:return"Values";default:return"Series"}}static makeSeriesItem(e){return{id:nn.generate(),value:e}}static makeDefaultSeriesItems(e,t){if(Ye.getMaxSeriesCount(e)===0||t==null||t.length===0)return[];const s=t.length>1?t[1].name:t[0].name;return[Ye.makeSeriesItem(s)]}static getDefaultXAxis(e,t){return t!=null&&t.length>0?t[0].name:null}constructor(e){super(e),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:t}=e,{columns:n}=t,s=Ye.types[0],o=Ye.getDefaultXAxis(s,n),i=Ye.makeDefaultSeriesItems(s,n);this.state={type:s,seriesItems:i,xAxis:o,isLinked:!0}}handleAddSeries(){this.setState(e=>{const{seriesItems:t}=e,n=[...t],{model:s}=this.props,{columns:o}=s;return n.push({id:nn.generate(),value:o[0].name}),{seriesItems:n}},this.sendChange)}handleLinkStateChange(e){this.setState({isLinked:e.target.value==="true"},this.sendChange)}handleReset(){const{model:e}=this.props,{columns:t}=e,n=Ye.types[0],s=Ye.getDefaultXAxis(n,t),o=Ye.makeDefaultSeriesItems(n,t),i=!0;this.setState({type:n,seriesItems:o,xAxis:s,isLinked:i},this.sendChange)}handleSeriesChange(e){const{value:t}=e.target,n=e.target.getAttribute("data-index"),s=parseInt(n,10);this.setState(o=>{let{seriesItems:i}=o;return i=[...i],i[s].value=t,{seriesItems:i}},this.sendChange)}handleSeriesDeleteClick(e){const n=e.target.getAttribute("data-index"),s=parseInt(n,10);this.setState(o=>{const{seriesItems:i}=o,r=[...i];return r.splice(s,1),{seriesItems:r}},this.sendChange)}handleSubmit(e){e.preventDefault();const{onSubmit:t}=this.props,{type:n,seriesItems:s,xAxis:o,isLinked:i}=this.state,r=s.map(l=>l.value);t({type:`${n}`,series:r,xAxis:o,isLinked:i})}handleTypeClick(e){const n=e.target.getAttribute("data-index"),s=parseInt(n,10),o=Ye.types[s];Al.debug2("handleTypeSelect",o),this.setState(i=>{const r=Ye.getMaxSeriesCount(o);let{seriesItems:l}=i;if(l=l.slice(0,r),l.length===0&&r>0){const{model:a}=this.props,{columns:c}=a;l=Ye.makeDefaultSeriesItems(o,c)}return{type:o,seriesItems:l}},this.sendChange)}handleXAxisChange(e){const t=e.target.value;Al.debug2("x-axis change",t),this.setState({xAxis:t},this.sendChange)}sendChange(){const{onChange:e}=this.props,{isLinked:t,type:n,seriesItems:s,xAxis:o}=this.state,i=s.map(r=>r.value);e({type:n,series:i,xAxis:o,isLinked:t})}render(){const{model:e}=this.props,{columns:t}=e,{seriesItems:n,type:s,xAxis:o,isLinked:i}=this.state,r=Ye.getMaxSeriesCount(s),l=Ye.getXAxisLabel(s),a=Ye.getSeriesLabel(s),c=n.length>0,d=n.length<r;return h("div",{className:"chart-builder",children:R("form",{onSubmit:this.handleSubmit,children:[R("div",{className:"form-row",children:[h("label",{children:"Select Chart Type"}),h("div",{className:"form-row",children:Ye.types.map((u,m)=>{const p=u;return h("div",{className:"col col-chart-type",children:R("button",{type:"button",className:B("btn","btn-icon","btn-chart-type",{active:u===s}),"data-index":m,onClick:this.handleTypeClick,children:[Ye.getTypeIcon(u),Ye.getTypeName(u)]})},p)})})]}),h("hr",{}),R("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:o,onChange:this.handleXAxisChange,children:t.map(u=>h("option",{value:u.name,children:u.name},u.name))})]}),c&&h("hr",{}),n.map((u,m)=>R("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:t.map(p=>h("option",{value:p.name,"data-index":m,children:p.name},p.name))}),n.length>1&&h(X,{kind:"ghost",className:"btn-delete-series ml-2 px-2","data-index":m,"data-testid":`delete-series-${m}`,onClick:this.handleSeriesDeleteClick,icon:Rn,tooltip:"Delete"})]},u.id)),d&&R("div",{className:"form-row",children:[h("div",{className:"col-2"}),h(X,{kind:"ghost",className:"btn-add-series mt-1",onClick:this.handleAddSeries,icon:Bs,children:"Add Series"})]}),R("div",{className:"form-row chart-builder-link",children:[h("label",{className:"col-2 label-right",children:R("div",{className:"fa-md fa-layers",children:[h(Z,{mask:br,icon:fi,transform:"right-5 down-5"}),h(Z,{icon:i?ra:Lu,transform:"grow-2 right-8 down-6"})]})}),R(Mr,{onChange:this.handleLinkStateChange,value:`${i}`,children:[h(vn,{value:"true",children:"Sync State"}),h(vn,{value:"false",children:"Freeze State"})]})]}),R("div",{className:"form-row",children:[h("div",{className:"col-2 label-right"}),h("div",{className:"col chart-builder-link-info",children:i?"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."})]}),R("div",{className:B("form-row","justify-content-end","my-3"),children:[h(X,{kind:"secondary",className:"btn-reset",onClick:this.handleReset,children:"Reset"}),h(X,{kind:"primary",type:"submit",className:"btn-submit",children:"Create"})]})]})})}};let ja=Ye;ja.types=[I.plot.SeriesPlotStyle.LINE,I.plot.SeriesPlotStyle.BAR,I.plot.SeriesPlotStyle.SCATTER,I.plot.SeriesPlotStyle.PIE];class Za extends T.exports.Component{constructor(t){super(t),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 o;const{value:t,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:t,wordWrap:"on",automaticLayout:!0,...n};if(!this.editorContainer)throw new Error("editorContainer is null");this.editor=bn.create(this.editorContainer,s),this.editor.layout(),(o=this.editor.getModel())==null||o.updateOptions({tabSize:0}),this.editor.onKeyDown(this.handleKeyDown),this.editor.onDidChangeModelContent(this.handleContentChanged),this.editor.onDidFocusEditorText(this.handleEditorFocus),this.editor.onDidBlurEditorText(this.handleEditorBlur)}destroyEditor(){var t;(t=this.editor)==null||t.dispose(),this.editor=void 0}handleContentChanged(){var s,o;const{onContentChanged:t}=this.props,n=(o=(s=this.editor)==null?void 0:s.getModel())==null?void 0:o.getValue();n!==void 0&&this.setState({isEditorEmpty:n.length===0}),t(n)}handleEditorFocus(){this.setState({isEditorFocused:!0})}handleEditorBlur(){var n,s,o;const t=(o=(s=(n=this.editor)==null?void 0:n.getModel())==null?void 0:s.getValue())!=null?o:"";this.setState({isEditorEmpty:t.length===0,isEditorFocused:!1})}handleContainerClick(){var n;const{isEditorFocused:t}=this.state;t||(n=this.editor)==null||n.focus()}handleKeyDown(t){const{onTab:n,editorIndex:s}=this.props;t.code==="Tab"&&(t.stopPropagation(),t.preventDefault(),n(s,t.shiftKey))}render(){const{value:t,invalid:n}=this.props,{isEditorFocused:s,isEditorEmpty:o}=this.state;return R("div",{className:B("input-editor-wrapper",{focused:s,invalid:n}),role:"presentation",onClick:this.handleContainerClick,children:[h("div",{className:"editor-container",ref:i=>{this.editorContainer=i}}),o&&!t&&h("div",{className:"editor-placeholder text-muted",children:"Column Formula"})]})}}Za.defaultProps={value:"",onContentChanged:()=>{},editorSettings:{},editorIndex:0,onTab:()=>{},invalid:!1};const Ol=Object.freeze({NAME:"name",FORMULA:"formula"}),Ip=()=>{};function Mp({eventKey:e,name:t,inputIndex:n,formula:s,onChange:o,onDeleteColumn:i,onTabInEditor:r,invalid:l,isDuplicate:a}){const c=t===""||_t.isValidColumnName(t),d=T.exports.useCallback(u=>{u!==void 0&&(u.replace(/(\r\n|\n|\r)/gm,""),o(e,Ol.FORMULA,u))},[o,e]);return h(cr,{draggableId:e,index:n,disableInteractiveElementBlocking:!0,children:(u,m)=>R("div",{className:B("draggable-container",{dragging:m.isDragging}),ref:u.innerRef,...u.draggableProps,children:[R("div",{className:"custom-column-input-container",children:[R("div",{className:"pb-3",children:[R("div",{className:"d-flex flex-row custom-column-name",children:[h("input",{className:B("form-control custom-column-input",{"is-invalid":l||!c||a}),placeholder:"Column Name",value:t,onChange:p=>{o(e,Ol.NAME,p.target.value)}}),h(X,{kind:"ghost",className:"ml-1 px-2",onClick:()=>{i(e)},icon:Rn,tooltip:"Delete custom column"}),h(X,{kind:"ghost",className:"btn-drag-handle",onClick:Ip,...u.dragHandleProps,icon:Ci,tooltip:"Drag column to re-order"})]}),(!c||a)&&h("p",{className:"validate-label-error text-danger mb-0 mt-2 pl-1",children:c?"Duplicate name":"Invalid name"})]}),h(Za,{editorSettings:{language:"deephavenDb"},editorIndex:n,value:s,onContentChanged:d,onTab:r,invalid:l})]}),h("hr",{})]})})}const $i=[];class me extends Ha{constructor(){super(),this.listenerCount=0}addEventListener(t,n,s){super.addEventListener(t,n,s),this.listenerCount+=1,this.listenerCount===1&&this.startListening()}removeEventListener(t,n,s){super.removeEventListener(t,n,s),this.listenerCount-=1,this.listenerCount===0&&this.stopListening()}startListening(){}stopListening(){}get originalColumns(){return this.columns}get layoutHints(){return null}get frontColumns(){return $i}get backColumns(){return $i}get frozenColumns(){return $i}isColumnFrozen(t){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(t){return!1}close(){}isRowMovable(){return!1}get isSeekRowAvailable(){return!1}}me.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 ks=class extends T.exports.Component{constructor(e){super(e),this.getInput=Ie((t,n)=>t.find(s=>s.eventKey===n)),this.getInputIndex=Ie((t,n)=>t.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 nn.generate()}static createCustomColumnInput(){return{eventKey:nn.generate(),name:"",formula:""}}componentDidMount(){const{customColumns:e}=this.props;this.parseCustomColumns(e),this.startListening()}componentWillUnmount(){this.stopListening(),this.successButtonTimer&&clearTimeout(this.successButtonTimer)}resetErrorMessage(){this.setState({errorMessage:null})}startListening(){const{model:e}=this.props;e.addEventListener(me.EVENT.COLUMNS_CHANGED,this.handleCustomColumnUpdated),e.addEventListener(me.EVENT.UPDATED,this.handleCustomColumnUpdated),e.addEventListener(me.EVENT.REQUEST_FAILED,this.handleRequestFailed)}stopListening(){const{model:e}=this.props;e.removeEventListener(me.EVENT.COLUMNS_CHANGED,this.handleCustomColumnUpdated),e.removeEventListener(me.EVENT.UPDATED,this.handleCustomColumnUpdated),e.removeEventListener(me.EVENT.REQUEST_FAILED,this.handleRequestFailed)}parseCustomColumns(e){if(e.length>0){const t=e.map(n=>{const s=n.split(/=(.+)/,2);return{eventKey:ks.makeCustomColumnInputEventKey(),name:s[0],formula:s[1]}});this.setState({inputs:t})}else this.setState({inputs:[ks.createCustomColumnInput()]})}handleAddColumnClick(){const{inputs:e}=this.state,t=[...e];t.push(ks.createCustomColumnInput()),this.setState({inputs:t})}handleDeleteColumn(e){const{inputs:t}=this.state,n=this.getInputIndex(t,e),s=[...t];s.splice(n,1),s.length===0&&s.push(ks.createCustomColumnInput()),this.setState({inputs:s})}handleInputChange(e,t,n){const{inputs:s}=this.state,o=this.getInputIndex(s,e),r={...this.getInput(s,e)};r[t]=n;const l=[...s];l.splice(o,1,r),this.setState({inputs:l})}handleCustomColumnUpdated(){const{isCustomColumnApplying:e}=this.state;!e||this.setState({isCustomColumnApplying:!1,isSuccessShowing:!0},()=>{this.successButtonTimer=setTimeout(()=>this.setState({isSuccessShowing:!1}),ks.SUCCESS_SHOW_DURATION)})}handleRequestFailed(e){const t=e,{isCustomColumnApplying:n}=this.state;!n||this.setState({isCustomColumnApplying:!1,errorMessage:R(Fe,{children:[R("p",{children:[h(Z,{icon:Yn})," Failed to apply custom columns."]}),R("div",{className:"error-box",children:[t.detail.errorMessage,h("br",{}),"Table configuration:"," ",JSON.stringify(t.detail.configuration)]})]}),hasRequestFailed:!0})}handleDragEnd(e){if(gt.stopDragging(),!e.destination)return;const{inputs:t}=this.state,n=e.source.index,s=e.destination.index,o=[...t],i=t[n];o.splice(n,1),o.splice(s,0,i),this.setState({inputs:o})}handleEditorTabNavigation(e,t){var s,o,i,r;const{inputs:n}=this.state;if(t){((s=this.container)==null?void 0:s.querySelectorAll(".btn-drag-handle")[e]).focus();return}if(e===n.length-1)(i=(o=this.container)==null?void 0:o.querySelector(".btn-add-column"))==null||i.focus();else{const l=e+1;((r=this.container)==null?void 0:r.querySelectorAll(".custom-column-input")[l]).focus()}}handleSaveClick(){const{onSave:e,customColumns:t}=this.props,{inputs:n,isCustomColumnApplying:s}=this.state;if(s)return;const o=[];n.forEach(i=>{const{name:r,formula:l}=i;r&&l&&o.push(`${r}=${l}`)}),this.resetErrorMessage(),this.setState({isCustomColumnApplying:o.length>0||t.length>0}),e(o)}resetRequestFailed(){this.setState(({hasRequestFailed:e})=>e?{hasRequestFailed:!1}:null)}renderInputs(){const{inputs:e,hasRequestFailed:t}=this.state,n=new Map;return e.forEach(({name:s})=>{var o;return n.set(s,((o=n.get(s))!=null?o:0)+1)}),e.map((s,o)=>{var c;const{eventKey:i,name:r,formula:l}=s,a=((c=n.get(r))!=null?c:0)>1;return h(Mp,{inputIndex:o,eventKey:i,name:r,formula:l,onChange:this.handleInputChange,onDeleteColumn:this.handleDeleteColumn,onTabInEditor:this.handleEditorTabNavigation,invalid:t,isDuplicate:a},i)})}renderSaveButton(){const{inputs:e,isCustomColumnApplying:t,isSuccessShowing:n}=this.state,s=e.length>1?"Save Columns":"Save Column",o=e.every(({name:l})=>l===""||_t.isValidColumnName(l)),i=e.filter(({name:l})=>l!=="").map(({name:l})=>l),r=new Set(i).size===i.length;return R(X,{kind:n?"success":"primary",className:B("btn-apply",{"btn-spinner":t}),disabled:n||t||!o||!r,onClick:this.handleSaveClick,children:[t&&R("span",{children:[h(Vt,{}),h("span",{className:"btn-normal-content",children:"Applying"})]}),!n&&!t&&s,n&&R(Fe,{children:[h(Z,{icon:aa})," Success"]})]})}render(){const{onCancel:e}=this.props,{errorMessage:t}=this.state;return R("div",{role:"presentation",className:"custom-column-builder-container",ref:n=>{this.container=n},onClick:this.resetRequestFailed,onFocus:this.resetRequestFailed,children:[h("hr",{}),h(gi,{onDragStart:gt.startDragging,onDragEnd:this.handleDragEnd,children:h(pi,{droppableId:"droppable-custom-columns",children:(n,s)=>R("div",{ref:n.innerRef,...n.droppableProps,className:B("droppable-container",{dragging:s.draggingFromThisWith}),children:[this.renderInputs(),n.placeholder]})})}),h("div",{className:"pt-1 px-3",children:h(X,{kind:"ghost",className:"btn-add-column",onClick:this.handleAddColumnClick,icon:Bs,children:"Add Another Column"})}),R("div",{className:"custom-column-builder-footer",children:[t&&h("div",{className:"error-message",children:t}),R("div",{className:"d-flex justify-content-end",children:[h(X,{kind:"secondary",className:"mr-2",onClick:e,children:"Cancel"}),this.renderSaveButton()]})]})]})}};let Ja=ks;Ja.SUCCESS_SHOW_DURATION=750;var ve=(e=>(e.ADVANCED_SETTINGS="ADVANCED_SETTINGS",e.AGGREGATIONS="AGGREGATIONS",e.AGGREGATION_EDIT="AGGREGATIONS_EDIT",e.CHART_BUILDER="CHART_BUILDER",e.CUSTOM_COLUMN_BUILDER="CUSTOM_COLUMN_BUILDER",e.QUICK_FILTERS="QUICK_FILTERS",e.ROLLUP_ROWS="ROLLUP_ROWS",e.SEARCH_BAR="SEARCH_BAR",e.SELECT_DISTINCT="SELECT_DISTINCT",e.TABLE_EXPORTER="TABLE_EXPORTER",e.VISIBILITY_ORDERING_BUILDER="VISIBILITY_ORDERING_BUILDER",e.CONDITIONAL_FORMATTING="CONDITIONAL_FORMATTING",e.CONDITIONAL_FORMATTING_EDIT="CONDITIONAL_FORMATTING_EDIT",e.GOTO="GOTO",e))(ve||{});const no=se.module("RollupRows"),Dp=150,Yo="grouped-rollup-rows",Qo="ungrouped-rollup-rows",Ot=class extends T.exports.Component{constructor(e){super(e),this.search=ft(i=>{const r=this.getSortedUngroupedColumns(),l=[];let a=null;for(let c=0;c<r.length;c+=1)r[c].name.toLowerCase().includes(i.toLowerCase())&&(a==null&&(a=c),l.push([c,c]));O(a),this.setState({ungroupedSelectedRanges:l}),l.length>0&&this.ungroupedList.current&&this.ungroupedList.current.scrollToItem(a)},Dp),this.getCachedUngroupedColumns=he((i,r)=>i.filter(l=>Ot.isGroupable(l)&&r.find(a=>a===l.name)==null)),this.getCachedSortedColumns=he((i,r)=>r==null?[...i]:x.sortColumns(i,r===Ot.SORT.ASCENDING)),this.handleDeleteClicked=this.handleDeleteClicked.bind(this),this.handleSearchChange=this.handleSearchChange.bind(this),this.handleUngroupedSelect=this.handleUngroupedSelect.bind(this),this.handleUngroupedSelectionChange=this.handleUngroupedSelectionChange.bind(this),this.handleDragStart=this.handleDragStart.bind(this),this.handleDragEnd=this.handleDragEnd.bind(this),this.handleGroupedSelectionChange=this.handleGroupedSelectionChange.bind(this),this.handleShowConstituentsChange=this.handleShowConstituentsChange.bind(this),this.handleShowNonAggregatedColumnsChange=this.handleShowNonAggregatedColumnsChange.bind(this),this.handleSortAscending=this.handleSortAscending.bind(this),this.handleSortDescending=this.handleSortDescending.bind(this),this.renderGroupedItem=this.renderGroupedItem.bind(this),this.ungroupedList=te.createRef(),this.groupedList=te.createRef();const{config:t}=e,{columns:n=[],showConstituents:s=!0,showNonAggregatedColumns:o=!0}=t!=null?t:{};this.state={ungroupedSelectedRanges:[],columns:n,groupedSelectedRanges:[],searchFilter:"",showConstituents:s,showNonAggregatedColumns:o,dragSource:null,sort:null}}static renderColumn({item:e,isClone:t,selectedCount:n}){const s=e==null?void 0:e.name,o=t!==void 0&&t?`${n}`:void 0,i=t!==void 0&&t?"item-list-item-clone":"";return bt.renderTextItem({text:s,badgeText:o,className:i})}static addGroupings(e,t,n=e.length){if(t==null||t.length===0)return e;let s=n;const o=e.filter((i,r)=>t.includes(i)?(r<s&&(s-=1),!1):!0);return o.splice(s,0,...t),o}static isGroupable(e){return!x.isDecimalType(e.type)}componentDidUpdate(e,t){const{config:n}=this.props,{columns:s,showConstituents:o,showNonAggregatedColumns:i}=this.state;n!==e.config?this.updateFromConfig():(s!==t.columns||o!==t.showConstituents||i!==t.showNonAggregatedColumns)&&(n==null||s!==n.columns||o!==n.showConstituents||i!==n.showNonAggregatedColumns)&&this.sendChange()}componentWillUnmount(){this.search.cancel()}handleSearchChange(e){const t=e.target.value;if(this.setState({searchFilter:t}),!t){this.search.cancel(),this.resetSelection();return}this.search(t)}handleSortAscending(){this.setState(({sort:e})=>({sort:e===Ot.SORT.ASCENDING?null:Ot.SORT.ASCENDING}))}handleSortDescending(){this.setState(({sort:e})=>({sort:e===Ot.SORT.DESCENDING?null:Ot.SORT.DESCENDING}))}resetSelection(){this.setState({ungroupedSelectedRanges:[],groupedSelectedRanges:[]})}handleDragStart(e){no.debug("handleDragStart",e),document.documentElement.classList.add("drag-pointer-events-none"),this.setState({dragSource:e.source})}handleDragEnd(e){no.debug("handleDragEnd",e),document.documentElement.classList.remove("drag-pointer-events-none"),this.setState({dragSource:null});const{destination:t,source:n}=e;if(t==null||n==null)return;if(t.droppableId===Qo){this.setState(({groupedSelectedRanges:i,columns:r})=>{const l=[...r];return gt.reorder(l,i,[],0),{columns:l,ungroupedSelectedRanges:[],groupedSelectedRanges:[]}});return}const s=n.droppableId===Yo;let o=t.index;s&&n.index<t.index&&(o+=1),this.setState(({columns:i,ungroupedSelectedRanges:r,groupedSelectedRanges:l})=>{const a=[...i],c=s?a:this.getSortedUngroupedColumns().map(g=>g.name),d=s?l:r,u=gt.reorder(c,d,a,o),m=s?gt.adjustDestinationIndex(o,l):o,p=[[m,m+u.length-1]];return{columns:a,ungroupedSelectedRanges:[],groupedSelectedRanges:p}}),this.resetSelection()}handleUngroupedSelect(e){no.debug("handleUngroupedSelect"),this.setState(({columns:t})=>({columns:Ot.addGroupings(t,[this.getSortedUngroupedColumns()[e].name]),ungroupedSelectedRanges:[],groupedSelectedRanges:[]}))}handleUngroupedSelectionChange(e){no.debug2("handleUngroupedSelectionChange",e),this.setState(({ungroupedSelectedRanges:t})=>e===t?null:{ungroupedSelectedRanges:e,groupedSelectedRanges:[]})}handleGroupedSelectionChange(e){no.debug2("handleGroupedSelectedRanges",e),this.setState(({groupedSelectedRanges:t})=>e===t?null:{groupedSelectedRanges:e,ungroupedSelectedRanges:[]})}handleDeleteClicked(e){this.setState(({columns:t})=>{const n=t.slice();return n.splice(e,1),{columns:n}})}handleShowConstituentsChange(){this.setState(({showConstituents:e})=>({showConstituents:!e}))}handleShowNonAggregatedColumnsChange(){this.setState(({showNonAggregatedColumns:e})=>({showNonAggregatedColumns:!e}))}updateFromConfig(){const{config:e}=this.props,{columns:t=[],showConstituents:n=!0,showNonAggregatedColumns:s=!0}=e!=null?e:{};this.setState({columns:t,showConstituents:n,showNonAggregatedColumns:s})}sendChange(){const{onChange:e}=this.props,{columns:t,showConstituents:n,showNonAggregatedColumns:s}=this.state;e({columns:t,showConstituents:n,showNonAggregatedColumns:s})}getUngroupedColumns(){const{model:e}=this.props,{columns:t}=this.state,{originalColumns:n}=e;return this.getCachedUngroupedColumns(n,t)}getSortedUngroupedColumns(){const{sort:e}=this.state,t=this.getUngroupedColumns();return this.getCachedSortedColumns(t,e)}renderGroupedItem({item:e,itemIndex:t,isClone:n,selectedCount:s}){const i=`${n!==void 0&&n?"":"\xA0\xA0".repeat(t)}${e}`,r=n!==void 0&&n?`${s}`:void 0,l=n!==void 0&&n?"item-list-item-clone":"";return R(Fe,{children:[bt.renderTextItem({text:i,badgeText:r,className:l}),(n===void 0||!n)&&h(X,{kind:"ghost",className:"btn btn-link btn-link-icon btn-delete-grouping float-right",onClick:()=>this.handleDeleteClicked(t),children:h(Z,{icon:Rn})})]})}render(){const{columns:e,dragSource:t,searchFilter:n,groupedSelectedRanges:s,ungroupedSelectedRanges:o,showConstituents:i,showNonAggregatedColumns:r,sort:l}=this.state,a=this.getSortedUngroupedColumns();let c=e.length*bt.DEFAULT_ROW_HEIGHT;(t==null?void 0:t.droppableId)===Qo&&(c+=bt.DEFAULT_ROW_HEIGHT);const d=a.length*bt.DEFAULT_ROW_HEIGHT+10,u=Math.min(3*bt.DEFAULT_ROW_HEIGHT,d);return h("div",{role:"menu",className:B("rollup-rows",{"is-dragging":t!=null}),tabIndex:0,children:R(gi,{onDragEnd:this.handleDragEnd,onDragStart:this.handleDragStart,children:[R("div",{className:"rollup-rows-group-by",children:[h("div",{className:"section-title",children:"Group By"}),e.length===0&&h(pi,{droppableId:"placeholder",children:(m,p)=>h("div",{className:B("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."})}),e.length>0&&h(bt,{draggingItemClassName:"rollup-rows-dragging-grouped-item",draggablePrefix:Yo,droppableId:Yo,itemCount:e.length,items:e,offset:0,onSelectionChange:this.handleGroupedSelectionChange,ref:this.groupedList,renderItem:this.renderGroupedItem,selectedRanges:s,style:{height:c},isMultiSelect:!0})]}),R("div",{className:"rollup-rows-available-columns",children:[h("div",{className:"section-title",children:"Available Grouping Columns"}),R("div",{className:"top-menu",children:[h(Jn,{className:"w-100",value:n,matchCount:n?o.length:void 0,placeholder:"Find column...",onChange:this.handleSearchChange}),R(X,{kind:"ghost",className:B("btn-link btn-link-icon",{active:l===Ot.SORT.ASCENDING}),onClick:this.handleSortAscending,children:[h(Z,{icon:Cr}),h(We,{children:"Sort ascending"})]}),R(X,{kind:"ghost",className:B("btn-link btn-link-icon",{active:l===Ot.SORT.DESCENDING}),onClick:this.handleSortDescending,children:[h(Z,{icon:wr}),h(We,{children:"Sort descending"})]})]}),h(bt,{className:"rollup-available-grouping-columns",draggablePrefix:Qo,droppableId:Qo,itemCount:a.length,items:a,renderItem:Ot.renderColumn,offset:0,onSelect:this.handleUngroupedSelect,onSelectionChange:this.handleUngroupedSelectionChange,ref:this.ungroupedList,selectedRanges:o,style:{maxHeight:d,minHeight:u},isDropDisabled:(t==null?void 0:t.droppableId)!==Yo,isMultiSelect:!0}),R("div",{className:"bottom-menu",children:[h("div",{className:"label",children:"Show:"}),h(ut,{checked:i,onChange:this.handleShowConstituentsChange,children:"Constituents"}),h(ut,{checked:r,onChange:this.handleShowNonAggregatedColumnsChange,children:"Non-Aggregated Columns"})]})]})]})})}};let _r=Ot;_r.SORT=Object.freeze({ASCENDING:"ASC",DESCENDING:"DESC"});_r.defaultProps={config:null,onChange:()=>{}};const Np=se.module("TableCsvExporter"),Ae=class extends T.exports.Component{static getDateString(){return I.i18n.DateTimeFormat.format(Ae.FILENAME_DATE_FORMAT,new Date)}constructor(e){super(e),this.handleDownloadClick=this.handleDownloadClick.bind(this),this.handleDownloadRowOptionChanged=this.handleDownloadRowOptionChanged.bind(this),this.handleCustomizedDownloadRowOptionChanged=this.handleCustomizedDownloadRowOptionChanged.bind(this),this.handleCustomizedDownloadRowsChanged=this.handleCustomizedDownloadRowsChanged.bind(this),this.handleIncludeColumnHeadersChanged=this.handleIncludeColumnHeadersChanged.bind(this),this.handleIncludeHiddenColumnsChanged=this.handleIncludeHiddenColumnsChanged.bind(this),this.handleUseUnformattedValuesChanged=this.handleUseUnformattedValuesChanged.bind(this);const{name:t}=e;this.state={fileName:`${t}-${Ae.getDateString()}.csv`,downloadRowOption:Ae.DOWNLOAD_ROW_OPTIONS.ALL_ROWS,customizedDownloadRowOption:Ae.CUSTOMIZED_ROWS_OPTIONS.FIRST,customizedDownloadRows:Ae.DEFAULT_DOWNLOAD_ROWS,includeColumnHeaders:!0,includeHiddenColumns:!1,useUnformattedValues:!1,errorMessage:null,id:nn.generate()}}getSnapshotRanges(){const{model:e,selectedRanges:t}=this.props,{downloadRowOption:n,customizedDownloadRowOption:s,customizedDownloadRows:o}=this.state,{rowCount:i,columnCount:r}=e;let l=[];switch(n){case Ae.DOWNLOAD_ROW_OPTIONS.ALL_ROWS:l.push(new ee(0,0,r-1,i-1));break;case Ae.DOWNLOAD_ROW_OPTIONS.SELECTED_ROWS:l=t.map(a=>({...a,startColumn:0,endColumn:r-1})).sort((a,c)=>a.startRow!=null&&c.startRow!=null?a.startRow-c.startRow:0);break;case Ae.DOWNLOAD_ROW_OPTIONS.CUSTOMIZED_ROWS:switch(s){case Ae.CUSTOMIZED_ROWS_OPTIONS.FIRST:l.push(new ee(0,0,r-1,Math.min(o-1,i-1)));break;case Ae.CUSTOMIZED_ROWS_OPTIONS.LAST:l.push(new ee(0,Math.max(0,i-o),r-1,i-1));break}break}return l}getModelRanges(e){const{userColumnWidths:t,movedColumns:n}=this.props,{includeHiddenColumns:s}=this.state,o=ne.getHiddenColumns(t);let i=W.getModelRanges(e,n);if(!s&&o.length>0){const r=o.map(ee.makeColumn);i=ee.subtractRangesFromRanges(i,r)}return i}resetDownloadState(){this.setState({errorMessage:null})}async handleDownloadClick(){const{model:e,isDownloading:t,onDownloadStart:n,onDownload:s,onCancel:o}=this.props,{fileName:i,includeColumnHeaders:r,useUnformattedValues:l}=this.state;if(t){o();return}this.resetDownloadState();const a=this.getSnapshotRanges(),c=this.getModelRanges(a);if(this.validateOptionInput()){n();try{const d=await e.export(),u=d.setViewport(0,0);await u.getViewportData(),s(i,d,u,a,c,r,l)}catch(d){Np.error("CSV download failed",d),this.setState({errorMessage:R("p",{children:[h(Z,{icon:Yn})," ",`${d}`]})}),o()}}}handleDownloadRowOptionChanged(e){this.setState({downloadRowOption:e.target.value})}handleCustomizedDownloadRowOptionChanged(e){this.setState({customizedDownloadRowOption:e.target.value})}handleCustomizedDownloadRowsChanged(e){this.setState({customizedDownloadRows:parseInt(e.target.value,10)})}handleIncludeColumnHeadersChanged(){this.setState(({includeColumnHeaders:e})=>({includeColumnHeaders:!e}))}handleIncludeHiddenColumnsChanged(){this.setState(({includeHiddenColumns:e})=>({includeHiddenColumns:!e}))}handleUseUnformattedValuesChanged(){this.setState(({useUnformattedValues:e})=>({useUnformattedValues:!e}))}validateOptionInput(){const{selectedRanges:e}=this.props,{downloadRowOption:t,customizedDownloadRows:n}=this.state;return t===Ae.DOWNLOAD_ROW_OPTIONS.SELECTED_ROWS&&e.length===0?(this.setState({errorMessage:R("p",{children:[h(Z,{icon:Yn})," No rows selected. Please select some rows in the table."]})}),!1):t===Ae.DOWNLOAD_ROW_OPTIONS.CUSTOMIZED_ROWS&&n<=0?(this.setState({errorMessage:R("p",{children:[h(Z,{icon:Yn})," Number of rows to output must be greater than 0"]})}),!1):!0}render(){const{model:e,isDownloading:t,tableDownloadProgress:n,tableDownloadEstimatedTime:s,selectedRanges:o,tableDownloadStatus:i}=this.props,{fileName:r,downloadRowOption:l,customizedDownloadRowOption:a,customizedDownloadRows:c,includeColumnHeaders:d,includeHiddenColumns:u,useUnformattedValues:m,errorMessage:p,id:g}=this.state,{rowCount:f}=e;return R("div",{className:"table-csv-exporter",children:[h("div",{className:"section-title",children:"Download Rows"}),h("div",{className:"form-group",children:R(Mr,{onChange:this.handleDownloadRowOptionChanged,value:l,disabled:t,children:[R(vn,{value:Ae.DOWNLOAD_ROW_OPTIONS.ALL_ROWS,"data-testid":"radio-csv-exporter-download-all",children:["All Rows",h("span",{className:"text-muted ml-2",children:`(${f.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1,")} rows)`})]}),R(vn,{value:Ae.DOWNLOAD_ROW_OPTIONS.SELECTED_ROWS,"data-testid":"radio-csv-exporter-only-selected",children:["Only Selected Rows",h("span",{className:"text-muted ml-2",children:o.length>0?`(${ee.rowCount(o).toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1,")} rows)`:null})]}),h(vn,{value:Ae.DOWNLOAD_ROW_OPTIONS.CUSTOMIZED_ROWS,"data-testid":"radio-csv-exporter-customized-rows",children:R("div",{className:"radio-input-row",role:"presentation",onClick:()=>{this.setState({downloadRowOption:Ae.DOWNLOAD_ROW_OPTIONS.CUSTOMIZED_ROWS})},children:[R("select",{value:a,"data-testid":"select-csv-exporter-customized-rows",className:"custom-select",disabled:t,onChange:this.handleCustomizedDownloadRowOptionChanged,children:[h("option",{value:"FIRST",children:"First"}),h("option",{value:"LAST",children:"Last"})]}),h("input",{type:"number",className:"form-control",id:`customizedRows-${g}`,"data-testid":"input-csv-exporter-customized-rows",name:`customizedRows-${g}`,placeholder:"100",value:c,disabled:t,onChange:this.handleCustomizedDownloadRowsChanged}),h("div",{children:"Rows"})]})})]})}),R("div",{className:"form-group",children:[h("label",{htmlFor:`customizedRows-${g}`,children:"File Name"}),h("input",{type:"text",className:"form-control",id:`filename-${g}`,"data-testid":"input-csv-exporter-file-name",name:`filename-${g}`,value:r,onChange:w=>{this.setState({fileName:w.target.value})},disabled:t})]}),R("div",{className:"checkbox-options",children:[h(ut,{checked:d,onChange:this.handleIncludeColumnHeadersChanged,children:"Include column headers"}),h(ut,{checked:u,onChange:this.handleIncludeHiddenColumnsChanged,children:"Include hidden columns"}),h(ut,{checked:m,onChange:this.handleUseUnformattedValuesChanged,children:"Use unformatted values"})]}),R("div",{className:"section-footer flex-column",children:[p!=null&&h("div",{className:"error-message",children:p}),i&&R("div",{className:"download-status",children:[(i===Ae.DOWNLOAD_STATUS.DOWNLOADING||i===Ae.DOWNLOAD_STATUS.INITIATING)&&R(Fe,{children:[i===Ae.DOWNLOAD_STATUS.INITIATING&&h("div",{className:"text-muted",children:"Starting Download..."}),i===Ae.DOWNLOAD_STATUS.DOWNLOADING&&R("div",{className:"text-muted d-flex justify-content-between",children:[h("span",{children:s||s===0?`Estimated time: ${en.formatElapsedTime(s)}`:null}),h("span",{children:`${n}%`})]})]}),i===Ae.DOWNLOAD_STATUS.FINISHED&&h("div",{className:"text-muted text-right",children:"Download Completed"}),i===Ae.DOWNLOAD_STATUS.CANCELED&&h("div",{className:"text-muted",children:"Download Canceled"}),(i===Ae.DOWNLOAD_STATUS.DOWNLOADING||i===Ae.DOWNLOAD_STATUS.INITIATING)&&h("div",{className:"progress",children:h("div",{className:"progress-bar progress-bar-striped progress-bar-animated",style:{width:`${n}%`}})}),i===Ae.DOWNLOAD_STATUS.FINISHED&&h("div",{className:"progress",children:h("div",{className:"progress-bar bg-success",style:{width:`${n}%`}})})]}),R(X,{kind:"primary","data-testid":"btn-csv-exporter-download",className:B("btn-downloading",{"btn-spinner btn-cancelable":t}),onClick:this.handleDownloadClick,children:[t&&R("span",{children:[h(Vt,{}),h("span",{className:"btn-normal-content",children:"Downloading"}),h("span",{className:"btn-hover-content",children:"Cancel"})]}),!t&&"Download"]})]})]})}};let Tt=Ae;Tt.FILENAME_DATE_FORMAT="yyyy-MM-dd-HHmmss";Tt.DOWNLOAD_STATUS={INITIATING:"INITIATING",DOWNLOADING:"DOWNLOADING",FINISHED:"FINISHED",CANCELED:"CANCELED"};Tt.DOWNLOAD_ROW_OPTIONS={ALL_ROWS:"ALL_ROWS",SELECTED_ROWS:"SELECTED_ROWS",CUSTOMIZED_ROWS:"CUSTOMIZED_ROWS"};Tt.CUSTOMIZED_ROWS_OPTIONS={FIRST:"FIRST",LAST:"LAST"};Tt.DEFAULT_DOWNLOAD_ROWS=100;Tt.defaultProps={onDownloadStart:()=>{},isDownloading:!1,tableDownloadStatus:"",tableDownloadProgress:0,tableDownloadEstimatedTime:null,selectedRanges:[]};const un=se.module("TableSaver"),Fp="yyyy-MM-dd'T'HH:mm:ss.SSSSSSSSS z";function xp(e){return e.added!==void 0}function Ap(e){if(!xp(e))throw new Error("event is not UpdateEventData")}const Un=class extends T.exports.PureComponent{constructor(e){var t,n;super(e),this.WritableStream=(t=window.WritableStream)!=null?t:jr,this.getCachedCustomColumnFormatFlag=Et(ms.isCustomColumnFormatDefined,{max:1e4}),this.handlePortMessage=this.handlePortMessage.bind(this),this.handleSnapshotResolved=this.handleSnapshotResolved.bind(this),this.handleDownloadTimeout=this.handleDownloadTimeout.bind(this),this.state={},this.gridRanges=[],this.gridRangeCounter=0,this.rangedSnapshotsTotal=[],this.rangedSnapshotCounter=0,this.includeColumnHeaders=!0,this.useUnformattedValues=!1,this.snapshotsTotal=0,this.snapshotCounter=0,this.snapshotsBuffer=new Map,this.currentSnapshotIndex=0,this.snapshotPending=0,this.cancelableSnapshots=[],this.WritableStream=(n=window.WritableStream)!=null?n:jr,this.iframes=[],this.useBlobFallback=!1}static csvEscapeString(e){return`"${e.replace(/"/g,'""')}"`}componentDidMount(){const{getDownloadWorker:e}=this.props;e().then(t=>{un.info("found active service worker"),this.sw=t,this.sw.postMessage("ping")}).catch(t=>{un.warn("Download csv is not optimized.",t),this.useBlobFallback=!0})}componentWillUnmount(){this.iframes.length>0&&this.iframes.forEach(e=>{e.remove()}),this.streamTimeout&&clearTimeout(this.streamTimeout),this.snapshotHandlerTimeout&&clearTimeout(this.snapshotHandlerTimeout)}createWriterStream(e){const t=this.useBlobFallback,n=[];let s=null;t&&(s=TextEncoder.prototype.encode.bind(new TextEncoder));const{fileName:o}=this,i={};return t?(i.write=r=>{O(s),r.header!==void 0&&n.push(s(r.header)),r.rows!==void 0&&n.push(s(r.rows))},i.close=()=>{O(o);const r=new Blob(n,{type:"application/octet-stream; charset=utf-8"}),l=document.createElement("a");l.href=URL.createObjectURL(r),l.download=o,l.click()},i.abort=()=>{e.postMessage({cancel:!0}),e.close()}):(i.write=r=>{e.postMessage(r)},i.close=()=>{e.postMessage({end:!0}),e.close()},i.abort=()=>{e.postMessage({cancel:!0}),e.close()}),new this.WritableStream(i)}startDownload(e,t,n,s,o,i,r){const{isDownloading:l}=this.props;if(l)return;this.downloadStartTime=Date.now(),un.info(`start downloading ${e}`),this.table=t,this.columns=ne.columnsFromRanges(o,t.columns),this.tableSubscription=n,this.gridRanges=s,this.includeColumnHeaders=i,this.useUnformattedValues=r;const a=encodeURIComponent(e.replace(/\//g,":")).replace(/['()]/g,escape).replace(/\*/g,"%2A"),c=new MessageChannel;if(this.port=c.port1,this.fileName=e,this.fileWriter=this.createWriterStream(this.port).getWriter(),this.useBlobFallback){this.writeCsvTable(i);return}this.sw&&this.sw.postMessage({encodedFileName:a},[c.port2]),this.port.onmessage=this.handlePortMessage}finishDownload(){this.table&&this.table.close(),this.tableSubscription&&this.tableSubscription.close(),this.fileWriter&&this.fileWriter.close();const{onDownloadCompleted:e}=this.props;e(),this.resetTableSaver(),this.downloadStartTime!==void 0&&un.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(t=>{t&&(t.catch(()=>null),t.cancel())});const{onDownloadCanceled:e}=this.props;e(),this.resetTableSaver()}resetTableSaver(){this.table=void 0,this.tableSubscription=void 0,this.columns=void 0,this.chunkRows=void 0,this.gridRanges=[],this.gridRangeCounter=0,this.rangedSnapshotsTotal=[],this.rangedSnapshotCounter=0,this.includeColumnHeaders=!0,this.useUnformattedValues=!1,this.snapshotsTotal=0,this.snapshotCounter=0,this.snapshotsBuffer=new Map,this.currentSnapshotIndex=0,this.snapshotPending=0,this.cancelableSnapshots=[],this.streamTimeout!=null&&clearTimeout(this.streamTimeout),this.snapshotHandlerTimeout!=null&&clearTimeout(this.snapshotHandlerTimeout),this.streamTimeout=void 0,this.snapshotHandlerTimeout=void 0}handleDownloadTimeout(){un.info("download canceled"),this.cancelDownload()}writeTableHeader(){var t;let e="";if(this.columns)for(let n=0;n<this.columns.length;n+=1)e+=this.columns[n].name,e+=n===this.columns.length-1?`
|
|
5
|
+
`:",";(t=this.fileWriter)==null||t.write({header:e}).then(()=>null)}startWriteTableBody(){this.columns&&this.gridRanges!=null&&(this.chunkRows=Math.floor(Un.DOWNLOAD_CELL_CHUNK/this.columns.length),this.rangedSnapshotsTotal=this.gridRanges.map(e=>(O(e.endRow),O(e.startRow),O(this.chunkRows),Math.ceil((e.endRow-e.startRow+1)/this.chunkRows))),this.snapshotsTotal=this.rangedSnapshotsTotal.reduce((e,t)=>e+t),un.info("start writing table, total snapshots: ",this.snapshotsTotal),this.makeSnapshot(Math.min(Un.SNAPSHOT_BUFFER_SIZE,this.snapshotsTotal)))}writeCsvTable(e){e&&this.writeTableHeader(),this.startWriteTableBody()}writeSnapshot(e,t,n){if(this.currentSnapshotIndex===e&&this.fileWriter){for(;this.snapshotsBuffer.has(this.currentSnapshotIndex);){const s=this.snapshotsBuffer.get(this.currentSnapshotIndex);O(s),this.fileWriter.write({rows:this.convertSnapshotIntoCsv(s)}),this.snapshotsBuffer.delete(this.currentSnapshotIndex),this.currentSnapshotIndex+=1,this.updateDownloadProgress(e)}if(this.snapshotsTotal&&this.currentSnapshotIndex>=this.snapshotsTotal){this.finishDownload();return}}this.snapshotCounter&&this.snapshotsTotal&&this.snapshotCounter<this.snapshotsTotal&&(un.debug2(`
|
|
6
6
|
current range index: ${this.gridRangeCounter},
|
|
7
7
|
snapshotIndexCounter: ${this.snapshotCounter},
|
|
8
8
|
currentRangedSnapshotIndex : ${this.rangedSnapshotCounter},
|
|
9
9
|
snapshotpending: ${this.snapshotPending},
|
|
10
10
|
buffered ${this.snapshotsBuffer.size}
|
|
11
|
-
making ${Math.min(
|
|
12
|
-
`),this.makeSnapshot(Math.min(
|
|
13
|
-
`:","}}return t}makeSnapshot(e){if(e<=0)return;O(this.gridRangeCounter);let t=0,n=this.gridRanges[this.gridRangeCounter];for(O(this.tableSubscription),O(this.columns);t<e;){O(n),O(n.startRow),O(n.endRow),O(this.rangedSnapshotCounter),O(this.chunkRows);const s=n.startRow+this.rangedSnapshotCounter*this.chunkRows,o=Math.min(s+this.chunkRows-1,n.endRow),i=this.snapshotCounter;this.cancelableSnapshots.push(Ue.makeCancelable(this.tableSubscription.snapshot(I.RangeSet.ofRange(s,o),this.columns).then(r=>(Ap(r),this.handleSnapshotResolved(r,i,s,o),i)).catch(r=>{hn.error(r)}),r=>{hn.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]),t+=1}}handlePortMessage({data:e}){const{download:t,readableStreamPulling:n}=e;if(!this.useBlobFallback){if(t!=null){const{includeColumnHeaders:s}=this;this.makeIframe(`${t}`),this.writeCsvTable(s)}n!=null&&(this.useBlobFallback||(this.streamTimeout!=null&&clearTimeout(this.streamTimeout),this.streamTimeout=setTimeout(this.handleDownloadTimeout,Bn.STREAM_TIMEOUT)))}}handleSnapshotResolved(e,t,n,s){this.snapshotHandlerTimeout=setTimeout(()=>{this.snapshotsBuffer.set(t,e),this.snapshotPending-=1,this.writeSnapshot(t,n,s),this.cancelableSnapshots[t]=null},Bn.SNAPSHOT_HANDLER_TIMEOUT)}makeIframe(e){const t=document.createElement("iframe");t.hidden=!0,t.src=`download/${e}`,t.name="iframe",document.body.appendChild(t),this.iframes.push(t)}render(){return null}};let qs=Bn;qs.DOWNLOAD_CELL_CHUNK=6e3;qs.SNAPSHOT_BUFFER_SIZE=5;qs.STREAM_TIMEOUT=8e3;qs.SNAPSHOT_HANDLER_TIMEOUT=5;qs.defaultProps={getDownloadWorker:()=>Promise.reject(new Error("Download worker not provided")),isDownloading:!1,onDownloadCompleted:()=>{},onDownloadCanceled:()=>{},onDownloadProgressUpdate:()=>{}};function Op(e){var v;const{group:t,onDelete:n,onColorChange:s,onNameChange:o,validateName:i}=e,{isNew:r}=t,l=T.exports.useRef(t),a=T.exports.useRef(null),c=T.exports.useRef(null),[d,u]=T.exports.useState(r?"":t.name),[m,p]=T.exports.useState(r),[g,f]=T.exports.useState(!1),w=d!==t.name?i(d):"",C=r&&!g||w==="";T.exports.useEffect(function(){m&&a.current&&(a.current.focus(),a.current.select())},[m]),T.exports.useEffect(function(){return()=>{l.current.isNew&&n(l.current)}},[n]);const S=()=>{C&&(o(t,d),p(!1))},b=()=>{if(r){n(t);return}u(t.name),p(!1)},E=y=>{f(!0),y.key==="Enter"&&(y.stopPropagation(),S()),y.key===" "&&y.stopPropagation(),y.key==="Escape"&&b()};return m?R(Fe,{children:[R("div",{className:"editing-container",children:[h("input",{ref:a,className:B("form-control",{"is-invalid":!C}),value:d,placeholder:"Group Name",onChange:y=>u(y.target.value),onKeyDown:E}),h(X,{kind:"ghost",icon:Xn,tooltip:"Confirm",onClick:S}),h(X,{kind:"ghost",icon:Kd,tooltip:"Cancel",onClick:b})]}),!C&&h("p",{className:"mb-0 validate-label-error text-danger",children:w})]}):R("div",{className:"group-name-wrapper",children:[h("span",{className:"column-name",children:d}),h(X,{className:"p-1 mx-1",kind:"ghost",icon:pr,tooltip:"Edit",onClick:()=>{p(!0)}}),R("span",{className:"right-buttons",children:[h(X,{kind:"ghost",icon:yn,tooltip:"Delete group",onClick:()=>n(t)}),h(X,{kind:"ghost",className:"color-swatch mr-1",icon:t.color!==void 0?R("span",{className:"fa-layers",children:[h(Z,{className:"color-swatch",icon:ii,color:Le.white,transform:"down-1"}),h(Z,{className:"color-swatch",icon:ii,color:t.color,transform:"shrink-2 down-1"})]}):lu,tooltip:"Set color",onClick:()=>{var y,M;(y=c.current)==null||y.click(),(M=c.current)==null||M.focus()}}),h("input",{"aria-label":"Color input",ref:c,type:"color",list:"presetColors",value:(v=t.color)!=null?v:Le["content-bg"],style:{visibility:"hidden",width:0,height:0,padding:0,border:0},onChange:y=>{t.color=y.target.value,s(t,y.target.value)}}),R("datalist",{id:"presetColors",children:[h("option",{children:Le["content-bg"]}),h("option",{children:Le.primary}),h("option",{children:Le.foreground}),h("option",{children:Le.green}),h("option",{children:Le.yellow}),h("option",{children:Le.orange}),h("option",{children:Le.red}),h("option",{children:Le.purple}),h("option",{children:Le.blue}),h("option",{children:Le["gray-400"]})]})]})]})}function kp(){}const Lp=T.exports.forwardRef(function(t,n){const{value:s,clone:o,childCount:i,item:r,onVisibilityChange:l,onClick:a,onGroupDelete:c,onGroupColorChange:d,onGroupNameChange:u,validateGroupName:m,handleProps:p}=t,{group:g,modelIndex:f,isVisible:w}=r.data,C=T.exports.useRef(null),S=T.exports.useCallback(E=>{var v;E.buttons===1&&(l([f].flat(),!w),(v=C.current)==null||v.focus())},[l,f,w]),b=T.exports.useCallback(E=>{a(s,E)},[a,s]);return R("div",{ref:n,className:B("tree-item",{isSelected:r.selected,"two-dragged":i===2,"multiple-dragged":i>2}),onClick:b,...p,children:[h(X,{ref:C,kind:"ghost",className:"px-1",onClick:kp,onMouseDown:S,onMouseEnter:S,icon:w?gr:ua,tooltip:"Toggle visibility"}),h("span",{className:B("column-name",g&&"column-group"),children:g&&!o?h(Op,{group:g,onDelete:c,onColorChange:d,onNameChange:u,validateName:m}):s}),R("div",{children:[o&&i>1&&h("span",{className:"item-count",children:i}),h(We,{children:"Drag to re-order"}),h(Z,{icon:Ci})]})]})});function Pp(e){return e.parentId!==void 0}function Hp(e,t){return Math.round(e/t)}function ec(e,t,n,s,o,i){const r=e.findIndex(l=>l.name===s);if(r===-1){const l=n.get(s);if(l==null)throw new Error(`Column or header group not found: ${s}`);const a=l.childIndexes.flat();return{id:s,selected:i.has(s),children:l.children.map(c=>ec(e,t,n,c,o,i)).sort((c,d)=>{const u=Array.isArray(c.data.visibleIndex)?c.data.visibleIndex[0]:c.data.visibleIndex,m=Array.isArray(d.data.visibleIndex)?d.data.visibleIndex[0]:d.data.visibleIndex;return u-m}),data:{modelIndex:a,visibleIndex:l.getVisibleRange(t),group:l,isVisible:a.some(c=>!o.has(c))}}}return{id:s,children:[],selected:i.has(s),data:{modelIndex:r,visibleIndex:W.getVisibleIndex(r,t),isVisible:!o.has(r)}}}function _p(e,t,n,s,o){const i=[],r=new Set(o),l=new Map(n.map(d=>[d.name,d])),a=new Set(s);let c=0;for(;c<e.length;){const d=W.getModelIndex(c,t),u=e[d].name;let m=n.find(({children:g})=>g.includes(u));for(;m!==void 0&&m.parent!==void 0;)m=l.get(m.parent);const p=ec(e,t,l,m?m.name:u,a,r);i.push(p),Array.isArray(p.data.visibleIndex)?c+=p.data.visibleIndex[1]-p.data.visibleIndex[0]+1:c+=1}return i}function ai(e,t,n,s,o){const i=e.findIndex(({id:C})=>C===n),r=e.findIndex(({id:C})=>C===t),l=e[r],a=Hc(e,r,i),c=a[i-1],d=a[i+1],u=Hp(s,o),m=l.depth+u,p=Vp({previousItem:c,nextItem:d}),g=Up({nextItem:d});let f=m;return m>=p?f=p:m<g&&(f=g),{depth:f,maxDepth:p,minDepth:g,parentId:w()};function w(){var S;if(f===0||!c)return null;if(f===c.depth)return c.parentId;if(f>c.depth)return c.id;const C=(S=a.slice(0,i).reverse().find(b=>b.depth===f))==null?void 0:S.parentId;return C!=null?C:null}}function Vp({previousItem:e,nextItem:t}){var n,s;return Math.max((n=e==null?void 0:e.depth)!=null?n:0,(s=t==null?void 0:t.depth)!=null?s:0)}function Up({nextItem:e}){return e?e.depth:0}function tc(e,t=null,n=0){return e.reduce((s,o,i)=>[...s,{...o,parentId:t,depth:n,index:i},...tc(o.children,o.id,n+1)],[])}function Nt(e){return e.every(Pp)?[...e]:tc(e)}function nc(e,t){for(let n=0;n<e.length;n+=1){const s=e[n],{id:o,children:i}=s;if(o===t)return s;if(i.length){const r=nc(i,t);if(r)return r}}}function sc(e,t=0){return e.reduce((n,{children:s})=>s.length?sc(s,n+1):n+1,t)}function Bp(e,t){const n=nc(e,t);return n?sc(n.children):0}const Gp=[en.Down,en.Right,en.Up,en.Left],zp=[en.Left,en.Right];function Wp(e,t,n){return(s,{currentCoordinates:o,context:{active:i,over:r,collisionRect:l,droppableRects:a,droppableContainers:c}})=>{if(Gp.includes(s.code)){if(!i||!l)return;s.preventDefault();const{current:{items:d,offset:u}}=e;if(zp.includes(s.code)&&(r==null?void 0:r.id)!=null){const{depth:f,maxDepth:w,minDepth:C}=ai(d,i.id,r.id,u,n);switch(s.code){case en.Left:if(f>C)return{...o,x:o.x-n};break;case en.Right:if(f<w)return{...o,x:o.x+n};break}return}const m=[];c.forEach(f=>{if((f==null?void 0:f.disabled)||f.id===(r==null?void 0:r.id))return;const w=a.get(f.id);if(!!w)switch(s.code){case en.Down:l.top<w.top&&m.push(f);break;case en.Up:l.top>w.top&&m.push(f);break}});const p=_c({active:i,collisionRect:l,pointerCoordinates:null,droppableRects:a,droppableContainers:m});let g=Vc(p,"id");if(g===(r==null?void 0:r.id)&&p.length>1&&(g=p[1].id),g!=null&&(r==null?void 0:r.id)!=null){const f=a.get(i.id),w=a.get(g),C=c.get(g);if(f&&w&&C){const S=d.findIndex(({id:y})=>y===g),b=d[S],E=d.findIndex(({id:y})=>y===i.id),v=d[E];if(b!=null&&v!=null){const{depth:y}=ai(d,i.id,g,(b.depth-v.depth)*n,n),A=S>E?1:-1,F=t?(l.height-f.height)/2:0;return{x:w.left+y*n,y:w.top+A*F}}}}}}}class oc extends Uc{}oc.activators=[{eventName:"onPointerDown",handler:({nativeEvent:e})=>!(!e.isPrimary||e.button!==0||qp(e.target))}];const $p=["button","input","textarea","select","option"];function qp(e){return!!((e==null?void 0:e.tagName)!=null&&$p.includes(e.tagName.toLowerCase()))}function ic(e){const{clone:t=!1,depth:n,disableInteraction:s=!1,ghost:o=!1,handleProps:i,value:r,dragRef:l=null,wrapperRef:a=null,renderItem:c,item:d,childCount:u}=e,m=T.exports.useMemo(()=>Array(n).fill(0).map((g,f)=>h("span",{className:"depth-line"},`depth-line-${f}`)),[n]),p=T.exports.useMemo(()=>({ref:l,clone:t,value:r,item:d,childCount:u,handleProps:i}),[l,t,r,d,u,i]);return R("li",{className:B("item-wrapper",{clone:t,ghost:o,disableInteraction:s}),ref:a,children:[!t&&m,c(p)]},r)}ic.displayName="TreeItem";const Kp=({isSorting:e,wasDragging:t})=>!(e||t);function kl({id:e,depth:t,...n}){const{attributes:s,isDragging:o,isSorting:i,listeners:r,setDraggableNodeRef:l,setDroppableNodeRef:a,transform:c,transition:d}=Bc({id:e,animateLayoutChanges:Kp}),u=er.Translate.toString(c),m=T.exports.useMemo(()=>({transform:u,transition:d}),[u,d]),p=T.exports.useMemo(()=>({...s,...r,style:m}),[s,r,m]);return h(ic,{dragRef:l,wrapperRef:a,depth:t,ghost:o,disableInteraction:i,handleProps:p,...n})}const Xp={keyframes({transform:e}){return[{opacity:1,transform:er.Transform.toString(e.initial)},{opacity:0,transform:er.Transform.toString({...e.final,x:e.final.x+5,y:e.final.y+5})}]},easing:"ease-out",sideEffects({active:e}){e.node.animate([{opacity:0},{opacity:1}],{duration:Zr.duration,easing:Zr.easing})}};let Ds=null;function Yp(e){return Ds==null&&e.activeNodeRect&&e.activatorEvent instanceof PointerEvent&&(Ds=Math.floor((e.activatorEvent.clientY-e.activeNodeRect.top)/e.activeNodeRect.height)*e.activeNodeRect.height),e.activeNodeRect||(Ds=null),{...e.transform,y:e.transform.y+(Ds!=null?Ds:0)}}function Qp({items:e,renderItem:t,indentationWidth:n=30,indicator:s=!1,activeId:o,overId:i,offsetLeft:r}){const l=Gc(),a=T.exports.useRef(l);T.exports.useEffect(function(){a.current=l},[l]),T.exports.useEffect(function(){a.current.measureDroppableContainers(e.map(({id:p})=>p))},[e]);const c=o!=null&&i!=null?ai(e,o,i,r,n):null,d=T.exports.useRef({items:e,offset:r}),u=o!=null?e.find(({id:m})=>m===o):null;return T.exports.useEffect(()=>{d.current={items:e,offset:r}},[e,r]),R(Fe,{children:[h("div",{className:B("tree-container",o!=null&&"marching-ants"),children:e.map(m=>{const{id:p,depth:g}=m;return h(kl,{id:p,value:p,depth:p===o&&c?c.depth:g,item:m,renderItem:t},p)})}),zc.exports.createPortal(h(Wc,{dropAnimation:Xp,modifiers:[Yp],className:"visibility-ordering-list",children:o!=null&&u?h(kl,{id:o,depth:u.depth,clone:!0,childCount:Bp(e,o)+1,value:o.toString(),renderItem:t,item:u}):null}),document.body)]})}const jp={droppable:{strategy:$c.Always}},Zp={activationConstraint:{distance:5}};function Jp({items:e,indicator:t=!1,indentationWidth:n=30,onDragStart:s,onDragEnd:o,renderItem:i}){const[r,l]=T.exports.useState(null),[a,c]=T.exports.useState(null),[d,u]=T.exports.useState(0),m=T.exports.useMemo(()=>{const A=Nt(e);return r!=null?A.filter(({id:F,selected:V})=>F===r||!V):A},[r,e]),p=r!=null&&a!=null?ai(m,r,a,d,n):null,g=T.exports.useRef({items:m,offset:d}),f=T.exports.useMemo(()=>({coordinateGetter:Wp(g,t,n)}),[n,t]),w=qc(Jr(oc,Zp),Jr(jc,f)),C=T.exports.useMemo(()=>m.map(({id:A})=>A),[m]);T.exports.useEffect(()=>{g.current={items:m,offset:d}},[m,d]);const S=T.exports.useCallback(({active:{id:A}})=>{l(A),c(A),s==null||s(A),document.body.style.setProperty("cursor","grabbing")},[s]),b=T.exports.useCallback(({delta:A})=>{u(A.x)},[]),E=T.exports.useCallback(({over:A})=>{var F;c((F=A==null?void 0:A.id)!=null?F:null)},[]),v=T.exports.useCallback(()=>{c(null),l(null),u(0),document.body.style.setProperty("cursor","")},[]),y=T.exports.useCallback(({active:A,over:F})=>{if(v(),p&&F){const{depth:V,parentId:H}=p,N=JSON.parse(JSON.stringify(Nt(e))),P=N.findIndex(({id:K})=>K===F.id),k=N.findIndex(({id:K})=>K===A.id),z=N[k];N[k]={...z,depth:V,parentId:H},o==null||o(z,{...N[P],parentId:p.parentId})}},[e,o,p,v]),M=T.exports.useCallback(()=>{v()},[v]);return h(Kc,{sensors:w,collisionDetection:Xc,measuring:jp,onDragStart:S,onDragMove:b,onDragOver:E,onDragEnd:y,onDragCancel:M,children:h(Yc,{items:C,strategy:Qc,children:h(Qp,{items:m,renderItem:i,indicator:t,indentationWidth:n,activeId:r,overId:a,offsetLeft:d})})})}function eg(e,t,n,s,o,i,r,l){const a=o.map((S,b)=>({...S,index:b}));let c=[],d=s;const u=i[0].data.visibleIndex,m=a.findIndex(({id:S})=>S===e.id),p=a.findIndex(({id:S})=>S===t.id);let g=Array.isArray(u)?u[1]+1:u+1;d=Wn(i[0],t.parentId,d);for(let S=1;S<i.length;S+=1){const{data:{visibleIndex:b}}=i[S];c=W.moveItemOrRange(b,g,c,!0),g+=Array.isArray(b)?b[1]-b[0]+1:1,d=Wn(i[S],t.parentId,d)}const f=[Array.isArray(u)?u[0]:u,g-1],w=Array.isArray(t.data.visibleIndex)?t.data.visibleIndex[0]:t.data.visibleIndex;let C=W.getVisibleIndex(w,c);return m>p&&C>w&&(C-=1),t.children.length>0&&(Array.isArray(u)?u[0]:u)<C&&(C-=1),f[0]<C&&(C-=f[1]-f[0]),c=W.moveItemOrRange(f,ze(C,r,l),c),{groups:d,movedColumns:n.concat(c)}}function Wn(e,t,n){var a;if(e.parentId===t)return[...n];let s=n.map(c=>new jt(c));const o=new Map(s.map(c=>[c.name,c])),i=s.find(c=>c.name===e.parentId),r=s.find(c=>c.name===t),l=s.find(c=>c.name===e.id);if(i!=null&&(i.children=i.children.filter(c=>c!==e.id),i.children.length===0)){const c=new Set([i.name]),{parent:d=""}=i;let u=o.get(d);for(u==null||u.removeChildren([i.name]);u&&u.children.length===0;){c.add(u.name);const m=(a=u==null?void 0:u.parent)!=null?a:"",p=o.get(m);p==null||p.removeChildren([u.name]),u=p}s=s.filter(({name:m})=>!c.has(m))}return r!=null&&r.addChildren([e.id]),l==null||l.setParent(t!=null?t:void 0),s}const tg=150,Je=class extends T.exports.Component{constructor(e){super(e),this.debouncedSearchColumns=ft(this.searchColumns,tg),this.handleGroupColorChange=Zn((t,n)=>{const{columnHeaderGroups:s,onColumnHeaderGroupChanged:o}=this.props,i=[...s],r=new jt({...t,color:n});i.splice(i.findIndex(({name:l})=>l===t.name),1,r),o(i)},250),this.renderItem=he(({value:t,clone:n,item:s,ref:o,handleProps:i})=>{const{onColumnVisibilityChanged:r}=this.props,{selectedColumns:l}=this.state;let a=t;return n&&(a=this.getSelectedParentItems().map(({id:d})=>d).join(", ")),h(Lp,{ref:o,value:a,clone:n,item:s,childCount:l.size,onVisibilityChange:r,onClick:this.handleItemClick,onGroupDelete:this.handleGroupDelete,onGroupColorChange:this.handleGroupColorChange,onGroupNameChange:this.handleGroupNameChange,validateGroupName:this.validateGroupName,handleProps:i})}),this.getMemoizedFirstMovableIndex=he((t,n,s)=>{for(let o=0;o<n.length;o+=1){const i=W.getModelIndex(o,s);if(t.isColumnMovable(i))return o}return null}),this.getMemoizedLastMovableIndex=he((t,n,s)=>{for(let o=n.length-1;o>=0;o-=1){const i=W.getModelIndex(o,s);if(t.isColumnMovable(i))return o}return null}),this.memoizedGetTreeItems=he((t,n,s,o,i)=>_p(t,n,s,o,[...i.values()])),this.makeVisibilityOrderingList=he((t,n)=>{const{movedColumns:s}=this.props,o=[],i=this.getFirstMovableIndex(),r=this.getLastMovableIndex(),l=n.findIndex(({data:d})=>Array.isArray(d.visibleIndex)?d.visibleIndex[0]===i:d.visibleIndex===i),a=n.findIndex(({data:d})=>Array.isArray(d.visibleIndex)?d.visibleIndex[1]===r:d.visibleIndex===r),c=n.slice(l,a+1);if(i==null||r===null){for(let d=0;d<t.length;d+=1){const u=W.getModelIndex(d,s),m=t[u];o.push(this.renderImmovableItem(m.name))}return o}for(let d=0;d<i;d+=1){const u=W.getModelIndex(d,s),m=t[u];o.push(this.renderImmovableItem(m.name))}i!==null&&i>0&&o.push(h("hr",{},"top-horizontal-divider")),o.push(h(Jp,{items:c,renderItem:this.renderItem,onDragStart:this.handleDragStart,onDragEnd:this.handleDragEnd},"movable-items")),r!=null&&r<t.length-1&&o.push(h("hr",{},"bottom-horizontal-divider"));for(let d=r+1;d<t.length;d+=1){const u=W.getModelIndex(d,s),m=t[u];o.push(this.renderImmovableItem(m.name))}return o}),this.renderImmovableItem=he(t=>h("div",{className:"visibility-ordering-list-item immovable",children:h("div",{className:"column-item",children:h("span",{className:"column-name",children:t})})},t)),this.handleSearchInputChange=this.handleSearchInputChange.bind(this),this.searchColumns=this.searchColumns.bind(this),this.handleItemClick=this.handleItemClick.bind(this),this.handleDragEnd=this.handleDragEnd.bind(this),this.handleGroupDelete=this.handleGroupDelete.bind(this),this.handleGroupNameChange=this.handleGroupNameChange.bind(this),this.handleGroupCreate=this.handleGroupCreate.bind(this),this.validateGroupName=this.validateGroupName.bind(this),this.addColumnToSelected=this.addColumnToSelected.bind(this),this.handleDragStart=this.handleDragStart.bind(this),this.state={selectedColumns:new Set,lastSelectedColumn:"",searchFilter:""},this.list=null}componentWillUnmount(){this.debouncedSearchColumns.cancel()}resetVisibilityOrdering(){const{model:e,onReset:t,onMovedColumnsChanged:n,onColumnHeaderGroupChanged:s}=this.props;this.setState({selectedColumns:new Set,lastSelectedColumn:"",searchFilter:""}),t(),s(e.initialColumnHeaderGroups),n(e.initialMovedColumns)}resetSelection(){this.setState({selectedColumns:new Set,lastSelectedColumn:""})}handleSearchInputChange(e){const t=e.target.value;if(this.setState({searchFilter:t}),!t){this.debouncedSearchColumns.cancel(),this.resetSelection();return}this.debouncedSearchColumns(t)}searchColumns(e){var i;const t=Nt(this.getTreeItems()),s=t.filter(({id:r})=>r.toLowerCase().includes(e.toLowerCase())).map(({id:r})=>r),o=t.findIndex(({id:r})=>r.toLowerCase().includes(e.toLowerCase()));if(this.addColumnToSelected(s,!1),s.length>0){const r=(i=this.list)==null?void 0:i.querySelectorAll(".item-wrapper")[o];r==null||r.scrollIntoView({block:"center"})}}moveSelectedColumns(e){var d;const{columnHeaderGroups:t}=this.props,{selectedColumns:n}=this.state,s=Nt(this.getTreeItems());let o=this.getFirstMovableIndex(),i=this.getLastMovableIndex();O(o),O(i);const r=this.getSelectedParentItems();e===Je.MOVE_OPTIONS.UP||e===Je.MOVE_OPTIONS.TOP||r.reverse();let a=[],c=t;for(let u=0;u<r.length;u+=1){const{id:m,parentId:p,depth:g,data:{visibleIndex:f}}=r[u];switch(e){case Je.MOVE_OPTIONS.TOP:{a=W.moveItemOrRange(f,o,a,!0),o+=Array.isArray(f)?f[1]-f[0]+1:1,c=Wn(r[u],null,c);break}case Je.MOVE_OPTIONS.BOTTOM:{a=W.moveItemOrRange(f,i,a,!0),i-=Array.isArray(f)?f[1]-f[0]+1:1,c=Wn(r[u],null,c);break}case Je.MOVE_OPTIONS.UP:{const w=s.findIndex(b=>b.id===m),C=s.map((b,E)=>E<w&&!n.has(b.id)).lastIndexOf(!0),S=s[C];if(S!=null&&S.parentId!==p)if(Math.abs(S.depth-g)>1){const b=s.map((v,y)=>y<C&&v.depth===g).lastIndexOf(!0),E=s[b];c=Wn(r[u],E.id,c)}else c=Wn(r[u],S.parentId,c);else{const b=ze(Array.isArray(f)?f[0]-1:f-1,o,i);a=W.moveItemOrRange(f,b,a,!1),o+=Array.isArray(f)?f[1]-f[0]+1:1}break}case Je.MOVE_OPTIONS.DOWN:{const w=s.findIndex(E=>E.id===m),C=s.find((E,v)=>v>w&&!n.has(E.id));if((C==null?void 0:C.parentId)!==p){const E=s.find(v=>v.id===p);c=Wn(r[u],(d=E==null?void 0:E.parentId)!=null?d:null,c);break}else if((C==null?void 0:C.children.length)>0){c=Wn(r[u],C.id,c);break}const S=ze(Array.isArray(f)?f[0]+1:f+1,o,i);a=W.moveItemOrRange(f,S,a,!1),i-=Array.isArray(f)?f[1]-f[0]+1:1;break}}}return{newMoves:a,groups:c}}handleMoveColumns(e){const{onMovedColumnsChanged:t,movedColumns:n,onColumnHeaderGroupChanged:s}=this.props,{newMoves:o,groups:i}=this.moveSelectedColumns(e);let r;e===Je.MOVE_OPTIONS.TOP&&(r=()=>{var l,a;(a=(l=this.list)==null?void 0:l.parentElement)==null||a.scroll({top:0})}),e===Je.MOVE_OPTIONS.BOTTOM&&(r=()=>{var l,a;(a=(l=this.list)==null?void 0:l.parentElement)==null||a.scroll({top:this.list.parentElement.scrollHeight})}),s(i),o.length>0&&t(n.concat(o),r)}getSortMoves(e,t,n){const s=[...e],o=t===Je.SORTING_OPTIONS.ASC;s.sort((l,a)=>{const c=l.id.toUpperCase(),d=a.id.toUpperCase();return Tr.sort(c,d,o)});let i=[...n],r=Math.min(...s.flatMap(l=>{const{modelIndex:a}=l.data;return Array.isArray(a)?W.getVisibleIndexes(a,i):W.getVisibleIndex(a,i)}));for(let l=0;l<s.length;l+=1){const a=s[l],{modelIndex:c}=a.data,d=Array.isArray(c)?W.getVisibleIndexes(c,i):W.getVisibleIndex(c,i);i=Array.isArray(d)?W.moveRange([Math.min(...d),Math.max(...d)],r,i,!0):W.moveItem(d,r,i),Array.isArray(d)&&(i=this.getSortMoves(a.children,t,i)),r+=Array.isArray(c)?c.length:1}return i}handleSortColumns(e){const{model:t,onMovedColumnsChanged:n}=this.props,s=this.getSortMoves(this.getTreeItems(),e,t.initialMovedColumns);n(s)}handleItemClick(e,t){if(t.stopPropagation(),t.target instanceof HTMLElement&&(t.target.tagName==="BUTTON"||t.target.tagName==="INPUT"))return;t.currentTarget.focus();const{selectedColumns:n,lastSelectedColumn:s}=this.state,o=W.isModifierKeyDown(t),i=t.shiftKey,r=n.has(e),l=[e];if(r&&o){this.removeColumnFromSelected(e);return}const a=Nt(this.getTreeItems());if(r&&!i&&s===e){const c=a.find(({id:u})=>u===e);if(O(c),Nt(c.children).length+1===n.size){this.resetSelection();return}}if(i){const c=a.findIndex(u=>u.id===e),d=a.findIndex(u=>u.id===s);l.push(...a.slice(Math.min(d,c),Math.max(d,c)+1).map(u=>u.id))}this.addColumnToSelected(l,o||i),this.setState({lastSelectedColumn:e})}addColumnToSelected(e,t){const{selectedColumns:n}=this.state,s=new Set(t?[...n.values()].concat(e):e);Nt(this.getTreeItems()).forEach(({id:i,children:r})=>{s.has(i)&&r.forEach(l=>s.add(l.id))}),this.setState({selectedColumns:s})}removeColumnFromSelected(e){const{selectedColumns:t}=this.state,n=Nt(this.getTreeItems()),s=n.find(({id:i})=>i===e);O(s);let o=n.find(({id:i})=>i===s.parentId);for(Nt(s==null?void 0:s.children).forEach(i=>t.delete(i.id));o!=null;){t.delete(o.id);const i=o.parentId;o=n.find(({id:r})=>r===i)}t.delete(e),this.setState({selectedColumns:new Set(t)})}handleDragStart(e){const{selectedColumns:t}=this.state;t.has(e)||this.addColumnToSelected([e],!1)}handleDragEnd(e,t){const{movedColumns:n,onMovedColumnsChanged:s,columnHeaderGroups:o,onColumnHeaderGroupChanged:i}=this.props,r=this.getSelectedParentItems(),l=Nt(this.getTreeItems()).map((m,p)=>({...m,index:p})),a=this.getFirstMovableIndex(),c=this.getLastMovableIndex();O(a),O(c);const{groups:d,movedColumns:u}=eg(e,t,n,o,l,r,a,c);i(d),s(u)}handleGroupNameChange(e,t){const{columnHeaderGroups:n,onColumnHeaderGroupChanged:s}=this.props,o=[...n],i=e.name,r=o.findIndex(({name:d})=>d===i),l=o[r];O(l);const a=new jt(l);a.name=t,o.splice(r,1,a);const c=o.findIndex(({name:d})=>d===a.parent);if(c>=0){const d=new jt(o[c]);d.removeChildren([i]),d.addChildren([t]),o.splice(c,1,d)}s(o)}handleGroupDelete(e){const{columnHeaderGroups:t,onColumnHeaderGroupChanged:n}=this.props,s=t.filter(i=>i.name!==e.name),o=s.findIndex(i=>i.name===e.parent);if(o>=0){const i=new jt(s[o]);i.addChildren(e.children),i.removeChildren([e.name]),s.splice(o,1,i)}n(s)}handleGroupCreate(){const{movedColumns:e,onMovedColumnsChanged:t,onColumnHeaderGroupChanged:n}=this.props,{newMoves:s,groups:o}=this.moveSelectedColumns(Je.MOVE_OPTIONS.TOP),i=o.filter(d=>!d.isNew),r=this.getSelectedParentItems(),l=r.map(d=>d.data.modelIndex).flat().filter(d=>d>=0),a=`${jt.NEW_GROUP_PREFIX}-${Date.now()}`,c=new jt({name:a,children:r.map(({id:d})=>d),depth:0,childIndexes:[...new Set(l)]});t(e.concat(s),()=>{var d,u;(u=(d=this.list)==null?void 0:d.parentElement)==null||u.scroll({top:0})}),n(i.concat([c])),this.resetSelection()}validateGroupName(e){const{model:t,columnHeaderGroups:n}=this.props,{columns:s}=t;return _t.isValidColumnName(e)?s.some(({name:o})=>o===e)||n.some(({name:o})=>o===e)?"Duplicate name":"":"Invalid name"}getFirstMovableIndex(){const{model:e,movedColumns:t}=this.props;return this.getMemoizedFirstMovableIndex(e,e.columns,t)}getLastMovableIndex(){const{model:e,movedColumns:t}=this.props;return this.getMemoizedLastMovableIndex(e,e.columns,t)}getTreeItems(){const{model:e,movedColumns:t,hiddenColumns:n,columnHeaderGroups:s}=this.props,{selectedColumns:o}=this.state;return this.memoizedGetTreeItems(e.columns,t,s,n,o)}getSelectedParentItems(){const{selectedColumns:e}=this.state;return Nt(this.getTreeItems()).filter(({id:n,parentId:s})=>e.has(n)&&!e.has(s!=null?s:""))}render(){const{model:e,hiddenColumns:t,onColumnVisibilityChanged:n}=this.props,{selectedColumns:s,searchFilter:o}=this.state,i=s.size>0,r=this.getTreeItems(),l=new Map(Nt(r).map(g=>[g.id,g.data.modelIndex])),a=new Set(t),c=[...new Set(i?[...s.values()].map(g=>l.get(g)).filter(g=>g!=null).flat():r.map(g=>g.data.modelIndex).flat())],d=c.some(g=>!a.has(g)),u=d?"Hide All":"Show All",m=d?"Hide Selected":"Show Selected",p=this.makeVisibilityOrderingList(e.columns,r);return R("div",{role:"menu",className:"visibility-ordering-builder",tabIndex:0,children:[R("div",{className:"top-menu",children:[h(X,{kind:"ghost",className:"toggle-visibility-btn",onClick:()=>{n(c,!d)},icon:d?gr:ua,tooltip:"Toggle column visibility",children:i?m:u}),h(Jn,{className:"visibility-search",value:o,matchCount:o?s.size:void 0,onChange:this.handleSearchInputChange})]}),R("div",{className:"top-menu",children:[h(X,{kind:"ghost",icon:uu,tooltip:"Reset to default",onClick:()=>{this.resetVisibilityOrdering()},children:"Reset"}),h("span",{className:"vertical-divider"}),h(X,{kind:"ghost",icon:Cr,tooltip:"Sort ascending",onClick:()=>{this.handleSortColumns(Je.SORTING_OPTIONS.ASC)}}),h(X,{kind:"ghost",icon:wr,tooltip:"Sort descending",onClick:()=>{this.handleSortColumns(Je.SORTING_OPTIONS.DSC)}}),h("span",{className:"vertical-divider"}),R(X,{kind:"ghost",tooltip:"Create group from selection",disabled:!i,onClick:this.handleGroupCreate,children:[R("span",{className:"fa-layers",style:{marginRight:"0.75rem"},children:[h(Z,{mask:fu,icon:fi,transform:"right-7 down-5 shrink-6"}),h(Z,{icon:Ud,transform:"right-8 down-6 shrink-8"})]}),"Group"]}),h("span",{className:"vertical-divider"}),h(X,{kind:"ghost",icon:qd,tooltip:"Move selection up",onClick:()=>{this.handleMoveColumns(Je.MOVE_OPTIONS.UP)},disabled:!i}),h(X,{kind:"ghost",icon:Wd,tooltip:"Move selection down",onClick:()=>{this.handleMoveColumns(Je.MOVE_OPTIONS.DOWN)},disabled:!i}),h(X,{kind:"ghost",icon:Su,tooltip:"Move selection to top",onClick:()=>{this.handleMoveColumns(Je.MOVE_OPTIONS.TOP)},disabled:!i}),h(X,{kind:"ghost",icon:wu,tooltip:"Move selection to bottom",onClick:()=>{this.handleMoveColumns(Je.MOVE_OPTIONS.BOTTOM)},disabled:!i})]}),h("div",{role:"menu",className:B("visibility-ordering-list"),children:h("div",{className:"column-list",ref:g=>{this.list=g},children:p})})]})}};let Vr=Je;Vr.SORTING_OPTIONS={DSC:"DSC",ASC:"ASC"};Vr.MOVE_OPTIONS={TOP:"TOP",BOTTOM:"BOTTOM",UP:"UP",DOWN:"DOWN"};class jo extends T.exports.PureComponent{constructor(t){super(t),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=te.createRef(),this.state={isConfigureColumnsShown:!1}}static createSearchFilter(t,n,s,o){const i=o?s.filter(r=>!n.includes(r.name)).map(r=>r.name):n;if(t&&i.length>0){const r=I.FilterValue.ofString(t);return i.length===s.length?I.FilterCondition.search(r):I.FilterCondition.search(r,s.filter(a=>i.includes(a.name)).map(a=>a.filter()))}}focus(){var t;(t=this.searchField.current)==null||t.focus()}handleSearchValueChange(t){const{onChange:n,selectedColumns:s,invertSelection:o}=this.props;n(t.target.value,s,o)}sendColumnChange(t,n){const{onChange:s,value:o}=this.props;s(o,t,n)}setInvertSelection(t){const{onChange:n,value:s}=this.props;n(s,[],t)}toggleColumn(t){const{selectedColumns:n,invertSelection:s}=this.props;if(n.includes(t))this.sendColumnChange(n.filter(o=>o!==t),s);else{const o=n.slice();o.push(t),this.sendColumnChange(o,s)}}selectAll(){this.setInvertSelection(!0)}clear(){this.setInvertSelection(!1)}selectNumbers(){const{columns:t}=this.props;this.sendColumnChange(t.filter(n=>x.isNumberType(n.type)).map(n=>n.name),!1)}render(){const{value:t,selectedColumns:n,invertSelection:s,columns:o}=this.props,{isConfigureColumnsShown:i}=this.state,r=n.length===0&&s===!0||n.length===o.length&&s===!1,l=n.length===0&&s===!1||n.length===o.length&&s===!0;let a;return r?a=R(Fe,{children:[h(Z,{icon:ii,mask:Vi,transform:"shrink-2 down-5 right-7"}),h(Z,{icon:bu,className:"text-primary",transform:"shrink-4 down-5 right-7"})]}):l?a=R(Fe,{children:[h(Z,{icon:fi,mask:Vi,transform:"shrink-1 down-5 right-7"}),h(Z,{icon:ll,className:"text-danger",transform:"shrink-4 down-5 right-7"})]}):a=R(Fe,{children:[h(Z,{icon:ii,mask:Vi,transform:"shrink-2 down-5 right-7"}),h(Z,{icon:Fu,className:"text-primary",transform:"shrink-4 down-5 right-7"})]}),R("div",{className:"cross-column-container",children:[h(Jn,{className:"cross-column-search",placeholder:"Search Data...",value:t,onChange:this.handleSearchValueChange,ref:this.searchField}),R("button",{type:"button",className:"btn btn-link btn-link-icon px-2",onClick:()=>{i?this.setState({isConfigureColumnsShown:!1}):this.setState({isConfigureColumnsShown:!0})},children:[h("div",{className:"fa-layers",children:a}),h(We,{children:"Configure Columns"}),h(Rn,{isShown:i,className:"cross-column-popper",onExited:()=>{this.setState({isConfigureColumnsShown:!1})},closeOnBlur:!0,interactive:!0,children:R("div",{className:"cross-column-popup",children:["Searched Columns",h("div",{className:"cross-column-scroll",children:o.map(c=>R(te.Fragment,{children:[h(ut,{className:"cross-column-checkbox",checked:s?!n.includes(c.name):n.includes(c.name),onChange:()=>this.toggleColumn(c.name),children:c.name}),c.type.substring(c.type.lastIndexOf(".")+1)]},c.name))}),R("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&&R("p",{className:"text-danger",children:[h(Z,{icon:ll})," Select at least one column to search."]})]})})]})]})}}const Ln=se.module("PartitionSelectorSearch"),ng=150,rc=class extends T.exports.Component{constructor(e){super(e),this.debounceUpdateFilter=ft(()=>{this.updateFilter()},ng),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(e){e instanceof po||Ln.error(e)}componentDidMount(){this.startListening()}componentDidUpdate(e,t){const{isLoading:n,itemCount:s}=this.state,{onListResized:o}=this.props;(s!==t.itemCount||n!==t.isLoading)&&o()}componentWillUnmount(){this.debounceUpdateFilter.cancel(),this.stopListening()}handleKeyDown(e){if(this.itemList==null)return!1;const{items:t,itemCount:n}=this.state;switch(e.key){case"Enter":{let s=null;if(t.length>0)s=t[0].value;else{const{text:o}=this.state;s=o.trim()}if(s.length>0){const{onSelect:o}=this.props;o(s)}return e.stopPropagation(),e.preventDefault(),!0}case"ArrowDown":return n>0&&this.itemList.focusItem(1),e.stopPropagation(),e.preventDefault(),!0;default:return!1}}handleListKeydown(e){switch(e.key){case"Escape":break;default:this.focus();break}}handleFilterChange(){Ln.debug2("handleFilterChange");const{table:e}=this.props,t=e.size;this.setState({itemCount:t,isLoading:!0})}handleInputFocus(){this.itemList&&this.itemList.focusItem(0)}handleSelect(e){Ln.debug2("handleSelect",e);const{onSelect:t}=this.props,{offset:n,items:s}=this.state,o=e-n;if(o<0||s.length<=o){Ln.error("No data for item",e);return}const{value:i}=s[o];t(i)}handleTableUpdate(e){const t=e.detail,{offset:n}=t,s=[],{getFormattedString:o,table:i}=this.props,r=i.columns[0];for(let a=0;a<t.rows.length;a+=1){const d=t.rows[a].get(r),u=o(d,r.type,r.name);s.push({displayValue:u,value:d})}const l=i.size;Ln.debug2("handleTableUpdate",l,n,s.length),this.setState({itemCount:l,items:s,offset:n,isLoading:!1})}handleTextChange(e){Ln.debug2("handleTextChange");const{value:t}=e.target;this.setState({text:t}),this.debounceUpdateFilter()}handleViewportChange(e,t){Ln.debug2("handleViewportChange",e,t);const n=Math.max(1,t-e),s=Math.max(0,e-n),o=t+n,{table:i}=this.props;i.setViewport(s,o)}focus(){this.searchInput&&this.searchInput.focus()}startListening(){const{initialPageSize:e,table:t}=this.props;t.addEventListener(I.Table.EVENT_UPDATED,this.handleTableUpdate),t.addEventListener(I.Table.EVENT_FILTERCHANGED,this.handleFilterChange),t.setViewport(0,e)}stopListening(){const{table:e}=this.props;e.removeEventListener(I.Table.EVENT_UPDATED,this.handleTableUpdate),e.removeEventListener(I.Table.EVENT_FILTERCHANGED,this.handleFilterChange)}updateFilter(){const{initialPageSize:e,table:t}=this.props,{text:n}=this.state,s=n.trim(),o=[];if(s.length>0){const r=t.columns[0].filter().invoke("matches",I.FilterValue.ofString(`(?s)(?i).*\\Q${s}\\E.*`));o.push(r)}Ln.debug2("updateFilter",o),t.applyFilter(o),t.setViewport(0,e)}render(){const{isLoading:e,itemCount:t,items:n,offset:s,text:o}=this.state,i=Math.min(t,rc.MAX_VISIBLE_ITEMS)*on.DEFAULT_ROW_HEIGHT+11;return R("div",{className:"iris-grid-partition-selector-search",children:[h("div",{className:"search-container",children:h("input",{type:"text",ref:r=>{this.searchInput=r},value:o,placeholder:"Available Partitions",onChange:this.handleTextChange,onFocus:this.handleInputFocus,onKeyDown:this.handleKeyDown,className:"form-control input-partition"})}),!e&&t>0&&h("div",{className:"iris-grid-partition-selector-search-list",onKeyDown:this.handleListKeydown,role:"presentation",style:{height:i},children:h(on,{ref:r=>{this.itemList=r},itemCount:t,items:n,offset:s,onSelect:this.handleSelect,onViewportChange:this.handleViewportChange})}),!e&&t===0&&h("div",{className:"iris-grid-partition-selector-search-empty",children:"No results"}),e&&R("div",{className:"iris-grid-partition-selector-loading",children:[h(Vt,{}),"\xA0Loading..."]})]})}};let Di=rc;Di.MAX_VISIBLE_ITEMS=12;Di.defaultProps={initialPageSize:100,onSelect:()=>{},onListResized:()=>{}};Di.propTypes={getFormattedString:D.exports.func.isRequired,table:D.exports.shape({addEventListener:D.exports.func.isRequired,removeEventListener:D.exports.func.isRequired,columns:D.exports.arrayOf(D.exports.shape({name:D.exports.string.isRequired,type:D.exports.string.isRequired,filter:D.exports.func.isRequired})),size:D.exports.number.isRequired,applyFilter:D.exports.func.isRequired,setViewport:D.exports.func.isRequired}).isRequired,initialPageSize:D.exports.number,onSelect:D.exports.func,onListResized:D.exports.func};const Ns=se.module("IrisGridPartitionSelector"),sg=250;class lc extends T.exports.Component{constructor(t){super(t),this.debounceUpdate=ft(()=>{this.sendUpdate()},sg),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}=t;this.state={partition:n}}componentWillUnmount(){this.debounceUpdate.cancel()}handleAppendClick(){Ns.debug2("handleAppendClick");const{onAppend:t}=this.props,{partition:n}=this.state;t(n)}handleCloseClick(){Ns.debug2("handleCloseClick"),this.sendDone()}handleIgnoreClick(){Ns.debug2("handleIgnoreClick"),this.sendFetchAll()}handlePartitionChange(t){Ns.debug2("handlePartitionChange");const{value:n}=t.target;this.setState({partition:n}),this.debounceUpdate()}handlePartitionSelect(t){this.searchMenu&&this.searchMenu.closeMenu(),this.setState({partition:t},()=>{this.sendUpdate()})}handlePartitionListResized(){this.searchMenu&&this.searchMenu.scheduleUpdate()}handleSearchClosed(){const{table:t}=this.props;t.applyFilter([])}handleSearchOpened(){this.selectorSearch&&this.selectorSearch.focus()}sendDone(){this.debounceUpdate.flush();const{onDone:t}=this.props;t()}sendUpdate(){Ns.debug2("sendUpdate");const{onChange:t}=this.props,{partition:n}=this.state;t(n)}sendFetchAll(){Ns.debug2("sendFetchAll"),this.debounceUpdate.cancel();const{onFetchAll:t}=this.props;t()}render(){const{columnName:t,getFormattedString:n,onDone:s,table:o}=this.props,{partition:i}=this.state,r=h(Di,{getFormattedString:n,table:o,onSelect:this.handlePartitionSelect,onListResized:this.handlePartitionListResized,ref:l=>{this.selectorSearch=l}},"search");return R("div",{className:"iris-grid-partition-selector",children:[h("div",{className:"status-message",children:R("span",{children:['Filtering "',t,'" partition to']})}),R("div",{className:"input-group",children:[h("input",{type:"text",value:i,onChange:this.handlePartitionChange,className:"form-control input-partition"}),h("div",{className:"input-group-append",children:R("button",{type:"button",className:"btn btn-outline-primary",children:[h(Z,{icon:$n}),h(We,{children:"Partitions"}),h(Qn,{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(Z,{icon:go})})]})}}lc.defaultProps={onAppend:()=>{},onChange:()=>{},onFetchAll:()=>{},onDone:()=>{},partition:""};const og=se.module("SelectDistinctBuilder");class ac extends T.exports.Component{constructor(t){super(t),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(t,n){const{inputs:s}=this.state,{onChange:o}=this.props;if(n.inputs!==s){const i=s.filter(r=>r!=="");ct(n.inputs.filter(r=>r!==""),i)||o(i)}}handleAddColumnClick(){this.setState(({inputs:t})=>({inputs:[...t,""]}))}handleDeleteColumn(t){this.setState(({inputs:n})=>({inputs:n.length===1&&t===0?[""]:n.filter((s,o)=>t!==o)}))}handleDropdownChanged(t,n){og.debug("handleDropdownChanged",t,n);const{value:s}=n.target;this.setState(({inputs:o})=>{const i=[...o];return i[t]=s,{inputs:i}})}renderInputs(){const{columns:t,inputs:n}=this.state;return n.map((s,o)=>{const i=t.filter(({name:r})=>r===s||!n.includes(r)).map(({name:r})=>h("option",{value:r,children:r},r));return R("div",{className:"form-inline px-3 pb-3",children:[R("select",{className:"form-control custom-select col",value:s,onChange:r=>this.handleDropdownChanged(o,r),children:[h("option",{value:"",children:"Select a column"}),i]}),(n.length>1||s!=="")&&h(X,{kind:"ghost",className:"ml-1 px-2",onClick:()=>{this.handleDeleteColumn(o)},icon:h(Z,{icon:yn,transform:"grow-3"}),tooltip:"Delete column"})]},o)})}render(){const{columns:t,inputs:n}=this.state,s=n.length>=t.length;return R("div",{role:"presentation",className:"select-distinct-builder-container h-100",children:[h("div",{className:"select-distinct-title",children:"Display Unique Values From"}),this.renderInputs(),h("hr",{}),h("div",{className:"pt-1 px-3",children:h(X,{kind:"ghost",className:"btn-add-column",onClick:this.handleAddColumnClick,disabled:s,icon:Bs,children:"Add Additional Column"})}),h("div",{className:"select-distinct-builder-footer",children:R("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."]})})]})}}ac.defaultProps={selectDistinctColumns:[],onChange:()=>{}};function Ur({items:e,onChange:t=()=>{}}){return h(Fa,{items:Array.from(e.entries()).map(([n,s])=>({title:Ur.getAdvancedSettingsTitleForKey(n),isOn:s,onChange:o=>t(n,o)}))})}Ur.getAdvancedSettingsTitleForKey=e=>{switch(e){case fs.FILTER_CONTROL_CHANGE_CLEARS_ALL_FILTERS:return"Control filters clear existing table filters";case fs.LINK_CHANGE_CLEARS_ALL_FILTERS:return"Inbound links clear existing table filters"}};const Ll=se.module("ConditionalFormattingMenu"),qi=()=>{};function ig(e){const{column:{type:t}}=e;if(x.isNumberType(t))return e.condition===Oe.IS_NULL||e.condition===Oe.IS_NOT_NULL?"":`${e.value}`;if(x.isCharType(t))return e.condition===at.IS_NULL||e.condition===at.IS_NOT_NULL?"":`${e.value}`;if(x.isStringType(t))return e.condition===vt.IS_NULL||e.condition===vt.IS_NOT_NULL?"":`"${e.value}"`;if(x.isDateType(t))return e.condition===at.IS_NULL||e.condition===at.IS_NOT_NULL?"":`${e.value}`;if(x.isBooleanType(t))return"";throw new Error(`Invalid column type ${t} in getRuleValue`)}function rg(e){return x.isNumberType(e.column.type)&&e.condition===Oe.IS_BETWEEN?`${e.start} < ${e.column.name} < ${e.end}`:`${e.column.name} ${Lm(e.column.type,e.condition)}
|
|
14
|
-
${ig(e)}`}function lg(e){const{rules:t=[],onChange:n=qi,onCreate:s=qi,onSelect:o=qi}=e,i=T.exports.useCallback((c,d,u)=>{c.stopPropagation(),Ll.debug("Rule clicked",d,u),o(u)},[o]),r=T.exports.useCallback((c,d,u)=>{c.stopPropagation(),Ll.debug("Delete button clicked",d,u);const m=[...t];m.splice(u,1),n(m)},[n,t]),l=T.exports.useCallback(c=>{c.stopPropagation()},[]),a=T.exports.useCallback(c=>{if(gt.stopDragging(),c.destination==null)return;const d=c.source.index,u=c.destination.index,m=[...t],p=t[d];m.splice(d,1),m.splice(u,0,p),n(m)},[n,t]);return R("div",{className:"conditional-formatting-rules",children:[h(gi,{onDragStart:gt.startDragging,onDragEnd:a,children:h(pi,{droppableId:"droppable-custom-columns",children:(c,d)=>R("div",{ref:c.innerRef,...c.droppableProps,className:B("droppable-container",{dragging:d.draggingFromThisWith}),children:[t.length===0&&h("div",{className:"text-muted pl-2",children:"No formats defined"}),t.map((u,m)=>h(cr,{draggableId:`${m}-${u.type}`,index:m,disableInteractiveElementBlocking:!0,children:(p,g)=>h("div",{role:"menuitem",tabIndex:0,onClick:f=>i(f,u,m),className:B("draggable-container",{dragging:g.isDragging}),ref:p.innerRef,...p.draggableProps,children:h("div",{className:"conditional-formatting-list-item",children:R("div",{className:"formatting-item",children:[h("div",{className:"rule-icon",children:h("span",{className:"rule-icon-bg",style:{backgroundColor:ri(u.config.style),color:li(u.config.style)},children:u.type===rn.ROWS?"row":"col"})}),h("div",{className:"rule-title",children:rg(u.config)}),h(X,{kind:"ghost",className:"ml-1 px-2",onClick:f=>r(f,u,m),icon:yn,tooltip:"Delete rule"}),R("button",{type:"button",className:"btn btn-link btn-link-icon px-2 btn-drag-handle",onClick:l,...p.dragHandleProps,children:[h(We,{children:"Drag to re-order"}),h(Z,{icon:Ci})]})]})})})},`${m}-${u.type}`)),c.placeholder]})})}),h("hr",{}),h(X,{kind:"ghost",onClick:s,icon:Bs,children:"Add New Rule"})]})}const Fs=se.module("ConditionEditor"),ag=()=>{},cg=[Oe.IS_EQUAL,Oe.IS_NOT_EQUAL,Oe.IS_BETWEEN,Oe.GREATER_THAN,Oe.GREATER_THAN_OR_EQUAL,Oe.LESS_THAN,Oe.LESS_THAN_OR_EQUAL,Oe.IS_NULL,Oe.IS_NOT_NULL].map(e=>h("option",{value:e,children:Sm(e)},e)),dg=[vt.IS_EXACTLY,vt.IS_NOT_EXACTLY,vt.CONTAINS,vt.DOES_NOT_CONTAIN,vt.STARTS_WITH,vt.ENDS_WITH,vt.IS_NULL,vt.IS_NOT_NULL].map(e=>h("option",{value:e,children:bm(e)},e)),ug=[at.IS_EXACTLY,at.IS_NOT_EXACTLY,at.IS_BEFORE,at.IS_BEFORE_OR_EQUAL,at.IS_AFTER,at.IS_AFTER_OR_EQUAL,at.IS_NULL,at.IS_NOT_NULL].map(e=>h("option",{value:e,children:vm(e)},e)),hg=[lo.IS_TRUE,lo.IS_FALSE,lo.IS_NULL,lo.IS_NOT_NULL].map(e=>h("option",{value:e,children:Tm(e)},e)),mg=[hs.IS_EQUAL,hs.IS_NOT_EQUAL,hs.IS_NULL,hs.IS_NOT_NULL].map(e=>h("option",{value:e,children:Em(e)},e));function pg(e,t,n,s){return e===Oe.IS_NULL||e===Oe.IS_NOT_NULL||e===Oe.IS_BETWEEN&&n!=null&&n!==""&&!Number.isNaN(Number.parseFloat(n))&&s!=null&&s!==""&&!Number.isNaN(Number.parseFloat(s))||e!==Oe.IS_BETWEEN&&t!==void 0&&t!==""&&!Number.isNaN(Number.parseFloat(t))}function gg(e,t,n,s,o,i,r){switch(e){case Oe.IS_EQUAL:case Oe.IS_NOT_EQUAL:case Oe.GREATER_THAN:case Oe.GREATER_THAN_OR_EQUAL:case Oe.LESS_THAN:case Oe.LESS_THAN_OR_EQUAL:return h("input",{type:"number",className:"form-control",placeholder:"Enter value",value:o!=null?o:"",onChange:t});case Oe.IS_BETWEEN:return R("div",{className:"d-flex flex-row",children:[h("input",{type:"number",className:"form-control d-flex mr-2",placeholder:"Start value",value:i!=null?i:"",onChange:n}),h("input",{type:"number",className:"form-control d-flex",placeholder:"End value",value:r!=null?r:"",onChange:s})]});case Oe.IS_NULL:case Oe.IS_NOT_NULL:return null}}function fg(e,t,n){switch(e){case vt.IS_NULL:case vt.IS_NOT_NULL:return null;default:return h("input",{type:"text",className:"form-control",placeholder:"Enter value",value:n!=null?n:"",onChange:t})}}function Cg(e,t,n){switch(e){case at.IS_NULL:case at.IS_NOT_NULL:return null;default:return h("input",{type:"text",className:"form-control",placeholder:"Enter value",value:n!=null?n:"",onChange:t})}}function wg(){return null}function Sg(e,t,n){switch(e){case hs.IS_NULL:case hs.IS_NOT_NULL:return null;default:return h("input",{type:"text",className:"form-control",maxLength:1,placeholder:"Enter value",value:n!=null?n:"",onChange:t})}}function cc(e){const{column:t,config:n,onChange:s=ag}=e,o=t.type,[i,r]=T.exports.useState(o),[l,a]=T.exports.useState(n.condition),[c,d]=T.exports.useState(n.value),[u,m]=T.exports.useState(n.start),[p,g]=T.exports.useState(n.end);o!==i&&(a(Va(o)),d(void 0),m(void 0),g(void 0),r(o));const f=T.exports.useMemo(()=>{if(o===void 0)return[];if(x.isNumberType(o))return cg;if(x.isCharType(o))return mg;if(x.isStringType(o))return dg;if(x.isDateType(o))return ug;if(x.isBooleanType(o))return hg},[o]),w=T.exports.useCallback(v=>{const{value:y}=v.target;Fs.debug("handleConditionChange",y),a(y)},[]),C=T.exports.useCallback(v=>{const{value:y}=v.target;Fs.debug("handleValueChange",y),d(y)},[]),S=T.exports.useCallback(v=>{const{value:y}=v.target;Fs.debug("handleStartValueChange",y),m(y)},[]),b=T.exports.useCallback(v=>{const{value:y}=v.target;Fs.debug("handleEndValueChange",y),g(y)},[]);T.exports.useEffect(function(){let y=!0;l===void 0&&(Fs.debug("Unable to create formatting rule. Condition is not selected."),y=!1),x.isNumberType(t.type)&&!pg(l,c,u,p)&&(Fs.debug("Unable to create formatting rule. Invalid value",c),y=!1),s({condition:l,value:c,start:u,end:p},y)},[s,t.type,l,c,u,p]);const E=T.exports.useMemo(()=>{if(o===void 0)return null;if(x.isNumberType(o))return gg(l,C,S,b,c,u,p);if(x.isCharType(o))return Sg(l,C,c);if(x.isStringType(o))return fg(l,C,c);if(x.isDateType(o))return Cg(l,C,c);if(x.isBooleanType(o))return wg()},[o,l,c,u,p,C,S,b]);return R("div",{className:"condition-editor mb-2",children:[h("select",{value:l,id:"condition-select",className:"custom-select mb-2",onChange:w,children:f}),E]})}const bg=se.module("StyleEditor"),vg="#fcfcfa",Tg="#f0f0ee",Eg="#1a171a",Rg=200,yg=()=>{};function dc(e){var b,E;const{config:t,onChange:n=yg}=e,[s,o]=T.exports.useState(t.type),[i,r]=T.exports.useState((E=(b=t.customConfig)==null?void 0:b.background)!=null?E:vg),[l,a]=T.exports.useState(!1),[c,d]=T.exports.useState(Rg),u=T.exports.useRef(null),m=T.exports.useCallback(v=>{const{value:y}=v.target;bg.debug("handleBackgroundChange",y),r(y)},[]),p=T.exports.useCallback(()=>{l&&a(!1)},[l]),g=T.exports.useCallback(()=>{l||w(),a(!l)},[l]),f=T.exports.useMemo(()=>[Kt.NO_FORMATTING,Kt.POSITIVE,Kt.NEGATIVE,Kt.WARN,Kt.NEUTRAL,Kt.ACCENT_1,Kt.ACCENT_2,Kt.CUSTOM],[]);function w(){u.current&&d(u.current.getBoundingClientRect().width)}T.exports.useEffect(function(){n({type:s,customConfig:{color:Si.isDark(i)?Tg:Eg,background:i}})},[n,s,i]);const C=T.exports.useCallback(()=>{const v=[];for(let y=0;y<f.length;y+=1){const M=f[y],A=`option-${y}-${M}`;v.push(R(X,{kind:"inline",className:"style-option-btn",onClick:()=>{o(M),a(!1)},style:{color:li({type:M}),background:ri({type:M})},children:[M===s&&h(Z,{icon:Xn,className:"mr-2"}),M!==s&&h("span",{className:"mr-4"}),Il(M)]},A))}return v},[f,s]),S=T.exports.useCallback(()=>h("div",{className:"style-menu-container",role:"presentation",style:{width:c},children:h("div",{className:"style-options",children:C()})}),[c,C]);return R("div",{className:"style-editor",children:[R("div",{className:"mb-2",ref:u,children:[h("label",{className:"mb-0",children:"Style"}),R(X,{kind:"inline",className:"cs-dropdown",style:{color:li({type:s}),background:ri({type:s})},onClick:g,children:[Il(s),h("span",{children:h(Z,{icon:Sr,className:"cs-caret"})}),h(Qn,{isShown:l,actions:{menuElement:S()},popperOptions:{placement:"bottom-start"},popperClassName:"style-dropdown-menu",onMenuClosed:p,menuStyle:{maxWidth:"100rem"}})]})]}),s===Kt.CUSTOM&&R("div",{className:"mb-2",children:[h("label",{className:"mb-0",children:"Background"}),h("input",{type:"color",value:i,className:"custom-select color-select",onChange:m})]})]})}const so=se.module("ColumnFormatEditor"),Ig=()=>{};function Mg(e){const{type:t,name:n}=e[0];return{column:{type:t,name:n},style:Ba(),...Ri(t)}}function Dg(e){var w;const{columns:t,config:n=Mg(t),onChange:s=Ig}=e,[o,i]=T.exports.useState((w=t.find(C=>C.name===n.column.name&&C.type===n.column.type))!=null?w:t[0]),[r,l]=T.exports.useState(Ua(n)),[a,c]=T.exports.useState(!1),[d,u]=T.exports.useState(n.style),m=T.exports.useCallback(C=>{const S=t.find(({name:b})=>b===C);S!==void 0?(i(S),o.type!==S.type&&(l(Ri(S.type)),c(!1))):so.error(`Column ${C} not found.`)},[t,o]),p=T.exports.useCallback((C,S)=>{so.debug("handleConditionChange",C,S),l(C),c(S)},[]),g=T.exports.useCallback(C=>{so.debug("handleStyleChange",C),u(C)},[]);T.exports.useEffect(function(){if(o===void 0){so.debug("Column is not selected, skip update.");return}if(d===void 0){so.debug("Style is not selected, skip update.");return}const{type:S,name:b}=o;s({column:{type:S,name:b},style:d,...r},a)},[s,o,d,r,a]);const f=t.map(({name:C})=>({title:C,value:C}));return R("div",{className:"conditional-rule-editor form",children:[R("div",{className:"mb-2",children:[h("label",{className:"mb-0",children:"Format Cell If"}),h(zs,{defaultValue:o==null?void 0:o.name,options:f,inputPlaceholder:"Select a column",spellCheck:!1,onChange:m,searchPlaceholder:"Filter columns"})]}),o!==void 0&&R(Fe,{children:[h(cc,{column:o,config:r,onChange:p}),h(dc,{config:d,onChange:g})]})]})}const oo=se.module("RowFormatEditor"),Ng=()=>{};function Fg(e){const{type:t,name:n}=e[0];return{column:{type:t,name:n},style:Ba(),...Ri(t)}}function xg(e){var w;const{columns:t,config:n=Fg(t),onChange:s=Ng}=e,[o,i]=T.exports.useState((w=t.find(C=>C.name===n.column.name&&C.type===n.column.type))!=null?w:t[0]),[r,l]=T.exports.useState(Ua(n)),[a,c]=T.exports.useState(!1),[d,u]=T.exports.useState(n.style),m=T.exports.useCallback(C=>{const S=t.find(({name:b})=>b===C);S!==void 0?(i(S),o.type!==S.type&&(l(Ri(S.type)),c(!1))):oo.error(`Column ${C} not found.`)},[t,o]),p=T.exports.useCallback((C,S)=>{oo.debug("handleConditionChange",C,S),l(C),c(S)},[]),g=T.exports.useCallback(C=>{oo.debug("handleStyleChange",C),u(C)},[]);T.exports.useEffect(function(){if(o===void 0){oo.debug("Column is not selected, skip update.");return}if(d===void 0){oo.debug("Style is not selected, skip update.");return}const{type:S,name:b}=o;s({column:{type:S,name:b},style:d,...r},a)},[s,o,d,r,a]);const f=t.map(({name:C})=>({title:C,value:C}));return R("div",{className:"conditional-rule-editor form",children:[R("div",{className:"mb-2",children:[h("label",{className:"mb-0",children:"Format Row If"}),h(zs,{defaultValue:o==null?void 0:o.name,options:f,inputPlaceholder:"Select a column",spellCheck:!1,onChange:m,searchPlaceholder:"Filter columns"})]}),o!==void 0&&R(Fe,{children:[h(cc,{column:o,config:r,onChange:p}),h(dc,{config:d,onChange:g})]})]})}const Ki=se.module("ConditionalFormatEditor"),Xi=()=>{};function Ag(e){switch(e){case rn.CONDITIONAL:return h(Rp,{});case rn.ROWS:return h(yp,{})}}function Og(e){switch(e){case rn.CONDITIONAL:return"Conditional";case rn.ROWS:return"Rows"}}const Pl=[rn.CONDITIONAL,rn.ROWS];function kg(e){var C;const{columns:t,onSave:n=Xi,onUpdate:s=Xi,onCancel:o=Xi,rule:i}=e,r=t.filter(Hm),[l,a]=T.exports.useState((C=i==null?void 0:i.type)!=null?C:Pl[0]),[c,d]=T.exports.useState(i),[u,m]=T.exports.useState(!1),p=T.exports.useCallback(()=>{o()},[o]),g=T.exports.useCallback(()=>{if(c===void 0){Ki.error("Rule is not defined.");return}n(c)},[n,c]),f=T.exports.useCallback(S=>{Ki.debug("handleFormatterChange",S),a(S)},[]),w=T.exports.useCallback((S,b)=>{Ki.debug("handleRuleChange",S,b,l);const E={type:l,config:S};d(E),m(b),s(b?E:void 0)},[s,l]);return R("div",{className:"conditional-format-editor form",children:[R("div",{className:"mb-2",children:[h("label",{className:"mb-0",htmlFor:"formatter-select",children:"Select Formatter"}),h("div",{className:"formatter-list",children:Pl.map((S,b)=>h("div",{className:"formatter-type",children:R("button",{type:"button",className:B("btn","btn-icon","btn-formatter-type",{active:S===l}),"data-index":b,onClick:()=>f(S),children:[Ag(S),Og(S)]})},S))})]}),l===rn.CONDITIONAL&&h(Dg,{columns:r,config:c==null?void 0:c.config,onChange:w}),l===rn.ROWS&&h(xg,{columns:r,config:c==null?void 0:c.config,onChange:w}),h("hr",{}),R("div",{className:"d-flex justify-content-end my-3",children:[h(X,{kind:"secondary",onClick:p,className:"mr-2",children:"Cancel"}),h(X,{kind:"primary",onClick:g,disabled:c===void 0||!u,children:"Done"})]})]})}function Lg({type:e}){switch(e){case I.VariableType.TABLE:case I.VariableType.TABLEMAP:case I.VariableType.TREETABLE:case I.VariableType.HIERARCHICALTABLE:return h(Z,{icon:br});case I.VariableType.FIGURE:return h(Z,{icon:ia});case I.VariableType.PANDAS:return h(Z,{icon:Du});default:return h(Z,{icon:du})}}class uc extends T.exports.Component{constructor(t){super(t),this.container=null}componentDidMount(){this.colorize()}colorize(){const{children:t}=this.props;this.container&&t!=null&&vn.colorizeElement(this.container,{theme:"dh-dark"})}render(){const{children:t,language:n}=this.props;return h("div",{children:h("div",{"data-lang":n,ref:s=>{this.container=s},style:{pointerEvents:"none"},children:t})})}}class Pg{static get LANGUAGE_MAP(){return new Map([["python","Python"],["groovy","Groovy"],["scala","Scala"]])}}class Us{static hasComment(t){return t.comment!==void 0}static hasPattern(t){return t.pattern!==void 0}static hasOp(t){return t.op!==void 0}static parseArguments(t){return t==null||!(typeof t=="string"||t instanceof String)?[]:Zc.parse(t).filter(n=>!this.hasComment(n)).map(n=>this.hasPattern(n)?n.pattern:this.hasOp(n)?n.op:`${n}`)}static formatTimestamp(t){if(t==null||!(t instanceof Date))return null;const n=`${t.getHours()}`.padStart(2,"0"),s=`${t.getMinutes()}`.padStart(2,"0"),o=`${t.getSeconds()}`.padStart(2,"0"),i=`${t.getMilliseconds()}`.padStart(3,"0");return`${n}:${s}:${o}.${i}`}static isTableType(t){return t===I.VariableType.TABLE||t===I.VariableType.TREETABLE||t===I.VariableType.HIERARCHICALTABLE}static isWidgetType(t){return t===I.VariableType.FIGURE||t===I.VariableType.OTHERWIDGET||t===I.VariableType.PANDAS}static isOpenableType(t){return Us.isTableType(t)||Us.isWidgetType(t)}static isFigureType(t){return t===I.VariableType.FIGURE}static isPandas(t){return t===I.VariableType.PANDAS}}function hc({children:e}){return R("div",{className:"console-history-item-result",children:[h("div",{className:"console-history-gutter",children:"-"}),h("div",{className:"console-history-content",children:e})]})}hc.propTypes={children:D.exports.node.isRequired};class mc extends T.exports.Component{constructor(t){super(t),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:t,onCancelClick:n}=this.props,{elapsed:s}=this.state;return h("div",{className:B("console-history-result-in-progress",{disabled:t}),children:R("span",{className:"badge",children:[h(Vt,{}),"\xA0Running... ",tn.formatElapsedTime(s),"\xA0",h(X,{className:"console-history-result-in-progress-cancel",kind:"ghost",icon:go,tooltip:"Cancel",onClick:n,disabled:t})]})})}}mc.defaultProps={disabled:!1};const rr=class extends T.exports.PureComponent{constructor(e){super(e),this.handleKeyPress=this.handleKeyPress.bind(this),this.handleMouseDown=this.handleMouseDown.bind(this),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleMouseUp=this.handleMouseUp.bind(this),this.handleToggleError=this.handleToggleError.bind(this),this.handleMouseEnter=this.handleMouseEnter.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.mouseX=null,this.mouseY=null,this.isClicking=!1,this.state={isExpanded:!1,isTriggerHovered:!1}}handleKeyPress(e){switch(e.key){case"Enter":case" ":this.handleToggleError(),e.stopPropagation(),e.preventDefault();break}}handleMouseDown(e){this.mouseX=e.clientX,this.mouseY=e.clientY,this.isClicking=!0}handleMouseMove(e){this.mouseX!=null&&this.mouseY!=null?(Math.abs(e.clientX-this.mouseX)>=rr.mouseDragThreshold||Math.abs(e.clientY-this.mouseY)>=rr.mouseDragThreshold)&&(this.isClicking=!1):this.isClicking&&(this.isClicking=!1)}handleMouseUp(e){this.isClicking&&!e.shiftKey&&!e.metaKey&&!e.altKey&&this.handleToggleError(),this.mouseX=null,this.mouseY=null,this.isClicking=!1}handleToggleError(){this.setState(e=>({isExpanded:!e.isExpanded}))}handleMouseEnter(){this.setState({isTriggerHovered:!0})}handleMouseLeave(){this.setState({isTriggerHovered:!1})}render(){const{isExpanded:e,isTriggerHovered:t}=this.state,{message:n}=this.props;O(n);const s=n.indexOf(`
|
|
15
|
-
`),o=s>-1;let i=n;o&&(i=n.slice(0,s));const r=n.slice(s),l=t?"error-btn-link error-btn-link--active":"error-btn-link";return R("div",{className:B("error-message",{expanded:e}),children:[o&&R(Fe,{children:[h("div",{className:"error-gutter",children:h("button",{type:"button",onClick:this.handleToggleError,className:l,tabIndex:-1,children:h(Z,{icon:e?$n:da,transform:"left-3"})})}),R("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:i}),e?r:""]})]}),!o&&h("div",{className:"error-content",children:h("div",{className:"console-error-text",children:i})})]},"error")}};let Br=rr;Br.defaultProps={message:""};Br.mouseDragThreshold=5;const Hl=se.module("ConsoleHistoryItem");class pc extends T.exports.PureComponent{constructor(t){super(t),this.handleCancelClick=this.handleCancelClick.bind(this),this.handleObjectClick=this.handleObjectClick.bind(this)}handleObjectClick(t){Hl.debug("handleObjectClick",t);const{openObject:n}=this.props;n(t)}handleCancelClick(){const{item:t}=this.props;t!=null&&t.cancelResult&&(Hl.debug(`Cancelling command: ${t.command}`),t.cancelResult())}render(){var d;const{disabled:t,item:n,language:s}=this.props,{disabledObjects:o,result:i}=n;let r=null;n.command!=null&&n.command!==""&&(r=R("div",{className:"console-history-item-command",children:[h("div",{className:"console-history-gutter",children:">"}),h("div",{className:"console-history-content",children:h(uc,{language:s,children:n.command})})]}));const l=[];let a=!1;if(i){const{error:u,message:m,changes:p}=i;if(p){const{created:g,updated:f}=p;[...g,...f].forEach(w=>{a=!0;const{title:C}=w,S=`${C}`,b=t===void 0||t||(o!=null?o:[]).indexOf(S)>=0,E=h(X,{kind:"primary",onClick:()=>this.handleObjectClick(w),className:"btn-console-object",disabled:b,icon:h(Lg,{type:w.type}),children:C},S);l.push(E)})}if(u!=null&&n.command==null){let g=`${(d=u.message)!=null?d:u}`;g||(g=u);const f=h(Br,{message:g},"result-error");l.push(f)}if(m!==void 0&&m!==""){const g=h("div",{className:"log-message",children:m},"log-message");l.push(g)}}else{a=!0;const u=h(mc,{onCancelClick:this.handleCancelClick,disabled:t},"in_progress");l.push(u)}let c=null;return l.length>0&&(c=h(hc,{children:l})),R("div",{className:B("console-command-result",{"console-result-buttons":a}),children:[r,c]})}}pc.defaultProps={disabled:!1};const gc=class extends T.exports.Component{static itemKey(e,t){return`${e}.${t.command}.${t.result&&t.result.message}.${t.result&&t.result.error}`}render(){const{disabled:e,items:t,language:n,openObject:s}=this.props,o=[];for(let i=0;i<t.length;i+=1){const r=t[i],l=h(pc,{disabled:e,item:r,openObject:s,language:n},gc.itemKey(i,r));o.push(l)}return h("div",{className:"container-fluid console-history",children:o})}};let fc=gc;fc.defaultProps={disabled:!1};const Hg={name:"Console",CLEAR:De.createAndAdd({id:"CONSOLE.CLEAR",name:"Clear",shortcut:[ie.CTRL,ae.L],macShortcut:[ie.CTRL,ae.C]}),FOCUS_HISTORY:De.createAndAdd({id:"CONSOLE.FOCUS_HISTORY",name:"Focus History",shortcut:[ie.CTRL,ae.H],macShortcut:[ie.CTRL,ie.OPTION,ae.H]})},_g={name:"Command History",FOCUS_HISTORY:De.createAndAdd({id:"COMMAND_HISTORY.FOCUS_HISTORY",name:"Focus History Search",shortcut:[ie.CTRL,ae.H],macShortcut:[ie.CTRL,ie.OPTION,ae.H]}),SEND_TO_CONSOLE:De.createAndAdd({id:"COMMAND_HISTORY.SEND_TO_CONSOLE",name:"Send to Console",shortcut:[ae.ENTER],macShortcut:[ae.ENTER]}),SEND_TO_NOTEBOOK:De.createAndAdd({id:"COMMAND_HISTORY.SEND_TO_NOTEBOOK",name:"Send to Notebook",shortcut:[ie.CTRL,ae.ENTER],macShortcut:[ie.CMD,ae.ENTER]}),RUN:De.createAndAdd({id:"COMMAND_HISTORY.RUN",name:"Run",shortcut:[ie.ALT,ae.R],macShortcut:[ie.OPTION,ae.R]})},Vg={name:"Notebook",RUN:De.createAndAdd({id:"NOTEBOOK.RUN",name:"Run",shortcut:[ie.ALT,ae.R],macShortcut:[ie.OPTION,ae.R]}),RUN_SELECTED:De.createAndAdd({id:"NOTEBOOK.RUN_SELECTED",name:"Run Selected",shortcut:[ie.ALT,ie.SHIFT,ae.R],macShortcut:[ie.OPTION,ie.SHIFT,ae.R]}),FIND:De.createAndAdd({id:"NOTEBOOK.FIND",name:"Find",shortcut:[ie.CTRL,ae.F],macShortcut:[ie.CMD,ae.F],isEditable:!1}),MINIMAP:De.createAndAdd({id:"NOTEBOOK.MINIMAP",name:"Show Minimap",shortcut:[ie.ALT,ae.M],macShortcut:[ie.OPTION,ae.M]}),WORDWRAP:De.createAndAdd({id:"NOTEBOOK.WORDWRAP",name:"Word Wrap",shortcut:[ie.ALT,ae.Z],macShortcut:[ie.OPTION,ae.Z]})},ps={CONSOLE:Hg,COMMAND_HISTORY:_g,NOTEBOOK:Vg},et=Object.freeze({FATAL:"FATAL",STDERR:"STDERR",ERROR:"ERROR",WARN:"WARN",STDOUT:"STDOUT",INFO:"INFO",DEBUG:"DEBUG",TRACE:"TRACE"}),Ug="#2d2a2e",Bg="#fcfcfa",Gg="#fcd65b",zg="#b2b1b2",Wg="#9edc6f",$g="#76d9e4",qg="#f95d84",Kg="#aa9af4",Xg="#f95d84",Yg="#fcfcfa",Qg="#7c7b7c",ce={"error-foreground":"#f95d84",background:Ug,foreground:Bg,"line-height":"19px",string:Gg,"string-delim":"#929192",delimiter:zg,predefined:Wg,keyword:$g,storage:qg,number:Kg,operator:Xg,identifier:Yg,"namespace-identifier":"#f95d84","identifier-js":"#fcd65b",comment:Qg,"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"},jg="python",Zg={comments:{lineComment:"#",blockComment:["'''","'''"]},brackets:[["{","}"],["[","]"],["(",")"]],autoClosingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"',notIn:["string"]},{open:"'",close:"'",notIn:["string","comment"]}],surroundingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}],onEnterRules:[{beforeText:/^\s*(?:def|class|for|if|elif|else|while|try|with|finally|except|async).*?:\s*$/,action:{indentAction:1}}],folding:{offSide:!0,markers:{start:/^\s*#region\b/,end:/^\s*#endregion\b/}}},Jg={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"]]}},ef={id:jg,conf:Zg,language:Jg},tf="groovy",nf={comments:{lineComment:"//",blockComment:["/*","*/"]},brackets:[["{","}"],["[","]"],["(",")"]],autoClosingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"',notIn:["string"]},{open:"'",close:"'",notIn:["string","comment"]}],surroundingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}],onEnterRules:[{beforeText:/^\s*(?:def|class|for|if|elif|else|while|try|with|finally|except|async).*?:\s*$/,action:{indentAction:1}}],folding:{offSide:!0,markers:{start:/^\s*#region\b/,end:/^\s*#endregion\b/}}},sf={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"]]}},of={id:tf,conf:nf,language:sf},rf="scala",lf={wordPattern:/(unary_[@~!#%^&*()\-=+\\|:<>/?]+)|([a-zA-Z_$][\w$]*?_=)|(`[^`]+`)|([a-zA-Z_$][\w$]*)/g,comments:{lineComment:"//",blockComment:["/*","*/"]},brackets:[["{","}"],["[","]"],["(",")"]],autoClosingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}],surroundingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}],folding:{markers:{start:/^\s*\/\/\s*(?:(?:#?region\b)|(?:<editor-fold\b))/,end:/^\s*\/\/\s*(?:(?:#?endregion\b)|(?:<\/editor-fold>))/}}},af={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"]]}},cf={id:rf,conf:lf,language:af},df="deephavenDb",uf={comments:{lineComment:"#",blockComment:["'''","'''"]},brackets:[["{","}"],["[","]"],["(",")"]],autoClosingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"',notIn:["string"]},{open:"'",close:"'",notIn:["string","comment"]}],surroundingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}],onEnterRules:[{beforeText:/^\s*(?:def|class|for|if|elif|else|while|try|with|finally|except|async).*?:\s*$/,action:{indentAction:1}}],folding:{offSide:!0,markers:{start:/^\s*#region\b/,end:/^\s*#endregion\b/}}},hf={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"]]}},mf={id:df,conf:uf,language:hf},pf="log",gf={},ff={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"}]]}},Cf={id:pf,conf:gf,language:ff},qt=se.module("MonacoUtils");class Ge{static init({getWorker:t}={}){qt.debug("Initializing Monaco..."),t!==void 0&&Ge.registerGetWorker(t);const{registerLanguages:n,removeHashtag:s}=Ge,o=[{token:"",foreground:s(ce.foreground)},{token:"string",foreground:s(ce.string)},{token:"string.delim",foreground:s(ce["string-delim"])},{token:"keyword",foreground:s(ce.keyword)},{token:"identifier.js",foreground:s(ce["identifier-js"])},{token:"delimiter",foreground:s(ce.delimiter)},{token:"comment",foreground:s(ce.comment)},{token:"number",foreground:s(ce.number)},{token:"storage",foreground:s(ce.storage)},{token:"identifier",foreground:s(ce.identifier)},{token:"namespace.identifier",foreground:s(ce["namespace-identifier"])},{token:"operator",foreground:s(ce.operator)},{token:"predefined",foreground:s(ce.predefined)},{token:"error.log",foreground:ce["log-error"].substring(1)},{token:"warn.log",foreground:s(ce["log-warn"])},{token:"info.log",foreground:s(ce["log-info"])},{token:"stdout.log",foreground:s(ce["log-stdout"])},{token:"trace.log",foreground:s(ce["log-trace"])},{token:"debug.log",foreground:s(ce["log-debug"])},{token:"date.log",foreground:s(ce["log-date"])}],i={errorForeground:ce["error-foreground"],"inputOption.activeBorder":ce["input-option-active-border"],"editor.background":ce.background,"editor.foreground":ce.foreground,"editor.lineHighlightBackground":ce["editor-line-highlight-bg"],"editorLineNumber.foreground":ce["editor-line-number-foreground"],"editor.selectionBackground":ce["editor-selection-background"],"editor.findMatchBackground":ce["editor-find-match-background"],"editor.findMatchHighlightBackground":ce["editor-find-match-highlight-background"],"editorSuggestWidget.background":ce["editor-suggest-widget-background"],"editorSuggestWidget.border":ce["editor-suggest-widget-border"],"editorSuggestWidget.foreground":ce["editor-suggest-widget-foreground"],"editorSuggestWidget.selectedBackground":ce["editor-suggest-widget-selected-background"],"editorSuggestWidget.highlightForeground":ce["editor-suggest-widget-highlightForeground"],"list.hoverBackground":ce["list-hover-background"],"dropdown.background":ce["context-menu-background"],"dropdown.foreground":ce["context-menu-foreground"],"menu.selectionBackground":ce["menu-selection-background"],"list.focusBackground":ce["menu-selection-background"],"editorWidget.background":ce["editor-widget-background"],"inputOption.activeBackground":ce["input-option-active-background"],"inputOption.activeForeground":ce["input-option-active-foreground"],focusBorder:ce["focus-border"],"input.background":ce["input-background"],"input.foreground":ce["input-foreground"],"input.border":ce["input-border"]};vn.defineTheme("dh-dark",{base:"vs-dark",inherit:!0,rules:o,colors:i}),qt.debug2("monaco theme: ",ce),vn.setTheme("dh-dark"),n([mf,ef,of,Cf,cf]),qt.debug("Monaco initialized.")}static registerGetWorker(t){window.MonacoEnvironment={...window.MonacoEnvironment,getWorker:t}}static removeHashtag(t){return t.substring(1)}static registerLanguages(t){const n=t.map(({id:s})=>s);As.getLanguages().filter(({id:s})=>n.includes(s)).forEach(s=>{const o=s;qt.debug2("Overriding default language loader:",o.id)}),t.forEach(s=>{Ge.registerLanguage(s)})}static registerLanguage(t){qt.debug2("Registering language: ",t.id),As.register(t),As.onLanguage(t.id,()=>{As.setLanguageConfiguration(t.id,t.conf),As.setMonarchTokensProvider(t.id,t.language)})}static setEOL(t,n=vn.EndOfLineSequence.LF){var s;(s=t.getModel())==null||s.setEOL(n)}static openDocument(t,n){const s=t.getModel();O(s);const o={textDocument:{uri:`${s.uri}`,languageId:s.getLanguageId(),version:s.getVersionId(),text:s.getValue()}};return qt.debug2("didOpenDocumentParams: ",o),n.openDocument(o),t.onDidChangeModelContent(r=>{const{changes:l,versionId:a}=r,c=[];for(let d=0;d<l.length;d+=1){const u=l[d],{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};c.push(f)}if(c.length>0){const d={textDocument:{version:a,uri:`${s.uri}`},contentChanges:c};qt.debug2("didChangeDocumentParams",d),n.changeDocument(d)}})}static closeDocument(t,n){const s=t.getModel();O(s);const o={textDocument:{uri:`${s.uri}`}};n.closeDocument(o)}static registerPasteHandler(t){t.onDidPaste(n=>{const s=/“|”/g,o=/\u200b/g,i=/\u00A0/g,r=t.getModel();O(r);const l=r.getValueInRange(n.range);(s.test(l)||o.test(l)||i.test(l))&&r.applyEdits([{range:n.range,text:l.replace(s,'"').replace(o,"").replace(i," ")}])})}static isMacPlatform(){const{platform:t}=window.navigator;return t.startsWith("Mac")}static removeConflictingKeybindings(t){const n=[{windows:"ctrl+D",mac:"meta+D"},{windows:"ctrl+H"}];try{n.forEach(s=>{Ge.isMacPlatform()&&s.mac===""||!Ge.isMacPlatform()&&s.windows===""||Ge.removeKeybinding(t,Ge.isMacPlatform()?s.mac:s.windows)})}catch(s){qt.error(s)}}static removeKeybinding(t,n){if(n===void 0)return;const s=t._standaloneKeybindingService._getResolver()._map.get(n);s!=null?s.forEach(o=>{qt.debug2(`Removing Monaco keybinding ${n} for ${o.command}`),t._standaloneKeybindingService.addDynamicKeybinding(`-${o.command}`,null,()=>{})}):qt.warn(`Did not find any keybindings to remove for ${n}`)}static getMonacoKeyCodeFromShortcut(t){const{keyState:n}=t,{keyValue:s}=n;return s===null?0:Ge.isMacPlatform()?(n.metaKey?Ft.CtrlCmd:0)|(n.shiftKey?Ft.Shift:0)|(n.altKey?Ft.Alt:0)|(n.ctrlKey?Ft.WinCtrl:0)|el.fromString(s):(n.ctrlKey?Ft.CtrlCmd:0)|(n.shiftKey?Ft.Shift:0)|(n.altKey?Ft.Alt:0)|(n.metaKey?Ft.WinCtrl:0)|el.fromString(s)}}const _l=se.module("MonacoCompletionProvider");class Cc extends T.exports.PureComponent{constructor(t){super(t),this.handleCompletionRequest=this.handleCompletionRequest.bind(this)}componentDidMount(){const{language:t}=this.props;this.registeredCompletionProvider=As.registerCompletionItemProvider(t!=null?t:"",{provideCompletionItems:this.handleCompletionRequest,triggerCharacters:['"',".","'","(","[","{",","]})}componentWillUnmount(){var t;(t=this.registeredCompletionProvider)==null||t.dispose()}handleCompletionRequest(t,n,s){const{model:o,session:i}=this.props;if(t!==o)return null;const r={textDocument:{uri:`${t.uri}`,version:t.getVersionId()},position:{line:n.lineNumber-1,character:n.column-1},context:s},l=i.getCompletionItems(r);return _l.debug("Completion items received: ",r,l),l.then(c=>{const d=c.map(u=>{const{label:m,kind:p,detail:g,documentation:f,sortText:w,filterText:C,textEdit:S,insertTextFormat:b}=u,{start:E,end:v}=S.range,y={startLineNumber:E.line+1,startColumn:E.character+1,endLineNumber:v.line+1,endColumn:v.character+1};return{label:m,kind:p,detail:g,documentation:f,sortText:w,filterText:C,insertText:S.text,insertTextRules:b===2?4:b,range:y}});return{incomplete:!0,suggestions:d}}).catch(c=>(_l.error("There was an error retrieving completion items",c),{suggestions:[]}))}render(){return null}}const Yi=se.module("ConsoleInput"),ci=parseInt(ce["line-height"],10),wc=6,Sc=6,wf=ci+wc+Sc,Qi=100,bc=class extends T.exports.PureComponent{constructor(e){super(e),this.handleWindowResize=this.handleWindowResize.bind(this),this.commandContainer=te.createRef(),this.commandHistoryIndex=null,this.timestamp=Date.now(),this.bufferIndex=0,this.history=[],this.modifiedCommands=new Map,this.state={commandEditorHeight:ci,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(e,t=!0,n=!1){var s;!e||(Yi.debug("Command received: ",e),n||(this.commandHistoryIndex=null,(s=this.commandEditor)==null||s.setValue(e)),t&&this.focusEnd(),this.updateDimensions(),n&&this.processCommand(e))}initCommandEditor(){const{language:e,session:t}=this.props,n={copyWithSyntaxHighlighting:!1,cursorStyle:"block",fixedOverflowWidgets:!0,folding:!1,fontFamily:"Fira Mono",glyphMargin:!1,language:e,lineHeight:ci,lineDecorationsWidth:3,lineNumbers:"off",minimap:{enabled:!1},renderLineHighlight:"none",scrollBeyondLastLine:!1,scrollbar:{arrowSize:0,horizontal:"hidden",horizontalScrollbarSize:0},padding:{top:wc,bottom:Sc},tabCompletion:"on",value:"",wordWrap:"on"},s=this.commandContainer.current;O(s),this.commandEditor=vn.create(s,n),Ge.setEOL(this.commandEditor),Ge.openDocument(this.commandEditor,t),this.commandEditor.onDidChangeModelContent(()=>{var i;const o=(i=this.commandEditor)==null?void 0:i.getValue();this.modifiedCommands.set(this.commandHistoryIndex,o!=null?o:null),this.updateDimensions()}),this.commandEditor.onDidFocusEditorText(()=>{this.setState({isFocused:!0})}),this.commandEditor.onDidBlurEditorText(()=>{this.setState({isFocused:!1})}),this.commandEditor.onKeyDown(o=>{var d,u,m;const{commandEditor:i,commandHistoryIndex:r}=this,l=i==null?void 0:i.getPosition();O(l);const{lineNumber:a}=l,c=i==null?void 0:i.getModel();if(o.keyCode===Zt.UpArrow&&!this.isSuggestionMenuPopulated()&&a===1){r!=null?this.loadCommand(r+1):this.loadCommand(0),this.focusStart(),o.stopPropagation(),o.preventDefault();return}if(o.keyCode===Zt.DownArrow&&!this.isSuggestionMenuPopulated()&&a===(c==null?void 0:c.getLineCount())){r!=null&&r>0?this.loadCommand(r-1):this.loadCommand(null),this.focusEnd(),o.stopPropagation(),o.preventDefault();return}if(!o.altKey&&!o.shiftKey&&!o.metaKey)if(o.keyCode===Zt.Enter){if(!this.isSuggestionMenuPopulated()){o.stopPropagation(),o.preventDefault();const p=(d=this.commandEditor)==null?void 0:d.getValue().trim();p!==void 0&&(this.processCommand(p),(u=this.commandEditor)==null||u.setValue(""))}}else o.keyCode===Zt.Tab&&(this.isSuggestionMenuActive()?this.isSuggestionMenuPopulated()||(o.stopPropagation(),o.preventDefault()):(o.stopPropagation(),o.preventDefault(),(m=this.commandEditor)==null||m.trigger("Tab key trigger suggestions","editor.action.triggerSuggest",{})))}),this.commandEditor.addCommand(Ft.CtrlCmd|Zt.KeyF,()=>{}),Ge.removeConflictingKeybindings(this.commandEditor),Ge.registerPasteHandler(this.commandEditor),this.commandEditor.focus(),this.updateDimensions(),this.setState({model:this.commandEditor.getModel()})}destroyCommandEditor(){const{session:e}=this.props;this.commandEditor&&(Ge.closeDocument(this.commandEditor,e),this.commandEditor.dispose(),this.commandEditor=void 0)}handleWindowResize(){this.updateDimensions()}isSuggestionMenuActive(){var e,t,n;return this.commandSuggestionContainer||(this.commandSuggestionContainer=(t=(e=this.commandEditor)==null?void 0:e.getDomNode())==null?void 0:t.querySelector(".suggest-widget")),(n=this.commandSuggestionContainer&&this.commandSuggestionContainer.classList.contains("visible"))!=null?n:!1}isSuggestionMenuPopulated(){var e,t,n;return this.isSuggestionMenuActive()&&((n=(t=(e=this.commandSuggestionContainer)==null?void 0:e.querySelector(".monaco-list-rows"))==null?void 0:t.childElementCount)!=null?n:0)>0}focus(){var e;(e=this.commandEditor)==null||e.focus()}focusStart(){var s,o,i,r,l;const e=(s=this.commandEditor)==null?void 0:s.getModel();O(e);const t=e.getLineLength(1)+1,n=(o=this.commandEditor)==null?void 0:o.getTopForPosition(1,t);O(n),(i=this.commandEditor)==null||i.setPosition({lineNumber:1,column:t}),(r=this.commandEditor)==null||r.setScrollTop(n),(l=this.commandEditor)==null||l.focus()}focusEnd(){var o,i,r,l,a;const e=(o=this.commandEditor)==null?void 0:o.getModel();O(e);const t=e.getLineCount(),n=e.getLineLength(t)+1,s=(i=this.commandEditor)==null?void 0:i.getTopForPosition(t,n);O(s),(r=this.commandEditor)==null||r.setPosition({lineNumber:t,column:n}),(l=this.commandEditor)==null||l.setScrollTop(s),(a=this.commandEditor)==null||a.focus()}clear(){var e,t,n;(e=this.commandEditor)==null||e.focus(),(n=(t=this.commandEditor)==null?void 0:t.getModel())==null||n.setValue(""),this.commandHistoryIndex=null}layoutEditor(){this.commandEditor&&this.commandEditor.layout()}loadCommand(e){var s,o;if(e===null||e>=this.history.length)return;const t=this.modifiedCommands.get(e),n=e===null?"":this.history[this.history.length-e-1];this.commandHistoryIndex=e,(o=(s=this.commandEditor)==null?void 0:s.getModel())==null||o.setValue(t!=null?t:n),e!==null&&e>this.history.length-Qi&&this.loadMoreHistory()}async loadMoreHistory(){try{if(this.loadingPromise!=null||this.bufferIndex==null)return;const{commandHistoryStorage:e,language:t,scope:n}=this.props;this.loadingPromise=Ue.makeCancelable(e.getTable(t,n!=null?n:"",this.timestamp),i=>i.close());const s=await this.loadingPromise;s.setReversed(!0),s.setViewport({top:this.bufferIndex,bottom:this.bufferIndex+Qi-1}),this.loadingPromise=Ue.makeCancelable(s.getViewportData(),()=>s.close());const o=await this.loadingPromise;this.bufferIndex+=Qi,this.bufferIndex>=s.size&&(this.bufferIndex=null),this.history=[...o.items.filter(({name:i},r,l)=>r===0||i!==l[r-1].name).map(({name:i})=>i).reverse(),...this.history],this.loadingPromise=void 0,s.close()}catch(e){if(this.loadingPromise=void 0,Ue.isCanceled(e)){Yi.debug2("Promise canceled, not loading history");return}Yi.error("Error fetching history",e)}}processCommand(e){this.commandHistoryIndex=null,this.modifiedCommands.clear(),O(e),e!==""&&(this.history.length===0||e!==this.history[this.history.length-1])&&this.history.push(e),this.updateDimensions();const{onSubmit:t}=this.props;t(e)}updateDimensions(){if(!this.commandEditor)return;const{maxHeight:e}=this.props;O(e);const t=this.commandEditor.getContentHeight(),n=Math.max(Math.min(t,e),wf),o={overviewRulerLanes:t>n?void 0:0};this.setState({commandEditorHeight:n},()=>{var i,r;(i=this.commandEditor)==null||i.updateOptions(o),(r=this.commandEditor)==null||r.layout()})}render(){const{disabled:e,language:t,session:n}=this.props,{commandEditorHeight:s,isFocused:o,model:i}=this.state;return h("div",{className:B("console-input-wrapper",{disabled:e}),children:R("div",{className:B("console-input-inner-wrapper",{focus:o}),children:[h("div",{className:bc.INPUT_CLASS_NAME,ref:this.commandContainer,style:{height:s}}),i&&h(Cc,{model:i,language:t,session:n})]})})}};let di=bc;di.defaultProps={maxHeight:ci*10,scope:null,disabled:!1};di.INPUT_CLASS_NAME="console-input";const Vl="pasted values",Sf=[/^audio.*/,/^font.*/,/^image.*/,/^video.*/],ji=[".csv",".tsv",".tab",".psv",".dsv",".txt"],Ul=[".zip"],Ls=class extends T.exports.Component{constructor(e){super(e),this.getValidExtensions=Ie(t=>t?[...ji,...Ul]:[...ji]),this.getAcceptString=Ie(t=>this.getValidExtensions(t).join(", ")),this.getFileTypeErrorString=Ie(t=>Tr.join(this.getValidExtensions(t),"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=te.createRef(),this.divElem=te.createRef(),this.state={selectedFileName:""}}static isValidDropItem(e){return e!=null&&e.kind==="file"&&!Sf.find(t=>t.test(e.type))}static isValidExtension(e,t=!1){return ji.some(n=>e.endsWith(n))||t&&Ul.some(n=>e.endsWith(n))}static handleDragOver(e){e.preventDefault(),e.stopPropagation()}static getIcon(e){return e===Vl?sl:e.endsWith(".csv")?Tu:e.endsWith(".zip")?jd:Ru}componentDidMount(){var e,t;(e=this.divElem.current)==null||e.addEventListener("paste",this.handlePasteEvent),(t=this.divElem.current)==null||t.focus()}componentWillUnmount(){var e;(e=this.divElem.current)==null||e.removeEventListener("paste",this.handlePasteEvent)}handleSelectFile(){var e;this.fileElem.current&&(this.fileElem.current.value="",(e=this.fileElem.current)==null||e.click())}handleFiles(e){e.stopPropagation(),e.preventDefault();const{files:t}=e.target;t!=null&&this.handleFile(t[0])}handleDrop(e){const{allowZip:t,clearDragError:n,dragError:s}=this.props;if(e.preventDefault(),e.stopPropagation(),s!=null){n();return}if(e.dataTransfer==null||e.dataTransfer.items==null||e.dataTransfer.items.length===0)return;const o=e.dataTransfer.items[0].getAsFile();O(o),Ls.isValidExtension(o.name,t)?this.handleFile(o):this.setState({dropError:Ls.FILE_TYPE_ERROR})}unstageFile(e){const{onCancel:t}=this.props;e.stopPropagation(),e.preventDefault(),t(),this.setState({selectedFileName:"",dropError:void 0})}handleFile(e){const{onFileOpened:t}=this.props;t(e),this.setState({selectedFileName:e.name,dropError:void 0})}handleMenuPaste(){const{onPaste:e,onError:t,uploadInProgress:n}=this.props;n||navigator.clipboard.readText().then(s=>{e(s),this.setState({selectedFileName:Vl,dropError:void 0})}).catch(s=>t(s))}handlePasteEvent(e){e.stopPropagation(),e.preventDefault(),this.handleMenuPaste()}makeContextMenuItems(){const{uploadInProgress:e}=this.props;return[{title:"Paste",icon:sl,action:this.handleMenuPaste,shortcut:Nr.PASTE,disabled:e}]}render(){const{allowZip:e,dragError:t,uploadInProgress:n}=this.props,{selectedFileName:s,dropError:o}=this.state,i=t!=null?t:o,r=this.makeContextMenuItems();return R("div",{ref:this.divElem,className:"csv-overlay fill-parent-absolute",onDragOver:Ls.handleDragOver,onDrop:this.handleDrop,tabIndex:-1,children:[h(re,{actions:r}),h("input",{ref:this.fileElem,type:"file",id:"fileElem",accept:this.getAcceptString(e),style:{display:"none"},onChange:this.handleFiles,"data-testid":"fileElem"}),!s&&(i===void 0||i==="")&&R("div",{className:"message-content",children:[h("div",{className:"message-icon",children:h(Z,{icon:Eu})}),h("label",{children:"Drop file (or paste values) here to import"}),h("div",{className:"message-small",children:h("label",{children:"or"})}),h(X,{kind:"primary",onClick:this.handleSelectFile,children:"Select File..."})]}),s&&(i===void 0||i==="")&&R("div",{className:"selected-content",children:[h("div",{className:"selected-icon",children:h(Z,{icon:Ls.getIcon(s)})}),R("div",{className:"selected-text",children:[h("label",{children:"Selected File"}),R("label",{className:"selected-name",children:[s,!n&&h(X,{kind:"ghost",className:"ml-2",onClick:this.unstageFile,icon:yn,tooltip:"Remove"})]})]})]}),Boolean(i)&&R("div",{className:"message-content",children:[h("div",{className:"message-icon",children:h(Z,{icon:Yn})}),h("label",{children:i}),i===Ls.FILE_TYPE_ERROR&&h("div",{className:"message-small",children:h("label",{children:this.getFileTypeErrorString(e)})})]})]})}};let bn=Ls;bn.defaultProps={allowZip:!1,dragError:null};bn.MULTIPLE_FILE_ERROR="Please select only one file";bn.FILE_TYPE_ERROR="Filetype not supported.";class Se{}Se.INTEGER="int";Se.LONG="long";Se.DOUBLE="double";Se.BOOLEAN="bool";Se.STRING="string";Se.DATE_TIME="datetime";Se.LOCAL_TIME="localtime";const Bl="unknown",bf=2147483647,vf=-2147483648,Gl=/^[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]+)?$/,zl=/^([0-9]+T)?([0-9]+):([0-9]+)(:[0-9]+)?(?:\.[0-9]{1,9})?$/;class ot{static determineType(t,n,s){if(!t||t===s)return n;switch(n){case Se.STRING:return Se.STRING;case Se.INTEGER:return ot.checkInteger(t);case Se.LONG:return ot.checkLong(t);case Se.DOUBLE:return ot.checkDouble(t);case Se.BOOLEAN:return ot.checkBoolean(t);case Se.DATE_TIME:return ot.checkDateTime(t);case Se.LOCAL_TIME:return ot.checkLocalTime(t);default:return ot.getTypeFromUnknown(t)}}static isNotParsableNumber(t){return isNaN(t)||t==="Infinity"||t==="-Infinity"}static checkInteger(t){const n=t.replace(/,/g,"");return ot.isNotParsableNumber(n)?Se.STRING:ot.getNumberType(n)}static checkLong(t){const n=t.replace(/,/g,"");return ot.isNotParsableNumber(n)?Se.STRING:n.includes(".")?Se.DOUBLE:Se.LONG}static checkDouble(t){const n=t.replace(/,/g,"");return ot.isNotParsableNumber(n)?Se.STRING:Se.DOUBLE}static checkBoolean(t){const n=t.toLowerCase();return n==="true"||n==="false"?Se.BOOLEAN:Se.STRING}static checkDateTime(t){return Gl.test(t)?Se.DATE_TIME:Se.STRING}static checkLocalTime(t){return zl.test(t)?Se.LOCAL_TIME:Se.STRING}static getTypeFromUnknown(t){const n=t.replace(/,/g,"");if(ot.isNotParsableNumber(n)){const s=t.toLowerCase();return s==="true"||s==="false"?Se.BOOLEAN:Gl.test(t)&&t.includes(":")?Se.DATE_TIME:zl.test(t)?Se.LOCAL_TIME:Se.STRING}return ot.getNumberType(n)}static getNumberType(t){if(t.includes("."))return Se.DOUBLE;const n=t.startsWith("-")?11:10;if(t.length>n)return Se.LONG;const s=parseInt(t,10);return s>bf||s<vf?Se.LONG:Se.INTEGER}constructor(t,n,s,o,i,r,l,a,c,d){this.onFileCompleted=t,this.file=n,this.readHeaders=s,this.nullString=i,this.onProgress=r,this.onError=l,this.chunks=0,this.totalChunks=a,this.isZip=c,this.shouldTrim=d,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={...o,error:this.handleError,chunk:this.handleChunk,complete:this.handleComplete}}parse(){const t=this.isZip?this.file.nodeStream("nodebuffer",this.handleNodeUpdate):this.file;tr.parse(t,this.config)}handleChunk(t,n){let{data:s}=t;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(Bl),this.readHeaders&&(s=s.slice(1))}O(this.types);const o=[...this.types];s.forEach(l=>{if(l.length>=o.length){for(let a=0;a<o.length;a+=1)o[a]=ot.determineType(this.shouldTrim?l[a].trim():l[a],o[a],this.nullString);this.types=o}else n.abort(),this.onError(`Error parsing CSV: Insufficient data in row.
|
|
11
|
+
making ${Math.min(Un.SNAPSHOT_BUFFER_SIZE-this.snapshotsBuffer.size-this.snapshotPending,this.snapshotsTotal-this.snapshotCounter)} more snapshots
|
|
12
|
+
`),this.makeSnapshot(Math.min(Un.SNAPSHOT_BUFFER_SIZE-this.snapshotsBuffer.size-this.snapshotPending,this.snapshotsTotal-this.snapshotCounter)))}updateDownloadProgress(e){if(e!=null&&this.snapshotsTotal!=null&&this.downloadStartTime!=null){const{onDownloadProgressUpdate:t}=this.props,n=Math.floor(e*100/this.snapshotsTotal),s=e>1?Math.floor((Date.now()-this.downloadStartTime)*(this.snapshotsTotal-e)/e/1e3):null;t(n,s)}}convertSnapshotIntoCsv(e){var r;let t="";const n=e.added.iterator(),{formatter:s}=this.props,o=[];for(;n.hasNext();)o.push(n.next().value);O(this.columns);const{useUnformattedValues:i}=this;for(let l=0;l<o.length;l+=1){const a=o[l];for(let c=0;c<this.columns.length;c+=1){const{type:d,name:u}=this.columns[c];let m=null;if(i){let p=(r=e.getData(a,this.columns[c]))!=null?r:"";p!==""&&x.isDateType(d)&&(p=I.i18n.DateTimeFormat.format(Fp,p,I.i18n.TimeZone.getTimeZone(s.timeZone))),m=p.toString()}else{const p=this.getCachedCustomColumnFormatFlag(s,u,d);let g=null;if(!p){const f=e.getFormat(a,this.columns[c]);g=(f==null?void 0:f.formatString)!=null?f:null}g?m=s.getFormattedString(e.getData(a,this.columns[c]),d,u,g):m=s.getFormattedString(e.getData(a,this.columns[c]),d,u)}t+=Un.csvEscapeString(m),t+=c===this.columns.length-1?`
|
|
13
|
+
`:","}}return t}makeSnapshot(e){if(e<=0)return;O(this.gridRangeCounter);let t=0,n=this.gridRanges[this.gridRangeCounter];for(O(this.tableSubscription),O(this.columns);t<e;){O(n),O(n.startRow),O(n.endRow),O(this.rangedSnapshotCounter),O(this.chunkRows);const s=n.startRow+this.rangedSnapshotCounter*this.chunkRows,o=Math.min(s+this.chunkRows-1,n.endRow),i=this.snapshotCounter;this.cancelableSnapshots.push(Ue.makeCancelable(this.tableSubscription.snapshot(I.RangeSet.ofRange(s,o),this.columns).then(r=>(Ap(r),this.handleSnapshotResolved(r,i,s,o),i)).catch(r=>{un.error(r)}),r=>{un.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]),t+=1}}handlePortMessage({data:e}){const{download:t,readableStreamPulling:n}=e;if(!this.useBlobFallback){if(t!=null){const{includeColumnHeaders:s}=this;this.makeIframe(`${t}`),this.writeCsvTable(s)}n!=null&&(this.useBlobFallback||(this.streamTimeout!=null&&clearTimeout(this.streamTimeout),this.streamTimeout=setTimeout(this.handleDownloadTimeout,Un.STREAM_TIMEOUT)))}}handleSnapshotResolved(e,t,n,s){this.snapshotHandlerTimeout=setTimeout(()=>{this.snapshotsBuffer.set(t,e),this.snapshotPending-=1,this.writeSnapshot(t,n,s),this.cancelableSnapshots[t]=null},Un.SNAPSHOT_HANDLER_TIMEOUT)}makeIframe(e){const t=document.createElement("iframe");t.hidden=!0,t.src=`download/${e}`,t.name="iframe",document.body.appendChild(t),this.iframes.push(t)}render(){return null}};let qs=Un;qs.DOWNLOAD_CELL_CHUNK=6e3;qs.SNAPSHOT_BUFFER_SIZE=5;qs.STREAM_TIMEOUT=8e3;qs.SNAPSHOT_HANDLER_TIMEOUT=5;qs.defaultProps={getDownloadWorker:()=>Promise.reject(new Error("Download worker not provided")),isDownloading:!1,onDownloadCompleted:()=>{},onDownloadCanceled:()=>{},onDownloadProgressUpdate:()=>{}};function Op(e){var v;const{group:t,onDelete:n,onColorChange:s,onNameChange:o,validateName:i}=e,{isNew:r}=t,l=T.exports.useRef(t),a=T.exports.useRef(null),c=T.exports.useRef(null),[d,u]=T.exports.useState(r?"":t.name),[m,p]=T.exports.useState(r),[g,f]=T.exports.useState(!1),w=d!==t.name?i(d):"",C=r&&!g||w==="";T.exports.useEffect(function(){m&&a.current&&(a.current.focus(),a.current.select())},[m]),T.exports.useEffect(function(){return()=>{l.current.isNew&&n(l.current)}},[n]);const S=()=>{C&&(o(t,d),p(!1))},b=()=>{if(r){n(t);return}u(t.name),p(!1)},E=y=>{f(!0),y.key==="Enter"&&(y.stopPropagation(),S()),y.key===" "&&y.stopPropagation(),y.key==="Escape"&&b()};return m?R(Fe,{children:[R("div",{className:"editing-container",children:[h("input",{ref:a,className:B("form-control",{"is-invalid":!C}),value:d,placeholder:"Group Name",onChange:y=>u(y.target.value),onKeyDown:E}),h(X,{kind:"ghost",icon:Xn,tooltip:"Confirm",onClick:S}),h(X,{kind:"ghost",icon:Kd,tooltip:"Cancel",onClick:b})]}),!C&&h("p",{className:"mb-0 validate-label-error text-danger",children:w})]}):R("div",{className:"group-name-wrapper",children:[h("span",{className:"column-name",children:d}),h(X,{className:"p-1 mx-1",kind:"ghost",icon:pr,tooltip:"Edit",onClick:()=>{p(!0)}}),R("span",{className:"right-buttons",children:[h(X,{kind:"ghost",icon:Rn,tooltip:"Delete group",onClick:()=>n(t)}),h(X,{kind:"ghost",className:"color-swatch mr-1",icon:t.color!==void 0?R("span",{className:"fa-layers",children:[h(Z,{className:"color-swatch",icon:ii,color:Le.white,transform:"down-1"}),h(Z,{className:"color-swatch",icon:ii,color:t.color,transform:"shrink-2 down-1"})]}):lu,tooltip:"Set color",onClick:()=>{var y,M;(y=c.current)==null||y.click(),(M=c.current)==null||M.focus()}}),h("input",{"aria-label":"Color input",ref:c,type:"color",list:"presetColors",value:(v=t.color)!=null?v:Le["content-bg"],style:{visibility:"hidden",width:0,height:0,padding:0,border:0},onChange:y=>{t.color=y.target.value,s(t,y.target.value)}}),R("datalist",{id:"presetColors",children:[h("option",{children:Le["content-bg"]}),h("option",{children:Le.primary}),h("option",{children:Le.foreground}),h("option",{children:Le.green}),h("option",{children:Le.yellow}),h("option",{children:Le.orange}),h("option",{children:Le.red}),h("option",{children:Le.purple}),h("option",{children:Le.blue}),h("option",{children:Le["gray-400"]})]})]})]})}function kp(){}const Lp=T.exports.forwardRef(function(t,n){const{value:s,clone:o,childCount:i,item:r,onVisibilityChange:l,onClick:a,onGroupDelete:c,onGroupColorChange:d,onGroupNameChange:u,validateGroupName:m,handleProps:p}=t,{group:g,modelIndex:f,isVisible:w}=r.data,C=T.exports.useRef(null),S=T.exports.useCallback(E=>{var v;E.buttons===1&&(l([f].flat(),!w),(v=C.current)==null||v.focus())},[l,f,w]),b=T.exports.useCallback(E=>{a(s,E)},[a,s]);return R("div",{ref:n,className:B("tree-item",{isSelected:r.selected,"two-dragged":i===2,"multiple-dragged":i>2}),onClick:b,...p,children:[h(X,{ref:C,kind:"ghost",className:"px-1",onClick:kp,onMouseDown:S,onMouseEnter:S,icon:w?gr:ua,tooltip:"Toggle visibility"}),h("span",{className:B("column-name",g&&"column-group"),children:g&&!o?h(Op,{group:g,onDelete:c,onColorChange:d,onNameChange:u,validateName:m}):s}),R("div",{children:[o&&i>1&&h("span",{className:"item-count",children:i}),h(We,{children:"Drag to re-order"}),h(Z,{icon:Ci})]})]})});function Pp(e){return e.parentId!==void 0}function Hp(e,t){return Math.round(e/t)}function ec(e,t,n,s,o,i){const r=e.findIndex(l=>l.name===s);if(r===-1){const l=n.get(s);if(l==null)throw new Error(`Column or header group not found: ${s}`);const a=l.childIndexes.flat();return{id:s,selected:i.has(s),children:l.children.map(c=>ec(e,t,n,c,o,i)).sort((c,d)=>{const u=Array.isArray(c.data.visibleIndex)?c.data.visibleIndex[0]:c.data.visibleIndex,m=Array.isArray(d.data.visibleIndex)?d.data.visibleIndex[0]:d.data.visibleIndex;return u-m}),data:{modelIndex:a,visibleIndex:l.getVisibleRange(t),group:l,isVisible:a.some(c=>!o.has(c))}}}return{id:s,children:[],selected:i.has(s),data:{modelIndex:r,visibleIndex:W.getVisibleIndex(r,t),isVisible:!o.has(r)}}}function _p(e,t,n,s,o){const i=[],r=new Set(o),l=new Map(n.map(d=>[d.name,d])),a=new Set(s);let c=0;for(;c<e.length;){const d=W.getModelIndex(c,t),u=e[d].name;let m=n.find(({children:g})=>g.includes(u));for(;m!==void 0&&m.parent!==void 0;)m=l.get(m.parent);const p=ec(e,t,l,m?m.name:u,a,r);i.push(p),Array.isArray(p.data.visibleIndex)?c+=p.data.visibleIndex[1]-p.data.visibleIndex[0]+1:c+=1}return i}function ai(e,t,n,s,o){const i=e.findIndex(({id:C})=>C===n),r=e.findIndex(({id:C})=>C===t),l=e[r],a=Hc(e,r,i),c=a[i-1],d=a[i+1],u=Hp(s,o),m=l.depth+u,p=Vp({previousItem:c,nextItem:d}),g=Up({nextItem:d});let f=m;return m>=p?f=p:m<g&&(f=g),{depth:f,maxDepth:p,minDepth:g,parentId:w()};function w(){var S;if(f===0||!c)return null;if(f===c.depth)return c.parentId;if(f>c.depth)return c.id;const C=(S=a.slice(0,i).reverse().find(b=>b.depth===f))==null?void 0:S.parentId;return C!=null?C:null}}function Vp({previousItem:e,nextItem:t}){var n,s;return Math.max((n=e==null?void 0:e.depth)!=null?n:0,(s=t==null?void 0:t.depth)!=null?s:0)}function Up({nextItem:e}){return e?e.depth:0}function tc(e,t=null,n=0){return e.reduce((s,o,i)=>[...s,{...o,parentId:t,depth:n,index:i},...tc(o.children,o.id,n+1)],[])}function Nt(e){return e.every(Pp)?[...e]:tc(e)}function nc(e,t){for(let n=0;n<e.length;n+=1){const s=e[n],{id:o,children:i}=s;if(o===t)return s;if(i.length){const r=nc(i,t);if(r)return r}}}function sc(e,t=0){return e.reduce((n,{children:s})=>s.length?sc(s,n+1):n+1,t)}function Bp(e,t){const n=nc(e,t);return n?sc(n.children):0}const Gp=[Jt.Down,Jt.Right,Jt.Up,Jt.Left],zp=[Jt.Left,Jt.Right];function Wp(e,t,n){return(s,{currentCoordinates:o,context:{active:i,over:r,collisionRect:l,droppableRects:a,droppableContainers:c}})=>{if(Gp.includes(s.code)){if(!i||!l)return;s.preventDefault();const{current:{items:d,offset:u}}=e;if(zp.includes(s.code)&&(r==null?void 0:r.id)!=null){const{depth:f,maxDepth:w,minDepth:C}=ai(d,i.id,r.id,u,n);switch(s.code){case Jt.Left:if(f>C)return{...o,x:o.x-n};break;case Jt.Right:if(f<w)return{...o,x:o.x+n};break}return}const m=[];c.forEach(f=>{if((f==null?void 0:f.disabled)||f.id===(r==null?void 0:r.id))return;const w=a.get(f.id);if(!!w)switch(s.code){case Jt.Down:l.top<w.top&&m.push(f);break;case Jt.Up:l.top>w.top&&m.push(f);break}});const p=_c({active:i,collisionRect:l,pointerCoordinates:null,droppableRects:a,droppableContainers:m});let g=Vc(p,"id");if(g===(r==null?void 0:r.id)&&p.length>1&&(g=p[1].id),g!=null&&(r==null?void 0:r.id)!=null){const f=a.get(i.id),w=a.get(g),C=c.get(g);if(f&&w&&C){const S=d.findIndex(({id:y})=>y===g),b=d[S],E=d.findIndex(({id:y})=>y===i.id),v=d[E];if(b!=null&&v!=null){const{depth:y}=ai(d,i.id,g,(b.depth-v.depth)*n,n),A=S>E?1:-1,F=t?(l.height-f.height)/2:0;return{x:w.left+y*n,y:w.top+A*F}}}}}}}class oc extends Uc{}oc.activators=[{eventName:"onPointerDown",handler:({nativeEvent:e})=>!(!e.isPrimary||e.button!==0||qp(e.target))}];const $p=["button","input","textarea","select","option"];function qp(e){return!!((e==null?void 0:e.tagName)!=null&&$p.includes(e.tagName.toLowerCase()))}function ic(e){const{clone:t=!1,depth:n,disableInteraction:s=!1,ghost:o=!1,handleProps:i,value:r,dragRef:l=null,wrapperRef:a=null,renderItem:c,item:d,childCount:u}=e,m=T.exports.useMemo(()=>Array(n).fill(0).map((g,f)=>h("span",{className:"depth-line"},`depth-line-${f}`)),[n]),p=T.exports.useMemo(()=>({ref:l,clone:t,value:r,item:d,childCount:u,handleProps:i}),[l,t,r,d,u,i]);return R("li",{className:B("item-wrapper",{clone:t,ghost:o,disableInteraction:s}),ref:a,children:[!t&&m,c(p)]},r)}ic.displayName="TreeItem";const Kp=({isSorting:e,wasDragging:t})=>!(e||t);function kl({id:e,depth:t,...n}){const{attributes:s,isDragging:o,isSorting:i,listeners:r,setDraggableNodeRef:l,setDroppableNodeRef:a,transform:c,transition:d}=Bc({id:e,animateLayoutChanges:Kp}),u=er.Translate.toString(c),m=T.exports.useMemo(()=>({transform:u,transition:d}),[u,d]),p=T.exports.useMemo(()=>({...s,...r,style:m}),[s,r,m]);return h(ic,{dragRef:l,wrapperRef:a,depth:t,ghost:o,disableInteraction:i,handleProps:p,...n})}const Xp={keyframes({transform:e}){return[{opacity:1,transform:er.Transform.toString(e.initial)},{opacity:0,transform:er.Transform.toString({...e.final,x:e.final.x+5,y:e.final.y+5})}]},easing:"ease-out",sideEffects({active:e}){e.node.animate([{opacity:0},{opacity:1}],{duration:Zr.duration,easing:Zr.easing})}};let Ds=null;function Yp(e){return Ds==null&&e.activeNodeRect&&e.activatorEvent instanceof PointerEvent&&(Ds=Math.floor((e.activatorEvent.clientY-e.activeNodeRect.top)/e.activeNodeRect.height)*e.activeNodeRect.height),e.activeNodeRect||(Ds=null),{...e.transform,y:e.transform.y+(Ds!=null?Ds:0)}}function Qp({items:e,renderItem:t,indentationWidth:n=30,indicator:s=!1,activeId:o,overId:i,offsetLeft:r}){const l=Gc(),a=T.exports.useRef(l);T.exports.useEffect(function(){a.current=l},[l]),T.exports.useEffect(function(){a.current.measureDroppableContainers(e.map(({id:p})=>p))},[e]);const c=o!=null&&i!=null?ai(e,o,i,r,n):null,d=T.exports.useRef({items:e,offset:r}),u=o!=null?e.find(({id:m})=>m===o):null;return T.exports.useEffect(()=>{d.current={items:e,offset:r}},[e,r]),R(Fe,{children:[h("div",{className:B("tree-container",o!=null&&"marching-ants"),children:e.map(m=>{const{id:p,depth:g}=m;return h(kl,{id:p,value:p,depth:p===o&&c?c.depth:g,item:m,renderItem:t},p)})}),zc.exports.createPortal(h(Wc,{dropAnimation:Xp,modifiers:[Yp],className:"visibility-ordering-list",children:o!=null&&u?h(kl,{id:o,depth:u.depth,clone:!0,childCount:Bp(e,o)+1,value:o.toString(),renderItem:t,item:u}):null}),document.body)]})}const jp={droppable:{strategy:$c.Always}},Zp={activationConstraint:{distance:5}};function Jp({items:e,indicator:t=!1,indentationWidth:n=30,onDragStart:s,onDragEnd:o,renderItem:i}){const[r,l]=T.exports.useState(null),[a,c]=T.exports.useState(null),[d,u]=T.exports.useState(0),m=T.exports.useMemo(()=>{const A=Nt(e);return r!=null?A.filter(({id:F,selected:V})=>F===r||!V):A},[r,e]),p=r!=null&&a!=null?ai(m,r,a,d,n):null,g=T.exports.useRef({items:m,offset:d}),f=T.exports.useMemo(()=>({coordinateGetter:Wp(g,t,n)}),[n,t]),w=qc(Jr(oc,Zp),Jr(jc,f)),C=T.exports.useMemo(()=>m.map(({id:A})=>A),[m]);T.exports.useEffect(()=>{g.current={items:m,offset:d}},[m,d]);const S=T.exports.useCallback(({active:{id:A}})=>{l(A),c(A),s==null||s(A),document.body.style.setProperty("cursor","grabbing")},[s]),b=T.exports.useCallback(({delta:A})=>{u(A.x)},[]),E=T.exports.useCallback(({over:A})=>{var F;c((F=A==null?void 0:A.id)!=null?F:null)},[]),v=T.exports.useCallback(()=>{c(null),l(null),u(0),document.body.style.setProperty("cursor","")},[]),y=T.exports.useCallback(({active:A,over:F})=>{if(v(),p&&F){const{depth:V,parentId:H}=p,N=JSON.parse(JSON.stringify(Nt(e))),P=N.findIndex(({id:K})=>K===F.id),k=N.findIndex(({id:K})=>K===A.id),z=N[k];N[k]={...z,depth:V,parentId:H},o==null||o(z,{...N[P],parentId:p.parentId})}},[e,o,p,v]),M=T.exports.useCallback(()=>{v()},[v]);return h(Kc,{sensors:w,collisionDetection:Xc,measuring:jp,onDragStart:S,onDragMove:b,onDragOver:E,onDragEnd:y,onDragCancel:M,children:h(Yc,{items:C,strategy:Qc,children:h(Qp,{items:m,renderItem:i,indicator:t,indentationWidth:n,activeId:r,overId:a,offsetLeft:d})})})}function eg(e,t,n,s,o,i,r,l){const a=o.map((S,b)=>({...S,index:b}));let c=[],d=s;const u=i[0].data.visibleIndex,m=a.findIndex(({id:S})=>S===e.id),p=a.findIndex(({id:S})=>S===t.id);let g=Array.isArray(u)?u[1]+1:u+1;d=zn(i[0],t.parentId,d);for(let S=1;S<i.length;S+=1){const{data:{visibleIndex:b}}=i[S];c=W.moveItemOrRange(b,g,c,!0),g+=Array.isArray(b)?b[1]-b[0]+1:1,d=zn(i[S],t.parentId,d)}const f=[Array.isArray(u)?u[0]:u,g-1],w=Array.isArray(t.data.visibleIndex)?t.data.visibleIndex[0]:t.data.visibleIndex;let C=W.getVisibleIndex(w,c);return m>p&&C>w&&(C-=1),t.children.length>0&&(Array.isArray(u)?u[0]:u)<C&&(C-=1),f[0]<C&&(C-=f[1]-f[0]),c=W.moveItemOrRange(f,ze(C,r,l),c),{groups:d,movedColumns:n.concat(c)}}function zn(e,t,n){var a;if(e.parentId===t)return[...n];let s=n.map(c=>new jt(c));const o=new Map(s.map(c=>[c.name,c])),i=s.find(c=>c.name===e.parentId),r=s.find(c=>c.name===t),l=s.find(c=>c.name===e.id);if(i!=null&&(i.children=i.children.filter(c=>c!==e.id),i.children.length===0)){const c=new Set([i.name]),{parent:d=""}=i;let u=o.get(d);for(u==null||u.removeChildren([i.name]);u&&u.children.length===0;){c.add(u.name);const m=(a=u==null?void 0:u.parent)!=null?a:"",p=o.get(m);p==null||p.removeChildren([u.name]),u=p}s=s.filter(({name:m})=>!c.has(m))}return r!=null&&r.addChildren([e.id]),l==null||l.setParent(t!=null?t:void 0),s}const tg=150,Je=class extends T.exports.Component{constructor(e){super(e),this.debouncedSearchColumns=ft(this.searchColumns,tg),this.handleGroupColorChange=Zn((t,n)=>{const{columnHeaderGroups:s,onColumnHeaderGroupChanged:o}=this.props,i=[...s],r=new jt({...t,color:n});i.splice(i.findIndex(({name:l})=>l===t.name),1,r),o(i)},250),this.renderItem=he(({value:t,clone:n,item:s,ref:o,handleProps:i})=>{const{onColumnVisibilityChanged:r}=this.props,{selectedColumns:l}=this.state;let a=t;return n&&(a=this.getSelectedParentItems().map(({id:d})=>d).join(", ")),h(Lp,{ref:o,value:a,clone:n,item:s,childCount:l.size,onVisibilityChange:r,onClick:this.handleItemClick,onGroupDelete:this.handleGroupDelete,onGroupColorChange:this.handleGroupColorChange,onGroupNameChange:this.handleGroupNameChange,validateGroupName:this.validateGroupName,handleProps:i})}),this.getMemoizedFirstMovableIndex=he((t,n,s)=>{for(let o=0;o<n.length;o+=1){const i=W.getModelIndex(o,s);if(t.isColumnMovable(i))return o}return null}),this.getMemoizedLastMovableIndex=he((t,n,s)=>{for(let o=n.length-1;o>=0;o-=1){const i=W.getModelIndex(o,s);if(t.isColumnMovable(i))return o}return null}),this.memoizedGetTreeItems=he((t,n,s,o,i)=>_p(t,n,s,o,[...i.values()])),this.makeVisibilityOrderingList=he((t,n)=>{const{movedColumns:s}=this.props,o=[],i=this.getFirstMovableIndex(),r=this.getLastMovableIndex(),l=n.findIndex(({data:d})=>Array.isArray(d.visibleIndex)?d.visibleIndex[0]===i:d.visibleIndex===i),a=n.findIndex(({data:d})=>Array.isArray(d.visibleIndex)?d.visibleIndex[1]===r:d.visibleIndex===r),c=n.slice(l,a+1);if(i==null||r===null){for(let d=0;d<t.length;d+=1){const u=W.getModelIndex(d,s),m=t[u];o.push(this.renderImmovableItem(m.name))}return o}for(let d=0;d<i;d+=1){const u=W.getModelIndex(d,s),m=t[u];o.push(this.renderImmovableItem(m.name))}i!==null&&i>0&&o.push(h("hr",{},"top-horizontal-divider")),o.push(h(Jp,{items:c,renderItem:this.renderItem,onDragStart:this.handleDragStart,onDragEnd:this.handleDragEnd},"movable-items")),r!=null&&r<t.length-1&&o.push(h("hr",{},"bottom-horizontal-divider"));for(let d=r+1;d<t.length;d+=1){const u=W.getModelIndex(d,s),m=t[u];o.push(this.renderImmovableItem(m.name))}return o}),this.renderImmovableItem=he(t=>h("div",{className:"visibility-ordering-list-item immovable",children:h("div",{className:"column-item",children:h("span",{className:"column-name",children:t})})},t)),this.handleSearchInputChange=this.handleSearchInputChange.bind(this),this.searchColumns=this.searchColumns.bind(this),this.handleItemClick=this.handleItemClick.bind(this),this.handleDragEnd=this.handleDragEnd.bind(this),this.handleGroupDelete=this.handleGroupDelete.bind(this),this.handleGroupNameChange=this.handleGroupNameChange.bind(this),this.handleGroupCreate=this.handleGroupCreate.bind(this),this.validateGroupName=this.validateGroupName.bind(this),this.addColumnToSelected=this.addColumnToSelected.bind(this),this.handleDragStart=this.handleDragStart.bind(this),this.state={selectedColumns:new Set,lastSelectedColumn:"",searchFilter:""},this.list=null}componentWillUnmount(){this.debouncedSearchColumns.cancel()}resetVisibilityOrdering(){const{model:e,onReset:t,onMovedColumnsChanged:n,onColumnHeaderGroupChanged:s}=this.props;this.setState({selectedColumns:new Set,lastSelectedColumn:"",searchFilter:""}),t(),s(e.initialColumnHeaderGroups),n(e.initialMovedColumns)}resetSelection(){this.setState({selectedColumns:new Set,lastSelectedColumn:""})}handleSearchInputChange(e){const t=e.target.value;if(this.setState({searchFilter:t}),!t){this.debouncedSearchColumns.cancel(),this.resetSelection();return}this.debouncedSearchColumns(t)}searchColumns(e){var i;const t=Nt(this.getTreeItems()),s=t.filter(({id:r})=>r.toLowerCase().includes(e.toLowerCase())).map(({id:r})=>r),o=t.findIndex(({id:r})=>r.toLowerCase().includes(e.toLowerCase()));if(this.addColumnToSelected(s,!1),s.length>0){const r=(i=this.list)==null?void 0:i.querySelectorAll(".item-wrapper")[o];r==null||r.scrollIntoView({block:"center"})}}moveSelectedColumns(e){var d;const{columnHeaderGroups:t}=this.props,{selectedColumns:n}=this.state,s=Nt(this.getTreeItems());let o=this.getFirstMovableIndex(),i=this.getLastMovableIndex();O(o),O(i);const r=this.getSelectedParentItems();e===Je.MOVE_OPTIONS.UP||e===Je.MOVE_OPTIONS.TOP||r.reverse();let a=[],c=t;for(let u=0;u<r.length;u+=1){const{id:m,parentId:p,depth:g,data:{visibleIndex:f}}=r[u];switch(e){case Je.MOVE_OPTIONS.TOP:{a=W.moveItemOrRange(f,o,a,!0),o+=Array.isArray(f)?f[1]-f[0]+1:1,c=zn(r[u],null,c);break}case Je.MOVE_OPTIONS.BOTTOM:{a=W.moveItemOrRange(f,i,a,!0),i-=Array.isArray(f)?f[1]-f[0]+1:1,c=zn(r[u],null,c);break}case Je.MOVE_OPTIONS.UP:{const w=s.findIndex(b=>b.id===m),C=s.map((b,E)=>E<w&&!n.has(b.id)).lastIndexOf(!0),S=s[C];if(S!=null&&S.parentId!==p)if(Math.abs(S.depth-g)>1){const b=s.map((v,y)=>y<C&&v.depth===g).lastIndexOf(!0),E=s[b];c=zn(r[u],E.id,c)}else c=zn(r[u],S.parentId,c);else{const b=ze(Array.isArray(f)?f[0]-1:f-1,o,i);a=W.moveItemOrRange(f,b,a,!1),o+=Array.isArray(f)?f[1]-f[0]+1:1}break}case Je.MOVE_OPTIONS.DOWN:{const w=s.findIndex(E=>E.id===m),C=s.find((E,v)=>v>w&&!n.has(E.id));if((C==null?void 0:C.parentId)!==p){const E=s.find(v=>v.id===p);c=zn(r[u],(d=E==null?void 0:E.parentId)!=null?d:null,c);break}else if((C==null?void 0:C.children.length)>0){c=zn(r[u],C.id,c);break}const S=ze(Array.isArray(f)?f[0]+1:f+1,o,i);a=W.moveItemOrRange(f,S,a,!1),i-=Array.isArray(f)?f[1]-f[0]+1:1;break}}}return{newMoves:a,groups:c}}handleMoveColumns(e){const{onMovedColumnsChanged:t,movedColumns:n,onColumnHeaderGroupChanged:s}=this.props,{newMoves:o,groups:i}=this.moveSelectedColumns(e);let r;e===Je.MOVE_OPTIONS.TOP&&(r=()=>{var l,a;(a=(l=this.list)==null?void 0:l.parentElement)==null||a.scroll({top:0})}),e===Je.MOVE_OPTIONS.BOTTOM&&(r=()=>{var l,a;(a=(l=this.list)==null?void 0:l.parentElement)==null||a.scroll({top:this.list.parentElement.scrollHeight})}),s(i),o.length>0&&t(n.concat(o),r)}getSortMoves(e,t,n){const s=[...e],o=t===Je.SORTING_OPTIONS.ASC;s.sort((l,a)=>{const c=l.id.toUpperCase(),d=a.id.toUpperCase();return Tr.sort(c,d,o)});let i=[...n],r=Math.min(...s.flatMap(l=>{const{modelIndex:a}=l.data;return Array.isArray(a)?W.getVisibleIndexes(a,i):W.getVisibleIndex(a,i)}));for(let l=0;l<s.length;l+=1){const a=s[l],{modelIndex:c}=a.data,d=Array.isArray(c)?W.getVisibleIndexes(c,i):W.getVisibleIndex(c,i);i=Array.isArray(d)?W.moveRange([Math.min(...d),Math.max(...d)],r,i,!0):W.moveItem(d,r,i),Array.isArray(d)&&(i=this.getSortMoves(a.children,t,i)),r+=Array.isArray(c)?c.length:1}return i}handleSortColumns(e){const{model:t,onMovedColumnsChanged:n}=this.props,s=this.getSortMoves(this.getTreeItems(),e,t.initialMovedColumns);n(s)}handleItemClick(e,t){if(t.stopPropagation(),t.target instanceof HTMLElement&&(t.target.tagName==="BUTTON"||t.target.tagName==="INPUT"))return;t.currentTarget.focus();const{selectedColumns:n,lastSelectedColumn:s}=this.state,o=W.isModifierKeyDown(t),i=t.shiftKey,r=n.has(e),l=[e];if(r&&o){this.removeColumnFromSelected(e);return}const a=Nt(this.getTreeItems());if(r&&!i&&s===e){const c=a.find(({id:u})=>u===e);if(O(c),Nt(c.children).length+1===n.size){this.resetSelection();return}}if(i){const c=a.findIndex(u=>u.id===e),d=a.findIndex(u=>u.id===s);l.push(...a.slice(Math.min(d,c),Math.max(d,c)+1).map(u=>u.id))}this.addColumnToSelected(l,o||i),this.setState({lastSelectedColumn:e})}addColumnToSelected(e,t){const{selectedColumns:n}=this.state,s=new Set(t?[...n.values()].concat(e):e);Nt(this.getTreeItems()).forEach(({id:i,children:r})=>{s.has(i)&&r.forEach(l=>s.add(l.id))}),this.setState({selectedColumns:s})}removeColumnFromSelected(e){const{selectedColumns:t}=this.state,n=Nt(this.getTreeItems()),s=n.find(({id:i})=>i===e);O(s);let o=n.find(({id:i})=>i===s.parentId);for(Nt(s==null?void 0:s.children).forEach(i=>t.delete(i.id));o!=null;){t.delete(o.id);const i=o.parentId;o=n.find(({id:r})=>r===i)}t.delete(e),this.setState({selectedColumns:new Set(t)})}handleDragStart(e){const{selectedColumns:t}=this.state;t.has(e)||this.addColumnToSelected([e],!1)}handleDragEnd(e,t){const{movedColumns:n,onMovedColumnsChanged:s,columnHeaderGroups:o,onColumnHeaderGroupChanged:i}=this.props,r=this.getSelectedParentItems(),l=Nt(this.getTreeItems()).map((m,p)=>({...m,index:p})),a=this.getFirstMovableIndex(),c=this.getLastMovableIndex();O(a),O(c);const{groups:d,movedColumns:u}=eg(e,t,n,o,l,r,a,c);i(d),s(u)}handleGroupNameChange(e,t){const{columnHeaderGroups:n,onColumnHeaderGroupChanged:s}=this.props,o=[...n],i=e.name,r=o.findIndex(({name:d})=>d===i),l=o[r];O(l);const a=new jt(l);a.name=t,o.splice(r,1,a);const c=o.findIndex(({name:d})=>d===a.parent);if(c>=0){const d=new jt(o[c]);d.removeChildren([i]),d.addChildren([t]),o.splice(c,1,d)}s(o)}handleGroupDelete(e){const{columnHeaderGroups:t,onColumnHeaderGroupChanged:n}=this.props,s=t.filter(i=>i.name!==e.name),o=s.findIndex(i=>i.name===e.parent);if(o>=0){const i=new jt(s[o]);i.addChildren(e.children),i.removeChildren([e.name]),s.splice(o,1,i)}n(s)}handleGroupCreate(){const{movedColumns:e,onMovedColumnsChanged:t,onColumnHeaderGroupChanged:n}=this.props,{newMoves:s,groups:o}=this.moveSelectedColumns(Je.MOVE_OPTIONS.TOP),i=o.filter(d=>!d.isNew),r=this.getSelectedParentItems(),l=r.map(d=>d.data.modelIndex).flat().filter(d=>d>=0),a=`${jt.NEW_GROUP_PREFIX}-${Date.now()}`,c=new jt({name:a,children:r.map(({id:d})=>d),depth:0,childIndexes:[...new Set(l)]});t(e.concat(s),()=>{var d,u;(u=(d=this.list)==null?void 0:d.parentElement)==null||u.scroll({top:0})}),n(i.concat([c])),this.resetSelection()}validateGroupName(e){const{model:t,columnHeaderGroups:n}=this.props,{columns:s}=t;return _t.isValidColumnName(e)?s.some(({name:o})=>o===e)||n.some(({name:o})=>o===e)?"Duplicate name":"":"Invalid name"}getFirstMovableIndex(){const{model:e,movedColumns:t}=this.props;return this.getMemoizedFirstMovableIndex(e,e.columns,t)}getLastMovableIndex(){const{model:e,movedColumns:t}=this.props;return this.getMemoizedLastMovableIndex(e,e.columns,t)}getTreeItems(){const{model:e,movedColumns:t,hiddenColumns:n,columnHeaderGroups:s}=this.props,{selectedColumns:o}=this.state;return this.memoizedGetTreeItems(e.columns,t,s,n,o)}getSelectedParentItems(){const{selectedColumns:e}=this.state;return Nt(this.getTreeItems()).filter(({id:n,parentId:s})=>e.has(n)&&!e.has(s!=null?s:""))}render(){const{model:e,hiddenColumns:t,onColumnVisibilityChanged:n}=this.props,{selectedColumns:s,searchFilter:o}=this.state,i=s.size>0,r=this.getTreeItems(),l=new Map(Nt(r).map(g=>[g.id,g.data.modelIndex])),a=new Set(t),c=[...new Set(i?[...s.values()].map(g=>l.get(g)).filter(g=>g!=null).flat():r.map(g=>g.data.modelIndex).flat())],d=c.some(g=>!a.has(g)),u=d?"Hide All":"Show All",m=d?"Hide Selected":"Show Selected",p=this.makeVisibilityOrderingList(e.columns,r);return R("div",{role:"menu",className:"visibility-ordering-builder",tabIndex:0,children:[R("div",{className:"top-menu",children:[h(X,{kind:"ghost",className:"toggle-visibility-btn",onClick:()=>{n(c,!d)},icon:d?gr:ua,tooltip:"Toggle column visibility",children:i?m:u}),h(Jn,{className:"visibility-search",value:o,matchCount:o?s.size:void 0,onChange:this.handleSearchInputChange})]}),R("div",{className:"top-menu",children:[h(X,{kind:"ghost",icon:uu,tooltip:"Reset to default",onClick:()=>{this.resetVisibilityOrdering()},children:"Reset"}),h("span",{className:"vertical-divider"}),h(X,{kind:"ghost",icon:Cr,tooltip:"Sort ascending",onClick:()=>{this.handleSortColumns(Je.SORTING_OPTIONS.ASC)}}),h(X,{kind:"ghost",icon:wr,tooltip:"Sort descending",onClick:()=>{this.handleSortColumns(Je.SORTING_OPTIONS.DSC)}}),h("span",{className:"vertical-divider"}),R(X,{kind:"ghost",tooltip:"Create group from selection",disabled:!i,onClick:this.handleGroupCreate,children:[R("span",{className:"fa-layers",style:{marginRight:"0.75rem"},children:[h(Z,{mask:fu,icon:fi,transform:"right-7 down-5 shrink-6"}),h(Z,{icon:Ud,transform:"right-8 down-6 shrink-8"})]}),"Group"]}),h("span",{className:"vertical-divider"}),h(X,{kind:"ghost",icon:qd,tooltip:"Move selection up",onClick:()=>{this.handleMoveColumns(Je.MOVE_OPTIONS.UP)},disabled:!i}),h(X,{kind:"ghost",icon:Wd,tooltip:"Move selection down",onClick:()=>{this.handleMoveColumns(Je.MOVE_OPTIONS.DOWN)},disabled:!i}),h(X,{kind:"ghost",icon:Su,tooltip:"Move selection to top",onClick:()=>{this.handleMoveColumns(Je.MOVE_OPTIONS.TOP)},disabled:!i}),h(X,{kind:"ghost",icon:wu,tooltip:"Move selection to bottom",onClick:()=>{this.handleMoveColumns(Je.MOVE_OPTIONS.BOTTOM)},disabled:!i})]}),h("div",{role:"menu",className:B("visibility-ordering-list"),children:h("div",{className:"column-list",ref:g=>{this.list=g},children:p})})]})}};let Vr=Je;Vr.SORTING_OPTIONS={DSC:"DSC",ASC:"ASC"};Vr.MOVE_OPTIONS={TOP:"TOP",BOTTOM:"BOTTOM",UP:"UP",DOWN:"DOWN"};class jo extends T.exports.PureComponent{constructor(t){super(t),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=te.createRef(),this.state={isConfigureColumnsShown:!1}}static createSearchFilter(t,n,s,o){const i=o?s.filter(r=>!n.includes(r.name)).map(r=>r.name):n;if(t&&i.length>0){const r=I.FilterValue.ofString(t);return i.length===s.length?I.FilterCondition.search(r):I.FilterCondition.search(r,s.filter(a=>i.includes(a.name)).map(a=>a.filter()))}}focus(){var t;(t=this.searchField.current)==null||t.focus()}handleSearchValueChange(t){const{onChange:n,selectedColumns:s,invertSelection:o}=this.props;n(t.target.value,s,o)}sendColumnChange(t,n){const{onChange:s,value:o}=this.props;s(o,t,n)}setInvertSelection(t){const{onChange:n,value:s}=this.props;n(s,[],t)}toggleColumn(t){const{selectedColumns:n,invertSelection:s}=this.props;if(n.includes(t))this.sendColumnChange(n.filter(o=>o!==t),s);else{const o=n.slice();o.push(t),this.sendColumnChange(o,s)}}selectAll(){this.setInvertSelection(!0)}clear(){this.setInvertSelection(!1)}selectNumbers(){const{columns:t}=this.props;this.sendColumnChange(t.filter(n=>x.isNumberType(n.type)).map(n=>n.name),!1)}render(){const{value:t,selectedColumns:n,invertSelection:s,columns:o}=this.props,{isConfigureColumnsShown:i}=this.state,r=n.length===0&&s===!0||n.length===o.length&&s===!1,l=n.length===0&&s===!1||n.length===o.length&&s===!0;let a;return r?a=R(Fe,{children:[h(Z,{icon:ii,mask:Vi,transform:"shrink-2 down-5 right-7"}),h(Z,{icon:bu,className:"text-primary",transform:"shrink-4 down-5 right-7"})]}):l?a=R(Fe,{children:[h(Z,{icon:fi,mask:Vi,transform:"shrink-1 down-5 right-7"}),h(Z,{icon:ll,className:"text-danger",transform:"shrink-4 down-5 right-7"})]}):a=R(Fe,{children:[h(Z,{icon:ii,mask:Vi,transform:"shrink-2 down-5 right-7"}),h(Z,{icon:Fu,className:"text-primary",transform:"shrink-4 down-5 right-7"})]}),R("div",{className:"cross-column-container",children:[h(Jn,{className:"cross-column-search",placeholder:"Search Data...",value:t,onChange:this.handleSearchValueChange,ref:this.searchField}),R("button",{type:"button",className:"btn btn-link btn-link-icon px-2",onClick:()=>{i?this.setState({isConfigureColumnsShown:!1}):this.setState({isConfigureColumnsShown:!0})},children:[h("div",{className:"fa-layers",children:a}),h(We,{children:"Configure Columns"}),h(En,{isShown:i,className:"cross-column-popper",onExited:()=>{this.setState({isConfigureColumnsShown:!1})},closeOnBlur:!0,interactive:!0,children:R("div",{className:"cross-column-popup",children:["Searched Columns",h("div",{className:"cross-column-scroll",children:o.map(c=>R(te.Fragment,{children:[h(ut,{className:"cross-column-checkbox",checked:s?!n.includes(c.name):n.includes(c.name),onChange:()=>this.toggleColumn(c.name),children:c.name}),c.type.substring(c.type.lastIndexOf(".")+1)]},c.name))}),R("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&&R("p",{className:"text-danger",children:[h(Z,{icon:ll})," Select at least one column to search."]})]})})]})]})}}const kn=se.module("PartitionSelectorSearch"),ng=150,rc=class extends T.exports.Component{constructor(e){super(e),this.debounceUpdateFilter=ft(()=>{this.updateFilter()},ng),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(e){e instanceof po||kn.error(e)}componentDidMount(){this.startListening()}componentDidUpdate(e,t){const{isLoading:n,itemCount:s}=this.state,{onListResized:o}=this.props;(s!==t.itemCount||n!==t.isLoading)&&o()}componentWillUnmount(){this.debounceUpdateFilter.cancel(),this.stopListening()}handleKeyDown(e){if(this.itemList==null)return!1;const{items:t,itemCount:n}=this.state;switch(e.key){case"Enter":{let s=null;if(t.length>0)s=t[0].value;else{const{text:o}=this.state;s=o.trim()}if(s.length>0){const{onSelect:o}=this.props;o(s)}return e.stopPropagation(),e.preventDefault(),!0}case"ArrowDown":return n>0&&this.itemList.focusItem(1),e.stopPropagation(),e.preventDefault(),!0;default:return!1}}handleListKeydown(e){switch(e.key){case"Escape":break;default:this.focus();break}}handleFilterChange(){kn.debug2("handleFilterChange");const{table:e}=this.props,t=e.size;this.setState({itemCount:t,isLoading:!0})}handleInputFocus(){this.itemList&&this.itemList.focusItem(0)}handleSelect(e){kn.debug2("handleSelect",e);const{onSelect:t}=this.props,{offset:n,items:s}=this.state,o=e-n;if(o<0||s.length<=o){kn.error("No data for item",e);return}const{value:i}=s[o];t(i)}handleTableUpdate(e){const t=e.detail,{offset:n}=t,s=[],{getFormattedString:o,table:i}=this.props,r=i.columns[0];for(let a=0;a<t.rows.length;a+=1){const d=t.rows[a].get(r),u=o(d,r.type,r.name);s.push({displayValue:u,value:d})}const l=i.size;kn.debug2("handleTableUpdate",l,n,s.length),this.setState({itemCount:l,items:s,offset:n,isLoading:!1})}handleTextChange(e){kn.debug2("handleTextChange");const{value:t}=e.target;this.setState({text:t}),this.debounceUpdateFilter()}handleViewportChange(e,t){kn.debug2("handleViewportChange",e,t);const n=Math.max(1,t-e),s=Math.max(0,e-n),o=t+n,{table:i}=this.props;i.setViewport(s,o)}focus(){this.searchInput&&this.searchInput.focus()}startListening(){const{initialPageSize:e,table:t}=this.props;t.addEventListener(I.Table.EVENT_UPDATED,this.handleTableUpdate),t.addEventListener(I.Table.EVENT_FILTERCHANGED,this.handleFilterChange),t.setViewport(0,e)}stopListening(){const{table:e}=this.props;e.removeEventListener(I.Table.EVENT_UPDATED,this.handleTableUpdate),e.removeEventListener(I.Table.EVENT_FILTERCHANGED,this.handleFilterChange)}updateFilter(){const{initialPageSize:e,table:t}=this.props,{text:n}=this.state,s=n.trim(),o=[];if(s.length>0){const r=t.columns[0].filter().invoke("matches",I.FilterValue.ofString(`(?s)(?i).*\\Q${s}\\E.*`));o.push(r)}kn.debug2("updateFilter",o),t.applyFilter(o),t.setViewport(0,e)}render(){const{isLoading:e,itemCount:t,items:n,offset:s,text:o}=this.state,i=Math.min(t,rc.MAX_VISIBLE_ITEMS)*sn.DEFAULT_ROW_HEIGHT+11;return R("div",{className:"iris-grid-partition-selector-search",children:[h("div",{className:"search-container",children:h("input",{type:"text",ref:r=>{this.searchInput=r},value:o,placeholder:"Available Partitions",onChange:this.handleTextChange,onFocus:this.handleInputFocus,onKeyDown:this.handleKeyDown,className:"form-control input-partition"})}),!e&&t>0&&h("div",{className:"iris-grid-partition-selector-search-list",onKeyDown:this.handleListKeydown,role:"presentation",style:{height:i},children:h(sn,{ref:r=>{this.itemList=r},itemCount:t,items:n,offset:s,onSelect:this.handleSelect,onViewportChange:this.handleViewportChange})}),!e&&t===0&&h("div",{className:"iris-grid-partition-selector-search-empty",children:"No results"}),e&&R("div",{className:"iris-grid-partition-selector-loading",children:[h(Vt,{}),"\xA0Loading..."]})]})}};let Di=rc;Di.MAX_VISIBLE_ITEMS=12;Di.defaultProps={initialPageSize:100,onSelect:()=>{},onListResized:()=>{}};Di.propTypes={getFormattedString:D.exports.func.isRequired,table:D.exports.shape({addEventListener:D.exports.func.isRequired,removeEventListener:D.exports.func.isRequired,columns:D.exports.arrayOf(D.exports.shape({name:D.exports.string.isRequired,type:D.exports.string.isRequired,filter:D.exports.func.isRequired})),size:D.exports.number.isRequired,applyFilter:D.exports.func.isRequired,setViewport:D.exports.func.isRequired}).isRequired,initialPageSize:D.exports.number,onSelect:D.exports.func,onListResized:D.exports.func};const Ns=se.module("IrisGridPartitionSelector"),sg=250;class lc extends T.exports.Component{constructor(t){super(t),this.debounceUpdate=ft(()=>{this.sendUpdate()},sg),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}=t;this.state={partition:n}}componentWillUnmount(){this.debounceUpdate.cancel()}handleAppendClick(){Ns.debug2("handleAppendClick");const{onAppend:t}=this.props,{partition:n}=this.state;t(n)}handleCloseClick(){Ns.debug2("handleCloseClick"),this.sendDone()}handleIgnoreClick(){Ns.debug2("handleIgnoreClick"),this.sendFetchAll()}handlePartitionChange(t){Ns.debug2("handlePartitionChange");const{value:n}=t.target;this.setState({partition:n}),this.debounceUpdate()}handlePartitionSelect(t){this.searchMenu&&this.searchMenu.closeMenu(),this.setState({partition:t},()=>{this.sendUpdate()})}handlePartitionListResized(){this.searchMenu&&this.searchMenu.scheduleUpdate()}handleSearchClosed(){const{table:t}=this.props;t.applyFilter([])}handleSearchOpened(){this.selectorSearch&&this.selectorSearch.focus()}sendDone(){this.debounceUpdate.flush();const{onDone:t}=this.props;t()}sendUpdate(){Ns.debug2("sendUpdate");const{onChange:t}=this.props,{partition:n}=this.state;t(n)}sendFetchAll(){Ns.debug2("sendFetchAll"),this.debounceUpdate.cancel();const{onFetchAll:t}=this.props;t()}render(){const{columnName:t,getFormattedString:n,onDone:s,table:o}=this.props,{partition:i}=this.state,r=h(Di,{getFormattedString:n,table:o,onSelect:this.handlePartitionSelect,onListResized:this.handlePartitionListResized,ref:l=>{this.selectorSearch=l}},"search");return R("div",{className:"iris-grid-partition-selector",children:[h("div",{className:"status-message",children:R("span",{children:['Filtering "',t,'" partition to']})}),R("div",{className:"input-group",children:[h("input",{type:"text",value:i,onChange:this.handlePartitionChange,className:"form-control input-partition"}),h("div",{className:"input-group-append",children:R("button",{type:"button",className:"btn btn-outline-primary",children:[h(Z,{icon:$n}),h(We,{children:"Partitions"}),h(Qn,{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(Z,{icon:go})})]})}}lc.defaultProps={onAppend:()=>{},onChange:()=>{},onFetchAll:()=>{},onDone:()=>{},partition:""};const og=se.module("SelectDistinctBuilder");class ac extends T.exports.Component{constructor(t){super(t),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(t,n){const{inputs:s}=this.state,{onChange:o}=this.props;if(n.inputs!==s){const i=s.filter(r=>r!=="");ct(n.inputs.filter(r=>r!==""),i)||o(i)}}handleAddColumnClick(){this.setState(({inputs:t})=>({inputs:[...t,""]}))}handleDeleteColumn(t){this.setState(({inputs:n})=>({inputs:n.length===1&&t===0?[""]:n.filter((s,o)=>t!==o)}))}handleDropdownChanged(t,n){og.debug("handleDropdownChanged",t,n);const{value:s}=n.target;this.setState(({inputs:o})=>{const i=[...o];return i[t]=s,{inputs:i}})}renderInputs(){const{columns:t,inputs:n}=this.state;return n.map((s,o)=>{const i=t.filter(({name:r})=>r===s||!n.includes(r)).map(({name:r})=>h("option",{value:r,children:r},r));return R("div",{className:"form-inline px-3 pb-3",children:[R("select",{className:"form-control custom-select col",value:s,onChange:r=>this.handleDropdownChanged(o,r),children:[h("option",{value:"",children:"Select a column"}),i]}),(n.length>1||s!=="")&&h(X,{kind:"ghost",className:"ml-1 px-2",onClick:()=>{this.handleDeleteColumn(o)},icon:h(Z,{icon:Rn,transform:"grow-3"}),tooltip:"Delete column"})]},o)})}render(){const{columns:t,inputs:n}=this.state,s=n.length>=t.length;return R("div",{role:"presentation",className:"select-distinct-builder-container h-100",children:[h("div",{className:"select-distinct-title",children:"Display Unique Values From"}),this.renderInputs(),h("hr",{}),h("div",{className:"pt-1 px-3",children:h(X,{kind:"ghost",className:"btn-add-column",onClick:this.handleAddColumnClick,disabled:s,icon:Bs,children:"Add Additional Column"})}),h("div",{className:"select-distinct-builder-footer",children:R("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."]})})]})}}ac.defaultProps={selectDistinctColumns:[],onChange:()=>{}};function Ur({items:e,onChange:t=()=>{}}){return h(Fa,{items:Array.from(e.entries()).map(([n,s])=>({title:Ur.getAdvancedSettingsTitleForKey(n),isOn:s,onChange:o=>t(n,o)}))})}Ur.getAdvancedSettingsTitleForKey=e=>{switch(e){case fs.FILTER_CONTROL_CHANGE_CLEARS_ALL_FILTERS:return"Control filters clear existing table filters";case fs.LINK_CHANGE_CLEARS_ALL_FILTERS:return"Inbound links clear existing table filters"}};const Ll=se.module("ConditionalFormattingMenu"),qi=()=>{};function ig(e){const{column:{type:t}}=e;if(x.isNumberType(t))return e.condition===Oe.IS_NULL||e.condition===Oe.IS_NOT_NULL?"":`${e.value}`;if(x.isCharType(t))return e.condition===at.IS_NULL||e.condition===at.IS_NOT_NULL?"":`${e.value}`;if(x.isStringType(t))return e.condition===vt.IS_NULL||e.condition===vt.IS_NOT_NULL?"":`"${e.value}"`;if(x.isDateType(t))return e.condition===at.IS_NULL||e.condition===at.IS_NOT_NULL?"":`${e.value}`;if(x.isBooleanType(t))return"";throw new Error(`Invalid column type ${t} in getRuleValue`)}function rg(e){return x.isNumberType(e.column.type)&&e.condition===Oe.IS_BETWEEN?`${e.start} < ${e.column.name} < ${e.end}`:`${e.column.name} ${Lm(e.column.type,e.condition)}
|
|
14
|
+
${ig(e)}`}function lg(e){const{rules:t=[],onChange:n=qi,onCreate:s=qi,onSelect:o=qi}=e,i=T.exports.useCallback((c,d,u)=>{c.stopPropagation(),Ll.debug("Rule clicked",d,u),o(u)},[o]),r=T.exports.useCallback((c,d,u)=>{c.stopPropagation(),Ll.debug("Delete button clicked",d,u);const m=[...t];m.splice(u,1),n(m)},[n,t]),l=T.exports.useCallback(c=>{c.stopPropagation()},[]),a=T.exports.useCallback(c=>{if(gt.stopDragging(),c.destination==null)return;const d=c.source.index,u=c.destination.index,m=[...t],p=t[d];m.splice(d,1),m.splice(u,0,p),n(m)},[n,t]);return R("div",{className:"conditional-formatting-rules",children:[h(gi,{onDragStart:gt.startDragging,onDragEnd:a,children:h(pi,{droppableId:"droppable-custom-columns",children:(c,d)=>R("div",{ref:c.innerRef,...c.droppableProps,className:B("droppable-container",{dragging:d.draggingFromThisWith}),children:[t.length===0&&h("div",{className:"text-muted pl-2",children:"No formats defined"}),t.map((u,m)=>h(cr,{draggableId:`${m}-${u.type}`,index:m,disableInteractiveElementBlocking:!0,children:(p,g)=>h("div",{role:"menuitem",tabIndex:0,onClick:f=>i(f,u,m),className:B("draggable-container",{dragging:g.isDragging}),ref:p.innerRef,...p.draggableProps,children:h("div",{className:"conditional-formatting-list-item",children:R("div",{className:"formatting-item",children:[h("div",{className:"rule-icon",children:h("span",{className:"rule-icon-bg",style:{backgroundColor:ri(u.config.style),color:li(u.config.style)},children:u.type===on.ROWS?"row":"col"})}),h("div",{className:"rule-title",children:rg(u.config)}),h(X,{kind:"ghost",className:"ml-1 px-2",onClick:f=>r(f,u,m),icon:Rn,tooltip:"Delete rule"}),R("button",{type:"button",className:"btn btn-link btn-link-icon px-2 btn-drag-handle",onClick:l,...p.dragHandleProps,children:[h(We,{children:"Drag to re-order"}),h(Z,{icon:Ci})]})]})})})},`${m}-${u.type}`)),c.placeholder]})})}),h("hr",{}),h(X,{kind:"ghost",onClick:s,icon:Bs,children:"Add New Rule"})]})}const Fs=se.module("ConditionEditor"),ag=()=>{},cg=[Oe.IS_EQUAL,Oe.IS_NOT_EQUAL,Oe.IS_BETWEEN,Oe.GREATER_THAN,Oe.GREATER_THAN_OR_EQUAL,Oe.LESS_THAN,Oe.LESS_THAN_OR_EQUAL,Oe.IS_NULL,Oe.IS_NOT_NULL].map(e=>h("option",{value:e,children:Sm(e)},e)),dg=[vt.IS_EXACTLY,vt.IS_NOT_EXACTLY,vt.CONTAINS,vt.DOES_NOT_CONTAIN,vt.STARTS_WITH,vt.ENDS_WITH,vt.IS_NULL,vt.IS_NOT_NULL].map(e=>h("option",{value:e,children:bm(e)},e)),ug=[at.IS_EXACTLY,at.IS_NOT_EXACTLY,at.IS_BEFORE,at.IS_BEFORE_OR_EQUAL,at.IS_AFTER,at.IS_AFTER_OR_EQUAL,at.IS_NULL,at.IS_NOT_NULL].map(e=>h("option",{value:e,children:vm(e)},e)),hg=[lo.IS_TRUE,lo.IS_FALSE,lo.IS_NULL,lo.IS_NOT_NULL].map(e=>h("option",{value:e,children:Tm(e)},e)),mg=[hs.IS_EQUAL,hs.IS_NOT_EQUAL,hs.IS_NULL,hs.IS_NOT_NULL].map(e=>h("option",{value:e,children:Em(e)},e));function pg(e,t,n,s){return e===Oe.IS_NULL||e===Oe.IS_NOT_NULL||e===Oe.IS_BETWEEN&&n!=null&&n!==""&&!Number.isNaN(Number.parseFloat(n))&&s!=null&&s!==""&&!Number.isNaN(Number.parseFloat(s))||e!==Oe.IS_BETWEEN&&t!==void 0&&t!==""&&!Number.isNaN(Number.parseFloat(t))}function gg(e,t,n,s,o,i,r){switch(e){case Oe.IS_EQUAL:case Oe.IS_NOT_EQUAL:case Oe.GREATER_THAN:case Oe.GREATER_THAN_OR_EQUAL:case Oe.LESS_THAN:case Oe.LESS_THAN_OR_EQUAL:return h("input",{type:"number",className:"form-control",placeholder:"Enter value",value:o!=null?o:"",onChange:t});case Oe.IS_BETWEEN:return R("div",{className:"d-flex flex-row",children:[h("input",{type:"number",className:"form-control d-flex mr-2",placeholder:"Start value",value:i!=null?i:"",onChange:n}),h("input",{type:"number",className:"form-control d-flex",placeholder:"End value",value:r!=null?r:"",onChange:s})]});case Oe.IS_NULL:case Oe.IS_NOT_NULL:return null}}function fg(e,t,n){switch(e){case vt.IS_NULL:case vt.IS_NOT_NULL:return null;default:return h("input",{type:"text",className:"form-control",placeholder:"Enter value",value:n!=null?n:"",onChange:t})}}function Cg(e,t,n){switch(e){case at.IS_NULL:case at.IS_NOT_NULL:return null;default:return h("input",{type:"text",className:"form-control",placeholder:"Enter value",value:n!=null?n:"",onChange:t})}}function wg(){return null}function Sg(e,t,n){switch(e){case hs.IS_NULL:case hs.IS_NOT_NULL:return null;default:return h("input",{type:"text",className:"form-control",maxLength:1,placeholder:"Enter value",value:n!=null?n:"",onChange:t})}}function cc(e){const{column:t,config:n,onChange:s=ag}=e,o=t.type,[i,r]=T.exports.useState(o),[l,a]=T.exports.useState(n.condition),[c,d]=T.exports.useState(n.value),[u,m]=T.exports.useState(n.start),[p,g]=T.exports.useState(n.end);o!==i&&(a(Va(o)),d(void 0),m(void 0),g(void 0),r(o));const f=T.exports.useMemo(()=>{if(o===void 0)return[];if(x.isNumberType(o))return cg;if(x.isCharType(o))return mg;if(x.isStringType(o))return dg;if(x.isDateType(o))return ug;if(x.isBooleanType(o))return hg},[o]),w=T.exports.useCallback(v=>{const{value:y}=v.target;Fs.debug("handleConditionChange",y),a(y)},[]),C=T.exports.useCallback(v=>{const{value:y}=v.target;Fs.debug("handleValueChange",y),d(y)},[]),S=T.exports.useCallback(v=>{const{value:y}=v.target;Fs.debug("handleStartValueChange",y),m(y)},[]),b=T.exports.useCallback(v=>{const{value:y}=v.target;Fs.debug("handleEndValueChange",y),g(y)},[]);T.exports.useEffect(function(){let y=!0;l===void 0&&(Fs.debug("Unable to create formatting rule. Condition is not selected."),y=!1),x.isNumberType(t.type)&&!pg(l,c,u,p)&&(Fs.debug("Unable to create formatting rule. Invalid value",c),y=!1),s({condition:l,value:c,start:u,end:p},y)},[s,t.type,l,c,u,p]);const E=T.exports.useMemo(()=>{if(o===void 0)return null;if(x.isNumberType(o))return gg(l,C,S,b,c,u,p);if(x.isCharType(o))return Sg(l,C,c);if(x.isStringType(o))return fg(l,C,c);if(x.isDateType(o))return Cg(l,C,c);if(x.isBooleanType(o))return wg()},[o,l,c,u,p,C,S,b]);return R("div",{className:"condition-editor mb-2",children:[h("select",{value:l,id:"condition-select",className:"custom-select mb-2",onChange:w,children:f}),E]})}const bg=se.module("StyleEditor"),vg="#fcfcfa",Tg="#f0f0ee",Eg="#1a171a",Rg=200,yg=()=>{};function dc(e){var b,E;const{config:t,onChange:n=yg}=e,[s,o]=T.exports.useState(t.type),[i,r]=T.exports.useState((E=(b=t.customConfig)==null?void 0:b.background)!=null?E:vg),[l,a]=T.exports.useState(!1),[c,d]=T.exports.useState(Rg),u=T.exports.useRef(null),m=T.exports.useCallback(v=>{const{value:y}=v.target;bg.debug("handleBackgroundChange",y),r(y)},[]),p=T.exports.useCallback(()=>{l&&a(!1)},[l]),g=T.exports.useCallback(()=>{l||w(),a(!l)},[l]),f=T.exports.useMemo(()=>[Kt.NO_FORMATTING,Kt.POSITIVE,Kt.NEGATIVE,Kt.WARN,Kt.NEUTRAL,Kt.ACCENT_1,Kt.ACCENT_2,Kt.CUSTOM],[]);function w(){u.current&&d(u.current.getBoundingClientRect().width)}T.exports.useEffect(function(){n({type:s,customConfig:{color:Si.isDark(i)?Tg:Eg,background:i}})},[n,s,i]);const C=T.exports.useCallback(()=>{const v=[];for(let y=0;y<f.length;y+=1){const M=f[y],A=`option-${y}-${M}`;v.push(R(X,{kind:"inline",className:"style-option-btn",onClick:()=>{o(M),a(!1)},style:{color:li({type:M}),background:ri({type:M})},children:[M===s&&h(Z,{icon:Xn,className:"mr-2"}),M!==s&&h("span",{className:"mr-4"}),Il(M)]},A))}return v},[f,s]),S=T.exports.useCallback(()=>h("div",{className:"style-menu-container",role:"presentation",style:{width:c},children:h("div",{className:"style-options",children:C()})}),[c,C]);return R("div",{className:"style-editor",children:[R("div",{className:"mb-2",ref:u,children:[h("label",{className:"mb-0",children:"Style"}),R(X,{kind:"inline",className:"cs-dropdown",style:{color:li({type:s}),background:ri({type:s})},onClick:g,children:[Il(s),h("span",{children:h(Z,{icon:Sr,className:"cs-caret"})}),h(Qn,{isShown:l,actions:{menuElement:S()},popperOptions:{placement:"bottom-start"},popperClassName:"style-dropdown-menu",onMenuClosed:p,menuStyle:{maxWidth:"100rem"}})]})]}),s===Kt.CUSTOM&&R("div",{className:"mb-2",children:[h("label",{className:"mb-0",children:"Background"}),h("input",{type:"color",value:i,className:"custom-select color-select",onChange:m})]})]})}const so=se.module("ColumnFormatEditor"),Ig=()=>{};function Mg(e){const{type:t,name:n}=e[0];return{column:{type:t,name:n},style:Ba(),...Ri(t)}}function Dg(e){var w;const{columns:t,config:n=Mg(t),onChange:s=Ig}=e,[o,i]=T.exports.useState((w=t.find(C=>C.name===n.column.name&&C.type===n.column.type))!=null?w:t[0]),[r,l]=T.exports.useState(Ua(n)),[a,c]=T.exports.useState(!1),[d,u]=T.exports.useState(n.style),m=T.exports.useCallback(C=>{const S=t.find(({name:b})=>b===C);S!==void 0?(i(S),o.type!==S.type&&(l(Ri(S.type)),c(!1))):so.error(`Column ${C} not found.`)},[t,o]),p=T.exports.useCallback((C,S)=>{so.debug("handleConditionChange",C,S),l(C),c(S)},[]),g=T.exports.useCallback(C=>{so.debug("handleStyleChange",C),u(C)},[]);T.exports.useEffect(function(){if(o===void 0){so.debug("Column is not selected, skip update.");return}if(d===void 0){so.debug("Style is not selected, skip update.");return}const{type:S,name:b}=o;s({column:{type:S,name:b},style:d,...r},a)},[s,o,d,r,a]);const f=t.map(({name:C})=>({title:C,value:C}));return R("div",{className:"conditional-rule-editor form",children:[R("div",{className:"mb-2",children:[h("label",{className:"mb-0",children:"Format Cell If"}),h(zs,{defaultValue:o==null?void 0:o.name,options:f,inputPlaceholder:"Select a column",spellCheck:!1,onChange:m,searchPlaceholder:"Filter columns"})]}),o!==void 0&&R(Fe,{children:[h(cc,{column:o,config:r,onChange:p}),h(dc,{config:d,onChange:g})]})]})}const oo=se.module("RowFormatEditor"),Ng=()=>{};function Fg(e){const{type:t,name:n}=e[0];return{column:{type:t,name:n},style:Ba(),...Ri(t)}}function xg(e){var w;const{columns:t,config:n=Fg(t),onChange:s=Ng}=e,[o,i]=T.exports.useState((w=t.find(C=>C.name===n.column.name&&C.type===n.column.type))!=null?w:t[0]),[r,l]=T.exports.useState(Ua(n)),[a,c]=T.exports.useState(!1),[d,u]=T.exports.useState(n.style),m=T.exports.useCallback(C=>{const S=t.find(({name:b})=>b===C);S!==void 0?(i(S),o.type!==S.type&&(l(Ri(S.type)),c(!1))):oo.error(`Column ${C} not found.`)},[t,o]),p=T.exports.useCallback((C,S)=>{oo.debug("handleConditionChange",C,S),l(C),c(S)},[]),g=T.exports.useCallback(C=>{oo.debug("handleStyleChange",C),u(C)},[]);T.exports.useEffect(function(){if(o===void 0){oo.debug("Column is not selected, skip update.");return}if(d===void 0){oo.debug("Style is not selected, skip update.");return}const{type:S,name:b}=o;s({column:{type:S,name:b},style:d,...r},a)},[s,o,d,r,a]);const f=t.map(({name:C})=>({title:C,value:C}));return R("div",{className:"conditional-rule-editor form",children:[R("div",{className:"mb-2",children:[h("label",{className:"mb-0",children:"Format Row If"}),h(zs,{defaultValue:o==null?void 0:o.name,options:f,inputPlaceholder:"Select a column",spellCheck:!1,onChange:m,searchPlaceholder:"Filter columns"})]}),o!==void 0&&R(Fe,{children:[h(cc,{column:o,config:r,onChange:p}),h(dc,{config:d,onChange:g})]})]})}const Ki=se.module("ConditionalFormatEditor"),Xi=()=>{};function Ag(e){switch(e){case on.CONDITIONAL:return h(Rp,{});case on.ROWS:return h(yp,{})}}function Og(e){switch(e){case on.CONDITIONAL:return"Conditional";case on.ROWS:return"Rows"}}const Pl=[on.CONDITIONAL,on.ROWS];function kg(e){var C;const{columns:t,onSave:n=Xi,onUpdate:s=Xi,onCancel:o=Xi,rule:i}=e,r=t.filter(Hm),[l,a]=T.exports.useState((C=i==null?void 0:i.type)!=null?C:Pl[0]),[c,d]=T.exports.useState(i),[u,m]=T.exports.useState(!1),p=T.exports.useCallback(()=>{o()},[o]),g=T.exports.useCallback(()=>{if(c===void 0){Ki.error("Rule is not defined.");return}n(c)},[n,c]),f=T.exports.useCallback(S=>{Ki.debug("handleFormatterChange",S),a(S)},[]),w=T.exports.useCallback((S,b)=>{Ki.debug("handleRuleChange",S,b,l);const E={type:l,config:S};d(E),m(b),s(b?E:void 0)},[s,l]);return R("div",{className:"conditional-format-editor form",children:[R("div",{className:"mb-2",children:[h("label",{className:"mb-0",htmlFor:"formatter-select",children:"Select Formatter"}),h("div",{className:"formatter-list",children:Pl.map((S,b)=>h("div",{className:"formatter-type",children:R("button",{type:"button",className:B("btn","btn-icon","btn-formatter-type",{active:S===l}),"data-index":b,onClick:()=>f(S),children:[Ag(S),Og(S)]})},S))})]}),l===on.CONDITIONAL&&h(Dg,{columns:r,config:c==null?void 0:c.config,onChange:w}),l===on.ROWS&&h(xg,{columns:r,config:c==null?void 0:c.config,onChange:w}),h("hr",{}),R("div",{className:"d-flex justify-content-end my-3",children:[h(X,{kind:"secondary",onClick:p,className:"mr-2",children:"Cancel"}),h(X,{kind:"primary",onClick:g,disabled:c===void 0||!u,children:"Done"})]})]})}function Lg({type:e}){switch(e){case I.VariableType.TABLE:case I.VariableType.TABLEMAP:case I.VariableType.TREETABLE:case I.VariableType.HIERARCHICALTABLE:return h(Z,{icon:br});case I.VariableType.FIGURE:return h(Z,{icon:ia});case I.VariableType.PANDAS:return h(Z,{icon:Du});default:return h(Z,{icon:du})}}class uc extends T.exports.Component{constructor(t){super(t),this.container=null}componentDidMount(){this.colorize()}colorize(){const{children:t}=this.props;this.container&&t!=null&&bn.colorizeElement(this.container,{theme:"dh-dark"})}render(){const{children:t,language:n}=this.props;return h("div",{children:h("div",{"data-lang":n,ref:s=>{this.container=s},style:{pointerEvents:"none"},children:t})})}}class Pg{static get LANGUAGE_MAP(){return new Map([["python","Python"],["groovy","Groovy"],["scala","Scala"]])}}class Us{static hasComment(t){return t.comment!==void 0}static hasPattern(t){return t.pattern!==void 0}static hasOp(t){return t.op!==void 0}static parseArguments(t){return t==null||!(typeof t=="string"||t instanceof String)?[]:Zc.parse(t).filter(n=>!this.hasComment(n)).map(n=>this.hasPattern(n)?n.pattern:this.hasOp(n)?n.op:`${n}`)}static formatTimestamp(t){if(t==null||!(t instanceof Date))return null;const n=`${t.getHours()}`.padStart(2,"0"),s=`${t.getMinutes()}`.padStart(2,"0"),o=`${t.getSeconds()}`.padStart(2,"0"),i=`${t.getMilliseconds()}`.padStart(3,"0");return`${n}:${s}:${o}.${i}`}static isTableType(t){return t===I.VariableType.TABLE||t===I.VariableType.TREETABLE||t===I.VariableType.HIERARCHICALTABLE}static isWidgetType(t){return t===I.VariableType.FIGURE||t===I.VariableType.OTHERWIDGET||t===I.VariableType.PANDAS}static isOpenableType(t){return Us.isTableType(t)||Us.isWidgetType(t)}static isFigureType(t){return t===I.VariableType.FIGURE}static isPandas(t){return t===I.VariableType.PANDAS}}function hc({children:e}){return R("div",{className:"console-history-item-result",children:[h("div",{className:"console-history-gutter",children:"-"}),h("div",{className:"console-history-content",children:e})]})}hc.propTypes={children:D.exports.node.isRequired};class mc extends T.exports.Component{constructor(t){super(t),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:t,onCancelClick:n}=this.props,{elapsed:s}=this.state;return h("div",{className:B("console-history-result-in-progress",{disabled:t}),children:R("span",{className:"badge",children:[h(Vt,{}),"\xA0Running... ",en.formatElapsedTime(s),"\xA0",h(X,{className:"console-history-result-in-progress-cancel",kind:"ghost",icon:go,tooltip:"Cancel",onClick:n,disabled:t})]})})}}mc.defaultProps={disabled:!1};const rr=class extends T.exports.PureComponent{constructor(e){super(e),this.handleKeyPress=this.handleKeyPress.bind(this),this.handleMouseDown=this.handleMouseDown.bind(this),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleMouseUp=this.handleMouseUp.bind(this),this.handleToggleError=this.handleToggleError.bind(this),this.handleMouseEnter=this.handleMouseEnter.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.mouseX=null,this.mouseY=null,this.isClicking=!1,this.state={isExpanded:!1,isTriggerHovered:!1}}handleKeyPress(e){switch(e.key){case"Enter":case" ":this.handleToggleError(),e.stopPropagation(),e.preventDefault();break}}handleMouseDown(e){this.mouseX=e.clientX,this.mouseY=e.clientY,this.isClicking=!0}handleMouseMove(e){this.mouseX!=null&&this.mouseY!=null?(Math.abs(e.clientX-this.mouseX)>=rr.mouseDragThreshold||Math.abs(e.clientY-this.mouseY)>=rr.mouseDragThreshold)&&(this.isClicking=!1):this.isClicking&&(this.isClicking=!1)}handleMouseUp(e){this.isClicking&&!e.shiftKey&&!e.metaKey&&!e.altKey&&this.handleToggleError(),this.mouseX=null,this.mouseY=null,this.isClicking=!1}handleToggleError(){this.setState(e=>({isExpanded:!e.isExpanded}))}handleMouseEnter(){this.setState({isTriggerHovered:!0})}handleMouseLeave(){this.setState({isTriggerHovered:!1})}render(){const{isExpanded:e,isTriggerHovered:t}=this.state,{message:n}=this.props;O(n);const s=n.indexOf(`
|
|
15
|
+
`),o=s>-1;let i=n;o&&(i=n.slice(0,s));const r=n.slice(s),l=t?"error-btn-link error-btn-link--active":"error-btn-link";return R("div",{className:B("error-message",{expanded:e}),children:[o&&R(Fe,{children:[h("div",{className:"error-gutter",children:h("button",{type:"button",onClick:this.handleToggleError,className:l,tabIndex:-1,children:h(Z,{icon:e?$n:da,transform:"left-3"})})}),R("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:i}),e?r:""]})]}),!o&&h("div",{className:"error-content",children:h("div",{className:"console-error-text",children:i})})]},"error")}};let Br=rr;Br.defaultProps={message:""};Br.mouseDragThreshold=5;const Hl=se.module("ConsoleHistoryItem");class pc extends T.exports.PureComponent{constructor(t){super(t),this.handleCancelClick=this.handleCancelClick.bind(this),this.handleObjectClick=this.handleObjectClick.bind(this)}handleObjectClick(t){Hl.debug("handleObjectClick",t);const{openObject:n}=this.props;n(t)}handleCancelClick(){const{item:t}=this.props;t!=null&&t.cancelResult&&(Hl.debug(`Cancelling command: ${t.command}`),t.cancelResult())}render(){var d;const{disabled:t,item:n,language:s}=this.props,{disabledObjects:o,result:i}=n;let r=null;n.command!=null&&n.command!==""&&(r=R("div",{className:"console-history-item-command",children:[h("div",{className:"console-history-gutter",children:">"}),h("div",{className:"console-history-content",children:h(uc,{language:s,children:n.command})})]}));const l=[];let a=!1;if(i){const{error:u,message:m,changes:p}=i;if(p){const{created:g,updated:f}=p;[...g,...f].forEach(w=>{a=!0;const{title:C}=w,S=`${C}`,b=t===void 0||t||(o!=null?o:[]).indexOf(S)>=0,E=h(X,{kind:"primary",onClick:()=>this.handleObjectClick(w),className:"btn-console-object",disabled:b,icon:h(Lg,{type:w.type}),children:C},S);l.push(E)})}if(u!=null&&n.command==null){let g=`${(d=u.message)!=null?d:u}`;g||(g=u);const f=h(Br,{message:g},"result-error");l.push(f)}if(m!==void 0&&m!==""){const g=h("div",{className:"log-message",children:m},"log-message");l.push(g)}}else{a=!0;const u=h(mc,{onCancelClick:this.handleCancelClick,disabled:t},"in_progress");l.push(u)}let c=null;return l.length>0&&(c=h(hc,{children:l})),R("div",{className:B("console-command-result",{"console-result-buttons":a}),children:[r,c]})}}pc.defaultProps={disabled:!1};const gc=class extends T.exports.Component{static itemKey(e,t){return`${e}.${t.command}.${t.result&&t.result.message}.${t.result&&t.result.error}`}render(){const{disabled:e,items:t,language:n,openObject:s}=this.props,o=[];for(let i=0;i<t.length;i+=1){const r=t[i],l=h(pc,{disabled:e,item:r,openObject:s,language:n},gc.itemKey(i,r));o.push(l)}return h("div",{className:"container-fluid console-history",children:o})}};let fc=gc;fc.defaultProps={disabled:!1};const Hg={name:"Console",CLEAR:De.createAndAdd({id:"CONSOLE.CLEAR",name:"Clear",shortcut:[ie.CTRL,ae.L],macShortcut:[ie.CTRL,ae.C]}),FOCUS_HISTORY:De.createAndAdd({id:"CONSOLE.FOCUS_HISTORY",name:"Focus History",shortcut:[ie.CTRL,ae.H],macShortcut:[ie.CTRL,ie.OPTION,ae.H]})},_g={name:"Command History",FOCUS_HISTORY:De.createAndAdd({id:"COMMAND_HISTORY.FOCUS_HISTORY",name:"Focus History Search",shortcut:[ie.CTRL,ae.H],macShortcut:[ie.CTRL,ie.OPTION,ae.H]}),SEND_TO_CONSOLE:De.createAndAdd({id:"COMMAND_HISTORY.SEND_TO_CONSOLE",name:"Send to Console",shortcut:[ae.ENTER],macShortcut:[ae.ENTER]}),SEND_TO_NOTEBOOK:De.createAndAdd({id:"COMMAND_HISTORY.SEND_TO_NOTEBOOK",name:"Send to Notebook",shortcut:[ie.CTRL,ae.ENTER],macShortcut:[ie.CMD,ae.ENTER]}),RUN:De.createAndAdd({id:"COMMAND_HISTORY.RUN",name:"Run",shortcut:[ie.ALT,ae.R],macShortcut:[ie.OPTION,ae.R]})},Vg={name:"Notebook",RUN:De.createAndAdd({id:"NOTEBOOK.RUN",name:"Run",shortcut:[ie.ALT,ae.R],macShortcut:[ie.OPTION,ae.R]}),RUN_SELECTED:De.createAndAdd({id:"NOTEBOOK.RUN_SELECTED",name:"Run Selected",shortcut:[ie.ALT,ie.SHIFT,ae.R],macShortcut:[ie.OPTION,ie.SHIFT,ae.R]}),FIND:De.createAndAdd({id:"NOTEBOOK.FIND",name:"Find",shortcut:[ie.CTRL,ae.F],macShortcut:[ie.CMD,ae.F],isEditable:!1}),MINIMAP:De.createAndAdd({id:"NOTEBOOK.MINIMAP",name:"Show Minimap",shortcut:[ie.ALT,ae.M],macShortcut:[ie.OPTION,ae.M]}),WORDWRAP:De.createAndAdd({id:"NOTEBOOK.WORDWRAP",name:"Word Wrap",shortcut:[ie.ALT,ae.Z],macShortcut:[ie.OPTION,ae.Z]})},ps={CONSOLE:Hg,COMMAND_HISTORY:_g,NOTEBOOK:Vg},et=Object.freeze({FATAL:"FATAL",STDERR:"STDERR",ERROR:"ERROR",WARN:"WARN",STDOUT:"STDOUT",INFO:"INFO",DEBUG:"DEBUG",TRACE:"TRACE"}),Ug="#2d2a2e",Bg="#fcfcfa",Gg="#fcd65b",zg="#b2b1b2",Wg="#9edc6f",$g="#76d9e4",qg="#f95d84",Kg="#aa9af4",Xg="#f95d84",Yg="#fcfcfa",Qg="#7c7b7c",ce={"error-foreground":"#f95d84",background:Ug,foreground:Bg,"line-height":"19px",string:Gg,"string-delim":"#929192",delimiter:zg,predefined:Wg,keyword:$g,storage:qg,number:Kg,operator:Xg,identifier:Yg,"namespace-identifier":"#f95d84","identifier-js":"#fcd65b",comment:Qg,"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"},jg="python",Zg={comments:{lineComment:"#",blockComment:["'''","'''"]},brackets:[["{","}"],["[","]"],["(",")"]],autoClosingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"',notIn:["string"]},{open:"'",close:"'",notIn:["string","comment"]}],surroundingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}],onEnterRules:[{beforeText:/^\s*(?:def|class|for|if|elif|else|while|try|with|finally|except|async).*?:\s*$/,action:{indentAction:1}}],folding:{offSide:!0,markers:{start:/^\s*#region\b/,end:/^\s*#endregion\b/}}},Jg={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"]]}},ef={id:jg,conf:Zg,language:Jg},tf="groovy",nf={comments:{lineComment:"//",blockComment:["/*","*/"]},brackets:[["{","}"],["[","]"],["(",")"]],autoClosingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"',notIn:["string"]},{open:"'",close:"'",notIn:["string","comment"]}],surroundingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}],onEnterRules:[{beforeText:/^\s*(?:def|class|for|if|elif|else|while|try|with|finally|except|async).*?:\s*$/,action:{indentAction:1}}],folding:{offSide:!0,markers:{start:/^\s*#region\b/,end:/^\s*#endregion\b/}}},sf={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"]]}},of={id:tf,conf:nf,language:sf},rf="scala",lf={wordPattern:/(unary_[@~!#%^&*()\-=+\\|:<>/?]+)|([a-zA-Z_$][\w$]*?_=)|(`[^`]+`)|([a-zA-Z_$][\w$]*)/g,comments:{lineComment:"//",blockComment:["/*","*/"]},brackets:[["{","}"],["[","]"],["(",")"]],autoClosingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}],surroundingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}],folding:{markers:{start:/^\s*\/\/\s*(?:(?:#?region\b)|(?:<editor-fold\b))/,end:/^\s*\/\/\s*(?:(?:#?endregion\b)|(?:<\/editor-fold>))/}}},af={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"]]}},cf={id:rf,conf:lf,language:af},df="deephavenDb",uf={comments:{lineComment:"#",blockComment:["'''","'''"]},brackets:[["{","}"],["[","]"],["(",")"]],autoClosingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"',notIn:["string"]},{open:"'",close:"'",notIn:["string","comment"]}],surroundingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}],onEnterRules:[{beforeText:/^\s*(?:def|class|for|if|elif|else|while|try|with|finally|except|async).*?:\s*$/,action:{indentAction:1}}],folding:{offSide:!0,markers:{start:/^\s*#region\b/,end:/^\s*#endregion\b/}}},hf={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"]]}},mf={id:df,conf:uf,language:hf},pf="log",gf={},ff={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"}]]}},Cf={id:pf,conf:gf,language:ff},qt=se.module("MonacoUtils");class Ge{static init({getWorker:t}={}){qt.debug("Initializing Monaco..."),t!==void 0&&Ge.registerGetWorker(t);const{registerLanguages:n,removeHashtag:s}=Ge,o=[{token:"",foreground:s(ce.foreground)},{token:"string",foreground:s(ce.string)},{token:"string.delim",foreground:s(ce["string-delim"])},{token:"keyword",foreground:s(ce.keyword)},{token:"identifier.js",foreground:s(ce["identifier-js"])},{token:"delimiter",foreground:s(ce.delimiter)},{token:"comment",foreground:s(ce.comment)},{token:"number",foreground:s(ce.number)},{token:"storage",foreground:s(ce.storage)},{token:"identifier",foreground:s(ce.identifier)},{token:"namespace.identifier",foreground:s(ce["namespace-identifier"])},{token:"operator",foreground:s(ce.operator)},{token:"predefined",foreground:s(ce.predefined)},{token:"error.log",foreground:ce["log-error"].substring(1)},{token:"warn.log",foreground:s(ce["log-warn"])},{token:"info.log",foreground:s(ce["log-info"])},{token:"stdout.log",foreground:s(ce["log-stdout"])},{token:"trace.log",foreground:s(ce["log-trace"])},{token:"debug.log",foreground:s(ce["log-debug"])},{token:"date.log",foreground:s(ce["log-date"])}],i={errorForeground:ce["error-foreground"],"inputOption.activeBorder":ce["input-option-active-border"],"editor.background":ce.background,"editor.foreground":ce.foreground,"editor.lineHighlightBackground":ce["editor-line-highlight-bg"],"editorLineNumber.foreground":ce["editor-line-number-foreground"],"editor.selectionBackground":ce["editor-selection-background"],"editor.findMatchBackground":ce["editor-find-match-background"],"editor.findMatchHighlightBackground":ce["editor-find-match-highlight-background"],"editorSuggestWidget.background":ce["editor-suggest-widget-background"],"editorSuggestWidget.border":ce["editor-suggest-widget-border"],"editorSuggestWidget.foreground":ce["editor-suggest-widget-foreground"],"editorSuggestWidget.selectedBackground":ce["editor-suggest-widget-selected-background"],"editorSuggestWidget.highlightForeground":ce["editor-suggest-widget-highlightForeground"],"list.hoverBackground":ce["list-hover-background"],"dropdown.background":ce["context-menu-background"],"dropdown.foreground":ce["context-menu-foreground"],"menu.selectionBackground":ce["menu-selection-background"],"list.focusBackground":ce["menu-selection-background"],"editorWidget.background":ce["editor-widget-background"],"inputOption.activeBackground":ce["input-option-active-background"],"inputOption.activeForeground":ce["input-option-active-foreground"],focusBorder:ce["focus-border"],"input.background":ce["input-background"],"input.foreground":ce["input-foreground"],"input.border":ce["input-border"]};bn.defineTheme("dh-dark",{base:"vs-dark",inherit:!0,rules:o,colors:i}),qt.debug2("monaco theme: ",ce),bn.setTheme("dh-dark"),n([mf,ef,of,Cf,cf]),qt.debug("Monaco initialized.")}static registerGetWorker(t){window.MonacoEnvironment={...window.MonacoEnvironment,getWorker:t}}static removeHashtag(t){return t.substring(1)}static registerLanguages(t){const n=t.map(({id:s})=>s);As.getLanguages().filter(({id:s})=>n.includes(s)).forEach(s=>{const o=s;qt.debug2("Overriding default language loader:",o.id)}),t.forEach(s=>{Ge.registerLanguage(s)})}static registerLanguage(t){qt.debug2("Registering language: ",t.id),As.register(t),As.onLanguage(t.id,()=>{As.setLanguageConfiguration(t.id,t.conf),As.setMonarchTokensProvider(t.id,t.language)})}static setEOL(t,n=bn.EndOfLineSequence.LF){var s;(s=t.getModel())==null||s.setEOL(n)}static openDocument(t,n){const s=t.getModel();O(s);const o={textDocument:{uri:`${s.uri}`,languageId:s.getLanguageId(),version:s.getVersionId(),text:s.getValue()}};return qt.debug2("didOpenDocumentParams: ",o),n.openDocument(o),t.onDidChangeModelContent(r=>{const{changes:l,versionId:a}=r,c=[];for(let d=0;d<l.length;d+=1){const u=l[d],{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};c.push(f)}if(c.length>0){const d={textDocument:{version:a,uri:`${s.uri}`},contentChanges:c};qt.debug2("didChangeDocumentParams",d),n.changeDocument(d)}})}static closeDocument(t,n){const s=t.getModel();O(s);const o={textDocument:{uri:`${s.uri}`}};n.closeDocument(o)}static registerPasteHandler(t){t.onDidPaste(n=>{const s=/“|”/g,o=/\u200b/g,i=/\u00A0/g,r=t.getModel();O(r);const l=r.getValueInRange(n.range);(s.test(l)||o.test(l)||i.test(l))&&r.applyEdits([{range:n.range,text:l.replace(s,'"').replace(o,"").replace(i," ")}])})}static isMacPlatform(){const{platform:t}=window.navigator;return t.startsWith("Mac")}static removeConflictingKeybindings(t){const n=[{windows:"ctrl+D",mac:"meta+D"},{windows:"ctrl+H"}];try{n.forEach(s=>{Ge.isMacPlatform()&&s.mac===""||!Ge.isMacPlatform()&&s.windows===""||Ge.removeKeybinding(t,Ge.isMacPlatform()?s.mac:s.windows)})}catch(s){qt.error(s)}}static removeKeybinding(t,n){if(n===void 0)return;const s=t._standaloneKeybindingService._getResolver()._map.get(n);s!=null?s.forEach(o=>{qt.debug2(`Removing Monaco keybinding ${n} for ${o.command}`),t._standaloneKeybindingService.addDynamicKeybinding(`-${o.command}`,null,()=>{})}):qt.warn(`Did not find any keybindings to remove for ${n}`)}static getMonacoKeyCodeFromShortcut(t){const{keyState:n}=t,{keyValue:s}=n;return s===null?0:Ge.isMacPlatform()?(n.metaKey?Ft.CtrlCmd:0)|(n.shiftKey?Ft.Shift:0)|(n.altKey?Ft.Alt:0)|(n.ctrlKey?Ft.WinCtrl:0)|el.fromString(s):(n.ctrlKey?Ft.CtrlCmd:0)|(n.shiftKey?Ft.Shift:0)|(n.altKey?Ft.Alt:0)|(n.metaKey?Ft.WinCtrl:0)|el.fromString(s)}}const _l=se.module("MonacoCompletionProvider");class Cc extends T.exports.PureComponent{constructor(t){super(t),this.handleCompletionRequest=this.handleCompletionRequest.bind(this)}componentDidMount(){const{language:t}=this.props;this.registeredCompletionProvider=As.registerCompletionItemProvider(t!=null?t:"",{provideCompletionItems:this.handleCompletionRequest,triggerCharacters:['"',".","'","(","[","{",","]})}componentWillUnmount(){var t;(t=this.registeredCompletionProvider)==null||t.dispose()}handleCompletionRequest(t,n,s){const{model:o,session:i}=this.props;if(t!==o)return null;const r={textDocument:{uri:`${t.uri}`,version:t.getVersionId()},position:{line:n.lineNumber-1,character:n.column-1},context:s},l=i.getCompletionItems(r);return _l.debug("Completion items received: ",r,l),l.then(c=>{const d=c.map(u=>{const{label:m,kind:p,detail:g,documentation:f,sortText:w,filterText:C,textEdit:S,insertTextFormat:b}=u,{start:E,end:v}=S.range,y={startLineNumber:E.line+1,startColumn:E.character+1,endLineNumber:v.line+1,endColumn:v.character+1};return{label:m,kind:p,detail:g,documentation:f,sortText:w,filterText:C,insertText:S.text,insertTextRules:b===2?4:b,range:y}});return{incomplete:!0,suggestions:d}}).catch(c=>(_l.error("There was an error retrieving completion items",c),{suggestions:[]}))}render(){return null}}const Yi=se.module("ConsoleInput"),ci=parseInt(ce["line-height"],10),wc=6,Sc=6,wf=ci+wc+Sc,Qi=100,bc=class extends T.exports.PureComponent{constructor(e){super(e),this.handleWindowResize=this.handleWindowResize.bind(this),this.commandContainer=te.createRef(),this.commandHistoryIndex=null,this.timestamp=Date.now(),this.bufferIndex=0,this.history=[],this.modifiedCommands=new Map,this.state={commandEditorHeight:ci,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(e,t=!0,n=!1){var s;!e||(Yi.debug("Command received: ",e),n||(this.commandHistoryIndex=null,(s=this.commandEditor)==null||s.setValue(e)),t&&this.focusEnd(),this.updateDimensions(),n&&this.processCommand(e))}initCommandEditor(){const{language:e,session:t}=this.props,n={copyWithSyntaxHighlighting:!1,cursorStyle:"block",fixedOverflowWidgets:!0,folding:!1,fontFamily:"Fira Mono",glyphMargin:!1,language:e,lineHeight:ci,lineDecorationsWidth:3,lineNumbers:"off",minimap:{enabled:!1},renderLineHighlight:"none",scrollBeyondLastLine:!1,scrollbar:{arrowSize:0,horizontal:"hidden",horizontalScrollbarSize:0},padding:{top:wc,bottom:Sc},tabCompletion:"on",value:"",wordWrap:"on"},s=this.commandContainer.current;O(s),this.commandEditor=bn.create(s,n),Ge.setEOL(this.commandEditor),Ge.openDocument(this.commandEditor,t),this.commandEditor.onDidChangeModelContent(()=>{var i;const o=(i=this.commandEditor)==null?void 0:i.getValue();this.modifiedCommands.set(this.commandHistoryIndex,o!=null?o:null),this.updateDimensions()}),this.commandEditor.onDidFocusEditorText(()=>{this.setState({isFocused:!0})}),this.commandEditor.onDidBlurEditorText(()=>{this.setState({isFocused:!1})}),this.commandEditor.onKeyDown(o=>{var d,u,m;const{commandEditor:i,commandHistoryIndex:r}=this,l=i==null?void 0:i.getPosition();O(l);const{lineNumber:a}=l,c=i==null?void 0:i.getModel();if(o.code==="ArrowUp"&&!this.isSuggestionMenuPopulated()&&a===1){r!=null?this.loadCommand(r+1):this.loadCommand(0),this.focusStart(),o.stopPropagation(),o.preventDefault();return}if(o.code==="ArrowDown"&&!this.isSuggestionMenuPopulated()&&a===(c==null?void 0:c.getLineCount())){r!=null&&r>0?this.loadCommand(r-1):this.loadCommand(null),this.focusEnd(),o.stopPropagation(),o.preventDefault();return}if(!o.altKey&&!o.shiftKey&&!o.metaKey)if(o.keyCode===Wn.Enter){if(!this.isSuggestionMenuPopulated()){o.stopPropagation(),o.preventDefault();const p=(d=this.commandEditor)==null?void 0:d.getValue().trim();p!==void 0&&(this.processCommand(p),(u=this.commandEditor)==null||u.setValue(""))}}else o.keyCode===Wn.Tab&&(this.isSuggestionMenuActive()?this.isSuggestionMenuPopulated()||(o.stopPropagation(),o.preventDefault()):(o.stopPropagation(),o.preventDefault(),(m=this.commandEditor)==null||m.trigger("Tab key trigger suggestions","editor.action.triggerSuggest",{})))}),this.commandEditor.addCommand(Ft.CtrlCmd|Wn.KeyF,()=>{}),Ge.removeConflictingKeybindings(this.commandEditor),Ge.registerPasteHandler(this.commandEditor),this.commandEditor.focus(),this.updateDimensions(),this.setState({model:this.commandEditor.getModel()})}destroyCommandEditor(){const{session:e}=this.props;this.commandEditor&&(Ge.closeDocument(this.commandEditor,e),this.commandEditor.dispose(),this.commandEditor=void 0)}handleWindowResize(){this.updateDimensions()}isSuggestionMenuActive(){var e,t,n;return this.commandSuggestionContainer||(this.commandSuggestionContainer=(t=(e=this.commandEditor)==null?void 0:e.getDomNode())==null?void 0:t.querySelector(".suggest-widget")),(n=this.commandSuggestionContainer&&this.commandSuggestionContainer.classList.contains("visible"))!=null?n:!1}isSuggestionMenuPopulated(){var e,t,n;return this.isSuggestionMenuActive()&&((n=(t=(e=this.commandSuggestionContainer)==null?void 0:e.querySelector(".monaco-list-rows"))==null?void 0:t.childElementCount)!=null?n:0)>0}focus(){var e;(e=this.commandEditor)==null||e.focus()}focusStart(){var s,o,i,r,l;const e=(s=this.commandEditor)==null?void 0:s.getModel();O(e);const t=e.getLineLength(1)+1,n=(o=this.commandEditor)==null?void 0:o.getTopForPosition(1,t);O(n),(i=this.commandEditor)==null||i.setPosition({lineNumber:1,column:t}),(r=this.commandEditor)==null||r.setScrollTop(n),(l=this.commandEditor)==null||l.focus()}focusEnd(){var o,i,r,l,a;const e=(o=this.commandEditor)==null?void 0:o.getModel();O(e);const t=e.getLineCount(),n=e.getLineLength(t)+1,s=(i=this.commandEditor)==null?void 0:i.getTopForPosition(t,n);O(s),(r=this.commandEditor)==null||r.setPosition({lineNumber:t,column:n}),(l=this.commandEditor)==null||l.setScrollTop(s),(a=this.commandEditor)==null||a.focus()}clear(){var e,t,n;(e=this.commandEditor)==null||e.focus(),(n=(t=this.commandEditor)==null?void 0:t.getModel())==null||n.setValue(""),this.commandHistoryIndex=null}layoutEditor(){this.commandEditor&&this.commandEditor.layout()}loadCommand(e){var s,o;if(e!==null&&e>=this.history.length)return;const t=this.modifiedCommands.get(e),n=e===null?"":this.history[this.history.length-e-1];this.commandHistoryIndex=e,(o=(s=this.commandEditor)==null?void 0:s.getModel())==null||o.setValue(t!=null?t:n),e!==null&&e>this.history.length-Qi&&this.loadMoreHistory()}async loadMoreHistory(){try{if(this.loadingPromise!=null||this.bufferIndex==null)return;const{commandHistoryStorage:e,language:t,scope:n}=this.props;this.loadingPromise=Ue.makeCancelable(e.getTable(t,n!=null?n:"",this.timestamp),i=>i.close());const s=await this.loadingPromise;s.setReversed(!0),s.setViewport({top:this.bufferIndex,bottom:this.bufferIndex+Qi-1}),this.loadingPromise=Ue.makeCancelable(s.getViewportData(),()=>s.close());const o=await this.loadingPromise;this.bufferIndex+=Qi,this.bufferIndex>=s.size&&(this.bufferIndex=null),this.history=[...o.items.filter(({name:i},r,l)=>r===0||i!==l[r-1].name).map(({name:i})=>i).reverse(),...this.history],this.loadingPromise=void 0,s.close()}catch(e){if(this.loadingPromise=void 0,Ue.isCanceled(e)){Yi.debug2("Promise canceled, not loading history");return}Yi.error("Error fetching history",e)}}processCommand(e){this.commandHistoryIndex=null,this.modifiedCommands.clear(),O(e),e!==""&&(this.history.length===0||e!==this.history[this.history.length-1])&&this.history.push(e),this.updateDimensions();const{onSubmit:t}=this.props;t(e)}updateDimensions(){if(!this.commandEditor)return;const{maxHeight:e}=this.props;O(e);const t=this.commandEditor.getContentHeight(),n=Math.max(Math.min(t,e),wf),o={overviewRulerLanes:t>n?void 0:0};this.setState({commandEditorHeight:n},()=>{var i,r;(i=this.commandEditor)==null||i.updateOptions(o),(r=this.commandEditor)==null||r.layout()})}render(){const{disabled:e,language:t,session:n}=this.props,{commandEditorHeight:s,isFocused:o,model:i}=this.state;return h("div",{className:B("console-input-wrapper",{disabled:e}),children:R("div",{className:B("console-input-inner-wrapper",{focus:o}),children:[h("div",{className:bc.INPUT_CLASS_NAME,ref:this.commandContainer,style:{height:s}}),i&&h(Cc,{model:i,language:t,session:n})]})})}};let di=bc;di.defaultProps={maxHeight:ci*10,scope:null,disabled:!1};di.INPUT_CLASS_NAME="console-input";const Vl="pasted values",Sf=[/^audio.*/,/^font.*/,/^image.*/,/^video.*/],ji=[".csv",".tsv",".tab",".psv",".dsv",".txt"],Ul=[".zip"],Ls=class extends T.exports.Component{constructor(e){super(e),this.getValidExtensions=Ie(t=>t?[...ji,...Ul]:[...ji]),this.getAcceptString=Ie(t=>this.getValidExtensions(t).join(", ")),this.getFileTypeErrorString=Ie(t=>Tr.join(this.getValidExtensions(t),"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=te.createRef(),this.divElem=te.createRef(),this.state={selectedFileName:""}}static isValidDropItem(e){return e!=null&&e.kind==="file"&&!Sf.find(t=>t.test(e.type))}static isValidExtension(e,t=!1){return ji.some(n=>e.endsWith(n))||t&&Ul.some(n=>e.endsWith(n))}static handleDragOver(e){e.preventDefault(),e.stopPropagation()}static getIcon(e){return e===Vl?sl:e.endsWith(".csv")?Tu:e.endsWith(".zip")?jd:Ru}componentDidMount(){var e,t;(e=this.divElem.current)==null||e.addEventListener("paste",this.handlePasteEvent),(t=this.divElem.current)==null||t.focus()}componentWillUnmount(){var e;(e=this.divElem.current)==null||e.removeEventListener("paste",this.handlePasteEvent)}handleSelectFile(){var e;this.fileElem.current&&(this.fileElem.current.value="",(e=this.fileElem.current)==null||e.click())}handleFiles(e){e.stopPropagation(),e.preventDefault();const{files:t}=e.target;t!=null&&this.handleFile(t[0])}handleDrop(e){const{allowZip:t,clearDragError:n,dragError:s}=this.props;if(e.preventDefault(),e.stopPropagation(),s!=null){n();return}if(e.dataTransfer==null||e.dataTransfer.items==null||e.dataTransfer.items.length===0)return;const o=e.dataTransfer.items[0].getAsFile();O(o),Ls.isValidExtension(o.name,t)?this.handleFile(o):this.setState({dropError:Ls.FILE_TYPE_ERROR})}unstageFile(e){const{onCancel:t}=this.props;e.stopPropagation(),e.preventDefault(),t(),this.setState({selectedFileName:"",dropError:void 0})}handleFile(e){const{onFileOpened:t}=this.props;t(e),this.setState({selectedFileName:e.name,dropError:void 0})}handleMenuPaste(){const{onPaste:e,onError:t,uploadInProgress:n}=this.props;n||navigator.clipboard.readText().then(s=>{e(s),this.setState({selectedFileName:Vl,dropError:void 0})}).catch(s=>t(s))}handlePasteEvent(e){e.stopPropagation(),e.preventDefault(),this.handleMenuPaste()}makeContextMenuItems(){const{uploadInProgress:e}=this.props;return[{title:"Paste",icon:sl,action:this.handleMenuPaste,shortcut:Nr.PASTE,disabled:e}]}render(){const{allowZip:e,dragError:t,uploadInProgress:n}=this.props,{selectedFileName:s,dropError:o}=this.state,i=t!=null?t:o,r=this.makeContextMenuItems();return R("div",{ref:this.divElem,className:"csv-overlay fill-parent-absolute",onDragOver:Ls.handleDragOver,onDrop:this.handleDrop,tabIndex:-1,children:[h(re,{actions:r}),h("input",{ref:this.fileElem,type:"file",id:"fileElem",accept:this.getAcceptString(e),style:{display:"none"},onChange:this.handleFiles,"data-testid":"fileElem"}),!s&&(i===void 0||i==="")&&R("div",{className:"message-content",children:[h("div",{className:"message-icon",children:h(Z,{icon:Eu})}),h("label",{children:"Drop file (or paste values) here to import"}),h("div",{className:"message-small",children:h("label",{children:"or"})}),h(X,{kind:"primary",onClick:this.handleSelectFile,children:"Select File..."})]}),s&&(i===void 0||i==="")&&R("div",{className:"selected-content",children:[h("div",{className:"selected-icon",children:h(Z,{icon:Ls.getIcon(s)})}),R("div",{className:"selected-text",children:[h("label",{children:"Selected File"}),R("label",{className:"selected-name",children:[s,!n&&h(X,{kind:"ghost",className:"ml-2",onClick:this.unstageFile,icon:Rn,tooltip:"Remove"})]})]})]}),Boolean(i)&&R("div",{className:"message-content",children:[h("div",{className:"message-icon",children:h(Z,{icon:Yn})}),h("label",{children:i}),i===Ls.FILE_TYPE_ERROR&&h("div",{className:"message-small",children:h("label",{children:this.getFileTypeErrorString(e)})})]})]})}};let Sn=Ls;Sn.defaultProps={allowZip:!1,dragError:null};Sn.MULTIPLE_FILE_ERROR="Please select only one file";Sn.FILE_TYPE_ERROR="Filetype not supported.";class Se{}Se.INTEGER="int";Se.LONG="long";Se.DOUBLE="double";Se.BOOLEAN="bool";Se.STRING="string";Se.DATE_TIME="datetime";Se.LOCAL_TIME="localtime";const Bl="unknown",bf=2147483647,vf=-2147483648,Gl=/^[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]+)?$/,zl=/^([0-9]+T)?([0-9]+):([0-9]+)(:[0-9]+)?(?:\.[0-9]{1,9})?$/;class ot{static determineType(t,n,s){if(!t||t===s)return n;switch(n){case Se.STRING:return Se.STRING;case Se.INTEGER:return ot.checkInteger(t);case Se.LONG:return ot.checkLong(t);case Se.DOUBLE:return ot.checkDouble(t);case Se.BOOLEAN:return ot.checkBoolean(t);case Se.DATE_TIME:return ot.checkDateTime(t);case Se.LOCAL_TIME:return ot.checkLocalTime(t);default:return ot.getTypeFromUnknown(t)}}static isNotParsableNumber(t){return isNaN(t)||t==="Infinity"||t==="-Infinity"}static checkInteger(t){const n=t.replace(/,/g,"");return ot.isNotParsableNumber(n)?Se.STRING:ot.getNumberType(n)}static checkLong(t){const n=t.replace(/,/g,"");return ot.isNotParsableNumber(n)?Se.STRING:n.includes(".")?Se.DOUBLE:Se.LONG}static checkDouble(t){const n=t.replace(/,/g,"");return ot.isNotParsableNumber(n)?Se.STRING:Se.DOUBLE}static checkBoolean(t){const n=t.toLowerCase();return n==="true"||n==="false"?Se.BOOLEAN:Se.STRING}static checkDateTime(t){return Gl.test(t)?Se.DATE_TIME:Se.STRING}static checkLocalTime(t){return zl.test(t)?Se.LOCAL_TIME:Se.STRING}static getTypeFromUnknown(t){const n=t.replace(/,/g,"");if(ot.isNotParsableNumber(n)){const s=t.toLowerCase();return s==="true"||s==="false"?Se.BOOLEAN:Gl.test(t)&&t.includes(":")?Se.DATE_TIME:zl.test(t)?Se.LOCAL_TIME:Se.STRING}return ot.getNumberType(n)}static getNumberType(t){if(t.includes("."))return Se.DOUBLE;const n=t.startsWith("-")?11:10;if(t.length>n)return Se.LONG;const s=parseInt(t,10);return s>bf||s<vf?Se.LONG:Se.INTEGER}constructor(t,n,s,o,i,r,l,a,c,d){this.onFileCompleted=t,this.file=n,this.readHeaders=s,this.nullString=i,this.onProgress=r,this.onError=l,this.chunks=0,this.totalChunks=a,this.isZip=c,this.shouldTrim=d,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={...o,error:this.handleError,chunk:this.handleChunk,complete:this.handleComplete}}parse(){const t=this.isZip?this.file.nodeStream("nodebuffer",this.handleNodeUpdate):this.file;tr.parse(t,this.config)}handleChunk(t,n){let{data:s}=t;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(Bl),this.readHeaders&&(s=s.slice(1))}O(this.types);const o=[...this.types];s.forEach(l=>{if(l.length>=o.length){for(let a=0;a<o.length;a+=1)o[a]=ot.determineType(this.shouldTrim?l[a].trim():l[a],o[a],this.nullString);this.types=o}else n.abort(),this.onError(`Error parsing CSV: Insufficient data in row.
|
|
16
16
|
Expected length ${o.length} but found ${l.length}.
|
|
17
17
|
Row = ${l}`)}),this.chunks+=1;let i=0;this.totalChunks>0?i=Math.round(this.chunks/this.totalChunks*50):i=Math.round(this.zipProgress/2),this.onProgress(i)&&n.abort()}handleComplete(t){const{types:n,onFileCompleted:s}=this;O(n),(t==null||!t.meta.aborted)&&s(n.map(o=>o===Bl?Se.STRING:o))}handleError(t){const{onError:n}=this;n(t)}handleNodeUpdate(t){this.zipProgress=t.percent}}const Zo=se.module("CsvParser"),Tf=650,ui=class{static generateHeaderRecursive(e){let t="",n=e;return e>=26&&(t=t.concat(ui.generateHeaderRecursive(Math.floor(e/26)-1)),n=e%26),t.concat(String.fromCharCode(65+n))}constructor({onFileCompleted:e,session:t,file:n,type:s,readHeaders:o=!0,onProgress:i,onError:r,timeZone:l,isZip:a}){this.onFileCompleted=e,this.session=t,this.file=n,this.isZip=a,this.type=s,this.readHeaders=o,this.timeZone=l,this.onProgress=i,this.onError=r,this.tables=[],this.chunks=0,this.totalChunks=a?0:Math.ceil(n.size/tr.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(e,t){const n=t.length,s=new Array(e).fill(null).map(()=>new Array(n));for(let o=0;o<n;o+=1){const i=t[o];if(i.length<e)throw new Error(`Insufficient columns. Expected ${e} but found ${i.length}
|
|
18
18
|
${i}`);for(let r=0;r<e;r+=1){const l=this.type.shouldTrim?t[o][r].trim():t[o][r];s[r][o]=this.nullCheck(l)}}return s}nullCheck(e){return e===this.type.nullString?"":e}parse(){const e=n=>{const s=this.isZip?this.file.nodeStream("nodebuffer",this.handleNodeUpdate):this.file;this.types=n,tr.parse(s,this.config)};new ot(e,this.file,this.readHeaders,this.config,this.type.nullString,this.onProgress,this.onError,this.totalChunks,this.isZip,this.type.shouldTrim).parse()}handleChunk(e,t){const{readHeaders:n,onError:s,handleCreateTable:o,isZip:i,tables:r}=this;if(this.isCancelled){Zo.debug2("CSV parser cancelled."),t.abort(),r.forEach(c=>c.close());return}let{data:l}=e;this.headers||(n?(this.headers=_t.legalizeColumnNames(l[0]),l=l.slice(1)):this.headers=ui.generateHeaders(l[0].length));let a=[];try{if(a=this.transpose(this.headers.length,l),i)this.consolidateChunks(a,t);else{const c=this.chunks;this.chunks+=1,o(c,a,t)}}catch(c){s(c)}}consolidateChunks(e,t){if(!this.consolidatedChunks)this.consolidatedChunks=e.slice();else for(let n=0;n<e.length;n+=1)this.consolidatedChunks[n]=this.consolidatedChunks[n].concat(e[n]);this.numConsolidated+=1,(this.numConsolidated>=Tf||this.isComplete)&&this.uploadConsolidatedChunks(t)}uploadConsolidatedChunks(e){var o;const{handleCreateTable:t}=this,n=this.chunks;this.chunks+=1;const s=(o=this.consolidatedChunks)==null?void 0:o.slice();this.consolidatedChunks=void 0,this.numConsolidated=0,O(s),t(n,s,e)}handleCreateTable(e,t,n){const{session:s,tables:o,onFileCompleted:i,totalChunks:r,types:l,onProgress:a,onError:c}=this;n&&n.pause(),O(this.headers),O(l),s.newTable(this.headers,l,t,this.timeZone).then(d=>{if(this.isCancelled){Zo.debug2("CSV parser cancelled."),n&&n.abort(),o.forEach(m=>m.close());return}n&&n.resume(),o[e]=d;let u=0;r>0?u=Math.round(o.length/r*50)+50:u=Math.round(50+this.zipProgress/2),Zo.debug2(`CSV parser progress ${u}`),a(u),this.isComplete&&o.length===this.chunks&&(Zo.debug2("CSV parser complete."),i(o))}).catch(d=>{!this.isComplete&&n&&n.abort(),c(d)})}handleComplete(e){(e==null||e.meta.aborted==null)&&(this.isComplete=!0,this.consolidatedChunks&&this.uploadConsolidatedChunks(null))}handleError(e){const{onError:t}=this;t(e)}handleNodeUpdate(e){this.zipProgress=e.percent}};let vc=ui;vc.generateHeaders=e=>{const t=[];for(let n=0;n<e;n+=1)t.push(ui.generateHeaderRecursive(n));return t};class Kn{static fromExtension(t){return t.endsWith(".csv")?"DEFAULT_CSV":t.endsWith(".tsv")||t.endsWith(".tab")?"TSV":t.endsWith(".psv")?"PIPE_SV":"AUTODETECT"}}Kn.DEFAULT_TYPE="DEFAULT_CSV";Kn.AUTO="AUTODETECT";Kn.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
|
|
19
19
|
`,escapeChar:'"',shouldTrim:!0,skipEmptyLines:!0,nullString:null},EXCEL_CSV:{name:"Excel csv (strict)",delimiter:",",newline:`\r
|
|
20
20
|
`,escapeChar:'"',shouldTrim:!0,skipEmptyLines:!1,nullString:null},MY_SQL_CSV:{name:"MySQL csv",delimiter:" ",newline:`
|
|
21
21
|
`,escapeChar:"\\",shouldTrim:!0,skipEmptyLines:!1,nullString:"\\N"},RFC4180_CSV:{name:"RFC4180 csv",delimiter:",",newline:`\r
|
|
22
|
-
`,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 Wl=se.module("CsvInputBar"),Ef=Object.entries(Kn.TYPES).map(([e,t])=>h("option",{value:e,children:t.name},e));class Tc extends T.exports.Component{constructor(t){super(t),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=te.createRef(),this.state={tableName:"",tableNameSet:!1,isFirstRowHeaders:!0,showProgress:!1,progressValue:0,type:Kn.DEFAULT_TYPE,parser:null}}componentDidUpdate(t){var r;const{file:n,paste:s}=this.props,{tableName:o,tableNameSet:i}=this.state;if(!i&&n!=null&&!o){const l=n.name.lastIndexOf("."),a=_t.legalizeTableName(n.name.substring(0,l));this.setState({tableName:a,tableNameSet:!0}),(r=this.inputRef.current)==null||r.focus()}else(n==null&&t.file!=null||s==null&&t.paste!=null)&&this.setState({tableName:"",tableNameSet:!1});s!=null&&s!==""&&!o&&this.inputRef.current&&this.inputRef.current.focus(),n!=null&&n!==t.file?this.setState({type:Kn.fromExtension(n.name)}):s!=null&&s!==""&&(t.paste===void 0||t.paste==="")&&this.setState({type:Kn.AUTO})}componentWillUnmount(){const{parser:t}=this.state;t&&t.cancel()}handleCancel(){const{onClose:t}=this.props;t()}handleError(t){const{onClose:n,onError:s}=this.props;Wl.error(t),s(t),n()}handleTableName(t){this.setState({tableName:t.target.value,tableNameSet:!0})}toggleFirstRowHeaders(){const{isFirstRowHeaders:t}=this.state;this.setState({isFirstRowHeaders:!t})}handleUpload(t){t.stopPropagation(),t.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(t,n=!1){Wl.info(`Starting CSV parser for ${t instanceof File?t.name:"pasted values"} ${n?"":t.size} bytes`);const{session:s,timeZone:o,onInProgress:i}=this.props,{tableName:r,isFirstRowHeaders:l,type:a}=this.state,c=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))},d=new vc({onFileCompleted:c,session:s,file:t,type:Kn.TYPES[a],readHeaders:l,onProgress:this.handleProgress,onError:this.handleError,timeZone:o,isZip:n});d.parse(),this.setState({showProgress:!0,parser:d}),i(!0)}handleZipFile(t){const{onUpdate:n,unzip:s}=this.props;if(s==null){this.handleError(new Error("No support for zip files available."));return}s(t).then(o=>{let i=!1;for(let r=0;r<o.length;r+=1){const l=o[r];if(bn.isValidExtension(l.name)){n(`Loading ${l.name} as csv from ${t.name}`),i=!0,this.handleFile(l,!0);break}}if(!i)throw new Error(`No csv file found in ${t.name}`)}).catch(o=>this.handleError(o))}handleProgress(t){const{showProgress:n}=this.state;return n&&this.setState({progressValue:t}),!n}handleCancelInProgress(){const{onInProgress:t}=this.props,{parser:n}=this.state;n&&n.cancel(),this.setState({showProgress:!1,progressValue:0}),t(!1)}openTable(){const{onOpenTable:t,onClose:n}=this.props,{tableName:s}=this.state;t(s),n()}handleQueryTypeChange(t){this.setState({type:t.target.value})}render(){const{file:t,paste:n}=this.props,{tableName:s,isFirstRowHeaders:o,showProgress:i,progressValue:r,type:l}=this.state,a=Boolean(n)&&!s;return R("div",{className:"csv-input-bar",children:[!i&&R("form",{onSubmit:this.handleUpload,className:"csv-input-bar-container form-inline",children:[R("div",{className:"form-group",children:[h("label",{htmlFor:"tableNameInput",children:"Table name"}),h("input",{ref:this.inputRef,id:"tableNameInput",type:"text",className:B("form-control",{"is-invalid":a}),value:s,onChange:this.handleTableName})]}),R("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:Ef})]}),h(ut,{className:"firstRowHeaders",checked:o,onChange:this.toggleFirstRowHeaders,children:"First row is column headers"}),R("div",{className:"csv-input-buttons form-group",children:[h(X,{kind:"secondary",onClick:this.handleCancel,children:"Cancel"}),h(X,{kind:"primary",type:"submit",disabled:!(t!==null||n!==void 0&&n!=="")||!s,children:"Upload"})]})]}),i&&R("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})}),R("label",{children:[r,"%"]}),h(X,{kind:"primary",onClick:this.handleCancelInProgress,children:"Cancel"})]})]})}}Tc.defaultProps={file:null,paste:null,unzip:null};const $l=se.module("ConsoleMenu");class hi extends T.exports.PureComponent{constructor(t){super(t),this.makeTableActions=Ie((n,s,o)=>{const i=n.filter(r=>Us.isTableType(r.type));return hi.makeItemActions(i,s,r=>{this.tableSearchField=r},this.handleTableFilterChange,o)}),this.makeWidgetActions=Ie((n,s,o)=>{const i=n.filter(r=>Us.isWidgetType(r.type));return hi.makeItemActions(i,s,r=>{this.widgetSearchField=r},this.handleWidgetFilterChange,o)}),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(t,n,s,o,i){if(t.length===0)return[];const r={menuElement:h(Jn,{value:n,onChange:o,className:"console-menu",ref:s})};let l=t;n&&(l=l.filter(({title:c})=>c!=null&&c.toLowerCase().indexOf(n.toLowerCase())>=0));const a=l.map(c=>({title:c.title,action:()=>{i(c)}}));return[r,...a]}handleTableFilterChange(t){$l.debug("filtering tables..."),this.setState({tableFilterText:t.target.value})}handleTableMenuClosed(){this.setState({tableFilterText:""})}handleTableMenuOpened(){var t;(t=this.tableSearchField)==null||t.focus()}handleWidgetFilterChange(t){$l.debug("filtering widgets..."),this.setState({widgetFilterText:t.target.value})}handleWidgetMenuClosed(){this.setState({widgetFilterText:""})}handleWidgetMenuOpened(){var t;(t=this.widgetSearchField)==null||t.focus()}render(){const{overflowActions:t,objects:n,openObject:s}=this.props,{tableFilterText:o,widgetFilterText:i}=this.state,r=this.makeTableActions(n,o,s),l=this.makeWidgetActions(n,i,s),a={placement:"bottom-end"},c=r.length===0,d=l.length===0;return R("div",{className:"console-pane-menu",children:[R(X,{kind:"ghost",className:"btn-link-icon",disabled:c,onClick:()=>{},tooltip:c?"No tables available":"Tables",children:[R("div",{className:"fa-md fa-layers",children:[h(Z,{mask:br,icon:$n,transform:"right-5 down-5"}),h(Z,{icon:$n,transform:"right-8 down-6"})]}),h(Qn,{actions:r,onMenuOpened:this.handleTableMenuOpened,onMenuClosed:this.handleTableMenuClosed,options:{initialKeyboardIndex:1},popperOptions:a},"table-actions ")]}),R(X,{kind:"ghost",className:"btn-link-icon",disabled:l.length===0,onClick:()=>{},tooltip:d?"No widgets available":"Widgets",children:[R("div",{className:"fa-md fa-layers",children:[h(Z,{mask:ia,icon:$n,transform:"right-5 down-5"}),h(Z,{icon:$n,transform:"right-8 down-6"})]}),h(Qn,{actions:l,onMenuOpened:this.handleWidgetMenuOpened,onMenuClosed:this.handleWidgetMenuClosed,options:{initialKeyboardIndex:1},popperOptions:a},"table-actions")]}),h(X,{kind:"ghost",className:"btn-overflow btn-link-icon",icon:tu,tooltip:"More Actions...",onClick:()=>{},children:h(Qn,{actions:t,popperOptions:a})})]})}}class Ec extends T.exports.PureComponent{constructor(t){super(t),this.handleCommandStarted=this.handleCommandStarted.bind(this),this.handleCommandCompleted=this.handleCommandCompleted.bind(this),this.pending=new bi,this.state={isDisconnected:!1,isCommandRunning:!1}}componentDidMount(){this.startListening()}componentWillUnmount(){this.stopListening(),this.cancelPendingPromises()}startListening(){const{session:t}=this.props;t.addEventListener(I.IdeSession.EVENT_COMMANDSTARTED,this.handleCommandStarted)}stopListening(){const{session:t}=this.props;t.removeEventListener(I.IdeSession.EVENT_COMMANDSTARTED,this.handleCommandStarted)}cancelPendingPromises(){this.pending.cancel()}handleCommandStarted(t){const{result:n}=t.detail;this.pending.add(n).then(()=>this.handleCommandCompleted(null)).catch(s=>this.handleCommandCompleted(s)),this.setState({isCommandRunning:!0})}handleCommandCompleted(t){t instanceof po||this.setState({isCommandRunning:this.pending.pending.length>0})}render(){const{children:t,openObject:n,overflowActions:s,objects:o}=this.props,{isDisconnected:i,isCommandRunning:r}=this.state;let l=null,a=null;return i?(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"),R("div",{className:"console-pane-status-bar",children:[R("div",{children:[h("div",{className:B("console-status-icon",l)}),h(We,{children:a})]}),t,h(hi,{overflowActions:s,openObject:n,objects:o})]})}}Ec.defaultProps={children:null};const mn=se.module("Console"),ql={isAutoLaunchPanelsEnabled:!0,isPrintStdOutEnabled:!0,isClosePanelsOnDisconnectEnabled:!0},co=class extends T.exports.PureComponent{constructor(e){super(e),this.processLogMessageQueue=Zn(()=>{this.scrollConsoleHistoryToBottom(),this.setState(s=>{mn.debug2("processLogMessageQueue",this.queuedLogMessages.length," items");let{consoleHistory:o}=s;return o=o.concat(this.queuedLogMessages),this.queuedLogMessages=[],{consoleHistory:o}})},co.LOG_THROTTLE),this.getObjects=Ie(s=>[...s.values()]),this.getContextActions=Ie(s=>[...s,{action:this.handleClearShortcut,shortcut:ps.CONSOLE.CLEAR},{action:this.handleFocusHistory,shortcut:ps.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=te.createRef(),this.consoleInput=te.createRef(),this.consoleHistoryScrollPane=te.createRef(),this.pending=new bi,this.queuedLogMessages=[];const{objectMap:t,settings:n}=this.props;this.state={consoleHistory:[],consoleHeight:0,isScrollDecorationShown:!1,objectHistoryMap:new Map,objectMap:new Map(t),showCsvOverlay:!1,csvFile:null,csvPaste:null,dragError:null,csvUploadInProgress:!1,...ql,...n}}static isErrorLevel(e){return e===et.STDERR||e===et.ERROR||e===et.FATAL}static isOutputLevel(e){return e===et.STDOUT||co.isErrorLevel(e)}componentDidMount(){this.initConsoleLogging();const{session:e}=this.props;e.addEventListener(I.IdeSession.EVENT_COMMANDSTARTED,this.handleCommandStarted),this.updateDimensions()}componentDidUpdate(e,t){const{props:n,state:s}=this;this.sendSettingsChange(t,s),n.objectMap!==e.objectMap&&this.updateObjectMap()}componentWillUnmount(){const{session:e}=this.props;e.removeEventListener(I.IdeSession.EVENT_COMMANDSTARTED,this.handleCommandStarted),this.pending.cancel(),this.processLogMessageQueue.cancel(),this.deinitConsoleLogging()}initConsoleLogging(){const{session:e}=this.props;this.cancelListener=e.onLogMessage(this.handleLogMessage)}deinitConsoleLogging(){this.cancelListener!=null&&(this.cancelListener(),this.cancelListener=void 0)}handleClearShortcut(e){var t;e.preventDefault(),e.stopPropagation(),(t=this.consoleInput.current)==null||t.clear()}handleCommandStarted(e){const{code:t,result:n}=e.detail,s=this.pending.add(n),o={command:t,disabledObjects:[],startTime:Date.now(),cancelResult:()=>{n.cancel()},wrappedResult:s},{commandHistoryStorage:i,language:r,scope:l}=this.props,a=i.addItem(r,l,t,{command:t,startTime:new Date().toJSON()});a.catch(c=>{mn.debug("Error adding workspace item",c)}),this.setState(c=>({consoleHistory:c.consoleHistory.concat(o)}),()=>{this.scrollConsoleHistoryToBottom(!0)}),s.then(c=>{this.handleCommandResult(c,o,a)}).catch(c=>{this.handleCommandError(c,o,a)})}handleCommandResult(e,t,n){const s={...t,wrappedResult:void 0,cancelResult:void 0,result:e!=null?e:t.result};this.setState(({consoleHistory:o})=>{const i=o.lastIndexOf(t);if(i<0)return mn.error("historyItem not found in consoleHistory"),null;const r=o.concat();return r[i]=s,{consoleHistory:r}}),e&&(this.updateHistory(e,s),this.updateKnownObjects(s),this.updateWorkspaceHistoryItem({error:e.error},n),this.closeRemovedItems(e.changes),this.openUpdatedItems(e.changes))}handleCommandError(e,t,n){if(Ue.isCanceled(e)){mn.debug("Called handleCommandError on a cancelled promise result");return}this.updateWorkspaceHistoryItem({error:`${e}`},n),this.setState(s=>{const o=s.consoleHistory.concat(),i=o.lastIndexOf(t),r={...t};return r.wrappedResult=void 0,r.cancelResult=void 0,r.endTime=Date.now(),r.result={error:e},o[i]=r,{consoleHistory:o}})}handleFocusHistory(e){e.preventDefault(),e.stopPropagation();const{focusCommandHistory:t}=this.props;t()}handleLogMessage(e){const{isPrintStdOutEnabled:t}=this.state;!t||co.isOutputLevel(e.logLevel)&&this.queueLogMessage(e.message,e.logLevel)}queueLogMessage(e,t){const n={};co.isErrorLevel(t)?n.error=e:n.message=e;const s={command:void 0,result:n};this.queuedLogMessages.push(s),this.processLogMessageQueue()}openUpdatedItems(e){const{isAutoLaunchPanelsEnabled:t}=this.state;if(e==null||!t)return;const{openObject:n}=this.props;[...e.created,...e.updated].forEach(s=>n(s))}closeRemovedItems(e){if(e==null||e.removed==null||e.removed.length===0)return;const{closeObject:t}=this.props,{removed:n}=e;n.forEach(s=>t(s))}updateHistory(e,t){const n=t;e==null||e.changes==null||n==null||(n.endTime=Date.now(),this.scrollConsoleHistoryToBottom(),this.setState(s=>({consoleHistory:s.consoleHistory.concat()})))}updateKnownObjects(e){let t;if(e.result&&(t=e.result.changes),!t||(t.created==null||t.created.length===0)&&(t.updated==null||t.updated.length===0)&&(t.removed==null||t.removed.length===0)){mn.debug2("updateKnownObjects no changes");return}this.setState(n=>{let{consoleHistory:s}=n;const o=s.lastIndexOf(e);if(o<0)return mn.error("historyItem not found in state.consoleHistory"),null;const i=new Map(n.objectHistoryMap),r=new Map(n.objectMap),l=(a,c=!1)=>{var m;const{title:d}=a;O(d);const u=i.get(d);if(u!=null&&u>=0){s===n.consoleHistory&&(s=s.concat());const p={...s[u],disabledObjects:[...(m=s[u].disabledObjects)!=null?m:[],d]};s[u]=p}i.set(d,o),c?r.delete(d):r.set(d,a)};return t==null||t.updated.forEach(a=>l(a)),t==null||t.removed.forEach(a=>l(a,!0)),t==null||t.created.forEach(a=>{const{title:c}=a;O(c),i.set(c,o),r.set(c,a)}),{objectHistoryMap:i,objectMap:r,consoleHistory:s}})}updateObjectMap(){const{objectMap:e}=this.props;this.setState({objectMap:e})}updateWorkspaceHistoryItem(e,t){const n=this.pending.add(t),s=new Date().toJSON();n.then(o=>{const i={...o,data:{...o.data,endTime:s,result:e}},{commandHistoryStorage:r,language:l}=this.props;r.updateItem(l,i).catch(a=>{mn.warn("Error updating command history storage",a)})}).catch(o=>{mn.debug("Error updating workspace history item",o)})}scrollConsoleHistoryToBottom(e=!1){const t=this.consoleHistoryScrollPane.current;O(t),!(!e&&t.scrollTop<t.scrollHeight-t.offsetHeight)&&window.requestAnimationFrame(()=>{t.scrollTop=t.scrollHeight})}handleScrollPaneScroll(){const e=this.consoleHistoryScrollPane.current;O(e),e.scrollTop>0&&e.scrollHeight>e.clientHeight?this.setState({isScrollDecorationShown:!0}):this.setState({isScrollDecorationShown:!1})}handleToggleAutoLaunchPanels(){this.setState(e=>({isAutoLaunchPanelsEnabled:!e.isAutoLaunchPanelsEnabled}))}handleToggleClosePanelsOnDisconnect(){this.setState(e=>({isClosePanelsOnDisconnectEnabled:!e.isClosePanelsOnDisconnectEnabled}))}handleTogglePrintStdout(){this.setState(e=>({isPrintStdOutEnabled:!e.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(e){this.setState({csvFile:e,csvPaste:null})}handleCsvPaste(e){this.setState({csvFile:null,csvPaste:e})}handleDragEnter(e){if(e.dataTransfer==null||e.dataTransfer.items==null||e.dataTransfer.items.length===0||e.dataTransfer.items[0].kind==="string")return;e.preventDefault(),e.stopPropagation(),this.setState({showCsvOverlay:!0});const{items:t}=e.dataTransfer;if(t.length>1){this.setState({dragError:bn.MULTIPLE_FILE_ERROR});return}const n=t[0];bn.isValidDropItem(n)?this.setState({dragError:null}):this.setState({dragError:bn.FILE_TYPE_ERROR})}handleDragLeave(e){e.currentTarget==null||e.currentTarget instanceof Element&&e.relatedTarget instanceof Element&&e.currentTarget.contains(e.relatedTarget)||(e.preventDefault(),e.stopPropagation(),this.setState({showCsvOverlay:!1,dragError:null}))}handleClearDragError(){this.setState({dragError:null})}handleOpenCsvTable(e){const{openObject:t,commandHistoryStorage:n,language:s,scope:o}=this.props,{consoleHistory:i,objectMap:r}=this.state,l={name:e,title:e,type:I.VariableType.TABLE},a=r.has(e),c={startTime:Date.now(),endTime:Date.now(),disabledObjects:[],result:{changes:{created:[],updated:[],removed:[],[a?"updated":"created"]:[l]}}},d=i.concat(c);this.setState({consoleHistory:d}),this.scrollConsoleHistoryToBottom(!0),this.updateKnownObjects(c),t({name:e,title:e,type:I.VariableType.TABLE}),n.addItem(s,o,e,{command:e,startTime:new Date().toJSON(),endTime:new Date().toJSON()})}addConsoleHistoryMessage(e,t){const{consoleHistory:n}=this.state,s={command:"",startTime:Date.now(),endTime:Date.now(),result:{message:e,error:t}},o=n.concat(s);this.setState({consoleHistory:o})}handleCsvUpdate(e){this.addConsoleHistoryMessage(e)}handleCsvError(e){this.addConsoleHistoryMessage(void 0,e!=null?`${e}`:void 0)}handleCsvInProgress(e){this.setState({csvUploadInProgress:e})}handleOverflowActions(){const{isAutoLaunchPanelsEnabled:e,isClosePanelsOnDisconnectEnabled:t,isPrintStdOutEnabled:n}=this.state,{actions:s}=this.props;return[...s,{title:"Print Stdout",action:this.handleTogglePrintStdout,group:re.groups.high,icon:n?Xn:void 0,order:10},{title:"Auto Launch Panels",action:this.handleToggleAutoLaunchPanels,group:re.groups.high,icon:e?Xn:void 0,order:20},{title:"Close Panels on Disconnect",action:this.handleToggleClosePanelsOnDisconnect,group:re.groups.high,icon:t?Xn:void 0,order:30},{title:"Upload Table from File",action:this.handleUploadCsv,group:re.groups.high+10,order:40}]}handleCommandSubmit(e){if(e==="clear"||e==="cls")this.clearConsoleHistory();else if(e.length>0){const{session:t}=this.props;t.runCode(e).catch(n=>{mn.error("There was an error initiating the command",n)})}else{const t={command:" ",result:{},startTime:Date.now(),endTime:Date.now()};this.scrollConsoleHistoryToBottom(!0),this.setState(n=>({consoleHistory:n.consoleHistory.concat(t)}))}}clearConsoleHistory(){this.pending.cancel(),this.setState(e=>{const t=new Map([...e.objectHistoryMap.keys()].map(n=>[n,-1]));return{consoleHistory:[],objectHistoryMap:t}})}addCommand(e,t=!0,n=!1){!this.consoleInput.current||(this.consoleInput.current.setConsoleText(e,t,n),t&&this.scrollConsoleHistoryToBottom(!0))}focus(){var e;(e=this.consoleInput.current)==null||e.focus()}sendSettingsChange(e,t,n=!0){const s=Object.keys(ql),o={};let i=!1;for(let l=0;l<s.length;l+=1){const a=s[l],{[a]:c}=t,{[a]:d}=e;c!==d&&(i=!0),o[a]=c}if(n&&!i)return;const{onSettingsChange:r}=this.props;r(o)}updateDimensions(){this.consolePane.current&&this.setState({consoleHeight:this.consolePane.current.clientHeight}),this.consoleInput.current&&this.consoleInput.current.updateDimensions()}render(){const{actions:e,historyChildren:t,language:n,statusBarChildren:s,openObject:o,session:i,scope:r,commandHistoryStorage:l,timeZone:a,disabled:c,unzip:d}=this.props,{consoleHeight:u,consoleHistory:m,isScrollDecorationShown:p,objectMap:g,showCsvOverlay:f,csvFile:w,csvPaste:C,dragError:S,csvUploadInProgress:b}=this.state,E=this.getObjects(g),v=Math.round(u*.7),y=this.getContextActions(e);return R("div",{role:"presentation",className:B("iris-console","h-100","w-100",{disabled:c}),children:[R("div",{className:"console-pane",ref:this.consolePane,children:[h(Ec,{session:i,overflowActions:this.handleOverflowActions,openObject:o,objects:E,children:s}),R("div",{className:"console-csv-container",onDragOver:bn.handleDragOver,onDragEnter:this.handleDragEnter,onDragLeave:this.handleDragLeave,children:[f&&h(bn,{onCancel:this.handleCsvFileCanceled,onFileOpened:this.handleCsvFileOpened,onPaste:this.handleCsvPaste,clearDragError:this.handleClearDragError,dragError:S,onError:this.handleCsvError,uploadInProgress:b,allowZip:d!=null}),R("div",{role:"presentation",className:B("scroll-pane no-scroll-x",{"scroll-decoration":p}),onScroll:this.handleScrollPaneScroll,ref:this.consoleHistoryScrollPane,children:[h(fc,{items:m,openObject:o,language:n,disabled:c}),t]})]}),!f&&h(di,{ref:this.consoleInput,session:i,language:n,scope:r,onSubmit:this.handleCommandSubmit,maxHeight:v,commandHistoryStorage:l}),f&&h(Tc,{session:i,onOpenTable:this.handleOpenCsvTable,onClose:this.handleHideCsv,onUpdate:this.handleCsvUpdate,onError:this.handleCsvError,file:w!=null?w:void 0,paste:C!=null?C:void 0,onInProgress:this.handleCsvInProgress,timeZone:a,unzip:d})]}),h(re,{actions:y,ignoreClassNames:[di.INPUT_CLASS_NAME]})]})}};let Rc=co;Rc.defaultProps={statusBarChildren:null,settings:{},onSettingsChange:()=>{},scope:null,actions:[],historyChildren:null,timeZone:"America/New_York",objectMap:new Map,disabled:!1,unzip:null};Rc.LOG_THROTTLE=500;class Gr extends T.exports.Component{constructor(t){super(t),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(t){if(this.editor){const n=this.editor.getModel();O(n),vn.setModelLanguage(n,t)}}handleResize(){this.updateDimensions()}toggleFind(){this.editor&&(this.editor.focus(),this.editor.trigger("toggleFind","actions.find",void 0))}updateDimensions(){var t;(t=this.editor)==null||t.layout()}initEditor(){const{onEditorInitialized:t}=this.props;let{settings:n}=this.props;n={copyWithSyntaxHighlighting:!1,fixedOverflowWidgets:!0,folding:!1,fontFamily:"Fira Mono",glyphMargin:!1,language:"python",lineNumbersMinChars:3,minimap:{enabled:!1},scrollBeyondLastLine:!1,tabCompletion:"on",value:"",wordWrap:"off",...n},O(this.container),this.editor=vn.create(this.container,n),this.editor.addAction({id:"find",label:"Find",keybindings:[Ft.CtrlCmd|Zt.KeyF],precondition:void 0,keybindingContext:void 0,contextMenuGroupId:"navigation",contextMenuOrder:1,run:()=>{this.toggleFind()}}),this.editor.layout(),Ge.removeConflictingKeybindings(this.editor),t(this.editor)}destroyEditor(){const{onEditorWillDestroy:t}=this.props;O(this.editor),t(this.editor),this.editor.dispose(),this.editor=void 0}render(){const{className:t}=this.props;return h("div",{className:B("editor-container",t),ref:n=>{this.container=n}})}}Gr.defaultProps={className:"fill-parent-absolute",onEditorInitialized:()=>{},onEditorWillDestroy:()=>{},settings:{}};const Dt=se.module("ScriptEditor");class Rf extends T.exports.Component{constructor(t){super(t),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=te.createRef(),this.state={model:null}}componentDidMount(){De.addEventListener("onUpdate",this.updateShortcuts)}componentDidUpdate(t){var d,u;const{sessionLanguage:n,settings:s}=this.props,o=s==null?void 0:s.language;o!==((d=t.settings)==null?void 0:d.language)&&(Dt.debug("Set language",o),this.setLanguage(o));const r=n==null&&t.sessionLanguage!=null,l=o===n,a=((u=t.settings)==null?void 0:u.language)===t.sessionLanguage;(r||n!==void 0&&a&&!l)&&(Dt.debug("De-init completion and context actions"),this.deInitContextActions(),this.deInitCodeCompletion()),(n!=null&&t.sessionLanguage==null&&l||n!==void 0&&!a&&l)&&(Dt.debug("Init completion and context actions"),this.initContextActions(),this.initCodeCompletion())}componentWillUnmount(){De.removeEventListener("onUpdate",this.updateShortcuts)}getValue(){return this.editor?this.editor.getValue():(Dt.error("Editor not initialized"),null)}getSelectedCommand(){var c,d;const t=(c=this.editor)==null?void 0:c.getSelection();O(t);const n=(d=this.editor)==null?void 0:d.getModel();O(n);const{startLineNumber:s,endColumn:o}=t;let{endLineNumber:i}=t;o===1&&i>s&&(i-=1);const r=n==null?void 0:n.getLineMinColumn(s),l=n==null?void 0:n.getLineMaxColumn(i),a=t.setStartPosition(s,r).setEndPosition(i,l);return n==null?void 0:n.getValueInRange(a)}handleEditorInitialized(t){const{focusOnMount:n,onChange:s,onEditorInitialized:o,settings:i,session:r,sessionLanguage:l}=this.props;Dt.debug("handleEditorInitialized",l,r,i),this.editor=t,this.setState({model:this.editor.getModel()}),Ge.setEOL(t),Ge.registerPasteHandler(t),r!=null&&i&&l===i.language&&(this.initContextActions(),this.initCodeCompletion()),t.onDidChangeModelContent(s),n!=null&&n&&t.focus(),o(this.editor)}handleEditorWillDestroy(t){Dt.debug("handleEditorWillDestroy");const{onEditorWillDestroy:n}=this.props;n(t),this.deInitContextActions(),this.deInitCodeCompletion(),this.setState({model:null}),this.editor=void 0}handleRun(){const{onRunCommand:t}=this.props,n=this.getValue();n!=null&&t(n)}handleRunSelected(){const{onRunCommand:t}=this.props,n=this.getSelectedCommand();t(n)}initContextActions(){if(this.contextActionCleanups.length>0){Dt.error("Context actions already initialized.");return}if(!this.editor)return;const t=[];t.push(this.editor.addAction({id:"run-code",label:"Run",keybindings:[Ge.getMonacoKeyCodeFromShortcut(ps.NOTEBOOK.RUN)],contextMenuGroupId:"navigation",contextMenuOrder:1.5,run:()=>{this.handleRun()}})),t.push(this.editor.addAction({id:"run-selected-code",label:"Run Selected",keybindings:[Ge.getMonacoKeyCodeFromShortcut(ps.NOTEBOOK.RUN_SELECTED)],contextMenuGroupId:"navigation",contextMenuOrder:1.5,run:()=>{this.handleRunSelected()}})),this.contextActionCleanups=t}deInitContextActions(){this.contextActionCleanups.length>0&&(this.contextActionCleanups.forEach(t=>t.dispose()),this.contextActionCleanups=[])}updateShortcuts(){this.deInitContextActions(),this.initContextActions()}initCodeCompletion(){if(this.completionCleanup!=null){Dt.error("Code completion already initialized.");return}const{session:t}=this.props;Dt.debug("initCodeCompletion",this.editor,t),this.editor&&t!=null&&(this.completionCleanup=Ge.openDocument(this.editor,t))}deInitCodeCompletion(){const{session:t}=this.props;Dt.debug("deInitCodeCompletion",this.editor,t),this.completionCleanup&&(this.completionCleanup.dispose(),this.completionCleanup=void 0,this.editor&&t!=null&&Ge.closeDocument(this.editor,t))}append(t,n=!0){O(this.editor);const s=this.editor.getModel();O(s);const o=s.getValue();o?s.setValue(`${o}
|
|
22
|
+
`,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 Wl=se.module("CsvInputBar"),Ef=Object.entries(Kn.TYPES).map(([e,t])=>h("option",{value:e,children:t.name},e));class Tc extends T.exports.Component{constructor(t){super(t),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=te.createRef(),this.state={tableName:"",tableNameSet:!1,isFirstRowHeaders:!0,showProgress:!1,progressValue:0,type:Kn.DEFAULT_TYPE,parser:null}}componentDidUpdate(t){var r;const{file:n,paste:s}=this.props,{tableName:o,tableNameSet:i}=this.state;if(!i&&n!=null&&!o){const l=n.name.lastIndexOf("."),a=_t.legalizeTableName(n.name.substring(0,l));this.setState({tableName:a,tableNameSet:!0}),(r=this.inputRef.current)==null||r.focus()}else(n==null&&t.file!=null||s==null&&t.paste!=null)&&this.setState({tableName:"",tableNameSet:!1});s!=null&&s!==""&&!o&&this.inputRef.current&&this.inputRef.current.focus(),n!=null&&n!==t.file?this.setState({type:Kn.fromExtension(n.name)}):s!=null&&s!==""&&(t.paste===void 0||t.paste==="")&&this.setState({type:Kn.AUTO})}componentWillUnmount(){const{parser:t}=this.state;t&&t.cancel()}handleCancel(){const{onClose:t}=this.props;t()}handleError(t){const{onClose:n,onError:s}=this.props;Wl.error(t),s(t),n()}handleTableName(t){this.setState({tableName:t.target.value,tableNameSet:!0})}toggleFirstRowHeaders(){const{isFirstRowHeaders:t}=this.state;this.setState({isFirstRowHeaders:!t})}handleUpload(t){t.stopPropagation(),t.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(t,n=!1){Wl.info(`Starting CSV parser for ${t instanceof File?t.name:"pasted values"} ${n?"":t.size} bytes`);const{session:s,timeZone:o,onInProgress:i}=this.props,{tableName:r,isFirstRowHeaders:l,type:a}=this.state,c=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))},d=new vc({onFileCompleted:c,session:s,file:t,type:Kn.TYPES[a],readHeaders:l,onProgress:this.handleProgress,onError:this.handleError,timeZone:o,isZip:n});d.parse(),this.setState({showProgress:!0,parser:d}),i(!0)}handleZipFile(t){const{onUpdate:n,unzip:s}=this.props;if(s==null){this.handleError(new Error("No support for zip files available."));return}s(t).then(o=>{let i=!1;for(let r=0;r<o.length;r+=1){const l=o[r];if(Sn.isValidExtension(l.name)){n(`Loading ${l.name} as csv from ${t.name}`),i=!0,this.handleFile(l,!0);break}}if(!i)throw new Error(`No csv file found in ${t.name}`)}).catch(o=>this.handleError(o))}handleProgress(t){const{showProgress:n}=this.state;return n&&this.setState({progressValue:t}),!n}handleCancelInProgress(){const{onInProgress:t}=this.props,{parser:n}=this.state;n&&n.cancel(),this.setState({showProgress:!1,progressValue:0}),t(!1)}openTable(){const{onOpenTable:t,onClose:n}=this.props,{tableName:s}=this.state;t(s),n()}handleQueryTypeChange(t){this.setState({type:t.target.value})}render(){const{file:t,paste:n}=this.props,{tableName:s,isFirstRowHeaders:o,showProgress:i,progressValue:r,type:l}=this.state,a=Boolean(n)&&!s;return R("div",{className:"csv-input-bar",children:[!i&&R("form",{onSubmit:this.handleUpload,className:"csv-input-bar-container form-inline",children:[R("div",{className:"form-group",children:[h("label",{htmlFor:"tableNameInput",children:"Table name"}),h("input",{ref:this.inputRef,id:"tableNameInput",type:"text",className:B("form-control",{"is-invalid":a}),value:s,onChange:this.handleTableName})]}),R("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:Ef})]}),h(ut,{className:"firstRowHeaders",checked:o,onChange:this.toggleFirstRowHeaders,children:"First row is column headers"}),R("div",{className:"csv-input-buttons form-group",children:[h(X,{kind:"secondary",onClick:this.handleCancel,children:"Cancel"}),h(X,{kind:"primary",type:"submit",disabled:!(t!==null||n!==void 0&&n!=="")||!s,children:"Upload"})]})]}),i&&R("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})}),R("label",{children:[r,"%"]}),h(X,{kind:"primary",onClick:this.handleCancelInProgress,children:"Cancel"})]})]})}}Tc.defaultProps={file:null,paste:null,unzip:null};const $l=se.module("ConsoleMenu");class hi extends T.exports.PureComponent{constructor(t){super(t),this.makeTableActions=Ie((n,s,o)=>{const i=n.filter(r=>Us.isTableType(r.type));return hi.makeItemActions(i,s,r=>{this.tableSearchField=r},this.handleTableFilterChange,o)}),this.makeWidgetActions=Ie((n,s,o)=>{const i=n.filter(r=>Us.isWidgetType(r.type));return hi.makeItemActions(i,s,r=>{this.widgetSearchField=r},this.handleWidgetFilterChange,o)}),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(t,n,s,o,i){if(t.length===0)return[];const r={menuElement:h(Jn,{value:n,onChange:o,className:"console-menu",ref:s})};let l=t;n&&(l=l.filter(({title:c})=>c!=null&&c.toLowerCase().indexOf(n.toLowerCase())>=0));const a=l.map(c=>({title:c.title,action:()=>{i(c)}}));return[r,...a]}handleTableFilterChange(t){$l.debug("filtering tables..."),this.setState({tableFilterText:t.target.value})}handleTableMenuClosed(){this.setState({tableFilterText:""})}handleTableMenuOpened(){var t;(t=this.tableSearchField)==null||t.focus()}handleWidgetFilterChange(t){$l.debug("filtering widgets..."),this.setState({widgetFilterText:t.target.value})}handleWidgetMenuClosed(){this.setState({widgetFilterText:""})}handleWidgetMenuOpened(){var t;(t=this.widgetSearchField)==null||t.focus()}render(){const{overflowActions:t,objects:n,openObject:s}=this.props,{tableFilterText:o,widgetFilterText:i}=this.state,r=this.makeTableActions(n,o,s),l=this.makeWidgetActions(n,i,s),a={placement:"bottom-end"},c=r.length===0,d=l.length===0;return R("div",{className:"console-pane-menu",children:[R(X,{kind:"ghost",className:"btn-link-icon",disabled:c,onClick:()=>{},tooltip:c?"No tables available":"Tables",children:[R("div",{className:"fa-md fa-layers",children:[h(Z,{mask:br,icon:$n,transform:"right-5 down-5"}),h(Z,{icon:$n,transform:"right-8 down-6"})]}),h(Qn,{actions:r,onMenuOpened:this.handleTableMenuOpened,onMenuClosed:this.handleTableMenuClosed,options:{initialKeyboardIndex:1},popperOptions:a},"table-actions ")]}),R(X,{kind:"ghost",className:"btn-link-icon",disabled:l.length===0,onClick:()=>{},tooltip:d?"No widgets available":"Widgets",children:[R("div",{className:"fa-md fa-layers",children:[h(Z,{mask:ia,icon:$n,transform:"right-5 down-5"}),h(Z,{icon:$n,transform:"right-8 down-6"})]}),h(Qn,{actions:l,onMenuOpened:this.handleWidgetMenuOpened,onMenuClosed:this.handleWidgetMenuClosed,options:{initialKeyboardIndex:1},popperOptions:a},"table-actions")]}),h(X,{kind:"ghost",className:"btn-overflow btn-link-icon",icon:tu,tooltip:"More Actions...",onClick:()=>{},children:h(Qn,{actions:t,popperOptions:a})})]})}}class Ec extends T.exports.PureComponent{constructor(t){super(t),this.handleCommandStarted=this.handleCommandStarted.bind(this),this.handleCommandCompleted=this.handleCommandCompleted.bind(this),this.pending=new bi,this.state={isDisconnected:!1,isCommandRunning:!1}}componentDidMount(){this.startListening()}componentWillUnmount(){this.stopListening(),this.cancelPendingPromises()}startListening(){const{session:t}=this.props;t.addEventListener(I.IdeSession.EVENT_COMMANDSTARTED,this.handleCommandStarted)}stopListening(){const{session:t}=this.props;t.removeEventListener(I.IdeSession.EVENT_COMMANDSTARTED,this.handleCommandStarted)}cancelPendingPromises(){this.pending.cancel()}handleCommandStarted(t){const{result:n}=t.detail;this.pending.add(n).then(()=>this.handleCommandCompleted(null)).catch(s=>this.handleCommandCompleted(s)),this.setState({isCommandRunning:!0})}handleCommandCompleted(t){t instanceof po||this.setState({isCommandRunning:this.pending.pending.length>0})}render(){const{children:t,openObject:n,overflowActions:s,objects:o}=this.props,{isDisconnected:i,isCommandRunning:r}=this.state;let l=null,a=null;return i?(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"),R("div",{className:"console-pane-status-bar",children:[R("div",{children:[h("div",{className:B("console-status-icon",l)}),h(We,{children:a})]}),t,h(hi,{overflowActions:s,openObject:n,objects:o})]})}}Ec.defaultProps={children:null};const hn=se.module("Console"),ql={isAutoLaunchPanelsEnabled:!0,isPrintStdOutEnabled:!0,isClosePanelsOnDisconnectEnabled:!0},co=class extends T.exports.PureComponent{constructor(e){super(e),this.processLogMessageQueue=Zn(()=>{this.scrollConsoleHistoryToBottom(),this.setState(s=>{hn.debug2("processLogMessageQueue",this.queuedLogMessages.length," items");let{consoleHistory:o}=s;return o=o.concat(this.queuedLogMessages),this.queuedLogMessages=[],{consoleHistory:o}})},co.LOG_THROTTLE),this.getObjects=Ie(s=>[...s.values()]),this.getContextActions=Ie(s=>[...s,{action:this.handleClearShortcut,shortcut:ps.CONSOLE.CLEAR},{action:this.handleFocusHistory,shortcut:ps.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=te.createRef(),this.consoleInput=te.createRef(),this.consoleHistoryScrollPane=te.createRef(),this.pending=new bi,this.queuedLogMessages=[];const{objectMap:t,settings:n}=this.props;this.state={consoleHistory:[],consoleHeight:0,isScrollDecorationShown:!1,objectHistoryMap:new Map,objectMap:new Map(t),showCsvOverlay:!1,csvFile:null,csvPaste:null,dragError:null,csvUploadInProgress:!1,...ql,...n}}static isErrorLevel(e){return e===et.STDERR||e===et.ERROR||e===et.FATAL}static isOutputLevel(e){return e===et.STDOUT||co.isErrorLevel(e)}componentDidMount(){this.initConsoleLogging();const{session:e}=this.props;e.addEventListener(I.IdeSession.EVENT_COMMANDSTARTED,this.handleCommandStarted),this.updateDimensions()}componentDidUpdate(e,t){const{props:n,state:s}=this;this.sendSettingsChange(t,s),n.objectMap!==e.objectMap&&this.updateObjectMap()}componentWillUnmount(){const{session:e}=this.props;e.removeEventListener(I.IdeSession.EVENT_COMMANDSTARTED,this.handleCommandStarted),this.pending.cancel(),this.processLogMessageQueue.cancel(),this.deinitConsoleLogging()}initConsoleLogging(){const{session:e}=this.props;this.cancelListener=e.onLogMessage(this.handleLogMessage)}deinitConsoleLogging(){this.cancelListener!=null&&(this.cancelListener(),this.cancelListener=void 0)}handleClearShortcut(e){var t;e.preventDefault(),e.stopPropagation(),(t=this.consoleInput.current)==null||t.clear()}handleCommandStarted(e){const{code:t,result:n}=e.detail,s=this.pending.add(n),o={command:t,disabledObjects:[],startTime:Date.now(),cancelResult:()=>{n.cancel()},wrappedResult:s},{commandHistoryStorage:i,language:r,scope:l}=this.props,a=i.addItem(r,l,t,{command:t,startTime:new Date().toJSON()});a.catch(c=>{hn.debug("Error adding workspace item",c)}),this.setState(c=>({consoleHistory:c.consoleHistory.concat(o)}),()=>{this.scrollConsoleHistoryToBottom(!0)}),s.then(c=>{this.handleCommandResult(c,o,a)}).catch(c=>{this.handleCommandError(c,o,a)})}handleCommandResult(e,t,n){const s={...t,wrappedResult:void 0,cancelResult:void 0,result:e!=null?e:t.result};this.setState(({consoleHistory:o})=>{const i=o.lastIndexOf(t);if(i<0)return hn.error("historyItem not found in consoleHistory"),null;const r=o.concat();return r[i]=s,{consoleHistory:r}}),e&&(this.updateHistory(e,s),this.updateKnownObjects(s),this.updateWorkspaceHistoryItem({error:e.error},n),this.closeRemovedItems(e.changes),this.openUpdatedItems(e.changes))}handleCommandError(e,t,n){if(Ue.isCanceled(e)){hn.debug("Called handleCommandError on a cancelled promise result");return}this.updateWorkspaceHistoryItem({error:`${e}`},n),this.setState(s=>{const o=s.consoleHistory.concat(),i=o.lastIndexOf(t),r={...t};return r.wrappedResult=void 0,r.cancelResult=void 0,r.endTime=Date.now(),r.result={error:e},o[i]=r,{consoleHistory:o}})}handleFocusHistory(e){e.preventDefault(),e.stopPropagation();const{focusCommandHistory:t}=this.props;t()}handleLogMessage(e){const{isPrintStdOutEnabled:t}=this.state;!t||co.isOutputLevel(e.logLevel)&&this.queueLogMessage(e.message,e.logLevel)}queueLogMessage(e,t){const n={};co.isErrorLevel(t)?n.error=e:n.message=e;const s={command:void 0,result:n};this.queuedLogMessages.push(s),this.processLogMessageQueue()}openUpdatedItems(e){const{isAutoLaunchPanelsEnabled:t}=this.state;if(e==null||!t)return;const{openObject:n}=this.props;[...e.created,...e.updated].forEach(s=>n(s))}closeRemovedItems(e){if(e==null||e.removed==null||e.removed.length===0)return;const{closeObject:t}=this.props,{removed:n}=e;n.forEach(s=>t(s))}updateHistory(e,t){const n=t;e==null||e.changes==null||n==null||(n.endTime=Date.now(),this.scrollConsoleHistoryToBottom(),this.setState(s=>({consoleHistory:s.consoleHistory.concat()})))}updateKnownObjects(e){let t;if(e.result&&(t=e.result.changes),!t||(t.created==null||t.created.length===0)&&(t.updated==null||t.updated.length===0)&&(t.removed==null||t.removed.length===0)){hn.debug2("updateKnownObjects no changes");return}this.setState(n=>{let{consoleHistory:s}=n;const o=s.lastIndexOf(e);if(o<0)return hn.error("historyItem not found in state.consoleHistory"),null;const i=new Map(n.objectHistoryMap),r=new Map(n.objectMap),l=(a,c=!1)=>{var m;const{title:d}=a;O(d);const u=i.get(d);if(u!=null&&u>=0){s===n.consoleHistory&&(s=s.concat());const p={...s[u],disabledObjects:[...(m=s[u].disabledObjects)!=null?m:[],d]};s[u]=p}i.set(d,o),c?r.delete(d):r.set(d,a)};return t==null||t.updated.forEach(a=>l(a)),t==null||t.removed.forEach(a=>l(a,!0)),t==null||t.created.forEach(a=>{const{title:c}=a;O(c),i.set(c,o),r.set(c,a)}),{objectHistoryMap:i,objectMap:r,consoleHistory:s}})}updateObjectMap(){const{objectMap:e}=this.props;this.setState({objectMap:e})}updateWorkspaceHistoryItem(e,t){const n=this.pending.add(t),s=new Date().toJSON();n.then(o=>{const i={...o,data:{...o.data,endTime:s,result:e}},{commandHistoryStorage:r,language:l}=this.props;r.updateItem(l,i).catch(a=>{hn.warn("Error updating command history storage",a)})}).catch(o=>{hn.debug("Error updating workspace history item",o)})}scrollConsoleHistoryToBottom(e=!1){const t=this.consoleHistoryScrollPane.current;O(t),!(!e&&t.scrollTop<t.scrollHeight-t.offsetHeight)&&window.requestAnimationFrame(()=>{t.scrollTop=t.scrollHeight})}handleScrollPaneScroll(){const e=this.consoleHistoryScrollPane.current;O(e),e.scrollTop>0&&e.scrollHeight>e.clientHeight?this.setState({isScrollDecorationShown:!0}):this.setState({isScrollDecorationShown:!1})}handleToggleAutoLaunchPanels(){this.setState(e=>({isAutoLaunchPanelsEnabled:!e.isAutoLaunchPanelsEnabled}))}handleToggleClosePanelsOnDisconnect(){this.setState(e=>({isClosePanelsOnDisconnectEnabled:!e.isClosePanelsOnDisconnectEnabled}))}handleTogglePrintStdout(){this.setState(e=>({isPrintStdOutEnabled:!e.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(e){this.setState({csvFile:e,csvPaste:null})}handleCsvPaste(e){this.setState({csvFile:null,csvPaste:e})}handleDragEnter(e){if(e.dataTransfer==null||e.dataTransfer.items==null||e.dataTransfer.items.length===0||e.dataTransfer.items[0].kind==="string")return;e.preventDefault(),e.stopPropagation(),this.setState({showCsvOverlay:!0});const{items:t}=e.dataTransfer;if(t.length>1){this.setState({dragError:Sn.MULTIPLE_FILE_ERROR});return}const n=t[0];Sn.isValidDropItem(n)?this.setState({dragError:null}):this.setState({dragError:Sn.FILE_TYPE_ERROR})}handleDragLeave(e){e.currentTarget==null||e.currentTarget instanceof Element&&e.relatedTarget instanceof Element&&e.currentTarget.contains(e.relatedTarget)||(e.preventDefault(),e.stopPropagation(),this.setState({showCsvOverlay:!1,dragError:null}))}handleClearDragError(){this.setState({dragError:null})}handleOpenCsvTable(e){const{openObject:t,commandHistoryStorage:n,language:s,scope:o}=this.props,{consoleHistory:i,objectMap:r}=this.state,l={name:e,title:e,type:I.VariableType.TABLE},a=r.has(e),c={startTime:Date.now(),endTime:Date.now(),disabledObjects:[],result:{changes:{created:[],updated:[],removed:[],[a?"updated":"created"]:[l]}}},d=i.concat(c);this.setState({consoleHistory:d}),this.scrollConsoleHistoryToBottom(!0),this.updateKnownObjects(c),t({name:e,title:e,type:I.VariableType.TABLE}),n.addItem(s,o,e,{command:e,startTime:new Date().toJSON(),endTime:new Date().toJSON()})}addConsoleHistoryMessage(e,t){const{consoleHistory:n}=this.state,s={command:"",startTime:Date.now(),endTime:Date.now(),result:{message:e,error:t}},o=n.concat(s);this.setState({consoleHistory:o})}handleCsvUpdate(e){this.addConsoleHistoryMessage(e)}handleCsvError(e){this.addConsoleHistoryMessage(void 0,e!=null?`${e}`:void 0)}handleCsvInProgress(e){this.setState({csvUploadInProgress:e})}handleOverflowActions(){const{isAutoLaunchPanelsEnabled:e,isClosePanelsOnDisconnectEnabled:t,isPrintStdOutEnabled:n}=this.state,{actions:s}=this.props;return[...s,{title:"Print Stdout",action:this.handleTogglePrintStdout,group:re.groups.high,icon:n?Xn:void 0,order:10},{title:"Auto Launch Panels",action:this.handleToggleAutoLaunchPanels,group:re.groups.high,icon:e?Xn:void 0,order:20},{title:"Close Panels on Disconnect",action:this.handleToggleClosePanelsOnDisconnect,group:re.groups.high,icon:t?Xn:void 0,order:30},{title:"Upload Table from File",action:this.handleUploadCsv,group:re.groups.high+10,order:40}]}handleCommandSubmit(e){if(e==="clear"||e==="cls")this.clearConsoleHistory();else if(e.length>0){const{session:t}=this.props;t.runCode(e).catch(n=>{hn.error("There was an error initiating the command",n)})}else{const t={command:" ",result:{},startTime:Date.now(),endTime:Date.now()};this.scrollConsoleHistoryToBottom(!0),this.setState(n=>({consoleHistory:n.consoleHistory.concat(t)}))}}clearConsoleHistory(){this.pending.cancel(),this.setState(e=>{const t=new Map([...e.objectHistoryMap.keys()].map(n=>[n,-1]));return{consoleHistory:[],objectHistoryMap:t}})}addCommand(e,t=!0,n=!1){!this.consoleInput.current||(this.consoleInput.current.setConsoleText(e,t,n),t&&this.scrollConsoleHistoryToBottom(!0))}focus(){var e;(e=this.consoleInput.current)==null||e.focus()}sendSettingsChange(e,t,n=!0){const s=Object.keys(ql),o={};let i=!1;for(let l=0;l<s.length;l+=1){const a=s[l],{[a]:c}=t,{[a]:d}=e;c!==d&&(i=!0),o[a]=c}if(n&&!i)return;const{onSettingsChange:r}=this.props;r(o)}updateDimensions(){this.consolePane.current&&this.setState({consoleHeight:this.consolePane.current.clientHeight}),this.consoleInput.current&&this.consoleInput.current.updateDimensions()}render(){const{actions:e,historyChildren:t,language:n,statusBarChildren:s,openObject:o,session:i,scope:r,commandHistoryStorage:l,timeZone:a,disabled:c,unzip:d}=this.props,{consoleHeight:u,consoleHistory:m,isScrollDecorationShown:p,objectMap:g,showCsvOverlay:f,csvFile:w,csvPaste:C,dragError:S,csvUploadInProgress:b}=this.state,E=this.getObjects(g),v=Math.round(u*.7),y=this.getContextActions(e);return R("div",{role:"presentation",className:B("iris-console","h-100","w-100",{disabled:c}),children:[R("div",{className:"console-pane",ref:this.consolePane,children:[h(Ec,{session:i,overflowActions:this.handleOverflowActions,openObject:o,objects:E,children:s}),R("div",{className:"console-csv-container",onDragOver:Sn.handleDragOver,onDragEnter:this.handleDragEnter,onDragLeave:this.handleDragLeave,children:[f&&h(Sn,{onCancel:this.handleCsvFileCanceled,onFileOpened:this.handleCsvFileOpened,onPaste:this.handleCsvPaste,clearDragError:this.handleClearDragError,dragError:S,onError:this.handleCsvError,uploadInProgress:b,allowZip:d!=null}),R("div",{role:"presentation",className:B("scroll-pane no-scroll-x",{"scroll-decoration":p}),onScroll:this.handleScrollPaneScroll,ref:this.consoleHistoryScrollPane,children:[h(fc,{items:m,openObject:o,language:n,disabled:c}),t]})]}),!f&&h(di,{ref:this.consoleInput,session:i,language:n,scope:r,onSubmit:this.handleCommandSubmit,maxHeight:v,commandHistoryStorage:l}),f&&h(Tc,{session:i,onOpenTable:this.handleOpenCsvTable,onClose:this.handleHideCsv,onUpdate:this.handleCsvUpdate,onError:this.handleCsvError,file:w!=null?w:void 0,paste:C!=null?C:void 0,onInProgress:this.handleCsvInProgress,timeZone:a,unzip:d})]}),h(re,{actions:y,ignoreClassNames:[di.INPUT_CLASS_NAME]})]})}};let Rc=co;Rc.defaultProps={statusBarChildren:null,settings:{},onSettingsChange:()=>{},scope:null,actions:[],historyChildren:null,timeZone:"America/New_York",objectMap:new Map,disabled:!1,unzip:null};Rc.LOG_THROTTLE=500;class Gr extends T.exports.Component{constructor(t){super(t),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(t){if(this.editor){const n=this.editor.getModel();O(n),bn.setModelLanguage(n,t)}}handleResize(){this.updateDimensions()}toggleFind(){this.editor&&(this.editor.focus(),this.editor.trigger("toggleFind","actions.find",void 0))}updateDimensions(){var t;(t=this.editor)==null||t.layout()}initEditor(){const{onEditorInitialized:t}=this.props;let{settings:n}=this.props;n={copyWithSyntaxHighlighting:!1,fixedOverflowWidgets:!0,folding:!1,fontFamily:"Fira Mono",glyphMargin:!1,language:"python",lineNumbersMinChars:3,minimap:{enabled:!1},scrollBeyondLastLine:!1,tabCompletion:"on",value:"",wordWrap:"off",...n},O(this.container),this.editor=bn.create(this.container,n),this.editor.addAction({id:"find",label:"Find",keybindings:[Ft.CtrlCmd|Wn.KeyF],precondition:void 0,keybindingContext:void 0,contextMenuGroupId:"navigation",contextMenuOrder:1,run:()=>{this.toggleFind()}}),this.editor.layout(),Ge.removeConflictingKeybindings(this.editor),t(this.editor)}destroyEditor(){const{onEditorWillDestroy:t}=this.props;O(this.editor),t(this.editor),this.editor.dispose(),this.editor=void 0}render(){const{className:t}=this.props;return h("div",{className:B("editor-container",t),ref:n=>{this.container=n}})}}Gr.defaultProps={className:"fill-parent-absolute",onEditorInitialized:()=>{},onEditorWillDestroy:()=>{},settings:{}};const Dt=se.module("ScriptEditor");class Rf extends T.exports.Component{constructor(t){super(t),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=te.createRef(),this.state={model:null}}componentDidMount(){De.addEventListener("onUpdate",this.updateShortcuts)}componentDidUpdate(t){var d,u;const{sessionLanguage:n,settings:s}=this.props,o=s==null?void 0:s.language;o!==((d=t.settings)==null?void 0:d.language)&&(Dt.debug("Set language",o),this.setLanguage(o));const r=n==null&&t.sessionLanguage!=null,l=o===n,a=((u=t.settings)==null?void 0:u.language)===t.sessionLanguage;(r||n!==void 0&&a&&!l)&&(Dt.debug("De-init completion and context actions"),this.deInitContextActions(),this.deInitCodeCompletion()),(n!=null&&t.sessionLanguage==null&&l||n!==void 0&&!a&&l)&&(Dt.debug("Init completion and context actions"),this.initContextActions(),this.initCodeCompletion())}componentWillUnmount(){De.removeEventListener("onUpdate",this.updateShortcuts)}getValue(){return this.editor?this.editor.getValue():(Dt.error("Editor not initialized"),null)}getSelectedCommand(){var c,d;const t=(c=this.editor)==null?void 0:c.getSelection();O(t);const n=(d=this.editor)==null?void 0:d.getModel();O(n);const{startLineNumber:s,endColumn:o}=t;let{endLineNumber:i}=t;o===1&&i>s&&(i-=1);const r=n==null?void 0:n.getLineMinColumn(s),l=n==null?void 0:n.getLineMaxColumn(i),a=t.setStartPosition(s,r).setEndPosition(i,l);return n==null?void 0:n.getValueInRange(a)}handleEditorInitialized(t){const{focusOnMount:n,onChange:s,onEditorInitialized:o,settings:i,session:r,sessionLanguage:l}=this.props;Dt.debug("handleEditorInitialized",l,r,i),this.editor=t,this.setState({model:this.editor.getModel()}),Ge.setEOL(t),Ge.registerPasteHandler(t),r!=null&&i&&l===i.language&&(this.initContextActions(),this.initCodeCompletion()),t.onDidChangeModelContent(s),n!=null&&n&&t.focus(),o(this.editor)}handleEditorWillDestroy(t){Dt.debug("handleEditorWillDestroy");const{onEditorWillDestroy:n}=this.props;n(t),this.deInitContextActions(),this.deInitCodeCompletion(),this.setState({model:null}),this.editor=void 0}handleRun(){const{onRunCommand:t}=this.props,n=this.getValue();n!=null&&t(n)}handleRunSelected(){const{onRunCommand:t}=this.props,n=this.getSelectedCommand();t(n)}initContextActions(){if(this.contextActionCleanups.length>0){Dt.error("Context actions already initialized.");return}if(!this.editor)return;const t=[];t.push(this.editor.addAction({id:"run-code",label:"Run",keybindings:[Ge.getMonacoKeyCodeFromShortcut(ps.NOTEBOOK.RUN)],contextMenuGroupId:"navigation",contextMenuOrder:1.5,run:()=>{this.handleRun()}})),t.push(this.editor.addAction({id:"run-selected-code",label:"Run Selected",keybindings:[Ge.getMonacoKeyCodeFromShortcut(ps.NOTEBOOK.RUN_SELECTED)],contextMenuGroupId:"navigation",contextMenuOrder:1.5,run:()=>{this.handleRunSelected()}})),this.contextActionCleanups=t}deInitContextActions(){this.contextActionCleanups.length>0&&(this.contextActionCleanups.forEach(t=>t.dispose()),this.contextActionCleanups=[])}updateShortcuts(){this.deInitContextActions(),this.initContextActions()}initCodeCompletion(){if(this.completionCleanup!=null){Dt.error("Code completion already initialized.");return}const{session:t}=this.props;Dt.debug("initCodeCompletion",this.editor,t),this.editor&&t!=null&&(this.completionCleanup=Ge.openDocument(this.editor,t))}deInitCodeCompletion(){const{session:t}=this.props;Dt.debug("deInitCodeCompletion",this.editor,t),this.completionCleanup&&(this.completionCleanup.dispose(),this.completionCleanup=void 0,this.editor&&t!=null&&Ge.closeDocument(this.editor,t))}append(t,n=!0){O(this.editor);const s=this.editor.getModel();O(s);const o=s.getValue();o?s.setValue(`${o}
|
|
23
23
|
${t}`):s.setValue(`${t}`);const i=s.getLineCount(),r=s.getLineLength(i)+1;this.editor.setPosition({lineNumber:i,column:r}),n&&this.editor.focus()}updateDimensions(){Dt.debug("updateDimensions"),this.editor&&this.editor.layout()}focus(){Dt.debug("focus"),this.editor&&this.editor.focus()}toggleFind(){this.editorComponent.current&&this.editorComponent.current.toggleFind()}setLanguage(t){this.editorComponent.current&&t!==void 0&&this.editorComponent.current.setLanguage(t)}render(){var u;const{error:t,isLoaded:n,isLoading:s,session:o,sessionLanguage:i,settings:r}=this.props,{model:l}=this.state,a=t?`Unable to open document. ${t}`:null,c=r&&(u=r.language)!=null?u:null,d=l&&o&&c===i;return R(Fe,{children:[(t||s)&&h("div",{className:"h-100 w-100 position-relative",children:h(Da,{errorMessage:a,isLoading:s,isLoaded:n})}),n&&h("div",{className:"h-100 w-100 script-editor",children:r&&R(Fe,{children:[h(Gr,{ref:this.editorComponent,settings:r,onEditorInitialized:this.handleEditorInitialized,onEditorWillDestroy:this.handleEditorWillDestroy}),d!=null&&d&&h(Cc,{model:l,language:c,session:o})]})})]})}}Rf.defaultProps={error:null,isLoading:!1,isLoaded:!1,focusOnMount:!0,onChange:()=>{},onEditorInitialized:()=>{},onEditorWillDestroy:()=>{},session:null};const yf=250,If=2500,yc=class extends T.exports.Component{constructor(e){super(e),this.loadData=ft(()=>{const{commandHistoryStorage:t,item:n,language:s}=this.props,{id:o}=n;this.cleanup=t.listenItem(s,o,this.handleUpdate,this.handleError)},yf),this.getPreviewText=he(t=>t.split(`
|
|
24
24
|
`,If).join(`
|
|
25
|
-
`),{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(e,t){if(e==null||t===""||t===0)return null;const n=Math.round((new Date(t).valueOf()-new Date(e).valueOf())/1e3);return n<1?"<1s":
|
|
26
|
-
`))}updateActions(){this.setState(e=>{const{selectedRanges:t}=e,n=t.reduce((s,o)=>s+o[1]-o[0]+1,0);return n>0&&n<
|
|
25
|
+
`),{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(e,t){if(e==null||t===""||t===0)return null;const n=Math.round((new Date(t).valueOf()-new Date(e).valueOf())/1e3);return n<1?"<1s":en.formatElapsedTime(n)}componentDidMount(){this.loadData()}componentDidUpdate(e,t){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=t.data)!=null&&s.result)||Boolean(n==null?void 0:n.endTime)&&!(t.data==null||t.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(e){this.setState({error:`${e}`})}handleUpdate(e){const{data:t}=e!=null?e:{};this.setState({data:t});const{onUpdate:n}=this.props;n==null||n(t)}handleTimeout(){this.updateTime()}render(){var m;const{item:{name:e},language:t}=this.props,{currentTime:n,data:s,error:o}=this.state,{result:i,startTime:r,endTime:l}=s!=null?s:{},a=(m=i==null?void 0:i.error)!=null?m:o,c=yc.getTimeString(r,l!=null?l:n),d=this.getPreviewText(e),u=Boolean(c);return R("div",{className:"command-history-item-tooltip",children:[R("div",{className:"scroll-container",children:[h(uc,{language:t,children:d}),d.length<e.length&&h("p",{children:"Preview Truncated..."})]}),R("div",{className:"result-info",children:[R("div",{className:"d-flex justify-content-between",children:[Boolean(a)&&R("div",{className:"text-danger mr-1",children:[h(Z,{icon:Yn})," Executed with errors"]}),R("div",{className:"time-wrapper",children:["Elapsed time:"," ",u?h("span",{className:"time-string",children:c}):h(Vt,{})]})]}),Boolean(a)&&h("div",{className:"error-message",children:a})]})]})}};let Ic=yc;Ic.defaultProps={onUpdate:()=>{}};const Mf=512;function Mc(e){const{item:t,language:n,isSelected:s,commandHistoryStorage:o}=e,i=t.name.substring(0,Mf),r=T.exports.useRef(null),l=T.exports.useCallback(()=>{var a;(a=r.current)==null||a.update()},[r]);return R("div",{className:B("command-history-item",{selected:s}),children:[i,h(We,{ref:r,interactive:!0,options:{placement:"left",modifiers:{preventOverflow:{enabled:!0,boundariesElement:"viewport",order:825}}},popperClassName:"command-history-item-popper",children:h(Ic,{item:t,language:n,onUpdate:l,commandHistoryStorage:o})})]})}Mc.defaultProps={isSelected:!1};class mi extends T.exports.Component{static itemKey(t,n){return`${n.title}`}static renderContent(t){return t.selectionRequired!==void 0&&t.selectionRequired?R("div",{className:"fa-md fa-layers",children:[h(Z,{icon:fi,mask:t.icon,transform:"right-5 down-5 shrink-4"}),h(Z,{icon:Gd,transform:"shrink-3 right-7 down-6"})]}):h(Z,{icon:t.icon})}render(){const{actions:t,hasSelection:n}=this.props;return h("div",{className:"command-history-actions",children:t.map((s,o)=>h(X,{kind:"inline",className:B(s.className),onClick:s.action,tooltip:s.description,disabled:s.selectionRequired!==void 0&&s.selectionRequired&&!n,icon:mi.renderContent(s)},mi.itemKey(o,s)))})}}const Df=150,Kl=3,Xl=se.module("CommandHistoryViewportUpdater");function Nf({table:e,columns:t,top:n=0,bottom:s=0,search:o,isReversed:i=!1,onUpdate:r}){const l=T.exports.useMemo(()=>Zn(a=>{const c=a.bottom-a.top,d=Math.max(0,a.top-c*Kl),u=a.bottom+c*Kl;e.setViewport({top:d,bottom:u,columns:a.columns})},Df),[e]);return T.exports.useEffect(function(){const c=e.onUpdate(d=>{var u,m;r({items:(u=d.items)!=null?u:[],offset:(m=d.offset)!=null?m:0})});return()=>{Xl.debug("onUpdate cleanup"),c()}},[e,r]),T.exports.useEffect(function(){e.setSearch(o!=null?o:"")},[e,o]),T.exports.useEffect(function(){l({top:n,bottom:s,columns:t})},[l,n,s,t,o,i]),T.exports.useEffect(()=>()=>{Xl.debug2("Cancel throttledUpdateViewport"),l.cancel()},[l]),null}const Ln=se.module("CommandHistory"),fn=class extends T.exports.Component{constructor(e){super(e),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:Zd,shortcut:Nr.COPY,action:this.copySelectedCommands,group:re.groups.edit},{title:"Send to Console",description:"Open selected commands in the console",icon:il,shortcut:ps.COMMAND_HISTORY.SEND_TO_CONSOLE,action:this.sendToConsole,group:fn.menuGroups.send,order:10},{title:"Run in Console",description:"Run selected commands in the console",icon:cu,shortcut:ps.COMMAND_HISTORY.RUN,action:this.runInConsole,group:fn.menuGroups.send,order:10},{title:"Send to Active Notebook",description:"Open selected commands in a notebook",icon:ol,shortcut:ps.COMMAND_HISTORY.SEND_TO_NOTEBOOK,action:this.sendToNotebook,group:fn.menuGroups.send,order:20},{title:"Send to New Notebook",description:"Open selected commands in a new notebook",icon:ru,action:this.createNotebook,group:fn.menuGroups.send,order:30}],this.historyActions=[{title:"Send to Console",icon:il,selectionRequired:!0,description:"Open selected commands in the console",action:this.sendToConsole},{title:"Send to Notebook",icon:ol,selectionRequired:!0,description:"Open selected commands in a notebook",action:this.sendToNotebook}],this.pending=new bi,this.searchInputRef=te.createRef(),this.itemListRef=te.createRef();const{table:t}=e;this.state={actions:[],historyActions:this.historyActions,top:0,bottom:0,itemCount:t.size,items:[],offset:0,selectedRanges:[],searchText:""}}static getCommandsFromViewport(e,t,n){const s=[];for(let o=0;o<n.length;o+=1){const i=n[o];for(let r=i[0];r<=i[1];r+=1)if(r>=t&&r<t+e.length){const{name:l}=e[r-t];s.push(l)}}return s}static async getCommandsFromSnapshot(e,t){return[...(await e.getSnapshot(t)).values()].map(s=>s.name)}componentWillUnmount(){this.pending.cancel()}async getSelectedCommands(){const{items:e,offset:t,selectedRanges:n}=this.state,s=n.slice().sort((i,r)=>i[0]-r[0]);if(s.length===0)return[];if(s[0][0]>=t&&s[s.length-1][1]<t+e.length)return fn.getCommandsFromViewport(e,t,s);const{table:o}=this.props;return this.pending.add(fn.getCommandsFromSnapshot(o,s))}getSelectedCommandText(){return this.getSelectedCommands().then(e=>e.join(`
|
|
26
|
+
`))}updateActions(){this.setState(e=>{const{selectedRanges:t}=e,n=t.reduce((s,o)=>s+o[1]-o[0]+1,0);return n>0&&n<fn.MAX_SELECTION_COUNT?(Ln.debug("Updating actions",this.itemActions),{actions:this.itemActions}):(Ln.debug("Disabling actions",n),{actions:[]})})}copySelectedCommands(){this.getSelectedCommandText().then(fo).catch(Ln.error)}createNotebook(){this.getSelectedCommandText().then(e=>{const{language:t,sendToNotebook:n}=this.props;n({value:e,language:t},!0)}).catch(Ln.error)}sendToNotebook(){this.getSelectedCommandText().then(e=>{const{language:t,sendToNotebook:n}=this.props;n({value:e,language:t})}).catch(Ln.error)}sendToConsole(){const{sendToConsole:e}=this.props;this.getSelectedCommandText().then(e).catch(Ln.error)}runInConsole(){this.getSelectedCommandText().then(e=>{const{sendToConsole:t}=this.props;t(e,!0,!0)}).catch(Ln.error)}handleSelect(e){const{sendToConsole:t}=this.props,{items:n,offset:s}=this.state;if(e<s||e>=s+n.length){Ln.error("Invalid index!",e);return}const{name:o}=n[e-s];t(o)}handleSelectionChange(e){this.setState({selectedRanges:e}),this.updateActions()}handleViewportChange(e,t){this.setState({top:e,bottom:t})}handleSearchChange(e){this.setState({searchText:e.target.value,selectedRanges:[]})}handleViewportUpdate({items:e,offset:t}){const{table:n}=this.props,s=n.size;this.setState({items:e,itemCount:s,offset:t})}renderItem({item:e,itemIndex:t,isSelected:n}){const{language:s,commandHistoryStorage:o}=this.props;return h(Mc,{isSelected:n,item:e,language:s,commandHistoryStorage:o})}focus(){this.searchInputRef.current&&this.searchInputRef.current.focus()}restoreScrollPosition(){var e;(e=this.itemListRef.current)==null||e.restoreScrollPosition()}render(){var m;const{language:e,table:t}=this.props,{actions:n,historyActions:s,searchText:o,top:i,bottom:r,items:l,itemCount:a,offset:c,selectedRanges:d}=this.state,u=(m=Pg.LANGUAGE_MAP.get(e))!=null?m:"";return R("div",{className:"command-history",children:[R("div",{className:"command-history-search-bar",children:[h(Jn,{ref:this.searchInputRef,value:o,placeholder:`${u} Command History`,onChange:this.handleSearchChange}),h(mi,{actions:s,hasSelection:d.length>0})]}),R("div",{className:"command-history-list",children:[h(sn,{ref:this.itemListRef,itemCount:a,items:l,offset:c,selectedRanges:d,onSelect:this.handleSelect,onSelectionChange:this.handleSelectionChange,onViewportChange:this.handleViewportChange,renderItem:this.renderItem,rowHeight:fn.ITEM_HEIGHT,isDoubleClickSelect:!0,isMultiSelect:!0,isStickyBottom:!0}),h(Nf,{table:t,top:i,bottom:r,search:o,onUpdate:this.handleViewportUpdate}),h(re,{actions:n})]})]})}};let zr=fn;zr.ITEM_HEIGHT=29;zr.MAX_SELECTION_COUNT=1e4;zr.menuGroups={send:re.groups.medium+100};class Ff extends T.exports.PureComponent{constructor(t){super(t),this.handleSwitchClick=this.handleSwitchClick.bind(this)}handleSwitchClick(){const{logLevel:t,onClick:n}=this.props;n(t)}render(){const{logLevel:t,on:n}=this.props;return R("div",{className:B("log-level-menu-item",t),children:[h(Na,{on:n,onClick:this.handleSwitchClick}),t]})}}const lt=class extends T.exports.PureComponent{constructor(e){super(e),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(e){const t=new Date(e.micros/1e3);return`${Us.formatTimestamp(t)} ${e.logLevel} ${e.message}`}componentDidMount(){this.resetLogLevels(),this.initMonaco(),this.startListening(),window.addEventListener("resize",this.handleResize)}componentDidUpdate(e,t){this.updateDimensions();const{shownLogLevels:n}=this.state;t.shownLogLevels!==n&&this.refreshLogText();const{session:s}=this.props;e.session!==s&&(this.stopListening(),this.startListening(),this.clearLogs())}componentWillUnmount(){this.stopFlushTimer(),this.stopListening(),this.destroyMonaco(),window.removeEventListener("resize",this.handleResize)}getMenuActions(e){const t=[];t.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],o=e[s]!=null?e[s]:!1;t.push({title:s,group:1,order:n+100,menuElement:h(Ff,{logLevel:s,on:o,onClick:this.handleMenuItemClick,ref:i=>{i!=null&&(this.logLevelMenuItems[s]=i)}})})}return t.push({group:1,order:1e3,menuElement:R("div",{className:"log-level-menu-controls",children:[h(X,{kind:"ghost",className:"log-level-toggle-all",onClick:this.handleToggleAllClick,children:"Toggle All"}),h(X,{kind:"ghost",onClick:this.handleResetClick,children:"Reset"})]})}),t}resetLogLevels(){const e={};for(let t=0;t<lt.AllLogLevels.length;t+=1){const n=lt.AllLogLevels[t],s=lt.DefaultLogLevels.some(o=>o===n);e[n]=s}this.setState({shownLogLevels:e})}startListening(){const{session:e}=this.props;this.cancelListener=e.onLogMessage(this.handleLogMessage)}stopListening(){this.cancelListener!=null&&(this.cancelListener(),this.cancelListener=void 0)}initMonaco(){O(this.editorContainer),this.editor=bn.create(this.editorContainer,{copyWithSyntaxHighlighting:!1,fixedOverflowWidgets:!0,folding:!1,fontFamily:"Fira Mono",glyphMargin:!1,language:"log",lineDecorationsWidth:0,lineNumbers:"off",lineNumbersMinChars:0,minimap:{enabled:!1},readOnly:!0,renderLineHighlight:"none",scrollBeyondLastLine:!1,value:"",wordWrap:"on"}),this.editor.addCommand(Wn.Escape,()=>{}),this.editor.addCommand(Ft.Shift|Wn.Escape,()=>{}),this.editor.addCommand(Wn.Escape,()=>{var t,n;const e=(t=this.editor)==null?void 0:t.getPosition();O(e),(n=this.editor)==null||n.setPosition(e)},"findWidgetVisible && editorTextFocus"),this.editor.addCommand(Ft.Shift|Wn.Escape,()=>{var t,n;const e=(t=this.editor)==null?void 0:t.getPosition();O(e),(n=this.editor)==null||n.setPosition(e)},"findWidgetVisible && editorTextFocus")}destroyMonaco(){this.editor&&(this.editor.dispose(),this.editor=void 0)}triggerFindWidget(){var e,t;(e=this.editor)==null||e.focus(),(t=this.editor)==null||t.trigger("keyboard","actions.find",void 0)}toggleAll(){const{shownLogLevels:e}=this.state;let t=!0;for(let n=0;n<lt.AllLogLevels.length;n+=1){const s=lt.AllLogLevels[n];if(!e[s]){t=!1;break}}if(t)this.setState({shownLogLevels:{}});else{const n={};for(let s=0;s<lt.AllLogLevels.length;s+=1){const o=lt.AllLogLevels[s];n[o]=!0}this.setState({shownLogLevels:n})}}toggleLogLevel(e){const{shownLogLevels:t}=this.state,n=t[e],s={};s[e]=!n,this.updateLogLevels(s)}updateLogLevels(e){let{shownLogLevels:t}=this.state;t={...t,...e},this.setState({shownLogLevels:t})}appendLogText(e){if(!this.editor)return;const t=this.editor.getModel();let n=t==null?void 0:t.getLineCount();O(n);let s=t==null?void 0:t.getLineLength(n);O(s);const o=this.isBottomVisible(),i=[];if(s>0&&(i.push({range:{startLineNumber:n,startColumn:s+1,endLineNumber:n,endColumn:s+1},text:`
|
|
27
27
|
`,forceMoveMarkers:!0}),n+=1,s=0),i.push({range:{startLineNumber:n,startColumn:s,endLineNumber:n,endColumn:s},text:e,forceMoveMarkers:!0}),t==null||t.applyEdits(i),o){const r=t==null?void 0:t.getLineCount();O(r),this.editor.revealLine(r,1)}}refreshLogText(){var s;if(!this.editor)return;this.truncateLogIfNecessary();const{shownLogLevels:e}=this.state,t=this.isBottomVisible();let n="";for(let o=0;o<this.messages.length;o+=1){const i=this.messages[o];if(e[i.logLevel]){const r=lt.getLogText(i);r.length>0&&(n+=r,r.charAt(r.length-1)!==`
|
|
28
28
|
`&&(n+=`
|
|
29
29
|
`))}}if(n=n.trimRight(),this.editor.setValue(n),t){const o=(s=this.editor.getModel())==null?void 0:s.getLineCount();O(o),this.editor.revealLine(o,1)}this.stopFlushTimer(),this.bufferedMessages=[]}truncateLogIfNecessary(){this.messages.length>lt.maxLogSize&&(this.messages=this.messages.splice(this.messages.length-lt.truncateSize))}scrollToBottom(){var t,n,s;if(!this.editor)return;const e=(s=(n=(t=this.editor)==null?void 0:t.getModel)==null?void 0:n.call(t))==null?void 0:s.getLineCount();O(e),this.editor.revealLine(e,1)}isBottomVisible(){if(!this.editor)return!0;const e=this.editor.getModel(),t=e==null?void 0:e.getLineCount();return O(t),this.isLineVisible(t)}isLineVisible(e){var n;const t=(n=this.editor)==null?void 0:n.getVisibleRanges();if(t==null||t.length===0)return!1;for(let s=0;s<t.length;s+=1){const o=t[s];if(o.startLineNumber<=e&&e<=o.endLineNumber)return!0}return!1}isLogItemVisible(e){const{shownLogLevels:t}=this.state;return t[e.logLevel]}flush(){let e="";for(let t=0;t<this.bufferedMessages.length;t+=1){const n=this.bufferedMessages[t],s=lt.getLogText(n);e+=s,s.charAt(s.length-1)!==`
|
|
30
30
|
`&&(e+=`
|
|
31
|
-
`)}this.bufferedMessages=[],this.appendLogText(e)}queue(e){this.bufferedMessages.push(e),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(e){this.messages.push(e),this.editor&&this.isLogItemVisible(e)&&this.queue(e)}handleMenuItemClick(e){this.toggleLogLevel(e)}handleResetClick(){this.resetLogLevels()}handleResize(){this.updateDimensions()}handleToggleAllClick(){this.toggleAll()}render(){const e={placement:"bottom-end"},{shownLogLevels:t}=this.state,n=this.getMenuActions(t);return R("div",{className:"log-pane h-100 w-100",children:[R("div",{className:"log-pane-menu",children:[h(X,{kind:"ghost",className:"btn-clear-logs",onClick:this.handleClearClick,icon:Ou,tooltip:"Clear log"}),h(X,{kind:"ghost",className:"btn-link-icon btn-overflow",icon:Jd,tooltip:"Log Settings",onClick:()=>{},children:h(Qn,{actions:n,popperClassName:"log-level-menu-popper",popperOptions:e})})]}),h("div",{className:"log-pane-editor h-100 w-100",ref:s=>{this.editorContainer=s}})]})}};let bo=lt;bo.DefaultLogLevels=[et.STDOUT,et.ERROR,et.FATAL,et.STDERR,et.WARN];bo.AllLogLevels=[et.INFO,et.STDOUT,et.ERROR,et.FATAL,et.STDERR,et.WARN,et.DEBUG,et.TRACE];bo.bufferTimeout=16;bo.maxLogSize=131072;bo.truncateSize=65536;si.register([Jc,ed,td,nd,sd,od]);const xf=typeof Hi=="function"?Hi(si):Hi.default(si),wn=class{constructor(){this.listeners=[],this.isDownsamplingDisabled=!1}getData(){return[]}getDefaultTitle(){return""}getLayout(){return{}}getFilterColumnMap(){return new Map}isFilterRequired(){return!1}setFilter(e){}close(){}setFormatter(e){this.formatter=e}setDownsamplingDisabled(e){this.isDownsamplingDisabled=e}setDimensions(e){this.rect=e}setTitle(e){this.title=e}subscribe(e){this.listeners.push(e)}unsubscribe(e){this.listeners=this.listeners.filter(t=>t!==e)}fireEvent(e){for(let t=0;t<this.listeners.length;t+=1)this.listeners[t](e)}fireUpdate(e){this.fireEvent(new CustomEvent(wn.EVENT_UPDATED,{detail:e}))}fireDisconnect(){this.fireEvent(new CustomEvent(wn.EVENT_DISCONNECT))}fireReconnect(){this.fireEvent(new CustomEvent(wn.EVENT_RECONNECT))}fireDownsampleStart(e){this.fireEvent(new CustomEvent(wn.EVENT_DOWNSAMPLESTARTED,{detail:e}))}fireDownsampleFinish(e){this.fireEvent(new CustomEvent(wn.EVENT_DOWNSAMPLEFINISHED,{detail:e}))}fireDownsampleFail(e){this.fireEvent(new CustomEvent(wn.EVENT_DOWNSAMPLEFAILED,{detail:e}))}fireDownsampleNeeded(e){this.fireEvent(new CustomEvent(wn.EVENT_DOWNSAMPLENEEDED,{detail:e}))}fireLoadFinished(){this.fireEvent(new CustomEvent(wn.EVENT_LOADFINISHED))}};let tt=wn;tt.EVENT_UPDATED="ChartModel.EVENT_UPDATED";tt.EVENT_DISCONNECT="ChartModel.EVENT_DISCONNECT";tt.EVENT_RECONNECT="ChartModel.EVENT_RECONNECT";tt.EVENT_DOWNSAMPLESTARTED="ChartModel.EVENT_DOWNSAMPLESTARTED";tt.EVENT_DOWNSAMPLEFINISHED="ChartModel.EVENT_DOWNSAMPLEFINISHED";tt.EVENT_DOWNSAMPLEFAILED="ChartModel.EVENT_DOWNSAMPLEFAILED";tt.EVENT_DOWNSAMPLENEEDED="ChartModel.EVENT_DOWNSAMPLENEEDED";tt.EVENT_LOADFINISHED="ChartModel.EVENT_LOADFINISHED";const Af="#76d9e4 #9edc6f #fcd65b #aa9af4 #f37e3f #f95d84 #f0f0ee",Of="#403e41",kf="#5b5a5c",Lf="#c0bfbf",Pf="#4878ea",Hf="rgba(91, 90, 92, 0.7)",st={"paper-bgcolor":"#2d2a2e","plot-bgcolor":"#322f33","title-color":"#f0f0ee",colorway:Af,gridcolor:Of,linecolor:kf,zerolinecolor:Lf,activecolor:Pf,rangebgcolor:Hf,"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"},Gn=Object.freeze({paper_bgcolor:st["paper-bgcolor"],plot_bgcolor:st["plot-bgcolor"],title_color:st["title-color"],colorway:st.colorway,gridcolor:st.gridcolor,linecolor:st.linecolor,zerolinecolor:st.zerolinecolor,activecolor:st.activecolor,rangebgcolor:st.rangebgcolor,area_color:st["area-color"],trend_color:st["trend-color"],line_color:st["line-color"],error_band_line_color:st["error-band-line-color"],error_band_fill_color:st["error-band-fill-color"],ohlc_increasing:st["ohlc-increasing"],ohlc_decreasing:st["ohlc-decreasing"]}),io=se.module("ChartUtils"),Hn=Object.freeze(I.calendar.DayOfWeek.values()),Yl="io.deephaven.time.DateTime",_f=36e5,Vf=1e6;function Uf(e){return e.asDate!==void 0}function Bf(e){return e.asNumber!==void 0}function Ql(e){return e.dhTimeZone!==void 0}function Gf(e){return e!=null&&e.range!=null&&(e.autorange===!1||e.autorange===void 0)}const Q=class{static getPlotlyChartType(e,t){switch(e){case I.plot.SeriesPlotStyle.SCATTER:return t?"scatter":"scattergl";case I.plot.SeriesPlotStyle.LINE:return"scatter";case I.plot.SeriesPlotStyle.BAR:case I.plot.SeriesPlotStyle.STACKED_BAR:return"bar";case I.plot.SeriesPlotStyle.PIE:return"pie";case I.plot.SeriesPlotStyle.TREEMAP:return"treemap";case I.plot.SeriesPlotStyle.HISTOGRAM:return"histogram";case I.plot.SeriesPlotStyle.OHLC:return"ohlc";default:return}}static getPlotlyChartMode(e,t,n){const s=new Set;switch(e){case I.plot.SeriesPlotStyle.SCATTER:t!=null&&t&&s.add(Q.MODE_LINES),(n==null||n)&&s.add(Q.MODE_MARKERS);break;case I.plot.SeriesPlotStyle.LINE:(t==null||t)&&s.add(Q.MODE_LINES),n!=null&&n&&s.add(Q.MODE_MARKERS);break}return s.size>0?[...s].join("+"):void 0}static getPlotlyProperty(e,t){switch(e){case I.plot.SeriesPlotStyle.PIE:switch(t){case I.plot.SourceType.X:return"labels";case I.plot.SourceType.Y:return"values"}break;case I.plot.SeriesPlotStyle.OHLC:switch(t){case I.plot.SourceType.TIME:return"x"}break;case I.plot.SeriesPlotStyle.TREEMAP:switch(t){case I.plot.SourceType.X:return"ids";case I.plot.SourceType.Y:return"values";case I.plot.SourceType.LABEL:return"labels";case I.plot.SourceType.PARENT:return"parents";case I.plot.SourceType.COLOR:return"marker.colors"}break}switch(t){case I.plot.SourceType.X:return"x";case I.plot.SourceType.Y:return"y";case I.plot.SourceType.Z:return"z";case I.plot.SourceType.X_LOW:return"xLow";case I.plot.SourceType.X_HIGH:return"xHigh";case I.plot.SourceType.Y_LOW:return"yLow";case I.plot.SourceType.Y_HIGH:return"yHigh";case I.plot.SourceType.TIME:return"time";case I.plot.SourceType.OPEN:return"open";case I.plot.SourceType.HIGH:return"high";case I.plot.SourceType.LOW:return"low";case I.plot.SourceType.CLOSE:return"close";case I.plot.SourceType.SHAPE:return"shape";case I.plot.SourceType.SIZE:return"size";case I.plot.SourceType.LABEL:return"label";case I.plot.SourceType.COLOR:return"color";case I.plot.SourceType.PARENT:return"parent";case I.plot.SourceType.HOVER_TEXT:return"hovertext";case I.plot.SourceType.TEXT:return"text";default:throw new Error(`Unrecognized source type: ${t}`)}}static getPlotlySeriesOrientation(e){var n,s;const{sources:t}=e;return t.length===2&&((s=(n=t[0])==null?void 0:n.axis)==null?void 0:s.type)===I.plot.AxisType.Y?Q.ORIENTATION.HORIZONTAL:Q.ORIENTATION.VERTICAL}static getPlotlyErrorBars(e,t,n){const s=n.map((i,r)=>i-e[r]),o=t.map((i,r)=>e[r]-i);return{type:"data",symmetric:!1,array:s,arrayminus:o}}static getPlotlyDateFormat(e,t,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 o;const i=e==null?void 0:e.getColumnTypeFormatter(t);return i!=null&&Ql(i)&&i.dhTimeZone!=null&&i.showTimeZone&&(o=I.i18n.DateTimeFormat.format(" z",new Date,i.dhTimeZone)),{tickformat:s,ticksuffix:o,automargin:!0}}static convertNumberPrefix(e){return e.replace(/\u00A4\u00A4/g,"USD").replace(/\u00A4/g,"$")}static getPlotlyNumberFormat(e,t,n){if(!n)return null;const o=n.split(";")[0].match(/^([^#,0.]*)([#,]*)([0,]*)(\.?)(0*)(#*)(E?0*)(%?)(.*)/);O(o);const[,i,r,l,,a,c,d,u,m]=o,p=l.replace(",","").length,f=r.indexOf(",")>=0||l.indexOf(",")>=0?",":"",w=d!=null&&d!==""?"e":"f",C=u!==""?u:w,S=a.length+c.length,E=`0${p}${f}.${S}${C}`,v=Q.convertNumberPrefix(i),y=Q.convertNumberPrefix(m);return{tickformat:E,tickprefix:v,ticksuffix:y,automargin:!0}}static getPlotlyAxisFormat(e,t=null){const{axis:n,columnType:s}=e,{formatPattern:o}=n;let i=null;return x.isDateType(s)?(i=Q.getPlotlyDateFormat(t,s,o),i=Q.addTickSpacing(i,n,!0)):x.isNumberType(s)&&(i=Q.getPlotlyNumberFormat(t,s,o),i=Q.addTickSpacing(i,n,!1)),n.formatType===I.plot.AxisFormatType.CATEGORY&&(i?i.type="category":i={type:"category",tickformat:void 0,ticksuffix:void 0}),i}static addTickSpacing(e,t,n){const{gapBetweenMajorTicks:s}=t;if(s>0){const o=e||{};let i=s;return n&&(i=s/Vf),t.log&&(i=Math.log(i)),o.tickmode="linear",o.dtick=i,o}return e}static getSourceForAxis(e,t){for(let n=0;n<e.series.length;n+=1){const s=e.series[n];for(let o=0;o<s.sources.length;o+=1){const i=s.sources[o];if(i.axis===t)return i}}return null}static getSeriesVisibility(e,t){return t!=null&&t.hiddenSeries!=null&&t.hiddenSeries.includes(e)?"legendonly":!0}static getHiddenLabels(e){return e!=null&&e.hiddenSeries?[...e.hiddenSeries]:[]}static makeSeriesData(e,t,n,s,o=Q.ORIENTATION.VERTICAL){return{type:e,mode:t,name:n,orientation:o,showlegend:s!=null?s:void 0}}static makeSeriesDataFromSeries(e,t,n,s=null,o=Gn){const{name:i,isLinesVisible:r,isShapesVisible:l,plotStyle:a,lineColor:c,shapeColor:d,sources:u,shape:m,shapeSize:p}=e,g=u.some(b=>{var E;return(E=b.axis)==null?void 0:E.businessCalendar}),f=Q.getChartType(a,g),w=Q.getPlotlyChartMode(a,r!=null?r:void 0,l!=null?l:void 0),C=Q.getPlotlySeriesOrientation(e),S=Q.makeSeriesData(f,w,i,s,C);return Q.addSourcesToSeriesData(S,a,u,t),Q.addStylingToSeriesData(S,a,o,c,d,m,p,n),S}static addSourcesToSeriesData(e,t,n,s){const o=e;for(let i=0;i<n.length;i+=1){const r=n[i],{axis:l,type:a}=r,c=Q.getPlotlyProperty(t,a);Zl(o,c,[]);const d=l!=null?Q.getAxisPropertyName(l.type):null;if(d!=null){const u=s.get(l.type);if(u){const m=u.indexOf(l),p=m>0?`${m+1}`:"";o[`${d}axis`]=`${d}${p}`}}}}static addStylingToSeriesData(e,t,n=Gn,s=null,o=null,i=null,r=null,l=null){const a=e;if(a.marker={line:{}},a.line={width:1},t===I.plot.SeriesPlotStyle.AREA?a.fill="tozeroy":t===I.plot.SeriesPlotStyle.STACKED_AREA?a.stackgroup="stack":t===I.plot.SeriesPlotStyle.STEP?a.line.shape="hv":t===I.plot.SeriesPlotStyle.HISTOGRAM?(a.width=[],a.marker.line!==void 0&&Object.assign(a.marker.line,{color:n.paper_bgcolor,width:1})):t===I.plot.SeriesPlotStyle.OHLC?(a.increasing={line:{color:n.ohlc_increasing}},a.decreasing={line:{color:n.ohlc_decreasing}}):t===I.plot.SeriesPlotStyle.PIE?(a.textinfo="label+percent",a.outsidetextfont={color:n.title_color}):t===I.plot.SeriesPlotStyle.TREEMAP&&(a.hoverinfo="text",a.textinfo="label+text",a.tiling={packing:"squarify",pad:0},a.textposition="middle center",a.outsidetextfont={color:n.title_color}),s!=null&&(t===I.plot.SeriesPlotStyle.BAR?a.marker.color=s:a.line.color=s),o!=null&&(a.marker.color=o),i!=null&&i.length>0)try{a.marker.symbol=Q.getMarkerSymbol(i)}catch(c){io.warn("Unable to handle shape",i,":",c)}r!=null&&(a.marker.size=r*Q.DEFAULT_MARKER_SIZE),l!=null&&t!==I.plot.SeriesPlotStyle.PIE&&(a.visible=l)}static getMarkerSymbol(e){switch(e){case"SQUARE":return"square";case"CIRCLE":return"circle";case"DIAMOND":return"diamond";case"UP_TRIANGLE":return"triangle-up";case"DOWN_TRIANGLE":return"triangle-down";case"RIGHT_TRIANGLE":return"triangle-right";case"LEFT_TRIANGLE":return"triangle-left";case"ELLIPSE":case"HORIZONTAL_RECTANGLE":case"VERTICAL_RECTANGLE":default:throw new Error(`Unrecognized shape ${e}`)}}static getAxisFormats(e,t){const n=new Map,s={tickformat:null,ticksuffix:null},o=Q.getAllAxes(e),i=Q.groupArray(o,"type"),{charts:r}=e;for(let l=0;l<r.length;l+=1){const a=r[l];for(let c=0;c<a.series.length;c+=1){const d=a.series[c],{sources:u}=d,m=u.filter(p=>p.axis);for(let p=0;p<m.length;p+=1){const g=m[p],{axis:f}=g,{type:w}=f,C=i.get(w);O(C);const S=C.indexOf(f),b=Q.getAxisPropertyName(w);if(b!=null){const E=Q.getAxisLayoutProperty(b,S);if(n.has(E))io.debug(`${E} already added.`);else{io.debug(`Adding ${E} to axisFormats.`);const v=Q.getPlotlyAxisFormat(g,t);if(v===null)n.set(E,s);else{n.set(E,v);const{businessCalendar:y}=f;if(y!=null){const M=[],{businessPeriods:A,businessDays:F,holidays:V,timeZone:H}=y,N=t==null?void 0:t.getColumnTypeFormatter(Yl);let P;Ql(N)&&(P=N.dhTimeZone);const k=P?(H.standardOffset-P.standardOffset)/60:0;V.length>0&&M.push(...Q.createRangeBreakValuesFromHolidays(V,H,P)),A.forEach(z=>M.push({pattern:"hour",bounds:[Q.periodToDecimal(z.close)+k,Q.periodToDecimal(z.open)+k]})),F.length<Hn.length&&Q.createBoundsFromDays(F).forEach(z=>M.push({pattern:"day of week",bounds:z})),v.rangebreaks=M}if(n.size===a.axes.length)return n}}}}}}return n}static getChartType(e,t){switch(e){case I.plot.SeriesPlotStyle.HISTOGRAM:return"bar";default:return Q.getPlotlyChartType(e,t)}}static getAxisPropertyName(e){switch(e){case I.plot.AxisType.X:return"x";case I.plot.AxisType.Y:return"y";default:return null}}static getAxisSide(e){switch(e){case I.plot.AxisPosition.BOTTOM:return"bottom";case I.plot.AxisPosition.TOP:return"top";case I.plot.AxisPosition.LEFT:return"left";case I.plot.AxisPosition.RIGHT:return"right";default:return}}static getAllAxes(e){return e.charts.reduce((t,n)=>[...t,...n.axes],[])}static getChartForSeries(e,t){const{charts:n}=e;for(let s=0;s<n.length;s+=1){const o=n[s];for(let i=0;i<o.series.length;i+=1)if(t===o.series[i])return o}return null}static getLayoutRanges(e){const t={},n=Object.keys(e).filter(s=>s.indexOf("axis")>=0);for(let s=0;s<n.length;s+=1){const o=n[s],i=e[o];Gf(i)&&(t[o]=[...i.range])}return t}static updateFigureAxes(e,t,n,s=0,o=0,i=Gn){const r=e,l=Q.getAllAxes(t);for(let a=0;a<t.charts.length;a+=1){const c=t.charts[a],d=n==null?void 0:n(c),u=Q.getChartBounds(t,c,s,o);Q.updateLayoutAxes(r,c.axes,l,s,o,u,d,i)}Q.removeStaleAxes(r,l)}static getChartBounds(e,t,n=0,s=0){var b;const{cols:o,rows:i}=e,{column:r,colspan:l,row:a,rowspan:c}=t,d=r+l,u=a+c,m=1/o,p=1/i,g=Q.AXIS_SIZE_PX/n,f=Q.AXIS_SIZE_PX/s,w={left:r*m+(r>0?g/2:0),bottom:a*p+(a>0?f/2:0),top:u*p-(u<i?f/2:0),right:d*m-(d<o?g/2:0)};return((b=Q.groupArray(t.axes,"position").get(I.plot.AxisPosition.RIGHT))!=null?b:[]).length>0&&(n>0?w.right-=(w.right-w.left)*Math.max(0,Math.min(Q.LEGEND_WIDTH_PX/n,Q.MAX_LEGEND_SIZE)):w.right-=(w.right-w.left)*Q.DEFAULT_AXIS_SIZE),w}static updateLayoutAxes(e,t,n,s=0,o=0,i={left:0,top:0,right:1,bottom:1},r,l=Gn){const a=s>0?Math.max(Q.MIN_AXIS_SIZE,Math.min(Q.AXIS_SIZE_PX/o,Q.MAX_AXIS_SIZE)):Q.DEFAULT_AXIS_SIZE,c=o>0?Math.max(Q.MIN_AXIS_SIZE,Math.min(Q.AXIS_SIZE_PX/s,Q.MAX_AXIS_SIZE)):Q.DEFAULT_AXIS_SIZE,d=e,u=Q.groupArray(t,"position"),m=Q.groupArray(t,"type"),p=[...m.keys()],g=Q.groupArray(n,"type");for(let f=0;f<p.length;f+=1){const w=p[f],C=Q.getAxisPropertyName(w);if(C!=null){const S=m.get(w),b=g.get(w),v=w===I.plot.AxisType.Y?o:s;O(S),O(b);for(let y=0;y<S.length;y+=1){const M=S[y],A=b.indexOf(M),F=Q.getAxisLayoutProperty(C,A);d[F]==null&&(d[F]=Q.makeLayoutAxis(w,l));const V=d[F];if(V!=null){Q.updateLayoutAxis(V,M,y,u,a,c,i);const{range:H,autorange:N}=V;if(r!=null&&H!==void 0&&(N===void 0||N===!1)){const P=r(M),[k,z]=P(H);io.debug("Setting downsample range",v,k,z),M.range(v,k,z)}else M.range(v)}}}}}static removeStaleAxes(e,t){const n=e,s=Q.groupArray(t,"type"),o=[...s.keys()];for(let i=0;i<o.length;i+=1){const r=o[i],l=s.get(r);O(l);let a=l.length;const c=Q.getAxisPropertyName(r);if(c!=null){let d=Q.getAxisLayoutProperty(c,a);for(;n[d]!=null;)delete n[d],a+=1,d=Q.getAxisLayoutProperty(c,a)}}}static getAxisLayoutProperty(e,t){const n=t>0?`${t+1}`:"";return`${e!=null?e:""}axis${n}`}static updateLayoutAxis(e,t,n,s,o,i,r){var u,m,p;const a=t.type===I.plot.AxisType.Y?i:o,c=e,d=(u=t.label)!=null?u:"";if(c.title!==void 0&&typeof c.title!="string"?c.title.text=d:c.title={text:d},t.log&&(c.type="log"),c.side=Q.getAxisSide(t.position),n>0){c.overlaying=(m=Q.getAxisPropertyName(t.type))!=null?m:void 0;const g=(p=s.get(t.position))!=null?p:[],f=g.indexOf(t);f>0&&(c.anchor="free",t.position===I.plot.AxisPosition.RIGHT?c.position=r.right+(f-g.length+1)*a:t.position===I.plot.AxisPosition.TOP?c.position=r.top+(f-g.length+1)*a:t.position===I.plot.AxisPosition.BOTTOM?c.position=r.bottom+(g.length-f+1)*a:t.position===I.plot.AxisPosition.LEFT&&(c.position=r.left+(g.length-f+1)*a))}else if(t.type===I.plot.AxisType.X){const g=s.get(I.plot.AxisPosition.LEFT)||[],f=s.get(I.plot.AxisPosition.RIGHT)||[],w=Math.max(r.left,r.left+(g.length-1)*i),C=Math.min(r.right-(f.length-1)*i,r.right);c.domain=[w,C]}else if(t.type===I.plot.AxisType.Y){const g=s.get(I.plot.AxisPosition.BOTTOM)||[],f=s.get(I.plot.AxisPosition.TOP)||[],w=Math.max(r.bottom,r.bottom+(g.length-1)*o),C=Math.min(r.top-(f.length-1)*o,r.top);c.domain=[w,C]}}static periodToDecimal(e){const t=e.split(":");return Number(t[0])+Number(t[1])/60}static createBoundsFromDays(e){const t=e.map(i=>Hn.indexOf(i)),n=Hn.filter(i=>!e.includes(i)).map(i=>Hn.indexOf(i)),s=new Set;n.forEach(i=>{for(let r=i+1;r<i+Hn.length;r+=1){const l=r%Hn.length;if(t.includes(l)){s.add(l);break}}});const o=[];return s.forEach(i=>{for(let r=i-1;r>i-Hn.length;r-=1){const l=r<0?r+Hn.length:r;if(t.includes(l)){const a=(l+1)%7;o.push([a,i]);break}}}),o}static createRangeBreakValuesFromHolidays(e,t,n){const s=[],o=[];return e.forEach(i=>{i.businessPeriods.length>0?o.push(...Q.createPartialHoliday(i,t,n)):s.push(Q.createFullHoliday(i,t,n))}),[{values:s},...o]}static createFullHoliday(e,t,n){return Q.adjustDateForTimeZone(`${e.date.toString()} 00:00:00.000000`,t,n)}static createPartialHoliday(e,t,n){const s=e.date.toString(),o=["00:00"];e.businessPeriods.forEach(r=>{o.push(r.open),o.push(r.close)}),o.push("24:00");const i=[];for(let r=0;r<o.length;r+=2){const l=o[r],a=o[r+1];if(l!==a){const c=[Q.adjustDateForTimeZone(`${s} ${l}:00.000000`,t,n)],d=_f*(Q.periodToDecimal(a)-Q.periodToDecimal(l));i.push({values:c,dvalue:d})}}return i}static adjustDateForTimeZone(e,t,n){return n&&n.standardOffset!==t.standardOffset?Q.unwrapValue(Q.wrapValue(e,Yl,t),n):e}static groupArray(e,t){return e.reduce((n,s)=>{var r;const o=s[t],i=(r=n.get(o))!=null?r:[];return i.push(s),n.set(o,i),n},new Map)}static unwrapValue(e,t){if(e!=null){if(Uf(e))return I.i18n.DateTimeFormat.format(Q.DATE_FORMAT,e,t);if(Bf(e))return e.asNumber()}return e}static wrapValue(e,t,n=null){if(x.isDateType(t)&&typeof e=="string"){const s=e,o=Q.DATE_FORMAT.substr(0,e.length),i=I.i18n.DateTimeFormat.parse(o,s);if(!n)return i;const r=`${o} Z`,l=I.i18n.DateTimeFormat.format("Z",i,n),a=I.i18n.DateTimeFormat.parse(r,`${s} ${l}`),c=I.i18n.DateTimeFormat.format("Z",a,n);return I.i18n.DateTimeFormat.parse(r,`${s} ${c}`)}return e}static makeLayoutAxis(e,t=Gn){const n={automargin:!0,gridcolor:t.gridcolor,linecolor:t.linecolor,rangeslider:{visible:!1},showline:!0,ticklen:5,tickcolor:t.paper_bgcolor,tickfont:{color:t.zerolinecolor},title:{font:{color:t.title_color}}};return e===I.plot.AxisType.X?Object.assign(n,{showgrid:!0}):e===I.plot.AxisType.Y&&Object.assign(n,{zerolinecolor:t.zerolinecolor,zerolinewidth:2}),n}static getColorwayFromTheme(e=Gn){let t=[];return e.colorway&&(Array.isArray(e.colorway)?t=e.colorway:typeof e.colorway=="string"?t=e.colorway.split(" "):io.warn(`Unable to handle colorway property: ${e.colorway}`)),t}static makeDefaultLayout(e=Gn){const t={...e,autosize:!0,colorway:Q.getColorwayFromTheme(e),font:{family:"'Fira Sans', sans-serif"},title:{font:{color:e.title_color},yanchor:"top",pad:{...Q.DEFAULT_TITLE_PADDING},y:1},legend:{font:{color:e.title_color}},margin:{...Q.DEFAULT_MARGIN},xaxis:Q.makeLayoutAxis(I.plot.AxisType.X,e),yaxis:Q.makeLayoutAxis(I.plot.AxisType.Y,e)};return t.datarevision=0,t}static hydrateSettings(e){return{...e,type:I.plot.SeriesPlotStyle[e.type]}}static titleFromSettings(e){const{series:t,xAxis:n,title:s=`${t.join(", ")} by ${n}`}=e;return s}static makeFigureSettings(e,t){const{series:n,xAxis:s,type:o}=e,i=Q.titleFromSettings(e),r={formatType:`${I.plot.AxisFormatType.NUMBER}`,type:`${I.plot.AxisType.X}`,position:`${I.plot.AxisPosition.BOTTOM}`},l={formatType:`${I.plot.AxisFormatType.NUMBER}`,type:`${I.plot.AxisType.Y}`,position:`${I.plot.AxisPosition.LEFT}`};return{charts:[{chartType:`${I.plot.ChartType.XY}`,axes:[r,l],series:n.map(a=>({plotStyle:`${o}`,name:a,dataSources:[{type:`${I.plot.SourceType.X}`,columnName:s,axis:r,table:t},{type:`${I.plot.SourceType.Y}`,columnName:a,axis:l,table:t}]}))}],title:i}}};let be=Q;be.DEFAULT_AXIS_SIZE=.15;be.MIN_AXIS_SIZE=.025;be.MAX_AXIS_SIZE=.2;be.AXIS_SIZE_PX=75;be.LEGEND_WIDTH_PX=50;be.MAX_LEGEND_SIZE=.25;be.ORIENTATION=Object.freeze({HORIZONTAL:"h",VERTICAL:"v"});be.DATE_FORMAT="yyyy-MM-dd HH:mm:ss.SSSSSS";be.DEFAULT_MARGIN=Object.freeze({l:60,r:50,t:30,b:60,pad:0});be.DEFAULT_TITLE_PADDING=Object.freeze({t:8});be.SUBTITLE_LINE_HEIGHT=25;be.DEFAULT_MARKER_SIZE=6;be.MODE_MARKERS="markers";be.MODE_LINES="lines";const _n=se.module("Chart"),uo=class extends T.exports.Component{constructor(e){super(e),this.getCachedConfig=Ie((t,n,s,o)=>{const i=[],r=Boolean(t);if(r&&i.push({name:`Downsampling failed: ${t}`,click:()=>{},icon:uo.convertIcon(ha),attr:"fill-warning"}),n||s||o||r){const l=uo.downsampleButtonTitle(s,o),a=uo.downsampleButtonAttr(s,o),c=s?la:Iu;i.push({name:l,icon:uo.convertIcon(c),click:this.handleDownsampleClick,attr:a})}return{displaylogo:!1,displayModeBar:s||r?!0:"hover",modeBarButtons:[i,["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=te.createRef(),this.plotWrapper=te.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(e){const[t,,,,n]=e.icon,s=`${n}`;return{width:t,path:s,ascent:t,descent:0,transform:"matrix(1, 0, 0, 1, 0, 0)"}}static downsampleButtonTitle(e,t){return e?"Downsampling in progress...":t?"Downsampling disabled, click to enable":"Downsampling enabled, click to disable"}static downsampleButtonAttr(e,t){return e?"animation-spin":t?void 0:"fill-active"}componentDidMount(){this.updateDimensions(),this.updateModelDimensions(),this.initData(),this.initFormatter();const{isActive:e}=this.props;e&&this.subscribe()}componentDidUpdate(e){const{isActive:t,settings:n}=this.props;this.updateFormatterSettings(n),t!==e.isActive&&(t?this.subscribe():this.unsubscribe())}componentWillUnmount(){this.unsubscribe()}getPlotRect(){var e,t;return(t=(e=this.plotWrapper.current)==null?void 0:e.getBoundingClientRect())!=null?t:null}initData(){const{model:e}=this.props,{layout:t}=this.state;this.setState({data:e.getData(),layout:{...t,...e.getLayout()}})}subscribe(){if(this.isSubscribed)return;const{model:e}=this.props;if(!this.rect||this.rect.width===0||this.rect.height===0){_n.debug2("Delaying subscription until model dimensions are set");return}e.subscribe(this.handleModelEvent),this.isSubscribed=!0}unsubscribe(){if(!this.isSubscribed)return;const{model:e}=this.props;e.unsubscribe(this.handleModelEvent),this.isSubscribed=!1}handleAfterPlot(){this.plot.current!=null}handleDownsampleClick(){this.setState(({isDownsamplingDisabled:e})=>({downsamplingError:null,isDownsampleInProgress:!1,isDownsampleFinished:!1,isDownsamplingDisabled:!e}),()=>{const{model:e}=this.props,{isDownsamplingDisabled:t}=this.state;e.setDownsamplingDisabled(t)})}handleModelEvent(e){var s;const{type:t,detail:n}=e;switch(_n.debug2("Received data update",t,n),t){case tt.EVENT_UPDATED:{this.currentSeries+=1,this.setState(i=>{const{layout:r,revision:l}=i;return typeof r.datarevision=="number"&&(r.datarevision+=1),{data:n,layout:r,revision:l+1}});const{onUpdate:o}=this.props;o({isLoading:!this.isLoadedFired});break}case tt.EVENT_LOADFINISHED:{const{onUpdate:o}=this.props;this.isLoadedFired=!0,o({isLoading:!1});break}case tt.EVENT_DISCONNECT:{const{onDisconnect:o}=this.props;o();break}case tt.EVENT_RECONNECT:{const{onReconnect:o}=this.props;o();break}case tt.EVENT_DOWNSAMPLESTARTED:{this.setState({isDownsampleFinished:!1,isDownsampleInProgress:!0,downsamplingError:null});break}case tt.EVENT_DOWNSAMPLEFINISHED:{this.setState({isDownsampleFinished:!0,isDownsampleInProgress:!1,downsamplingError:null});break}case tt.EVENT_DOWNSAMPLENEEDED:case tt.EVENT_DOWNSAMPLEFAILED:{const o=(s=n.message)!=null?s:n;this.setState({isDownsampleFinished:!1,isDownsampleInProgress:!1,isDownsamplingDisabled:!1,downsamplingError:o});const{onError:i}=this.props;i(new Error(o));break}default:_n.debug("Unknown event type",t,e)}}handlePlotUpdate(e){const{layout:t}=e,n=be.getLayoutRanges(t);!ct(n,this.ranges)&&(this.ranges=n,this.updateModelDimensions(!0))}handleRelayout(e){if(_n.debug("handleRelayout",e),e.hiddenlabels!=null){const{onSettingsChanged:t}=this.props,n=[...e.hiddenlabels];t({hiddenSeries:n})}this.updateModelDimensions()}handleRestyle([e,t]){if(_n.debug("handleRestyle",e,t),Object.keys(e).includes("visible")){const{data:n}=this.state,{onSettingsChanged:s}=this.props;if(n!=null){const o=n.reduce((i,{name:r,visible:l})=>r!=null&&l==="legendonly"?[...i,r]:i,[]);s({hiddenSeries:o})}}}updateModelDimensions(e=!1){const t=this.getPlotRect();if(!t){_n.warn("Unable to get plotting rect");return}if(!this.rect||this.rect.width!==t.width||this.rect.height!==t.height||e){this.rect=t;const{isActive:s,model:o}=this.props;o.setDimensions(t),s&&this.subscribe()}}initFormatter(){const{settings:e}=this.props;this.updateFormatterSettings(e)}updateFormatterSettings(e){const t=ms.getColumnFormats(e),n=ms.getDateTimeFormatterOptions(e),{decimalFormatOptions:s={},integerFormatOptions:o={}}=e;(!ct(this.columnFormats,t)||!ct(this.dateTimeFormatterOptions,n)||!ct(this.decimalFormatOptions,s)||!ct(this.integerFormatOptions,o))&&(this.columnFormats=ms.getColumnFormats(e),this.dateTimeFormatterOptions=n,this.decimalFormatOptions=s,this.integerFormatOptions=o,this.updateFormatter())}updateFormatter(){const e=new nn(this.columnFormats,this.dateTimeFormatterOptions,this.decimalFormatOptions,this.integerFormatOptions),{model:t}=this.props;t.setFormatter(e)}updateDimensions(){const e=this.getPlotRect();this.plot.current!=null&&e!=null&&e.width>0&&e.height>0&&si.relayout(this.plot.current.el,{autosize:!0}).catch(t=>{_n.debug("Unable to resize, promise rejected",t)})}render(){const{data:e,downsamplingError:t,isDownsampleFinished:n,isDownsampleInProgress:s,isDownsamplingDisabled:o,layout:i,revision:r}=this.state,l=this.getCachedConfig(t,n,s,o),a=e!=null;return h("div",{className:"h-100 w-100 chart-wrapper",ref:this.plotWrapper,children:a&&h(xf,{ref:this.plot,data:e,layout:i,revision:r,config:l,onAfterPlot:this.handleAfterPlot,onError:_n.error,onRelayout:this.handleRelayout,onUpdate:this.handlePlotUpdate,onRestyle:this.handleRestyle,useResizeHandler:!0,style:{height:"100%",width:"100%"}})})}};let zf=uo;zf.defaultProps={isActive:!0,settings:{timeZone:"America/New_York",defaultDateTimeFormat:En.FULL_DATE_FORMAT,showTimeZone:!1,showTSeparator:!0,formatter:[]},onDisconnect:()=>{},onReconnect:()=>{},onUpdate:()=>{},onError:()=>{},onSettingsChanged:()=>{}};const rt=se.module("FigureChartModel"),Dc=class extends tt{constructor(e,t={},n=Gn){super(),this.addPendingSeries=ft(()=>{var r;const o=be.getAllAxes(this.figure),{pendingSeries:i}=this;for(let l=0;l<i.length;l+=1){const a=i[l],c=this.figure.charts.find(d=>d.series.includes(a));this.addSeries(a,o,(r=c==null?void 0:c.showLegend)!=null?r:null),a.subscribe()}this.pendingSeries=[]},Dc.ADD_SERIES_DEBOUNCE),this.getTimeZone=he((o,i)=>{if(i!=null){const r=i.getColumnTypeFormatter(o);if(r!=null)return r.dhTimeZone}}),this.getValueTranslator=he((o,i)=>{const r=this.getTimeZone(o,i);return l=>be.unwrapValue(l,r)}),this.getValueParser=he((o,i)=>{const r=this.getTimeZone(o,i);return l=>be.wrapValue(l,o,r)}),this.getRangeParser=he((o,i)=>r=>{let[l,a]=r;const c=this.getValueParser(o,i);return l=c(l),a=c(a),[l,a]}),this.getAxisRangeParser=he((o,i)=>r=>{const l=be.getSourceForAxis(o,r);return l?this.getRangeParser(l.columnType,i):a=>a}),this.handleFigureUpdated=this.handleFigureUpdated.bind(this),this.handleFigureDisconnected=this.handleFigureDisconnected.bind(this),this.handleFigureReconnected=this.handleFigureReconnected.bind(this),this.handleFigureSeriesAdded=this.handleFigureSeriesAdded.bind(this),this.handleDownsampleStart=this.handleDownsampleStart.bind(this),this.handleDownsampleFinish=this.handleDownsampleFinish.bind(this),this.handleDownsampleFail=this.handleDownsampleFail.bind(this),this.handleDownsampleNeeded=this.handleDownsampleNeeded.bind(this),this.handleRequestFailed=this.handleRequestFailed.bind(this),this.figure=e,this.settings=t,this.theme=n,this.data=[];const s={data:{},layout:be.makeDefaultLayout(n)};this.layout={grid:{rows:e.rows,columns:e.cols,pattern:"independent"},template:s},this.seriesDataMap=new Map,this.pendingSeries=[],this.oneClicks=[],this.filterColumnMap=new Map,this.lastFilter=new Map,this.isConnected=!0,this.seriesToProcess=new Set,this.setTitle(this.getDefaultTitle()),this.initAllSeries(),this.updateAxisPositions(),this.startListeningFigure()}close(){this.figure.close(),this.addPendingSeries.cancel(),this.stopListeningFigure()}getDefaultTitle(){return this.figure.charts.length>0?this.figure.charts[0].title:""}initAllSeries(){this.oneClicks=[],this.filterColumnMap.clear();const{charts:e}=this.figure,t=be.getAllAxes(this.figure),n=[];for(let i=0;i<e.length;i+=1){const r=e[i];for(let l=0;l<r.series.length;l+=1){const a=r.series[l];n.push(a.name),this.addSeries(a,t,r.showLegend)}}const o=[...this.seriesDataMap.keys()].filter(i=>n.indexOf(i)<0);for(let i=0;i<o.length;i+=1){const r=o[i];this.seriesDataMap.delete(r)}this.seriesToProcess=new Set([...this.seriesDataMap.keys()])}addSeries(e,t,n){const s=be.groupArray(t,"type"),o=be.makeSeriesDataFromSeries(e,s,be.getSeriesVisibility(e.name,this.settings),n,this.theme);if(this.seriesDataMap.set(e.name,o),this.data=[...this.seriesDataMap.values()],e.plotStyle===I.plot.SeriesPlotStyle.STACKED_BAR?this.layout.barmode="stack":e.plotStyle===I.plot.SeriesPlotStyle.PIE&&(this.layout.hiddenlabels=be.getHiddenLabels(this.settings)),this.layout.showlegend=this.data.length>1||e.plotStyle===I.plot.SeriesPlotStyle.PIE?n!=null?n:void 0:!1,e.oneClick!=null){const{oneClick:i}=e,{columns:r}=i;for(let l=0;l<r.length;l+=1)this.filterColumnMap.set(r[l].name,r[l]);this.oneClicks.push(i)}this.updateLayoutFormats()}subscribe(e){super.subscribe(e),this.listeners.length===1&&(this.initAllSeries(),this.subscribeFigure())}unsubscribe(e){super.unsubscribe(e),this.listeners.length===0&&this.unsubscribeFigure()}subscribeFigure(){if(!this.isConnected){rt.debug("Ignoring subscribe when figure in disconnected state");return}this.figure.subscribe(this.isDownsamplingDisabled?I.plot.DownsampleOptions.DISABLE:I.plot.DownsampleOptions.DEFAULT)}unsubscribeFigure(){this.figure.unsubscribe()}startListeningFigure(){this.figure.addEventListener(I.plot.Figure.EVENT_UPDATED,this.handleFigureUpdated),this.figure.addEventListener(I.plot.Figure.EVENT_SERIES_ADDED,this.handleFigureSeriesAdded),this.figure.addEventListener(I.plot.Figure.EVENT_DISCONNECT,this.handleFigureDisconnected),this.figure.addEventListener(I.plot.Figure.EVENT_RECONNECT,this.handleFigureReconnected),this.figure.addEventListener(I.plot.Figure.EVENT_DOWNSAMPLESTARTED,this.handleDownsampleStart),this.figure.addEventListener(I.plot.Figure.EVENT_DOWNSAMPLEFINISHED,this.handleDownsampleFinish),this.figure.addEventListener(I.plot.Figure.EVENT_DOWNSAMPLEFAILED,this.handleDownsampleFail),this.figure.addEventListener(I.plot.Figure.EVENT_DOWNSAMPLENEEDED,this.handleDownsampleNeeded),this.figure.addEventListener(I.Client.EVENT_REQUEST_FAILED,this.handleRequestFailed)}stopListeningFigure(){this.figure.removeEventListener(I.plot.Figure.EVENT_UPDATED,this.handleFigureUpdated),this.figure.removeEventListener(I.plot.Figure.EVENT_SERIES_ADDED,this.handleFigureSeriesAdded),this.figure.removeEventListener(I.plot.Figure.EVENT_DISCONNECT,this.handleFigureDisconnected),this.figure.removeEventListener(I.plot.Figure.EVENT_RECONNECT,this.handleFigureReconnected),this.figure.removeEventListener(I.plot.Figure.EVENT_DOWNSAMPLESTARTED,this.handleDownsampleStart),this.figure.removeEventListener(I.plot.Figure.EVENT_DOWNSAMPLEFINISHED,this.handleDownsampleFinish),this.figure.removeEventListener(I.plot.Figure.EVENT_DOWNSAMPLEFAILED,this.handleDownsampleFail),this.figure.removeEventListener(I.plot.Figure.EVENT_DOWNSAMPLENEEDED,this.handleDownsampleNeeded),this.figure.removeEventListener(I.Client.EVENT_REQUEST_FAILED,this.handleRequestFailed)}handleDownsampleStart(e){rt.debug("Downsample started",e),this.fireDownsampleStart(e.detail)}handleDownsampleFinish(e){rt.debug("Downsample finished",e),this.fireDownsampleFinish(e.detail)}handleDownsampleFail(e){rt.error("Downsample failed",e),this.fireDownsampleFail(e.detail)}handleDownsampleNeeded(e){rt.info("Downsample needed",e),this.fireDownsampleNeeded(e.detail)}handleFigureUpdated(e){const{detail:t}=e,{series:n}=t;rt.debug2("handleFigureUpdated",n);for(let o=0;o<n.length;o+=1){const i=n[o];rt.debug2("handleFigureUpdated updating series",i.name);const{sources:r}=i;for(let l=0;l<r.length;l+=1){const a=r[l],{columnType:c,type:d}=a,u=this.getValueTranslator(c,this.formatter),m=t.getArray(i,d,u);this.setDataArrayForSeries(i,d,m)}this.seriesToProcess.delete(i.name),this.seriesToProcess.size===0&&this.fireLoadFinished(),this.cleanSeries(i)}const{data:s}=this;this.fireUpdate(s)}handleRequestFailed(e){rt.error("Request failed",e)}resubscribe(){this.listeners.length>0&&(this.unsubscribeFigure(),this.subscribeFigure())}setFormatter(e){super.setFormatter(e),this.updateLayoutFormats(),this.resubscribe()}setDownsamplingDisabled(e){super.setDownsamplingDisabled(e),this.resubscribe()}handleFigureDisconnected(e){rt.debug("Figure disconnected",e),this.isConnected=!1,this.listeners.length>0&&this.unsubscribeFigure(),this.fireDisconnect()}handleFigureReconnected(e){rt.debug("Figure reconnected",e),this.isConnected=!0,this.initAllSeries(),this.fireReconnect(),this.listeners.length>0&&this.subscribeFigure()}handleFigureSeriesAdded(e){const{detail:t}=e;rt.debug("handleFigureSeriesAdded",t),this.pendingSeries.push(t),this.addPendingSeries()}setDimensions(e){super.setDimensions(e),this.updateAxisPositions()}setTitle(e){var s,o;super.setTitle(e);const t=(o=(s=(e!=null?e:"").match(/<br>/g))==null?void 0:s.length)!=null?o:0,n=be.DEFAULT_MARGIN.t+t*be.SUBTITLE_LINE_HEIGHT;this.layout.margin?this.layout.margin.t=n:this.layout.margin={t:n},typeof this.layout.title=="string"?this.layout.title=e:(this.layout.title={...this.layout.title},this.layout.title.text=e,this.layout.title.pad={...this.layout.title.pad},this.layout.title.pad.t=be.DEFAULT_TITLE_PADDING.t+t*be.SUBTITLE_LINE_HEIGHT*.5)}getPlotWidth(){var e,t,n,s;return!this.rect||!this.rect.width?0:Math.max(this.rect.width-((t=(e=this.layout.margin)==null?void 0:e.l)!=null?t:0)-((s=(n=this.layout.margin)==null?void 0:n.r)!=null?s:0),0)}getPlotHeight(){var e,t,n,s;return!this.rect||!this.rect.height?0:Math.max(this.rect.height-((t=(e=this.layout.margin)==null?void 0:e.t)!=null?t:0)-((s=(n=this.layout.margin)==null?void 0:n.b)!=null?s:0),0)}updateAxisPositions(){const e=this.getPlotWidth(),t=this.getPlotHeight();be.updateFigureAxes(this.layout,this.figure,n=>this.getAxisRangeParser(n,this.formatter),e,t,this.theme)}updateLayoutFormats(){if(!this.formatter)return;be.getAxisFormats(this.figure,this.formatter).forEach((t,n)=>{rt.debug(`Assigning ${n}`,this.layout[n],t);const s=this.layout[n];s!=null?Object.assign(s,t):rt.debug(`Ignoring null layout.${n}`)})}setDataArrayForSeries(e,t,n){const{name:s,plotStyle:o}=e,i=this.seriesDataMap.get(s),r=be.getPlotlyProperty(o,t);i&&Zl(i,r,n)}cleanSeries(e){const{name:t,plotStyle:n}=e,s=this.seriesDataMap.get(t);if(s!=null){if(n===I.plot.SeriesPlotStyle.HISTOGRAM){const{xLow:o,xHigh:i}=s;if(o&&i&&o.length===i.length){const r=[];for(let l=0;l<o.length;l+=1)r.push(i[l]-o[l]);s.width=r}}else if(n===I.plot.SeriesPlotStyle.LINE){const{x:o,xLow:i,xHigh:r,y:l,yLow:a,yHigh:c}=s;i&&r&&i!==o&&(s.error_x=be.getPlotlyErrorBars(o,i,r)),a&&c&&a!==l&&(s.error_y=be.getPlotlyErrorBars(l,a,c))}else if(n===I.plot.SeriesPlotStyle.TREEMAP){const{ids:o,labels:i}=s;o!==void 0&&i===void 0&&(s.labels=o)}}}getData(){return this.data}getLayout(){return this.layout}getFilterColumnMap(){return new Map(this.filterColumnMap)}isFilterRequired(){return this.oneClicks.find(e=>e.requireAllFiltersToDisplay)!=null}setFilter(e){if(this.oneClicks.length===0){rt.warn("Trying to set a filter, but no one click!");return}rt.debug("setFilter",e);for(let t=0;t<this.oneClicks.length;t+=1){const n=this.oneClicks[t],{columns:s}=n;new Set([...e.keys(),...this.lastFilter.keys()]).forEach(i=>{const r=e.get(i);this.lastFilter.get(i)!==r&&s.find(l=>l.name===i)!=null&&n.setValueForColumn(i,r)})}this.lastFilter=new Map(e)}setFigure(e){this.close(),this.figure=e,this.setTitle(this.getDefaultTitle()),this.initAllSeries(),this.updateAxisPositions(),this.startListeningFigure(),this.listeners.length>0&&this.subscribeFigure()}updateSettings(e){this.settings=e}};let Wf=Dc;Wf.ADD_SERIES_DEBOUNCE=50;function $f({text:e,isOpen:t,onClose:n}){var b,E;const[s,o]=T.exports.useState(!1),[i,r]=T.exports.useState(0),[l,a]=T.exports.useState(!1),[c,d]=T.exports.useState(!1),[u,m]=T.exports.useState(!1),p=T.exports.useRef();T.exports.useEffect(function(){if(!!t){try{JSON.parse(e),m(!0)}catch{m(!1)}d(!1)}},[t,e]),T.exports.useEffect(function(){p.current&&p.current.layout()},[i]),T.exports.useEffect(function(){p.current&&p.current.updateOptions({lineNumbers:l?"on":"off"})},[l]);function g(){a(!l)}function f(){var y;const v=(y=p.current)==null?void 0:y.getModel();!u||!v||(c?(v.setValue(e),d(!1)):(v.setValue(JSON.stringify(JSON.parse(e),void 0,2)),d(!0)),w())}function w(){var y,M;const v=p.current;!v||a(((M=(y=v.getModel())==null?void 0:y.getLineCount())!=null?M:0)>1)}function C(){s&&(p.current=void 0,n())}function S(v){p.current=v,r(v.getContentHeight()),v.onDidContentSizeChange(({contentHeight:y})=>r(y)),w()}return!t&&!s?null:R(Ld,{isOpen:t,centered:!0,keyboard:!0,toggle:C,onOpened:()=>o(!0),onClosed:()=>{o(!1),r(0)},className:"theme-bg-dark cell-overflow-modal",size:"xl",children:[R(Hd,{toggle:n,children:[h("h5",{className:"overflow-modal-title",children:"Cell Contents"}),h(Sa,{kind:"inline",tooltip:"Copy cell contents",copy:(E=(b=p.current)==null?void 0:b.getValue())!=null?E:e}),h(X,{kind:"inline",active:l,icon:su,tooltip:"Toggle line numbers",onClick:g}),u&&h(X,{kind:"inline",icon:eu,active:c,tooltip:"Format as JSON",onClick:f})]}),h(Pd,{style:{height:i},children:h(Gr,{onEditorInitialized:S,settings:{value:e,readOnly:!0,wordWrap:"on",language:u?"typescript":"plaintext",folding:u,padding:{bottom:16},lineNumbers:l?"on":"off",overviewRulerLanes:0,renderLineHighlight:"none",find:{seedSearchStringFromSelection:"never"}}})})]})}function qf(e){return e.model!==void 0}const Kf="###,##0";function Xf({gotoRow:e,gotoRowError:t,gotoValueError:n,onGotoRowSubmit:s,isShown:o,onEntering:i,onEntered:r,onExiting:l,onExited:a,model:c,onGotoRowNumberChanged:d,onClose:u,gotoValueSelectedColumnName:m,gotoValue:p,onGotoValueSelectedColumnNameChanged:g,onGotoValueSelectedFilterChanged:f,onGotoValueChanged:w,onGotoValueSubmit:C}){const S=T.exports.useRef(null),b=T.exports.useRef(null),[E,v]=T.exports.useState(!1);let y=[];qf(c)&&c.table!==void 0&&({columns:y}=c.table);const M="Row number",{rowCount:A}=c,F=G=>{G.key==="Enter"&&(G.stopPropagation(),G.preventDefault(),C())},V=c.getColumnIndexByName(m);O(V);const H=y[V],N=H==null?void 0:H.type,P=x.getNormalizedType(N),k=G=>{w(G!=null?G:"")},z=()=>{var G,_;E&&document.activeElement!==S.current?(G=S.current)==null||G.select():!E&&document.activeElement!==b.current&&((_=b.current)==null||_.select())};T.exports.useEffect(z,[E,e,p]);const K=()=>{switch(P){case x.dataType.DECIMAL:case x.dataType.INT:return h("div",{className:"goto-row-input",children:h("input",{ref:b,type:"number",className:B("form-control",{"is-invalid":n!==""}),onKeyDown:F,placeholder:"value",onChange:G=>k(G.target.value),value:p})});case x.dataType.DATETIME:return h("div",{className:"goto-value-date-time-input",children:h(Ir,{className:B("form-control","goto-value-date-time-input",{"is-invalid":n!==""}),onChange:k})});case x.dataType.STRING:return R(Fe,{children:[h("div",{className:"goto-row-input",children:R("select",{className:"custom-select",onChange:G=>{f(G.target.value)},children:[h("option",{value:U.eq,children:"Equals"},U.eq),h("option",{value:U.contains,children:"Contains"},U.contains),h("option",{value:U.eqIgnoreCase,children:"EqIgnoreCase"},U.eqIgnoreCase)]})}),h("div",{className:"goto-row-input",children:h("input",{ref:b,className:B("form-control",{"is-invalid":n!==""}),onKeyDown:F,placeholder:"value",onChange:G=>k(G.target.value),value:p})})]});case x.dataType.BOOLEAN:return h("div",{className:"goto-row-input",children:R("select",{className:"custom-select",onChange:G=>{k(G.target.value)},value:p,children:[h("option",{value:"true",children:"true"},"true"),h("option",{value:"false",children:"false"},"false")]})});default:return h("div",{className:"goto-row-input",children:h("input",{ref:b,className:"form-control",onKeyDown:F,placeholder:"value",onChange:G=>k(G.target.value),value:p})})}};return h(yi,{isShown:o,className:B("goto-row"),onEntering:i,onEntered:()=>{r(),z()},onExiting:l,onExited:a,children:R(Fe,{children:[R("div",{className:"goto-row-row",children:[R("div",{className:B("goto-row-wrapper",{"is-inactive":!E}),onClick:()=>v(!0),onFocus:()=>v(!0),role:"group",children:[h("div",{className:"goto-row-text",children:"Go to row"}),h("div",{className:"goto-row-input",children:h("input",{ref:S,type:"number",onKeyDown:G=>{G.key==="Enter"&&(G.stopPropagation(),G.preventDefault(),s())},className:B("form-control",{"is-invalid":t!==""}),placeholder:M,onChange:G=>{d(G)},value:e})}),R("div",{className:"goto-row-text",children:["of ",dh.i18n.NumberFormat.format(Kf,A)]}),t&&h("div",{className:"text-danger",children:t})]}),h("div",{className:"goto-row-close",children:h(X,{kind:"ghost",onClick:u,children:h(Z,{icon:go,style:{marginRight:"0"}})})})]}),c.isSeekRowAvailable&&h("div",{className:"goto-row-row",children:R("div",{className:B("goto-row-wrapper",{"is-inactive":E}),onClick:()=>v(!1),onFocus:()=>v(!1),role:"group",children:[h("div",{className:"goto-row-text",children:"Go to value"}),h("div",{className:"goto-row-input",children:h("select",{className:"custom-select",onChange:G=>{const _=G.target.value;g(_)},value:m,children:y.map(G=>h("option",{value:G.name,children:G.name},G.name))})}),K(),R("div",{children:[h(X,{kind:"ghost",disabled:p==="",onClick:()=>{C(!0)},children:h(Z,{icon:zd})}),h(X,{kind:"ghost",disabled:p==="",onClick:()=>{C(!1)},children:h(Z,{icon:Bd})})]}),n&&h("div",{className:"text-danger",children:n})]})})]})})}const le=se.module("IrisGrid"),Yf=500,Qf=250,jf=250,Zf=250,Nc=Object.freeze({aggregations:ye,showOnTop:!1}),Jf="yyyy-MM-dd'T'HH:mm:ss.SSSSSSSSS z";function jl({advancedFilters:e,aggregationSettings:t,customColumns:n,quickFilters:s,reverseType:o,rollupConfig:i,searchFilter:r,selectDistinctColumns:l,sorts:a}){return e.size===0&&t.aggregations.length===0&&n.length===0&&s.size===0&&o===x.REVERSE_TYPE.NONE&&i==null&&r==null&&l.length===0&&a.length===0}const zn=class extends T.exports.Component{constructor(e){var K,G;super(e),this.getAdvancedMenuOpenedHandler=he(_=>this.handleAdvancedMenuOpened.bind(this,_),{max:100}),this.getCachedAdvancedFilterMenuActions=he((_,q,Y,J,de)=>h(Hr,{model:_,column:q,onFilterChange:this.handleAdvancedFilterChange,onSortChange:this.handleAdvancedFilterSortChange,onDone:this.handleAdvancedFilterDone,options:Y,sortDirection:J,formatter:de}),{max:50}),this.getCachedOptionItems=he((_,q,Y,J,de,pe,ge,Te,fe,nt,je,qe,Ut,yt,In,Bt)=>{const xe=[];return _&&xe.push({type:ve.CHART_BUILDER,title:"Chart Builder",icon:Mu}),xe.push({type:ve.VISIBILITY_ORDERING_BUILDER,title:"Hide, Group, and Order Columns",icon:gr}),Y&&xe.push({type:ve.CONDITIONAL_FORMATTING,title:"Conditional Formatting",icon:pr}),q&&xe.push({type:ve.CUSTOM_COLUMN_BUILDER,title:"Custom Columns",icon:pu}),J&&xe.push({type:ve.ROLLUP_ROWS,title:"Rollup Rows",icon:ku}),de&&xe.push({type:ve.AGGREGATIONS,title:"Aggregate Columns",icon:gu}),pe&&xe.push({type:ve.SELECT_DISTINCT,title:"Select Distinct Values",icon:mu}),ge&&Ut&&xe.push({type:ve.TABLE_EXPORTER,title:"Download CSV",icon:Yd}),Bt&&xe.push({type:ve.ADVANCED_SETTINGS,title:"Advanced Settings",icon:Cu}),xe.push({type:ve.QUICK_FILTERS,title:"Quick Filters",subtitle:Te.shortcut.getDisplayText(),icon:oi,isOn:je,onChange:Te.action}),yt&&xe.push({type:ve.SEARCH_BAR,title:"Search Bar",subtitle:fe.shortcut.getDisplayText(),icon:ca,isOn:qe,onChange:fe.action}),xe.push({type:ve.GOTO,title:"Go to",subtitle:nt.shortcut.getDisplayText(),icon:hu,isOn:In,onChange:nt.action}),Object.freeze(xe)},{max:1}),this.getCachedHiddenColumns=he((_,q)=>ne.getHiddenColumns(new Map([..._.initialColumnWidths,...q])),{max:1}),this.getAggregationMap=he((_,q)=>{const Y={};return q.forEach(({operation:J,selected:de,invert:pe})=>{Y[J]=qn.getOperationColumnNames(_,J,de,pe)}),Y}),this.getOperationMap=he((_,q)=>{const Y={};return q.filter(J=>!qn.isRollupOperation(J.operation)).forEach(({operation:J,selected:de,invert:pe})=>{qn.getOperationColumnNames(_,J,de,pe).forEach(ge=>{var fe;const Te=[...(fe=Y[ge])!=null?fe:[],J];Y[ge]=Object.freeze(Te)})}),Y}),this.getOperationOrder=he(_=>_.map(q=>q.operation).filter(q=>!qn.isRollupOperation(q))),this.getCachedFormatColumns=he((_,q)=>Pm(_,q)),this.getCachedModelColumns=he((_,q)=>_.columns),this.getCachedPreviewFormatColumns=he((_,q,Y,J)=>{if(le.debug("getCachedPreviewFormatColumns",q,Y,J),Y!==void 0&&J!==void 0){const de=[...q];return de[J]=Y,this.getCachedFormatColumns(_,de)}return this.getCachedFormatColumns(_,q)}),this.getModelRollupConfig=he((_,q,Y)=>ne.getModelRollupConfig(_,q,Y)),this.getModelTotalsConfig=he((_,q,Y)=>{var Te,fe,nt;const{aggregations:J,showOnTop:de}=Y;if(((fe=(Te=q==null?void 0:q.columns)==null?void 0:Te.length)!=null?fe:0)>0||((nt=J==null?void 0:J.length)!=null?nt:0)===0)return null;const pe=this.getOperationMap(_,J),ge=this.getOperationOrder(J);return{operationMap:pe,operationOrder:ge,showOnTop:de}}),this.getCachedStateOverride=he((_,q,Y,J,de,pe,ge,Te,fe,nt)=>({hoverSelectColumn:_,isFilterBarShown:q,isSelectingColumn:Y,loadingScrimProgress:J,quickFilters:de,advancedFilters:pe,sorts:ge,reverseType:Te,rollupConfig:fe,isMenuShown:nt}),{max:1}),this.getCachedFilter=he((_,q,Y,J,de)=>[..._!=null?_:[],...J!=null?J:[],...ne.getFiltersFromFilterMap(q),...ne.getFiltersFromFilterMap(Y),...de!==void 0?[de]:[]],{max:1}),this.getCachedTheme=he((_,q,Y)=>({...Ka,..._,autoSelectRow:!q,rowFooterWidth:Y>0?_.rowFooterWidth:0}),{max:1}),this.getAlwaysFetchColumns=he((_,q,Y,J,de,pe)=>{const ge=[];for(let fe=0;fe<J;fe+=1)ge.push(q[W.getModelIndex(fe,Y)].name);for(let fe=0;fe<de;fe+=1)ge.push(q[W.getModelIndex(q.length-1-fe,Y)].name);if(pe)for(let fe=pe[0];fe<=pe[1];fe+=1)ge.push(q[W.getModelIndex(fe,Y)].name);const Te=new Set([..._,...ge]);return Object.freeze([...Te])}),this.updateSearchFilter=ft((_,q,Y,J)=>{const de=jo.createSearchFilter(_,q,Y,J);this.setState({searchFilter:de})},Qf),this.handleConditionalFormatEditorUpdate=ft(_=>{this.setState({conditionalFormatPreview:_})},Zf),this.handleDownloadProgressUpdate=Zn((_,q)=>{const{tableDownloadStatus:Y}=this.state;Y===Tt.DOWNLOAD_STATUS.DOWNLOADING&&this.setState({tableDownloadProgress:_,tableDownloadEstimatedTime:q})},Yf),this.getOverflowButtonTooltip=he(_=>{if(_==null)return null;const q={position:"absolute",..._,pointerEvents:"none"};return h("div",{style:q,children:h(We,{options:{placement:"left",modifiers:{flip:{behavior:["left","right"]}}},ref:this.handleTooltipRef,children:"View full contents"},Date.now())})}),this.getExpandCellTooltip=he(_=>{if(_==null)return null;const{expandTooltipDisplayValue:q}=this.state,Y={position:"absolute",..._,pointerEvents:"none"};return h("div",{style:Y,children:h(We,{options:{placement:"bottom-start"},ref:this.handleTooltipRef,children:R("div",{style:{textAlign:"left"},children:["Click to ",q," row",h("br",{}),Ne.isMacPlatform()?"\u2318":"Ctrl+","Click to expand row and all children"]})},Date.now())})}),this.handleGotoValueChanged=_=>{this.setState({gotoValue:_}),this.debouncedSeekRow(_)},this.debouncedSeekRow=ft(_=>{this.seekRow(_)},jf),this.handleAdvancedFilterChange=this.handleAdvancedFilterChange.bind(this),this.handleAdvancedFilterSortChange=this.handleAdvancedFilterSortChange.bind(this),this.handleAdvancedFilterDone=this.handleAdvancedFilterDone.bind(this),this.handleAdvancedMenuOpened=this.handleAdvancedMenuOpened.bind(this),this.handleGotoRowOpened=this.handleGotoRowOpened.bind(this),this.handleGotoRowClosed=this.handleGotoRowClosed.bind(this),this.handleAdvancedMenuClosed=this.handleAdvancedMenuClosed.bind(this),this.handleAggregationChange=this.handleAggregationChange.bind(this),this.handleAggregationsChange=this.handleAggregationsChange.bind(this),this.handleAggregationEdit=this.handleAggregationEdit.bind(this),this.handleAnimationLoop=this.handleAnimationLoop.bind(this),this.handleAnimationStart=this.handleAnimationStart.bind(this),this.handleAnimationEnd=this.handleAnimationEnd.bind(this),this.handleChartChange=this.handleChartChange.bind(this),this.handleChartCreate=this.handleChartCreate.bind(this),this.handleGridError=this.handleGridError.bind(this),this.handleFilterBarChange=this.handleFilterBarChange.bind(this),this.handleFilterBarDone=this.handleFilterBarDone.bind(this),this.handleFilterBarTab=this.handleFilterBarTab.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleMenu=this.handleMenu.bind(this),this.handleMenuClose=this.handleMenuClose.bind(this),this.handleMenuSelect=this.handleMenuSelect.bind(this),this.handleMenuBack=this.handleMenuBack.bind(this),this.handleRequestFailed=this.handleRequestFailed.bind(this),this.handleSelectionChanged=this.handleSelectionChanged.bind(this),this.handleMovedColumnsChanged=this.handleMovedColumnsChanged.bind(this),this.handleHeaderGroupsChanged=this.handleHeaderGroupsChanged.bind(this),this.handleUpdate=this.handleUpdate.bind(this),this.handleTooltipRef=this.handleTooltipRef.bind(this),this.handleViewChanged=this.handleViewChanged.bind(this),this.handleFormatSelection=this.handleFormatSelection.bind(this),this.handleConditionalFormatCreate=this.handleConditionalFormatCreate.bind(this),this.handleConditionalFormatEdit=this.handleConditionalFormatEdit.bind(this),this.handleConditionalFormatsChange=this.handleConditionalFormatsChange.bind(this),this.handleConditionalFormatEditorSave=this.handleConditionalFormatEditorSave.bind(this),this.handleConditionalFormatEditorCancel=this.handleConditionalFormatEditorCancel.bind(this),this.handleUpdateCustomColumns=this.handleUpdateCustomColumns.bind(this),this.handleCustomColumnsChanged=this.handleCustomColumnsChanged.bind(this),this.handleSelectDistinctChanged=this.handleSelectDistinctChanged.bind(this),this.handlePendingDataUpdated=this.handlePendingDataUpdated.bind(this),this.handlePendingCommitClicked=this.handlePendingCommitClicked.bind(this),this.handlePendingDiscardClicked=this.handlePendingDiscardClicked.bind(this),this.handleGotoRowSelectedRowNumberSubmit=this.handleGotoRowSelectedRowNumberSubmit.bind(this),this.focusRowInGrid=this.focusRowInGrid.bind(this),this.handleDownloadTable=this.handleDownloadTable.bind(this),this.handleDownloadTableStart=this.handleDownloadTableStart.bind(this),this.handleCancelDownloadTable=this.handleCancelDownloadTable.bind(this),this.handleDownloadCanceled=this.handleDownloadCanceled.bind(this),this.handleDownloadCompleted=this.handleDownloadCompleted.bind(this),this.handlePartitionAppend=this.handlePartitionAppend.bind(this),this.handlePartitionChange=this.handlePartitionChange.bind(this),this.handlePartitionFetchAll=this.handlePartitionFetchAll.bind(this),this.handlePartitionDone=this.handlePartitionDone.bind(this),this.handleColumnVisibilityChanged=this.handleColumnVisibilityChanged.bind(this),this.handleColumnVisibilityReset=this.handleColumnVisibilityReset.bind(this),this.handleCrossColumnSearch=this.handleCrossColumnSearch.bind(this),this.handleRollupChange=this.handleRollupChange.bind(this),this.handleOverflowClose=this.handleOverflowClose.bind(this),this.getColumnBoundingRect=this.getColumnBoundingRect.bind(this),this.handleGotoRowSelectedRowNumberChanged=this.handleGotoRowSelectedRowNumberChanged.bind(this),this.handleGotoValueSelectedColumnNameChanged=this.handleGotoValueSelectedColumnNameChanged.bind(this),this.handleGotoValueSelectedFilterChanged=this.handleGotoValueSelectedFilterChanged.bind(this),this.handleGotoValueChanged=this.handleGotoValueChanged.bind(this),this.handleGotoValueSubmitted=this.handleGotoValueSubmitted.bind(this),this.grid=null,this.gridWrapper=null,this.lastLoadedConfig=null,this.pending=new bi,this.globalColumnFormats=ye,this.decimalFormatOptions={},this.integerFormatOptions={},this.truncateNumbersWithPound=!1,this.renderer=new mo,this.tableSaver=null,this.crossColumnRef=te.createRef(),this.isAnimating=!1,this.filterInputRef=te.createRef(),this.toggleFilterBarAction={action:()=>this.toggleFilterBar(),shortcut:Lt.TABLE.TOGGLE_QUICK_FILTER},this.toggleSearchBarAction={action:()=>this.toggleSearchBar(),shortcut:Lt.TABLE.TOGGLE_SEARCH},this.toggleGotoRowAction={action:()=>this.toggleGotoRow(),shortcut:Lt.TABLE.GOTO_ROW},this.discardAction={action:()=>{const{model:_}=this.props;He(_)&&_.isEditable&&_.pendingDataMap.size>0&&this.discardPending().catch(le.error)},shortcut:Lt.INPUT_TABLE.DISCARD},this.commitAction={action:()=>{const{model:_}=this.props;He(_)&&_.isEditable&&_.pendingDataMap.size>0&&_.pendingDataErrors.size===0&&this.commitPending().catch(le.error)},shortcut:Lt.INPUT_TABLE.COMMIT},this.contextActions=[this.toggleFilterBarAction,this.toggleSearchBarAction,this.toggleGotoRowAction,this.discardAction,this.commitAction];const{aggregationSettings:t,conditionalFormats:n,customColumnFormatMap:s,isFilterBarShown:o,isSelectingPartition:i,model:r,movedColumns:l,movedRows:a,partition:c,partitionColumn:d,rollupConfig:u,userColumnWidths:m,userRowHeights:p,showSearchBar:g,searchValue:f,selectedSearchColumns:w,invertSearchColumns:C,advancedFilters:S,quickFilters:b,selectDistinctColumns:E,pendingDataMap:v,canCopy:y,frozenColumns:M,columnHeaderGroups:A}=e,F=[new Qm(this),new jm(this)];y&&F.push(new Km(this));const V=[new Zm(this),new op(this),new Jm(this),new ep(this),new ip(this),new sp(this),new ln(this),new np(this),new rp(this)],H=l.length>0?l:r.initialMovedColumns,N=a.length>0?a:r.initialMovedRows,P=new cp({userColumnWidths:new Map(m),userRowHeights:new Map(p),movedColumns:H,initialColumnWidths:new Map((G=(K=r==null?void 0:r.layoutHints)==null?void 0:K.hiddenColumns)==null?void 0:G.map(_=>[r.getColumnIndexByName(_),0]))}),k=w!=null?w:[],z=jo.createSearchFilter(f,k,r.columns,C);this.state={isFilterBarShown:o,isSelectingPartition:i,focusedFilterBarColumn:null,metricCalculator:P,metrics:void 0,keyHandlers:F,mouseHandlers:V,partition:c,partitionColumn:d,partitionTable:null,partitionFilters:[],quickFilters:b?new Map(b):new Map,advancedFilters:new Map(S),shownAdvancedFilter:null,hoverAdvancedFilter:null,sorts:[],reverseType:x.REVERSE_TYPE.NONE,customColumns:[],selectDistinctColumns:E,selectedRanges:[],copyOperation:null,loadingText:null,loadingScrimProgress:null,loadingSpinnerShown:!1,movedColumns:H,movedRows:N,shownColumnTooltip:null,formatter:new nn,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:z,searchValue:f,selectedSearchColumns:k,invertSearchColumns:C,rollupConfig:u,rollupSelectedColumns:[],aggregationSettings:t,selectedAggregation:null,openOptions:[],pendingRowCount:0,pendingDataMap:v!=null?v:new Map,pendingDataErrors:new Map,pendingSavePromise:null,pendingSaveError:null,toastMessage:null,frozenColumns:M,showOverflowModal:!1,overflowText:"",overflowButtonTooltipProps:null,expandCellTooltipProps:null,expandTooltipDisplayValue:"expand",isGotoShown:!1,gotoRow:"",gotoRowError:"",gotoValueError:"",gotoValueSelectedColumnName:r.columns[0].name,gotoValueSelectedFilter:U.eq,gotoValue:"",columnHeaderGroups:A!=null?A:r.initialColumnHeaderGroups}}static makeQuickFilter(e,t,n){try{return x.makeQuickFilter(e,t,n)}catch(s){le.error("Error creating quick filter",s)}return null}componentDidMount(){const{partitionColumn:e,model:t}=this.props,n=e!=null?e:t.columns.find(s=>s.isPartitionColumn);t.isFilterRequired&&t.isValuesTableAvailable&&n!=null?this.loadPartitionsTable(n):this.initState(),this.startListening(t)}componentDidUpdate(e){var d;const{inputFilters:t,isSelectingColumn:n,settings:s,model:o,customFilters:i,sorts:r}=this.props;o!==e.model&&(this.stopListening(e.model),this.startListening(o));const l=t!==e.inputFilters?t.filter(u=>!e.inputFilters.includes(u)):[];if(l.length>0){const{advancedSettings:u}=this.props,m=(d=u.get(fs.FILTER_CONTROL_CHANGE_CLEARS_ALL_FILTERS))!=null?d:!1;m&&(this.clearGridInputField(),this.clearCrossColumSearch()),this.startLoading("Filtering...",!0),this.applyInputFilters(l,m)}n!==e.isSelectingColumn&&this.resetColumnSelection(),s!==e.settings&&this.updateFormatterSettings(s),i!==e.customFilters&&this.startLoading("Filtering...",!0),r!==e.sorts&&this.updateSorts(r);const{loadingScrimStartTime:a,loadingScrimFinishTime:c}=this;a!=null&&c!=null&&window.requestAnimationFrame(()=>{const u=Date.now(),m=u-a,p=c-a,g=Math.min(m/p,1);c<u&&(this.loadingScrimStartTime=void 0,this.loadingScrimFinishTime=void 0),this.setState(f=>f.loadingScrimProgress==null?(le.debug2("Ignoring scrim update because loading cancelled."),null):{loadingScrimProgress:g})}),this.sendStateChange()}componentWillUnmount(){const{model:e}=this.props;this.stopListening(e),this.pending.cancel(),this.updateSearchFilter.cancel(),this.loadingTimer&&clearTimeout(this.loadingTimer),this.handleDownloadProgressUpdate.cancel(),this.animationFrame!==void 0&&cancelAnimationFrame(this.animationFrame)}getValueForCell(e,t,n=!1){const{model:s}=this.props,o=this.getModelColumn(e),i=this.getModelRow(t);if(n&&o!=null&&i!=null){const r=s.valueForCell(o,i);if(x.isDateType(s.columns[o].type)){const{formatter:l}=s;return I.i18n.DateTimeFormat.format(Jf,r,I.i18n.TimeZone.getTimeZone(l.timeZone))}return r}return n?null:o!=null&&i!=null?s.textForCell(o,i):""}getModelColumn(e){const{metrics:t}=this.state;O(t);const{modelColumns:n}=t;return n==null?null:e!=null?n.get(e):null}getModelRow(e){const{metrics:t}=this.state;O(t);const{modelRows:n}=t;return n==null?null:e!=null?n.get(e):null}getTheme(){var n;const{model:e,theme:t}=this.props;return this.getCachedTheme(t,(n=He(e)&&e.isEditable)!=null?n:!1,e.floatingTopRowCount+e.floatingBottomRowCount)}getVisibleColumn(e){const{movedColumns:t}=this.state;return W.getVisibleIndex(e,t)}applyInputFilters(e,t=!1){const{model:n}=this.props,{advancedFilters:s,quickFilters:o}=this.state,i=t?new Map:new Map(s),r=t?new Map:new Map(o);let l=t&&s.size>0;e.forEach(({name:a,type:c,value:d})=>{const u=n.columns.findIndex(({name:m,type:p})=>m===a&&p===c);u>=0?(l=i.delete(u)||l,l=this.applyQuickFilter(u,d,r)||l):le.error("Unable to find column for inputFilter",a,c,d)}),l&&this.setState({quickFilters:r,advancedFilters:i})}applyQuickFilter(e,t,n){const{model:s}=this.props,{formatter:o}=s,i=s.columns[e];if(t!=null&&`${t}`.trim().length>0){const r=n.get(e);if(r!=null){const{text:l}=r;if(l===t)return le.debug2("Ignoring change to existing filter"),!1}return n.set(e,{text:t,filter:zn.makeQuickFilter(i,t,o.timeZone)}),!0}return n.delete(e)}setAdvancedFilterMap(e){this.setState({advancedFilters:e})}setAdvancedFilter(e,t,n){le.debug("Setting advanced filter",e,t),this.startLoading("Filtering...",!0),this.setState(({advancedFilters:s})=>{const o=new Map(s);return t==null?o.delete(e):o.set(e,{filter:t,options:n}),{advancedFilters:o}})}setQuickFilter(e,t,n){le.debug("Setting quick filter",e,t,n),this.startLoading("Filtering...",!0),this.setState(({quickFilters:s})=>{const o=new Map(s);return o.set(e,{filter:t,text:n}),{quickFilters:o}})}setFilterMap(e){var o;le.debug("setFilterMap",e);const{advancedSettings:t}=this.props;((o=t.get(fs.LINK_CHANGE_CLEARS_ALL_FILTERS))!=null?o:!1)&&this.clearAllFilters();const{model:s}=this.props;e.forEach(({columnType:i,filterList:r},l)=>{const a=s.columns.find(u=>u.name===l&&u.type===i);if(a==null)return;const c=s.getColumnIndexByName(a.name);O(c);const d=ne.combineFiltersFromList(i,r);if(d.length===0)this.removeQuickFilter(c);else{const{formatter:u}=s;this.setQuickFilter(c,zn.makeQuickFilter(a,d,u.timeZone),`${d}`)}})}removeColumnFilter(e){this.startLoading("Filtering...",!0),this.setState(({advancedFilters:t,quickFilters:n})=>{const s=t?new Map(t):new Map,o=n?new Map(n):new Map;return o.delete(e),s.delete(e),{quickFilters:o,advancedFilters:s}})}removeQuickFilter(e){this.startLoading("Clearing Filter...",!0),this.setState(({quickFilters:t})=>{const n=new Map(t);return n.delete(e),{quickFilters:n}})}clearAllFilters(){le.debug("Clearing all filters");const{advancedFilters:e,quickFilters:t,searchFilter:n}=this.state;t.size===0&&e.size===0&&n===null||(this.clearGridInputField(),this.startLoading("Clearing Filters...",!0),this.setState({quickFilters:new Map,advancedFilters:new Map,searchValue:"",searchFilter:void 0}))}clearCrossColumSearch(){le.debug("Clearing cross-column search"),this.setState({searchValue:"",searchFilter:void 0})}clearGridInputField(){this.filterInputRef.current!=null&&this.filterInputRef.current.setValue("")}rebuildFilters(){le.debug("Rebuilding filters");const{model:e}=this.props,{advancedFilters:t,quickFilters:n}=this.state,{columns:s,formatter:o}=e,i=new Map,r=new Map;t.forEach((l,a)=>{const{options:c}=l,d=s[a],u=x.makeAdvancedFilter(d,c,o.timeZone);i.set(a,{options:c,filter:u})}),n.forEach((l,a)=>{const{text:c}=l,d=s[a];r.set(a,{text:c,filter:zn.makeQuickFilter(d,c,o.timeZone)})}),this.startLoading("Rebuilding filters...",!0),this.setState({quickFilters:r,advancedFilters:i})}setFilters({quickFilters:e,advancedFilters:t}){this.setState({quickFilters:e,advancedFilters:t})}updateFormatterSettings(e,t=!0){var m,p,g;const n=ms.getColumnFormats(e),s=ms.getDateTimeFormatterOptions(e),o=(m=e==null?void 0:e.defaultDecimalFormatOptions)!=null?m:{},i=(p=e==null?void 0:e.defaultIntegerFormatOptions)!=null?p:{},r=(g=e==null?void 0:e.truncateNumbersWithPound)!=null?g:!1,l=!ct(this.globalColumnFormats,n),a=!ct(this.dateTimeFormatterOptions,s),c=!ct(this.decimalFormatOptions,e==null?void 0:e.defaultDecimalFormatOptions),d=!ct(this.integerFormatOptions,i),u=this.truncateNumbersWithPound!==r;(l||a||c||d||u)&&(this.globalColumnFormats=n,this.dateTimeFormatterOptions=s,this.decimalFormatOptions=o,this.integerFormatOptions=i,this.truncateNumbersWithPound=r,this.updateFormatter({},t),a&&t&&this.rebuildFilters())}updateFormatter(e,t=!0){var r;const{customColumnFormatMap:n}=this.state,s={customColumnFormatMap:n,...e},o=[...(r=this.globalColumnFormats)!=null?r:[],...s.customColumnFormatMap.values()],i=new nn(o,this.dateTimeFormatterOptions,this.decimalFormatOptions,this.integerFormatOptions,this.truncateNumbersWithPound);le.debug("updateFormatter",this.globalColumnFormats,o),this.setState({...s,formatter:i},()=>{t&&this.grid&&this.grid.forceUpdate()})}initFormatter(){const{settings:e}=this.props;this.updateFormatterSettings(e)}initState(){const{applyInputFiltersOnInit:e,inputFilters:t,sorts:n,model:s,reverseType:o,customColumns:i,searchValue:r,selectedSearchColumns:l,invertSearchColumns:a}=this.props,c=l!=null?l:[],d=jo.createSearchFilter(r,c,s.columns,a);if(e){const u=t.filter(m=>m.value!=null);this.applyInputFilters(u)}this.setState({sorts:n,reverseType:o,customColumns:i,isReady:!0,searchFilter:d}),this.initFormatter()}async loadPartitionsTable(e){const{model:t}=this.props;this.setState({isSelectingPartition:!0});try{const n=await this.pending.add(t.valuesTable(e),r=>r.close()),s=n.columns[0],o=s.sort().desc();n.applySort([o]),n.setViewport(0,0,[s]);const i=await this.pending.add(n.getViewportData());if(i.rows.length>0){const l=i.rows[0].get(s);this.updatePartition(l,e),this.setState({isSelectingPartition:!0})}else le.info("Table does not have any data, just fetching all"),this.setState({isSelectingPartition:!1}),this.handlePartitionFetchAll();this.setState({partitionTable:n,partitionColumn:e},()=>{this.initState()})}catch(n){this.handleTableLoadError(n)}}updatePartition(e,t){const s=[t.filter().eq(I.FilterValue.ofString(e))];this.setState({partition:e,partitionFilters:s})}copyCell(e,t,n=!1){const{canCopy:s}=this.props;if(s){const o=String(this.getValueForCell(e,t,n));fo(o).catch(i=>le.error("Unable to copy cell",i))}else le.error("Attempted to copyCell for user without copy permission.")}copyRanges(e,t=!1,n=!0,s){const{model:o,canCopy:i}=this.props,{metricCalculator:r,movedColumns:l}=this.state,a=r.getUserColumnWidths();if(i){const c={ranges:ee.boundedRanges(e,o.columnCount,o.rowCount),includeHeaders:t,formatValues:n,movedColumns:l,userColumnWidths:a,error:s};this.setState({copyOperation:c})}else le.error("Attempted copyRanges for user without copy permission.")}startLoading(e,t=!1){var s,o;this.setState({loadingText:e});const n=this.getTheme();if(t&&this.grid&&(this.grid.clearSelectedRanges(),this.grid.setViewState({top:0},!0)),this.loadingScrimStartTime==null){const{minScrimTransitionTime:i,maxScrimTransitionTime:r}=n;O(i),O(r);const l=(o=(s=this.gridWrapper)==null?void 0:s.getBoundingClientRect().height)!=null?o:0,a=Math.max(i,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})},zn.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){le.debug("loading last loading config",this.lastLoadedConfig);const{advancedFilters:e,aggregationSettings:t,customColumns:n,quickFilters:s,reverseType:o,rollupConfig:i,searchFilter:r,selectDistinctColumns:l,sorts:a}=this.lastLoadedConfig;this.lastLoadedConfig=null,this.setState({advancedFilters:e,aggregationSettings:t,customColumns:n,quickFilters:s,reverseType:o,rollupConfig:i,searchFilter:r,selectDistinctColumns:l,sorts:a})}else le.debug("remove all sorts, filters, and custom columns"),this.setState({advancedFilters:new Map,aggregationSettings:Nc,customColumns:[],quickFilters:new Map,reverseType:x.REVERSE_TYPE.NONE,rollupConfig:void 0,selectDistinctColumns:[],sorts:[]})}canRollback(){return this.lastLoadedConfig!=null||!jl(this.state)}startListening(e){e.addEventListener(me.EVENT.UPDATED,this.handleUpdate),e.addEventListener(me.EVENT.REQUEST_FAILED,this.handleRequestFailed),e.addEventListener(me.EVENT.COLUMNS_CHANGED,this.handleCustomColumnsChanged),e.addEventListener(me.EVENT.PENDING_DATA_UPDATED,this.handlePendingDataUpdated)}stopListening(e){e.removeEventListener(me.EVENT.UPDATED,this.handleUpdate),e.removeEventListener(me.EVENT.REQUEST_FAILED,this.handleRequestFailed),e.removeEventListener(me.EVENT.COLUMNS_CHANGED,this.handleCustomColumnsChanged),e.removeEventListener(me.EVENT.PENDING_DATA_UPDATED,this.handlePendingDataUpdated)}focus(){var e;(e=this.grid)==null||e.focus()}focusFilterBar(e){var d,u,m;const{movedColumns:t}=this.state,{model:n}=this.props,{columnCount:s}=n,o=W.getModelIndex(e,t);if(e==null||e<0||s<=e||!n.isFilterable(o)){this.setState({focusedFilterBarColumn:null});return}const{metricCalculator:i,metrics:r}=this.state;O(r);const{left:l,rightVisible:a,lastLeft:c}=r;if(e<l)(d=this.grid)==null||d.setViewState({left:e},!0);else if(a<e){const p=(u=this.grid)==null?void 0:u.getMetricState();O(p);const g=i.getLastLeft(p,e,i.getVisibleWidth(p));(m=this.grid)==null||m.setViewState({left:Math.min(g,c),leftOffset:0},!0)}this.lastFocusedFilterBarColumn=e,this.setState({focusedFilterBarColumn:e,isFilterBarShown:!0})}hideColumnByVisibleIndex(e){var s;const{metricCalculator:t,movedColumns:n}=this.state;t.setColumnWidth(W.getModelIndex(e,n),0),(s=this.grid)==null||s.forceUpdate()}freezeColumnByColumnName(e){const{frozenColumns:t,movedColumns:n}=this.state,{model:s}=this.props;le.debug2("freezing column",e);const o=t==null?new Set(s.frozenColumns):new Set(t);o.add(e);const i=s.getColumnIndexByName(e);O(i);const r=W.getVisibleIndex(i,n),l=W.moveItem(r,o.size-1,n);this.setState({frozenColumns:[...o],movedColumns:l})}unFreezeColumnByColumnName(e){const{frozenColumns:t,movedColumns:n}=this.state,{model:s}=this.props;le.debug2("unfreezing column",e);const o=t==null?new Set(s.frozenColumns):new Set(t);o.delete(e);const i=s.getColumnIndexByName(e);O(i);const r=W.getVisibleIndex(i,n),l=W.moveItem(r,o.size+s.frontColumns.length,n);this.setState({frozenColumns:[...o],movedColumns:l})}handleColumnVisibilityChanged(e,t){var o;const{metricCalculator:n,metrics:s}=this.state;O(s),t?e.forEach(i=>{const r=n.initialColumnWidths.get(i),l=L(s.calculatedColumnWidths,i);r!==l?n.setColumnWidth(i,l):n.resetColumnWidth(i)}):e.forEach(i=>{n.setColumnWidth(i,0)}),(o=this.grid)==null||o.forceUpdate()}handleColumnVisibilityReset(){var s,o;const{metricCalculator:e,metrics:t}=this.state,{model:n}=this.props;O(t);for(let i=0;i<t.columnCount;i+=1)e.resetColumnWidth(i);this.handleMovedColumnsChanged(n.initialMovedColumns),this.handleHeaderGroupsChanged(n.initialColumnHeaderGroups),this.setState({frozenColumns:(o=(s=n.layoutHints)==null?void 0:s.frozenColumns)!=null?o:[]})}handleCrossColumnSearch(e,t,n){const{model:s}=this.props;this.updateSearchFilter(e,t,s.columns,n),this.setState({searchValue:e,selectedSearchColumns:t,invertSearchColumns:n})}handleAnimationLoop(){var e,t;(e=this.grid)==null||e.updateCanvasScale(),(t=this.grid)==null||t.updateCanvas(),this.isAnimating&&(this.animationFrame=requestAnimationFrame(this.handleAnimationLoop))}handleAnimationStart(){le.debug2("handleAnimationStart"),this.isAnimating=!0,this.animationFrame=requestAnimationFrame(this.handleAnimationLoop)}handleAnimationEnd(){le.debug2("handleAnimationEnd"),this.isAnimating=!1}handlePartitionAppend(e){const{onPartitionAppend:t}=this.props,{partitionColumn:n}=this.state;n!=null&&t(n,e)}handlePartitionChange(e){const{partitionColumn:t}=this.state;t!=null&&this.updatePartition(e,t)}handlePartitionFetchAll(){this.setState({partitionFilters:[],isSelectingPartition:!1})}handlePartitionDone(){this.setState({isSelectingPartition:!1})}handleTableLoadError(e){if(Ue.isCanceled(e))return;le.error(e);const{onError:t}=this.props;t(e)}showAllColumns(){var s;const{metricCalculator:e}=this.state,n=[...e.getUserColumnWidths().entries()];for(let o=0;o<n.length;o+=1){const[i,r]=n[o];r===0&&e.resetColumnWidth(i)}(s=this.grid)==null||s.forceUpdate()}toggleSort(e,t){le.info("Toggling sort for column",e);const{model:n}=this.props,{sorts:s}=this.state,o=this.getModelColumn(e);O(o);const i=x.toggleSortForColumn(s,n.columns,o,t);this.updateSorts(i)}updateSorts(e){var t;this.startLoading("Sorting..."),this.setState({sorts:e}),(t=this.grid)==null||t.forceUpdate()}sortColumn(e,t=x.sortDirection.none,n=!1,s=!1){var r;O(e);const{model:o}=this.props,i=x.sortColumn(o.sort,o.columns,e,t,n,s);this.startLoading("Sorting..."),this.setState({sorts:i}),(r=this.grid)==null||r.forceUpdate()}reverse(e){var t;this.startLoading("Reversing..."),this.setState({reverseType:e}),(t=this.grid)==null||t.forceUpdate()}isReversible(){const{model:e}=this.props;return e.isReversible}toggleFilterBar(e=this.lastFocusedFilterBarColumn){var n;let{isFilterBarShown:t}=this.state;if(t=!t,this.setState({isFilterBarShown:t}),t)if(e!=null)this.focusFilterBar(e);else{let s=0;const{model:o}=this.props,{columnCount:i}=o;for(let r=0;r<i;r+=1){const l=this.getModelColumn(r);if(l!=null){const a=o.columns[l];if(a!=null&&x.isTextType(a.type)){s=r;break}}}this.focusFilterBar(s)}else(n=this.grid)==null||n.focus()}isTableSearchAvailable(){var s,o,i;const{model:e,canToggleSearch:t}=this.props,n=(s=e==null?void 0:e.layoutHints)==null?void 0:s.searchDisplayMode;return n===((o=I.SearchDisplayMode)==null?void 0:o.SEARCH_DISPLAY_HIDE)?!1:n===((i=I.SearchDisplayMode)==null?void 0:i.SEARCH_DISPLAY_SHOW)?!0:t}toggleSearchBar(){const{showSearchBar:e}=this.state;if(!this.isTableSearchAvailable())return;const t=!e;this.setState({showSearchBar:t},()=>{var n,s,o;t&&((n=this.crossColumnRef)==null?void 0:n.current)?(s=this.crossColumnRef)==null||s.current.focus():(o=this.grid)==null||o.focus()})}toggleGotoRow(e="",t="",n=""){const{isGotoShown:s}=this.state;if(e||t){this.setState({isGotoShown:!0,gotoRow:e,gotoValue:t,gotoValueSelectedColumnName:n,gotoRowError:"",gotoValueError:""}),this.focusRowInGrid(e);return}this.setState({isGotoShown:!s,gotoRow:"",gotoValue:"",gotoRowError:"",gotoValueError:""})}async commitPending(){var o,i;const{model:e}=this.props;if(!He(e)||!e.isEditable)throw new Error("Cannot save, table is not editable");const{pendingSavePromise:t}=this.state;if(t!=null)throw new Error("Save already in progress");const n=(o=document==null?void 0:document.activeElement)==null?void 0:o.classList.contains("grid-cell-input-field");if(n!=null&&n){if(document.activeElement!=null&&document.activeElement.classList.contains("error"))throw new zu("Current input is invalid");(i=this.grid)==null||i.focus()}const s=this.pending.add(e.commitPending()).then(()=>{this.setState({pendingSaveError:null,pendingSavePromise:null})}).catch(r=>{Ue.isCanceled(r)||this.setState({pendingSaveError:r,pendingSavePromise:null})});return this.setState({pendingSavePromise:s}),s}async discardPending(){const{pendingSavePromise:e}=this.state;if(e!=null)throw new Error("Cannot cancel a save in progress");this.setState({pendingSavePromise:null,pendingSaveError:null,pendingDataMap:new Map,pendingDataErrors:new Map})}selectColumn(e){const{onColumnSelected:t}=this.props;t(e)}selectData(e,t){const{model:n}=this.props,{columns:s,groupedColumns:o}=n,i={};for(let l=0;l<s.length;l+=1){const a=s[l],{name:c,type:d}=a,u=n.valueForCell(l,t),m=n.textForCell(l,t),p=this.getVisibleColumn(l),g=ke(n)&&n.isRowExpandable(t),f=o.find(w=>w.name===c)!=null;i[c]={value:u,text:m,type:d,isGrouped:f,isExpandable:g,visibleIndex:p}}const{onDataSelected:r}=this.props;r(t,i)}handleAdvancedFilterChange(e,t,n){const{model:s}=this.props,o=s.getColumnIndexByName(e.name);O(o),this.setAdvancedFilter(o,t,n)}handleAdvancedFilterSortChange(e,t,n=!1){var a;const{model:s}=this.props,o=s.getColumnIndexByName(e.name);O(o);const i=x.getSortForColumn(s.sort,o);let r=null;(i==null||i.direction!==t)&&(t===x.sortDirection.descending?r=e.sort().desc():r=e.sort().asc());const l=x.setSortForColumn(s.sort,o,r,n);le.info("Setting table sorts",l),this.startLoading("Sorting..."),this.setState({sorts:l}),(a=this.grid)==null||a.forceUpdate()}handleAdvancedFilterDone(){var e;(e=this.grid)==null||e.focus()}handleAdvancedMenuOpened(e){this.setState({shownAdvancedFilter:e})}handleGotoRowOpened(){this.setState({isGotoShown:!0})}handleGotoRowClosed(){this.setState({isGotoShown:!1})}handleAdvancedMenuClosed(e){var s,o;const{focusedFilterBarColumn:t,isFilterBarShown:n}=this.state;n&&t===e&&((s=this.filterInputRef)==null?void 0:s.current)!==null?((o=this.filterInputRef)==null||o.current.focus(),this.setState({shownAdvancedFilter:null})):this.setState({focusedFilterBarColumn:null,shownAdvancedFilter:null})}handleCancel(){this.rollback()}handleChartChange(){}handleChartCreate(e){const{model:t,onCreateChart:n}=this.props;n(e,t)}handleGridError(e){le.warn("Grid Error",e),this.setState({toastMessage:h("div",{className:"error-message",children:`${e}`})})}handleFilterBarChange(e){this.startLoading("Filtering...",!0),this.setState(({focusedFilterBarColumn:t,quickFilters:n})=>{const s=new Map(n);if(t!=null){const o=this.getModelColumn(t);O(o),this.applyQuickFilter(o,e,s)}return{quickFilters:s}})}handleFilterBarDone(e=!0,t=!0){var n;e&&((n=this.grid)==null||n.focus()),t&&this.setState({focusedFilterBarColumn:null})}handleFilterBarTab(e){const{focusedFilterBarColumn:t}=this.state;O(t),e?this.focusFilterBar(t-1):this.focusFilterBar(t+1)}handleFormatSelection(e,t){const{model:n}=this.props,s=n.columns[e],{customColumnFormatMap:o}=this.state,i=new Map(o);if(t!=null){const r=x.getNormalizedType(s.type);O(r);const l=nn.makeColumnFormattingRule(r,s.name,t);i.set(s.name,l)}else i.delete(s.name);this.updateFormatter({customColumnFormatMap:i})}handleMenu(e){e.stopPropagation(),this.setState({isMenuShown:!0})}handleMenuClose(){this.setState({isMenuShown:!1,openOptions:[]})}handleMenuBack(){this.setState(({openOptions:e})=>{const t=[...e];return t.pop(),{openOptions:t}})}handleMenuSelect(e){this.setState(({openOptions:t})=>({openOptions:[...t,e]}))}handleRequestFailed(e){const t=e;if(le.error("request failed:",t.detail),this.stopLoading(),this.canRollback())this.startLoading("Rolling back changes...",!0),this.rollback();else{le.error("Table failed and unable to rollback");const{onError:n}=this.props;n(new Error(`Error displaying table: ${t.detail}`))}}handleUpdate(){var d;this.stopLoading(),le.debug2("Received model update");const{advancedFilters:e,aggregationSettings:t,customColumns:n,quickFilters:s,reverseType:o,rollupConfig:i,searchFilter:r,selectDistinctColumns:l,sorts:a}=this.state,c={advancedFilters:e,aggregationSettings:t,customColumns:n,quickFilters:s,reverseType:o,rollupConfig:i,searchFilter:r,selectDistinctColumns:l,sorts:a};jl(c)?this.lastLoadedConfig=null:this.lastLoadedConfig=c,(d=this.grid)==null||d.forceUpdate()}handleViewChanged(e){var o,i;const{model:t}=this.props,{selectionEndRow:n=0}=(i=(o=this.grid)==null?void 0:o.state)!=null?i:{};let s=0;if(He(t)&&t.isEditable){O(e);const{bottomViewport:r}=e,l=t.rowCount-t.floatingBottomRowCount;n===l-1?s=t.pendingRowCount+1:n===l-2?s=t.pendingRowCount:s=Math.max(0,r-(t.rowCount-t.pendingRowCount)-t.floatingTopRowCount-t.floatingBottomRowCount-1)}this.setState({metrics:e,pendingRowCount:s})}handleSelectionChanged(e){O(e);const{onSelectionChanged:t}=this.props,{copyOperation:n}=this.state;this.setState({selectedRanges:e}),n!=null&&this.setState({copyOperation:null}),t(e)}handleMovedColumnsChanged(e,t){this.setState({movedColumns:e},t)}handleHeaderGroupsChanged(e){const{model:t}=this.props;this.setState({columnHeaderGroups:ne.parseColumnHeaderGroups(t,e).groups},()=>{var n;return(n=this.grid)==null?void 0:n.forceUpdate()})}handleTooltipRef(e){e!=null&&e.startTimer(),this.tooltip=e}handleConditionalFormatsChange(e){le.debug("Updated conditional formats",e),this.setState({conditionalFormats:e})}handleConditionalFormatCreate(){le.debug("Create new conditional format");const{openOptions:e,conditionalFormats:t}=this.state;this.setState({openOptions:[...e,{type:ve.CONDITIONAL_FORMATTING_EDIT,title:"Create Formatting Rule"}],conditionalFormatEditIndex:t.length,conditionalFormatPreview:void 0})}handleConditionalFormatEdit(e){le.debug("Edit conditional format",e);const{openOptions:t,conditionalFormats:n}=this.state;this.setState({openOptions:[...t,{type:ve.CONDITIONAL_FORMATTING_EDIT,title:"Edit Formatting Rule"}],conditionalFormatEditIndex:e,conditionalFormatPreview:{...n[e]}})}handleConditionalFormatEditorSave(e){le.debug("Save conditional format changes",e),this.setState(t=>{if(t.conditionalFormatEditIndex===null)return le.debug("Invalid format index"),null;const n=[...t.conditionalFormats];return n[t.conditionalFormatEditIndex]=e,{conditionalFormats:n}},()=>{this.handleMenuBack()})}handleConditionalFormatEditorCancel(){this.handleMenuBack(),this.setState({conditionalFormatEditIndex:null})}handleUpdateCustomColumns(e){le.info("handleUpdateCustomColumns:",e);const{model:t}=this.props,{movedColumns:n,sorts:s,quickFilters:o,advancedFilters:i,selectDistinctColumns:r}=this.state,{columns:l}=t,a=t.customColumns.map(d=>`${d}`),c=ne.getRemovedCustomColumnNames(a,e);if(c.length>0){const d=ne.removeSortsInColumns(s,c),u=ne.removeFiltersInColumns(l,o,c),m=ne.removeFiltersInColumns(l,i,c),p=ne.removeColumnFromMovedColumns(l,n,c),g=ne.removeColumnsFromSelectDistinctColumns(r,c);d.length!==s.length&&(le.debug("removing sorts from removed custom columns..."),this.setState({sorts:d})),(u.size!==o.size||m.size!==i.size)&&(le.debug("removing filters from removed custom columns..."),this.setState({quickFilters:u,advancedFilters:m})),ct(n,p)||(le.debug("change moved columns for removed custom columns",p),this.setState({movedColumns:p})),ct(r,g)||(le.debug("change selectDistinct columns for removed custom columns",p),this.setState({selectDistinctColumns:g}))}this.setState({customColumns:e}),e.length>0&&this.startLoading("Applying custom columns...")}handleCustomColumnsChanged(){var t;le.debug("custom columns changed");const{isReady:e}=this.state;e?(this.stopLoading(),(t=this.grid)==null||t.forceUpdate()):this.initState()}handlePendingCommitClicked(){return this.commitPending()}handlePendingDiscardClicked(){return this.discardPending()}handlePendingDataUpdated(){var s;le.debug("pending data updated");const{model:e}=this.props,{pendingDataMap:t,pendingDataErrors:n}=e;this.setState({pendingDataMap:t,pendingDataErrors:n,pendingSaveError:null}),(s=this.grid)==null||s.forceUpdate()}handleAggregationsChange(e){le.debug("handleAggregationsChange",e),this.startLoading(`Aggregating ${e.aggregations.map(t=>t.operation).join(", ")}...`),this.setState({aggregationSettings:e})}handleAggregationChange(e){le.debug("handleAggregationChange",e),this.startLoading(`Aggregating ${e.operation}...`),this.setState(({aggregationSettings:t})=>({selectedAggregation:e,aggregationSettings:{...t,aggregations:t.aggregations.map(n=>n.operation===e.operation?e:n)}}))}handleAggregationEdit(e){le.debug("handleAggregationEdit",e);const{openOptions:t}=this.state;this.setState({openOptions:[...t,{type:ve.AGGREGATION_EDIT,title:`Edit Columns to ${e.operation}`}],selectedAggregation:e})}handleRollupChange(e){var t,n;le.info("Rollup change",e),this.resetGridViewState(),this.showAllColumns(),this.clearAllFilters(),this.startLoading(`Grouping by columns ${(n=(t=e==null?void 0:e.columns)==null?void 0:t.join(", "))!=null?n:""}...`),this.setState({rollupConfig:e,movedColumns:[],sorts:[],reverseType:x.REVERSE_TYPE.NONE,selectDistinctColumns:[]})}handleSelectDistinctChanged(e){le.debug("SelectDistinct change",e),this.resetGridViewState(),this.showAllColumns(),this.clearAllFilters(),this.startLoading(`Selecting distinct values in ${e.length>0?e.join(", "):""}...`),this.setState({selectDistinctColumns:e,movedColumns:[],sorts:[],reverseType:x.REVERSE_TYPE.NONE})}handleDownloadTableStart(){const{canDownloadCsv:e}=this.props;e?this.setState({isTableDownloading:!0,tableDownloadProgress:0,tableDownloadEstimatedTime:null,tableDownloadStatus:Tt.DOWNLOAD_STATUS.INITIATING}):le.error("Attempted to handleDownloadTableStart for user without download CSV permission.")}handleDownloadTable(e,t,n,s,o,i,r){const{canDownloadCsv:l}=this.props;l?(le.info("start table downloading",e,t,n,s,o,i,r),this.setState(()=>(this.tableSaver&&this.tableSaver.startDownload(e,t,n,s,o,i,r),{tableDownloadStatus:Tt.DOWNLOAD_STATUS.DOWNLOADING}))):le.error("Attempted to handleDownloadTable for user without download CSV permission.")}async seekRow(e,t=!1){var d;const{gotoValueSelectedColumnName:n,gotoValueSelectedFilter:s}=this.state,{model:o}=this.props;if(!o.isSeekRowAvailable||e==="")return;const i=o.getColumnIndexByName(n);if(i===void 0)return;const r=o.columns[i];let l;this.grid&&({selectionEndRow:l}=this.grid.state),l==null&&(l=0);const a=s===U.contains,c=s===U.eq||s===U.eqIgnoreCase;try{const u=x.getNormalizedType(r.type);let m;switch(u){case x.dataType.STRING:{m=await o.seekRow(t===!0?l-1:l+1,r,I.ValueType.STRING,e,c,a,t!=null?t:!1);break}case x.dataType.DATETIME:{const{formatter:p}=o,[g]=En.parseDateRange(e,p.timeZone);m=await o.seekRow(t===!0?l-1:l+1,r,I.ValueType.DATETIME,g,void 0,void 0,t!=null?t:!1);break}case x.dataType.DECIMAL:case x.dataType.INT:{if(!x.isBigDecimalType(r.type)&&!x.isBigIntegerType(r.type)){const p=parseInt(e,10);m=await o.seekRow(l,r,I.ValueType.NUMBER,p,void 0,void 0,t!=null?t:!1)}else m=await o.seekRow(l,r,I.ValueType.STRING,e,void 0,void 0,t!=null?t:!1);break}default:m=await o.seekRow(l,r,I.ValueType.STRING,e,void 0,void 0,t!=null?t:!1)}(d=this.grid)==null||d.setFocusRow(m),this.setState({gotoValueError:""})}catch{this.setState({gotoValueError:"invalid input"})}}handleCancelDownloadTable(){var e;(e=this.tableSaver)==null||e.cancelDownload(),this.setState({isTableDownloading:!1})}handleDownloadCompleted(){this.setState({isTableDownloading:!1,tableDownloadProgress:100,tableDownloadStatus:Tt.DOWNLOAD_STATUS.FINISHED})}handleDownloadCanceled(){this.setState({isTableDownloading:!1,tableDownloadProgress:0,tableDownloadStatus:Tt.DOWNLOAD_STATUS.CANCELED})}deleteRanges(e){const{model:t}=this.props;this.pending.add(t.delete(e)).catch(n=>{Ue.isCanceled(n)||le.error("Unable to delete ranges",e,n)})}resetColumnSelection(){if(this.grid==null)return;const{isSelectingColumn:e}=this.props;if(e){const{columnAllowedCursor:t}=this.props;this.grid.setState({cursor:t})}else this.grid.setState({cursor:null}),this.setState({hoverSelectColumn:null})}resetGridViewState(e=!0){!this.grid||(this.grid.clearSelectedRanges(),this.grid.setViewState({left:0,top:0,topOffset:0,leftOffset:0},e))}sendStateChange(){if(!this.grid)return;const{state:e}=this,{state:t}=this.grid,{onStateChange:n}=this.props;n(e,t)}handleOverflowClose(){this.setState({showOverflowModal:!1})}getColumnBoundingRect(){var m;const{metrics:e,shownColumnTooltip:t}=this.state;O(e),O(t);const n=(m=this.gridWrapper)==null?void 0:m.getBoundingClientRect(),s=20;O(n);const{columnHeaderHeight:o,allColumnXs:i,allColumnWidths:r,width:l,columnHeaderMaxDepth:a}=e,c=i.get(t),d=r.get(t);O(c),O(d);const u=n.left+ze(c+d/2,s,l-s);return{top:n.top+(a-1)*o,left:n.left+ze(c+d/2,s,l-s),bottom:n.top+a*o,right:n.left+ze(c+d/2,s,l-s)+1,width:1,height:o,x:u,y:n.top,toJSON:()=>{throw new Error("not implemented")}}}handleGotoRowSelectedRowNumberSubmit(){const{gotoRow:e}=this.state;this.focusRowInGrid(e)}focusRowInGrid(e){var o,i,r;const{model:t}=this.props,{rowCount:n}=t;if(this.setState({gotoRow:e}),e===""){this.setState({gotoRowError:"",gotoValueError:""});return}const s=parseInt(e,10);s>n||s<-n?this.setState({gotoRowError:"Invalid row index"}):s===0?(this.setState({gotoRowError:"",gotoValueError:""}),(o=this.grid)==null||o.setFocusRow(0)):s<0?(this.setState({gotoRowError:"",gotoValueError:""}),(i=this.grid)==null||i.setFocusRow(s+n)):((r=this.grid)==null||r.setFocusRow(s-1),this.setState({gotoRowError:"",gotoValueError:""}))}handleGotoRowSelectedRowNumberChanged(e){const t=e.target.value;this.focusRowInGrid(t)}getColumnTooltip(e,t,n){const{columnHeaderHeight:s,columnHeaderMaxDepth:o,allColumnXs:i,allColumnWidths:r,width:l}=t,a=i.get(e),c=r.get(e);if(a==null||c==null)return null;const d=Math.max(0,a);let u=c;a+c>l?u=l-a:a<0&&(u=c-Math.abs(a));const m={position:"absolute",top:(o-1)*s,left:d,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(e);if(f==null)return null;const w=n.columns[f];return w==null?null:h("div",{style:m,children:h(We,{timeout:400,interactive:!0,options:g,ref:this.handleTooltipRef,referenceObject:p,onExited:()=>{this.setState({shownColumnTooltip:null})},children:h(Xa,{model:n,column:w,onStatistics:()=>{var C;(C=this.tooltip)==null||C.update()}})},w.name)})}handleGotoValueSelectedColumnNameChanged(e){this.setState({gotoValueSelectedColumnName:e,gotoValueError:""})}handleGotoValueSelectedFilterChanged(e){this.setState({gotoValueSelectedFilter:e,gotoValueError:""})}handleGotoValueSubmitted(e){const{gotoValue:t}=this.state;this.seekRow(t,e)}render(){var Vo,Uo,Bo,$e,vs,qr,Kr,Xr,Yr;const{children:e,customFilters:t,getDownloadWorker:n,isSelectingColumn:s,isStuckToBottom:o,isStuckToRight:i,model:r,name:l,onlyFetchVisibleColumns:a,alwaysFetchColumns:c,advancedSettings:d,onAdvancedSettingsChange:u,canDownloadCsv:m,onCreateChart:p}=this.props,{metricCalculator:g,metrics:f,isFilterBarShown:w,isSelectingPartition:C,isMenuShown:S,isReady:b,copyOperation:E,focusedFilterBarColumn:v,loadingText:y,loadingScrimProgress:M,loadingSpinnerShown:A,keyHandlers:F,mouseHandlers:V,shownColumnTooltip:H,hoverAdvancedFilter:N,shownAdvancedFilter:P,hoverSelectColumn:k,quickFilters:z,advancedFilters:K,partition:G,partitionFilters:_,partitionTable:q,partitionColumn:Y,searchFilter:J,selectDistinctColumns:de,movedColumns:pe,movedRows:ge,formatter:Te,conditionalFormats:fe,conditionalFormatPreview:nt,conditionalFormatEditIndex:je,sorts:qe,reverseType:Ut,customColumns:yt,selectedRanges:In,isTableDownloading:Bt,tableDownloadStatus:xe,tableDownloadProgress:we,tableDownloadEstimatedTime:Ze,showSearchBar:Ke,searchValue:ht,selectedSearchColumns:It,invertSearchColumns:Mn,aggregationSettings:Gt,selectedAggregation:To,rollupConfig:an,openOptions:Mt,pendingSavePromise:Dn,pendingSaveError:ws,pendingRowCount:Ks,pendingDataErrors:Ss,pendingDataMap:bs,toastMessage:Eo,frozenColumns:Ro,columnHeaderGroups:Nn,showOverflowModal:es,overflowText:Ni,overflowButtonTooltipProps:yo,expandCellTooltipProps:Xs,isGotoShown:Ys,gotoRow:Io,gotoRowError:Mo,gotoValueError:Fi,gotoValueSelectedColumnName:xi,gotoValue:Ai}=this.state;if(!b)return null;const ts=this.getTheme(),Oi=this.getCachedFilter(t,z,K,_,J),Do=g.getUserColumnWidths(),No=this.getCachedStateOverride(k,w,s,M,z,K,qe,Ut,an,S),Qs=f?f.top:0,Fo=f?f.bottomViewport:0;let Fn=null,js=null;a&&(Fn=f?f.left:0,js=f?f.right:0);const xo=f!=null&&f.width>0&&f.height>0,Ao=((Uo=(Vo=an==null?void 0:an.columns)==null?void 0:Vo.length)!=null?Uo:0)>0;let Zs=null;const ki=f?Math.min(Math.max(zn.minDebounce,Math.round(f.rowCount/200)),zn.maxDebounce):zn.maxDebounce;if(w&&v!=null&&f!=null){const{gridX:Pe,gridY:Ct,allColumnXs:xn,allColumnWidths:Js,width:Ts}=f,zt=xn.get(v),mt=Js.get(v);if(zt!=null&&mt!=null){const it=Pe+zt,cn=Ct-((Bo=ts.filterBarHeight)!=null?Bo:0),ns=mt+1,ss=(($e=ts.filterBarHeight)!=null?$e:0)-1,Go={top:cn,left:it,minWidth:Math.min(ns,Ts-it),height:ss};let Wt="",Es=!0;const os=this.getModelColumn(v);O(os);const Rs=z.get(os),An=K.get(os);Rs!=null&&(Wt=Rs.text,Es=Rs.filter!=null);const ys=z.size!==0||K.size!==0;Zs=h(za,{ref:this.filterInputRef,style:Go,className:B({error:!Es,active:Wt!==""||An!=null,"iris-grid-has-filter":ys}),isAdvancedFilterSet:An!=null,onAdvancedFiltersTriggered:()=>{this.setState({shownAdvancedFilter:v})},onChange:this.handleFilterBarChange,onDone:this.handleFilterBarDone,onTab:this.handleFilterBarTab,onContextMenu:(vs=this.grid)==null?void 0:vs.handleContextMenu,debounceMs:ki,value:Wt},v)}}let Oo=null;if(y!=null){const Pe=R("div",{className:"iris-grid-loading-status",children:[h("div",{className:B("iris-grid-loading-status-bar",{show:A}),children:y}),R("button",{type:"button",onClick:this.handleCancel,className:B("iris-grid-btn-cancel",{show:A}),children:[h(Z,{icon:go,transform:"down-1"}),"Cancel"]})]}),Ct=f?f.gridY:0;Oo=h("div",{className:"iris-grid-loading",style:{top:Ct},children:Pe})}let ko=null;H!=null&&f&&(ko=this.getColumnTooltip(H,f,r),(qr=this.tooltip)==null||qr.update());const Lo=[];if(f&&w){const{gridX:Pe,gridY:Ct,visibleColumns:xn,allColumnXs:Js,allColumnWidths:Ts}=f,{filterBarHeight:zt}=ts;for(let mt=0;mt<xn.length;mt+=1){const it=xn[mt],cn=Js.get(it),ns=Ts.get(it),ss=this.getModelColumn(it);if(ss!=null&&r.isFilterable(ss)&&cn!=null&&ns!=null&&ns>0){const Wt=Pe+cn+ns-24,Es=Ct-(zt!=null?zt:0)+2,os={position:"absolute",top:Es,left:Wt},An=K.get(ss)!=null,ys=it===N||it===v||An,Pi=h("div",{className:B("advanced-filter-button-container",{hidden:!ys}),style:os,children:ys&&h(X,{kind:"ghost",className:B("btn-link-icon advanced-filter-button",{"filter-set":An}),onClick:()=>{this.setState({shownAdvancedFilter:it})},onContextMenu:Ac=>{var Qr;(Qr=this.grid)==null||Qr.handleContextMenu(Ac)},onMouseEnter:()=>{this.setState({hoverAdvancedFilter:it})},onMouseLeave:()=>{this.setState({hoverAdvancedFilter:null})},children:R("div",{className:"fa-layers",children:[h(Z,{icon:fr,className:"filter-solid"}),h(Z,{icon:oi,className:"filter-light"})]})})},it);Lo.push(Pi)}}}const Po=[];if(f){const{gridX:Pe,visibleColumns:Ct,allColumnXs:xn,allColumnWidths:Js,columnHeaderHeight:Ts}=f;for(let zt=0;zt<Ct.length;zt+=1){const mt=Ct[zt],it=xn.get(mt),cn=Js.get(mt);if(it!=null&&cn!=null&&cn>0){const ns=Pe+it,ss=Pe+it+cn-20,Go=w?{position:"absolute",top:Ts,left:ss,width:20,height:ts.filterBarHeight}:{position:"absolute",top:0,left:ns,width:cn,height:Ts},Wt=this.getModelColumn(mt);if(Wt!=null){const Es=r.columns[Wt],os=K.get(Wt),{options:Rs}=os||{},An=x.getSortForColumn(r.sort,Wt),ys=An?An.direction:null,Pi=h("div",{className:"advanced-filter-menu-container",style:Go,children:h(Rn,{className:"advanced-filter-menu-popper",onEntered:this.getAdvancedMenuOpenedHandler(mt),onExited:()=>{this.handleAdvancedMenuClosed(mt)},isShown:P===mt,interactive:!0,closeOnBlur:!0,options:{positionFixed:!0},children:this.getCachedAdvancedFilterMenuActions(r,Es,Rs,ys,Te)})},mt);Po.push(Pi)}}}}const Ho=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,w,Ke,m,this.isTableSearchAvailable(),Ys,d.size>0),_o=this.getCachedHiddenColumns(g,Do),Li=Mt.map(Pe=>{switch(Pe.type){case ve.CHART_BUILDER:return h(ja,{model:r,onChange:this.handleChartChange,onSubmit:this.handleChartCreate},ve.CHART_BUILDER);case ve.VISIBILITY_ORDERING_BUILDER:return h(Vr,{model:r,movedColumns:pe,hiddenColumns:_o,columnHeaderGroups:Nn,onColumnVisibilityChanged:this.handleColumnVisibilityChanged,onReset:this.handleColumnVisibilityReset,onMovedColumnsChanged:this.handleMovedColumnsChanged,onColumnHeaderGroupChanged:this.handleHeaderGroupsChanged},ve.VISIBILITY_ORDERING_BUILDER);case ve.CONDITIONAL_FORMATTING:return h(lg,{rules:fe,onChange:this.handleConditionalFormatsChange,onCreate:this.handleConditionalFormatCreate,onSelect:this.handleConditionalFormatEdit});case ve.CONDITIONAL_FORMATTING_EDIT:return O(r.columns),O(this.handleConditionalFormatEditorUpdate),h(kg,{columns:r.columns,rule:nt,onUpdate:this.handleConditionalFormatEditorUpdate,onSave:this.handleConditionalFormatEditorSave,onCancel:this.handleConditionalFormatEditorCancel});case ve.CUSTOM_COLUMN_BUILDER:return h(Ja,{model:r,customColumns:yt,onSave:this.handleUpdateCustomColumns,onCancel:this.handleMenuBack},ve.CUSTOM_COLUMN_BUILDER);case ve.ROLLUP_ROWS:return h(_r,{model:r,onChange:this.handleRollupChange,config:an},ve.ROLLUP_ROWS);case ve.AGGREGATIONS:return h(fp,{settings:Gt,isRollup:Ao,onChange:this.handleAggregationsChange,onEdit:this.handleAggregationEdit});case ve.AGGREGATION_EDIT:return To&&h(wp,{aggregation:To,columns:r.originalColumns,onChange:this.handleAggregationChange});case ve.TABLE_EXPORTER:return h(Tt,{model:r,name:l,userColumnWidths:Do,movedColumns:pe,isDownloading:Bt,tableDownloadStatus:xe,tableDownloadProgress:we,tableDownloadEstimatedTime:Ze!=null?Ze:void 0,onDownload:this.handleDownloadTable,onDownloadStart:this.handleDownloadTableStart,onCancel:this.handleCancelDownloadTable,selectedRanges:In},ve.TABLE_EXPORTER);case ve.SELECT_DISTINCT:return h(ac,{model:r,selectDistinctColumns:de,onChange:this.handleSelectDistinctChanged});case ve.ADVANCED_SETTINGS:return h(Ur,{items:d,onChange:u});default:throw Error(`Unexpected option type ${Pe.type}`)}});return R("div",{className:"iris-grid",role:"presentation",children:[R("div",{className:"iris-grid-column",children:[e!=null&&h("div",{className:"iris-grid-bar",children:e}),h(dt,{in:C,timeout:Le.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:q&&Y&&G!=null&&h(lc,{table:q,getFormattedString:(Pe,Ct,xn)=>r.displayString(Pe,Ct,xn),columnName:Y.name,partition:G,onChange:this.handlePartitionChange,onFetchAll:this.handlePartitionFetchAll,onAppend:this.handlePartitionAppend,onDone:this.handlePartitionDone})})}),h(dt,{in:Ke,timeout:Le.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(jo,{value:ht,selectedColumns:It,invertSelection:Mn,onChange:this.handleCrossColumnSearch,columns:r.columns,ref:this.crossColumnRef})})}),R("div",{className:"grid-wrapper",ref:Pe=>{this.gridWrapper=Pe},children:[h(Ws,{ref:Pe=>{this.grid=Pe},isStickyBottom:!He(r)||!r.isEditable,isStuckToBottom:o,isStuckToRight:i,metricCalculator:g,model:r,keyHandlers:F,mouseHandlers:V,movedColumns:pe,movedRows:ge,onError:this.handleGridError,onViewChanged:this.handleViewChanged,onSelectionChanged:this.handleSelectionChanged,onMovedColumnsChanged:this.handleMovedColumnsChanged,renderer:this.renderer,stateOverride:No,theme:ts}),h($f,{isOpen:es,text:Ni,onClose:this.handleOverflowClose}),xo&&h(qa,{model:r,modelColumns:r.columns,top:Qs,bottom:Fo,left:Fn,right:js,filter:Oi,formatter:Te,sorts:qe,reverseType:Ut,movedColumns:pe,customColumns:yt,hiddenColumns:_o,alwaysFetchColumns:this.getAlwaysFetchColumns(c,r.columns,pe,r.floatingLeftColumnCount,r.floatingRightColumnCount,(Xr=(Kr=this.grid)==null?void 0:Kr.state.draggingColumn)==null?void 0:Xr.range),formatColumns:this.getCachedPreviewFormatColumns(this.getCachedModelColumns(r,yt),fe,nt,((Yr=Mt[Mt.length-1])==null?void 0:Yr.type)===ve.CONDITIONAL_FORMATTING_EDIT&&je!=null?je:void 0),rollupConfig:this.getModelRollupConfig(r.originalColumns,an,Gt),totalsConfig:this.getModelTotalsConfig(r.columns,an,Gt),selectDistinctColumns:de,pendingRowCount:Ks,pendingDataMap:bs,frozenColumns:Ro,columnHeaderGroups:Nn}),!S&&h("div",{className:"grid-settings-button",children:h(X,{kind:"ghost","data-testid":`btn-iris-grid-settings-button-${l}`,onClick:this.handleMenu,icon:h(Z,{icon:iu,transform:"up-1"}),tooltip:"Table Options"})}),Zs,Oo,Lo,ko,Po,yo&&this.getOverflowButtonTooltip(yo),Xs&&this.getExpandCellTooltip(Xs)]}),h(Xf,{model:r,isShown:Ys,gotoRow:Io,gotoRowError:Mo,gotoValueError:Fi,onGotoRowSubmit:this.handleGotoRowSelectedRowNumberSubmit,onGotoRowNumberChanged:this.handleGotoRowSelectedRowNumberChanged,onClose:this.handleGotoRowClosed,onEntering:this.handleAnimationStart,onEntered:this.handleAnimationEnd,onExiting:()=>{this.handleAnimationStart(),this.focus()},onExited:this.handleAnimationEnd,gotoValueSelectedColumnName:xi,gotoValue:Ai,onGotoValueSelectedColumnNameChanged:this.handleGotoValueSelectedColumnNameChanged,onGotoValueSelectedFilterChanged:this.handleGotoValueSelectedFilterChanged,onGotoValueChanged:this.handleGotoValueChanged,onGotoValueSubmit:this.handleGotoValueSubmitted}),h(Um,{error:ws,isSaving:Dn!=null,saveTooltip:`Commit (${this.commitAction.shortcut.getDisplayText()})`,discardTooltip:`Discard (${this.discardAction.shortcut.getDisplayText()})`,pendingDataErrors:Ss,pendingDataMap:bs,onEntering:this.handleAnimationStart,onEntered:this.handleAnimationEnd,onExiting:this.handleAnimationStart,onExited:this.handleAnimationEnd,onSave:this.handlePendingCommitClicked,onDiscard:this.handlePendingDiscardClicked}),h(ap,{children:Eo}),h($s,{model:r,copyOperation:E!=null?E:void 0,onEntering:this.handleAnimationStart,onEntered:this.handleAnimationEnd,onExiting:this.handleAnimationStart,onExited:this.handleAnimationEnd}),h(qs,{ref:Pe=>{this.tableSaver=Pe},getDownloadWorker:n,onDownloadCompleted:this.handleDownloadCompleted,onDownloadCanceled:this.handleDownloadCanceled,onDownloadProgressUpdate:this.handleDownloadProgressUpdate,isDownloading:xe===Tt.DOWNLOAD_STATUS.DOWNLOADING,formatter:Te})]}),h(dt,{in:S,timeout:Le.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:R(mh,{children:[h(fl,{title:"Table Options",onClose:this.handleMenuClose,children:h(Fa,{onSelect:Pe=>this.handleMenuSelect(Ho[Pe]),items:Ho})}),Li.map((Pe,Ct)=>h(fl,{title:Mt[Ct].title,onBack:this.handleMenuBack,onClose:this.handleMenuClose,children:Pe},Mt[Ct].type))]})})}),h(re,{actions:this.contextActions})]})}};let vo=zn;vo.minDebounce=150;vo.maxDebounce=500;vo.loadingSpinnerDelay=800;vo.defaultProps={children:null,advancedFilters:Sn,advancedSettings:Sn,alwaysFetchColumns:ye,conditionalFormats:ye,customColumnFormatMap:Sn,isFilterBarShown:!1,applyInputFiltersOnInit:!1,movedColumns:ye,movedRows:ye,inputFilters:ye,customFilters:ye,onCreateChart:void 0,onColumnSelected:()=>{},onDataSelected:()=>{},onError:()=>{},onStateChange:()=>{},onPartitionAppend:()=>{},onAdvancedSettingsChange:()=>{},partition:null,partitionColumn:null,quickFilters:Sn,selectDistinctColumns:ye,sorts:ye,reverseType:x.REVERSE_TYPE.NONE,customColumns:ye,aggregationSettings:Nc,rollupConfig:void 0,userColumnWidths:Sn,userRowHeights:Sn,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:Sn,getDownloadWorker:void 0,settings:{timeZone:"America/New_York",defaultDateTimeFormat:En.FULL_DATE_FORMAT,showTimeZone:!1,showTSeparator:!0,truncateNumbersWithPound:!1,formatter:ye,decimalFormatOptions:D.exports.shape({defaultFormatString:D.exports.string}),integerFormatOptions:D.exports.shape({defaultFormatString:D.exports.string})},canCopy:!0,canDownloadCsv:!0,frozenColumns:null,theme:Ka,canToggleSearch:!0};class eC extends Error{constructor(t,n){super(`${n} can't be empty (on pending row ${t+1})`),this.isMissingKey=!0,this.rowIndex=t,this.columnName=n}}const Ve=se.module("IrisGridTableModel"),tC=150,nC=0,sC=[];function Jo(e){return e.table!==void 0}const lr=class extends me{constructor(e,t=new nn,n=null){var s,o;super(),this.pendingNewRowCount=0,this._columnHeaderGroupMap=new Map,this.columnHeaderParentMap=new Map,this._columnHeaderMaxDepth=null,this._columnHeaderGroups=[],this._movedColumns=null,this.getMemoizedInitialMovedColumns=Ie(i=>{var g;if(!i)return[];let r=[];const{groupMap:l}=ne.parseColumnHeaderGroups(this,(g=i==null?void 0:i.columnGroups)!=null?g:[]),a=(f,w)=>{const C=this.getColumnIndexByName(f);if(C==null)throw new Error(`Unknown layout hint column: ${f}`);const S=W.getVisibleIndex(C,r);r=W.moveItem(S,w,r)},c=(f,w)=>{const C=l.get(f);if(C==null)throw new Error(`Unknown layout hint group: ${f}`);const S=C.getVisibleRange(r);r=W.moveRange(S,w,r)},{frontColumns:d=[],backColumns:u=[],frozenColumns:m=[]}=i;if(d.length||u.length||m.length){const f=new Set;let w=0;m.forEach(S=>{if(f.has(S))throw new Error(`Column specified in multiple layout hints: ${S}`);a(S,w),w+=1}),d.forEach(S=>{if(f.has(S))throw new Error(`Column specified in multiple layout hints: ${S}`);a(S,w),w+=1});let C=this.columnMap.size-1;u.forEach(S=>{if(f.has(S))throw new Error(`Column specified in multiple layout hints: ${S}`);a(S,C),C-=1})}if(i==null?void 0:i.columnGroups){const f=[...l.values()];f.sort((w,C)=>w.depth-C.depth),f.forEach(w=>{const C=w.children[0],S=this.getColumnIndexByName(C);let b;if(S!=null)b=W.getVisibleIndex(S,r);else{const E=l.get(C);if(!E)throw new Error(`Unknown column ${C} in group ${w.name}`);[,b]=E.getVisibleRange(r)}for(let E=1;E<w.children.length;E+=1){const v=w.children[E],y=l.get(v),M=this.getColumnIndexByName(v);if(y){const F=y.getVisibleRange(r)[0]<b?b-y.childIndexes.length+1:b+1;c(v,F),b=F+y.childIndexes.length-1}else if(M!=null){const F=W.getVisibleIndex(M,r)<b?b:b+1;a(v,F),b=F}}})}return this._movedColumns=r,r}),this.getMemoizedInitialColumnHeaderGroups=Ie(i=>{var r;return ne.parseColumnHeaderGroups(this,(r=i==null?void 0:i.columnGroups)!=null?r:[]).groups}),this.getMemoizedColumnMap=Ie(i=>{const r=new Map;return i.forEach(l=>r.set(l.name,l)),r}),this.getColumnIndicesByNameMap=Ie(i=>{const r=new Map;return i.forEach(({name:l},a)=>r.set(l,a)),r}),this.setViewport=Zn((i,r,l)=>{if(r<i){Ve.error("Invalid viewport",i,r);return}const{viewport:a}=this;if(a!=null&&a.top===i&&a.bottom===r&&a.columns===l){Ve.debug2("Ignoring duplicate viewport",a);return}this.viewport={top:i,bottom:r,columns:l},Ve.debug2("setViewport",this.viewport),this.applyViewport()},tC),this.applyViewport=Zn(()=>{if(!this.viewport)return;Ve.debug2("applyViewport",this.viewport);const{top:i,bottom:r,columns:l}=this.viewport,[a,c]=this.getCachedViewportRowRange(i,r);this.applyBufferedViewport(a,c,l)},nC,{leading:!1}),this.getCachedFormattedString=Et((i,r,l,a,c)=>i.getFormattedString(r,l,a,c),{max:1e4}),this.getCachedCustomColumnFormatFlag=Et(ms.isCustomColumnFormatDefined,{max:1e4}),this.getCachedViewportRowRange=Ie((i,r)=>{const l=r-i,a=Math.max(0,i-l*lr.ROW_BUFFER_PAGES),c=r+l*lr.ROW_BUFFER_PAGES;return[a,c]}),this.getCachedPendingErrors=Ie((i,r,l)=>{const a=new Map;return i.forEach((c,d)=>{var m;const{data:u}=c;for(let p=0;p<l;p+=1)u.has(p)||(a.has(d)||a.set(d,[]),(m=a.get(d))==null||m.push(new eC(d,r[p].name)))}),a}),this.handleTableDisconnect=this.handleTableDisconnect.bind(this),this.handleTableReconnect=this.handleTableReconnect.bind(this),this.handleTableUpdate=this.handleTableUpdate.bind(this),this.handleTotalsUpdate=this.handleTotalsUpdate.bind(this),this.handleRequestFailed=this.handleRequestFailed.bind(this),this.handleCustomColumnsChanged=this.handleCustomColumnsChanged.bind(this),this.irisFormatter=t,this.inputTable=n,this.subscription=null,this.table=e,this.viewport=null,this.viewportData=null,this.formattedStringData=[],this.pendingStringData=[],this.isSaveInProgress=!1,this.totalsTable=null,this.totalsTablePromise=null,this.totals=null,this.totalsDataMap=null,this.pendingNewDataMap=new Map,this.pendingNewRowCount=0,this.columnHeaderGroups=ne.parseColumnHeaderGroups(this,(o=(s=this.layoutHints)==null?void 0:s.columnGroups)!=null?o:[]).groups}seekRow(e,t,n,s,o,i,r){throw new Error("Method not implemented.")}export(){throw new Error("Method not implemented.")}columnStatistics(e){throw new Error("Method not implemented.")}get customColumns(){return[]}set customColumns(e){throw new Error("Method not implemented.")}get formatColumns(){return[]}set formatColumns(e){throw new Error("Method not implemented.")}updateFrozenColumns(e){throw new Error("Method not implemented.")}get rollupConfig(){throw new Error("Method not implemented.")}set rollupConfig(e){throw new Error("Method not implemented.")}get selectDistinctColumns(){throw new Error("Method not implemented.")}set selectDistinctColumns(e){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(I.Table.EVENT_DISCONNECT,this.handleTableDisconnect),this.table.addEventListener(I.Table.EVENT_RECONNECT,this.handleTableReconnect),this.table.addEventListener(I.Table.EVENT_UPDATED,this.handleTableUpdate),this.table.addEventListener(I.Client.EVENT_REQUEST_FAILED,this.handleRequestFailed),this.table.addEventListener(I.Table.EVENT_CUSTOMCOLUMNSCHANGED,this.handleCustomColumnsChanged),this.totalsTable!=null&&this.addTotalsListeners(this.totalsTable),this.applyViewport()}stopListening(){super.stopListening(),this.table.removeEventListener(I.Table.EVENT_DISCONNECT,this.handleTableDisconnect),this.table.removeEventListener(I.Table.EVENT_RECONNECT,this.handleTableReconnect),this.table.removeEventListener(I.Table.EVENT_UPDATED,this.handleTableUpdate),this.table.removeEventListener(I.Client.EVENT_REQUEST_FAILED,this.handleRequestFailed),this.table.removeEventListener(I.Table.EVENT_CUSTOMCOLUMNSCHANGED,this.handleCustomColumnsChanged),this.totalsTable!=null&&this.removeTotalsListeners(this.totalsTable),this.closeSubscription()}addTotalsListeners(e){e.addEventListener(I.Table.EVENT_UPDATED,this.handleTotalsUpdate),e.setViewport(0,0)}removeTotalsListeners(e){e.removeEventListener(I.Table.EVENT_UPDATED,this.handleTotalsUpdate)}handleTableDisconnect(){this.dispatchEvent(new Me(me.EVENT.DISCONNECT))}handleTableReconnect(){this.dispatchEvent(new Me(me.EVENT.RECONNECT))}handleTableUpdate(e){this.copyViewportData(e.detail),this.dispatchEvent(new Me(me.EVENT.UPDATED))}handleTotalsUpdate(e){this.copyTotalsData(e.detail),this.dispatchEvent(new Me(me.EVENT.UPDATED))}handleRequestFailed(e){this.dispatchEvent(new Me(me.EVENT.REQUEST_FAILED,e))}handleCustomColumnsChanged(){this.dispatchEvent(new Me(me.EVENT.COLUMNS_CHANGED,{detail:this.columns}))}get rowCount(){var e,t,n;return this.table.size+this.pendingNewRowCount+((n=(t=(e=this.totals)==null?void 0:e.operationOrder)==null?void 0:t.length)!=null?n:0)}get pendingDataErrors(){var e,t;return this.getCachedPendingErrors(this.pendingNewDataMap,this.columns,(t=(e=this.inputTable)==null?void 0:e.keyColumns.length)!=null?t:0)}get pendingDataMap(){return this.pendingNewDataMap}set pendingDataMap(e){e!==this.pendingNewDataMap&&(e.forEach((t,n)=>{if(!ne.isValidIndex(n))throw new Error(`Invalid rowIndex ${n}`);const{data:s}=t;s.forEach((o,i)=>{if(!ne.isValidIndex(i))throw new Error(`Invalid columnIndex ${i}`)})}),this.pendingNewDataMap=e,this.pendingNewRowCount=Math.max(this.pendingNewRowCount,this.maxPendingDataRow),this.formattedStringData=[],this.dispatchEvent(new Me(me.EVENT.PENDING_DATA_UPDATED)))}get pendingRowCount(){return this.pendingNewRowCount}set pendingRowCount(e){e!==this.pendingNewRowCount&&(this.pendingNewRowCount=Math.max(0,e,this.maxPendingDataRow),this.dispatchEvent(new Me(me.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 e,t,n;return this.totals!=null&&this.totals.showOnTop?0:(n=(t=(e=this.totals)==null?void 0:e.operationOrder)==null?void 0:t.length)!=null?n:0}get floatingTopRowCount(){var e,t,n;return this.totals!=null&&this.totals.showOnTop&&(n=(t=(e=this.totals)==null?void 0:e.operationOrder)==null?void 0:t.length)!=null?n:0}get isChartBuilderAvailable(){return!0}get isTotalsAvailable(){return this.table.getTotalsTable!=null}get isEditable(){return!this.isSaveInProgress&&this.inputTable!=null}cacheFormattedValue(e,t,n){this.formattedStringData[e]==null&&(this.formattedStringData[e]=[]),this.formattedStringData[e][t]=n}cachePendingValue(e,t,n){this.pendingStringData[e]==null&&(this.pendingStringData[e]=[]),this.pendingStringData[e][t]=n}clearPendingValue(e,t){const n=this.pendingStringData[e];n!=null&&delete n[t]}textValueForCell(e,t){var n,s,o;if(((n=this.pendingStringData[e])==null?void 0:n[t])!==void 0)return this.pendingStringData[e][t];if(((s=this.formattedStringData[e])==null?void 0:s[t])===void 0){const i=this.valueForCell(e,t);if(i==null)return null;const r=(o=this.totalsColumn(e,t))!=null?o:this.columns[e],l=this.getCachedCustomColumnFormatFlag(this.formatter,r.name,r.type);let a;if(!l){const d=this.formatForCell(e,t);(d==null?void 0:d.formatString)!=null&&(a=d)}const c=this.displayString(i,r.type,r.name,a);this.cacheFormattedValue(e,t,c)}return this.formattedStringData[e][t]}textForCell(e,t){const n=this.textValueForCell(e,t);if(n==null&&this.isKeyColumn(e)){const s=this.pendingRow(t);if(s!=null&&this.pendingDataMap.has(s))return"*"}return n!=null?n:""}truncationCharForCell(e){const t=this.columns[e],{type:n}=t;if(x.isNumberType(n)&&this.formatter.truncateNumbersWithPound)return"#"}colorForCell(e,t,n){var o;const s=this.dataForCell(e,t);if(s){const{format:i,value:r}=s;if(r==null||r==="")return O(n.nullStringColor),n.nullStringColor;if(i&&i.color)return i.color;if(this.isPendingRow(t))return O(n.pendingTextColor),n.pendingTextColor;if(r!=null){const l=(o=this.totalsColumn(e,t))!=null?o:this.columns[e];if(x.isDateType(l.type)||l.name==="Date")return O(n.dateColor),n.dateColor;if(x.isNumberType(l.type))return r>0?(O(n.positiveNumberColor),n.positiveNumberColor):r<0?(O(n.negativeNumberColor),n.negativeNumberColor):(O(n.zeroNumberColor),n.zeroNumberColor)}}else if(this.isPendingRow(t)&&this.isKeyColumn(e))return O(n.errorTextColor),n.errorTextColor;return n.textColor}backgroundColorForCell(e,t){var n,s;return(s=(n=this.formatForCell(e,t))==null?void 0:n.backgroundColor)!=null?s:null}textAlignForCell(e){const t=this.columns[e],{type:n}=t;return x.isNumberType(n)?"right":x.isDateType(n)||t.name==="Date"?"center":"left"}textForColumnHeader(e,t=0){const n=this.columnAtDepth(e,t);return Gi(n)?n.isNew?"":n.name:n==null?void 0:n.name}colorForColumnHeader(e,t=0){var s;const n=this.columnAtDepth(e,t);return Gi(n)&&(s=n.color)!=null?s:null}getColumnHeaderGroup(e,t){const n=this.columnAtDepth(e,t);if(Gi(n))return n}getColumnHeaderParentGroup(e,t){var n,s;return this.columnHeaderParentMap.get((s=(n=this.columnAtDepth(e,t))==null?void 0:n.name)!=null?s:"")}columnAtDepth(e,t=0){var i;if(t===0)return this.columns[e];const n=(i=this.columns[e])==null?void 0:i.name;let s=this.columnHeaderParentMap.get(n);if(!s)return;let o=s.depth;for(;o<t;){if(s=this.columnHeaderParentMap.get(s.name),!s)return;o=s.depth}if(s.depth===t)return s}textForRowFooter(e){const t=this.totalsRow(e);return t!=null&&this.totals?this.totals.operationOrder[t]:""}get initialMovedColumns(){var e;return this.getMemoizedInitialMovedColumns((e=this.layoutHints)!=null?e:void 0)}get initialMovedRows(){return sC}get initialColumnHeaderGroups(){var e;return this.getMemoizedInitialColumnHeaderGroups((e=this.layoutHints)!=null?e:void 0)}get columnMap(){return this.getMemoizedColumnMap(this.table.columns)}get columnHeaderMaxDepth(){var e;return(e=this._columnHeaderMaxDepth)!=null?e:1}set columnHeaderMaxDepth(e){this._columnHeaderMaxDepth=e}get columnHeaderGroupMap(){return this._columnHeaderGroupMap}get columnHeaderGroups(){return this._columnHeaderGroups}set columnHeaderGroups(e){if(e===this._columnHeaderGroups)return;const{groups:t,maxDepth:n,parentMap:s,groupMap:o}=ne.parseColumnHeaderGroups(this,e!=null?e:this.initialColumnHeaderGroups);this._columnHeaderGroups=t,this.columnHeaderMaxDepth=n,this.columnHeaderParentMap=s,this._columnHeaderGroupMap=o}get groupedColumns(){return[]}row(e){var l,a,c,d,u,m,p,g,f,w,C,S,b,E;const t=(c=(a=(l=this.totals)==null?void 0:l.operationOrder)==null?void 0:a.length)!=null?c:0,n=(u=(d=this.totals)==null?void 0:d.showOnTop)!=null?u:!1,s=this.totalsRow(e);if(s!=null){const v=(m=this.totals)==null?void 0:m.operationOrder[s];return O(v),(g=(p=this.totalsDataMap)==null?void 0:p.get(v))!=null?g:null}const o=this.pendingRow(e);if(o!=null)return(f=this.pendingNewDataMap.get(o))!=null?f:null;const i=(C=(w=this.viewportData)==null?void 0:w.offset)!=null?C:0,r=(n?e-t:e)-i;return(E=(b=(S=this.viewportData)==null?void 0:S.rows)==null?void 0:b[r])!=null?E:null}totalsColumn(e,t){var r,l,a,c;const n=this.totalsRow(t);if(n==null)return null;const s=(r=this.totals)==null?void 0:r.operationOrder[n],o=(a=(l=this.totals)==null?void 0:l.defaultOperation)!=null?a:Ee.SUM,i=this.columns[e];return(c=this.totalsTable)==null?void 0:c.columns.find(d=>{var u;return d.name===`${i.name}__${s}`||(s===o||((u=this.totals)==null?void 0:u.operationOrder.length)===1)&&d.name===i.name})}totalsRow(e){var o,i,r,l,a;const t=(r=(i=(o=this.totals)==null?void 0:o.operationOrder)==null?void 0:i.length)!=null?r:0,s=((a=(l=this.totals)==null?void 0:l.showOnTop)!=null?a:!1)?e:e-this.table.size;return s>=0&&s<t?s:null}pendingRow(e){const t=e-this.floatingTopRowCount-this.table.size;return t>=0&&t<this.pendingNewRowCount?t:null}isTotalsRow(e){return this.totalsRow(e)!=null}isPendingRow(e){return this.pendingRow(e)!=null}dataForCell(e,t){var n;return(n=this.row(t))==null?void 0:n.data.get(e)}formatForCell(e,t){var n;return(n=this.dataForCell(e,t))==null?void 0:n.format}valueForCell(e,t){var s;const n=this.dataForCell(e,t);if(n)return(s=n.value)!=null?s:null}copyViewportData(e){if(e==null){Ve.warn("invalid data!");return}this.viewportData=this.extractViewportData(e),this.formattedStringData=[]}copyTotalsData(e){var l,a,c,d,u;if(e==null){Ve.warn("invalid data!");return}const{columns:t,rows:n}=e;if(n.length!==1){Ve.error("Unexpected number of rows received for totals table, ignoring update");return}const s=new Map,o=n[0],i=(a=(l=this.totals)==null?void 0:l.defaultOperation)!=null?a:Ee.SUM,r=(c=this.totals)==null?void 0:c.operationMap;for(let m=0;m<t.length;m+=1){const p=t[m],[g,f=(u=(d=r==null?void 0:r[g])==null?void 0:d[0])!=null?u:i]=p.name.split("__");s.has(f)||s.set(f,{data:new Map});const{data:w}=s.get(f),C=this.columns.findIndex(S=>S.name===g);w.set(C,{value:o.get(p),format:o.getFormat(p)})}Ve.debug2("copyTotalsData",s),this.totalsDataMap=s,this.formattedStringData=[]}getColumnIndexByName(e){return this.getColumnIndicesByNameMap(this.columns).get(e)}extractViewportData(e){const t={offset:e.offset,rows:[]},{columns:n}=e;for(let s=0;s<e.rows.length;s+=1){const o=e.rows[s],i=this.extractViewportRow(o,n);t.rows.push(i)}return t}extractViewportRow(e,t){const n=new Map;for(let s=0;s<t.length;s+=1){const o=t[s],i=this.getColumnIndexByName(o.name);O(i),n.set(i,{value:e.get(o),format:e.getFormat(o)})}return{data:n}}closeSubscription(){Ve.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(e){this.closeSubscription(),this.table.applyFilter(e),this.applyViewport()}get formatter(){return this.irisFormatter}set formatter(e){this.irisFormatter=e,this.formattedStringData=[],this.dispatchEvent(new Me(me.EVENT.FORMATTER_UPDATED))}displayString(e,t,n="",s){return this.getCachedFormattedString(this.formatter,e,t,n,s)}get sort(){return this.table.sort}set sort(e){this.closeSubscription(),this.table.applySort(e),this.applyViewport()}set totalsConfig(e){if(Ve.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 Me(me.EVENT.UPDATED));return}this.totalsTablePromise=Ue.makeCancelable(this.table.getTotalsTable(e),t=>t.close()),this.totalsTablePromise.then(t=>{this.totalsTablePromise=null,this.setTotalsTable(t)}).catch(t=>{Ue.isCanceled(t)||(Ve.error("Unable to set next totalsTable",t),this.totalsTablePromise=null,this.dispatchEvent(new Me(me.EVENT.REQUEST_FAILED,{detail:t})))})}}setTotalsTable(e){Ve.debug("setTotalsTable",e),this.totalsTable!==null&&(this.listenerCount>0&&this.removeTotalsListeners(this.totalsTable),this.totalsTable.close()),this.totalsTable=e,this.totalsDataMap=null,this.listenerCount>0&&this.totalsTable!=null&&this.addTotalsListeners(this.totalsTable)}applyBufferedViewport(e,t,n){Ve.debug2("applyBufferedViewport",e,t,n),this.subscription==null?(Ve.debug2("applyBufferedViewport creating new subscription"),this.subscription=this.table.setViewport(e,t,n)):(Ve.debug2("applyBufferedViewport using existing subscription"),this.subscription.setViewport(e,t,n))}async snapshot(e,t=!1,n=o=>o,s=!0){if(this.subscription==null)throw new Error("No subscription available");const o=s?ee.consolidate(e):e;if(!ne.isValidSnapshotRanges(o))throw new Error(`Invalid snapshot ranges ${e}`);const i=new Set,r=[],l=new Set;for(let m=0;m<o.length;m+=1){const p=o[m];O(p.endRow),O(p.startRow);for(let g=p.startRow;g<=p.endRow&&g<this.floatingTopRowCount;g+=1)i.add(g);p.endRow>=this.floatingTopRowCount&&p.startRow<=this.floatingTopRowCount+this.table.size&&r.push(new ee(p.startColumn,Math.min(Math.max(0,p.startRow-this.floatingTopRowCount)),p.endColumn,Math.min(Math.max(0,p.endRow-this.floatingTopRowCount),this.table.size-this.floatingTopRowCount)));for(let g=Math.max(p.startRow,this.floatingTopRowCount+this.table.size);g<=p.endRow&&g<this.floatingTopRowCount+this.table.size+this.floatingBottomRowCount;g+=1)l.add(g)}const a=ne.columnsFromRanges(o,this.columns),c=[];t&&c.push(a.map(m=>m.name));const d=[...i].sort();for(let m=0;m<d.length;m+=1){const p=d[m],g=a.map(f=>{const w=this.getColumnIndexByName(f.name);return O(w),n(this.valueForCell(w,p),f)});t&&g.push(this.textForRowFooter(p)),c.push(g)}if(r.length>0){const m=ne.rangeSetFromRanges(r),p=await this.subscription.snapshot(m,a);c.push(...p.rows.map(g=>a.map(f=>n(g.get(f),f))))}const u=[...l].sort();for(let m=0;m<u.length;m+=1){const p=u[m],g=a.map(f=>{const w=this.getColumnIndexByName(f.name);return O(w),n(this.valueForCell(w,p),f)});t&&g.push(this.textForRowFooter(p)),c.push(g)}return c}async textSnapshot(e,t=!1,n=s=>`${s}`){return Ve.debug2("textSnapshot",e,t),(await this.snapshot(e,t,n,!1)).map(o=>o.join(" ")).join(`
|
|
32
|
-
`)}async valuesTable(e){let t=null;try{return t=await this.table.copy(),t.applyFilter([]),t.applySort([]),t.selectDistinct([e])}finally{t!=null&&t.close()}}isColumnMovable(e,t){if(e<0||e>=this.columnCount)return!1;if(t>0)return!0;const n=this.columns[e].name;return this.frontColumns.includes(n)||this.backColumns.includes(n)||this.frozenColumns.includes(n)||!n?!1:!this.isKeyColumn(e)}isKeyColumn(e){var t,n;return e<((n=(t=this.inputTable)==null?void 0:t.keyColumns.length)!=null?n:0)}isRowMovable(){return!1}isEditableRange(e){return!(this.inputTable==null||!ee.isBounded(e)||!(this.isPendingRow(e.startRow)&&this.isPendingRow(e.endRow)||this.inputTable.keyColumns.length!==0&&e.startColumn>=this.inputTable.keyColumns.length&&e.endColumn>=this.inputTable.keyColumns.length)||e.startRow<this.floatingTopRowCount||e.startRow>=this.floatingTopRowCount+this.table.size+this.pendingRowCount||e.endRow>=this.floatingTopRowCount+this.table.size+this.pendingRowCount)}isDeletableRange(e){return this.inputTable!=null&&e.startRow!=null&&e.endRow!=null&&e.startRow>=this.floatingTopRowCount&&e.startRow<this.floatingTopRowCount+this.table.size+this.pendingRowCount&&e.endRow<this.floatingTopRowCount+this.table.size+this.pendingRowCount}isEditableRanges(e){return e.every(t=>this.isEditableRange(t))}isDeletableRanges(e){return e.every(t=>this.isDeletableRange(t))}getTableAreaRange(){return new ee(null,this.floatingTopRowCount,null,this.floatingTopRowCount+this.table.size-1)}getPendingAreaRange(){return new ee(null,this.floatingTopRowCount+this.table.size,null,this.floatingTopRowCount+this.table.size+this.pendingNewRowCount-1)}async setValueForCell(e,t,n){return this.setValueForRanges([new ee(e,t,e,t)],n)}async setValueForRanges(e,t){var n;if(!this.isEditableRanges(e))throw new Error(`Uneditable ranges ${e}`);try{const s=new Set,o=[];ee.forEachCell(e,(c,d)=>{const u=this.columns[c];if(s.add(u),o[c]===void 0){const m=x.makeValue(u.type,t,this.formatter.timeZone);o[c]=m!=null?this.displayString(m,u.type,u.name):null}this.cachePendingValue(c,d,o[c])});const i=this.getPendingAreaRange(),r=e.map(c=>ee.intersection(i,c)).filter(c=>c!=null).map(c=>(O(c),ee.offset(c,0,-(this.floatingTopRowCount+this.table.size))));if(r.length>0){const c=new Map(this.pendingNewDataMap);ee.forEachCell(r,(d,u)=>{c.has(u)||c.set(u,{data:new Map});const m=this.columns[d],p=c.get(u);O(p);const{data:g}=p,f=new Map(g),w=x.makeValue(m.type,t,this.formatter.timeZone);w!=null?f.set(d,{value:w}):f.delete(d),f.size>0?c.set(u,{...p,data:f}):c.delete(u)}),this.pendingDataMap=c}this.dispatchEvent(new Me(me.EVENT.UPDATED));const l=this.getTableAreaRange(),a=e.map(c=>ee.intersection(l,c)).filter(c=>c!=null);if(a.length>0){const d=(await this.snapshot(a.map(m=>{var p,g;return new ee(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]=x.makeValue(g.type,t,this.formatter.timeZone)}),p}),u=await((n=this.inputTable)==null?void 0:n.addRows(d));Ve.debug("setValueForRanges(",e,",",t,") set tableRanges",a,"result",u)}ee.forEachCell(e,(c,d)=>{const u=o[c];O(u),this.cacheFormattedValue(c,d,u)})}catch(s){Ve.error("Unable to set ranges",e,t,s)}finally{ee.forEachCell(e,(s,o)=>{this.clearPendingValue(s,o)})}}async setValues(e=[]){var t;if(Ve.debug("setValues(",e,")"),!e.every(n=>{var s,o;return this.isEditableRange(ee.makeCell((s=n.column)!=null?s:n.x,(o=n.row)!=null?o:n.y))}))throw new Error(`Uneditable ranges ${e}`);try{const n=new Map(this.pendingNewDataMap);e.forEach(l=>{var f,w;const{text:a}=l,c=(f=l.column)!=null?f:l.x,d=(w=l.row)!=null?w:l.y,u=this.columns[c],m=x.makeValue(u.type,a,this.formatter.timeZone),p=m!=null?this.displayString(m,u.type,u.name):null;this.cachePendingValue(c,d,p);const g=this.pendingRow(d);if(g!=null){n.has(g)||n.set(g,{data:new Map});const C=n.get(g);O(C);const{data:S}=C,b=new Map(S);m!=null?b.set(c,{value:m}):b.delete(c),b.size>0?n.set(g,{...C,data:b}):n.delete(g)}}),this.pendingDataMap=n,this.dispatchEvent(new Me(me.EVENT.UPDATED));const s=e.reduce((l,a)=>{var d,u;const c=(d=a.row)!=null?d:a.y;return l.has(c)||l.set(c,[]),(u=l.get(c))==null||u.push(a),l},new Map),o=ee.consolidate(e.map(l=>{var a,c;return ee.makeCell((a=l.column)!=null?a:l.x,(c=l.row)!=null?c:l.y)})),i=this.getTableAreaRange(),r=o.map(l=>ee.intersection(i,l)).filter(l=>l!=null);if(r.length>0){const a=(await this.snapshot(r.map(d=>(O(d),new ee(null,d.startRow,null,d.endRow))))).map((d,u)=>{let m=null,p=u;for(let w=0;w<r.length;w+=1){const C=r[w];O(C);const S=ee.rowCount([C]);if(p<S){O(C.startRow),m=C.startRow+p;break}p-=S}const g={};for(let w=0;w<this.columns.length;w+=1)g[this.columns[w].name]=d[w];O(m);const f=s.get(m);return f!=null&&f.forEach(w=>{var S;const C=this.columns[(S=w.column)!=null?S:w.x];g[C.name]=x.makeValue(C.type,w.text,this.formatter.timeZone)}),g});Ve.info("setValues setting tableRanges",r);const c=await((t=this.inputTable)==null?void 0:t.addRows(a));Ve.info("setValues set tableRanges",r,"SUCCESS",c)}e.forEach(l=>{var g,f;const{text:a}=l,c=(g=l.column)!=null?g:l.x,d=(f=l.row)!=null?f:l.y,u=this.columns[c],m=x.makeValue(u.type,a,this.formatter.timeZone),p=m!=null?this.displayString(m,u.type,u.name):null;this.cacheFormattedValue(c,d,p)})}finally{e.forEach(n=>{this.clearPendingValue(n.column,n.row)})}}async commitPending(){var e,t,n;if(this.pendingNewDataMap.size<=0)throw new Error("No pending changes to commit");try{this.isSaveInProgress=!0;const s=[];this.pendingNewDataMap.forEach(i=>{const r={};i.data.forEach(({value:l},a)=>{const c=this.columns[a];r[c.name]=l}),s.push(r)});const o=await((e=this.inputTable)==null?void 0:e.addRows(s));Ve.debug("commitPending()",this.pendingNewDataMap,"result",o),this.pendingNewDataMap=new Map,this.pendingNewRowCount=Math.max(0,((n=(t=this.viewport)==null?void 0:t.bottom)!=null?n:0)-this.table.size),this.formattedStringData=[],this.dispatchEvent(new Me(me.EVENT.PENDING_DATA_UPDATED))}finally{this.isSaveInProgress=!1}}editValueForCell(e,t){return this.textValueForCell(e,t)}async delete(e){if(!this.isDeletableRanges(e))throw new Error(`Undeletable ranges ${e}`);O(this.inputTable);const{keyColumns:t}=this.inputTable;if(t.length===0)throw new Error("No key columns to allow deletion");const n=this.getPendingAreaRange(),s=e.map(d=>ee.intersection(n,d)).filter(d=>d!=null).map(d=>(O(d),ee.offset(d,0,-(this.floatingTopRowCount+this.table.size))));if(s.length>0){const d=new Map(this.pendingNewDataMap);for(let u=0;u<s.length;u+=1){const m=s[u];O(m.startRow),O(m.endRow);for(let p=m.startRow;p<=m.endRow;p+=1)d.delete(p)}this.pendingNewDataMap=d,this.formattedStringData=[],this.dispatchEvent(new Me(me.EVENT.PENDING_DATA_UPDATED)),this.dispatchEvent(new Me(me.EVENT.UPDATED))}const o=this.getTableAreaRange(),i=e.map(d=>ee.intersection(o,d)).filter(d=>d!=null);if(i.length<=0)return;const[r,l]=await Promise.all([this.snapshot(i.map(d=>(O(d),new ee(0,d.startRow,t.length-1,d.endRow)))),this.table.copy()]),c=r.map(d=>{const u=[];for(let m=0;m<t.length;m+=1){const p=t[m],g=d[m],f=x.makeFilterRawValue(p.type,g),w=p.filter().eq(f);u.push(w)}return u.reduce((m,p)=>{var g;return(g=m==null?void 0:m.and(p))!=null?g:p})}).reduce((d,u)=>{var m;return(m=d==null?void 0:d.or(u))!=null?m:u});l.applyFilter([c]),l.close()}isValidForCell(e,t,n){try{const s=this.columns[e];return x.makeValue(s.type,n,this.formatter.timeZone),!0}catch{return!1}}};let Wr=lr;Wr.ROW_BUFFER_PAGES=1;const Vn=se.module("IrisGridTableModel");class oC extends Wr{constructor(t,n=new nn,s=null){super(t,n,s),this.getMemoizedFrontColumns=Ie(o=>o!=null?o:[]),this.getMemoizedBackColumns=Ie(o=>o!=null?o:[]),this.getMemoizedFrozenColumns=Ie((o,i)=>{var r;return(r=i!=null?i:o)!=null?r:[]}),this.getCachedFilterableColumnSet=Ie(o=>new Set(o.map((i,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 t;return this.getMemoizedFrontColumns((t=this.layoutHints)==null?void 0:t.frontColumns)}get backColumns(){var t;return this.getMemoizedBackColumns((t=this.layoutHints)==null?void 0:t.backColumns)}get frozenColumns(){var t;return this.getMemoizedFrozenColumns((t=this.layoutHints)==null?void 0:t.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(t){if(Vn.debug2("set customColumns",t,this.customColumnList,t===this.customColumnList),this.customColumnList.length===0&&t.length===0){Vn.debug("Ignore empty initial customColumns"),this.customColumnList=t;return}if(this.customColumnList===t){Vn.debug("Ignore same customColumns");return}this.closeSubscription(),this.customColumnList=t,this.table.applyCustomColumns([...t,...this.formatColumns]),this.applyViewport()}get formatColumns(){return this.formatColumnList}set formatColumns(t){if(Vn.debug2("set formatColumns",t,this.formatColumnList,t===this.formatColumnList),this.formatColumnList.length===0&&t.length===0){Vn.debug("Ignore empty initial formatColumns"),this.formatColumnList=t;return}if(this.formatColumnList===t){Vn.debug("Ignore same formatColumns");return}this.closeSubscription(),this.formatColumnList=t,this.table.applyCustomColumns([...this.customColumns,...t]),this.applyViewport()}updateFrozenColumns(t){this.userFrozenColumns=t,this.dispatchEvent(new Me(me.EVENT.TABLE_CHANGED,{detail:this.table}))}set totalsConfig(t){if(Vn.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 Me(me.EVENT.UPDATED));return}this.totalsTablePromise=Ue.makeCancelable(this.table.getTotalsTable(t),n=>n.close()),this.totalsTablePromise.then(n=>{this.totalsTablePromise=null,this.setTotalsTable(n)}).catch(n=>{Ue.isCanceled(n)||(Vn.error("Unable to set next totalsTable",n),this.totalsTablePromise=null,this.dispatchEvent(new Me(me.EVENT.REQUEST_FAILED,{detail:n})))})}}get isFilterRequired(){return this.table.isUncoalesced}isFilterable(t){return this.getCachedFilterableColumnSet(this.columns).has(t)}async export(){return this.table.freeze()}columnStatistics(t){return this.table.getColumnStatistics(t)}isColumnMovable(t){const n=this.columns[t].name;return this.frontColumns.includes(n)||this.backColumns.includes(n)||this.frozenColumns.includes(n)?!1:!this.isKeyColumn(t)}isColumnFrozen(t){return this.frozenColumns.includes(this.columns[t].name)}async delete(t){var u;if(!this.isDeletableRanges(t))throw new Error(`Undeletable ranges ${t}`);O(this.inputTable);const{keyColumns:n}=this.inputTable;if(n.length===0)throw new Error("No key columns to allow deletion");const s=this.getPendingAreaRange(),o=t.map(m=>ee.intersection(s,m)).filter(m=>m!=null).map(m=>(O(m),ee.offset(m,0,-(this.floatingTopRowCount+this.table.size))));if(o.length>0){const m=new Map(super.pendingDataMap);for(let p=0;p<o.length;p+=1){const g=o[p];O(g.startRow),O(g.endRow);for(let f=g.startRow;f<=g.endRow;f+=1)m.delete(f)}super.pendingDataMap=m,this.formattedStringData=[],this.dispatchEvent(new Me(me.EVENT.PENDING_DATA_UPDATED)),this.dispatchEvent(new Me(me.EVENT.UPDATED))}const i=this.getTableAreaRange(),r=t.map(m=>ee.intersection(i,m)).filter(m=>m!=null);if(r.length<=0)return;const[l,a]=await Promise.all([this.snapshot(r.map(m=>(O(m),new ee(0,m.startRow,n.length-1,m.endRow)))),this.table.copy()]),d=l.map(m=>{const p=[];for(let g=0;g<n.length;g+=1){const f=n[g],w=m[g],C=x.makeFilterRawValue(f.type,w),S=f.filter().eq(C);p.push(S)}return p.reduce((g,f)=>{var w;return(w=g==null?void 0:g.and(f))!=null?w:f})}).reduce((m,p)=>{var g;return(g=m==null?void 0:m.or(p))!=null?g:p});a.applyFilter([d]),await((u=this.inputTable)==null?void 0:u.deleteTable(a)),a.close()}async seekRow(t,n,s,o,i,r,l){return this.table.seekRow(t,n,s,o,i,r,l)}get isSeekRowAvailable(){return this.table.seekRow!=null}}class iC extends Wr{constructor(){super(...arguments),this.getCachedFilterableColumnSet=Ie((t,n)=>new Set(((n==null?void 0:n.length)>0?n:t).map(s=>t.findIndex(o=>s.name===o.name))))}applyBufferedViewport(t,n,s){this.table.setViewport(t,n,s)}textForCell(t,n){const s=this.columns[t],o=this.row(n);if(o!=null&&s!=null&&!o.hasChildren&&s.constituentType!=null){const i=this.valueForCell(t,n);return this.displayString(i,s.constituentType,s.name)}return super.textForCell(t,n)}extractViewportRow(t,n){const{isExpanded:s,hasChildren:o,depth:i}=t;return{...super.extractViewportRow(t,n),isExpanded:s,hasChildren:o,depth:i}}async snapshot(t,n,s){var l,a;O(this.viewport),O(this.viewportData);const{columns:o}=this.viewport,i=[];n!=null&&n&&i.push(o.map(c=>c.name));const r=new ee(0,(l=this.viewportData)==null?void 0:l.offset,o.length,this.viewportData.offset+this.viewportData.rows.length);for(let c=0;c<t.length;c+=1){const d=ee.intersection(r,t[c]);O(d),O(d.startRow),O(d.endRow);for(let u=d.startRow;u<=d.endRow;u+=1){const m=[],p=this.viewportData.rows[u-this.viewportData.offset];O(d.startColumn),O(d.endColumn);for(let g=d.startColumn;g<=d.endColumn;g+=1)O(s),m.push(s((a=p.data.get(g))==null?void 0:a.value,this.columns[g]));i.push(m)}}return i}get groupedColumns(){return this.table.groupedColumns}get hasExpandableRows(){return!0}get isExpandAllAvailable(){return this.table.expandAll!==void 0}get isChartBuilderAvailable(){return!1}get isSelectDistinctAvailable(){return!1}get isReversible(){return!1}isFilterable(t){return this.getCachedFilterableColumnSet(this.columns,this.groupedColumns).has(t)}isColumnMovable(t){return t>=this.groupedColumns.length}isRowExpandable(t){var s;const n=this.row(t);return(s=n==null?void 0:n.hasChildren)!=null?s:!1}isRowExpanded(t){var s;const n=this.row(t);return(s=n==null?void 0:n.isExpanded)!=null?s:!1}setRowExpanded(t,n,s=!1){this.isExpandAllAvailable?this.table.setExpanded(t,n,s):this.table.setExpanded(t,n)}expandAll(){this.table.expandAll&&this.table.expandAll()}collapseAll(){this.table.collapseAll&&this.table.collapseAll()}depthForRow(t){var s;const n=this.row(t);return((s=n==null?void 0:n.depth)!=null?s:1)-1}}const Un=se.module("IrisGridProxyModel");function Zi(e,t,n){return x.isTreeTable(e)?new iC(e,t):new oC(e,t,n)}class rC extends me{constructor(t,n=new nn,s=null){super(),this.textForCell=(...i)=>this.model.textForCell(...i),this.truncationCharForCell=(...i)=>this.model.truncationCharForCell(...i),this.textAlignForCell=(...i)=>this.model.textAlignForCell(...i),this.colorForCell=(...i)=>this.model.colorForCell(...i),this.backgroundColorForCell=(...i)=>this.model.backgroundColorForCell(...i),this.textForColumnHeader=(...i)=>this.model.textForColumnHeader(...i),this.colorForColumnHeader=(...i)=>this.model.colorForColumnHeader(...i),this.textForRowHeader=(...i)=>this.model.textForRowHeader(...i),this.textForRowFooter=(...i)=>this.model.textForRowFooter(...i),this.isRowMovable=(...i)=>this.model.isRowMovable(...i),this.isColumnMovable=(...i)=>this.model.isColumnMovable(...i),this.isRowExpandable=(...i)=>ke(this.model)?this.model.isRowExpandable(...i):!1,this.isRowExpanded=(...i)=>ke(this.model)?this.model.isRowExpanded(...i):!1,this.setRowExpanded=(...i)=>{if(ke(this.model))return this.model.setRowExpanded(...i);throw Error("Function setRowExpanded does not exist on IrisGridTableModel")},this.expandAll=()=>{if(ke(this.model))return this.model.expandAll();throw Error("Function expandAll does not exist on IrisGridTableModel")},this.collapseAll=()=>{if(ke(this.model))return this.model.collapseAll();throw Error("Function collapseAll does not exist on IrisGridTableModel")},this.depthForRow=(...i)=>ke(this.model)?this.model.depthForRow(...i):0,this.getColumnHeaderGroup=(...i)=>this.model.getColumnHeaderGroup(...i),this.getColumnHeaderParentGroup=(...i)=>this.model.getColumnHeaderParentGroup(...i),this.formatForCell=(...i)=>this.model.formatForCell(...i),this.valueForCell=(...i)=>this.model.valueForCell(...i),this.displayString=(...i)=>this.model.displayString(...i),this.isEditableRange=(...i)=>He(this.model)?this.model.isEditableRange(...i):!1,this.isFilterable=(...i)=>this.model.isFilterable(...i),this.setViewport=(i,r,l)=>this.model.setViewport(i,r,l),this.snapshot=(...i)=>this.model.snapshot(...i),this.textSnapshot=(...i)=>this.model.textSnapshot(...i),this.valuesTable=(...i)=>this.model.valuesTable(...i),this.editValueForCell=(...i)=>(He(this.model)&&this.model.editValueForCell(...i),""),this.setValueForCell=(...i)=>He(this.model)?this.model.setValueForCell(...i):Promise.reject(new Error("Model is not editable")),this.setValueForRanges=(...i)=>He(this.model)?this.model.setValueForRanges(...i):Promise.reject(new Error("Model is not editable")),this.setValues=(...i)=>He(this.model)?this.model.setValues(...i):Promise.resolve(),this.isValidForCell=(...i)=>He(this.model)?this.model.isValidForCell(...i):!1,this.delete=(...i)=>this.model.delete(...i),this.commitPending=(...i)=>this.model.commitPending(...i),this.handleModelEvent=this.handleModelEvent.bind(this);const o=Zi(t,n,s);this.originalModel=o,this.model=o,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(t){Un.debug2("handleModelEvent",t);const{detail:n,type:s}=t;this.dispatchEvent(new Me(s,{detail:n}))}setModel(t){Un.debug("setModel",t);const n=this.model;n!==this.originalModel&&n.close(),this.model=t,this.listenerCount>0&&this.addListeners(t),this.dispatchEvent(new Me(me.EVENT.COLUMNS_CHANGED,{detail:t.columns})),Jo(t)&&this.dispatchEvent(new Me(me.EVENT.TABLE_CHANGED,{detail:t.table}))}setNextModel(t){Un.debug2("setNextModel"),this.modelPromise&&this.modelPromise.cancel(),this.listenerCount>0&&this.removeListeners(this.model),this.modelPromise=Ue.makeCancelable(t,n=>n.close()),this.modelPromise.then(n=>{this.modelPromise=null,this.setModel(n)}).catch(n=>{if(Ue.isCanceled(n)){Un.debug2("setNextModel cancelled");return}Un.error("Unable to set next model",n),this.modelPromise=null,this.dispatchEvent(new Me(me.EVENT.REQUEST_FAILED,{detail:n}))})}startListening(){super.startListening(),this.addListeners(this.model)}stopListening(){super.stopListening(),this.removeListeners(this.model)}addListeners(t){const n=Object.keys(me.EVENT);for(let s=0;s<n.length;s+=1)t.addEventListener(n[s],this.handleModelEvent)}removeListeners(t){const n=Object.keys(me.EVENT);for(let s=0;s<n.length;s+=1)t.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(t){return this.model.isColumnFrozen(t)}get hasExpandableRows(){return ke(this.model)?this.model.hasExpandableRows:!1}get isExpandAllAvailable(){var t;return ke(this.model)&&(t=this.model.isExpandAllAvailable)!=null?t:!1}get isExportAvailable(){return this.model.isExportAvailable}get isColumnStatisticsAvailable(){return this.model.isColumnStatisticsAvailable}get isValuesTableAvailable(){return this.model.isValuesTableAvailable}get isCustomColumnsAvailable(){return this.model.isCustomColumnsAvailable&&!(this.isSelectDistinctAvailable&&this.selectDistinctColumns.length>0)}get isFormatColumnsAvailable(){return this.model.isFormatColumnsAvailable}get isChartBuilderAvailable(){return this.model.isChartBuilderAvailable}get isRollupAvailable(){return(this.originalModel.isRollupAvailable||this.rollup!=null)&&this.selectDistinct.length===0}get isSelectDistinctAvailable(){return(this.originalModel.isSelectDistinctAvailable||this.selectDistinct.length>0)&&this.rollup==null}get isTotalsAvailable(){return this.model.isTotalsAvailable}get isReversible(){return this.model.isReversible}get columns(){return this.model.columns}get initialMovedColumns(){return this.model.initialMovedColumns}get initialMovedRows(){return this.model.initialMovedRows}get layoutHints(){return this.model.layoutHints}get frontColumns(){return this.model.frontColumns}get backColumns(){return this.model.backColumns}get frozenColumns(){return this.model.frozenColumns}get columnHeaderGroups(){return this.model.columnHeaderGroups}set columnHeaderGroups(t){this.model.columnHeaderGroups=t}get initialColumnHeaderGroups(){return this.model.initialColumnHeaderGroups}get columnHeaderGroupMap(){return this.model.columnHeaderGroupMap}get columnHeaderMaxDepth(){return this.model.columnHeaderMaxDepth}updateFrozenColumns(t){return this.model.updateFrozenColumns(t)}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(t){this.model.filter=t}get formatter(){return this.model.formatter}set formatter(t){this.model.formatter=t}get sort(){return this.model.sort}set sort(t){this.model.sort=t}get customColumns(){return this.model.customColumns}set customColumns(t){this.model.customColumns=t}get formatColumns(){return this.model.formatColumns}set formatColumns(t){this.model.formatColumns=t}get rollupConfig(){return this.rollup}set rollupConfig(t){if(Un.debug("set rollupConfig",t),!this.isRollupAvailable)throw new Error("Rollup Rows are not available");if(ct(t,this.rollup))return;this.rollup=t;let n=Promise.resolve(this.originalModel);Jo(this.originalModel)&&t!=null&&(n=this.originalModel.table.rollup(t).then(s=>Zi(s,this.formatter))),this.setNextModel(n)}get selectDistinctColumns(){return this.selectDistinct}set selectDistinctColumns(t){if(Un.debug("set selectDistinctColumns",t),!this.isSelectDistinctAvailable)throw new Error("Select distinct is not available");if(t===this.selectDistinctColumns||t.length===0&&this.selectDistinctColumns.length===0){Un.debug("Ignore same selectDistinctColumns",t);return}this.selectDistinct=t;const n=t.map(o=>this.originalColumns.find(i=>i.name===o)).filter(o=>o!=null);let s=Promise.resolve(this.originalModel);Jo(this.originalModel)&&n.length>0&&(s=this.originalModel.table.selectDistinct(n).then(o=>Zi(o,this.formatter))),this.setNextModel(s)}get table(){if(Jo(this.model))return this.model.table}get totalsConfig(){return this.model.totalsConfig}set totalsConfig(t){this.model.totalsConfig=t}get isFilterRequired(){return this.model.isFilterRequired}get isEditable(){return He(this.model)&&this.model.isEditable}export(){if(x.isTreeTable(this.model))throw new Error("TreeTable has no 'export' property");return this.model.export()}columnStatistics(t){if(x.isTreeTable(this.model))throw new Error("TreeTable has no 'columnStatistics' function");return this.model.columnStatistics(t)}get pendingDataMap(){return this.model.pendingDataMap}set pendingDataMap(t){this.model.pendingDataMap=t}get pendingRowCount(){return this.model.pendingRowCount}set pendingRowCount(t){this.model.pendingRowCount=t}get pendingDataErrors(){return this.model.pendingDataErrors}getColumnIndexByName(t){return this.model.getColumnIndexByName(t)}async seekRow(t,n,s,o,i,r,l){return this.model.seekRow(t,n,s,o,i,r,l)}get isSeekRowAvailable(){return this.model.isSeekRowAvailable}}class lC{static async makeModel(t,n=new nn){let s=null;return!x.isTreeTable(t)&&t.hasInputTable&&(s=await t.inputTable()),new rC(t,n,s)}}const pn=se.module("TableViewportUpdater"),aC=150,ho=class extends T.exports.PureComponent{constructor(){super(...arguments),this.getViewportRowRange=Ie((e,t,n)=>{const s=n-t,o=Math.max(0,t-s*ho.ROW_BUFFER_PAGES),i=n+s*ho.ROW_BUFFER_PAGES;return[o,i]}),this.getViewportColumns=Ie((e,t,n,s)=>{if(t==null||n==null)return null;const o=n-t,i=Math.max(0,t-o*ho.COLUMN_BUFFER_PAGES),r=Math.min(n+o*ho.COLUMN_BUFFER_PAGES,e.columns.length-1),l=[];for(let a=i;a<=r;a+=1){const c=W.getModelIndex(a,s);l.push(e.columns[c])}return l}),this.updateViewport=Zn((e,t,n,s,o)=>{if(t<e){pn.error("Invalid viewport",e,t);return}if(e===0&&t===0){pn.debug2("Ignoring 0-0 viewport");return}const{movedColumns:i,table:r}=this.props,[l,a]=this.getViewportRowRange(r,e,t),c=o!=null?o:this.getViewportColumns(r,n,s,i);if(pn.debug2("Setting Viewport Top:",l,"Bottom:",a,"Columns:",c),this.subscription==null){pn.debug2("updateViewport creating new subscription"),this.subscription=r.setViewport(l,a,c);const{onSubscription:d}=this.props;d(this.subscription)}else pn.debug2("updateViewport using existing subscription"),this.subscription.setViewport(l,a,c)},aC)}componentDidMount(){const{top:e,bottom:t,left:n,right:s,table:o,filters:i,sorts:r,columns:l,customColumns:a}=this.props;o.applyFilter(i),o.applySort(r),o.applyCustomColumns(a),this.updateViewport(e,t,n,s,l)}componentDidUpdate(e){const{top:t,bottom:n,left:s,right:o,table:i,filters:r,sorts:l,customColumns:a,columns:c}=this.props,d=r!==e.filters,u=l!==e.sorts,m=a!==e.customColumns,p=i!==e.table;(d||u||m||p)&&this.closeSubscription(),(d||p)&&(pn.debug("update table filter",r),i.applyFilter(r)),(u||p)&&(pn.debug("update table sort",l),i.applySort(l)),(m||p)&&(pn.debug("update table custom columns",a),i.applyCustomColumns(a)),this.updateViewport(t,n,s,o,c)}componentWillUnmount(){this.closeSubscription()}closeSubscription(){if(pn.debug2("closeSubscription",this.subscription),this.subscription){this.subscription.close(),this.subscription=void 0;const{onSubscription:e}=this.props;e()}this.updateViewport.cancel()}render(){return null}};let $r=ho;$r.ROW_BUFFER_PAGES=3;$r.COLUMN_BUFFER_PAGES=1;$r.defaultProps={top:0,bottom:0,left:null,right:null,columns:null,onSubscription:()=>{},filters:[],sorts:[],customColumns:[],movedColumns:[]};const xs=se.module("TreeTableViewportUpdater"),cC=150,Fc=class extends T.exports.PureComponent{constructor(e){super(e),this.updateViewport=Zn((t,n)=>{if(n<t){xs.error("Invalid viewport",t,n);return}if(t===0&&n===0){xs.debug2("Ignoring 0-0 viewport");return}const{table:s,updateInterval:o}=this.props,i=n-t,r=Math.max(0,t-i*3),l=n+i*3+1;if(xs.debug2("Setting Viewport Top:",r,"Bottom:",l,s),!this.listenerCleanup){const{onViewportUpdate:a}=this.props;this.listenerCleanup=s.addEventListener(I.TreeTable.EVENT_UPDATED,a)}s.setViewport(r,l,void 0,o)},cC),this.listenerCleanup=null}componentDidMount(){const{top:e,bottom:t,table:n,filters:s,sorts:o}=this.props;xs.debug("componentDidMount",this.props),n.applyFilter(s),n.applySort(o),this.updateViewport(e,t)}componentDidUpdate(e){const{top:t,bottom:n,table:s,filters:o,sorts:i}=this.props;o!==e.filters&&(xs.debug("update table filter",o),s.applyFilter(o)),i!==e.sorts&&(xs.debug("update table sort",i),s.applySort(i)),this.updateViewport(t,n)}componentWillUnmount(){this.updateViewport.cancel(),this.listenerCleanup&&this.listenerCleanup()}render(){return null}};let xc=Fc;xc.UPDATE_INTERVAL=1e3;xc.defaultProps={top:0,bottom:0,onViewportUpdate:()=>{},filters:[],sorts:[],updateInterval:Fc.UPDATE_INTERVAL};se.setLogLevel(parseInt("2",10));const Ps=se.module("EmbedGrid.App"),dC=[I.VariableType.TABLE,I.VariableType.TREETABLE,I.VariableType.HIERARCHICALTABLE,I.VariableType.PANDAS];async function uC(e,t){Ps.info(`Fetching table ${t}...`);const n=await Xh(e,t);if(!dC.includes(n.type))throw new Error(`Unsupported type '${n.type}' for variable named '${t}'`);return await e.getObject(n)}function hC(){const[e,t]=T.exports.useState(),[n,s]=T.exports.useState(),[o,i]=T.exports.useState(),[r,l]=T.exports.useState(),[a,c]=T.exports.useState(!0),d=T.exports.useMemo(()=>new URLSearchParams(window.location.search),[]),u=d.get("canCopy")!=null,m=d.get("canDownloadCsv")!=null;T.exports.useEffect(function(){async function f(){try{const w=d.get("name");if(w==null)throw new Error("No name param provided");const C=new URL("/jsapi",`${window.location}`),S=`${C.protocol}//${C.host}`;Ps.debug("Starting connection...");const b=new I.IdeConnection(S);Ps.debug("Loading table",w,"...");const E=await uC(b,w);Ps.debug("Creating model...");const v=await lC.makeModel(E);t(v),Ps.debug("Table successfully loaded!")}catch(w){Ps.error("Unable to load table",w),s(`${w}`)}c(!1)}f()},[d]),T.exports.useEffect(function(){function f(w){const{command:C,value:S}=w.data;switch(C){case"filter":{const E=S.map(({name:v,value:y})=>{const M=e==null?void 0:e.columns.find(A=>A.name===v);if(M==null)throw new Error(`Could not find column named ${v}`);return{name:v,value:y,type:x.getNormalizedType(M.type)}});i(E);break}case"sort":{const E=S.map(({name:v,direction:y})=>{const M=e==null?void 0:e.columns.find(A=>A.name===v);if(M==null)throw new Error(`Could not find column named ${v}`);return y==="DESC"?M.sort().desc():M.sort().asc()});l(E);break}}}return window.addEventListener("message",f),()=>{window.removeEventListener("message",f)}},[e]);const p=e!=null;return R("div",{className:"App",children:[p&&h(vo,{canCopy:u,canDownloadCsv:m,model:e,inputFilters:o,sorts:r}),!p&&h(Da,{isLoaded:p,isLoading:a,errorMessage:n!=null?n:null}),h(Wu,{})]})}ar.render(h(hC,{}),document.getElementById("root"));
|
|
33
|
-
//# sourceMappingURL=index.
|
|
31
|
+
`)}this.bufferedMessages=[],this.appendLogText(e)}queue(e){this.bufferedMessages.push(e),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(e){this.messages.push(e),this.editor&&this.isLogItemVisible(e)&&this.queue(e)}handleMenuItemClick(e){this.toggleLogLevel(e)}handleResetClick(){this.resetLogLevels()}handleResize(){this.updateDimensions()}handleToggleAllClick(){this.toggleAll()}render(){const e={placement:"bottom-end"},{shownLogLevels:t}=this.state,n=this.getMenuActions(t);return R("div",{className:"log-pane h-100 w-100",children:[R("div",{className:"log-pane-menu",children:[h(X,{kind:"ghost",className:"btn-clear-logs",onClick:this.handleClearClick,icon:Ou,tooltip:"Clear log"}),h(X,{kind:"ghost",className:"btn-link-icon btn-overflow",icon:Jd,tooltip:"Log Settings",onClick:()=>{},children:h(Qn,{actions:n,popperClassName:"log-level-menu-popper",popperOptions:e})})]}),h("div",{className:"log-pane-editor h-100 w-100",ref:s=>{this.editorContainer=s}})]})}};let bo=lt;bo.DefaultLogLevels=[et.STDOUT,et.ERROR,et.FATAL,et.STDERR,et.WARN];bo.AllLogLevels=[et.INFO,et.STDOUT,et.ERROR,et.FATAL,et.STDERR,et.WARN,et.DEBUG,et.TRACE];bo.bufferTimeout=16;bo.maxLogSize=131072;bo.truncateSize=65536;si.register([Jc,ed,td,nd,sd,od]);const xf=typeof Hi=="function"?Hi(si):Hi.default(si),Cn=class{constructor(){this.listeners=[],this.isDownsamplingDisabled=!1}getData(){return[]}getDefaultTitle(){return""}getLayout(){return{}}getFilterColumnMap(){return new Map}isFilterRequired(){return!1}setFilter(e){}close(){}setFormatter(e){this.formatter=e}setDownsamplingDisabled(e){this.isDownsamplingDisabled=e}setDimensions(e){this.rect=e}setTitle(e){this.title=e}subscribe(e){this.listeners.push(e)}unsubscribe(e){this.listeners=this.listeners.filter(t=>t!==e)}fireEvent(e){for(let t=0;t<this.listeners.length;t+=1)this.listeners[t](e)}fireUpdate(e){this.fireEvent(new CustomEvent(Cn.EVENT_UPDATED,{detail:e}))}fireDisconnect(){this.fireEvent(new CustomEvent(Cn.EVENT_DISCONNECT))}fireReconnect(){this.fireEvent(new CustomEvent(Cn.EVENT_RECONNECT))}fireDownsampleStart(e){this.fireEvent(new CustomEvent(Cn.EVENT_DOWNSAMPLESTARTED,{detail:e}))}fireDownsampleFinish(e){this.fireEvent(new CustomEvent(Cn.EVENT_DOWNSAMPLEFINISHED,{detail:e}))}fireDownsampleFail(e){this.fireEvent(new CustomEvent(Cn.EVENT_DOWNSAMPLEFAILED,{detail:e}))}fireDownsampleNeeded(e){this.fireEvent(new CustomEvent(Cn.EVENT_DOWNSAMPLENEEDED,{detail:e}))}fireLoadFinished(){this.fireEvent(new CustomEvent(Cn.EVENT_LOADFINISHED))}};let tt=Cn;tt.EVENT_UPDATED="ChartModel.EVENT_UPDATED";tt.EVENT_DISCONNECT="ChartModel.EVENT_DISCONNECT";tt.EVENT_RECONNECT="ChartModel.EVENT_RECONNECT";tt.EVENT_DOWNSAMPLESTARTED="ChartModel.EVENT_DOWNSAMPLESTARTED";tt.EVENT_DOWNSAMPLEFINISHED="ChartModel.EVENT_DOWNSAMPLEFINISHED";tt.EVENT_DOWNSAMPLEFAILED="ChartModel.EVENT_DOWNSAMPLEFAILED";tt.EVENT_DOWNSAMPLENEEDED="ChartModel.EVENT_DOWNSAMPLENEEDED";tt.EVENT_LOADFINISHED="ChartModel.EVENT_LOADFINISHED";const Af="#76d9e4 #9edc6f #fcd65b #aa9af4 #f37e3f #f95d84 #f0f0ee",Of="#403e41",kf="#5b5a5c",Lf="#c0bfbf",Pf="#4878ea",Hf="rgba(91, 90, 92, 0.7)",st={"paper-bgcolor":"#2d2a2e","plot-bgcolor":"#322f33","title-color":"#f0f0ee",colorway:Af,gridcolor:Of,linecolor:kf,zerolinecolor:Lf,activecolor:Pf,rangebgcolor:Hf,"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"},Bn=Object.freeze({paper_bgcolor:st["paper-bgcolor"],plot_bgcolor:st["plot-bgcolor"],title_color:st["title-color"],colorway:st.colorway,gridcolor:st.gridcolor,linecolor:st.linecolor,zerolinecolor:st.zerolinecolor,activecolor:st.activecolor,rangebgcolor:st.rangebgcolor,area_color:st["area-color"],trend_color:st["trend-color"],line_color:st["line-color"],error_band_line_color:st["error-band-line-color"],error_band_fill_color:st["error-band-fill-color"],ohlc_increasing:st["ohlc-increasing"],ohlc_decreasing:st["ohlc-decreasing"]}),io=se.module("ChartUtils"),Pn=Object.freeze(I.calendar.DayOfWeek.values()),Yl="io.deephaven.time.DateTime",_f=36e5,Vf=1e6;function Uf(e){return e.asDate!==void 0}function Bf(e){return e.asNumber!==void 0}function Ql(e){return e.dhTimeZone!==void 0}function Gf(e){return e!=null&&e.range!=null&&(e.autorange===!1||e.autorange===void 0)}const Q=class{static getPlotlyChartType(e,t){switch(e){case I.plot.SeriesPlotStyle.SCATTER:return t?"scatter":"scattergl";case I.plot.SeriesPlotStyle.LINE:return"scatter";case I.plot.SeriesPlotStyle.BAR:case I.plot.SeriesPlotStyle.STACKED_BAR:return"bar";case I.plot.SeriesPlotStyle.PIE:return"pie";case I.plot.SeriesPlotStyle.TREEMAP:return"treemap";case I.plot.SeriesPlotStyle.HISTOGRAM:return"histogram";case I.plot.SeriesPlotStyle.OHLC:return"ohlc";default:return}}static getPlotlyChartMode(e,t,n){const s=new Set;switch(e){case I.plot.SeriesPlotStyle.SCATTER:t!=null&&t&&s.add(Q.MODE_LINES),(n==null||n)&&s.add(Q.MODE_MARKERS);break;case I.plot.SeriesPlotStyle.LINE:(t==null||t)&&s.add(Q.MODE_LINES),n!=null&&n&&s.add(Q.MODE_MARKERS);break}return s.size>0?[...s].join("+"):void 0}static getPlotlyProperty(e,t){switch(e){case I.plot.SeriesPlotStyle.PIE:switch(t){case I.plot.SourceType.X:return"labels";case I.plot.SourceType.Y:return"values"}break;case I.plot.SeriesPlotStyle.OHLC:switch(t){case I.plot.SourceType.TIME:return"x"}break;case I.plot.SeriesPlotStyle.TREEMAP:switch(t){case I.plot.SourceType.X:return"ids";case I.plot.SourceType.Y:return"values";case I.plot.SourceType.LABEL:return"labels";case I.plot.SourceType.PARENT:return"parents";case I.plot.SourceType.COLOR:return"marker.colors"}break}switch(t){case I.plot.SourceType.X:return"x";case I.plot.SourceType.Y:return"y";case I.plot.SourceType.Z:return"z";case I.plot.SourceType.X_LOW:return"xLow";case I.plot.SourceType.X_HIGH:return"xHigh";case I.plot.SourceType.Y_LOW:return"yLow";case I.plot.SourceType.Y_HIGH:return"yHigh";case I.plot.SourceType.TIME:return"time";case I.plot.SourceType.OPEN:return"open";case I.plot.SourceType.HIGH:return"high";case I.plot.SourceType.LOW:return"low";case I.plot.SourceType.CLOSE:return"close";case I.plot.SourceType.SHAPE:return"shape";case I.plot.SourceType.SIZE:return"size";case I.plot.SourceType.LABEL:return"label";case I.plot.SourceType.COLOR:return"color";case I.plot.SourceType.PARENT:return"parent";case I.plot.SourceType.HOVER_TEXT:return"hovertext";case I.plot.SourceType.TEXT:return"text";default:throw new Error(`Unrecognized source type: ${t}`)}}static getPlotlySeriesOrientation(e){var n,s;const{sources:t}=e;return t.length===2&&((s=(n=t[0])==null?void 0:n.axis)==null?void 0:s.type)===I.plot.AxisType.Y?Q.ORIENTATION.HORIZONTAL:Q.ORIENTATION.VERTICAL}static getPlotlyErrorBars(e,t,n){const s=n.map((i,r)=>i-e[r]),o=t.map((i,r)=>e[r]-i);return{type:"data",symmetric:!1,array:s,arrayminus:o}}static getPlotlyDateFormat(e,t,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 o;const i=e==null?void 0:e.getColumnTypeFormatter(t);return i!=null&&Ql(i)&&i.dhTimeZone!=null&&i.showTimeZone&&(o=I.i18n.DateTimeFormat.format(" z",new Date,i.dhTimeZone)),{tickformat:s,ticksuffix:o,automargin:!0}}static convertNumberPrefix(e){return e.replace(/\u00A4\u00A4/g,"USD").replace(/\u00A4/g,"$")}static getPlotlyNumberFormat(e,t,n){if(!n)return null;const o=n.split(";")[0].match(/^([^#,0.]*)([#,]*)([0,]*)(\.?)(0*)(#*)(E?0*)(%?)(.*)/);O(o);const[,i,r,l,,a,c,d,u,m]=o,p=l.replace(",","").length,f=r.indexOf(",")>=0||l.indexOf(",")>=0?",":"",w=d!=null&&d!==""?"e":"f",C=u!==""?u:w,S=a.length+c.length,E=`0${p}${f}.${S}${C}`,v=Q.convertNumberPrefix(i),y=Q.convertNumberPrefix(m);return{tickformat:E,tickprefix:v,ticksuffix:y,automargin:!0}}static getPlotlyAxisFormat(e,t=null){const{axis:n,columnType:s}=e,{formatPattern:o}=n;let i=null;return x.isDateType(s)?(i=Q.getPlotlyDateFormat(t,s,o),i=Q.addTickSpacing(i,n,!0)):x.isNumberType(s)&&(i=Q.getPlotlyNumberFormat(t,s,o),i=Q.addTickSpacing(i,n,!1)),n.formatType===I.plot.AxisFormatType.CATEGORY&&(i?i.type="category":i={type:"category",tickformat:void 0,ticksuffix:void 0}),i}static addTickSpacing(e,t,n){const{gapBetweenMajorTicks:s}=t;if(s>0){const o=e||{};let i=s;return n&&(i=s/Vf),t.log&&(i=Math.log(i)),o.tickmode="linear",o.dtick=i,o}return e}static getSourceForAxis(e,t){for(let n=0;n<e.series.length;n+=1){const s=e.series[n];for(let o=0;o<s.sources.length;o+=1){const i=s.sources[o];if(i.axis===t)return i}}return null}static getSeriesVisibility(e,t){return t!=null&&t.hiddenSeries!=null&&t.hiddenSeries.includes(e)?"legendonly":!0}static getHiddenLabels(e){return e!=null&&e.hiddenSeries?[...e.hiddenSeries]:[]}static makeSeriesData(e,t,n,s,o=Q.ORIENTATION.VERTICAL){return{type:e,mode:t,name:n,orientation:o,showlegend:s!=null?s:void 0}}static makeSeriesDataFromSeries(e,t,n,s=null,o=Bn){const{name:i,isLinesVisible:r,isShapesVisible:l,plotStyle:a,lineColor:c,shapeColor:d,sources:u,shape:m,shapeSize:p}=e,g=u.some(b=>{var E;return(E=b.axis)==null?void 0:E.businessCalendar}),f=Q.getChartType(a,g),w=Q.getPlotlyChartMode(a,r!=null?r:void 0,l!=null?l:void 0),C=Q.getPlotlySeriesOrientation(e),S=Q.makeSeriesData(f,w,i,s,C);return Q.addSourcesToSeriesData(S,a,u,t),Q.addStylingToSeriesData(S,a,o,c,d,m,p,n),S}static addSourcesToSeriesData(e,t,n,s){const o=e;for(let i=0;i<n.length;i+=1){const r=n[i],{axis:l,type:a}=r,c=Q.getPlotlyProperty(t,a);Zl(o,c,[]);const d=l!=null?Q.getAxisPropertyName(l.type):null;if(d!=null){const u=s.get(l.type);if(u){const m=u.indexOf(l),p=m>0?`${m+1}`:"";o[`${d}axis`]=`${d}${p}`}}}}static addStylingToSeriesData(e,t,n=Bn,s=null,o=null,i=null,r=null,l=null){const a=e;if(a.marker={line:{}},a.line={width:1},t===I.plot.SeriesPlotStyle.AREA?a.fill="tozeroy":t===I.plot.SeriesPlotStyle.STACKED_AREA?a.stackgroup="stack":t===I.plot.SeriesPlotStyle.STEP?a.line.shape="hv":t===I.plot.SeriesPlotStyle.HISTOGRAM?(a.width=[],a.marker.line!==void 0&&Object.assign(a.marker.line,{color:n.paper_bgcolor,width:1})):t===I.plot.SeriesPlotStyle.OHLC?(a.increasing={line:{color:n.ohlc_increasing}},a.decreasing={line:{color:n.ohlc_decreasing}}):t===I.plot.SeriesPlotStyle.PIE?(a.textinfo="label+percent",a.outsidetextfont={color:n.title_color}):t===I.plot.SeriesPlotStyle.TREEMAP&&(a.hoverinfo="text",a.textinfo="label+text",a.tiling={packing:"squarify",pad:0},a.textposition="middle center",a.outsidetextfont={color:n.title_color}),s!=null&&(t===I.plot.SeriesPlotStyle.BAR?a.marker.color=s:a.line.color=s),o!=null&&(a.marker.color=o),i!=null&&i.length>0)try{a.marker.symbol=Q.getMarkerSymbol(i)}catch(c){io.warn("Unable to handle shape",i,":",c)}r!=null&&(a.marker.size=r*Q.DEFAULT_MARKER_SIZE),l!=null&&t!==I.plot.SeriesPlotStyle.PIE&&(a.visible=l)}static getMarkerSymbol(e){switch(e){case"SQUARE":return"square";case"CIRCLE":return"circle";case"DIAMOND":return"diamond";case"UP_TRIANGLE":return"triangle-up";case"DOWN_TRIANGLE":return"triangle-down";case"RIGHT_TRIANGLE":return"triangle-right";case"LEFT_TRIANGLE":return"triangle-left";case"ELLIPSE":case"HORIZONTAL_RECTANGLE":case"VERTICAL_RECTANGLE":default:throw new Error(`Unrecognized shape ${e}`)}}static getAxisFormats(e,t){const n=new Map,s={tickformat:null,ticksuffix:null},o=Q.getAllAxes(e),i=Q.groupArray(o,"type"),{charts:r}=e;for(let l=0;l<r.length;l+=1){const a=r[l];for(let c=0;c<a.series.length;c+=1){const d=a.series[c],{sources:u}=d,m=u.filter(p=>p.axis);for(let p=0;p<m.length;p+=1){const g=m[p],{axis:f}=g,{type:w}=f,C=i.get(w);O(C);const S=C.indexOf(f),b=Q.getAxisPropertyName(w);if(b!=null){const E=Q.getAxisLayoutProperty(b,S);if(n.has(E))io.debug(`${E} already added.`);else{io.debug(`Adding ${E} to axisFormats.`);const v=Q.getPlotlyAxisFormat(g,t);if(v===null)n.set(E,s);else{n.set(E,v);const{businessCalendar:y}=f;if(y!=null){const M=[],{businessPeriods:A,businessDays:F,holidays:V,timeZone:H}=y,N=t==null?void 0:t.getColumnTypeFormatter(Yl);let P;Ql(N)&&(P=N.dhTimeZone);const k=P?(H.standardOffset-P.standardOffset)/60:0;V.length>0&&M.push(...Q.createRangeBreakValuesFromHolidays(V,H,P)),A.forEach(z=>M.push({pattern:"hour",bounds:[Q.periodToDecimal(z.close)+k,Q.periodToDecimal(z.open)+k]})),F.length<Pn.length&&Q.createBoundsFromDays(F).forEach(z=>M.push({pattern:"day of week",bounds:z})),v.rangebreaks=M}if(n.size===a.axes.length)return n}}}}}}return n}static getChartType(e,t){switch(e){case I.plot.SeriesPlotStyle.HISTOGRAM:return"bar";default:return Q.getPlotlyChartType(e,t)}}static getAxisPropertyName(e){switch(e){case I.plot.AxisType.X:return"x";case I.plot.AxisType.Y:return"y";default:return null}}static getAxisSide(e){switch(e){case I.plot.AxisPosition.BOTTOM:return"bottom";case I.plot.AxisPosition.TOP:return"top";case I.plot.AxisPosition.LEFT:return"left";case I.plot.AxisPosition.RIGHT:return"right";default:return}}static getAllAxes(e){return e.charts.reduce((t,n)=>[...t,...n.axes],[])}static getChartForSeries(e,t){const{charts:n}=e;for(let s=0;s<n.length;s+=1){const o=n[s];for(let i=0;i<o.series.length;i+=1)if(t===o.series[i])return o}return null}static getLayoutRanges(e){const t={},n=Object.keys(e).filter(s=>s.indexOf("axis")>=0);for(let s=0;s<n.length;s+=1){const o=n[s],i=e[o];Gf(i)&&(t[o]=[...i.range])}return t}static updateFigureAxes(e,t,n,s=0,o=0,i=Bn){const r=e,l=Q.getAllAxes(t);for(let a=0;a<t.charts.length;a+=1){const c=t.charts[a],d=n==null?void 0:n(c),u=Q.getChartBounds(t,c,s,o);Q.updateLayoutAxes(r,c.axes,l,s,o,u,d,i)}Q.removeStaleAxes(r,l)}static getChartBounds(e,t,n=0,s=0){var b;const{cols:o,rows:i}=e,{column:r,colspan:l,row:a,rowspan:c}=t,d=r+l,u=a+c,m=1/o,p=1/i,g=Q.AXIS_SIZE_PX/n,f=Q.AXIS_SIZE_PX/s,w={left:r*m+(r>0?g/2:0),bottom:a*p+(a>0?f/2:0),top:u*p-(u<i?f/2:0),right:d*m-(d<o?g/2:0)};return((b=Q.groupArray(t.axes,"position").get(I.plot.AxisPosition.RIGHT))!=null?b:[]).length>0&&(n>0?w.right-=(w.right-w.left)*Math.max(0,Math.min(Q.LEGEND_WIDTH_PX/n,Q.MAX_LEGEND_SIZE)):w.right-=(w.right-w.left)*Q.DEFAULT_AXIS_SIZE),w}static updateLayoutAxes(e,t,n,s=0,o=0,i={left:0,top:0,right:1,bottom:1},r,l=Bn){const a=s>0?Math.max(Q.MIN_AXIS_SIZE,Math.min(Q.AXIS_SIZE_PX/o,Q.MAX_AXIS_SIZE)):Q.DEFAULT_AXIS_SIZE,c=o>0?Math.max(Q.MIN_AXIS_SIZE,Math.min(Q.AXIS_SIZE_PX/s,Q.MAX_AXIS_SIZE)):Q.DEFAULT_AXIS_SIZE,d=e,u=Q.groupArray(t,"position"),m=Q.groupArray(t,"type"),p=[...m.keys()],g=Q.groupArray(n,"type");for(let f=0;f<p.length;f+=1){const w=p[f],C=Q.getAxisPropertyName(w);if(C!=null){const S=m.get(w),b=g.get(w),v=w===I.plot.AxisType.Y?o:s;O(S),O(b);for(let y=0;y<S.length;y+=1){const M=S[y],A=b.indexOf(M),F=Q.getAxisLayoutProperty(C,A);d[F]==null&&(d[F]=Q.makeLayoutAxis(w,l));const V=d[F];if(V!=null){Q.updateLayoutAxis(V,M,y,u,a,c,i);const{range:H,autorange:N}=V;if(r!=null&&H!==void 0&&(N===void 0||N===!1)){const P=r(M),[k,z]=P(H);io.debug("Setting downsample range",v,k,z),M.range(v,k,z)}else M.range(v)}}}}}static removeStaleAxes(e,t){const n=e,s=Q.groupArray(t,"type"),o=[...s.keys()];for(let i=0;i<o.length;i+=1){const r=o[i],l=s.get(r);O(l);let a=l.length;const c=Q.getAxisPropertyName(r);if(c!=null){let d=Q.getAxisLayoutProperty(c,a);for(;n[d]!=null;)delete n[d],a+=1,d=Q.getAxisLayoutProperty(c,a)}}}static getAxisLayoutProperty(e,t){const n=t>0?`${t+1}`:"";return`${e!=null?e:""}axis${n}`}static updateLayoutAxis(e,t,n,s,o,i,r){var u,m,p;const a=t.type===I.plot.AxisType.Y?i:o,c=e,d=(u=t.label)!=null?u:"";if(c.title!==void 0&&typeof c.title!="string"?c.title.text=d:c.title={text:d},t.log&&(c.type="log"),c.side=Q.getAxisSide(t.position),n>0){c.overlaying=(m=Q.getAxisPropertyName(t.type))!=null?m:void 0;const g=(p=s.get(t.position))!=null?p:[],f=g.indexOf(t);f>0&&(c.anchor="free",t.position===I.plot.AxisPosition.RIGHT?c.position=r.right+(f-g.length+1)*a:t.position===I.plot.AxisPosition.TOP?c.position=r.top+(f-g.length+1)*a:t.position===I.plot.AxisPosition.BOTTOM?c.position=r.bottom+(g.length-f+1)*a:t.position===I.plot.AxisPosition.LEFT&&(c.position=r.left+(g.length-f+1)*a))}else if(t.type===I.plot.AxisType.X){const g=s.get(I.plot.AxisPosition.LEFT)||[],f=s.get(I.plot.AxisPosition.RIGHT)||[],w=Math.max(r.left,r.left+(g.length-1)*i),C=Math.min(r.right-(f.length-1)*i,r.right);c.domain=[w,C]}else if(t.type===I.plot.AxisType.Y){const g=s.get(I.plot.AxisPosition.BOTTOM)||[],f=s.get(I.plot.AxisPosition.TOP)||[],w=Math.max(r.bottom,r.bottom+(g.length-1)*o),C=Math.min(r.top-(f.length-1)*o,r.top);c.domain=[w,C]}}static periodToDecimal(e){const t=e.split(":");return Number(t[0])+Number(t[1])/60}static createBoundsFromDays(e){const t=e.map(i=>Pn.indexOf(i)),n=Pn.filter(i=>!e.includes(i)).map(i=>Pn.indexOf(i)),s=new Set;n.forEach(i=>{for(let r=i+1;r<i+Pn.length;r+=1){const l=r%Pn.length;if(t.includes(l)){s.add(l);break}}});const o=[];return s.forEach(i=>{for(let r=i-1;r>i-Pn.length;r-=1){const l=r<0?r+Pn.length:r;if(t.includes(l)){const a=(l+1)%7;o.push([a,i]);break}}}),o}static createRangeBreakValuesFromHolidays(e,t,n){const s=[],o=[];return e.forEach(i=>{i.businessPeriods.length>0?o.push(...Q.createPartialHoliday(i,t,n)):s.push(Q.createFullHoliday(i,t,n))}),[{values:s},...o]}static createFullHoliday(e,t,n){return Q.adjustDateForTimeZone(`${e.date.toString()} 00:00:00.000000`,t,n)}static createPartialHoliday(e,t,n){const s=e.date.toString(),o=["00:00"];e.businessPeriods.forEach(r=>{o.push(r.open),o.push(r.close)}),o.push("24:00");const i=[];for(let r=0;r<o.length;r+=2){const l=o[r],a=o[r+1];if(l!==a){const c=[Q.adjustDateForTimeZone(`${s} ${l}:00.000000`,t,n)],d=_f*(Q.periodToDecimal(a)-Q.periodToDecimal(l));i.push({values:c,dvalue:d})}}return i}static adjustDateForTimeZone(e,t,n){return n&&n.standardOffset!==t.standardOffset?Q.unwrapValue(Q.wrapValue(e,Yl,t),n):e}static groupArray(e,t){return e.reduce((n,s)=>{var r;const o=s[t],i=(r=n.get(o))!=null?r:[];return i.push(s),n.set(o,i),n},new Map)}static unwrapValue(e,t){if(e!=null){if(Uf(e))return I.i18n.DateTimeFormat.format(Q.DATE_FORMAT,e,t);if(Bf(e))return e.asNumber()}return e}static wrapValue(e,t,n=null){if(x.isDateType(t)&&typeof e=="string"){const s=e,o=Q.DATE_FORMAT.substr(0,e.length),i=I.i18n.DateTimeFormat.parse(o,s);if(!n)return i;const r=`${o} Z`,l=I.i18n.DateTimeFormat.format("Z",i,n),a=I.i18n.DateTimeFormat.parse(r,`${s} ${l}`),c=I.i18n.DateTimeFormat.format("Z",a,n);return I.i18n.DateTimeFormat.parse(r,`${s} ${c}`)}return e}static makeLayoutAxis(e,t=Bn){const n={automargin:!0,gridcolor:t.gridcolor,linecolor:t.linecolor,rangeslider:{visible:!1},showline:!0,ticklen:5,tickcolor:t.paper_bgcolor,tickfont:{color:t.zerolinecolor},title:{font:{color:t.title_color}}};return e===I.plot.AxisType.X?Object.assign(n,{showgrid:!0}):e===I.plot.AxisType.Y&&Object.assign(n,{zerolinecolor:t.zerolinecolor,zerolinewidth:2}),n}static getColorwayFromTheme(e=Bn){let t=[];return e.colorway&&(Array.isArray(e.colorway)?t=e.colorway:typeof e.colorway=="string"?t=e.colorway.split(" "):io.warn(`Unable to handle colorway property: ${e.colorway}`)),t}static makeDefaultLayout(e=Bn){const t={...e,autosize:!0,colorway:Q.getColorwayFromTheme(e),font:{family:"'Fira Sans', sans-serif"},title:{font:{color:e.title_color},yanchor:"top",pad:{...Q.DEFAULT_TITLE_PADDING},y:1},legend:{font:{color:e.title_color}},margin:{...Q.DEFAULT_MARGIN},xaxis:Q.makeLayoutAxis(I.plot.AxisType.X,e),yaxis:Q.makeLayoutAxis(I.plot.AxisType.Y,e)};return t.datarevision=0,t}static hydrateSettings(e){return{...e,type:I.plot.SeriesPlotStyle[e.type]}}static titleFromSettings(e){const{series:t,xAxis:n,title:s=`${t.join(", ")} by ${n}`}=e;return s}static makeFigureSettings(e,t){const{series:n,xAxis:s,type:o}=e,i=Q.titleFromSettings(e),r={formatType:`${I.plot.AxisFormatType.NUMBER}`,type:`${I.plot.AxisType.X}`,position:`${I.plot.AxisPosition.BOTTOM}`},l={formatType:`${I.plot.AxisFormatType.NUMBER}`,type:`${I.plot.AxisType.Y}`,position:`${I.plot.AxisPosition.LEFT}`};return{charts:[{chartType:`${I.plot.ChartType.XY}`,axes:[r,l],series:n.map(a=>({plotStyle:`${o}`,name:a,dataSources:[{type:`${I.plot.SourceType.X}`,columnName:s,axis:r,table:t},{type:`${I.plot.SourceType.Y}`,columnName:a,axis:l,table:t}]}))}],title:i}}};let be=Q;be.DEFAULT_AXIS_SIZE=.15;be.MIN_AXIS_SIZE=.025;be.MAX_AXIS_SIZE=.2;be.AXIS_SIZE_PX=75;be.LEGEND_WIDTH_PX=50;be.MAX_LEGEND_SIZE=.25;be.ORIENTATION=Object.freeze({HORIZONTAL:"h",VERTICAL:"v"});be.DATE_FORMAT="yyyy-MM-dd HH:mm:ss.SSSSSS";be.DEFAULT_MARGIN=Object.freeze({l:60,r:50,t:30,b:60,pad:0});be.DEFAULT_TITLE_PADDING=Object.freeze({t:8});be.SUBTITLE_LINE_HEIGHT=25;be.DEFAULT_MARKER_SIZE=6;be.MODE_MARKERS="markers";be.MODE_LINES="lines";const Hn=se.module("Chart"),uo=class extends T.exports.Component{constructor(e){super(e),this.getCachedConfig=Ie((t,n,s,o)=>{const i=[],r=Boolean(t);if(r&&i.push({name:`Downsampling failed: ${t}`,click:()=>{},icon:uo.convertIcon(ha),attr:"fill-warning"}),n||s||o||r){const l=uo.downsampleButtonTitle(s,o),a=uo.downsampleButtonAttr(s,o),c=s?la:Iu;i.push({name:l,icon:uo.convertIcon(c),click:this.handleDownsampleClick,attr:a})}return{displaylogo:!1,displayModeBar:s||r?!0:"hover",modeBarButtons:[i,["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=te.createRef(),this.plotWrapper=te.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(e){const[t,,,,n]=e.icon,s=`${n}`;return{width:t,path:s,ascent:t,descent:0,transform:"matrix(1, 0, 0, 1, 0, 0)"}}static downsampleButtonTitle(e,t){return e?"Downsampling in progress...":t?"Downsampling disabled, click to enable":"Downsampling enabled, click to disable"}static downsampleButtonAttr(e,t){return e?"animation-spin":t?void 0:"fill-active"}componentDidMount(){this.updateDimensions(),this.updateModelDimensions(),this.initData(),this.initFormatter();const{isActive:e}=this.props;e&&this.subscribe()}componentDidUpdate(e){const{isActive:t,settings:n}=this.props;this.updateFormatterSettings(n),t!==e.isActive&&(t?this.subscribe():this.unsubscribe())}componentWillUnmount(){this.unsubscribe()}getPlotRect(){var e,t;return(t=(e=this.plotWrapper.current)==null?void 0:e.getBoundingClientRect())!=null?t:null}initData(){const{model:e}=this.props,{layout:t}=this.state;this.setState({data:e.getData(),layout:{...t,...e.getLayout()}})}subscribe(){if(this.isSubscribed)return;const{model:e}=this.props;if(!this.rect||this.rect.width===0||this.rect.height===0){Hn.debug2("Delaying subscription until model dimensions are set");return}e.subscribe(this.handleModelEvent),this.isSubscribed=!0}unsubscribe(){if(!this.isSubscribed)return;const{model:e}=this.props;e.unsubscribe(this.handleModelEvent),this.isSubscribed=!1}handleAfterPlot(){this.plot.current!=null}handleDownsampleClick(){this.setState(({isDownsamplingDisabled:e})=>({downsamplingError:null,isDownsampleInProgress:!1,isDownsampleFinished:!1,isDownsamplingDisabled:!e}),()=>{const{model:e}=this.props,{isDownsamplingDisabled:t}=this.state;e.setDownsamplingDisabled(t)})}handleModelEvent(e){var s;const{type:t,detail:n}=e;switch(Hn.debug2("Received data update",t,n),t){case tt.EVENT_UPDATED:{this.currentSeries+=1,this.setState(i=>{const{layout:r,revision:l}=i;return typeof r.datarevision=="number"&&(r.datarevision+=1),{data:n,layout:r,revision:l+1}});const{onUpdate:o}=this.props;o({isLoading:!this.isLoadedFired});break}case tt.EVENT_LOADFINISHED:{const{onUpdate:o}=this.props;this.isLoadedFired=!0,o({isLoading:!1});break}case tt.EVENT_DISCONNECT:{const{onDisconnect:o}=this.props;o();break}case tt.EVENT_RECONNECT:{const{onReconnect:o}=this.props;o();break}case tt.EVENT_DOWNSAMPLESTARTED:{this.setState({isDownsampleFinished:!1,isDownsampleInProgress:!0,downsamplingError:null});break}case tt.EVENT_DOWNSAMPLEFINISHED:{this.setState({isDownsampleFinished:!0,isDownsampleInProgress:!1,downsamplingError:null});break}case tt.EVENT_DOWNSAMPLENEEDED:case tt.EVENT_DOWNSAMPLEFAILED:{const o=(s=n.message)!=null?s:n;this.setState({isDownsampleFinished:!1,isDownsampleInProgress:!1,isDownsamplingDisabled:!1,downsamplingError:o});const{onError:i}=this.props;i(new Error(o));break}default:Hn.debug("Unknown event type",t,e)}}handlePlotUpdate(e){const{layout:t}=e,n=be.getLayoutRanges(t);!ct(n,this.ranges)&&(this.ranges=n,this.updateModelDimensions(!0))}handleRelayout(e){if(Hn.debug("handleRelayout",e),e.hiddenlabels!=null){const{onSettingsChanged:t}=this.props,n=[...e.hiddenlabels];t({hiddenSeries:n})}this.updateModelDimensions()}handleRestyle([e,t]){if(Hn.debug("handleRestyle",e,t),Object.keys(e).includes("visible")){const{data:n}=this.state,{onSettingsChanged:s}=this.props;if(n!=null){const o=n.reduce((i,{name:r,visible:l})=>r!=null&&l==="legendonly"?[...i,r]:i,[]);s({hiddenSeries:o})}}}updateModelDimensions(e=!1){const t=this.getPlotRect();if(!t){Hn.warn("Unable to get plotting rect");return}if(!this.rect||this.rect.width!==t.width||this.rect.height!==t.height||e){this.rect=t;const{isActive:s,model:o}=this.props;o.setDimensions(t),s&&this.subscribe()}}initFormatter(){const{settings:e}=this.props;this.updateFormatterSettings(e)}updateFormatterSettings(e){const t=ms.getColumnFormats(e),n=ms.getDateTimeFormatterOptions(e),{decimalFormatOptions:s={},integerFormatOptions:o={}}=e;(!ct(this.columnFormats,t)||!ct(this.dateTimeFormatterOptions,n)||!ct(this.decimalFormatOptions,s)||!ct(this.integerFormatOptions,o))&&(this.columnFormats=ms.getColumnFormats(e),this.dateTimeFormatterOptions=n,this.decimalFormatOptions=s,this.integerFormatOptions=o,this.updateFormatter())}updateFormatter(){const e=new tn(this.columnFormats,this.dateTimeFormatterOptions,this.decimalFormatOptions,this.integerFormatOptions),{model:t}=this.props;t.setFormatter(e)}updateDimensions(){const e=this.getPlotRect();this.plot.current!=null&&e!=null&&e.width>0&&e.height>0&&si.relayout(this.plot.current.el,{autosize:!0}).catch(t=>{Hn.debug("Unable to resize, promise rejected",t)})}render(){const{data:e,downsamplingError:t,isDownsampleFinished:n,isDownsampleInProgress:s,isDownsamplingDisabled:o,layout:i,revision:r}=this.state,l=this.getCachedConfig(t,n,s,o),a=e!=null;return h("div",{className:"h-100 w-100 chart-wrapper",ref:this.plotWrapper,children:a&&h(xf,{ref:this.plot,data:e,layout:i,revision:r,config:l,onAfterPlot:this.handleAfterPlot,onError:Hn.error,onRelayout:this.handleRelayout,onUpdate:this.handlePlotUpdate,onRestyle:this.handleRestyle,useResizeHandler:!0,style:{height:"100%",width:"100%"}})})}};let zf=uo;zf.defaultProps={isActive:!0,settings:{timeZone:"America/New_York",defaultDateTimeFormat:Tn.FULL_DATE_FORMAT,showTimeZone:!1,showTSeparator:!0,formatter:[]},onDisconnect:()=>{},onReconnect:()=>{},onUpdate:()=>{},onError:()=>{},onSettingsChanged:()=>{}};const rt=se.module("FigureChartModel"),Dc=class extends tt{constructor(e,t={},n=Bn){super(),this.addPendingSeries=ft(()=>{var r;const o=be.getAllAxes(this.figure),{pendingSeries:i}=this;for(let l=0;l<i.length;l+=1){const a=i[l],c=this.figure.charts.find(d=>d.series.includes(a));this.addSeries(a,o,(r=c==null?void 0:c.showLegend)!=null?r:null),a.subscribe()}this.pendingSeries=[]},Dc.ADD_SERIES_DEBOUNCE),this.getTimeZone=he((o,i)=>{if(i!=null){const r=i.getColumnTypeFormatter(o);if(r!=null)return r.dhTimeZone}}),this.getValueTranslator=he((o,i)=>{const r=this.getTimeZone(o,i);return l=>be.unwrapValue(l,r)}),this.getValueParser=he((o,i)=>{const r=this.getTimeZone(o,i);return l=>be.wrapValue(l,o,r)}),this.getRangeParser=he((o,i)=>r=>{let[l,a]=r;const c=this.getValueParser(o,i);return l=c(l),a=c(a),[l,a]}),this.getAxisRangeParser=he((o,i)=>r=>{const l=be.getSourceForAxis(o,r);return l?this.getRangeParser(l.columnType,i):a=>a}),this.handleFigureUpdated=this.handleFigureUpdated.bind(this),this.handleFigureDisconnected=this.handleFigureDisconnected.bind(this),this.handleFigureReconnected=this.handleFigureReconnected.bind(this),this.handleFigureSeriesAdded=this.handleFigureSeriesAdded.bind(this),this.handleDownsampleStart=this.handleDownsampleStart.bind(this),this.handleDownsampleFinish=this.handleDownsampleFinish.bind(this),this.handleDownsampleFail=this.handleDownsampleFail.bind(this),this.handleDownsampleNeeded=this.handleDownsampleNeeded.bind(this),this.handleRequestFailed=this.handleRequestFailed.bind(this),this.figure=e,this.settings=t,this.theme=n,this.data=[];const s={data:{},layout:be.makeDefaultLayout(n)};this.layout={grid:{rows:e.rows,columns:e.cols,pattern:"independent"},template:s},this.seriesDataMap=new Map,this.pendingSeries=[],this.oneClicks=[],this.filterColumnMap=new Map,this.lastFilter=new Map,this.isConnected=!0,this.seriesToProcess=new Set,this.setTitle(this.getDefaultTitle()),this.initAllSeries(),this.updateAxisPositions(),this.startListeningFigure()}close(){this.figure.close(),this.addPendingSeries.cancel(),this.stopListeningFigure()}getDefaultTitle(){return this.figure.charts.length>0?this.figure.charts[0].title:""}initAllSeries(){this.oneClicks=[],this.filterColumnMap.clear();const{charts:e}=this.figure,t=be.getAllAxes(this.figure),n=[];for(let i=0;i<e.length;i+=1){const r=e[i];for(let l=0;l<r.series.length;l+=1){const a=r.series[l];n.push(a.name),this.addSeries(a,t,r.showLegend)}}const o=[...this.seriesDataMap.keys()].filter(i=>n.indexOf(i)<0);for(let i=0;i<o.length;i+=1){const r=o[i];this.seriesDataMap.delete(r)}this.seriesToProcess=new Set([...this.seriesDataMap.keys()])}addSeries(e,t,n){const s=be.groupArray(t,"type"),o=be.makeSeriesDataFromSeries(e,s,be.getSeriesVisibility(e.name,this.settings),n,this.theme);if(this.seriesDataMap.set(e.name,o),this.data=[...this.seriesDataMap.values()],e.plotStyle===I.plot.SeriesPlotStyle.STACKED_BAR?this.layout.barmode="stack":e.plotStyle===I.plot.SeriesPlotStyle.PIE&&(this.layout.hiddenlabels=be.getHiddenLabels(this.settings)),this.layout.showlegend=this.data.length>1||e.plotStyle===I.plot.SeriesPlotStyle.PIE?n!=null?n:void 0:!1,e.oneClick!=null){const{oneClick:i}=e,{columns:r}=i;for(let l=0;l<r.length;l+=1)this.filterColumnMap.set(r[l].name,r[l]);this.oneClicks.push(i)}this.updateLayoutFormats()}subscribe(e){super.subscribe(e),this.listeners.length===1&&(this.initAllSeries(),this.subscribeFigure())}unsubscribe(e){super.unsubscribe(e),this.listeners.length===0&&this.unsubscribeFigure()}subscribeFigure(){if(!this.isConnected){rt.debug("Ignoring subscribe when figure in disconnected state");return}this.figure.subscribe(this.isDownsamplingDisabled?I.plot.DownsampleOptions.DISABLE:I.plot.DownsampleOptions.DEFAULT)}unsubscribeFigure(){this.figure.unsubscribe()}startListeningFigure(){this.figure.addEventListener(I.plot.Figure.EVENT_UPDATED,this.handleFigureUpdated),this.figure.addEventListener(I.plot.Figure.EVENT_SERIES_ADDED,this.handleFigureSeriesAdded),this.figure.addEventListener(I.plot.Figure.EVENT_DISCONNECT,this.handleFigureDisconnected),this.figure.addEventListener(I.plot.Figure.EVENT_RECONNECT,this.handleFigureReconnected),this.figure.addEventListener(I.plot.Figure.EVENT_DOWNSAMPLESTARTED,this.handleDownsampleStart),this.figure.addEventListener(I.plot.Figure.EVENT_DOWNSAMPLEFINISHED,this.handleDownsampleFinish),this.figure.addEventListener(I.plot.Figure.EVENT_DOWNSAMPLEFAILED,this.handleDownsampleFail),this.figure.addEventListener(I.plot.Figure.EVENT_DOWNSAMPLENEEDED,this.handleDownsampleNeeded),this.figure.addEventListener(I.Client.EVENT_REQUEST_FAILED,this.handleRequestFailed)}stopListeningFigure(){this.figure.removeEventListener(I.plot.Figure.EVENT_UPDATED,this.handleFigureUpdated),this.figure.removeEventListener(I.plot.Figure.EVENT_SERIES_ADDED,this.handleFigureSeriesAdded),this.figure.removeEventListener(I.plot.Figure.EVENT_DISCONNECT,this.handleFigureDisconnected),this.figure.removeEventListener(I.plot.Figure.EVENT_RECONNECT,this.handleFigureReconnected),this.figure.removeEventListener(I.plot.Figure.EVENT_DOWNSAMPLESTARTED,this.handleDownsampleStart),this.figure.removeEventListener(I.plot.Figure.EVENT_DOWNSAMPLEFINISHED,this.handleDownsampleFinish),this.figure.removeEventListener(I.plot.Figure.EVENT_DOWNSAMPLEFAILED,this.handleDownsampleFail),this.figure.removeEventListener(I.plot.Figure.EVENT_DOWNSAMPLENEEDED,this.handleDownsampleNeeded),this.figure.removeEventListener(I.Client.EVENT_REQUEST_FAILED,this.handleRequestFailed)}handleDownsampleStart(e){rt.debug("Downsample started",e),this.fireDownsampleStart(e.detail)}handleDownsampleFinish(e){rt.debug("Downsample finished",e),this.fireDownsampleFinish(e.detail)}handleDownsampleFail(e){rt.error("Downsample failed",e),this.fireDownsampleFail(e.detail)}handleDownsampleNeeded(e){rt.info("Downsample needed",e),this.fireDownsampleNeeded(e.detail)}handleFigureUpdated(e){const{detail:t}=e,{series:n}=t;rt.debug2("handleFigureUpdated",n);for(let o=0;o<n.length;o+=1){const i=n[o];rt.debug2("handleFigureUpdated updating series",i.name);const{sources:r}=i;for(let l=0;l<r.length;l+=1){const a=r[l],{columnType:c,type:d}=a,u=this.getValueTranslator(c,this.formatter),m=t.getArray(i,d,u);this.setDataArrayForSeries(i,d,m)}this.seriesToProcess.delete(i.name),this.seriesToProcess.size===0&&this.fireLoadFinished(),this.cleanSeries(i)}const{data:s}=this;this.fireUpdate(s)}handleRequestFailed(e){rt.error("Request failed",e)}resubscribe(){this.listeners.length>0&&(this.unsubscribeFigure(),this.subscribeFigure())}setFormatter(e){super.setFormatter(e),this.updateLayoutFormats(),this.resubscribe()}setDownsamplingDisabled(e){super.setDownsamplingDisabled(e),this.resubscribe()}handleFigureDisconnected(e){rt.debug("Figure disconnected",e),this.isConnected=!1,this.listeners.length>0&&this.unsubscribeFigure(),this.fireDisconnect()}handleFigureReconnected(e){rt.debug("Figure reconnected",e),this.isConnected=!0,this.initAllSeries(),this.fireReconnect(),this.listeners.length>0&&this.subscribeFigure()}handleFigureSeriesAdded(e){const{detail:t}=e;rt.debug("handleFigureSeriesAdded",t),this.pendingSeries.push(t),this.addPendingSeries()}setDimensions(e){super.setDimensions(e),this.updateAxisPositions()}setTitle(e){var s,o;super.setTitle(e);const t=(o=(s=(e!=null?e:"").match(/<br>/g))==null?void 0:s.length)!=null?o:0,n=be.DEFAULT_MARGIN.t+t*be.SUBTITLE_LINE_HEIGHT;this.layout.margin?this.layout.margin.t=n:this.layout.margin={t:n},typeof this.layout.title=="string"?this.layout.title=e:(this.layout.title={...this.layout.title},this.layout.title.text=e,this.layout.title.pad={...this.layout.title.pad},this.layout.title.pad.t=be.DEFAULT_TITLE_PADDING.t+t*be.SUBTITLE_LINE_HEIGHT*.5)}getPlotWidth(){var e,t,n,s;return!this.rect||!this.rect.width?0:Math.max(this.rect.width-((t=(e=this.layout.margin)==null?void 0:e.l)!=null?t:0)-((s=(n=this.layout.margin)==null?void 0:n.r)!=null?s:0),0)}getPlotHeight(){var e,t,n,s;return!this.rect||!this.rect.height?0:Math.max(this.rect.height-((t=(e=this.layout.margin)==null?void 0:e.t)!=null?t:0)-((s=(n=this.layout.margin)==null?void 0:n.b)!=null?s:0),0)}updateAxisPositions(){const e=this.getPlotWidth(),t=this.getPlotHeight();be.updateFigureAxes(this.layout,this.figure,n=>this.getAxisRangeParser(n,this.formatter),e,t,this.theme)}updateLayoutFormats(){if(!this.formatter)return;be.getAxisFormats(this.figure,this.formatter).forEach((t,n)=>{rt.debug(`Assigning ${n}`,this.layout[n],t);const s=this.layout[n];s!=null?Object.assign(s,t):rt.debug(`Ignoring null layout.${n}`)})}setDataArrayForSeries(e,t,n){const{name:s,plotStyle:o}=e,i=this.seriesDataMap.get(s),r=be.getPlotlyProperty(o,t);i&&Zl(i,r,n)}cleanSeries(e){const{name:t,plotStyle:n}=e,s=this.seriesDataMap.get(t);if(s!=null){if(n===I.plot.SeriesPlotStyle.HISTOGRAM){const{xLow:o,xHigh:i}=s;if(o&&i&&o.length===i.length){const r=[];for(let l=0;l<o.length;l+=1)r.push(i[l]-o[l]);s.width=r}}else if(n===I.plot.SeriesPlotStyle.LINE){const{x:o,xLow:i,xHigh:r,y:l,yLow:a,yHigh:c}=s;i&&r&&i!==o&&(s.error_x=be.getPlotlyErrorBars(o,i,r)),a&&c&&a!==l&&(s.error_y=be.getPlotlyErrorBars(l,a,c))}else if(n===I.plot.SeriesPlotStyle.TREEMAP){const{ids:o,labels:i}=s;o!==void 0&&i===void 0&&(s.labels=o)}}}getData(){return this.data}getLayout(){return this.layout}getFilterColumnMap(){return new Map(this.filterColumnMap)}isFilterRequired(){return this.oneClicks.find(e=>e.requireAllFiltersToDisplay)!=null}setFilter(e){if(this.oneClicks.length===0){rt.warn("Trying to set a filter, but no one click!");return}rt.debug("setFilter",e);for(let t=0;t<this.oneClicks.length;t+=1){const n=this.oneClicks[t],{columns:s}=n;new Set([...e.keys(),...this.lastFilter.keys()]).forEach(i=>{const r=e.get(i);this.lastFilter.get(i)!==r&&s.find(l=>l.name===i)!=null&&n.setValueForColumn(i,r)})}this.lastFilter=new Map(e)}setFigure(e){this.close(),this.figure=e,this.setTitle(this.getDefaultTitle()),this.initAllSeries(),this.updateAxisPositions(),this.startListeningFigure(),this.listeners.length>0&&this.subscribeFigure()}updateSettings(e){this.settings=e}};let Wf=Dc;Wf.ADD_SERIES_DEBOUNCE=50;function $f({text:e,isOpen:t,onClose:n}){var b,E;const[s,o]=T.exports.useState(!1),[i,r]=T.exports.useState(0),[l,a]=T.exports.useState(!1),[c,d]=T.exports.useState(!1),[u,m]=T.exports.useState(!1),p=T.exports.useRef();T.exports.useEffect(function(){if(!!t){try{JSON.parse(e),m(!0)}catch{m(!1)}d(!1)}},[t,e]),T.exports.useEffect(function(){p.current&&p.current.layout()},[i]),T.exports.useEffect(function(){p.current&&p.current.updateOptions({lineNumbers:l?"on":"off"})},[l]);function g(){a(!l)}function f(){var y;const v=(y=p.current)==null?void 0:y.getModel();!u||!v||(c?(v.setValue(e),d(!1)):(v.setValue(JSON.stringify(JSON.parse(e),void 0,2)),d(!0)),w())}function w(){var y,M;const v=p.current;!v||a(((M=(y=v.getModel())==null?void 0:y.getLineCount())!=null?M:0)>1)}function C(){s&&(p.current=void 0,n())}function S(v){p.current=v,r(v.getContentHeight()),v.onDidContentSizeChange(({contentHeight:y})=>r(y)),w()}return!t&&!s?null:R(Ld,{isOpen:t,centered:!0,keyboard:!0,toggle:C,onOpened:()=>o(!0),onClosed:()=>{o(!1),r(0)},className:"theme-bg-dark cell-overflow-modal",size:"xl",children:[R(Hd,{toggle:n,children:[h("h5",{className:"overflow-modal-title",children:"Cell Contents"}),h(Sa,{kind:"inline",tooltip:"Copy cell contents",copy:(E=(b=p.current)==null?void 0:b.getValue())!=null?E:e}),h(X,{kind:"inline",active:l,icon:su,tooltip:"Toggle line numbers",onClick:g}),u&&h(X,{kind:"inline",icon:eu,active:c,tooltip:"Format as JSON",onClick:f})]}),h(Pd,{style:{height:i},children:h(Gr,{onEditorInitialized:S,settings:{value:e,readOnly:!0,wordWrap:"on",language:u?"typescript":"plaintext",folding:u,padding:{bottom:16},lineNumbers:l?"on":"off",overviewRulerLanes:0,renderLineHighlight:"none",find:{seedSearchStringFromSelection:"never"}}})})]})}function qf(e){return e.model!==void 0}const Kf="###,##0";function Xf({gotoRow:e,gotoRowError:t,gotoValueError:n,onGotoRowSubmit:s,isShown:o,onEntering:i,onEntered:r,onExiting:l,onExited:a,model:c,onGotoRowNumberChanged:d,onClose:u,gotoValueSelectedColumnName:m,gotoValue:p,onGotoValueSelectedColumnNameChanged:g,onGotoValueSelectedFilterChanged:f,onGotoValueChanged:w,onGotoValueSubmit:C}){const S=T.exports.useRef(null),b=T.exports.useRef(null),[E,v]=T.exports.useState(!1);let y=[];qf(c)&&c.table!==void 0&&({columns:y}=c.table);const M="Row number",{rowCount:A}=c,F=G=>{G.key==="Enter"&&(G.stopPropagation(),G.preventDefault(),C())},V=c.getColumnIndexByName(m);O(V);const H=y[V],N=H==null?void 0:H.type,P=x.getNormalizedType(N),k=G=>{w(G!=null?G:"")},z=()=>{var G,_;E&&document.activeElement!==S.current?(G=S.current)==null||G.select():!E&&document.activeElement!==b.current&&((_=b.current)==null||_.select())};T.exports.useEffect(z,[E,e,p]);const K=()=>{switch(P){case x.dataType.DECIMAL:case x.dataType.INT:return h("div",{className:"goto-row-input",children:h("input",{ref:b,type:"number",className:B("form-control",{"is-invalid":n!==""}),onKeyDown:F,placeholder:"value",onChange:G=>k(G.target.value),value:p})});case x.dataType.DATETIME:return h("div",{className:"goto-value-date-time-input",children:h(Ir,{className:B("form-control","goto-value-date-time-input",{"is-invalid":n!==""}),onChange:k})});case x.dataType.STRING:return R(Fe,{children:[h("div",{className:"goto-row-input",children:R("select",{className:"custom-select",onChange:G=>{f(G.target.value)},children:[h("option",{value:U.eq,children:"Equals"},U.eq),h("option",{value:U.contains,children:"Contains"},U.contains),h("option",{value:U.eqIgnoreCase,children:"EqIgnoreCase"},U.eqIgnoreCase)]})}),h("div",{className:"goto-row-input",children:h("input",{ref:b,className:B("form-control",{"is-invalid":n!==""}),onKeyDown:F,placeholder:"value",onChange:G=>k(G.target.value),value:p})})]});case x.dataType.BOOLEAN:return h("div",{className:"goto-row-input",children:R("select",{className:"custom-select",onChange:G=>{k(G.target.value)},value:p,children:[h("option",{value:"true",children:"true"},"true"),h("option",{value:"false",children:"false"},"false")]})});default:return h("div",{className:"goto-row-input",children:h("input",{ref:b,className:"form-control",onKeyDown:F,placeholder:"value",onChange:G=>k(G.target.value),value:p})})}};return h(yi,{isShown:o,className:B("goto-row"),onEntering:i,onEntered:()=>{r(),z()},onExiting:l,onExited:a,children:R(Fe,{children:[R("div",{className:"goto-row-row",children:[R("div",{className:B("goto-row-wrapper",{"is-inactive":!E}),onClick:()=>v(!0),onFocus:()=>v(!0),role:"group",children:[h("div",{className:"goto-row-text",children:"Go to row"}),h("div",{className:"goto-row-input",children:h("input",{ref:S,type:"number",onKeyDown:G=>{G.key==="Enter"&&(G.stopPropagation(),G.preventDefault(),s())},className:B("form-control",{"is-invalid":t!==""}),placeholder:M,onChange:G=>{d(G)},value:e})}),R("div",{className:"goto-row-text",children:["of ",dh.i18n.NumberFormat.format(Kf,A)]}),t&&h("div",{className:"text-danger",children:t})]}),h("div",{className:"goto-row-close",children:h(X,{kind:"ghost",onClick:u,children:h(Z,{icon:go,style:{marginRight:"0"}})})})]}),c.isSeekRowAvailable&&h("div",{className:"goto-row-row",children:R("div",{className:B("goto-row-wrapper",{"is-inactive":E}),onClick:()=>v(!1),onFocus:()=>v(!1),role:"group",children:[h("div",{className:"goto-row-text",children:"Go to value"}),h("div",{className:"goto-row-input",children:h("select",{className:"custom-select",onChange:G=>{const _=G.target.value;g(_)},value:m,children:y.map(G=>h("option",{value:G.name,children:G.name},G.name))})}),K(),R("div",{children:[h(X,{kind:"ghost",disabled:p==="",onClick:()=>{C(!0)},children:h(Z,{icon:zd})}),h(X,{kind:"ghost",disabled:p==="",onClick:()=>{C(!1)},children:h(Z,{icon:Bd})})]}),n&&h("div",{className:"text-danger",children:n})]})})]})})}const le=se.module("IrisGrid"),Yf=500,Qf=250,jf=250,Zf=250,Nc=Object.freeze({aggregations:ye,showOnTop:!1}),Jf="yyyy-MM-dd'T'HH:mm:ss.SSSSSSSSS z";function jl({advancedFilters:e,aggregationSettings:t,customColumns:n,quickFilters:s,reverseType:o,rollupConfig:i,searchFilter:r,selectDistinctColumns:l,sorts:a}){return e.size===0&&t.aggregations.length===0&&n.length===0&&s.size===0&&o===x.REVERSE_TYPE.NONE&&i==null&&r==null&&l.length===0&&a.length===0}const Gn=class extends T.exports.Component{constructor(e){var K,G;super(e),this.getAdvancedMenuOpenedHandler=he(_=>this.handleAdvancedMenuOpened.bind(this,_),{max:100}),this.getCachedAdvancedFilterMenuActions=he((_,q,Y,J,de)=>h(Hr,{model:_,column:q,onFilterChange:this.handleAdvancedFilterChange,onSortChange:this.handleAdvancedFilterSortChange,onDone:this.handleAdvancedFilterDone,options:Y,sortDirection:J,formatter:de}),{max:50}),this.getCachedOptionItems=he((_,q,Y,J,de,pe,ge,Te,fe,nt,je,qe,Ut,yt,yn,Bt)=>{const xe=[];return _&&xe.push({type:ve.CHART_BUILDER,title:"Chart Builder",icon:Mu}),xe.push({type:ve.VISIBILITY_ORDERING_BUILDER,title:"Hide, Group, and Order Columns",icon:gr}),Y&&xe.push({type:ve.CONDITIONAL_FORMATTING,title:"Conditional Formatting",icon:pr}),q&&xe.push({type:ve.CUSTOM_COLUMN_BUILDER,title:"Custom Columns",icon:pu}),J&&xe.push({type:ve.ROLLUP_ROWS,title:"Rollup Rows",icon:ku}),de&&xe.push({type:ve.AGGREGATIONS,title:"Aggregate Columns",icon:gu}),pe&&xe.push({type:ve.SELECT_DISTINCT,title:"Select Distinct Values",icon:mu}),ge&&Ut&&xe.push({type:ve.TABLE_EXPORTER,title:"Download CSV",icon:Yd}),Bt&&xe.push({type:ve.ADVANCED_SETTINGS,title:"Advanced Settings",icon:Cu}),xe.push({type:ve.QUICK_FILTERS,title:"Quick Filters",subtitle:Te.shortcut.getDisplayText(),icon:oi,isOn:je,onChange:Te.action}),yt&&xe.push({type:ve.SEARCH_BAR,title:"Search Bar",subtitle:fe.shortcut.getDisplayText(),icon:ca,isOn:qe,onChange:fe.action}),xe.push({type:ve.GOTO,title:"Go to",subtitle:nt.shortcut.getDisplayText(),icon:hu,isOn:yn,onChange:nt.action}),Object.freeze(xe)},{max:1}),this.getCachedHiddenColumns=he((_,q)=>ne.getHiddenColumns(new Map([..._.initialColumnWidths,...q])),{max:1}),this.getAggregationMap=he((_,q)=>{const Y={};return q.forEach(({operation:J,selected:de,invert:pe})=>{Y[J]=qn.getOperationColumnNames(_,J,de,pe)}),Y}),this.getOperationMap=he((_,q)=>{const Y={};return q.filter(J=>!qn.isRollupOperation(J.operation)).forEach(({operation:J,selected:de,invert:pe})=>{qn.getOperationColumnNames(_,J,de,pe).forEach(ge=>{var fe;const Te=[...(fe=Y[ge])!=null?fe:[],J];Y[ge]=Object.freeze(Te)})}),Y}),this.getOperationOrder=he(_=>_.map(q=>q.operation).filter(q=>!qn.isRollupOperation(q))),this.getCachedFormatColumns=he((_,q)=>Pm(_,q)),this.getCachedModelColumns=he((_,q)=>_.columns),this.getCachedPreviewFormatColumns=he((_,q,Y,J)=>{if(le.debug("getCachedPreviewFormatColumns",q,Y,J),Y!==void 0&&J!==void 0){const de=[...q];return de[J]=Y,this.getCachedFormatColumns(_,de)}return this.getCachedFormatColumns(_,q)}),this.getModelRollupConfig=he((_,q,Y)=>ne.getModelRollupConfig(_,q,Y)),this.getModelTotalsConfig=he((_,q,Y)=>{var Te,fe,nt;const{aggregations:J,showOnTop:de}=Y;if(((fe=(Te=q==null?void 0:q.columns)==null?void 0:Te.length)!=null?fe:0)>0||((nt=J==null?void 0:J.length)!=null?nt:0)===0)return null;const pe=this.getOperationMap(_,J),ge=this.getOperationOrder(J);return{operationMap:pe,operationOrder:ge,showOnTop:de}}),this.getCachedStateOverride=he((_,q,Y,J,de,pe,ge,Te,fe,nt)=>({hoverSelectColumn:_,isFilterBarShown:q,isSelectingColumn:Y,loadingScrimProgress:J,quickFilters:de,advancedFilters:pe,sorts:ge,reverseType:Te,rollupConfig:fe,isMenuShown:nt}),{max:1}),this.getCachedFilter=he((_,q,Y,J,de)=>[..._!=null?_:[],...J!=null?J:[],...ne.getFiltersFromFilterMap(q),...ne.getFiltersFromFilterMap(Y),...de!==void 0?[de]:[]],{max:1}),this.getCachedTheme=he((_,q,Y)=>({...Ka,..._,autoSelectRow:!q,rowFooterWidth:Y>0?_.rowFooterWidth:0}),{max:1}),this.getAlwaysFetchColumns=he((_,q,Y,J,de,pe)=>{const ge=[];for(let fe=0;fe<J;fe+=1)ge.push(q[W.getModelIndex(fe,Y)].name);for(let fe=0;fe<de;fe+=1)ge.push(q[W.getModelIndex(q.length-1-fe,Y)].name);if(pe)for(let fe=pe[0];fe<=pe[1];fe+=1)ge.push(q[W.getModelIndex(fe,Y)].name);const Te=new Set([..._,...ge]);return Object.freeze([...Te])}),this.updateSearchFilter=ft((_,q,Y,J)=>{const de=jo.createSearchFilter(_,q,Y,J);this.setState({searchFilter:de})},Qf),this.handleConditionalFormatEditorUpdate=ft(_=>{this.setState({conditionalFormatPreview:_})},Zf),this.handleDownloadProgressUpdate=Zn((_,q)=>{const{tableDownloadStatus:Y}=this.state;Y===Tt.DOWNLOAD_STATUS.DOWNLOADING&&this.setState({tableDownloadProgress:_,tableDownloadEstimatedTime:q})},Yf),this.getOverflowButtonTooltip=he(_=>{if(_==null)return null;const q={position:"absolute",..._,pointerEvents:"none"};return h("div",{style:q,children:h(We,{options:{placement:"left",modifiers:{flip:{behavior:["left","right"]}}},ref:this.handleTooltipRef,children:"View full contents"},Date.now())})}),this.getExpandCellTooltip=he(_=>{if(_==null)return null;const{expandTooltipDisplayValue:q}=this.state,Y={position:"absolute",..._,pointerEvents:"none"};return h("div",{style:Y,children:h(We,{options:{placement:"bottom-start"},ref:this.handleTooltipRef,children:R("div",{style:{textAlign:"left"},children:["Click to ",q," row",h("br",{}),Ne.isMacPlatform()?"\u2318":"Ctrl+","Click to expand row and all children"]})},Date.now())})}),this.handleGotoValueChanged=_=>{this.setState({gotoValue:_}),this.debouncedSeekRow(_)},this.debouncedSeekRow=ft(_=>{this.seekRow(_)},jf),this.handleAdvancedFilterChange=this.handleAdvancedFilterChange.bind(this),this.handleAdvancedFilterSortChange=this.handleAdvancedFilterSortChange.bind(this),this.handleAdvancedFilterDone=this.handleAdvancedFilterDone.bind(this),this.handleAdvancedMenuOpened=this.handleAdvancedMenuOpened.bind(this),this.handleGotoRowOpened=this.handleGotoRowOpened.bind(this),this.handleGotoRowClosed=this.handleGotoRowClosed.bind(this),this.handleAdvancedMenuClosed=this.handleAdvancedMenuClosed.bind(this),this.handleAggregationChange=this.handleAggregationChange.bind(this),this.handleAggregationsChange=this.handleAggregationsChange.bind(this),this.handleAggregationEdit=this.handleAggregationEdit.bind(this),this.handleAnimationLoop=this.handleAnimationLoop.bind(this),this.handleAnimationStart=this.handleAnimationStart.bind(this),this.handleAnimationEnd=this.handleAnimationEnd.bind(this),this.handleChartChange=this.handleChartChange.bind(this),this.handleChartCreate=this.handleChartCreate.bind(this),this.handleGridError=this.handleGridError.bind(this),this.handleFilterBarChange=this.handleFilterBarChange.bind(this),this.handleFilterBarDone=this.handleFilterBarDone.bind(this),this.handleFilterBarTab=this.handleFilterBarTab.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleMenu=this.handleMenu.bind(this),this.handleMenuClose=this.handleMenuClose.bind(this),this.handleMenuSelect=this.handleMenuSelect.bind(this),this.handleMenuBack=this.handleMenuBack.bind(this),this.handleRequestFailed=this.handleRequestFailed.bind(this),this.handleSelectionChanged=this.handleSelectionChanged.bind(this),this.handleMovedColumnsChanged=this.handleMovedColumnsChanged.bind(this),this.handleHeaderGroupsChanged=this.handleHeaderGroupsChanged.bind(this),this.handleUpdate=this.handleUpdate.bind(this),this.handleTooltipRef=this.handleTooltipRef.bind(this),this.handleViewChanged=this.handleViewChanged.bind(this),this.handleFormatSelection=this.handleFormatSelection.bind(this),this.handleConditionalFormatCreate=this.handleConditionalFormatCreate.bind(this),this.handleConditionalFormatEdit=this.handleConditionalFormatEdit.bind(this),this.handleConditionalFormatsChange=this.handleConditionalFormatsChange.bind(this),this.handleConditionalFormatEditorSave=this.handleConditionalFormatEditorSave.bind(this),this.handleConditionalFormatEditorCancel=this.handleConditionalFormatEditorCancel.bind(this),this.handleUpdateCustomColumns=this.handleUpdateCustomColumns.bind(this),this.handleCustomColumnsChanged=this.handleCustomColumnsChanged.bind(this),this.handleSelectDistinctChanged=this.handleSelectDistinctChanged.bind(this),this.handlePendingDataUpdated=this.handlePendingDataUpdated.bind(this),this.handlePendingCommitClicked=this.handlePendingCommitClicked.bind(this),this.handlePendingDiscardClicked=this.handlePendingDiscardClicked.bind(this),this.handleGotoRowSelectedRowNumberSubmit=this.handleGotoRowSelectedRowNumberSubmit.bind(this),this.focusRowInGrid=this.focusRowInGrid.bind(this),this.handleDownloadTable=this.handleDownloadTable.bind(this),this.handleDownloadTableStart=this.handleDownloadTableStart.bind(this),this.handleCancelDownloadTable=this.handleCancelDownloadTable.bind(this),this.handleDownloadCanceled=this.handleDownloadCanceled.bind(this),this.handleDownloadCompleted=this.handleDownloadCompleted.bind(this),this.handlePartitionAppend=this.handlePartitionAppend.bind(this),this.handlePartitionChange=this.handlePartitionChange.bind(this),this.handlePartitionFetchAll=this.handlePartitionFetchAll.bind(this),this.handlePartitionDone=this.handlePartitionDone.bind(this),this.handleColumnVisibilityChanged=this.handleColumnVisibilityChanged.bind(this),this.handleColumnVisibilityReset=this.handleColumnVisibilityReset.bind(this),this.handleCrossColumnSearch=this.handleCrossColumnSearch.bind(this),this.handleRollupChange=this.handleRollupChange.bind(this),this.handleOverflowClose=this.handleOverflowClose.bind(this),this.getColumnBoundingRect=this.getColumnBoundingRect.bind(this),this.handleGotoRowSelectedRowNumberChanged=this.handleGotoRowSelectedRowNumberChanged.bind(this),this.handleGotoValueSelectedColumnNameChanged=this.handleGotoValueSelectedColumnNameChanged.bind(this),this.handleGotoValueSelectedFilterChanged=this.handleGotoValueSelectedFilterChanged.bind(this),this.handleGotoValueChanged=this.handleGotoValueChanged.bind(this),this.handleGotoValueSubmitted=this.handleGotoValueSubmitted.bind(this),this.grid=null,this.gridWrapper=null,this.lastLoadedConfig=null,this.pending=new bi,this.globalColumnFormats=ye,this.decimalFormatOptions={},this.integerFormatOptions={},this.truncateNumbersWithPound=!1,this.renderer=new mo,this.tableSaver=null,this.crossColumnRef=te.createRef(),this.isAnimating=!1,this.filterInputRef=te.createRef(),this.toggleFilterBarAction={action:()=>this.toggleFilterBar(),shortcut:Lt.TABLE.TOGGLE_QUICK_FILTER},this.toggleSearchBarAction={action:()=>this.toggleSearchBar(),shortcut:Lt.TABLE.TOGGLE_SEARCH},this.toggleGotoRowAction={action:()=>this.toggleGotoRow(),shortcut:Lt.TABLE.GOTO_ROW},this.discardAction={action:()=>{const{model:_}=this.props;He(_)&&_.isEditable&&_.pendingDataMap.size>0&&this.discardPending().catch(le.error)},shortcut:Lt.INPUT_TABLE.DISCARD},this.commitAction={action:()=>{const{model:_}=this.props;He(_)&&_.isEditable&&_.pendingDataMap.size>0&&_.pendingDataErrors.size===0&&this.commitPending().catch(le.error)},shortcut:Lt.INPUT_TABLE.COMMIT},this.contextActions=[this.toggleFilterBarAction,this.toggleSearchBarAction,this.toggleGotoRowAction,this.discardAction,this.commitAction];const{aggregationSettings:t,conditionalFormats:n,customColumnFormatMap:s,isFilterBarShown:o,isSelectingPartition:i,model:r,movedColumns:l,movedRows:a,partition:c,partitionColumn:d,rollupConfig:u,userColumnWidths:m,userRowHeights:p,showSearchBar:g,searchValue:f,selectedSearchColumns:w,invertSearchColumns:C,advancedFilters:S,quickFilters:b,selectDistinctColumns:E,pendingDataMap:v,canCopy:y,frozenColumns:M,columnHeaderGroups:A}=e,F=[new Qm(this),new jm(this)];y&&F.push(new Km(this));const V=[new Zm(this),new op(this),new Jm(this),new ep(this),new ip(this),new sp(this),new rn(this),new np(this),new rp(this)],H=l.length>0?l:r.initialMovedColumns,N=a.length>0?a:r.initialMovedRows,P=new cp({userColumnWidths:new Map(m),userRowHeights:new Map(p),movedColumns:H,initialColumnWidths:new Map((G=(K=r==null?void 0:r.layoutHints)==null?void 0:K.hiddenColumns)==null?void 0:G.map(_=>[r.getColumnIndexByName(_),0]))}),k=w!=null?w:[],z=jo.createSearchFilter(f,k,r.columns,C);this.state={isFilterBarShown:o,isSelectingPartition:i,focusedFilterBarColumn:null,metricCalculator:P,metrics:void 0,keyHandlers:F,mouseHandlers:V,partition:c,partitionColumn:d,partitionTable:null,partitionFilters:[],quickFilters:b?new Map(b):new Map,advancedFilters:new Map(S),shownAdvancedFilter:null,hoverAdvancedFilter:null,sorts:[],reverseType:x.REVERSE_TYPE.NONE,customColumns:[],selectDistinctColumns:E,selectedRanges:[],copyOperation:null,loadingText:null,loadingScrimProgress:null,loadingSpinnerShown:!1,movedColumns:H,movedRows:N,shownColumnTooltip:null,formatter:new tn,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:z,searchValue:f,selectedSearchColumns:k,invertSearchColumns:C,rollupConfig:u,rollupSelectedColumns:[],aggregationSettings:t,selectedAggregation:null,openOptions:[],pendingRowCount:0,pendingDataMap:v!=null?v:new Map,pendingDataErrors:new Map,pendingSavePromise:null,pendingSaveError:null,toastMessage:null,frozenColumns:M,showOverflowModal:!1,overflowText:"",overflowButtonTooltipProps:null,expandCellTooltipProps:null,expandTooltipDisplayValue:"expand",isGotoShown:!1,gotoRow:"",gotoRowError:"",gotoValueError:"",gotoValueSelectedColumnName:r.columns[0].name,gotoValueSelectedFilter:U.eq,gotoValue:"",columnHeaderGroups:A!=null?A:r.initialColumnHeaderGroups}}static makeQuickFilter(e,t,n){try{return x.makeQuickFilter(e,t,n)}catch(s){le.error("Error creating quick filter",s)}return null}componentDidMount(){const{partitionColumn:e,model:t}=this.props,n=e!=null?e:t.columns.find(s=>s.isPartitionColumn);t.isFilterRequired&&t.isValuesTableAvailable&&n!=null?this.loadPartitionsTable(n):this.initState(),this.startListening(t)}componentDidUpdate(e){var d;const{inputFilters:t,isSelectingColumn:n,settings:s,model:o,customFilters:i,sorts:r}=this.props;o!==e.model&&(this.stopListening(e.model),this.startListening(o));const l=t!==e.inputFilters?t.filter(u=>!e.inputFilters.includes(u)):[];if(l.length>0){const{advancedSettings:u}=this.props,m=(d=u.get(fs.FILTER_CONTROL_CHANGE_CLEARS_ALL_FILTERS))!=null?d:!1;m&&(this.clearGridInputField(),this.clearCrossColumSearch()),this.startLoading("Filtering...",!0),this.applyInputFilters(l,m)}n!==e.isSelectingColumn&&this.resetColumnSelection(),s!==e.settings&&this.updateFormatterSettings(s),i!==e.customFilters&&this.startLoading("Filtering...",!0),r!==e.sorts&&this.updateSorts(r);const{loadingScrimStartTime:a,loadingScrimFinishTime:c}=this;a!=null&&c!=null&&window.requestAnimationFrame(()=>{const u=Date.now(),m=u-a,p=c-a,g=Math.min(m/p,1);c<u&&(this.loadingScrimStartTime=void 0,this.loadingScrimFinishTime=void 0),this.setState(f=>f.loadingScrimProgress==null?(le.debug2("Ignoring scrim update because loading cancelled."),null):{loadingScrimProgress:g})}),this.sendStateChange()}componentWillUnmount(){const{model:e}=this.props;this.stopListening(e),this.pending.cancel(),this.updateSearchFilter.cancel(),this.loadingTimer&&clearTimeout(this.loadingTimer),this.handleDownloadProgressUpdate.cancel(),this.animationFrame!==void 0&&cancelAnimationFrame(this.animationFrame)}getValueForCell(e,t,n=!1){const{model:s}=this.props,o=this.getModelColumn(e),i=this.getModelRow(t);if(n&&o!=null&&i!=null){const r=s.valueForCell(o,i);if(x.isDateType(s.columns[o].type)){const{formatter:l}=s;return I.i18n.DateTimeFormat.format(Jf,r,I.i18n.TimeZone.getTimeZone(l.timeZone))}return r}return n?null:o!=null&&i!=null?s.textForCell(o,i):""}getModelColumn(e){const{metrics:t}=this.state;O(t);const{modelColumns:n}=t;return n==null?null:e!=null?n.get(e):null}getModelRow(e){const{metrics:t}=this.state;O(t);const{modelRows:n}=t;return n==null?null:e!=null?n.get(e):null}getTheme(){var n;const{model:e,theme:t}=this.props;return this.getCachedTheme(t,(n=He(e)&&e.isEditable)!=null?n:!1,e.floatingTopRowCount+e.floatingBottomRowCount)}getVisibleColumn(e){const{movedColumns:t}=this.state;return W.getVisibleIndex(e,t)}applyInputFilters(e,t=!1){const{model:n}=this.props,{advancedFilters:s,quickFilters:o}=this.state,i=t?new Map:new Map(s),r=t?new Map:new Map(o);let l=t&&s.size>0;e.forEach(({name:a,type:c,value:d})=>{const u=n.columns.findIndex(({name:m,type:p})=>m===a&&p===c);u>=0?(l=i.delete(u)||l,l=this.applyQuickFilter(u,d,r)||l):le.error("Unable to find column for inputFilter",a,c,d)}),l&&this.setState({quickFilters:r,advancedFilters:i})}applyQuickFilter(e,t,n){const{model:s}=this.props,{formatter:o}=s,i=s.columns[e];if(t!=null&&`${t}`.trim().length>0){const r=n.get(e);if(r!=null){const{text:l}=r;if(l===t)return le.debug2("Ignoring change to existing filter"),!1}return n.set(e,{text:t,filter:Gn.makeQuickFilter(i,t,o.timeZone)}),!0}return n.delete(e)}setAdvancedFilterMap(e){this.setState({advancedFilters:e})}setAdvancedFilter(e,t,n){le.debug("Setting advanced filter",e,t),this.startLoading("Filtering...",!0),this.setState(({advancedFilters:s})=>{const o=new Map(s);return t==null?o.delete(e):o.set(e,{filter:t,options:n}),{advancedFilters:o}})}setQuickFilter(e,t,n){le.debug("Setting quick filter",e,t,n),this.startLoading("Filtering...",!0),this.setState(({quickFilters:s})=>{const o=new Map(s);return o.set(e,{filter:t,text:n}),{quickFilters:o}})}setFilterMap(e){var o;le.debug("setFilterMap",e);const{advancedSettings:t}=this.props;((o=t.get(fs.LINK_CHANGE_CLEARS_ALL_FILTERS))!=null?o:!1)&&this.clearAllFilters();const{model:s}=this.props;e.forEach(({columnType:i,filterList:r},l)=>{const a=s.columns.find(u=>u.name===l&&u.type===i);if(a==null)return;const c=s.getColumnIndexByName(a.name);O(c);const d=ne.combineFiltersFromList(i,r);if(d.length===0)this.removeQuickFilter(c);else{const{formatter:u}=s;this.setQuickFilter(c,Gn.makeQuickFilter(a,d,u.timeZone),`${d}`)}})}removeColumnFilter(e){this.startLoading("Filtering...",!0),this.setState(({advancedFilters:t,quickFilters:n})=>{const s=t?new Map(t):new Map,o=n?new Map(n):new Map;return o.delete(e),s.delete(e),{quickFilters:o,advancedFilters:s}})}removeQuickFilter(e){this.startLoading("Clearing Filter...",!0),this.setState(({quickFilters:t})=>{const n=new Map(t);return n.delete(e),{quickFilters:n}})}clearAllFilters(){le.debug("Clearing all filters");const{advancedFilters:e,quickFilters:t,searchFilter:n}=this.state;t.size===0&&e.size===0&&n===null||(this.clearGridInputField(),this.startLoading("Clearing Filters...",!0),this.setState({quickFilters:new Map,advancedFilters:new Map,searchValue:"",searchFilter:void 0}))}clearCrossColumSearch(){le.debug("Clearing cross-column search"),this.setState({searchValue:"",searchFilter:void 0})}clearGridInputField(){this.filterInputRef.current!=null&&this.filterInputRef.current.setValue("")}rebuildFilters(){le.debug("Rebuilding filters");const{model:e}=this.props,{advancedFilters:t,quickFilters:n}=this.state,{columns:s,formatter:o}=e,i=new Map,r=new Map;t.forEach((l,a)=>{const{options:c}=l,d=s[a],u=x.makeAdvancedFilter(d,c,o.timeZone);i.set(a,{options:c,filter:u})}),n.forEach((l,a)=>{const{text:c}=l,d=s[a];r.set(a,{text:c,filter:Gn.makeQuickFilter(d,c,o.timeZone)})}),this.startLoading("Rebuilding filters...",!0),this.setState({quickFilters:r,advancedFilters:i})}setFilters({quickFilters:e,advancedFilters:t}){this.setState({quickFilters:e,advancedFilters:t})}updateFormatterSettings(e,t=!0){var m,p,g;const n=ms.getColumnFormats(e),s=ms.getDateTimeFormatterOptions(e),o=(m=e==null?void 0:e.defaultDecimalFormatOptions)!=null?m:{},i=(p=e==null?void 0:e.defaultIntegerFormatOptions)!=null?p:{},r=(g=e==null?void 0:e.truncateNumbersWithPound)!=null?g:!1,l=!ct(this.globalColumnFormats,n),a=!ct(this.dateTimeFormatterOptions,s),c=!ct(this.decimalFormatOptions,e==null?void 0:e.defaultDecimalFormatOptions),d=!ct(this.integerFormatOptions,i),u=this.truncateNumbersWithPound!==r;(l||a||c||d||u)&&(this.globalColumnFormats=n,this.dateTimeFormatterOptions=s,this.decimalFormatOptions=o,this.integerFormatOptions=i,this.truncateNumbersWithPound=r,this.updateFormatter({},t),a&&t&&this.rebuildFilters())}updateFormatter(e,t=!0){var r;const{customColumnFormatMap:n}=this.state,s={customColumnFormatMap:n,...e},o=[...(r=this.globalColumnFormats)!=null?r:[],...s.customColumnFormatMap.values()],i=new tn(o,this.dateTimeFormatterOptions,this.decimalFormatOptions,this.integerFormatOptions,this.truncateNumbersWithPound);le.debug("updateFormatter",this.globalColumnFormats,o),this.setState({...s,formatter:i},()=>{t&&this.grid&&this.grid.forceUpdate()})}initFormatter(){const{settings:e}=this.props;this.updateFormatterSettings(e)}initState(){const{applyInputFiltersOnInit:e,inputFilters:t,sorts:n,model:s,reverseType:o,customColumns:i,searchValue:r,selectedSearchColumns:l,invertSearchColumns:a}=this.props,c=l!=null?l:[],d=jo.createSearchFilter(r,c,s.columns,a);if(e){const u=t.filter(m=>m.value!=null);this.applyInputFilters(u)}this.setState({sorts:n,reverseType:o,customColumns:i,isReady:!0,searchFilter:d}),this.initFormatter()}async loadPartitionsTable(e){const{model:t}=this.props;this.setState({isSelectingPartition:!0});try{const n=await this.pending.add(t.valuesTable(e),r=>r.close()),s=n.columns[0],o=s.sort().desc();n.applySort([o]),n.setViewport(0,0,[s]);const i=await this.pending.add(n.getViewportData());if(i.rows.length>0){const l=i.rows[0].get(s);this.updatePartition(l,e),this.setState({isSelectingPartition:!0})}else le.info("Table does not have any data, just fetching all"),this.setState({isSelectingPartition:!1}),this.handlePartitionFetchAll();this.setState({partitionTable:n,partitionColumn:e},()=>{this.initState()})}catch(n){this.handleTableLoadError(n)}}updatePartition(e,t){const s=[t.filter().eq(I.FilterValue.ofString(e))];this.setState({partition:e,partitionFilters:s})}copyCell(e,t,n=!1){const{canCopy:s}=this.props;if(s){const o=String(this.getValueForCell(e,t,n));fo(o).catch(i=>le.error("Unable to copy cell",i))}else le.error("Attempted to copyCell for user without copy permission.")}copyRanges(e,t=!1,n=!0,s){const{model:o,canCopy:i}=this.props,{metricCalculator:r,movedColumns:l}=this.state,a=r.getUserColumnWidths();if(i){const c={ranges:ee.boundedRanges(e,o.columnCount,o.rowCount),includeHeaders:t,formatValues:n,movedColumns:l,userColumnWidths:a,error:s};this.setState({copyOperation:c})}else le.error("Attempted copyRanges for user without copy permission.")}startLoading(e,t=!1){var s,o;this.setState({loadingText:e});const n=this.getTheme();if(t&&this.grid&&(this.grid.clearSelectedRanges(),this.grid.setViewState({top:0},!0)),this.loadingScrimStartTime==null){const{minScrimTransitionTime:i,maxScrimTransitionTime:r}=n;O(i),O(r);const l=(o=(s=this.gridWrapper)==null?void 0:s.getBoundingClientRect().height)!=null?o:0,a=Math.max(i,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})},Gn.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){le.debug("loading last loading config",this.lastLoadedConfig);const{advancedFilters:e,aggregationSettings:t,customColumns:n,quickFilters:s,reverseType:o,rollupConfig:i,searchFilter:r,selectDistinctColumns:l,sorts:a}=this.lastLoadedConfig;this.lastLoadedConfig=null,this.setState({advancedFilters:e,aggregationSettings:t,customColumns:n,quickFilters:s,reverseType:o,rollupConfig:i,searchFilter:r,selectDistinctColumns:l,sorts:a})}else le.debug("remove all sorts, filters, and custom columns"),this.setState({advancedFilters:new Map,aggregationSettings:Nc,customColumns:[],quickFilters:new Map,reverseType:x.REVERSE_TYPE.NONE,rollupConfig:void 0,selectDistinctColumns:[],sorts:[]})}canRollback(){return this.lastLoadedConfig!=null||!jl(this.state)}startListening(e){e.addEventListener(me.EVENT.UPDATED,this.handleUpdate),e.addEventListener(me.EVENT.REQUEST_FAILED,this.handleRequestFailed),e.addEventListener(me.EVENT.COLUMNS_CHANGED,this.handleCustomColumnsChanged),e.addEventListener(me.EVENT.PENDING_DATA_UPDATED,this.handlePendingDataUpdated)}stopListening(e){e.removeEventListener(me.EVENT.UPDATED,this.handleUpdate),e.removeEventListener(me.EVENT.REQUEST_FAILED,this.handleRequestFailed),e.removeEventListener(me.EVENT.COLUMNS_CHANGED,this.handleCustomColumnsChanged),e.removeEventListener(me.EVENT.PENDING_DATA_UPDATED,this.handlePendingDataUpdated)}focus(){var e;(e=this.grid)==null||e.focus()}focusFilterBar(e){var d,u,m;const{movedColumns:t}=this.state,{model:n}=this.props,{columnCount:s}=n,o=W.getModelIndex(e,t);if(e==null||e<0||s<=e||!n.isFilterable(o)){this.setState({focusedFilterBarColumn:null});return}const{metricCalculator:i,metrics:r}=this.state;O(r);const{left:l,rightVisible:a,lastLeft:c}=r;if(e<l)(d=this.grid)==null||d.setViewState({left:e},!0);else if(a<e){const p=(u=this.grid)==null?void 0:u.getMetricState();O(p);const g=i.getLastLeft(p,e,i.getVisibleWidth(p));(m=this.grid)==null||m.setViewState({left:Math.min(g,c),leftOffset:0},!0)}this.lastFocusedFilterBarColumn=e,this.setState({focusedFilterBarColumn:e,isFilterBarShown:!0})}hideColumnByVisibleIndex(e){var s;const{metricCalculator:t,movedColumns:n}=this.state;t.setColumnWidth(W.getModelIndex(e,n),0),(s=this.grid)==null||s.forceUpdate()}freezeColumnByColumnName(e){const{frozenColumns:t,movedColumns:n}=this.state,{model:s}=this.props;le.debug2("freezing column",e);const o=t==null?new Set(s.frozenColumns):new Set(t);o.add(e);const i=s.getColumnIndexByName(e);O(i);const r=W.getVisibleIndex(i,n),l=W.moveItem(r,o.size-1,n);this.setState({frozenColumns:[...o],movedColumns:l})}unFreezeColumnByColumnName(e){const{frozenColumns:t,movedColumns:n}=this.state,{model:s}=this.props;le.debug2("unfreezing column",e);const o=t==null?new Set(s.frozenColumns):new Set(t);o.delete(e);const i=s.getColumnIndexByName(e);O(i);const r=W.getVisibleIndex(i,n),l=W.moveItem(r,o.size+s.frontColumns.length,n);this.setState({frozenColumns:[...o],movedColumns:l})}handleColumnVisibilityChanged(e,t){var o;const{metricCalculator:n,metrics:s}=this.state;O(s),t?e.forEach(i=>{const r=n.initialColumnWidths.get(i),l=L(s.calculatedColumnWidths,i);r!==l?n.setColumnWidth(i,l):n.resetColumnWidth(i)}):e.forEach(i=>{n.setColumnWidth(i,0)}),(o=this.grid)==null||o.forceUpdate()}handleColumnVisibilityReset(){var s,o;const{metricCalculator:e,metrics:t}=this.state,{model:n}=this.props;O(t);for(let i=0;i<t.columnCount;i+=1)e.resetColumnWidth(i);this.handleMovedColumnsChanged(n.initialMovedColumns),this.handleHeaderGroupsChanged(n.initialColumnHeaderGroups),this.setState({frozenColumns:(o=(s=n.layoutHints)==null?void 0:s.frozenColumns)!=null?o:[]})}handleCrossColumnSearch(e,t,n){const{model:s}=this.props;this.updateSearchFilter(e,t,s.columns,n),this.setState({searchValue:e,selectedSearchColumns:t,invertSearchColumns:n})}handleAnimationLoop(){var e,t;(e=this.grid)==null||e.updateCanvasScale(),(t=this.grid)==null||t.updateCanvas(),this.isAnimating&&(this.animationFrame=requestAnimationFrame(this.handleAnimationLoop))}handleAnimationStart(){le.debug2("handleAnimationStart"),this.isAnimating=!0,this.animationFrame=requestAnimationFrame(this.handleAnimationLoop)}handleAnimationEnd(){le.debug2("handleAnimationEnd"),this.isAnimating=!1}handlePartitionAppend(e){const{onPartitionAppend:t}=this.props,{partitionColumn:n}=this.state;n!=null&&t(n,e)}handlePartitionChange(e){const{partitionColumn:t}=this.state;t!=null&&this.updatePartition(e,t)}handlePartitionFetchAll(){this.setState({partitionFilters:[],isSelectingPartition:!1})}handlePartitionDone(){this.setState({isSelectingPartition:!1})}handleTableLoadError(e){if(Ue.isCanceled(e))return;le.error(e);const{onError:t}=this.props;t(e)}showAllColumns(){var s;const{metricCalculator:e}=this.state,n=[...e.getUserColumnWidths().entries()];for(let o=0;o<n.length;o+=1){const[i,r]=n[o];r===0&&e.resetColumnWidth(i)}(s=this.grid)==null||s.forceUpdate()}toggleSort(e,t){le.info("Toggling sort for column",e);const{model:n}=this.props,{sorts:s}=this.state,o=this.getModelColumn(e);O(o);const i=x.toggleSortForColumn(s,n.columns,o,t);this.updateSorts(i)}updateSorts(e){var t;this.startLoading("Sorting..."),this.setState({sorts:e}),(t=this.grid)==null||t.forceUpdate()}sortColumn(e,t=x.sortDirection.none,n=!1,s=!1){var r;O(e);const{model:o}=this.props,i=x.sortColumn(o.sort,o.columns,e,t,n,s);this.startLoading("Sorting..."),this.setState({sorts:i}),(r=this.grid)==null||r.forceUpdate()}reverse(e){var t;this.startLoading("Reversing..."),this.setState({reverseType:e}),(t=this.grid)==null||t.forceUpdate()}isReversible(){const{model:e}=this.props;return e.isReversible}toggleFilterBar(e=this.lastFocusedFilterBarColumn){var n;let{isFilterBarShown:t}=this.state;if(t=!t,this.setState({isFilterBarShown:t}),t)if(e!=null)this.focusFilterBar(e);else{let s=0;const{model:o}=this.props,{columnCount:i}=o;for(let r=0;r<i;r+=1){const l=this.getModelColumn(r);if(l!=null){const a=o.columns[l];if(a!=null&&x.isTextType(a.type)){s=r;break}}}this.focusFilterBar(s)}else(n=this.grid)==null||n.focus()}isTableSearchAvailable(){var s,o,i;const{model:e,canToggleSearch:t}=this.props,n=(s=e==null?void 0:e.layoutHints)==null?void 0:s.searchDisplayMode;return n===((o=I.SearchDisplayMode)==null?void 0:o.SEARCH_DISPLAY_HIDE)?!1:n===((i=I.SearchDisplayMode)==null?void 0:i.SEARCH_DISPLAY_SHOW)?!0:t}toggleSearchBar(){const{showSearchBar:e}=this.state;if(!this.isTableSearchAvailable())return;const t=!e;this.setState({showSearchBar:t},()=>{var n,s,o;t&&((n=this.crossColumnRef)==null?void 0:n.current)?(s=this.crossColumnRef)==null||s.current.focus():(o=this.grid)==null||o.focus()})}toggleGotoRow(e="",t="",n=""){const{isGotoShown:s}=this.state;if(e||t){this.setState({isGotoShown:!0,gotoRow:e,gotoValue:t,gotoValueSelectedColumnName:n,gotoRowError:"",gotoValueError:""}),this.focusRowInGrid(e);return}this.setState({isGotoShown:!s,gotoRow:"",gotoValue:"",gotoRowError:"",gotoValueError:""})}async commitPending(){var o,i;const{model:e}=this.props;if(!He(e)||!e.isEditable)throw new Error("Cannot save, table is not editable");const{pendingSavePromise:t}=this.state;if(t!=null)throw new Error("Save already in progress");const n=(o=document==null?void 0:document.activeElement)==null?void 0:o.classList.contains("grid-cell-input-field");if(n!=null&&n){if(document.activeElement!=null&&document.activeElement.classList.contains("error"))throw new zu("Current input is invalid");(i=this.grid)==null||i.focus()}const s=this.pending.add(e.commitPending()).then(()=>{this.setState({pendingSaveError:null,pendingSavePromise:null})}).catch(r=>{Ue.isCanceled(r)||this.setState({pendingSaveError:r,pendingSavePromise:null})});return this.setState({pendingSavePromise:s}),s}async discardPending(){const{pendingSavePromise:e}=this.state;if(e!=null)throw new Error("Cannot cancel a save in progress");this.setState({pendingSavePromise:null,pendingSaveError:null,pendingDataMap:new Map,pendingDataErrors:new Map})}selectColumn(e){const{onColumnSelected:t}=this.props;t(e)}selectData(e,t){const{model:n}=this.props,{columns:s,groupedColumns:o}=n,i={};for(let l=0;l<s.length;l+=1){const a=s[l],{name:c,type:d}=a,u=n.valueForCell(l,t),m=n.textForCell(l,t),p=this.getVisibleColumn(l),g=ke(n)&&n.isRowExpandable(t),f=o.find(w=>w.name===c)!=null;i[c]={value:u,text:m,type:d,isGrouped:f,isExpandable:g,visibleIndex:p}}const{onDataSelected:r}=this.props;r(t,i)}handleAdvancedFilterChange(e,t,n){const{model:s}=this.props,o=s.getColumnIndexByName(e.name);O(o),this.setAdvancedFilter(o,t,n)}handleAdvancedFilterSortChange(e,t,n=!1){var a;const{model:s}=this.props,o=s.getColumnIndexByName(e.name);O(o);const i=x.getSortForColumn(s.sort,o);let r=null;(i==null||i.direction!==t)&&(t===x.sortDirection.descending?r=e.sort().desc():r=e.sort().asc());const l=x.setSortForColumn(s.sort,o,r,n);le.info("Setting table sorts",l),this.startLoading("Sorting..."),this.setState({sorts:l}),(a=this.grid)==null||a.forceUpdate()}handleAdvancedFilterDone(){var e;(e=this.grid)==null||e.focus()}handleAdvancedMenuOpened(e){this.setState({shownAdvancedFilter:e})}handleGotoRowOpened(){this.setState({isGotoShown:!0})}handleGotoRowClosed(){this.setState({isGotoShown:!1})}handleAdvancedMenuClosed(e){var s,o;const{focusedFilterBarColumn:t,isFilterBarShown:n}=this.state;n&&t===e&&((s=this.filterInputRef)==null?void 0:s.current)!==null?((o=this.filterInputRef)==null||o.current.focus(),this.setState({shownAdvancedFilter:null})):this.setState({focusedFilterBarColumn:null,shownAdvancedFilter:null})}handleCancel(){this.rollback()}handleChartChange(){}handleChartCreate(e){const{model:t,onCreateChart:n}=this.props;n(e,t)}handleGridError(e){le.warn("Grid Error",e),this.setState({toastMessage:h("div",{className:"error-message",children:`${e}`})})}handleFilterBarChange(e){this.startLoading("Filtering...",!0),this.setState(({focusedFilterBarColumn:t,quickFilters:n})=>{const s=new Map(n);if(t!=null){const o=this.getModelColumn(t);O(o),this.applyQuickFilter(o,e,s)}return{quickFilters:s}})}handleFilterBarDone(e=!0,t=!0){var n;e&&((n=this.grid)==null||n.focus()),t&&this.setState({focusedFilterBarColumn:null})}handleFilterBarTab(e){const{focusedFilterBarColumn:t}=this.state;O(t),e?this.focusFilterBar(t-1):this.focusFilterBar(t+1)}handleFormatSelection(e,t){const{model:n}=this.props,s=n.columns[e],{customColumnFormatMap:o}=this.state,i=new Map(o);if(t!=null){const r=x.getNormalizedType(s.type);O(r);const l=tn.makeColumnFormattingRule(r,s.name,t);i.set(s.name,l)}else i.delete(s.name);this.updateFormatter({customColumnFormatMap:i})}handleMenu(e){e.stopPropagation(),this.setState({isMenuShown:!0})}handleMenuClose(){this.setState({isMenuShown:!1,openOptions:[]})}handleMenuBack(){this.setState(({openOptions:e})=>{const t=[...e];return t.pop(),{openOptions:t}})}handleMenuSelect(e){this.setState(({openOptions:t})=>({openOptions:[...t,e]}))}handleRequestFailed(e){const t=e;if(le.error("request failed:",t.detail),this.stopLoading(),this.canRollback())this.startLoading("Rolling back changes...",!0),this.rollback();else{le.error("Table failed and unable to rollback");const{onError:n}=this.props;n(new Error(`Error displaying table: ${t.detail}`))}}handleUpdate(){var d;this.stopLoading(),le.debug2("Received model update");const{advancedFilters:e,aggregationSettings:t,customColumns:n,quickFilters:s,reverseType:o,rollupConfig:i,searchFilter:r,selectDistinctColumns:l,sorts:a}=this.state,c={advancedFilters:e,aggregationSettings:t,customColumns:n,quickFilters:s,reverseType:o,rollupConfig:i,searchFilter:r,selectDistinctColumns:l,sorts:a};jl(c)?this.lastLoadedConfig=null:this.lastLoadedConfig=c,(d=this.grid)==null||d.forceUpdate()}handleViewChanged(e){var o,i;const{model:t}=this.props,{selectionEndRow:n=0}=(i=(o=this.grid)==null?void 0:o.state)!=null?i:{};let s=0;if(He(t)&&t.isEditable){O(e);const{bottomViewport:r}=e,l=t.rowCount-t.floatingBottomRowCount;n===l-1?s=t.pendingRowCount+1:n===l-2?s=t.pendingRowCount:s=Math.max(0,r-(t.rowCount-t.pendingRowCount)-t.floatingTopRowCount-t.floatingBottomRowCount-1)}this.setState({metrics:e,pendingRowCount:s})}handleSelectionChanged(e){O(e);const{onSelectionChanged:t}=this.props,{copyOperation:n}=this.state;this.setState({selectedRanges:e}),n!=null&&this.setState({copyOperation:null}),t(e)}handleMovedColumnsChanged(e,t){this.setState({movedColumns:e},t)}handleHeaderGroupsChanged(e){const{model:t}=this.props;this.setState({columnHeaderGroups:ne.parseColumnHeaderGroups(t,e).groups},()=>{var n;return(n=this.grid)==null?void 0:n.forceUpdate()})}handleTooltipRef(e){e!=null&&e.startTimer(),this.tooltip=e}handleConditionalFormatsChange(e){le.debug("Updated conditional formats",e),this.setState({conditionalFormats:e})}handleConditionalFormatCreate(){le.debug("Create new conditional format");const{openOptions:e,conditionalFormats:t}=this.state;this.setState({openOptions:[...e,{type:ve.CONDITIONAL_FORMATTING_EDIT,title:"Create Formatting Rule"}],conditionalFormatEditIndex:t.length,conditionalFormatPreview:void 0})}handleConditionalFormatEdit(e){le.debug("Edit conditional format",e);const{openOptions:t,conditionalFormats:n}=this.state;this.setState({openOptions:[...t,{type:ve.CONDITIONAL_FORMATTING_EDIT,title:"Edit Formatting Rule"}],conditionalFormatEditIndex:e,conditionalFormatPreview:{...n[e]}})}handleConditionalFormatEditorSave(e){le.debug("Save conditional format changes",e),this.setState(t=>{if(t.conditionalFormatEditIndex===null)return le.debug("Invalid format index"),null;const n=[...t.conditionalFormats];return n[t.conditionalFormatEditIndex]=e,{conditionalFormats:n}},()=>{this.handleMenuBack()})}handleConditionalFormatEditorCancel(){this.handleMenuBack(),this.setState({conditionalFormatEditIndex:null})}handleUpdateCustomColumns(e){le.info("handleUpdateCustomColumns:",e);const{model:t}=this.props,{movedColumns:n,sorts:s,quickFilters:o,advancedFilters:i,selectDistinctColumns:r}=this.state,{columns:l}=t,a=t.customColumns.map(d=>`${d}`),c=ne.getRemovedCustomColumnNames(a,e);if(c.length>0){const d=ne.removeSortsInColumns(s,c),u=ne.removeFiltersInColumns(l,o,c),m=ne.removeFiltersInColumns(l,i,c),p=ne.removeColumnFromMovedColumns(l,n,c),g=ne.removeColumnsFromSelectDistinctColumns(r,c);d.length!==s.length&&(le.debug("removing sorts from removed custom columns..."),this.setState({sorts:d})),(u.size!==o.size||m.size!==i.size)&&(le.debug("removing filters from removed custom columns..."),this.setState({quickFilters:u,advancedFilters:m})),ct(n,p)||(le.debug("change moved columns for removed custom columns",p),this.setState({movedColumns:p})),ct(r,g)||(le.debug("change selectDistinct columns for removed custom columns",p),this.setState({selectDistinctColumns:g}))}this.setState({customColumns:e}),e.length>0&&this.startLoading("Applying custom columns...")}handleCustomColumnsChanged(){var t;le.debug("custom columns changed");const{isReady:e}=this.state;e?(this.stopLoading(),(t=this.grid)==null||t.forceUpdate()):this.initState()}handlePendingCommitClicked(){return this.commitPending()}handlePendingDiscardClicked(){return this.discardPending()}handlePendingDataUpdated(){var s;le.debug("pending data updated");const{model:e}=this.props,{pendingDataMap:t,pendingDataErrors:n}=e;this.setState({pendingDataMap:t,pendingDataErrors:n,pendingSaveError:null}),(s=this.grid)==null||s.forceUpdate()}handleAggregationsChange(e){le.debug("handleAggregationsChange",e),this.startLoading(`Aggregating ${e.aggregations.map(t=>t.operation).join(", ")}...`),this.setState({aggregationSettings:e})}handleAggregationChange(e){le.debug("handleAggregationChange",e),this.startLoading(`Aggregating ${e.operation}...`),this.setState(({aggregationSettings:t})=>({selectedAggregation:e,aggregationSettings:{...t,aggregations:t.aggregations.map(n=>n.operation===e.operation?e:n)}}))}handleAggregationEdit(e){le.debug("handleAggregationEdit",e);const{openOptions:t}=this.state;this.setState({openOptions:[...t,{type:ve.AGGREGATION_EDIT,title:`Edit Columns to ${e.operation}`}],selectedAggregation:e})}handleRollupChange(e){var t,n;le.info("Rollup change",e),this.resetGridViewState(),this.showAllColumns(),this.clearAllFilters(),this.startLoading(`Grouping by columns ${(n=(t=e==null?void 0:e.columns)==null?void 0:t.join(", "))!=null?n:""}...`),this.setState({rollupConfig:e,movedColumns:[],sorts:[],reverseType:x.REVERSE_TYPE.NONE,selectDistinctColumns:[]})}handleSelectDistinctChanged(e){le.debug("SelectDistinct change",e),this.resetGridViewState(),this.showAllColumns(),this.clearAllFilters(),this.startLoading(`Selecting distinct values in ${e.length>0?e.join(", "):""}...`),this.setState({selectDistinctColumns:e,movedColumns:[],sorts:[],reverseType:x.REVERSE_TYPE.NONE})}handleDownloadTableStart(){const{canDownloadCsv:e}=this.props;e?this.setState({isTableDownloading:!0,tableDownloadProgress:0,tableDownloadEstimatedTime:null,tableDownloadStatus:Tt.DOWNLOAD_STATUS.INITIATING}):le.error("Attempted to handleDownloadTableStart for user without download CSV permission.")}handleDownloadTable(e,t,n,s,o,i,r){const{canDownloadCsv:l}=this.props;l?(le.info("start table downloading",e,t,n,s,o,i,r),this.setState(()=>(this.tableSaver&&this.tableSaver.startDownload(e,t,n,s,o,i,r),{tableDownloadStatus:Tt.DOWNLOAD_STATUS.DOWNLOADING}))):le.error("Attempted to handleDownloadTable for user without download CSV permission.")}async seekRow(e,t=!1){var d;const{gotoValueSelectedColumnName:n,gotoValueSelectedFilter:s}=this.state,{model:o}=this.props;if(!o.isSeekRowAvailable||e==="")return;const i=o.getColumnIndexByName(n);if(i===void 0)return;const r=o.columns[i];let l;this.grid&&({selectionEndRow:l}=this.grid.state),l==null&&(l=0);const a=s===U.contains,c=s===U.eq||s===U.eqIgnoreCase;try{const u=x.getNormalizedType(r.type);let m;switch(u){case x.dataType.STRING:{m=await o.seekRow(t===!0?l-1:l+1,r,I.ValueType.STRING,e,c,a,t!=null?t:!1);break}case x.dataType.DATETIME:{const{formatter:p}=o,[g]=Tn.parseDateRange(e,p.timeZone);m=await o.seekRow(t===!0?l-1:l+1,r,I.ValueType.DATETIME,g,void 0,void 0,t!=null?t:!1);break}case x.dataType.DECIMAL:case x.dataType.INT:{if(!x.isBigDecimalType(r.type)&&!x.isBigIntegerType(r.type)){const p=parseInt(e,10);m=await o.seekRow(l,r,I.ValueType.NUMBER,p,void 0,void 0,t!=null?t:!1)}else m=await o.seekRow(l,r,I.ValueType.STRING,e,void 0,void 0,t!=null?t:!1);break}default:m=await o.seekRow(l,r,I.ValueType.STRING,e,void 0,void 0,t!=null?t:!1)}(d=this.grid)==null||d.setFocusRow(m),this.setState({gotoValueError:""})}catch{this.setState({gotoValueError:"invalid input"})}}handleCancelDownloadTable(){var e;(e=this.tableSaver)==null||e.cancelDownload(),this.setState({isTableDownloading:!1})}handleDownloadCompleted(){this.setState({isTableDownloading:!1,tableDownloadProgress:100,tableDownloadStatus:Tt.DOWNLOAD_STATUS.FINISHED})}handleDownloadCanceled(){this.setState({isTableDownloading:!1,tableDownloadProgress:0,tableDownloadStatus:Tt.DOWNLOAD_STATUS.CANCELED})}deleteRanges(e){const{model:t}=this.props;this.pending.add(t.delete(e)).catch(n=>{Ue.isCanceled(n)||le.error("Unable to delete ranges",e,n)})}resetColumnSelection(){if(this.grid==null)return;const{isSelectingColumn:e}=this.props;if(e){const{columnAllowedCursor:t}=this.props;this.grid.setState({cursor:t})}else this.grid.setState({cursor:null}),this.setState({hoverSelectColumn:null})}resetGridViewState(e=!0){!this.grid||(this.grid.clearSelectedRanges(),this.grid.setViewState({left:0,top:0,topOffset:0,leftOffset:0},e))}sendStateChange(){if(!this.grid)return;const{state:e}=this,{state:t}=this.grid,{onStateChange:n}=this.props;n(e,t)}handleOverflowClose(){this.setState({showOverflowModal:!1})}getColumnBoundingRect(){var m;const{metrics:e,shownColumnTooltip:t}=this.state;O(e),O(t);const n=(m=this.gridWrapper)==null?void 0:m.getBoundingClientRect(),s=20;O(n);const{columnHeaderHeight:o,allColumnXs:i,allColumnWidths:r,width:l,columnHeaderMaxDepth:a}=e,c=i.get(t),d=r.get(t);O(c),O(d);const u=n.left+ze(c+d/2,s,l-s);return{top:n.top+(a-1)*o,left:n.left+ze(c+d/2,s,l-s),bottom:n.top+a*o,right:n.left+ze(c+d/2,s,l-s)+1,width:1,height:o,x:u,y:n.top,toJSON:()=>{throw new Error("not implemented")}}}handleGotoRowSelectedRowNumberSubmit(){const{gotoRow:e}=this.state;this.focusRowInGrid(e)}focusRowInGrid(e){var o,i,r;const{model:t}=this.props,{rowCount:n}=t;if(this.setState({gotoRow:e}),e===""){this.setState({gotoRowError:"",gotoValueError:""});return}const s=parseInt(e,10);s>n||s<-n?this.setState({gotoRowError:"Invalid row index"}):s===0?(this.setState({gotoRowError:"",gotoValueError:""}),(o=this.grid)==null||o.setFocusRow(0)):s<0?(this.setState({gotoRowError:"",gotoValueError:""}),(i=this.grid)==null||i.setFocusRow(s+n)):((r=this.grid)==null||r.setFocusRow(s-1),this.setState({gotoRowError:"",gotoValueError:""}))}handleGotoRowSelectedRowNumberChanged(e){const t=e.target.value;this.focusRowInGrid(t)}getColumnTooltip(e,t,n){const{columnHeaderHeight:s,columnHeaderMaxDepth:o,allColumnXs:i,allColumnWidths:r,width:l}=t,a=i.get(e),c=r.get(e);if(a==null||c==null)return null;const d=Math.max(0,a);let u=c;a+c>l?u=l-a:a<0&&(u=c-Math.abs(a));const m={position:"absolute",top:(o-1)*s,left:d,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(e);if(f==null)return null;const w=n.columns[f];return w==null?null:h("div",{style:m,children:h(We,{timeout:400,interactive:!0,options:g,ref:this.handleTooltipRef,referenceObject:p,onExited:()=>{this.setState({shownColumnTooltip:null})},children:h(Xa,{model:n,column:w,onStatistics:()=>{var C;(C=this.tooltip)==null||C.update()}})},w.name)})}handleGotoValueSelectedColumnNameChanged(e){this.setState({gotoValueSelectedColumnName:e,gotoValueError:""})}handleGotoValueSelectedFilterChanged(e){this.setState({gotoValueSelectedFilter:e,gotoValueError:""})}handleGotoValueSubmitted(e){const{gotoValue:t}=this.state;this.seekRow(t,e)}render(){var Vo,Uo,Bo,$e,vs,qr,Kr,Xr,Yr;const{children:e,customFilters:t,getDownloadWorker:n,isSelectingColumn:s,isStuckToBottom:o,isStuckToRight:i,model:r,name:l,onlyFetchVisibleColumns:a,alwaysFetchColumns:c,advancedSettings:d,onAdvancedSettingsChange:u,canDownloadCsv:m,onCreateChart:p}=this.props,{metricCalculator:g,metrics:f,isFilterBarShown:w,isSelectingPartition:C,isMenuShown:S,isReady:b,copyOperation:E,focusedFilterBarColumn:v,loadingText:y,loadingScrimProgress:M,loadingSpinnerShown:A,keyHandlers:F,mouseHandlers:V,shownColumnTooltip:H,hoverAdvancedFilter:N,shownAdvancedFilter:P,hoverSelectColumn:k,quickFilters:z,advancedFilters:K,partition:G,partitionFilters:_,partitionTable:q,partitionColumn:Y,searchFilter:J,selectDistinctColumns:de,movedColumns:pe,movedRows:ge,formatter:Te,conditionalFormats:fe,conditionalFormatPreview:nt,conditionalFormatEditIndex:je,sorts:qe,reverseType:Ut,customColumns:yt,selectedRanges:yn,isTableDownloading:Bt,tableDownloadStatus:xe,tableDownloadProgress:we,tableDownloadEstimatedTime:Ze,showSearchBar:Ke,searchValue:ht,selectedSearchColumns:It,invertSearchColumns:In,aggregationSettings:Gt,selectedAggregation:To,rollupConfig:ln,openOptions:Mt,pendingSavePromise:Mn,pendingSaveError:ws,pendingRowCount:Ks,pendingDataErrors:Ss,pendingDataMap:bs,toastMessage:Eo,frozenColumns:Ro,columnHeaderGroups:Dn,showOverflowModal:es,overflowText:Ni,overflowButtonTooltipProps:yo,expandCellTooltipProps:Xs,isGotoShown:Ys,gotoRow:Io,gotoRowError:Mo,gotoValueError:Fi,gotoValueSelectedColumnName:xi,gotoValue:Ai}=this.state;if(!b)return null;const ts=this.getTheme(),Oi=this.getCachedFilter(t,z,K,_,J),Do=g.getUserColumnWidths(),No=this.getCachedStateOverride(k,w,s,M,z,K,qe,Ut,ln,S),Qs=f?f.top:0,Fo=f?f.bottomViewport:0;let Nn=null,js=null;a&&(Nn=f?f.left:0,js=f?f.right:0);const xo=f!=null&&f.width>0&&f.height>0,Ao=((Uo=(Vo=ln==null?void 0:ln.columns)==null?void 0:Vo.length)!=null?Uo:0)>0;let Zs=null;const ki=f?Math.min(Math.max(Gn.minDebounce,Math.round(f.rowCount/200)),Gn.maxDebounce):Gn.maxDebounce;if(w&&v!=null&&f!=null){const{gridX:Pe,gridY:Ct,allColumnXs:Fn,allColumnWidths:Js,width:Ts}=f,zt=Fn.get(v),mt=Js.get(v);if(zt!=null&&mt!=null){const it=Pe+zt,an=Ct-((Bo=ts.filterBarHeight)!=null?Bo:0),ns=mt+1,ss=(($e=ts.filterBarHeight)!=null?$e:0)-1,Go={top:an,left:it,minWidth:Math.min(ns,Ts-it),height:ss};let Wt="",Es=!0;const os=this.getModelColumn(v);O(os);const Rs=z.get(os),xn=K.get(os);Rs!=null&&(Wt=Rs.text,Es=Rs.filter!=null);const ys=z.size!==0||K.size!==0;Zs=h(za,{ref:this.filterInputRef,style:Go,className:B({error:!Es,active:Wt!==""||xn!=null,"iris-grid-has-filter":ys}),isAdvancedFilterSet:xn!=null,onAdvancedFiltersTriggered:()=>{this.setState({shownAdvancedFilter:v})},onChange:this.handleFilterBarChange,onDone:this.handleFilterBarDone,onTab:this.handleFilterBarTab,onContextMenu:(vs=this.grid)==null?void 0:vs.handleContextMenu,debounceMs:ki,value:Wt},v)}}let Oo=null;if(y!=null){const Pe=R("div",{className:"iris-grid-loading-status",children:[h("div",{className:B("iris-grid-loading-status-bar",{show:A}),children:y}),R("button",{type:"button",onClick:this.handleCancel,className:B("iris-grid-btn-cancel",{show:A}),children:[h(Z,{icon:go,transform:"down-1"}),"Cancel"]})]}),Ct=f?f.gridY:0;Oo=h("div",{className:"iris-grid-loading",style:{top:Ct},children:Pe})}let ko=null;H!=null&&f&&(ko=this.getColumnTooltip(H,f,r),(qr=this.tooltip)==null||qr.update());const Lo=[];if(f&&w){const{gridX:Pe,gridY:Ct,visibleColumns:Fn,allColumnXs:Js,allColumnWidths:Ts}=f,{filterBarHeight:zt}=ts;for(let mt=0;mt<Fn.length;mt+=1){const it=Fn[mt],an=Js.get(it),ns=Ts.get(it),ss=this.getModelColumn(it);if(ss!=null&&r.isFilterable(ss)&&an!=null&&ns!=null&&ns>0){const Wt=Pe+an+ns-24,Es=Ct-(zt!=null?zt:0)+2,os={position:"absolute",top:Es,left:Wt},xn=K.get(ss)!=null,ys=it===N||it===v||xn,Pi=h("div",{className:B("advanced-filter-button-container",{hidden:!ys}),style:os,children:ys&&h(X,{kind:"ghost",className:B("btn-link-icon advanced-filter-button",{"filter-set":xn}),onClick:()=>{this.setState({shownAdvancedFilter:it})},onContextMenu:Ac=>{var Qr;(Qr=this.grid)==null||Qr.handleContextMenu(Ac)},onMouseEnter:()=>{this.setState({hoverAdvancedFilter:it})},onMouseLeave:()=>{this.setState({hoverAdvancedFilter:null})},children:R("div",{className:"fa-layers",children:[h(Z,{icon:fr,className:"filter-solid"}),h(Z,{icon:oi,className:"filter-light"})]})})},it);Lo.push(Pi)}}}const Po=[];if(f){const{gridX:Pe,visibleColumns:Ct,allColumnXs:Fn,allColumnWidths:Js,columnHeaderHeight:Ts}=f;for(let zt=0;zt<Ct.length;zt+=1){const mt=Ct[zt],it=Fn.get(mt),an=Js.get(mt);if(it!=null&&an!=null&&an>0){const ns=Pe+it,ss=Pe+it+an-20,Go=w?{position:"absolute",top:Ts,left:ss,width:20,height:ts.filterBarHeight}:{position:"absolute",top:0,left:ns,width:an,height:Ts},Wt=this.getModelColumn(mt);if(Wt!=null){const Es=r.columns[Wt],os=K.get(Wt),{options:Rs}=os||{},xn=x.getSortForColumn(r.sort,Wt),ys=xn?xn.direction:null,Pi=h("div",{className:"advanced-filter-menu-container",style:Go,children:h(En,{className:"advanced-filter-menu-popper",onEntered:this.getAdvancedMenuOpenedHandler(mt),onExited:()=>{this.handleAdvancedMenuClosed(mt)},isShown:P===mt,interactive:!0,closeOnBlur:!0,options:{positionFixed:!0},children:this.getCachedAdvancedFilterMenuActions(r,Es,Rs,ys,Te)})},mt);Po.push(Pi)}}}}const Ho=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,w,Ke,m,this.isTableSearchAvailable(),Ys,d.size>0),_o=this.getCachedHiddenColumns(g,Do),Li=Mt.map(Pe=>{switch(Pe.type){case ve.CHART_BUILDER:return h(ja,{model:r,onChange:this.handleChartChange,onSubmit:this.handleChartCreate},ve.CHART_BUILDER);case ve.VISIBILITY_ORDERING_BUILDER:return h(Vr,{model:r,movedColumns:pe,hiddenColumns:_o,columnHeaderGroups:Dn,onColumnVisibilityChanged:this.handleColumnVisibilityChanged,onReset:this.handleColumnVisibilityReset,onMovedColumnsChanged:this.handleMovedColumnsChanged,onColumnHeaderGroupChanged:this.handleHeaderGroupsChanged},ve.VISIBILITY_ORDERING_BUILDER);case ve.CONDITIONAL_FORMATTING:return h(lg,{rules:fe,onChange:this.handleConditionalFormatsChange,onCreate:this.handleConditionalFormatCreate,onSelect:this.handleConditionalFormatEdit});case ve.CONDITIONAL_FORMATTING_EDIT:return O(r.columns),O(this.handleConditionalFormatEditorUpdate),h(kg,{columns:r.columns,rule:nt,onUpdate:this.handleConditionalFormatEditorUpdate,onSave:this.handleConditionalFormatEditorSave,onCancel:this.handleConditionalFormatEditorCancel});case ve.CUSTOM_COLUMN_BUILDER:return h(Ja,{model:r,customColumns:yt,onSave:this.handleUpdateCustomColumns,onCancel:this.handleMenuBack},ve.CUSTOM_COLUMN_BUILDER);case ve.ROLLUP_ROWS:return h(_r,{model:r,onChange:this.handleRollupChange,config:ln},ve.ROLLUP_ROWS);case ve.AGGREGATIONS:return h(fp,{settings:Gt,isRollup:Ao,onChange:this.handleAggregationsChange,onEdit:this.handleAggregationEdit});case ve.AGGREGATION_EDIT:return To&&h(wp,{aggregation:To,columns:r.originalColumns,onChange:this.handleAggregationChange});case ve.TABLE_EXPORTER:return h(Tt,{model:r,name:l,userColumnWidths:Do,movedColumns:pe,isDownloading:Bt,tableDownloadStatus:xe,tableDownloadProgress:we,tableDownloadEstimatedTime:Ze!=null?Ze:void 0,onDownload:this.handleDownloadTable,onDownloadStart:this.handleDownloadTableStart,onCancel:this.handleCancelDownloadTable,selectedRanges:yn},ve.TABLE_EXPORTER);case ve.SELECT_DISTINCT:return h(ac,{model:r,selectDistinctColumns:de,onChange:this.handleSelectDistinctChanged});case ve.ADVANCED_SETTINGS:return h(Ur,{items:d,onChange:u});default:throw Error(`Unexpected option type ${Pe.type}`)}});return R("div",{className:"iris-grid",role:"presentation",children:[R("div",{className:"iris-grid-column",children:[e!=null&&h("div",{className:"iris-grid-bar",children:e}),h(dt,{in:C,timeout:Le.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:q&&Y&&G!=null&&h(lc,{table:q,getFormattedString:(Pe,Ct,Fn)=>r.displayString(Pe,Ct,Fn),columnName:Y.name,partition:G,onChange:this.handlePartitionChange,onFetchAll:this.handlePartitionFetchAll,onAppend:this.handlePartitionAppend,onDone:this.handlePartitionDone})})}),h(dt,{in:Ke,timeout:Le.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(jo,{value:ht,selectedColumns:It,invertSelection:In,onChange:this.handleCrossColumnSearch,columns:r.columns,ref:this.crossColumnRef})})}),R("div",{className:"grid-wrapper",ref:Pe=>{this.gridWrapper=Pe},children:[h(Ws,{ref:Pe=>{this.grid=Pe},isStickyBottom:!He(r)||!r.isEditable,isStuckToBottom:o,isStuckToRight:i,metricCalculator:g,model:r,keyHandlers:F,mouseHandlers:V,movedColumns:pe,movedRows:ge,onError:this.handleGridError,onViewChanged:this.handleViewChanged,onSelectionChanged:this.handleSelectionChanged,onMovedColumnsChanged:this.handleMovedColumnsChanged,renderer:this.renderer,stateOverride:No,theme:ts}),h($f,{isOpen:es,text:Ni,onClose:this.handleOverflowClose}),xo&&h(qa,{model:r,modelColumns:r.columns,top:Qs,bottom:Fo,left:Nn,right:js,filter:Oi,formatter:Te,sorts:qe,reverseType:Ut,movedColumns:pe,customColumns:yt,hiddenColumns:_o,alwaysFetchColumns:this.getAlwaysFetchColumns(c,r.columns,pe,r.floatingLeftColumnCount,r.floatingRightColumnCount,(Xr=(Kr=this.grid)==null?void 0:Kr.state.draggingColumn)==null?void 0:Xr.range),formatColumns:this.getCachedPreviewFormatColumns(this.getCachedModelColumns(r,yt),fe,nt,((Yr=Mt[Mt.length-1])==null?void 0:Yr.type)===ve.CONDITIONAL_FORMATTING_EDIT&&je!=null?je:void 0),rollupConfig:this.getModelRollupConfig(r.originalColumns,ln,Gt),totalsConfig:this.getModelTotalsConfig(r.columns,ln,Gt),selectDistinctColumns:de,pendingRowCount:Ks,pendingDataMap:bs,frozenColumns:Ro,columnHeaderGroups:Dn}),!S&&h("div",{className:"grid-settings-button",children:h(X,{kind:"ghost","data-testid":`btn-iris-grid-settings-button-${l}`,onClick:this.handleMenu,icon:h(Z,{icon:iu,transform:"up-1"}),tooltip:"Table Options"})}),Zs,Oo,Lo,ko,Po,yo&&this.getOverflowButtonTooltip(yo),Xs&&this.getExpandCellTooltip(Xs)]}),h(Xf,{model:r,isShown:Ys,gotoRow:Io,gotoRowError:Mo,gotoValueError:Fi,onGotoRowSubmit:this.handleGotoRowSelectedRowNumberSubmit,onGotoRowNumberChanged:this.handleGotoRowSelectedRowNumberChanged,onClose:this.handleGotoRowClosed,onEntering:this.handleAnimationStart,onEntered:this.handleAnimationEnd,onExiting:()=>{this.handleAnimationStart(),this.focus()},onExited:this.handleAnimationEnd,gotoValueSelectedColumnName:xi,gotoValue:Ai,onGotoValueSelectedColumnNameChanged:this.handleGotoValueSelectedColumnNameChanged,onGotoValueSelectedFilterChanged:this.handleGotoValueSelectedFilterChanged,onGotoValueChanged:this.handleGotoValueChanged,onGotoValueSubmit:this.handleGotoValueSubmitted}),h(Um,{error:ws,isSaving:Mn!=null,saveTooltip:`Commit (${this.commitAction.shortcut.getDisplayText()})`,discardTooltip:`Discard (${this.discardAction.shortcut.getDisplayText()})`,pendingDataErrors:Ss,pendingDataMap:bs,onEntering:this.handleAnimationStart,onEntered:this.handleAnimationEnd,onExiting:this.handleAnimationStart,onExited:this.handleAnimationEnd,onSave:this.handlePendingCommitClicked,onDiscard:this.handlePendingDiscardClicked}),h(ap,{children:Eo}),h($s,{model:r,copyOperation:E!=null?E:void 0,onEntering:this.handleAnimationStart,onEntered:this.handleAnimationEnd,onExiting:this.handleAnimationStart,onExited:this.handleAnimationEnd}),h(qs,{ref:Pe=>{this.tableSaver=Pe},getDownloadWorker:n,onDownloadCompleted:this.handleDownloadCompleted,onDownloadCanceled:this.handleDownloadCanceled,onDownloadProgressUpdate:this.handleDownloadProgressUpdate,isDownloading:xe===Tt.DOWNLOAD_STATUS.DOWNLOADING,formatter:Te})]}),h(dt,{in:S,timeout:Le.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:R(mh,{children:[h(fl,{title:"Table Options",onClose:this.handleMenuClose,children:h(Fa,{onSelect:Pe=>this.handleMenuSelect(Ho[Pe]),items:Ho})}),Li.map((Pe,Ct)=>h(fl,{title:Mt[Ct].title,onBack:this.handleMenuBack,onClose:this.handleMenuClose,children:Pe},Mt[Ct].type))]})})}),h(re,{actions:this.contextActions})]})}};let vo=Gn;vo.minDebounce=150;vo.maxDebounce=500;vo.loadingSpinnerDelay=800;vo.defaultProps={children:null,advancedFilters:wn,advancedSettings:wn,alwaysFetchColumns:ye,conditionalFormats:ye,customColumnFormatMap:wn,isFilterBarShown:!1,applyInputFiltersOnInit:!1,movedColumns:ye,movedRows:ye,inputFilters:ye,customFilters:ye,onCreateChart:void 0,onColumnSelected:()=>{},onDataSelected:()=>{},onError:()=>{},onStateChange:()=>{},onPartitionAppend:()=>{},onAdvancedSettingsChange:()=>{},partition:null,partitionColumn:null,quickFilters:wn,selectDistinctColumns:ye,sorts:ye,reverseType:x.REVERSE_TYPE.NONE,customColumns:ye,aggregationSettings:Nc,rollupConfig:void 0,userColumnWidths:wn,userRowHeights:wn,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:wn,getDownloadWorker:void 0,settings:{timeZone:"America/New_York",defaultDateTimeFormat:Tn.FULL_DATE_FORMAT,showTimeZone:!1,showTSeparator:!0,truncateNumbersWithPound:!1,formatter:ye,decimalFormatOptions:D.exports.shape({defaultFormatString:D.exports.string}),integerFormatOptions:D.exports.shape({defaultFormatString:D.exports.string})},canCopy:!0,canDownloadCsv:!0,frozenColumns:null,theme:Ka,canToggleSearch:!0};class eC extends Error{constructor(t,n){super(`${n} can't be empty (on pending row ${t+1})`),this.isMissingKey=!0,this.rowIndex=t,this.columnName=n}}const Ve=se.module("IrisGridTableModel"),tC=150,nC=0,sC=[];function Jo(e){return e.table!==void 0}const lr=class extends me{constructor(e,t=new tn,n=null){var s,o;super(),this.pendingNewRowCount=0,this._columnHeaderGroupMap=new Map,this.columnHeaderParentMap=new Map,this._columnHeaderMaxDepth=null,this._columnHeaderGroups=[],this._movedColumns=null,this.getMemoizedInitialMovedColumns=Ie(i=>{var g;if(!i)return[];let r=[];const{groupMap:l}=ne.parseColumnHeaderGroups(this,(g=i==null?void 0:i.columnGroups)!=null?g:[]),a=(f,w)=>{const C=this.getColumnIndexByName(f);if(C==null)throw new Error(`Unknown layout hint column: ${f}`);const S=W.getVisibleIndex(C,r);r=W.moveItem(S,w,r)},c=(f,w)=>{const C=l.get(f);if(C==null)throw new Error(`Unknown layout hint group: ${f}`);const S=C.getVisibleRange(r);r=W.moveRange(S,w,r)},{frontColumns:d=[],backColumns:u=[],frozenColumns:m=[]}=i;if(d.length||u.length||m.length){const f=new Set;let w=0;m.forEach(S=>{if(f.has(S))throw new Error(`Column specified in multiple layout hints: ${S}`);a(S,w),w+=1}),d.forEach(S=>{if(f.has(S))throw new Error(`Column specified in multiple layout hints: ${S}`);a(S,w),w+=1});let C=this.columnMap.size-1;u.forEach(S=>{if(f.has(S))throw new Error(`Column specified in multiple layout hints: ${S}`);a(S,C),C-=1})}if(i==null?void 0:i.columnGroups){const f=[...l.values()];f.sort((w,C)=>w.depth-C.depth),f.forEach(w=>{const C=w.children[0],S=this.getColumnIndexByName(C);let b;if(S!=null)b=W.getVisibleIndex(S,r);else{const E=l.get(C);if(!E)throw new Error(`Unknown column ${C} in group ${w.name}`);[,b]=E.getVisibleRange(r)}for(let E=1;E<w.children.length;E+=1){const v=w.children[E],y=l.get(v),M=this.getColumnIndexByName(v);if(y){const F=y.getVisibleRange(r)[0]<b?b-y.childIndexes.length+1:b+1;c(v,F),b=F+y.childIndexes.length-1}else if(M!=null){const F=W.getVisibleIndex(M,r)<b?b:b+1;a(v,F),b=F}}})}return this._movedColumns=r,r}),this.getMemoizedInitialColumnHeaderGroups=Ie(i=>{var r;return ne.parseColumnHeaderGroups(this,(r=i==null?void 0:i.columnGroups)!=null?r:[]).groups}),this.getMemoizedColumnMap=Ie(i=>{const r=new Map;return i.forEach(l=>r.set(l.name,l)),r}),this.getColumnIndicesByNameMap=Ie(i=>{const r=new Map;return i.forEach(({name:l},a)=>r.set(l,a)),r}),this.setViewport=Zn((i,r,l)=>{if(r<i){Ve.error("Invalid viewport",i,r);return}const{viewport:a}=this;if(a!=null&&a.top===i&&a.bottom===r&&a.columns===l){Ve.debug2("Ignoring duplicate viewport",a);return}this.viewport={top:i,bottom:r,columns:l},Ve.debug2("setViewport",this.viewport),this.applyViewport()},tC),this.applyViewport=Zn(()=>{if(!this.viewport)return;Ve.debug2("applyViewport",this.viewport);const{top:i,bottom:r,columns:l}=this.viewport,[a,c]=this.getCachedViewportRowRange(i,r);this.applyBufferedViewport(a,c,l)},nC,{leading:!1}),this.getCachedFormattedString=Et((i,r,l,a,c)=>i.getFormattedString(r,l,a,c),{max:1e4}),this.getCachedCustomColumnFormatFlag=Et(ms.isCustomColumnFormatDefined,{max:1e4}),this.getCachedViewportRowRange=Ie((i,r)=>{const l=r-i,a=Math.max(0,i-l*lr.ROW_BUFFER_PAGES),c=r+l*lr.ROW_BUFFER_PAGES;return[a,c]}),this.getCachedPendingErrors=Ie((i,r,l)=>{const a=new Map;return i.forEach((c,d)=>{var m;const{data:u}=c;for(let p=0;p<l;p+=1)u.has(p)||(a.has(d)||a.set(d,[]),(m=a.get(d))==null||m.push(new eC(d,r[p].name)))}),a}),this.handleTableDisconnect=this.handleTableDisconnect.bind(this),this.handleTableReconnect=this.handleTableReconnect.bind(this),this.handleTableUpdate=this.handleTableUpdate.bind(this),this.handleTotalsUpdate=this.handleTotalsUpdate.bind(this),this.handleRequestFailed=this.handleRequestFailed.bind(this),this.handleCustomColumnsChanged=this.handleCustomColumnsChanged.bind(this),this.irisFormatter=t,this.inputTable=n,this.subscription=null,this.table=e,this.viewport=null,this.viewportData=null,this.formattedStringData=[],this.pendingStringData=[],this.isSaveInProgress=!1,this.totalsTable=null,this.totalsTablePromise=null,this.totals=null,this.totalsDataMap=null,this.pendingNewDataMap=new Map,this.pendingNewRowCount=0,this.columnHeaderGroups=ne.parseColumnHeaderGroups(this,(o=(s=this.layoutHints)==null?void 0:s.columnGroups)!=null?o:[]).groups}seekRow(e,t,n,s,o,i,r){throw new Error("Method not implemented.")}export(){throw new Error("Method not implemented.")}columnStatistics(e){throw new Error("Method not implemented.")}get customColumns(){return[]}set customColumns(e){throw new Error("Method not implemented.")}get formatColumns(){return[]}set formatColumns(e){throw new Error("Method not implemented.")}updateFrozenColumns(e){throw new Error("Method not implemented.")}get rollupConfig(){throw new Error("Method not implemented.")}set rollupConfig(e){throw new Error("Method not implemented.")}get selectDistinctColumns(){throw new Error("Method not implemented.")}set selectDistinctColumns(e){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(I.Table.EVENT_DISCONNECT,this.handleTableDisconnect),this.table.addEventListener(I.Table.EVENT_RECONNECT,this.handleTableReconnect),this.table.addEventListener(I.Table.EVENT_UPDATED,this.handleTableUpdate),this.table.addEventListener(I.Client.EVENT_REQUEST_FAILED,this.handleRequestFailed),this.table.addEventListener(I.Table.EVENT_CUSTOMCOLUMNSCHANGED,this.handleCustomColumnsChanged),this.totalsTable!=null&&this.addTotalsListeners(this.totalsTable),this.applyViewport()}stopListening(){super.stopListening(),this.table.removeEventListener(I.Table.EVENT_DISCONNECT,this.handleTableDisconnect),this.table.removeEventListener(I.Table.EVENT_RECONNECT,this.handleTableReconnect),this.table.removeEventListener(I.Table.EVENT_UPDATED,this.handleTableUpdate),this.table.removeEventListener(I.Client.EVENT_REQUEST_FAILED,this.handleRequestFailed),this.table.removeEventListener(I.Table.EVENT_CUSTOMCOLUMNSCHANGED,this.handleCustomColumnsChanged),this.totalsTable!=null&&this.removeTotalsListeners(this.totalsTable),this.closeSubscription()}addTotalsListeners(e){e.addEventListener(I.Table.EVENT_UPDATED,this.handleTotalsUpdate),e.setViewport(0,0)}removeTotalsListeners(e){e.removeEventListener(I.Table.EVENT_UPDATED,this.handleTotalsUpdate)}handleTableDisconnect(){this.dispatchEvent(new Me(me.EVENT.DISCONNECT))}handleTableReconnect(){this.dispatchEvent(new Me(me.EVENT.RECONNECT))}handleTableUpdate(e){this.copyViewportData(e.detail),this.dispatchEvent(new Me(me.EVENT.UPDATED))}handleTotalsUpdate(e){this.copyTotalsData(e.detail),this.dispatchEvent(new Me(me.EVENT.UPDATED))}handleRequestFailed(e){this.dispatchEvent(new Me(me.EVENT.REQUEST_FAILED,e))}handleCustomColumnsChanged(){this.dispatchEvent(new Me(me.EVENT.COLUMNS_CHANGED,{detail:this.columns}))}get rowCount(){var e,t,n;return this.table.size+this.pendingNewRowCount+((n=(t=(e=this.totals)==null?void 0:e.operationOrder)==null?void 0:t.length)!=null?n:0)}get pendingDataErrors(){var e,t;return this.getCachedPendingErrors(this.pendingNewDataMap,this.columns,(t=(e=this.inputTable)==null?void 0:e.keyColumns.length)!=null?t:0)}get pendingDataMap(){return this.pendingNewDataMap}set pendingDataMap(e){e!==this.pendingNewDataMap&&(e.forEach((t,n)=>{if(!ne.isValidIndex(n))throw new Error(`Invalid rowIndex ${n}`);const{data:s}=t;s.forEach((o,i)=>{if(!ne.isValidIndex(i))throw new Error(`Invalid columnIndex ${i}`)})}),this.pendingNewDataMap=e,this.pendingNewRowCount=Math.max(this.pendingNewRowCount,this.maxPendingDataRow),this.formattedStringData=[],this.dispatchEvent(new Me(me.EVENT.PENDING_DATA_UPDATED)))}get pendingRowCount(){return this.pendingNewRowCount}set pendingRowCount(e){e!==this.pendingNewRowCount&&(this.pendingNewRowCount=Math.max(0,e,this.maxPendingDataRow),this.dispatchEvent(new Me(me.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 e,t,n;return this.totals!=null&&this.totals.showOnTop?0:(n=(t=(e=this.totals)==null?void 0:e.operationOrder)==null?void 0:t.length)!=null?n:0}get floatingTopRowCount(){var e,t,n;return this.totals!=null&&this.totals.showOnTop&&(n=(t=(e=this.totals)==null?void 0:e.operationOrder)==null?void 0:t.length)!=null?n:0}get isChartBuilderAvailable(){return!0}get isTotalsAvailable(){return this.table.getTotalsTable!=null}get isEditable(){return!this.isSaveInProgress&&this.inputTable!=null}cacheFormattedValue(e,t,n){this.formattedStringData[e]==null&&(this.formattedStringData[e]=[]),this.formattedStringData[e][t]=n}cachePendingValue(e,t,n){this.pendingStringData[e]==null&&(this.pendingStringData[e]=[]),this.pendingStringData[e][t]=n}clearPendingValue(e,t){const n=this.pendingStringData[e];n!=null&&delete n[t]}textValueForCell(e,t){var n,s,o;if(((n=this.pendingStringData[e])==null?void 0:n[t])!==void 0)return this.pendingStringData[e][t];if(((s=this.formattedStringData[e])==null?void 0:s[t])===void 0){const i=this.valueForCell(e,t);if(i==null)return null;const r=(o=this.totalsColumn(e,t))!=null?o:this.columns[e],l=this.getCachedCustomColumnFormatFlag(this.formatter,r.name,r.type);let a;if(!l){const d=this.formatForCell(e,t);(d==null?void 0:d.formatString)!=null&&(a=d)}const c=this.displayString(i,r.type,r.name,a);this.cacheFormattedValue(e,t,c)}return this.formattedStringData[e][t]}textForCell(e,t){const n=this.textValueForCell(e,t);if(n==null&&this.isKeyColumn(e)){const s=this.pendingRow(t);if(s!=null&&this.pendingDataMap.has(s))return"*"}return n!=null?n:""}truncationCharForCell(e){const t=this.columns[e],{type:n}=t;if(x.isNumberType(n)&&this.formatter.truncateNumbersWithPound)return"#"}colorForCell(e,t,n){var o;const s=this.dataForCell(e,t);if(s){const{format:i,value:r}=s;if(r==null||r==="")return O(n.nullStringColor),n.nullStringColor;if(i&&i.color)return i.color;if(this.isPendingRow(t))return O(n.pendingTextColor),n.pendingTextColor;if(r!=null){const l=(o=this.totalsColumn(e,t))!=null?o:this.columns[e];if(x.isDateType(l.type)||l.name==="Date")return O(n.dateColor),n.dateColor;if(x.isNumberType(l.type))return r>0?(O(n.positiveNumberColor),n.positiveNumberColor):r<0?(O(n.negativeNumberColor),n.negativeNumberColor):(O(n.zeroNumberColor),n.zeroNumberColor)}}else if(this.isPendingRow(t)&&this.isKeyColumn(e))return O(n.errorTextColor),n.errorTextColor;return n.textColor}backgroundColorForCell(e,t){var n,s;return(s=(n=this.formatForCell(e,t))==null?void 0:n.backgroundColor)!=null?s:null}textAlignForCell(e){const t=this.columns[e],{type:n}=t;return x.isNumberType(n)?"right":x.isDateType(n)||t.name==="Date"?"center":"left"}textForColumnHeader(e,t=0){const n=this.columnAtDepth(e,t);return Gi(n)?n.isNew?"":n.name:n==null?void 0:n.name}colorForColumnHeader(e,t=0){var s;const n=this.columnAtDepth(e,t);return Gi(n)&&(s=n.color)!=null?s:null}getColumnHeaderGroup(e,t){const n=this.columnAtDepth(e,t);if(Gi(n))return n}getColumnHeaderParentGroup(e,t){var n,s;return this.columnHeaderParentMap.get((s=(n=this.columnAtDepth(e,t))==null?void 0:n.name)!=null?s:"")}columnAtDepth(e,t=0){var i;if(t===0)return this.columns[e];const n=(i=this.columns[e])==null?void 0:i.name;let s=this.columnHeaderParentMap.get(n);if(!s)return;let o=s.depth;for(;o<t;){if(s=this.columnHeaderParentMap.get(s.name),!s)return;o=s.depth}if(s.depth===t)return s}textForRowFooter(e){const t=this.totalsRow(e);return t!=null&&this.totals?this.totals.operationOrder[t]:""}get initialMovedColumns(){var e;return this.getMemoizedInitialMovedColumns((e=this.layoutHints)!=null?e:void 0)}get initialMovedRows(){return sC}get initialColumnHeaderGroups(){var e;return this.getMemoizedInitialColumnHeaderGroups((e=this.layoutHints)!=null?e:void 0)}get columnMap(){return this.getMemoizedColumnMap(this.table.columns)}get columnHeaderMaxDepth(){var e;return(e=this._columnHeaderMaxDepth)!=null?e:1}set columnHeaderMaxDepth(e){this._columnHeaderMaxDepth=e}get columnHeaderGroupMap(){return this._columnHeaderGroupMap}get columnHeaderGroups(){return this._columnHeaderGroups}set columnHeaderGroups(e){if(e===this._columnHeaderGroups)return;const{groups:t,maxDepth:n,parentMap:s,groupMap:o}=ne.parseColumnHeaderGroups(this,e!=null?e:this.initialColumnHeaderGroups);this._columnHeaderGroups=t,this.columnHeaderMaxDepth=n,this.columnHeaderParentMap=s,this._columnHeaderGroupMap=o}get groupedColumns(){return[]}row(e){var l,a,c,d,u,m,p,g,f,w,C,S,b,E;const t=(c=(a=(l=this.totals)==null?void 0:l.operationOrder)==null?void 0:a.length)!=null?c:0,n=(u=(d=this.totals)==null?void 0:d.showOnTop)!=null?u:!1,s=this.totalsRow(e);if(s!=null){const v=(m=this.totals)==null?void 0:m.operationOrder[s];return O(v),(g=(p=this.totalsDataMap)==null?void 0:p.get(v))!=null?g:null}const o=this.pendingRow(e);if(o!=null)return(f=this.pendingNewDataMap.get(o))!=null?f:null;const i=(C=(w=this.viewportData)==null?void 0:w.offset)!=null?C:0,r=(n?e-t:e)-i;return(E=(b=(S=this.viewportData)==null?void 0:S.rows)==null?void 0:b[r])!=null?E:null}totalsColumn(e,t){var r,l,a,c;const n=this.totalsRow(t);if(n==null)return null;const s=(r=this.totals)==null?void 0:r.operationOrder[n],o=(a=(l=this.totals)==null?void 0:l.defaultOperation)!=null?a:Ee.SUM,i=this.columns[e];return(c=this.totalsTable)==null?void 0:c.columns.find(d=>{var u;return d.name===`${i.name}__${s}`||(s===o||((u=this.totals)==null?void 0:u.operationOrder.length)===1)&&d.name===i.name})}totalsRow(e){var o,i,r,l,a;const t=(r=(i=(o=this.totals)==null?void 0:o.operationOrder)==null?void 0:i.length)!=null?r:0,s=((a=(l=this.totals)==null?void 0:l.showOnTop)!=null?a:!1)?e:e-this.table.size;return s>=0&&s<t?s:null}pendingRow(e){const t=e-this.floatingTopRowCount-this.table.size;return t>=0&&t<this.pendingNewRowCount?t:null}isTotalsRow(e){return this.totalsRow(e)!=null}isPendingRow(e){return this.pendingRow(e)!=null}dataForCell(e,t){var n;return(n=this.row(t))==null?void 0:n.data.get(e)}formatForCell(e,t){var n;return(n=this.dataForCell(e,t))==null?void 0:n.format}valueForCell(e,t){var s;const n=this.dataForCell(e,t);if(n)return(s=n.value)!=null?s:null}copyViewportData(e){if(e==null){Ve.warn("invalid data!");return}this.viewportData=this.extractViewportData(e),this.formattedStringData=[]}copyTotalsData(e){var l,a,c,d,u;if(e==null){Ve.warn("invalid data!");return}const{columns:t,rows:n}=e;if(n.length!==1){Ve.error("Unexpected number of rows received for totals table, ignoring update");return}const s=new Map,o=n[0],i=(a=(l=this.totals)==null?void 0:l.defaultOperation)!=null?a:Ee.SUM,r=(c=this.totals)==null?void 0:c.operationMap;for(let m=0;m<t.length;m+=1){const p=t[m],[g,f=(u=(d=r==null?void 0:r[g])==null?void 0:d[0])!=null?u:i]=p.name.split("__");s.has(f)||s.set(f,{data:new Map});const{data:w}=s.get(f),C=this.columns.findIndex(S=>S.name===g);w.set(C,{value:o.get(p),format:o.getFormat(p)})}Ve.debug2("copyTotalsData",s),this.totalsDataMap=s,this.formattedStringData=[]}getColumnIndexByName(e){return this.getColumnIndicesByNameMap(this.columns).get(e)}extractViewportData(e){const t={offset:e.offset,rows:[]},{columns:n}=e;for(let s=0;s<e.rows.length;s+=1){const o=e.rows[s],i=this.extractViewportRow(o,n);t.rows.push(i)}return t}extractViewportRow(e,t){const n=new Map;for(let s=0;s<t.length;s+=1){const o=t[s],i=this.getColumnIndexByName(o.name);O(i),n.set(i,{value:e.get(o),format:e.getFormat(o)})}return{data:n}}closeSubscription(){Ve.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(e){this.closeSubscription(),this.table.applyFilter(e),this.applyViewport()}get formatter(){return this.irisFormatter}set formatter(e){this.irisFormatter=e,this.formattedStringData=[],this.dispatchEvent(new Me(me.EVENT.FORMATTER_UPDATED))}displayString(e,t,n="",s){return this.getCachedFormattedString(this.formatter,e,t,n,s)}get sort(){return this.table.sort}set sort(e){this.closeSubscription(),this.table.applySort(e),this.applyViewport()}set totalsConfig(e){if(Ve.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 Me(me.EVENT.UPDATED));return}this.totalsTablePromise=Ue.makeCancelable(this.table.getTotalsTable(e),t=>t.close()),this.totalsTablePromise.then(t=>{this.totalsTablePromise=null,this.setTotalsTable(t)}).catch(t=>{Ue.isCanceled(t)||(Ve.error("Unable to set next totalsTable",t),this.totalsTablePromise=null,this.dispatchEvent(new Me(me.EVENT.REQUEST_FAILED,{detail:t})))})}}setTotalsTable(e){Ve.debug("setTotalsTable",e),this.totalsTable!==null&&(this.listenerCount>0&&this.removeTotalsListeners(this.totalsTable),this.totalsTable.close()),this.totalsTable=e,this.totalsDataMap=null,this.listenerCount>0&&this.totalsTable!=null&&this.addTotalsListeners(this.totalsTable)}applyBufferedViewport(e,t,n){Ve.debug2("applyBufferedViewport",e,t,n),this.subscription==null?(Ve.debug2("applyBufferedViewport creating new subscription"),this.subscription=this.table.setViewport(e,t,n)):(Ve.debug2("applyBufferedViewport using existing subscription"),this.subscription.setViewport(e,t,n))}async snapshot(e,t=!1,n=o=>o,s=!0){if(this.subscription==null)throw new Error("No subscription available");const o=s?ee.consolidate(e):e;if(!ne.isValidSnapshotRanges(o))throw new Error(`Invalid snapshot ranges ${e}`);const i=new Set,r=[],l=new Set;for(let m=0;m<o.length;m+=1){const p=o[m];O(p.endRow),O(p.startRow);for(let g=p.startRow;g<=p.endRow&&g<this.floatingTopRowCount;g+=1)i.add(g);p.endRow>=this.floatingTopRowCount&&p.startRow<=this.floatingTopRowCount+this.table.size&&r.push(new ee(p.startColumn,Math.min(Math.max(0,p.startRow-this.floatingTopRowCount)),p.endColumn,Math.min(Math.max(0,p.endRow-this.floatingTopRowCount),this.table.size-this.floatingTopRowCount)));for(let g=Math.max(p.startRow,this.floatingTopRowCount+this.table.size);g<=p.endRow&&g<this.floatingTopRowCount+this.table.size+this.floatingBottomRowCount;g+=1)l.add(g)}const a=ne.columnsFromRanges(o,this.columns),c=[];t&&c.push(a.map(m=>m.name));const d=[...i].sort();for(let m=0;m<d.length;m+=1){const p=d[m],g=a.map(f=>{const w=this.getColumnIndexByName(f.name);return O(w),n(this.valueForCell(w,p),f)});t&&g.push(this.textForRowFooter(p)),c.push(g)}if(r.length>0){const m=ne.rangeSetFromRanges(r),p=await this.subscription.snapshot(m,a);c.push(...p.rows.map(g=>a.map(f=>n(g.get(f),f))))}const u=[...l].sort();for(let m=0;m<u.length;m+=1){const p=u[m],g=a.map(f=>{const w=this.getColumnIndexByName(f.name);return O(w),n(this.valueForCell(w,p),f)});t&&g.push(this.textForRowFooter(p)),c.push(g)}return c}async textSnapshot(e,t=!1,n=s=>`${s}`){return Ve.debug2("textSnapshot",e,t),(await this.snapshot(e,t,n,!1)).map(o=>o.join(" ")).join(`
|
|
32
|
+
`)}async valuesTable(e){let t=null;try{return t=await this.table.copy(),t.applyFilter([]),t.applySort([]),t.selectDistinct([e])}finally{t!=null&&t.close()}}isColumnMovable(e,t){if(e<0||e>=this.columnCount)return!1;if(t>0)return!0;const n=this.columns[e].name;return this.frontColumns.includes(n)||this.backColumns.includes(n)||this.frozenColumns.includes(n)||!n?!1:!this.isKeyColumn(e)}isKeyColumn(e){var t,n;return e<((n=(t=this.inputTable)==null?void 0:t.keyColumns.length)!=null?n:0)}isRowMovable(){return!1}isEditableRange(e){return!(this.inputTable==null||!ee.isBounded(e)||!(this.isPendingRow(e.startRow)&&this.isPendingRow(e.endRow)||this.inputTable.keyColumns.length!==0&&e.startColumn>=this.inputTable.keyColumns.length&&e.endColumn>=this.inputTable.keyColumns.length)||e.startRow<this.floatingTopRowCount||e.startRow>=this.floatingTopRowCount+this.table.size+this.pendingRowCount||e.endRow>=this.floatingTopRowCount+this.table.size+this.pendingRowCount)}isDeletableRange(e){return this.inputTable!=null&&e.startRow!=null&&e.endRow!=null&&e.startRow>=this.floatingTopRowCount&&e.startRow<this.floatingTopRowCount+this.table.size+this.pendingRowCount&&e.endRow<this.floatingTopRowCount+this.table.size+this.pendingRowCount}isEditableRanges(e){return e.every(t=>this.isEditableRange(t))}isDeletableRanges(e){return e.every(t=>this.isDeletableRange(t))}getTableAreaRange(){return new ee(null,this.floatingTopRowCount,null,this.floatingTopRowCount+this.table.size-1)}getPendingAreaRange(){return new ee(null,this.floatingTopRowCount+this.table.size,null,this.floatingTopRowCount+this.table.size+this.pendingNewRowCount-1)}async setValueForCell(e,t,n){return this.setValueForRanges([new ee(e,t,e,t)],n)}async setValueForRanges(e,t){var n;if(!this.isEditableRanges(e))throw new Error(`Uneditable ranges ${e}`);try{const s=new Set,o=[];ee.forEachCell(e,(c,d)=>{const u=this.columns[c];if(s.add(u),o[c]===void 0){const m=x.makeValue(u.type,t,this.formatter.timeZone);o[c]=m!=null?this.displayString(m,u.type,u.name):null}this.cachePendingValue(c,d,o[c])});const i=this.getPendingAreaRange(),r=e.map(c=>ee.intersection(i,c)).filter(c=>c!=null).map(c=>(O(c),ee.offset(c,0,-(this.floatingTopRowCount+this.table.size))));if(r.length>0){const c=new Map(this.pendingNewDataMap);ee.forEachCell(r,(d,u)=>{c.has(u)||c.set(u,{data:new Map});const m=this.columns[d],p=c.get(u);O(p);const{data:g}=p,f=new Map(g),w=x.makeValue(m.type,t,this.formatter.timeZone);w!=null?f.set(d,{value:w}):f.delete(d),f.size>0?c.set(u,{...p,data:f}):c.delete(u)}),this.pendingDataMap=c}this.dispatchEvent(new Me(me.EVENT.UPDATED));const l=this.getTableAreaRange(),a=e.map(c=>ee.intersection(l,c)).filter(c=>c!=null);if(a.length>0){const d=(await this.snapshot(a.map(m=>{var p,g;return new ee(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]=x.makeValue(g.type,t,this.formatter.timeZone)}),p}),u=await((n=this.inputTable)==null?void 0:n.addRows(d));Ve.debug("setValueForRanges(",e,",",t,") set tableRanges",a,"result",u)}ee.forEachCell(e,(c,d)=>{const u=o[c];O(u),this.cacheFormattedValue(c,d,u)})}catch(s){Ve.error("Unable to set ranges",e,t,s)}finally{ee.forEachCell(e,(s,o)=>{this.clearPendingValue(s,o)})}}async setValues(e=[]){var t;if(Ve.debug("setValues(",e,")"),!e.every(n=>{var s,o;return this.isEditableRange(ee.makeCell((s=n.column)!=null?s:n.x,(o=n.row)!=null?o:n.y))}))throw new Error(`Uneditable ranges ${e}`);try{const n=new Map(this.pendingNewDataMap);e.forEach(l=>{var f,w;const{text:a}=l,c=(f=l.column)!=null?f:l.x,d=(w=l.row)!=null?w:l.y,u=this.columns[c],m=x.makeValue(u.type,a,this.formatter.timeZone),p=m!=null?this.displayString(m,u.type,u.name):null;this.cachePendingValue(c,d,p);const g=this.pendingRow(d);if(g!=null){n.has(g)||n.set(g,{data:new Map});const C=n.get(g);O(C);const{data:S}=C,b=new Map(S);m!=null?b.set(c,{value:m}):b.delete(c),b.size>0?n.set(g,{...C,data:b}):n.delete(g)}}),this.pendingDataMap=n,this.dispatchEvent(new Me(me.EVENT.UPDATED));const s=e.reduce((l,a)=>{var d,u;const c=(d=a.row)!=null?d:a.y;return l.has(c)||l.set(c,[]),(u=l.get(c))==null||u.push(a),l},new Map),o=ee.consolidate(e.map(l=>{var a,c;return ee.makeCell((a=l.column)!=null?a:l.x,(c=l.row)!=null?c:l.y)})),i=this.getTableAreaRange(),r=o.map(l=>ee.intersection(i,l)).filter(l=>l!=null);if(r.length>0){const a=(await this.snapshot(r.map(d=>(O(d),new ee(null,d.startRow,null,d.endRow))))).map((d,u)=>{let m=null,p=u;for(let w=0;w<r.length;w+=1){const C=r[w];O(C);const S=ee.rowCount([C]);if(p<S){O(C.startRow),m=C.startRow+p;break}p-=S}const g={};for(let w=0;w<this.columns.length;w+=1)g[this.columns[w].name]=d[w];O(m);const f=s.get(m);return f!=null&&f.forEach(w=>{var S;const C=this.columns[(S=w.column)!=null?S:w.x];g[C.name]=x.makeValue(C.type,w.text,this.formatter.timeZone)}),g});Ve.info("setValues setting tableRanges",r);const c=await((t=this.inputTable)==null?void 0:t.addRows(a));Ve.info("setValues set tableRanges",r,"SUCCESS",c)}e.forEach(l=>{var g,f;const{text:a}=l,c=(g=l.column)!=null?g:l.x,d=(f=l.row)!=null?f:l.y,u=this.columns[c],m=x.makeValue(u.type,a,this.formatter.timeZone),p=m!=null?this.displayString(m,u.type,u.name):null;this.cacheFormattedValue(c,d,p)})}finally{e.forEach(n=>{this.clearPendingValue(n.column,n.row)})}}async commitPending(){var e,t,n;if(this.pendingNewDataMap.size<=0)throw new Error("No pending changes to commit");try{this.isSaveInProgress=!0;const s=[];this.pendingNewDataMap.forEach(i=>{const r={};i.data.forEach(({value:l},a)=>{const c=this.columns[a];r[c.name]=l}),s.push(r)});const o=await((e=this.inputTable)==null?void 0:e.addRows(s));Ve.debug("commitPending()",this.pendingNewDataMap,"result",o),this.pendingNewDataMap=new Map,this.pendingNewRowCount=Math.max(0,((n=(t=this.viewport)==null?void 0:t.bottom)!=null?n:0)-this.table.size),this.formattedStringData=[],this.dispatchEvent(new Me(me.EVENT.PENDING_DATA_UPDATED))}finally{this.isSaveInProgress=!1}}editValueForCell(e,t){return this.textValueForCell(e,t)}async delete(e){if(!this.isDeletableRanges(e))throw new Error(`Undeletable ranges ${e}`);O(this.inputTable);const{keyColumns:t}=this.inputTable;if(t.length===0)throw new Error("No key columns to allow deletion");const n=this.getPendingAreaRange(),s=e.map(d=>ee.intersection(n,d)).filter(d=>d!=null).map(d=>(O(d),ee.offset(d,0,-(this.floatingTopRowCount+this.table.size))));if(s.length>0){const d=new Map(this.pendingNewDataMap);for(let u=0;u<s.length;u+=1){const m=s[u];O(m.startRow),O(m.endRow);for(let p=m.startRow;p<=m.endRow;p+=1)d.delete(p)}this.pendingNewDataMap=d,this.formattedStringData=[],this.dispatchEvent(new Me(me.EVENT.PENDING_DATA_UPDATED)),this.dispatchEvent(new Me(me.EVENT.UPDATED))}const o=this.getTableAreaRange(),i=e.map(d=>ee.intersection(o,d)).filter(d=>d!=null);if(i.length<=0)return;const[r,l]=await Promise.all([this.snapshot(i.map(d=>(O(d),new ee(0,d.startRow,t.length-1,d.endRow)))),this.table.copy()]),c=r.map(d=>{const u=[];for(let m=0;m<t.length;m+=1){const p=t[m],g=d[m],f=x.makeFilterRawValue(p.type,g),w=p.filter().eq(f);u.push(w)}return u.reduce((m,p)=>{var g;return(g=m==null?void 0:m.and(p))!=null?g:p})}).reduce((d,u)=>{var m;return(m=d==null?void 0:d.or(u))!=null?m:u});l.applyFilter([c]),l.close()}isValidForCell(e,t,n){try{const s=this.columns[e];return x.makeValue(s.type,n,this.formatter.timeZone),!0}catch{return!1}}};let Wr=lr;Wr.ROW_BUFFER_PAGES=1;const _n=se.module("IrisGridTableModel");class oC extends Wr{constructor(t,n=new tn,s=null){super(t,n,s),this.getMemoizedFrontColumns=Ie(o=>o!=null?o:[]),this.getMemoizedBackColumns=Ie(o=>o!=null?o:[]),this.getMemoizedFrozenColumns=Ie((o,i)=>{var r;return(r=i!=null?i:o)!=null?r:[]}),this.getCachedFilterableColumnSet=Ie(o=>new Set(o.map((i,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 t;return this.getMemoizedFrontColumns((t=this.layoutHints)==null?void 0:t.frontColumns)}get backColumns(){var t;return this.getMemoizedBackColumns((t=this.layoutHints)==null?void 0:t.backColumns)}get frozenColumns(){var t;return this.getMemoizedFrozenColumns((t=this.layoutHints)==null?void 0:t.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(t){if(_n.debug2("set customColumns",t,this.customColumnList,t===this.customColumnList),this.customColumnList.length===0&&t.length===0){_n.debug("Ignore empty initial customColumns"),this.customColumnList=t;return}if(this.customColumnList===t){_n.debug("Ignore same customColumns");return}this.closeSubscription(),this.customColumnList=t,this.table.applyCustomColumns([...t,...this.formatColumns]),this.applyViewport()}get formatColumns(){return this.formatColumnList}set formatColumns(t){if(_n.debug2("set formatColumns",t,this.formatColumnList,t===this.formatColumnList),this.formatColumnList.length===0&&t.length===0){_n.debug("Ignore empty initial formatColumns"),this.formatColumnList=t;return}if(this.formatColumnList===t){_n.debug("Ignore same formatColumns");return}this.closeSubscription(),this.formatColumnList=t,this.table.applyCustomColumns([...this.customColumns,...t]),this.applyViewport()}updateFrozenColumns(t){this.userFrozenColumns=t,this.dispatchEvent(new Me(me.EVENT.TABLE_CHANGED,{detail:this.table}))}set totalsConfig(t){if(_n.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 Me(me.EVENT.UPDATED));return}this.totalsTablePromise=Ue.makeCancelable(this.table.getTotalsTable(t),n=>n.close()),this.totalsTablePromise.then(n=>{this.totalsTablePromise=null,this.setTotalsTable(n)}).catch(n=>{Ue.isCanceled(n)||(_n.error("Unable to set next totalsTable",n),this.totalsTablePromise=null,this.dispatchEvent(new Me(me.EVENT.REQUEST_FAILED,{detail:n})))})}}get isFilterRequired(){return this.table.isUncoalesced}isFilterable(t){return this.getCachedFilterableColumnSet(this.columns).has(t)}async export(){return this.table.freeze()}columnStatistics(t){return this.table.getColumnStatistics(t)}isColumnMovable(t){const n=this.columns[t].name;return this.frontColumns.includes(n)||this.backColumns.includes(n)||this.frozenColumns.includes(n)?!1:!this.isKeyColumn(t)}isColumnFrozen(t){return this.frozenColumns.includes(this.columns[t].name)}async delete(t){var u;if(!this.isDeletableRanges(t))throw new Error(`Undeletable ranges ${t}`);O(this.inputTable);const{keyColumns:n}=this.inputTable;if(n.length===0)throw new Error("No key columns to allow deletion");const s=this.getPendingAreaRange(),o=t.map(m=>ee.intersection(s,m)).filter(m=>m!=null).map(m=>(O(m),ee.offset(m,0,-(this.floatingTopRowCount+this.table.size))));if(o.length>0){const m=new Map(super.pendingDataMap);for(let p=0;p<o.length;p+=1){const g=o[p];O(g.startRow),O(g.endRow);for(let f=g.startRow;f<=g.endRow;f+=1)m.delete(f)}super.pendingDataMap=m,this.formattedStringData=[],this.dispatchEvent(new Me(me.EVENT.PENDING_DATA_UPDATED)),this.dispatchEvent(new Me(me.EVENT.UPDATED))}const i=this.getTableAreaRange(),r=t.map(m=>ee.intersection(i,m)).filter(m=>m!=null);if(r.length<=0)return;const[l,a]=await Promise.all([this.snapshot(r.map(m=>(O(m),new ee(0,m.startRow,n.length-1,m.endRow)))),this.table.copy()]),d=l.map(m=>{const p=[];for(let g=0;g<n.length;g+=1){const f=n[g],w=m[g],C=x.makeFilterRawValue(f.type,w),S=f.filter().eq(C);p.push(S)}return p.reduce((g,f)=>{var w;return(w=g==null?void 0:g.and(f))!=null?w:f})}).reduce((m,p)=>{var g;return(g=m==null?void 0:m.or(p))!=null?g:p});a.applyFilter([d]),await((u=this.inputTable)==null?void 0:u.deleteTable(a)),a.close()}async seekRow(t,n,s,o,i,r,l){return this.table.seekRow(t,n,s,o,i,r,l)}get isSeekRowAvailable(){return this.table.seekRow!=null}}class iC extends Wr{constructor(){super(...arguments),this.getCachedFilterableColumnSet=Ie((t,n)=>new Set(((n==null?void 0:n.length)>0?n:t).map(s=>t.findIndex(o=>s.name===o.name))))}applyBufferedViewport(t,n,s){this.table.setViewport(t,n,s)}textForCell(t,n){const s=this.columns[t],o=this.row(n);if(o!=null&&s!=null&&!o.hasChildren&&s.constituentType!=null){const i=this.valueForCell(t,n);return this.displayString(i,s.constituentType,s.name)}return super.textForCell(t,n)}extractViewportRow(t,n){const{isExpanded:s,hasChildren:o,depth:i}=t;return{...super.extractViewportRow(t,n),isExpanded:s,hasChildren:o,depth:i}}async snapshot(t,n,s){var l,a;O(this.viewport),O(this.viewportData);const{columns:o}=this.viewport,i=[];n!=null&&n&&i.push(o.map(c=>c.name));const r=new ee(0,(l=this.viewportData)==null?void 0:l.offset,o.length,this.viewportData.offset+this.viewportData.rows.length);for(let c=0;c<t.length;c+=1){const d=ee.intersection(r,t[c]);O(d),O(d.startRow),O(d.endRow);for(let u=d.startRow;u<=d.endRow;u+=1){const m=[],p=this.viewportData.rows[u-this.viewportData.offset];O(d.startColumn),O(d.endColumn);for(let g=d.startColumn;g<=d.endColumn;g+=1)O(s),m.push(s((a=p.data.get(g))==null?void 0:a.value,this.columns[g]));i.push(m)}}return i}get groupedColumns(){return this.table.groupedColumns}get hasExpandableRows(){return!0}get isExpandAllAvailable(){return this.table.expandAll!==void 0}get isChartBuilderAvailable(){return!1}get isSelectDistinctAvailable(){return!1}get isReversible(){return!1}isFilterable(t){return this.getCachedFilterableColumnSet(this.columns,this.groupedColumns).has(t)}isColumnMovable(t){return t>=this.groupedColumns.length}isRowExpandable(t){var s;const n=this.row(t);return(s=n==null?void 0:n.hasChildren)!=null?s:!1}isRowExpanded(t){var s;const n=this.row(t);return(s=n==null?void 0:n.isExpanded)!=null?s:!1}setRowExpanded(t,n,s=!1){this.isExpandAllAvailable?this.table.setExpanded(t,n,s):this.table.setExpanded(t,n)}expandAll(){this.table.expandAll&&this.table.expandAll()}collapseAll(){this.table.collapseAll&&this.table.collapseAll()}depthForRow(t){var s;const n=this.row(t);return((s=n==null?void 0:n.depth)!=null?s:1)-1}}const Vn=se.module("IrisGridProxyModel");function Zi(e,t,n){return x.isTreeTable(e)?new iC(e,t):new oC(e,t,n)}class rC extends me{constructor(t,n=new tn,s=null){super(),this.textForCell=(...i)=>this.model.textForCell(...i),this.truncationCharForCell=(...i)=>this.model.truncationCharForCell(...i),this.textAlignForCell=(...i)=>this.model.textAlignForCell(...i),this.colorForCell=(...i)=>this.model.colorForCell(...i),this.backgroundColorForCell=(...i)=>this.model.backgroundColorForCell(...i),this.textForColumnHeader=(...i)=>this.model.textForColumnHeader(...i),this.colorForColumnHeader=(...i)=>this.model.colorForColumnHeader(...i),this.textForRowHeader=(...i)=>this.model.textForRowHeader(...i),this.textForRowFooter=(...i)=>this.model.textForRowFooter(...i),this.isRowMovable=(...i)=>this.model.isRowMovable(...i),this.isColumnMovable=(...i)=>this.model.isColumnMovable(...i),this.isRowExpandable=(...i)=>ke(this.model)?this.model.isRowExpandable(...i):!1,this.isRowExpanded=(...i)=>ke(this.model)?this.model.isRowExpanded(...i):!1,this.setRowExpanded=(...i)=>{if(ke(this.model))return this.model.setRowExpanded(...i);throw Error("Function setRowExpanded does not exist on IrisGridTableModel")},this.expandAll=()=>{if(ke(this.model))return this.model.expandAll();throw Error("Function expandAll does not exist on IrisGridTableModel")},this.collapseAll=()=>{if(ke(this.model))return this.model.collapseAll();throw Error("Function collapseAll does not exist on IrisGridTableModel")},this.depthForRow=(...i)=>ke(this.model)?this.model.depthForRow(...i):0,this.getColumnHeaderGroup=(...i)=>this.model.getColumnHeaderGroup(...i),this.getColumnHeaderParentGroup=(...i)=>this.model.getColumnHeaderParentGroup(...i),this.formatForCell=(...i)=>this.model.formatForCell(...i),this.valueForCell=(...i)=>this.model.valueForCell(...i),this.displayString=(...i)=>this.model.displayString(...i),this.isEditableRange=(...i)=>He(this.model)?this.model.isEditableRange(...i):!1,this.isFilterable=(...i)=>this.model.isFilterable(...i),this.setViewport=(i,r,l)=>this.model.setViewport(i,r,l),this.snapshot=(...i)=>this.model.snapshot(...i),this.textSnapshot=(...i)=>this.model.textSnapshot(...i),this.valuesTable=(...i)=>this.model.valuesTable(...i),this.editValueForCell=(...i)=>(He(this.model)&&this.model.editValueForCell(...i),""),this.setValueForCell=(...i)=>He(this.model)?this.model.setValueForCell(...i):Promise.reject(new Error("Model is not editable")),this.setValueForRanges=(...i)=>He(this.model)?this.model.setValueForRanges(...i):Promise.reject(new Error("Model is not editable")),this.setValues=(...i)=>He(this.model)?this.model.setValues(...i):Promise.resolve(),this.isValidForCell=(...i)=>He(this.model)?this.model.isValidForCell(...i):!1,this.delete=(...i)=>this.model.delete(...i),this.commitPending=(...i)=>this.model.commitPending(...i),this.handleModelEvent=this.handleModelEvent.bind(this);const o=Zi(t,n,s);this.originalModel=o,this.model=o,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(t){Vn.debug2("handleModelEvent",t);const{detail:n,type:s}=t;this.dispatchEvent(new Me(s,{detail:n}))}setModel(t){Vn.debug("setModel",t);const n=this.model;n!==this.originalModel&&n.close(),this.model=t,this.listenerCount>0&&this.addListeners(t),this.dispatchEvent(new Me(me.EVENT.COLUMNS_CHANGED,{detail:t.columns})),Jo(t)&&this.dispatchEvent(new Me(me.EVENT.TABLE_CHANGED,{detail:t.table}))}setNextModel(t){Vn.debug2("setNextModel"),this.modelPromise&&this.modelPromise.cancel(),this.listenerCount>0&&this.removeListeners(this.model),this.modelPromise=Ue.makeCancelable(t,n=>n.close()),this.modelPromise.then(n=>{this.modelPromise=null,this.setModel(n)}).catch(n=>{if(Ue.isCanceled(n)){Vn.debug2("setNextModel cancelled");return}Vn.error("Unable to set next model",n),this.modelPromise=null,this.dispatchEvent(new Me(me.EVENT.REQUEST_FAILED,{detail:n}))})}startListening(){super.startListening(),this.addListeners(this.model)}stopListening(){super.stopListening(),this.removeListeners(this.model)}addListeners(t){const n=Object.keys(me.EVENT);for(let s=0;s<n.length;s+=1)t.addEventListener(n[s],this.handleModelEvent)}removeListeners(t){const n=Object.keys(me.EVENT);for(let s=0;s<n.length;s+=1)t.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(t){return this.model.isColumnFrozen(t)}get hasExpandableRows(){return ke(this.model)?this.model.hasExpandableRows:!1}get isExpandAllAvailable(){var t;return ke(this.model)&&(t=this.model.isExpandAllAvailable)!=null?t:!1}get isExportAvailable(){return this.model.isExportAvailable}get isColumnStatisticsAvailable(){return this.model.isColumnStatisticsAvailable}get isValuesTableAvailable(){return this.model.isValuesTableAvailable}get isCustomColumnsAvailable(){return this.model.isCustomColumnsAvailable&&!(this.isSelectDistinctAvailable&&this.selectDistinctColumns.length>0)}get isFormatColumnsAvailable(){return this.model.isFormatColumnsAvailable}get isChartBuilderAvailable(){return this.model.isChartBuilderAvailable}get isRollupAvailable(){return(this.originalModel.isRollupAvailable||this.rollup!=null)&&this.selectDistinct.length===0}get isSelectDistinctAvailable(){return(this.originalModel.isSelectDistinctAvailable||this.selectDistinct.length>0)&&this.rollup==null}get isTotalsAvailable(){return this.model.isTotalsAvailable}get isReversible(){return this.model.isReversible}get columns(){return this.model.columns}get initialMovedColumns(){return this.model.initialMovedColumns}get initialMovedRows(){return this.model.initialMovedRows}get layoutHints(){return this.model.layoutHints}get frontColumns(){return this.model.frontColumns}get backColumns(){return this.model.backColumns}get frozenColumns(){return this.model.frozenColumns}get columnHeaderGroups(){return this.model.columnHeaderGroups}set columnHeaderGroups(t){this.model.columnHeaderGroups=t}get initialColumnHeaderGroups(){return this.model.initialColumnHeaderGroups}get columnHeaderGroupMap(){return this.model.columnHeaderGroupMap}get columnHeaderMaxDepth(){return this.model.columnHeaderMaxDepth}updateFrozenColumns(t){return this.model.updateFrozenColumns(t)}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(t){this.model.filter=t}get formatter(){return this.model.formatter}set formatter(t){this.model.formatter=t}get sort(){return this.model.sort}set sort(t){this.model.sort=t}get customColumns(){return this.model.customColumns}set customColumns(t){this.model.customColumns=t}get formatColumns(){return this.model.formatColumns}set formatColumns(t){this.model.formatColumns=t}get rollupConfig(){return this.rollup}set rollupConfig(t){if(Vn.debug("set rollupConfig",t),!this.isRollupAvailable)throw new Error("Rollup Rows are not available");if(ct(t,this.rollup))return;this.rollup=t;let n=Promise.resolve(this.originalModel);Jo(this.originalModel)&&t!=null&&(n=this.originalModel.table.rollup(t).then(s=>Zi(s,this.formatter))),this.setNextModel(n)}get selectDistinctColumns(){return this.selectDistinct}set selectDistinctColumns(t){if(Vn.debug("set selectDistinctColumns",t),!this.isSelectDistinctAvailable)throw new Error("Select distinct is not available");if(t===this.selectDistinctColumns||t.length===0&&this.selectDistinctColumns.length===0){Vn.debug("Ignore same selectDistinctColumns",t);return}this.selectDistinct=t;const n=t.map(o=>this.originalColumns.find(i=>i.name===o)).filter(o=>o!=null);let s=Promise.resolve(this.originalModel);Jo(this.originalModel)&&n.length>0&&(s=this.originalModel.table.selectDistinct(n).then(o=>Zi(o,this.formatter))),this.setNextModel(s)}get table(){if(Jo(this.model))return this.model.table}get totalsConfig(){return this.model.totalsConfig}set totalsConfig(t){this.model.totalsConfig=t}get isFilterRequired(){return this.model.isFilterRequired}get isEditable(){return He(this.model)&&this.model.isEditable}export(){if(x.isTreeTable(this.model))throw new Error("TreeTable has no 'export' property");return this.model.export()}columnStatistics(t){if(x.isTreeTable(this.model))throw new Error("TreeTable has no 'columnStatistics' function");return this.model.columnStatistics(t)}get pendingDataMap(){return this.model.pendingDataMap}set pendingDataMap(t){this.model.pendingDataMap=t}get pendingRowCount(){return this.model.pendingRowCount}set pendingRowCount(t){this.model.pendingRowCount=t}get pendingDataErrors(){return this.model.pendingDataErrors}getColumnIndexByName(t){return this.model.getColumnIndexByName(t)}async seekRow(t,n,s,o,i,r,l){return this.model.seekRow(t,n,s,o,i,r,l)}get isSeekRowAvailable(){return this.model.isSeekRowAvailable}}class lC{static async makeModel(t,n=new tn){let s=null;return!x.isTreeTable(t)&&t.hasInputTable&&(s=await t.inputTable()),new rC(t,n,s)}}const mn=se.module("TableViewportUpdater"),aC=150,ho=class extends T.exports.PureComponent{constructor(){super(...arguments),this.getViewportRowRange=Ie((e,t,n)=>{const s=n-t,o=Math.max(0,t-s*ho.ROW_BUFFER_PAGES),i=n+s*ho.ROW_BUFFER_PAGES;return[o,i]}),this.getViewportColumns=Ie((e,t,n,s)=>{if(t==null||n==null)return null;const o=n-t,i=Math.max(0,t-o*ho.COLUMN_BUFFER_PAGES),r=Math.min(n+o*ho.COLUMN_BUFFER_PAGES,e.columns.length-1),l=[];for(let a=i;a<=r;a+=1){const c=W.getModelIndex(a,s);l.push(e.columns[c])}return l}),this.updateViewport=Zn((e,t,n,s,o)=>{if(t<e){mn.error("Invalid viewport",e,t);return}if(e===0&&t===0){mn.debug2("Ignoring 0-0 viewport");return}const{movedColumns:i,table:r}=this.props,[l,a]=this.getViewportRowRange(r,e,t),c=o!=null?o:this.getViewportColumns(r,n,s,i);if(mn.debug2("Setting Viewport Top:",l,"Bottom:",a,"Columns:",c),this.subscription==null){mn.debug2("updateViewport creating new subscription"),this.subscription=r.setViewport(l,a,c);const{onSubscription:d}=this.props;d(this.subscription)}else mn.debug2("updateViewport using existing subscription"),this.subscription.setViewport(l,a,c)},aC)}componentDidMount(){const{top:e,bottom:t,left:n,right:s,table:o,filters:i,sorts:r,columns:l,customColumns:a}=this.props;o.applyFilter(i),o.applySort(r),o.applyCustomColumns(a),this.updateViewport(e,t,n,s,l)}componentDidUpdate(e){const{top:t,bottom:n,left:s,right:o,table:i,filters:r,sorts:l,customColumns:a,columns:c}=this.props,d=r!==e.filters,u=l!==e.sorts,m=a!==e.customColumns,p=i!==e.table;(d||u||m||p)&&this.closeSubscription(),(d||p)&&(mn.debug("update table filter",r),i.applyFilter(r)),(u||p)&&(mn.debug("update table sort",l),i.applySort(l)),(m||p)&&(mn.debug("update table custom columns",a),i.applyCustomColumns(a)),this.updateViewport(t,n,s,o,c)}componentWillUnmount(){this.closeSubscription()}closeSubscription(){if(mn.debug2("closeSubscription",this.subscription),this.subscription){this.subscription.close(),this.subscription=void 0;const{onSubscription:e}=this.props;e()}this.updateViewport.cancel()}render(){return null}};let $r=ho;$r.ROW_BUFFER_PAGES=3;$r.COLUMN_BUFFER_PAGES=1;$r.defaultProps={top:0,bottom:0,left:null,right:null,columns:null,onSubscription:()=>{},filters:[],sorts:[],customColumns:[],movedColumns:[]};const xs=se.module("TreeTableViewportUpdater"),cC=150,Fc=class extends T.exports.PureComponent{constructor(e){super(e),this.updateViewport=Zn((t,n)=>{if(n<t){xs.error("Invalid viewport",t,n);return}if(t===0&&n===0){xs.debug2("Ignoring 0-0 viewport");return}const{table:s,updateInterval:o}=this.props,i=n-t,r=Math.max(0,t-i*3),l=n+i*3+1;if(xs.debug2("Setting Viewport Top:",r,"Bottom:",l,s),!this.listenerCleanup){const{onViewportUpdate:a}=this.props;this.listenerCleanup=s.addEventListener(I.TreeTable.EVENT_UPDATED,a)}s.setViewport(r,l,void 0,o)},cC),this.listenerCleanup=null}componentDidMount(){const{top:e,bottom:t,table:n,filters:s,sorts:o}=this.props;xs.debug("componentDidMount",this.props),n.applyFilter(s),n.applySort(o),this.updateViewport(e,t)}componentDidUpdate(e){const{top:t,bottom:n,table:s,filters:o,sorts:i}=this.props;o!==e.filters&&(xs.debug("update table filter",o),s.applyFilter(o)),i!==e.sorts&&(xs.debug("update table sort",i),s.applySort(i)),this.updateViewport(t,n)}componentWillUnmount(){this.updateViewport.cancel(),this.listenerCleanup&&this.listenerCleanup()}render(){return null}};let xc=Fc;xc.UPDATE_INTERVAL=1e3;xc.defaultProps={top:0,bottom:0,onViewportUpdate:()=>{},filters:[],sorts:[],updateInterval:Fc.UPDATE_INTERVAL};se.setLogLevel(parseInt("2",10));const Ps=se.module("EmbedGrid.App"),dC=[I.VariableType.TABLE,I.VariableType.TREETABLE,I.VariableType.HIERARCHICALTABLE,I.VariableType.PANDAS];async function uC(e,t){Ps.info(`Fetching table ${t}...`);const n=await Xh(e,t);if(!dC.includes(n.type))throw new Error(`Unsupported type '${n.type}' for variable named '${t}'`);return await e.getObject(n)}function hC(){const[e,t]=T.exports.useState(),[n,s]=T.exports.useState(),[o,i]=T.exports.useState(),[r,l]=T.exports.useState(),[a,c]=T.exports.useState(!0),d=T.exports.useMemo(()=>new URLSearchParams(window.location.search),[]),u=d.get("canCopy")!=null,m=d.get("canDownloadCsv")!=null;T.exports.useEffect(function(){async function f(){try{const w=d.get("name");if(w==null)throw new Error("No name param provided");const C=new URL("/jsapi",`${window.location}`),S=`${C.protocol}//${C.host}`;Ps.debug("Starting connection...");const b=new I.IdeConnection(S);Ps.debug("Loading table",w,"...");const E=await uC(b,w);Ps.debug("Creating model...");const v=await lC.makeModel(E);t(v),Ps.debug("Table successfully loaded!")}catch(w){Ps.error("Unable to load table",w),s(`${w}`)}c(!1)}f()},[d]),T.exports.useEffect(function(){function f(w){const{command:C,value:S}=w.data;switch(C){case"filter":{const E=S.map(({name:v,value:y})=>{const M=e==null?void 0:e.columns.find(A=>A.name===v);if(M==null)throw new Error(`Could not find column named ${v}`);return{name:v,value:y,type:x.getNormalizedType(M.type)}});i(E);break}case"sort":{const E=S.map(({name:v,direction:y})=>{const M=e==null?void 0:e.columns.find(A=>A.name===v);if(M==null)throw new Error(`Could not find column named ${v}`);return y==="DESC"?M.sort().desc():M.sort().asc()});l(E);break}}}return window.addEventListener("message",f),()=>{window.removeEventListener("message",f)}},[e]);const p=e!=null;return R("div",{className:"App",children:[p&&h(vo,{canCopy:u,canDownloadCsv:m,model:e,inputFilters:o,sorts:r}),!p&&h(Da,{isLoaded:p,isLoading:a,errorMessage:n!=null?n:null}),h(Wu,{})]})}ar.render(h(hC,{}),document.getElementById("root"));
|
|
33
|
+
//# sourceMappingURL=index.5dfe90f8.js.map
|