@deephaven/code-studio 0.24.1-beta.0 → 0.24.1-hierarchical-table.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -3,7 +3,7 @@ import{B as R,A as S,R as Y,P as og,C as h,D as ut,E as W,F as v,G as ui,H as hl
|
|
|
3
3
|
`)}`:""}constructor(e){this.history=[],this.offset=0,this.limit=1e4,this.isEnabled=!1,this.proxy=e,this.addHistory=this.addHistory.bind(this)}enable(){this.isEnabled||(this.proxy.addEventListener(Ht.DEBUG,this.addHistory),this.proxy.addEventListener(Ht.LOG,this.addHistory),this.proxy.addEventListener(Ht.WARN,this.addHistory),this.proxy.addEventListener(Ht.ERROR,this.addHistory),this.proxy.addEventListener(Ht.UNCAUGHT_ERROR,this.addHistory),this.isEnabled=!0)}disable(){!this.isEnabled||(this.proxy.removeEventListener(Ht.DEBUG,this.addHistory),this.proxy.removeEventListener(Ht.LOG,this.addHistory),this.proxy.removeEventListener(Ht.WARN,this.addHistory),this.proxy.removeEventListener(Ht.ERROR,this.addHistory),this.proxy.removeEventListener(Ht.UNCAUGHT_ERROR,this.addHistory),this.isEnabled=!1)}addHistory({type:e,detail:n}){const s={type:e,messages:n,time:new Date};switch(e){case Ht.ERROR:case Ht.UNCAUGHT_ERROR:s.stack=Error().stack;break}this.history[this.offset%this.limit]=s,this.offset+=1}getHistory(){if(this.offset>this.limit){const e=this.offset%this.limit;this.history=this.history.slice(e).concat(this.history.slice(0,e)),this.offset=this.limit}return this.history}getFormattedHistory(){return this.getHistory().map(n=>`${n.time.toISOString()} ${n.type} ${Kr.formatMessages(n.messages)}`+(n.stack!=null?`
|
|
4
4
|
${Kr.formatStack(n.stack,n.type)}`:"")).join(`
|
|
5
5
|
`)}}const rf=X.module("Tooltip"),sn=class extends S.exports.Component{constructor(t){super(t),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.handleWindowMouseMove=this.handleWindowMouseMove.bind(this),this.handleWheel=this.handleWheel.bind(this),this.handleTimeout=this.handleTimeout.bind(this),this.handleExited=this.handleExited.bind(this),this.stopShowingTooltip=this.stopShowingTooltip.bind(this),this.container=Y.createRef(),this.popper=Y.createRef(),this.parent=null,this.timer=null,this.state={isShown:!1}}static handleHidden(){sn.shownTooltipCount-=1,sn.shownTooltipCount===0&&(sn.lastHiddenTime=Date.now())}static handleShown(){sn.shownTooltipCount+=1}componentDidMount(){this.startListening();const{timeout:t}=this.props;t===0&&this.show()}componentDidUpdate(t,e){const{isShown:n}=e,{isShown:s}=this.state;s!==n&&(s?sn.handleShown():sn.handleHidden())}componentWillUnmount(){this.stopListening(),this.stopListeningWindow(),this.stopTimer();const{isShown:t}=this.state;t&&sn.handleHidden()}startListening(){if(!this.container.current||!this.container.current.parentElement){rf.error("Tooltip doesn't have a container or a parent set!");return}this.parent=this.container.current.parentElement,this.parent.addEventListener("mousemove",this.handleMouseMove),this.parent.addEventListener("mouseleave",this.handleMouseLeave),this.parent.addEventListener("mousedown",this.stopShowingTooltip)}stopListening(){!this.parent||(this.parent.removeEventListener("mousemove",this.handleMouseMove),this.parent.removeEventListener("mouseleave",this.handleMouseLeave),this.parent.removeEventListener("mousedown",this.stopShowingTooltip))}startListeningWindow(){window.addEventListener("mousemove",this.handleWindowMouseMove,!0),window.addEventListener("contextmenu",this.stopShowingTooltip,!0),window.addEventListener("wheel",this.handleWheel)}stopListeningWindow(){window.removeEventListener("mousemove",this.handleWindowMouseMove,!0),window.removeEventListener("contextmenu",this.stopShowingTooltip,!0),window.removeEventListener("wheel",this.handleWheel)}handleMouseMove(){this.startTimer()}handleWheel(){const{isShown:t}=this.state;this.popper.current&&this.parent&&t&&!this.popper.current.element.matches(":hover")&&!this.parent.matches(":hover")&&(this.stopTimer(),this.hide())}handleMouseLeave(){const{isShown:t}=this.state;this.stopTimer();const{interactive:e}=this.props;!e&&t&&this.hide()}handleTimeout(){this.show()}handleWindowMouseMove(t){const e=t.clientX,n=t.clientY,{isShown:s}=this.state;if(!this.popper.current||!this.parent)return;const i=this.popper.current.element.getBoundingClientRect(),o=this.parent.getBoundingClientRect();e>=i.left&&e<=i.left+i.width&&n>=i.top&&n<=i.top+i.height?this.handleMouseMove():e>=o.left&&e<=o.left+o.width&&n>=o.top&&n<=o.top+o.height?this.handleMouseMove():s&&(this.stopTimer(),this.hide())}startTimer(){this.stopTimer();const{timeout:t,reshowTimeout:e}=this.props;let n=t;(sn.shownTooltipCount>0||Date.now()-sn.lastHiddenTime<sn.triggerReshowThreshold)&&(n=e),this.timer=window.setTimeout(this.handleTimeout,n)}stopTimer(){this.timer!=null&&(clearTimeout(this.timer),this.timer=null)}show(){var e;const{isShown:t}=this.state;if(this.stopTimer(),!t){(e=this.popper.current)==null||e.show(),this.setState({isShown:!0});const{interactive:n}=this.props;n&&this.startListeningWindow()}}hide(){var t;(t=this.popper.current)==null||t.hide(),this.stopListeningWindow()}update(){var t;(t=this.popper.current)==null||t.scheduleUpdate()}handleExited(){this.setState({isShown:!1});const{onExited:t}=this.props;t()}stopShowingTooltip(){const{isShown:t}=this.state;this.stopTimer(),t&&this.hide()}render(){const{interactive:t,children:e,options:n,referenceObject:s,popperClassName:i,"data-testid":o,onEntered:r}=this.props,{isShown:l}=this.state;return h("div",{ref:this.container,style:{display:"none"},"data-testid":o,children:h(kn,{className:W(i),options:n,ref:this.popper,onEntered:r,onExited:this.handleExited,interactive:t,referenceObject:s,children:v("div",{className:"tooltip-content",children:[" ",l&&e]})})})}};let Ue=sn;Ue.defaultTimeout=500;Ue.defaultReshowTimeout=100;Ue.triggerReshowThreshold=300;Ue.shownTooltipCount=0;Ue.lastHiddenTime=Date.now();Ue.defaultProps={interactive:!1,options:{},popperClassName:"",reshowTimeout:sn.defaultReshowTimeout,timeout:sn.defaultTimeout,onEntered:()=>{},onExited:()=>{},"data-testid":void 0};const lf=100;var uu=(t=>(t.UP="UP",t.DOWN="DOWN",t))(uu||{});const Xs=class extends S.exports.Component{constructor(t){super(t),this.getCachedFilteredOptions=ve((n,s)=>n.filter(i=>i.title.toLowerCase().indexOf(s.toLowerCase())>=0));let{popperOptions:e}=this.props;e={placement:"bottom-end",modifiers:{preventOverflow:{enabled:!1}},...e},this.state={title:"",filteredOptions:[],keyboardOptionIndex:0,menuIsOpen:!1,inputWidth:100,invalid:!1,popperOptions:e},this.handleMenuKeyDown=this.handleMenuKeyDown.bind(this),this.handleMenuBlur=this.handleMenuBlur.bind(this),this.handleInputChange=this.handleInputChange.bind(this),this.handleInputKeyDown=this.handleInputKeyDown.bind(this),this.handleInputBlur=this.handleInputBlur.bind(this),this.handelInputFocus=this.handelInputFocus.bind(this),this.handleInputClick=this.handleInputClick.bind(this),this.updateInputValue=je(this.updateInputValue,lf),this.handleOptionClick=this.handleOptionClick.bind(this),this.handleMenuOpened=this.handleMenuOpened.bind(this),this.handleMenuExited=this.handleMenuExited.bind(this),this.popper=Y.createRef(),this.cbContainer=Y.createRef(),this.menuContainer=Y.createRef(),this.input=Y.createRef()}setInputWidth(){this.cbContainer.current&&this.setState({inputWidth:this.cbContainer.current.getBoundingClientRect().width})}getValueAndValidate(t){if(!t)return this.setState({invalid:!1}),{value:t,isValid:!1};const{options:e}=this.props,n=e.filter(s=>s.title.toLowerCase()===t.toLowerCase());return n.length<1?(this.setState({invalid:!0}),{value:t,isValid:!1}):(this.setState({invalid:!1}),{value:n[0].value,isValid:!0})}updateInputValue(t){const{menuIsOpen:e}=this.state,{value:n,isValid:s}=this.getValueAndValidate(t);e&&this.processFilterChange(t),this.fireOnChange(n,s)}fireOnChange(t,e=!0){const{onChange:n}=this.props;n(t,e)}processFilterChange(t){var o;const{options:e}=this.props,{menuIsOpen:n}=this.state,s=t?this.getCachedFilteredOptions(e,t):e,i=s.length===1&&s[0].title===t;if(this.setState({filteredOptions:s,keyboardOptionIndex:0}),i&&n){this.closeMenu();return}(o=this.popper.current)==null||o.scheduleUpdate()}resetValue(){this.setState({title:""}),this.fireOnChange("")}handleResize(){this.setInputWidth()}handleMenuKeyDown(t){var i;const{filteredOptions:e,keyboardOptionIndex:n}=this.state,s=e[n];switch(t.key){case"Enter":case"ArrowRight":t.stopPropagation(),t.preventDefault(),s!=null&&(this.setState({title:s.title,invalid:!1}),this.fireOnChange(s.value)),this.closeMenu(),(i=this.input.current)==null||i.focus();break;case"ArrowUp":t.stopPropagation(),t.preventDefault(),this.navigateMenu(Xs.MENU_NAVIGATION_DIRECTION.UP);break;case"ArrowDown":t.stopPropagation(),t.preventDefault(),this.navigateMenu(Xs.MENU_NAVIGATION_DIRECTION.DOWN);break;case"Tab":if(t.stopPropagation(),t.preventDefault(),t.shiftKey){this.navigateMenu(Xs.MENU_NAVIGATION_DIRECTION.UP);break}this.navigateMenu(Xs.MENU_NAVIGATION_DIRECTION.DOWN);break;case"Escape":t.preventDefault(),t.stopPropagation(),this.closeMenu();break}}navigateMenu(t){const{filteredOptions:e,keyboardOptionIndex:n}=this.state;let s=n;t===Xs.MENU_NAVIGATION_DIRECTION.UP?n>0?(s=(s-1)%e.length,this.setState({keyboardOptionIndex:s})):n===0&&(s=e.length-1,this.setState({keyboardOptionIndex:s})):t===Xs.MENU_NAVIGATION_DIRECTION.DOWN&&n<e.length&&(s=(s+1)%e.length,this.setState({keyboardOptionIndex:s})),this.scrollOptionIntoView(s)}handleInputKeyDown(t){const{onEnter:e}=this.props,{menuIsOpen:n}=this.state;n?this.handleMenuKeyDown(t):t.key==="Enter"?e():t.key==="Escape"?(this.resetValue(),t.preventDefault(),t.stopPropagation()):t.key==="ArrowRight"||t.key==="ArrowLeft"||t.key==="Tab"||t.key==="Shift"||this.openMenu()}handleInputChange(t){this.setState({title:t.target.value}),this.updateInputValue(t.target.value)}handleOptionClick(t){var e;this.setState({title:t.title,invalid:!1}),this.fireOnChange(t.value),this.closeMenu(),(e=this.input.current)==null||e.focus()}handelInputFocus(){const{menuIsOpen:t}=this.state;t||this.openMenu()}handleInputClick(){const{menuIsOpen:t}=this.state;t||this.openMenu()}handleInputBlur(t){const{menuIsOpen:e}=this.state;e&&t.relatedTarget instanceof Element&&this.popper.current!==null&&this.popper.current.element.contains(t.relatedTarget)||this.closeMenu(!1)}handleMenuBlur(t){t.relatedTarget===this.input.current||t.relatedTarget instanceof Element&&this.popper.current!==null&&this.popper.current.element.contains(t.relatedTarget)||this.closeMenu(!1)}handleMenuOpened(){var t;(t=this.input.current)==null||t.focus()}handleMenuExited(){const{menuIsOpen:t}=this.state;t&&this.setState({menuIsOpen:!1,keyboardOptionIndex:0})}openMenu(){const{title:t}=this.state;this.processFilterChange(t),this.setInputWidth(),this.setState({menuIsOpen:!0}),window.requestAnimationFrame(()=>{var e;(e=this.popper.current)==null||e.show()})}closeMenu(t=!0){var e,n;this.setState({menuIsOpen:!1,keyboardOptionIndex:0}),t&&((e=this.input.current)==null||e.focus()),(n=this.popper.current)==null||n.hide()}scrollOptionIntoView(t){var e;this.menuContainer.current&&((e=this.menuContainer.current.children.item(t))==null||e.scrollIntoView({behavior:"smooth",block:"nearest"}))}renderMenuElement(){const{inputWidth:t}=this.state;return h("div",{className:W("aci-options"),ref:this.menuContainer,role:"presentation",onKeyDown:this.handleMenuKeyDown,style:{width:t},onBlur:this.handleMenuBlur,children:this.renderOptions()})}renderOptions(){const{noMatchText:t}=this.props,{title:e,filteredOptions:n}=this.state;return e&&n.length===0?h("div",{className:"no-match",children:t}):n.map((s,i)=>this.renderOption(s,i))}renderOption(t,e){const{keyboardOptionIndex:n}=this.state,s=`option-${e}-${t.value}`;return h("button",{type:"button",className:W("aci-option-btn",{"keyboard-active":n===e}),onClick:()=>this.handleOptionClick(t),onFocus:()=>this.setState({keyboardOptionIndex:e}),children:t.title},s)}render(){const{options:t,inputPlaceholder:e,disabled:n,className:s,defaultTitle:i,spellCheck:o,"data-testid":r}=this.props,{title:l,menuIsOpen:a,popperOptions:d,invalid:c}=this.state;return v("div",{className:"aci-container",ref:this.cbContainer,children:[h("input",{value:l||i,className:W("form-control",s,"aci-input",{"is-invalid":c&&!a}),ref:this.input,onChange:this.handleInputChange,placeholder:e||t[0].title,disabled:n,onFocus:this.handelInputFocus,onClick:this.handleInputClick,onBlur:this.handleInputBlur,onKeyDown:this.handleInputKeyDown,spellCheck:o,"data-testid":r}),h(kn,{ref:this.popper,options:d,className:W("aci-options-popper interactive"),onEntered:this.handleMenuOpened,onExited:this.handleMenuExited,children:this.renderMenuElement()})]})}};let id=Xs;id.propTypes={options:R.exports.arrayOf(R.exports.shape({title:R.exports.string.isRequired,value:R.exports.string.isRequired})).isRequired,popperOptions:R.exports.shape({}),onChange:R.exports.func,inputPlaceholder:R.exports.string,disabled:R.exports.bool,className:R.exports.string,defaultTitle:R.exports.string,spellCheck:R.exports.bool,onEnter:R.exports.func,noMatchText:R.exports.string,"data-testid":R.exports.string};id.defaultProps={onChange(){},inputPlaceholder:"",disabled:!1,className:"",defaultTitle:"",popperOptions:null,spellCheck:!0,onEnter(){},noMatchText:"No matching items found","data-testid":void 0};id.MENU_NAVIGATION_DIRECTION=uu;R.exports.string.isRequired,R.exports.func.isRequired,R.exports.string,R.exports.string,R.exports.bool,R.exports.bool,R.exports.string,R.exports.string,R.exports.string;function ml(t){const{children:e,className:n,style:s,"data-testid":i}=t;return h("div",{className:W("btn-group",n),style:s,role:"group","data-testid":i,children:e})}ml.displayName="ButtonGroup";ml.propTypes={children:R.exports.node.isRequired,className:R.exports.string,style:R.exports.object,"data-testid":R.exports.string};ml.defaultProps={className:null,style:{},"data-testid":void 0};const af=["primary","secondary","tertiary","success","danger","inline","ghost"],df=["group-end"];function cf(t,e){switch(t){case"primary":return"btn-primary";case"secondary":return"btn-outline-primary";case"tertiary":return"btn-secondary";case"success":return"btn-success";case"danger":return"btn-danger";case"inline":return"btn-inline";case"ghost":return W("btn-link",{"btn-link-icon":e,"btn-link-icon-only":e})}}function hf(t){switch(t){case"group-end":return W("pl-2","pr-3")}}const z=Y.forwardRef((t,e)=>{const{kind:n,variant:s,type:i,tooltip:o,icon:r,disabled:l,active:a,onClick:d,onContextMenu:c,onMouseDown:u,onMouseUp:m,onMouseEnter:p,onMouseLeave:g,onKeyDown:f,className:b,style:C,children:w,tabIndex:T,"data-testid":y,"aria-label":E}=t,I=Boolean(r&&w==null),D=cf(n,I);let F;s&&(F=hf(s));let x;r&&(x=Y.isValidElement(r)?r:h(j,{icon:r}));let U;o!==void 0&&(U=typeof o=="string"?h(Ue,{children:o}):o);let B=E;E===void 0&&I&&o!=null&&typeof o=="string"&&(B=o);const _=v("button",{"data-testid":y,ref:e,type:i,className:W("btn",D,F,{active:a},b),onClick:d,onContextMenu:c,onMouseUp:m,onMouseDown:u,onMouseEnter:p,onMouseLeave:g,onKeyDown:f,style:C,disabled:l,tabIndex:T,"aria-label":B,children:[r&&x,w,o!=null&&(l===void 0||!l)&&U]});return l!==void 0&&l?v("span",{className:"btn-disabled-wrapper",children:[_,o!==void 0&&U]}):_});z.displayName="Button";z.propTypes={kind:R.exports.oneOf(af).isRequired,variant:R.exports.oneOf(df),type:R.exports.oneOf(["submit","reset","button"]),tooltip(t){const{tooltip:e,icon:n,children:s}=t;return e===void 0&&n!=null&&s==null?new Error("Tooltip is required for icon only buttons"):null},icon(t){const{children:e,icon:n}=t;return n==null&&e==null?new Error("Icon is required if no children are provided"):e==null&&!Y.isValidElement(n)&&(n==null||n.iconName===""||n.iconName==null)?new Error("Icon must be react element or fontawesome IconDefinition"):null},disabled:R.exports.bool,active:R.exports.bool,onClick(t){const{onClick:e,type:n}=t;return n==="button"&&typeof e!="function"?new Error("type button requires an onClick function"):e!==void 0&&typeof e!="function"?new Error("onClick must be a function"):null},onContextMenu:R.exports.func,onMouseUp:R.exports.func,onMouseDown:R.exports.func,onMouseEnter:R.exports.func,onMouseLeave:R.exports.func,onKeyDown:R.exports.func,tabIndex:R.exports.number,children:R.exports.node,className:R.exports.string,style:R.exports.object,"data-testid":R.exports.string};z.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 $o({className:t="theme-bg-light",children:e,role:n="role",keyboard:s=!0,isOpen:i=!1,centered:o=!1,size:r,onOpened:l,onClosed:a,toggle:d,"data-testid":c}){const u=S.exports.useRef(),m=S.exports.useRef(null),[p,g]=S.exports.useState(!1),f=S.exports.useCallback(C=>{switch(C.key){case"Escape":d==null||d();break}},[d]);S.exports.useEffect(function(){if(i&&s)return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[f,i,s]),S.exports.useEffect(function(){i&&l&&l()},[l,i]),S.exports.useEffect(function(){!i&&a&&a()},[a,i]),i&&!u.current&&(u.current=document.createElement("div"),u.current.setAttribute("style","padding-right: 15px; display: block"),u.current.setAttribute("role","presentation"),document.body.appendChild(u.current));const b=()=>{u.current&&(document.body.removeChild(u.current),u.current=void 0)};return u.current?ui.createPortal(v(ye,{children:[h(ut,{appear:!0,mountOnEnter:!0,unmountOnExit:!0,in:i,classNames:{appearActive:"show",appearDone:"show"},timeout:It.transitionMs,onExited:b,children:h("div",{className:W("modal-backdrop fade"),style:{zIndex:1050}})}),h(ut,{appear:!0,mountOnEnter:!0,unmountOnExit:!0,in:i,classNames:{appearDone:"show"},timeout:It.transitionMs,onExited:b,children:h("div",{ref:m,className:"modal fade",onMouseDown:C=>{C.target===m.current?g(!0):g(!1)},onMouseUp:C=>{p&&C.target===m.current&&d!==void 0&&d()},role:"dialog",style:{display:"block"},children:h("div",{className:W(`modal-dialog ${t}`,{"modal-lg":r==="lg","modal-sm":r==="sm","modal-xl":r==="xl","modal-dialog-centered":o}),style:{zIndex:1040},children:h("div",{className:"modal-content",role:"presentation","data-testid":c,children:e})})})})]}),u.current):null}function Wo({className:t="modal-body",style:e,children:n,"data-testid":s}){return h("div",{className:t,"data-testid":s,style:e,children:n})}function zo({className:t,children:e,closeButton:n=!0,style:s,toggle:i,"data-testid":o}){return v("div",{className:`modal-header ${t}`,style:s,children:[h("h5",{className:"modal-title",children:e}),n&&h("button",{type:"button",className:"close","data-dismiss":"modal","aria-label":"Close",onClick:i,children:h("span",{"aria-hidden":"true",children:"\xD7"})})]})}function od({className:t="modal-footer",children:e,"data-testid":n}){return h("div",{className:t,"data-testid":n,children:e})}function $i(t){const{isOpen:e,headerText:n,bodyText:s,onCancel:i,onConfirm:o,onDiscard:r,onModalDisable:l,cancelButtonText:a="Cancel",confirmButtonText:d="Okay",discardButtonText:c="Discard",children:u,"data-testid":m}=t,p=S.exports.useRef(null),g=S.exports.useRef(null),f=S.exports.useCallback(()=>{g.current!==null&&g.current.checked&&l&&l(),o()},[o,l]);let b="";return e&&(b=typeof s=="function"?s():s),v($o,{isOpen:e,className:"theme-bg-light",onOpened:()=>{var C;(C=p.current)==null||C.focus()},children:[h(zo,{closeButton:!1,children:n}),h(Wo,{children:b}),v(od,{children:[l&&v("div",{className:"custom-control custom-checkbox form-group mr-auto",children:[h("input",{type:"checkbox",className:"custom-control-input",id:"move-confirmation-checkbox",defaultChecked:!1,ref:g,"data-testid":m!==void 0?`${m}-checkbox-confirm`:void 0}),h("label",{className:"custom-control-label",htmlFor:"move-confirmation-checkbox",children:"Don't ask me again"})]}),r&&h(z,{kind:"secondary",className:"mr-auto","data-dismiss":"modal",onClick:r,"data-testid":m!==void 0?`${m}-btn-discard`:void 0,children:c}),i&&h(z,{kind:"secondary","data-dismiss":"modal",onClick:i,"data-testid":m!==void 0?`${m}-btn-cancel`:void 0,children:a}),v(ml,{children:[h(z,{kind:"primary",onClick:f,ref:p,"data-testid":m!==void 0?`${m}-btn-confirm`:void 0,children:d}),u]})]})]})}$i.propTypes={isOpen:R.exports.bool.isRequired,headerText:R.exports.string.isRequired,bodyText:R.exports.oneOfType([R.exports.string,R.exports.func]).isRequired,onCancel:R.exports.func,onConfirm:R.exports.func.isRequired,onDiscard:R.exports.func,onModalDisable:R.exports.func,cancelButtonText:R.exports.string,confirmButtonText:R.exports.string,discardButtonText:R.exports.string,children:R.exports.node,"data-testid":R.exports.string};$i.defaultProps={children:void 0,cancelButtonText:"Cancel",confirmButtonText:"Okay",discardButtonText:"Discard",onCancel:void 0,onDiscard:void 0,onModalDisable:void 0,"data-testid":void 0};const Ao=Y.forwardRef((t,e)=>{const{children:n,className:s,disabled:i,onClick:o,style:r,id:l}=t;return h("button",{ref:e,type:"button",className:W("btn",s),onClick:o,style:r,disabled:i,id:l,children:n})});Ao.displayName="Button";Ao.propTypes={children:R.exports.node,className:R.exports.string,disabled:R.exports.bool,onClick:R.exports.func,style:R.exports.shape({}),id:R.exports.string};Ao.defaultProps={children:null,className:"",disabled:!1,onClick:()=>null,style:{},id:""};function rd({className:t,isFlipped:e,children:n,"data-testid":s}){const i=a=>{if(n.length!==2)throw new Error("CardFlip requires 2 children to function");return n[a]},o=S.exports.useRef(null),r=S.exports.useCallback(a=>{a.target===a.currentTarget&&document.body.classList.add("card-flip--is-flipping")},[]),l=S.exports.useCallback(a=>{a.target===a.currentTarget&&document.body.classList.remove("card-flip--is-flipping")},[]);return S.exports.useEffect(function(){if(!o.current)throw Error("ref undefined");o.current.addEventListener("transitionstart",r);const d=o.current;return function(){if(d!=null)return d.removeEventListener("transitionstart",r)}},[r]),v("div",{className:W(t,{"card-flip--show-front":e,"card-flip--show-back":!e}),"data-testid":s,children:[h("div",{className:"card-flip--back",children:i(0)}),h("div",{ref:o,className:"card-flip--front",onTransitionEnd:l,children:i(1)})]})}function oa(t){return t.then!==void 0}const Ni=class{static disableAllActions(){Ni.actionsDisabled=!0}static enableAllActions(){Ni.actionsDisabled=!1}static isContextActionEvent(t){return Array.isArray(t.contextActions)}static compareActions(t,e){var n,s,i,o,r,l;return t.group!==e.group?((n=t.group)!=null?n:0)>((s=e.group)!=null?s:0)?1:-1:t.order!==e.order?((i=t.order)!=null?i:0)>((o=e.order)!=null?o:0)?1:-1:t.title!==e.title?((r=t.title)!=null?r:"")>((l=e.title)!=null?l:"")?1:-1:t!==e?t>e?1:-1:0}static sortActions(t){if(t==null||!Array.isArray(t))return[];const e=t.slice();return e.sort(Ni.compareActions),e}static isMacPlatform(){const{platform:t}=window.navigator;return t.startsWith("Mac")}static getModifierKey(){return Ni.isMacPlatform()?"metaKey":"ctrlKey"}static isModifierKeyDown(t){const e=Ni.getModifierKey();return t[e]}static getMenuItems(t,e=!0){let n=[],s=t;Array.isArray(s)||(s=[s]);for(let i=0;i<s.length;i+=1){const o=s[i];let r;typeof o=="function"?r=o():r=o,r!=null&&(r instanceof Promise?e&&n.push(r):Array.isArray(r)?n=n.concat(r):n.push(r))}return n=n.filter(i=>i.title!==void 0||i.then!=null||i.menuElement),n}static getNextMenuItem(t,e,n){let s=t;s<0&&e<0&&(s=n.length);for(let i=1;i<n.length+1;i+=1){const o=(s+e*i+n.length)%n.length,r=n[o];if(!(r instanceof Promise)&&r.disabled!==!0)return o}return t}};let We=Ni;We.actionsDisabled=!1;const Rc=X.module("GlobalContextAction");class uf extends S.exports.Component{constructor(e){super(e),this.handleContextMenu=this.handleContextMenu.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this)}componentDidMount(){document.body.addEventListener("contextmenu",this.handleContextMenu),document.body.addEventListener("keydown",this.handleKeyDown)}componentWillUnmount(){document.body.removeEventListener("contextmenu",this.handleContextMenu),document.body.removeEventListener("keydown",this.handleKeyDown)}handleContextMenu(e){const n=e;n.contextActions==null&&(n.contextActions=[]);const{action:s}=this.props;s.title==null&&!s.menuElement||(n.contextActions==null&&(n.contextActions=[]),n.contextActions.push(s),Rc.debug("Received context menu event at global action! Menu items are now: ",n.contextActions))}handleKeyDown(e){var s;const{action:n}=this.props;!We.actionsDisabled&&n.shortcut!==void 0&&n.shortcut.matchesEvent(e)&&(Rc.debug("Global hotkey matched!",e),(s=n.action)==null||s.call(n,e),e.preventDefault(),e.stopPropagation())}render(){return null}}class mf extends S.exports.Component{render(){const{actions:e,"data-testid":n}=this.props,s=[];for(let i=0;i<e.length;i+=1){const o=e[i],{shortcut:r}=o;if(o.title!=null||o.menuElement||r){const l=h(uf,{action:o,"data-testid":n},`${o.title}.${r==null?void 0:r.id}`);s.push(l)}}return s}}const Cr=X.module("ContextActions");class oe extends S.exports.Component{constructor(e){super(e),this.handleContextMenu=this.handleContextMenu.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.container=Y.createRef(),this.state={globalActions:[],keyboardActions:[]}}static triggerMenu(e,n,s,i){if(i.length===0)return;const o=new MouseEvent("contextmenu",{clientX:n,clientY:s,bubbles:!0,cancelable:!0});o.contextActions=i,e.dispatchEvent(o)}static getDerivedStateFromProps(e){if(e.actions==null||!Array.isArray(e.actions))return{globalActions:[],keyboardActions:[]};const n=e.actions.filter(i=>!oa(i)&&typeof i!="function"&&i.isGlobal),s=e.actions.filter(i=>!oa(i)&&typeof i!="function"&&(i.isGlobal===void 0||!i.isGlobal)&&i.shortcut!=null);return{globalActions:n,keyboardActions:s}}componentDidMount(){var e;(e=this.container.current)!=null&&e.parentElement&&(this.container.current.parentElement.addEventListener("contextmenu",this.handleContextMenu),this.container.current.parentElement.addEventListener("keydown",this.handleKeyDown))}componentWillUnmount(){var e;(e=this.container.current)!=null&&e.parentElement&&(this.container.current.parentElement.removeEventListener("contextmenu",this.handleContextMenu),this.container.current.parentElement.removeEventListener("keydown",this.handleKeyDown))}handleContextMenu(e){const{ignoreClassNames:n=[]}=this.props;if(n.length>0){let i=e.target;for(;i!=null;){const{classList:o}=i,r=n.find(l=>o.contains(l));if(r!==void 0){Cr.debug2(`Contextmenu event ignored based on the target className "${r}"`);return}i=i.parentElement}}if(We.isContextActionEvent(e)||(e.contextActions=[]),!We.isContextActionEvent(e))return;const{actions:s}=this.props;if(s!=null){let i=s;Array.isArray(i)&&(i=i.filter(o=>oa(o)||typeof o=="function"||o.isGlobal===void 0||!o.isGlobal)),e.contextActions=e.contextActions.concat(i)}Cr.debug("Received context menu event! Menu items are now: ",e.contextActions)}handleKeyDown(e){var s;const{keyboardActions:n}=this.state;for(let i=0;i<n.length;i+=1){const o=n[i];!We.actionsDisabled&&o.shortcut!=null&&o.shortcut.matchesEvent(e)&&(Cr.debug("Context hotkey matched!",e),(s=o.action)==null||s.call(o,e),e.stopPropagation(),e.preventDefault(),Cr.debug2("Matched hotkey returned false, key event not consumed"))}}render(){const{"data-testid":e}=this.props,{globalActions:n}=this.state;return h("div",{className:"context-actions-listener",ref:this.container,"data-testid":e,children:h(mf,{actions:n})})}}oe.groups={default:null,high:100,medium:5e3,low:1e4,global:1e5,edit:100};var pf={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"]},Dc={prefix:"vs",iconName:"arrow-small-down",icon:[512,512,[],"f000","m342.4 276.48 -80 80h-22.4L160 276.48l22.4 -22.72 52.8 52.48V128h32v178.24L320 253.44l22.4 23.04z"]},Ra={prefix:"vs",iconName:"arrow-small-up",icon:[512,512,[],"f000","M160 208 240 128h22.4l80 80 -22.4 22.72 -52.8 -52.48v178.24h-32V178.24L182.4 231.04 160 208z"]},gf={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"]},ds={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"]},ff={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"]},Cf={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"]},mu={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"]},bf={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"]},Po={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"]},Sf={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"]},wf={prefix:"vs",iconName:"circle-slash",icon:[512,512,[],"f000","M256 32a224 224 0 1 1 -224 224 224.256 224.256 0 0 1 224 -224zM64 256c0 45.376 16.128 89.28 45.536 123.84l270.304 -270.304A191.776 191.776 0 0 0 64 256zm384 0c0 -45.376 -16.128 -89.28 -45.536 -123.84L132.16 402.464A191.776 191.776 0 0 0 448 256z"]},Mc={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"]},Xi={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"]},vf={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"]},Tf={prefix:"vs",iconName:"code",icon:[512,512,[],"f000","M150.656 178.496 65.952 263.168l84.704 84.672 -22.656 22.656 -96 -96V251.84l96 -96 22.656 22.656zm224 -22.656L352 178.496l84.704 84.672L352 347.84l22.656 22.656 96 -96V251.84l-96 -96zM157.056 416l28.608 14.336 160 -320L317.056 96l-160 320z"]},Ef={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"]},Da={prefix:"vs",iconName:"device-camera",icon:[512,512,[],"f000","M342.624 96H464l16 16v288l-16 16h-416l-16 -16v-288l16 -16h121.376l27.296 -27.328L208 64h96l11.328 4.672 27.296 27.328zM64 384h384V128h-112l-11.328 -4.672L297.376 96H214.624l-27.296 27.328L176 128H64v256zm48 -224a16 16 0 1 0 0 32 16 16 0 0 0 0 -32zM256 192a64 64 0 1 1 0 128 64 64 0 0 1 0 -128zm0 -32a96 96 0 1 0 0 192 96 96 0 0 0 0 -192z"]},pl={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"]},Nc={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"]},yf={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"]},If={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"]},qr={prefix:"vs",iconName:"filter",icon:[512,512,[],"f000","M480 64v53.44l-160 152.288V448H192V269.728l-160 -152.32V64h448zM224 256v160h64V256l160 -152.32V96H64v7.68L224 256z"]},Rf={prefix:"vs",iconName:"folder-opened",icon:[512,512,[],"f000","M48 448h352l15.36 -11.84 84.16 -224 -15.36 -20.16H448V112l-16 -16H246.72l-27.52 -27.2L208 64h-160l-16 16v352l16 16zM64 96h137.28l27.52 27.2 11.2 4.8H416v64H272l-11.2 4.8 -27.52 27.2H112l-15.04 10.88 -32 98.56L64 96zm324.16 320H70.08l53.44 -160H240l11.2 -4.8 27.52 -27.2h185.28l-75.84 192z"]},Df={prefix:"vs",iconName:"folder",icon:[512,512,[],"f000","M464 96H246.72l-27.2 -27.2L208.32 64h-160l-16 16v352l16 16h416l16 -16v-320L464 96zm-16.32 271.68V416h-384V224h143.68l11.2 -4.8 27.52 -27.52H448v48l-0.32 128zm0 -207.68h-208l-11.2 4.8 -27.52 27.52H64v-96h137.28l27.2 27.2 11.52 4.8H448l-0.32 31.68z"]},Go={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"]},pu={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"]},Ko={prefix:"vs",iconName:"gripper",icon:[512,512,[],"f000","M160 96h64v64H160zm0 128h64v64H160zm0 128h64v64H160zm128 -256h64v64H288zm0 128h64v64H288zm0 128h64v64H288z"]},Mf={prefix:"vs",iconName:"home",icon:[512,512,[],"f000","m267.52 43.84 203.52 185.6 -22.72 22.72L416 222.848v208.832l-16 16h-96l-16 -16v-112H224v112l-16 16h-96l-16 -16V223.104L64 252.16l-22.72 -22.72 203.2 -185.6h23.04zM128 194.016v221.664h64v-112l16 -16h96l16 16v112h64V193.824L256 77.76 128 194.016z"]},Nf={prefix:"vs",iconName:"info",icon:[512,512,[],"f000","M274.176 32.992A217.6 217.6 0 0 1 408.32 97.6a225.92 225.92 0 0 1 14.72 300.48 219.2 219.2 0 0 1 -274.56 55.68 224 224 0 0 1 -99.84 -112 227.84 227.84 0 0 1 -7.36 -150.72 224 224 0 0 1 88.64 -121.28 217.6 217.6 0 0 1 144.256 -36.768zM289.28 444.16a188.48 188.48 0 0 0 109.12 -66.24 194.24 194.24 0 0 0 -12.8 -257.92 186.24 186.24 0 0 0 -237.76 -23.68 193.92 193.92 0 0 0 16 329.28 185.92 185.92 0 0 0 125.44 18.56zM236 192h40V160h-40v32zm40 32v128h-40V224h40z"]},Ff={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"]},gu={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"]},xf={prefix:"vs",iconName:"law",icon:[512,512,[],"f000","M468.16 224 416 96h32V64H288V32H256v32H96v32h32L76.16 224H64v32h4.8c4.992 15.936 15.136 29.76 28.8 39.36a79.04 79.04 0 0 0 92.8 0A78.08 78.08 0 0 0 219.52 256H224V224h-14.4L156.16 96H256v256H192l-12.48 5.76 -64 80.32 12.48 25.92h288l12.48 -25.92 -64 -80.32L352 352H288V96h100.16l-53.44 128H320v32h4.8a79.36 79.36 0 0 0 150.72 0H480V224h-11.84zM167.04 272.32a48.64 48.64 0 0 1 -23.04 6.08 46.4 46.4 0 0 1 -22.72 -6.08A47.04 47.04 0 0 1 104 256h80a48.64 48.64 0 0 1 -16.96 16.32zM175.04 224h-64l32 -76.8 32 76.8zm169.28 160L384 432H160L199.68 384h144.64zm56.96 -236.16 32 76.8h-64l32 -76.8zm21.76 125.12a45.12 45.12 0 0 1 -23.04 6.08 43.2 43.2 0 0 1 -22.72 -6.08 49.6 49.6 0 0 1 -17.28 -16.96h80a43.84 43.84 0 0 1 -16.96 16.96z"]},_f={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"]},ld={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"]},kf={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"]},fu={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"]},Of={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"]},Lf={prefix:"vs",iconName:"markdown",icon:[512,512,[],"f000","M203.04 160h67.2v209.056H223.776l1.76 -169.92 -56.768 169.92H130.304l-57.76 -169.92c1.28 20.608 1.92 169.92 1.92 169.92H32V160h68.992s48.896 143.776 50.464 153.824L203.04 160zm214.72 115.744v-112H355.52v112H293.312l93.344 93.312L480 275.744h-62.24z"]},Af={prefix:"vs",iconName:"menu",icon:[512,512,[],"f000","M512 160H0V128h512v32zm0 256H0v-32h512v32zm0 -128.256H0V256h512v31.744z"]},Cu={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"]},Pf={prefix:"vs",iconName:"new-folder",icon:[512,512,[],"f000","M464 64H246.72l-27.2 -27.2L208.32 32h-160l-16 16v352l16 16H224v-32H63.68V192h143.68l11.2 -4.8 27.52 -27.52H448v48l-0.032 16.32h32.352V80L464 64zm-16.32 64h-208l-11.2 4.8 -27.52 27.52H64v-96h137.28l27.2 27.2 11.52 4.8H448l-0.32 31.68zM416 512h-32v-96H288v-32h96V288h32v96h96v32h-96v96z"]},Hf={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"]},ad={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"]},Yr={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"]},Ma={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"]},Vf={prefix:"vs",iconName:"record-keys",icon:[512,512,[],"f000","M448 96H96a32 32 0 0 0 -32 32v224a32 32 0 0 0 32 32h352a32 32 0 0 0 32 -32V128a32 32 0 0 0 -32 -32zm0 256H96V128h352v224zm-96 -192h-32v32h32V160zm-32 64H288v32h32V224zm64 -64h32v32h-32V160zm32 128h-32v32h32V288zM192 288h160v32H192V288zm224 -64h-64v32h64V224zM256 160h32v32H256V160zm0 64H224v32h32V224zM128 288h32v32H128V288zm0 -128h32v32H128V160zm96 0H192v32h32V160zM128 224h64v32H128V224z"]},ki={prefix:"vs",iconName:"refresh",icon:[512,512,[],"f000","M149.792 96H64V64h112l16 16V192H160V128a160 160 0 1 0 144.96 -24.352l9.664 -30.528A192 192 0 1 1 149.792 96z"]},Jn={prefix:"vs",iconName:"remove",icon:[512,512,[],"f000","M480 256H32V224h448v32z"]},Uf={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"]},Bf={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"]},bu={prefix:"vs",iconName:"save",icon:[512,512,[],"f000","m427.296 36.672 48 48L480 96v368l-16 16h-416l-16 -16v-416l16 -16H416l11.296 4.672zM64 64v384h384V102.656L409.376 64H352v128H128V64H64zm192 0v96h64V64H256z"]},Su={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"]},$f={prefix:"vs",iconName:"split-horizontal",icon:[512,512,[],"f000","M448 32H96L64 64v352l32 32h352l32 -32V64l-32 -32zM256 416H96V64h160v352zm192 0H288V64h160v352z"]},Wf={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"]},Fc={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"]},zf={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"]},wn={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"]},Gn={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"]},wu={prefix:"vs",iconName:"triangle-right",icon:[512,512,[],"f000","M177.92 448 160 434.784V76.576L177.28 64 352 244.064v26.464L177.92 448z"]},cs={prefix:"vs",iconName:"warning",icon:[512,512,[],"f000","M241.92 32h28.16l209.28 392.32 -14.08 23.68H46.08L32 424.32 241.92 32zM256 72.96 72.96 416H438.4L256 72.96zM276 384v-32h-40v32h40zm-40 -64V192h40v128h-40z"]},Gf={prefix:"vs",iconName:"watch",icon:[512,512,[],"f000","M240 288h64V256H256V176H224v96l16 16zm-64 -170.592A159.936 159.936 0 0 0 96 256a159.936 159.936 0 0 0 80 138.592V464l16 16h128l16 -16v-69.408A159.936 159.936 0 0 0 416 256a159.936 159.936 0 0 0 -80 -138.592V48L320 32H192l-16 16v69.408zM384 256a128 128 0 1 1 -256 0 128 128 0 0 1 256 0z"]},Kf={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"]},qf={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"]},Yf={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"]},Xf={prefix:"dh",iconName:"exclamation",icon:[512,512,[],"f000","M275.2 384v-32H236.8v32h38.4zm-38.4 -64V128h38.4v192H236.8z"]},xc={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"]},Na={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"]},jf={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"]},Qf={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"]},Zf={prefix:"dh",iconName:"file-search",icon:[512,512,[],"f000","M412.8 147.2 304 35.2 294.4 32H80l-16 16v384l16 16H224v-32H96V64h160v128h128v32h32V160l-3.2 -12.8zM288 160V64l92.8 96H288zm224 329.6 -92.8 -92.8c9.6 -16 16 -32 16 -51.2 0 -51.2 -41.6 -89.6 -89.6 -89.6C297.6 256 256 297.6 256 345.6s41.6 89.6 89.6 89.6c19.2 0 38.4 -6.4 51.2 -16l92.8 92.8 22.4 -22.4zm-224 -144c0 -32 25.6 -57.6 57.6 -57.6s57.6 25.6 57.6 57.6 -25.6 57.6 -57.6 57.6S288 377.6 288 345.6z"]},Jf={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"]},dd={prefix:"dh",iconName:"filter-filled",icon:[512,512,[],"f000","M480 64v54.4l-160 153.6V448H192V268.8L32 118.4V64h448z"]},eC={prefix:"dh",iconName:"filter-slash",icon:[512,512,[],"f000","M480 118.4V64H108.8L70.4 25.6 25.6 70.4l406.4 406.4 44.8 -44.8L320 275.2v-6.4l160 -150.4zM288 416H224v-86.4l-32 -32V448h128v-22.4l-32 -32v22.4zM140.8 96H448v6.4L294.4 249.6 140.8 96z"]},tC={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"]},ra={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"]},nC={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"]},sC={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"]},iC={prefix:"dh",iconName:"input",icon:[512,512,[],"f000","M464 448h-416l-16 -16v-352l16 -16h416l16 16v352l-16 16zM64 416h384V96H64v320zm96 -224h32v128H160zm64 -32v32H128V160l48 16zm0 160v32l-48 -16L128 352v-32z"]},Ps={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"]},oC={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"]},rC={prefix:"dh",iconName:"panels",icon:[512,512,[],"f000","m496 288 16 16v160l-16 16h-192l-16 -16v-160l16 -16h192zm0 -256h-192l-16 16v160l16 16h192l16 -16v-160l-16 -16zM16 32l-16 16v160l16 16h192l16 -16v-160L208 32h-192zm0 256 -16 16v160l16 16h192l16 -16v-160L208 288h-192z"]},lC={prefix:"dh",iconName:"python",icon:[512,512,[],"f000","M198.4 249.6h99.2s57.6 0 57.6 -54.4V102.4s9.6 -54.4 -99.2 -54.4c-105.6 0 -99.2 44.8 -99.2 44.8v48H256v12.8H115.2s-67.2 -6.4 -67.2 99.2c0 105.6 57.6 102.4 57.6 102.4h35.2V307.2s-3.2 -57.6 57.6 -57.6zm3.2 -131.2c-9.6 0 -19.2 -9.6 -19.2 -19.2s6.4 -19.2 19.2 -19.2c9.6 0 19.2 9.6 19.2 19.2s-9.6 19.2 -19.2 19.2zm208 35.2h-35.2v48s3.2 57.6 -57.6 57.6H217.6S160 259.2 160 313.6v92.8s-12.8 54.4 99.2 54.4c105.6 0 99.2 -44.8 99.2 -44.8v-48H259.2v-12.8h140.8s67.2 6.4 67.2 -99.2 -57.6 -102.4 -57.6 -102.4zm-96 236.8c9.6 0 19.2 9.6 19.2 19.2s-9.6 19.2 -19.2 19.2 -19.2 -9.6 -19.2 -19.2 9.6 -19.2 19.2 -19.2z"]},cd={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"]},aC={prefix:"dh",iconName:"remove-square-filled",icon:[512,512,[],"f000","M432 32h-384l-16 16v384l16 16h384l16 -16v-384l-16 -16zM352 256H128V224h224v32z"]},dC={prefix:"dh",iconName:"run-selection",icon:[704,512,[],"f000","M124.8 64 128 96h-3.2c-6.4 0 -12.8 0 -19.2 3.2 -16 6.4 -25.6 25.6 -25.6 44.8v44.8c0 6.4 0 12.8 -3.2 19.2 0 6.4 -3.2 12.8 -6.4 19.2 -3.2 9.6 -12.8 22.4 -22.4 28.8 9.6 6.4 19.2 19.2 22.4 32 3.2 6.4 3.2 12.8 6.4 19.2 0 6.4 3.2 12.8 3.2 19.2v44.8c0 6.4 0 12.8 3.2 19.2 3.2 6.4 6.4 9.6 9.6 16 3.2 3.2 9.6 6.4 16 9.6H128v32h-3.2c-9.6 0 -19.2 -3.2 -28.8 -6.4 -9.6 -3.2 -19.2 -9.6 -25.6 -16 -6.4 -6.4 -12.8 -16 -16 -25.6 -3.2 -9.6 -6.4 -16 -6.4 -25.6V316.8c0 -6.4 0 -12.8 -3.2 -19.2 -3.2 -3.2 -6.4 -6.4 -9.6 -12.8 -3.2 -3.2 -9.6 -6.4 -16 -9.6 -3.2 -3.2 -9.6 -3.2 -16 -3.2H0v-32h3.2c6.4 0 12.8 0 19.2 -3.2 9.6 -6.4 19.2 -12.8 22.4 -25.6 3.2 -6.4 3.2 -12.8 3.2 -19.2V134.4c0 -9.6 3.2 -19.2 6.4 -25.6 3.2 -6.4 9.6 -16 16 -22.4 6.4 -6.4 16 -12.8 25.6 -16 9.6 -3.2 19.2 -6.4 28.8 -6.4zm576 176c-6.4 0 -12.8 0 -19.2 -3.2 -6.4 -3.2 -9.6 -6.4 -16 -9.6 -3.2 -3.2 -6.4 -9.6 -9.6 -16 -3.2 -6.4 -3.2 -12.8 -3.2 -19.2V134.4c0 -9.6 -3.2 -19.2 -6.4 -25.6 -3.2 -9.6 -9.6 -16 -16 -25.6 -6.4 -6.4 -16 -12.8 -25.6 -16 -6.4 0 -16 -3.2 -25.6 -3.2H576v32h3.2c6.4 0 12.8 0 19.2 3.2 6.4 3.2 9.6 6.4 16 9.6 3.2 3.2 6.4 9.6 9.6 16 3.2 6.4 3.2 12.8 3.2 19.2v44.8c0 6.4 0 12.8 3.2 19.2 0 6.4 3.2 12.8 6.4 19.2 6.4 12.8 12.8 22.4 22.4 32 -9.6 6.4 -19.2 19.2 -22.4 32 -3.2 6.4 -3.2 12.8 -6.4 19.2 0 6.4 -3.2 12.8 -3.2 19.2v44.8c0 19.2 -9.6 35.2 -28.8 44.8 -6.4 -3.2 -12.8 -3.2 -19.2 -3.2H576v32h3.2c9.6 0 19.2 -3.2 28.8 -6.4 9.6 -3.2 19.2 -9.6 25.6 -16 6.4 -6.4 12.8 -16 16 -25.6 3.2 -9.6 6.4 -16 6.4 -25.6V316.8c0 -6.4 0 -12.8 3.2 -19.2 3.2 -9.6 12.8 -16 25.6 -22.4 6.4 -3.2 12.8 -3.2 19.2 -3.2l-3.2 -32zm-192 28.8 -240 160 -25.6 -12.8V96l25.6 -12.8 240 160v25.6zM470.4 256 275.2 124.8V384l195.2 -128z"]},cC={prefix:"dh",iconName:"shapes",icon:[512,512,[],"f000","M195.2 320 160 256 128 313.6 105.6 352 32 480h256l-73.6 -128 -19.2 -32zm112 -76.8c51.2 -35.2 121.6 -22.4 156.8 28.8s22.4 121.6 -28.8 156.8c0 0 -3.2 0 -3.2 3.2 -51.2 32 -121.6 19.2 -153.6 -32 -35.2 -54.4 -22.4 -121.6 28.8 -156.8zM96 32v192h192V32H96z"]},hd={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"]},ud={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"]},_c={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"]},hC={prefix:"dh",iconName:"sort-down",icon:[512,512,[],"f000","m128 288 -12.8 25.6 128 118.4h25.6l128 -118.4L384 288H128z"]},uC={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"]},md={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"]},kc={prefix:"dh",iconName:"square-filled",icon:[512,512,[],"f000","M432 32h-384l-16 16v384l16 16h384l16 -16v-384l-16 -16z"]},pd={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"]},mC={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"]},vu={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"]},pC={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"]},Oc={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"]},Tu={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 gl=Y.forwardRef((t,e)=>{var b,C;function n(w){const{menuItem:T,onMenuItemClick:y}=t;y(T,w)}function s(w){const{menuItem:T,onMenuItemMouseMove:y}=t;y(T,w)}function i(w){const{menuItem:T,onMenuItemContextMenu:y}=t;y(T,w)}function o(w,T,y){if(typeof w.type=="string")return w;const{closeMenu:E,menuItem:I,isKeyboardSelected:D,isMouseSelected:F,"data-testid":x}=t,U={menuItem:I,closeMenu:E,isKeyboardSelected:D,isMouseSelected:F,iconElement:T,displayShortcut:y,"data-testid":x};return Y.cloneElement(w,{forwardedProps:U})}const{children:r,menuItem:l,isKeyboardSelected:a=!1,isMouseSelected:d=!1,"data-testid":c}=t,u=(b=l.shortcut)==null?void 0:b.getDisplayText();let m=null;if(l.icon){const w=l.icon;if(Y.isValidElement(w))m=w;else{let T;l.iconColor!=null&&(l.disabled===void 0||!l.disabled)&&(T={color:l.iconColor}),m=h(j,{icon:w,style:T})}}let p=null;const g=Boolean(r);l.actions&&(p=h(j,{icon:mu}));let f=null;if(l.menuElement)f=h("div",{className:"custom-menu-item",onMouseMove:s,children:o(l.menuElement,m,u)});else{const w=l.disabled,T=l.iconOutline;f=h("button",{type:"button",className:W("btn-context-menu",{disabled:w},{active:(g||d)&&(w===void 0||!w)},{"keyboard-active":a&&(w===void 0||!w)}),onClick:n,onMouseMove:s,onContextMenu:i,title:(C=l.description)!=null?C:"",children:v("div",{className:"btn-context-menu-wrapper",children:[h("span",{className:W("icon",{outline:T}),children:m}),h("span",{className:"title",children:l.title}),u!==void 0&&h("span",{className:"shortcut",children:u}),p&&h("span",{className:W("submenu-indicator",{disabled:w}),children:p})]})})}return v("div",{className:"context-menu-item",ref:e,"data-testid":c,children:[r,f]})});gl.displayName="ContextMenuItem";gl.defaultProps={children:null,isKeyboardSelected:!1,isMouseSelected:!1,"data-testid":void 0};class di extends Error{constructor(){super(...arguments),this.isCanceled=!0}}class fl{static isDark(e){const n=document.createElement("div");n.style.display="none",n.style.color=e;const s=getComputedStyle(document.body.appendChild(n)).color,i=s.match(/\d+/g);let o=[];if(i)o=i.map(l=>parseInt(l,10));else throw new Error(`Invalid color received. Got ${s}`);return document.body.removeChild(n),fl.getBrightness(o)<125}static getBrightness(e){return Math.round((e[0]*299+e[1]*587+e[2]*114)/1e3)}}async function ji(t){const{clipboard:e}=navigator;if(e!==void 0)try{return navigator.clipboard.writeText(t)}catch{return Lc(t)}Lc(t)}function Lc(t){const e=document.activeElement,n=document.createElement("textarea");n.value=t,document.body.appendChild(n),n.focus(),n.select();const s=document.execCommand("copy");if(document.body.removeChild(n),e instanceof HTMLElement&&e.focus(),!s)throw new Error("Unable to execute copy command")}const gC="table_",Eu="column_",fC=new Set(["in","not","i","ii","k"]),CC=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"]),bC=/[^a-zA-Z0-9_$+@-]/g,SC=/[^A-Za-z0-9_$]/g,Qi=class{};let gs=Qi;gs.legalize=(t,e,n,s,i)=>{let o=t.trim().replace(/[- ]/g,"_");return s&&(fC.has(o)||CC.has(o))&&(o=e+o),o=o.replace(n,""),o||(o=e+i),Number.isNaN(Number(o.charAt(0)))||(o=e+o),o};gs.legalizeTableName=t=>Qi.legalize(t,gC,bC,!1,0);gs.legalizeColumnNames=t=>{const e=[];return t.forEach((n,s)=>{let i=Qi.legalizeColumnName(n,s);e.includes(i)&&(i=Eu+s),e.push(i)}),e};gs.legalizeColumnName=(t,e=0)=>Qi.legalize(t,Eu,SC,!0,e);gs.isValidTableName=t=>Qi.legalizeTableName(t)===t;gs.isValidColumnName=t=>Qi.legalizeColumnName(t)===t;function wC(t,e){return t?t.closest(`.${e}`):null}const vC={getClosestByClassName:wC};class Ge extends CustomEvent{constructor(e,n){super(e,n)}}class yu extends Error{constructor(){super(...arguments),this.isTimeout=!0}}class Te{static makeCancelable(e,n){let s=!1,i;const o=new Promise((r,l)=>{Promise.resolve(e).then(a=>{s?(n&&n(a),l(new di)):(i=a,r(a))},a=>l(s?new di:a))});return o.cancel=()=>{s=!0,i!=null&&n&&n(i)},o}static isCanceled(e){return e instanceof di}static isTimedOut(e){return e instanceof yu}}class fs{constructor(){this.pending=[],this.resolved=[]}add(e,n){const s=Te.makeCancelable(e,n);return this.pending.push(s),s.then(()=>{this.resolve(s)},()=>{this.resolve(s)}),s}remove(e){for(let n=0;n<this.pending.length;n+=1)if(this.pending[n]===e){this.pending.splice(n,1);return}}resolve(e){this.remove(e),this.resolved.push(e)}cancel(){const e=[...this.pending,...this.resolved];for(let n=0;n<e.length;n+=1)e[n].cancel();this.pending=[],this.resolved=[]}}function P(t){if(t==null)throw new Error("Value is null or undefined")}class fn{static isValidRange(e){return e!=null&&e.length===2&&Number.isInteger(e[0])&&Number.isInteger(e[1])&&e[0]<=e[1]}static validateRange(e){if(!fn.isValidRange(e))throw new Error(`Invalid range! ${e}`)}static isSelected(e,n){for(let s=0;s<e.length;s+=1){const i=e[s],o=i[0],r=i[1];if(o<=n&&n<=r)return!0}return!1}static selectRange(e,n){let[s,i]=n;const o=[...e];for(let r=o.length-1;r>=0;r-=1){const l=o[r],a=l[0],d=l[1];if(a<=s&&i<=d)return o;s<=d&&a<=i&&(s=Math.min(s,a),i=Math.max(i,d),o.splice(r,1))}return o.push([s,i]),o}static deselectRange(e,n){const[s,i]=n,o=[...e];for(let r=o.length-1;r>=0;r-=1){const l=o[r],a=l[0],d=l[1];if(!(i<a||d<s))if(a<s&&i<d){o[r]=[a,s-1],o.splice(r+1,0,[i+1,d]);break}else s<=a&&d<=i?o.splice(r,1):a<s?o[r]=[a,s-1]:o[r]=[i+1,d]}return o}static count(e){return e.reduce((n,s)=>n+(s[1]-s[0]+1),0)}static getItemsInRanges(e,n){return n.reduce((s,i)=>{const o=[...s];for(let r=i[0];r<=i[1];r+=1)o.push(e[r]);return o},[])}}class on{static join(e,n="and"){if(e==null||e.length===0)return"";if(e.length===1)return e[0];if(e.length===2)return`${e[0]} ${n} ${e[1]}`;const s=e.slice(0,e.length-1).join(", "),i=e[e.length-1];return`${s}, ${n} ${i}`}static toLower(e,n=!0){if(e==null){if(n)return"";throw new Error("Null string passed in to TextUtils.toLower")}return e.toLowerCase()}static sort(e,n,s=!0){return e<n?s?-1:1:e>n?s?1:-1:0}}const Iu=class{static formatElapsedTime(t){if(typeof t!="number"||!Number.isInteger(t))throw new Error(`${t} is not a number that can be expressed as a formatted time`);const e=Math.floor(t/3600),n=Math.floor(t%3600/60),s=t%60;return`${e>0?`${e}h `:""}${n>0||e>0?`${n}m `:""}${t>=60?`${s}s`.padStart(3,"0"):`${s}s`}`}static formatTime(t){if(typeof t!="number"||!Number.isInteger(t)||t<0)throw new Error(`${t} is not a number that can be expressed as a formatted time`);const e=String(Math.floor(t/(60*60))).padStart(2,"0"),n=t%(60*60),s=String(Math.floor(n/60)).padStart(2,"0"),i=n%60,o=String(Math.ceil(i)).padStart(2,"0");return`${e}:${s}:${o}`}static isTimeString(t){return new RegExp(Iu.TIME_PATTERN).test(t)}static parseTime(t){if(t==null||typeof t!="string")throw new Error(`${t} is not a valid string`);const e=t.split(":");if(e.length!==3)throw new Error(`${t} is not a time string that can be parsed`);return Number(e[0])*60*60+Number(e[1])*60+Number(e[2])}};let Dn=Iu;Dn.TIME_PATTERN="([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]";Dn.TIME_ZONES=Object.freeze([{label:"Tokyo UTC+9 No DST",value:"Asia/Tokyo"},{label:"Seoul UTC+9 No DST",value:"Asia/Seoul"},{label:"Hong Kong UTC+8 No DST",value:"Asia/Hong_Kong"},{label:"Singapore UTC+8 No DST",value:"Asia/Singapore"},{label:"Kolkata UTC+5:30 No DST",value:"Asia/Kolkata"},{label:"Berlin UTC+1",value:"Europe/Berlin"},{label:"UTC UTC\xB10 No DST",value:"UTC"},{label:"London UTC\xB10",value:"Europe/London"},{label:"Sao Paulo UTC-2",value:"America/Sao_Paulo"},{label:"Newfoundland UTC-3:30",value:"America/St_Johns"},{label:"Halifax UTC-4",value:"America/Halifax"},{label:"New York UTC\u22125",value:"America/New_York"},{label:"Chicago UTC-6",value:"America/Chicago"},{label:"Denver UTC-7",value:"America/Denver"},{label:"Los Angeles UTC-8",value:"America/Los_Angeles"},{label:"Anchorage UTC-9",value:"America/Anchorage"},{label:"Honolulu UTC-10 No DST",value:"Pacific/Honolulu"},{label:"Zurich UTC+1",value:"Europe/Zurich"},{label:"Amsterdam UTC+1",value:"Europe/Amsterdam"},{label:"Taipei UTC+8 No DST",value:"Asia/Taipei"},{label:"Sydney UTC+10",value:"Australia/Sydney"}]);class Hi extends Error{constructor(){super(...arguments),this.isInvalid=!0}}function On({className:t="","data-testid":e}){return v("div",{className:W("loading-spinner fa-layers",t),"data-testid":e,children:[h(j,{icon:Sf,className:"text-white-50"}),h(j,{icon:fu,className:"text-primary",spin:!0})]})}const Ac=X.module("ContextMenu"),Fa=class extends S.exports.PureComponent{constructor(t){super(t),this.handleBlur=this.handleBlur.bind(this),this.handleCloseSubMenu=this.handleCloseSubMenu.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleMenuItemClick=this.handleMenuItemClick.bind(this),this.handleMenuItemContextMenu=this.handleMenuItemContextMenu.bind(this),this.handleMenuItemMouseMove=this.handleMenuItemMouseMove.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.handleWindowResize=this.handleWindowResize.bind(this),this.container=Y.createRef(),this.oldFocus=document.activeElement,this.activeSubMenuRef=Y.createRef(),this.subMenuTimer=0,this.rAF=0,this.initialPosition={top:t.top,left:t.left},this.state={menuItems:[],pendingItems:[],activeSubMenu:null,hasOverflow:!1,subMenuTop:null,subMenuLeft:null,subMenuParentWidth:0,subMenuParentHeight:0,keyboardIndex:-1,mouseIndex:-1}}static handleContextMenu(t){t.metaKey||(t.stopPropagation(),t.preventDefault())}componentDidMount(){this.initMenu(),this.verifyPosition(),window.addEventListener("resize",this.handleWindowResize),this.rAF=window.requestAnimationFrame(()=>{var e;(e=this.container.current)==null||e.focus();const{onMenuOpened:t}=this.props;t(this)})}componentDidUpdate(t,e){var i,o;const{actions:n}=this.props,{activeSubMenu:s}=this.state;s!==e.activeSubMenu&&(s==null?(i=this.container.current)==null||i.focus():this.setActiveSubMenuPosition()),t.actions!==n&&(this.initMenu(),(this.container.current==null||!this.container.current.contains(document.activeElement))&&((o=this.container.current)==null||o.focus())),this.verifyPosition()}componentWillUnmount(){this.cancelPromises(),window.removeEventListener("resize",this.handleWindowResize),cancelAnimationFrame(this.rAF)}getKeyboardIndex(){const{options:t}=this.props;if(t.separateKeyboardMouse!==void 0&&t.separateKeyboardMouse){const{keyboardIndex:e}=this.state;return e}return this.getMouseIndex()}setKeyboardIndex(t){const{options:e}=this.props;e.separateKeyboardMouse!==void 0&&e.separateKeyboardMouse?this.setState({keyboardIndex:t}):this.setMouseIndex(t)}getMouseIndex(){const{mouseIndex:t}=this.state;return t}setMouseIndex(t){this.setState({mouseIndex:t})}initMenu(){this.cancelPromises(),cancelAnimationFrame(this.rAF);const{options:t}=this.props;let e=t.initialKeyboardIndex;e===void 0&&(e=-1);const{actions:n}=this.props,s=We.getMenuItems(n),i=[];for(let o=s.length-1;o>=0;o-=1){const r=s[o];r instanceof Promise?this.initMenuPromise(r):i.push(r)}this.setState({mouseIndex:-1,keyboardIndex:e,activeSubMenu:null,menuItems:We.sortActions(i)})}initMenuPromise(t){const e=Te.makeCancelable(t);this.setState(n=>({pendingItems:n.pendingItems.concat(e)})),e.then(n=>{this.setState(s=>{const i=s.pendingItems.indexOf(e);if(i>=0){const o=s.pendingItems.slice();return o.splice(i,1),{menuItems:We.sortActions(s.menuItems.concat(n)),pendingItems:o}}return null})},n=>{Te.isCanceled(n)||(this.setState(s=>{const i=s.pendingItems.indexOf(e);if(i>=0){const o=s.pendingItems.slice();return o.splice(i,1),{pendingItems:o}}return null}),Ac.error(n))})}cancelPromises(){const{pendingItems:t}=this.state;t.map(e=>e.cancel())}setActiveSubMenuPosition(){if(this.activeSubMenuRef.current===null)return;const t=this.activeSubMenuRef.current.getBoundingClientRect();this.setState({subMenuTop:t.top,subMenuLeft:t.right,subMenuParentHeight:t.height,subMenuParentWidth:t.width})}verifyPosition(){var u,m,p,g;const{options:t,updatePosition:e,subMenuParentWidth:n,subMenuParentHeight:s,top:i,left:o}=this.props;if(!this.container.current||t.doNotVerifyPosition!=null&&t.doNotVerifyPosition)return;let{top:r,left:l}=this.initialPosition;const{width:a,height:d}=(m=(u=this.container.current)==null?void 0:u.getBoundingClientRect())!=null?m:{width:0,height:0},c=((g=(p=this.container.current)==null?void 0:p.scrollHeight)!=null?g:0)>window.innerHeight;d===0||a===0||(r+d>window.innerHeight&&(r-d-s>0?r-=d-s:r=window.innerHeight-d),l+a>window.innerWidth&&(l=l-a-n),(o!==l||i!==r)&&(this.setState({hasOverflow:c}),e(r,l)))}handleWindowResize(){!this.container.current||this.closeMenu(!0)}handleBlur(t){if(!this.container.current){Ac.warn("Container is null!");return}if(!this.container.current.contains(t.relatedTarget)){let e=t.relatedTarget,n=!1;for(;e&&!n;)n=e.hasAttribute("data-dh-context-menu"),e=e.parentElement;n||this.closeMenu(!0)}}isEscapeKey(t){const{left:e}=this.props;return t==="Escape"||e<0&&t==="ArrowRight"||t==="ArrowLeft"}handleKeyDown(t){const{menuItems:e}=this.state,n=this.getKeyboardIndex();let s=n,i=!1;if(t.key==="Enter"||t.key===" "){n>=0&&n<e.length&&this.handleMenuItemClick(e[n],t);return}if(t.key==="ArrowRight"?n>=0&&n<=e.length?i=!0:s=0:this.isEscapeKey(t.key)?s=null:t.key==="ArrowUp"||t.shiftKey&&t.key==="Tab"?s=We.getNextMenuItem(s,-1,e):(t.key==="ArrowDown"||t.key==="Tab")&&(s=We.getNextMenuItem(s,1,e)),i){this.openSubMenu(n),t.preventDefault(),t.stopPropagation();return}n!==s&&(s!==null?this.setKeyboardIndex(s):(this.closeMenu(),this.oldFocus instanceof HTMLElement&&this.oldFocus.focus()),t.preventDefault(),t.stopPropagation())}openSubMenu(t){const{menuItems:e,activeSubMenu:n}=this.state,s=e[t].actions?t:null;n!==s&&this.setState({activeSubMenu:s,subMenuTop:null,subMenuLeft:null})}closeMenu(t=!1){const{closeMenu:e,onMenuClosed:n}=this.props;cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{e(t),n(this)})}closeSubMenu(){this.setState({activeSubMenu:null})}handleCloseSubMenu(t){t?this.closeMenu(!0):this.closeSubMenu()}handleMenuItemClick(t,e){e.preventDefault(),e.stopPropagation();const{menuItems:n}=this.state;t!=null&&(t.disabled===void 0||!t.disabled)&&(t.actions!=null?this.openSubMenu(n.indexOf(t)):t.action!=null&&(t.action(),this.closeMenu(!0)))}handleMenuItemContextMenu(t,e){e.metaKey||this.handleMenuItemClick(t,e)}handleMenuItemMouseMove(t){const{menuItems:e}=this.state,n=e.indexOf(t);this.setMouseIndex(n),n>=0&&n<e.length&&(t.disabled===void 0||!t.disabled)&&this.openSubMenu(n)}handleMouseLeave(){this.setMouseIndex(-1)}render(){const t=[],{top:e,left:n}=this.props,{activeSubMenu:s,hasOverflow:i,keyboardIndex:o,menuItems:r,mouseIndex:l,pendingItems:a,subMenuTop:d,subMenuLeft:c,subMenuParentWidth:u,subMenuParentHeight:m}=this.state;for(let C=0;C<r.length;C+=1){const w=r[C];C>0&&w.group!==r[C-1].group&&t.push(h("hr",{},`${C}.separator`));const T=h(gl,{ref:s===C?this.activeSubMenuRef:null,isKeyboardSelected:o===C,isMouseSelected:l===C,menuItem:w,closeMenu:this.handleCloseSubMenu,onMenuItemClick:this.handleMenuItemClick,onMenuItemMouseMove:this.handleMenuItemMouseMove,onMenuItemContextMenu:this.handleMenuItemContextMenu},C);t.push(T)}let p=null;a.length>0&&(p=h("div",{className:"loading",children:h(On,{})}));const{menuStyle:g,"data-testid":f}=this.props,b=s!==null&&d!==null&&c!==null;return v(ye,{children:[v("div",{className:W({"has-overflow":i},"context-menu-container"),style:{top:e,left:n,...g},ref:this.container,"data-dh-context-menu":!0,onBlur:this.handleBlur,onKeyDown:this.handleKeyDown,onMouseLeave:this.handleMouseLeave,onContextMenu:Fa.handleContextMenu,role:"menuitem",tabIndex:0,"data-testid":f,children:[t,p]}),b&&s!==null&&d!==null&&c!==null&&h(Fa,{actions:r[s].actions||[],closeMenu:this.handleCloseSubMenu,top:d,left:c,updatePosition:(C,w)=>{this.setState({subMenuTop:C,subMenuLeft:w})},subMenuParentWidth:u,subMenuParentHeight:m},`sub-${s}`)]})}};let Ru=Fa;Ru.defaultProps={subMenuParentWidth:0,subMenuParentHeight:0,closeMenu(){},onMenuOpened(){},onMenuClosed(){},options:{},menuStyle:{},"data-testid":void 0};class Du extends S.exports.Component{constructor(e){super(e),this.handleMenuClose=this.handleMenuClose.bind(this),this.handleContextMenu=this.handleContextMenu.bind(this),this.container=Y.createRef(),this.openMenu=Y.createRef(),this.state={actions:null,left:0,top:0}}componentDidMount(){var e;(e=this.container.current)!=null&&e.parentElement&&this.container.current.parentElement.addEventListener("contextmenu",this.handleContextMenu)}componentWillUnmount(){var e;(e=this.container.current)!=null&&e.parentElement&&this.container.current.parentElement.removeEventListener("contextmenu",this.handleContextMenu)}handleContextMenu(e){if(!We.isContextActionEvent(e)||!this.container.current||e.metaKey||e.ctrlKey)return;const n=We.getMenuItems(e.contextActions),s=this.container.current.getBoundingClientRect(),i=e.clientY-s.top,o=e.clientX-s.left;if(n.length===0){if(e.target===this.container.current){e.preventDefault(),this.setState({actions:null},()=>{const r=document.elementFromPoint(o,i),l=new MouseEvent("contextmenu",{clientX:e.clientX,clientY:e.clientY,bubbles:!0,cancelable:!0});r==null||r.dispatchEvent(l)});return}return}e.preventDefault(),this.setState({actions:n,top:i,left:o})}handleMenuClose(e){e===this.openMenu.current&&this.setState({actions:null})}render(){let e=null;const{"data-testid":n}=this.props,{actions:s,top:i,left:o}=this.state;return s&&(e=h(Ru,{ref:this.openMenu,actions:s,onMenuClosed:this.handleMenuClose,top:i,left:o,updatePosition:(r,l)=>{this.setState({top:r,left:l})},"data-testid":n})),h("div",{className:W("context-menu-root",{active:s}),ref:this.container,children:e})}}const js=class extends S.exports.Component{static handleEnter(t){const e=t;e.style.height="0"}static handleEntering(t){const e=t;e.style.height=`${js.getHeight(e)}px`}static handleExiting(t){const e=t;e.style.height="0"}static handleExit(t){const e=t;e.style.height=`${js.getHeight(e)}px`}static getHeight(t){const e=t.scrollWidth-t.clientWidth;return t.scrollHeight-e}constructor(t){super(t),this.handleEntered=this.handleEntered.bind(this)}handleEntered(t){const e=t;e.style.height="";const{autoFocusOnShow:n}=this.props;if(n!==void 0&&n){const s=e.querySelector("input, select, textarea");s!=null&&s.focus()}}render(){const{children:t,className:e,in:n,"data-testid":s}=this.props;return h(ut,{in:n,classNames:{enterActive:"collapsing",enterDone:"collapse show",exitActive:"collapsing",exitDone:"collapse"},onEnter:js.handleEnter,onEntering:js.handleEntering,onEntered:this.handleEntered,onExit:js.handleExit,onExiting:js.handleExiting,timeout:350,children:i=>h("div",{className:W({collapse:i==="exited"},e),"data-testid":s,children:t})})}};let gd=js;gd.propTypes={className:R.exports.string,in:R.exports.bool.isRequired,children:R.exports.node.isRequired,autoFocusOnShow:R.exports.bool,"data-testid":R.exports.string};gd.defaultProps={className:"",autoFocusOnShow:!1,"data-testid":void 0};function Cl(t){const e=S.exports.useRef();return S.exports.useEffect(function(){e.current=t}),e.current}function Mu(t){const e=S.exports.useRef(null);return S.exports.useEffect(function(){!t||(typeof t=="function"?t(e.current):t.current=e.current)}),e}const TC=3500,EC=X.module("useCopyToClipboard");function yC(){const[t,e]=S.exports.useState(!1),n=S.exports.useRef(null),s=S.exports.useCallback(i=>{ji(i).then(()=>{e(!0)}).catch(o=>EC.error(`Unable to copy ${i}`,`
|
|
6
|
-
`,o))},[]);return S.exports.useEffect(()=>(n.current&&clearTimeout(n.current),t&&(n.current=setTimeout(()=>{e(!1)},TC)),()=>{n.current&&clearTimeout(n.current)}),[t]),[t,s]}const St=Y.forwardRef((t,e)=>{const{checked:n=!1,children:s,className:i,disabled:o,inputClassName:r,isInvalid:l,labelClassName:a,name:d,onChange:c,"data-testid":u}=t,[m]=S.exports.useState(ze()),p=Mu(e);S.exports.useEffect(function(){p.current&&(p.current.indeterminate=n===null)},[p,n]);const g=S.exports.useCallback(f=>{p.current&&(p.current.indeterminate=n===null),c&&c(f)},[p,n,c]);return v("div",{className:W("custom-control custom-checkbox",i),children:[h("input",{type:"checkbox",ref:p,checked:n!=null?n:!1,className:W("custom-control-input",r,{"is-invalid":l}),disabled:o,id:m,name:d,onChange:g,"data-testid":u}),h("label",{className:W("custom-control-label",a),htmlFor:m,children:s})]})});St.displayName="Checkbox";St.propTypes={checked:(t,e)=>{const{[e]:n}=t;return n!==null&&typeof n!="boolean"?new Error("Checked must be a boolean or null for indeterminate"):null},children:R.exports.node.isRequired,className:R.exports.string,disabled:R.exports.bool,inputClassName:R.exports.string,isInvalid:R.exports.bool,labelClassName:R.exports.string,name:R.exports.string,onChange:R.exports.func,"data-testid":R.exports.string};St.defaultProps={checked:!1,className:"",disabled:!1,inputClassName:"",isInvalid:!1,labelClassName:"",name:void 0,onChange:void 0,"data-testid":void 0};class Cs extends S.exports.PureComponent{constructor(e){super(e),this.inputField=Y.createRef()}focus(){var e;(e=this.inputField.current)==null||e.focus()}render(){const{value:e,placeholder:n,onBlur:s,onChange:i,className:o,disabled:r,matchCount:l,id:a,onKeyDown:d,"data-testid":c}=this.props;return v("div",{className:W("search-group",o),children:[h("input",{type:"search",value:e,onBlur:s,onChange:i,onKeyDown:d,className:"form-control",disabled:r,placeholder:n,ref:this.inputField,id:a,"data-testid":c}),l!=null&&h("span",{className:"search-match",children:l}),h("span",{className:"search-icon",children:h(j,{icon:Su})})]})}}Cs.defaultProps={placeholder:"Search",className:"",matchCount:null,onKeyDown(){},id:"","data-testid":void 0};var Nu=(t=>(t.UP="UP",t.DOWN="DOWN",t))(Nu||{});const Eo=class extends S.exports.Component{constructor(t){super(t),this.getCachedFilteredOptions=ve((e,n)=>e.filter(s=>s.title.toLowerCase().indexOf(n.toLowerCase())>=0||s.value.toLowerCase().indexOf(n.toLowerCase())>=0)),this.state={value:"",filter:"",filteredOptions:t.options,keyboardOptionIndex:-1,menuIsOpen:!1,inputWidth:100},this.toggleMenu=this.toggleMenu.bind(this),this.handleMenuKeyDown=this.handleMenuKeyDown.bind(this),this.handleMenuBlur=this.handleMenuBlur.bind(this),this.closeMenu=this.closeMenu.bind(this),this.handleInputChange=this.handleInputChange.bind(this),this.handleInputKeyDown=this.handleInputKeyDown.bind(this),this.handleInputBlur=this.handleInputBlur.bind(this),this.handleFilterChange=this.handleFilterChange.bind(this),this.handleOptionClick=this.handleOptionClick.bind(this),this.handleOptionFocus=this.handleOptionFocus.bind(this),this.handleMenuOpened=this.handleMenuOpened.bind(this),this.handleMenuExited=this.handleMenuExited.bind(this),this.popper=Y.createRef(),this.cbContainer=Y.createRef(),this.toggleButton=Y.createRef(),this.menuContainer=Y.createRef(),this.input=Y.createRef(),this.searchInput=Y.createRef()}componentDidUpdate(){const{menuIsOpen:t,keyboardOptionIndex:e}=this.state;t&&e>=0&&this.scrollOptionIntoView()}setInputWidth(){this.cbContainer.current&&this.setState({inputWidth:this.cbContainer.current.getBoundingClientRect().width})}focus(){var t;(t=this.input.current)==null||t.focus()}resetValue(){this.setState({value:""})}updateInputValue(t){const{onChange:e}=this.props;this.setState({value:t}),e(t)}handleResize(){this.setInputWidth()}handleMenuKeyDown(t){var r,l;const{filter:e,filteredOptions:n,keyboardOptionIndex:s}=this.state,{options:i}=this.props,o=e?n:i;switch(t.key){case"Enter":((r=o[s])==null?void 0:r.value)!=null&&this.updateInputValue(o[s].value),this.closeMenu(),(l=this.input.current)==null||l.focus(),t.stopPropagation(),t.preventDefault();break;case"ArrowUp":this.handleMenuNavigation(Eo.MENU_NAVIGATION_DIRECTION.UP),t.stopPropagation(),t.preventDefault();break;case"ArrowDown":this.handleMenuNavigation(Eo.MENU_NAVIGATION_DIRECTION.DOWN),t.stopPropagation(),t.preventDefault();break;case"Escape":e!==""?(this.setState({filter:""}),t.stopPropagation()):this.closeMenu();break;case"Tab":!t.shiftKey&&s===o.length-1&&this.closeMenu();break}}handleMenuNavigation(t){const{filter:e,filteredOptions:n,keyboardOptionIndex:s}=this.state,{options:i}=this.props,r=(e?n:i).length;let l=0;switch(t){case Eo.MENU_NAVIGATION_DIRECTION.UP:l=-1;break;case Eo.MENU_NAVIGATION_DIRECTION.DOWN:l=1;break}l!==0&&this.setState({keyboardOptionIndex:(s+l+r)%r})}handleInputKeyDown(t){const{onEnter:e}=this.props,{menuIsOpen:n}=this.state;t.key==="ArrowDown"||t.key==="ArrowUp"?n||this.openMenu():t.key==="Enter"&&e()}handleInputChange(t){this.updateInputValue(t.target.value)}handleOptionClick(t){var r;const e=Number(t.currentTarget.value),{filter:n,filteredOptions:s}=this.state,{options:i}=this.props,o=n?s:i;this.updateInputValue(o[e].value),this.closeMenu(),(r=this.input.current)==null||r.focus()}handleOptionFocus(t){this.setState({keyboardOptionIndex:Number(t.target.value)})}handleFilterChange(t){var i;const{options:e}=this.props,n=t.target.value,s=this.getCachedFilteredOptions(e,n);this.setState({filter:n,filteredOptions:s,keyboardOptionIndex:0}),(i=this.popper.current)==null||i.scheduleUpdate()}handleMenuBlur(t){t.relatedTarget instanceof Element&&this.popper.current!=null&&this.popper.current.element.contains(t.relatedTarget)||t.relatedTarget===this.toggleButton.current||this.closeMenu(!1)}handleInputBlur(t){const{menuIsOpen:e}=this.state;e&&t.relatedTarget instanceof Element&&this.popper.current!=null&&this.popper.current.element.contains(t.relatedTarget)||this.closeMenu(!1)}handleMenuOpened(){var t;this.scrollOptionIntoView(),(t=this.searchInput.current)==null||t.focus()}handleMenuExited(){var e;const{menuIsOpen:t}=this.state;t&&(this.setState({menuIsOpen:!1}),(e=this.popper.current)==null||e.hide()),this.setState({filter:""})}toggleMenu(t){const{menuIsOpen:e}=this.state;e?this.closeMenu():this.openMenu(),t.stopPropagation()}openMenu(){this.updateKeyboardIndex(),this.setInputWidth(),this.setState({menuIsOpen:!0}),window.requestAnimationFrame(()=>{var t;(t=this.popper.current)==null||t.show()})}closeMenu(t=!0){var e,n;this.setState({menuIsOpen:!1}),t&&((e=this.input.current)==null||e.focus()),(n=this.popper.current)==null||n.hide()}updateKeyboardIndex(){const{value:t,filter:e,filteredOptions:n}=this.state,{options:s}=this.props,o=(e?n:s).findIndex(r=>r.value===t);this.setState({keyboardOptionIndex:o})}scrollOptionIntoView(){var e;const t=(e=this.menuContainer.current)==null?void 0:e.querySelector(".cb-option-btn.keyboard-active");t instanceof HTMLElement&&t.scrollIntoView({block:"nearest",inline:"nearest"})}renderMenuElement(){const{searchPlaceholder:t}=this.props,{filter:e,inputWidth:n}=this.state;return v("div",{className:"cb-menu-container",ref:this.menuContainer,role:"presentation",onKeyDown:this.handleMenuKeyDown,onClick:s=>{s.stopPropagation()},style:{width:n},onBlur:this.handleMenuBlur,children:[h("div",{className:"cb-search-input-container",children:h(Cs,{value:e,ref:this.searchInput,onChange:this.handleFilterChange,className:"cb-search-input",placeholder:t})}),h("div",{className:"cb-options-container",children:h("div",{className:"cb-options",children:this.renderOptions()})})]})}renderOptions(){const{options:t}=this.props,{keyboardOptionIndex:e,filter:n,filteredOptions:s}=this.state;return(n?s:t).map((o,r)=>{const l=`option-${r}-${o.value}`;return h("button",{type:"button",value:r,className:W("cb-option-btn",{"keyboard-active":e===r}),onClick:this.handleOptionClick,onFocus:this.handleOptionFocus,children:o.title},l)})}render(){const{options:t,inputPlaceholder:e,disabled:n,className:s,defaultValue:i,spellCheck:o,"data-testid":r}=this.props,{value:l}=this.state;let{popperOptions:a}=this.props;return a={placement:"bottom-end",modifiers:{preventOverflow:{enabled:!1}},...a},v("div",{className:"input-group cb-container",ref:this.cbContainer,children:[h("input",{value:l||i,className:W("form-control",s,"cb-input"),ref:this.input,onChange:this.handleInputChange,placeholder:e||(t[0]!=null?t[0].title:void 0),disabled:n,onBlur:this.handleInputBlur,onKeyDown:this.handleInputKeyDown,spellCheck:o,"data-testid":r!==void 0?`${r}-input`:void 0}),h("div",{className:"input-group-append cb-dropdown",children:v("button",{type:"button",className:"btn cb-btn form-control",ref:this.toggleButton,onClick:this.toggleMenu,onKeyDown:this.handleInputKeyDown,disabled:n,"data-testid":r!==void 0?`${r}-btn`:void 0,children:[h(j,{icon:Gn}),h(kn,{ref:this.popper,options:a,className:W("combobox interactive"),onEntered:this.handleMenuOpened,onExited:this.handleMenuExited,children:this.renderMenuElement()})]})})]})}};let Zi=Eo;Zi.MENU_NAVIGATION_DIRECTION=Nu;Zi.DROP_DOWN_MENU_HEIGHT=200;Zi.propTypes={options:R.exports.arrayOf(R.exports.shape({title:R.exports.string.isRequired,value:R.exports.string.isRequired})).isRequired,popperOptions:R.exports.shape({title:R.exports.string.isRequired,value:R.exports.string.isRequired}),onChange:R.exports.func,inputPlaceholder:R.exports.string,searchPlaceholder:R.exports.string,disabled:R.exports.bool,className:R.exports.string,defaultValue:R.exports.string,spellCheck:R.exports.bool,onEnter:R.exports.func,"data-testid":R.exports.string};Zi.defaultProps={onChange(){},inputPlaceholder:"",searchPlaceholder:"Search",disabled:!1,className:"",defaultValue:"",popperOptions:null,spellCheck:!0,onEnter(){},"data-testid":void 0};function bl({copy:t,kind:e="ghost",tooltip:n="Copy",className:s,"data-testid":i,children:o}){const[r,l]=yC();return h(z,{kind:e,className:s,"data-testid":i,icon:r?Hf:Ef,tooltip:r?"Copied":n,onClick:()=>{l(typeof t=="function"?t():t)},children:o})}const yn=X.module("MaskedInput"),Ti={FORWARD:"forward",BACKWARD:"backward",NONE:"none"},br="\u2007";function fd(t,e,n){return t.substring(0,e)+n+t.substring(e+1)}function IC(t,e,n){return t.length<n?`${t}${e.substring(t.length,n)}`:t}function Pc(t,e){let{length:n}=t;for(let s=t.length-1;s>=0&&e[s]===t[s];s-=1)n=s;return t.substring(0,n)}const Sl=Y.forwardRef((t,e)=>{const{className:n,example:s,getNextSegmentValue:i=(_,H,A)=>A,getPreferredReplacementString:o=fd,onChange:r=()=>!1,onSelect:l=()=>!1,pattern:a,placeholder:d,selection:c,value:u,onFocus:m=()=>!1,onBlur:p=()=>!1,"data-testid":g}=t,f=Mu(e),b=S.exports.useMemo(()=>Array.isArray(s)?s:[s],[s]),C=S.exports.useMemo(()=>b[0].replace(/[a-zA-Z0-9]/g,br),[b]);S.exports.useEffect(function(){var H;if(c!=null){yn.debug("setting selection...",c);const{selectionStart:A,selectionEnd:N,selectionDirection:k}=c;(H=f.current)==null||H.setSelectionRange(A,N,k),yn.debug("selection set!")}},[c,f]);const w=S.exports.useCallback(_=>{let H=_,A=_;const N=b.length>0?b[0]:u;for(let O=H-1;O>=0&&/[a-zA-Z0-9]/g.test(N.charAt(O));O-=1)H=O;for(let O=A;O<N.length&&/[a-zA-Z0-9]/g.test(N.charAt(O));O+=1)A=O+1;const k=H===A?Ti.NONE:Ti.BACKWARD;return{selectionStart:H,selectionEnd:A,selectionDirection:k}},[b,u]);function T(_,H,A=_.length){let N="";for(let k=0;k<A;k+=1)_.charAt(k)!==br?N=N.concat(_[k]):N=N.concat(H[k]);return N=N.concat(H.substring(A)),N}function y(_,H=_.length){const A=new RegExp(`^${a}$`);if(A.test(_))return!0;for(let N=0;N<b.length;N+=1){const k=T(_,b[N],H);if(A.test(k))return!0}return!1}function E(_){const H=w(_),A=H.selectionEnd+1;return A>=u.length?H:w(A)}function I(_){const H=w(_),A=H.selectionStart-1;return A<=0?H:w(A)}function D(_,H){const A=w(_),N=u.substring(A.selectionStart,A.selectionEnd),k=i(A,H,N,u),O=u.substring(0,A.selectionStart)+k+u.substring(A.selectionEnd);y(O,A.selectionEnd)&&(r(O),l(A))}const F=S.exports.useCallback(_=>{const{selectionStart:H=0,selectionEnd:A=0,selectionDirection:N="none"}=_.target;if(H===null||A===null||N===null){yn.error("Selection attempted on non-text input element",_.target);return}if(yn.debug2("handleSelect",H,A,N),!(c!=null&&H===c.selectionStart&&A===c.selectionEnd)){if(c!=null&&H===u.length&&A===u.length&&_.nativeEvent.type!=="mouseup"){l({...c});return}if(H===A){const k=w(H);yn.debug("Selection segment from ",H,A,"=>",k),l(k)}else l({selectionStart:H,selectionEnd:A,selectionDirection:N})}},[w,l,c,u]),x=S.exports.useCallback(_=>{var A;if(!f.current)return;yn.debug("handleSelectCapture",_);const H=(A=f.current.selectionStart)!=null?A:0;H===u.length&&c!=null&&H!==c.selectionStart&&(_.preventDefault(),_.stopPropagation())},[f,c,u]);function U(_){if(_.preventDefault(),_.stopPropagation(),!f.current)return;const{key:H}=_,{selectionStart:A=0,selectionEnd:N=0}=f.current;if(A===null||N===null){yn.error("Selection arrow nvaigation attempted on non-text input element",_.target);return}H==="ArrowLeft"?l(I(A)):H==="ArrowRight"?l(E(N)):H==="ArrowUp"?D(A,-1):H==="ArrowDown"&&D(A,1)}function B(_){if(!f.current)return;yn.debug("handleKeyDown",_);const{key:H}=_,{selectionStart:A=0,selectionEnd:N=0}=f.current;if(A===null||N===null){yn.error("Selection key event on non-text input element",_.target);return}if(H.startsWith("Arrow")){U(_);return}if(H==="Delete"||H==="Backspace"){if(_.preventDefault(),_.stopPropagation(),N>=Pc(u,C).length){const O=u.substring(0,A===N?A-1:A),V=Pc(O,C);V!==u&&(r(V),l({selectionStart:V.length,selectionEnd:V.length,selectionDirection:Ti.NONE}));return}if(A!==N){const O=u.substring(0,A)+u.substring(A,N).replace(/[a-zA-Z0-9]/g,br)+u.substring(N);yn.debug("Range ",A,N,"deleted, setting value",O),r(O),l({selectionStart:A,selectionEnd:A,selectionDirection:Ti.NONE})}else if(A>0)for(let O=A-1;O>=0;O-=1){const V=u.substring(0,O)+u.substring(O,A).replace(/[a-zA-Z0-9]/g,br)+u.substring(A);if(V!==u){r(V),l({selectionStart:O,selectionEnd:O,selectionDirection:Ti.NONE});return}}return}if(_.altKey||_.metaKey||_.ctrlKey||H.length>1)return;_.preventDefault(),_.stopPropagation();const k=Array.from(new Set([H,H.toUpperCase(),H.toLowerCase()]));for(let O=0;O<k.length;O+=1){const V=k[O],G=/[a-zA-Z0-9]/g.test(V)?b[0].length-1:A;for(let Q=A;Q<=G;Q+=1){const Z=IC(u,b[0],Q+1),be=o(Z,Q,V,A,N);if(y(be,Q+1)){const le=w(Q),he=Q+1;let De={selectionStart:he,selectionEnd:he,selectionDirection:Ti.NONE};if(he>=le.selectionEnd){const ee=E(Q);ee.selectionStart!==le.selectionStart&&(De=ee)}yn.debug("handleKeyDown",H,"=>",be,De),r(be),l(De);return}}}}return h("input",{ref:f,className:W("form-control masked-input",n),type:"text",pattern:a,placeholder:d,value:u,onChange:()=>{},onKeyDown:B,onSelect:F,onSelectCapture:x,onFocus:m,onBlur:p,"data-testid":g})});Sl.defaultProps={className:"",placeholder:void 0,onChange(){},onSelect(){},getNextSegmentValue:(t,e,n)=>n,getPreferredReplacementString:fd,selection:void 0,onFocus(){},onBlur(){},"data-testid":void 0};const RC=X.module("TimeInput"),DC="([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]",MC=["00:00:00","12:34:56","23:59:59"],Fu=Y.forwardRef((t,e)=>{const{allowValueWrapping:n=!0,className:s="",onChange:i=()=>!1,value:o=0,onFocus:r=()=>!1,onBlur:l=()=>!1,onSelect:a=()=>!1,"data-testid":d}=t,[c,u]=S.exports.useState(Dn.formatTime(o)),[m,p]=S.exports.useState(),g=S.exports.useRef(null);S.exports.useImperativeHandle(e,()=>({focus:()=>{var T;(T=g.current)==null||T.focus()},setSelection:T=>{var y;(y=g.current)==null||y.focus(),p(T)}}),[]),S.exports.useEffect(function(){u(Dn.formatTime(o))},[o]);function f(T,y,E){const I=T.selectionStart===0?24:60;let D=parseInt(E,10)-y;return Number.isNaN(D)?D=0:n?D=(D%I+I)%I:D=Math.min(Math.max(0,D),I-1),`${D}`.padStart(2,"0")}function b(T,y,E,I,D){return I===0&&D===2&&y===1&&parseInt(E,10)>1?`0${E}${T.substring(2)}`:fd(T,y,E)}function C(T){RC.debug("handleChange",T),u(T),Dn.isTimeString(T)&&i(Dn.parseTime(T))}const w=S.exports.useCallback(T=>{p(T),a(T)},[a]);return h(Sl,{ref:g,className:s,example:MC,getNextSegmentValue:f,getPreferredReplacementString:b,onChange:C,onSelect:w,pattern:DC,selection:m,value:c,onFocus:r,onBlur:l,"data-testid":d})});Fu.defaultProps={allowValueWrapping:!0,className:"",onChange:()=>!1,onSelect:()=>!1,value:0,onFocus:()=>!1,onBlur:()=>!1,"data-testid":void 0};class xu extends S.exports.PureComponent{constructor(e){var i;super(e),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleMenuItemClick=this.handleMenuItemClick.bind(this),this.handleMenuItemMouseMove=this.handleMenuItemMouseMove.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.handleCloseMenu=this.handleCloseMenu.bind(this),this.container=Y.createRef(),this.oldFocus=document.activeElement,this.rAF=0;const{options:n}=e,s=(i=n.initialKeyboardIndex)!=null?i:-1;this.state={menuItems:[],keyboardIndex:s,mouseIndex:-1}}componentDidMount(){this.initMenu(),this.rAF=window.requestAnimationFrame(()=>{var n;(n=this.container.current)==null||n.focus();const{onMenuOpened:e}=this.props;e(this)})}componentDidUpdate(e){const{actions:n}=this.props;e.actions!==n&&this.initMenu()}componentWillUnmount(){cancelAnimationFrame(this.rAF)}getKeyboardIndex(){const{options:e}=this.props;if(e.separateKeyboardMouse!==void 0&&e.separateKeyboardMouse){const{keyboardIndex:n}=this.state;return n}return this.getMouseIndex()}setKeyboardIndex(e){const{options:n}=this.props;n.separateKeyboardMouse!==void 0&&n.separateKeyboardMouse?this.setState({keyboardIndex:e}):this.setMouseIndex(e)}getMouseIndex(){const{mouseIndex:e}=this.state;return e}setMouseIndex(e){this.setState({mouseIndex:e})}initMenu(){cancelAnimationFrame(this.rAF),this.setState({menuItems:[]});const{actions:e}=this.props,n=We.getMenuItems(e,!1);n.length>0&&this.setState(s=>({menuItems:We.sortActions(s.menuItems.concat(n))}))}handleKeyDown(e){const{menuItems:n}=this.state,s=this.getKeyboardIndex();let i=s;if(e.key==="Enter"||e.key===" "){s!=null&&s>=0&&s<n.length&&this.handleMenuItemClick(n[s],e);return}e.key==="Escape"?i=null:e.key==="ArrowUp"||e.key==="Tab"&&e.shiftKey===!0?i=We.getNextMenuItem(i!=null?i:0,-1,n):(e.key==="ArrowDown"||e.key==="Tab"&&e.shiftKey===!1)&&(i=We.getNextMenuItem(i!=null?i:0,1,n)),s!==i&&(i!==null?this.setKeyboardIndex(i):(this.closeMenu(),this.oldFocus instanceof HTMLElement&&this.oldFocus.focus()),e.preventDefault(),e.stopPropagation())}closeMenu(e=!1){const{closeMenu:n,onMenuClosed:s}=this.props;cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{n(e),s(this)})}handleCloseMenu(){this.closeMenu()}handleMenuItemClick(e,n){n.preventDefault(),n.stopPropagation(),e!=null&&(e.disabled===void 0||!e.disabled)&&e.action!=null&&(e.action(),this.closeMenu(!0))}handleMenuItemMouseMove(e){const{menuItems:n}=this.state,s=n.indexOf(e);this.setMouseIndex(s)}handleMouseLeave(){this.setMouseIndex(-1)}render(){const e=[],{"data-testid":n}=this.props,{keyboardIndex:s,menuItems:i,mouseIndex:o}=this.state;for(let l=0;l<i.length;l+=1){const a=i[l];l>0&&a.group!==i[l-1].group&&e.push(h("hr",{},`${l}.separator`));const d=h(gl,{isKeyboardSelected:s===l,isMouseSelected:o===l,menuItem:a,closeMenu:this.handleCloseMenu,onMenuItemClick:this.handleMenuItemClick,onMenuItemMouseMove:this.handleMenuItemMouseMove,onMenuItemContextMenu:()=>!1},l);e.push(d)}const{menuStyle:r}=this.props;return h("div",{className:"context-menu-container",style:{...r},ref:this.container,onKeyDown:this.handleKeyDown,onMouseLeave:this.handleMouseLeave,role:"menuitem",tabIndex:0,"data-testid":n,children:e})}}xu.defaultProps={closeMenu(){},onMenuOpened(){},onMenuClosed(){},options:{},menuStyle:{},"data-testid":void 0};class Fn extends S.exports.PureComponent{constructor(e){super(e),this.handleClick=this.handleClick.bind(this),this.handleCloseMenu=this.handleCloseMenu.bind(this),this.handleExited=this.handleExited.bind(this),this.container=Y.createRef(),this.parent=null,this.popper=Y.createRef(),this.isOpen=!1}componentDidMount(){var n;const{isShown:e}=this.props;e===null?(n=this.container.current)!=null&&n.parentElement&&(this.parent=this.container.current.parentElement,this.parent.addEventListener("click",this.handleClick)):e&&this.openMenu()}componentDidUpdate(e){const{isShown:n}=this.props;e.isShown!==n&&(n!==null&&n?window.requestAnimationFrame(()=>{this.openMenu()}):this.closeMenu())}componentWillUnmount(){this.parent&&this.parent.removeEventListener("click",this.handleClick)}closeMenu(){var e;(e=this.popper.current)==null||e.hide()}openMenu(){this.popper.current&&!this.isOpen&&(this.popper.current.show(),this.isOpen=!0)}scheduleUpdate(){var e;(e=this.popper.current)==null||e.scheduleUpdate()}handleClick(e){e.preventDefault(),e.stopPropagation(),this.openMenu()}handleCloseMenu(){this.closeMenu()}handleExited(){this.isOpen=!1;const{onMenuClosed:e}=this.props;e()}render(){const{actions:e,onMenuOpened:n,popperClassName:s,"data-testid":i}=this.props,{menuStyle:o}=this.props;let{options:r,popperOptions:l}=this.props;return l={placement:"bottom",...l},r={separateKeyboardMouse:!0,...r},h("div",{className:"menu-actions-listener",ref:this.container,"data-testid":i,children:h(kn,{ref:this.popper,options:l,className:W("menu-popper",s),onExited:this.handleExited,closeOnBlur:!0,interactive:!0,children:h(xu,{actions:e,closeMenu:this.handleCloseMenu,onMenuOpened:n,options:r,menuStyle:o})})})}}Fn.defaultProps={isShown:null,onMenuClosed(){},onMenuOpened(){},options:{},popperOptions:{},popperClassName:"",menuStyle:{},"data-testid":void 0};const Hc=-1;var _u=(t=>(t.UP="UP",t.DOWN="DOWN",t))(_u||{});const ss=class extends S.exports.Component{constructor(t){super(t);const{value:e,valueToTime:n}=t;this.toggleMenu=this.toggleMenu.bind(this),this.handleMenuKeyDown=this.handleMenuKeyDown.bind(this),this.closeMenu=this.closeMenu.bind(this),this.handleOptionClick=this.handleOptionClick.bind(this),this.handleOptionFocus=this.handleOptionFocus.bind(this),this.handleMenuOpened=this.handleMenuOpened.bind(this),this.handleMenuExited=this.handleMenuExited.bind(this),this.handleCustomInput=this.handleCustomInput.bind(this),this.csContainer=Y.createRef(),this.menuContainer=Y.createRef(),this.button=Y.createRef(),this.input=Y.createRef(),this.state={keyboardOptionIndex:0,menuIsOpen:!1,inputWidth:100,customTime:n(e),inputFocused:!1}}getSelectedText(){const{options:t,value:e,placeholder:n}=this.props,{customTime:s}=this.state;if(e===null)return n;for(let i=0;i<t.length;i+=1){const o=t[i];if(o.value===e)return o.title}return Dn.formatTime(s)}setInputWidth(){this.csContainer.current&&this.setState({inputWidth:this.csContainer.current.getBoundingClientRect().width})}focus(){var t;(t=this.button.current)==null||t.focus()}updateInputValue(t){const{onChange:e}=this.props;e(t)}handleResize(){this.setInputWidth()}handleMenuKeyDown(t){var i;const{keyboardOptionIndex:e,inputFocused:n}=this.state,{options:s}=this.props;switch(t.key){case"Enter":case" ":n?this.updateFromCustom():this.updateInputValue(s[e].value),this.closeMenu(),(i=this.button.current)==null||i.focus(),t.stopPropagation(),t.preventDefault();break;case"Tab":t.shiftKey?this.handleMenuNavigation(ss.MENU_NAVIGATION_DIRECTION.UP):this.handleMenuNavigation(ss.MENU_NAVIGATION_DIRECTION.DOWN),t.stopPropagation(),t.preventDefault();break;case"ArrowUp":this.handleMenuNavigation(ss.MENU_NAVIGATION_DIRECTION.UP),t.stopPropagation(),t.preventDefault();break;case"ArrowDown":this.handleMenuNavigation(ss.MENU_NAVIGATION_DIRECTION.DOWN),t.stopPropagation(),t.preventDefault();break;case"Escape":this.closeMenu();break}}handleMenuNavigation(t){const{keyboardOptionIndex:e,inputFocused:n}=this.state,{options:s}=this.props,i=s.length;let o=e;switch(t){case ss.MENU_NAVIGATION_DIRECTION.UP:if(!n&&e===0){this.focusInput();break}else n&&this.focusOption(e);e>0&&!n?(o=(o-1)%i,this.setState({keyboardOptionIndex:o})):e===0&&(o=i-1,this.setState({keyboardOptionIndex:o})),this.scrollOptionIntoView(o);break;case ss.MENU_NAVIGATION_DIRECTION.DOWN:if(!n&&e===i-1){this.focusInput();break}else n&&this.focusOption(e);e<i&&!(n&&e===0)&&(o=(o+1)%i,this.setState({keyboardOptionIndex:o})),this.scrollOptionIntoView(o);break}}handleOptionClick(t){const e=Number(t.currentTarget.value),{options:n,timeToValue:s}=this.props,{customTime:i}=this.state;if(e===Hc){const o=s(i);this.updateAndClose(o)}else this.updateAndClose(n[e].value)}updateAndClose(t){var e;this.updateInputValue(t),this.closeMenu(),(e=this.button.current)==null||e.focus()}handleOptionFocus(t){this.setState({keyboardOptionIndex:Number(t.target.value)})}handleMenuOpened(){var o;const{options:t,value:e}=this.props,{keyboardOptionIndex:n}=this.state;this.scrollOptionIntoView(n);const s=(o=this.menuContainer.current)==null?void 0:o.querySelector(".cs-option-btn.keyboard-active");if(s instanceof HTMLElement&&s.focus(),e===null)return;t.map(r=>r.value).indexOf(e)<0&&this.focusInput()}focusInput(){var t;(t=this.input.current)==null||t.focus()}focusOption(t){var n;const e=(n=this.menuContainer.current)==null?void 0:n.querySelector(".cs-options");if(e&&e.children!=null){const s=e.children.item(t);s instanceof HTMLElement&&s.focus()}}handleMenuExited(){const{menuIsOpen:t}=this.state;t&&this.setState({menuIsOpen:!1,keyboardOptionIndex:0})}handleCustomInput(t){const{timeToValue:e}=this.props,n=e(t);this.updateInputValue(n),this.setState({customTime:t})}updateFromCustom(){const{timeToValue:t}=this.props,{customTime:e}=this.state,n=t(e);this.updateInputValue(n)}toggleMenu(t){const{menuIsOpen:e}=this.state;e?this.closeMenu():this.openMenu(),t.stopPropagation()}openMenu(){this.updateKeyboardIndex(),this.setInputWidth(),this.setState({menuIsOpen:!0})}closeMenu(t=!0){var e;this.setState({menuIsOpen:!1}),t&&((e=this.button.current)==null||e.focus())}updateKeyboardIndex(){const{options:t,value:e}=this.props;if(e===null)return;const n=t.map(s=>s.value).indexOf(e);n>0&&this.setState({keyboardOptionIndex:n})}scrollOptionIntoView(t){var n;const e=(n=this.menuContainer.current)==null?void 0:n.querySelector(".cs-options");if(e&&e.children!=null){const s=e.children.item(t);s instanceof HTMLElement&&s.offsetTop>ss.DROP_DOWN_MENU_HEIGHT?e.scrollTop=s.offsetTop-ss.DROP_DOWN_MENU_HEIGHT:(s instanceof HTMLElement&&s.offsetTop<0||t===0)&&(e.scrollTop=0)}}renderMenuElement(){const{inputWidth:t}=this.state;return h("div",{className:"cs-menu-container",ref:this.menuContainer,role:"presentation",onKeyDown:this.handleMenuKeyDown,onClick:e=>{e.stopPropagation()},style:{width:t},children:h("div",{className:"cs-options-container",children:h("div",{className:"cs-options",children:this.renderOptions()})})})}renderOptions(){const{options:t,value:e,icon:n,customText:s}=this.props,{keyboardOptionIndex:i,customTime:o,inputFocused:r}=this.state;let l=!1;const a=[];for(let d=0;d<t.length;d+=1){const c=t[d],u=`option-${d}-${c.value}`;l=l||c.value===e,a.push(v("button",{type:"button",value:d,className:W("cs-option-btn",{"keyboard-active":i===d&&!r}),onClick:this.handleOptionClick,onFocus:this.handleOptionFocus,children:[c.value===e&&h(j,{icon:n,className:"mr-2"}),c.value!==e&&h("span",{className:"mr-4"}),c.title]},u))}return a.push(h("hr",{className:"cs-divider"},"option-divider")),a.push(v("button",{type:"button",value:Hc,className:W("cs-option-btn",{"keyboard-active":r}),onClick:this.handleOptionClick,onFocus:this.handleOptionFocus,children:[!l&&e!==null?h(j,{icon:n,className:"mr-2"}):h("span",{className:"mr-4"}),s]},"option-custom-label")),a.push(v("div",{className:"cs-custom-container",children:[h("span",{className:"mr-2"}),h(Fu,{ref:this.input,onChange:this.handleCustomInput,value:o,onFocus:()=>this.setState({inputFocused:!0}),onBlur:()=>this.setState({inputFocused:!1})},"option-input"),h("span",{className:"ml-2"})]},"cs-custom-container")),a.push(h("hr",{className:"mb-2"},"option-end")),a}render(){const{disabled:t,invalid:e,value:n,"data-testid":s}=this.props,{menuIsOpen:i}=this.state;let{popperOptions:o}=this.props;return o={placement:"bottom-end",modifiers:{preventOverflow:{enabled:!1}},...o},h("div",{className:"input-group cs-container context-menu",ref:this.csContainer,"data-testid":s,children:h("div",{className:W("input-group-append cs-dropdown",{"cs-dropdown-invalid":e}),children:v("button",{type:"button",className:W("btn cs-btn form-control",{"cs-btn-invalid":e}),ref:this.button,onClick:this.toggleMenu,disabled:t,children:[h("span",{className:W({"text-muted":n===null}),children:this.getSelectedText()}),h("span",{children:h(j,{icon:md,className:"cs-caret"})}),h(Fn,{isShown:i,actions:{menuElement:this.renderMenuElement()},popperOptions:o,popperClassName:"CustomTimeSelect",onMenuOpened:this.handleMenuOpened,onMenuClosed:this.handleMenuExited,menuStyle:{maxWidth:"100rem"}})]})})})}};let Cd=ss;Cd.MENU_NAVIGATION_DIRECTION=_u;Cd.DROP_DOWN_MENU_HEIGHT=125;Cd.defaultProps={onChange(){},value:null,disabled:!1,popperOptions:{},icon:ds,customText:"Custom",placeholder:"Select a time",valueToTime:t=>t===null?0:Math.round(t/1e3),timeToValue:t=>t*1e3,invalid:!1,"data-testid":void 0};function Ei(t,e,n,s,i){const o=s-n+1;return`${((parseInt(e,10)-t-n)%o+o)%o+n}`.padStart(i,"0")}function ku(t,e,n){const{selectionStart:s}=t;return s===0?Ei(e,n,1900,2099,4):s===5?Ei(e,n,1,12,2):s===8?Ei(e,n,1,31,2):s===11?Ei(e,n,0,23,2):s===17||s===14?Ei(e,n,0,59,2):s===20||s===24||s===28?Ei(e,n,0,999,3):n}const NC=X.module("DateTimeInput"),FC="[12][0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])",xC="([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}",_C=`${FC} ${xC}`,Lr="2022-01-01",Ou=`${Lr} 00:00:00.000000000`,kC="YYYY-MM-DD HH:MM:SS.SSSSSSSSS";function Vc(t){return t!=null&&t.length>=Lr.length?`${t.substring(0,Lr.length)}${t.substring(Lr.length).replace(/\u2007/g,"0")}${Ou.substring(t.length)}`:t}function xa(t){const e=t.substring(0,23),n=t.substring(23,26),s=t.substring(26);return[e,n,s].filter(i=>i!=="").join("\u200B")}const Uc=t=>t.replace(/\u200B/g,""),OC=[xa(Ou)],Lu=Y.forwardRef((t,e)=>{const{className:n="",onChange:s=()=>{},defaultValue:i="",onFocus:o=()=>{},onBlur:r=()=>{},"data-testid":l}=t,[a,d]=S.exports.useState(i.length>0?xa(i):""),[c,u]=S.exports.useState(),m=S.exports.useCallback(g=>{NC.debug("handleChange",g),d(g),s(Vc(Uc(g)))},[s]),p=S.exports.useCallback(()=>{const g=Uc(a),f=Vc(g);f!==g&&d(xa(f)),r()},[a,r]);return h("div",{className:"d-flex flex-row align-items-center",children:h(Sl,{ref:e,className:W(n),example:OC,getNextSegmentValue:ku,onChange:m,onSelect:u,pattern:_C,placeholder:kC,selection:c,value:a,onFocus:o,onBlur:p,"data-testid":l})})});Lu.displayName="DateTimeInput";Lu.defaultProps={className:"",onChange:()=>{},defaultValue:"",onFocus:()=>{},onBlur:()=>{},"data-testid":void 0};const LC=X.module("DateInput"),AC="[12][0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])",PC=["2000-01-01","2022-12-31"],HC="YYYY-MM-DD",Au=Y.forwardRef((t,e)=>{const{className:n="",onChange:s=()=>{},defaultValue:i="",onFocus:o=()=>{},onBlur:r=()=>{},"data-testid":l}=t,[a,d]=S.exports.useState(i),[c,u]=S.exports.useState(),m=S.exports.useCallback(p=>{LC.debug("handleChange",p),d(p),s(p)},[s]);return h("div",{className:"d-flex flex-row align-items-center",children:h(Sl,{ref:e,className:W(n),example:PC,getNextSegmentValue:ku,onChange:m,onSelect:u,pattern:AC,placeholder:HC,selection:c,value:a,onFocus:o,onBlur:r,"data-testid":l})})});Au.displayName="DateInput";Au.defaultProps={className:"",onChange:()=>!1,defaultValue:"",onFocus:()=>!1,onBlur:()=>!1,"data-testid":void 0};class Pu extends S.exports.PureComponent{constructor(e){super(e),this.searchInput=Y.createRef(),this.handleChange=this.handleChange.bind(this),this.sendUpdate=je(this.sendUpdate.bind(this),e.debounceMs),this.state={value:e.value}}componentDidUpdate(e){const{value:n}=this.props;e.value!==n&&this.setState({value:n})}focus(){var e;(e=this.searchInput.current)==null||e.focus()}handleChange(e){this.setState({value:e.target.value},this.sendUpdate)}sendUpdate(){const{onChange:e}=this.props,{value:n}=this.state;e(n)}render(){const{placeholder:e,className:n,matchCount:s,id:i,"data-testid":o}=this.props,{value:r}=this.state;return h(Cs,{value:r,placeholder:e,onChange:this.handleChange,className:n,matchCount:s,ref:this.searchInput,id:i,"data-testid":o})}}Pu.defaultProps={placeholder:"Search",className:"",matchCount:null,debounceMs:250,id:"","data-testid":void 0};const VC=X.module("ItemListItem"),Hu=class extends S.exports.Component{constructor(t){super(t),this.handleBlur=this.handleBlur.bind(this),this.handleFocus=this.handleFocus.bind(this),this.handleClick=this.handleClick.bind(this),this.handleContextMenu=this.handleContextMenu.bind(this),this.handleDragStart=this.handleDragStart.bind(this),this.handleDrag=this.handleDrag.bind(this),this.handleDragOver=this.handleDragOver.bind(this),this.handleDragEnd=this.handleDragEnd.bind(this),this.handleDrop=this.handleDrop.bind(this),this.handleDoubleClick=this.handleDoubleClick.bind(this),this.handleMouseDown=this.handleMouseDown.bind(this),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleMouseUp=this.handleMouseUp.bind(this),this.itemRef=Y.createRef()}static handleKeyDown(){return VC.log("ItemListItem.handleKeyDown false"),!1}handleBlur(t){const{itemIndex:e,onBlur:n}=this.props;n(e,t)}handleFocus(t){const{itemIndex:e,onFocus:n}=this.props;n(e,t)}handleClick(t){const{itemIndex:e,onClick:n}=this.props;n(e,t)}handleContextMenu(t){const{itemIndex:e,onContextMenu:n}=this.props;n(e,t)}handleDragStart(t){const{itemIndex:e,onDragStart:n}=this.props;n(e,t)}handleDrag(t){const{itemIndex:e,onDrag:n}=this.props;n(e,t)}handleDragOver(t){t.preventDefault();const{itemIndex:e,onDragOver:n}=this.props;n(e,t)}handleDragEnd(t){const{itemIndex:e,onDragEnd:n}=this.props;n(e,t)}handleDrop(t){const{itemIndex:e,onDrop:n}=this.props;n(e,t)}handleDoubleClick(t){const{itemIndex:e,onDoubleClick:n}=this.props;n(e,t)}handleMouseMove(t){const{itemIndex:e,onMouseMove:n}=this.props;n(e,t)}handleMouseDown(t){const{itemIndex:e,onMouseDown:n}=this.props;n(e,t)}handleMouseUp(t){const{itemIndex:e,onMouseUp:n}=this.props;n(e,t)}render(){const{isDraggable:t,isFocused:e,isSelected:n,style:s,children:i,"data-testid":o}=this.props;return h("div",{className:W("item-list-item",{active:n},{"is-focused":e},{"is-draggable":t}),onKeyDown:Hu.handleKeyDown,onContextMenu:this.handleContextMenu,onClick:this.handleClick,onDrag:this.handleDrag,onDragStart:this.handleDragStart,onDragOver:this.handleDragOver,onDragEnd:this.handleDragEnd,onDrop:this.handleDrop,onDoubleClick:this.handleDoubleClick,onMouseDown:this.handleMouseDown,onMouseMove:this.handleMouseMove,onMouseUp:this.handleMouseUp,tabIndex:-1,ref:this.itemRef,role:"listitem",style:s,onFocus:this.handleFocus,onBlur:this.handleBlur,draggable:t,"data-testid":o,children:i})}};let Vu=Hu;Vu.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 Bc=X.module("ItemList"),Vi=class extends S.exports.PureComponent{constructor(t){super(t),this.getItemSelected=ve((s,i)=>fn.isSelected(i,s),{max:Vi.CACHE_SIZE}),this.getCachedItem=ve((s,i,o,r,l,a,d,c)=>{const u=a({item:o,itemIndex:s,isFocused:r,isSelected:l,style:d});return h(Vu,{onContextMenu:this.handleItemContextMenu,onDoubleClick:this.handleItemDoubleClick,onMouseDown:this.handleItemMouseDown,onFocus:this.handleItemFocus,onBlur:this.handleItemBlur,disableSelect:c,onMouseMove:this.handleItemMouseMove,onMouseUp:this.handleItemMouseUp,isFocused:r,isSelected:l,itemIndex:s,style:d,children:u},i)},{max:Vi.CACHE_SIZE}),this.getOuterElement=ve(s=>{const i=Y.forwardRef((o,r)=>h("div",{ref:r,tabIndex:-1,onKeyDown:s,role:"presentation",...o}));return i.displayName="ItemListOuterElement",i}),this.getInnerElement=ve(()=>{const s=Y.forwardRef((i,o)=>h("div",{className:"item-list-inner-element",ref:o,...i}));return s.displayName="ItemListInnerElement",s}),this.getItemData=ve((s,i,o)=>({items:s,selectedRanges:i,renderItem:o})),this.handleItemBlur=this.handleItemBlur.bind(this),this.handleItemContextMenu=this.handleItemContextMenu.bind(this),this.handleItemFocus=this.handleItemFocus.bind(this),this.handleItemDoubleClick=this.handleItemDoubleClick.bind(this),this.handleItemMouseDown=this.handleItemMouseDown.bind(this),this.handleItemMouseMove=this.handleItemMouseMove.bind(this),this.handleItemMouseUp=this.handleItemMouseUp.bind(this),this.handleItemsRendered=this.handleItemsRendered.bind(this),this.handleWindowMouseUp=this.handleWindowMouseUp.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.handleScroll=this.handleScroll.bind(this),this.handleResize=this.handleResize.bind(this),this.renderInnerElement=this.renderInnerElement.bind(this),this.list=Y.createRef(),this.listContainer=Y.createRef();const{isStickyBottom:e,selectedRanges:n}=t;this.state={focusIndex:null,mouseDownIndex:null,selectedRanges:n,overscanStartIndex:0,height:null,isDragging:!1,isStuckToBottom:e,scrollOffset:null}}static renderItem({item:t}){var e,n;return h("div",{className:"item-list-item-content",children:t!=null&&((n=(e=t.displayValue)!=null?e:t.value)!=null?n:`${t}`)})}componentDidUpdate(t,e){const{selectedRanges:n,itemCount:s}=this.props,{focusIndex:i,isStuckToBottom:o,scrollOffset:r,height:l,selectedRanges:a}=this.state;if(o&&!this.isListAtBottom()&&s>0&&this.scrollToBottom(),(r!==e.scrollOffset||l!==e.height)&&this.sendViewportUpdate(),n!==t.selectedRanges&&n!==a)this.setSelectedRanges(n);else if(a!==e.selectedRanges){const{onSelectionChange:d}=this.props;d(a)}if(i!==e.focusIndex){const{onFocusChange:d}=this.props;d(i)}}componentWillUnmount(){window.removeEventListener("mouseup",this.handleWindowMouseUp)}focus(){var t;(t=this.listContainer.current)==null||t.focus()}restoreScrollPosition(){var e;const{scrollOffset:t}=this.state;t!=null&&((e=this.listContainer.current)==null||e.scrollTo(0,t))}getElement(t){if(this.listContainer.current==null)return null;const{focusSelector:e}=this.props,{overscanStartIndex:n}=this.state,s=this.listContainer.current.querySelectorAll(e),i=t-n;return s[i]}focusItem(t){const{disableSelect:e}=this.props;if(e)return;this.setState({focusIndex:t});const n=this.getElement(t);n instanceof HTMLElement&&n.focus()}scrollToItem(t){const e=this.getElement(t);e!=null&&e.scrollIntoView({block:"center"})}handleItemContextMenu(t,e){const{selectedRanges:n}=this.state,i=fn.isSelected(n,t)||We.isModifierKeyDown(e);this.toggleSelect(t,e.shiftKey,i,!1)}handleItemDoubleClick(t,e){const{isDoubleClickSelect:n,onSelect:s}=this.props;n&&this.setState(({selectedRanges:i})=>({selectedRanges:fn.selectRange(i,[t,t])}),()=>{s(t,e)})}handleItemMouseDown(t,e){const{selectedRanges:n}=this.state;if(!(e.target instanceof HTMLElement&&["button","select","input","textarea"].indexOf(e.target.tagName.toLowerCase())!==-1)){if(e.button===2&&n.length===0){this.focusItem(t),this.selectItem(t);return}e.button!=null&&e.button!==0||(this.setState({mouseDownIndex:t}),window.addEventListener("mouseup",this.handleWindowMouseUp))}}handleItemBlur(t,e){Bc.debug2("item blur",t,e.currentTarget,e.relatedTarget),(!e.relatedTarget||this.listContainer.current&&e.relatedTarget instanceof HTMLElement&&!this.listContainer.current.contains(e.relatedTarget))&&this.setState({focusIndex:null})}handleItemFocus(t,e){Bc.debug2("item focus",t,e.target),this.setState(n=>{const{focusIndex:s}=n;return s!==t?{focusIndex:t}:null})}handleItemMouseMove(t,e){const{isDragSelect:n,isMultiSelect:s,disableSelect:i}=this.props,{mouseDownIndex:o,selectedRanges:r}=this.state;o==null||i||(this.setState({isDragging:!0}),(n||o===t)&&(this.focusItem(t),s?(!n&&!this.getItemSelected(t,r)&&!We.isModifierKeyDown(e)&&this.deselectAll(),this.selectRange([Math.min(o,t),Math.max(o,t)])):this.toggleSelect(t,e.shiftKey,We.isModifierKeyDown(e),!1)))}handleItemMouseUp(t,e){const{isDeselectOnClick:n,isDoubleClickSelect:s,onSelect:i}=this.props,{mouseDownIndex:o,isDragging:r}=this.state;if(!(e.target instanceof HTMLElement&&["button","select","input","textarea"].indexOf(e.target.tagName.toLowerCase())!==-1)){if(o===t&&!r){const l=e.shiftKey,a=We.isModifierKeyDown(e);this.focusItem(t),this.toggleSelect(t,l,a,n),!s&&!l&&!a&&i(t,e)}this.resetMouseState()}}handleItemsRendered({overscanStartIndex:t}){this.setState({overscanStartIndex:t})}handleResize({height:t}){this.setState({height:t})}handleMouseLeave(){this.setState({mouseDownIndex:null})}handleWindowMouseUp(){this.resetMouseState(),window.removeEventListener("mouseup",this.handleWindowMouseUp)}handleKeyDown(t){var r;const{isMultiSelect:e,itemCount:n,onSelect:s}=this.props,{focusIndex:i}=this.state;let o=i;if(t.key==="Enter"||t.key===" "){!e&&o!=null&&this.setState({selectedRanges:[[o,o]]},()=>{o!=null&&s(o,t)});return}if(t.key==="ArrowUp")o!=null&&o>=0?o=Math.max(0,o-1):o=n-1;else if(t.key==="ArrowDown")o!=null&&o>=0?o=Math.min(o+1,n-1):o=0;else return;if(i!==o){t.stopPropagation(),t.preventDefault(),this.focusItem(o);const{selectedRanges:l}=this.state;if(t.shiftKey&&l.length>0){const a=l[l.length-1];this.selectRange([Math.min(o,a[0]),Math.max(o,a[1])])}else this.deselectAll(),o!==null?this.selectItem(o):(r=this.listContainer.current)==null||r.focus();this.scrollIntoView(o)}}handleScroll({scrollUpdateWasRequested:t,scrollOffset:e}){this.setState(n=>{if(t)return{scrollOffset:e};const{isStickyBottom:s}=this.props,{height:i}=n;return{isStuckToBottom:s&&this.isListAtBottom({scrollOffset:e,height:i}),scrollOffset:e}})}resetMouseState(){this.setState({mouseDownIndex:null,isDragging:!1})}scrollToBottom(){const{itemCount:t}=this.props;this.list.current&&this.list.current.scrollToItem(t)}scrollIntoView(t){this.list.current&&this.list.current.scrollToItem(t)}toggleSelect(t,e,n,s=!0){const{isMultiSelect:i}=this.props,{selectedRanges:o}=this.state;if(i&&e&&o.length>0){const r=o[o.length-1];this.selectRange([Math.min(r[0],t),Math.max(t,r[1])])}else i&&o.length===1&&o[0][0]===t&&o[0][1]===t?s&&this.deselectItem(t):i&&n?this.getItemSelected(t,o)?s&&this.deselectItem(t):this.selectItem(t):(this.deselectAll(),this.selectItem(t))}deselectAll(){const{itemCount:t}=this.props;this.deselectRange([0,t])}deselectItem(t){this.deselectRange([t,t])}deselectRange(t){fn.validateRange(t),this.setState(({selectedRanges:e})=>({selectedRanges:fn.deselectRange(e,t)}))}selectItem(t){const{disableSelect:e}=this.props;e||this.selectRange([t,t])}selectRange(t){fn.validateRange(t),this.setState(({selectedRanges:e})=>({selectedRanges:fn.selectRange(e,t)}))}setSelectedRanges(t){this.setState({selectedRanges:t})}sendViewportUpdate(){const{scrollOffset:t,height:e}=this.state;if(t!=null&&e!=null){const{onViewportChange:n,rowHeight:s}=this.props,i=Math.floor(t/s),o=i+Math.ceil(e/s);n(i,o)}}isListAtBottom({scrollOffset:t,height:e}=this.state){if(e==null||t==null)return!1;const{itemCount:n,rowHeight:s}=this.props;return t+e>=n*s}renderInnerElement({index:t,style:e}){const{items:n,offset:s,renderItem:i,disableSelect:o}=this.props,{focusIndex:r,selectedRanges:l}=this.state;if(t<s||t>=s+n.length)return null;const a=n[t-s];return this.getCachedItem(t,t,a,t===r&&!o,this.getItemSelected(t,l),i,e,o)}render(){const{items:t,itemCount:e,overscanCount:n,renderItem:s,rowHeight:i,"data-testid":o}=this.props,{selectedRanges:r,isStuckToBottom:l}=this.state;return h(rg,{className:"item-list-auto-sizer",onResize:this.handleResize,children:({width:a,height:d})=>h(lg,{className:"item-list-scroll-pane",height:d,width:a,initialScrollOffset:l?e*i:0,itemCount:e,itemSize:i,itemData:this.getItemData(t,r,s),onScroll:this.handleScroll,onItemsRendered:this.handleItemsRendered,ref:this.list,outerElementType:this.getOuterElement(this.handleKeyDown),outerRef:this.listContainer,innerElementType:this.getInnerElement(),overscanCount:n,"data-testid":o,children:this.renderInnerElement})})}};let bn=Vi;bn.CACHE_SIZE=1e3;bn.DEFAULT_ROW_HEIGHT=20;bn.DEFAULT_OVERSCAN=10;bn.defaultProps={offset:0,items:[],rowHeight:Vi.DEFAULT_ROW_HEIGHT,isDeselectOnClick:!0,isDoubleClickSelect:!1,isDragSelect:!0,isMultiSelect:!1,isStickyBottom:!1,disableSelect:!1,onFocusChange(){},onSelect(){},onSelectionChange(){},onViewportChange(){},overscanCount:Vi.DEFAULT_OVERSCAN,renderItem:Vi.renderItem,selectedRanges:[],focusSelector:".item-list-item","data-testid":void 0};const ii=class extends S.exports.PureComponent{constructor(t){super(t),this.getCachedDraggableItem=ve((e,n,s,i,o,r,l,a)=>h(ul,{draggableId:ii.getDraggableId(e,i),index:i,isDragDisabled:l,children:d=>h("div",{role:"menuitem",className:"draggable-item-list-item",ref:d.innerRef,tabIndex:-1,...d.draggableProps,...d.dragHandleProps,children:n({item:s,itemIndex:i,isFocused:o,isSelected:r,style:a,isClone:!1})})},i),{max:bn.CACHE_SIZE}),this.getCachedRenderDraggableItem=ve((e,n,s)=>({item:i,itemIndex:o,isFocused:r,isSelected:l,style:a})=>this.getCachedDraggableItem(e,s,i,o,r,l,n,a),{max:1}),this.getCachedRenderClone=ve((e,n,s,i)=>(o,r,l)=>{const{selectedCount:a}=this.state,{draggableProps:d,dragHandleProps:c,innerRef:u}=o,{index:m}=l.source,p=n[m-s];return h("div",{className:W("draggable-item-list-dragging-item-container",e),...d,...c,ref:u,children:h("div",{className:W("draggable-item-list-dragging-item",{"two-dragged":a===2},{"multiple-dragged":a>2}),children:i({item:p,itemIndex:m,isFocused:!1,isSelected:!0,style:{},isClone:!0,selectedCount:a})})})},{max:1}),this.handleSelectionChange=this.handleSelectionChange.bind(this),this.itemList=Y.createRef(),this.state={selectedCount:0}}static renderHandle(){return v("div",{children:[h(Ue,{children:"Drag to re-order"}),h(j,{icon:Ko})]})}static renderBadge({text:t}){return t!=null&&t.length>0?h("span",{className:"number-badge",children:t}):null}static renderTextItem({text:t,badgeText:e="",className:n=""}){return v("div",{className:W("item-list-item-content","draggable-item-list-item-content",n),children:[h("span",{className:"title",children:t}),ii.renderBadge({text:e}),ii.renderHandle()]})}static renderItem({item:t,isClone:e,selectedCount:n}){var r,l;const s=t!=null?(l=(r=t.displayValue)!=null?r:t.value)!=null?l:`${t}`:"",i=e!==void 0&&e?`${n}`:"",o=e!==void 0&&e?"item-list-item-clone":"";return ii.renderTextItem({text:s,badgeText:i,className:o})}static getDraggableId(t,e){return`${t}/${e}`}static getDraggableIndex(t){const e=t.split("/").pop();return parseInt(e!==void 0?e:"",10)}selectItem(t){var e;(e=this.itemList.current)==null||e.selectItem(t)}focusItem(t){var e;(e=this.itemList.current)==null||e.focusItem(t)}scrollToItem(t){var e;(e=this.itemList.current)==null||e.scrollToItem(t)}handleSelectionChange(t){this.setState({selectedCount:fn.count(t)});const{onSelectionChange:e}=this.props;e(t)}render(){const{className:t,draggablePrefix:e,draggingItemClassName:n,droppableId:s,isDoubleClickSelect:i,isDragDisabled:o,isDropDisabled:r,isMultiSelect:l,isStickyBottom:a,itemCount:d,items:c,offset:u,onFocusChange:m,onSelect:p,onViewportChange:g,renderItem:f,rowHeight:b,selectedRanges:C,style:w,"data-testid":T}=this.props;return h(Uo,{isDropDisabled:r,droppableId:s,mode:"virtual",renderClone:this.getCachedRenderClone(n,c,u,f),"data-testid":T,children:(y,E)=>h("div",{role:"menu",className:W("draggable-item-list",t,{"is-drop-disabled":r,"is-drag-disabled":o,"is-dragging-from-this":E.draggingFromThisWith,"is-dragging-over":E.isDraggingOver,"is-dropping":E.draggingOverWith}),style:w,ref:y.innerRef,...y.droppableProps,children:h(bn,{focusSelector:".draggable-item-list-item",isDoubleClickSelect:i,isDragSelect:!1,isMultiSelect:l,isStickyBottom:a,itemCount:d,items:c,onFocusChange:m,onSelect:p,onSelectionChange:this.handleSelectionChange,onViewportChange:g,offset:u,ref:this.itemList,renderItem:this.getCachedRenderDraggableItem(e,o,f),rowHeight:b,selectedRanges:C})})})}};let rn=ii;rn.DEFAULT_ROW_HEIGHT=30;rn.defaultProps={className:"",draggingItemClassName:"",offset:0,items:[],rowHeight:ii.DEFAULT_ROW_HEIGHT,isDeselectOnClick:!0,isDoubleClickSelect:!0,isDropDisabled:!1,isDragDisabled:!1,isMultiSelect:!1,isStickyBottom:!1,disableSelect:!1,style:null,onFocusChange(){},onSelect(){},onSelectionChange(){},onViewportChange(){},renderItem:ii.renderItem,selectedRanges:[],draggablePrefix:"draggable-item",droppableId:"droppable-item-list","data-testid":void 0};class jt{static reorder(e,n,s,i){const o=e===s?jt.adjustDestinationIndex(i,n):i,r=jt.removeItems(e,n);return s.splice(o,0,...r),r}static removeItems(e,n){const s=[],i=n.map((o,r)=>({range:o,index:r})).sort((o,r)=>r.range[0]-o.range[0]);for(let o=0;o<i.length;o+=1){const{range:r,index:l}=i[o],[a,d]=r;s[l]=e.splice(a,d-a+1)}return ag(s)}static adjustDestinationIndex(e,n){let s=e;for(let i=0;i<n.length;i+=1){const[o,r]=n[i];if(o>e)break;s-=Math.min(r,e-1)-o+1}return s}static startDragging(){document.documentElement.classList.add("drag-pointer-events-none")}static stopDragging(){document.documentElement.classList.remove("drag-pointer-events-none")}}const Ar=class extends S.exports.Component{static isParentSelected(t,e){const n=e.get(t);if(n===void 0)return!1;if(typeof n=="boolean")return n;const s=Array.from(n.values()).includes(!0),i=Array.from(n.values()).includes(!1);return s&&i?null:s}constructor(t){super(t),this.toggleMenu=this.toggleMenu.bind(this),this.toggleValueFor=this.toggleValueFor.bind(this),this.selectAll=this.selectAll.bind(this),this.clear=this.clear.bind(this),this.state={menuIsOpen:!1}}toggleMenu(t){t.stopPropagation(),t.preventDefault(),this.setState(e=>{const{menuIsOpen:n}=e;return{menuIsOpen:!n}})}toggleValueFor(t,e){const{valueMap:n,onUpdateValueMap:s}=this.props,i=new Map(n),o=i.get(t);if(o instanceof Map){const l=new Map(o);if(e!=null)l.set(e,o.get(e)===void 0);else{const a=Ar.isParentSelected(t,i),d=a==null||!a;o.forEach((c,u)=>l.set(u,d))}i.set(t,l)}else i.set(t,o==null||!o);const r=i.get(t);if(e===void 0&&r!==void 0&&typeof r!="boolean"){const l=Ar.isParentSelected(t,n);l!=null&&l?r.forEach((a,d)=>r.set(d,!1)):r.forEach((a,d)=>r.set(d,!0))}s(i)}setAllValues(t){const{valueMap:e,onUpdateValueMap:n}=this.props,s=new Map;e.forEach((i,o)=>{if(typeof i=="boolean")s.set(o,t);else{const r=new Map;i.forEach((l,a)=>r.set(a,t)),s.set(o,r)}}),n(s)}selectAll(){this.setAllValues(!0)}clear(){this.setAllValues(!1)}renderMenuElement(){const{valueMap:t,"data-testid":e}=this.props;return v("div",{className:"hcm-menu-container",children:[Array.from(t.entries()).map(([n,s])=>v("div",{children:[h(St,{className:"hcm-parent",checked:Ar.isParentSelected(n,t),onChange:()=>this.toggleValueFor(n),children:n}),s!==void 0&&typeof s!="boolean"&&Array.from(s.entries()).map(([i,o])=>h(St,{className:"hcm-child",checked:o,onChange:()=>this.toggleValueFor(n,i),children:i},i))]},n)),h(z,{kind:"ghost",onClick:this.selectAll,"data-testid":e!==void 0?`${e}-btn-select-all`:void 0,children:"Select All"}),h(z,{kind:"ghost",onClick:this.clear,"data-testid":e!==void 0?`${e}-btn-clear`:void 0,children:"Clear"})]})}render(){const{menuText:t,className:e,icon:n,id:s,"data-testid":i}=this.props,{menuIsOpen:o}=this.state;return v("button",{type:"button",className:W("btn hcm-btn",e),onClick:this.toggleMenu,id:s,"data-testid":i,children:[v("span",{children:[n&&h(j,{icon:n,className:"hcm-icon mr-1"}),t]}),h(j,{icon:md,className:"hcm-icon ml-1"}),h(kn,{options:{placement:"bottom"},isShown:o,onExited:()=>{this.setState({menuIsOpen:!1})},closeOnBlur:!0,interactive:!0,children:this.renderMenuElement()})]})}};let UC=Ar;UC.defaultProps={className:"",icon:null,id:"","data-testid":void 0};function wl({isLoaded:t=!1,isLoading:e=!0,errorMessage:n=null,"data-testid":s}){return h(ut,{in:Boolean(n)||!t||e,timeout:It.transitionMs,classNames:t?"fade":"",mountOnEnter:!0,unmountOnExit:!0,children:h("div",{className:"fill-parent-absolute","data-testid":s,children:h("div",{className:W("iris-panel-message-overlay","fill-parent-absolute",{"iris-panel-scrim-background":t}),children:v("div",{className:"message-content",children:[v("div",{className:"message-icon",children:[e&&h(On,{}),!e&&n!=null&&h(j,{icon:cs})]}),h("div",{className:"message-text",children:n})]})})})})}function Uu({on:t,id:e,className:n,isInvalid:s,disabled:i=!1,onClick:o,"data-testid":r}){return h("button",{type:"button",className:W("btn","btn-switch",n,{active:t},{"is-invalid":s}),id:e,onClick:o,disabled:i,"data-testid":r,children:h("div",{className:"handle"})})}function $c(t){return t.isOn!==void 0}function BC({item:t,onSelect:e=()=>{},"data-testid":n}){const{icon:s,subtitle:i,title:o}=t,r=S.exports.useMemo(()=>$c(t)?()=>{t.onChange(!t.isOn)}:e,[t,e]);return v("div",{className:"btn btn-navigation-menu-item","data-testid":`menu-item-${o}`,onClick:r,onKeyDown:l=>{(l.key==="Enter"||l.key===" ")&&r()},tabIndex:0,role:"menuitem",children:[s!==void 0&&h("div",{className:"icon",children:h(j,{icon:s})}),h("div",{className:"title",children:o}),i!==void 0&&h("div",{className:"shortcut",children:i}),h("div",{className:"accessory","data-testid":n,children:$c(t)?h(Uu,{on:t.isOn,onClick:l=>{l.stopPropagation(),r()}}):h(j,{icon:mu})})]})}function Bu({items:t,onSelect:e=()=>{},"data-testid":n}){return h("div",{className:"navigation-menu-view","data-testid":n,children:h("ul",{className:"navigation-menu-list",children:t.map((s,i)=>h("li",{children:h(BC,{item:s,onSelect:()=>{e(i)}})},s.title))})})}function Wc({children:t,onBack:e,onClose:n,title:s,"data-testid":i}){return v("div",{className:"navigation-page","data-testid":i,children:[v("div",{className:"navigation-title-bar",children:[h("div",{className:"navigation-left-buttons",children:e!==void 0&&h(z,{kind:"ghost",className:"btn-back","data-testid":"btn-page-back",onClick:e,icon:Cf,children:"Back"})}),h("div",{className:"navigation-title",children:s}),h("div",{className:"navigation-right-buttons",children:n!==void 0&&h(z,{kind:"ghost",className:"btn-close px-2 m-1","data-testid":"btn-page-close",onClick:n,icon:Xi,tooltip:"Close"})})]}),h("div",{className:"navigation-content",children:t})]})}function $C({children:t,"data-testid":e}){const n=S.exports.useMemo(()=>Y.Children.toArray(t),[t]),s=Cl(n),[i,o]=S.exports.useState(n[n.length-1]),[r,l]=S.exports.useState(null),[a,d]=S.exports.useState(null);S.exports.useEffect(function(){if(s===void 0||n===s)return;const p=n[n.length-1];n.length===s.length||s.length===0||r!==null||a!==null?r!==null&&p!==r?l(p):p!==a&&p!==i&&o(p):n.length>s.length?l(p):n.length<s.length&&(o(p),d(s[s.length-1]))},[n,s,r,a,i]);const c=S.exports.useCallback(()=>{o(r),l(null)},[r]),u=S.exports.useCallback(()=>{d(null)},[]);return v("div",{className:"navigation-stack",children:[h("div",{className:"main-view","data-testid":e,children:i}),h(ut,{in:a!=null,timeout:It.transitionMidMs,classNames:"slide-right",onEntered:u,children:h(ye,{children:a!=null&&h("div",{className:"popping-view",children:a})})}),h(ut,{in:r!=null,timeout:It.transitionMidMs,classNames:"slide-left",onEntered:c,children:h(ye,{children:r!=null&&h("div",{className:"pushing-view",children:r})})})]})}function WC({children:t,disabled:e,value:n,"data-testid":s}){return h("option",{value:n,disabled:e,"data-testid":s,children:t})}function vl(t){const{children:e,disabled:n=!1,name:s,onChange:i,value:o="","data-testid":r}=t,[l]=S.exports.useState(s!=null?s:ze());return h(ye,{children:Y.Children.map(e,a=>{var d,c;return a?Y.cloneElement(a,{name:l,onChange:(d=a.props.onChange)!=null?d:i,checked:o===a.props.value,disabled:(c=a.props.disabled)!=null?c:n,"data-testid":r}):null})})}const xn=Y.forwardRef((t,e)=>{const{checked:n,children:s,className:i="",disabled:o=!1,inputClassName:r="",isInvalid:l=!1,labelClassName:a="",name:d,onChange:c,value:u,"data-testid":m}=t,[p]=S.exports.useState(ze());return v("div",{className:W("custom-control custom-radio",i),children:[h("input",{type:"radio",id:p,"data-testid":m,name:d,ref:e,className:W("custom-control-input",r,{"is-invalid":l}),checked:n,disabled:o,value:u,onChange:c}),h("label",{className:W("custom-control-label",a),htmlFor:p,children:s})]})});xn.displayName="RadioItem";xn.defaultProps={checked:void 0,className:"",disabled:!1,inputClassName:"",isInvalid:!1,labelClassName:"",name:void 0,onChange:void 0,"data-testid":void 0};function zC({children:t,onBlur:e,onChange:n,className:s,defaultValue:i,name:o,value:r,disabled:l,"data-testid":a}){const d=S.exports.useCallback(c=>{n(c.target.value)},[n]);return h("select",{className:W("custom-select",s),onBlur:e,onChange:d,defaultValue:i,value:r,name:o,disabled:l,"data-testid":a,children:t})}class $u extends S.exports.PureComponent{constructor(e){super(e),this.getCachedItem=ve((n,s,i,o,r,l,a)=>{const d={height:r},c=o!=null?o:i;return h("li",{className:"value-list-item",style:d,tabIndex:-1,children:h(St,{checked:l,disabled:a,onChange:()=>this.handleSelect(n),children:c})},s)},{max:1e3}),this.getCachedItems=ve((n,s,i,o)=>{const r=[];for(let l=0;l<n.length;l+=1){const a=n[l],{value:d,displayValue:c,isSelected:u}=a,m=i+l,p=m,g=this.getCachedItem(m,p,d,c,s,u,o);r.push(g)}return r},{max:1}),this.handleBlur=this.handleBlur.bind(this),this.handleScroll=this.handleScroll.bind(this),this.handleSelect=this.handleSelect.bind(this),this.list=Y.createRef(),this.topRow=null,this.bottomRow=null}componentDidMount(){this.sendViewportUpdate()}componentDidUpdate(){this.sendViewportUpdate()}handleBlur(e){if(!e.relatedTarget||this.list.current&&e.relatedTarget instanceof HTMLElement&&!this.list.current.contains(e.relatedTarget)){const{onBlur:n}=this.props;n==null||n(e)}}handleScroll(){this.sendViewportUpdate()}handleSelect(e){const{items:n,offset:s,onSelect:i}=this.props,o=e-s;if(o>=0&&o<n.length){const r=n[o],{value:l}=r;i(e,l)}else i(e,null)}sendViewportUpdate(){if(!this.list.current||this.list.current.clientHeight===0)return;const{onViewportChange:e,rowHeight:n}=this.props,s=this.list.current.scrollTop,i=s+this.list.current.clientHeight,o=Math.floor(s/n),r=Math.ceil(i/n);(this.topRow!==o||this.bottomRow!==r)&&(this.topRow=o,this.bottomRow=r,e(o,r))}getElement(e){return this.list.current==null?null:this.list.current.querySelectorAll(".value-list-item")[e]}scrollIntoView(e){const n=this.getElement(e);n==null||n.scrollIntoView({block:"center"})}render(){const{className:e,disabled:n,isInvalid:s,items:i,itemCount:o,offset:r,rowHeight:l,"data-testid":a}=this.props,d=this.getCachedItems(i,l,r,n);return h("div",{className:W("select-value-list-scroll-pane h-100 w-100",{"is-invalid":s},e),onBlur:this.handleBlur,onScroll:this.handleScroll,ref:this.list,"data-testid":a,children:h("div",{className:"select-value-list",style:{height:o*l},children:h("ol",{className:"select-value-list-content",style:{position:"absolute",height:i.length*l,top:r*l,left:0},children:d})})})}}$u.defaultProps={disabled:!1,rowHeight:21,onBlur:()=>{},"data-testid":void 0};const zc=X.module("Shortcut");var de=(t=>(t.CTRL="MODIFIER_CTRL",t.CMD="MODIFIER_CMD",t.ALT="MODIFIER_ALT",t.OPTION="MODIFIER_OPTION",t.SHIFT="MODIFIER_SHIFT",t))(de||{}),me=(t=>(t.A="A",t.B="B",t.C="C",t.D="D",t.E="E",t.F="F",t.G="G",t.H="H",t.I="I",t.J="J",t.K="K",t.L="L",t.M="M",t.N="N",t.O="O",t.P="P",t.Q="Q",t.R="R",t.S="S",t.T="T",t.U="U",t.V="V",t.W="W",t.X="X",t.Y="Y",t.Z="Z",t.ZERO="0",t.ONE="1",t.TWO="2",t.THREE="3",t.FOUR="4",t.FIVE="5",t.SIX="6",t.SEVEN="7",t.EIGHT="8",t.NINE="9",t.BACKSPACE="Backspace",t.ESCAPE="Escape",t.ENTER="Enter",t.DELETE="Delete",t.SLASH="/",t.QUESTION_MARK="?",t.BACKSLASH="\\",t.PIPE="|",t.MINUS="-",t.UNDERSCORE="_",t.EQUALS="=",t.PLUS="+",t.BACKTICK="`",t.TILDE="~",t.COMMA=",",t.LEFT_CHEVRON="<",t.PERIOD=".",t.RIGHT_CHEVRON=">",t.SEMICOLON=";",t.COLON=":",t.SINGLE_QUOTE="'",t.DOUBLE_QUOTE='"',t.LEFT_BRACKET="[",t.RIGHT_BRACKET="]",t.LEFT_CURLY="{",t.RIGHT_CURLY="}",t.F1="F1",t.F2="F2",t.F3="F3",t.F4="F4",t.F5="F5",t.F6="F6",t.F7="F7",t.F8="F8",t.F9="F9",t.F10="F10",t.F11="F11",t.F12="F12",t))(me||{});const GC=new Set(["Enter","Delete","F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12"]),ft=class extends hl{constructor({id:t,shortcut:e,macShortcut:n,isEditable:s=!0,name:i,tooltip:o}){super(),this.id=t,this.name=i,this.tooltip=o,this.isEditable=s;const l=ft.isMacPlatform?n:e;this.defaultKeyState=ft.createKeyState(l),this.keyState=this.defaultKeyState}static isAllowedKey(t){return Object.values(me).includes(t)}static isValidKeyState(t){const{keyValue:e}=t;return e===null?!0:!ft.isMacPlatform&&t.metaKey||!ft.isAllowedKey(e)?!1:!(!t.altKey&&!t.ctrlKey&&!t.metaKey&&!t.shiftKey)||GC.has(e)}static createKeyState(t){const e={altKey:!1,ctrlKey:!1,metaKey:!1,shiftKey:!1,keyValue:t[t.length-1]};return t.forEach(n=>{switch(n){case"MODIFIER_CTRL":e.ctrlKey=!0;break;case"MODIFIER_ALT":case"MODIFIER_OPTION":e.altKey=!0;break;case"MODIFIER_CMD":e.metaKey=!0;break;case"MODIFIER_SHIFT":e.shiftKey=!0;break}}),e}static getKeyStateFromEvent(t){const{key:e,keyCode:n}=t;let s="";return e==="Shift"||e==="Meta"||e==="Control"||e==="Alt"?s="":!ft.isAllowedKey(e)&&ft.isAllowedKey(String.fromCharCode(n))?s=String.fromCharCode(n):s=e,{keyValue:s,altKey:t.altKey,ctrlKey:t.ctrlKey,metaKey:t.metaKey,shiftKey:t.shiftKey}}static getWindowsDisplayText(t){let e="";return t.ctrlKey&&(e+="Ctrl+"),t.altKey&&(e+="Alt+"),t.shiftKey&&(e+="Shift+"),t.keyValue==="Escape"?e+="Esc":t.keyValue!==null&&(e+=t.keyValue),e}static getMacDisplayText(t){let e="";switch(t.ctrlKey&&(e+="\u2303"),t.altKey&&(e+="\u2325"),t.shiftKey&&(e+="\u21E7"),t.metaKey&&(e+="\u2318"),t.keyValue){case"Enter":e+="\u23CE";break;case"Escape":e+="\u238B";break;case"Backspace":e+="\u232B";break;case"Delete":e+="\u2326";break;case null:break;default:e+=t.keyValue}return e}static doKeyStatesMatch(t,e){var n,s;return((n=t.keyValue)==null?void 0:n.toUpperCase())===((s=e.keyValue)==null?void 0:s.toUpperCase())&&t.altKey===e.altKey&&t.ctrlKey===e.ctrlKey&&t.metaKey===e.metaKey&&t.shiftKey===e.shiftKey}static getDisplayText(t){return t.keyValue===null?"":ft.isMacPlatform?ft.getMacDisplayText(t):ft.getWindowsDisplayText(t)}getDisplayText(){return ft.getDisplayText(this.keyState)}getKeyState(){return this.keyState}setKeyState(t){ft.isValidKeyState(t)?(zc.debug2(`Shortcut ${this.id} updated to ${JSON.stringify(t)}`),this.keyState=t,this.dispatchEvent(new Ge("onUpdate",{detail:this}))):zc.debug2(`Shortcut ${this.id} tried to update to invalid keyState ${JSON.stringify(t)}`)}getDefaultKeyState(){return this.defaultKeyState}isDefault(){return ft.doKeyStatesMatch(this.getDefaultKeyState(),this.getKeyState())}setToNull(){this.setKeyState(ft.NULL_KEY_STATE)}isNull(){return ft.doKeyStatesMatch(this.keyState,ft.NULL_KEY_STATE)}setToDefault(){this.setKeyState(this.defaultKeyState)}matchesKeyState(t){return ft.doKeyStatesMatch(t,this.keyState)}matchesEvent(t){return this.matchesKeyState(ft.getKeyStateFromEvent(t))}};let Kt=ft;Kt.NULL_KEY_STATE={metaKey:!1,shiftKey:!1,altKey:!1,ctrlKey:!1,keyValue:null};Kt.isMacPlatform=We.isMacPlatform();const Gc=X.module("ShortcutRegistry");class KC extends hl{constructor(){super(...arguments),this.shortcutMap=new Map,this.shortcutsByCategory=new Map}createAndAdd(e){const n=new Kt(e);return this.add(n)}add(e){var i;const n=this.shortcutMap.get(e.id);if(n)return Gc.warn(`Skipping attempt to add duplicate shortcut ID to registry: ${e.id}`),n;Gc.debug2(`Adding shortcut to registry: ${e.id}`),e.addEventListener("onUpdate",({detail:o})=>this.dispatchEvent(new Ge("onUpdate",{detail:o})));const s=e.id.split(".")[0];return this.shortcutMap.set(e.id,e),this.shortcutsByCategory.has(s)?(i=this.shortcutsByCategory.get(s))==null||i.push(e):this.shortcutsByCategory.set(s,[e]),e}get(e){return this.shortcutMap.get(e)}getConflictingShortcuts(e){return Array.from(this.shortcutMap.values()).filter(n=>!n.isNull()&&n.matchesKeyState(e))}}const Ae=Object.freeze(new KC),ms={COPY:Ae.createAndAdd({id:"GLOBAL.COPY",name:"Copy",shortcut:[de.CTRL,me.C],macShortcut:[de.CMD,me.C],isEditable:!1}),PASTE:Ae.createAndAdd({id:"GLOBAL.PASTE",name:"Paste",shortcut:[de.CTRL,me.V],macShortcut:[de.CMD,me.V],isEditable:!1}),SAVE:Ae.createAndAdd({id:"GLOBAL.SAVE",name:"Save",shortcut:[de.CTRL,me.S],macShortcut:[de.CMD,me.S],isEditable:!1}),SELECT_ALL:Ae.createAndAdd({id:"GLOBAL.SELECT_ALL",name:"Select All",shortcut:[de.CTRL,me.A],macShortcut:[de.CMD,me.A],isEditable:!1}),LINKER:Ae.createAndAdd({id:"GLOBAL.LINKER",name:"Linker",shortcut:[de.CTRL,me.L],macShortcut:[de.CMD,me.L]}),LINKER_CLOSE:Ae.createAndAdd({id:"GLOBAL.LINKER_CLOSE",name:"Close Linker Overlay",shortcut:[me.ESCAPE],macShortcut:[me.ESCAPE],isEditable:!1})};const Tl=Y.forwardRef((t,e)=>{const{children:n,className:s,disabled:i,isLinked:o,isLinkedSource:r,isInvalid:l,onClick:a,onMouseEnter:d,onMouseLeave:c,style:u,"data-testid":m}=t;return v("button",{ref:e,type:"button",className:W("btn-socketed",{"btn-socketed-linked":o!==void 0&&o||r},{"btn-socketed-linked-source":r},{"is-invalid":l},s),onClick:a,onMouseEnter:d,onMouseLeave:c,style:u,disabled:i,"data-testid":m,children:[n,h(j,{icon:ld,className:"linked btn-socketed-icon",transform:"down-1"}),h(j,{icon:Xf,className:"is-invalid btn-socketed-icon"})]})});Tl.displayName="SocketedButton";Tl.defaultProps={children:void 0,className:"",disabled:!1,isLinked:!1,isLinkedSource:!1,isInvalid:!1,onClick:void 0,onMouseEnter:void 0,onMouseLeave:void 0,style:void 0,"data-testid":void 0};const qC="_track_535ju_30",YC="_handle_535ju_13",XC="_ticks_535ju_98",Wu={"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:qC,"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:YC,ticks:XC,"tick-labels":"_tick-labels_535ju_116","tick-label":"_tick-label_535ju_116","tick-label-wrapper":"_tick-label-wrapper_535ju_132"};parseInt(Wu["handle-size"],10);parseInt(Wu["popover-width"],10);Object.freeze({ERROR:"error"});const{dh:M}=globalThis,El=R.exports.shape({name:R.exports.string.isRequired,type:R.exports.string.isRequired,description:R.exports.string,constituentType:R.exports.string}),zu=R.exports.shape({not:R.exports.func.isRequired,and:R.exports.func.isRequired,or:R.exports.func.isRequired}),jC=R.exports.shape({asc:R.exports.func.isRequired,desc:R.exports.func.isRequired,abs:R.exports.func.isRequired,column:El.isRequired,direction:R.exports.string.isRequired,isAbs:R.exports.bool.isRequired}),QC=R.exports.shape({columns:R.exports.arrayOf(El).isRequired,customColumns:R.exports.arrayOf(R.exports.string).isRequired,filter:R.exports.arrayOf(zu),addEventListener:R.exports.func.isRequired,removeEventListener:R.exports.func.isRequired,size:R.exports.number.isRequired,sort:R.exports.arrayOf(R.exports.any),copy:R.exports.func.isRequired,applyFilter:R.exports.func.isRequired,applySort:R.exports.func.isRequired,applyCustomColumns:R.exports.func.isRequired,description:R.exports.string}),ZC=R.exports.shape({columns:R.exports.arrayOf(El),filter:R.exports.arrayOf(R.exports.any),isExpanded:R.exports.func.isRequired,saveExpandedState:R.exports.func.isRequired,addEventListener:R.exports.func.isRequired,removeEventListener:R.exports.func.isRequired,size:R.exports.number.isRequired,sort:R.exports.arrayOf(R.exports.any),applyFilter:R.exports.func.isRequired,applySort:R.exports.func.isRequired}),Pr=R.exports.shape({name:R.exports.string.isRequired,type:R.exports.string.isRequired}),JC=R.exports.shape({created:R.exports.arrayOf(Pr).isRequired,updated:R.exports.arrayOf(Pr).isRequired,removed:R.exports.arrayOf(Pr).isRequired}),eb=R.exports.shape({groupingColumns:R.exports.arrayOf(R.exports.string),aggregations:R.exports.shape({}),includeConstituents:R.exports.bool,includeOriginalColumns:R.exports.bool,includeDescriptions:R.exports.bool}),tb=R.exports.shape({addEventListener:R.exports.func.isRequired,removeEventListener:R.exports.func.isRequired,onLogMessage:R.exports.func,getTable:R.exports.func.isRequired,runCode:R.exports.func.isRequired});Object.freeze({Column:El,FilterCondition:zu,IdeSession:tb,RollupConfig:eb,Sort:jC,Table:QC,TreeTable:ZC,VariableChanges:JC,VariableDefinition:Pr});function Gu({type:t}){switch(t){case M.VariableType.TABLE:case M.VariableType.TABLEMAP:case M.VariableType.TREETABLE:return h(j,{icon:pd});case M.VariableType.FIGURE:return h(j,{icon:pu});case M.VariableType.PANDAS:return h(j,{icon:oC});default:return h(j,{icon:Ma})}}class yl extends S.exports.Component{constructor(e){super(e),this.container=null}componentDidMount(){this.colorize()}colorize(){const{children:e}=this.props;this.container&&e!=null&&as.colorizeElement(this.container,{theme:"dh-dark"})}render(){const{children:e,language:n}=this.props;return h("div",{children:h("div",{"data-lang":n,ref:s=>{this.container=s},style:{pointerEvents:"none"},children:e})})}}class Ku{static get LANGUAGE_MAP(){return new Map([["python","Python"],["groovy","Groovy"],["scala","Scala"]])}}class Wi{static hasComment(e){return e.comment!==void 0}static hasPattern(e){return e.pattern!==void 0}static hasOp(e){return e.op!==void 0}static parseArguments(e){return e==null||!(typeof e=="string"||e instanceof String)?[]:dg.parse(e).filter(n=>!this.hasComment(n)).map(n=>this.hasPattern(n)?n.pattern:this.hasOp(n)?n.op:`${n}`)}static formatTimestamp(e){if(e==null||!(e instanceof Date))return null;const n=`${e.getHours()}`.padStart(2,"0"),s=`${e.getMinutes()}`.padStart(2,"0"),i=`${e.getSeconds()}`.padStart(2,"0"),o=`${e.getMilliseconds()}`.padStart(3,"0");return`${n}:${s}:${i}.${o}`}static isTableType(e){return e===M.VariableType.TABLE||e===M.VariableType.TREETABLE}static isWidgetType(e){return e===M.VariableType.FIGURE||e===M.VariableType.OTHERWIDGET||e===M.VariableType.PANDAS}static isOpenableType(e){return Wi.isTableType(e)||Wi.isWidgetType(e)}static isFigureType(e){return e===M.VariableType.FIGURE}static isPandas(e){return e===M.VariableType.PANDAS}}function qu({children:t}){return v("div",{className:"console-history-item-result",children:[h("div",{className:"console-history-gutter",children:"-"}),h("div",{className:"console-history-content",children:t})]})}qu.propTypes={children:R.exports.node.isRequired};class Yu extends S.exports.Component{constructor(e){super(e),this.updateElapsed=this.updateElapsed.bind(this),this.startTime=Date.now(),this.state={elapsed:0}}componentDidMount(){this.timer=setInterval(this.updateElapsed,1e3)}componentWillUnmount(){this.timer&&clearInterval(this.timer),this.timer=void 0}updateElapsed(){this.setState({elapsed:Math.round((Date.now()-this.startTime)/1e3)})}render(){const{disabled:e,onCancelClick:n}=this.props,{elapsed:s}=this.state;return h("div",{className:W("console-history-result-in-progress",{disabled:e}),children:v("span",{className:"badge",children:[h(On,{}),"\xA0Running... ",Dn.formatElapsedTime(s),"\xA0",h(z,{className:"console-history-result-in-progress-cancel",kind:"ghost",icon:Xi,tooltip:"Cancel",onClick:n,disabled:e})]})})}}Yu.defaultProps={disabled:!1};const _a=class extends S.exports.PureComponent{constructor(t){super(t),this.handleKeyPress=this.handleKeyPress.bind(this),this.handleMouseDown=this.handleMouseDown.bind(this),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleMouseUp=this.handleMouseUp.bind(this),this.handleToggleError=this.handleToggleError.bind(this),this.handleMouseEnter=this.handleMouseEnter.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.mouseX=null,this.mouseY=null,this.isClicking=!1,this.state={isExpanded:!1,isTriggerHovered:!1}}handleKeyPress(t){switch(t.key){case"Enter":case" ":this.handleToggleError(),t.stopPropagation(),t.preventDefault();break}}handleMouseDown(t){this.mouseX=t.clientX,this.mouseY=t.clientY,this.isClicking=!0}handleMouseMove(t){this.mouseX!=null&&this.mouseY!=null?(Math.abs(t.clientX-this.mouseX)>=_a.mouseDragThreshold||Math.abs(t.clientY-this.mouseY)>=_a.mouseDragThreshold)&&(this.isClicking=!1):this.isClicking&&(this.isClicking=!1)}handleMouseUp(t){this.isClicking&&!t.shiftKey&&!t.metaKey&&!t.altKey&&this.handleToggleError(),this.mouseX=null,this.mouseY=null,this.isClicking=!1}handleToggleError(){this.setState(t=>({isExpanded:!t.isExpanded}))}handleMouseEnter(){this.setState({isTriggerHovered:!0})}handleMouseLeave(){this.setState({isTriggerHovered:!1})}render(){const{isExpanded:t,isTriggerHovered:e}=this.state,{message:n}=this.props;P(n);const s=n.indexOf(`
|
|
6
|
+
`,o))},[]);return S.exports.useEffect(()=>(n.current&&clearTimeout(n.current),t&&(n.current=setTimeout(()=>{e(!1)},TC)),()=>{n.current&&clearTimeout(n.current)}),[t]),[t,s]}const St=Y.forwardRef((t,e)=>{const{checked:n=!1,children:s,className:i,disabled:o,inputClassName:r,isInvalid:l,labelClassName:a,name:d,onChange:c,"data-testid":u}=t,[m]=S.exports.useState(ze()),p=Mu(e);S.exports.useEffect(function(){p.current&&(p.current.indeterminate=n===null)},[p,n]);const g=S.exports.useCallback(f=>{p.current&&(p.current.indeterminate=n===null),c&&c(f)},[p,n,c]);return v("div",{className:W("custom-control custom-checkbox",i),children:[h("input",{type:"checkbox",ref:p,checked:n!=null?n:!1,className:W("custom-control-input",r,{"is-invalid":l}),disabled:o,id:m,name:d,onChange:g,"data-testid":u}),h("label",{className:W("custom-control-label",a),htmlFor:m,children:s})]})});St.displayName="Checkbox";St.propTypes={checked:(t,e)=>{const{[e]:n}=t;return n!==null&&typeof n!="boolean"?new Error("Checked must be a boolean or null for indeterminate"):null},children:R.exports.node.isRequired,className:R.exports.string,disabled:R.exports.bool,inputClassName:R.exports.string,isInvalid:R.exports.bool,labelClassName:R.exports.string,name:R.exports.string,onChange:R.exports.func,"data-testid":R.exports.string};St.defaultProps={checked:!1,className:"",disabled:!1,inputClassName:"",isInvalid:!1,labelClassName:"",name:void 0,onChange:void 0,"data-testid":void 0};class Cs extends S.exports.PureComponent{constructor(e){super(e),this.inputField=Y.createRef()}focus(){var e;(e=this.inputField.current)==null||e.focus()}render(){const{value:e,placeholder:n,onBlur:s,onChange:i,className:o,disabled:r,matchCount:l,id:a,onKeyDown:d,"data-testid":c}=this.props;return v("div",{className:W("search-group",o),children:[h("input",{type:"search",value:e,onBlur:s,onChange:i,onKeyDown:d,className:"form-control",disabled:r,placeholder:n,ref:this.inputField,id:a,"data-testid":c}),l!=null&&h("span",{className:"search-match",children:l}),h("span",{className:"search-icon",children:h(j,{icon:Su})})]})}}Cs.defaultProps={placeholder:"Search",className:"",matchCount:null,onKeyDown(){},id:"","data-testid":void 0};var Nu=(t=>(t.UP="UP",t.DOWN="DOWN",t))(Nu||{});const Eo=class extends S.exports.Component{constructor(t){super(t),this.getCachedFilteredOptions=ve((e,n)=>e.filter(s=>s.title.toLowerCase().indexOf(n.toLowerCase())>=0||s.value.toLowerCase().indexOf(n.toLowerCase())>=0)),this.state={value:"",filter:"",filteredOptions:t.options,keyboardOptionIndex:-1,menuIsOpen:!1,inputWidth:100},this.toggleMenu=this.toggleMenu.bind(this),this.handleMenuKeyDown=this.handleMenuKeyDown.bind(this),this.handleMenuBlur=this.handleMenuBlur.bind(this),this.closeMenu=this.closeMenu.bind(this),this.handleInputChange=this.handleInputChange.bind(this),this.handleInputKeyDown=this.handleInputKeyDown.bind(this),this.handleInputBlur=this.handleInputBlur.bind(this),this.handleFilterChange=this.handleFilterChange.bind(this),this.handleOptionClick=this.handleOptionClick.bind(this),this.handleOptionFocus=this.handleOptionFocus.bind(this),this.handleMenuOpened=this.handleMenuOpened.bind(this),this.handleMenuExited=this.handleMenuExited.bind(this),this.popper=Y.createRef(),this.cbContainer=Y.createRef(),this.toggleButton=Y.createRef(),this.menuContainer=Y.createRef(),this.input=Y.createRef(),this.searchInput=Y.createRef()}componentDidUpdate(){const{menuIsOpen:t,keyboardOptionIndex:e}=this.state;t&&e>=0&&this.scrollOptionIntoView()}setInputWidth(){this.cbContainer.current&&this.setState({inputWidth:this.cbContainer.current.getBoundingClientRect().width})}focus(){var t;(t=this.input.current)==null||t.focus()}resetValue(){this.setState({value:""})}updateInputValue(t){const{onChange:e}=this.props;this.setState({value:t}),e(t)}handleResize(){this.setInputWidth()}handleMenuKeyDown(t){var r,l;const{filter:e,filteredOptions:n,keyboardOptionIndex:s}=this.state,{options:i}=this.props,o=e?n:i;switch(t.key){case"Enter":((r=o[s])==null?void 0:r.value)!=null&&this.updateInputValue(o[s].value),this.closeMenu(),(l=this.input.current)==null||l.focus(),t.stopPropagation(),t.preventDefault();break;case"ArrowUp":this.handleMenuNavigation(Eo.MENU_NAVIGATION_DIRECTION.UP),t.stopPropagation(),t.preventDefault();break;case"ArrowDown":this.handleMenuNavigation(Eo.MENU_NAVIGATION_DIRECTION.DOWN),t.stopPropagation(),t.preventDefault();break;case"Escape":e!==""?(this.setState({filter:""}),t.stopPropagation()):this.closeMenu();break;case"Tab":!t.shiftKey&&s===o.length-1&&this.closeMenu();break}}handleMenuNavigation(t){const{filter:e,filteredOptions:n,keyboardOptionIndex:s}=this.state,{options:i}=this.props,r=(e?n:i).length;let l=0;switch(t){case Eo.MENU_NAVIGATION_DIRECTION.UP:l=-1;break;case Eo.MENU_NAVIGATION_DIRECTION.DOWN:l=1;break}l!==0&&this.setState({keyboardOptionIndex:(s+l+r)%r})}handleInputKeyDown(t){const{onEnter:e}=this.props,{menuIsOpen:n}=this.state;t.key==="ArrowDown"||t.key==="ArrowUp"?n||this.openMenu():t.key==="Enter"&&e()}handleInputChange(t){this.updateInputValue(t.target.value)}handleOptionClick(t){var r;const e=Number(t.currentTarget.value),{filter:n,filteredOptions:s}=this.state,{options:i}=this.props,o=n?s:i;this.updateInputValue(o[e].value),this.closeMenu(),(r=this.input.current)==null||r.focus()}handleOptionFocus(t){this.setState({keyboardOptionIndex:Number(t.target.value)})}handleFilterChange(t){var i;const{options:e}=this.props,n=t.target.value,s=this.getCachedFilteredOptions(e,n);this.setState({filter:n,filteredOptions:s,keyboardOptionIndex:0}),(i=this.popper.current)==null||i.scheduleUpdate()}handleMenuBlur(t){t.relatedTarget instanceof Element&&this.popper.current!=null&&this.popper.current.element.contains(t.relatedTarget)||t.relatedTarget===this.toggleButton.current||this.closeMenu(!1)}handleInputBlur(t){const{menuIsOpen:e}=this.state;e&&t.relatedTarget instanceof Element&&this.popper.current!=null&&this.popper.current.element.contains(t.relatedTarget)||this.closeMenu(!1)}handleMenuOpened(){var t;this.scrollOptionIntoView(),(t=this.searchInput.current)==null||t.focus()}handleMenuExited(){var e;const{menuIsOpen:t}=this.state;t&&(this.setState({menuIsOpen:!1}),(e=this.popper.current)==null||e.hide()),this.setState({filter:""})}toggleMenu(t){const{menuIsOpen:e}=this.state;e?this.closeMenu():this.openMenu(),t.stopPropagation()}openMenu(){this.updateKeyboardIndex(),this.setInputWidth(),this.setState({menuIsOpen:!0}),window.requestAnimationFrame(()=>{var t;(t=this.popper.current)==null||t.show()})}closeMenu(t=!0){var e,n;this.setState({menuIsOpen:!1}),t&&((e=this.input.current)==null||e.focus()),(n=this.popper.current)==null||n.hide()}updateKeyboardIndex(){const{value:t,filter:e,filteredOptions:n}=this.state,{options:s}=this.props,o=(e?n:s).findIndex(r=>r.value===t);this.setState({keyboardOptionIndex:o})}scrollOptionIntoView(){var e;const t=(e=this.menuContainer.current)==null?void 0:e.querySelector(".cb-option-btn.keyboard-active");t instanceof HTMLElement&&t.scrollIntoView({block:"nearest",inline:"nearest"})}renderMenuElement(){const{searchPlaceholder:t}=this.props,{filter:e,inputWidth:n}=this.state;return v("div",{className:"cb-menu-container",ref:this.menuContainer,role:"presentation",onKeyDown:this.handleMenuKeyDown,onClick:s=>{s.stopPropagation()},style:{width:n},onBlur:this.handleMenuBlur,children:[h("div",{className:"cb-search-input-container",children:h(Cs,{value:e,ref:this.searchInput,onChange:this.handleFilterChange,className:"cb-search-input",placeholder:t})}),h("div",{className:"cb-options-container",children:h("div",{className:"cb-options",children:this.renderOptions()})})]})}renderOptions(){const{options:t}=this.props,{keyboardOptionIndex:e,filter:n,filteredOptions:s}=this.state;return(n?s:t).map((o,r)=>{const l=`option-${r}-${o.value}`;return h("button",{type:"button",value:r,className:W("cb-option-btn",{"keyboard-active":e===r}),onClick:this.handleOptionClick,onFocus:this.handleOptionFocus,children:o.title},l)})}render(){const{options:t,inputPlaceholder:e,disabled:n,className:s,defaultValue:i,spellCheck:o,"data-testid":r}=this.props,{value:l}=this.state;let{popperOptions:a}=this.props;return a={placement:"bottom-end",modifiers:{preventOverflow:{enabled:!1}},...a},v("div",{className:"input-group cb-container",ref:this.cbContainer,children:[h("input",{value:l||i,className:W("form-control",s,"cb-input"),ref:this.input,onChange:this.handleInputChange,placeholder:e||(t[0]!=null?t[0].title:void 0),disabled:n,onBlur:this.handleInputBlur,onKeyDown:this.handleInputKeyDown,spellCheck:o,"data-testid":r!==void 0?`${r}-input`:void 0}),h("div",{className:"input-group-append cb-dropdown",children:v("button",{type:"button",className:"btn cb-btn form-control",ref:this.toggleButton,onClick:this.toggleMenu,onKeyDown:this.handleInputKeyDown,disabled:n,"data-testid":r!==void 0?`${r}-btn`:void 0,children:[h(j,{icon:Gn}),h(kn,{ref:this.popper,options:a,className:W("combobox interactive"),onEntered:this.handleMenuOpened,onExited:this.handleMenuExited,children:this.renderMenuElement()})]})})]})}};let Zi=Eo;Zi.MENU_NAVIGATION_DIRECTION=Nu;Zi.DROP_DOWN_MENU_HEIGHT=200;Zi.propTypes={options:R.exports.arrayOf(R.exports.shape({title:R.exports.string.isRequired,value:R.exports.string.isRequired})).isRequired,popperOptions:R.exports.shape({title:R.exports.string.isRequired,value:R.exports.string.isRequired}),onChange:R.exports.func,inputPlaceholder:R.exports.string,searchPlaceholder:R.exports.string,disabled:R.exports.bool,className:R.exports.string,defaultValue:R.exports.string,spellCheck:R.exports.bool,onEnter:R.exports.func,"data-testid":R.exports.string};Zi.defaultProps={onChange(){},inputPlaceholder:"",searchPlaceholder:"Search",disabled:!1,className:"",defaultValue:"",popperOptions:null,spellCheck:!0,onEnter(){},"data-testid":void 0};function bl({copy:t,kind:e="ghost",tooltip:n="Copy",className:s,"data-testid":i,children:o}){const[r,l]=yC();return h(z,{kind:e,className:s,"data-testid":i,icon:r?Hf:Ef,tooltip:r?"Copied":n,onClick:()=>{l(typeof t=="function"?t():t)},children:o})}const yn=X.module("MaskedInput"),Ti={FORWARD:"forward",BACKWARD:"backward",NONE:"none"},br="\u2007";function fd(t,e,n){return t.substring(0,e)+n+t.substring(e+1)}function IC(t,e,n){return t.length<n?`${t}${e.substring(t.length,n)}`:t}function Pc(t,e){let{length:n}=t;for(let s=t.length-1;s>=0&&e[s]===t[s];s-=1)n=s;return t.substring(0,n)}const Sl=Y.forwardRef((t,e)=>{const{className:n,example:s,getNextSegmentValue:i=(_,H,A)=>A,getPreferredReplacementString:o=fd,onChange:r=()=>!1,onSelect:l=()=>!1,pattern:a,placeholder:d,selection:c,value:u,onFocus:m=()=>!1,onBlur:p=()=>!1,"data-testid":g}=t,f=Mu(e),b=S.exports.useMemo(()=>Array.isArray(s)?s:[s],[s]),C=S.exports.useMemo(()=>b[0].replace(/[a-zA-Z0-9]/g,br),[b]);S.exports.useEffect(function(){var H;if(c!=null){yn.debug("setting selection...",c);const{selectionStart:A,selectionEnd:N,selectionDirection:k}=c;(H=f.current)==null||H.setSelectionRange(A,N,k),yn.debug("selection set!")}},[c,f]);const w=S.exports.useCallback(_=>{let H=_,A=_;const N=b.length>0?b[0]:u;for(let O=H-1;O>=0&&/[a-zA-Z0-9]/g.test(N.charAt(O));O-=1)H=O;for(let O=A;O<N.length&&/[a-zA-Z0-9]/g.test(N.charAt(O));O+=1)A=O+1;const k=H===A?Ti.NONE:Ti.BACKWARD;return{selectionStart:H,selectionEnd:A,selectionDirection:k}},[b,u]);function T(_,H,A=_.length){let N="";for(let k=0;k<A;k+=1)_.charAt(k)!==br?N=N.concat(_[k]):N=N.concat(H[k]);return N=N.concat(H.substring(A)),N}function y(_,H=_.length){const A=new RegExp(`^${a}$`);if(A.test(_))return!0;for(let N=0;N<b.length;N+=1){const k=T(_,b[N],H);if(A.test(k))return!0}return!1}function E(_){const H=w(_),A=H.selectionEnd+1;return A>=u.length?H:w(A)}function I(_){const H=w(_),A=H.selectionStart-1;return A<=0?H:w(A)}function D(_,H){const A=w(_),N=u.substring(A.selectionStart,A.selectionEnd),k=i(A,H,N,u),O=u.substring(0,A.selectionStart)+k+u.substring(A.selectionEnd);y(O,A.selectionEnd)&&(r(O),l(A))}const F=S.exports.useCallback(_=>{const{selectionStart:H=0,selectionEnd:A=0,selectionDirection:N="none"}=_.target;if(H===null||A===null||N===null){yn.error("Selection attempted on non-text input element",_.target);return}if(yn.debug2("handleSelect",H,A,N),!(c!=null&&H===c.selectionStart&&A===c.selectionEnd)){if(c!=null&&H===u.length&&A===u.length&&_.nativeEvent.type!=="mouseup"){l({...c});return}if(H===A){const k=w(H);yn.debug("Selection segment from ",H,A,"=>",k),l(k)}else l({selectionStart:H,selectionEnd:A,selectionDirection:N})}},[w,l,c,u]),x=S.exports.useCallback(_=>{var A;if(!f.current)return;yn.debug("handleSelectCapture",_);const H=(A=f.current.selectionStart)!=null?A:0;H===u.length&&c!=null&&H!==c.selectionStart&&(_.preventDefault(),_.stopPropagation())},[f,c,u]);function U(_){if(_.preventDefault(),_.stopPropagation(),!f.current)return;const{key:H}=_,{selectionStart:A=0,selectionEnd:N=0}=f.current;if(A===null||N===null){yn.error("Selection arrow nvaigation attempted on non-text input element",_.target);return}H==="ArrowLeft"?l(I(A)):H==="ArrowRight"?l(E(N)):H==="ArrowUp"?D(A,-1):H==="ArrowDown"&&D(A,1)}function B(_){if(!f.current)return;yn.debug("handleKeyDown",_);const{key:H}=_,{selectionStart:A=0,selectionEnd:N=0}=f.current;if(A===null||N===null){yn.error("Selection key event on non-text input element",_.target);return}if(H.startsWith("Arrow")){U(_);return}if(H==="Delete"||H==="Backspace"){if(_.preventDefault(),_.stopPropagation(),N>=Pc(u,C).length){const O=u.substring(0,A===N?A-1:A),V=Pc(O,C);V!==u&&(r(V),l({selectionStart:V.length,selectionEnd:V.length,selectionDirection:Ti.NONE}));return}if(A!==N){const O=u.substring(0,A)+u.substring(A,N).replace(/[a-zA-Z0-9]/g,br)+u.substring(N);yn.debug("Range ",A,N,"deleted, setting value",O),r(O),l({selectionStart:A,selectionEnd:A,selectionDirection:Ti.NONE})}else if(A>0)for(let O=A-1;O>=0;O-=1){const V=u.substring(0,O)+u.substring(O,A).replace(/[a-zA-Z0-9]/g,br)+u.substring(A);if(V!==u){r(V),l({selectionStart:O,selectionEnd:O,selectionDirection:Ti.NONE});return}}return}if(_.altKey||_.metaKey||_.ctrlKey||H.length>1)return;_.preventDefault(),_.stopPropagation();const k=Array.from(new Set([H,H.toUpperCase(),H.toLowerCase()]));for(let O=0;O<k.length;O+=1){const V=k[O],G=/[a-zA-Z0-9]/g.test(V)?b[0].length-1:A;for(let Q=A;Q<=G;Q+=1){const Z=IC(u,b[0],Q+1),be=o(Z,Q,V,A,N);if(y(be,Q+1)){const le=w(Q),he=Q+1;let De={selectionStart:he,selectionEnd:he,selectionDirection:Ti.NONE};if(he>=le.selectionEnd){const ee=E(Q);ee.selectionStart!==le.selectionStart&&(De=ee)}yn.debug("handleKeyDown",H,"=>",be,De),r(be),l(De);return}}}}return h("input",{ref:f,className:W("form-control masked-input",n),type:"text",pattern:a,placeholder:d,value:u,onChange:()=>{},onKeyDown:B,onSelect:F,onSelectCapture:x,onFocus:m,onBlur:p,"data-testid":g})});Sl.defaultProps={className:"",placeholder:void 0,onChange(){},onSelect(){},getNextSegmentValue:(t,e,n)=>n,getPreferredReplacementString:fd,selection:void 0,onFocus(){},onBlur(){},"data-testid":void 0};const RC=X.module("TimeInput"),DC="([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]",MC=["00:00:00","12:34:56","23:59:59"],Fu=Y.forwardRef((t,e)=>{const{allowValueWrapping:n=!0,className:s="",onChange:i=()=>!1,value:o=0,onFocus:r=()=>!1,onBlur:l=()=>!1,onSelect:a=()=>!1,"data-testid":d}=t,[c,u]=S.exports.useState(Dn.formatTime(o)),[m,p]=S.exports.useState(),g=S.exports.useRef(null);S.exports.useImperativeHandle(e,()=>({focus:()=>{var T;(T=g.current)==null||T.focus()},setSelection:T=>{var y;(y=g.current)==null||y.focus(),p(T)}}),[]),S.exports.useEffect(function(){u(Dn.formatTime(o))},[o]);function f(T,y,E){const I=T.selectionStart===0?24:60;let D=parseInt(E,10)-y;return Number.isNaN(D)?D=0:n?D=(D%I+I)%I:D=Math.min(Math.max(0,D),I-1),`${D}`.padStart(2,"0")}function b(T,y,E,I,D){return I===0&&D===2&&y===1&&parseInt(E,10)>1?`0${E}${T.substring(2)}`:fd(T,y,E)}function C(T){RC.debug("handleChange",T),u(T),Dn.isTimeString(T)&&i(Dn.parseTime(T))}const w=S.exports.useCallback(T=>{p(T),a(T)},[a]);return h(Sl,{ref:g,className:s,example:MC,getNextSegmentValue:f,getPreferredReplacementString:b,onChange:C,onSelect:w,pattern:DC,selection:m,value:c,onFocus:r,onBlur:l,"data-testid":d})});Fu.defaultProps={allowValueWrapping:!0,className:"",onChange:()=>!1,onSelect:()=>!1,value:0,onFocus:()=>!1,onBlur:()=>!1,"data-testid":void 0};class xu extends S.exports.PureComponent{constructor(e){var i;super(e),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleMenuItemClick=this.handleMenuItemClick.bind(this),this.handleMenuItemMouseMove=this.handleMenuItemMouseMove.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.handleCloseMenu=this.handleCloseMenu.bind(this),this.container=Y.createRef(),this.oldFocus=document.activeElement,this.rAF=0;const{options:n}=e,s=(i=n.initialKeyboardIndex)!=null?i:-1;this.state={menuItems:[],keyboardIndex:s,mouseIndex:-1}}componentDidMount(){this.initMenu(),this.rAF=window.requestAnimationFrame(()=>{var n;(n=this.container.current)==null||n.focus();const{onMenuOpened:e}=this.props;e(this)})}componentDidUpdate(e){const{actions:n}=this.props;e.actions!==n&&this.initMenu()}componentWillUnmount(){cancelAnimationFrame(this.rAF)}getKeyboardIndex(){const{options:e}=this.props;if(e.separateKeyboardMouse!==void 0&&e.separateKeyboardMouse){const{keyboardIndex:n}=this.state;return n}return this.getMouseIndex()}setKeyboardIndex(e){const{options:n}=this.props;n.separateKeyboardMouse!==void 0&&n.separateKeyboardMouse?this.setState({keyboardIndex:e}):this.setMouseIndex(e)}getMouseIndex(){const{mouseIndex:e}=this.state;return e}setMouseIndex(e){this.setState({mouseIndex:e})}initMenu(){cancelAnimationFrame(this.rAF),this.setState({menuItems:[]});const{actions:e}=this.props,n=We.getMenuItems(e,!1);n.length>0&&this.setState(s=>({menuItems:We.sortActions(s.menuItems.concat(n))}))}handleKeyDown(e){const{menuItems:n}=this.state,s=this.getKeyboardIndex();let i=s;if(e.key==="Enter"||e.key===" "){s!=null&&s>=0&&s<n.length&&this.handleMenuItemClick(n[s],e);return}e.key==="Escape"?i=null:e.key==="ArrowUp"||e.key==="Tab"&&e.shiftKey===!0?i=We.getNextMenuItem(i!=null?i:0,-1,n):(e.key==="ArrowDown"||e.key==="Tab"&&e.shiftKey===!1)&&(i=We.getNextMenuItem(i!=null?i:0,1,n)),s!==i&&(i!==null?this.setKeyboardIndex(i):(this.closeMenu(),this.oldFocus instanceof HTMLElement&&this.oldFocus.focus()),e.preventDefault(),e.stopPropagation())}closeMenu(e=!1){const{closeMenu:n,onMenuClosed:s}=this.props;cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{n(e),s(this)})}handleCloseMenu(){this.closeMenu()}handleMenuItemClick(e,n){n.preventDefault(),n.stopPropagation(),e!=null&&(e.disabled===void 0||!e.disabled)&&e.action!=null&&(e.action(),this.closeMenu(!0))}handleMenuItemMouseMove(e){const{menuItems:n}=this.state,s=n.indexOf(e);this.setMouseIndex(s)}handleMouseLeave(){this.setMouseIndex(-1)}render(){const e=[],{"data-testid":n}=this.props,{keyboardIndex:s,menuItems:i,mouseIndex:o}=this.state;for(let l=0;l<i.length;l+=1){const a=i[l];l>0&&a.group!==i[l-1].group&&e.push(h("hr",{},`${l}.separator`));const d=h(gl,{isKeyboardSelected:s===l,isMouseSelected:o===l,menuItem:a,closeMenu:this.handleCloseMenu,onMenuItemClick:this.handleMenuItemClick,onMenuItemMouseMove:this.handleMenuItemMouseMove,onMenuItemContextMenu:()=>!1},l);e.push(d)}const{menuStyle:r}=this.props;return h("div",{className:"context-menu-container",style:{...r},ref:this.container,onKeyDown:this.handleKeyDown,onMouseLeave:this.handleMouseLeave,role:"menuitem",tabIndex:0,"data-testid":n,children:e})}}xu.defaultProps={closeMenu(){},onMenuOpened(){},onMenuClosed(){},options:{},menuStyle:{},"data-testid":void 0};class Fn extends S.exports.PureComponent{constructor(e){super(e),this.handleClick=this.handleClick.bind(this),this.handleCloseMenu=this.handleCloseMenu.bind(this),this.handleExited=this.handleExited.bind(this),this.container=Y.createRef(),this.parent=null,this.popper=Y.createRef(),this.isOpen=!1}componentDidMount(){var n;const{isShown:e}=this.props;e===null?(n=this.container.current)!=null&&n.parentElement&&(this.parent=this.container.current.parentElement,this.parent.addEventListener("click",this.handleClick)):e&&this.openMenu()}componentDidUpdate(e){const{isShown:n}=this.props;e.isShown!==n&&(n!==null&&n?window.requestAnimationFrame(()=>{this.openMenu()}):this.closeMenu())}componentWillUnmount(){this.parent&&this.parent.removeEventListener("click",this.handleClick)}closeMenu(){var e;(e=this.popper.current)==null||e.hide()}openMenu(){this.popper.current&&!this.isOpen&&(this.popper.current.show(),this.isOpen=!0)}scheduleUpdate(){var e;(e=this.popper.current)==null||e.scheduleUpdate()}handleClick(e){e.preventDefault(),e.stopPropagation(),this.openMenu()}handleCloseMenu(){this.closeMenu()}handleExited(){this.isOpen=!1;const{onMenuClosed:e}=this.props;e()}render(){const{actions:e,onMenuOpened:n,popperClassName:s,"data-testid":i}=this.props,{menuStyle:o}=this.props;let{options:r,popperOptions:l}=this.props;return l={placement:"bottom",...l},r={separateKeyboardMouse:!0,...r},h("div",{className:"menu-actions-listener",ref:this.container,"data-testid":i,children:h(kn,{ref:this.popper,options:l,className:W("menu-popper",s),onExited:this.handleExited,closeOnBlur:!0,interactive:!0,children:h(xu,{actions:e,closeMenu:this.handleCloseMenu,onMenuOpened:n,options:r,menuStyle:o})})})}}Fn.defaultProps={isShown:null,onMenuClosed(){},onMenuOpened(){},options:{},popperOptions:{},popperClassName:"",menuStyle:{},"data-testid":void 0};const Hc=-1;var _u=(t=>(t.UP="UP",t.DOWN="DOWN",t))(_u||{});const ss=class extends S.exports.Component{constructor(t){super(t);const{value:e,valueToTime:n}=t;this.toggleMenu=this.toggleMenu.bind(this),this.handleMenuKeyDown=this.handleMenuKeyDown.bind(this),this.closeMenu=this.closeMenu.bind(this),this.handleOptionClick=this.handleOptionClick.bind(this),this.handleOptionFocus=this.handleOptionFocus.bind(this),this.handleMenuOpened=this.handleMenuOpened.bind(this),this.handleMenuExited=this.handleMenuExited.bind(this),this.handleCustomInput=this.handleCustomInput.bind(this),this.csContainer=Y.createRef(),this.menuContainer=Y.createRef(),this.button=Y.createRef(),this.input=Y.createRef(),this.state={keyboardOptionIndex:0,menuIsOpen:!1,inputWidth:100,customTime:n(e),inputFocused:!1}}getSelectedText(){const{options:t,value:e,placeholder:n}=this.props,{customTime:s}=this.state;if(e===null)return n;for(let i=0;i<t.length;i+=1){const o=t[i];if(o.value===e)return o.title}return Dn.formatTime(s)}setInputWidth(){this.csContainer.current&&this.setState({inputWidth:this.csContainer.current.getBoundingClientRect().width})}focus(){var t;(t=this.button.current)==null||t.focus()}updateInputValue(t){const{onChange:e}=this.props;e(t)}handleResize(){this.setInputWidth()}handleMenuKeyDown(t){var i;const{keyboardOptionIndex:e,inputFocused:n}=this.state,{options:s}=this.props;switch(t.key){case"Enter":case" ":n?this.updateFromCustom():this.updateInputValue(s[e].value),this.closeMenu(),(i=this.button.current)==null||i.focus(),t.stopPropagation(),t.preventDefault();break;case"Tab":t.shiftKey?this.handleMenuNavigation(ss.MENU_NAVIGATION_DIRECTION.UP):this.handleMenuNavigation(ss.MENU_NAVIGATION_DIRECTION.DOWN),t.stopPropagation(),t.preventDefault();break;case"ArrowUp":this.handleMenuNavigation(ss.MENU_NAVIGATION_DIRECTION.UP),t.stopPropagation(),t.preventDefault();break;case"ArrowDown":this.handleMenuNavigation(ss.MENU_NAVIGATION_DIRECTION.DOWN),t.stopPropagation(),t.preventDefault();break;case"Escape":this.closeMenu();break}}handleMenuNavigation(t){const{keyboardOptionIndex:e,inputFocused:n}=this.state,{options:s}=this.props,i=s.length;let o=e;switch(t){case ss.MENU_NAVIGATION_DIRECTION.UP:if(!n&&e===0){this.focusInput();break}else n&&this.focusOption(e);e>0&&!n?(o=(o-1)%i,this.setState({keyboardOptionIndex:o})):e===0&&(o=i-1,this.setState({keyboardOptionIndex:o})),this.scrollOptionIntoView(o);break;case ss.MENU_NAVIGATION_DIRECTION.DOWN:if(!n&&e===i-1){this.focusInput();break}else n&&this.focusOption(e);e<i&&!(n&&e===0)&&(o=(o+1)%i,this.setState({keyboardOptionIndex:o})),this.scrollOptionIntoView(o);break}}handleOptionClick(t){const e=Number(t.currentTarget.value),{options:n,timeToValue:s}=this.props,{customTime:i}=this.state;if(e===Hc){const o=s(i);this.updateAndClose(o)}else this.updateAndClose(n[e].value)}updateAndClose(t){var e;this.updateInputValue(t),this.closeMenu(),(e=this.button.current)==null||e.focus()}handleOptionFocus(t){this.setState({keyboardOptionIndex:Number(t.target.value)})}handleMenuOpened(){var o;const{options:t,value:e}=this.props,{keyboardOptionIndex:n}=this.state;this.scrollOptionIntoView(n);const s=(o=this.menuContainer.current)==null?void 0:o.querySelector(".cs-option-btn.keyboard-active");if(s instanceof HTMLElement&&s.focus(),e===null)return;t.map(r=>r.value).indexOf(e)<0&&this.focusInput()}focusInput(){var t;(t=this.input.current)==null||t.focus()}focusOption(t){var n;const e=(n=this.menuContainer.current)==null?void 0:n.querySelector(".cs-options");if(e&&e.children!=null){const s=e.children.item(t);s instanceof HTMLElement&&s.focus()}}handleMenuExited(){const{menuIsOpen:t}=this.state;t&&this.setState({menuIsOpen:!1,keyboardOptionIndex:0})}handleCustomInput(t){const{timeToValue:e}=this.props,n=e(t);this.updateInputValue(n),this.setState({customTime:t})}updateFromCustom(){const{timeToValue:t}=this.props,{customTime:e}=this.state,n=t(e);this.updateInputValue(n)}toggleMenu(t){const{menuIsOpen:e}=this.state;e?this.closeMenu():this.openMenu(),t.stopPropagation()}openMenu(){this.updateKeyboardIndex(),this.setInputWidth(),this.setState({menuIsOpen:!0})}closeMenu(t=!0){var e;this.setState({menuIsOpen:!1}),t&&((e=this.button.current)==null||e.focus())}updateKeyboardIndex(){const{options:t,value:e}=this.props;if(e===null)return;const n=t.map(s=>s.value).indexOf(e);n>0&&this.setState({keyboardOptionIndex:n})}scrollOptionIntoView(t){var n;const e=(n=this.menuContainer.current)==null?void 0:n.querySelector(".cs-options");if(e&&e.children!=null){const s=e.children.item(t);s instanceof HTMLElement&&s.offsetTop>ss.DROP_DOWN_MENU_HEIGHT?e.scrollTop=s.offsetTop-ss.DROP_DOWN_MENU_HEIGHT:(s instanceof HTMLElement&&s.offsetTop<0||t===0)&&(e.scrollTop=0)}}renderMenuElement(){const{inputWidth:t}=this.state;return h("div",{className:"cs-menu-container",ref:this.menuContainer,role:"presentation",onKeyDown:this.handleMenuKeyDown,onClick:e=>{e.stopPropagation()},style:{width:t},children:h("div",{className:"cs-options-container",children:h("div",{className:"cs-options",children:this.renderOptions()})})})}renderOptions(){const{options:t,value:e,icon:n,customText:s}=this.props,{keyboardOptionIndex:i,customTime:o,inputFocused:r}=this.state;let l=!1;const a=[];for(let d=0;d<t.length;d+=1){const c=t[d],u=`option-${d}-${c.value}`;l=l||c.value===e,a.push(v("button",{type:"button",value:d,className:W("cs-option-btn",{"keyboard-active":i===d&&!r}),onClick:this.handleOptionClick,onFocus:this.handleOptionFocus,children:[c.value===e&&h(j,{icon:n,className:"mr-2"}),c.value!==e&&h("span",{className:"mr-4"}),c.title]},u))}return a.push(h("hr",{className:"cs-divider"},"option-divider")),a.push(v("button",{type:"button",value:Hc,className:W("cs-option-btn",{"keyboard-active":r}),onClick:this.handleOptionClick,onFocus:this.handleOptionFocus,children:[!l&&e!==null?h(j,{icon:n,className:"mr-2"}):h("span",{className:"mr-4"}),s]},"option-custom-label")),a.push(v("div",{className:"cs-custom-container",children:[h("span",{className:"mr-2"}),h(Fu,{ref:this.input,onChange:this.handleCustomInput,value:o,onFocus:()=>this.setState({inputFocused:!0}),onBlur:()=>this.setState({inputFocused:!1})},"option-input"),h("span",{className:"ml-2"})]},"cs-custom-container")),a.push(h("hr",{className:"mb-2"},"option-end")),a}render(){const{disabled:t,invalid:e,value:n,"data-testid":s}=this.props,{menuIsOpen:i}=this.state;let{popperOptions:o}=this.props;return o={placement:"bottom-end",modifiers:{preventOverflow:{enabled:!1}},...o},h("div",{className:"input-group cs-container context-menu",ref:this.csContainer,"data-testid":s,children:h("div",{className:W("input-group-append cs-dropdown",{"cs-dropdown-invalid":e}),children:v("button",{type:"button",className:W("btn cs-btn form-control",{"cs-btn-invalid":e}),ref:this.button,onClick:this.toggleMenu,disabled:t,children:[h("span",{className:W({"text-muted":n===null}),children:this.getSelectedText()}),h("span",{children:h(j,{icon:md,className:"cs-caret"})}),h(Fn,{isShown:i,actions:{menuElement:this.renderMenuElement()},popperOptions:o,popperClassName:"CustomTimeSelect",onMenuOpened:this.handleMenuOpened,onMenuClosed:this.handleMenuExited,menuStyle:{maxWidth:"100rem"}})]})})})}};let Cd=ss;Cd.MENU_NAVIGATION_DIRECTION=_u;Cd.DROP_DOWN_MENU_HEIGHT=125;Cd.defaultProps={onChange(){},value:null,disabled:!1,popperOptions:{},icon:ds,customText:"Custom",placeholder:"Select a time",valueToTime:t=>t===null?0:Math.round(t/1e3),timeToValue:t=>t*1e3,invalid:!1,"data-testid":void 0};function Ei(t,e,n,s,i){const o=s-n+1;return`${((parseInt(e,10)-t-n)%o+o)%o+n}`.padStart(i,"0")}function ku(t,e,n){const{selectionStart:s}=t;return s===0?Ei(e,n,1900,2099,4):s===5?Ei(e,n,1,12,2):s===8?Ei(e,n,1,31,2):s===11?Ei(e,n,0,23,2):s===17||s===14?Ei(e,n,0,59,2):s===20||s===24||s===28?Ei(e,n,0,999,3):n}const NC=X.module("DateTimeInput"),FC="[12][0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])",xC="([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}",_C=`${FC} ${xC}`,Lr="2022-01-01",Ou=`${Lr} 00:00:00.000000000`,kC="YYYY-MM-DD HH:MM:SS.SSSSSSSSS";function Vc(t){return t!=null&&t.length>=Lr.length?`${t.substring(0,Lr.length)}${t.substring(Lr.length).replace(/\u2007/g,"0")}${Ou.substring(t.length)}`:t}function xa(t){const e=t.substring(0,23),n=t.substring(23,26),s=t.substring(26);return[e,n,s].filter(i=>i!=="").join("\u200B")}const Uc=t=>t.replace(/\u200B/g,""),OC=[xa(Ou)],Lu=Y.forwardRef((t,e)=>{const{className:n="",onChange:s=()=>{},defaultValue:i="",onFocus:o=()=>{},onBlur:r=()=>{},"data-testid":l}=t,[a,d]=S.exports.useState(i.length>0?xa(i):""),[c,u]=S.exports.useState(),m=S.exports.useCallback(g=>{NC.debug("handleChange",g),d(g),s(Vc(Uc(g)))},[s]),p=S.exports.useCallback(()=>{const g=Uc(a),f=Vc(g);f!==g&&d(xa(f)),r()},[a,r]);return h("div",{className:"d-flex flex-row align-items-center",children:h(Sl,{ref:e,className:W(n),example:OC,getNextSegmentValue:ku,onChange:m,onSelect:u,pattern:_C,placeholder:kC,selection:c,value:a,onFocus:o,onBlur:p,"data-testid":l})})});Lu.displayName="DateTimeInput";Lu.defaultProps={className:"",onChange:()=>{},defaultValue:"",onFocus:()=>{},onBlur:()=>{},"data-testid":void 0};const LC=X.module("DateInput"),AC="[12][0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])",PC=["2000-01-01","2022-12-31"],HC="YYYY-MM-DD",Au=Y.forwardRef((t,e)=>{const{className:n="",onChange:s=()=>{},defaultValue:i="",onFocus:o=()=>{},onBlur:r=()=>{},"data-testid":l}=t,[a,d]=S.exports.useState(i),[c,u]=S.exports.useState(),m=S.exports.useCallback(p=>{LC.debug("handleChange",p),d(p),s(p)},[s]);return h("div",{className:"d-flex flex-row align-items-center",children:h(Sl,{ref:e,className:W(n),example:PC,getNextSegmentValue:ku,onChange:m,onSelect:u,pattern:AC,placeholder:HC,selection:c,value:a,onFocus:o,onBlur:r,"data-testid":l})})});Au.displayName="DateInput";Au.defaultProps={className:"",onChange:()=>!1,defaultValue:"",onFocus:()=>!1,onBlur:()=>!1,"data-testid":void 0};class Pu extends S.exports.PureComponent{constructor(e){super(e),this.searchInput=Y.createRef(),this.handleChange=this.handleChange.bind(this),this.sendUpdate=je(this.sendUpdate.bind(this),e.debounceMs),this.state={value:e.value}}componentDidUpdate(e){const{value:n}=this.props;e.value!==n&&this.setState({value:n})}focus(){var e;(e=this.searchInput.current)==null||e.focus()}handleChange(e){this.setState({value:e.target.value},this.sendUpdate)}sendUpdate(){const{onChange:e}=this.props,{value:n}=this.state;e(n)}render(){const{placeholder:e,className:n,matchCount:s,id:i,"data-testid":o}=this.props,{value:r}=this.state;return h(Cs,{value:r,placeholder:e,onChange:this.handleChange,className:n,matchCount:s,ref:this.searchInput,id:i,"data-testid":o})}}Pu.defaultProps={placeholder:"Search",className:"",matchCount:null,debounceMs:250,id:"","data-testid":void 0};const VC=X.module("ItemListItem"),Hu=class extends S.exports.Component{constructor(t){super(t),this.handleBlur=this.handleBlur.bind(this),this.handleFocus=this.handleFocus.bind(this),this.handleClick=this.handleClick.bind(this),this.handleContextMenu=this.handleContextMenu.bind(this),this.handleDragStart=this.handleDragStart.bind(this),this.handleDrag=this.handleDrag.bind(this),this.handleDragOver=this.handleDragOver.bind(this),this.handleDragEnd=this.handleDragEnd.bind(this),this.handleDrop=this.handleDrop.bind(this),this.handleDoubleClick=this.handleDoubleClick.bind(this),this.handleMouseDown=this.handleMouseDown.bind(this),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleMouseUp=this.handleMouseUp.bind(this),this.itemRef=Y.createRef()}static handleKeyDown(){return VC.log("ItemListItem.handleKeyDown false"),!1}handleBlur(t){const{itemIndex:e,onBlur:n}=this.props;n(e,t)}handleFocus(t){const{itemIndex:e,onFocus:n}=this.props;n(e,t)}handleClick(t){const{itemIndex:e,onClick:n}=this.props;n(e,t)}handleContextMenu(t){const{itemIndex:e,onContextMenu:n}=this.props;n(e,t)}handleDragStart(t){const{itemIndex:e,onDragStart:n}=this.props;n(e,t)}handleDrag(t){const{itemIndex:e,onDrag:n}=this.props;n(e,t)}handleDragOver(t){t.preventDefault();const{itemIndex:e,onDragOver:n}=this.props;n(e,t)}handleDragEnd(t){const{itemIndex:e,onDragEnd:n}=this.props;n(e,t)}handleDrop(t){const{itemIndex:e,onDrop:n}=this.props;n(e,t)}handleDoubleClick(t){const{itemIndex:e,onDoubleClick:n}=this.props;n(e,t)}handleMouseMove(t){const{itemIndex:e,onMouseMove:n}=this.props;n(e,t)}handleMouseDown(t){const{itemIndex:e,onMouseDown:n}=this.props;n(e,t)}handleMouseUp(t){const{itemIndex:e,onMouseUp:n}=this.props;n(e,t)}render(){const{isDraggable:t,isFocused:e,isSelected:n,style:s,children:i,"data-testid":o}=this.props;return h("div",{className:W("item-list-item",{active:n},{"is-focused":e},{"is-draggable":t}),onKeyDown:Hu.handleKeyDown,onContextMenu:this.handleContextMenu,onClick:this.handleClick,onDrag:this.handleDrag,onDragStart:this.handleDragStart,onDragOver:this.handleDragOver,onDragEnd:this.handleDragEnd,onDrop:this.handleDrop,onDoubleClick:this.handleDoubleClick,onMouseDown:this.handleMouseDown,onMouseMove:this.handleMouseMove,onMouseUp:this.handleMouseUp,tabIndex:-1,ref:this.itemRef,role:"listitem",style:s,onFocus:this.handleFocus,onBlur:this.handleBlur,draggable:t,"data-testid":o,children:i})}};let Vu=Hu;Vu.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 Bc=X.module("ItemList"),Vi=class extends S.exports.PureComponent{constructor(t){super(t),this.getItemSelected=ve((s,i)=>fn.isSelected(i,s),{max:Vi.CACHE_SIZE}),this.getCachedItem=ve((s,i,o,r,l,a,d,c)=>{const u=a({item:o,itemIndex:s,isFocused:r,isSelected:l,style:d});return h(Vu,{onContextMenu:this.handleItemContextMenu,onDoubleClick:this.handleItemDoubleClick,onMouseDown:this.handleItemMouseDown,onFocus:this.handleItemFocus,onBlur:this.handleItemBlur,disableSelect:c,onMouseMove:this.handleItemMouseMove,onMouseUp:this.handleItemMouseUp,isFocused:r,isSelected:l,itemIndex:s,style:d,children:u},i)},{max:Vi.CACHE_SIZE}),this.getOuterElement=ve(s=>{const i=Y.forwardRef((o,r)=>h("div",{ref:r,tabIndex:-1,onKeyDown:s,role:"presentation",...o}));return i.displayName="ItemListOuterElement",i}),this.getInnerElement=ve(()=>{const s=Y.forwardRef((i,o)=>h("div",{className:"item-list-inner-element",ref:o,...i}));return s.displayName="ItemListInnerElement",s}),this.getItemData=ve((s,i,o)=>({items:s,selectedRanges:i,renderItem:o})),this.handleItemBlur=this.handleItemBlur.bind(this),this.handleItemContextMenu=this.handleItemContextMenu.bind(this),this.handleItemFocus=this.handleItemFocus.bind(this),this.handleItemDoubleClick=this.handleItemDoubleClick.bind(this),this.handleItemMouseDown=this.handleItemMouseDown.bind(this),this.handleItemMouseMove=this.handleItemMouseMove.bind(this),this.handleItemMouseUp=this.handleItemMouseUp.bind(this),this.handleItemsRendered=this.handleItemsRendered.bind(this),this.handleWindowMouseUp=this.handleWindowMouseUp.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.handleScroll=this.handleScroll.bind(this),this.handleResize=this.handleResize.bind(this),this.renderInnerElement=this.renderInnerElement.bind(this),this.list=Y.createRef(),this.listContainer=Y.createRef();const{isStickyBottom:e,selectedRanges:n}=t;this.state={focusIndex:null,mouseDownIndex:null,selectedRanges:n,overscanStartIndex:0,height:null,isDragging:!1,isStuckToBottom:e,scrollOffset:null}}static renderItem({item:t}){var e,n;return h("div",{className:"item-list-item-content",children:t!=null&&((n=(e=t.displayValue)!=null?e:t.value)!=null?n:`${t}`)})}componentDidUpdate(t,e){const{selectedRanges:n,itemCount:s}=this.props,{focusIndex:i,isStuckToBottom:o,scrollOffset:r,height:l,selectedRanges:a}=this.state;if(o&&!this.isListAtBottom()&&s>0&&this.scrollToBottom(),(r!==e.scrollOffset||l!==e.height)&&this.sendViewportUpdate(),n!==t.selectedRanges&&n!==a)this.setSelectedRanges(n);else if(a!==e.selectedRanges){const{onSelectionChange:d}=this.props;d(a)}if(i!==e.focusIndex){const{onFocusChange:d}=this.props;d(i)}}componentWillUnmount(){window.removeEventListener("mouseup",this.handleWindowMouseUp)}focus(){var t;(t=this.listContainer.current)==null||t.focus()}restoreScrollPosition(){var e;const{scrollOffset:t}=this.state;t!=null&&((e=this.listContainer.current)==null||e.scrollTo(0,t))}getElement(t){if(this.listContainer.current==null)return null;const{focusSelector:e}=this.props,{overscanStartIndex:n}=this.state,s=this.listContainer.current.querySelectorAll(e),i=t-n;return s[i]}focusItem(t){const{disableSelect:e}=this.props;if(e)return;this.setState({focusIndex:t});const n=this.getElement(t);n instanceof HTMLElement&&n.focus()}scrollToItem(t){const e=this.getElement(t);e!=null&&e.scrollIntoView({block:"center"})}handleItemContextMenu(t,e){const{selectedRanges:n}=this.state,i=fn.isSelected(n,t)||We.isModifierKeyDown(e);this.toggleSelect(t,e.shiftKey,i,!1)}handleItemDoubleClick(t,e){const{isDoubleClickSelect:n,onSelect:s}=this.props;n&&this.setState(({selectedRanges:i})=>({selectedRanges:fn.selectRange(i,[t,t])}),()=>{s(t,e)})}handleItemMouseDown(t,e){const{selectedRanges:n}=this.state;if(!(e.target instanceof HTMLElement&&["button","select","input","textarea"].indexOf(e.target.tagName.toLowerCase())!==-1)){if(e.button===2&&n.length===0){this.focusItem(t),this.selectItem(t);return}e.button!=null&&e.button!==0||(this.setState({mouseDownIndex:t}),window.addEventListener("mouseup",this.handleWindowMouseUp))}}handleItemBlur(t,e){Bc.debug2("item blur",t,e.currentTarget,e.relatedTarget),(!e.relatedTarget||this.listContainer.current&&e.relatedTarget instanceof HTMLElement&&!this.listContainer.current.contains(e.relatedTarget))&&this.setState({focusIndex:null})}handleItemFocus(t,e){Bc.debug2("item focus",t,e.target),this.setState(n=>{const{focusIndex:s}=n;return s!==t?{focusIndex:t}:null})}handleItemMouseMove(t,e){const{isDragSelect:n,isMultiSelect:s,disableSelect:i}=this.props,{mouseDownIndex:o,selectedRanges:r}=this.state;o==null||i||(this.setState({isDragging:!0}),(n||o===t)&&(this.focusItem(t),s?(!n&&!this.getItemSelected(t,r)&&!We.isModifierKeyDown(e)&&this.deselectAll(),this.selectRange([Math.min(o,t),Math.max(o,t)])):this.toggleSelect(t,e.shiftKey,We.isModifierKeyDown(e),!1)))}handleItemMouseUp(t,e){const{isDeselectOnClick:n,isDoubleClickSelect:s,onSelect:i}=this.props,{mouseDownIndex:o,isDragging:r}=this.state;if(!(e.target instanceof HTMLElement&&["button","select","input","textarea"].indexOf(e.target.tagName.toLowerCase())!==-1)){if(o===t&&!r){const l=e.shiftKey,a=We.isModifierKeyDown(e);this.focusItem(t),this.toggleSelect(t,l,a,n),!s&&!l&&!a&&i(t,e)}this.resetMouseState()}}handleItemsRendered({overscanStartIndex:t}){this.setState({overscanStartIndex:t})}handleResize({height:t}){this.setState({height:t})}handleMouseLeave(){this.setState({mouseDownIndex:null})}handleWindowMouseUp(){this.resetMouseState(),window.removeEventListener("mouseup",this.handleWindowMouseUp)}handleKeyDown(t){var r;const{isMultiSelect:e,itemCount:n,onSelect:s}=this.props,{focusIndex:i}=this.state;let o=i;if(t.key==="Enter"||t.key===" "){!e&&o!=null&&this.setState({selectedRanges:[[o,o]]},()=>{o!=null&&s(o,t)});return}if(t.key==="ArrowUp")o!=null&&o>=0?o=Math.max(0,o-1):o=n-1;else if(t.key==="ArrowDown")o!=null&&o>=0?o=Math.min(o+1,n-1):o=0;else return;if(i!==o){t.stopPropagation(),t.preventDefault(),this.focusItem(o);const{selectedRanges:l}=this.state;if(t.shiftKey&&l.length>0){const a=l[l.length-1];this.selectRange([Math.min(o,a[0]),Math.max(o,a[1])])}else this.deselectAll(),o!==null?this.selectItem(o):(r=this.listContainer.current)==null||r.focus();this.scrollIntoView(o)}}handleScroll({scrollUpdateWasRequested:t,scrollOffset:e}){this.setState(n=>{if(t)return{scrollOffset:e};const{isStickyBottom:s}=this.props,{height:i}=n;return{isStuckToBottom:s&&this.isListAtBottom({scrollOffset:e,height:i}),scrollOffset:e}})}resetMouseState(){this.setState({mouseDownIndex:null,isDragging:!1})}scrollToBottom(){const{itemCount:t}=this.props;this.list.current&&this.list.current.scrollToItem(t)}scrollIntoView(t){this.list.current&&this.list.current.scrollToItem(t)}toggleSelect(t,e,n,s=!0){const{isMultiSelect:i}=this.props,{selectedRanges:o}=this.state;if(i&&e&&o.length>0){const r=o[o.length-1];this.selectRange([Math.min(r[0],t),Math.max(t,r[1])])}else i&&o.length===1&&o[0][0]===t&&o[0][1]===t?s&&this.deselectItem(t):i&&n?this.getItemSelected(t,o)?s&&this.deselectItem(t):this.selectItem(t):(this.deselectAll(),this.selectItem(t))}deselectAll(){const{itemCount:t}=this.props;this.deselectRange([0,t])}deselectItem(t){this.deselectRange([t,t])}deselectRange(t){fn.validateRange(t),this.setState(({selectedRanges:e})=>({selectedRanges:fn.deselectRange(e,t)}))}selectItem(t){const{disableSelect:e}=this.props;e||this.selectRange([t,t])}selectRange(t){fn.validateRange(t),this.setState(({selectedRanges:e})=>({selectedRanges:fn.selectRange(e,t)}))}setSelectedRanges(t){this.setState({selectedRanges:t})}sendViewportUpdate(){const{scrollOffset:t,height:e}=this.state;if(t!=null&&e!=null){const{onViewportChange:n,rowHeight:s}=this.props,i=Math.floor(t/s),o=i+Math.ceil(e/s);n(i,o)}}isListAtBottom({scrollOffset:t,height:e}=this.state){if(e==null||t==null)return!1;const{itemCount:n,rowHeight:s}=this.props;return t+e>=n*s}renderInnerElement({index:t,style:e}){const{items:n,offset:s,renderItem:i,disableSelect:o}=this.props,{focusIndex:r,selectedRanges:l}=this.state;if(t<s||t>=s+n.length)return null;const a=n[t-s];return this.getCachedItem(t,t,a,t===r&&!o,this.getItemSelected(t,l),i,e,o)}render(){const{items:t,itemCount:e,overscanCount:n,renderItem:s,rowHeight:i,"data-testid":o}=this.props,{selectedRanges:r,isStuckToBottom:l}=this.state;return h(rg,{className:"item-list-auto-sizer",onResize:this.handleResize,children:({width:a,height:d})=>h(lg,{className:"item-list-scroll-pane",height:d,width:a,initialScrollOffset:l?e*i:0,itemCount:e,itemSize:i,itemData:this.getItemData(t,r,s),onScroll:this.handleScroll,onItemsRendered:this.handleItemsRendered,ref:this.list,outerElementType:this.getOuterElement(this.handleKeyDown),outerRef:this.listContainer,innerElementType:this.getInnerElement(),overscanCount:n,"data-testid":o,children:this.renderInnerElement})})}};let bn=Vi;bn.CACHE_SIZE=1e3;bn.DEFAULT_ROW_HEIGHT=20;bn.DEFAULT_OVERSCAN=10;bn.defaultProps={offset:0,items:[],rowHeight:Vi.DEFAULT_ROW_HEIGHT,isDeselectOnClick:!0,isDoubleClickSelect:!1,isDragSelect:!0,isMultiSelect:!1,isStickyBottom:!1,disableSelect:!1,onFocusChange(){},onSelect(){},onSelectionChange(){},onViewportChange(){},overscanCount:Vi.DEFAULT_OVERSCAN,renderItem:Vi.renderItem,selectedRanges:[],focusSelector:".item-list-item","data-testid":void 0};const ii=class extends S.exports.PureComponent{constructor(t){super(t),this.getCachedDraggableItem=ve((e,n,s,i,o,r,l,a)=>h(ul,{draggableId:ii.getDraggableId(e,i),index:i,isDragDisabled:l,children:d=>h("div",{role:"menuitem",className:"draggable-item-list-item",ref:d.innerRef,tabIndex:-1,...d.draggableProps,...d.dragHandleProps,children:n({item:s,itemIndex:i,isFocused:o,isSelected:r,style:a,isClone:!1})})},i),{max:bn.CACHE_SIZE}),this.getCachedRenderDraggableItem=ve((e,n,s)=>({item:i,itemIndex:o,isFocused:r,isSelected:l,style:a})=>this.getCachedDraggableItem(e,s,i,o,r,l,n,a),{max:1}),this.getCachedRenderClone=ve((e,n,s,i)=>(o,r,l)=>{const{selectedCount:a}=this.state,{draggableProps:d,dragHandleProps:c,innerRef:u}=o,{index:m}=l.source,p=n[m-s];return h("div",{className:W("draggable-item-list-dragging-item-container",e),...d,...c,ref:u,children:h("div",{className:W("draggable-item-list-dragging-item",{"two-dragged":a===2},{"multiple-dragged":a>2}),children:i({item:p,itemIndex:m,isFocused:!1,isSelected:!0,style:{},isClone:!0,selectedCount:a})})})},{max:1}),this.handleSelectionChange=this.handleSelectionChange.bind(this),this.itemList=Y.createRef(),this.state={selectedCount:0}}static renderHandle(){return v("div",{children:[h(Ue,{children:"Drag to re-order"}),h(j,{icon:Ko})]})}static renderBadge({text:t}){return t!=null&&t.length>0?h("span",{className:"number-badge",children:t}):null}static renderTextItem({text:t,badgeText:e="",className:n=""}){return v("div",{className:W("item-list-item-content","draggable-item-list-item-content",n),children:[h("span",{className:"title",children:t}),ii.renderBadge({text:e}),ii.renderHandle()]})}static renderItem({item:t,isClone:e,selectedCount:n}){var r,l;const s=t!=null?(l=(r=t.displayValue)!=null?r:t.value)!=null?l:`${t}`:"",i=e!==void 0&&e?`${n}`:"",o=e!==void 0&&e?"item-list-item-clone":"";return ii.renderTextItem({text:s,badgeText:i,className:o})}static getDraggableId(t,e){return`${t}/${e}`}static getDraggableIndex(t){const e=t.split("/").pop();return parseInt(e!==void 0?e:"",10)}selectItem(t){var e;(e=this.itemList.current)==null||e.selectItem(t)}focusItem(t){var e;(e=this.itemList.current)==null||e.focusItem(t)}scrollToItem(t){var e;(e=this.itemList.current)==null||e.scrollToItem(t)}handleSelectionChange(t){this.setState({selectedCount:fn.count(t)});const{onSelectionChange:e}=this.props;e(t)}render(){const{className:t,draggablePrefix:e,draggingItemClassName:n,droppableId:s,isDoubleClickSelect:i,isDragDisabled:o,isDropDisabled:r,isMultiSelect:l,isStickyBottom:a,itemCount:d,items:c,offset:u,onFocusChange:m,onSelect:p,onViewportChange:g,renderItem:f,rowHeight:b,selectedRanges:C,style:w,"data-testid":T}=this.props;return h(Uo,{isDropDisabled:r,droppableId:s,mode:"virtual",renderClone:this.getCachedRenderClone(n,c,u,f),"data-testid":T,children:(y,E)=>h("div",{role:"menu",className:W("draggable-item-list",t,{"is-drop-disabled":r,"is-drag-disabled":o,"is-dragging-from-this":E.draggingFromThisWith,"is-dragging-over":E.isDraggingOver,"is-dropping":E.draggingOverWith}),style:w,ref:y.innerRef,...y.droppableProps,children:h(bn,{focusSelector:".draggable-item-list-item",isDoubleClickSelect:i,isDragSelect:!1,isMultiSelect:l,isStickyBottom:a,itemCount:d,items:c,onFocusChange:m,onSelect:p,onSelectionChange:this.handleSelectionChange,onViewportChange:g,offset:u,ref:this.itemList,renderItem:this.getCachedRenderDraggableItem(e,o,f),rowHeight:b,selectedRanges:C})})})}};let rn=ii;rn.DEFAULT_ROW_HEIGHT=30;rn.defaultProps={className:"",draggingItemClassName:"",offset:0,items:[],rowHeight:ii.DEFAULT_ROW_HEIGHT,isDeselectOnClick:!0,isDoubleClickSelect:!0,isDropDisabled:!1,isDragDisabled:!1,isMultiSelect:!1,isStickyBottom:!1,disableSelect:!1,style:null,onFocusChange(){},onSelect(){},onSelectionChange(){},onViewportChange(){},renderItem:ii.renderItem,selectedRanges:[],draggablePrefix:"draggable-item",droppableId:"droppable-item-list","data-testid":void 0};class jt{static reorder(e,n,s,i){const o=e===s?jt.adjustDestinationIndex(i,n):i,r=jt.removeItems(e,n);return s.splice(o,0,...r),r}static removeItems(e,n){const s=[],i=n.map((o,r)=>({range:o,index:r})).sort((o,r)=>r.range[0]-o.range[0]);for(let o=0;o<i.length;o+=1){const{range:r,index:l}=i[o],[a,d]=r;s[l]=e.splice(a,d-a+1)}return ag(s)}static adjustDestinationIndex(e,n){let s=e;for(let i=0;i<n.length;i+=1){const[o,r]=n[i];if(o>e)break;s-=Math.min(r,e-1)-o+1}return s}static startDragging(){document.documentElement.classList.add("drag-pointer-events-none")}static stopDragging(){document.documentElement.classList.remove("drag-pointer-events-none")}}const Ar=class extends S.exports.Component{static isParentSelected(t,e){const n=e.get(t);if(n===void 0)return!1;if(typeof n=="boolean")return n;const s=Array.from(n.values()).includes(!0),i=Array.from(n.values()).includes(!1);return s&&i?null:s}constructor(t){super(t),this.toggleMenu=this.toggleMenu.bind(this),this.toggleValueFor=this.toggleValueFor.bind(this),this.selectAll=this.selectAll.bind(this),this.clear=this.clear.bind(this),this.state={menuIsOpen:!1}}toggleMenu(t){t.stopPropagation(),t.preventDefault(),this.setState(e=>{const{menuIsOpen:n}=e;return{menuIsOpen:!n}})}toggleValueFor(t,e){const{valueMap:n,onUpdateValueMap:s}=this.props,i=new Map(n),o=i.get(t);if(o instanceof Map){const l=new Map(o);if(e!=null)l.set(e,o.get(e)===void 0);else{const a=Ar.isParentSelected(t,i),d=a==null||!a;o.forEach((c,u)=>l.set(u,d))}i.set(t,l)}else i.set(t,o==null||!o);const r=i.get(t);if(e===void 0&&r!==void 0&&typeof r!="boolean"){const l=Ar.isParentSelected(t,n);l!=null&&l?r.forEach((a,d)=>r.set(d,!1)):r.forEach((a,d)=>r.set(d,!0))}s(i)}setAllValues(t){const{valueMap:e,onUpdateValueMap:n}=this.props,s=new Map;e.forEach((i,o)=>{if(typeof i=="boolean")s.set(o,t);else{const r=new Map;i.forEach((l,a)=>r.set(a,t)),s.set(o,r)}}),n(s)}selectAll(){this.setAllValues(!0)}clear(){this.setAllValues(!1)}renderMenuElement(){const{valueMap:t,"data-testid":e}=this.props;return v("div",{className:"hcm-menu-container",children:[Array.from(t.entries()).map(([n,s])=>v("div",{children:[h(St,{className:"hcm-parent",checked:Ar.isParentSelected(n,t),onChange:()=>this.toggleValueFor(n),children:n}),s!==void 0&&typeof s!="boolean"&&Array.from(s.entries()).map(([i,o])=>h(St,{className:"hcm-child",checked:o,onChange:()=>this.toggleValueFor(n,i),children:i},i))]},n)),h(z,{kind:"ghost",onClick:this.selectAll,"data-testid":e!==void 0?`${e}-btn-select-all`:void 0,children:"Select All"}),h(z,{kind:"ghost",onClick:this.clear,"data-testid":e!==void 0?`${e}-btn-clear`:void 0,children:"Clear"})]})}render(){const{menuText:t,className:e,icon:n,id:s,"data-testid":i}=this.props,{menuIsOpen:o}=this.state;return v("button",{type:"button",className:W("btn hcm-btn",e),onClick:this.toggleMenu,id:s,"data-testid":i,children:[v("span",{children:[n&&h(j,{icon:n,className:"hcm-icon mr-1"}),t]}),h(j,{icon:md,className:"hcm-icon ml-1"}),h(kn,{options:{placement:"bottom"},isShown:o,onExited:()=>{this.setState({menuIsOpen:!1})},closeOnBlur:!0,interactive:!0,children:this.renderMenuElement()})]})}};let UC=Ar;UC.defaultProps={className:"",icon:null,id:"","data-testid":void 0};function wl({isLoaded:t=!1,isLoading:e=!0,errorMessage:n=null,"data-testid":s}){return h(ut,{in:Boolean(n)||!t||e,timeout:It.transitionMs,classNames:t?"fade":"",mountOnEnter:!0,unmountOnExit:!0,children:h("div",{className:"fill-parent-absolute","data-testid":s,children:h("div",{className:W("iris-panel-message-overlay","fill-parent-absolute",{"iris-panel-scrim-background":t}),children:v("div",{className:"message-content",children:[v("div",{className:"message-icon",children:[e&&h(On,{}),!e&&n!=null&&h(j,{icon:cs})]}),h("div",{className:"message-text",children:n})]})})})})}function Uu({on:t,id:e,className:n,isInvalid:s,disabled:i=!1,onClick:o,"data-testid":r}){return h("button",{type:"button",className:W("btn","btn-switch",n,{active:t},{"is-invalid":s}),id:e,onClick:o,disabled:i,"data-testid":r,children:h("div",{className:"handle"})})}function $c(t){return t.isOn!==void 0}function BC({item:t,onSelect:e=()=>{},"data-testid":n}){const{icon:s,subtitle:i,title:o}=t,r=S.exports.useMemo(()=>$c(t)?()=>{t.onChange(!t.isOn)}:e,[t,e]);return v("div",{className:"btn btn-navigation-menu-item","data-testid":`menu-item-${o}`,onClick:r,onKeyDown:l=>{(l.key==="Enter"||l.key===" ")&&r()},tabIndex:0,role:"menuitem",children:[s!==void 0&&h("div",{className:"icon",children:h(j,{icon:s})}),h("div",{className:"title",children:o}),i!==void 0&&h("div",{className:"shortcut",children:i}),h("div",{className:"accessory","data-testid":n,children:$c(t)?h(Uu,{on:t.isOn,onClick:l=>{l.stopPropagation(),r()}}):h(j,{icon:mu})})]})}function Bu({items:t,onSelect:e=()=>{},"data-testid":n}){return h("div",{className:"navigation-menu-view","data-testid":n,children:h("ul",{className:"navigation-menu-list",children:t.map((s,i)=>h("li",{children:h(BC,{item:s,onSelect:()=>{e(i)}})},s.title))})})}function Wc({children:t,onBack:e,onClose:n,title:s,"data-testid":i}){return v("div",{className:"navigation-page","data-testid":i,children:[v("div",{className:"navigation-title-bar",children:[h("div",{className:"navigation-left-buttons",children:e!==void 0&&h(z,{kind:"ghost",className:"btn-back","data-testid":"btn-page-back",onClick:e,icon:Cf,children:"Back"})}),h("div",{className:"navigation-title",children:s}),h("div",{className:"navigation-right-buttons",children:n!==void 0&&h(z,{kind:"ghost",className:"btn-close px-2 m-1","data-testid":"btn-page-close",onClick:n,icon:Xi,tooltip:"Close"})})]}),h("div",{className:"navigation-content",children:t})]})}function $C({children:t,"data-testid":e}){const n=S.exports.useMemo(()=>Y.Children.toArray(t),[t]),s=Cl(n),[i,o]=S.exports.useState(n[n.length-1]),[r,l]=S.exports.useState(null),[a,d]=S.exports.useState(null);S.exports.useEffect(function(){if(s===void 0||n===s)return;const p=n[n.length-1];n.length===s.length||s.length===0||r!==null||a!==null?r!==null&&p!==r?l(p):p!==a&&p!==i&&o(p):n.length>s.length?l(p):n.length<s.length&&(o(p),d(s[s.length-1]))},[n,s,r,a,i]);const c=S.exports.useCallback(()=>{o(r),l(null)},[r]),u=S.exports.useCallback(()=>{d(null)},[]);return v("div",{className:"navigation-stack",children:[h("div",{className:"main-view","data-testid":e,children:i}),h(ut,{in:a!=null,timeout:It.transitionMidMs,classNames:"slide-right",onEntered:u,children:h(ye,{children:a!=null&&h("div",{className:"popping-view",children:a})})}),h(ut,{in:r!=null,timeout:It.transitionMidMs,classNames:"slide-left",onEntered:c,children:h(ye,{children:r!=null&&h("div",{className:"pushing-view",children:r})})})]})}function WC({children:t,disabled:e,value:n,"data-testid":s}){return h("option",{value:n,disabled:e,"data-testid":s,children:t})}function vl(t){const{children:e,disabled:n=!1,name:s,onChange:i,value:o="","data-testid":r}=t,[l]=S.exports.useState(s!=null?s:ze());return h(ye,{children:Y.Children.map(e,a=>{var d,c;return a?Y.cloneElement(a,{name:l,onChange:(d=a.props.onChange)!=null?d:i,checked:o===a.props.value,disabled:(c=a.props.disabled)!=null?c:n,"data-testid":r}):null})})}const xn=Y.forwardRef((t,e)=>{const{checked:n,children:s,className:i="",disabled:o=!1,inputClassName:r="",isInvalid:l=!1,labelClassName:a="",name:d,onChange:c,value:u,"data-testid":m}=t,[p]=S.exports.useState(ze());return v("div",{className:W("custom-control custom-radio",i),children:[h("input",{type:"radio",id:p,"data-testid":m,name:d,ref:e,className:W("custom-control-input",r,{"is-invalid":l}),checked:n,disabled:o,value:u,onChange:c}),h("label",{className:W("custom-control-label",a),htmlFor:p,children:s})]})});xn.displayName="RadioItem";xn.defaultProps={checked:void 0,className:"",disabled:!1,inputClassName:"",isInvalid:!1,labelClassName:"",name:void 0,onChange:void 0,"data-testid":void 0};function zC({children:t,onBlur:e,onChange:n,className:s,defaultValue:i,name:o,value:r,disabled:l,"data-testid":a}){const d=S.exports.useCallback(c=>{n(c.target.value)},[n]);return h("select",{className:W("custom-select",s),onBlur:e,onChange:d,defaultValue:i,value:r,name:o,disabled:l,"data-testid":a,children:t})}class $u extends S.exports.PureComponent{constructor(e){super(e),this.getCachedItem=ve((n,s,i,o,r,l,a)=>{const d={height:r},c=o!=null?o:i;return h("li",{className:"value-list-item",style:d,tabIndex:-1,children:h(St,{checked:l,disabled:a,onChange:()=>this.handleSelect(n),children:c})},s)},{max:1e3}),this.getCachedItems=ve((n,s,i,o)=>{const r=[];for(let l=0;l<n.length;l+=1){const a=n[l],{value:d,displayValue:c,isSelected:u}=a,m=i+l,p=m,g=this.getCachedItem(m,p,d,c,s,u,o);r.push(g)}return r},{max:1}),this.handleBlur=this.handleBlur.bind(this),this.handleScroll=this.handleScroll.bind(this),this.handleSelect=this.handleSelect.bind(this),this.list=Y.createRef(),this.topRow=null,this.bottomRow=null}componentDidMount(){this.sendViewportUpdate()}componentDidUpdate(){this.sendViewportUpdate()}handleBlur(e){if(!e.relatedTarget||this.list.current&&e.relatedTarget instanceof HTMLElement&&!this.list.current.contains(e.relatedTarget)){const{onBlur:n}=this.props;n==null||n(e)}}handleScroll(){this.sendViewportUpdate()}handleSelect(e){const{items:n,offset:s,onSelect:i}=this.props,o=e-s;if(o>=0&&o<n.length){const r=n[o],{value:l}=r;i(e,l)}else i(e,null)}sendViewportUpdate(){if(!this.list.current||this.list.current.clientHeight===0)return;const{onViewportChange:e,rowHeight:n}=this.props,s=this.list.current.scrollTop,i=s+this.list.current.clientHeight,o=Math.floor(s/n),r=Math.ceil(i/n);(this.topRow!==o||this.bottomRow!==r)&&(this.topRow=o,this.bottomRow=r,e(o,r))}getElement(e){return this.list.current==null?null:this.list.current.querySelectorAll(".value-list-item")[e]}scrollIntoView(e){const n=this.getElement(e);n==null||n.scrollIntoView({block:"center"})}render(){const{className:e,disabled:n,isInvalid:s,items:i,itemCount:o,offset:r,rowHeight:l,"data-testid":a}=this.props,d=this.getCachedItems(i,l,r,n);return h("div",{className:W("select-value-list-scroll-pane h-100 w-100",{"is-invalid":s},e),onBlur:this.handleBlur,onScroll:this.handleScroll,ref:this.list,"data-testid":a,children:h("div",{className:"select-value-list",style:{height:o*l},children:h("ol",{className:"select-value-list-content",style:{position:"absolute",height:i.length*l,top:r*l,left:0},children:d})})})}}$u.defaultProps={disabled:!1,rowHeight:21,onBlur:()=>{},"data-testid":void 0};const zc=X.module("Shortcut");var de=(t=>(t.CTRL="MODIFIER_CTRL",t.CMD="MODIFIER_CMD",t.ALT="MODIFIER_ALT",t.OPTION="MODIFIER_OPTION",t.SHIFT="MODIFIER_SHIFT",t))(de||{}),me=(t=>(t.A="A",t.B="B",t.C="C",t.D="D",t.E="E",t.F="F",t.G="G",t.H="H",t.I="I",t.J="J",t.K="K",t.L="L",t.M="M",t.N="N",t.O="O",t.P="P",t.Q="Q",t.R="R",t.S="S",t.T="T",t.U="U",t.V="V",t.W="W",t.X="X",t.Y="Y",t.Z="Z",t.ZERO="0",t.ONE="1",t.TWO="2",t.THREE="3",t.FOUR="4",t.FIVE="5",t.SIX="6",t.SEVEN="7",t.EIGHT="8",t.NINE="9",t.BACKSPACE="Backspace",t.ESCAPE="Escape",t.ENTER="Enter",t.DELETE="Delete",t.SLASH="/",t.QUESTION_MARK="?",t.BACKSLASH="\\",t.PIPE="|",t.MINUS="-",t.UNDERSCORE="_",t.EQUALS="=",t.PLUS="+",t.BACKTICK="`",t.TILDE="~",t.COMMA=",",t.LEFT_CHEVRON="<",t.PERIOD=".",t.RIGHT_CHEVRON=">",t.SEMICOLON=";",t.COLON=":",t.SINGLE_QUOTE="'",t.DOUBLE_QUOTE='"',t.LEFT_BRACKET="[",t.RIGHT_BRACKET="]",t.LEFT_CURLY="{",t.RIGHT_CURLY="}",t.F1="F1",t.F2="F2",t.F3="F3",t.F4="F4",t.F5="F5",t.F6="F6",t.F7="F7",t.F8="F8",t.F9="F9",t.F10="F10",t.F11="F11",t.F12="F12",t))(me||{});const GC=new Set(["Enter","Delete","F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12"]),ft=class extends hl{constructor({id:t,shortcut:e,macShortcut:n,isEditable:s=!0,name:i,tooltip:o}){super(),this.id=t,this.name=i,this.tooltip=o,this.isEditable=s;const l=ft.isMacPlatform?n:e;this.defaultKeyState=ft.createKeyState(l),this.keyState=this.defaultKeyState}static isAllowedKey(t){return Object.values(me).includes(t)}static isValidKeyState(t){const{keyValue:e}=t;return e===null?!0:!ft.isMacPlatform&&t.metaKey||!ft.isAllowedKey(e)?!1:!(!t.altKey&&!t.ctrlKey&&!t.metaKey&&!t.shiftKey)||GC.has(e)}static createKeyState(t){const e={altKey:!1,ctrlKey:!1,metaKey:!1,shiftKey:!1,keyValue:t[t.length-1]};return t.forEach(n=>{switch(n){case"MODIFIER_CTRL":e.ctrlKey=!0;break;case"MODIFIER_ALT":case"MODIFIER_OPTION":e.altKey=!0;break;case"MODIFIER_CMD":e.metaKey=!0;break;case"MODIFIER_SHIFT":e.shiftKey=!0;break}}),e}static getKeyStateFromEvent(t){const{key:e,keyCode:n}=t;let s="";return e==="Shift"||e==="Meta"||e==="Control"||e==="Alt"?s="":!ft.isAllowedKey(e)&&ft.isAllowedKey(String.fromCharCode(n))?s=String.fromCharCode(n):s=e,{keyValue:s,altKey:t.altKey,ctrlKey:t.ctrlKey,metaKey:t.metaKey,shiftKey:t.shiftKey}}static getWindowsDisplayText(t){let e="";return t.ctrlKey&&(e+="Ctrl+"),t.altKey&&(e+="Alt+"),t.shiftKey&&(e+="Shift+"),t.keyValue==="Escape"?e+="Esc":t.keyValue!==null&&(e+=t.keyValue),e}static getMacDisplayText(t){let e="";switch(t.ctrlKey&&(e+="\u2303"),t.altKey&&(e+="\u2325"),t.shiftKey&&(e+="\u21E7"),t.metaKey&&(e+="\u2318"),t.keyValue){case"Enter":e+="\u23CE";break;case"Escape":e+="\u238B";break;case"Backspace":e+="\u232B";break;case"Delete":e+="\u2326";break;case null:break;default:e+=t.keyValue}return e}static doKeyStatesMatch(t,e){var n,s;return((n=t.keyValue)==null?void 0:n.toUpperCase())===((s=e.keyValue)==null?void 0:s.toUpperCase())&&t.altKey===e.altKey&&t.ctrlKey===e.ctrlKey&&t.metaKey===e.metaKey&&t.shiftKey===e.shiftKey}static getDisplayText(t){return t.keyValue===null?"":ft.isMacPlatform?ft.getMacDisplayText(t):ft.getWindowsDisplayText(t)}getDisplayText(){return ft.getDisplayText(this.keyState)}getKeyState(){return this.keyState}setKeyState(t){ft.isValidKeyState(t)?(zc.debug2(`Shortcut ${this.id} updated to ${JSON.stringify(t)}`),this.keyState=t,this.dispatchEvent(new Ge("onUpdate",{detail:this}))):zc.debug2(`Shortcut ${this.id} tried to update to invalid keyState ${JSON.stringify(t)}`)}getDefaultKeyState(){return this.defaultKeyState}isDefault(){return ft.doKeyStatesMatch(this.getDefaultKeyState(),this.getKeyState())}setToNull(){this.setKeyState(ft.NULL_KEY_STATE)}isNull(){return ft.doKeyStatesMatch(this.keyState,ft.NULL_KEY_STATE)}setToDefault(){this.setKeyState(this.defaultKeyState)}matchesKeyState(t){return ft.doKeyStatesMatch(t,this.keyState)}matchesEvent(t){return this.matchesKeyState(ft.getKeyStateFromEvent(t))}};let Kt=ft;Kt.NULL_KEY_STATE={metaKey:!1,shiftKey:!1,altKey:!1,ctrlKey:!1,keyValue:null};Kt.isMacPlatform=We.isMacPlatform();const Gc=X.module("ShortcutRegistry");class KC extends hl{constructor(){super(...arguments),this.shortcutMap=new Map,this.shortcutsByCategory=new Map}createAndAdd(e){const n=new Kt(e);return this.add(n)}add(e){var i;const n=this.shortcutMap.get(e.id);if(n)return Gc.warn(`Skipping attempt to add duplicate shortcut ID to registry: ${e.id}`),n;Gc.debug2(`Adding shortcut to registry: ${e.id}`),e.addEventListener("onUpdate",({detail:o})=>this.dispatchEvent(new Ge("onUpdate",{detail:o})));const s=e.id.split(".")[0];return this.shortcutMap.set(e.id,e),this.shortcutsByCategory.has(s)?(i=this.shortcutsByCategory.get(s))==null||i.push(e):this.shortcutsByCategory.set(s,[e]),e}get(e){return this.shortcutMap.get(e)}getConflictingShortcuts(e){return Array.from(this.shortcutMap.values()).filter(n=>!n.isNull()&&n.matchesKeyState(e))}}const Ae=Object.freeze(new KC),ms={COPY:Ae.createAndAdd({id:"GLOBAL.COPY",name:"Copy",shortcut:[de.CTRL,me.C],macShortcut:[de.CMD,me.C],isEditable:!1}),PASTE:Ae.createAndAdd({id:"GLOBAL.PASTE",name:"Paste",shortcut:[de.CTRL,me.V],macShortcut:[de.CMD,me.V],isEditable:!1}),SAVE:Ae.createAndAdd({id:"GLOBAL.SAVE",name:"Save",shortcut:[de.CTRL,me.S],macShortcut:[de.CMD,me.S],isEditable:!1}),SELECT_ALL:Ae.createAndAdd({id:"GLOBAL.SELECT_ALL",name:"Select All",shortcut:[de.CTRL,me.A],macShortcut:[de.CMD,me.A],isEditable:!1}),LINKER:Ae.createAndAdd({id:"GLOBAL.LINKER",name:"Linker",shortcut:[de.CTRL,me.L],macShortcut:[de.CMD,me.L]}),LINKER_CLOSE:Ae.createAndAdd({id:"GLOBAL.LINKER_CLOSE",name:"Close Linker Overlay",shortcut:[me.ESCAPE],macShortcut:[me.ESCAPE],isEditable:!1})};const Tl=Y.forwardRef((t,e)=>{const{children:n,className:s,disabled:i,isLinked:o,isLinkedSource:r,isInvalid:l,onClick:a,onMouseEnter:d,onMouseLeave:c,style:u,"data-testid":m}=t;return v("button",{ref:e,type:"button",className:W("btn-socketed",{"btn-socketed-linked":o!==void 0&&o||r},{"btn-socketed-linked-source":r},{"is-invalid":l},s),onClick:a,onMouseEnter:d,onMouseLeave:c,style:u,disabled:i,"data-testid":m,children:[n,h(j,{icon:ld,className:"linked btn-socketed-icon",transform:"down-1"}),h(j,{icon:Xf,className:"is-invalid btn-socketed-icon"})]})});Tl.displayName="SocketedButton";Tl.defaultProps={children:void 0,className:"",disabled:!1,isLinked:!1,isLinkedSource:!1,isInvalid:!1,onClick:void 0,onMouseEnter:void 0,onMouseLeave:void 0,style:void 0,"data-testid":void 0};const qC="_track_535ju_30",YC="_handle_535ju_13",XC="_ticks_535ju_98",Wu={"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:qC,"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:YC,ticks:XC,"tick-labels":"_tick-labels_535ju_116","tick-label":"_tick-label_535ju_116","tick-label-wrapper":"_tick-label-wrapper_535ju_132"};parseInt(Wu["handle-size"],10);parseInt(Wu["popover-width"],10);Object.freeze({ERROR:"error"});const{dh:M}=globalThis,El=R.exports.shape({name:R.exports.string.isRequired,type:R.exports.string.isRequired,description:R.exports.string,constituentType:R.exports.string}),zu=R.exports.shape({not:R.exports.func.isRequired,and:R.exports.func.isRequired,or:R.exports.func.isRequired}),jC=R.exports.shape({asc:R.exports.func.isRequired,desc:R.exports.func.isRequired,abs:R.exports.func.isRequired,column:El.isRequired,direction:R.exports.string.isRequired,isAbs:R.exports.bool.isRequired}),QC=R.exports.shape({columns:R.exports.arrayOf(El).isRequired,customColumns:R.exports.arrayOf(R.exports.string).isRequired,filter:R.exports.arrayOf(zu),addEventListener:R.exports.func.isRequired,removeEventListener:R.exports.func.isRequired,size:R.exports.number.isRequired,sort:R.exports.arrayOf(R.exports.any),copy:R.exports.func.isRequired,applyFilter:R.exports.func.isRequired,applySort:R.exports.func.isRequired,applyCustomColumns:R.exports.func.isRequired,description:R.exports.string}),ZC=R.exports.shape({columns:R.exports.arrayOf(El),filter:R.exports.arrayOf(R.exports.any),isExpanded:R.exports.func.isRequired,saveExpandedState:R.exports.func.isRequired,addEventListener:R.exports.func.isRequired,removeEventListener:R.exports.func.isRequired,size:R.exports.number.isRequired,sort:R.exports.arrayOf(R.exports.any),applyFilter:R.exports.func.isRequired,applySort:R.exports.func.isRequired}),Pr=R.exports.shape({name:R.exports.string.isRequired,type:R.exports.string.isRequired}),JC=R.exports.shape({created:R.exports.arrayOf(Pr).isRequired,updated:R.exports.arrayOf(Pr).isRequired,removed:R.exports.arrayOf(Pr).isRequired}),eb=R.exports.shape({groupingColumns:R.exports.arrayOf(R.exports.string),aggregations:R.exports.shape({}),includeConstituents:R.exports.bool,includeOriginalColumns:R.exports.bool,includeDescriptions:R.exports.bool}),tb=R.exports.shape({addEventListener:R.exports.func.isRequired,removeEventListener:R.exports.func.isRequired,onLogMessage:R.exports.func,getTable:R.exports.func.isRequired,runCode:R.exports.func.isRequired});Object.freeze({Column:El,FilterCondition:zu,IdeSession:tb,RollupConfig:eb,Sort:jC,Table:QC,TreeTable:ZC,VariableChanges:JC,VariableDefinition:Pr});function Gu({type:t}){switch(t){case M.VariableType.TABLE:case M.VariableType.TABLEMAP:case M.VariableType.TREETABLE:case M.VariableType.HIERARCHICALTABLE:return h(j,{icon:pd});case M.VariableType.FIGURE:return h(j,{icon:pu});case M.VariableType.PANDAS:return h(j,{icon:oC});default:return h(j,{icon:Ma})}}class yl extends S.exports.Component{constructor(e){super(e),this.container=null}componentDidMount(){this.colorize()}colorize(){const{children:e}=this.props;this.container&&e!=null&&as.colorizeElement(this.container,{theme:"dh-dark"})}render(){const{children:e,language:n}=this.props;return h("div",{children:h("div",{"data-lang":n,ref:s=>{this.container=s},style:{pointerEvents:"none"},children:e})})}}class Ku{static get LANGUAGE_MAP(){return new Map([["python","Python"],["groovy","Groovy"],["scala","Scala"]])}}class Wi{static hasComment(e){return e.comment!==void 0}static hasPattern(e){return e.pattern!==void 0}static hasOp(e){return e.op!==void 0}static parseArguments(e){return e==null||!(typeof e=="string"||e instanceof String)?[]:dg.parse(e).filter(n=>!this.hasComment(n)).map(n=>this.hasPattern(n)?n.pattern:this.hasOp(n)?n.op:`${n}`)}static formatTimestamp(e){if(e==null||!(e instanceof Date))return null;const n=`${e.getHours()}`.padStart(2,"0"),s=`${e.getMinutes()}`.padStart(2,"0"),i=`${e.getSeconds()}`.padStart(2,"0"),o=`${e.getMilliseconds()}`.padStart(3,"0");return`${n}:${s}:${i}.${o}`}static isTableType(e){return e===M.VariableType.TABLE||e===M.VariableType.TREETABLE||e===M.VariableType.HIERARCHICALTABLE}static isWidgetType(e){return e===M.VariableType.FIGURE||e===M.VariableType.OTHERWIDGET||e===M.VariableType.PANDAS}static isOpenableType(e){return Wi.isTableType(e)||Wi.isWidgetType(e)}static isFigureType(e){return e===M.VariableType.FIGURE}static isPandas(e){return e===M.VariableType.PANDAS}}function qu({children:t}){return v("div",{className:"console-history-item-result",children:[h("div",{className:"console-history-gutter",children:"-"}),h("div",{className:"console-history-content",children:t})]})}qu.propTypes={children:R.exports.node.isRequired};class Yu extends S.exports.Component{constructor(e){super(e),this.updateElapsed=this.updateElapsed.bind(this),this.startTime=Date.now(),this.state={elapsed:0}}componentDidMount(){this.timer=setInterval(this.updateElapsed,1e3)}componentWillUnmount(){this.timer&&clearInterval(this.timer),this.timer=void 0}updateElapsed(){this.setState({elapsed:Math.round((Date.now()-this.startTime)/1e3)})}render(){const{disabled:e,onCancelClick:n}=this.props,{elapsed:s}=this.state;return h("div",{className:W("console-history-result-in-progress",{disabled:e}),children:v("span",{className:"badge",children:[h(On,{}),"\xA0Running... ",Dn.formatElapsedTime(s),"\xA0",h(z,{className:"console-history-result-in-progress-cancel",kind:"ghost",icon:Xi,tooltip:"Cancel",onClick:n,disabled:e})]})})}}Yu.defaultProps={disabled:!1};const _a=class extends S.exports.PureComponent{constructor(t){super(t),this.handleKeyPress=this.handleKeyPress.bind(this),this.handleMouseDown=this.handleMouseDown.bind(this),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleMouseUp=this.handleMouseUp.bind(this),this.handleToggleError=this.handleToggleError.bind(this),this.handleMouseEnter=this.handleMouseEnter.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.mouseX=null,this.mouseY=null,this.isClicking=!1,this.state={isExpanded:!1,isTriggerHovered:!1}}handleKeyPress(t){switch(t.key){case"Enter":case" ":this.handleToggleError(),t.stopPropagation(),t.preventDefault();break}}handleMouseDown(t){this.mouseX=t.clientX,this.mouseY=t.clientY,this.isClicking=!0}handleMouseMove(t){this.mouseX!=null&&this.mouseY!=null?(Math.abs(t.clientX-this.mouseX)>=_a.mouseDragThreshold||Math.abs(t.clientY-this.mouseY)>=_a.mouseDragThreshold)&&(this.isClicking=!1):this.isClicking&&(this.isClicking=!1)}handleMouseUp(t){this.isClicking&&!t.shiftKey&&!t.metaKey&&!t.altKey&&this.handleToggleError(),this.mouseX=null,this.mouseY=null,this.isClicking=!1}handleToggleError(){this.setState(t=>({isExpanded:!t.isExpanded}))}handleMouseEnter(){this.setState({isTriggerHovered:!0})}handleMouseLeave(){this.setState({isTriggerHovered:!1})}render(){const{isExpanded:t,isTriggerHovered:e}=this.state,{message:n}=this.props;P(n);const s=n.indexOf(`
|
|
7
7
|
`),i=s>-1;let o=n;i&&(o=n.slice(0,s));const r=n.slice(s),l=e?"error-btn-link error-btn-link--active":"error-btn-link";return v("div",{className:W("error-message",{expanded:t}),children:[i&&v(ye,{children:[h("div",{className:"error-gutter",children:h("button",{type:"button",onClick:this.handleToggleError,className:l,tabIndex:-1,children:h(j,{icon:t?Gn:wu,transform:"left-3"})})}),v("div",{className:"error-content",children:[h("div",{className:"console-error-text-trigger",role:"button",tabIndex:0,onKeyPress:this.handleKeyPress,onMouseDown:this.handleMouseDown,onMouseMove:this.handleMouseMove,onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave,onMouseUp:this.handleMouseUp,children:o}),t?r:""]})]}),!i&&h("div",{className:"error-content",children:h("div",{className:"console-error-text",children:o})})]},"error")}};let bd=_a;bd.defaultProps={message:""};bd.mouseDragThreshold=5;const Kc=X.module("ConsoleHistoryItem");class Xu extends S.exports.PureComponent{constructor(e){super(e),this.handleCancelClick=this.handleCancelClick.bind(this),this.handleObjectClick=this.handleObjectClick.bind(this)}handleObjectClick(e){Kc.debug("handleObjectClick",e);const{openObject:n}=this.props;n(e)}handleCancelClick(){const{item:e}=this.props;e!=null&&e.cancelResult&&(Kc.debug(`Cancelling command: ${e.command}`),e.cancelResult())}render(){var c;const{disabled:e,item:n,language:s}=this.props,{disabledObjects:i,result:o}=n;let r=null;n.command!=null&&n.command!==""&&(r=v("div",{className:"console-history-item-command",children:[h("div",{className:"console-history-gutter",children:">"}),h("div",{className:"console-history-content",children:h(yl,{language:s,children:n.command})})]}));const l=[];let a=!1;if(o){const{error:u,message:m,changes:p}=o;if(p){const{created:g,updated:f}=p;[...g,...f].forEach(b=>{a=!0;const{title:C}=b,w=`${C}`,T=e===void 0||e||(i!=null?i:[]).indexOf(w)>=0,y=h(z,{kind:"primary",onClick:()=>this.handleObjectClick(b),className:"btn-console-object",disabled:T,icon:h(Gu,{type:b.type}),children:C},w);l.push(y)})}if(u!=null&&n.command==null){let g=`${(c=u.message)!=null?c:u}`;g||(g=u);const f=h(bd,{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(Yu,{onCancelClick:this.handleCancelClick,disabled:e},"in_progress");l.push(u)}let d=null;return l.length>0&&(d=h(qu,{children:l})),v("div",{className:W("console-command-result",{"console-result-buttons":a}),children:[r,d]})}}Xu.defaultProps={disabled:!1};const ju=class extends S.exports.Component{static itemKey(t,e){return`${t}.${e.command}.${e.result&&e.result.message}.${e.result&&e.result.error}`}render(){const{disabled:t,items:e,language:n,openObject:s}=this.props,i=[];for(let o=0;o<e.length;o+=1){const r=e[o],l=h(Xu,{disabled:t,item:r,openObject:s,language:n},ju.itemKey(o,r));i.push(l)}return h("div",{className:"container-fluid console-history",children:i})}};let Qu=ju;Qu.defaultProps={disabled:!1};const nb={name:"Console",CLEAR:Ae.createAndAdd({id:"CONSOLE.CLEAR",name:"Clear",shortcut:[de.CTRL,me.L],macShortcut:[de.CTRL,me.C]}),FOCUS_HISTORY:Ae.createAndAdd({id:"CONSOLE.FOCUS_HISTORY",name:"Focus History",shortcut:[de.CTRL,me.H],macShortcut:[de.CTRL,de.OPTION,me.H]})},sb={name:"Command History",FOCUS_HISTORY:Ae.createAndAdd({id:"COMMAND_HISTORY.FOCUS_HISTORY",name:"Focus History Search",shortcut:[de.CTRL,me.H],macShortcut:[de.CTRL,de.OPTION,me.H]}),SEND_TO_CONSOLE:Ae.createAndAdd({id:"COMMAND_HISTORY.SEND_TO_CONSOLE",name:"Send to Console",shortcut:[me.ENTER],macShortcut:[me.ENTER]}),SEND_TO_NOTEBOOK:Ae.createAndAdd({id:"COMMAND_HISTORY.SEND_TO_NOTEBOOK",name:"Send to Notebook",shortcut:[de.CTRL,me.ENTER],macShortcut:[de.CMD,me.ENTER]}),RUN:Ae.createAndAdd({id:"COMMAND_HISTORY.RUN",name:"Run",shortcut:[de.ALT,me.R],macShortcut:[de.OPTION,me.R]})},ib={name:"Notebook",RUN:Ae.createAndAdd({id:"NOTEBOOK.RUN",name:"Run",shortcut:[de.ALT,me.R],macShortcut:[de.OPTION,me.R]}),RUN_SELECTED:Ae.createAndAdd({id:"NOTEBOOK.RUN_SELECTED",name:"Run Selected",shortcut:[de.ALT,de.SHIFT,me.R],macShortcut:[de.OPTION,de.SHIFT,me.R]}),FIND:Ae.createAndAdd({id:"NOTEBOOK.FIND",name:"Find",shortcut:[de.CTRL,me.F],macShortcut:[de.CMD,me.F],isEditable:!1}),MINIMAP:Ae.createAndAdd({id:"NOTEBOOK.MINIMAP",name:"Show Minimap",shortcut:[de.ALT,me.M],macShortcut:[de.OPTION,me.M]}),WORDWRAP:Ae.createAndAdd({id:"NOTEBOOK.WORDWRAP",name:"Word Wrap",shortcut:[de.ALT,me.Z],macShortcut:[de.OPTION,me.Z]})},Bt={CONSOLE:nb,COMMAND_HISTORY:sb,NOTEBOOK:ib},vt=Object.freeze({FATAL:"FATAL",STDERR:"STDERR",ERROR:"ERROR",WARN:"WARN",STDOUT:"STDOUT",INFO:"INFO",DEBUG:"DEBUG",TRACE:"TRACE"}),ob="#2d2a2e",rb="#fcfcfa",lb="#fcd65b",ab="#b2b1b2",db="#9edc6f",cb="#76d9e4",hb="#f95d84",ub="#aa9af4",mb="#f95d84",pb="#fcfcfa",gb="#7c7b7c",we={"error-foreground":"#f95d84",background:ob,foreground:rb,"line-height":"19px",string:lb,"string-delim":"#929192",delimiter:ab,predefined:db,keyword:cb,storage:hb,number:ub,operator:mb,identifier:pb,"namespace-identifier":"#f95d84","identifier-js":"#fcd65b",comment:gb,"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"},fb="python",Cb={comments:{lineComment:"#",blockComment:["'''","'''"]},brackets:[["{","}"],["[","]"],["(",")"]],autoClosingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"',notIn:["string"]},{open:"'",close:"'",notIn:["string","comment"]}],surroundingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}],onEnterRules:[{beforeText:/^\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/}}},bb={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"]]}},Sb={id:fb,conf:Cb,language:bb},wb="groovy",vb={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/}}},Tb={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"]]}},Eb={id:wb,conf:vb,language:Tb},yb="scala",Ib={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>))/}}},Rb={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"]]}},Db={id:yb,conf:Ib,language:Rb},Mb="deephavenDb",Nb={comments:{lineComment:"#",blockComment:["'''","'''"]},brackets:[["{","}"],["[","]"],["(",")"]],autoClosingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"',notIn:["string"]},{open:"'",close:"'",notIn:["string","comment"]}],surroundingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}],onEnterRules:[{beforeText:/^\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/}}},Fb={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"]]}},xb={id:Mb,conf:Nb,language:Fb},_b="log",kb={},Ob={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"}]]}},Lb={id:_b,conf:kb,language:Ob},Hn=X.module("MonacoUtils");class st{static init({getWorker:e}={}){Hn.debug("Initializing Monaco..."),e!==void 0&&st.registerGetWorker(e);const{registerLanguages:n,removeHashtag:s}=st,i=[{token:"",foreground:s(we.foreground)},{token:"string",foreground:s(we.string)},{token:"string.delim",foreground:s(we["string-delim"])},{token:"keyword",foreground:s(we.keyword)},{token:"identifier.js",foreground:s(we["identifier-js"])},{token:"delimiter",foreground:s(we.delimiter)},{token:"comment",foreground:s(we.comment)},{token:"number",foreground:s(we.number)},{token:"storage",foreground:s(we.storage)},{token:"identifier",foreground:s(we.identifier)},{token:"namespace.identifier",foreground:s(we["namespace-identifier"])},{token:"operator",foreground:s(we.operator)},{token:"predefined",foreground:s(we.predefined)},{token:"error.log",foreground:we["log-error"].substring(1)},{token:"warn.log",foreground:s(we["log-warn"])},{token:"info.log",foreground:s(we["log-info"])},{token:"stdout.log",foreground:s(we["log-stdout"])},{token:"trace.log",foreground:s(we["log-trace"])},{token:"debug.log",foreground:s(we["log-debug"])},{token:"date.log",foreground:s(we["log-date"])}],o={errorForeground:we["error-foreground"],"inputOption.activeBorder":we["input-option-active-border"],"editor.background":we.background,"editor.foreground":we.foreground,"editor.lineHighlightBackground":we["editor-line-highlight-bg"],"editorLineNumber.foreground":we["editor-line-number-foreground"],"editor.selectionBackground":we["editor-selection-background"],"editor.findMatchBackground":we["editor-find-match-background"],"editor.findMatchHighlightBackground":we["editor-find-match-highlight-background"],"editorSuggestWidget.background":we["editor-suggest-widget-background"],"editorSuggestWidget.border":we["editor-suggest-widget-border"],"editorSuggestWidget.foreground":we["editor-suggest-widget-foreground"],"editorSuggestWidget.selectedBackground":we["editor-suggest-widget-selected-background"],"editorSuggestWidget.highlightForeground":we["editor-suggest-widget-highlightForeground"],"list.hoverBackground":we["list-hover-background"],"dropdown.background":we["context-menu-background"],"dropdown.foreground":we["context-menu-foreground"],"menu.selectionBackground":we["menu-selection-background"],"list.focusBackground":we["menu-selection-background"],"editorWidget.background":we["editor-widget-background"],"inputOption.activeBackground":we["input-option-active-background"],"inputOption.activeForeground":we["input-option-active-foreground"],focusBorder:we["focus-border"],"input.background":we["input-background"],"input.foreground":we["input-foreground"],"input.border":we["input-border"]};as.defineTheme("dh-dark",{base:"vs-dark",inherit:!0,rules:i,colors:o}),Hn.debug2("monaco theme: ",we),as.setTheme("dh-dark"),n([xb,Sb,Eb,Lb,Db]),Hn.debug("Monaco initialized.")}static registerGetWorker(e){window.MonacoEnvironment={...window.MonacoEnvironment,getWorker:e}}static removeHashtag(e){return e.substring(1)}static registerLanguages(e){const n=e.map(({id:s})=>s);Mi.getLanguages().filter(({id:s})=>n.includes(s)).forEach(s=>{const i=s;Hn.debug2("Overriding default language loader:",i.id)}),e.forEach(s=>{st.registerLanguage(s)})}static registerLanguage(e){Hn.debug2("Registering language: ",e.id),Mi.register(e),Mi.onLanguage(e.id,()=>{Mi.setLanguageConfiguration(e.id,e.conf),Mi.setMonarchTokensProvider(e.id,e.language)})}static setEOL(e,n=as.EndOfLineSequence.LF){var s;(s=e.getModel())==null||s.setEOL(n)}static openDocument(e,n){const s=e.getModel();P(s);const i={textDocument:{uri:`${s.uri}`,languageId:s.getLanguageId(),version:s.getVersionId(),text:s.getValue()}};return Hn.debug2("didOpenDocumentParams: ",i),n.openDocument(i),e.onDidChangeModelContent(r=>{const{changes:l,versionId:a}=r,d=[];for(let c=0;c<l.length;c+=1){const u=l[c],{range:m,rangeLength:p,text:g}=u,f={range:{start:{line:m.startLineNumber-1,character:m.startColumn-1},end:{line:m.endLineNumber-1,character:m.endColumn-1}},rangeLength:p,text:g};d.push(f)}if(d.length>0){const c={textDocument:{version:a,uri:`${s.uri}`},contentChanges:d};Hn.debug2("didChangeDocumentParams",c),n.changeDocument(c)}})}static closeDocument(e,n){const s=e.getModel();P(s);const i={textDocument:{uri:`${s.uri}`}};n.closeDocument(i)}static registerPasteHandler(e){e.onDidPaste(n=>{const s=/“|”/g,i=/\u200b/g,o=/\u00A0/g,r=e.getModel();P(r);const l=r.getValueInRange(n.range);(s.test(l)||i.test(l)||o.test(l))&&r.applyEdits([{range:n.range,text:l.replace(s,'"').replace(i,"").replace(o," ")}])})}static isMacPlatform(){const{platform:e}=window.navigator;return e.startsWith("Mac")}static removeConflictingKeybindings(e){const n=[{windows:"ctrl+D",mac:"meta+D"},{windows:"ctrl+H"}];try{n.forEach(s=>{st.isMacPlatform()&&s.mac===""||!st.isMacPlatform()&&s.windows===""||st.removeKeybinding(e,st.isMacPlatform()?s.mac:s.windows)})}catch(s){Hn.error(s)}}static removeKeybinding(e,n){if(n===void 0)return;const s=e._standaloneKeybindingService._getResolver()._map.get(n);s!=null?s.forEach(i=>{Hn.debug2(`Removing Monaco keybinding ${n} for ${i.command}`),e._standaloneKeybindingService.addDynamicKeybinding(`-${i.command}`,null,()=>{})}):Hn.warn(`Did not find any keybindings to remove for ${n}`)}static getMonacoKeyCodeFromShortcut(e){const{keyState:n}=e,{keyValue:s}=n;return s===null?0:st.isMacPlatform()?(n.metaKey?gn.CtrlCmd:0)|(n.shiftKey?gn.Shift:0)|(n.altKey?gn.Alt:0)|(n.ctrlKey?gn.WinCtrl:0)|yc.fromString(s):(n.ctrlKey?gn.CtrlCmd:0)|(n.shiftKey?gn.Shift:0)|(n.altKey?gn.Alt:0)|(n.metaKey?gn.WinCtrl:0)|yc.fromString(s)}}const qc=X.module("MonacoCompletionProvider");class Zu extends S.exports.PureComponent{constructor(e){super(e),this.handleCompletionRequest=this.handleCompletionRequest.bind(this)}componentDidMount(){const{language:e}=this.props;this.registeredCompletionProvider=Mi.registerCompletionItemProvider(e!=null?e:"",{provideCompletionItems:this.handleCompletionRequest,triggerCharacters:['"',".","'","(","[","{",","]})}componentWillUnmount(){var e;(e=this.registeredCompletionProvider)==null||e.dispose()}handleCompletionRequest(e,n,s){const{model:i,session:o}=this.props;if(e!==i)return null;const r={textDocument:{uri:`${e.uri}`,version:e.getVersionId()},position:{line:n.lineNumber-1,character:n.column-1},context:s},l=o.getCompletionItems(r);return qc.debug("Completion items received: ",r,l),l.then(d=>{const c=d.map(u=>{const{label:m,kind:p,detail:g,documentation:f,sortText:b,filterText:C,textEdit:w,insertTextFormat:T}=u,{start:y,end:E}=w.range,I={startLineNumber:y.line+1,startColumn:y.character+1,endLineNumber:E.line+1,endColumn:E.character+1};return{label:m,kind:p,detail:g,documentation:f,sortText:b,filterText:C,insertText:w.text,insertTextRules:T===2?4:T,range:I}});return{incomplete:!0,suggestions:c}}).catch(d=>(qc.error("There was an error retrieving completion items",d),{suggestions:[]}))}render(){return null}}const la=X.module("ConsoleInput"),Xr=parseInt(we["line-height"],10),Ju=6,em=6,Ab=Xr+Ju+em,aa=100,tm=class extends S.exports.PureComponent{constructor(t){super(t),this.handleWindowResize=this.handleWindowResize.bind(this),this.commandContainer=Y.createRef(),this.commandHistoryIndex=null,this.timestamp=Date.now(),this.bufferIndex=0,this.history=[],this.modifiedCommands=new Map,this.state={commandEditorHeight:Xr,isFocused:!1,model:null}}componentDidMount(){this.initCommandEditor(),window.addEventListener("resize",this.handleWindowResize),this.loadMoreHistory()}componentDidUpdate(){this.layoutEditor()}componentWillUnmount(){window.removeEventListener("resize",this.handleWindowResize),this.loadingPromise!=null&&this.loadingPromise.cancel(),this.destroyCommandEditor()}setConsoleText(t,e=!0,n=!1){var s;!t||(la.debug("Command received: ",t),n||(this.commandHistoryIndex=null,(s=this.commandEditor)==null||s.setValue(t)),e&&this.focusEnd(),this.updateDimensions(),n&&this.processCommand(t))}initCommandEditor(){const{language:t,session:e}=this.props,n={copyWithSyntaxHighlighting:!1,cursorStyle:"block",fixedOverflowWidgets:!0,folding:!1,fontFamily:"Fira Mono",glyphMargin:!1,language:t,lineHeight:Xr,lineDecorationsWidth:3,lineNumbers:"off",minimap:{enabled:!1},renderLineHighlight:"none",scrollBeyondLastLine:!1,scrollbar:{arrowSize:0,horizontal:"hidden",horizontalScrollbarSize:0},padding:{top:Ju,bottom:em},tabCompletion:"on",value:"",wordWrap:"on"},s=this.commandContainer.current;P(s),this.commandEditor=as.create(s,n),st.setEOL(this.commandEditor),st.openDocument(this.commandEditor,e),this.commandEditor.onDidChangeModelContent(()=>{var o;const i=(o=this.commandEditor)==null?void 0:o.getValue();this.modifiedCommands.set(this.commandHistoryIndex,i!=null?i:null),this.updateDimensions()}),this.commandEditor.onDidFocusEditorText(()=>{this.setState({isFocused:!0})}),this.commandEditor.onDidBlurEditorText(()=>{this.setState({isFocused:!1})}),this.commandEditor.onKeyDown(i=>{var c,u,m;const{commandEditor:o,commandHistoryIndex:r}=this,l=o==null?void 0:o.getPosition();P(l);const{lineNumber:a}=l,d=o==null?void 0:o.getModel();if(i.keyCode===zn.UpArrow&&!this.isSuggestionMenuPopulated()&&a===1){r!=null?this.loadCommand(r+1):this.loadCommand(0),this.focusStart(),i.stopPropagation(),i.preventDefault();return}if(i.keyCode===zn.DownArrow&&!this.isSuggestionMenuPopulated()&&a===(d==null?void 0:d.getLineCount())){r!=null&&r>0?this.loadCommand(r-1):this.loadCommand(null),this.focusEnd(),i.stopPropagation(),i.preventDefault();return}if(!i.altKey&&!i.shiftKey&&!i.metaKey)if(i.keyCode===zn.Enter){if(!this.isSuggestionMenuPopulated()){i.stopPropagation(),i.preventDefault();const p=(c=this.commandEditor)==null?void 0:c.getValue().trim();p!==void 0&&(this.processCommand(p),(u=this.commandEditor)==null||u.setValue(""))}}else i.keyCode===zn.Tab&&(this.isSuggestionMenuActive()?this.isSuggestionMenuPopulated()||(i.stopPropagation(),i.preventDefault()):(i.stopPropagation(),i.preventDefault(),(m=this.commandEditor)==null||m.trigger("Tab key trigger suggestions","editor.action.triggerSuggest",{})))}),this.commandEditor.addCommand(gn.CtrlCmd|zn.KeyF,()=>{}),st.removeConflictingKeybindings(this.commandEditor),st.registerPasteHandler(this.commandEditor),this.commandEditor.focus(),this.updateDimensions(),this.setState({model:this.commandEditor.getModel()})}destroyCommandEditor(){const{session:t}=this.props;this.commandEditor&&(st.closeDocument(this.commandEditor,t),this.commandEditor.dispose(),this.commandEditor=void 0)}handleWindowResize(){this.updateDimensions()}isSuggestionMenuActive(){var t,e,n;return this.commandSuggestionContainer||(this.commandSuggestionContainer=(e=(t=this.commandEditor)==null?void 0:t.getDomNode())==null?void 0:e.querySelector(".suggest-widget")),(n=this.commandSuggestionContainer&&this.commandSuggestionContainer.classList.contains("visible"))!=null?n:!1}isSuggestionMenuPopulated(){var t,e,n;return this.isSuggestionMenuActive()&&((n=(e=(t=this.commandSuggestionContainer)==null?void 0:t.querySelector(".monaco-list-rows"))==null?void 0:e.childElementCount)!=null?n:0)>0}focus(){var t;(t=this.commandEditor)==null||t.focus()}focusStart(){var s,i,o,r,l;const t=(s=this.commandEditor)==null?void 0:s.getModel();P(t);const e=t.getLineLength(1)+1,n=(i=this.commandEditor)==null?void 0:i.getTopForPosition(1,e);P(n),(o=this.commandEditor)==null||o.setPosition({lineNumber:1,column:e}),(r=this.commandEditor)==null||r.setScrollTop(n),(l=this.commandEditor)==null||l.focus()}focusEnd(){var i,o,r,l,a;const t=(i=this.commandEditor)==null?void 0:i.getModel();P(t);const e=t.getLineCount(),n=t.getLineLength(e)+1,s=(o=this.commandEditor)==null?void 0:o.getTopForPosition(e,n);P(s),(r=this.commandEditor)==null||r.setPosition({lineNumber:e,column:n}),(l=this.commandEditor)==null||l.setScrollTop(s),(a=this.commandEditor)==null||a.focus()}clear(){var t,e,n;(t=this.commandEditor)==null||t.focus(),(n=(e=this.commandEditor)==null?void 0:e.getModel())==null||n.setValue(""),this.commandHistoryIndex=null}layoutEditor(){this.commandEditor&&this.commandEditor.layout()}loadCommand(t){var s,i;if(t===null||t>=this.history.length)return;const e=this.modifiedCommands.get(t),n=t===null?"":this.history[this.history.length-t-1];this.commandHistoryIndex=t,(i=(s=this.commandEditor)==null?void 0:s.getModel())==null||i.setValue(e!=null?e:n),t!==null&&t>this.history.length-aa&&this.loadMoreHistory()}async loadMoreHistory(){try{if(this.loadingPromise!=null||this.bufferIndex==null)return;const{commandHistoryStorage:t,language:e,scope:n}=this.props;this.loadingPromise=Te.makeCancelable(t.getTable(e,n!=null?n:"",this.timestamp),o=>o.close());const s=await this.loadingPromise;s.setReversed(!0),s.setViewport({top:this.bufferIndex,bottom:this.bufferIndex+aa-1}),this.loadingPromise=Te.makeCancelable(s.getViewportData(),()=>s.close());const i=await this.loadingPromise;this.bufferIndex+=aa,this.bufferIndex>=s.size&&(this.bufferIndex=null),this.history=[...i.items.filter(({name:o},r,l)=>r===0||o!==l[r-1].name).map(({name:o})=>o).reverse(),...this.history],this.loadingPromise=void 0,s.close()}catch(t){if(this.loadingPromise=void 0,Te.isCanceled(t)){la.debug2("Promise canceled, not loading history");return}la.error("Error fetching history",t)}}processCommand(t){this.commandHistoryIndex=null,this.modifiedCommands.clear(),P(t),t!==""&&(this.history.length===0||t!==this.history[this.history.length-1])&&this.history.push(t),this.updateDimensions();const{onSubmit:e}=this.props;e(t)}updateDimensions(){if(!this.commandEditor)return;const{maxHeight:t}=this.props;P(t);const e=this.commandEditor.getContentHeight(),n=Math.max(Math.min(e,t),Ab),i={overviewRulerLanes:e>n?void 0:0};this.setState({commandEditorHeight:n},()=>{var o,r;(o=this.commandEditor)==null||o.updateOptions(i),(r=this.commandEditor)==null||r.layout()})}render(){const{disabled:t,language:e,session:n}=this.props,{commandEditorHeight:s,isFocused:i,model:o}=this.state;return h("div",{className:W("console-input-wrapper",{disabled:t}),children:v("div",{className:W("console-input-inner-wrapper",{focus:i}),children:[h("div",{className:tm.INPUT_CLASS_NAME,ref:this.commandContainer,style:{height:s}}),o&&h(Zu,{model:o,language:e,session:n})]})})}};let jr=tm;jr.defaultProps={maxHeight:Xr*10,scope:null,disabled:!1};jr.INPUT_CLASS_NAME="console-input";const Yc="pasted values",Pb=[/^audio.*/,/^font.*/,/^image.*/,/^video.*/],da=[".csv",".tsv",".tab",".psv",".dsv",".txt"],Xc=[".zip"],Fi=class extends S.exports.Component{constructor(t){super(t),this.getValidExtensions=pe(e=>e?[...da,...Xc]:[...da]),this.getAcceptString=pe(e=>this.getValidExtensions(e).join(", ")),this.getFileTypeErrorString=pe(e=>on.join(this.getValidExtensions(e),"or")),this.handleSelectFile=this.handleSelectFile.bind(this),this.handleFiles=this.handleFiles.bind(this),this.handleDrop=this.handleDrop.bind(this),this.unstageFile=this.unstageFile.bind(this),this.handleMenuPaste=this.handleMenuPaste.bind(this),this.handlePasteEvent=this.handlePasteEvent.bind(this),this.fileElem=Y.createRef(),this.divElem=Y.createRef(),this.state={selectedFileName:""}}static isValidDropItem(t){return t!=null&&t.kind==="file"&&!Pb.find(e=>e.test(t.type))}static isValidExtension(t,e=!1){return da.some(n=>t.endsWith(n))||e&&Xc.some(n=>t.endsWith(n))}static handleDragOver(t){t.preventDefault(),t.stopPropagation()}static getIcon(t){return t===Yc?Mc:t.endsWith(".csv")?jf:t.endsWith(".zip")?yf:Jf}componentDidMount(){var t,e;(t=this.divElem.current)==null||t.addEventListener("paste",this.handlePasteEvent),(e=this.divElem.current)==null||e.focus()}componentWillUnmount(){var t;(t=this.divElem.current)==null||t.removeEventListener("paste",this.handlePasteEvent)}handleSelectFile(){var t;this.fileElem.current&&(this.fileElem.current.value="",(t=this.fileElem.current)==null||t.click())}handleFiles(t){t.stopPropagation(),t.preventDefault();const{files:e}=t.target;e!=null&&this.handleFile(e[0])}handleDrop(t){const{allowZip:e,clearDragError:n,dragError:s}=this.props;if(t.preventDefault(),t.stopPropagation(),s!=null){n();return}if(t.dataTransfer==null||t.dataTransfer.items==null||t.dataTransfer.items.length===0)return;const i=t.dataTransfer.items[0].getAsFile();P(i),Fi.isValidExtension(i.name,e)?this.handleFile(i):this.setState({dropError:Fi.FILE_TYPE_ERROR})}unstageFile(t){const{onCancel:e}=this.props;t.stopPropagation(),t.preventDefault(),e(),this.setState({selectedFileName:"",dropError:void 0})}handleFile(t){const{onFileOpened:e}=this.props;e(t),this.setState({selectedFileName:t.name,dropError:void 0})}handleMenuPaste(){const{onPaste:t,onError:e,uploadInProgress:n}=this.props;n||navigator.clipboard.readText().then(s=>{t(s),this.setState({selectedFileName:Yc,dropError:void 0})}).catch(s=>e(s))}handlePasteEvent(t){t.stopPropagation(),t.preventDefault(),this.handleMenuPaste()}makeContextMenuItems(){const{uploadInProgress:t}=this.props;return[{title:"Paste",icon:Mc,action:this.handleMenuPaste,shortcut:ms.PASTE,disabled:t}]}render(){const{allowZip:t,dragError:e,uploadInProgress:n}=this.props,{selectedFileName:s,dropError:i}=this.state,o=e!=null?e:i,r=this.makeContextMenuItems();return v("div",{ref:this.divElem,className:"csv-overlay fill-parent-absolute",onDragOver:Fi.handleDragOver,onDrop:this.handleDrop,tabIndex:-1,children:[h(oe,{actions:r}),h("input",{ref:this.fileElem,type:"file",id:"fileElem",accept:this.getAcceptString(t),style:{display:"none"},onChange:this.handleFiles,"data-testid":"fileElem"}),!s&&(o===void 0||o==="")&&v("div",{className:"message-content",children:[h("div",{className:"message-icon",children:h(j,{icon:Qf})}),h("label",{children:"Drop file (or paste values) here to import"}),h("div",{className:"message-small",children:h("label",{children:"or"})}),h(z,{kind:"primary",onClick:this.handleSelectFile,children:"Select File..."})]}),s&&(o===void 0||o==="")&&v("div",{className:"selected-content",children:[h("div",{className:"selected-icon",children:h(j,{icon:Fi.getIcon(s)})}),v("div",{className:"selected-text",children:[h("label",{children:"Selected File"}),v("label",{className:"selected-name",children:[s,!n&&h(z,{kind:"ghost",className:"ml-2",onClick:this.unstageFile,icon:wn,tooltip:"Remove"})]})]})]}),Boolean(o)&&v("div",{className:"message-content",children:[h("div",{className:"message-icon",children:h(j,{icon:cs})}),h("label",{children:o}),o===Fi.FILE_TYPE_ERROR&&h("div",{className:"message-small",children:h("label",{children:this.getFileTypeErrorString(t)})})]})]})}};let ls=Fi;ls.defaultProps={allowZip:!1,dragError:null};ls.MULTIPLE_FILE_ERROR="Please select only one file";ls.FILE_TYPE_ERROR="Filetype not supported.";class Ne{}Ne.INTEGER="int";Ne.LONG="long";Ne.DOUBLE="double";Ne.BOOLEAN="bool";Ne.STRING="string";Ne.DATE_TIME="datetime";Ne.LOCAL_TIME="localtime";const jc="unknown",Hb=2147483647,Vb=-2147483648,Qc=/^[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]+)?$/,Zc=/^([0-9]+T)?([0-9]+):([0-9]+)(:[0-9]+)?(?:\.[0-9]{1,9})?$/;class Nt{static determineType(e,n,s){if(!e||e===s)return n;switch(n){case Ne.STRING:return Ne.STRING;case Ne.INTEGER:return Nt.checkInteger(e);case Ne.LONG:return Nt.checkLong(e);case Ne.DOUBLE:return Nt.checkDouble(e);case Ne.BOOLEAN:return Nt.checkBoolean(e);case Ne.DATE_TIME:return Nt.checkDateTime(e);case Ne.LOCAL_TIME:return Nt.checkLocalTime(e);default:return Nt.getTypeFromUnknown(e)}}static isNotParsableNumber(e){return isNaN(e)||e==="Infinity"||e==="-Infinity"}static checkInteger(e){const n=e.replace(/,/g,"");return Nt.isNotParsableNumber(n)?Ne.STRING:Nt.getNumberType(n)}static checkLong(e){const n=e.replace(/,/g,"");return Nt.isNotParsableNumber(n)?Ne.STRING:n.includes(".")?Ne.DOUBLE:Ne.LONG}static checkDouble(e){const n=e.replace(/,/g,"");return Nt.isNotParsableNumber(n)?Ne.STRING:Ne.DOUBLE}static checkBoolean(e){const n=e.toLowerCase();return n==="true"||n==="false"?Ne.BOOLEAN:Ne.STRING}static checkDateTime(e){return Qc.test(e)?Ne.DATE_TIME:Ne.STRING}static checkLocalTime(e){return Zc.test(e)?Ne.LOCAL_TIME:Ne.STRING}static getTypeFromUnknown(e){const n=e.replace(/,/g,"");if(Nt.isNotParsableNumber(n)){const s=e.toLowerCase();return s==="true"||s==="false"?Ne.BOOLEAN:Qc.test(e)&&e.includes(":")?Ne.DATE_TIME:Zc.test(e)?Ne.LOCAL_TIME:Ne.STRING}return Nt.getNumberType(n)}static getNumberType(e){if(e.includes("."))return Ne.DOUBLE;const n=e.startsWith("-")?11:10;if(e.length>n)return Ne.LONG;const s=parseInt(e,10);return s>Hb||s<Vb?Ne.LONG:Ne.INTEGER}constructor(e,n,s,i,o,r,l,a,d,c){this.onFileCompleted=e,this.file=n,this.readHeaders=s,this.nullString=o,this.onProgress=r,this.onError=l,this.chunks=0,this.totalChunks=a,this.isZip=d,this.shouldTrim=c,this.zipProgress=0,this.handleChunk=this.handleChunk.bind(this),this.handleComplete=this.handleComplete.bind(this),this.handleError=this.handleError.bind(this),this.handleNodeUpdate=this.handleNodeUpdate.bind(this),this.config={...i,error:this.handleError,chunk:this.handleChunk,complete:this.handleComplete}}parse(){const e=this.isZip?this.file.nodeStream("nodebuffer",this.handleNodeUpdate):this.file;ya.parse(e,this.config)}handleChunk(e,n){let{data:s}=e;if(!this.types){if(s==null||s.length===0){n.abort(),this.onError("Error parsing CSV: no data in file.");return}this.types=new Array(s[0].length).fill(jc),this.readHeaders&&(s=s.slice(1))}P(this.types);const i=[...this.types];s.forEach(l=>{if(l.length>=i.length){for(let a=0;a<i.length;a+=1)i[a]=Nt.determineType(this.shouldTrim?l[a].trim():l[a],i[a],this.nullString);this.types=i}else n.abort(),this.onError(`Error parsing CSV: Insufficient data in row.
|
|
8
8
|
Expected length ${i.length} but found ${l.length}.
|
|
9
9
|
Row = ${l}`)}),this.chunks+=1;let o=0;this.totalChunks>0?o=Math.round(this.chunks/this.totalChunks*50):o=Math.round(this.zipProgress/2),this.onProgress(o)&&n.abort()}handleComplete(e){const{types:n,onFileCompleted:s}=this;P(n),(e==null||!e.meta.aborted)&&s(n.map(i=>i===jc?Ne.STRING:i))}handleError(e){const{onError:n}=this;n(e)}handleNodeUpdate(e){this.zipProgress=e.percent}}const Sr=X.module("CsvParser"),Ub=650,Qr=class{static generateHeaderRecursive(t){let e="",n=t;return t>=26&&(e=e.concat(Qr.generateHeaderRecursive(Math.floor(t/26)-1)),n=t%26),e.concat(String.fromCharCode(65+n))}constructor({onFileCompleted:t,session:e,file:n,type:s,readHeaders:i=!0,onProgress:o,onError:r,timeZone:l,isZip:a}){this.onFileCompleted=t,this.session=e,this.file=n,this.isZip=a,this.type=s,this.readHeaders=i,this.timeZone=l,this.onProgress=o,this.onError=r,this.tables=[],this.chunks=0,this.totalChunks=a?0:Math.ceil(n.size/ya.LocalChunkSize),this.isComplete=!1,this.zipProgress=0,this.numConsolidated=0,this.isCancelled=!1,this.handleChunk=this.handleChunk.bind(this),this.handleError=this.handleError.bind(this),this.handleComplete=this.handleComplete.bind(this),this.handleNodeUpdate=this.handleNodeUpdate.bind(this),this.handleCreateTable=this.handleCreateTable.bind(this),this.config={delimiter:s.delimiter,newline:s.newline,escapeChar:s.escapeChar,dynamicTyping:!1,error:this.handleError,skipEmptyLines:s.skipEmptyLines,chunk:this.handleChunk,complete:this.handleComplete,fastMode:!1}}cancel(){this.isCancelled=!0}transpose(t,e){const n=e.length,s=new Array(t).fill(null).map(()=>new Array(n));for(let i=0;i<n;i+=1){const o=e[i];if(o.length<t)throw new Error(`Insufficient columns. Expected ${t} but found ${o.length}
|
|
@@ -35,7 +35,7 @@ ${e}`):s.setValue(`${e}`);const o=s.getLineCount(),r=s.getLineLength(o)+1;this.e
|
|
|
35
35
|
${fT(t)}`}function bT(t){const{rules:e=[],onChange:n=fa,onCreate:s=fa,onSelect:i=fa}=t,o=S.exports.useCallback((d,c,u)=>{d.stopPropagation(),Nh.debug("Rule clicked",c,u),i(u)},[i]),r=S.exports.useCallback((d,c,u)=>{d.stopPropagation(),Nh.debug("Delete button clicked",c,u);const m=[...e];m.splice(u,1),n(m)},[n,e]),l=S.exports.useCallback(d=>{d.stopPropagation()},[]),a=S.exports.useCallback(d=>{if(jt.stopDragging(),d.destination==null)return;const c=d.source.index,u=d.destination.index,m=[...e],p=e[c];m.splice(c,1),m.splice(u,0,p),n(m)},[n,e]);return v("div",{className:"conditional-formatting-rules",children:[h(Bo,{onDragStart:jt.startDragging,onDragEnd:a,children:h(Uo,{droppableId:"droppable-custom-columns",children:(d,c)=>v("div",{ref:d.innerRef,...d.droppableProps,className:W("droppable-container",{dragging:c.draggingFromThisWith}),children:[e.length===0&&h("div",{className:"text-muted pl-2",children:"No formats defined"}),e.map((u,m)=>h(ul,{draggableId:`${m}-${u.type}`,index:m,disableInteractiveElementBlocking:!0,children:(p,g)=>h("div",{role:"menuitem",tabIndex:0,onClick:f=>o(f,u,m),className:W("draggable-container",{dragging:g.isDragging}),ref:p.innerRef,...p.draggableProps,children:h("div",{className:"conditional-formatting-list-item",children:v("div",{className:"formatting-item",children:[h("div",{className:"rule-icon",children:h("span",{className:"rule-icon-bg",style:{backgroundColor:sl(u.config.style),color:il(u.config.style)},children:u.type===Yn.ROWS?"row":"col"})}),h("div",{className:"rule-title",children:CT(u.config)}),h(z,{kind:"ghost",className:"ml-1 px-2",onClick:f=>r(f,u,m),icon:wn,tooltip:"Delete rule"}),v("button",{type:"button",className:"btn btn-link btn-link-icon px-2 btn-drag-handle",onClick:l,...p.dragHandleProps,children:[h(Ue,{children:"Drag to re-order"}),h(j,{icon:Ko})]})]})})})},`${m}-${u.type}`)),d.placeholder]})})}),h("hr",{}),h(z,{kind:"ghost",onClick:s,icon:Ps,children:"Add New Rule"})]})}const Ii=X.module("ConditionEditor"),ST=()=>{},wT=[Xe.IS_EQUAL,Xe.IS_NOT_EQUAL,Xe.IS_BETWEEN,Xe.GREATER_THAN,Xe.GREATER_THAN_OR_EQUAL,Xe.LESS_THAN,Xe.LESS_THAN_OR_EQUAL,Xe.IS_NULL,Xe.IS_NOT_NULL].map(t=>h("option",{value:t,children:nv(t)},t)),vT=[ln.IS_EXACTLY,ln.IS_NOT_EXACTLY,ln.CONTAINS,ln.DOES_NOT_CONTAIN,ln.STARTS_WITH,ln.ENDS_WITH,ln.IS_NULL,ln.IS_NOT_NULL].map(t=>h("option",{value:t,children:sv(t)},t)),TT=[Ut.IS_EXACTLY,Ut.IS_NOT_EXACTLY,Ut.IS_BEFORE,Ut.IS_BEFORE_OR_EQUAL,Ut.IS_AFTER,Ut.IS_AFTER_OR_EQUAL,Ut.IS_NULL,Ut.IS_NOT_NULL].map(t=>h("option",{value:t,children:iv(t)},t)),ET=[Do.IS_TRUE,Do.IS_FALSE,Do.IS_NULL,Do.IS_NOT_NULL].map(t=>h("option",{value:t,children:ov(t)},t)),yT=[ri.IS_EQUAL,ri.IS_NOT_EQUAL,ri.IS_NULL,ri.IS_NOT_NULL].map(t=>h("option",{value:t,children:rv(t)},t));function IT(t,e,n,s){return t===Xe.IS_NULL||t===Xe.IS_NOT_NULL||t===Xe.IS_BETWEEN&&n!=null&&n!==""&&!Number.isNaN(Number.parseFloat(n))&&s!=null&&s!==""&&!Number.isNaN(Number.parseFloat(s))||t!==Xe.IS_BETWEEN&&e!==void 0&&e!==""&&!Number.isNaN(Number.parseFloat(e))}function RT(t,e,n,s,i,o,r){switch(t){case Xe.IS_EQUAL:case Xe.IS_NOT_EQUAL:case Xe.GREATER_THAN:case Xe.GREATER_THAN_OR_EQUAL:case Xe.LESS_THAN:case Xe.LESS_THAN_OR_EQUAL:return h("input",{type:"number",className:"form-control",placeholder:"Enter value",value:i!=null?i:"",onChange:e});case Xe.IS_BETWEEN:return v("div",{className:"d-flex flex-row",children:[h("input",{type:"number",className:"form-control d-flex mr-2",placeholder:"Start value",value:o!=null?o:"",onChange:n}),h("input",{type:"number",className:"form-control d-flex",placeholder:"End value",value:r!=null?r:"",onChange:s})]});case Xe.IS_NULL:case Xe.IS_NOT_NULL:return null}}function DT(t,e,n){switch(t){case ln.IS_NULL:case ln.IS_NOT_NULL:return null;default:return h("input",{type:"text",className:"form-control",placeholder:"Enter value",value:n!=null?n:"",onChange:e})}}function MT(t,e,n){switch(t){case Ut.IS_NULL:case Ut.IS_NOT_NULL:return null;default:return h("input",{type:"text",className:"form-control",placeholder:"Enter value",value:n!=null?n:"",onChange:e})}}function NT(){return null}function FT(t,e,n){switch(t){case ri.IS_NULL:case ri.IS_NOT_NULL:return null;default:return h("input",{type:"text",className:"form-control",maxLength:1,placeholder:"Enter value",value:n!=null?n:"",onChange:e})}}function wp(t){const{column:e,config:n,onChange:s=ST}=t,i=e.type,[o,r]=S.exports.useState(i),[l,a]=S.exports.useState(n.condition),[d,c]=S.exports.useState(n.value),[u,m]=S.exports.useState(n.start),[p,g]=S.exports.useState(n.end);i!==o&&(a(sp(i)),c(void 0),m(void 0),g(void 0),r(i));const f=S.exports.useMemo(()=>{if(i===void 0)return[];if(L.isNumberType(i))return wT;if(L.isCharType(i))return yT;if(L.isStringType(i))return vT;if(L.isDateType(i))return TT;if(L.isBooleanType(i))return ET},[i]),b=S.exports.useCallback(E=>{const{value:I}=E.target;Ii.debug("handleConditionChange",I),a(I)},[]),C=S.exports.useCallback(E=>{const{value:I}=E.target;Ii.debug("handleValueChange",I),c(I)},[]),w=S.exports.useCallback(E=>{const{value:I}=E.target;Ii.debug("handleStartValueChange",I),m(I)},[]),T=S.exports.useCallback(E=>{const{value:I}=E.target;Ii.debug("handleEndValueChange",I),g(I)},[]);S.exports.useEffect(function(){let I=!0;l===void 0&&(Ii.debug("Unable to create formatting rule. Condition is not selected."),I=!1),L.isNumberType(e.type)&&!IT(l,d,u,p)&&(Ii.debug("Unable to create formatting rule. Invalid value",d),I=!1),s({condition:l,value:d,start:u,end:p},I)},[s,e.type,l,d,u,p]);const y=S.exports.useMemo(()=>{if(i===void 0)return null;if(L.isNumberType(i))return RT(l,C,w,T,d,u,p);if(L.isCharType(i))return FT(l,C,d);if(L.isStringType(i))return DT(l,C,d);if(L.isDateType(i))return MT(l,C,d);if(L.isBooleanType(i))return NT()},[i,l,d,u,p,C,w,T]);return v("div",{className:"condition-editor mb-2",children:[h("select",{value:l,id:"condition-select",className:"custom-select mb-2",onChange:b,children:f}),y]})}const xT=X.module("StyleEditor"),_T="#fcfcfa",kT="#f0f0ee",OT="#1a171a",LT=200,AT=()=>{};function vp(t){var T,y;const{config:e,onChange:n=AT}=t,[s,i]=S.exports.useState(e.type),[o,r]=S.exports.useState((y=(T=e.customConfig)==null?void 0:T.background)!=null?y:_T),[l,a]=S.exports.useState(!1),[d,c]=S.exports.useState(LT),u=S.exports.useRef(null),m=S.exports.useCallback(E=>{const{value:I}=E.target;xT.debug("handleBackgroundChange",I),r(I)},[]),p=S.exports.useCallback(()=>{l&&a(!1)},[l]),g=S.exports.useCallback(()=>{l||b(),a(!l)},[l]),f=S.exports.useMemo(()=>[Bn.NO_FORMATTING,Bn.POSITIVE,Bn.NEGATIVE,Bn.WARN,Bn.NEUTRAL,Bn.ACCENT_1,Bn.ACCENT_2,Bn.CUSTOM],[]);function b(){u.current&&c(u.current.getBoundingClientRect().width)}S.exports.useEffect(function(){n({type:s,customConfig:{color:fl.isDark(o)?kT:OT,background:o}})},[n,s,o]);const C=S.exports.useCallback(()=>{const E=[];for(let I=0;I<f.length;I+=1){const D=f[I],F=`option-${I}-${D}`;E.push(v(z,{kind:"inline",className:"style-option-btn",onClick:()=>{i(D),a(!1)},style:{color:il({type:D}),background:sl({type:D})},children:[D===s&&h(j,{icon:ds,className:"mr-2"}),D!==s&&h("span",{className:"mr-4"}),Eh(D)]},F))}return E},[f,s]),w=S.exports.useCallback(()=>h("div",{className:"style-menu-container",role:"presentation",style:{width:d},children:h("div",{className:"style-options",children:C()})}),[d,C]);return v("div",{className:"style-editor",children:[v("div",{className:"mb-2",ref:u,children:[h("label",{className:"mb-0",children:"Style"}),v(z,{kind:"inline",className:"cs-dropdown",style:{color:il({type:s}),background:sl({type:s})},onClick:g,children:[Eh(s),h("span",{children:h(j,{icon:md,className:"cs-caret"})}),h(Fn,{isShown:l,actions:{menuElement:w()},popperOptions:{placement:"bottom-start"},popperClassName:"style-dropdown-menu",onMenuClosed:p,menuStyle:{maxWidth:"100rem"}})]})]}),s===Bn.CUSTOM&&v("div",{className:"mb-2",children:[h("label",{className:"mb-0",children:"Background"}),h("input",{type:"color",value:o,className:"custom-select color-select",onChange:m})]})]})}const fo=X.module("ColumnFormatEditor"),PT=()=>{};function HT(t){const{type:e,name:n}=t[0];return{column:{type:e,name:n},style:op(),...Ol(e)}}function VT(t){var b;const{columns:e,config:n=HT(e),onChange:s=PT}=t,[i,o]=S.exports.useState((b=e.find(C=>C.name===n.column.name&&C.type===n.column.type))!=null?b:e[0]),[r,l]=S.exports.useState(ip(n)),[a,d]=S.exports.useState(!1),[c,u]=S.exports.useState(n.style),m=S.exports.useCallback(C=>{const w=e.find(({name:T})=>T===C);w!==void 0?(o(w),i.type!==w.type&&(l(Ol(w.type)),d(!1))):fo.error(`Column ${C} not found.`)},[e,i]),p=S.exports.useCallback((C,w)=>{fo.debug("handleConditionChange",C,w),l(C),d(w)},[]),g=S.exports.useCallback(C=>{fo.debug("handleStyleChange",C),u(C)},[]);S.exports.useEffect(function(){if(i===void 0){fo.debug("Column is not selected, skip update.");return}if(c===void 0){fo.debug("Style is not selected, skip update.");return}const{type:w,name:T}=i;s({column:{type:w,name:T},style:c,...r},a)},[s,i,c,r,a]);const f=e.map(({name:C})=>({title:C,value:C}));return v("div",{className:"conditional-rule-editor form",children:[v("div",{className:"mb-2",children:[h("label",{className:"mb-0",children:"Format Cell If"}),h(Zi,{defaultValue:i==null?void 0:i.name,options:f,inputPlaceholder:"Select a column",spellCheck:!1,onChange:m,searchPlaceholder:"Filter columns"})]}),i!==void 0&&v(ye,{children:[h(wp,{column:i,config:r,onChange:p}),h(vp,{config:c,onChange:g})]})]})}const Co=X.module("RowFormatEditor"),UT=()=>{};function BT(t){const{type:e,name:n}=t[0];return{column:{type:e,name:n},style:op(),...Ol(e)}}function $T(t){var b;const{columns:e,config:n=BT(e),onChange:s=UT}=t,[i,o]=S.exports.useState((b=e.find(C=>C.name===n.column.name&&C.type===n.column.type))!=null?b:e[0]),[r,l]=S.exports.useState(ip(n)),[a,d]=S.exports.useState(!1),[c,u]=S.exports.useState(n.style),m=S.exports.useCallback(C=>{const w=e.find(({name:T})=>T===C);w!==void 0?(o(w),i.type!==w.type&&(l(Ol(w.type)),d(!1))):Co.error(`Column ${C} not found.`)},[e,i]),p=S.exports.useCallback((C,w)=>{Co.debug("handleConditionChange",C,w),l(C),d(w)},[]),g=S.exports.useCallback(C=>{Co.debug("handleStyleChange",C),u(C)},[]);S.exports.useEffect(function(){if(i===void 0){Co.debug("Column is not selected, skip update.");return}if(c===void 0){Co.debug("Style is not selected, skip update.");return}const{type:w,name:T}=i;s({column:{type:w,name:T},style:c,...r},a)},[s,i,c,r,a]);const f=e.map(({name:C})=>({title:C,value:C}));return v("div",{className:"conditional-rule-editor form",children:[v("div",{className:"mb-2",children:[h("label",{className:"mb-0",children:"Format Row If"}),h(Zi,{defaultValue:i==null?void 0:i.name,options:f,inputPlaceholder:"Select a column",spellCheck:!1,onChange:m,searchPlaceholder:"Filter columns"})]}),i!==void 0&&v(ye,{children:[h(wp,{column:i,config:r,onChange:p}),h(vp,{config:c,onChange:g})]})]})}const Ca=X.module("ConditionalFormatEditor"),ba=()=>{};function WT(t){switch(t){case Yn.CONDITIONAL:return h(iT,{});case Yn.ROWS:return h(oT,{})}}function zT(t){switch(t){case Yn.CONDITIONAL:return"Conditional";case Yn.ROWS:return"Rows"}}const Fh=[Yn.CONDITIONAL,Yn.ROWS];function GT(t){var C;const{columns:e,onSave:n=ba,onUpdate:s=ba,onCancel:i=ba,rule:o}=t,r=e.filter(wv),[l,a]=S.exports.useState((C=o==null?void 0:o.type)!=null?C:Fh[0]),[d,c]=S.exports.useState(o),[u,m]=S.exports.useState(!1),p=S.exports.useCallback(()=>{i()},[i]),g=S.exports.useCallback(()=>{if(d===void 0){Ca.error("Rule is not defined.");return}n(d)},[n,d]),f=S.exports.useCallback(w=>{Ca.debug("handleFormatterChange",w),a(w)},[]),b=S.exports.useCallback((w,T)=>{Ca.debug("handleRuleChange",w,T,l);const y={type:l,config:w};c(y),m(T),s(T?y:void 0)},[s,l]);return v("div",{className:"conditional-format-editor form",children:[v("div",{className:"mb-2",children:[h("label",{className:"mb-0",htmlFor:"formatter-select",children:"Select Formatter"}),h("div",{className:"formatter-list",children:Fh.map((w,T)=>h("div",{className:"formatter-type",children:v("button",{type:"button",className:W("btn","btn-icon","btn-formatter-type",{active:w===l}),"data-index":T,onClick:()=>f(w),children:[WT(w),zT(w)]})},w))})]}),l===Yn.CONDITIONAL&&h(VT,{columns:r,config:d==null?void 0:d.config,onChange:b}),l===Yn.ROWS&&h($T,{columns:r,config:d==null?void 0:d.config,onChange:b}),h("hr",{}),v("div",{className:"d-flex justify-content-end my-3",children:[h(z,{kind:"secondary",onClick:p,className:"mr-2",children:"Cancel"}),h(z,{kind:"primary",onClick:g,disabled:d===void 0||!u,children:"Done"})]})]})}function KT({text:t,isOpen:e,onClose:n}){var T,y;const[s,i]=S.exports.useState(!1),[o,r]=S.exports.useState(0),[l,a]=S.exports.useState(!1),[d,c]=S.exports.useState(!1),[u,m]=S.exports.useState(!1),p=S.exports.useRef();S.exports.useEffect(function(){if(!!e){try{JSON.parse(t),m(!0)}catch{m(!1)}c(!1)}},[e,t]),S.exports.useEffect(function(){p.current&&p.current.layout()},[o]),S.exports.useEffect(function(){p.current&&p.current.updateOptions({lineNumbers:l?"on":"off"})},[l]);function g(){a(!l)}function f(){var I;const E=(I=p.current)==null?void 0:I.getModel();!u||!E||(d?(E.setValue(t),c(!1)):(E.setValue(JSON.stringify(JSON.parse(t),void 0,2)),c(!0)),b())}function b(){var I,D;const E=p.current;!E||a(((D=(I=E.getModel())==null?void 0:I.getLineCount())!=null?D:0)>1)}function C(){s&&(p.current=void 0,n())}function w(E){p.current=E,E.onDidContentSizeChange(({contentHeight:I})=>r(I)),b()}return!e&&!s?null:v($o,{isOpen:e,centered:!0,keyboard:!0,toggle:C,onOpened:()=>i(!0),onClosed:()=>{i(!1),r(0)},className:"theme-bg-dark cell-overflow-modal",children:[v(zo,{toggle:n,children:[h("h5",{className:"overflow-modal-title",children:"Cell Contents"}),h(bl,{kind:"inline",tooltip:"Copy cell contents",copy:(y=(T=p.current)==null?void 0:T.getValue())!=null?y:t}),h(z,{kind:"inline",active:l,icon:kf,tooltip:"Toggle line numbers",onClick:g}),u&&h(z,{kind:"inline",icon:Ff,active:d,tooltip:"Format as JSON",onClick:f})]}),h(Wo,{style:{height:o},children:h(Il,{onEditorInitialized:w,settings:{value:t,readOnly:!0,wordWrap:"on",language:u?"typescript":"plaintext",folding:u,padding:{bottom:16},lineNumbers:l?"on":"off",overviewRulerLanes:0,renderLineHighlight:"none",find:{seedSearchStringFromSelection:"never"}}})})]})}const qT="###,##0";function YT({gotoRow:t,gotoRowError:e,onSubmit:n,isShown:s,onEntering:i,onEntered:o,onExiting:r,onExited:l,model:a,onGotoRowNumberChanged:d,onClose:c}){const u=S.exports.useRef(null),m="Row number",{rowCount:p}=a;return S.exports.useEffect(()=>{var g;document.activeElement!==u.current&&((g=u.current)==null||g.select())},[t]),h(Ll,{isShown:s,className:W("goto-row"),onEntering:i,onEntered:()=>{var g;o(),(g=u.current)==null||g.select()},onExiting:r,onExited:l,children:v(ye,{children:[v("div",{className:"goto-row-wrapper",children:[h("div",{className:"goto-row-text",children:"Go to row"}),h("div",{className:"goto-row-input",children:h("input",{ref:u,type:"number",onKeyDown:g=>{g.key==="Enter"&&(g.stopPropagation(),g.preventDefault(),n())},className:W("form-control",{"is-invalid":e!==""}),placeholder:m,onChange:g=>{d(g)},value:t})}),v("div",{className:"goto-row-text",children:["of ",dh.i18n.NumberFormat.format(qT,p)]}),e&&h("div",{className:"goto-row-error text-danger",children:e})]}),h("div",{className:"goto-row-close",children:h(z,{kind:"ghost",onClick:c,children:h(j,{icon:Xi,style:{marginRight:"0"}})})})]})})}const fe=X.module("IrisGrid"),XT=500,jT=250,QT=250,Tp=Object.freeze({aggregations:[],showOnTop:!1}),ZT="yyyy-MM-dd'T'HH:mm:ss.SSSSSSSSS z";function xh({advancedFilters:t,aggregationSettings:e,customColumns:n,quickFilters:s,reverseType:i,rollupConfig:o,searchFilter:r,selectDistinctColumns:l,sorts:a}){return t.size===0&&e.aggregations.length===0&&n.length===0&&s.size===0&&i===L.REVERSE_TYPE.NONE&&o==null&&r==null&&l.length===0&&a.length===0}const Os=class extends S.exports.Component{constructor(t){super(t),this.getAdvancedMenuOpenedHandler=ve(N=>this.handleAdvancedMenuOpened.bind(this,N),{max:100}),this.getCachedAdvancedFilterMenuActions=ve((N,k,O,V,G)=>h(Bd,{model:N,column:k,onFilterChange:this.handleAdvancedFilterChange,onSortChange:this.handleAdvancedFilterSortChange,onDone:this.handleAdvancedFilterDone,options:O,sortDirection:V,formatter:G}),{max:50}),this.getCachedOptionItems=ve((N,k,O,V,G,Q,Z,be,le,he,De,ee,ue,Se,Me,qe)=>{const ke=[];return N&&ke.push({type:_e.CHART_BUILDER,title:"Chart Builder",icon:sC}),ke.push({type:_e.VISIBILITY_ORDERING_BUILDER,title:"Column Visibility & Ordering",icon:Na}),O&&ke.push({type:_e.CONDITIONAL_FORMATTING,title:"Conditional Formatting",icon:pl}),k&&ke.push({type:_e.CUSTOM_COLUMN_BUILDER,title:"Custom Columns",icon:$f}),V&&ke.push({type:_e.ROLLUP_ROWS,title:"Rollup Rows",icon:vu}),G&&ke.push({type:_e.AGGREGATIONS,title:"Aggregate Columns",icon:Wf}),Q&&ke.push({type:_e.SELECT_DISTINCT,title:"Select Distinct Values",icon:Bf}),Z&&ue&&ke.push({type:_e.TABLE_EXPORTER,title:"Download CSV",icon:vf}),qe&&ke.push({type:_e.ADVANCED_SETTINGS,title:"Advanced Settings",icon:zf}),ke.push({type:_e.QUICK_FILTERS,title:"Quick Filters",subtitle:be.shortcut.getDisplayText(),icon:qr,isOn:De,onChange:be.action}),Se&&ke.push({type:_e.SEARCH_BAR,title:"Search Bar",subtitle:le.shortcut.getDisplayText(),icon:Su,isOn:ee,onChange:le.action}),ke.push({type:_e.GOTO,title:"Go to",subtitle:he.shortcut.getDisplayText(),icon:Uf,isOn:Me,onChange:he.action}),ke},{max:1}),this.getCachedHiddenColumns=ve(N=>N,{max:1,normalizer:([N])=>N.join()}),this.getAggregationMap=ve((N,k)=>{const O={};return k.forEach(({operation:V,selected:G,invert:Q})=>{O[V]=As.getOperationColumnNames(N,V,G,Q)}),O}),this.getOperationMap=ve((N,k)=>{const O={};return k.filter(V=>!As.isRollupOperation(V.operation)).forEach(({operation:V,selected:G,invert:Q})=>{As.getOperationColumnNames(N,V,G,Q).forEach(Z=>{var le;const be=[...(le=O[Z])!=null?le:[],V];O[Z]=be})}),O}),this.getOperationOrder=ve(N=>N.map(k=>k.operation).filter(k=>!As.isRollupOperation(k))),this.getCachedFormatColumns=ve((N,k)=>Sv(N,k)),this.getCachedModelColumns=ve((N,k)=>N.columns),this.getCachedPreviewFormatColumns=ve((N,k,O,V)=>{if(fe.debug("getCachedPreviewFormatColumns",k,O,V),O!==void 0&&V!==void 0){const G=[...k];return G[V]=O,this.getCachedFormatColumns(N,G)}return this.getCachedFormatColumns(N,k)}),this.getModelRollupConfig=ve((N,k,O)=>ne.getModelRollupConfig(N,k,O)),this.getModelTotalsConfig=ve((N,k,O)=>{var be,le,he;const{aggregations:V,showOnTop:G}=O;if(((le=(be=k==null?void 0:k.columns)==null?void 0:be.length)!=null?le:0)>0||((he=V==null?void 0:V.length)!=null?he:0)===0)return null;const Q=this.getOperationMap(N,V),Z=this.getOperationOrder(V);return{operationMap:Q,operationOrder:Z,showOnTop:G}}),this.getCachedStateOverride=ve((N,k,O,V,G,Q,Z,be,le,he)=>({hoverSelectColumn:N,isFilterBarShown:k,isSelectingColumn:O,loadingScrimProgress:V,quickFilters:G,advancedFilters:Q,sorts:Z,reverseType:be,rollupConfig:le,isMenuShown:he}),{max:1}),this.getCachedFilter=ve((N,k,O,V,G)=>[...N!=null?N:[],...V!=null?V:[],...ne.getFiltersFromFilterMap(k),...ne.getFiltersFromFilterMap(O),...G!==void 0?[G]:[]],{max:1}),this.getCachedTheme=ve((N,k,O)=>({...hp,...N,autoSelectRow:!k,rowFooterWidth:O>0?N.rowFooterWidth:0}),{max:1}),this.getAlwaysFetchColumns=ve((N,k,O,V,G,Q)=>{const Z=[];for(let le=0;le<V;le+=1)Z.push(k[K.getModelIndex(le,O)].name);for(let le=0;le<G;le+=1)Z.push(k[K.getModelIndex(k.length-1-le,O)].name);if(Q)for(let le=Q[0];le<=Q[1];le+=1)Z.push(k[K.getModelIndex(le,O)].name);return[...new Set([...N,...Z])]}),this.updateSearchFilter=je((N,k,O,V)=>{const G=Mr.createSearchFilter(N,k,O,V);this.setState({searchFilter:G})},jT),this.handleConditionalFormatEditorUpdate=je(N=>{this.setState({conditionalFormatPreview:N})},QT),this.handleDownloadProgressUpdate=us((N,k)=>{const{tableDownloadStatus:O}=this.state;O===an.DOWNLOAD_STATUS.DOWNLOADING&&this.setState({tableDownloadProgress:N,tableDownloadEstimatedTime:k})},XT),this.getOverflowButtonTooltip=ve(N=>{if(N==null)return null;const k={position:"absolute",...N,pointerEvents:"none"};return h("div",{style:k,children:h(Ue,{options:{placement:"left",modifiers:{flip:{behavior:["left","right"]}}},ref:this.handleTooltipRef,children:"View full contents"},Date.now())})}),this.handleAdvancedFilterChange=this.handleAdvancedFilterChange.bind(this),this.handleAdvancedFilterSortChange=this.handleAdvancedFilterSortChange.bind(this),this.handleAdvancedFilterDone=this.handleAdvancedFilterDone.bind(this),this.handleAdvancedMenuOpened=this.handleAdvancedMenuOpened.bind(this),this.handleGotoRowOpened=this.handleGotoRowOpened.bind(this),this.handleGotoRowClosed=this.handleGotoRowClosed.bind(this),this.handleAdvancedMenuClosed=this.handleAdvancedMenuClosed.bind(this),this.handleAggregationChange=this.handleAggregationChange.bind(this),this.handleAggregationsChange=this.handleAggregationsChange.bind(this),this.handleAggregationEdit=this.handleAggregationEdit.bind(this),this.handleAnimationLoop=this.handleAnimationLoop.bind(this),this.handleAnimationStart=this.handleAnimationStart.bind(this),this.handleAnimationEnd=this.handleAnimationEnd.bind(this),this.handleChartChange=this.handleChartChange.bind(this),this.handleChartCreate=this.handleChartCreate.bind(this),this.handleGridError=this.handleGridError.bind(this),this.handleFilterBarChange=this.handleFilterBarChange.bind(this),this.handleFilterBarDone=this.handleFilterBarDone.bind(this),this.handleFilterBarTab=this.handleFilterBarTab.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleMenu=this.handleMenu.bind(this),this.handleMenuClose=this.handleMenuClose.bind(this),this.handleMenuSelect=this.handleMenuSelect.bind(this),this.handleMenuBack=this.handleMenuBack.bind(this),this.handleRequestFailed=this.handleRequestFailed.bind(this),this.handleSelectionChanged=this.handleSelectionChanged.bind(this),this.handleMovedColumnsChanged=this.handleMovedColumnsChanged.bind(this),this.handleUpdate=this.handleUpdate.bind(this),this.handleTooltipRef=this.handleTooltipRef.bind(this),this.handleViewChanged=this.handleViewChanged.bind(this),this.handleFormatSelection=this.handleFormatSelection.bind(this),this.handleConditionalFormatCreate=this.handleConditionalFormatCreate.bind(this),this.handleConditionalFormatEdit=this.handleConditionalFormatEdit.bind(this),this.handleConditionalFormatsChange=this.handleConditionalFormatsChange.bind(this),this.handleConditionalFormatEditorSave=this.handleConditionalFormatEditorSave.bind(this),this.handleConditionalFormatEditorCancel=this.handleConditionalFormatEditorCancel.bind(this),this.handleUpdateCustomColumns=this.handleUpdateCustomColumns.bind(this),this.handleCustomColumnsChanged=this.handleCustomColumnsChanged.bind(this),this.handleSelectDistinctChanged=this.handleSelectDistinctChanged.bind(this),this.handlePendingDataUpdated=this.handlePendingDataUpdated.bind(this),this.handlePendingCommitClicked=this.handlePendingCommitClicked.bind(this),this.handlePendingDiscardClicked=this.handlePendingDiscardClicked.bind(this),this.handleGotoRowSelectedRowNumberSubmit=this.handleGotoRowSelectedRowNumberSubmit.bind(this),this.focusRowInGrid=this.focusRowInGrid.bind(this),this.handleDownloadTable=this.handleDownloadTable.bind(this),this.handleDownloadTableStart=this.handleDownloadTableStart.bind(this),this.handleCancelDownloadTable=this.handleCancelDownloadTable.bind(this),this.handleDownloadCanceled=this.handleDownloadCanceled.bind(this),this.handleDownloadCompleted=this.handleDownloadCompleted.bind(this),this.handlePartitionAppend=this.handlePartitionAppend.bind(this),this.handlePartitionChange=this.handlePartitionChange.bind(this),this.handlePartitionFetchAll=this.handlePartitionFetchAll.bind(this),this.handlePartitionDone=this.handlePartitionDone.bind(this),this.handleColumnVisibilityChanged=this.handleColumnVisibilityChanged.bind(this),this.handleCrossColumnSearch=this.handleCrossColumnSearch.bind(this),this.handleRollupChange=this.handleRollupChange.bind(this),this.handleOverflowClose=this.handleOverflowClose.bind(this),this.getColumnBoundingRect=this.getColumnBoundingRect.bind(this),this.handleGotoRowSelectedRowNumberChanged=this.handleGotoRowSelectedRowNumberChanged.bind(this),this.grid=null,this.gridWrapper=null,this.lastLoadedConfig=null,this.pending=new fs,this.globalColumnFormats=[],this.decimalFormatOptions={},this.integerFormatOptions={},this.truncateNumbersWithPound=!1,this.renderer=new xo,this.tableSaver=null,this.crossColumnRef=Y.createRef(),this.isAnimating=!1,this.filterInputRef=Y.createRef(),this.toggleFilterBarAction={action:()=>this.toggleFilterBar(),shortcut:cn.TABLE.TOGGLE_QUICK_FILTER},this.toggleSearchBarAction={action:()=>this.toggleSearchBar(),shortcut:cn.TABLE.TOGGLE_SEARCH},this.toggleGotoRowAction={action:()=>this.toggleGotoRow(),shortcut:cn.TABLE.GOTO_ROW},this.discardAction={action:()=>{const{model:N}=this.props;Je(N)&&N.isEditable&&N.pendingDataMap.size>0&&this.discardPending().catch(fe.error)},shortcut:cn.INPUT_TABLE.DISCARD},this.commitAction={action:()=>{const{model:N}=this.props;Je(N)&&N.isEditable&&N.pendingDataMap.size>0&&N.pendingDataErrors.size===0&&this.commitPending().catch(fe.error)},shortcut:cn.INPUT_TABLE.COMMIT},this.contextActions=[this.toggleFilterBarAction,this.toggleSearchBarAction,this.toggleGotoRowAction,this.discardAction,this.commitAction];const{aggregationSettings:e,conditionalFormats:n,customColumnFormatMap:s,isFilterBarShown:i,isSelectingPartition:o,model:r,movedColumns:l,movedRows:a,partition:d,partitionColumn:c,rollupConfig:u,userColumnWidths:m,userRowHeights:p,showSearchBar:g,searchValue:f,selectedSearchColumns:b,invertSearchColumns:C,advancedFilters:w,quickFilters:T,selectDistinctColumns:y,pendingDataMap:E,canCopy:I,frozenColumns:D}=t,F=[new xv(this),new _v(this)];I&&F.push(new Mv(this));const x=[new kv(this),new Ov(this),new Lv(this),new Vv(this),new Hv(this),new bs(this),new Pv(this),new Uv(this)],U=l.length>0?l:r.movedColumns,B=a.length>0?a:r.movedRows,_=new Wv({userColumnWidths:new Map(m),userRowHeights:new Map(p),movedColumns:U}),H=b!=null?b:[],A=Mr.createSearchFilter(f,H,r.columns,C);this.state={isFilterBarShown:i,isSelectingPartition:o,focusedFilterBarColumn:null,metricCalculator:_,metrics:void 0,keyHandlers:F,mouseHandlers:x,partition:d,partitionColumn:c,partitionTable:null,partitionFilters:[],quickFilters:T?new Map(T):new Map,advancedFilters:new Map(w),shownAdvancedFilter:null,hoverAdvancedFilter:null,sorts:[],reverseType:L.REVERSE_TYPE.NONE,customColumns:[],selectDistinctColumns:y,selectedRanges:[],copyOperation:null,loadingText:null,loadingScrimProgress:null,loadingSpinnerShown:!1,movedColumns:U,movedRows:B,shownColumnTooltip:null,formatter:new un,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:A,searchValue:f,selectedSearchColumns:H,invertSearchColumns:C,rollupConfig:u,rollupSelectedColumns:[],aggregationSettings:e,selectedAggregation:null,openOptions:[],pendingRowCount:0,pendingDataMap:E!=null?E:new Map,pendingDataErrors:new Map,pendingSavePromise:null,pendingSaveError:null,toastMessage:null,frozenColumns:D,showOverflowModal:!1,overflowText:"",overflowButtonTooltipProps:null,isGotoRowShown:!1,gotoRow:"",gotoRowError:""}}static makeQuickFilter(t,e,n){try{return L.makeQuickFilter(t,e,n)}catch(s){fe.error("Error creating quick filter",s)}return null}componentDidMount(){const{partitionColumn:t,model:e}=this.props,n=t!=null?t:e.columns.find(s=>s.isPartitionColumn);e.isFilterRequired&&e.isValuesTableAvailable&&n!=null?this.loadPartitionsTable(n):this.initState(),this.startListening(e)}componentDidUpdate(t){var c;const{inputFilters:e,isSelectingColumn:n,settings:s,model:i,customFilters:o,sorts:r}=this.props;i!==t.model&&(this.stopListening(t.model),this.startListening(i));const l=e!==t.inputFilters?e.filter(u=>!t.inputFilters.includes(u)):[];if(l.length>0){const{advancedSettings:u}=this.props,m=(c=u.get(mi.FILTER_CONTROL_CHANGE_CLEARS_ALL_FILTERS))!=null?c:!1;m&&(this.clearGridInputField(),this.clearCrossColumSearch()),this.startLoading("Filtering...",!0),this.applyInputFilters(l,m)}n!==t.isSelectingColumn&&this.resetColumnSelection(),s!==t.settings&&this.updateFormatterSettings(s),o!==t.customFilters&&this.startLoading("Filtering...",!0),r!==t.sorts&&this.updateSorts(r);const{loadingScrimStartTime:a,loadingScrimFinishTime:d}=this;a!=null&&d!=null&&window.requestAnimationFrame(()=>{const u=Date.now(),m=u-a,p=d-a,g=Math.min(m/p,1);d<u&&(this.loadingScrimStartTime=void 0,this.loadingScrimFinishTime=void 0),this.setState(f=>f.loadingScrimProgress==null?(fe.debug2("Ignoring scrim update because loading cancelled."),null):{loadingScrimProgress:g})}),this.sendStateChange()}componentWillUnmount(){const{model:t}=this.props;this.stopListening(t),this.pending.cancel(),this.updateSearchFilter.cancel(),this.loadingTimer&&clearTimeout(this.loadingTimer),this.handleDownloadProgressUpdate.cancel(),this.animationFrame!==void 0&&cancelAnimationFrame(this.animationFrame)}getValueForCell(t,e,n=!1){const{model:s}=this.props,i=this.getModelColumn(t),o=this.getModelRow(e);if(n&&i!=null&&o!=null){const r=s.valueForCell(i,o);if(L.isDateType(s.columns[i].type)){const{formatter:l}=s;return M.i18n.DateTimeFormat.format(ZT,r,M.i18n.TimeZone.getTimeZone(l.timeZone))}return r}return n?null:i!=null&&o!=null?s.textForCell(i,o):""}getModelColumn(t){const{metrics:e}=this.state;P(e);const{modelColumns:n}=e;return n==null?null:t!=null?n.get(t):null}getModelRow(t){const{metrics:e}=this.state;P(e);const{modelRows:n}=e;return n==null?null:t!=null?n.get(t):null}getTheme(){var n;const{model:t,theme:e}=this.props;return this.getCachedTheme(e,(n=Je(t)&&t.isEditable)!=null?n:!1,t.floatingTopRowCount+t.floatingBottomRowCount)}getVisibleColumn(t){const{movedColumns:e}=this.state;return K.getVisibleIndex(t,e)}applyInputFilters(t,e=!1){const{model:n}=this.props,{advancedFilters:s,quickFilters:i}=this.state,o=e?new Map:new Map(s),r=e?new Map:new Map(i);let l=e&&s.size>0;t.forEach(({name:a,type:d,value:c})=>{const u=n.columns.findIndex(({name:m,type:p})=>m===a&&p===d);u>=0?(l=o.delete(u)||l,l=this.applyQuickFilter(u,c,r)||l):fe.error("Unable to find column for inputFilter",a,d,c)}),l&&this.setState({quickFilters:r,advancedFilters:o})}applyQuickFilter(t,e,n){const{model:s}=this.props,{formatter:i}=s,o=s.columns[t];if(e!=null&&`${e}`.trim().length>0){const r=n.get(t);if(r!=null){const{text:l}=r;if(l===e)return fe.debug2("Ignoring change to existing filter"),!1}return n.set(t,{text:e,filter:Os.makeQuickFilter(o,e,i.timeZone)}),!0}return n.delete(t)}setAdvancedFilterMap(t){this.setState({advancedFilters:t})}setAdvancedFilter(t,e,n){fe.debug("Setting advanced filter",t,e),this.startLoading("Filtering...",!0),this.setState(({advancedFilters:s})=>{const i=new Map(s);return e==null?i.delete(t):i.set(t,{filter:e,options:n}),{advancedFilters:i}})}setQuickFilter(t,e,n){fe.debug("Setting quick filter",t,e,n),this.startLoading("Filtering...",!0),this.setState(({quickFilters:s})=>{const i=new Map(s);return i.set(t,{filter:e,text:n}),{quickFilters:i}})}setFilterMap(t){var i;fe.debug("setFilterMap",t);const{advancedSettings:e}=this.props;((i=e.get(mi.LINK_CHANGE_CLEARS_ALL_FILTERS))!=null?i:!1)&&this.clearAllFilters();const{model:s}=this.props;t.forEach(({columnType:o,filterList:r},l)=>{const a=s.columns.find(u=>u.name===l&&u.type===o);if(a==null)return;const d=s.getColumnIndexByName(a.name);P(d);const c=ne.combineFiltersFromList(o,r);if(c.length===0)this.removeQuickFilter(d);else{const{formatter:u}=s;this.setQuickFilter(d,Os.makeQuickFilter(a,c,u.timeZone),`${c}`)}})}removeColumnFilter(t){this.startLoading("Filtering...",!0),this.setState(({advancedFilters:e,quickFilters:n})=>{const s=e?new Map(e):new Map,i=n?new Map(n):new Map;return i.delete(t),s.delete(t),{quickFilters:i,advancedFilters:s}})}removeQuickFilter(t){this.startLoading("Clearing Filter...",!0),this.setState(({quickFilters:e})=>{const n=new Map(e);return n.delete(t),{quickFilters:n}})}clearAllFilters(){fe.debug("Clearing all filters");const{advancedFilters:t,quickFilters:e,searchFilter:n}=this.state;e.size===0&&t.size===0&&n===null||(this.clearGridInputField(),this.startLoading("Clearing Filters...",!0),this.setState({quickFilters:new Map,advancedFilters:new Map,searchValue:"",searchFilter:void 0}))}clearCrossColumSearch(){fe.debug("Clearing cross-column search"),this.setState({searchValue:"",searchFilter:void 0})}clearGridInputField(){this.filterInputRef.current!=null&&this.filterInputRef.current.setValue("")}rebuildFilters(){fe.debug("Rebuilding filters");const{model:t}=this.props,{advancedFilters:e,quickFilters:n}=this.state,{columns:s,formatter:i}=t,o=new Map,r=new Map;e.forEach((l,a)=>{const{options:d}=l,c=s[a],u=L.makeAdvancedFilter(c,d,i.timeZone);o.set(a,{options:d,filter:u})}),n.forEach((l,a)=>{const{text:d}=l,c=s[a];r.set(a,{text:d,filter:Os.makeQuickFilter(c,d,i.timeZone)})}),this.startLoading("Rebuilding filters...",!0),this.setState({quickFilters:r,advancedFilters:o})}setFilters({quickFilters:t,advancedFilters:e}){this.setState({quickFilters:t,advancedFilters:e})}updateFormatterSettings(t,e=!0){var m,p,g;const n=hs.getColumnFormats(t),s=hs.getDateTimeFormatterOptions(t),i=(m=t==null?void 0:t.defaultDecimalFormatOptions)!=null?m:{},o=(p=t==null?void 0:t.defaultIntegerFormatOptions)!=null?p:{},r=(g=t==null?void 0:t.truncateNumbersWithPound)!=null?g:!1,l=!ht(this.globalColumnFormats,n),a=!ht(this.dateTimeFormatterOptions,s),d=!ht(this.decimalFormatOptions,t==null?void 0:t.defaultDecimalFormatOptions),c=!ht(this.integerFormatOptions,o),u=this.truncateNumbersWithPound!==r;(l||a||d||c||u)&&(this.globalColumnFormats=n,this.dateTimeFormatterOptions=s,this.decimalFormatOptions=i,this.integerFormatOptions=o,this.truncateNumbersWithPound=r,this.updateFormatter({},e),a&&e&&this.rebuildFilters())}updateFormatter(t,e=!0){var r;const{customColumnFormatMap:n}=this.state,s={customColumnFormatMap:n,...t},i=[...(r=this.globalColumnFormats)!=null?r:[],...s.customColumnFormatMap.values()],o=new un(i,this.dateTimeFormatterOptions,this.decimalFormatOptions,this.integerFormatOptions,this.truncateNumbersWithPound);fe.debug("updateFormatter",this.globalColumnFormats,i),this.setState({...s,formatter:o},()=>{e&&this.grid&&this.grid.forceUpdate()})}initFormatter(){const{settings:t}=this.props;this.updateFormatterSettings(t)}initState(){const{applyInputFiltersOnInit:t,inputFilters:e,sorts:n,model:s,reverseType:i,customColumns:o,searchValue:r,selectedSearchColumns:l,invertSearchColumns:a}=this.props,d=l!=null?l:[],c=Mr.createSearchFilter(r,d,s.columns,a);if(t){const u=e.filter(m=>m.value!=null);this.applyInputFilters(u)}this.setState({sorts:n,reverseType:i,customColumns:o,isReady:!0,searchFilter:c}),this.initFormatter()}async loadPartitionsTable(t){const{model:e}=this.props;this.setState({isSelectingPartition:!0});try{const n=await this.pending.add(e.valuesTable(t),r=>r.close()),s=n.columns[0],i=s.sort().desc();n.applySort([i]),n.setViewport(0,0,[s]);const o=await this.pending.add(n.getViewportData());if(o.rows.length>0){const l=o.rows[0].get(s);this.updatePartition(l,t),this.setState({isSelectingPartition:!0})}else fe.info("Table does not have any data, just fetching all"),this.setState({isSelectingPartition:!1}),this.handlePartitionFetchAll();this.setState({partitionTable:n,partitionColumn:t},()=>{this.initState()})}catch(n){this.handleTableLoadError(n)}}updatePartition(t,e){const s=[e.filter().eq(M.FilterValue.ofString(t))];this.setState({partition:t,partitionFilters:s})}copyCell(t,e,n=!1){const{canCopy:s}=this.props;if(s){const i=String(this.getValueForCell(t,e,n));ji(i).catch(o=>fe.error("Unable to copy cell",o))}else fe.error("Attempted to copyCell for user without copy permission.")}copyRanges(t,e=!1,n=!0,s){const{model:i,canCopy:o}=this.props,{metricCalculator:r,movedColumns:l}=this.state,a=r.getUserColumnWidths();if(o){const d={ranges:re.boundedRanges(t,i.columnCount,i.rowCount),includeHeaders:e,formatValues:n,movedColumns:l,userColumnWidths:a,error:s};this.setState({copyOperation:d})}else fe.error("Attempted copyRanges for user without copy permission.")}startLoading(t,e=!1){var s,i;this.setState({loadingText:t});const n=this.getTheme();if(e&&this.grid&&(this.grid.clearSelectedRanges(),this.grid.setViewState({top:0},!0)),this.loadingScrimStartTime==null){const{minScrimTransitionTime:o,maxScrimTransitionTime:r}=n;P(o),P(r);const l=(i=(s=this.gridWrapper)==null?void 0:s.getBoundingClientRect().height)!=null?i:0,a=Math.max(o,Math.min(l/2,r));this.loadingScrimStartTime=Date.now(),this.loadingScrimFinishTime=this.loadingScrimStartTime+a,this.setState({loadingScrimProgress:0}),this.loadingTimer=setTimeout(()=>{this.setState({loadingSpinnerShown:!0})},Os.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){fe.debug("loading last loading config",this.lastLoadedConfig);const{advancedFilters:t,aggregationSettings:e,customColumns:n,quickFilters:s,reverseType:i,rollupConfig:o,searchFilter:r,selectDistinctColumns:l,sorts:a}=this.lastLoadedConfig;this.lastLoadedConfig=null,this.setState({advancedFilters:t,aggregationSettings:e,customColumns:n,quickFilters:s,reverseType:i,rollupConfig:o,searchFilter:r,selectDistinctColumns:l,sorts:a})}else fe.debug("remove all sorts, filters, and custom columns"),this.setState({advancedFilters:new Map,aggregationSettings:Tp,customColumns:[],quickFilters:new Map,reverseType:L.REVERSE_TYPE.NONE,rollupConfig:void 0,selectDistinctColumns:[],sorts:[]})}canRollback(){return this.lastLoadedConfig!=null||!xh(this.state)}startListening(t){t.addEventListener(Ce.EVENT.UPDATED,this.handleUpdate),t.addEventListener(Ce.EVENT.REQUEST_FAILED,this.handleRequestFailed),t.addEventListener(Ce.EVENT.COLUMNS_CHANGED,this.handleCustomColumnsChanged),t.addEventListener(Ce.EVENT.PENDING_DATA_UPDATED,this.handlePendingDataUpdated)}stopListening(t){t.removeEventListener(Ce.EVENT.UPDATED,this.handleUpdate),t.removeEventListener(Ce.EVENT.REQUEST_FAILED,this.handleRequestFailed),t.removeEventListener(Ce.EVENT.COLUMNS_CHANGED,this.handleCustomColumnsChanged),t.removeEventListener(Ce.EVENT.PENDING_DATA_UPDATED,this.handlePendingDataUpdated)}focus(){var t;(t=this.grid)==null||t.focus()}focusFilterBar(t){var c,u,m;const{movedColumns:e}=this.state,{model:n}=this.props,{columnCount:s}=n,i=K.getModelIndex(t,e);if(t==null||t<0||s<=t||!n.isFilterable(i)){this.setState({focusedFilterBarColumn:null});return}const{metricCalculator:o,metrics:r}=this.state;P(r);const{left:l,rightVisible:a,lastLeft:d}=r;if(t<l)(c=this.grid)==null||c.setViewState({left:t},!0);else if(a<t){const p=(u=this.grid)==null?void 0:u.getMetricState();P(p);const g=o.getLastLeft(p,t,o.getVisibleWidth(p));(m=this.grid)==null||m.setViewState({left:Math.min(g,d),leftOffset:0},!0)}this.lastFocusedFilterBarColumn=t,this.setState({focusedFilterBarColumn:t,isFilterBarShown:!0})}hideColumnByVisibleIndex(t){var s;const{metricCalculator:e,movedColumns:n}=this.state;e.setColumnWidth(K.getModelIndex(t,n),0),(s=this.grid)==null||s.forceUpdate()}freezeColumnByColumnName(t){const{frozenColumns:e,movedColumns:n}=this.state,{model:s}=this.props;fe.debug2("freezing column",t);const i=e==null?new Set(s.frozenColumns):new Set(e);i.add(t);const o=s.getColumnIndexByName(t);P(o);const r=K.getVisibleIndex(o,n),l=K.moveItem(r,i.size-1,n);this.setState({frozenColumns:[...i],movedColumns:l})}unFreezeColumnByColumnName(t){const{frozenColumns:e,movedColumns:n}=this.state,{model:s}=this.props;fe.debug2("unfreezing column",t);const i=e==null?new Set(s.frozenColumns):new Set(e);i.delete(t);const o=s.getColumnIndexByName(t);P(o);const r=K.getVisibleIndex(o,n),l=K.moveItem(r,i.size+s.frontColumns.length,n);this.setState({frozenColumns:[...i],movedColumns:l})}handleColumnVisibilityChanged(t,e){var s;const{metricCalculator:n}=this.state;e===pi.VISIBILITY_OPTIONS.SHOW?t.forEach(i=>{n.resetColumnWidth(i)}):t.forEach(i=>{n.setColumnWidth(i,0)}),(s=this.grid)==null||s.forceUpdate()}handleCrossColumnSearch(t,e,n){const{model:s}=this.props;this.updateSearchFilter(t,e,s.columns,n),this.setState({searchValue:t,selectedSearchColumns:e,invertSearchColumns:n})}handleAnimationLoop(){var t,e;(t=this.grid)==null||t.updateCanvasScale(),(e=this.grid)==null||e.updateCanvas(),this.isAnimating&&(this.animationFrame=requestAnimationFrame(this.handleAnimationLoop))}handleAnimationStart(){fe.debug2("handleAnimationStart"),this.isAnimating=!0,this.animationFrame=requestAnimationFrame(this.handleAnimationLoop)}handleAnimationEnd(){fe.debug2("handleAnimationEnd"),this.isAnimating=!1}handlePartitionAppend(t){const{onPartitionAppend:e}=this.props,{partitionColumn:n}=this.state;!n||e(n,t)}handlePartitionChange(t){const{partitionColumn:e}=this.state;!e||this.updatePartition(t,e)}handlePartitionFetchAll(){this.setState({partitionFilters:[],isSelectingPartition:!1})}handlePartitionDone(){this.setState({isSelectingPartition:!1})}handleTableLoadError(t){if(Te.isCanceled(t))return;fe.error(t);const{onError:e}=this.props;e(t)}showAllColumns(){var s;const{metricCalculator:t}=this.state,n=[...t.getUserColumnWidths().entries()];for(let i=0;i<n.length;i+=1){const[o,r]=n[i];r===0&&t.resetColumnWidth(o)}(s=this.grid)==null||s.forceUpdate()}toggleSort(t,e){fe.info("Toggling sort for column",t);const{model:n}=this.props,{sorts:s}=this.state,i=this.getModelColumn(t);P(i);const o=L.toggleSortForColumn(s,n.columns,i,e);this.updateSorts(o)}updateSorts(t){var e;this.startLoading("Sorting..."),this.setState({sorts:t}),(e=this.grid)==null||e.forceUpdate()}sortColumn(t,e=L.sortDirection.none,n=!1,s=!1){var r;P(t);const{model:i}=this.props,o=L.sortColumn(i.sort,i.columns,t,e,n,s);this.startLoading("Sorting..."),this.setState({sorts:o}),(r=this.grid)==null||r.forceUpdate()}reverse(t){var e;this.startLoading("Reversing..."),this.setState({reverseType:t}),(e=this.grid)==null||e.forceUpdate()}isReversible(){const{model:t}=this.props;return t.isReversible}toggleFilterBar(t=this.lastFocusedFilterBarColumn){var n;let{isFilterBarShown:e}=this.state;if(e=!e,this.setState({isFilterBarShown:e}),e)if(t!=null)this.focusFilterBar(t);else{let s=0;const{model:i}=this.props,{columnCount:o}=i;for(let r=0;r<o;r+=1){const l=this.getModelColumn(r);if(l!=null){const a=i.columns[l];if(a!=null&&L.isTextType(a.type)){s=r;break}}}this.focusFilterBar(s)}else(n=this.grid)==null||n.focus()}isTableSearchAvailable(){var s,i,o;const{model:t,canToggleSearch:e}=this.props,n=(s=t==null?void 0:t.layoutHints)==null?void 0:s.searchDisplayMode;return n===((i=M.SearchDisplayMode)==null?void 0:i.SEARCH_DISPLAY_HIDE)?!1:n===((o=M.SearchDisplayMode)==null?void 0:o.SEARCH_DISPLAY_SHOW)?!0:e}toggleSearchBar(){const{showSearchBar:t}=this.state;if(!this.isTableSearchAvailable())return;const e=!t;this.setState({showSearchBar:e},()=>{var n,s,i;e&&((n=this.crossColumnRef)==null?void 0:n.current)?(s=this.crossColumnRef)==null||s.current.focus():(i=this.grid)==null||i.focus()})}toggleGotoRow(t=""){const{isGotoRowShown:e}=this.state;if(t){this.setState({isGotoRowShown:!0,gotoRow:t,gotoRowError:""});return}this.setState({isGotoRowShown:!e,gotoRow:"",gotoRowError:""})}async commitPending(){var i,o;const{model:t}=this.props;if(!Je(t)||!t.isEditable)throw new Error("Cannot save, table is not editable");const{pendingSavePromise:e}=this.state;if(e!=null)throw new Error("Save already in progress");const n=(i=document==null?void 0:document.activeElement)==null?void 0:i.classList.contains("grid-cell-input-field");if(n!=null&&n){if(document.activeElement!=null&&document.activeElement.classList.contains("error"))throw new Hi("Current input is invalid");(o=this.grid)==null||o.focus()}const s=this.pending.add(t.commitPending()).then(()=>{this.setState({pendingSaveError:null,pendingSavePromise:null})}).catch(r=>{Te.isCanceled(r)||this.setState({pendingSaveError:r,pendingSavePromise:null})});return this.setState({pendingSavePromise:s}),s}async discardPending(){const{pendingSavePromise:t}=this.state;if(t!=null)throw new Error("Cannot cancel a save in progress");this.setState({pendingSavePromise:null,pendingSaveError:null,pendingDataMap:new Map,pendingDataErrors:new Map})}selectColumn(t){const{onColumnSelected:e}=this.props;e(t)}selectData(t,e){const{model:n}=this.props,{columns:s,groupedColumns:i}=n,o={};for(let l=0;l<s.length;l+=1){const a=s[l],{name:d,type:c}=a,u=n.valueForCell(l,e),m=n.textForCell(l,e),p=this.getVisibleColumn(l),g=pt(n)&&n.isRowExpandable(e),f=i.find(b=>b.name===d)!=null;o[d]={value:u,text:m,type:c,isGrouped:f,isExpandable:g,visibleIndex:p}}const{onDataSelected:r}=this.props;r(e,o)}handleAdvancedFilterChange(t,e,n){const{model:s}=this.props,i=s.getColumnIndexByName(t.name);P(i),this.setAdvancedFilter(i,e,n)}handleAdvancedFilterSortChange(t,e,n=!1){var a;const{model:s}=this.props,i=s.getColumnIndexByName(t.name);P(i);const o=L.getSortForColumn(s.sort,i);let r=null;(o==null||o.direction!==e)&&(e===L.sortDirection.descending?r=t.sort().desc():r=t.sort().asc());const l=L.setSortForColumn(s.sort,i,r,n);fe.info("Setting table sorts",l),this.startLoading("Sorting..."),this.setState({sorts:l}),(a=this.grid)==null||a.forceUpdate()}handleAdvancedFilterDone(){var t;(t=this.grid)==null||t.focus()}handleAdvancedMenuOpened(t){this.setState({shownAdvancedFilter:t})}handleGotoRowOpened(){this.setState({isGotoRowShown:!0})}handleGotoRowClosed(){this.setState({isGotoRowShown:!1})}handleAdvancedMenuClosed(t){var s,i;const{focusedFilterBarColumn:e,isFilterBarShown:n}=this.state;n&&e===t&&((s=this.filterInputRef)==null?void 0:s.current)!==null?((i=this.filterInputRef)==null||i.current.focus(),this.setState({shownAdvancedFilter:null})):this.setState({focusedFilterBarColumn:null,shownAdvancedFilter:null})}handleCancel(){this.rollback()}handleChartChange(){}handleChartCreate(t){const{model:e,onCreateChart:n}=this.props;n(t,e)}handleGridError(t){fe.warn("Grid Error",t),this.setState({toastMessage:h("div",{className:"error-message",children:`${t}`})})}handleFilterBarChange(t){this.startLoading("Filtering...",!0),this.setState(({focusedFilterBarColumn:e,quickFilters:n})=>{const s=new Map(n);if(e!=null){const i=this.getModelColumn(e);P(i),this.applyQuickFilter(i,t,s)}return{quickFilters:s}})}handleFilterBarDone(t=!0,e=!0){var n;t&&((n=this.grid)==null||n.focus()),e&&this.setState({focusedFilterBarColumn:null})}handleFilterBarTab(t){const{focusedFilterBarColumn:e}=this.state;P(e),t?this.focusFilterBar(e-1):this.focusFilterBar(e+1)}handleFormatSelection(t,e){const{model:n}=this.props,s=n.columns[t],{customColumnFormatMap:i}=this.state,o=new Map(i);if(e!=null){const r=L.getNormalizedType(s.type);P(r);const l=un.makeColumnFormattingRule(r,s.name,e);o.set(s.name,l)}else o.delete(s.name);this.updateFormatter({customColumnFormatMap:o})}handleMenu(t){t.stopPropagation(),this.setState({isMenuShown:!0})}handleMenuClose(){this.setState({isMenuShown:!1,openOptions:[]})}handleMenuBack(){this.setState(({openOptions:t})=>{const e=[...t];return e.pop(),{openOptions:e}})}handleMenuSelect(t){this.setState(({openOptions:e})=>({openOptions:[...e,t]}))}handleRequestFailed(t){const e=t;if(fe.error("request failed:",e.detail),this.stopLoading(),this.canRollback())this.startLoading("Rolling back changes...",!0),this.rollback();else{fe.error("Table failed and unable to rollback");const{onError:n}=this.props;n(new Error(`Error displaying table: ${e.detail}`))}}handleUpdate(){var c;this.stopLoading(),fe.debug2("Received model update");const{advancedFilters:t,aggregationSettings:e,customColumns:n,quickFilters:s,reverseType:i,rollupConfig:o,searchFilter:r,selectDistinctColumns:l,sorts:a}=this.state,d={advancedFilters:t,aggregationSettings:e,customColumns:n,quickFilters:s,reverseType:i,rollupConfig:o,searchFilter:r,selectDistinctColumns:l,sorts:a};xh(d)?this.lastLoadedConfig=null:this.lastLoadedConfig=d,(c=this.grid)==null||c.forceUpdate()}handleViewChanged(t){var i,o;const{model:e}=this.props,{selectionEndRow:n=0}=(o=(i=this.grid)==null?void 0:i.state)!=null?o:{};let s=0;if(Je(e)&&e.isEditable){P(t);const{bottomViewport:r}=t,l=e.rowCount-e.floatingBottomRowCount;n===l-1?s=e.pendingRowCount+1:n===l-2?s=e.pendingRowCount:s=Math.max(0,r-(e.rowCount-e.pendingRowCount)-e.floatingTopRowCount-e.floatingBottomRowCount-1)}this.setState({metrics:t,pendingRowCount:s})}handleSelectionChanged(t){P(t);const{onSelectionChanged:e}=this.props,{copyOperation:n}=this.state;this.setState({selectedRanges:t}),n!=null&&this.setState({copyOperation:null}),e(t)}handleMovedColumnsChanged(t,e=()=>null){this.setState({movedColumns:t},e)}handleTooltipRef(t){t!=null&&t.startTimer(),this.tooltip=t}handleConditionalFormatsChange(t){fe.debug("Updated conditional formats",t),this.setState({conditionalFormats:t})}handleConditionalFormatCreate(){fe.debug("Create new conditional format");const{openOptions:t,conditionalFormats:e}=this.state;this.setState({openOptions:[...t,{type:_e.CONDITIONAL_FORMATTING_EDIT,title:"Create Formatting Rule"}],conditionalFormatEditIndex:e.length,conditionalFormatPreview:void 0})}handleConditionalFormatEdit(t){fe.debug("Edit conditional format",t);const{openOptions:e,conditionalFormats:n}=this.state;this.setState({openOptions:[...e,{type:_e.CONDITIONAL_FORMATTING_EDIT,title:"Edit Formatting Rule"}],conditionalFormatEditIndex:t,conditionalFormatPreview:{...n[t]}})}handleConditionalFormatEditorSave(t){fe.debug("Save conditional format changes",t),this.setState(e=>{if(e.conditionalFormatEditIndex===null)return fe.debug("Invalid format index"),null;const n=[...e.conditionalFormats];return n[e.conditionalFormatEditIndex]=t,{conditionalFormats:n}},()=>{this.handleMenuBack()})}handleConditionalFormatEditorCancel(){this.handleMenuBack(),this.setState({conditionalFormatEditIndex:null})}handleUpdateCustomColumns(t){fe.info("handleUpdateCustomColumns:",t);const{model:e}=this.props,{movedColumns:n,sorts:s,quickFilters:i,advancedFilters:o,selectDistinctColumns:r}=this.state,{columns:l}=e,a=e.customColumns.map(c=>`${c}`),d=ne.getRemovedCustomColumnNames(a,t);if(d.length>0){const c=ne.removeSortsInColumns(s,d),u=ne.removeFiltersInColumns(l,i,d),m=ne.removeFiltersInColumns(l,o,d),p=ne.removeColumnFromMovedColumns(l,n,d),g=ne.removeColumnsFromSelectDistinctColumns(r,d);c.length!==s.length&&(fe.debug("removing sorts from removed custom columns..."),this.setState({sorts:c})),(u.size!==i.size||m.size!==o.size)&&(fe.debug("removing filters from removed custom columns..."),this.setState({quickFilters:u,advancedFilters:m})),ht(n,p)||(fe.debug("change moved columns for removed custom columns",p),this.setState({movedColumns:p})),ht(r,g)||(fe.debug("change selectDistinct columns for removed custom columns",p),this.setState({selectDistinctColumns:g}))}this.setState({customColumns:t}),this.startLoading("Applying custom columns...")}handleCustomColumnsChanged(){var e;fe.debug("custom columns changed");const{isReady:t}=this.state;t?(this.stopLoading(),(e=this.grid)==null||e.forceUpdate()):this.initState()}handlePendingCommitClicked(){return this.commitPending()}handlePendingDiscardClicked(){return this.discardPending()}handlePendingDataUpdated(){var s;fe.debug("pending data updated");const{model:t}=this.props,{pendingDataMap:e,pendingDataErrors:n}=t;this.setState({pendingDataMap:e,pendingDataErrors:n,pendingSaveError:null}),(s=this.grid)==null||s.forceUpdate()}handleAggregationsChange(t){fe.debug("handleAggregationsChange",t),this.startLoading(`Aggregating ${t.aggregations.map(e=>e.operation).join(", ")}...`),this.setState({aggregationSettings:t})}handleAggregationChange(t){fe.debug("handleAggregationChange",t),this.startLoading(`Aggregating ${t.operation}...`),this.setState(({aggregationSettings:e})=>({selectedAggregation:t,aggregationSettings:{...e,aggregations:e.aggregations.map(n=>n.operation===t.operation?t:n)}}))}handleAggregationEdit(t){fe.debug("handleAggregationEdit",t);const{openOptions:e}=this.state;this.setState({openOptions:[...e,{type:_e.AGGREGATION_EDIT,title:`Edit Columns to ${t.operation}`}],selectedAggregation:t})}handleRollupChange(t){var e,n;fe.info("Rollup change",t),this.resetGridViewState(),this.showAllColumns(),this.clearAllFilters(),this.startLoading(`Grouping by columns ${(n=(e=t==null?void 0:t.columns)==null?void 0:e.join(", "))!=null?n:""}...`),this.setState({rollupConfig:t,movedColumns:[],sorts:[],reverseType:L.REVERSE_TYPE.NONE,selectDistinctColumns:[]})}handleSelectDistinctChanged(t){fe.debug("SelectDistinct change",t),this.resetGridViewState(),this.showAllColumns(),this.clearAllFilters(),this.startLoading(`Selecting distinct values in ${t.length>0?t.join(", "):""}...`),this.setState({selectDistinctColumns:t,movedColumns:[],sorts:[],reverseType:L.REVERSE_TYPE.NONE})}handleDownloadTableStart(){const{canDownloadCsv:t}=this.props;t?this.setState({isTableDownloading:!0,tableDownloadProgress:0,tableDownloadEstimatedTime:null,tableDownloadStatus:an.DOWNLOAD_STATUS.INITIATING}):fe.error("Attempted to handleDownloadTableStart for user without download CSV permission.")}handleDownloadTable(t,e,n,s,i,o,r){const{canDownloadCsv:l}=this.props;l?(fe.info("start table downloading",t,e,n,s,i,o,r),this.setState(()=>(this.tableSaver&&this.tableSaver.startDownload(t,e,n,s,i,o,r),{tableDownloadStatus:an.DOWNLOAD_STATUS.DOWNLOADING}))):fe.error("Attempted to handleDownloadTable for user without download CSV permission.")}handleCancelDownloadTable(){var t;(t=this.tableSaver)==null||t.cancelDownload(),this.setState({isTableDownloading:!1})}handleDownloadCompleted(){this.setState({isTableDownloading:!1,tableDownloadProgress:100,tableDownloadStatus:an.DOWNLOAD_STATUS.FINISHED})}handleDownloadCanceled(){this.setState({isTableDownloading:!1,tableDownloadProgress:0,tableDownloadStatus:an.DOWNLOAD_STATUS.CANCELED})}deleteRanges(t){const{model:e}=this.props;this.pending.add(e.delete(t)).catch(n=>{Te.isCanceled(n)||fe.error("Unable to delete ranges",t,n)})}resetColumnSelection(){if(this.grid==null)return;const{isSelectingColumn:t}=this.props;if(t){const{columnAllowedCursor:e}=this.props;this.grid.setState({cursor:e})}else this.grid.setState({cursor:null}),this.setState({hoverSelectColumn:null})}resetGridViewState(t=!0){!this.grid||(this.grid.clearSelectedRanges(),this.grid.setViewState({left:0,top:0,topOffset:0,leftOffset:0},t))}sendStateChange(){if(!this.grid)return;const{state:t}=this,{state:e}=this.grid,{onStateChange:n}=this.props;n(t,e)}handleOverflowClose(){this.setState({showOverflowModal:!1})}getColumnBoundingRect(){var m;const{metrics:t,shownColumnTooltip:e}=this.state;P(t),P(e);const n=(m=this.gridWrapper)==null?void 0:m.getBoundingClientRect(),s=20;P(n);const{columnHeaderHeight:i,visibleColumnXs:o,visibleColumnWidths:r,width:l,columnHeaderMaxDepth:a}=t,d=o.get(e),c=r.get(e);P(d),P(c);const u=n.left+gt(d+c/2,s,l-s);return{top:n.top+(a-1)*i,left:n.left+gt(d+c/2,s,l-s),bottom:n.top+a*i,right:n.left+gt(d+c/2,s,l-s)+1,width:1,height:i,x:u,y:n.top,toJSON:()=>{throw new Error("not implemented")}}}handleGotoRowSelectedRowNumberSubmit(){const{gotoRow:t}=this.state;this.focusRowInGrid(t)}focusRowInGrid(t){var i,o,r;const{model:e}=this.props,{rowCount:n}=e;if(this.setState({gotoRow:t}),t===""){this.setState({gotoRowError:""});return}const s=parseInt(t,10);s>n||s<-n?this.setState({gotoRowError:"Invalid row index"}):s===0?(this.setState({gotoRowError:""}),(i=this.grid)==null||i.setFocusRow(0)):s<0?(this.setState({gotoRowError:""}),(o=this.grid)==null||o.setFocusRow(s+n)):((r=this.grid)==null||r.setFocusRow(s-1),this.setState({gotoRowError:""}))}handleGotoRowSelectedRowNumberChanged(t){const e=t.target.value;this.focusRowInGrid(e)}getColumnTooltip(t,e,n){const{columnHeaderHeight:s,columnHeaderMaxDepth:i,visibleColumnXs:o,visibleColumnWidths:r,width:l}=e,a=o.get(t),d=r.get(t);if(a==null||d==null)return null;const c=Math.max(0,a);let u=d;a+d>l?u=l-a:a<0&&(u=d-Math.abs(a));const m={position:"absolute",top:(i-1)*s,left:c,width:u,height:s,pointerEvents:"none"},p={clientWidth:1,clientHeight:s,getBoundingClientRect:this.getColumnBoundingRect},g={placement:"bottom",modifiers:{flip:{behavior:["bottom","top"]}}},f=this.getModelColumn(t);if(f==null)return null;const b=n.columns[f];return b==null?null:h("div",{style:m,children:h(Ue,{timeout:400,interactive:!0,options:g,ref:this.handleTooltipRef,referenceObject:p,onExited:()=>{this.setState({shownColumnTooltip:null})},children:h(up,{model:n,column:b,onStatistics:()=>{var C;(C=this.tooltip)==null||C.update()}})},b.name)})}render(){var mt,Ci,mc,pc,gc,fc,Cc,bc,Sc;const{children:t,customFilters:e,getDownloadWorker:n,isSelectingColumn:s,isStuckToBottom:i,isStuckToRight:o,model:r,name:l,onlyFetchVisibleColumns:a,alwaysFetchColumns:d,advancedSettings:c,onAdvancedSettingsChange:u,canDownloadCsv:m,onCreateChart:p}=this.props,{metricCalculator:g,metrics:f,isFilterBarShown:b,isSelectingPartition:C,isMenuShown:w,isReady:T,copyOperation:y,focusedFilterBarColumn:E,loadingText:I,loadingScrimProgress:D,loadingSpinnerShown:F,keyHandlers:x,mouseHandlers:U,shownColumnTooltip:B,hoverAdvancedFilter:_,shownAdvancedFilter:H,hoverSelectColumn:A,quickFilters:N,advancedFilters:k,partition:O,partitionFilters:V,partitionTable:G,partitionColumn:Q,searchFilter:Z,selectDistinctColumns:be,movedColumns:le,movedRows:he,formatter:De,conditionalFormats:ee,conditionalFormatPreview:ue,conditionalFormatEditIndex:Se,sorts:Me,reverseType:qe,customColumns:ke,selectedRanges:Qn,isTableDownloading:vn,tableDownloadStatus:wt,tableDownloadProgress:Re,tableDownloadEstimatedTime:ot,showSearchBar:rt,searchValue:_t,selectedSearchColumns:Zt,invertSearchColumns:Jt,aggregationSettings:kt,selectedAggregation:Ln,rollupConfig:$t,openOptions:Tn,pendingSavePromise:Us,pendingSaveError:Kl,pendingRowCount:ql,pendingDataErrors:Yl,pendingDataMap:tr,toastMessage:nr,frozenColumns:sr,showOverflowModal:ir,overflowText:or,overflowButtonTooltipProps:rr,isGotoRowShown:lr,gotoRow:Xl,gotoRowError:jl}=this.state;if(!T)return null;const Bs=this.getTheme(),Ql=this.getCachedFilter(e,N,k,V,Z),$s=g.getUserColumnWidths(),lo=this.getCachedStateOverride(A,b,s,D,N,k,Me,qe,$t,w),ar=f?f.top:0,dr=f?f.bottomViewport:0;let ao=null,co=null;a&&(ao=f?f.left:0,co=f?f.right:0);const Zl=f!=null&&f.width>0&&f.height>0,Jl=((Ci=(mt=$t==null?void 0:$t.columns)==null?void 0:mt.length)!=null?Ci:0)>0;let cr=null;const ea=f?Math.min(Math.max(Os.minDebounce,Math.round(f.rowCount/200)),Os.maxDebounce):Os.maxDebounce;if(b&&E!=null&&f!=null){const{gridX:Qe,gridY:en,visibleColumnXs:Ss,visibleColumnWidths:ho,width:bi}=f,An=Ss.get(E),Wt=ho.get(E);if(An!=null&&Wt!=null){const Ot=Qe+An,Zn=en-((mc=Bs.filterBarHeight)!=null?mc:0),Ws=Wt+1,zs=((pc=Bs.filterBarHeight)!=null?pc:0)-1,fr={top:Zn,left:Ot,minWidth:Math.min(Ws,bi-Ot),height:zs};let Pn="",Si=!0;const Gs=this.getModelColumn(E);P(Gs);const wi=N.get(Gs),ws=k.get(Gs);wi!=null&&(Pn=wi.text,Si=wi.filter!=null);const vi=N.size!==0||k.size!==0;cr=h(lp,{ref:this.filterInputRef,style:fr,className:W({error:!Si,active:Pn!==""||ws!=null,"iris-grid-has-filter":vi}),isAdvancedFilterSet:ws!=null,onAdvancedFiltersTriggered:()=>{this.setState({shownAdvancedFilter:E})},onChange:this.handleFilterBarChange,onDone:this.handleFilterBarDone,onTab:this.handleFilterBarTab,onContextMenu:(gc=this.grid)==null?void 0:gc.handleContextMenu,debounceMs:ea,value:Pn},E)}}let hr=null;if(I!=null){const Qe=v("div",{className:"iris-grid-loading-status",children:[h("div",{className:W("iris-grid-loading-status-bar",{show:F}),children:I}),v("button",{type:"button",onClick:this.handleCancel,className:W("iris-grid-btn-cancel",{show:F}),children:[h(j,{icon:Xi,transform:"down-1"}),"Cancel"]})]}),en=f?f.gridY:0;hr=h("div",{className:"iris-grid-loading",style:{top:en},children:Qe})}let ur=null;B!=null&&f&&(ur=this.getColumnTooltip(B,f,r),(fc=this.tooltip)==null||fc.update());const mr=[];if(f&&b){const{gridX:Qe,gridY:en,visibleColumns:Ss,visibleColumnXs:ho,visibleColumnWidths:bi}=f,{filterBarHeight:An}=Bs;for(let Wt=0;Wt<Ss.length;Wt+=1){const Ot=Ss[Wt],Zn=ho.get(Ot),Ws=bi.get(Ot),zs=this.getModelColumn(Ot);if(zs!=null&&r.isFilterable(zs)&&Zn!=null&&Ws!=null&&Ws>0){const Pn=Qe+Zn+Ws-24,Si=en-(An!=null?An:0)+2,Gs={position:"absolute",top:Si,left:Pn},ws=k.get(zs)!=null,vi=Ot===_||Ot===E||ws,sa=h("div",{className:W("advanced-filter-button-container",{hidden:!vi}),style:Gs,children:vi&&h(z,{kind:"ghost",className:W("btn-link-icon advanced-filter-button",{"filter-set":ws}),onClick:()=>{this.setState({shownAdvancedFilter:Ot})},onContextMenu:ig=>{var wc;(wc=this.grid)==null||wc.handleContextMenu(ig)},onMouseEnter:()=>{this.setState({hoverAdvancedFilter:Ot})},onMouseLeave:()=>{this.setState({hoverAdvancedFilter:null})},children:v("div",{className:"fa-layers",children:[h(j,{icon:dd,className:"filter-solid"}),h(j,{icon:qr,className:"filter-light"})]})})},Ot);mr.push(sa)}}}const pr=[];if(f){const{gridX:Qe,visibleColumns:en,visibleColumnXs:Ss,visibleColumnWidths:ho,columnHeaderHeight:bi}=f;for(let An=0;An<en.length;An+=1){const Wt=en[An],Ot=Ss.get(Wt),Zn=ho.get(Wt);if(Ot!=null&&Zn!=null&&Zn>0){const Ws=Qe+Ot,zs=Qe+Ot+Zn-20,fr=b?{position:"absolute",top:bi,left:zs,width:20,height:Bs.filterBarHeight}:{position:"absolute",top:0,left:Ws,width:Zn,height:bi},Pn=this.getModelColumn(Wt);if(Pn!=null){const Si=r.columns[Pn],Gs=k.get(Pn),{options:wi}=Gs||{},ws=L.getSortForColumn(r.sort,Pn),vi=ws?ws.direction:null,sa=h("div",{className:"advanced-filter-menu-container",style:fr,children:h(kn,{className:"advanced-filter-menu-popper",onEntered:this.getAdvancedMenuOpenedHandler(Wt),onExited:()=>{this.handleAdvancedMenuClosed(Wt)},isShown:H===Wt,interactive:!0,closeOnBlur:!0,options:{positionFixed:!0},children:this.getCachedAdvancedFilterMenuActions(r,Si,wi,vi,De)})},Wt);pr.push(sa)}}}}const gr=this.getCachedOptionItems(p!==void 0&&r.isChartBuilderAvailable,r.isCustomColumnsAvailable,r.isFormatColumnsAvailable,r.isRollupAvailable,r.isTotalsAvailable,r.isSelectDistinctAvailable,r.isExportAvailable,this.toggleFilterBarAction,this.toggleSearchBarAction,this.toggleGotoRowAction,b,rt,m,this.isTableSearchAvailable(),lr,c.size>0),ta=Tn.map(Qe=>{switch(Qe.type){case _e.CHART_BUILDER:return h(gp,{model:r,onChange:this.handleChartChange,onSubmit:this.handleChartCreate},_e.CHART_BUILDER);case _e.VISIBILITY_ORDERING_BUILDER:return h(pi,{model:r,movedColumns:le,userColumnWidths:$s,onColumnVisibilityChanged:this.handleColumnVisibilityChanged,onMovedColumnsChanged:this.handleMovedColumnsChanged},_e.VISIBILITY_ORDERING_BUILDER);case _e.CONDITIONAL_FORMATTING:return h(bT,{rules:ee,onChange:this.handleConditionalFormatsChange,onCreate:this.handleConditionalFormatCreate,onSelect:this.handleConditionalFormatEdit});case _e.CONDITIONAL_FORMATTING_EDIT:return P(r.columns),P(this.handleConditionalFormatEditorUpdate),h(GT,{columns:r.columns,rule:ue,onUpdate:this.handleConditionalFormatEditorUpdate,onSave:this.handleConditionalFormatEditorSave,onCancel:this.handleConditionalFormatEditorCancel});case _e.CUSTOM_COLUMN_BUILDER:return h(Wd,{model:r,customColumns:ke,onSave:this.handleUpdateCustomColumns,onCancel:this.handleMenuBack},_e.CUSTOM_COLUMN_BUILDER);case _e.ROLLUP_ROWS:return h(zd,{model:r,onChange:this.handleRollupChange,config:$t},_e.ROLLUP_ROWS);case _e.AGGREGATIONS:return h(jv,{settings:kt,isRollup:Jl,onChange:this.handleAggregationsChange,onEdit:this.handleAggregationEdit});case _e.AGGREGATION_EDIT:return Ln&&h(Zv,{aggregation:Ln,columns:r.originalColumns,onChange:this.handleAggregationChange});case _e.TABLE_EXPORTER:return h(an,{model:r,name:l,userColumnWidths:$s,movedColumns:le,isDownloading:vn,tableDownloadStatus:wt,tableDownloadProgress:Re,tableDownloadEstimatedTime:ot!=null?ot:void 0,onDownload:this.handleDownloadTable,onDownloadStart:this.handleDownloadTableStart,onCancel:this.handleCancelDownloadTable,selectedRanges:Qn},_e.TABLE_EXPORTER);case _e.SELECT_DISTINCT:return h(Sp,{model:r,selectDistinctColumns:be,onChange:this.handleSelectDistinctChanged});case _e.ADVANCED_SETTINGS:return h(Gd,{items:c,onChange:u});default:throw Error(`Unexpected option type ${Qe.type}`)}}),na=this.getCachedHiddenColumns(ne.getHiddenColumns($s));return v("div",{className:"iris-grid",role:"presentation",children:[v("div",{className:"iris-grid-column",children:[t!=null&&h("div",{className:"iris-grid-bar",children:t}),h(ut,{in:C,timeout:It.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:G&&Q&&O!=null&&h(bp,{table:G,getFormattedString:(Qe,en,Ss)=>r.displayString(Qe,en,Ss),columnName:Q.name,partition:O,onChange:this.handlePartitionChange,onFetchAll:this.handlePartitionFetchAll,onAppend:this.handlePartitionAppend,onDone:this.handlePartitionDone})})}),h(ut,{in:rt,timeout:It.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(Mr,{value:_t,selectedColumns:Zt,invertSelection:Jt,onChange:this.handleCrossColumnSearch,columns:r.columns,ref:this.crossColumnRef})})}),v("div",{className:"grid-wrapper",ref:Qe=>{this.gridWrapper=Qe},children:[h(to,{ref:Qe=>{this.grid=Qe},isStickyBottom:!Je(r)||!r.isEditable,isStuckToBottom:i,isStuckToRight:o,metricCalculator:g,model:r,keyHandlers:x,mouseHandlers:U,movedColumns:le,movedRows:he,onError:this.handleGridError,onViewChanged:this.handleViewChanged,onSelectionChanged:this.handleSelectionChanged,onMovedColumnsChanged:this.handleMovedColumnsChanged,renderer:this.renderer,stateOverride:lo,theme:Bs}),h(KT,{isOpen:ir,text:or,onClose:this.handleOverflowClose}),Zl&&h(cp,{model:r,modelColumns:r.columns,top:ar,bottom:dr,left:ao,right:co,filter:Ql,formatter:De,sorts:Me,reverseType:qe,movedColumns:le,customColumns:ke,hiddenColumns:na,alwaysFetchColumns:this.getAlwaysFetchColumns(d,r.columns,le,r.floatingLeftColumnCount,r.floatingRightColumnCount,(bc=(Cc=this.grid)==null?void 0:Cc.state.draggingColumn)==null?void 0:bc.range),formatColumns:this.getCachedPreviewFormatColumns(this.getCachedModelColumns(r,ke),ee,ue,((Sc=Tn[Tn.length-1])==null?void 0:Sc.type)===_e.CONDITIONAL_FORMATTING_EDIT&&Se!=null?Se:void 0),rollupConfig:this.getModelRollupConfig(r.originalColumns,$t,kt),totalsConfig:this.getModelTotalsConfig(r.columns,$t,kt),selectDistinctColumns:be,pendingRowCount:ql,pendingDataMap:tr,frozenColumns:sr}),!w&&h("div",{className:"grid-settings-button",children:h(z,{kind:"ghost","data-testid":`btn-iris-grid-settings-button-${l}`,onClick:this.handleMenu,icon:h(j,{icon:Af,transform:"up-1"}),tooltip:"Table Options"})}),cr,hr,mr,ur,pr,rr&&this.getOverflowButtonTooltip(rr)]}),h(YT,{model:r,isShown:lr,gotoRow:Xl,gotoRowError:jl,onSubmit:this.handleGotoRowSelectedRowNumberSubmit,onGotoRowNumberChanged:this.handleGotoRowSelectedRowNumberChanged,onClose:this.handleGotoRowClosed,onEntering:this.handleAnimationStart,onEntered:this.handleAnimationEnd,onExiting:()=>{this.handleAnimationStart(),this.focus()},onExited:this.handleAnimationEnd}),h(Ev,{error:Kl,isSaving:Us!=null,saveTooltip:`Commit (${this.commitAction.shortcut.getDisplayText()})`,discardTooltip:`Discard (${this.discardAction.shortcut.getDisplayText()})`,pendingDataErrors:Yl,pendingDataMap:tr,onEntering:this.handleAnimationStart,onEntered:this.handleAnimationEnd,onExiting:this.handleAnimationStart,onExited:this.handleAnimationEnd,onSave:this.handlePendingCommitClicked,onDiscard:this.handlePendingDiscardClicked}),h($v,{children:nr}),h(no,{model:r,copyOperation:y!=null?y:void 0,onEntering:this.handleAnimationStart,onEntered:this.handleAnimationEnd,onExiting:this.handleAnimationStart,onExited:this.handleAnimationEnd}),h(so,{ref:Qe=>{this.tableSaver=Qe},getDownloadWorker:n,onDownloadCompleted:this.handleDownloadCompleted,onDownloadCanceled:this.handleDownloadCanceled,onDownloadProgressUpdate:this.handleDownloadProgressUpdate,isDownloading:wt===an.DOWNLOAD_STATUS.DOWNLOADING,formatter:De})]}),h(ut,{in:w,timeout:It.transitionMidMs,classNames:"slide-left",onEntering:this.handleAnimationStart,onEntered:this.handleAnimationEnd,onExiting:this.handleAnimationStart,onExited:this.handleAnimationEnd,mountOnEnter:!0,unmountOnExit:!0,children:h("div",{className:"table-sidebar",children:v($C,{children:[h(Wc,{title:"Table Options",onClose:this.handleMenuClose,children:h(Bu,{onSelect:Qe=>this.handleMenuSelect(gr[Qe]),items:gr})}),ta.map((Qe,en)=>h(Wc,{title:Tn[en].title,onBack:this.handleMenuBack,onClose:this.handleMenuClose,children:Qe},Tn[en].type))]})})}),h(oe,{actions:this.contextActions})]})}};let io=Os;io.minDebounce=150;io.maxDebounce=500;io.loadingSpinnerDelay=800;io.defaultProps={children:null,advancedFilters:new Map,advancedSettings:new Map,alwaysFetchColumns:[],conditionalFormats:[],customColumnFormatMap:new Map,isFilterBarShown:!1,applyInputFiltersOnInit:!1,movedColumns:[],movedRows:[],inputFilters:[],customFilters:[],onCreateChart:void 0,onColumnSelected:()=>{},onDataSelected:()=>{},onError:()=>{},onStateChange:()=>{},onPartitionAppend:()=>{},onAdvancedSettingsChange:()=>{},partition:null,partitionColumn:null,quickFilters:new Map,selectDistinctColumns:[],sorts:[],reverseType:L.REVERSE_TYPE.NONE,customColumns:[],aggregationSettings:Tp,rollupConfig:void 0,userColumnWidths:new Map,userRowHeights:new Map,onSelectionChanged:()=>{},isSelectingColumn:!1,isSelectingPartition:!1,isStuckToBottom:!1,isStuckToRight:!1,columnSelectionValidator:null,columnAllowedCursor:null,columnNotAllowedCursor:null,name:"table",onlyFetchVisibleColumns:!0,showSearchBar:!1,searchValue:"",selectedSearchColumns:null,invertSearchColumns:!0,onContextMenu:()=>{},pendingDataMap:new Map,getDownloadWorker:void 0,settings:{timeZone:"America/New_York",defaultDateTimeFormat:ps.FULL_DATE_FORMAT,showTimeZone:!1,showTSeparator:!0,truncateNumbersWithPound:!1,formatter:[],decimalFormatOptions:R.exports.shape({defaultFormatString:R.exports.string}),integerFormatOptions:R.exports.shape({defaultFormatString:R.exports.string})},canCopy:!0,canDownloadCsv:!0,frozenColumns:null,theme:hp,canToggleSearch:!0};class JT extends Error{constructor(e,n){super(`${n} can't be empty (on pending row ${e+1})`),this.isMissingKey=!0,this.rowIndex=e,this.columnName=n}}const eE=X.module("ColumnHeaderGroup");function _h(t){return t instanceof Ep}class Ep{constructor({name:e,children:n,color:s,depth:i,childIndexes:o}){this.getVisibleRange=pe(r=>{const l=this.childIndexes.flat(),a=K.getVisibleIndexes(l,r),d=Math.min(...a),c=Math.max(...a);return c-d!==l.length-1&&eE.warn(`Column header group ${this.name} is not contiguous`),[d,c]}),this.name=e,this.children=n,this.color=s,this.depth=i,this.childIndexes=o}}const tt=X.module("IrisGridTableModel"),tE=150,nE=0;function li(t){return t.table!==void 0}const za=class extends Ce{constructor(t,e=new un,n=null){super(),this.pendingNewRowCount=0,this.columnHeaderGroupMap=new Map,this.columnHeaderParentMap=new Map,this._columnHeaderMaxDepth=null,this._columnHeaderGroups=[],this.getMemoizedColumnMap=pe(s=>{const i=new Map;return s.forEach(o=>i.set(o.name,o)),i}),this.getColumnIndicesByNameMap=pe(s=>{const i=new Map;return s.forEach(({name:o},r)=>i.set(o,r)),i}),this.setViewport=us((s,i,o)=>{if(i<s){tt.error("Invalid viewport",s,i);return}const{viewport:r}=this;if(r!=null&&r.top===s&&r.bottom===i&&r.columns===o){tt.debug2("Ignoring duplicate viewport",r);return}this.viewport={top:s,bottom:i,columns:o},tt.debug2("setViewport",this.viewport),this.applyViewport()},tE),this.applyViewport=us(()=>{if(!this.viewport)return;tt.debug2("applyViewport",this.viewport);const{top:s,bottom:i,columns:o}=this.viewport,[r,l]=this.getCachedViewportRowRange(s,i);this.applyBufferedViewport(r,l,o)},nE,{leading:!1}),this.getCachedFormattedString=dn((s,i,o,r,l)=>s.getFormattedString(i,o,r,l),{max:1e4}),this.getCachedCustomColumnFormatFlag=dn(hs.isCustomColumnFormatDefined,{max:1e4}),this.getCachedViewportRowRange=pe((s,i)=>{const o=i-s,r=Math.max(0,s-o*za.ROW_BUFFER_PAGES),l=i+o*za.ROW_BUFFER_PAGES;return[r,l]}),this.getCachedPendingErrors=pe((s,i,o)=>{const r=new Map;return s.forEach((l,a)=>{var c;const{data:d}=l;for(let u=0;u<o;u+=1)d.has(u)||(r.has(a)||r.set(a,[]),(c=r.get(a))==null||c.push(new JT(a,i[u].name)))}),r}),this.handleTableDisconnect=this.handleTableDisconnect.bind(this),this.handleTableReconnect=this.handleTableReconnect.bind(this),this.handleTableUpdate=this.handleTableUpdate.bind(this),this.handleTotalsUpdate=this.handleTotalsUpdate.bind(this),this.handleRequestFailed=this.handleRequestFailed.bind(this),this.handleCustomColumnsChanged=this.handleCustomColumnsChanged.bind(this),this.irisFormatter=e,this.inputTable=n,this.subscription=null,this.table=t,this.viewport=null,this.viewportData=null,this.formattedStringData=[],this.pendingStringData=[],this.isSaveInProgress=!1,this.totalsTable=null,this.totalsTablePromise=null,this.totals=null,this.totalsDataMap=null,this.pendingNewDataMap=new Map,this.pendingNewDataErrors=null,this.pendingNewRowCount=0}export(){throw new Error("Method not implemented.")}columnStatistics(t){throw new Error("Method not implemented.")}get customColumns(){return[]}set customColumns(t){throw new Error("Method not implemented.")}get formatColumns(){return[]}set formatColumns(t){throw new Error("Method not implemented.")}updateFrozenColumns(t){throw new Error("Method not implemented.")}get rollupConfig(){throw new Error("Method not implemented.")}set rollupConfig(t){throw new Error("Method not implemented.")}get selectDistinctColumns(){throw new Error("Method not implemented.")}set selectDistinctColumns(t){throw new Error("Method not implemented.")}get columns(){return this.table.columns}close(){this.table.close(),this.totalsTable!==null&&this.totalsTable.close(),this.totalsTablePromise!==null&&this.totalsTablePromise.cancel()}startListening(){super.startListening(),this.table.addEventListener(M.Table.EVENT_DISCONNECT,this.handleTableDisconnect),this.table.addEventListener(M.Table.EVENT_RECONNECT,this.handleTableReconnect),this.table.addEventListener(M.Table.EVENT_UPDATED,this.handleTableUpdate),this.table.addEventListener(M.Client.EVENT_REQUEST_FAILED,this.handleRequestFailed),this.table.addEventListener(M.Table.EVENT_CUSTOMCOLUMNSCHANGED,this.handleCustomColumnsChanged),this.totalsTable!=null&&this.addTotalsListeners(this.totalsTable),this.applyViewport()}stopListening(){super.stopListening(),this.table.removeEventListener(M.Table.EVENT_DISCONNECT,this.handleTableDisconnect),this.table.removeEventListener(M.Table.EVENT_RECONNECT,this.handleTableReconnect),this.table.removeEventListener(M.Table.EVENT_UPDATED,this.handleTableUpdate),this.table.removeEventListener(M.Client.EVENT_REQUEST_FAILED,this.handleRequestFailed),this.table.removeEventListener(M.Table.EVENT_CUSTOMCOLUMNSCHANGED,this.handleCustomColumnsChanged),this.totalsTable!=null&&this.removeTotalsListeners(this.totalsTable),this.closeSubscription()}addTotalsListeners(t){t.addEventListener(M.Table.EVENT_UPDATED,this.handleTotalsUpdate),t.setViewport(0,0)}removeTotalsListeners(t){t.removeEventListener(M.Table.EVENT_UPDATED,this.handleTotalsUpdate)}handleTableDisconnect(){this.dispatchEvent(new Ge(Ce.EVENT.DISCONNECT))}handleTableReconnect(){this.dispatchEvent(new Ge(Ce.EVENT.RECONNECT))}handleTableUpdate(t){this.copyViewportData(t.detail),this.dispatchEvent(new Ge(Ce.EVENT.UPDATED))}handleTotalsUpdate(t){this.copyTotalsData(t.detail),this.dispatchEvent(new Ge(Ce.EVENT.UPDATED))}handleRequestFailed(t){this.dispatchEvent(new Ge(Ce.EVENT.REQUEST_FAILED,t))}handleCustomColumnsChanged(){this.dispatchEvent(new Ge(Ce.EVENT.COLUMNS_CHANGED,{detail:this.columns}))}get rowCount(){var t,e,n;return this.table.size+this.pendingNewRowCount+((n=(e=(t=this.totals)==null?void 0:t.operationOrder)==null?void 0:e.length)!=null?n:0)}get pendingDataErrors(){var t,e;return this.getCachedPendingErrors(this.pendingNewDataMap,this.columns,(e=(t=this.inputTable)==null?void 0:t.keyColumns.length)!=null?e:0)}get pendingDataMap(){return this.pendingNewDataMap}set pendingDataMap(t){t!==this.pendingNewDataMap&&(t.forEach((e,n)=>{if(!ne.isValidIndex(n))throw new Error(`Invalid rowIndex ${n}`);const{data:s}=e;s.forEach((i,o)=>{if(!ne.isValidIndex(o))throw new Error(`Invalid columnIndex ${o}`)})}),this.pendingNewDataMap=t,this.pendingNewRowCount=Math.max(this.pendingNewRowCount,this.maxPendingDataRow),this.formattedStringData=[],this.dispatchEvent(new Ge(Ce.EVENT.PENDING_DATA_UPDATED)))}get pendingRowCount(){return this.pendingNewRowCount}set pendingRowCount(t){t!==this.pendingNewRowCount&&(this.pendingNewRowCount=Math.max(0,t,this.maxPendingDataRow),this.dispatchEvent(new Ge(Ce.EVENT.UPDATED)))}get maxPendingDataRow(){return this.pendingNewDataMap.size>0?Math.max(...this.pendingNewDataMap.keys())+1:0}get columnCount(){return this.columns.length}get floatingBottomRowCount(){var t,e,n;return this.totals!=null&&this.totals.showOnTop?0:(n=(e=(t=this.totals)==null?void 0:t.operationOrder)==null?void 0:e.length)!=null?n:0}get floatingTopRowCount(){var t,e,n;return this.totals!=null&&this.totals.showOnTop&&(n=(e=(t=this.totals)==null?void 0:t.operationOrder)==null?void 0:e.length)!=null?n:0}get isChartBuilderAvailable(){return!0}get isTotalsAvailable(){return this.table.getTotalsTable!=null}get isEditable(){return!this.isSaveInProgress&&this.inputTable!=null}cacheFormattedValue(t,e,n){this.formattedStringData[t]==null&&(this.formattedStringData[t]=[]),this.formattedStringData[t][e]=n}cachePendingValue(t,e,n){this.pendingStringData[t]==null&&(this.pendingStringData[t]=[]),this.pendingStringData[t][e]=n}clearPendingValue(t,e){const n=this.pendingStringData[t];n!=null&&delete n[e]}textValueForCell(t,e){var n,s,i;if(((n=this.pendingStringData[t])==null?void 0:n[e])!==void 0)return this.pendingStringData[t][e];if(((s=this.formattedStringData[t])==null?void 0:s[e])===void 0){const o=this.valueForCell(t,e);if(o==null)return null;const r=(i=this.totalsColumn(t,e))!=null?i:this.columns[t],l=this.getCachedCustomColumnFormatFlag(this.formatter,r.name,r.type);let a;if(!l){const c=this.formatForCell(t,e);(c==null?void 0:c.formatString)!=null&&(a=c)}const d=this.displayString(o,r.type,r.name,a);this.cacheFormattedValue(t,e,d)}return this.formattedStringData[t][e]}textForCell(t,e){const n=this.textValueForCell(t,e);if(n==null&&this.isKeyColumn(t)){const s=this.pendingRow(e);if(s!=null&&this.pendingDataMap.has(s))return"*"}return n!=null?n:""}truncationCharForCell(t){const e=this.columns[t],{type:n}=e;if(L.isNumberType(n)&&this.formatter.truncateNumbersWithPound)return"#"}colorForCell(t,e,n){var i;const s=this.dataForCell(t,e);if(s){const{format:o,value:r}=s;if(r==null||r==="")return P(n.nullStringColor),n.nullStringColor;if(o&&o.color)return o.color;if(this.isPendingRow(e))return P(n.pendingTextColor),n.pendingTextColor;if(r!=null){const l=(i=this.totalsColumn(t,e))!=null?i:this.columns[t];if(L.isDateType(l.type)||l.name==="Date")return P(n.dateColor),n.dateColor;if(L.isNumberType(l.type))return r>0?(P(n.positiveNumberColor),n.positiveNumberColor):r<0?(P(n.negativeNumberColor),n.negativeNumberColor):(P(n.zeroNumberColor),n.zeroNumberColor)}}else if(this.isPendingRow(e)&&this.isKeyColumn(t))return P(n.errorTextColor),n.errorTextColor;return n.textColor}backgroundColorForCell(t,e){var n,s;return(s=(n=this.formatForCell(t,e))==null?void 0:n.backgroundColor)!=null?s:null}textAlignForCell(t){const e=this.columns[t],{type:n}=e;return L.isNumberType(n)?"right":L.isDateType(n)||e.name==="Date"?"center":"left"}textForColumnHeader(t,e=0){var n,s;return(s=(n=this.columnAtDepth(t,e))==null?void 0:n.name)!=null?s:void 0}colorForColumnHeader(t,e=0){var s;const n=this.columnAtDepth(t,e);return _h(n)&&(s=n.color)!=null?s:null}getColumnHeaderGroup(t,e){const n=this.columnAtDepth(t,e);if(_h(n))return n}getColumnHeaderParentGroup(t,e){var n,s;return this.columnHeaderParentMap.get((s=(n=this.columnAtDepth(t,e))==null?void 0:n.name)!=null?s:"")}columnAtDepth(t,e=0){var o;if(e===0)return this.columns[t];const n=(o=this.columns[t])==null?void 0:o.name;let s=this.columnHeaderParentMap.get(n);if(!s)return;let i=s.depth;for(;i<e;){if(s=this.columnHeaderParentMap.get(s.name),!s)return;i=s.depth}if(s.depth===e)return s}textForRowFooter(t){const e=this.totalsRow(t);return e!=null&&this.totals?this.totals.operationOrder[e]:""}get movedColumns(){var i;let t=[];const e=(o,r)=>{const l=this.getColumnIndexByName(o);if(l==null)throw new Error(`Unknown layout hint column: ${o}`);const a=K.getVisibleIndex(l,t);t=K.moveItem(a,r,t)},n=(o,r)=>{const l=this.columnHeaderGroupMap.get(o);if(!l)throw new Error(`Unknown layout hint group: ${o}`);const a=l.getVisibleRange(t);t=K.moveRange(a,r,t)};if(this.frontColumns.length||this.backColumns.length||this.frozenColumns.length){const o=new Set;let r=0;this.frozenColumns.forEach(a=>{if(o.has(a))throw new Error(`Column specified in multiple layout hints: ${a}`);e(a,r),r+=1}),this.frontColumns.forEach(a=>{if(o.has(a))throw new Error(`Column specified in multiple layout hints: ${a}`);e(a,r),r+=1});let l=this.columnMap.size-1;this.backColumns.forEach(a=>{if(o.has(a))throw new Error(`Column specified in multiple layout hints: ${a}`);e(a,l),l-=1})}const s=(i=this.layoutHints)==null?void 0:i.columnGroups;if(s){this.setColumnHeaderGroups(s);const o=[...this.columnHeaderGroupMap.values()];o.sort((r,l)=>r.depth-l.depth),o.forEach(r=>{const l=r.children[0],a=this.getColumnIndexByName(l);let d;if(a!=null)d=K.getVisibleIndex(a,t);else{const c=this.columnHeaderGroupMap.get(l);if(!c)throw new Error(`Unknown column ${l} in group ${r.name}`);[,d]=c.getVisibleRange(t)}for(let c=1;c<r.children.length;c+=1){const u=r.children[c],m=this.columnHeaderGroupMap.get(u),p=this.getColumnIndexByName(u);if(m){const f=m.getVisibleRange(t)[0]<d?d-m.childIndexes.length+1:d+1;n(u,f),d=f+m.childIndexes.length-1}else if(p!=null){const f=K.getVisibleIndex(p,t)<d?d:d+1;e(u,f),d=f}}})}return t}get columnMap(){return this.getMemoizedColumnMap(this.table.columns)}get columnHeaderMaxDepth(){var t,e;return this._columnHeaderMaxDepth==null&&this.setColumnHeaderGroups((t=this.layoutHints)==null?void 0:t.columnGroups),(e=this._columnHeaderMaxDepth)!=null?e:1}set columnHeaderMaxDepth(t){this._columnHeaderMaxDepth=t}setColumnHeaderGroups(t){if(t===this._columnHeaderGroups||(this._columnHeaderGroups=t!=null?t:[],this.columnHeaderMaxDepth=1,this.columnHeaderParentMap=new Map,this.columnHeaderGroupMap=new Map,!t||t.length===0))return;const e=new Map(t.map(o=>[o.name,o])),n=new Set,s=o=>{const{name:r}=o;if(this.getColumnIndexByName(r)!=null)throw new Error(`Column header group has same name as column: ${r}`);const l=this.columnHeaderGroupMap.get(r);if(l)return l;const a=[];let d=1;o.children.forEach(u=>{if(n.has(u))throw new Error(`Column group child ${u} specified in multiple groups`);n.add(u);const m=e.get(u),p=this.getColumnIndexByName(u);if(m){const g=s(m);a.push(g.childIndexes.flat()),d=Math.max(d,g.depth+1)}else if(p!=null)a.push(p),d=Math.max(d,1);else throw new Error(`Unknown child ${u} in group ${r}`)});const c=new Ep({...o,depth:d,childIndexes:a});return this.columnHeaderGroupMap.set(r,c),o.children.forEach(u=>this.columnHeaderParentMap.set(u,c)),this.columnHeaderMaxDepth=Math.max(this.columnHeaderMaxDepth,c.depth+1),c},i=new Set;t.forEach(o=>{const{name:r}=o;if(i.has(r))throw new Error(`Duplicate column group name: ${r}`);i.add(r),s(o)})}get groupedColumns(){return[]}row(t){var l,a,d,c,u,m,p,g,f,b,C,w,T,y;const e=(d=(a=(l=this.totals)==null?void 0:l.operationOrder)==null?void 0:a.length)!=null?d:0,n=(u=(c=this.totals)==null?void 0:c.showOnTop)!=null?u:!1,s=this.totalsRow(t);if(s!=null){const E=(m=this.totals)==null?void 0:m.operationOrder[s];return P(E),(g=(p=this.totalsDataMap)==null?void 0:p.get(E))!=null?g:null}const i=this.pendingRow(t);if(i!=null)return(f=this.pendingNewDataMap.get(i))!=null?f:null;const o=(C=(b=this.viewportData)==null?void 0:b.offset)!=null?C:0,r=(n?t-e:t)-o;return(y=(T=(w=this.viewportData)==null?void 0:w.rows)==null?void 0:T[r])!=null?y:null}totalsColumn(t,e){var r,l,a,d;const n=this.totalsRow(e);if(n==null)return null;const s=(r=this.totals)==null?void 0:r.operationOrder[n],i=(a=(l=this.totals)==null?void 0:l.defaultOperation)!=null?a:Oe.SUM,o=this.columns[t];return(d=this.totalsTable)==null?void 0:d.columns.find(c=>{var u;return c.name===`${o.name}__${s}`||(s===i||((u=this.totals)==null?void 0:u.operationOrder.length)===1)&&c.name===o.name})}totalsRow(t){var i,o,r,l,a;const e=(r=(o=(i=this.totals)==null?void 0:i.operationOrder)==null?void 0:o.length)!=null?r:0,s=((a=(l=this.totals)==null?void 0:l.showOnTop)!=null?a:!1)?t:t-this.table.size;return s>=0&&s<e?s:null}pendingRow(t){const e=t-this.floatingTopRowCount-this.table.size;return e>=0&&e<this.pendingNewRowCount?e:null}isTotalsRow(t){return this.totalsRow(t)!=null}isPendingRow(t){return this.pendingRow(t)!=null}dataForCell(t,e){var n;return(n=this.row(e))==null?void 0:n.data.get(t)}formatForCell(t,e){var n;return(n=this.dataForCell(t,e))==null?void 0:n.format}valueForCell(t,e){var s;const n=this.dataForCell(t,e);if(n)return(s=n.value)!=null?s:null}copyViewportData(t){if(t==null){tt.warn("invalid data!");return}this.viewportData=this.extractViewportData(t),this.formattedStringData=[]}copyTotalsData(t){var l,a,d,c,u;if(t==null){tt.warn("invalid data!");return}const{columns:e,rows:n}=t;if(n.length!==1){tt.error("Unexpected number of rows received for totals table, ignoring update");return}const s=new Map,i=n[0],o=(a=(l=this.totals)==null?void 0:l.defaultOperation)!=null?a:Oe.SUM,r=(d=this.totals)==null?void 0:d.operationMap;for(let m=0;m<e.length;m+=1){const p=e[m],[g,f=(u=(c=r==null?void 0:r[g])==null?void 0:c[0])!=null?u:o]=p.name.split("__");s.has(f)||s.set(f,{data:new Map});const{data:b}=s.get(f),C=this.columns.findIndex(w=>w.name===g);b.set(C,{value:i.get(p),format:i.getFormat(p)})}tt.debug2("copyTotalsData",s),this.totalsDataMap=s,this.formattedStringData=[]}getColumnIndexByName(t){return this.getColumnIndicesByNameMap(this.columns).get(t)}extractViewportData(t){const e={offset:t.offset,rows:[]},{columns:n}=t;for(let s=0;s<t.rows.length;s+=1){const i=t.rows[s],o=this.extractViewportRow(i,n);e.rows.push(o)}return e}extractViewportRow(t,e){const n=new Map;for(let s=0;s<e.length;s+=1){const i=e[s],o=this.getColumnIndexByName(i.name);P(o),n.set(o,{value:t.get(i),format:t.getFormat(i)})}return{data:n}}closeSubscription(){tt.debug2("closeSubscription",this.subscription),this.subscription&&(this.subscription.close(),this.subscription=null),this.setViewport.cancel(),this.applyViewport.cancel()}get filter(){return this.table.filter}set filter(t){this.closeSubscription(),this.table.applyFilter(t),this.applyViewport()}get formatter(){return this.irisFormatter}set formatter(t){this.irisFormatter=t,this.formattedStringData=[],this.dispatchEvent(new Ge(Ce.EVENT.FORMATTER_UPDATED))}displayString(t,e,n="",s){return this.getCachedFormattedString(this.formatter,t,e,n,s)}get sort(){return this.table.sort}set sort(t){this.closeSubscription(),this.table.applySort(t),this.applyViewport()}set totalsConfig(t){if(tt.debug("set totalsConfig",t),t!==this.totals){if(this.totals=t,this.formattedStringData=[],this.totalsTablePromise!=null&&this.totalsTablePromise.cancel(),this.setTotalsTable(null),t==null){this.dispatchEvent(new Ge(Ce.EVENT.UPDATED));return}this.totalsTablePromise=Te.makeCancelable(this.table.getTotalsTable(t),e=>e.close()),this.totalsTablePromise.then(e=>{this.totalsTablePromise=null,this.setTotalsTable(e)}).catch(e=>{Te.isCanceled(e)||(tt.error("Unable to set next totalsTable",e),this.totalsTablePromise=null,this.dispatchEvent(new Ge(Ce.EVENT.REQUEST_FAILED,{detail:e})))})}}setTotalsTable(t){tt.debug("setTotalsTable",t),this.totalsTable!==null&&(this.listenerCount>0&&this.removeTotalsListeners(this.totalsTable),this.totalsTable.close()),this.totalsTable=t,this.totalsDataMap=null,this.listenerCount>0&&this.totalsTable!=null&&this.addTotalsListeners(this.totalsTable)}applyBufferedViewport(t,e,n){tt.debug2("applyBufferedViewport",t,e,n),this.subscription==null?(tt.debug2("applyBufferedViewport creating new subscription"),this.subscription=this.table.setViewport(t,e,n)):(tt.debug2("applyBufferedViewport using existing subscription"),this.subscription.setViewport(t,e,n))}async snapshot(t,e=!1,n=i=>i,s=!0){if(this.subscription==null)throw new Error("No subscription available");const i=s?re.consolidate(t):t;if(!ne.isValidSnapshotRanges(i))throw new Error(`Invalid snapshot ranges ${t}`);const o=new Set,r=[],l=new Set;for(let m=0;m<i.length;m+=1){const p=i[m];P(p.endRow),P(p.startRow);for(let g=p.startRow;g<=p.endRow&&g<this.floatingTopRowCount;g+=1)o.add(g);p.endRow>=this.floatingTopRowCount&&p.startRow<=this.floatingTopRowCount+this.table.size&&r.push(new re(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(i,this.columns),d=[];e&&d.push(a.map(m=>m.name));const c=[...o].sort();for(let m=0;m<c.length;m+=1){const p=c[m],g=a.map(f=>{const b=this.getColumnIndexByName(f.name);return P(b),n(this.valueForCell(b,p),f)});e&&g.push(this.textForRowFooter(p)),d.push(g)}if(r.length>0){const m=ne.rangeSetFromRanges(r),p=await this.subscription.snapshot(m,a);d.push(...p.rows.map(g=>a.map(f=>n(g.get(f),f))))}const u=[...l].sort();for(let m=0;m<u.length;m+=1){const p=u[m],g=a.map(f=>{const b=this.getColumnIndexByName(f.name);return P(b),n(this.valueForCell(b,p),f)});e&&g.push(this.textForRowFooter(p)),d.push(g)}return d}async textSnapshot(t,e=!1,n=s=>`${s}`){return tt.debug2("textSnapshot",t,e),(await this.snapshot(t,e,n,!1)).map(i=>i.join(" ")).join(`
|
|
36
36
|
`)}async valuesTable(t){let e=null;try{return e=await this.table.copy(),e.applyFilter([]),e.applySort([]),e.selectDistinct([t])}finally{e!=null&&e.close()}}isColumnMovable(t,e){if(t<0||t>=this.columnCount)return!1;if(e>0)return!0;const n=this.columns[t].name;return this.frontColumns.includes(n)||this.backColumns.includes(n)||this.frozenColumns.includes(n)||!n?!1:!this.isKeyColumn(t)}isKeyColumn(t){var e,n;return t<((n=(e=this.inputTable)==null?void 0:e.keyColumns.length)!=null?n:0)}isRowMovable(){return!1}isEditableRange(t){return this.inputTable!=null&&re.isBounded(t)&&(this.isPendingRow(t.startRow)&&this.isPendingRow(t.endRow)||t.startColumn>=this.inputTable.keyColumns.length&&t.endColumn>=this.inputTable.keyColumns.length)&&t.startRow>=this.floatingTopRowCount&&t.startRow<this.floatingTopRowCount+this.table.size+this.pendingRowCount&&t.endRow<this.floatingTopRowCount+this.table.size+this.pendingRowCount}isDeletableRange(t){return this.inputTable!=null&&t.startRow!=null&&t.endRow!=null&&t.startRow>=this.floatingTopRowCount&&t.startRow<this.floatingTopRowCount+this.table.size+this.pendingRowCount&&t.endRow<this.floatingTopRowCount+this.table.size+this.pendingRowCount}isEditableRanges(t){return t.every(e=>this.isEditableRange(e))}isDeletableRanges(t){return t.every(e=>this.isDeletableRange(e))}getTableAreaRange(){return new re(null,this.floatingTopRowCount,null,this.floatingTopRowCount+this.table.size-1)}getPendingAreaRange(){return new re(null,this.floatingTopRowCount+this.table.size,null,this.floatingTopRowCount+this.table.size+this.pendingNewRowCount-1)}async setValueForCell(t,e,n){return this.setValueForRanges([new re(t,e,t,e)],n)}async setValueForRanges(t,e){var n;if(!this.isEditableRanges(t))throw new Error(`Uneditable ranges ${t}`);try{const s=new Set,i=[];re.forEachCell(t,(d,c)=>{const u=this.columns[d];if(s.add(u),i[d]===void 0){const m=L.makeValue(u.type,e,this.formatter.timeZone);i[d]=m!=null?this.displayString(m,u.type,u.name):null}this.cachePendingValue(d,c,i[d])});const o=this.getPendingAreaRange(),r=t.map(d=>re.intersection(o,d)).filter(d=>d!=null).map(d=>(P(d),re.offset(d,0,-(this.floatingTopRowCount+this.table.size))));if(r.length>0){const d=new Map(this.pendingNewDataMap);re.forEachCell(r,(c,u)=>{d.has(u)||d.set(u,{data:new Map});const m=this.columns[c],p=d.get(u);P(p);const{data:g}=p,f=new Map(g),b=L.makeValue(m.type,e,this.formatter.timeZone);b!=null?f.set(c,{value:b}):f.delete(c),f.size>0?d.set(u,{...p,data:f}):d.delete(u)}),this.pendingDataMap=d}this.dispatchEvent(new Ge(Ce.EVENT.UPDATED));const l=this.getTableAreaRange(),a=t.map(d=>re.intersection(l,d)).filter(d=>d!=null);if(a.length>0){const c=(await this.snapshot(a.map(m=>{var p,g;return new re(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]=L.makeValue(g.type,e,this.formatter.timeZone)}),p}),u=await((n=this.inputTable)==null?void 0:n.addRows(c));tt.debug("setValueForRanges(",t,",",e,") set tableRanges",a,"result",u)}re.forEachCell(t,(d,c)=>{const u=i[d];P(u),this.cacheFormattedValue(d,c,u)})}catch(s){tt.error("Unable to set ranges",t,e,s)}finally{re.forEachCell(t,(s,i)=>{this.clearPendingValue(s,i)})}}async setValues(t=[]){var e;if(tt.debug("setValues(",t,")"),!t.every(n=>{var s,i;return this.isEditableRange(re.makeCell((s=n.column)!=null?s:n.x,(i=n.row)!=null?i:n.y))}))throw new Error(`Uneditable ranges ${t}`);try{const n=new Map(this.pendingNewDataMap);t.forEach(l=>{var f,b;const{text:a}=l,d=(f=l.column)!=null?f:l.x,c=(b=l.row)!=null?b:l.y,u=this.columns[d],m=L.makeValue(u.type,a,this.formatter.timeZone),p=m!=null?this.displayString(m,u.type,u.name):null;this.cachePendingValue(d,c,p);const g=this.pendingRow(c);if(g!=null){n.has(g)||n.set(g,{data:new Map});const C=n.get(g);P(C);const{data:w}=C,T=new Map(w);m!=null?T.set(d,{value:m}):T.delete(d),T.size>0?n.set(g,{...C,data:T}):n.delete(g)}}),this.pendingDataMap=n,this.dispatchEvent(new Ge(Ce.EVENT.UPDATED));const s=t.reduce((l,a)=>{var c,u;const d=(c=a.row)!=null?c:a.y;return l.has(d)||l.set(d,[]),(u=l.get(d))==null||u.push(a),l},new Map),i=re.consolidate(t.map(l=>{var a,d;return re.makeCell((a=l.column)!=null?a:l.x,(d=l.row)!=null?d:l.y)})),o=this.getTableAreaRange(),r=i.map(l=>re.intersection(o,l)).filter(l=>l!=null);if(r.length>0){const a=(await this.snapshot(r.map(c=>(P(c),new re(null,c.startRow,null,c.endRow))))).map((c,u)=>{let m=null,p=u;for(let b=0;b<r.length;b+=1){const C=r[b];P(C);const w=re.rowCount([C]);if(p<w){P(C.startRow),m=C.startRow+p;break}p-=w}const g={};for(let b=0;b<this.columns.length;b+=1)g[this.columns[b].name]=c[b];P(m);const f=s.get(m);return f!=null&&f.forEach(b=>{var w;const C=this.columns[(w=b.column)!=null?w:b.x];g[C.name]=L.makeValue(C.type,b.text,this.formatter.timeZone)}),g});tt.info("setValues setting tableRanges",r);const d=await((e=this.inputTable)==null?void 0:e.addRows(a));tt.info("setValues set tableRanges",r,"SUCCESS",d)}t.forEach(l=>{var g,f;const{text:a}=l,d=(g=l.column)!=null?g:l.x,c=(f=l.row)!=null?f:l.y,u=this.columns[d],m=L.makeValue(u.type,a,this.formatter.timeZone),p=m!=null?this.displayString(m,u.type,u.name):null;this.cacheFormattedValue(d,c,p)})}finally{t.forEach(n=>{this.clearPendingValue(n.column,n.row)})}}async commitPending(){var t,e,n;if(this.pendingNewDataMap.size<=0)throw new Error("No pending changes to commit");try{this.isSaveInProgress=!0;const s=[];this.pendingNewDataMap.forEach(o=>{const r={};o.data.forEach(({value:l},a)=>{const d=this.columns[a];r[d.name]=l}),s.push(r)});const i=await((t=this.inputTable)==null?void 0:t.addRows(s));tt.debug("commitPending()",this.pendingNewDataMap,"result",i),this.pendingNewDataMap=new Map,this.pendingNewDataErrors=new Map,this.pendingNewRowCount=Math.max(0,((n=(e=this.viewport)==null?void 0:e.bottom)!=null?n:0)-this.table.size),this.formattedStringData=[],this.dispatchEvent(new Ge(Ce.EVENT.PENDING_DATA_UPDATED))}finally{this.isSaveInProgress=!1}}editValueForCell(t,e){return this.textValueForCell(t,e)}async delete(t){if(!this.isDeletableRanges(t))throw new Error(`Undeletable ranges ${t}`);P(this.inputTable);const{keyColumns:e}=this.inputTable;if(e.length===0)throw new Error("No key columns to allow deletion");const n=this.getPendingAreaRange(),s=t.map(c=>re.intersection(n,c)).filter(c=>c!=null).map(c=>(P(c),re.offset(c,0,-(this.floatingTopRowCount+this.table.size))));if(s.length>0){const c=new Map(this.pendingNewDataMap);for(let u=0;u<s.length;u+=1){const m=s[u];P(m.startRow),P(m.endRow);for(let p=m.startRow;p<=m.endRow;p+=1)c.delete(p)}this.pendingNewDataMap=c,this.formattedStringData=[],this.dispatchEvent(new Ge(Ce.EVENT.PENDING_DATA_UPDATED)),this.dispatchEvent(new Ge(Ce.EVENT.UPDATED))}const i=this.getTableAreaRange(),o=t.map(c=>re.intersection(i,c)).filter(c=>c!=null);if(o.length<=0)return;const[r,l]=await Promise.all([this.snapshot(o.map(c=>(P(c),new re(0,c.startRow,e.length-1,c.endRow)))),this.table.copy()]),d=r.map(c=>{const u=[];for(let m=0;m<e.length;m+=1){const p=e[m],g=c[m],f=L.makeFilterRawValue(p.type,g),b=p.filter().eq(f);u.push(b)}return u.reduce((m,p)=>{var g;return(g=m==null?void 0:m.and(p))!=null?g:p})}).reduce((c,u)=>{var m;return(m=c==null?void 0:c.or(u))!=null?m:u});l.applyFilter([d]),l.close()}isValidForCell(t,e,n){try{const s=this.columns[t];return L.makeValue(s.type,n,this.formatter.timeZone),!0}catch{return!1}}};let Kd=za;Kd.ROW_BUFFER_PAGES=1;const Ns=X.module("IrisGridTableModel");class yp extends Kd{constructor(e,n=new un,s=null){super(e,n,s),this.getMemoizedFrontColumns=pe(i=>i!=null?i:[]),this.getMemoizedBackColumns=pe(i=>i!=null?i:[]),this.getMemoizedFrozenColumns=pe((i,o)=>{var r;return(r=o!=null?o:i)!=null?r:[]}),this.getCachedFilterableColumnSet=pe(i=>new Set(i.map((o,r)=>r))),this.customColumnList=[],this.formatColumnList=[]}get isExportAvailable(){return this.table.freeze!=null}get isColumnStatisticsAvailable(){return this.table.getColumnStatistics!=null}get isValuesTableAvailable(){return this.table.selectDistinct!=null&&this.table.copy!=null}get isRollupAvailable(){return this.table.rollup!=null}get isSelectDistinctAvailable(){return this.table.selectDistinct!=null}get isCustomColumnsAvailable(){return this.table.applyCustomColumns!=null}get isFormatColumnsAvailable(){return this.table.applyCustomColumns!=null}get frontColumns(){var e;return this.getMemoizedFrontColumns((e=this.layoutHints)==null?void 0:e.frontColumns)}get backColumns(){var e;return this.getMemoizedBackColumns((e=this.layoutHints)==null?void 0:e.backColumns)}get frozenColumns(){var e;return this.getMemoizedFrozenColumns((e=this.layoutHints)==null?void 0:e.frozenColumns,this.userFrozenColumns)}get layoutHints(){return this.table.layoutHints}get floatingLeftColumnCount(){return this.frozenColumns.length}get description(){return this.table.description}get customColumns(){return this.customColumnList}set customColumns(e){if(Ns.debug2("set customColumns",e,this.customColumnList,e===this.customColumnList),this.customColumnList.length===0&&e.length===0){Ns.debug("Ignore empty initial customColumns"),this.customColumnList=e;return}if(this.customColumnList===e){Ns.debug("Ignore same customColumns");return}this.closeSubscription(),this.customColumnList=e,this.table.applyCustomColumns([...e,...this.formatColumns]),this.applyViewport()}get formatColumns(){return this.formatColumnList}set formatColumns(e){if(Ns.debug2("set formatColumns",e,this.formatColumnList,e===this.formatColumnList),this.formatColumnList.length===0&&e.length===0){Ns.debug("Ignore empty initial formatColumns"),this.formatColumnList=e;return}if(this.formatColumnList===e){Ns.debug("Ignore same formatColumns");return}this.closeSubscription(),this.formatColumnList=e,this.table.applyCustomColumns([...this.customColumns,...e]),this.applyViewport()}updateFrozenColumns(e){this.userFrozenColumns=e,this.dispatchEvent(new Ge(Ce.EVENT.TABLE_CHANGED,{detail:this.table}))}set totalsConfig(e){if(Ns.debug("set totalsConfig",e),e!==this.totals){if(this.totals=e,this.formattedStringData=[],this.totalsTablePromise!=null&&this.totalsTablePromise.cancel(),this.setTotalsTable(null),e==null){this.dispatchEvent(new Ge(Ce.EVENT.UPDATED));return}this.totalsTablePromise=Te.makeCancelable(this.table.getTotalsTable(e),n=>n.close()),this.totalsTablePromise.then(n=>{this.totalsTablePromise=null,this.setTotalsTable(n)}).catch(n=>{Te.isCanceled(n)||(Ns.error("Unable to set next totalsTable",n),this.totalsTablePromise=null,this.dispatchEvent(new Ge(Ce.EVENT.REQUEST_FAILED,{detail:n})))})}}get isFilterRequired(){return this.table.isUncoalesced}isFilterable(e){return this.getCachedFilterableColumnSet(this.columns).has(e)}async export(){return this.table.freeze()}columnStatistics(e){return this.table.getColumnStatistics(e)}isColumnMovable(e){const n=this.columns[e].name;return this.frontColumns.includes(n)||this.backColumns.includes(n)||this.frozenColumns.includes(n)?!1:!this.isKeyColumn(e)}isColumnFrozen(e){return this.frozenColumns.includes(this.columns[e].name)}async delete(e){var u;if(!this.isDeletableRanges(e))throw new Error(`Undeletable ranges ${e}`);P(this.inputTable);const{keyColumns:n}=this.inputTable;if(n.length===0)throw new Error("No key columns to allow deletion");const s=this.getPendingAreaRange(),i=e.map(m=>re.intersection(s,m)).filter(m=>m!=null).map(m=>(P(m),re.offset(m,0,-(this.floatingTopRowCount+this.table.size))));if(i.length>0){const m=new Map(super.pendingDataMap);for(let p=0;p<i.length;p+=1){const g=i[p];P(g.startRow),P(g.endRow);for(let f=g.startRow;f<=g.endRow;f+=1)m.delete(f)}super.pendingDataMap=m,this.formattedStringData=[],this.dispatchEvent(new Ge(Ce.EVENT.PENDING_DATA_UPDATED)),this.dispatchEvent(new Ge(Ce.EVENT.UPDATED))}const o=this.getTableAreaRange(),r=e.map(m=>re.intersection(o,m)).filter(m=>m!=null);if(r.length<=0)return;const[l,a]=await Promise.all([this.snapshot(r.map(m=>(P(m),new re(0,m.startRow,n.length-1,m.endRow)))),this.table.copy()]),c=l.map(m=>{const p=[];for(let g=0;g<n.length;g+=1){const f=n[g],b=m[g],C=L.makeFilterRawValue(f.type,b),w=f.filter().eq(C);p.push(w)}return p.reduce((g,f)=>{var b;return(b=g==null?void 0:g.and(f))!=null?b:f})}).reduce((m,p)=>{var g;return(g=m==null?void 0:m.or(p))!=null?g:p});a.applyFilter([c]),await((u=this.inputTable)==null?void 0:u.deleteTable(a)),a.close()}}class sE extends Kd{constructor(){super(...arguments),this.getCachedFilterableColumnSet=pe((e,n)=>new Set(((n==null?void 0:n.length)>0?n:e).map(s=>e.findIndex(i=>s.name===i.name))))}applyBufferedViewport(e,n,s){this.table.setViewport(e,n,s)}textForCell(e,n){const s=this.columns[e],i=this.row(n);if(i!=null&&s!=null&&!i.hasChildren&&s.constituentType!=null){const o=this.valueForCell(e,n);return this.displayString(o,s.constituentType,s.name)}return super.textForCell(e,n)}extractViewportRow(e,n){const{isExpanded:s,hasChildren:i,depth:o}=e;return{...super.extractViewportRow(e,n),isExpanded:s,hasChildren:i,depth:o}}async snapshot(e,n,s){var l,a;P(this.viewport),P(this.viewportData);const{columns:i}=this.viewport,o=[];n!=null&&n&&o.push(i.map(d=>d.name));const r=new re(0,(l=this.viewportData)==null?void 0:l.offset,i.length,this.viewportData.offset+this.viewportData.rows.length);for(let d=0;d<e.length;d+=1){const c=re.intersection(r,e[d]);P(c),P(c.startRow),P(c.endRow);for(let u=c.startRow;u<=c.endRow;u+=1){const m=[],p=this.viewportData.rows[u-this.viewportData.offset];P(c.startColumn),P(c.endColumn);for(let g=c.startColumn;g<=c.endColumn;g+=1)P(s),m.push(s((a=p.data.get(g))==null?void 0:a.value,this.columns[g]));o.push(m)}}return o}get groupedColumns(){return[]}get hasExpandableRows(){return!0}get isChartBuilderAvailable(){return!1}get isSelectDistinctAvailable(){return!1}get isReversible(){return!1}isFilterable(e){return this.getCachedFilterableColumnSet(this.columns,this.groupedColumns).has(e)}isColumnMovable(e){return e>=this.groupedColumns.length}isRowExpandable(e){var s;const n=this.row(e);return(s=n==null?void 0:n.hasChildren)!=null?s:!1}isRowExpanded(e){var s;const n=this.row(e);return(s=n==null?void 0:n.isExpanded)!=null?s:!1}setRowExpanded(e,n){this.table.setExpanded(e,n)}depthForRow(e){var s;const n=this.row(e);return((s=n==null?void 0:n.depth)!=null?s:1)-1}}const Fs=X.module("IrisGridProxyModel");function Sa(t,e,n){return L.isTreeTable(t)?new sE(t,e):new yp(t,e,n)}class iE extends Ce{constructor(e,n=new un,s=null){super(),this.textForCell=(...o)=>this.model.textForCell(...o),this.truncationCharForCell=(...o)=>this.model.truncationCharForCell(...o),this.textAlignForCell=(...o)=>this.model.textAlignForCell(...o),this.colorForCell=(...o)=>this.model.colorForCell(...o),this.backgroundColorForCell=(...o)=>this.model.backgroundColorForCell(...o),this.textForColumnHeader=(...o)=>this.model.textForColumnHeader(...o),this.colorForColumnHeader=(...o)=>this.model.colorForColumnHeader(...o),this.textForRowHeader=(...o)=>this.model.textForRowHeader(...o),this.textForRowFooter=(...o)=>this.model.textForRowFooter(...o),this.isRowMovable=(...o)=>this.model.isRowMovable(...o),this.isColumnMovable=(...o)=>this.model.isColumnMovable(...o),this.isRowExpandable=(...o)=>pt(this.model)?this.model.isRowExpandable(...o):!1,this.isRowExpanded=(...o)=>pt(this.model)?this.model.isRowExpanded(...o):!1,this.setRowExpanded=(...o)=>{if(pt(this.model))return this.model.setRowExpanded(...o);throw Error("Function setRowExpanded does not exist on IrisGridTableModel")},this.depthForRow=(...o)=>pt(this.model)?this.model.depthForRow(...o):0,this.getColumnHeaderGroup=(...o)=>this.model.getColumnHeaderGroup(...o),this.getColumnHeaderParentGroup=(...o)=>this.model.getColumnHeaderParentGroup(...o),this.formatForCell=(...o)=>this.model.formatForCell(...o),this.valueForCell=(...o)=>this.model.valueForCell(...o),this.displayString=(...o)=>this.model.displayString(...o),this.isEditableRange=(...o)=>Je(this.model)?this.model.isEditableRange(...o):!1,this.isFilterable=(...o)=>this.model.isFilterable(...o),this.setViewport=(o,r,l)=>this.model.setViewport(o,r,l),this.snapshot=(...o)=>this.model.snapshot(...o),this.textSnapshot=(...o)=>this.model.textSnapshot(...o),this.valuesTable=(...o)=>this.model.valuesTable(...o),this.editValueForCell=(...o)=>(Je(this.model)&&this.model.editValueForCell(...o),""),this.setValueForCell=(...o)=>Je(this.model)?this.model.setValueForCell(...o):Promise.reject(new Error("Model is not editable")),this.setValueForRanges=(...o)=>Je(this.model)?this.model.setValueForRanges(...o):Promise.reject(new Error("Model is not editable")),this.setValues=(...o)=>Je(this.model)?this.model.setValues(...o):Promise.resolve(),this.isValidForCell=(...o)=>Je(this.model)?this.model.isValidForCell(...o):!1,this.delete=(...o)=>this.model.delete(...o),this.commitPending=(...o)=>this.model.commitPending(...o),this.handleModelEvent=this.handleModelEvent.bind(this);const i=Sa(e,n,s);this.originalModel=i,this.model=i,this.modelPromise=null,this.rollup=null,this.selectDistinct=[]}close(){this.originalModel.close(),this.model!==this.originalModel&&this.model.close(),this.modelPromise!=null&&this.modelPromise.cancel()}handleModelEvent(e){Fs.debug2("handleModelEvent",e);const{detail:n,type:s}=e;this.dispatchEvent(new Ge(s,{detail:n}))}setModel(e){Fs.debug("setModel",e);const n=this.model;n!==this.originalModel&&n.close(),this.model=e,this.listenerCount>0&&this.addListeners(e),this.dispatchEvent(new Ge(Ce.EVENT.COLUMNS_CHANGED,{detail:e.columns})),li(e)&&this.dispatchEvent(new Ge(Ce.EVENT.TABLE_CHANGED,{detail:e.table}))}setNextModel(e){Fs.debug2("setNextModel"),this.modelPromise&&this.modelPromise.cancel(),this.listenerCount>0&&this.removeListeners(this.model),this.modelPromise=Te.makeCancelable(e,n=>n.close()),this.modelPromise.then(n=>{this.modelPromise=null,this.setModel(n)}).catch(n=>{if(Te.isCanceled(n)){Fs.debug2("setNextModel cancelled");return}Fs.error("Unable to set next model",n),this.modelPromise=null,this.dispatchEvent(new Ge(Ce.EVENT.REQUEST_FAILED,{detail:n}))})}startListening(){super.startListening(),this.addListeners(this.model)}stopListening(){super.stopListening(),this.removeListeners(this.model)}addListeners(e){const n=Object.keys(Ce.EVENT);for(let s=0;s<n.length;s+=1)e.addEventListener(n[s],this.handleModelEvent)}removeListeners(e){const n=Object.keys(Ce.EVENT);for(let s=0;s<n.length;s+=1)e.removeEventListener(n[s],this.handleModelEvent)}get rowCount(){return this.model.rowCount}get columnCount(){return this.model.columnCount}get floatingTopRowCount(){return this.model.floatingTopRowCount}get floatingBottomRowCount(){return this.model.floatingBottomRowCount}get floatingLeftColumnCount(){return this.model.floatingLeftColumnCount}get floatingRightColumnCount(){return this.model.floatingRightColumnCount}isColumnFrozen(e){return this.model.isColumnFrozen(e)}get hasExpandableRows(){return pt(this.model)?this.model.hasExpandableRows:!1}get isExportAvailable(){return this.model.isExportAvailable}get isColumnStatisticsAvailable(){return this.model.isColumnStatisticsAvailable}get isValuesTableAvailable(){return this.model.isValuesTableAvailable}get isCustomColumnsAvailable(){return this.model.isCustomColumnsAvailable&&!(this.isSelectDistinctAvailable&&this.selectDistinctColumns.length>0)}get isFormatColumnsAvailable(){return this.model.isFormatColumnsAvailable}get isChartBuilderAvailable(){return this.model.isChartBuilderAvailable}get isRollupAvailable(){return(this.originalModel.isRollupAvailable||this.rollup!=null)&&this.selectDistinct.length===0}get isSelectDistinctAvailable(){return(this.originalModel.isSelectDistinctAvailable||this.selectDistinct.length>0)&&this.rollup==null}get isTotalsAvailable(){return this.model.isTotalsAvailable}get isReversible(){return this.model.isReversible}get columns(){return this.model.columns}get movedColumns(){return this.model.movedColumns}get movedRows(){return this.model.movedRows}get layoutHints(){return this.model.layoutHints}get frontColumns(){return this.model.frontColumns}get backColumns(){return this.model.backColumns}get frozenColumns(){return this.model.frozenColumns}get columnHeaderMaxDepth(){return this.model.columnHeaderMaxDepth}updateFrozenColumns(e){return this.model.updateFrozenColumns(e)}get originalColumns(){return this.originalModel.columns}get groupedColumns(){return this.model.groupedColumns}get description(){return this.model.description}get filter(){return this.model.filter}set filter(e){this.model.filter=e}get formatter(){return this.model.formatter}set formatter(e){this.model.formatter=e}get sort(){return this.model.sort}set sort(e){this.model.sort=e}get customColumns(){return this.model.customColumns}set customColumns(e){this.model.customColumns=e}get formatColumns(){return this.model.formatColumns}set formatColumns(e){this.model.formatColumns=e}get rollupConfig(){return this.rollup}set rollupConfig(e){if(Fs.debug("set rollupConfig",e),!this.isRollupAvailable)throw new Error("Rollup Rows are not available");if(ht(e,this.rollup))return;this.rollup=e;let n=Promise.resolve(this.originalModel);li(this.originalModel)&&e!=null&&(n=this.originalModel.table.rollup(e).then(s=>Sa(s,this.formatter))),this.setNextModel(n)}get selectDistinctColumns(){return this.selectDistinct}set selectDistinctColumns(e){if(Fs.debug("set selectDistinctColumns",e),!this.isSelectDistinctAvailable)throw new Error("Select distinct is not available");if(e===this.selectDistinctColumns||e.length===0&&this.selectDistinctColumns.length===0){Fs.debug("Ignore same selectDistinctColumns",e);return}this.selectDistinct=e;const n=e.map(i=>this.originalColumns.find(o=>o.name===i)).filter(i=>i!=null);let s=Promise.resolve(this.originalModel);li(this.originalModel)&&n.length>0&&(s=this.originalModel.table.selectDistinct(n).then(i=>Sa(i,this.formatter))),this.setNextModel(s)}get table(){if(li(this.model))return this.model.table}get totalsConfig(){return this.model.totalsConfig}set totalsConfig(e){this.model.totalsConfig=e}get isFilterRequired(){return this.model.isFilterRequired}get isEditable(){return Je(this.model)&&this.model.isEditable}export(){if(L.isTreeTable(this.model))throw new Error("TreeTable has no 'export' property");return this.model.export()}columnStatistics(e){if(L.isTreeTable(this.model))throw new Error("TreeTable has no 'columnStatistics' function");return this.model.columnStatistics(e)}get pendingDataMap(){return this.model.pendingDataMap}set pendingDataMap(e){this.model.pendingDataMap=e}get pendingRowCount(){return this.model.pendingRowCount}set pendingRowCount(e){this.model.pendingRowCount=e}get pendingDataErrors(){return this.model.pendingDataErrors}getColumnIndexByName(e){return this.model.getColumnIndexByName(e)}}class qd{static async makeModel(e,n=new un){let s=null;return!L.isTreeTable(e)&&e.hasInputTable&&(s=await e.inputTable()),new iE(e,n,s)}}const ns=X.module("TableViewportUpdater"),oE=150,No=class extends S.exports.PureComponent{constructor(){super(...arguments),this.getViewportRowRange=pe((t,e,n)=>{const s=n-e,i=Math.max(0,e-s*No.ROW_BUFFER_PAGES),o=n+s*No.ROW_BUFFER_PAGES;return[i,o]}),this.getViewportColumns=pe((t,e,n,s)=>{if(e==null||n==null)return null;const i=n-e,o=Math.max(0,e-i*No.COLUMN_BUFFER_PAGES),r=Math.min(n+i*No.COLUMN_BUFFER_PAGES,t.columns.length-1),l=[];for(let a=o;a<=r;a+=1){const d=K.getModelIndex(a,s);l.push(t.columns[d])}return l}),this.updateViewport=us((t,e,n,s,i)=>{if(e<t){ns.error("Invalid viewport",t,e);return}if(t===0&&e===0){ns.debug2("Ignoring 0-0 viewport");return}const{movedColumns:o,table:r}=this.props,[l,a]=this.getViewportRowRange(r,t,e),d=i!=null?i:this.getViewportColumns(r,n,s,o);if(ns.debug2("Setting Viewport Top:",l,"Bottom:",a,"Columns:",d),this.subscription==null){ns.debug2("updateViewport creating new subscription"),this.subscription=r.setViewport(l,a,d);const{onSubscription:c}=this.props;c(this.subscription)}else ns.debug2("updateViewport using existing subscription"),this.subscription.setViewport(l,a,d)},oE)}componentDidMount(){const{top:t,bottom:e,left:n,right:s,table:i,filters:o,sorts:r,columns:l,customColumns:a}=this.props;i.applyFilter(o),i.applySort(r),i.applyCustomColumns(a),this.updateViewport(t,e,n,s,l)}componentDidUpdate(t){const{top:e,bottom:n,left:s,right:i,table:o,filters:r,sorts:l,customColumns:a,columns:d}=this.props,c=r!==t.filters,u=l!==t.sorts,m=a!==t.customColumns,p=o!==t.table;(c||u||m||p)&&this.closeSubscription(),(c||p)&&(ns.debug("update table filter",r),o.applyFilter(r)),(u||p)&&(ns.debug("update table sort",l),o.applySort(l)),(m||p)&&(ns.debug("update table custom columns",a),o.applyCustomColumns(a)),this.updateViewport(e,n,s,i,d)}componentWillUnmount(){this.closeSubscription()}closeSubscription(){if(ns.debug2("closeSubscription",this.subscription),this.subscription){this.subscription.close(),this.subscription=void 0;const{onSubscription:t}=this.props;t()}this.updateViewport.cancel()}render(){return null}};let Yd=No;Yd.ROW_BUFFER_PAGES=3;Yd.COLUMN_BUFFER_PAGES=1;Yd.defaultProps={top:0,bottom:0,left:null,right:null,columns:null,onSubscription:()=>{},filters:[],sorts:[],customColumns:[],movedColumns:[]};const Ri=X.module("TreeTableViewportUpdater"),rE=150,Ip=class extends S.exports.PureComponent{constructor(t){super(t),this.updateViewport=us((e,n)=>{if(n<e){Ri.error("Invalid viewport",e,n);return}if(e===0&&n===0){Ri.debug2("Ignoring 0-0 viewport");return}const{table:s,updateInterval:i}=this.props,o=n-e,r=Math.max(0,e-o*3),l=n+o*3+1;if(Ri.debug2("Setting Viewport Top:",r,"Bottom:",l,s),!this.listenerCleanup){const{onViewportUpdate:a}=this.props;this.listenerCleanup=s.addEventListener(M.TreeTable.EVENT_UPDATED,a)}s.setViewport(r,l,void 0,i)},rE),this.listenerCleanup=null}componentDidMount(){const{top:t,bottom:e,table:n,filters:s,sorts:i}=this.props;Ri.debug("componentDidMount",this.props),n.applyFilter(s),n.applySort(i),this.updateViewport(t,e)}componentDidUpdate(t){const{top:e,bottom:n,table:s,filters:i,sorts:o}=this.props;i!==t.filters&&(Ri.debug("update table filter",i),s.applyFilter(i)),o!==t.sorts&&(Ri.debug("update table sort",o),s.applySort(o)),this.updateViewport(e,n)}componentWillUnmount(){this.updateViewport.cancel(),this.listenerCleanup&&this.listenerCleanup()}render(){return null}};let Rp=Ip;Rp.UPDATE_INTERVAL=1e3;Rp.defaultProps={top:0,bottom:0,onViewportUpdate:()=>{},filters:[],sorts:[],updateInterval:Ip.UPDATE_INTERVAL};class Ki{}Ki.OPEN="ChartEvent.OPEN";Ki.CLOSE="ChartEvent.CLOSE";Ki.COLUMN_SELECTED="ChartEvent.COLUMN_SELECTED";class bt{}bt.SESSION_OPENED="ConsoleEvent.SESSION_OPENED";bt.SESSION_CLOSED="ConsoleEvent.SESSION_CLOSED";bt.FOCUS_HISTORY="ConsoleEvent.FOCUS_HISTORY";bt.SEND_COMMAND="ConsoleEvent.SEND_COMMAND";bt.SETTINGS_CHANGED="ConsoleEvent.SETTINGS_CHANGED";class Pe{}Pe.TABLE_CHANGED="InputFilterEvent.TABLE_CHANGED";Pe.COLUMNS_CHANGED="InputFilterEvent.COLUMNS_CHANGED";Pe.FILTERS_CHANGED="InputFilterEvent.FILTERS_CHANGED";Pe.CLEAR_ALL_FILTERS="InputFilterEvent.CLEAR_ALL_FILTERS";Pe.COLUMN_SELECTED="InputFilterEvent.COLUMN_SELECTED";Pe.OPEN_DROPDOWN="InputFilterEvent.OPEN_DROPDOWN";Pe.OPEN_INPUT="InputFilterEvent.OPEN_INPUT";Pe.OPEN_FILTER_SET_MANAGER="InputFilterEvent.OPEN_FILTER_SET_MANAGER";class Et{}Et.OPEN_GRID="IrisGridEvent.OPEN_GRID";Et.CLOSE_GRID="IrisGridEvent.CLOSE_GRID";Et.DATA_SELECTED="IrisGridEvent.DATA_SELECTED";Et.COLUMN_SELECTED="IrisGridEvent.COLUMN_SELECTED";Et.STATE_CHANGED="IrisGridEvent.STATE_CHANGED";Et.CREATE_CHART="IrisGridevent.CREATE_CHART";const Dp=Object.freeze({OPEN:"MarkdownEvent.OPEN"});class He{}He.CREATE_NOTEBOOK="NotebookEvent.createNotebook";He.SELECT_NOTEBOOK="NotebookEvent.selectNotebook";He.CLOSE_FILE="NotebookEvent.closeFile";He.RENAME="NotebookEvent.rename";He.RENAME_FILE="NotebookEvent.renameFile";He.REGISTER_FILE="NotebookEvent.registerFile";He.SEND_TO_NOTEBOOK="NotebookEvent.sendToNotebook";He.UNREGISTER_FILE="NotebookEvent.unregisterFile";class Kn{}Kn.focus="TabEvent.focus";Kn.blur="TabEvent.blur";Kn.openPQObject="TabEvent.openPQObject";Kn.openControl="TabEvent.openControl";Kn.reload="TabEvent.reload";Kn.clearAllFilters="TabEvent.clearAllFilters";class Mp extends S.exports.PureComponent{constructor(e){super(e),this.handleCloseTab=this.handleCloseTab.bind(this),this.handleCloseTabsRight=this.handleCloseTabsRight.bind(this),this.handleCloseTabsAll=this.handleCloseTabsAll.bind(this)}getAllTabs(){var n,s,i;const{glContainer:e}=this.props;return[...(i=(s=(n=e==null?void 0:e.tab)==null?void 0:n.header)==null?void 0:s.tabs)!=null?i:[]]}handleCloseTab(){const{glContainer:e}=this.props;e.close()}handleCloseTabsAll(){this.getAllTabs().forEach(n=>{var s;return(s=(n==null?void 0:n.contentItem).container)==null?void 0:s.close()})}handleCloseTabsRight(){var s,i,o,r,l,a,d;const{glContainer:e}=this.props,n=this.getAllTabs();for(let c=n.length-1;c>0&&((i=(s=n[c].contentItem)==null?void 0:s.config)==null?void 0:i.id)!==((l=(r=(o=e.tab)==null?void 0:o.contentItem)==null?void 0:r.config)==null?void 0:l.id);c-=1)(d=((a=n[c])==null?void 0:a.contentItem).container)==null||d.close()}canCloseTabsRight(){var i,o,r,l,a,d,c,u;const{glContainer:e}=this.props,n=this.getAllTabs();let s=!0;for(let m=n.length-1;m>0&&((o=(i=n[m].contentItem)==null?void 0:i.config)==null?void 0:o.id)!==((a=(l=(r=e.tab)==null?void 0:r.contentItem)==null?void 0:l.config)==null?void 0:a.id);m-=1)if(Boolean((u=(c=(d=n[m])==null?void 0:d.contentItem)==null?void 0:c.config)==null?void 0:u.isClosable)){s=!1;break}return s}canCloseAny(){var s,i,o;const e=this.getAllTabs();let n=!0;for(let r=e.length-1;r>0;r-=1)if(Boolean((o=(i=(s=e[r])==null?void 0:s.contentItem)==null?void 0:i.config)==null?void 0:o.isClosable)){n=!1;break}return n}render(){var o,r,l;const{additionalActions:e,glContainer:n}=this.props,s=[...e],i=(l=(r=(o=n.tab)==null?void 0:o.contentItem)==null?void 0:r.config)==null?void 0:l.isClosable;return s.push({title:"Close",order:10,group:oe.groups.low,action:this.handleCloseTab,disabled:i===void 0||!i}),s.push(()=>({title:"Close Tabs to Right",order:20,group:oe.groups.low,action:this.handleCloseTabsRight,disabled:this.canCloseTabsRight()})),s.push(()=>({title:"Close All",order:30,group:oe.groups.low,action:this.handleCloseTabsAll,disabled:this.canCloseAny()})),h(oe,{actions:s})}}Mp.defaultProps={additionalActions:[]};class Np extends S.exports.PureComponent{constructor(e){super(e),this.handleRenameDialogOpened=this.handleRenameDialogOpened.bind(this),this.handleRenameInputChange=this.handleRenameInputChange.bind(this),this.handleRenameCancel=this.handleRenameCancel.bind(this),this.handleRenameSubmit=this.handleRenameSubmit.bind(this),this.renameInputRef=Y.createRef();const{value:n}=e;this.state={value:n,valueWasValidated:!1}}componentDidUpdate(e){const{isShown:n}=e,{isShown:s}=this.props;s&&!n&&this.resetState()}resetState(){const{value:e}=this.props;this.setState({value:e,valueWasValidated:!1})}handleRenameDialogOpened(){var e,n;(n=(e=this.renameInputRef)==null?void 0:e.current)==null||n.focus()}handleRenameInputChange(e){this.setState({value:e.target.value})}handleRenameCancel(){const{onCancel:e}=this.props;e()}handleRenameSubmit(e){e.stopPropagation(),e.preventDefault();const{value:n}=this.state,s=n==null?void 0:n.trim();if(s!==void 0&&s!==""){const{onSubmit:i}=this.props;i(s)}else this.setState({value:s,valueWasValidated:!0})}renderRenameDialog(){const{isShared:e,isOwner:n,itemType:s}=this.props,{value:i,valueWasValidated:o}=this.state;return v("form",{className:W("p-3",{"was-validated":o}),onSubmit:this.handleRenameSubmit,noValidate:!0,role:"presentation",onMouseDown:r=>{r.stopPropagation()},onMouseUp:r=>{r.stopPropagation()},children:[v("div",{className:"form-group",children:[v("label",{htmlFor:`rename-dialog-${s}-input`,children:["Rename ",s]}),h("input",{type:"text",className:"form-control",id:`rename-dialog-${s}-input`,value:i!=null?i:void 0,ref:this.renameInputRef,onChange:this.handleRenameInputChange,required:!0}),v("div",{className:"invalid-feedback",children:[s," name cannot be empty"]}),(e||!n)&&v("div",{className:"pt-2",children:["Renaming this ",s," will rename for all users."]})]}),v("div",{className:"text-right",children:[h(z,{kind:"secondary",className:"mr-2",onClick:this.handleRenameCancel,children:"Cancel"}),h(z,{kind:"primary",type:"submit",children:"Rename"})]})]})}render(){const{isShown:e,onCancel:n}=this.props;return h(kn,{isShown:e,onEntered:this.handleRenameDialogOpened,onExited:n,options:{placement:"bottom",modifiers:{preventOverflow:{boundariesElement:"viewport"}}},interactive:!0,closeOnBlur:!0,children:this.renderRenameDialog()})}}Np.defaultProps={isShared:!1,isOwner:!0,itemType:"Item",value:""};const lE=X.module("Panel");class jn extends S.exports.PureComponent{constructor(e){super(e),this.getAdditionActions=pe((s,i,o)=>{const r=[];return i&&r.push(this.getCloneAction()),o&&r.push(this.getRenameAction()),[...r,...s]}),this.handleClearAllFilters=this.handleClearAllFilters.bind(this),this.handleCopyPanel=this.handleCopyPanel.bind(this),this.handleFocus=this.handleFocus.bind(this),this.handleBlur=this.handleBlur.bind(this),this.handleHide=this.handleHide.bind(this),this.handleResize=this.handleResize.bind(this),this.handleSessionClosed=this.handleSessionClosed.bind(this),this.handleSessionOpened=this.handleSessionOpened.bind(this),this.handleBeforeShow=this.handleBeforeShow.bind(this),this.handleShow=this.handleShow.bind(this),this.handleTabBlur=this.handleTabBlur.bind(this),this.handleTabFocus=this.handleTabFocus.bind(this),this.handleRenameCancel=this.handleRenameCancel.bind(this),this.handleRenameSubmit=this.handleRenameSubmit.bind(this),this.handleShowRenameDialog=this.handleShowRenameDialog.bind(this),this.handleTabClicked=this.handleTabClicked.bind(this),this.handleTab=this.handleTab.bind(this);const{glContainer:n}=this.props;this.state={title:te.getTitleFromContainer(n),showRenameDialog:!1}}componentDidMount(){const{componentPanel:e,glContainer:n,glEventHub:s}=this.props;n.on("resize",this.handleResize),n.on("show",this.handleBeforeShow),n.on("shown",this.handleShow),n.on("hide",this.handleHide),n.on("tab",this.handleTab),n.on("tabClicked",this.handleTabClicked),s.on(bt.SESSION_CLOSED,this.handleSessionClosed),s.on(bt.SESSION_OPENED,this.handleSessionOpened),s.on(Kn.focus,this.handleTabFocus),s.on(Kn.blur,this.handleTabBlur),s.on(Pe.CLEAR_ALL_FILTERS,this.handleClearAllFilters),s.emit(Ie.MOUNT,e)}componentWillUnmount(){const{componentPanel:e,glContainer:n,glEventHub:s}=this.props;n.off("resize",this.handleResize),n.off("show",this.handleBeforeShow),n.off("shown",this.handleShow),n.off("hide",this.handleHide),n.off("tab",this.handleTab),n.off("tabClicked",this.handleTabClicked),s.off(bt.SESSION_CLOSED,this.handleSessionClosed),s.off(bt.SESSION_OPENED,this.handleSessionOpened),s.off(Kn.focus,this.handleTabFocus),s.off(Kn.blur,this.handleTabBlur),s.off(Pe.CLEAR_ALL_FILTERS,this.handleClearAllFilters),s.emit(Ie.UNMOUNT,e)}handleTab(e){e!=null&&this.setState({title:te.getTitleFromTab(e)}),this.forceUpdate();const{onTab:n}=this.props;n(e)}handleTabClicked(...e){const{onTabClicked:n}=this.props;n(...e)}handleClearAllFilters(...e){const{onClearAllFilters:n}=this.props;n(...e)}handleFocus(e){const{componentPanel:n,glEventHub:s}=this.props;s.emit(Ie.FOCUS,n);const{onFocus:i}=this.props;i(e)}handleBlur(e){const{onBlur:n}=this.props;n(e)}handleHide(...e){const{onHide:n}=this.props;n(...e)}handleResize(...e){const{onResize:n}=this.props;n(...e)}handleSessionClosed(e){const{onSessionClose:n}=this.props;n(e)}handleSessionOpened(e,n){const{onSessionOpen:s}=this.props;s(e,n)}handleBeforeShow(...e){const{onBeforeShow:n}=this.props;n(...e)}handleShow(...e){const{onShow:n}=this.props;n(...e)}handleTabBlur(...e){const{onTabBlur:n}=this.props;n(...e)}handleTabFocus(...e){const{onTabFocus:n}=this.props;n(...e)}handleRenameCancel(){this.setState({showRenameDialog:!1})}handleShowRenameDialog(){this.setState({showRenameDialog:!0})}handleRenameSubmit(e){const{glContainer:n}=this.props;this.setState({showRenameDialog:!1,title:e});const s=te.getRootFromContainer(n),i=te.getComponentConfigFromContainer(n);P(i),te.renameComponent(s,i,e)}handleCopyPanel(){const{glContainer:e,glEventHub:n}=this.props,s=te.getRootFromContainer(e),i=te.getComponentConfigFromContainer(e);if(i==null){lE.error("Could not get component config from container",e);return}const o=te.cloneComponent(s,i);o!==null&&n.emit(Ie.CLONED,this,o)}getCloneAction(){return{title:"Copy Panel",order:10,group:oe.groups.high,action:this.handleCopyPanel}}getRenameAction(){return{title:"Rename",order:10,group:oe.groups.medium,action:this.handleShowRenameDialog}}render(){const{children:e,className:n,renderTabTooltip:s,glContainer:i,additionalActions:o,errorMessage:r,isLoaded:l,isLoading:a,isClonable:d,isRenamable:c}=this.props,{tab:u}=i,{showRenameDialog:m,title:p}=this.state;return v("div",{className:W("h-100 w-100 iris-panel",n),onFocusCapture:this.handleFocus,onBlurCapture:this.handleBlur,children:[e,h(wl,{errorMessage:r,isLoaded:l,isLoading:a}),u!=null&&ui.createPortal(v(ye,{children:[h(Mp,{glContainer:i,additionalActions:this.getAdditionActions(o,d,c)}),c&&h(Np,{isShown:m,value:p,itemType:"Panel",onCancel:this.handleRenameCancel,onSubmit:this.handleRenameSubmit}),s!=null&&h(Ue,{interactive:!0,options:{placement:"bottom"},popperClassName:"panel-tab-popper",children:s()})]}),u.element[0])]})}}jn.defaultProps={className:"",onTab:()=>{},onTabClicked:()=>{},onClearAllFilters:()=>{},onFocus:()=>{},onBlur:()=>{},onHide:()=>{},onResize:()=>{},onSessionClose:()=>{},onSessionOpen:()=>{},onBeforeShow:()=>{},onShow:()=>{},onTabBlur:()=>{},onTabFocus:()=>{},renderTabTooltip:null,additionalActions:[],errorMessage:null,isLoading:!1,isLoaded:!0,isClonable:!1,isRenamable:!1};function Vl(t){const{widgetType:e,widgetName:n,glContainer:s,description:i,children:o}=t,r=te.getTitleFromContainer(s);return v("div",{className:"tab-tooltip-container",children:[v("div",{className:"row flex-nowrap align-items-start",children:[h("span",{className:"tab-tooltip-title",children:v("b",{children:[e," Name "]})}),h("span",{className:"tab-tooltip-name",children:n}),h(bl,{className:"tab-tooltip-copy",tooltip:"Copy name",copy:n})]}),n!==r&&v("div",{className:"row",children:[h("span",{className:"tab-tooltip-title",children:h("b",{children:"Display Name"})}),h("span",{className:"tab-tooltip-name",children:r})]}),i&&h("div",{className:"row",children:h("span",{className:"tab-tooltip-description",children:i})}),o]})}Vl.propTypes={glContainer:kd.Container.isRequired,widgetType:R.exports.string,widgetName:R.exports.string,description:R.exports.string,children:R.exports.node};Vl.defaultProps={widgetType:"",widgetName:"",description:null,children:null};class Ul extends S.exports.PureComponent{constructor(e){super(e),this.getCachedRenderTabTooltip=pe((n,s,i,o,r)=>n?()=>h(Vl,{glContainer:s,widgetType:i,widgetName:o,description:r}):null),this.handleSessionClosed=this.handleSessionClosed.bind(this),this.handleSessionOpened=this.handleSessionOpened.bind(this),this.handleCopyName=this.handleCopyName.bind(this),this.state={isClientDisconnected:!1,isPanelDisconnected:!1,isWidgetDisconnected:!1,isWaitingForReconnect:!1,isPanelInactive:!1}}handleCopyName(){const{widgetName:e}=this.props;ji(e)}getErrorMessage(){const{errorMessage:e}=this.props,{isClientDisconnected:n,isPanelDisconnected:s,isWidgetDisconnected:i,isWaitingForReconnect:o}=this.state;if(e)return`${e}`;if(n&&s&&o)return`Disconnected from server.
|
|
37
37
|
Check your internet connection.`;if(n&&s)return"Disconnected from server.";if(s){const{widgetName:r,widgetType:l}=this.props;return`Variable "${r}" not set.
|
|
38
|
-
${l} does not exist yet.`}if(i){const{widgetName:r}=this.props;return`${r} is unavailable.`}}handleSessionClosed(...e){const{onSessionClose:n}=this.props;this.setState({isPanelDisconnected:!0,isWaitingForReconnect:!1}),n(...e)}handleSessionOpened(...e){const{onSessionOpen:n}=this.props;n(...e)}render(){const{children:e,className:n,componentPanel:s,isLoaded:i,isLoading:o,glContainer:r,glEventHub:l,isDisconnected:a,isClonable:d,isRenamable:c,showTabTooltip:u,renderTabTooltip:m,widgetType:p,widgetName:g,description:f,onClearAllFilters:b,onHide:C,onFocus:w,onBlur:T,onResize:y,onShow:E,onTabBlur:I,onTabFocus:D,onTabClicked:F}=this.props,{isPanelDisconnected:x,isWidgetDisconnected:U,isPanelInactive:B}=this.state,_=this.getErrorMessage(),H=m!=null?m:this.getCachedRenderTabTooltip(u,r,p,g,f),A=[{title:`Copy ${p} Name`,group:oe.groups.medium,order:20,action:this.handleCopyName}];return v(jn,{className:W(n,{disconnected:x||U||a,inactive:B}),componentPanel:s,glContainer:r,glEventHub:l,onClearAllFilters:b,onHide:C,onFocus:w,onBlur:T,onResize:y,onShow:E,onSessionClose:this.handleSessionClosed,onSessionOpen:this.handleSessionOpened,onTabBlur:I,onTabFocus:D,onTabClicked:F,renderTabTooltip:H,errorMessage:_,isLoaded:i,isLoading:o,isClonable:d,isRenamable:c,additionalActions:A,children:[e,B&&h("div",{className:"fill-parent-absolute"})]})}}Ul.defaultProps={className:"",errorMessage:null,isClonable:!0,isDisconnected:!1,isLoading:!1,isLoaded:!0,isRenamable:!0,showTabTooltip:!0,widgetName:"Widget",widgetType:"Widget",renderTabTooltip:null,description:"",onFocus:()=>{},onBlur:()=>{},onHide:()=>{},onClearAllFilters:()=>{},onResize:()=>{},onSessionClose:()=>{},onSessionOpen:()=>{},onShow:()=>{},onTabBlur:()=>{},onTabFocus:()=>{},onTabClicked:()=>{}};const Yt=Object.freeze({DEFAULT:"DEFAULT",LINKER:"LINKER"}),aE="SET_SESSION_WRAPPER",dE=Hs(aE,null),cE={sessionWrapper:dE},hE=new Map,Bl=Object.freeze([]),Fp=(t,e)=>{var n;return(n=Qt(t,e).columns)!=null?n:Bl},uE=(t,e)=>{var n;return(n=Qt(t,e).filterSets)!=null?n:Bl},Xd=(t,e)=>{var n;return(n=Qt(t,e).filters)!=null?n:Bl},jd=(t,e)=>{var n;return(n=Qt(t,e).tableMap)!=null?n:hE},Qd=(t,e)=>Qt(t,e).isolatedLinkerPanelId,oo=(t,e)=>{var n;return(n=Qt(t,e).links)!=null?n:Bl},Zd=(t,e)=>Qt(t,e).columnSelectionValidator,mE=(t,e)=>Qt(t,e).connection,gi=(t,e)=>Qt(t,e).sessionWrapper,pE=(t,e)=>n=>n(Xn(t,{connection:e})),gE=(t,e)=>n=>n(Xn(t,{sessionWrapper:e})),Jd=(t,e)=>n=>n(Xn(t,{links:e})),fE=(t,e)=>(n,s)=>{const i=oo(s(),t),o=e.filter(r=>i.findIndex(l=>ht(l.start,r.start)&&ht(l.end,r.end))<0);return n(Jd(t,i.concat(o)))},CE=(t,e)=>(n,s)=>{const o=oo(s(),t).filter(r=>!e.includes(r.id));return n(Jd(t,o))},xp=(t,e)=>n=>n(Xn(t,{isolatedLinkerPanelId:e})),bE=(t,e)=>n=>n(Xn(t,{columnSelectionValidator:e})),SE=(t,e)=>n=>n(Xn(t,{consoleSettings:e})),wE=(t,e)=>n=>n(Xn(t,{filterSets:e}));Object.entries(cE).map(([t,e])=>eo.register(t,e));function _p({columnMap:t,inputFilterMap:e,linkedColumnMap:n,onAdd:s,onOpenLinker:i,waitingFilterMap:o,waitingInputMap:r}){const l=S.exports.useMemo(()=>{const p=Array.from(r.keys()),g=p.find(C=>e.get(C)!=null),f=p.find(C=>n.get(C)!=null),b=on.join(p.map(C=>`"${C}"`));return g!=null&&g&&f!=null&&f?`Use a filter control or linked table to set a value for ${b}`:g!=null&&g?`Set a filter control value for ${b}`:`Double click a row in a linked table to set a value for ${b}`},[e,n,r]),a=S.exports.useMemo(()=>Array.from(t.values()),[t]),d=S.exports.useCallback(p=>{p.stopPropagation(),p.preventDefault(),s(Array.from(o.values()))},[s,o]),c=S.exports.useCallback(p=>{p.stopPropagation(),p.preventDefault(),i()},[i]),u=o.size>0,m=!u&&r.size>0;return h("div",{className:"chart-panel-overlay chart-filter-overlay",children:v("div",{className:W("chart-panel-overlay-content chart-filter-overlay-content",{"chart-filter-waiting-filter":u},{"chart-filter-waiting-input":m}),children:[u&&v(ye,{children:[h("div",{className:"info-message",children:"This plot requires a filter control to be added to the layout or a table link to be created on the following columns:"}),h("div",{className:"waiting-filter-list",children:a.map(p=>{const g=o.has(p.name),f=g?cs:ad;return v("div",{className:W("waiting-filter-item",{"is-invalid":g}),children:[h(j,{icon:f}),p.name]},p.name)})}),v("div",{children:[h(Ao,{onClick:d,className:"btn-primary",children:"Add Input Filters"}),h(Ao,{onClick:c,className:"btn-primary",children:"Open Linker Tool"})]})]}),m&&v(ye,{children:[h("div",{className:"info-message",children:"Waiting for User Input"}),h("div",{className:"",children:l})]})]})})}_p.propTypes={columnMap:R.exports.instanceOf(Map).isRequired,inputFilterMap:R.exports.instanceOf(Map).isRequired,linkedColumnMap:R.exports.instanceOf(Map).isRequired,onAdd:R.exports.func.isRequired,onOpenLinker:R.exports.func.isRequired,waitingFilterMap:R.exports.instanceOf(Map).isRequired,waitingInputMap:R.exports.instanceOf(Map).isRequired};function Vo({columns:t,onColumnSelected:e,onMouseEnter:n,onMouseLeave:s}){return h("div",{className:"chart-panel-overlay chart-column-selector-overlay",children:v("div",{className:W("chart-panel-overlay-content"),children:[h("div",{className:"info-message",children:"This plot requires a filter control to be added to the layout or a table link to be created on the following columns:"}),h("div",{className:"waiting-column-select-list",children:t.map(i=>h(Tl,{className:W("btn-chart-column-selector",Vo.makeButtonClassName(i.name)),onClick:()=>e(i.name),onMouseEnter:()=>{n&&n(i)},onMouseLeave:s,disabled:!i.isValid,isLinked:i.isActive,children:i.name},i.name))})]})})}Vo.makeButtonClassName=t=>`btn-chart-column-selector-${t}`;Vo.defaultProps={onMouseEnter:()=>{},onMouseLeave:()=>{}};const nn=X.module("ChartPanel"),vE=150;function Vr(t){return t.settings!==void 0}function TE(t){return t.inputFilters!=null}function EE(t){return t.panelState!=null}class $l extends S.exports.Component{constructor(e){super(e),this.getWaitingInputMap=pe((r,l,a)=>{if(!r)return new Map;const d=new Map(l);return a.forEach((c,u)=>{d.delete(u)}),d}),this.getWaitingFilterMap=pe((r,l,a,d,c)=>{if(!r)return new Map;const u=new Map(l);return a.forEach((m,p)=>{u.delete(p)}),c.forEach((m,p)=>{u.delete(p)}),d.forEach((m,p)=>{u.delete(p)}),u}),this.getInputFilterColumnMap=pe((r,l)=>{const a=new Map;for(let d=0;d<l.length;d+=1){const c=l[d],{name:u,type:m}=c,p=r.get(u);p!=null&&p.type===m&&a.set(u,c)}return a}),this.getLinkedColumnMap=pe((r,l)=>{const a=new Map,d=te.getIdFromPanel(this);for(let c=0;c<l.length;c+=1){const u=l[c];let m=null;if(u.start!=null&&u.start.panelId===d&&r.has(u.start.columnName)?m=u.start.columnName:u.end&&u.end.panelId===d&&r.has(u.end.columnName)&&(m=u.end.columnName),m!=null&&r.has(m)){const p=r.get(m);P(p),a.set(m,p)}}return a}),this.getSelectorColumns=pe((r,l,a)=>Array.from(r.values()).map(d=>({name:d.name,type:d.type,isValid:a?a(this,d):!1,isActive:l.has(d.name)}))),this.handleColumnSelected=this.handleColumnSelected.bind(this),this.handleColumnMouseEnter=this.handleColumnMouseEnter.bind(this),this.handleColumnMouseLeave=this.handleColumnMouseLeave.bind(this),this.handleDisconnect=this.handleDisconnect.bind(this),this.handleReconnect=this.handleReconnect.bind(this),this.handleFilterAdd=this.handleFilterAdd.bind(this),this.handleHide=this.handleHide.bind(this),this.handleError=this.handleError.bind(this),this.handleLoadError=this.handleLoadError.bind(this),this.handleLoadSuccess=this.handleLoadSuccess.bind(this),this.handleResize=this.handleResize.bind(this),this.handleSettingsChanged=this.handleSettingsChanged.bind(this),this.handleOpenLinker=this.handleOpenLinker.bind(this),this.handleShow=this.handleShow.bind(this),this.handleSourceColumnChange=this.handleSourceColumnChange.bind(this),this.handleSourceFilterChange=this.handleSourceFilterChange.bind(this),this.handleSourceSortChange=this.handleSourceSortChange.bind(this),this.handleTabBlur=this.handleTabBlur.bind(this),this.handleTabFocus=this.handleTabFocus.bind(this),this.handleUpdate=this.handleUpdate.bind(this),this.updateModelFromSource=je(this.updateModelFromSource.bind(this),vE),this.handleClearAllFilters=this.handleClearAllFilters.bind(this),this.panelContainer=Y.createRef(),this.chart=Y.createRef(),this.pending=new fs;const{metadata:n,panelState:s}=e,{filterValueMap:i=[],settings:o={}}=s!=null?s:{};this.state={settings:o,error:void 0,isActive:!1,isDisconnected:!1,isLoading:!1,isLoaded:!1,isLinked:n!=null&&Vr(n)&&n.settings.isLinked,filterMap:new Map(i),filterValueMap:new Map(i),model:void 0,columnMap:new Map,panelState:s}}componentDidMount(){this.isHidden()||(this.setState({isActive:!0}),this.initModel())}componentDidUpdate(e,n){const{inputFilters:s,source:i}=this.props,{columnMap:o,model:r,filterMap:l,filterValueMap:a,isLinked:d,settings:c}=this.state;!r||(o!==n.columnMap&&this.pruneFilterMaps(),s!==e.inputFilters&&this.updateChangedInputFilters(s,e.inputFilters),l!==n.filterMap?this.updateFilters():a!==n.filterValueMap&&this.updatePanelState(),c!==n.settings&&ah(r)&&(r.updateSettings(c),this.updatePanelState()),d!==n.isLinked?i&&(d?(this.startListeningToSource(i),this.updateModelFromSource()):this.stopListeningToSource(i)):d&&i!==e.source&&(e.source&&this.stopListeningToSource(e.source),i&&(this.startListeningToSource(i),this.updateModelFromSource())))}componentWillUnmount(){this.pending.cancel();const{source:e}=this.props;e&&this.stopListeningToSource(e)}initModel(){this.setState({isLoading:!0,isLoaded:!1,error:void 0});const{makeModel:e}=this.props;this.pending.add(e(),n=>{n.close()}).then(this.handleLoadSuccess,this.handleLoadError)}startListeningToSource(e){nn.debug("startListeningToSource",e),e.addEventListener(M.Table.EVENT_CUSTOMCOLUMNSCHANGED,this.handleSourceColumnChange),e.addEventListener(M.Table.EVENT_FILTERCHANGED,this.handleSourceFilterChange),e.addEventListener(M.Table.EVENT_SORTCHANGED,this.handleSourceSortChange)}stopListeningToSource(e){nn.debug("stopListeningToSource",e),e.removeEventListener(M.Table.EVENT_CUSTOMCOLUMNSCHANGED,this.handleSourceColumnChange),e.removeEventListener(M.Table.EVENT_FILTERCHANGED,this.handleSourceFilterChange),e.removeEventListener(M.Table.EVENT_SORTCHANGED,this.handleSourceSortChange)}loadModelIfNecessary(){const{isActive:e,isLoaded:n,isLoading:s}=this.state;e&&!n&&!s&&this.initModel()}isHidden(){const{glContainer:e}=this.props,{isHidden:n}=e;return n}handleColumnSelected(e){const{glEventHub:n}=this.props,{columnMap:s}=this.state;n.emit(Ki.COLUMN_SELECTED,this,s.get(e))}handleColumnMouseEnter({type:e,name:n}){const{columnSelectionValidator:s}=this.props;nn.debug("handleColumnMouseEnter",s,e,n),s&&s(this,{type:e,name:n})}handleColumnMouseLeave(){const{columnSelectionValidator:e}=this.props;nn.debug("handleColumnMouseLeave",e),e&&e(this,void 0)}handleDisconnect(){this.setState({error:new Error("Figure disconnected"),isDisconnected:!0})}handleFilterAdd(e){for(let n=0;n<e.length;n+=1)this.openInputFilter(e[n])}handleOpenLinker(){const{localDashboardId:e,setActiveTool:n,setDashboardIsolatedLinkerPanelId:s}=this.props;s(e,void 0),n(Yt.LINKER)}handleReconnect(){this.setState({isDisconnected:!1,error:void 0}),this.sendColumnChange(),this.updateColumnFilters()}handleLoadSuccess(e){nn.debug("handleLoadSuccess");const{model:n}=this.state;this.setState({model:e,isLoaded:!0},()=>{const{inputFilters:s,source:i}=this.props,{filterMap:o,isLinked:r}=this.state;e!==n&&(this.sendColumnChange(),this.updateColumnFilters(),this.updateInputFilters(s,o.size>0||e.isFilterRequired()),i&&r&&(this.startListeningToSource(i),this.updateModelFromSource()))})}handleLoadError(e){Te.isCanceled(e)||(nn.error("handleLoadError",e),this.setState({error:e,isLoading:!1}))}handleSourceColumnChange(){this.updateModelFromSource()}handleSourceFilterChange(){this.updateModelFromSource()}handleSourceSortChange(){this.updateModelFromSource()}updateModelFromSource(){const{metadata:e,source:n}=this.props,{isLinked:s,model:i}=this.state;if(!s||!i||!n){nn.debug2("updateModelFromSource ignoring",s,i,n);return}if(this.pending.cancel(),Vr(e)){const{settings:o}=e;this.pending.add(M.plot.Figure.create(xe.makeFigureSettings(o,n))).then(r=>{ah(i)&&i.setFigure(r)}).catch(this.handleLoadError)}this.updatePanelState()}updatePanelState(){const{sourcePanel:e}=this.props,{panelState:n,filterValueMap:s,settings:i}=this.state;let{tableSettings:o}=n!=null?n:{};if(e&&TE(e.props)&&EE(e.state)){const{inputFilters:r}=e.props,{panelState:l}=e.state;l!=null&&(o=ne.extractTableSettings(l,r))}this.setState({panelState:{settings:i,tableSettings:o,filterValueMap:Array.from(s)}})}handleError(){this.setState({isLoading:!1})}handleResize(){this.updateChart()}handleSettingsChanged(e){this.setState(({settings:n})=>{const s={...n,...e};return nn.debug("Updated settings",s),{settings:s}})}handleHide(){this.setActive(!1)}handleShow(){this.setActive(!0)}handleTabBlur(){this.setActive(!1)}handleTabFocus(){const e=this.isHidden();this.setActive(!e)}handleUpdate(){this.setState({isLoading:!1})}handleClearAllFilters(){this.setState({filterValueMap:new Map,filterMap:new Map}),this.updatePanelState()}openInputFilter(e){const{glEventHub:n}=this.props,{name:s,type:i}=e;n.emit(Pe.OPEN_INPUT,{title:`${s} Filter`,panelState:{name:s,type:i,isValueShown:!0},createNewStack:!0,focusElement:"input"})}setActive(e){this.setState({isActive:e},()=>{e&&(this.loadModelIfNecessary(),this.updateChart())})}sendColumnChange(){const{model:e}=this.state;if(!e)return;const{glEventHub:n}=this.props;n.emit(Pe.COLUMNS_CHANGED,this,Array.from(e.getFilterColumnMap().values()))}getCoordinateForColumn(e){var l;const n=Vo.makeButtonClassName(e);if(!this.panelContainer.current)return null;const s=this.panelContainer.current.querySelector(`.${n}`),i=(l=s==null?void 0:s.getBoundingClientRect())!=null?l:null;if(i==null||i.width<=0||i.height<=0)return null;const o=i.left+i.width/2,r=i.bottom;return[o,r]}setFilterMap(e){nn.debug("setFilterMap",e),this.setState(n=>{const{columnMap:s,filterMap:i}=n;let o=null;const r=new Map(n.filterValueMap);return e.forEach(({columnType:l,value:a},d)=>{const c=s.get(d);c==null||c.type!==l||(r.set(d,a),i.get(d)!==a&&(o===null&&(o=new Map(i)),o.set(d,a)))}),{filterValueMap:r,filterMap:o!=null?o:i}})}unsetFilterValue(e){this.setState(n=>{var a;const{inputFilters:s}=this.props,{columnMap:i}=n;let{filterMap:o,filterValueMap:r}=n;if(!r.has(e))return null;r=new Map(n.filterValueMap),r.delete(e);const l=this.getInputFilterColumnMap(i,s);if(l.has(e)){const d=o.get(e),c=(a=l.get(e))==null?void 0:a.value;c!=null&&d!==c&&(o=new Map(n.filterMap),c.length>0?o.set(e,c):o.delete(e))}else o=new Map(n.filterMap),o.delete(e);return{filterMap:o,filterValueMap:r}})}updateChangedInputFilters(e,n){const s=n.filter(o=>e.find(r=>r.name===o.name&&r.type===o.type)===void 0);s.length>0&&this.deleteInputFilters(s);const i=e.filter(o=>!n.includes(o));i.length>0&&this.updateInputFilters(i)}updateInputFilters(e,n=!1){this.setState(s=>{const{columnMap:i}=s,o=new Map(s.filterValueMap),r=new Map(s.filterMap),l=n?{filterMap:r,filterValueMap:o}:{};for(let a=0;a<e.length;a+=1){const{name:d,type:c,value:u}=e[a],m=i.get(d);m!=null&&m.type===c&&(u!=null&&r.get(d)!==u&&(u===""?r.delete(d):r.set(d,u),l.filterMap=r),o.has(d)&&(o.delete(d),l.filterValueMap=o))}return nn.debug("updateInputFilters",l),l})}deleteInputFilters(e,n=!1){this.setState(s=>{const{columnMap:i,filterValueMap:o}=s,r=new Map(s.filterMap);let l=n;for(let a=0;a<e.length;a+=1){const{name:d,type:c}=e[a],u=i.get(d);if(u!=null&&u.type===c&&r.has(d)){const m=r.get(d);if(o.has(d)){const p=o.get(d);p!==m&&p!=null&&(l=!0,r.set(d,p))}else l=!0,r.delete(d)}}return nn.debug("deleteInputFilters",l),l?{filterMap:r}:null})}updateColumnFilters(){this.setState(({model:e})=>e?{columnMap:e.getFilterColumnMap()}:null)}updateFilters(){const{columnMap:e,filterMap:n,model:s}=this.state;P(s);const i=this.getWaitingInputMap(s.isFilterRequired(),e,n);if(s.setFilter(n),n.size>0&&i.size===0){const o=s.getDefaultTitle(),r=on.join(Array.from(n.entries()).map(([l,a])=>`${l}: ${a}`));o?s.setTitle(`${o}<br><span style="font-size: smaller">${r}</span>`):s.setTitle(r),nn.debug2("updateFilters filters set",n),this.setState({isLoading:!0})}else nn.debug2("updateFilters waiting on inputs",i),s.setTitle(s.getDefaultTitle()),this.setState({isLoading:!1});this.updatePanelState()}pruneFilterMaps(){this.setState(e=>{const{columnMap:n}=e,s=new Map(e.filterMap),i=new Map(e.filterValueMap),o={};return e.filterValueMap.forEach((r,l)=>{n.has(l)||(i.delete(l),o.filterValueMap=i)}),e.filterMap.forEach((r,l)=>{n.has(l)||(s.delete(l),o.filterMap=s)}),o})}updateChart(){this.chart.current&&this.chart.current.updateDimensions()}render(){const{columnSelectionValidator:e,glContainer:n,glEventHub:s,inputFilters:i,isLinkerActive:o,links:r,metadata:l,settings:a}=this.props,{columnMap:d,filterMap:c,error:u,model:m,isActive:p,isDisconnected:g,isLoaded:f,isLoading:b}=this.state;let C;Vr(l)?C=l.table:C=l.figure;const w=this.getInputFilterColumnMap(d,i),T=this.getLinkedColumnMap(d,r),y=m!=null?this.getWaitingInputMap(m.isFilterRequired(),d,c):new Map,E=m!=null?this.getWaitingFilterMap(m.isFilterRequired(),d,c,T,w):new Map,I=u!=null?`Unable to open chart. ${u}`:void 0,D=y.size>0,F=d.size>0&&o;return h(Ul,{className:W("iris-chart-panel",{"input-required":D}),componentPanel:this,glContainer:n,glEventHub:s,onHide:this.handleHide,onClearAllFilters:this.handleClearAllFilters,onResize:this.handleResize,onShow:this.handleShow,onTabBlur:this.handleTabBlur,onTabFocus:this.handleTabFocus,errorMessage:I,isDisconnected:g,isLoading:b,isLoaded:f,widgetName:C,widgetType:"Chart",children:v("div",{ref:this.panelContainer,className:"chart-panel-container h-100 w-100",children:[h("div",{className:"chart-container h-100 w-100",children:f&&m&&h(mm,{isActive:p,model:m,settings:a,ref:this.chart,onDisconnect:this.handleDisconnect,onReconnect:this.handleReconnect,onUpdate:this.handleUpdate,onError:this.handleError,onSettingsChanged:this.handleSettingsChanged})}),h(ut,{in:D&&!F&&!b,timeout:It.transitionMs,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,children:h(_p,{inputFilterMap:w,linkedColumnMap:T,onAdd:this.handleFilterAdd,onOpenLinker:this.handleOpenLinker,columnMap:d,waitingFilterMap:E,waitingInputMap:y})}),h(ut,{in:F,timeout:It.transitionMs,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,children:h(Vo,{columns:this.getSelectorColumns(d,T,e),onColumnSelected:this.handleColumnSelected,onMouseEnter:this.handleColumnMouseEnter,onMouseLeave:this.handleColumnMouseLeave})})]})})}}$l.defaultProps={columnSelectionValidator:null,isLinkerActive:!1,source:null,sourcePanel:null,panelState:null,settings:{}};$l.displayName="ChartPanel";$l.COMPONENT="ChartPanel";const yE=(t,e)=>{const{localDashboardId:n,metadata:s}=e;let i;s!=null&&(i=s.sourcePanelId);const o=jd(t,n),r=jm(t,n),l=Nl(t),a=Qd(t,n),d=l===Yt.LINKER&&a===void 0;return{columnSelectionValidator:Zd(t,n),isLinkerActive:d,inputFilters:Xd(t,n),links:oo(t,n),source:i!=null?o.get(i):void 0,sourcePanel:i!=null?r.get(i):void 0,settings:xt(t)}},Bi=Ft(yE,{setActiveTool:Fl,setDashboardIsolatedLinkerPanelId:xp},null,{forwardRef:!0})($l);const Nr=X.module("CommandHistoryPanel"),kp=class extends S.exports.Component{constructor(t){super(t),this.handleFocusHistory=this.handleFocusHistory.bind(this),this.handleSessionOpened=this.handleSessionOpened.bind(this),this.handleSessionClosed=this.handleSessionClosed.bind(this),this.handleShow=this.handleShow.bind(this),this.handleSendToConsole=this.handleSendToConsole.bind(this),this.handleSendToNotebook=this.handleSendToNotebook.bind(this),this.container=Y.createRef(),this.pending=new fs;const{session:e,sessionId:n,language:s}=t;this.state={panelState:{},session:e,sessionId:n,language:s,contextActions:[{action:this.handleFocusHistory,shortcut:Bt.COMMAND_HISTORY.FOCUS_HISTORY}]}}static handleError(t){Nr.error(t)}componentDidMount(){const{glEventHub:t,session:e}=this.props;t.on(bt.FOCUS_HISTORY,this.handleFocusHistory),e!=null&&this.loadTable()}componentWillUnmount(){const{glEventHub:t}=this.props;t.off(bt.FOCUS_HISTORY,this.handleFocusHistory),this.pending.cancel()}handleFocusHistory(){this.container.current&&this.container.current.focus()}handleShow(){var t;(t=this.container.current)==null||t.restoreScrollPosition()}handleSessionOpened(t,{language:e,sessionId:n}){this.setState({session:t,sessionId:n,language:e},()=>{this.loadTable()})}handleSessionClosed(){this.pending.cancel(),this.setState({session:void 0,language:void 0,table:void 0})}handleSendToNotebook(t,e=!1){const{session:n,language:s}=this.state;if(Nr.debug("handleSendToNotebook",n,t),!n){Nr.error("Session is not connected.");return}const{glEventHub:i}=this.props;i.emit(e?He.CREATE_NOTEBOOK:He.SEND_TO_NOTEBOOK,n,s,t)}handleSendToConsole(t,e=!0,n=!1){Nr.debug("handleSendToConsole",t);const{glEventHub:s}=this.props;s.emit(bt.SEND_COMMAND,t,e,n)}loadTable(){const{commandHistoryStorage:t}=this.props,{language:e,sessionId:n}=this.state;P(e),P(n),this.pending.add(t.getTable(e,n,Date.now()),s=>s.close()).then(s=>{this.setState({table:s})}).catch(kp.handleError)}render(){const{glContainer:t,glEventHub:e,commandHistoryStorage:n}=this.props,{language:s,contextActions:i,table:o}=this.state;return v(jn,{className:"command-history-pane",componentPanel:this,glContainer:t,glEventHub:e,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,onShow:this.handleShow,children:[!o&&h("div",{className:"command-history-disconnected-message",children:"Waiting for console connection"}),o&&s!=null&&v(ye,{children:[h(Rl,{ref:this.container,language:s,sendToNotebook:this.handleSendToNotebook,sendToConsole:this.handleSendToConsole,table:o,commandHistoryStorage:n}),h(oe,{actions:i})]})]})}};let ec=kp;ec.COMPONENT="CommandHistoryPanel";ec.TITLE="Command History";const IE=(t,e)=>{const n=fm(t),s=gi(t,e.localDashboardId),{session:i,config:o}=s!=null?s:{},{type:r,id:l}=o!=null?o:{};return{commandHistoryStorage:n,language:r,session:i,sessionId:l}},ol=Ft(IE,null,null,{forwardRef:!0})(ec);const Fr=X.module("ConsolePanel"),RE=500,DE=Object.freeze({consoleSettings:{},itemIds:[]});class tc extends S.exports.PureComponent{constructor(e){super(e),this.savePanelState=je(()=>{const{consoleSettings:r,itemIds:l}=this.state,a={consoleSettings:r,itemIds:[...l]};Fr.debug("Saving panel state",a),this.setState({panelState:a})},RE),this.handleFocusCommandHistory=this.handleFocusCommandHistory.bind(this),this.handleOpenObject=this.handleOpenObject.bind(this),this.handleCloseObject=this.handleCloseObject.bind(this),this.handleResize=this.handleResize.bind(this),this.handleSettingsChange=this.handleSettingsChange.bind(this),this.handleShow=this.handleShow.bind(this),this.handlePanelMount=this.handlePanelMount.bind(this),this.consoleRef=Y.createRef();const{panelState:n}=e,s={...DE,...n||{}},{consoleSettings:i,itemIds:o}=s;this.state={consoleSettings:i,itemIds:new Map(o),objectMap:new Map,error:void 0,panelState:s}}componentDidMount(){const{glEventHub:e}=this.props;this.closeDisconnectedPanels(),e.on(Ie.MOUNT,this.handlePanelMount),this.subscribeToFieldUpdates()}componentDidUpdate(e,n){const{consoleSettings:s,itemIds:i}=this.state;(n.consoleSettings!==s||n.itemIds!==i)&&this.savePanelState()}componentWillUnmount(){var n;const{glEventHub:e}=this.props;this.savePanelState.flush(),e.off(Ie.MOUNT,this.handlePanelMount),(n=this.objectSubscriptionCleanup)==null||n.call(this)}subscribeToFieldUpdates(){const{sessionWrapper:e}=this.props,{session:n}=e;this.objectSubscriptionCleanup=n.subscribeToFieldUpdates(s=>{Fr.debug("Got updates",s),this.setState(({objectMap:i})=>{const{updated:o,created:r,removed:l}=s,a=[...o,...l],d=new Map(i);return a.forEach(u=>{const{title:m}=u;m!==void 0&&d.delete(m)}),[...o,...r].forEach(u=>{u.title!==void 0&&d.set(u.title,u)}),{objectMap:d}})})}setItemId(e,n){this.setState(({itemIds:s})=>{const i=new Map(s);return i.set(e,n),{itemIds:i}})}getItemId(e,n=!0){const{itemIds:s}=this.state;let i=s.get(e);return i==null&&n&&(i=ze.generate(),this.setItemId(e,i)),i}handleTabFocus(){var e;(e=this.consoleRef.current)==null||e.focus()}handlePanelMount(e){var o,r,l;const{itemIds:n}=this.state,s=(o=e==null?void 0:e.props)==null?void 0:o.id,i=(l=(r=e==null?void 0:e.props)==null?void 0:r.metadata)==null?void 0:l.sourcePanelId;s&&i&&new Set(n.values()).has(i)&&this.setItemId(s,s)}handleFocusCommandHistory(){const{glEventHub:e}=this.props;e.emit(bt.FOCUS_HISTORY)}handleResize(){this.updateDimensions()}handleShow(){this.updateDimensions()}handleOpenObject(e){const{sessionWrapper:n}=this.props,{session:s}=n;this.openWidget(e,s)}handleCloseObject(e){const{title:n}=e;if(n!==void 0){const s=this.getItemId(n,!1),{glEventHub:i}=this.props;i.emit(Ie.CLOSE,s)}}handleSettingsChange(e){const{glEventHub:n}=this.props;Fr.debug("handleSettingsChange",e),this.setState({consoleSettings:e}),n.emit(bt.SETTINGS_CHANGED,e)}openWidget(e,n){const{glEventHub:s}=this.props,{title:i}=e;P(i);const o=this.getItemId(i),r={fetch:()=>n.getObject(e),panelId:o,widget:e};Fr.debug("openWidget",r),s.emit(Ie.OPEN,r)}addCommand(e,n=!0,s=!1){var i;(i=this.consoleRef.current)==null||i.addCommand(e,n,s)}closeDisconnectedPanels(e=!1){const{consoleSettings:n,itemIds:s}=this.state,{isClosePanelsOnDisconnectEnabled:i=!0}=n;if(!i&&!e)return;const o=[...s.values()],{glEventHub:r}=this.props;o.forEach(l=>{r.emit(Ie.CLOSE,l)}),this.setState({itemIds:new Map})}updateDimensions(){var e;(e=this.consoleRef.current)==null||e.updateDimensions()}render(){const{commandHistoryStorage:e,glContainer:n,glEventHub:s,sessionWrapper:i,timeZone:o,unzip:r}=this.props,{consoleSettings:l,error:a,objectMap:d}=this.state,{config:c,session:u,connection:m}=i,{id:p,type:g}=c;return h(jn,{componentPanel:this,glContainer:n,glEventHub:s,onResize:this.handleResize,onShow:this.handleShow,onTabFocus:this.handleTabFocus,errorMessage:a!=null?`${a}`:void 0,children:u!=null&&h(Sd,{ref:this.consoleRef,settings:l,session:u,focusCommandHistory:this.handleFocusCommandHistory,openObject:this.handleOpenObject,closeObject:this.handleCloseObject,commandHistoryStorage:e,onSettingsChange:this.handleSettingsChange,language:g,statusBarChildren:v(ye,{children:[h("div",{children:"\xA0"}),h("div",{children:Ku.LANGUAGE_MAP.get(g)}),h("div",{children:"\xA0"}),h("div",{children:h(CS,{connection:m,defaultUpdateInterval:10*1e3,hoverUpdateInterval:3*1e3,monitorDuration:10*60*1e3})}),h("div",{children:"\xA0"})]}),scope:p,timeZone:o,objectMap:d,unzip:r})})}}tc.COMPONENT="ConsolePanel";tc.TITLE="Console";const ME=(t,e)=>({commandHistoryStorage:fm(t),sessionWrapper:gi(t,e.localDashboardId),timeZone:Ml(t)}),Li=Ft(ME,null,null,{forwardRef:!0})(tc);const bo=X.module("DropdownFilter"),NE=150,Ur=class extends S.exports.Component{constructor(t){super(t),this.getCompatibleColumns=pe((i,o)=>i!=null?o.filter(({type:r})=>r!==void 0&&L.isCompatibleType(r,i.columnType)):[]),this.getColumnOptions=pe((i,o)=>{let r=-1;const l=[];return l.push(h("option",{value:"-1",children:"Select a column"},"placeholder")),i.forEach((a,d)=>{l.push(h("option",{value:d,children:this.getItemLabel(i,d)},`${a.name}/${a.type}`)),o!==null&&a.name===o.name&&a.type===o.type&&(r=d)}),[l,r]}),this.getSelectedOptionIndex=pe((i,o)=>i.indexOf(o)),this.getValueOptions=pe(i=>[h("option",{value:"-1",children:Ur.PLACEHOLDER},"-1"),...i.map((o,r)=>h("option",{value:r,children:o},`${r}/${o}`))]),this.getItemLabel=ve((i,o)=>{const{name:r,type:l}=i[o];if(o>0&&i[o-1].name===r||o<i.length-1&&i[o+1].name===r){const a=l.substring(l.lastIndexOf(".")+1);return`${r} (${a})`}return r}),this.sendUpdate=je(()=>{const{onChange:i}=this.props,{column:o,value:r,isValueShown:l}=this.state;i({column:o,isValueShown:l,value:r!=null?r:void 0})},NE),this.handleColumnChange=this.handleColumnChange.bind(this),this.handleSettingsCancel=this.handleSettingsCancel.bind(this),this.handleSettingsClick=this.handleSettingsClick.bind(this),this.handleSettingsSave=this.handleSettingsSave.bind(this),this.handleBackgroundClick=this.handleBackgroundClick.bind(this),this.handleDropdownKeyPress=this.handleDropdownKeyPress.bind(this),this.handleValueChange=this.handleValueChange.bind(this),this.dropdownRef=Y.createRef();const{column:e,isValueShown:n,value:s}=t;this.state={column:e,selectedColumn:e,disableCancel:!n,isValueShown:n,value:s}}componentDidUpdate(t,e){const{source:n,values:s,isLoaded:i}=this.props,{column:o,value:r,isValueShown:l}=this.state;i&&(n!==t.source&&this.sourceUpdated(),s!==t.values&&r!==""&&!s.includes(r)&&this.resetValue(),l!==e.isValueShown&&l&&this.focusInput(),(o!==e.column||r!==e.value||l!==e.isValueShown)&&this.sendUpdate())}componentWillUnmount(){this.sendUpdate.flush()}handleColumnChange(t){const{value:e}=t.target;if(bo.debug2("handleColumnChange",e),e!=null&&parseInt(e,10)<0){this.setState({selectedColumn:null});return}const{columns:n,source:s}=this.props,i=this.getCompatibleColumns(s,n);this.setState({selectedColumn:i[parseInt(e,10)]})}handleDropdownKeyPress(t){t.key==="Enter"&&(t.preventDefault(),t.stopPropagation(),bo.debug2("handleDropdownKeyPress"),this.sendUpdate(),this.sendUpdate.flush())}handleValueChange(t){const{value:e}=t.target,n=parseInt(e,10);let s="";const{values:i}=this.props;if(n===-1)bo.debug2("Selected default item");else if(n>=0&&n<i.length)s=i[n];else{bo.error("Invalid index",n,i);return}bo.debug2("handleValueChange",s),this.setState({value:s})}handleSettingsCancel(){this.setState(({column:t})=>({selectedColumn:t,isValueShown:!0}))}handleSettingsSave(){this.setState(({column:t,selectedColumn:e,value:n})=>({column:e,value:t===e?n:"",isValueShown:!0,disableCancel:!1}))}handleSettingsClick(t){t.stopPropagation(),this.showSettings()}handleBackgroundClick(t){t.target!==this.dropdownRef.current&&this.focusInput()}handleMouseEnter(){const{onSourceMouseEnter:t}=this.props;t()}handleMouseLeave(){const{onSourceMouseLeave:t}=this.props;t()}sourceUpdated(){this.setState({column:null,selectedColumn:null,isValueShown:!1,disableCancel:!0,value:""})}showSettings(){const{column:t}=this.state;this.setState({selectedColumn:t,isValueShown:!1})}focusInput(){this.dropdownRef.current!==null&&this.dropdownRef.current.focus()}resetValue(){this.setState({value:""})}clearFilter(){this.resetValue()}setFilterState({name:t,type:e,value:n,isValueShown:s}){const i=t!=null&&e!=null?{name:t,type:e}:null;this.setState({column:i,value:n,isValueShown:s})}render(){var U;const{columns:t,disableLinking:e,isLinkerActive:n,isLoaded:s,source:i,onColumnSelected:o,onSourceMouseEnter:r,onSourceMouseLeave:l,values:a,settingsError:d}=this.props,{column:c,disableCancel:u,isValueShown:m,selectedColumn:p,value:g}=this.state,f=i===null,b=this.getCompatibleColumns(i,t),C=i!=null,w=(U=i==null?void 0:i.columnName)!=null?U:Ur.SOURCE_BUTTON_PLACEHOLDER,T=c!=null?`${c.name} Filter`:null,[y,E]=this.getColumnOptions(b,p),I=this.getValueOptions(a),D=this.getSelectedOptionIndex(a,g),F=!C||p==null;return v(rd,{className:"dropdown-filter fill-parent-absolute",isFlipped:m&&!n,children:[h("div",{className:"dropdown-filter-settings-card",children:v("div",{className:"dropdown-filter-card-content",children:[v("div",{className:"dropdown-filter-settings-grid",children:[h("label",{children:"Source Column"}),h(Tl,{isLinked:C,onClick:o,onMouseEnter:r,onMouseLeave:l,className:Ur.SOURCE_BUTTON_CLASS_NAME,disabled:e,children:w}),h("div",{className:"text-muted small",children:"Select a source column for the list by linking to a table."}),h("label",{children:"Filter Column"}),h("select",{value:E,className:"custom-select",onChange:this.handleColumnChange,disabled:f,children:y}),h("div",{className:"text-muted small",children:"Dropdown filter control will apply its filter to all columns matching this name in this dashboard."})]}),d&&h("div",{className:"error-message text-center",children:d}),C&&v("div",{className:"dropdown-filter-settings-buttons",children:[h(z,{kind:"secondary",type:"button",onClick:this.handleSettingsCancel,disabled:u||m||n,tooltip:n?"Cancel disabled while linker open":void 0,children:"Cancel"}),h(z,{kind:"primary",type:"button",className:"ml-2",onClick:this.handleSettingsSave,disabled:F||m||n,tooltip:n?"Save disabled while linker open":void 0,children:"Save"})]})]})}),h("div",{className:"dropdown-filter-value-card",onClick:this.handleBackgroundClick,children:s&&v(ye,{children:[h("div",{className:"dropdown-filter-column",children:h("div",{className:"dropdown-filter-column-title",children:T})}),v("div",{className:"dropdown-filter-card-content",children:[h("div",{className:"dropdown-filter-value-input d-flex flex-column justify-content-center",children:h("select",{className:"custom-select",value:D,ref:this.dropdownRef,onChange:this.handleValueChange,onKeyPress:this.handleDropdownKeyPress,children:I})}),d&&h("div",{className:"error-message mt-3 text-center",children:d})]}),h("div",{className:"dropdown-filter-menu",children:h(z,{kind:"ghost",className:"m-2 px-2",onClick:this.handleSettingsClick,icon:h(j,{icon:Go,transform:"grow-4"}),tooltip:"Dropdown Filter Settings"})})]})})]})}};let qi=Ur;qi.defaultProps={column:null,disableLinking:!1,isLinkerActive:!1,isLoaded:!1,isValueShown:!1,settingsError:null,source:null,value:"",values:[],onColumnSelected:()=>{},onSourceMouseEnter:()=>{},onSourceMouseLeave:()=>{}};qi.PLACEHOLDER="Select a value...";qi.SOURCE_BUTTON_CLASS_NAME="btn-dropdown-filter-selector";qi.SOURCE_BUTTON_PLACEHOLDER="Select a column";const nt=X.module("DropdownFilterPanel"),FE=250,ti=class extends S.exports.Component{constructor(t){super(t),this.getCachedValues=pe((d,{type:c,name:u},m)=>c!==void 0&&L.isDateType(c)?d.map(p=>ti.DATETIME_FORMATTER.format(p)):d.map(p=>p!=null&&c!=null?m.getFormattedString(p,c,u):null)),this.getCachedPanelLinks=pe((d,c)=>{const u=te.getIdFromPanel(c);return nt.debug("getCachedPanelLinks",d,u),d.filter(m=>{var p;return((p=m.end)==null?void 0:p.panelId)===u})}),this.getCachedSource=pe(d=>{nt.debug("getCachedSource",d);let c;if(d.length>0){const[u]=d;c=u.start,d.length>1&&nt.error("Filter has more that one link",d)}return c}),this.getCachedSourceTable=pe((d,c)=>{var m;if(nt.debug("getCachedSourceTable",d,c),c==null)return null;const{panelId:u}=c;return(m=d.get(u))!=null?m:null}),this.getCachedSourceColumn=pe((d,c)=>{var u;return nt.debug("getCachedSourceColumn",d,c),d==null||c==null?null:(u=d.columns.find(({name:m,type:p})=>m===c.columnName&&p===c.columnType))!=null?u:null}),this.handleChange=je(this.handleChange.bind(this),FE),this.handleClearAllFilters=this.handleClearAllFilters.bind(this),this.handleDisconnect=this.handleDisconnect.bind(this),this.handleReconnect=this.handleReconnect.bind(this),this.handleColumnSelected=this.handleColumnSelected.bind(this),this.handleSourceFilterChange=this.handleSourceFilterChange.bind(this),this.handleSourceSortChange=this.handleSourceSortChange.bind(this),this.handleSourceSizeChange=this.handleSourceSizeChange.bind(this),this.handleSourceMouseEnter=this.handleSourceMouseEnter.bind(this),this.handleSourceMouseLeave=this.handleSourceMouseLeave.bind(this),this.handleValuesTableUpdate=this.handleValuesTableUpdate.bind(this),this.dropdownFilterRef=Y.createRef(),this.panelContainer=Y.createRef(),this.pending=new fs;const{panelState:e,settings:n}=t;this.columnFormats=hs.getColumnFormats(n);const{value:s="",isValueShown:i=!1,name:o,type:r,timestamp:l}=e!=null?e:{},a=o!=null&&r!=null?{name:o,type:r}:void 0;this.state={column:a,formatter:new un(this.columnFormats),valuesTable:void 0,valuesColumn:void 0,sourceSize:0,value:s,timestamp:l,values:[],isValueShown:i,wasFlipped:!1,skipUpdate:!1,panelState:e,isDisconnected:!1,isLoading:!1,isLoaded:!1,error:null}}componentDidMount(){this.updateValuesTable();const{column:t,value:e,timestamp:n}=this.state,s=this.getSourceTable();if(s!==null&&this.startListeningToSource(s),t!=null){const{name:i,type:o}=t;this.sendUpdate(i,o,e,n)}}componentDidUpdate(t,e){const{valuesTable:n}=this.state,{settings:s}=this.props,i=this.getSource(),o=this.getSourceTable(),r=this.getSource(t),l=this.getSourceTable(t);s!==t.settings&&s!==void 0&&this.updateFormatterSettings(s),n!==e.valuesTable&&e.valuesTable!=null&&(nt.debug("Table in state modified, closing the old table."),e.valuesTable.close()),(o!==l||i!==r)&&this.updateValuesTable(),o!==l&&(l!==null&&this.stopListeningToSource(l),o!==null&&this.startListeningToSource(o))}componentWillUnmount(){const{valuesTable:t}=this.state,e=this.getSourceTable();this.pending.cancel(),e!==null&&this.stopListeningToSource(e),this.cleanup&&this.cleanup(),t!=null&&t.close()}getCoordinateForColumn(){var i;if(this.panelContainer.current==null)return null;const t=this.panelContainer.current.querySelector(`.${qi.SOURCE_BUTTON_CLASS_NAME}`),e=(i=t==null?void 0:t.getBoundingClientRect())!=null?i:null;if(e==null||e.width<=0||e.height<=0)return null;const n=e.left+e.width/2,s=e.bottom;return[n,s]}getSettingsErrorMessage(){const{sourceSize:t}=this.state;if(t>ti.MAX_TABLE_SIZE)return`Table too large, must have fewer than ${ti.MAX_TABLE_SIZE} options.`}getPanelErrorMessage(){const{error:t}=this.state;return t!=null?`${t}`:void 0}getSource(t=this.props){const{dashboardLinks:e}=t,n=this.getCachedPanelLinks(e,this);return this.getCachedSource(n)}getSourceTable(t=this.props){const{panelTableMap:e}=t,n=this.getSource(t);return this.getCachedSourceTable(e,n)}getValuesColumn(t){const e=this.getSource();return this.getCachedSourceColumn(t,e)}startListeningToSource(t){nt.debug("startListeningToSource"),t.addEventListener(M.Table.EVENT_FILTERCHANGED,this.handleSourceFilterChange),t.addEventListener(M.Table.EVENT_SORTCHANGED,this.handleSourceSortChange),t.addEventListener(M.Table.EVENT_SIZECHANGED,this.handleSourceSizeChange),t.addEventListener(M.Table.EVENT_DISCONNECT,this.handleDisconnect),t.addEventListener(M.Table.EVENT_RECONNECT,this.handleReconnect)}stopListeningToSource(t){nt.debug("stopListeningToSource"),t.removeEventListener(M.Table.EVENT_FILTERCHANGED,this.handleSourceFilterChange),t.removeEventListener(M.Table.EVENT_SORTCHANGED,this.handleSourceSortChange),t.removeEventListener(M.Table.EVENT_SIZECHANGED,this.handleSourceSizeChange),t.removeEventListener(M.Table.EVENT_DISCONNECT,this.handleDisconnect),t.removeEventListener(M.Table.EVENT_RECONNECT,this.handleReconnect)}handleChange({column:t,isValueShown:e=!1,value:n}){const{name:s=void 0,type:i=void 0}=t!=null?t:{};let o=!0,r=Date.now();this.setState(({panelState:l,timestamp:a,wasFlipped:d,skipUpdate:c})=>{var m;const u=l!=null&&e!==l.isValueShown&&s===l.name&&i===l.type&&n===l.value;return o=(m=!c&&e&&(!u||!d))!=null?m:!1,o||(r=a),{panelState:{isValueShown:e,name:s,type:i,value:n,timestamp:r!=null?r:void 0},timestamp:r,wasFlipped:u,skipUpdate:!1}},()=>{o&&this.sendUpdate(s!=null?s:null,i,n,r)})}handleDisconnect(){this.setState({error:new Error("Table disconnected"),isDisconnected:!0,isLoading:!1})}handleReconnect(){this.setState({isDisconnected:!1,error:null})}handleSourceFilterChange(){this.applySourceFilters()}handleSourceSortChange(){this.applySourceSorts()}handleSourceSizeChange({detail:t}){this.setState({sourceSize:t})}handleColumnSelected(){nt.debug("handleColumnSelected");const{glEventHub:t}=this.props;t.emit(Pe.COLUMN_SELECTED,this,ti.SOURCE_COLUMN)}handleClearAllFilters(){var t,e;(e=(t=this.dropdownFilterRef)==null?void 0:t.current)==null||e.clearFilter()}setPanelState(t,e=!1){var n,s;if(this.getSource()==null){nt.debug("Ignore state update for unlinked filter",t);return}this.setState({skipUpdate:!e}),(s=(n=this.dropdownFilterRef)==null?void 0:n.current)==null||s.setFilterState(t)}sendUpdate(t,e,n,s){var l;const{glEventHub:i}=this.props,o=(l=this.getSource())==null?void 0:l.panelId,r=o===null?[]:[o];nt.debug("sendUpdate",{name:t,type:e,value:n,timestamp:s,excludePanelIds:r}),i.emit(Pe.FILTERS_CHANGED,this,{name:t,type:e,value:n!=null?n:"=null",timestamp:s,excludePanelIds:r})}updateValuesTable(){const t=this.getSource(),e=this.getSourceTable();if(nt.debug("updateValuesTable",t,e),this.setState({values:[],valuesTable:void 0,error:null}),t==null){nt.debug("Filter unlinked."),this.setState({isLoading:!1,isLoaded:!0,isValueShown:!1,sourceSize:0});return}this.setState({isLoading:!0}),e!=null&&(this.setState({isLoaded:!1,sourceSize:e.size}),this.pending.add(e.copy(),n=>n.close()).then(n=>{this.updateViewportListener(n),this.setState({valuesTable:n})}).catch(n=>{Te.isCanceled(n)||(nt.error(n),this.setState({isLoading:!1,error:n}))}))}applySourceSorts(){const{valuesTable:t}=this.state,e=this.getSourceTable();if(nt.debug("applySourceSorts",e==null?void 0:e.sort),t==null||e==null){nt.debug("Table not initialized");return}const n=[...e.sort];t.applySort(n),this.setViewport(t)}applySourceFilters(){const{valuesTable:t}=this.state,e=this.getSourceTable();if(nt.debug("applySourceFilters",e==null?void 0:e.filter),t==null||e==null){nt.debug("Table not initialized");return}const n=[...e.filter];t.applyFilter(n),this.setViewport(t)}updateViewportListener(t){if(nt.debug("updateViewportListener",t==null?void 0:t.size),this.cleanup&&this.cleanup(),t==null){this.cleanup=void 0;return}this.cleanup=t.addEventListener(M.Table.EVENT_UPDATED,this.handleValuesTableUpdate),this.setViewport(t)}setViewport(t){const e=this.getValuesColumn(t);if(!e){nt.error("values column is null");return}t.setViewport(0,ti.MAX_TABLE_SIZE-1,[e])}updateFormatterSettings(t){const e=hs.getColumnFormats(t);ht(this.columnFormats,e)||(this.columnFormats=e,this.setState({formatter:new un(e)}))}handleValuesTableUpdate({detail:t}){const{rows:e}=t,{valuesTable:n}=this.state;if(!n){nt.error("valuesTable is null");return}const s=this.getValuesColumn(n);if(!s){nt.error("Values column not found");return}const i=e.map(o=>o.get(s));this.setState({values:i,isLoading:!1,isLoaded:!0,valuesColumn:s})}handleSourceMouseEnter(){const{columnSelectionValidator:t}=this.props;!t||t(this,ti.SOURCE_COLUMN)}handleSourceMouseLeave(){const{columnSelectionValidator:t}=this.props;!t||t(this,void 0)}render(){const{columns:t,disableLinking:e,glContainer:n,glEventHub:s,isLinkerActive:i}=this.props,{column:o,formatter:r,isDisconnected:l,isValueShown:a,value:d,values:c,valuesColumn:u,isLoading:m,isLoaded:p}=this.state,g=this.getSource(),f=this.getSettingsErrorMessage(),b=this.getPanelErrorMessage(),C=p&&u!=null?this.getCachedValues(c,u,r):[];return h(Ul,{errorMessage:b,isLoading:m,isLoaded:p,isDisconnected:l,className:"iris-dropdown-filter-panel",componentPanel:this,glContainer:n,glEventHub:s,onClearAllFilters:this.handleClearAllFilters,widgetName:"Dropdown Filter",widgetType:"DropdownFilter",children:h("div",{ref:this.panelContainer,className:"dropdown-filter-container h-100 w-100 container",children:h(qi,{ref:this.dropdownFilterRef,column:o,columns:t,isValueShown:a,isLinkerActive:i,disableLinking:e,isLoaded:p,settingsError:f,source:g,value:d,values:C,onChange:this.handleChange,onColumnSelected:this.handleColumnSelected,onSourceMouseEnter:this.handleSourceMouseEnter,onSourceMouseLeave:this.handleSourceMouseLeave})})})}};let ro=ti;ro.displayName="DropdownFilterPanel";ro.COMPONENT="DropdownFilterPanel";ro.MAX_TABLE_SIZE=256;ro.DATETIME_FORMATTER=new dt({showTimeZone:!1,showTSeparator:!0,defaultDateTimeFormatString:"yyyy-MM-dd HH:mm:ss.SSSSSSSSS"});ro.SOURCE_COLUMN=Object.freeze({name:"FilterSource",type:null});const xE=(t,e)=>{const{localDashboardId:n}=e,s=te.getIdFromPanel({props:e}),i=jd(t,n),o=oo(t,n),r=Nl(t),l=Qd(t,n),a=r===Yt.LINKER&&(l===void 0||l===s),d=r===Yt.LINKER&&l!==void 0&&l!==s;return{columns:Fp(t,n),columnSelectionValidator:Zd(t,n),isLinkerActive:a,disableLinking:d,settings:xt(t),panelTableMap:i,dashboardLinks:o}},ci=Ft(xE,null,null,{forwardRef:!0})(ro);function qn(t){return t.type==="directory"}var Op=(t=>(t.GROOVY="text/x-groovy",t.PLAIN_TEXT="text/plain",t.PYTHON="text/x-python",t.PYTHON_COMPILED="application/x-python-code",t.SCALA="text/x-scala",t.UNKNOWN="",t))(Op||{});class ce{static fileExtensionToString(e=""){return e.length===0?"":`.${e}`}static getDepth(e){var s;if(!ce.hasPath(e))throw new Error(`Invalid path provided: ${e}`);return((s=e.match(/\//g))!=null?s:[]).length-1}static getExtension(e){var s;const n=this.getBaseName(e).split(".");return n.length>1&&(s=n.pop())!=null?s:""}static getBaseName(e){var n;return(n=e.split("/").pop())!=null?n:""}static getCopyFileName(e){const n=e.lastIndexOf(".");let s=null,i=null;n<0?i=e:(i=e.substring(0,n),s=e.substring(n+1));const o=i?`${i}-copy`:"Copy";return s!==null?`${o}.${s}`:o}static getMimeType(e){switch(this.getExtension(e).toLowerCase()){case"groovy":return"text/x-groovy";case"py":return"text/x-python";case"pyc":return"application/x-python-code";case"scala":return"text/x-scala";case"txt":return"text/plain";default:return""}}static getParent(e){if(!ce.hasPath(e))throw new Error(`Invalid name provided: ${e}`);const n=e.split("/");for(;n.pop()==="";);if(n.length===0)throw new Error(`No parent for path provided: ${e}`);return`${n.join("/")}/`}static getPath(e){if(!ce.hasPath(e))throw new Error(`Invalid filename provided: ${e}`);const n=e.split("/");return n.pop(),`${n.join("/")}/`}static hasPath(e){return e.startsWith("/")}static isPath(e){return e.startsWith("/")&&e.endsWith("/")}static makePath(e){return e.endsWith("/")?e:`${e}/`}static replaceExtension(e,n=""){const s=e.lastIndexOf("."),i=s>-1?e.substring(0,s):e,o=ce.fileExtensionToString(n);return`${i}${o}`}static validateName(e){var o,r;const n=[".",".."],s=/[\\/\0]/g,i=new Map([["\0","null"]]);if(!e)throw new Hi("Name cannot be empty");if(n.includes(e))throw new Hi(`"${e}" is a reserved name`);if(s.test(e))throw new Hi(`Invalid characters in name: "${(r=(o=e.match(s))==null?void 0:o.reduce((l,a)=>l.includes(a)?l:[...l,a],[]).map(l=>i.has(l)?i.get(l):l).join('", "'))!=null?r:""}"`)}static reducePaths(e){const n=e.filter(s=>ce.isPath(s));return e.filter(s=>!n.some(i=>s!==i&&s.startsWith(i)))}static removeRoot(e,n){if(e.length===0)return n;if(!n.startsWith(e))throw new Error(`Filename ${n} does not start with expected root ${e}`);return n.substring(e.length)}static addRoot(e,n){return`${e}${n}`}}const At=X.module("FileList"),Ga=t=>qn(t)?ce.makePath(t.filename):ce.getPath(t.filename),nc=26,_E=500,kh="item-list-scroll-pane",Ka=t=>{var I;const{children:e,draggedItems:n,isDragInProgress:s,isDropTargetValid:i,isSelected:o,item:r,itemIndex:l,dropTargetItem:a,onDragStart:d,onDragOver:c,onDragEnd:u,onDrop:m}=t,p=(I=n==null?void 0:n.some(D=>D.id===r.id))!=null?I:!1,g=Ga(r),f=s&&a?Ga(a):null,b=s&&i&&qn(r)&&f===g,C=s&&i&&f===g,w=s&&!i&&f===g,T=kE(r),y=ce.getDepth(r.filename),E=Array(y).fill(null).map((D,F)=>h("span",{className:"file-list-depth-line"},F));return v("div",{className:W("d-flex w-100 align-items-center","file-list-item",{"is-dragged":p,"is-exact-drop-target":b,"is-in-drop-target":C,"is-invalid-drop-target":w,"is-selected":o}),onDragStart:D=>d(l,D),onDragOver:D=>c(l,D),onDragEnd:D=>u(l,D),onDrop:D=>m(l,D),draggable:!0,role:"presentation","aria-label":r.basename,children:[E," ",h(j,{icon:T,className:"item-icon",fixedWidth:!0})," ",v("span",{className:"truncation-wrapper",children:[e!=null?e:r.basename,h(Ue,{options:{modifiers:{preventOverflow:{boundariesElement:"window"}},placement:"left"},children:e!=null?e:r.basename})]})]})};function kE(t){if(qn(t))return t.isExpanded?Rf:Df;switch(ce.getMimeType(t.basename)){case Op.PYTHON:return lC;default:return Tf}}function Oh(t,e){if(t.length===0||e==null)throw new Error("No items to move");const n=Ga(e);if(t.some(({filename:s})=>ce.getPath(s)===n))throw new Error("File already in the destination folder");if(t.some(s=>qn(s)&&n.startsWith(ce.makePath(s.filename))))throw new Error("Destination folder cannot be a child of a dragged folder");return{files:t,targetPath:n}}function OE(t){const{isMultiSelect:e=!1,table:n,onFocusChange:s=()=>{},onMove:i,onSelect:o,onSelectionChange:r=()=>{},renderItem:l=Ka,rowHeight:a=nc,overscanCount:d=bn.DEFAULT_OVERSCAN}=t,[c,u]=S.exports.useState(()=>({items:[],offset:0,itemCount:0})),[m,p]=S.exports.useState({top:0,bottom:0}),[g,f]=S.exports.useState(),[b,C]=S.exports.useState(),[w,T]=S.exports.useState(),[y,E]=S.exports.useState([]),I=S.exports.useRef(null),D=S.exports.useRef(null),F=S.exports.useCallback(ee=>{if(ee.length===0||c==null)return[];const ue=[];for(let Se=0;Se<ee.length;Se+=1){const Me=ee[Se];for(let qe=Me[0];qe<=Me[1];qe+=1)qe>=c.offset&&qe<c.offset+c.items.length&&ue.push(c.items[qe-c.offset])}return ue},[c]),x=S.exports.useCallback(ee=>{const ue=F([[ee,ee]]);if(ue.length>0)return ue[0]},[F]),U=S.exports.useCallback(()=>{const ee=fn.count(y);if(ee===0)return null;if(ee===1){const ue=y[0][0],Se=x(ue);if(Se!=null)return Se.filename}return`${ee} items`},[x,y]),B=S.exports.useCallback(ee=>{var ue;if(!(!b||!g)){At.debug("dropItems",b,"to",ee);try{const{files:Se,targetPath:Me}=Oh(b,g);i(Se,Me),ee!=null&&(E([[ee,ee]]),(ue=I.current)==null||ue.focusItem(ee))}catch(Se){At.error("Unable to complete move",Se)}}},[b,g,i]),_=S.exports.useCallback((ee,ue)=>{const Se=c.items[ee-c.offset];Se!==void 0&&(At.debug("handleItemClick",Se),o(Se,ue),qn(Se)&&(n==null||n.setExpanded(Se.filename,!Se.isExpanded)))},[c,o,n]),H=S.exports.useCallback((ee,ue)=>{var qe;At.debug2("handleItemDragStart",ee,y);let Se=y;fn.isSelected(y,ee)||(Se=[[ee,ee]],E(Se)),C(F(Se)),(qe=I.current)==null||qe.resetMouseState();const Me=document.createElement("div");Me.innerHTML=`<div class="dnd-placeholder-content">${U()}</div>`,Me.className="file-list-dnd-placeholder",document.body.appendChild(Me),ue.dataTransfer.setDragImage(Me,0,0),ue.dataTransfer.effectAllowed="move",T(Me)},[U,F,y]),A=S.exports.useCallback((ee,ue)=>{ue.preventDefault(),At.debug2("handleItemDragOver",ue),f(x(ee))},[x]),N=S.exports.useCallback((ee,ue)=>{At.debug("handleItemDragEnd",ee),w==null||w.remove(),C(void 0),f(void 0),T(void 0)},[w]),k=S.exports.useCallback((ee,ue)=>{B(ee)},[B]),O=S.exports.useCallback(()=>{At.debug2("handleItemDragExit"),f(void 0)},[]),V=S.exports.useCallback(ee=>{ee.target instanceof Element&&ee.target.classList.contains(kh)&&(ee.preventDefault(),At.debug2("handleListDragOver",ee),f({type:"directory",filename:"/",basename:"/",id:"/"}))},[]),G=S.exports.useCallback(ee=>{ee.target instanceof Element&&ee.target.classList.contains(kh)&&(At.debug("handleListDrop"),B())},[B]),Q=S.exports.useCallback(ee=>{if(At.debug2("handleSelectionChange",ee),ee!==y){E(ee);const ue=F(ee);r(ue)}},[F,r,y]),Z=S.exports.useCallback(ee=>{if(At.debug2("handleFocusChange",ee),ee!=null){const[ue]=F([[ee,ee]]);s(ue)}else s()},[F,s]),be=S.exports.useCallback((ee,ue)=>{At.debug("handleViewportChange",ee,ue),(ee!==m.top||ue!==m.bottom)&&p({top:ee,bottom:ue})},[m]),le=S.exports.useMemo(()=>{if(!b||!g)return!1;try{return Oh(b,g),At.debug("handleValidateDropTarget true"),!0}catch{return At.debug("handleValidateDropTarget false"),!1}},[b,g]),{focusedPath:he}=t;S.exports.useEffect(()=>{he!==void 0&&(he==="/"?n.collapseAll():(n.setExpanded(he,!1),n.setExpanded(he,!0)))},[n,he]),S.exports.useEffect(function(){At.debug("updating table viewport",m),n==null||n.setViewport({top:Math.max(0,m.top-d),bottom:m.bottom+d})},[d,n,m]),S.exports.useEffect(function(){const ue=n.onUpdate(Se=>{u({items:Se.items.map(Me=>({...Me,itemName:Me.basename})),offset:Se.offset,itemCount:n.size})});return()=>{ue()}},[n]),S.exports.useEffect(function(){if(g!=null&&qn(g)&&g.filename!=="/"){const ue=setTimeout(()=>{g.isExpanded||n==null||n.setExpanded(g.filename,!0)},_E);return()=>clearTimeout(ue)}},[g,n]);const De=S.exports.useCallback(ee=>l({...ee,isDragInProgress:b!=null,dropTargetItem:g,draggedItems:b,isDropTargetValid:le,onDragStart:H,onDragEnd:N,onDragOver:A,onDragExit:O,onDrop:k}),[N,O,A,H,k,b,g,le,l]);return h("div",{ref:D,className:W("file-list",{"is-dragging":b!=null}),onDragOver:V,onDrop:G,children:h(bn,{ref:I,items:c.items,itemCount:c.itemCount,offset:c.offset,onFocusChange:Z,onSelect:_,onSelectionChange:Q,onViewportChange:be,selectedRanges:y,renderItem:De,rowHeight:a,isMultiSelect:e,isDragSelect:!1,isDeselectOnClick:!1})})}const LE={name:"File Explorer",DELETE:Ae.createAndAdd({id:"FILE_EXPLORER.DELETE",name:"Delete",shortcut:[me.DELETE],macShortcut:[de.CMD,me.BACKSPACE]}),RENAME:Ae.createAndAdd({id:"FILE_EXPLORER.RENAME",name:"Rename",shortcut:[me.ENTER],macShortcut:[me.ENTER]})},Lh={FILE_EXPLORER:LE};const Ah=X.module("FileListItemEditor"),AE=()=>Promise.resolve();function PE({item:t,onCancel:e,onSubmit:n,validate:s=AE}){const i=S.exports.useRef(null),[o,r]=S.exports.useState(t.basename),[l,a]=S.exports.useState(),[d,c]=S.exports.useState(Promise.resolve()),u=S.exports.useCallback(()=>{var C;(C=i.current)==null||C.focus()},[i]),m=S.exports.useCallback(C=>C.stopPropagation(),[]),p=S.exports.useCallback(()=>{d.then(()=>{n(o)}).catch(C=>Ah.info("Unable to validate name",C))},[n,o,d]);S.exports.useEffect(function(){const w=Te.makeCancelable(s(o));return w.then(()=>a(void 0)).catch(T=>{Te.isCanceled(T)||a(T)}),c(w),()=>w.cancel()},[s,o]),S.exports.useEffect(function(){u()},[u]);const g=S.exports.useCallback(()=>{Ah.debug2("handleBlur"),p()},[p]),f=S.exports.useCallback(C=>{const{value:w}=C.target;r(w)},[]),b=S.exports.useCallback(C=>{C.stopPropagation();const{key:w}=C;switch(w){case"Enter":{p();break}case"Escape":{e();break}}},[e,p]);return v("div",{className:"file-list-item-editor",children:[h("input",{type:"text",className:W("form-control file-list-item-editor-input",{"is-invalid":l}),value:o,ref:i,onBlur:g,onKeyDown:b,onChange:f,onClick:m,onDoubleClick:m,onMouseDown:m}),l&&h("div",{className:"invalid-feedback",children:`${l}`})]})}function Lp(t){const{isMultiSelect:e=!1,focusedPath:n,showContextMenu:s=!1,onCreateFile:i,onCreateFolder:o,onCopy:r,onDelete:l,onMove:a=()=>{},onRename:d,onSelect:c,onSelectionChange:u,table:m,rowHeight:p=nc,validateRename:g=()=>Promise.resolve()}=t,[f,b]=S.exports.useState(),[C,w]=S.exports.useState([]),[T,y]=S.exports.useState(),E=S.exports.useCallback(O=>{w(O),u==null||u(O)},[u]),I=S.exports.useCallback(O=>{y(O)},[]),D=S.exports.useCallback(()=>{T&&(r==null||r(T))},[T,r]),F=S.exports.useCallback(()=>{C.length>0&&(l==null||l(C))},[l,C]),x=S.exports.useCallback(()=>{i==null||i()},[i]),U=S.exports.useCallback(()=>{T&&(o==null||o(ce.getPath(T.filename)))},[T,o]),B=S.exports.useCallback(()=>{T&&b(T)},[T]),_=S.exports.useCallback(()=>{b(void 0)},[]),H=S.exports.useCallback(O=>{f&&(d==null||d(f,O),b(void 0))},[d,f]),A=S.exports.useMemo(()=>{if(f)return[];const O=[];return i&&O.push({title:"New File",description:"Create new file",action:x,group:oe.groups.medium}),o&&O.push({title:"New Folder",description:"Create new folder",action:U,group:oe.groups.medium}),r&&O.push({title:"Copy",description:"Copy",action:D,group:oe.groups.low,disabled:T==null||qn(T)}),l&&C.length>0&&O.push({title:"Delete",description:"Delete",shortcut:Lh.FILE_EXPLORER.DELETE,action:F,group:oe.groups.low}),d&&O.push({title:"Rename",description:"Rename",shortcut:Lh.FILE_EXPLORER.RENAME,action:B,group:oe.groups.low,disabled:T==null}),O},[D,F,x,U,B,T,r,i,o,l,d,C,f]),N=S.exports.useCallback(O=>f?g(f,O):Promise.reject(new Error("No rename item")),[f,g]),k=S.exports.useCallback(O=>{const{item:V}=O;return f&&f.filename===V.filename?Ka({...O,children:h(PE,{item:V,validate:N,onSubmit:H,onCancel:_})}):Ka(O)},[_,H,f,N]);return v("div",{className:"file-list-container",children:[m!=null&&h(OE,{onMove:a,onSelect:c,onSelectionChange:E,onFocusChange:I,renderItem:k,rowHeight:p,table:m,isMultiSelect:e,focusedPath:n}),s&&h(oe,{actions:A})]})}Lp.displayName="FileListContainer";class Br extends Hi{constructor(e){super("Name already exists"),this.isExistingFile=!0,this.info=e}}class sc extends Error{constructor(){super("No file exists at the path specified"),this.isFileNotFound=!0}}const Ks=X.module("FileExplorer");function ic(t){const{storage:e,isMultiSelect:n=!1,focusedPath:s,onDelete:i=()=>{},onRename:o=()=>{},onSelect:r,onSelectionChange:l,rowHeight:a=nc}=t,[d,c]=S.exports.useState([]),[u,m]=S.exports.useState();S.exports.useEffect(function(){let D;async function F(){Ks.debug("initTable"),D=Te.makeCancelable(e.getTable(),x=>x.close());try{m(await D)}catch(x){Te.isCanceled(x)||Ks.error("Unable to initialize table",x)}}return F(),()=>{D.cancel()}},[e]);const p=S.exports.useCallback(I=>{Te.isCanceled(I)||Ks.error(I)},[]),g=S.exports.useCallback(I=>{Ks.debug("handleDelete, pending confirmation",I),c(I)},[]),f=S.exports.useCallback(()=>{Ks.debug("handleDeleteConfirm",d),d.forEach(I=>e.deleteFile(qn(I)?ce.makePath(I.filename):I.filename)),i(d),c([])},[d,i,e]),b=S.exports.useCallback(()=>{Ks.debug("handleDeleteCancel"),c([])},[]),C=S.exports.useCallback((I,D)=>{ce.reducePaths(I.map(x=>qn(x)?ce.makePath(x.filename):x.filename)).forEach(x=>{const U=ce.isPath(x)?`${D}${ce.getBaseName(x.substring(0,x.length-1))}/`:`${D}${ce.getBaseName(x)}`;e.moveFile(x,U).then(()=>{o(x,U)}).catch(p)})},[p,o,e]),w=S.exports.useCallback((I,D)=>{let F=I.filename;const x=qn(I);x&&!F.endsWith("/")&&(F=`${F}/`);let U=`${ce.getParent(F)}${D}`;x&&!U.endsWith("/")&&(U=`${U}/`),Ks.debug2("handleRename",F,U),e.moveFile(F,U).catch(p),o(F,U)},[p,o,e]),T=S.exports.useCallback(async(I,D)=>{if(D===I.basename)return;ce.validateName(D);const F=`${ce.getPath(I.filename)}${D}`;try{const x=await e.info(F);throw new Br(x)}catch(x){if(!(x instanceof sc))throw x}},[e]),y=d.length>0,E=S.exports.useMemo(()=>d.length===1?`Are you sure you want to delete "${d[0].filename}"?`:"Are you sure you want to delete the selected files?",[d]);return v("div",{className:"file-explorer",children:[u&&h(Lp,{isMultiSelect:n,focusedPath:s,showContextMenu:!0,onMove:C,onDelete:g,onRename:w,onSelect:r,onSelectionChange:l,rowHeight:a,table:u,validateRename:T}),h($i,{isOpen:y,headerText:E,bodyText:"You cannot undo this action.",onCancel:b,onConfirm:f,confirmButtonText:"Delete"})]})}ic.displayName="FileExplorer";const qs=X.module("NewItemModal"),$r=class extends S.exports.PureComponent{constructor(t){super(t),this.inputRef=Y.createRef(),this.pending=new fs,this.pathMap=new Map,this.isInitialLoad=!0,this.handleModalSubmit=this.handleModalSubmit.bind(this),this.handleModalOpened=this.handleModalOpened.bind(this),this.handleSelect=this.handleSelect.bind(this),this.handleChange=this.handleChange.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleValidationError=this.handleValidationError.bind(this),this.handleOverwriteCancel=this.handleOverwriteCancel.bind(this),this.handleOverwriteConfirm=this.handleOverwriteConfirm.bind(this),this.handleExtensionChangeCancel=this.handleExtensionChangeCancel.bind(this),this.handleExtensionChangeConfirm=this.handleExtensionChangeConfirm.bind(this),this.handleBreadcrumbSelect=this.handleBreadcrumbSelect.bind(this);const{defaultValue:e}=t,n=ce.hasPath(e)?ce.getPath(e):"/";this.state={isSubmitting:!1,path:n,prevExtension:ce.getExtension(e),showExtensionChangeModal:!1,showOverwriteModal:!1,value:ce.getBaseName(e)}}static getValidationMessage(t){return t instanceof Br&&t.info.type==="directory"?"Error: Cannot overwrite existing directory":`${t}`}static handleError(t){Te.isCanceled(t)||qs.error(t)}componentDidUpdate(t,e){const{isOpen:n}=this.props,{isOpen:s}=t,{value:i,path:o}=this.state;!s&&n&&(this.resetValue(),this.isInitialLoad=!0),s&&n&&(!this.isInitialLoad&&(o!==e.path||i!==e.value)&&this.updateValidationStatus(o,i),this.isInitialLoad=!1)}componentWillUnmount(){this.pending.cancel(),this.cancelableValidatePromise&&this.cancelableValidatePromise.cancel(),this.cancelableExistingItemPromise&&this.cancelableExistingItemPromise.cancel()}resetValue(){const{defaultValue:t}=this.props,e=ce.hasPath(t)?ce.getPath(t):"/";this.setState({path:e,value:ce.getBaseName(t),validationError:void 0,prevExtension:ce.getExtension(t),isSubmitting:!1})}getValidationPromise(t,e,n=!1){return this.cancelableValidatePromise&&this.cancelableValidatePromise.cancel(),this.cancelableValidatePromise=Te.makeCancelable(this.validateName(t,e,n)),this.cancelableValidatePromise}async validateName(t,e,n){ce.validateName(e);const{defaultValue:s,storage:i}=this.props;if(n){const o=`${t}${e}`;if(o!==s)try{const r=await i.info(o);throw new Br(r)}catch(r){if(!(r instanceof sc))throw r}}return e}updateValidationStatus(t,e){this.getValidationPromise(t,e).then(()=>{this.setState({validationError:void 0})}).catch(this.handleValidationError).catch($r.handleError)}handleModalOpened(){this.focusRenameInput()}handleModalSubmit(){this.submitModal()}handleChange(t){const{value:e}=t.target;this.setState({value:e})}handleSelect(t){if(qs.debug("handleSelect",t),t.type==="directory")this.setState({path:ce.makePath(t.filename)});else{const e=t.basename,n=ce.getPath(t.filename);this.setState({value:e,path:n},()=>{this.focusRenameInput()})}}handleKeyDown(t){const{key:e}=t;switch(t.stopPropagation(),e){case"Enter":{t.preventDefault(),this.submitModal();break}case"Escape":{t.preventDefault();const{onCancel:n}=this.props;n();break}}}handleValidationError(t){if(!(t instanceof Hi))throw t;qs.debug("Validation error",t),this.setState({validationError:t})}handleOverwriteCancel(){this.setState({showOverwriteModal:!1,isSubmitting:!1})}handleOverwriteConfirm(){this.setState({showOverwriteModal:!1});const{onSubmit:t}=this.props,{path:e,value:n}=this.state;qs.debug("handleOverwriteConfirm",e,n),t(`${e}${n}`)}handleExtensionChangeCancel(){qs.debug("handleExtensionChangeCancel"),this.setState(({value:t,prevExtension:e})=>{const n=ce.replaceExtension(t,e);return{showExtensionChangeModal:!1,value:n}}),this.submitModal(!0)}handleExtensionChangeConfirm(){qs.debug("handleExtensionChangeConfirm"),this.setState({showExtensionChangeModal:!1}),this.submitModal(!0)}focusRenameInput(){const t=this.inputRef.current;if(t){const{type:e}=this.props,{value:n}=t,s=e==="directory"?n.length:n.lastIndexOf(".");t.focus(),t.setSelectionRange(0,s>0?s:n.length)}}submitModal(t=!1){this.setState(({prevExtension:e,value:n,path:s})=>{const{notifyOnExtensionChange:i,type:o}=this.props;qs.debug("submitModal",e,n);const r=ce.getExtension(n);return i&&!t&&e!==null&&e!==r?{isSubmitting:!1,showExtensionChangeModal:!0,newExtension:r}:(this.getValidationPromise(s,n,!0).then(l=>{const{onSubmit:a}=this.props;a(`${s}${n}`)}).catch(l=>{if(l instanceof Br&&o!=="directory"&&l.info.type!=="directory"){this.setState({showOverwriteModal:!0});return}throw l}).catch(l=>{throw Te.isCanceled(l)&&this.setState({isSubmitting:!1}),l}).catch(this.handleValidationError).catch($r.handleError),{isSubmitting:!0,showExtensionChangeModal:!1,newExtension:void 0})})}handleBreadcrumbSelect(t){this.setState({path:t})}renderPathButtons(t){const e=t.split("/");return e.pop(),e.map((n,s)=>{let i="";for(let o=0;o<s;o+=1)i+=`${e[o]}/`;return i+=`${n}/`,v(Y.Fragment,{children:[h(z,{kind:"ghost",className:"directory-breadcrumbs",onClick:()=>this.handleBreadcrumbSelect(i),"aria-label":s===0?"Home":void 0,icon:s===0?h(j,{icon:Mf,transform:"right-1.6"}):void 0,tooltip:s===0?"Home":void 0,children:n}),"/"]},i)})}render(){const{storage:t,isOpen:e,onCancel:n,placeholder:s,title:i,type:o}=this.props,{isSubmitting:r,path:l,showExtensionChangeModal:a,showOverwriteModal:d,validationError:c,value:u,prevExtension:m,newExtension:p}=this.state,g=o==="directory",f=ce.fileExtensionToString(m),b=ce.fileExtensionToString(p),C=g?"Create":"Save",w=g?"New folder name":"Save file as";return v(ye,{children:[v($o,{isOpen:e,toggle:n,onOpened:this.handleModalOpened,className:"modal-dialog-centered new-file-modal theme-bg-dark",children:[h(zo,{toggle:n,children:i}),h(Wo,{children:h("form",{children:v("div",{className:"d-flex flex-column new-file-modal-content",children:[v("div",{className:"flex-grow-0 mb-4",children:[h("label",{htmlFor:"file-name-input",children:w}),h("input",{id:"file-name-input",type:"text",autoComplete:"off",autoCapitalize:"none",autoCorrect:"off",spellCheck:"false",className:W("form-control",{"is-invalid":c}),value:u,placeholder:s,ref:this.inputRef,onKeyDown:this.handleKeyDown,onChange:this.handleChange}),c&&h("div",{className:"invalid-feedback",children:$r.getValidationMessage(c)})]}),v("div",{className:"flex-grow-0",children:[h("label",{children:"Directory: /"}),this.renderPathButtons(l)]}),h("div",{className:"flex-grow-1 file-explorer-container",children:h(ic,{onSelect:this.handleSelect,storage:t,focusedPath:l})})]})})}),v(od,{children:[h(z,{kind:"secondary",onClick:n,children:"Cancel"}),h(z,{kind:"primary",disabled:r,onClick:this.handleModalSubmit,children:C})]})]}),h($i,{isOpen:d,headerText:"Confirm overwrite",bodyText:"File with this name already exists, are you sure you want to overwrite it?",onCancel:this.handleOverwriteCancel,onConfirm:this.handleOverwriteConfirm,cancelButtonText:"Cancel",confirmButtonText:"Overwrite"}),h($i,{isOpen:a,headerText:"Confirm extension change",bodyText:`Are you sure you want to change extension from "${f}" to "${b}"?`,onCancel:this.handleExtensionChangeCancel,onConfirm:this.handleExtensionChangeConfirm,cancelButtonText:`Keep "${f}"`,confirmButtonText:`Use "${b}"`})]})}};let Wl=$r;Wl.propTypes={isOpen:R.exports.bool,title:R.exports.string.isRequired,defaultValue:R.exports.string,type:R.exports.oneOf(["file","directory"]).isRequired,onSubmit:R.exports.func,onCancel:R.exports.func,placeholder:R.exports.string,storage:R.exports.shape({}).isRequired,notifyOnExtensionChange:R.exports.bool};Wl.defaultProps={isOpen:!1,defaultValue:"/",notifyOnExtensionChange:!1,placeholder:"",onSubmit:t=>{},onCancel:()=>{}};function HE({createFile:t,createFolder:e,onSearchChange:n,defaultSearchText:s=""}){return v("div",{className:"file-explorer-toolbar",children:[v("div",{className:"file-explorer-toolbar-buttons",children:[h(z,{kind:"ghost",icon:Cu,tooltip:"New notebook",onClick:t,"aria-label":"New notebook"}),h(z,{kind:"ghost",icon:Pf,tooltip:"New folder",onClick:e,"aria-label":"New folder"})]}),n&&h("div",{className:"file-explorer-toolbar-search",children:h(Pu,{value:s,onChange:n,placeholder:"Search by name"})})]})}const Di=X.module("FileExplorerPanel"),VE=(t,e)=>{const n=Cm(t),s=gi(t,e.localDashboardId),{session:i,config:o}=s!=null?s:{},r=o==null?void 0:o.type;return{fileStorage:n,language:r,session:i}},UE=Ft(VE,null,null,{forwardRef:!0});function BE(t){const e=t;return e!=null&&typeof e.button=="number"}const qa=class extends Y.Component{static handleError(t){Di.error(t)}static isFocusEvent(t){return BE(t)?t.detail>=2:!0}constructor(t){super(t),this.handleFileSelect=this.handleFileSelect.bind(this),this.handleCreateFile=this.handleCreateFile.bind(this),this.handleCreateDirectory=this.handleCreateDirectory.bind(this),this.handleCreateDirectoryCancel=this.handleCreateDirectoryCancel.bind(this),this.handleCreateDirectorySubmit=this.handleCreateDirectorySubmit.bind(this),this.handleDelete=this.handleDelete.bind(this),this.handleRename=this.handleRename.bind(this),this.handleSessionOpened=this.handleSessionOpened.bind(this),this.handleSessionClosed=this.handleSessionClosed.bind(this),this.handleShow=this.handleShow.bind(this),this.handleSelectionChange=this.handleSelectionChange.bind(this);const{session:e,language:n}=t;this.state={isShown:!1,language:n,session:e,showCreateFolder:!1,focusedFilePath:"/"}}componentDidMount(){this.isHidden()||this.setState({isShown:!0})}handleCreateFile(){const{glEventHub:t}=this.props,{session:e,language:n}=this.state,s={language:n,value:""};Di.debug("handleCreateFile",e,n,s),t.emit(He.CREATE_NOTEBOOK,e,n,s)}handleCreateDirectory(t){this.setState({showCreateFolder:!0})}handleCreateDirectoryCancel(){Di.debug("handleCreateDirectoryCancel"),this.setState({showCreateFolder:!1})}handleCreateDirectorySubmit(t){Di.debug("handleCreateDirectorySubmit",t),this.setState({showCreateFolder:!1});const{fileStorage:e}=this.props;e.createDirectory(t).catch(qa.handleError)}handleDelete(t){const{glEventHub:e}=this.props;t.forEach(n=>{e.emit(He.CLOSE_FILE,{id:n.filename,itemName:n.filename})})}handleSelectionChange(t){let e="/";t.length===1&&(t[0].type==="directory"?e=ce.makePath(t[0].filename):e=ce.getPath(t[0].filename)),this.setState({focusedFilePath:e})}handleFileSelect(t,e){if(Di.debug("fileSelect",t),t.type==="directory")return;const n=qa.isFocusEvent(e),s={id:t.filename,itemName:t.filename},{glEventHub:i}=this.props,{session:o,language:r}=this.state,l={value:null,language:r};i.emit(He.SELECT_NOTEBOOK,o,r,l,s,n)}handleRename(t,e){const{glEventHub:n}=this.props;Di.debug("handleRename",t,e),n.emit(He.RENAME_FILE,t,e)}handleSessionOpened(t,{language:e}){this.setState({session:t,language:e})}handleSessionClosed(){this.setState({session:void 0,language:void 0})}handleShow(){this.setState({isShown:!0})}isHidden(){const{glContainer:t}=this.props,{isHidden:e}=t;return e}render(){const{fileStorage:t,glContainer:e,glEventHub:n}=this.props,{isShown:s,showCreateFolder:i,focusedFilePath:o}=this.state;return v(jn,{className:"file-explorer-panel",componentPanel:this,glContainer:e,glEventHub:n,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,onShow:this.handleShow,children:[h(HE,{createFile:this.handleCreateFile,createFolder:this.handleCreateDirectory}),s&&h(ic,{isMultiSelect:!0,storage:t,onDelete:this.handleDelete,onRename:this.handleRename,onSelect:this.handleFileSelect,onSelectionChange:this.handleSelectionChange}),h(Wl,{isOpen:i,type:"directory",title:"Create New Folder",storage:t,onSubmit:this.handleCreateDirectorySubmit,onCancel:this.handleCreateDirectoryCancel,defaultValue:o})]})}};let oc=qa;oc.COMPONENT="FileExplorerPanel";oc.TITLE="File Explorer";const rl=UE(oc);const lt=X.module("FilterSetManager"),$E="Enter name...",Ph="No Available Filter Sets";class ll extends S.exports.Component{constructor(e){super(e),this.renameInputRef=Y.createRef(),this.dropdownRef=Y.createRef(),this.editDropdownRef=Y.createRef(),this.isRenamingExistingSet=pe((n,s)=>s!==void 0&&n.some(({id:i})=>i===s.id)),this.handleSettingsCancel=this.handleSettingsCancel.bind(this),this.handleSettingsClick=this.handleSettingsClick.bind(this),this.handleSettingsSave=this.handleSettingsSave.bind(this),this.handleBackgroundClick=this.handleBackgroundClick.bind(this),this.handleEditDropdownChange=this.handleEditDropdownChange.bind(this),this.handleFilterChange=this.handleFilterChange.bind(this),this.handleFilterApply=this.handleFilterApply.bind(this),this.handleCaptureNewSet=this.handleCaptureNewSet.bind(this),this.handleNameInputChange=this.handleNameInputChange.bind(this),this.handleNameInputKeyPress=this.handleNameInputKeyPress.bind(this),this.handleRenameConfirm=this.handleRenameConfirm.bind(this),this.handleRenameCancel=this.handleRenameCancel.bind(this),this.handleRestoreFullStateChange=this.handleRestoreFullStateChange.bind(this),this.handleSetDelete=this.handleSetDelete.bind(this),this.handleSetEdit=this.handleSetEdit.bind(this),this.handleSetUpdate=this.handleSetUpdate.bind(this),this.state={editId:void 0,renameSet:void 0,nameInputValue:"",nameInputError:void 0,modifiedFilterSets:[],restoreFullState:!1}}static animateScreenFlash(){var n;const e=document.createElement("div");e.classList.add("screen-flash-overlay"),e.addEventListener("animationend",()=>{e.remove()}),(n=document.querySelector("body"))==null||n.appendChild(e)}componentDidMount(){const{isValueShown:e}=this.props;e?this.updateSelectedId():this.initSettingsScreen()}componentDidUpdate(e,n){const{isValueShown:s,filterSets:i}=this.props,{modifiedFilterSets:o}=this.state;if(e.isValueShown&&!s&&this.initSettingsScreen(),this.isNameInputScreen()&&!this.isNameInputScreen(n)&&this.focusRenameInput(),i!==e.filterSets)if(!s&&i.length>0&&e.filterSets.length===0&&o.length===0){const{onChange:r}=this.props;r({isValueShown:!0,selectedId:i[0].id})}else this.updateSelectedId()}initSettingsScreen(){const{filterSets:e,selectedId:n}=this.props;lt.debug("initSettingsScreen",e,n),this.setState({modifiedFilterSets:[...e],editId:n})}updateSelectedId(){const{isValueShown:e,filterSets:n,selectedId:s,onChange:i}=this.props;if(lt.debug("updateSelectedId",n,s),!!e&&!n.some(({id:o})=>o===s)){const o=n.length===0;i({isValueShown:!o,selectedId:o?void 0:n[0].id})}}handleEditDropdownChange(e){const{value:n}=e.target;this.setState({editId:n})}handleFilterChange(e){const{value:n}=e.target,{isValueShown:s,onChange:i}=this.props;this.applyFilterSet(n),i({isValueShown:s,selectedId:n})}handleFilterApply(){const{selectedId:e}=this.props;this.applyFilterSet(e)}handleSettingsCancel(){const{onChange:e,selectedId:n,filterSets:s}=this.props;this.setState({modifiedFilterSets:[]}),s.length>0&&e({isValueShown:!0,selectedId:n})}handleSettingsSave(){const{onChange:e,onUpdateSets:n}=this.props,{modifiedFilterSets:s,editId:i}=this.state;this.setState({modifiedFilterSets:[]}),lt.debug("Update sets",s,i),n(s),s.length>0&&e({isValueShown:!0,selectedId:i})}handleCaptureNewSet(){const{getFilterState:e}=this.props;ll.animateScreenFlash();const n=ze(),s=e(),i={id:n,title:"",panels:s};lt.debug("handleSetCreate",i),this.setState({nameInputValue:"",nameInputError:void 0,renameSet:i})}handleRenameCancel(){this.setState({renameSet:void 0})}handleRestoreFullStateChange(e){this.setState({restoreFullState:e.target.value==="true"})}getNameError(e){var o;const{renameSet:n,modifiedFilterSets:s}=this.state,i=(o=e==null?void 0:e.trim())!=null?o:"";if(i.length===0)return lt.debug("Name cannot be empty",i),"Name cannot be empty";if(n!==void 0&&s.some(({title:r,id:l})=>r===i&&l!==n.id))return lt.debug("Set with this name already exists",i),"Set with this name already exists"}handleRenameConfirm(){var c;const{nameInputValue:e,renameSet:n,modifiedFilterSets:s,restoreFullState:i}=this.state;if(n===void 0){lt.error("Renamed set undefined.");return}const o=this.getNameError(e);if(lt.debug("handleRenameConfirm",e,o),o!==void 0){this.setState({nameInputError:o});return}const r=(c=e==null?void 0:e.trim())!=null?c:"",l={...n,title:r,restoreFullState:i},a=s.findIndex(({id:u})=>u===n.id),d=[...s];a>=0?(d[a]=l,lt.debug("Renamed existing set",d)):(d.push(l),lt.debug("Added new set to modified sets",d)),this.setState({editId:l.id,modifiedFilterSets:d,renameSet:void 0})}handleSetDelete(){this.setState(e=>{const{editId:n,modifiedFilterSets:s}=e,i=s.findIndex(({id:a})=>a===n);if(i<0)return lt.error("Unable to find selected filterSet index",s,n),null;const o=s.filter(({id:a})=>a!==n),r=Math.max(0,Math.min(o.length-1,i-1)),l=o.length>0?o[r].id:void 0;return lt.debug("Deleted selected set",n,s,o),lt.debug("New selection",r,l),{modifiedFilterSets:o,editId:l}})}handleSetUpdate(){const{getFilterState:e}=this.props;ll.animateScreenFlash();const n=e();this.setState(({modifiedFilterSets:s,editId:i})=>{if(i===void 0)return lt.error("Filter for update not selected."),null;const o=[...s],r=o.findIndex(({id:l})=>l===i);return r<0?(lt.error("Selected set for update not found."),null):(o[r]={...o[r],panels:n},lt.debug("Update set",o,n),{modifiedFilterSets:o})})}handleSetEdit(){this.setState(({editId:e,modifiedFilterSets:n})=>{const s=n.find(({id:r})=>r===e);if(s===void 0)return lt.error("Could not find selected set",e,n),null;const{title:i,restoreFullState:o=!1}=s;return{nameInputValue:i,nameInputError:void 0,renameSet:s,restoreFullState:o}})}handleSettingsClick(e){e.stopPropagation();const{onChange:n,selectedId:s}=this.props;n({isValueShown:!1,selectedId:s})}handleBackgroundClick(e){lt.debug("handleBackgroundClick"),e.target!==this.dropdownRef.current&&this.focusInput()}handleNameInputChange(e){const{value:n}=e.target,s=this.getNameError(n);this.setState({nameInputValue:n,nameInputError:s})}handleNameInputKeyPress(e){const{key:n}=e;n==="Enter"&&(e.preventDefault(),this.handleRenameConfirm())}isNameInputScreen(e=this.state){const{renameSet:n}=e;return n!==void 0}applyFilterSet(e){const{onApply:n,filterSets:s}=this.props;if(e===void 0){lt.debug("No filter selected");return}const i=s.find(({id:o})=>o===e);if(i===void 0){lt.debug("Selected id not found in filterSets",e,s);return}lt.debug("Apply filterSet",i),n(i)}focusInput(){var e;(e=this.dropdownRef.current)==null||e.focus()}focusRenameInput(){var e;(e=this.renameInputRef.current)==null||e.focus()}render(){const{nameInputValue:e,nameInputError:n,editId:s,renameSet:i,modifiedFilterSets:o,restoreFullState:r}=this.state,{isValueShown:l,filterSets:a,selectedId:d}=this.props,c=this.isNameInputScreen(),u=this.isRenamingExistingSet(o,i),m=o.length===0,p=!c&&m&&a.length===0,g=!c&&!p,f=v("div",{className:"fa-layers mr-3",children:[h(j,{icon:Po,mask:Da,transform:"shrink-1 down-5 right-7"}),h(j,{icon:Ps,className:"text-primary",transform:"shrink-6 down-5 right-7"})]}),b=v("div",{className:"fa-layers",children:[h(j,{icon:Po,mask:Da,transform:"shrink-1 down-5 right-7"}),h(j,{icon:Ra,transform:"shrink-1 down-5 right-7"})]});return h("div",{className:"filter-set-manager fill-parent-absolute",children:v(rd,{className:"w-100 h-100",isFlipped:l,children:[h("div",{className:"filter-set-manager-settings-card fill-parent-absolute",children:v("div",{className:"filter-set-manager-card-content",children:[p&&v("div",{children:[h(z,{kind:"ghost",className:"btn btn-link no-underline",onClick:this.handleCaptureNewSet,icon:f,children:"Capture filter set"}),h("div",{className:"py-3 text-muted small",children:"Takes a snapshot of the currently applied filters on all panels, allowing you to restore saved filter sets later."})]}),c&&v("div",{className:"d-flex flex-column justify-content-center","data-testid":"edit-filter-set-container",children:[v("div",{className:"form-group",children:[h("label",{children:u?"Edit set":"Name captured set"}),v("div",{className:"name-input-container",children:[h("input",{type:"text",className:"input-set-name form-control",placeholder:$E,value:e,ref:this.renameInputRef,onChange:this.handleNameInputChange,onKeyPress:this.handleNameInputKeyPress,spellCheck:"false"}),h(z,{"data-testid":"rename-confirm-button",kind:"ghost",className:"btn btn-link no-underline pt-2 pb-2",onClick:this.handleRenameConfirm,tooltip:"Save","test-id":"button-save",icon:bu}),h(z,{"data-testid":"rename-cancel-button",kind:"ghost",className:"btn btn-link no-underline pt-2 pb-2",onClick:this.handleRenameCancel,tooltip:"Cancel",icon:wf})]}),n!==void 0&&h("div",{className:"error-message",children:n})]}),h("div",{className:"form-group",children:v(vl,{onChange:this.handleRestoreFullStateChange,value:`${r}`,children:[h(xn,{value:"false",children:"Restore only filters"}),h(xn,{value:"true",children:"Restore full table state"})]})})]}),g&&v("div",{className:"filter-set-manager-settings-grid-1",children:[v("div",{className:"form-group",children:[h("label",{children:"Edit filter sets"}),v("div",{className:"filter-select-container",children:[v("select",{"data-testid":"settings-card-filter-select",ref:this.editDropdownRef,value:s!=null?s:"-1",className:"custom-select filter-value-select",onChange:this.handleEditDropdownChange,disabled:m,children:[m&&h("option",{value:"-1",disabled:!0,children:Ph}),o.map(({id:C,title:w})=>h("option",{value:C,children:w},C))]}),h(z,{kind:"ghost",onClick:this.handleSetUpdate,disabled:m,icon:b,tooltip:"Update"}),h(z,{kind:"ghost",onClick:this.handleSetEdit,disabled:m,icon:pl,tooltip:"Edit"}),h(z,{kind:"ghost",onClick:this.handleSetDelete,disabled:m,icon:wn,tooltip:"Delete"})]})]}),h("div",{children:h(z,{kind:"ghost",className:"btn btn-link no-underline",onClick:this.handleCaptureNewSet,icon:f,children:"Capture new filter set"})}),v("div",{className:"py-3 text-right",children:[h(z,{kind:"secondary",onClick:this.handleSettingsCancel,children:"Cancel"}),"\xA0",h(z,{kind:"primary",onClick:this.handleSettingsSave,children:"Save"})]})]})]})},"front"),v("div",{className:"filter-set-manager-value-card fill-parent-absolute",onClick:this.handleBackgroundClick,children:[h("div",{className:"filter-set-manager-column",children:h("div",{className:"filter-set-manager-column-title",children:"Filter sets"})}),h("div",{className:"filter-set-manager-card-content",children:h("div",{className:"filter-set-manager-value-input",children:v("div",{className:"filter-select-container",children:[v("select",{"data-testid":"value-card-filter-select",ref:this.dropdownRef,value:d,className:"custom-select filter-value-select",onChange:this.handleFilterChange,children:[a.length===0&&h("option",{value:"-1",disabled:!0,children:Ph}),a.map(({id:C,title:w})=>h("option",{value:C,children:w},C))]}),h(z,{"data-testid":"filter-apply-button",kind:"ghost",onClick:this.handleFilterApply,icon:cd,tooltip:"Apply Filter Set"})]})})}),h("div",{className:"filter-set-manager-menu",children:h(z,{kind:"ghost",className:"btn btn-link btn-link-icon m-2 px-2",onClick:this.handleSettingsClick,tooltip:"Settings",icon:h(j,{icon:Go,transform:"grow-4"})})})]},"back")]})})}}function rc(t){var l,a;const{model:e,widgetName:n,glContainer:s,description:i}=t,o=((l=e==null?void 0:e.rowCount)!=null?l:0)-((a=e==null?void 0:e.pendingRowCount)!=null?a:0),r=e==null?void 0:e.displayString(o,"long");return h(Vl,{widgetType:"Table",widgetName:n,glContainer:s,description:i,children:v("div",{className:"column-statistics-grid",children:[h("span",{className:"column-statistic-operation",children:"Number of Rows"}),h("span",{className:"column-statistic-value",children:r})]})})}rc.propTypes={glContainer:kd.Container.isRequired,widgetName:R.exports.string.isRequired,description:R.exports.string};rc.defaultProps={description:null};const Un=X.module("IrisGridPanel"),WE=500,zE={IrisGrid:io,IrisGridTableModel:yp,ContextMenuRoot:Du};class Yi extends S.exports.PureComponent{constructor(e){super(e),this.getGridInputFilters=pe((s,i)=>ne.getInputFiltersForColumns(s,i.filter(({value:o,excludePanelIds:r})=>{const l=te.getIdFromPanel(this);return o!=null&&(r==null||l!=null&&!r.includes(l))}))),this.getAlwaysFetchColumns=pe((s,i)=>{const o=te.getIdFromPanel(this),r=new Set(i);for(let l=0;l<s.length;l+=1){const{start:a}=s[l];a!=null&&a.panelId===o&&r.add(a.columnName)}return[...r]}),this.getPluginContent=pe((s,i,o,r,l)=>!i||!li(i)||s==null||i.table==null?null:h("div",{className:"iris-grid-plugin",children:h(s,{ref:this.pluginRef,filter:this.handlePluginFilter,onFilter:this.handlePluginFilter,fetchColumns:this.handlePluginFetchColumns,onFetchColumns:this.handlePluginFetchColumns,table:i.table,user:o,panel:this,workspace:r,components:zE,onStateChange:this.handlePluginStateChange,pluginState:l})})),this.getDehydratedIrisGridPanelState=pe((s,i,o,r,l)=>ne.dehydrateIrisGridPanelState(s,{isSelectingPartition:i,partition:o,partitionColumn:r,advancedSettings:l})),this.getDehydratedIrisGridState=pe((s,i,o,r,l,a,d,c,u,m,p,g,f,b,C,w,T,y,E,I)=>ne.dehydrateIrisGridState(s,{advancedFilters:o,aggregationSettings:T,customColumnFormatMap:r,isFilterBarShown:l,metrics:{userColumnWidths:C,userRowHeights:w},quickFilters:a,customColumns:d,reverseType:c,rollupConfig:u,showSearchBar:m,searchValue:p,selectDistinctColumns:g,selectedSearchColumns:f,sorts:i,invertSearchColumns:b,pendingDataMap:y,frozenColumns:E,conditionalFormats:I})),this.getDehydratedGridState=pe((s,i,o,r,l)=>ne.dehydrateGridState(s,{isStuckToBottom:r,isStuckToRight:l,movedColumns:i,movedRows:o})),this.getCachedPanelState=pe((s,i,o,r)=>({irisGridPanelState:s,irisGridState:i,gridState:o,pluginState:r})),this.savePanelState=je(()=>{const{irisGridState:s,gridState:i,pluginState:o}=this;P(s);const{onPanelStateUpdate:r}=this.props,{model:l,panelState:a,isSelectingPartition:d,partition:c,partitionColumn:u,advancedSettings:m}=this.state,{advancedFilters:p,aggregationSettings:g,customColumnFormatMap:f,isFilterBarShown:b,quickFilters:C,customColumns:w,reverseType:T,rollupConfig:y,showSearchBar:E,searchValue:I,selectDistinctColumns:D,selectedSearchColumns:F,sorts:x,invertSearchColumns:U,metrics:B,pendingDataMap:_,frozenColumns:H,conditionalFormats:A}=s;P(l),P(B);const{userColumnWidths:N,userRowHeights:k}=B;P(i);const{isStuckToBottom:O,isStuckToRight:V,movedColumns:G,movedRows:Q}=i,Z=this.getCachedPanelState(this.getDehydratedIrisGridPanelState(l,d,c,u,m),this.getDehydratedIrisGridState(l,x,p,f,b,C,w,T,y,E,I,D,F,U,N,k,g,_,H,A),this.getDehydratedGridState(l,G,Q,O,V),o);Z!==a&&(Un.debug("Saving panel state",this,Z),this.setState({panelState:Z}),r==null||r(Z))},WE),this.handleAdvancedSettingsChange=this.handleAdvancedSettingsChange.bind(this),this.handleColumnsChanged=this.handleColumnsChanged.bind(this),this.handleTableChanged=this.handleTableChanged.bind(this),this.handleColumnSelected=this.handleColumnSelected.bind(this),this.handleDataSelected=this.handleDataSelected.bind(this),this.handleError=this.handleError.bind(this),this.handleGridStateChange=this.handleGridStateChange.bind(this),this.handlePluginStateChange=this.handlePluginStateChange.bind(this),this.handlePartitionAppend=this.handlePartitionAppend.bind(this),this.handleCreateChart=this.handleCreateChart.bind(this),this.handleResize=this.handleResize.bind(this),this.handleShow=this.handleShow.bind(this),this.handleTabClicked=this.handleTabClicked.bind(this),this.handleDisconnect=this.handleDisconnect.bind(this),this.handleReconnect=this.handleReconnect.bind(this),this.handleLoadSuccess=this.handleLoadSuccess.bind(this),this.handleLoadError=this.handleLoadError.bind(this),this.isColumnSelectionValid=this.isColumnSelectionValid.bind(this),this.handleContextMenu=this.handleContextMenu.bind(this),this.handlePluginFilter=this.handlePluginFilter.bind(this),this.handlePluginFetchColumns=this.handlePluginFetchColumns.bind(this),this.handleClearAllFilters=this.handleClearAllFilters.bind(this),this.irisGrid=Y.createRef(),this.pluginRef=Y.createRef();const{panelState:n}=e;this.pluginState=null,this.state={error:null,isDisconnected:!1,isLoaded:!1,isLoading:!0,isModelReady:!1,model:void 0,advancedFilters:new Map,aggregationSettings:{aggregations:[],showOnTop:!1},advancedSettings:new Map(rp.DEFAULTS),customColumns:[],customColumnFormatMap:new Map,isFilterBarShown:!1,quickFilters:new Map,sorts:[],userColumnWidths:new Map,userRowHeights:new Map,reverseType:L.REVERSE_TYPE.NONE,movedColumns:[],movedRows:[],isSelectingPartition:!1,partition:void 0,partitionColumn:void 0,rollupConfig:void 0,showSearchBar:!1,searchValue:"",selectedSearchColumns:void 0,invertSearchColumns:!0,Plugin:void 0,pluginFilters:[],pluginFetchColumns:[],modelQueue:[],pendingDataMap:new Map,frozenColumns:void 0,panelState:n,irisGridStateOverrides:{},gridStateOverrides:{},isStuckToBottom:!1,isStuckToRight:!1,conditionalFormats:[],selectDistinctColumns:[]}}componentDidMount(){this.initModel()}componentDidUpdate(e,n){const{model:s}=this.state;s!==n.model&&(n.model!=null&&(this.stopModelListening(n.model),n.model.close()),s!=null&&this.startModelListening(s))}componentWillUnmount(){this.savePanelState.cancel(),this.modelPromise!=null&&(this.modelPromise.cancel(),this.modelPromise=void 0);const{model:e}=this.state;e&&(this.stopModelListening(e),e.close())}getTableName(){const{metadata:e}=this.props;return e.table}initModel(){this.setState({isModelReady:!1,isLoading:!0,error:null});const{makeModel:e}=this.props;this.modelPromise!=null&&this.modelPromise.cancel(),this.modelPromise=Te.makeCancelable(e(),n=>n.close()),this.modelPromise.then(this.handleLoadSuccess).catch(this.handleLoadError)}handleLoadSuccess(e){const n=e,{panelState:s,irisGridStateOverrides:i}=this.state,o=[];if(s!=null){const{irisGridState:r}=s,{aggregationSettings:l,customColumns:a,selectDistinctColumns:d=[],rollupConfig:c}={...r,...i};a.length>0&&o.push(u=>{u.customColumns=a}),c!=null&&c.columns.length>0&&o.push(u=>{u.rollupConfig=ne.getModelRollupConfig(u.originalColumns,c,l)}),d.length>0&&o.push(u=>{u.selectDistinctColumns=d})}this.setState({model:n,modelQueue:o}),this.initModelQueue(n,o)}initModelQueue(e,n){const s=e;if(n.length===0){this.modelInitialized(s);return}const i=n.shift();Un.debug("initModelQueue",i),i&&i(s),this.setState({modelQueue:n})}handleAdvancedSettingsChange(e,n){Un.debug("handleAdvancedSettingsChange",e,n),this.setState(({advancedSettings:s})=>s.get(e)===n?null:{advancedSettings:new Map(s).set(e,n)})}handlePluginFilter(e){const{model:n}=this.state;P(n);const{columns:s,formatter:i}=n,o=ne.getFiltersFromInputFilters(s,e,i.timeZone);this.setState({pluginFilters:o})}handlePluginFetchColumns(e){this.setState({pluginFetchColumns:e})}handleContextMenu(e){var n,s,i;return(i=(s=(n=this.pluginRef.current)==null?void 0:n.getMenu)==null?void 0:s.call(n,e))!=null?i:[]}isColumnSelectionValid(e){const{columnSelectionValidator:n}=this.props;return n&&e?n(this,e):!1}handleGridStateChange(e,n){this.irisGridState=e,this.gridState=n,this.setState({isLoaded:!0,isLoading:!1}),this.savePanelState();const{glEventHub:s,onStateChange:i}=this.props;s.emit(Et.STATE_CHANGED,this),i==null||i(e,n)}handlePluginStateChange(e){const{irisGridState:n,gridState:s}=this;this.pluginState=e,n!==null&&s!==null&&this.savePanelState()}handleColumnsChanged(e){const{isModelReady:n,model:s,modelQueue:i}=this.state;n?this.sendColumnsChange(e.detail):(P(s),this.initModelQueue(s,i))}handleTableChanged(e){Un.debug("handleTableChanged",e);const{glEventHub:n}=this.props,{detail:s}=e;n.emit(Pe.TABLE_CHANGED,this,s)}handlePartitionAppend(e,n){const{glEventHub:s}=this.props,{name:i}=e,o=this.getTableName(),r=`${o} = ${o}.where("${i}=\`${n}\`")`;s.emit(bt.SEND_COMMAND,r,!1,!0)}handleCreateChart(e,n){this.savePanelState.flush(),this.setState(()=>null,()=>{const{glEventHub:s,inputFilters:i,metadata:o}=this.props,{table:r}=o,{panelState:l}=this.state,a=te.getIdFromPanel(this);let d;l&&(d=ne.extractTableSettings(l,i)),s.emit(Et.CREATE_CHART,{metadata:{settings:e,sourcePanelId:a,table:r,tableSettings:d},table:li(n)?n.table:void 0})})}handleColumnSelected(e){const{glEventHub:n}=this.props;n.emit(Et.COLUMN_SELECTED,this,e)}handleDataSelected(e,n){const{glEventHub:s}=this.props;s.emit(Et.DATA_SELECTED,this,n)}handleResize(){this.updateGrid()}handleShow(){this.updateGrid()}handleTabClicked(){this.irisGrid.current&&this.irisGrid.current.focus()}handleError(e){Un.error(e),this.setState({error:e,isLoading:!1})}handleDisconnect(){this.setState({error:new Error("Table disconnected"),isDisconnected:!0,isLoading:!1})}handleReconnect(){this.setState({isDisconnected:!1,error:null})}handleLoadError(e){Te.isCanceled(e)||this.handleError(e)}modelInitialized(e){const{glEventHub:n,loadPlugin:s}=this.props;if(this.modelPromise=void 0,this.loadPanelState(e),this.setState({isModelReady:!0}),li(e)){const{table:i}=e,{pluginName:o}=i;if(o!==""&&s!=null&&o!=null){const r=s(o);this.setState({Plugin:r})}n.emit(Pe.TABLE_CHANGED,this,i)}this.sendColumnsChange(e.columns)}handleClearAllFilters(){const e=this.irisGrid.current,{isDisconnected:n}=this.state;e!=null&&!n&&e.clearAllFilters()}sendColumnsChange(e){Un.debug2("sendColumnsChange",e);const{glEventHub:n}=this.props;n.emit(Pe.COLUMNS_CHANGED,this,e)}startModelListening(e){e.addEventListener(Ce.EVENT.DISCONNECT,this.handleDisconnect),e.addEventListener(Ce.EVENT.RECONNECT,this.handleReconnect),e.addEventListener(Ce.EVENT.COLUMNS_CHANGED,this.handleColumnsChanged),e.addEventListener(Ce.EVENT.TABLE_CHANGED,this.handleTableChanged)}stopModelListening(e){e.removeEventListener(Ce.EVENT.DISCONNECT,this.handleDisconnect),e.removeEventListener(Ce.EVENT.RECONNECT,this.handleReconnect),e.removeEventListener(Ce.EVENT.COLUMNS_CHANGED,this.handleColumnsChanged),e.removeEventListener(Ce.EVENT.TABLE_CHANGED,this.handleTableChanged)}getCoordinateForColumn(e){var w,T,y;const{model:n}=this.state;if(!n)return null;const s=this.irisGrid.current,{gridWrapper:i}=s||{},o=(w=i==null?void 0:i.getBoundingClientRect())!=null?w:null;if(o==null||o.width<=0||o.height<=0)return null;P(s);const{metrics:r}=s.state;P(r);const{columnHeaderHeight:l,visibleColumnXs:a,visibleColumnWidths:d,right:c,columnHeaderMaxDepth:u}=r,m=n.getColumnIndexByName(e);P(m);const p=s.getVisibleColumn(m),g=(T=a.get(p))!=null?T:0,f=(y=d.get(p))!=null?y:0,b=Math.max(o.left,Math.min(p>c?o.right:o.left+g+f*.5,o.right)),C=o.top+l*u;return[b,C]}setFilterMap(e){const n=this.irisGrid.current;n!=null&&n.setFilterMap(e)}setAdvancedFilterMap(e){const n=this.irisGrid.current;n!=null&&n.setAdvancedFilterMap(e)}setFilters({quickFilters:e,advancedFilters:n}){Un.debug("setFilters",e,n);const{model:s,isDisconnected:i}=this.state,o=this.irisGrid.current;if(o==null||i){Un.debug("Ignore setFilters, model disconnected");return}P(s);const{columns:r,formatter:l}=s,a=ne.changeFilterColumnNamesToIndexes(s.columns,e).filter(([c])=>s.isFilterable(c)),d=ne.changeFilterColumnNamesToIndexes(s.columns,n).filter(([c])=>s.isFilterable(c));o.clearAllFilters(),o.setFilters({quickFilters:ne.hydrateQuickFilters(r,a,l.timeZone),advancedFilters:ne.hydrateAdvancedFilters(r,d,l.timeZone)})}setStateOverrides(e){Un.debug("setStateOverrides",e);const{irisGridState:n,gridState:s}=e;this.setState({irisGridStateOverrides:n,gridStateOverrides:s},()=>{this.initModel()})}unsetFilterValue(){}loadPanelState(e){const{panelState:n,irisGridStateOverrides:s,gridStateOverrides:i}=this.state;if(n!=null)try{const{gridState:o,irisGridState:r,irisGridPanelState:l}=n,a={...s},{quickFilters:d,advancedFilters:c}=a;d&&(a.quickFilters=ne.changeFilterColumnNamesToIndexes(e.columns,d)),c&&(a.advancedFilters=ne.changeFilterColumnNamesToIndexes(e.columns,c));const{isSelectingPartition:u,partition:m,partitionColumn:p,advancedSettings:g}=ne.hydrateIrisGridPanelState(e,l),{advancedFilters:f,customColumns:b,customColumnFormatMap:C,isFilterBarShown:w,quickFilters:T,reverseType:y,rollupConfig:E,aggregationSettings:I,sorts:D,userColumnWidths:F,userRowHeights:x,showSearchBar:U,searchValue:B,selectDistinctColumns:_,selectedSearchColumns:H,invertSearchColumns:A,pendingDataMap:N,frozenColumns:k,conditionalFormats:O}=ne.hydrateIrisGridState(e,{...r,...a}),{isStuckToBottom:V,isStuckToRight:G,movedColumns:Q,movedRows:Z}=ne.hydrateGridState(e,{...o,...i},r.customColumns);this.setState({advancedFilters:f,advancedSettings:g,conditionalFormats:O,customColumns:b,customColumnFormatMap:C,isFilterBarShown:w,isSelectingPartition:u,movedColumns:Q,movedRows:Z,partition:m,partitionColumn:p,quickFilters:T,reverseType:y,rollupConfig:E,aggregationSettings:I,sorts:D,userColumnWidths:F,userRowHeights:x,showSearchBar:U,searchValue:B,selectDistinctColumns:_,selectedSearchColumns:H,invertSearchColumns:A,pendingDataMap:N,frozenColumns:k,isStuckToBottom:V,isStuckToRight:G})}catch(o){Un.error("loadPanelState failed to load panelState",n,o)}}updateGrid(){var n,s;const e=(s=(n=this.irisGrid.current)==null?void 0:n.grid)!=null?s:null;!e||e.handleResize()}render(){var Ln,$t;const{children:e,glContainer:n,glEventHub:s,columnSelectionValidator:i,getDownloadWorker:o,inputFilters:r,links:l,metadata:a,panelState:d,user:c,workspace:u,settings:m,theme:p}=this.props,{advancedFilters:g,aggregationSettings:f,advancedSettings:b,conditionalFormats:C,customColumns:w,customColumnFormatMap:T,error:y,isDisconnected:E,isFilterBarShown:I,isSelectingPartition:D,isStuckToBottom:F,isStuckToRight:x,isLoaded:U,isLoading:B,isModelReady:_,model:H,movedColumns:A,movedRows:N,partition:k,partitionColumn:O,quickFilters:V,reverseType:G,rollupConfig:Q,sorts:Z,userColumnWidths:be,userRowHeights:le,showSearchBar:he,searchValue:De,selectDistinctColumns:ee,selectedSearchColumns:ue,invertSearchColumns:Se,Plugin:Me,pluginFilters:qe,pluginFetchColumns:ke,pendingDataMap:Qn,frozenColumns:vn}=this.state,wt=y!=null?`Unable to open table. ${y}`:void 0,{table:Re}=a,ot=(Ln=H==null?void 0:H.description)!=null?Ln:void 0,rt=($t=d==null?void 0:d.pluginState)!=null?$t:null,_t=e!=null?e:this.getPluginContent(Me,H,c,u,rt),{permissions:Zt}=c,{canCopy:Jt,canDownloadCsv:kt}=Zt;return h(Ul,{errorMessage:wt,isDisconnected:E,isLoading:B,isLoaded:U,className:"iris-grid-panel",glContainer:n,glEventHub:s,onClearAllFilters:this.handleClearAllFilters,onResize:this.handleResize,onShow:this.handleShow,onTabFocus:this.handleShow,onTabClicked:this.handleTabClicked,widgetName:Re,widgetType:"Table",description:ot,componentPanel:this,renderTabTooltip:()=>h(rc,{model:H,widgetName:Re,glContainer:n,description:ot}),children:_&&H&&h(io,{advancedFilters:g,aggregationSettings:f,advancedSettings:b,alwaysFetchColumns:this.getAlwaysFetchColumns(l,ke),columnAllowedCursor:"linker",columnNotAllowedCursor:"not-allowed",customColumns:w,customColumnFormatMap:T,columnSelectionValidator:this.isColumnSelectionValid,conditionalFormats:C,inputFilters:this.getGridInputFilters(H.columns,r),applyInputFiltersOnInit:d==null,isFilterBarShown:I,isSelectingColumn:i!=null,isSelectingPartition:D,isStuckToBottom:F,isStuckToRight:x,movedColumns:A,movedRows:N,partition:k,partitionColumn:O,quickFilters:V,reverseType:G,rollupConfig:Q,settings:m,sorts:Z,userColumnWidths:be,userRowHeights:le,model:H,showSearchBar:he,searchValue:De,selectedSearchColumns:ue,selectDistinctColumns:ee,invertSearchColumns:Se,onColumnSelected:this.handleColumnSelected,onCreateChart:this.handleCreateChart,onDataSelected:this.handleDataSelected,onError:this.handleError,onPartitionAppend:this.handlePartitionAppend,onStateChange:this.handleGridStateChange,onContextMenu:this.handleContextMenu,onAdvancedSettingsChange:this.handleAdvancedSettingsChange,customFilters:qe,pendingDataMap:Qn,canCopy:Jt,canDownloadCsv:kt,ref:this.irisGrid,getDownloadWorker:o,frozenColumns:vn,theme:p,children:_t})})}}Yi.defaultProps={onStateChange:()=>{},onPanelStateUpdate:()=>{}};Yi.displayName="IrisGridPanel";Yi.COMPONENT="IrisGridPanel";const GE=(t,{localDashboardId:e=Mn})=>({inputFilters:Xd(t,e),links:oo(t,e),columnSelectionValidator:Zd(t,e),user:gm(t),workspace:Dl(t),settings:xt(t)}),hi=Ft(GE,null,null,{forwardRef:!0})(Yi);const Hh=X.module("InputFilter"),KE=150,Ya=class extends S.exports.Component{constructor(t){super(t),this.getItemLabel=ve((i,o)=>{const{name:r,type:l}=i[o];if(o>0&&i[o-1].name===r||o<i.length-1&&i[o+1].name===r){const a=l.substring(l.lastIndexOf(".")+1);return`${r} (${a})`}return r}),this.sendUpdate=je(()=>{const{onChange:i}=this.props,{column:o,value:r,isValueShown:l}=this.state;i({column:o,isValueShown:l,value:r})},KE),this.handleColumnChange=this.handleColumnChange.bind(this),this.handleInputKeyPress=this.handleInputKeyPress.bind(this),this.handleValueChange=this.handleValueChange.bind(this),this.handleSettingsCancel=this.handleSettingsCancel.bind(this),this.handleSettingsClick=this.handleSettingsClick.bind(this),this.handleSettingsSave=this.handleSettingsSave.bind(this),this.handleBackgroundClick=this.handleBackgroundClick.bind(this),this.inputRef=Y.createRef();const{column:e,isValueShown:n,value:s}=t;this.state={column:e,selectedColumn:e,value:s,isValueShown:n}}componentDidUpdate(t,e){const{column:n}=this.props,{column:s,value:i,isValueShown:o}=this.state;n!==t.column&&this.setState({column:n,selectedColumn:n}),o!==void 0&&o&&o!==e.isValueShown&&this.focusInput(),(s!==e.column||i!==e.value||o!==e.isValueShown)&&this.sendUpdate()}componentWillUnmount(){this.sendUpdate.flush()}handleColumnChange(t){const{columns:e}=this.props,{value:n}=t.target,s=e[parseInt(n,10)];Hh.debug2("handleColumnChange",s),this.setState({selectedColumn:s,value:void 0})}handleInputKeyPress(t){t.key==="Enter"&&(t.preventDefault(),t.stopPropagation(),this.setState(({value:e})=>e==null?{value:""}:null,()=>{this.sendUpdate(),this.sendUpdate.flush()}))}handleValueChange(t){const{value:e}=t.target;Hh.debug2("handleValueChange",e),this.setState({value:e})}handleSettingsCancel(){const{column:t}=this.state;this.setState({selectedColumn:t,isValueShown:!0})}handleSettingsSave(){const{selectedColumn:t}=this.state;this.setState({column:t,isValueShown:!0})}handleSettingsClick(t){const{column:e}=this.state;this.setState({selectedColumn:e,isValueShown:!1}),t.stopPropagation()}handleBackgroundClick(t){t.target!==this.inputRef.current&&this.focusInput()}focusInput(){this.inputRef.current!==null&&(this.inputRef.current.select(),this.inputRef.current.focus())}clearFilter(){this.setState({value:""})}setFilterState({name:t,type:e,value:n,isValueShown:s}){const i=t!=null&&e!=null?{name:t,type:e}:void 0,o=s===void 0?{column:i,value:n}:{column:i,value:n,isValueShown:s};this.setState(o)}render(){const{columns:t}=this.props,{column:e,isValueShown:n,selectedColumn:s,value:i}=this.state,o=i==null||i.length===0?Ya.PLACEHOLDER.length:i.length;let r=null;if(e!=null){const l=t.findIndex(a=>a.name===e.name&&a.type===e.type);r=l>=0?this.getItemLabel(t,l):e.name}return v(rd,{className:"input-filter fill-parent-absolute",isFlipped:n!=null?n:!1,children:[h("div",{className:"input-filter-settings-card",children:v("div",{className:"input-filter-settings-content",children:[v("div",{className:"input-filter-settings-grid",children:[h("label",{children:"Filter Column"}),v("select",{value:t.findIndex(l=>l.name===(s==null?void 0:s.name)&&l.type===(s==null?void 0:s.type)),className:"custom-select",onChange:this.handleColumnChange,children:[t.map((l,a)=>h("option",{value:a,children:this.getItemLabel(t,a)},`${l.name}/${l.type}`)),t.length===0&&h("option",{value:"-1",disabled:!0,children:"No Available Columns"})]}),h("div",{className:"text-muted small",children:"Input filter control will apply its filter to all columns matching this name in this dashboard."})]}),v("div",{className:"input-filter-settings-buttons",children:[h(z,{kind:"secondary",onClick:this.handleSettingsCancel,disabled:e==null,children:"Cancel"}),h(z,{kind:"primary",className:"ml-2",onClick:this.handleSettingsSave,disabled:s==null,children:"Save"})]})]})}),v("div",{className:"input-filter-value-card",onClick:this.handleBackgroundClick,children:[h("div",{className:"input-filter-column",children:v("div",{className:"input-filter-column-title",children:[r," Filter"]})}),h("div",{className:"d-flex justify-content-center align-items-center h-100 w-100",children:h("div",{className:"input-filter-value-input d-flex flex-column justify-content-center",children:h("input",{type:"text",ref:this.inputRef,placeholder:Ya.PLACEHOLDER,value:i!=null?i:"",onChange:this.handleValueChange,onKeyPress:this.handleInputKeyPress,style:{width:`${o+3}ch`},spellCheck:"false"})})}),h("div",{className:"input-filter-menu",children:h(z,{kind:"ghost",className:"m-2 px-2",onClick:this.handleSettingsClick,icon:h(j,{icon:Go,transform:"grow-4"}),tooltip:"Input Filter Settings"})})]})]})}};let lc=Ya;lc.PLACEHOLDER="Enter value...";lc.defaultProps={column:null,isValueShown:!1,value:null};const qE=250;class zl extends S.exports.Component{constructor(e){super(e),this.handleChange=je(this.handleChange.bind(this),qE),this.handleClearAllFilters=this.handleClearAllFilters.bind(this),this.inputFilterRef=Y.createRef();const{panelState:n}=e,{value:s,isValueShown:i=!1,name:o,type:r,timestamp:l}=n!=null?n:{};this.state={columns:[],column:o!=null&&r!=null?{name:o,type:r}:void 0,value:s,timestamp:l,isValueShown:i,wasFlipped:!1,skipUpdate:!1,panelState:n}}componentDidMount(){this.updateColumns();const{column:e,value:n,timestamp:s}=this.state;if(e!=null){const{name:i,type:o}=e;this.sendUpdate(i,o,n,s)}}componentDidUpdate(e){const{columns:n}=this.props;n!==e.columns&&this.updateColumns()}handleChange({column:e,isValueShown:n=!1,value:s}){let i,o;e!=null&&({name:i,type:o}=e);let r=!0,l=Date.now();this.setState(({panelState:a,timestamp:d,wasFlipped:c,skipUpdate:u})=>{var p;const m=a!=null&&n!==a.isValueShown&&i===a.name&&o===a.type&&s===a.value;return r=(p=!u&&n&&(!m||!c))!=null?p:!1,r||(l=d),{panelState:{isValueShown:n,name:i,type:o,value:s,timestamp:l},timestamp:l,wasFlipped:m,skipUpdate:!1}},()=>{r&&this.sendUpdate(i,o,s,l)})}handleClearAllFilters(){var e;(e=this.inputFilterRef.current)==null||e.clearFilter()}sendUpdate(e,n,s,i){const{glEventHub:o}=this.props;o.emit(Pe.FILTERS_CHANGED,this,{name:e,type:n,value:s,timestamp:i})}setPanelState(e,n=!1){var s;this.setState({skipUpdate:!n}),(s=this.inputFilterRef.current)==null||s.setFilterState(e)}updateColumns(){const{columns:e}=this.props;e!=null&&this.setState(n=>{const{column:s}=n;return s==null&&e.length>0?{columns:[...e],column:e[0]}:s!=null&&!e.find(({name:i,type:o})=>s.name===i&&s.type===o)?{columns:[...e,s]}:{columns:[...e]}})}render(){const{glContainer:e,glEventHub:n}=this.props,{column:s,columns:i,isValueShown:o,value:r}=this.state;return h(jn,{className:"iris-input-filter-panel",componentPanel:this,glContainer:e,glEventHub:n,onClearAllFilters:this.handleClearAllFilters,isClonable:!0,isRenamable:!0,children:h(lc,{ref:this.inputFilterRef,column:s,columns:i,onChange:this.handleChange,isValueShown:o,value:r})})}}zl.defaultProps={panelState:null};zl.COMPONENT="InputFilterPanel";zl.displayName="InputFilterPanel";const YE=(t,e)=>{const{localDashboardId:n}=e;return{columns:Fp(t,n)}},_o=Ft(YE,null,null,{forwardRef:!0})(zl);const Mt=X.module("FilterSetManagerPanel");function XE(t){return t.setPanelState!=null}const Xa=class extends S.exports.Component{static changeFilterIndexesToColumnNames(t,e){return e.map(([n,s])=>{if(n>=t.columns.length)return null;const{name:i}=t.columns[n];return{name:i,filter:s}}).filter(n=>n!=null)}constructor(t){super(t),this.handleChange=this.handleChange.bind(this),this.handleFilterApply=this.handleFilterApply.bind(this),this.handleSetsUpdate=this.handleSetsUpdate.bind(this),this.handleGetFilterState=this.handleGetFilterState.bind(this);const{panelState:e,filterSets:n}=t,{selectedId:s=n.length>0?n[0].id:void 0,isValueShown:i=!1}=e!=null?e:{};this.state={selectedId:s,isValueShown:i,panelState:e}}getFilterState(){const{dashboardOpenedPanelMap:t}=this.props,e=[];return[...t.keys()].forEach(n=>{const s=t.get(n);if(s===void 0){Mt.error("Could not get panel",s);return}const i=te.getComponentNameFromPanel(s),o=te.getIdFromPanel(s);Mt.debug("Panel:",s,i);const{glContainer:r=null}=s.props;if(r==null){Mt.error("Could not get panel container",s);return}const l=te.getComponentConfigFromContainer(r);if(l==null){Mt.error("Could not get component config from container",r);return}const a=te.getPanelComponentState(l);if(a==null){Mt.debug(`Panel state is null ${o}`);return}switch(i){case te.getComponentName(Yi):{let d;o!=null&&(d=this.getIrisGridPanelFilters(o,a)),d!=null&&e.push({panelId:o,type:i,state:d});break}case te.getComponentName(_o):case te.getComponentName(ci):{const{isValueShown:d,name:c,type:u,value:m}=a;e.push({panelId:o,type:i,state:{isValueShown:d,name:c,type:u,value:m}});break}}}),e}getIrisGridPanelFilters(t,e){const{panelTableMap:n}=this.props,s=n.get(t);if(s==null)return Mt.error(`Unable to get table for panel ${t}.`),null;const{irisGridState:i={advancedFilters:void 0,quickFilters:void 0},gridState:o={}}=e,{advancedFilters:r,quickFilters:l}=i;let a;r&&(a=Xa.changeFilterIndexesToColumnNames(s,r));let d;return l&&(d=Xa.changeFilterIndexesToColumnNames(s,l)),{irisGridState:{...i,advancedFilters:a,quickFilters:d},gridState:{...o}}}handleGetFilterState(){return this.getFilterState()}handleChange({isValueShown:t,selectedId:e}){Mt.debug("handleChange",t,e),this.setState({isValueShown:t,selectedId:e}),this.updatePanelState()}handleFilterApply(t){const{dashboardOpenedPanelMap:e}=this.props,{panels:n,restoreFullState:s=!1}=t;Mt.debug("Apply filters from filter set",t),n.forEach(({panelId:i,type:o,state:r})=>{if(i==null){Mt.debug("panel is null",i);return}if(!e.has(i)){Mt.debug("Ignore closed panel",i);return}Mt.debug("Apply panel filters",i,o,r);const l=e.get(i);switch(o){case te.getComponentName(Yi):this.restoreIrisGridFilters(l,r,s);break;case te.getComponentName(_o):case te.getComponentName(ci):this.restoreInputFilterState(l,r);break}})}handleSetsUpdate(t){const{setDashboardFilterSets:e,localDashboardId:n}=this.props;Mt.debug("Saving updated sets",t),e(n,[...t])}updatePanelState(){this.setState(({selectedId:t,isValueShown:e})=>({panelState:{selectedId:t,isValueShown:e}}))}restoreIrisGridFilters(t,e,n){const{irisGridState:s={},advancedFilters:i=[],quickFilters:o=[]}=e,{advancedFilters:r=i,quickFilters:l=o}=s,{panelTableMap:a}=this.props,d=te.getIdFromPanel(t);if(d==null){Mt.error("Panel Id is null.");return}if(a.get(d)==null){Mt.error(`Unable to get table for panel ${d}.`);return}Mt.debug("restoreIrisGridFilters",d,e,n),n?t.setStateOverrides(e):t.setFilters({quickFilters:l,advancedFilters:r})}restoreInputFilterState(t,e){const n={...e};delete n.isValueShown,Mt.debug("restoreInputFilterState",t,n),t&&XE(t)&&t.setPanelState(n)}render(){const{glContainer:t,glEventHub:e,filterSets:n}=this.props,{isValueShown:s,selectedId:i}=this.state;return h(jn,{className:"filter-set-manager-panel",componentPanel:this,glContainer:t,glEventHub:e,isClonable:!0,isRenamable:!0,children:h("div",{className:"input-filter-container h-100 w-100 container",children:h(ll,{onChange:this.handleChange,onApply:this.handleFilterApply,onUpdateSets:this.handleSetsUpdate,isValueShown:s,filterSets:n,selectedId:i,getFilterState:this.handleGetFilterState})})})}};let ac=Xa;ac.defaultProps={panelState:null};ac.COMPONENT="FilterSetManagerPanel";const jE=(t,e)=>{const{localDashboardId:n}=e;return{filterSets:uE(t,n),dashboardOpenedPanelMap:jm(t,n),dashboardInputFilters:Xd(t,n),panelTableMap:jd(t,n)}},wa=Ft(jE,{setDashboardFilterSets:wE},null,{forwardRef:!0})(ac);const Vh=X.module("LogPanel");class Gl extends S.exports.PureComponent{constructor(e){super(e),this.handleResize=this.handleResize.bind(this),this.handleShow=this.handleShow.bind(this),this.handleHide=this.handleHide.bind(this),this.handleSessionOpened=this.handleSessionOpened.bind(this),this.handleSessionClosed=this.handleSessionClosed.bind(this),this.isBottomVisible=!0,this.logView=null;const{session:n}=this.props;this.state={session:n}}handleResize(){this.updateDimensions()}handleShow(){this.updateDimensions(),this.logView&&(this.logView.triggerFindWidget(),this.isBottomVisible&&this.logView.scrollToBottom())}handleHide(){this.logView&&(this.isBottomVisible=this.logView.isBottomVisible())}handleSessionOpened(e){Vh.debug("Session opened",[e]),this.setState({session:e})}handleSessionClosed(e){Vh.debug("Session closed",e)}updateDimensions(){this.logView&&this.logView.updateDimensions()}render(){const{glContainer:e,glEventHub:n}=this.props,{session:s}=this.state;return v(jn,{componentPanel:this,glContainer:e,glEventHub:n,onResize:this.handleResize,onHide:this.handleHide,onShow:this.handleShow,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,children:[s==null&&h("div",{className:"log-panel-disconnected-message",children:"Waiting for session connection"}),s!=null&&h(Ji,{session:s,ref:i=>{this.logView=i}})]})}}Gl.defaultProps={session:null};Gl.COMPONENT="LogPanel";Gl.TITLE="Log";const QE=(t,e)=>{var n;return{session:(n=gi(t,e.localDashboardId))==null?void 0:n.session}},al=Ft(QE,null,null,{forwardRef:!0})(Gl);class Ap extends S.exports.PureComponent{render(){const{isEditing:e,children:n,onDoubleClick:s}=this.props;return v("div",{className:"markdown-editor-container h-100 w-100",onDoubleClick:s,children:[h("div",{className:W("text-muted","edit-hint",{viewing:e===void 0||!e}),children:v("span",{children:["double-click to edit ",h(j,{icon:pl})]})}),n]})}}Ap.defaultProps={isEditing:!1};const ZE=X.module("MarkdownStartPage");class Pp extends S.exports.PureComponent{constructor(e){super(e),this.handleDeleteButtonClick=this.handleDeleteButtonClick.bind(this),this.handleDeleteModalClose=this.handleDeleteModalClose.bind(this),this.state={isDeleteModalShown:!1}}handleDeleteButtonClick(e){this.setState({isDeleteModalShown:!0,toBeDeleted:e})}handleDeleteModalClose(){this.setState({isDeleteModalShown:!1,toBeDeleted:void 0})}handleDeleteMarkdown(e){if(ZE.debug("delete markdown: ",e),e!==void 0){const{onDelete:n}=this.props;n(e)}this.setState({isDeleteModalShown:!1,toBeDeleted:void 0})}render(){const{closedMarkdowns:e,onOpen:n,onCreate:s}=this.props,{isDeleteModalShown:i,toBeDeleted:o}=this.state;return h("div",{className:"markdown-panel-start-page h-100 w-100",children:v("div",{className:"markdown-panel-start-page-container",children:[v("div",{className:"markdown-panel-start-list",children:[h("h3",{className:"list-title",children:"Start"}),h("div",{className:"list-item",children:h(z,{kind:"ghost",className:"title",onClick:s,children:"New Markdown Note"})})]}),v("div",{className:"markdown-panel-start-list",children:[h("h3",{className:"list-title",children:"Recently Closed from Dashboard"}),e.map(r=>v("div",{className:"list-item",children:[h(z,{kind:"ghost",className:"title",onClick:()=>n(r),children:r.title}),h("button",{className:"btn-link icon",type:"button",onClick:()=>{this.handleDeleteButtonClick(r)},children:h(j,{icon:wn})})]},r.id)),v($o,{isOpen:i,toggle:this.handleDeleteModalClose,className:"modal-dialog-centered markdown-delete-modal theme-bg-light",children:[h(zo,{children:"Are you sure you want to permanently delete this note?"}),h(Wo,{children:"You can't undo this action."}),v(od,{children:[h(z,{kind:"secondary",onClick:this.handleDeleteModalClose,children:"Cancel"}),h(z,{kind:"danger",onClick:()=>{this.handleDeleteMarkdown(o)},children:"Delete"})]})]})]})]})})}}Pp.defaultProps={closedMarkdowns:[],onOpen:()=>{},onCreate:()=>{},onDelete:()=>{}};const JE=t=>{const{children:e,className:n}=t,s=n!==void 0&&(n==null?void 0:n.startsWith("language-"))?n.substring(9):"plaintext";return h("pre",{children:h("code",{children:h(yl,{language:s,children:Y.Children.map(e,i=>typeof i=="string"?i.trim():i)})})})};class Hp extends S.exports.PureComponent{constructor(e){super(e),this.container=null}render(){const{isEditing:e,content:n,onEditorInitialized:s}=this.props;return h("div",{className:"markdown-editor-container",ref:i=>{this.container=i},children:e?h(Il,{settings:{language:"markdown",value:n,lineNumbers:"off"},onEditorInitialized:s}):h(ou,{components:{code:JE},children:n})})}}Hp.defaultProps={isEditing:!1,content:""};const xr=X.module("MarkdownPanel");class dc extends S.exports.Component{constructor(e){super(e),this.getClosedMarkdowns=pe(i=>i.filter(o=>o.component==="MarkdownPanel").reverse()),this.handleContainerDoubleClick=this.handleContainerDoubleClick.bind(this),this.handleCreateMarkdown=this.handleCreateMarkdown.bind(this),this.handleDeleteMarkdown=this.handleDeleteMarkdown.bind(this),this.handleOpenMarkdown=this.handleOpenMarkdown.bind(this),this.handleEditorInitialized=this.handleEditorInitialized.bind(this),this.handleEditorBlur=this.handleEditorBlur.bind(this),this.handleEditorResize=this.handleEditorResize.bind(this);const{panelState:n}=e;let s=null;n!=null&&n.content!=null&&({content:s}=n),this.state={isStartPageShown:s==null,isEditing:!1,content:s,panelState:n},this.markdownEditor=null}setEditorPosition(e){var s,i;P(this.markdownEditor);const{container:n}=this.markdownEditor;if(this.editor&&n){const o=n.getBoundingClientRect().top,r=n.scrollTop,l=n.scrollHeight,a=(i=(s=this.editor.getModel())==null?void 0:s.getLineCount())!=null?i:0;let d=Math.round((r+e-o)/l*a);d>a&&(d=a),this.editor.revealLine(d),this.editor.setPosition({lineNumber:d,column:1}),this.editor.focus()}}handleContainerDoubleClick(e){const{isEditing:n}=this.state,s=e.clientY;n||this.setState({isEditing:!0},()=>{this.setEditorPosition(s)})}handleEditorInitialized(e){xr.debug("Markdown Editor Initialized..."),this.editor=e}handleCreateMarkdown(){xr.debug("create markdown..."),this.setState({isStartPageShown:!1,content:"",isEditing:!0,panelState:{content:""}},()=>{this.editor!=null&&this.editor.focus!=null&&this.editor.focus()})}handleOpenMarkdown(e){xr.debug("open markdown...",e);const{glContainer:n,glEventHub:s}=this.props,i=te.getComponentConfigFromContainer(n);s.emit(Ie.REOPEN,e,i)}handleDeleteMarkdown(e){const{glEventHub:n}=this.props;n.emit(Ie.DELETE,e)}handleEditorBlur(e){var i;xr.debug("markdown content changed, saving...");const{isEditing:n}=this.state;if(!n||this.markdownEditor!=null&&this.markdownEditor.container!=null&&this.markdownEditor.container.contains(e.relatedTarget))return;const s=(i=this.editor)==null?void 0:i.getValue();this.setState({content:s,isEditing:!1,panelState:{content:s}})}handleEditorResize(){const{isEditing:e}=this.state;e&&this.editor&&this.editor.layout()}render(){const{glContainer:e,glEventHub:n,closedPanels:s}=this.props,{isEditing:i,isStartPageShown:o,content:r}=this.state,l=this.getClosedMarkdowns(s);return h(jn,{glContainer:e,glEventHub:n,className:"markdown-panel",componentPanel:this,onResize:this.handleEditorResize,onBlur:this.handleEditorBlur,isClonable:!0,isRenamable:!0,children:o?h(Pp,{closedMarkdowns:l,onCreate:this.handleCreateMarkdown,onOpen:this.handleOpenMarkdown,onDelete:this.handleDeleteMarkdown}):h(Ap,{isEditing:i,onDoubleClick:this.handleContainerDoubleClick,children:h(Hp,{ref:a=>{this.markdownEditor=a},isEditing:i,content:r!=null?r:void 0,onEditorInitialized:this.handleEditorInitialized})})})}}dc.defaultProps={panelState:null};dc.COMPONENT="MarkdownPanel";const e1=(t,e)=>{const{localDashboardId:n}=e;return{closedPanels:w0(t,n)}},So=Ft(e1,null,null,{forwardRef:!0})(dc);class Vp extends S.exports.PureComponent{constructor(e){super(e),this.handleRunSelected=this.handleRunSelected.bind(this),this.renderCodeBlock=this.renderCodeBlock.bind(this),this.renderLink=this.renderLink.bind(this),this.commands=new Map,this.codeElements=new Map,this.editorScrollView=Y.createRef(),this.state={hasCode:!1,hasRunCode:!1,nextStartLine:null}}componentDidMount(){this.updateHasCode()}componentDidUpdate(){this.updateHasCode()}updateHasCode(){const{hasCode:e}=this.state;this.commands.size===0&&e?this.setState({hasCode:!1}):this.commands.size>0&&!e&&this.setState({hasCode:!0})}getNextStartLine(e){const n=[...this.commands.keys()],s=n.findIndex(i=>i===e)+1;return s>=n.length?null:n[s]}handleRunSelected(e){var c,u,m;e.preventDefault(),e.stopPropagation();const{nextStartLine:n}=this.state,s=[...this.commands.keys()],i=s.findIndex(p=>p===n||n==null);if(i<0)return;const o=s[i],r=this.commands.get(o),l=this.getNextStartLine(o),a=(c=this.codeElements.get(o))==null?void 0:c.current,d=(u=a==null?void 0:a.parentElement)==null?void 0:u.nextElementSibling;if(d!=null){const{offsetTop:p}=d,g=p;(m=this.editorScrollView.current)==null||m.scroll({top:g,left:0})}this.runCode(r),this.setState({nextStartLine:l})}runCode(e){const{onRunCode:n}=this.props;n(e),this.setState({hasRunCode:!0})}renderCodeBlock(e){const{children:n,className:s,inline:i,node:o}=e,{hasRunCode:r,nextStartLine:l}=this.state,{children:a,position:d}=o;P(d);const{start:c}=d,{line:u}=c,m=a[0].value,p=Y.createRef(),g=this.commands.size===0,f=l===u||g&&l==null&&!r,b=s!==void 0&&s.startsWith("language-")?s.substring(9):"plaintext";return i!=null&&i?h("code",{className:s,children:n}):(this.commands.set(u,m),this.codeElements.set(u,p),v("div",{className:W("markdown-notebook-code-block",{"is-selected":f}),ref:p,onClick:()=>{this.setState({nextStartLine:u})},role:"presentation",children:[h(z,{kind:"ghost",icon:Yr,className:"btn-play-block",onClick:C=>{C.stopPropagation(),C.preventDefault(),this.runCode(m),this.setState({nextStartLine:u})},tooltip:"Run code"}),h("code",{children:h(yl,{language:b,children:Y.Children.map(n,C=>typeof C=="string"?C.trim():C)})})]}))}renderLink(e){const{onLinkClick:n}=this.props,{href:s,children:i,target:o}=e;return h("a",{href:s,onClick:n,target:o,children:i})}render(){const{content:e,transformImageUri:n,transformLinkUri:s}=this.props,{hasCode:i,hasRunCode:o,nextStartLine:r}=this.state;return v("div",{className:"markdown-notebook",children:[h("div",{className:"markdown-notebook-toolbar",children:h(z,{className:W("btn-play-selected-cell",{flashing:i&&!o}),kind:"ghost",icon:Yr,onClick:this.handleRunSelected,tooltip:"Run code and select next",disabled:o&&r==null||!i,children:"Run Selected Code"})}),h("div",{className:"markdown-notebook-content",ref:this.editorScrollView,children:h(ou,{components:{code:this.renderCodeBlock,a:this.renderLink},linkTarget:"_blank",remarkPlugins:[fg],transformLinkUri:s,transformImageUri:n,includeElementIndex:!0,children:e})})]})}}Vp.defaultProps={onRunCode:()=>{}};const Be=X.module("NotebookPanel"),Uh=400,_i=class extends S.exports.Component{constructor(t){super(t),this.getSettings=pe((u,m)=>({...u,minimap:{enabled:m}})),this.getOverflowActions=pe((u,m)=>[{title:"Find",icon:Zf,action:this.handleFind,group:oe.groups.high,shortcut:Bt.NOTEBOOK.FIND,order:10},{title:"Show Minimap",icon:u?ds:void 0,action:this.handleMinimapChange,group:oe.groups.medium,shortcut:Bt.NOTEBOOK.MINIMAP,order:20},{title:"Word Wrap",icon:m?ds:void 0,action:this.handleWordWrapChange,group:oe.groups.medium,shortcut:Bt.NOTEBOOK.WORDWRAP,order:30}]),this.handleBlur=this.handleBlur.bind(this),this.handleCloseCancel=this.handleCloseCancel.bind(this),this.handleCloseDiscard=this.handleCloseDiscard.bind(this),this.handleCloseSave=this.handleCloseSave.bind(this),this.handleCopy=this.handleCopy.bind(this),this.handleEditorInitialized=this.handleEditorInitialized.bind(this),this.handleEditorWillDestroy=this.handleEditorWillDestroy.bind(this),this.handleEditorChange=this.handleEditorChange.bind(this),this.handleFind=this.handleFind.bind(this),this.handleMinimapChange=this.handleMinimapChange.bind(this),this.handleWordWrapChange=this.handleWordWrapChange.bind(this),this.handleFocus=this.handleFocus.bind(this),this.handleLinkClick=this.handleLinkClick.bind(this),this.handleLoadSuccess=this.handleLoadSuccess.bind(this),this.handleLoadError=this.handleLoadError.bind(this),this.handlePanelTabClick=this.handlePanelTabClick.bind(this),this.handleRenameFile=this.handleRenameFile.bind(this),this.handleResize=this.handleResize.bind(this),this.handleRunCommand=this.handleRunCommand.bind(this),this.handleRunAll=this.handleRunAll.bind(this),this.handleRunSelected=this.handleRunSelected.bind(this),this.handleSave=this.handleSave.bind(this),this.handleSaveAsCancel=this.handleSaveAsCancel.bind(this),this.handleSaveAsSubmit=this.handleSaveAsSubmit.bind(this),this.handleSaveError=this.handleSaveError.bind(this),this.handleSaveSuccess=this.handleSaveSuccess.bind(this),this.handleSessionOpened=this.handleSessionOpened.bind(this),this.handleSessionClosed=this.handleSessionClosed.bind(this),this.handleShow=this.handleShow.bind(this),this.handleShowRename=this.handleShowRename.bind(this),this.handleTab=this.handleTab.bind(this),this.handleTabFocus=this.handleTabFocus.bind(this),this.handleTabBlur=this.handleTabBlur.bind(this),this.handleTransformLinkUri=this.handleTransformLinkUri.bind(this),this.getDropdownOverflowActions=this.getDropdownOverflowActions.bind(this),this.pending=new fs,this.debouncedSavePanelState=je(this.savePanelState.bind(this),Uh),this.debouncedLoad=je(this.load.bind(this),Uh),this.notebook=null,this.tabTitleElement=null,this.tabInitOnce=!1,this.shouldPromptClose=!0;const{isDashboardActive:e,session:n,sessionLanguage:s,panelState:i}=t;let o={value:"",language:"",wordWrap:"off"},r=null,{isPreview:l}=t;i!=null&&({fileMetadata:r=r,isPreview:l=l,settings:o=o}=i);const a=r!=null&&ce.hasPath(r.itemName),c=a===!0&&o.value!=null||!a&&o.value!=null&&o.value.length>0?1:0;this.state={error:void 0,isDashboardActive:e,isFocused:!1,isLoading:!0,isLoaded:!1,isPreview:l,savedChangeCount:0,changeCount:c,fileMetadata:r,settings:o,session:n,sessionLanguage:s,panelState:{fileMetadata:r,settings:o},showCloseModal:!1,showSaveAsModal:!1,scriptCode:""},Be.debug("constructor",t,this.state)}static handleError(t){Te.isCanceled(t)||Be.error(t)}static languageFromFileName(t){switch(ce.getExtension(t).toLowerCase()){case"py":case"python":return"python";case"groovy":return"groovy";case"scala":return"scala";default:return null}}componentDidMount(){const{glContainer:t,glEventHub:e}=this.props,{tab:n}=t;n!=null&&this.initTab(n),this.initNotebookContent(),e.on(He.RENAME_FILE,this.handleRenameFile),t.on("tabClicked",this.handlePanelTabClick)}componentDidUpdate(t,e){const{isPreview:n,settings:s}=this.state,{wordWrap:i}=s,{defaultNotebookSettings:o}=this.props;n!==e.isPreview&&this.setPreviewStatus(),i!==e.settings.wordWrap&&(this.updateEditorWordWrap(),this.debouncedSavePanelState()),o.isMinimapEnabled!==t.defaultNotebookSettings.isMinimapEnabled&&this.updateEditorMinimap()}componentWillUnmount(){this.debouncedSavePanelState.flush(),this.pending.cancel();const{glContainer:t,glEventHub:e}=this.props,{fileMetadata:n,isPreview:s}=this.state;e.off(He.RENAME_FILE,this.handleRenameFile),t.off("tabClicked",this.handlePanelTabClick),e.emit(He.UNREGISTER_FILE,n,s)}initTab(t){this.tabInitOnce||(this.tabInitOnce=!0,this.initTabCloseOverride()),this.initTabClasses(t)}initTabCloseOverride(){const{glContainer:t}=this.props,e=t.close.bind(t);t.close=()=>{const{changeCount:n,savedChangeCount:s}=this.state;return n!==s&&this.shouldPromptClose?this.setState({showCloseModal:!0}):e(),!0}}initTabClasses(t){const e=t.element.get(0);P(e);const n=e.querySelector(".lm_title");this.tabTitleElement=n,n==null||n.classList.add("notebook-title"),this.setPreviewStatus()}getNotebookValue(){const{changeCount:t,savedChangeCount:e,settings:n}=this.state,{value:s}=n;if(t!==e&&this.notebook){const i=this.notebook.getValue();return i!=null?i:s}return s}initNotebookContent(){const{fileMetadata:t,settings:e,isPreview:n}=this.state;if(t&&t.id){Be.debug("Init content from file"),this.registerFileMetadata(t,n),this.load();return}if(e.value!=null){Be.debug("Use content passed in the settings prop"),this.handleLoadSuccess();return}this.handleLoadError(new Error("Missing file metadata"))}closeFileTabById(t){const{glEventHub:e}=this.props;e.emit(He.CLOSE_FILE,{id:t})}registerFileMetadata(t,e){const{glEventHub:n,metadata:s}=this.props,{id:i}=s;n.emit(He.REGISTER_FILE,i,t,e)}renameTab(t,e){const{glEventHub:n}=this.props;n.emit(He.RENAME,t,e)}load(){const{fileMetadata:t,settings:e}=this.state;P(t);const{id:n}=t,{fileStorage:s}=this.props;this.pending.add(s.loadFile(n)).then(i=>{var a;Be.debug("Loaded file",i);const{filename:o}=i,{itemName:r}=this.state;if(o!==r){const{metadata:d}=this.props,{id:c}=d;this.renameTab(c,ce.getBaseName(o))}const l={...e,language:(a=_i.languageFromFileName(o))!=null?a:""};e.value==null&&(l.value=i.content),e.wordWrap===void 0&&(e.wordWrap="off"),this.setState({fileMetadata:{id:o,itemName:o},settings:l}),this.debouncedSavePanelState()}).then(this.handleLoadSuccess).catch(this.handleLoadError)}save(){const{fileMetadata:t}=this.state;if(t&&ce.hasPath(t.itemName)){const e=this.getNotebookValue();return e!==void 0?(this.saveContent(t.itemName,e),!0):!1}return this.setState({showSaveAsModal:!0}),!1}saveContent(t,e){Be.debug("saveContent",t,e),this.updateSavedChangeCount();const{fileStorage:n}=this.props;this.pending.add(n.saveFile({filename:t,content:e,basename:t})).then(this.handleSaveSuccess).catch(this.handleSaveError)}updateSavedChangeCount(){this.setState(({changeCount:t})=>({savedChangeCount:t}))}setPreviewStatus(){if(!this.tabTitleElement)return;const{isPreview:t}=this.state;Be.debug("setPreviewStatus",this.tabTitleElement,t),t?this.tabTitleElement.classList.add("is-preview"):this.tabTitleElement.classList.remove("is-preview")}savePanelState(){this.setState(t=>{const{changeCount:e,savedChangeCount:n,fileMetadata:s,isPreview:i,settings:o}=t,r=this.getNotebookValue(),l=e!==n?r:void 0,a={...o,value:r},c={settings:{...o,value:l},fileMetadata:s,isPreview:i};return Be.debug("Saving panel state",c),{settings:a,panelState:c}})}handleCloseDiscard(){this.shouldPromptClose=!1,this.setState({showCloseModal:!1});const{glContainer:t}=this.props;t.close()}handleCloseSave(){if(this.shouldPromptClose=!1,this.setState({showCloseModal:!1}),this.save()){const{glContainer:t}=this.props;t.close()}}handleCloseCancel(){this.shouldPromptClose=!0,this.setState({showCloseModal:!1})}handleCopy(){const{fileMetadata:t,settings:e}=this.state;P(t);const n=this.getNotebookValue(),{language:s}=e,{itemName:i}=t,o=ce.getCopyFileName(i);Be.debug("handleCopy",t,i,o),this.createNotebook(o,s,n)}handleEditorInitialized(t){this.editor=t}handleEditorWillDestroy(){this.editor=void 0}handleEditorChange(t){Be.debug2("handleEditorChanged",t),this.removePreviewStatus(),this.setState(e=>{const{changeCount:n,savedChangeCount:s}=e,{isUndoing:i,isRedoing:o}=t;return i?{changeCount:n-1,savedChangeCount:s}:!o&&n<s?{changeCount:n+1,savedChangeCount:0}:{changeCount:n+1,savedChangeCount:s}}),this.debouncedSavePanelState()}handleFind(){this.notebook&&this.notebook.toggleFind()}updateEditorMinimap(){if(this.editor){const{defaultNotebookSettings:t}=this.props;this.editor.updateOptions({minimap:{enabled:t.isMinimapEnabled}})}}handleMinimapChange(){const{settings:t,defaultNotebookSettings:e,saveSettings:n}=this.props,s={...t,defaultNotebookSettings:{isMinimapEnabled:!e.isMinimapEnabled}};n(s)}updateEditorWordWrap(){if(this.editor){const{settings:t}=this.state,{wordWrap:e}=t;this.editor.updateOptions({wordWrap:e})}}handleWordWrapChange(){this.editor&&this.setState(t=>{const{settings:e}=t,n=e.wordWrap==="on"?"off":"on";return{settings:{...e,wordWrap:n}}})}handleBlur(){Be.debug("handleBlur"),this.setState({isFocused:!1})}handleFocus(){Be.debug("handleFocus"),this.setState({isFocused:!0})}handleLinkClick(t){const{notebooksUrl:e,session:n,sessionLanguage:s}=this.props,{href:i}=t.currentTarget;if(!i||!i.startsWith(e))return;t.stopPropagation(),t.preventDefault();const o=`/${i.substring(e.length)}`.replace(/%20/g," ");if(o==="/"){Be.debug("Ignoring invalid notebook link",o);return}Be.debug("Notebook link clicked, opening",o);const{glEventHub:r}=this.props,l={value:null,language:s},a={id:o,itemName:o};r.emit(He.SELECT_NOTEBOOK,n,s,l,a)}handleLoadSuccess(){this.setState({error:void 0,isLoaded:!0,isLoading:!1})}handleLoadError(t){let e=t;Te.isCanceled(e)||(Te.isTimedOut(e)&&(e=new Error("File not found.")),Be.error(e),this.setState({error:e,isLoading:!1}))}handleSave(){Be.debug("handleSave"),this.save()}handleSaveSuccess(t){var i;const{fileStorage:e}=this.props,n={id:t.filename,itemName:t.filename},s=(i=_i.languageFromFileName(t.filename))!=null?i:"";this.setState(o=>{const{fileMetadata:r}=o,l={...o.settings,language:s};return Be.debug("handleSaveSuccess",n,r,l),r&&ce.hasPath(r.itemName)&&r.itemName!==n.itemName&&(Be.debug("handleSaveSuccess deleting old file",r.itemName),e.deleteFile(r.itemName).catch(_i.handleError)),{fileMetadata:n,settings:l,isPreview:!1}}),this.debouncedSavePanelState(),this.registerFileMetadata(n,!1)}handleSaveError(t){Te.isCanceled(t)||(this.setState({savedChangeCount:0}),Be.error(t))}handleSaveAsCancel(){this.setState({showSaveAsModal:!1})}handleSaveAsSubmit(t){var i;Be.debug("handleSaveAsSubmit",t);const{fileMetadata:e}=this.state;if(!e)return;const{itemName:n}=e,s=(i=this.getNotebookValue())!=null?i:"";if(this.setState({showSaveAsModal:!1}),ce.getBaseName(n)!==ce.getBaseName(t)){const{metadata:o}=this.props,{id:r}=o;this.renameTab(r,ce.getBaseName(t))}this.saveContent(t,s)}handleRenameFile(t,e){const{fileMetadata:n}=this.state;n&&n.id===t&&(this.setState({fileMetadata:{id:e,itemName:e}}),this.debouncedSavePanelState())}handleResize(){var t;(t=this.notebook)==null||t.updateDimensions()}handleRunCommand(t){this.runCommand(t)}handleRunAll(){var t;if(!this.notebook){Be.error("Editor is not initialized.");return}this.runCommand((t=this.notebook.getValue())!=null?t:void 0)}handleRunSelected(){if(!this.notebook){Be.error("Editor is not initialized.");return}this.runCommand(this.notebook.getSelectedCommand())}handleSessionOpened(t,{language:e}){this.setState({session:t,sessionLanguage:e})}handleSessionClosed(){this.setState({session:void 0,sessionLanguage:void 0})}handleShow(){var t;Be.debug("handleShow"),(t=this.notebook)==null||t.updateDimensions()}handleShowRename(){this.setState({showSaveAsModal:!0})}handleTab(t){Be.debug("NotebookPanel tab event",t),this.initTab(t)}handleTabFocus(...t){Be.debug("handleTabFocus",...t);const{glContainer:e}=this.props;this.setState({isDashboardActive:!0}),this.notebook&&!e.isHidden&&this.notebook.updateDimensions()}handleTabBlur(){Be.debug("handleTabBlur"),this.setState({isDashboardActive:!1})}handlePanelTabClick(){Be.debug("handlePanelTabClick"),this.focus()}handleTransformLinkUri(t){const{notebooksUrl:e}=this.props,{fileMetadata:n}=this.state;if(t.endsWith("/"))return t;if(t.startsWith("/"))return`${e}${t.substring(1)}`;let s=n==null?void 0:n.itemName;if(s===void 0)return t;s.charAt(0)==="/"&&(s=s.substring(1));const i=new URL(s,e);return new URL(t,i).href}focus(){requestAnimationFrame(()=>{this.notebook&&this.notebook.focus()})}createNotebook(t,e,n=""){const{glEventHub:s}=this.props,{session:i,sessionLanguage:o,settings:r}=this.state,l={...r,language:e,value:n},a={id:null,itemName:t};Be.debug("handleCreateNotebook",i,o,l,a),s.emit(He.CREATE_NOTEBOOK,i,o,l,a)}runCommand(t){if(t===void 0){Be.debug("Ignoring empty command.");return}this.removePreviewStatus();const{glEventHub:e}=this.props;e.emit(bt.SEND_COMMAND,t,!1,!0)}removePreviewStatus(){this.setState(({isPreview:t})=>{if(t){const{fileMetadata:e}=this.state;return e&&this.registerFileMetadata(e,!1),{isPreview:!1}}return null})}getDropdownOverflowActions(){const{defaultNotebookSettings:t}=this.props,{settings:e}=this.state;return this.getOverflowActions(t.isMinimapEnabled,this.getSettings(e,t.isMinimapEnabled).wordWrap==="on")}render(){var k,O;const{fileStorage:t,glContainer:e,glContainer:{tab:n},glEventHub:s,defaultNotebookSettings:i}=this.props,{changeCount:o,savedChangeCount:r,error:l,isDashboardActive:a,isLoaded:d,isLoading:c,isPreview:u,fileMetadata:m,session:p,sessionLanguage:g,settings:f,showCloseModal:b,showSaveAsModal:C}=this.state,w=a&&!e.isHidden&&!u,T=(k=m==null?void 0:m.itemName)!=null?k:_i.DEFAULT_NAME,y=T.endsWith(".md"),E=(m==null?void 0:m.id)!=null,I=this.getSettings(f,i.isMinimapEnabled),D=p!=null,F=g===I.language,x=!d||!D||!F,U=!d,B=[{action:this.handleSave,shortcut:ms.SAVE},{action:this.handleMinimapChange,shortcut:Bt.NOTEBOOK.MINIMAP},{action:this.handleWordWrapChange,shortcut:Bt.NOTEBOOK.WORDWRAP}],_=nh.getDisabledRunTooltip(D,F,"Notebook extension","Run"),H=nh.getDisabledRunTooltip(D,F,"Notebook extension","Run Selected"),A=[{title:E?"Rename":"Save As\u2026",order:10,group:oe.groups.high,action:this.handleShowRename},{title:"Copy File",action:this.handleCopy,group:oe.groups.high,order:20}],N=n==null?void 0:n.element.find(".lm_title_before").get(0);return v(ye,{children:[N&&ui.createPortal(h("span",{className:W("editor-unsaved-indicator",{"is-unsaved":o!==r})}),N),v(jn,{className:"notebook-container",componentPanel:this,glContainer:e,glEventHub:s,onTab:this.handleTab,onResize:this.handleResize,onShow:this.handleShow,onTabFocus:this.handleTabFocus,onTabBlur:this.handleTabBlur,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,onFocus:this.handleFocus,onBlur:this.handleBlur,additionalActions:A,renderTabTooltip:()=>T,children:[!y&&v(ye,{children:[v("div",{className:"notebook-toolbar",children:[v("span",{children:[h(z,{kind:"ghost",className:"btn-play",onClick:this.handleRunAll,disabled:x,icon:h(j,{icon:Yr,transform:"grow-4"}),tooltip:`Run ${Bt.NOTEBOOK.RUN.getDisplayText()}`,"aria-label":"Run"}),_!=null&&h(Ue,{children:_})]}),v("span",{children:[h(z,{kind:"ghost",className:"btn-play",onClick:this.handleRunSelected,disabled:x,icon:h(j,{icon:dC,transform:"grow-4"}),tooltip:`Run Selected ${Bt.NOTEBOOK.RUN_SELECTED.getDisplayText()}`,"aria-label":"Run Selected"}),H!=null&&h(Ue,{children:H})]}),h(z,{kind:"ghost",className:"mr-auto",disabled:U,onClick:this.handleSave,icon:bu,tooltip:`Save ${ms.SAVE.getDisplayText()}`,"aria-label":"Save"}),h(z,{kind:"ghost",className:"btn-overflow btn-link-icon",disabled:U,icon:gu,tooltip:"More Actions...",onClick:()=>{},children:h(Fn,{actions:this.getDropdownOverflowActions,popperOptions:_i.POPPER_OPTIONS})})]}),h(om,{isLoaded:d,isLoading:c,error:l,onChange:this.handleEditorChange,onRunCommand:this.handleRunCommand,session:p,sessionLanguage:g,onEditorInitialized:this.handleEditorInitialized,onEditorWillDestroy:this.handleEditorWillDestroy,settings:I,focusOnMount:w,ref:V=>{this.notebook=V}})]}),y&&h(Vp,{content:(O=I.value)!=null?O:"",onLinkClick:this.handleLinkClick,onRunCode:this.handleRunCommand,transformImageUri:this.handleTransformLinkUri,transformLinkUri:this.handleTransformLinkUri}),h(Wl,{isOpen:C,type:"file",defaultValue:T,title:E?"Rename":"Save file as",onSubmit:this.handleSaveAsSubmit,onCancel:this.handleSaveAsCancel,notifyOnExtensionChange:!0,storage:t}),h($i,{isOpen:b,headerText:`Do you want to save the changes you made to ${T}?`,bodyText:"Your changes will be lost if you don't save them.",onCancel:this.handleCloseCancel,onDiscard:this.handleCloseDiscard,onConfirm:this.handleCloseSave,discardButtonText:"Discard Changes",confirmButtonText:"Save"}),h(oe,{actions:B})]})]})}};let Jo=_i;Jo.COMPONENT="NotebookPanel";Jo.POPPER_OPTIONS={placement:"bottom-end"};Jo.DEFAULT_NAME="Untitled";Jo.defaultProps={isDashboardActive:!0,isPreview:!1,session:null,sessionLanguage:null,defaultNotebookSettings:null};const t1=(t,e)=>{const n=Cm(t),s=xt(t),i=MS(t),o=gi(t,e.localDashboardId),{session:r,config:l}=o!=null?o:{},{type:a}=l!=null?l:{};return{fileStorage:n,settings:s,defaultNotebookSettings:i,session:r,sessionLanguage:a}},Ys=Ft(t1,{saveSettings:Td},null,{forwardRef:!0})(Jo);class ko extends S.exports.Component{constructor(e){super(e),this.irisGridRef=Y.createRef(),this.buttonRef=Y.createRef(),this.handleReload=this.handleReload.bind(this),this.handleGridStateChange=this.handleGridStateChange.bind(this),this.handlePanelStateUpdate=this.handlePanelStateUpdate.bind(this);const{panelState:n}=e;this.state={shouldFocusGrid:!1,panelState:n}}handleReload(){var e,n;(e=this.irisGridRef.current)==null||e.initModel(),(n=this.buttonRef.current)==null||n.blur(),this.setState({shouldFocusGrid:!0})}handleGridStateChange(){var n,s,i;const{shouldFocusGrid:e}=this.state;e&&((i=(s=(n=this.irisGridRef.current)==null?void 0:n.irisGrid)==null?void 0:s.current)==null?void 0:i.grid)&&(this.irisGridRef.current.irisGrid.current.grid.focus(),this.setState({shouldFocusGrid:!1}))}handlePanelStateUpdate(e){this.setState({panelState:e})}render(){const{...e}=this.props;return h(hi,{ref:this.irisGridRef,onStateChange:this.handleGridStateChange,onPanelStateUpdate:this.handlePanelStateUpdate,...e,children:v(z,{ref:this.buttonRef,kind:"primary",className:"btn-pandas",onClick:this.handleReload,tooltip:"Click to refresh pandas dataframe, updates do not occur automatically.",children:["pandas dataframe",v("span",{children:[h(j,{icon:cd,transform:"shrink-1",className:"mr-1"}),"Reload"]})]})})}}ko.defaultProps={panelState:null};ko.COMPONENT="PandasPanel";function n1(t){Vs(t);const{id:e,layout:n,registerComponent:s,hydrate:i}=t,o=S.exports.useCallback(({dragEvent:r,fetch:l,panelId:a=ze.generate(),widget:d})=>{const{name:c,type:u}=d;if(u!==dh.VariableType.FIGURE)return;const m={name:c,figure:c},p=()=>l().then(b=>zi.makeModel(void 0,b)),g={type:"react-component",component:Bi.COMPONENT,props:{localDashboardId:e,id:a,metadata:m,makeModel:p},title:c,id:a},{root:f}=n;te.openComponent({root:f,config:g,dragEvent:r})},[e,n]);return S.exports.useEffect(function(){const l=[s(Bi.COMPONENT,Bi,i)];return()=>{l.forEach(a=>a())}},[i,s]),Ke(n.eventHub,Ie.OPEN,o),null}function s1(t){Vs(t);const{id:e,layout:n}=t,s=S.exports.useCallback(({metadata:i,panelId:o=ze.generate(),table:r})=>{const{settings:l}=i,a=()=>zi.makeModelFromSettings(l,r),d=xe.titleFromSettings(l),c={type:"react-component",component:Bi.COMPONENT,props:{localDashboardId:e,id:o,metadata:i,makeModel:a},title:d,id:o},{root:u}=n;te.openComponent({root:u,config:c})},[e,n]);return Ke(n.eventHub,Et.CREATE_CHART,s),null}const ct=X.module("ConsolePlugin");function Bh(t){return t.notebook!==void 0}function i1(t){Vs(t)}function o1(t){i1(t);const{id:e,hydrateConsole:n,layout:s,panelManager:i,registerComponent:o,notebooksUrl:r}=t,l=S.exports.useRef(0),[a]=S.exports.useState(new Map),[d]=S.exports.useState(new Map),c=nd(),u=S.exports.useCallback(()=>i.getLastUsedPanelOfType(Li),[i]),m=S.exports.useCallback((N,k=!0,O=!0)=>{if(!(N&&N.trim()))ct.info("Ignoring empty code");else{const G=u();if(!G||!(G instanceof Li.WrappedComponent)){ct.error("Console panel not found");return}ct.debug("Send command: ",N,k,O),G.addCommand(N,k,O)}},[u]),p=S.exports.useCallback(N=>{c(SE(e,N))},[c,e]),g=S.exports.useCallback(({language:N})=>{const k=N==="python"?"py":N;let O=null;return k==null?(ct.debug("No extension for language",N),O=`Untitled-${l.current}`):O=`Untitled-${l.current}.${k}`,l.current+=1,O},[]),f=S.exports.useCallback((N,k=!0)=>{const{id:O}=N;return O!=null&&a.has(O)?a.get(O):O!=null&&d.has(O)?d.get(O):k?ze.generate():null},[a,d]),b=S.exports.useCallback((N,k)=>{te.renameComponent(s.root,{id:N},k)},[s.root]),C=S.exports.useCallback((N,k)=>{ct.debug("Rename file panel",N,k);let O;if(a.has(N)&&(O=a.get(N),a.delete(N),O!=null&&a.set(k,O)),d.has(N)&&(O=d.get(N),d.delete(N),O!=null&&d.set(k,O)),O===void 0){ct.debug2(`File ${N} isn't open, no need to rename the tab`);return}b(O,ce.getBaseName(k))},[a,d,b]),w=S.exports.useCallback(N=>{const k=f(N,!1);if(k==null){ct.error("Could not find panel id for file metadata",N);return}te.activateTab(s.root,{id:k})},[f,s.root]),T=S.exports.useCallback((N,k,O)=>{if(ct.debug("registerFilePanel",N,k,O),k==null||k.id==null){ct.debug("Ignore empty file id",k);return}const{id:V}=k;if(O){d.set(V,N);return}if(a.has(V)){const G=a.get(V);if(N===G){ct.debug(`Update tab title for file ${V}`);const{itemName:Q}=k;C(V,ce.getBaseName(Q))}else ct.error(`File ${V} already associated with a different tab ${G}`);return}a.set(V,N),d.has(V)&&d.delete(V)},[a,d,C]),y=S.exports.useCallback((N,k)=>{if(ct.debug("unregisterFileTab",N,k),N==null||N.id==null){ct.debug("Ignore empty file id",N);return}const{id:O}=N;if(k){d.delete(O);return}a.delete(O)},[a,d]),E=S.exports.useCallback(N=>{ct.debug("closeFilePanel",N);const{id:k}=N;let O=null,V=!1;if(a.has(k))O=a.get(k);else if(d.has(k))O=d.get(k),V=!0;else{ct.debug(`File ${k} isn't open, ignore close event`);return}y(N,V),te.closeComponent(s.root,{id:O})},[s.root,a,d,y]),I=S.exports.useCallback(N=>{const{itemName:k}=N;return ce.getBaseName(k)},[]),D=S.exports.useCallback(N=>{const{id:k}=N;return ct.debug("fileIsOpen",N,k,a),k!=null&&a.has(k)},[a]),F=S.exports.useCallback(N=>{const{id:k}=N;return ct.debug("fileIsOpenAsPreview",N,k,d),k!=null&&d.has(k)},[d]),x=S.exports.useCallback(N=>{if(N==null)return;const k=i.getOpenedPanelById(N);k&&Bh(k)&&k.focus()},[i]),U=S.exports.useCallback(({id:N,settings:k,fileMetadata:O,session:V,sessionLanguage:G,isPreview:Q=!1})=>{const Z={settings:k,fileMetadata:O},be=I(O);return{type:"react-component",component:Ys.COMPONENT,isFocusOnShow:!1,props:{localDashboardId:e,metadata:{id:N},session:V,sessionLanguage:G,panelState:Z,isPreview:Q,notebooksUrl:r},title:be,id:N}},[I,e,r]),B=S.exports.useCallback((N,k,O,V={id:null,itemName:g(O)})=>{const G=f(V);if(D(V)&&G!=null){ct.debug("File is already open, focus panel"),w(V),x(G);return}const Q=te.getStackForComponentTypes(s.root,[Ys.COMPONENT]),Z=U({id:G,settings:O,fileMetadata:V,session:N,sessionLanguage:k});ct.debug("createNotebook",Z,a),te.openComponentInStack(Q,Z)},[D,x,g,f,s.root,U,a,w]),_=S.exports.useCallback((N,k,O,V,G=!1)=>{ct.debug("selectNotebook",V,G);const Q=D(V),Z=F(V);if(Q){if(w(V),G){const ee=f(V);x(ee)}return}if(Z&&!G){w(V);return}const[be]=Array.from(d.values());let le=null,he=null;be!=null&&(le=be,he=te.getStackForConfig(s.root,{component:Ys.COMPONENT,id:le})),he==null&&(le=f(V),he=te.getStackForComponentTypes(s.root,[Ys.COMPONENT]));const De=U({id:le,settings:O,fileMetadata:V,session:N,sessionLanguage:k,isPreview:!G});te.openComponentInStack(he,De),G&&x(le)},[w,D,F,x,f,s.root,U,d]),H=S.exports.useCallback((N,k,O={},V=!0)=>{const G=i.getLastUsedPanelOfType(Ys);G&&Bh(G)?O!=null&&O.value!=null&&G.notebook!=null&&G.notebook.append(O.value):V&&B(N,k,O)},[B,i]),A=S.exports.useCallback((N,k)=>Ua.hydrate({...N,notebooksUrl:r},k),[r]);return S.exports.useEffect(function(){const k=[o(Li.COMPONENT,Li,n),o(ol.COMPONENT,ol),o(rl.COMPONENT,rl),o(al.COMPONENT,al),o(Ys.COMPONENT,Ys,A)];return()=>{k.forEach(O=>O())}},[o,n,A]),Ke(s.eventHub,bt.SEND_COMMAND,m),Ke(s.eventHub,bt.SETTINGS_CHANGED,p),Ke(s.eventHub,He.CLOSE_FILE,E),Ke(s.eventHub,He.CREATE_NOTEBOOK,B),Ke(s.eventHub,He.SELECT_NOTEBOOK,_),Ke(s.eventHub,He.RENAME,b),Ke(s.eventHub,He.RENAME_FILE,C),Ke(s.eventHub,He.SEND_TO_NOTEBOOK,H),Ke(s.eventHub,He.REGISTER_FILE,T),Ke(s.eventHub,He.UNREGISTER_FILE,y),null}const wo=X.module("FilterPlugin");function $h(t,e){return t.concat(e)}function r1(t){Vs(t);const{id:e,layout:n,registerComponent:s}=t,i=nd(),[o]=S.exports.useState(()=>new Map),[r]=S.exports.useState(()=>new Map),[l]=S.exports.useState(()=>new Map),a=S.exports.useCallback(()=>{const b=Array.from(o.values()).reduce($h,[]).sort((T,y)=>{const E=on.toLower(T.name),I=on.toLower(y.name);if(E!==I)return E>I?1:-1;const D=on.toLower(T.type),F=on.toLower(y.type);return D!==F?D>F?1:-1:0}).reduce((T,y)=>((T.length===0||on.toLower(T[T.length-1].name)!==on.toLower(y.name)||on.toLower(T[T.length-1].type)!==on.toLower(y.type))&&T.push(y),T),[]),C=Array.from(r.values()).reduce($h,[]).sort((T,y)=>T.timestamp-y.timestamp),w=new Map(l);wo.debug("sendUpdate",{columns:b,filters:C,tableMap:w}),i(Xn(e,{columns:b,filters:C,tableMap:w}))},[i,e,o,r,l]),d=S.exports.useCallback((b,C)=>{wo.debug2("handleColumnsChanged",b,C),o.set(b,[].concat(C)),a()},[o,a]),c=S.exports.useCallback((b,C)=>{wo.debug2("handleFiltersChanged",b,C),r.set(b,[].concat(C)),a()},[r,a]),u=S.exports.useCallback((b,C)=>{wo.debug2("handleTableChanged",b,C),l.set(te.getIdFromPanel(b),C),a()},[l,a]),m=S.exports.useCallback(b=>{wo.debug2("handlePanelUnmount",b),o.delete(b),r.delete(b),l.delete(te.getIdFromPanel(b)),a()},[o,r,l,a]),p=S.exports.useCallback(({title:b="DropdownFilter",metadata:C={},panelState:w=null,id:T=ze.generate(),focusElement:y=te.DEFAULT_FOCUS_SELECTOR,createNewStack:E=!1,dragEvent:I=null})=>{const D={type:"react-component",component:ci.COMPONENT,props:{id:T,metadata:C,panelState:w,localDashboardId:e},title:b,id:T},{root:F}=n;te.openComponent({root:F,config:D,focusElement:y,createNewStack:E,dragEvent:I})},[n,e]),g=S.exports.useCallback(({title:b="InputFilter",metadata:C={},panelState:w=null,id:T=ze.generate(),focusElement:y=te.DEFAULT_FOCUS_SELECTOR,createNewStack:E=!1,dragEvent:I=null})=>{const D={type:"react-component",component:_o.COMPONENT,props:{id:T,metadata:C,panelState:w,localDashboardId:e},title:b,id:T},{root:F}=n;te.openComponent({root:F,config:D,focusElement:y,createNewStack:E,dragEvent:I})},[n,e]),f=S.exports.useCallback(({title:b="FilterSets",metadata:C={},panelState:w=null,id:T=ze.generate(),focusElement:y=te.DEFAULT_FOCUS_SELECTOR,createNewStack:E=!1,dragEvent:I=null})=>{const D={type:"react-component",component:wa.COMPONENT,props:{id:T,metadata:C,panelState:w,localDashboardId:e},title:b,id:T},{root:F}=n;te.openComponent({root:F,config:D,focusElement:y,createNewStack:E,dragEvent:I})},[n,e]);return S.exports.useEffect(function(){const C=[s(ci.COMPONENT,ci),s(_o.COMPONENT,_o),s(wa.COMPONENT,wa)];return()=>{C.forEach(w=>w())}},[s]),Ke(n.eventHub,Pe.COLUMNS_CHANGED,d),Ke(n.eventHub,Pe.FILTERS_CHANGED,c),Ke(n.eventHub,Pe.TABLE_CHANGED,u),Ke(n.eventHub,Pe.OPEN_DROPDOWN,p),Ke(n.eventHub,Pe.OPEN_INPUT,g),Ke(n.eventHub,Pe.OPEN_FILTER_SET_MANAGER,f),Ke(n.eventHub,Ie.UNMOUNT,m),null}const l1=[dh.VariableType.TABLE,dh.VariableType.TREETABLE];function a1(t){Vs(t);const{getDownloadWorker:e,loadPlugin:n,id:s,layout:i,registerComponent:o,hydrate:r,theme:l}=t,a=S.exports.useCallback(({dragEvent:d,fetch:c,panelId:u=ze.generate(),widget:m})=>{const{name:p,type:g}=m;if(!l1.includes(g))return;const f={name:p,table:p},b=()=>c().then(T=>qd.makeModel(T)),C={type:"react-component",component:hi.COMPONENT,props:{getDownloadWorker:e,loadPlugin:n,localDashboardId:s,id:u,metadata:f,makeModel:b,theme:l},title:p,id:u},{root:w}=i;te.openComponent({root:w,config:C,dragEvent:d})},[e,s,i,n,l]);return S.exports.useEffect(function(){const c=[o(hi.COMPONENT,hi,r)];return()=>{c.forEach(u=>u())}},[r,o]),Ke(i.eventHub,Ie.OPEN,a),null}function Up(t){return typeof t.getCoordinateForColumn=="function"}function Wh(t){const e=t;return Up(t)&&typeof e.setFilterMap=="function"&&typeof e.unsetFilterValue=="function"}const vo=X.module("LinkerUtils"),Bp=class{static getLinkType(t,e,n){var l;if((t==null?void 0:t.panelId)==null||(e==null?void 0:e.panelId)==null||t.panelId===e.panelId||n!=null&&n!==t.panelId&&n!==e.panelId)return vo.debug2("Incompatible panel ids",t,e,n),"invalid";if(t.panelComponent==null||e.panelComponent==null)return vo.error("PanelComponent should not be null",t,e),"invalid";const s=(l=Bp.ALLOWED_LINKS.get(t.panelComponent))==null?void 0:l.includes(e.panelComponent);if(s===void 0||!s)return vo.debug2("Incompatible panel components",t,e),"invalid";const{columnType:i}=t,{columnType:o}=e;if(!(o===null||L.isCompatibleType(i,o)))return vo.debug2("Incompatible type",i,o),"invalid";switch(e.panelComponent){case te.getComponentName(Bi):case te.getComponentName(hi):return"tableLink";case te.getComponentName(ci):return"filterSource"}return vo.debug2("Incompatible target panel component",e.panelComponent),"invalid"}static findColumn(t,{columnName:e,columnType:n}){return t.find(({name:s,type:i})=>s===e&&i===n)}static cloneLinksForPanel(t,e,n){const s=[];return t.forEach(i=>{var o;i.start.panelId===e&&i.type!=="filterSource"?s.push({...i,id:ze.generate(),start:{...i.start,panelId:n}}):((o=i.end)==null?void 0:o.panelId)===e&&s.push({...i,id:ze.generate(),end:{...i.end,panelId:n}})}),s}};let ni=Bp;ni.ALLOWED_LINKS=new Map([[te.getComponentName(hi),[te.getComponentName(hi),te.getComponentName(Bi),te.getComponentName(ci)]]]);const d1=X.module("LinkerLink"),zh=.015,Gh=1.5,$p=12,Wp=12,Kh=2,_r=Math.sqrt((Wp*.5)**2+$p**2),qh=Math.asin(Wp*.5/$p),Yh=15,xs=Math.PI*.5,Wr=class extends S.exports.Component{constructor(t){super(t),this.getOperators=pe((e,n)=>{const{onOperatorChanged:s}=this.props;let i=L.getFilterTypes(n);return L.isBooleanType(n)&&(i=[q.eq,q.notEq]),i.flatMap((o,r)=>{if(o==="eqIgnoreCase"||o==="notEqIgnoreCase")return[];let l="";return o==="startsWith"?l="a*":o==="endsWith"?l="*z":l=L.getFilterOperatorString(o),[{title:Wr.getLabelForLinkFilter(n,o),icon:h("b",{children:l}),action:()=>s(e,o),order:r}]})}),this.handleClick=this.handleClick.bind(this),this.handleMouseEnter=this.handleMouseEnter.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.handleDelete=this.handleDelete.bind(this),this.getDropdownActions=this.getDropdownActions.bind(this),this.state={isHovering:void 0}}static makeCirclePath(t,e,n){return`M ${t} ${e} m -${n},0 a ${n},${n} 0 1,0 ${n*2},0 a ${n},${n} 0 1,0 -${n*2},0 z`}static getLabelForLinkFilter(t,e){try{if(L.isNumberType(t)||L.isCharType(t))return cm(e);if(L.isTextType(t))return dm(e);if(L.isDateType(t))return hm(e);if(L.isBooleanType(t)){if(e===q.eq)return"is equal to";if(e===q.notEq)return"is not equal to"}throw new Error(`Unrecognized column type: ${t}`)}catch(n){return d1.warn(n),""}}handleClick(t){t.stopPropagation(),t.preventDefault();const{id:e,onClick:n,onDelete:s}=this.props;t.altKey?s(e):n(e)}handleMouseEnter(){this.setState({isHovering:!0})}handleMouseLeave(){this.setState({isHovering:!1})}handleDelete(){const{id:t,onDelete:e}=this.props;e(t)}getDropdownActions(){const{id:t,startColumnType:e}=this.props;return e!=null?this.getOperators(t,e):[]}render(){const{className:t,operator:e,isSelected:n,x1:s,y1:i,x2:o,y2:r,id:l,startColumnType:a}=this.props,{isHovering:d}=this.state,c=Math.sqrt((s-o)**2+(i-r)**2),u=Math.atan2(r-i,o-s),m=Math.sin(u),p=Math.cos(u)+2,g=window.innerWidth,f=window.innerHeight,b=0,C=0,w=Math.max(b,Math.min(s+(o-s)/2+m*(c*zh)**Gh,g)),T=Math.max(C,Math.min(i+(r-i)/2+p*(c*zh)**Gh,f)),y=`M ${s} ${i} Q ${w} ${T} ${o} ${r}`,E=`M ${b} ${C} L ${b} ${f} L ${g} ${f} L ${g} ${C} z
|
|
38
|
+
${l} does not exist yet.`}if(i){const{widgetName:r}=this.props;return`${r} is unavailable.`}}handleSessionClosed(...e){const{onSessionClose:n}=this.props;this.setState({isPanelDisconnected:!0,isWaitingForReconnect:!1}),n(...e)}handleSessionOpened(...e){const{onSessionOpen:n}=this.props;n(...e)}render(){const{children:e,className:n,componentPanel:s,isLoaded:i,isLoading:o,glContainer:r,glEventHub:l,isDisconnected:a,isClonable:d,isRenamable:c,showTabTooltip:u,renderTabTooltip:m,widgetType:p,widgetName:g,description:f,onClearAllFilters:b,onHide:C,onFocus:w,onBlur:T,onResize:y,onShow:E,onTabBlur:I,onTabFocus:D,onTabClicked:F}=this.props,{isPanelDisconnected:x,isWidgetDisconnected:U,isPanelInactive:B}=this.state,_=this.getErrorMessage(),H=m!=null?m:this.getCachedRenderTabTooltip(u,r,p,g,f),A=[{title:`Copy ${p} Name`,group:oe.groups.medium,order:20,action:this.handleCopyName}];return v(jn,{className:W(n,{disconnected:x||U||a,inactive:B}),componentPanel:s,glContainer:r,glEventHub:l,onClearAllFilters:b,onHide:C,onFocus:w,onBlur:T,onResize:y,onShow:E,onSessionClose:this.handleSessionClosed,onSessionOpen:this.handleSessionOpened,onTabBlur:I,onTabFocus:D,onTabClicked:F,renderTabTooltip:H,errorMessage:_,isLoaded:i,isLoading:o,isClonable:d,isRenamable:c,additionalActions:A,children:[e,B&&h("div",{className:"fill-parent-absolute"})]})}}Ul.defaultProps={className:"",errorMessage:null,isClonable:!0,isDisconnected:!1,isLoading:!1,isLoaded:!0,isRenamable:!0,showTabTooltip:!0,widgetName:"Widget",widgetType:"Widget",renderTabTooltip:null,description:"",onFocus:()=>{},onBlur:()=>{},onHide:()=>{},onClearAllFilters:()=>{},onResize:()=>{},onSessionClose:()=>{},onSessionOpen:()=>{},onShow:()=>{},onTabBlur:()=>{},onTabFocus:()=>{},onTabClicked:()=>{}};const Yt=Object.freeze({DEFAULT:"DEFAULT",LINKER:"LINKER"}),aE="SET_SESSION_WRAPPER",dE=Hs(aE,null),cE={sessionWrapper:dE},hE=new Map,Bl=Object.freeze([]),Fp=(t,e)=>{var n;return(n=Qt(t,e).columns)!=null?n:Bl},uE=(t,e)=>{var n;return(n=Qt(t,e).filterSets)!=null?n:Bl},Xd=(t,e)=>{var n;return(n=Qt(t,e).filters)!=null?n:Bl},jd=(t,e)=>{var n;return(n=Qt(t,e).tableMap)!=null?n:hE},Qd=(t,e)=>Qt(t,e).isolatedLinkerPanelId,oo=(t,e)=>{var n;return(n=Qt(t,e).links)!=null?n:Bl},Zd=(t,e)=>Qt(t,e).columnSelectionValidator,mE=(t,e)=>Qt(t,e).connection,gi=(t,e)=>Qt(t,e).sessionWrapper,pE=(t,e)=>n=>n(Xn(t,{connection:e})),gE=(t,e)=>n=>n(Xn(t,{sessionWrapper:e})),Jd=(t,e)=>n=>n(Xn(t,{links:e})),fE=(t,e)=>(n,s)=>{const i=oo(s(),t),o=e.filter(r=>i.findIndex(l=>ht(l.start,r.start)&&ht(l.end,r.end))<0);return n(Jd(t,i.concat(o)))},CE=(t,e)=>(n,s)=>{const o=oo(s(),t).filter(r=>!e.includes(r.id));return n(Jd(t,o))},xp=(t,e)=>n=>n(Xn(t,{isolatedLinkerPanelId:e})),bE=(t,e)=>n=>n(Xn(t,{columnSelectionValidator:e})),SE=(t,e)=>n=>n(Xn(t,{consoleSettings:e})),wE=(t,e)=>n=>n(Xn(t,{filterSets:e}));Object.entries(cE).map(([t,e])=>eo.register(t,e));function _p({columnMap:t,inputFilterMap:e,linkedColumnMap:n,onAdd:s,onOpenLinker:i,waitingFilterMap:o,waitingInputMap:r}){const l=S.exports.useMemo(()=>{const p=Array.from(r.keys()),g=p.find(C=>e.get(C)!=null),f=p.find(C=>n.get(C)!=null),b=on.join(p.map(C=>`"${C}"`));return g!=null&&g&&f!=null&&f?`Use a filter control or linked table to set a value for ${b}`:g!=null&&g?`Set a filter control value for ${b}`:`Double click a row in a linked table to set a value for ${b}`},[e,n,r]),a=S.exports.useMemo(()=>Array.from(t.values()),[t]),d=S.exports.useCallback(p=>{p.stopPropagation(),p.preventDefault(),s(Array.from(o.values()))},[s,o]),c=S.exports.useCallback(p=>{p.stopPropagation(),p.preventDefault(),i()},[i]),u=o.size>0,m=!u&&r.size>0;return h("div",{className:"chart-panel-overlay chart-filter-overlay",children:v("div",{className:W("chart-panel-overlay-content chart-filter-overlay-content",{"chart-filter-waiting-filter":u},{"chart-filter-waiting-input":m}),children:[u&&v(ye,{children:[h("div",{className:"info-message",children:"This plot requires a filter control to be added to the layout or a table link to be created on the following columns:"}),h("div",{className:"waiting-filter-list",children:a.map(p=>{const g=o.has(p.name),f=g?cs:ad;return v("div",{className:W("waiting-filter-item",{"is-invalid":g}),children:[h(j,{icon:f}),p.name]},p.name)})}),v("div",{children:[h(Ao,{onClick:d,className:"btn-primary",children:"Add Input Filters"}),h(Ao,{onClick:c,className:"btn-primary",children:"Open Linker Tool"})]})]}),m&&v(ye,{children:[h("div",{className:"info-message",children:"Waiting for User Input"}),h("div",{className:"",children:l})]})]})})}_p.propTypes={columnMap:R.exports.instanceOf(Map).isRequired,inputFilterMap:R.exports.instanceOf(Map).isRequired,linkedColumnMap:R.exports.instanceOf(Map).isRequired,onAdd:R.exports.func.isRequired,onOpenLinker:R.exports.func.isRequired,waitingFilterMap:R.exports.instanceOf(Map).isRequired,waitingInputMap:R.exports.instanceOf(Map).isRequired};function Vo({columns:t,onColumnSelected:e,onMouseEnter:n,onMouseLeave:s}){return h("div",{className:"chart-panel-overlay chart-column-selector-overlay",children:v("div",{className:W("chart-panel-overlay-content"),children:[h("div",{className:"info-message",children:"This plot requires a filter control to be added to the layout or a table link to be created on the following columns:"}),h("div",{className:"waiting-column-select-list",children:t.map(i=>h(Tl,{className:W("btn-chart-column-selector",Vo.makeButtonClassName(i.name)),onClick:()=>e(i.name),onMouseEnter:()=>{n&&n(i)},onMouseLeave:s,disabled:!i.isValid,isLinked:i.isActive,children:i.name},i.name))})]})})}Vo.makeButtonClassName=t=>`btn-chart-column-selector-${t}`;Vo.defaultProps={onMouseEnter:()=>{},onMouseLeave:()=>{}};const nn=X.module("ChartPanel"),vE=150;function Vr(t){return t.settings!==void 0}function TE(t){return t.inputFilters!=null}function EE(t){return t.panelState!=null}class $l extends S.exports.Component{constructor(e){super(e),this.getWaitingInputMap=pe((r,l,a)=>{if(!r)return new Map;const d=new Map(l);return a.forEach((c,u)=>{d.delete(u)}),d}),this.getWaitingFilterMap=pe((r,l,a,d,c)=>{if(!r)return new Map;const u=new Map(l);return a.forEach((m,p)=>{u.delete(p)}),c.forEach((m,p)=>{u.delete(p)}),d.forEach((m,p)=>{u.delete(p)}),u}),this.getInputFilterColumnMap=pe((r,l)=>{const a=new Map;for(let d=0;d<l.length;d+=1){const c=l[d],{name:u,type:m}=c,p=r.get(u);p!=null&&p.type===m&&a.set(u,c)}return a}),this.getLinkedColumnMap=pe((r,l)=>{const a=new Map,d=te.getIdFromPanel(this);for(let c=0;c<l.length;c+=1){const u=l[c];let m=null;if(u.start!=null&&u.start.panelId===d&&r.has(u.start.columnName)?m=u.start.columnName:u.end&&u.end.panelId===d&&r.has(u.end.columnName)&&(m=u.end.columnName),m!=null&&r.has(m)){const p=r.get(m);P(p),a.set(m,p)}}return a}),this.getSelectorColumns=pe((r,l,a)=>Array.from(r.values()).map(d=>({name:d.name,type:d.type,isValid:a?a(this,d):!1,isActive:l.has(d.name)}))),this.handleColumnSelected=this.handleColumnSelected.bind(this),this.handleColumnMouseEnter=this.handleColumnMouseEnter.bind(this),this.handleColumnMouseLeave=this.handleColumnMouseLeave.bind(this),this.handleDisconnect=this.handleDisconnect.bind(this),this.handleReconnect=this.handleReconnect.bind(this),this.handleFilterAdd=this.handleFilterAdd.bind(this),this.handleHide=this.handleHide.bind(this),this.handleError=this.handleError.bind(this),this.handleLoadError=this.handleLoadError.bind(this),this.handleLoadSuccess=this.handleLoadSuccess.bind(this),this.handleResize=this.handleResize.bind(this),this.handleSettingsChanged=this.handleSettingsChanged.bind(this),this.handleOpenLinker=this.handleOpenLinker.bind(this),this.handleShow=this.handleShow.bind(this),this.handleSourceColumnChange=this.handleSourceColumnChange.bind(this),this.handleSourceFilterChange=this.handleSourceFilterChange.bind(this),this.handleSourceSortChange=this.handleSourceSortChange.bind(this),this.handleTabBlur=this.handleTabBlur.bind(this),this.handleTabFocus=this.handleTabFocus.bind(this),this.handleUpdate=this.handleUpdate.bind(this),this.updateModelFromSource=je(this.updateModelFromSource.bind(this),vE),this.handleClearAllFilters=this.handleClearAllFilters.bind(this),this.panelContainer=Y.createRef(),this.chart=Y.createRef(),this.pending=new fs;const{metadata:n,panelState:s}=e,{filterValueMap:i=[],settings:o={}}=s!=null?s:{};this.state={settings:o,error:void 0,isActive:!1,isDisconnected:!1,isLoading:!1,isLoaded:!1,isLinked:n!=null&&Vr(n)&&n.settings.isLinked,filterMap:new Map(i),filterValueMap:new Map(i),model:void 0,columnMap:new Map,panelState:s}}componentDidMount(){this.isHidden()||(this.setState({isActive:!0}),this.initModel())}componentDidUpdate(e,n){const{inputFilters:s,source:i}=this.props,{columnMap:o,model:r,filterMap:l,filterValueMap:a,isLinked:d,settings:c}=this.state;!r||(o!==n.columnMap&&this.pruneFilterMaps(),s!==e.inputFilters&&this.updateChangedInputFilters(s,e.inputFilters),l!==n.filterMap?this.updateFilters():a!==n.filterValueMap&&this.updatePanelState(),c!==n.settings&&ah(r)&&(r.updateSettings(c),this.updatePanelState()),d!==n.isLinked?i&&(d?(this.startListeningToSource(i),this.updateModelFromSource()):this.stopListeningToSource(i)):d&&i!==e.source&&(e.source&&this.stopListeningToSource(e.source),i&&(this.startListeningToSource(i),this.updateModelFromSource())))}componentWillUnmount(){this.pending.cancel();const{source:e}=this.props;e&&this.stopListeningToSource(e)}initModel(){this.setState({isLoading:!0,isLoaded:!1,error:void 0});const{makeModel:e}=this.props;this.pending.add(e(),n=>{n.close()}).then(this.handleLoadSuccess,this.handleLoadError)}startListeningToSource(e){nn.debug("startListeningToSource",e),e.addEventListener(M.Table.EVENT_CUSTOMCOLUMNSCHANGED,this.handleSourceColumnChange),e.addEventListener(M.Table.EVENT_FILTERCHANGED,this.handleSourceFilterChange),e.addEventListener(M.Table.EVENT_SORTCHANGED,this.handleSourceSortChange)}stopListeningToSource(e){nn.debug("stopListeningToSource",e),e.removeEventListener(M.Table.EVENT_CUSTOMCOLUMNSCHANGED,this.handleSourceColumnChange),e.removeEventListener(M.Table.EVENT_FILTERCHANGED,this.handleSourceFilterChange),e.removeEventListener(M.Table.EVENT_SORTCHANGED,this.handleSourceSortChange)}loadModelIfNecessary(){const{isActive:e,isLoaded:n,isLoading:s}=this.state;e&&!n&&!s&&this.initModel()}isHidden(){const{glContainer:e}=this.props,{isHidden:n}=e;return n}handleColumnSelected(e){const{glEventHub:n}=this.props,{columnMap:s}=this.state;n.emit(Ki.COLUMN_SELECTED,this,s.get(e))}handleColumnMouseEnter({type:e,name:n}){const{columnSelectionValidator:s}=this.props;nn.debug("handleColumnMouseEnter",s,e,n),s&&s(this,{type:e,name:n})}handleColumnMouseLeave(){const{columnSelectionValidator:e}=this.props;nn.debug("handleColumnMouseLeave",e),e&&e(this,void 0)}handleDisconnect(){this.setState({error:new Error("Figure disconnected"),isDisconnected:!0})}handleFilterAdd(e){for(let n=0;n<e.length;n+=1)this.openInputFilter(e[n])}handleOpenLinker(){const{localDashboardId:e,setActiveTool:n,setDashboardIsolatedLinkerPanelId:s}=this.props;s(e,void 0),n(Yt.LINKER)}handleReconnect(){this.setState({isDisconnected:!1,error:void 0}),this.sendColumnChange(),this.updateColumnFilters()}handleLoadSuccess(e){nn.debug("handleLoadSuccess");const{model:n}=this.state;this.setState({model:e,isLoaded:!0},()=>{const{inputFilters:s,source:i}=this.props,{filterMap:o,isLinked:r}=this.state;e!==n&&(this.sendColumnChange(),this.updateColumnFilters(),this.updateInputFilters(s,o.size>0||e.isFilterRequired()),i&&r&&(this.startListeningToSource(i),this.updateModelFromSource()))})}handleLoadError(e){Te.isCanceled(e)||(nn.error("handleLoadError",e),this.setState({error:e,isLoading:!1}))}handleSourceColumnChange(){this.updateModelFromSource()}handleSourceFilterChange(){this.updateModelFromSource()}handleSourceSortChange(){this.updateModelFromSource()}updateModelFromSource(){const{metadata:e,source:n}=this.props,{isLinked:s,model:i}=this.state;if(!s||!i||!n){nn.debug2("updateModelFromSource ignoring",s,i,n);return}if(this.pending.cancel(),Vr(e)){const{settings:o}=e;this.pending.add(M.plot.Figure.create(xe.makeFigureSettings(o,n))).then(r=>{ah(i)&&i.setFigure(r)}).catch(this.handleLoadError)}this.updatePanelState()}updatePanelState(){const{sourcePanel:e}=this.props,{panelState:n,filterValueMap:s,settings:i}=this.state;let{tableSettings:o}=n!=null?n:{};if(e&&TE(e.props)&&EE(e.state)){const{inputFilters:r}=e.props,{panelState:l}=e.state;l!=null&&(o=ne.extractTableSettings(l,r))}this.setState({panelState:{settings:i,tableSettings:o,filterValueMap:Array.from(s)}})}handleError(){this.setState({isLoading:!1})}handleResize(){this.updateChart()}handleSettingsChanged(e){this.setState(({settings:n})=>{const s={...n,...e};return nn.debug("Updated settings",s),{settings:s}})}handleHide(){this.setActive(!1)}handleShow(){this.setActive(!0)}handleTabBlur(){this.setActive(!1)}handleTabFocus(){const e=this.isHidden();this.setActive(!e)}handleUpdate(){this.setState({isLoading:!1})}handleClearAllFilters(){this.setState({filterValueMap:new Map,filterMap:new Map}),this.updatePanelState()}openInputFilter(e){const{glEventHub:n}=this.props,{name:s,type:i}=e;n.emit(Pe.OPEN_INPUT,{title:`${s} Filter`,panelState:{name:s,type:i,isValueShown:!0},createNewStack:!0,focusElement:"input"})}setActive(e){this.setState({isActive:e},()=>{e&&(this.loadModelIfNecessary(),this.updateChart())})}sendColumnChange(){const{model:e}=this.state;if(!e)return;const{glEventHub:n}=this.props;n.emit(Pe.COLUMNS_CHANGED,this,Array.from(e.getFilterColumnMap().values()))}getCoordinateForColumn(e){var l;const n=Vo.makeButtonClassName(e);if(!this.panelContainer.current)return null;const s=this.panelContainer.current.querySelector(`.${n}`),i=(l=s==null?void 0:s.getBoundingClientRect())!=null?l:null;if(i==null||i.width<=0||i.height<=0)return null;const o=i.left+i.width/2,r=i.bottom;return[o,r]}setFilterMap(e){nn.debug("setFilterMap",e),this.setState(n=>{const{columnMap:s,filterMap:i}=n;let o=null;const r=new Map(n.filterValueMap);return e.forEach(({columnType:l,value:a},d)=>{const c=s.get(d);c==null||c.type!==l||(r.set(d,a),i.get(d)!==a&&(o===null&&(o=new Map(i)),o.set(d,a)))}),{filterValueMap:r,filterMap:o!=null?o:i}})}unsetFilterValue(e){this.setState(n=>{var a;const{inputFilters:s}=this.props,{columnMap:i}=n;let{filterMap:o,filterValueMap:r}=n;if(!r.has(e))return null;r=new Map(n.filterValueMap),r.delete(e);const l=this.getInputFilterColumnMap(i,s);if(l.has(e)){const d=o.get(e),c=(a=l.get(e))==null?void 0:a.value;c!=null&&d!==c&&(o=new Map(n.filterMap),c.length>0?o.set(e,c):o.delete(e))}else o=new Map(n.filterMap),o.delete(e);return{filterMap:o,filterValueMap:r}})}updateChangedInputFilters(e,n){const s=n.filter(o=>e.find(r=>r.name===o.name&&r.type===o.type)===void 0);s.length>0&&this.deleteInputFilters(s);const i=e.filter(o=>!n.includes(o));i.length>0&&this.updateInputFilters(i)}updateInputFilters(e,n=!1){this.setState(s=>{const{columnMap:i}=s,o=new Map(s.filterValueMap),r=new Map(s.filterMap),l=n?{filterMap:r,filterValueMap:o}:{};for(let a=0;a<e.length;a+=1){const{name:d,type:c,value:u}=e[a],m=i.get(d);m!=null&&m.type===c&&(u!=null&&r.get(d)!==u&&(u===""?r.delete(d):r.set(d,u),l.filterMap=r),o.has(d)&&(o.delete(d),l.filterValueMap=o))}return nn.debug("updateInputFilters",l),l})}deleteInputFilters(e,n=!1){this.setState(s=>{const{columnMap:i,filterValueMap:o}=s,r=new Map(s.filterMap);let l=n;for(let a=0;a<e.length;a+=1){const{name:d,type:c}=e[a],u=i.get(d);if(u!=null&&u.type===c&&r.has(d)){const m=r.get(d);if(o.has(d)){const p=o.get(d);p!==m&&p!=null&&(l=!0,r.set(d,p))}else l=!0,r.delete(d)}}return nn.debug("deleteInputFilters",l),l?{filterMap:r}:null})}updateColumnFilters(){this.setState(({model:e})=>e?{columnMap:e.getFilterColumnMap()}:null)}updateFilters(){const{columnMap:e,filterMap:n,model:s}=this.state;P(s);const i=this.getWaitingInputMap(s.isFilterRequired(),e,n);if(s.setFilter(n),n.size>0&&i.size===0){const o=s.getDefaultTitle(),r=on.join(Array.from(n.entries()).map(([l,a])=>`${l}: ${a}`));o?s.setTitle(`${o}<br><span style="font-size: smaller">${r}</span>`):s.setTitle(r),nn.debug2("updateFilters filters set",n),this.setState({isLoading:!0})}else nn.debug2("updateFilters waiting on inputs",i),s.setTitle(s.getDefaultTitle()),this.setState({isLoading:!1});this.updatePanelState()}pruneFilterMaps(){this.setState(e=>{const{columnMap:n}=e,s=new Map(e.filterMap),i=new Map(e.filterValueMap),o={};return e.filterValueMap.forEach((r,l)=>{n.has(l)||(i.delete(l),o.filterValueMap=i)}),e.filterMap.forEach((r,l)=>{n.has(l)||(s.delete(l),o.filterMap=s)}),o})}updateChart(){this.chart.current&&this.chart.current.updateDimensions()}render(){const{columnSelectionValidator:e,glContainer:n,glEventHub:s,inputFilters:i,isLinkerActive:o,links:r,metadata:l,settings:a}=this.props,{columnMap:d,filterMap:c,error:u,model:m,isActive:p,isDisconnected:g,isLoaded:f,isLoading:b}=this.state;let C;Vr(l)?C=l.table:C=l.figure;const w=this.getInputFilterColumnMap(d,i),T=this.getLinkedColumnMap(d,r),y=m!=null?this.getWaitingInputMap(m.isFilterRequired(),d,c):new Map,E=m!=null?this.getWaitingFilterMap(m.isFilterRequired(),d,c,T,w):new Map,I=u!=null?`Unable to open chart. ${u}`:void 0,D=y.size>0,F=d.size>0&&o;return h(Ul,{className:W("iris-chart-panel",{"input-required":D}),componentPanel:this,glContainer:n,glEventHub:s,onHide:this.handleHide,onClearAllFilters:this.handleClearAllFilters,onResize:this.handleResize,onShow:this.handleShow,onTabBlur:this.handleTabBlur,onTabFocus:this.handleTabFocus,errorMessage:I,isDisconnected:g,isLoading:b,isLoaded:f,widgetName:C,widgetType:"Chart",children:v("div",{ref:this.panelContainer,className:"chart-panel-container h-100 w-100",children:[h("div",{className:"chart-container h-100 w-100",children:f&&m&&h(mm,{isActive:p,model:m,settings:a,ref:this.chart,onDisconnect:this.handleDisconnect,onReconnect:this.handleReconnect,onUpdate:this.handleUpdate,onError:this.handleError,onSettingsChanged:this.handleSettingsChanged})}),h(ut,{in:D&&!F&&!b,timeout:It.transitionMs,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,children:h(_p,{inputFilterMap:w,linkedColumnMap:T,onAdd:this.handleFilterAdd,onOpenLinker:this.handleOpenLinker,columnMap:d,waitingFilterMap:E,waitingInputMap:y})}),h(ut,{in:F,timeout:It.transitionMs,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,children:h(Vo,{columns:this.getSelectorColumns(d,T,e),onColumnSelected:this.handleColumnSelected,onMouseEnter:this.handleColumnMouseEnter,onMouseLeave:this.handleColumnMouseLeave})})]})})}}$l.defaultProps={columnSelectionValidator:null,isLinkerActive:!1,source:null,sourcePanel:null,panelState:null,settings:{}};$l.displayName="ChartPanel";$l.COMPONENT="ChartPanel";const yE=(t,e)=>{const{localDashboardId:n,metadata:s}=e;let i;s!=null&&(i=s.sourcePanelId);const o=jd(t,n),r=jm(t,n),l=Nl(t),a=Qd(t,n),d=l===Yt.LINKER&&a===void 0;return{columnSelectionValidator:Zd(t,n),isLinkerActive:d,inputFilters:Xd(t,n),links:oo(t,n),source:i!=null?o.get(i):void 0,sourcePanel:i!=null?r.get(i):void 0,settings:xt(t)}},Bi=Ft(yE,{setActiveTool:Fl,setDashboardIsolatedLinkerPanelId:xp},null,{forwardRef:!0})($l);const Nr=X.module("CommandHistoryPanel"),kp=class extends S.exports.Component{constructor(t){super(t),this.handleFocusHistory=this.handleFocusHistory.bind(this),this.handleSessionOpened=this.handleSessionOpened.bind(this),this.handleSessionClosed=this.handleSessionClosed.bind(this),this.handleShow=this.handleShow.bind(this),this.handleSendToConsole=this.handleSendToConsole.bind(this),this.handleSendToNotebook=this.handleSendToNotebook.bind(this),this.container=Y.createRef(),this.pending=new fs;const{session:e,sessionId:n,language:s}=t;this.state={panelState:{},session:e,sessionId:n,language:s,contextActions:[{action:this.handleFocusHistory,shortcut:Bt.COMMAND_HISTORY.FOCUS_HISTORY}]}}static handleError(t){Nr.error(t)}componentDidMount(){const{glEventHub:t,session:e}=this.props;t.on(bt.FOCUS_HISTORY,this.handleFocusHistory),e!=null&&this.loadTable()}componentWillUnmount(){const{glEventHub:t}=this.props;t.off(bt.FOCUS_HISTORY,this.handleFocusHistory),this.pending.cancel()}handleFocusHistory(){this.container.current&&this.container.current.focus()}handleShow(){var t;(t=this.container.current)==null||t.restoreScrollPosition()}handleSessionOpened(t,{language:e,sessionId:n}){this.setState({session:t,sessionId:n,language:e},()=>{this.loadTable()})}handleSessionClosed(){this.pending.cancel(),this.setState({session:void 0,language:void 0,table:void 0})}handleSendToNotebook(t,e=!1){const{session:n,language:s}=this.state;if(Nr.debug("handleSendToNotebook",n,t),!n){Nr.error("Session is not connected.");return}const{glEventHub:i}=this.props;i.emit(e?He.CREATE_NOTEBOOK:He.SEND_TO_NOTEBOOK,n,s,t)}handleSendToConsole(t,e=!0,n=!1){Nr.debug("handleSendToConsole",t);const{glEventHub:s}=this.props;s.emit(bt.SEND_COMMAND,t,e,n)}loadTable(){const{commandHistoryStorage:t}=this.props,{language:e,sessionId:n}=this.state;P(e),P(n),this.pending.add(t.getTable(e,n,Date.now()),s=>s.close()).then(s=>{this.setState({table:s})}).catch(kp.handleError)}render(){const{glContainer:t,glEventHub:e,commandHistoryStorage:n}=this.props,{language:s,contextActions:i,table:o}=this.state;return v(jn,{className:"command-history-pane",componentPanel:this,glContainer:t,glEventHub:e,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,onShow:this.handleShow,children:[!o&&h("div",{className:"command-history-disconnected-message",children:"Waiting for console connection"}),o&&s!=null&&v(ye,{children:[h(Rl,{ref:this.container,language:s,sendToNotebook:this.handleSendToNotebook,sendToConsole:this.handleSendToConsole,table:o,commandHistoryStorage:n}),h(oe,{actions:i})]})]})}};let ec=kp;ec.COMPONENT="CommandHistoryPanel";ec.TITLE="Command History";const IE=(t,e)=>{const n=fm(t),s=gi(t,e.localDashboardId),{session:i,config:o}=s!=null?s:{},{type:r,id:l}=o!=null?o:{};return{commandHistoryStorage:n,language:r,session:i,sessionId:l}},ol=Ft(IE,null,null,{forwardRef:!0})(ec);const Fr=X.module("ConsolePanel"),RE=500,DE=Object.freeze({consoleSettings:{},itemIds:[]});class tc extends S.exports.PureComponent{constructor(e){super(e),this.savePanelState=je(()=>{const{consoleSettings:r,itemIds:l}=this.state,a={consoleSettings:r,itemIds:[...l]};Fr.debug("Saving panel state",a),this.setState({panelState:a})},RE),this.handleFocusCommandHistory=this.handleFocusCommandHistory.bind(this),this.handleOpenObject=this.handleOpenObject.bind(this),this.handleCloseObject=this.handleCloseObject.bind(this),this.handleResize=this.handleResize.bind(this),this.handleSettingsChange=this.handleSettingsChange.bind(this),this.handleShow=this.handleShow.bind(this),this.handlePanelMount=this.handlePanelMount.bind(this),this.consoleRef=Y.createRef();const{panelState:n}=e,s={...DE,...n||{}},{consoleSettings:i,itemIds:o}=s;this.state={consoleSettings:i,itemIds:new Map(o),objectMap:new Map,error:void 0,panelState:s}}componentDidMount(){const{glEventHub:e}=this.props;this.closeDisconnectedPanels(),e.on(Ie.MOUNT,this.handlePanelMount),this.subscribeToFieldUpdates()}componentDidUpdate(e,n){const{consoleSettings:s,itemIds:i}=this.state;(n.consoleSettings!==s||n.itemIds!==i)&&this.savePanelState()}componentWillUnmount(){var n;const{glEventHub:e}=this.props;this.savePanelState.flush(),e.off(Ie.MOUNT,this.handlePanelMount),(n=this.objectSubscriptionCleanup)==null||n.call(this)}subscribeToFieldUpdates(){const{sessionWrapper:e}=this.props,{session:n}=e;this.objectSubscriptionCleanup=n.subscribeToFieldUpdates(s=>{Fr.debug("Got updates",s),this.setState(({objectMap:i})=>{const{updated:o,created:r,removed:l}=s,a=[...o,...l],d=new Map(i);return a.forEach(u=>{const{title:m}=u;m!==void 0&&d.delete(m)}),[...o,...r].forEach(u=>{u.title!==void 0&&d.set(u.title,u)}),{objectMap:d}})})}setItemId(e,n){this.setState(({itemIds:s})=>{const i=new Map(s);return i.set(e,n),{itemIds:i}})}getItemId(e,n=!0){const{itemIds:s}=this.state;let i=s.get(e);return i==null&&n&&(i=ze.generate(),this.setItemId(e,i)),i}handleTabFocus(){var e;(e=this.consoleRef.current)==null||e.focus()}handlePanelMount(e){var o,r,l;const{itemIds:n}=this.state,s=(o=e==null?void 0:e.props)==null?void 0:o.id,i=(l=(r=e==null?void 0:e.props)==null?void 0:r.metadata)==null?void 0:l.sourcePanelId;s&&i&&new Set(n.values()).has(i)&&this.setItemId(s,s)}handleFocusCommandHistory(){const{glEventHub:e}=this.props;e.emit(bt.FOCUS_HISTORY)}handleResize(){this.updateDimensions()}handleShow(){this.updateDimensions()}handleOpenObject(e){const{sessionWrapper:n}=this.props,{session:s}=n;this.openWidget(e,s)}handleCloseObject(e){const{title:n}=e;if(n!==void 0){const s=this.getItemId(n,!1),{glEventHub:i}=this.props;i.emit(Ie.CLOSE,s)}}handleSettingsChange(e){const{glEventHub:n}=this.props;Fr.debug("handleSettingsChange",e),this.setState({consoleSettings:e}),n.emit(bt.SETTINGS_CHANGED,e)}openWidget(e,n){const{glEventHub:s}=this.props,{title:i}=e;P(i);const o=this.getItemId(i),r={fetch:()=>n.getObject(e),panelId:o,widget:e};Fr.debug("openWidget",r),s.emit(Ie.OPEN,r)}addCommand(e,n=!0,s=!1){var i;(i=this.consoleRef.current)==null||i.addCommand(e,n,s)}closeDisconnectedPanels(e=!1){const{consoleSettings:n,itemIds:s}=this.state,{isClosePanelsOnDisconnectEnabled:i=!0}=n;if(!i&&!e)return;const o=[...s.values()],{glEventHub:r}=this.props;o.forEach(l=>{r.emit(Ie.CLOSE,l)}),this.setState({itemIds:new Map})}updateDimensions(){var e;(e=this.consoleRef.current)==null||e.updateDimensions()}render(){const{commandHistoryStorage:e,glContainer:n,glEventHub:s,sessionWrapper:i,timeZone:o,unzip:r}=this.props,{consoleSettings:l,error:a,objectMap:d}=this.state,{config:c,session:u,connection:m}=i,{id:p,type:g}=c;return h(jn,{componentPanel:this,glContainer:n,glEventHub:s,onResize:this.handleResize,onShow:this.handleShow,onTabFocus:this.handleTabFocus,errorMessage:a!=null?`${a}`:void 0,children:u!=null&&h(Sd,{ref:this.consoleRef,settings:l,session:u,focusCommandHistory:this.handleFocusCommandHistory,openObject:this.handleOpenObject,closeObject:this.handleCloseObject,commandHistoryStorage:e,onSettingsChange:this.handleSettingsChange,language:g,statusBarChildren:v(ye,{children:[h("div",{children:"\xA0"}),h("div",{children:Ku.LANGUAGE_MAP.get(g)}),h("div",{children:"\xA0"}),h("div",{children:h(CS,{connection:m,defaultUpdateInterval:10*1e3,hoverUpdateInterval:3*1e3,monitorDuration:10*60*1e3})}),h("div",{children:"\xA0"})]}),scope:p,timeZone:o,objectMap:d,unzip:r})})}}tc.COMPONENT="ConsolePanel";tc.TITLE="Console";const ME=(t,e)=>({commandHistoryStorage:fm(t),sessionWrapper:gi(t,e.localDashboardId),timeZone:Ml(t)}),Li=Ft(ME,null,null,{forwardRef:!0})(tc);const bo=X.module("DropdownFilter"),NE=150,Ur=class extends S.exports.Component{constructor(t){super(t),this.getCompatibleColumns=pe((i,o)=>i!=null?o.filter(({type:r})=>r!==void 0&&L.isCompatibleType(r,i.columnType)):[]),this.getColumnOptions=pe((i,o)=>{let r=-1;const l=[];return l.push(h("option",{value:"-1",children:"Select a column"},"placeholder")),i.forEach((a,d)=>{l.push(h("option",{value:d,children:this.getItemLabel(i,d)},`${a.name}/${a.type}`)),o!==null&&a.name===o.name&&a.type===o.type&&(r=d)}),[l,r]}),this.getSelectedOptionIndex=pe((i,o)=>i.indexOf(o)),this.getValueOptions=pe(i=>[h("option",{value:"-1",children:Ur.PLACEHOLDER},"-1"),...i.map((o,r)=>h("option",{value:r,children:o},`${r}/${o}`))]),this.getItemLabel=ve((i,o)=>{const{name:r,type:l}=i[o];if(o>0&&i[o-1].name===r||o<i.length-1&&i[o+1].name===r){const a=l.substring(l.lastIndexOf(".")+1);return`${r} (${a})`}return r}),this.sendUpdate=je(()=>{const{onChange:i}=this.props,{column:o,value:r,isValueShown:l}=this.state;i({column:o,isValueShown:l,value:r!=null?r:void 0})},NE),this.handleColumnChange=this.handleColumnChange.bind(this),this.handleSettingsCancel=this.handleSettingsCancel.bind(this),this.handleSettingsClick=this.handleSettingsClick.bind(this),this.handleSettingsSave=this.handleSettingsSave.bind(this),this.handleBackgroundClick=this.handleBackgroundClick.bind(this),this.handleDropdownKeyPress=this.handleDropdownKeyPress.bind(this),this.handleValueChange=this.handleValueChange.bind(this),this.dropdownRef=Y.createRef();const{column:e,isValueShown:n,value:s}=t;this.state={column:e,selectedColumn:e,disableCancel:!n,isValueShown:n,value:s}}componentDidUpdate(t,e){const{source:n,values:s,isLoaded:i}=this.props,{column:o,value:r,isValueShown:l}=this.state;i&&(n!==t.source&&this.sourceUpdated(),s!==t.values&&r!==""&&!s.includes(r)&&this.resetValue(),l!==e.isValueShown&&l&&this.focusInput(),(o!==e.column||r!==e.value||l!==e.isValueShown)&&this.sendUpdate())}componentWillUnmount(){this.sendUpdate.flush()}handleColumnChange(t){const{value:e}=t.target;if(bo.debug2("handleColumnChange",e),e!=null&&parseInt(e,10)<0){this.setState({selectedColumn:null});return}const{columns:n,source:s}=this.props,i=this.getCompatibleColumns(s,n);this.setState({selectedColumn:i[parseInt(e,10)]})}handleDropdownKeyPress(t){t.key==="Enter"&&(t.preventDefault(),t.stopPropagation(),bo.debug2("handleDropdownKeyPress"),this.sendUpdate(),this.sendUpdate.flush())}handleValueChange(t){const{value:e}=t.target,n=parseInt(e,10);let s="";const{values:i}=this.props;if(n===-1)bo.debug2("Selected default item");else if(n>=0&&n<i.length)s=i[n];else{bo.error("Invalid index",n,i);return}bo.debug2("handleValueChange",s),this.setState({value:s})}handleSettingsCancel(){this.setState(({column:t})=>({selectedColumn:t,isValueShown:!0}))}handleSettingsSave(){this.setState(({column:t,selectedColumn:e,value:n})=>({column:e,value:t===e?n:"",isValueShown:!0,disableCancel:!1}))}handleSettingsClick(t){t.stopPropagation(),this.showSettings()}handleBackgroundClick(t){t.target!==this.dropdownRef.current&&this.focusInput()}handleMouseEnter(){const{onSourceMouseEnter:t}=this.props;t()}handleMouseLeave(){const{onSourceMouseLeave:t}=this.props;t()}sourceUpdated(){this.setState({column:null,selectedColumn:null,isValueShown:!1,disableCancel:!0,value:""})}showSettings(){const{column:t}=this.state;this.setState({selectedColumn:t,isValueShown:!1})}focusInput(){this.dropdownRef.current!==null&&this.dropdownRef.current.focus()}resetValue(){this.setState({value:""})}clearFilter(){this.resetValue()}setFilterState({name:t,type:e,value:n,isValueShown:s}){const i=t!=null&&e!=null?{name:t,type:e}:null;this.setState({column:i,value:n,isValueShown:s})}render(){var U;const{columns:t,disableLinking:e,isLinkerActive:n,isLoaded:s,source:i,onColumnSelected:o,onSourceMouseEnter:r,onSourceMouseLeave:l,values:a,settingsError:d}=this.props,{column:c,disableCancel:u,isValueShown:m,selectedColumn:p,value:g}=this.state,f=i===null,b=this.getCompatibleColumns(i,t),C=i!=null,w=(U=i==null?void 0:i.columnName)!=null?U:Ur.SOURCE_BUTTON_PLACEHOLDER,T=c!=null?`${c.name} Filter`:null,[y,E]=this.getColumnOptions(b,p),I=this.getValueOptions(a),D=this.getSelectedOptionIndex(a,g),F=!C||p==null;return v(rd,{className:"dropdown-filter fill-parent-absolute",isFlipped:m&&!n,children:[h("div",{className:"dropdown-filter-settings-card",children:v("div",{className:"dropdown-filter-card-content",children:[v("div",{className:"dropdown-filter-settings-grid",children:[h("label",{children:"Source Column"}),h(Tl,{isLinked:C,onClick:o,onMouseEnter:r,onMouseLeave:l,className:Ur.SOURCE_BUTTON_CLASS_NAME,disabled:e,children:w}),h("div",{className:"text-muted small",children:"Select a source column for the list by linking to a table."}),h("label",{children:"Filter Column"}),h("select",{value:E,className:"custom-select",onChange:this.handleColumnChange,disabled:f,children:y}),h("div",{className:"text-muted small",children:"Dropdown filter control will apply its filter to all columns matching this name in this dashboard."})]}),d&&h("div",{className:"error-message text-center",children:d}),C&&v("div",{className:"dropdown-filter-settings-buttons",children:[h(z,{kind:"secondary",type:"button",onClick:this.handleSettingsCancel,disabled:u||m||n,tooltip:n?"Cancel disabled while linker open":void 0,children:"Cancel"}),h(z,{kind:"primary",type:"button",className:"ml-2",onClick:this.handleSettingsSave,disabled:F||m||n,tooltip:n?"Save disabled while linker open":void 0,children:"Save"})]})]})}),h("div",{className:"dropdown-filter-value-card",onClick:this.handleBackgroundClick,children:s&&v(ye,{children:[h("div",{className:"dropdown-filter-column",children:h("div",{className:"dropdown-filter-column-title",children:T})}),v("div",{className:"dropdown-filter-card-content",children:[h("div",{className:"dropdown-filter-value-input d-flex flex-column justify-content-center",children:h("select",{className:"custom-select",value:D,ref:this.dropdownRef,onChange:this.handleValueChange,onKeyPress:this.handleDropdownKeyPress,children:I})}),d&&h("div",{className:"error-message mt-3 text-center",children:d})]}),h("div",{className:"dropdown-filter-menu",children:h(z,{kind:"ghost",className:"m-2 px-2",onClick:this.handleSettingsClick,icon:h(j,{icon:Go,transform:"grow-4"}),tooltip:"Dropdown Filter Settings"})})]})})]})}};let qi=Ur;qi.defaultProps={column:null,disableLinking:!1,isLinkerActive:!1,isLoaded:!1,isValueShown:!1,settingsError:null,source:null,value:"",values:[],onColumnSelected:()=>{},onSourceMouseEnter:()=>{},onSourceMouseLeave:()=>{}};qi.PLACEHOLDER="Select a value...";qi.SOURCE_BUTTON_CLASS_NAME="btn-dropdown-filter-selector";qi.SOURCE_BUTTON_PLACEHOLDER="Select a column";const nt=X.module("DropdownFilterPanel"),FE=250,ti=class extends S.exports.Component{constructor(t){super(t),this.getCachedValues=pe((d,{type:c,name:u},m)=>c!==void 0&&L.isDateType(c)?d.map(p=>ti.DATETIME_FORMATTER.format(p)):d.map(p=>p!=null&&c!=null?m.getFormattedString(p,c,u):null)),this.getCachedPanelLinks=pe((d,c)=>{const u=te.getIdFromPanel(c);return nt.debug("getCachedPanelLinks",d,u),d.filter(m=>{var p;return((p=m.end)==null?void 0:p.panelId)===u})}),this.getCachedSource=pe(d=>{nt.debug("getCachedSource",d);let c;if(d.length>0){const[u]=d;c=u.start,d.length>1&&nt.error("Filter has more that one link",d)}return c}),this.getCachedSourceTable=pe((d,c)=>{var m;if(nt.debug("getCachedSourceTable",d,c),c==null)return null;const{panelId:u}=c;return(m=d.get(u))!=null?m:null}),this.getCachedSourceColumn=pe((d,c)=>{var u;return nt.debug("getCachedSourceColumn",d,c),d==null||c==null?null:(u=d.columns.find(({name:m,type:p})=>m===c.columnName&&p===c.columnType))!=null?u:null}),this.handleChange=je(this.handleChange.bind(this),FE),this.handleClearAllFilters=this.handleClearAllFilters.bind(this),this.handleDisconnect=this.handleDisconnect.bind(this),this.handleReconnect=this.handleReconnect.bind(this),this.handleColumnSelected=this.handleColumnSelected.bind(this),this.handleSourceFilterChange=this.handleSourceFilterChange.bind(this),this.handleSourceSortChange=this.handleSourceSortChange.bind(this),this.handleSourceSizeChange=this.handleSourceSizeChange.bind(this),this.handleSourceMouseEnter=this.handleSourceMouseEnter.bind(this),this.handleSourceMouseLeave=this.handleSourceMouseLeave.bind(this),this.handleValuesTableUpdate=this.handleValuesTableUpdate.bind(this),this.dropdownFilterRef=Y.createRef(),this.panelContainer=Y.createRef(),this.pending=new fs;const{panelState:e,settings:n}=t;this.columnFormats=hs.getColumnFormats(n);const{value:s="",isValueShown:i=!1,name:o,type:r,timestamp:l}=e!=null?e:{},a=o!=null&&r!=null?{name:o,type:r}:void 0;this.state={column:a,formatter:new un(this.columnFormats),valuesTable:void 0,valuesColumn:void 0,sourceSize:0,value:s,timestamp:l,values:[],isValueShown:i,wasFlipped:!1,skipUpdate:!1,panelState:e,isDisconnected:!1,isLoading:!1,isLoaded:!1,error:null}}componentDidMount(){this.updateValuesTable();const{column:t,value:e,timestamp:n}=this.state,s=this.getSourceTable();if(s!==null&&this.startListeningToSource(s),t!=null){const{name:i,type:o}=t;this.sendUpdate(i,o,e,n)}}componentDidUpdate(t,e){const{valuesTable:n}=this.state,{settings:s}=this.props,i=this.getSource(),o=this.getSourceTable(),r=this.getSource(t),l=this.getSourceTable(t);s!==t.settings&&s!==void 0&&this.updateFormatterSettings(s),n!==e.valuesTable&&e.valuesTable!=null&&(nt.debug("Table in state modified, closing the old table."),e.valuesTable.close()),(o!==l||i!==r)&&this.updateValuesTable(),o!==l&&(l!==null&&this.stopListeningToSource(l),o!==null&&this.startListeningToSource(o))}componentWillUnmount(){const{valuesTable:t}=this.state,e=this.getSourceTable();this.pending.cancel(),e!==null&&this.stopListeningToSource(e),this.cleanup&&this.cleanup(),t!=null&&t.close()}getCoordinateForColumn(){var i;if(this.panelContainer.current==null)return null;const t=this.panelContainer.current.querySelector(`.${qi.SOURCE_BUTTON_CLASS_NAME}`),e=(i=t==null?void 0:t.getBoundingClientRect())!=null?i:null;if(e==null||e.width<=0||e.height<=0)return null;const n=e.left+e.width/2,s=e.bottom;return[n,s]}getSettingsErrorMessage(){const{sourceSize:t}=this.state;if(t>ti.MAX_TABLE_SIZE)return`Table too large, must have fewer than ${ti.MAX_TABLE_SIZE} options.`}getPanelErrorMessage(){const{error:t}=this.state;return t!=null?`${t}`:void 0}getSource(t=this.props){const{dashboardLinks:e}=t,n=this.getCachedPanelLinks(e,this);return this.getCachedSource(n)}getSourceTable(t=this.props){const{panelTableMap:e}=t,n=this.getSource(t);return this.getCachedSourceTable(e,n)}getValuesColumn(t){const e=this.getSource();return this.getCachedSourceColumn(t,e)}startListeningToSource(t){nt.debug("startListeningToSource"),t.addEventListener(M.Table.EVENT_FILTERCHANGED,this.handleSourceFilterChange),t.addEventListener(M.Table.EVENT_SORTCHANGED,this.handleSourceSortChange),t.addEventListener(M.Table.EVENT_SIZECHANGED,this.handleSourceSizeChange),t.addEventListener(M.Table.EVENT_DISCONNECT,this.handleDisconnect),t.addEventListener(M.Table.EVENT_RECONNECT,this.handleReconnect)}stopListeningToSource(t){nt.debug("stopListeningToSource"),t.removeEventListener(M.Table.EVENT_FILTERCHANGED,this.handleSourceFilterChange),t.removeEventListener(M.Table.EVENT_SORTCHANGED,this.handleSourceSortChange),t.removeEventListener(M.Table.EVENT_SIZECHANGED,this.handleSourceSizeChange),t.removeEventListener(M.Table.EVENT_DISCONNECT,this.handleDisconnect),t.removeEventListener(M.Table.EVENT_RECONNECT,this.handleReconnect)}handleChange({column:t,isValueShown:e=!1,value:n}){const{name:s=void 0,type:i=void 0}=t!=null?t:{};let o=!0,r=Date.now();this.setState(({panelState:l,timestamp:a,wasFlipped:d,skipUpdate:c})=>{var m;const u=l!=null&&e!==l.isValueShown&&s===l.name&&i===l.type&&n===l.value;return o=(m=!c&&e&&(!u||!d))!=null?m:!1,o||(r=a),{panelState:{isValueShown:e,name:s,type:i,value:n,timestamp:r!=null?r:void 0},timestamp:r,wasFlipped:u,skipUpdate:!1}},()=>{o&&this.sendUpdate(s!=null?s:null,i,n,r)})}handleDisconnect(){this.setState({error:new Error("Table disconnected"),isDisconnected:!0,isLoading:!1})}handleReconnect(){this.setState({isDisconnected:!1,error:null})}handleSourceFilterChange(){this.applySourceFilters()}handleSourceSortChange(){this.applySourceSorts()}handleSourceSizeChange({detail:t}){this.setState({sourceSize:t})}handleColumnSelected(){nt.debug("handleColumnSelected");const{glEventHub:t}=this.props;t.emit(Pe.COLUMN_SELECTED,this,ti.SOURCE_COLUMN)}handleClearAllFilters(){var t,e;(e=(t=this.dropdownFilterRef)==null?void 0:t.current)==null||e.clearFilter()}setPanelState(t,e=!1){var n,s;if(this.getSource()==null){nt.debug("Ignore state update for unlinked filter",t);return}this.setState({skipUpdate:!e}),(s=(n=this.dropdownFilterRef)==null?void 0:n.current)==null||s.setFilterState(t)}sendUpdate(t,e,n,s){var l;const{glEventHub:i}=this.props,o=(l=this.getSource())==null?void 0:l.panelId,r=o===null?[]:[o];nt.debug("sendUpdate",{name:t,type:e,value:n,timestamp:s,excludePanelIds:r}),i.emit(Pe.FILTERS_CHANGED,this,{name:t,type:e,value:n!=null?n:"=null",timestamp:s,excludePanelIds:r})}updateValuesTable(){const t=this.getSource(),e=this.getSourceTable();if(nt.debug("updateValuesTable",t,e),this.setState({values:[],valuesTable:void 0,error:null}),t==null){nt.debug("Filter unlinked."),this.setState({isLoading:!1,isLoaded:!0,isValueShown:!1,sourceSize:0});return}this.setState({isLoading:!0}),e!=null&&(this.setState({isLoaded:!1,sourceSize:e.size}),this.pending.add(e.copy(),n=>n.close()).then(n=>{this.updateViewportListener(n),this.setState({valuesTable:n})}).catch(n=>{Te.isCanceled(n)||(nt.error(n),this.setState({isLoading:!1,error:n}))}))}applySourceSorts(){const{valuesTable:t}=this.state,e=this.getSourceTable();if(nt.debug("applySourceSorts",e==null?void 0:e.sort),t==null||e==null){nt.debug("Table not initialized");return}const n=[...e.sort];t.applySort(n),this.setViewport(t)}applySourceFilters(){const{valuesTable:t}=this.state,e=this.getSourceTable();if(nt.debug("applySourceFilters",e==null?void 0:e.filter),t==null||e==null){nt.debug("Table not initialized");return}const n=[...e.filter];t.applyFilter(n),this.setViewport(t)}updateViewportListener(t){if(nt.debug("updateViewportListener",t==null?void 0:t.size),this.cleanup&&this.cleanup(),t==null){this.cleanup=void 0;return}this.cleanup=t.addEventListener(M.Table.EVENT_UPDATED,this.handleValuesTableUpdate),this.setViewport(t)}setViewport(t){const e=this.getValuesColumn(t);if(!e){nt.error("values column is null");return}t.setViewport(0,ti.MAX_TABLE_SIZE-1,[e])}updateFormatterSettings(t){const e=hs.getColumnFormats(t);ht(this.columnFormats,e)||(this.columnFormats=e,this.setState({formatter:new un(e)}))}handleValuesTableUpdate({detail:t}){const{rows:e}=t,{valuesTable:n}=this.state;if(!n){nt.error("valuesTable is null");return}const s=this.getValuesColumn(n);if(!s){nt.error("Values column not found");return}const i=e.map(o=>o.get(s));this.setState({values:i,isLoading:!1,isLoaded:!0,valuesColumn:s})}handleSourceMouseEnter(){const{columnSelectionValidator:t}=this.props;!t||t(this,ti.SOURCE_COLUMN)}handleSourceMouseLeave(){const{columnSelectionValidator:t}=this.props;!t||t(this,void 0)}render(){const{columns:t,disableLinking:e,glContainer:n,glEventHub:s,isLinkerActive:i}=this.props,{column:o,formatter:r,isDisconnected:l,isValueShown:a,value:d,values:c,valuesColumn:u,isLoading:m,isLoaded:p}=this.state,g=this.getSource(),f=this.getSettingsErrorMessage(),b=this.getPanelErrorMessage(),C=p&&u!=null?this.getCachedValues(c,u,r):[];return h(Ul,{errorMessage:b,isLoading:m,isLoaded:p,isDisconnected:l,className:"iris-dropdown-filter-panel",componentPanel:this,glContainer:n,glEventHub:s,onClearAllFilters:this.handleClearAllFilters,widgetName:"Dropdown Filter",widgetType:"DropdownFilter",children:h("div",{ref:this.panelContainer,className:"dropdown-filter-container h-100 w-100 container",children:h(qi,{ref:this.dropdownFilterRef,column:o,columns:t,isValueShown:a,isLinkerActive:i,disableLinking:e,isLoaded:p,settingsError:f,source:g,value:d,values:C,onChange:this.handleChange,onColumnSelected:this.handleColumnSelected,onSourceMouseEnter:this.handleSourceMouseEnter,onSourceMouseLeave:this.handleSourceMouseLeave})})})}};let ro=ti;ro.displayName="DropdownFilterPanel";ro.COMPONENT="DropdownFilterPanel";ro.MAX_TABLE_SIZE=256;ro.DATETIME_FORMATTER=new dt({showTimeZone:!1,showTSeparator:!0,defaultDateTimeFormatString:"yyyy-MM-dd HH:mm:ss.SSSSSSSSS"});ro.SOURCE_COLUMN=Object.freeze({name:"FilterSource",type:null});const xE=(t,e)=>{const{localDashboardId:n}=e,s=te.getIdFromPanel({props:e}),i=jd(t,n),o=oo(t,n),r=Nl(t),l=Qd(t,n),a=r===Yt.LINKER&&(l===void 0||l===s),d=r===Yt.LINKER&&l!==void 0&&l!==s;return{columns:Fp(t,n),columnSelectionValidator:Zd(t,n),isLinkerActive:a,disableLinking:d,settings:xt(t),panelTableMap:i,dashboardLinks:o}},ci=Ft(xE,null,null,{forwardRef:!0})(ro);function qn(t){return t.type==="directory"}var Op=(t=>(t.GROOVY="text/x-groovy",t.PLAIN_TEXT="text/plain",t.PYTHON="text/x-python",t.PYTHON_COMPILED="application/x-python-code",t.SCALA="text/x-scala",t.UNKNOWN="",t))(Op||{});class ce{static fileExtensionToString(e=""){return e.length===0?"":`.${e}`}static getDepth(e){var s;if(!ce.hasPath(e))throw new Error(`Invalid path provided: ${e}`);return((s=e.match(/\//g))!=null?s:[]).length-1}static getExtension(e){var s;const n=this.getBaseName(e).split(".");return n.length>1&&(s=n.pop())!=null?s:""}static getBaseName(e){var n;return(n=e.split("/").pop())!=null?n:""}static getCopyFileName(e){const n=e.lastIndexOf(".");let s=null,i=null;n<0?i=e:(i=e.substring(0,n),s=e.substring(n+1));const o=i?`${i}-copy`:"Copy";return s!==null?`${o}.${s}`:o}static getMimeType(e){switch(this.getExtension(e).toLowerCase()){case"groovy":return"text/x-groovy";case"py":return"text/x-python";case"pyc":return"application/x-python-code";case"scala":return"text/x-scala";case"txt":return"text/plain";default:return""}}static getParent(e){if(!ce.hasPath(e))throw new Error(`Invalid name provided: ${e}`);const n=e.split("/");for(;n.pop()==="";);if(n.length===0)throw new Error(`No parent for path provided: ${e}`);return`${n.join("/")}/`}static getPath(e){if(!ce.hasPath(e))throw new Error(`Invalid filename provided: ${e}`);const n=e.split("/");return n.pop(),`${n.join("/")}/`}static hasPath(e){return e.startsWith("/")}static isPath(e){return e.startsWith("/")&&e.endsWith("/")}static makePath(e){return e.endsWith("/")?e:`${e}/`}static replaceExtension(e,n=""){const s=e.lastIndexOf("."),i=s>-1?e.substring(0,s):e,o=ce.fileExtensionToString(n);return`${i}${o}`}static validateName(e){var o,r;const n=[".",".."],s=/[\\/\0]/g,i=new Map([["\0","null"]]);if(!e)throw new Hi("Name cannot be empty");if(n.includes(e))throw new Hi(`"${e}" is a reserved name`);if(s.test(e))throw new Hi(`Invalid characters in name: "${(r=(o=e.match(s))==null?void 0:o.reduce((l,a)=>l.includes(a)?l:[...l,a],[]).map(l=>i.has(l)?i.get(l):l).join('", "'))!=null?r:""}"`)}static reducePaths(e){const n=e.filter(s=>ce.isPath(s));return e.filter(s=>!n.some(i=>s!==i&&s.startsWith(i)))}static removeRoot(e,n){if(e.length===0)return n;if(!n.startsWith(e))throw new Error(`Filename ${n} does not start with expected root ${e}`);return n.substring(e.length)}static addRoot(e,n){return`${e}${n}`}}const At=X.module("FileList"),Ga=t=>qn(t)?ce.makePath(t.filename):ce.getPath(t.filename),nc=26,_E=500,kh="item-list-scroll-pane",Ka=t=>{var I;const{children:e,draggedItems:n,isDragInProgress:s,isDropTargetValid:i,isSelected:o,item:r,itemIndex:l,dropTargetItem:a,onDragStart:d,onDragOver:c,onDragEnd:u,onDrop:m}=t,p=(I=n==null?void 0:n.some(D=>D.id===r.id))!=null?I:!1,g=Ga(r),f=s&&a?Ga(a):null,b=s&&i&&qn(r)&&f===g,C=s&&i&&f===g,w=s&&!i&&f===g,T=kE(r),y=ce.getDepth(r.filename),E=Array(y).fill(null).map((D,F)=>h("span",{className:"file-list-depth-line"},F));return v("div",{className:W("d-flex w-100 align-items-center","file-list-item",{"is-dragged":p,"is-exact-drop-target":b,"is-in-drop-target":C,"is-invalid-drop-target":w,"is-selected":o}),onDragStart:D=>d(l,D),onDragOver:D=>c(l,D),onDragEnd:D=>u(l,D),onDrop:D=>m(l,D),draggable:!0,role:"presentation","aria-label":r.basename,children:[E," ",h(j,{icon:T,className:"item-icon",fixedWidth:!0})," ",v("span",{className:"truncation-wrapper",children:[e!=null?e:r.basename,h(Ue,{options:{modifiers:{preventOverflow:{boundariesElement:"window"}},placement:"left"},children:e!=null?e:r.basename})]})]})};function kE(t){if(qn(t))return t.isExpanded?Rf:Df;switch(ce.getMimeType(t.basename)){case Op.PYTHON:return lC;default:return Tf}}function Oh(t,e){if(t.length===0||e==null)throw new Error("No items to move");const n=Ga(e);if(t.some(({filename:s})=>ce.getPath(s)===n))throw new Error("File already in the destination folder");if(t.some(s=>qn(s)&&n.startsWith(ce.makePath(s.filename))))throw new Error("Destination folder cannot be a child of a dragged folder");return{files:t,targetPath:n}}function OE(t){const{isMultiSelect:e=!1,table:n,onFocusChange:s=()=>{},onMove:i,onSelect:o,onSelectionChange:r=()=>{},renderItem:l=Ka,rowHeight:a=nc,overscanCount:d=bn.DEFAULT_OVERSCAN}=t,[c,u]=S.exports.useState(()=>({items:[],offset:0,itemCount:0})),[m,p]=S.exports.useState({top:0,bottom:0}),[g,f]=S.exports.useState(),[b,C]=S.exports.useState(),[w,T]=S.exports.useState(),[y,E]=S.exports.useState([]),I=S.exports.useRef(null),D=S.exports.useRef(null),F=S.exports.useCallback(ee=>{if(ee.length===0||c==null)return[];const ue=[];for(let Se=0;Se<ee.length;Se+=1){const Me=ee[Se];for(let qe=Me[0];qe<=Me[1];qe+=1)qe>=c.offset&&qe<c.offset+c.items.length&&ue.push(c.items[qe-c.offset])}return ue},[c]),x=S.exports.useCallback(ee=>{const ue=F([[ee,ee]]);if(ue.length>0)return ue[0]},[F]),U=S.exports.useCallback(()=>{const ee=fn.count(y);if(ee===0)return null;if(ee===1){const ue=y[0][0],Se=x(ue);if(Se!=null)return Se.filename}return`${ee} items`},[x,y]),B=S.exports.useCallback(ee=>{var ue;if(!(!b||!g)){At.debug("dropItems",b,"to",ee);try{const{files:Se,targetPath:Me}=Oh(b,g);i(Se,Me),ee!=null&&(E([[ee,ee]]),(ue=I.current)==null||ue.focusItem(ee))}catch(Se){At.error("Unable to complete move",Se)}}},[b,g,i]),_=S.exports.useCallback((ee,ue)=>{const Se=c.items[ee-c.offset];Se!==void 0&&(At.debug("handleItemClick",Se),o(Se,ue),qn(Se)&&(n==null||n.setExpanded(Se.filename,!Se.isExpanded)))},[c,o,n]),H=S.exports.useCallback((ee,ue)=>{var qe;At.debug2("handleItemDragStart",ee,y);let Se=y;fn.isSelected(y,ee)||(Se=[[ee,ee]],E(Se)),C(F(Se)),(qe=I.current)==null||qe.resetMouseState();const Me=document.createElement("div");Me.innerHTML=`<div class="dnd-placeholder-content">${U()}</div>`,Me.className="file-list-dnd-placeholder",document.body.appendChild(Me),ue.dataTransfer.setDragImage(Me,0,0),ue.dataTransfer.effectAllowed="move",T(Me)},[U,F,y]),A=S.exports.useCallback((ee,ue)=>{ue.preventDefault(),At.debug2("handleItemDragOver",ue),f(x(ee))},[x]),N=S.exports.useCallback((ee,ue)=>{At.debug("handleItemDragEnd",ee),w==null||w.remove(),C(void 0),f(void 0),T(void 0)},[w]),k=S.exports.useCallback((ee,ue)=>{B(ee)},[B]),O=S.exports.useCallback(()=>{At.debug2("handleItemDragExit"),f(void 0)},[]),V=S.exports.useCallback(ee=>{ee.target instanceof Element&&ee.target.classList.contains(kh)&&(ee.preventDefault(),At.debug2("handleListDragOver",ee),f({type:"directory",filename:"/",basename:"/",id:"/"}))},[]),G=S.exports.useCallback(ee=>{ee.target instanceof Element&&ee.target.classList.contains(kh)&&(At.debug("handleListDrop"),B())},[B]),Q=S.exports.useCallback(ee=>{if(At.debug2("handleSelectionChange",ee),ee!==y){E(ee);const ue=F(ee);r(ue)}},[F,r,y]),Z=S.exports.useCallback(ee=>{if(At.debug2("handleFocusChange",ee),ee!=null){const[ue]=F([[ee,ee]]);s(ue)}else s()},[F,s]),be=S.exports.useCallback((ee,ue)=>{At.debug("handleViewportChange",ee,ue),(ee!==m.top||ue!==m.bottom)&&p({top:ee,bottom:ue})},[m]),le=S.exports.useMemo(()=>{if(!b||!g)return!1;try{return Oh(b,g),At.debug("handleValidateDropTarget true"),!0}catch{return At.debug("handleValidateDropTarget false"),!1}},[b,g]),{focusedPath:he}=t;S.exports.useEffect(()=>{he!==void 0&&(he==="/"?n.collapseAll():(n.setExpanded(he,!1),n.setExpanded(he,!0)))},[n,he]),S.exports.useEffect(function(){At.debug("updating table viewport",m),n==null||n.setViewport({top:Math.max(0,m.top-d),bottom:m.bottom+d})},[d,n,m]),S.exports.useEffect(function(){const ue=n.onUpdate(Se=>{u({items:Se.items.map(Me=>({...Me,itemName:Me.basename})),offset:Se.offset,itemCount:n.size})});return()=>{ue()}},[n]),S.exports.useEffect(function(){if(g!=null&&qn(g)&&g.filename!=="/"){const ue=setTimeout(()=>{g.isExpanded||n==null||n.setExpanded(g.filename,!0)},_E);return()=>clearTimeout(ue)}},[g,n]);const De=S.exports.useCallback(ee=>l({...ee,isDragInProgress:b!=null,dropTargetItem:g,draggedItems:b,isDropTargetValid:le,onDragStart:H,onDragEnd:N,onDragOver:A,onDragExit:O,onDrop:k}),[N,O,A,H,k,b,g,le,l]);return h("div",{ref:D,className:W("file-list",{"is-dragging":b!=null}),onDragOver:V,onDrop:G,children:h(bn,{ref:I,items:c.items,itemCount:c.itemCount,offset:c.offset,onFocusChange:Z,onSelect:_,onSelectionChange:Q,onViewportChange:be,selectedRanges:y,renderItem:De,rowHeight:a,isMultiSelect:e,isDragSelect:!1,isDeselectOnClick:!1})})}const LE={name:"File Explorer",DELETE:Ae.createAndAdd({id:"FILE_EXPLORER.DELETE",name:"Delete",shortcut:[me.DELETE],macShortcut:[de.CMD,me.BACKSPACE]}),RENAME:Ae.createAndAdd({id:"FILE_EXPLORER.RENAME",name:"Rename",shortcut:[me.ENTER],macShortcut:[me.ENTER]})},Lh={FILE_EXPLORER:LE};const Ah=X.module("FileListItemEditor"),AE=()=>Promise.resolve();function PE({item:t,onCancel:e,onSubmit:n,validate:s=AE}){const i=S.exports.useRef(null),[o,r]=S.exports.useState(t.basename),[l,a]=S.exports.useState(),[d,c]=S.exports.useState(Promise.resolve()),u=S.exports.useCallback(()=>{var C;(C=i.current)==null||C.focus()},[i]),m=S.exports.useCallback(C=>C.stopPropagation(),[]),p=S.exports.useCallback(()=>{d.then(()=>{n(o)}).catch(C=>Ah.info("Unable to validate name",C))},[n,o,d]);S.exports.useEffect(function(){const w=Te.makeCancelable(s(o));return w.then(()=>a(void 0)).catch(T=>{Te.isCanceled(T)||a(T)}),c(w),()=>w.cancel()},[s,o]),S.exports.useEffect(function(){u()},[u]);const g=S.exports.useCallback(()=>{Ah.debug2("handleBlur"),p()},[p]),f=S.exports.useCallback(C=>{const{value:w}=C.target;r(w)},[]),b=S.exports.useCallback(C=>{C.stopPropagation();const{key:w}=C;switch(w){case"Enter":{p();break}case"Escape":{e();break}}},[e,p]);return v("div",{className:"file-list-item-editor",children:[h("input",{type:"text",className:W("form-control file-list-item-editor-input",{"is-invalid":l}),value:o,ref:i,onBlur:g,onKeyDown:b,onChange:f,onClick:m,onDoubleClick:m,onMouseDown:m}),l&&h("div",{className:"invalid-feedback",children:`${l}`})]})}function Lp(t){const{isMultiSelect:e=!1,focusedPath:n,showContextMenu:s=!1,onCreateFile:i,onCreateFolder:o,onCopy:r,onDelete:l,onMove:a=()=>{},onRename:d,onSelect:c,onSelectionChange:u,table:m,rowHeight:p=nc,validateRename:g=()=>Promise.resolve()}=t,[f,b]=S.exports.useState(),[C,w]=S.exports.useState([]),[T,y]=S.exports.useState(),E=S.exports.useCallback(O=>{w(O),u==null||u(O)},[u]),I=S.exports.useCallback(O=>{y(O)},[]),D=S.exports.useCallback(()=>{T&&(r==null||r(T))},[T,r]),F=S.exports.useCallback(()=>{C.length>0&&(l==null||l(C))},[l,C]),x=S.exports.useCallback(()=>{i==null||i()},[i]),U=S.exports.useCallback(()=>{T&&(o==null||o(ce.getPath(T.filename)))},[T,o]),B=S.exports.useCallback(()=>{T&&b(T)},[T]),_=S.exports.useCallback(()=>{b(void 0)},[]),H=S.exports.useCallback(O=>{f&&(d==null||d(f,O),b(void 0))},[d,f]),A=S.exports.useMemo(()=>{if(f)return[];const O=[];return i&&O.push({title:"New File",description:"Create new file",action:x,group:oe.groups.medium}),o&&O.push({title:"New Folder",description:"Create new folder",action:U,group:oe.groups.medium}),r&&O.push({title:"Copy",description:"Copy",action:D,group:oe.groups.low,disabled:T==null||qn(T)}),l&&C.length>0&&O.push({title:"Delete",description:"Delete",shortcut:Lh.FILE_EXPLORER.DELETE,action:F,group:oe.groups.low}),d&&O.push({title:"Rename",description:"Rename",shortcut:Lh.FILE_EXPLORER.RENAME,action:B,group:oe.groups.low,disabled:T==null}),O},[D,F,x,U,B,T,r,i,o,l,d,C,f]),N=S.exports.useCallback(O=>f?g(f,O):Promise.reject(new Error("No rename item")),[f,g]),k=S.exports.useCallback(O=>{const{item:V}=O;return f&&f.filename===V.filename?Ka({...O,children:h(PE,{item:V,validate:N,onSubmit:H,onCancel:_})}):Ka(O)},[_,H,f,N]);return v("div",{className:"file-list-container",children:[m!=null&&h(OE,{onMove:a,onSelect:c,onSelectionChange:E,onFocusChange:I,renderItem:k,rowHeight:p,table:m,isMultiSelect:e,focusedPath:n}),s&&h(oe,{actions:A})]})}Lp.displayName="FileListContainer";class Br extends Hi{constructor(e){super("Name already exists"),this.isExistingFile=!0,this.info=e}}class sc extends Error{constructor(){super("No file exists at the path specified"),this.isFileNotFound=!0}}const Ks=X.module("FileExplorer");function ic(t){const{storage:e,isMultiSelect:n=!1,focusedPath:s,onDelete:i=()=>{},onRename:o=()=>{},onSelect:r,onSelectionChange:l,rowHeight:a=nc}=t,[d,c]=S.exports.useState([]),[u,m]=S.exports.useState();S.exports.useEffect(function(){let D;async function F(){Ks.debug("initTable"),D=Te.makeCancelable(e.getTable(),x=>x.close());try{m(await D)}catch(x){Te.isCanceled(x)||Ks.error("Unable to initialize table",x)}}return F(),()=>{D.cancel()}},[e]);const p=S.exports.useCallback(I=>{Te.isCanceled(I)||Ks.error(I)},[]),g=S.exports.useCallback(I=>{Ks.debug("handleDelete, pending confirmation",I),c(I)},[]),f=S.exports.useCallback(()=>{Ks.debug("handleDeleteConfirm",d),d.forEach(I=>e.deleteFile(qn(I)?ce.makePath(I.filename):I.filename)),i(d),c([])},[d,i,e]),b=S.exports.useCallback(()=>{Ks.debug("handleDeleteCancel"),c([])},[]),C=S.exports.useCallback((I,D)=>{ce.reducePaths(I.map(x=>qn(x)?ce.makePath(x.filename):x.filename)).forEach(x=>{const U=ce.isPath(x)?`${D}${ce.getBaseName(x.substring(0,x.length-1))}/`:`${D}${ce.getBaseName(x)}`;e.moveFile(x,U).then(()=>{o(x,U)}).catch(p)})},[p,o,e]),w=S.exports.useCallback((I,D)=>{let F=I.filename;const x=qn(I);x&&!F.endsWith("/")&&(F=`${F}/`);let U=`${ce.getParent(F)}${D}`;x&&!U.endsWith("/")&&(U=`${U}/`),Ks.debug2("handleRename",F,U),e.moveFile(F,U).catch(p),o(F,U)},[p,o,e]),T=S.exports.useCallback(async(I,D)=>{if(D===I.basename)return;ce.validateName(D);const F=`${ce.getPath(I.filename)}${D}`;try{const x=await e.info(F);throw new Br(x)}catch(x){if(!(x instanceof sc))throw x}},[e]),y=d.length>0,E=S.exports.useMemo(()=>d.length===1?`Are you sure you want to delete "${d[0].filename}"?`:"Are you sure you want to delete the selected files?",[d]);return v("div",{className:"file-explorer",children:[u&&h(Lp,{isMultiSelect:n,focusedPath:s,showContextMenu:!0,onMove:C,onDelete:g,onRename:w,onSelect:r,onSelectionChange:l,rowHeight:a,table:u,validateRename:T}),h($i,{isOpen:y,headerText:E,bodyText:"You cannot undo this action.",onCancel:b,onConfirm:f,confirmButtonText:"Delete"})]})}ic.displayName="FileExplorer";const qs=X.module("NewItemModal"),$r=class extends S.exports.PureComponent{constructor(t){super(t),this.inputRef=Y.createRef(),this.pending=new fs,this.pathMap=new Map,this.isInitialLoad=!0,this.handleModalSubmit=this.handleModalSubmit.bind(this),this.handleModalOpened=this.handleModalOpened.bind(this),this.handleSelect=this.handleSelect.bind(this),this.handleChange=this.handleChange.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleValidationError=this.handleValidationError.bind(this),this.handleOverwriteCancel=this.handleOverwriteCancel.bind(this),this.handleOverwriteConfirm=this.handleOverwriteConfirm.bind(this),this.handleExtensionChangeCancel=this.handleExtensionChangeCancel.bind(this),this.handleExtensionChangeConfirm=this.handleExtensionChangeConfirm.bind(this),this.handleBreadcrumbSelect=this.handleBreadcrumbSelect.bind(this);const{defaultValue:e}=t,n=ce.hasPath(e)?ce.getPath(e):"/";this.state={isSubmitting:!1,path:n,prevExtension:ce.getExtension(e),showExtensionChangeModal:!1,showOverwriteModal:!1,value:ce.getBaseName(e)}}static getValidationMessage(t){return t instanceof Br&&t.info.type==="directory"?"Error: Cannot overwrite existing directory":`${t}`}static handleError(t){Te.isCanceled(t)||qs.error(t)}componentDidUpdate(t,e){const{isOpen:n}=this.props,{isOpen:s}=t,{value:i,path:o}=this.state;!s&&n&&(this.resetValue(),this.isInitialLoad=!0),s&&n&&(!this.isInitialLoad&&(o!==e.path||i!==e.value)&&this.updateValidationStatus(o,i),this.isInitialLoad=!1)}componentWillUnmount(){this.pending.cancel(),this.cancelableValidatePromise&&this.cancelableValidatePromise.cancel(),this.cancelableExistingItemPromise&&this.cancelableExistingItemPromise.cancel()}resetValue(){const{defaultValue:t}=this.props,e=ce.hasPath(t)?ce.getPath(t):"/";this.setState({path:e,value:ce.getBaseName(t),validationError:void 0,prevExtension:ce.getExtension(t),isSubmitting:!1})}getValidationPromise(t,e,n=!1){return this.cancelableValidatePromise&&this.cancelableValidatePromise.cancel(),this.cancelableValidatePromise=Te.makeCancelable(this.validateName(t,e,n)),this.cancelableValidatePromise}async validateName(t,e,n){ce.validateName(e);const{defaultValue:s,storage:i}=this.props;if(n){const o=`${t}${e}`;if(o!==s)try{const r=await i.info(o);throw new Br(r)}catch(r){if(!(r instanceof sc))throw r}}return e}updateValidationStatus(t,e){this.getValidationPromise(t,e).then(()=>{this.setState({validationError:void 0})}).catch(this.handleValidationError).catch($r.handleError)}handleModalOpened(){this.focusRenameInput()}handleModalSubmit(){this.submitModal()}handleChange(t){const{value:e}=t.target;this.setState({value:e})}handleSelect(t){if(qs.debug("handleSelect",t),t.type==="directory")this.setState({path:ce.makePath(t.filename)});else{const e=t.basename,n=ce.getPath(t.filename);this.setState({value:e,path:n},()=>{this.focusRenameInput()})}}handleKeyDown(t){const{key:e}=t;switch(t.stopPropagation(),e){case"Enter":{t.preventDefault(),this.submitModal();break}case"Escape":{t.preventDefault();const{onCancel:n}=this.props;n();break}}}handleValidationError(t){if(!(t instanceof Hi))throw t;qs.debug("Validation error",t),this.setState({validationError:t})}handleOverwriteCancel(){this.setState({showOverwriteModal:!1,isSubmitting:!1})}handleOverwriteConfirm(){this.setState({showOverwriteModal:!1});const{onSubmit:t}=this.props,{path:e,value:n}=this.state;qs.debug("handleOverwriteConfirm",e,n),t(`${e}${n}`)}handleExtensionChangeCancel(){qs.debug("handleExtensionChangeCancel"),this.setState(({value:t,prevExtension:e})=>{const n=ce.replaceExtension(t,e);return{showExtensionChangeModal:!1,value:n}}),this.submitModal(!0)}handleExtensionChangeConfirm(){qs.debug("handleExtensionChangeConfirm"),this.setState({showExtensionChangeModal:!1}),this.submitModal(!0)}focusRenameInput(){const t=this.inputRef.current;if(t){const{type:e}=this.props,{value:n}=t,s=e==="directory"?n.length:n.lastIndexOf(".");t.focus(),t.setSelectionRange(0,s>0?s:n.length)}}submitModal(t=!1){this.setState(({prevExtension:e,value:n,path:s})=>{const{notifyOnExtensionChange:i,type:o}=this.props;qs.debug("submitModal",e,n);const r=ce.getExtension(n);return i&&!t&&e!==null&&e!==r?{isSubmitting:!1,showExtensionChangeModal:!0,newExtension:r}:(this.getValidationPromise(s,n,!0).then(l=>{const{onSubmit:a}=this.props;a(`${s}${n}`)}).catch(l=>{if(l instanceof Br&&o!=="directory"&&l.info.type!=="directory"){this.setState({showOverwriteModal:!0});return}throw l}).catch(l=>{throw Te.isCanceled(l)&&this.setState({isSubmitting:!1}),l}).catch(this.handleValidationError).catch($r.handleError),{isSubmitting:!0,showExtensionChangeModal:!1,newExtension:void 0})})}handleBreadcrumbSelect(t){this.setState({path:t})}renderPathButtons(t){const e=t.split("/");return e.pop(),e.map((n,s)=>{let i="";for(let o=0;o<s;o+=1)i+=`${e[o]}/`;return i+=`${n}/`,v(Y.Fragment,{children:[h(z,{kind:"ghost",className:"directory-breadcrumbs",onClick:()=>this.handleBreadcrumbSelect(i),"aria-label":s===0?"Home":void 0,icon:s===0?h(j,{icon:Mf,transform:"right-1.6"}):void 0,tooltip:s===0?"Home":void 0,children:n}),"/"]},i)})}render(){const{storage:t,isOpen:e,onCancel:n,placeholder:s,title:i,type:o}=this.props,{isSubmitting:r,path:l,showExtensionChangeModal:a,showOverwriteModal:d,validationError:c,value:u,prevExtension:m,newExtension:p}=this.state,g=o==="directory",f=ce.fileExtensionToString(m),b=ce.fileExtensionToString(p),C=g?"Create":"Save",w=g?"New folder name":"Save file as";return v(ye,{children:[v($o,{isOpen:e,toggle:n,onOpened:this.handleModalOpened,className:"modal-dialog-centered new-file-modal theme-bg-dark",children:[h(zo,{toggle:n,children:i}),h(Wo,{children:h("form",{children:v("div",{className:"d-flex flex-column new-file-modal-content",children:[v("div",{className:"flex-grow-0 mb-4",children:[h("label",{htmlFor:"file-name-input",children:w}),h("input",{id:"file-name-input",type:"text",autoComplete:"off",autoCapitalize:"none",autoCorrect:"off",spellCheck:"false",className:W("form-control",{"is-invalid":c}),value:u,placeholder:s,ref:this.inputRef,onKeyDown:this.handleKeyDown,onChange:this.handleChange}),c&&h("div",{className:"invalid-feedback",children:$r.getValidationMessage(c)})]}),v("div",{className:"flex-grow-0",children:[h("label",{children:"Directory: /"}),this.renderPathButtons(l)]}),h("div",{className:"flex-grow-1 file-explorer-container",children:h(ic,{onSelect:this.handleSelect,storage:t,focusedPath:l})})]})})}),v(od,{children:[h(z,{kind:"secondary",onClick:n,children:"Cancel"}),h(z,{kind:"primary",disabled:r,onClick:this.handleModalSubmit,children:C})]})]}),h($i,{isOpen:d,headerText:"Confirm overwrite",bodyText:"File with this name already exists, are you sure you want to overwrite it?",onCancel:this.handleOverwriteCancel,onConfirm:this.handleOverwriteConfirm,cancelButtonText:"Cancel",confirmButtonText:"Overwrite"}),h($i,{isOpen:a,headerText:"Confirm extension change",bodyText:`Are you sure you want to change extension from "${f}" to "${b}"?`,onCancel:this.handleExtensionChangeCancel,onConfirm:this.handleExtensionChangeConfirm,cancelButtonText:`Keep "${f}"`,confirmButtonText:`Use "${b}"`})]})}};let Wl=$r;Wl.propTypes={isOpen:R.exports.bool,title:R.exports.string.isRequired,defaultValue:R.exports.string,type:R.exports.oneOf(["file","directory"]).isRequired,onSubmit:R.exports.func,onCancel:R.exports.func,placeholder:R.exports.string,storage:R.exports.shape({}).isRequired,notifyOnExtensionChange:R.exports.bool};Wl.defaultProps={isOpen:!1,defaultValue:"/",notifyOnExtensionChange:!1,placeholder:"",onSubmit:t=>{},onCancel:()=>{}};function HE({createFile:t,createFolder:e,onSearchChange:n,defaultSearchText:s=""}){return v("div",{className:"file-explorer-toolbar",children:[v("div",{className:"file-explorer-toolbar-buttons",children:[h(z,{kind:"ghost",icon:Cu,tooltip:"New notebook",onClick:t,"aria-label":"New notebook"}),h(z,{kind:"ghost",icon:Pf,tooltip:"New folder",onClick:e,"aria-label":"New folder"})]}),n&&h("div",{className:"file-explorer-toolbar-search",children:h(Pu,{value:s,onChange:n,placeholder:"Search by name"})})]})}const Di=X.module("FileExplorerPanel"),VE=(t,e)=>{const n=Cm(t),s=gi(t,e.localDashboardId),{session:i,config:o}=s!=null?s:{},r=o==null?void 0:o.type;return{fileStorage:n,language:r,session:i}},UE=Ft(VE,null,null,{forwardRef:!0});function BE(t){const e=t;return e!=null&&typeof e.button=="number"}const qa=class extends Y.Component{static handleError(t){Di.error(t)}static isFocusEvent(t){return BE(t)?t.detail>=2:!0}constructor(t){super(t),this.handleFileSelect=this.handleFileSelect.bind(this),this.handleCreateFile=this.handleCreateFile.bind(this),this.handleCreateDirectory=this.handleCreateDirectory.bind(this),this.handleCreateDirectoryCancel=this.handleCreateDirectoryCancel.bind(this),this.handleCreateDirectorySubmit=this.handleCreateDirectorySubmit.bind(this),this.handleDelete=this.handleDelete.bind(this),this.handleRename=this.handleRename.bind(this),this.handleSessionOpened=this.handleSessionOpened.bind(this),this.handleSessionClosed=this.handleSessionClosed.bind(this),this.handleShow=this.handleShow.bind(this),this.handleSelectionChange=this.handleSelectionChange.bind(this);const{session:e,language:n}=t;this.state={isShown:!1,language:n,session:e,showCreateFolder:!1,focusedFilePath:"/"}}componentDidMount(){this.isHidden()||this.setState({isShown:!0})}handleCreateFile(){const{glEventHub:t}=this.props,{session:e,language:n}=this.state,s={language:n,value:""};Di.debug("handleCreateFile",e,n,s),t.emit(He.CREATE_NOTEBOOK,e,n,s)}handleCreateDirectory(t){this.setState({showCreateFolder:!0})}handleCreateDirectoryCancel(){Di.debug("handleCreateDirectoryCancel"),this.setState({showCreateFolder:!1})}handleCreateDirectorySubmit(t){Di.debug("handleCreateDirectorySubmit",t),this.setState({showCreateFolder:!1});const{fileStorage:e}=this.props;e.createDirectory(t).catch(qa.handleError)}handleDelete(t){const{glEventHub:e}=this.props;t.forEach(n=>{e.emit(He.CLOSE_FILE,{id:n.filename,itemName:n.filename})})}handleSelectionChange(t){let e="/";t.length===1&&(t[0].type==="directory"?e=ce.makePath(t[0].filename):e=ce.getPath(t[0].filename)),this.setState({focusedFilePath:e})}handleFileSelect(t,e){if(Di.debug("fileSelect",t),t.type==="directory")return;const n=qa.isFocusEvent(e),s={id:t.filename,itemName:t.filename},{glEventHub:i}=this.props,{session:o,language:r}=this.state,l={value:null,language:r};i.emit(He.SELECT_NOTEBOOK,o,r,l,s,n)}handleRename(t,e){const{glEventHub:n}=this.props;Di.debug("handleRename",t,e),n.emit(He.RENAME_FILE,t,e)}handleSessionOpened(t,{language:e}){this.setState({session:t,language:e})}handleSessionClosed(){this.setState({session:void 0,language:void 0})}handleShow(){this.setState({isShown:!0})}isHidden(){const{glContainer:t}=this.props,{isHidden:e}=t;return e}render(){const{fileStorage:t,glContainer:e,glEventHub:n}=this.props,{isShown:s,showCreateFolder:i,focusedFilePath:o}=this.state;return v(jn,{className:"file-explorer-panel",componentPanel:this,glContainer:e,glEventHub:n,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,onShow:this.handleShow,children:[h(HE,{createFile:this.handleCreateFile,createFolder:this.handleCreateDirectory}),s&&h(ic,{isMultiSelect:!0,storage:t,onDelete:this.handleDelete,onRename:this.handleRename,onSelect:this.handleFileSelect,onSelectionChange:this.handleSelectionChange}),h(Wl,{isOpen:i,type:"directory",title:"Create New Folder",storage:t,onSubmit:this.handleCreateDirectorySubmit,onCancel:this.handleCreateDirectoryCancel,defaultValue:o})]})}};let oc=qa;oc.COMPONENT="FileExplorerPanel";oc.TITLE="File Explorer";const rl=UE(oc);const lt=X.module("FilterSetManager"),$E="Enter name...",Ph="No Available Filter Sets";class ll extends S.exports.Component{constructor(e){super(e),this.renameInputRef=Y.createRef(),this.dropdownRef=Y.createRef(),this.editDropdownRef=Y.createRef(),this.isRenamingExistingSet=pe((n,s)=>s!==void 0&&n.some(({id:i})=>i===s.id)),this.handleSettingsCancel=this.handleSettingsCancel.bind(this),this.handleSettingsClick=this.handleSettingsClick.bind(this),this.handleSettingsSave=this.handleSettingsSave.bind(this),this.handleBackgroundClick=this.handleBackgroundClick.bind(this),this.handleEditDropdownChange=this.handleEditDropdownChange.bind(this),this.handleFilterChange=this.handleFilterChange.bind(this),this.handleFilterApply=this.handleFilterApply.bind(this),this.handleCaptureNewSet=this.handleCaptureNewSet.bind(this),this.handleNameInputChange=this.handleNameInputChange.bind(this),this.handleNameInputKeyPress=this.handleNameInputKeyPress.bind(this),this.handleRenameConfirm=this.handleRenameConfirm.bind(this),this.handleRenameCancel=this.handleRenameCancel.bind(this),this.handleRestoreFullStateChange=this.handleRestoreFullStateChange.bind(this),this.handleSetDelete=this.handleSetDelete.bind(this),this.handleSetEdit=this.handleSetEdit.bind(this),this.handleSetUpdate=this.handleSetUpdate.bind(this),this.state={editId:void 0,renameSet:void 0,nameInputValue:"",nameInputError:void 0,modifiedFilterSets:[],restoreFullState:!1}}static animateScreenFlash(){var n;const e=document.createElement("div");e.classList.add("screen-flash-overlay"),e.addEventListener("animationend",()=>{e.remove()}),(n=document.querySelector("body"))==null||n.appendChild(e)}componentDidMount(){const{isValueShown:e}=this.props;e?this.updateSelectedId():this.initSettingsScreen()}componentDidUpdate(e,n){const{isValueShown:s,filterSets:i}=this.props,{modifiedFilterSets:o}=this.state;if(e.isValueShown&&!s&&this.initSettingsScreen(),this.isNameInputScreen()&&!this.isNameInputScreen(n)&&this.focusRenameInput(),i!==e.filterSets)if(!s&&i.length>0&&e.filterSets.length===0&&o.length===0){const{onChange:r}=this.props;r({isValueShown:!0,selectedId:i[0].id})}else this.updateSelectedId()}initSettingsScreen(){const{filterSets:e,selectedId:n}=this.props;lt.debug("initSettingsScreen",e,n),this.setState({modifiedFilterSets:[...e],editId:n})}updateSelectedId(){const{isValueShown:e,filterSets:n,selectedId:s,onChange:i}=this.props;if(lt.debug("updateSelectedId",n,s),!!e&&!n.some(({id:o})=>o===s)){const o=n.length===0;i({isValueShown:!o,selectedId:o?void 0:n[0].id})}}handleEditDropdownChange(e){const{value:n}=e.target;this.setState({editId:n})}handleFilterChange(e){const{value:n}=e.target,{isValueShown:s,onChange:i}=this.props;this.applyFilterSet(n),i({isValueShown:s,selectedId:n})}handleFilterApply(){const{selectedId:e}=this.props;this.applyFilterSet(e)}handleSettingsCancel(){const{onChange:e,selectedId:n,filterSets:s}=this.props;this.setState({modifiedFilterSets:[]}),s.length>0&&e({isValueShown:!0,selectedId:n})}handleSettingsSave(){const{onChange:e,onUpdateSets:n}=this.props,{modifiedFilterSets:s,editId:i}=this.state;this.setState({modifiedFilterSets:[]}),lt.debug("Update sets",s,i),n(s),s.length>0&&e({isValueShown:!0,selectedId:i})}handleCaptureNewSet(){const{getFilterState:e}=this.props;ll.animateScreenFlash();const n=ze(),s=e(),i={id:n,title:"",panels:s};lt.debug("handleSetCreate",i),this.setState({nameInputValue:"",nameInputError:void 0,renameSet:i})}handleRenameCancel(){this.setState({renameSet:void 0})}handleRestoreFullStateChange(e){this.setState({restoreFullState:e.target.value==="true"})}getNameError(e){var o;const{renameSet:n,modifiedFilterSets:s}=this.state,i=(o=e==null?void 0:e.trim())!=null?o:"";if(i.length===0)return lt.debug("Name cannot be empty",i),"Name cannot be empty";if(n!==void 0&&s.some(({title:r,id:l})=>r===i&&l!==n.id))return lt.debug("Set with this name already exists",i),"Set with this name already exists"}handleRenameConfirm(){var c;const{nameInputValue:e,renameSet:n,modifiedFilterSets:s,restoreFullState:i}=this.state;if(n===void 0){lt.error("Renamed set undefined.");return}const o=this.getNameError(e);if(lt.debug("handleRenameConfirm",e,o),o!==void 0){this.setState({nameInputError:o});return}const r=(c=e==null?void 0:e.trim())!=null?c:"",l={...n,title:r,restoreFullState:i},a=s.findIndex(({id:u})=>u===n.id),d=[...s];a>=0?(d[a]=l,lt.debug("Renamed existing set",d)):(d.push(l),lt.debug("Added new set to modified sets",d)),this.setState({editId:l.id,modifiedFilterSets:d,renameSet:void 0})}handleSetDelete(){this.setState(e=>{const{editId:n,modifiedFilterSets:s}=e,i=s.findIndex(({id:a})=>a===n);if(i<0)return lt.error("Unable to find selected filterSet index",s,n),null;const o=s.filter(({id:a})=>a!==n),r=Math.max(0,Math.min(o.length-1,i-1)),l=o.length>0?o[r].id:void 0;return lt.debug("Deleted selected set",n,s,o),lt.debug("New selection",r,l),{modifiedFilterSets:o,editId:l}})}handleSetUpdate(){const{getFilterState:e}=this.props;ll.animateScreenFlash();const n=e();this.setState(({modifiedFilterSets:s,editId:i})=>{if(i===void 0)return lt.error("Filter for update not selected."),null;const o=[...s],r=o.findIndex(({id:l})=>l===i);return r<0?(lt.error("Selected set for update not found."),null):(o[r]={...o[r],panels:n},lt.debug("Update set",o,n),{modifiedFilterSets:o})})}handleSetEdit(){this.setState(({editId:e,modifiedFilterSets:n})=>{const s=n.find(({id:r})=>r===e);if(s===void 0)return lt.error("Could not find selected set",e,n),null;const{title:i,restoreFullState:o=!1}=s;return{nameInputValue:i,nameInputError:void 0,renameSet:s,restoreFullState:o}})}handleSettingsClick(e){e.stopPropagation();const{onChange:n,selectedId:s}=this.props;n({isValueShown:!1,selectedId:s})}handleBackgroundClick(e){lt.debug("handleBackgroundClick"),e.target!==this.dropdownRef.current&&this.focusInput()}handleNameInputChange(e){const{value:n}=e.target,s=this.getNameError(n);this.setState({nameInputValue:n,nameInputError:s})}handleNameInputKeyPress(e){const{key:n}=e;n==="Enter"&&(e.preventDefault(),this.handleRenameConfirm())}isNameInputScreen(e=this.state){const{renameSet:n}=e;return n!==void 0}applyFilterSet(e){const{onApply:n,filterSets:s}=this.props;if(e===void 0){lt.debug("No filter selected");return}const i=s.find(({id:o})=>o===e);if(i===void 0){lt.debug("Selected id not found in filterSets",e,s);return}lt.debug("Apply filterSet",i),n(i)}focusInput(){var e;(e=this.dropdownRef.current)==null||e.focus()}focusRenameInput(){var e;(e=this.renameInputRef.current)==null||e.focus()}render(){const{nameInputValue:e,nameInputError:n,editId:s,renameSet:i,modifiedFilterSets:o,restoreFullState:r}=this.state,{isValueShown:l,filterSets:a,selectedId:d}=this.props,c=this.isNameInputScreen(),u=this.isRenamingExistingSet(o,i),m=o.length===0,p=!c&&m&&a.length===0,g=!c&&!p,f=v("div",{className:"fa-layers mr-3",children:[h(j,{icon:Po,mask:Da,transform:"shrink-1 down-5 right-7"}),h(j,{icon:Ps,className:"text-primary",transform:"shrink-6 down-5 right-7"})]}),b=v("div",{className:"fa-layers",children:[h(j,{icon:Po,mask:Da,transform:"shrink-1 down-5 right-7"}),h(j,{icon:Ra,transform:"shrink-1 down-5 right-7"})]});return h("div",{className:"filter-set-manager fill-parent-absolute",children:v(rd,{className:"w-100 h-100",isFlipped:l,children:[h("div",{className:"filter-set-manager-settings-card fill-parent-absolute",children:v("div",{className:"filter-set-manager-card-content",children:[p&&v("div",{children:[h(z,{kind:"ghost",className:"btn btn-link no-underline",onClick:this.handleCaptureNewSet,icon:f,children:"Capture filter set"}),h("div",{className:"py-3 text-muted small",children:"Takes a snapshot of the currently applied filters on all panels, allowing you to restore saved filter sets later."})]}),c&&v("div",{className:"d-flex flex-column justify-content-center","data-testid":"edit-filter-set-container",children:[v("div",{className:"form-group",children:[h("label",{children:u?"Edit set":"Name captured set"}),v("div",{className:"name-input-container",children:[h("input",{type:"text",className:"input-set-name form-control",placeholder:$E,value:e,ref:this.renameInputRef,onChange:this.handleNameInputChange,onKeyPress:this.handleNameInputKeyPress,spellCheck:"false"}),h(z,{"data-testid":"rename-confirm-button",kind:"ghost",className:"btn btn-link no-underline pt-2 pb-2",onClick:this.handleRenameConfirm,tooltip:"Save","test-id":"button-save",icon:bu}),h(z,{"data-testid":"rename-cancel-button",kind:"ghost",className:"btn btn-link no-underline pt-2 pb-2",onClick:this.handleRenameCancel,tooltip:"Cancel",icon:wf})]}),n!==void 0&&h("div",{className:"error-message",children:n})]}),h("div",{className:"form-group",children:v(vl,{onChange:this.handleRestoreFullStateChange,value:`${r}`,children:[h(xn,{value:"false",children:"Restore only filters"}),h(xn,{value:"true",children:"Restore full table state"})]})})]}),g&&v("div",{className:"filter-set-manager-settings-grid-1",children:[v("div",{className:"form-group",children:[h("label",{children:"Edit filter sets"}),v("div",{className:"filter-select-container",children:[v("select",{"data-testid":"settings-card-filter-select",ref:this.editDropdownRef,value:s!=null?s:"-1",className:"custom-select filter-value-select",onChange:this.handleEditDropdownChange,disabled:m,children:[m&&h("option",{value:"-1",disabled:!0,children:Ph}),o.map(({id:C,title:w})=>h("option",{value:C,children:w},C))]}),h(z,{kind:"ghost",onClick:this.handleSetUpdate,disabled:m,icon:b,tooltip:"Update"}),h(z,{kind:"ghost",onClick:this.handleSetEdit,disabled:m,icon:pl,tooltip:"Edit"}),h(z,{kind:"ghost",onClick:this.handleSetDelete,disabled:m,icon:wn,tooltip:"Delete"})]})]}),h("div",{children:h(z,{kind:"ghost",className:"btn btn-link no-underline",onClick:this.handleCaptureNewSet,icon:f,children:"Capture new filter set"})}),v("div",{className:"py-3 text-right",children:[h(z,{kind:"secondary",onClick:this.handleSettingsCancel,children:"Cancel"}),"\xA0",h(z,{kind:"primary",onClick:this.handleSettingsSave,children:"Save"})]})]})]})},"front"),v("div",{className:"filter-set-manager-value-card fill-parent-absolute",onClick:this.handleBackgroundClick,children:[h("div",{className:"filter-set-manager-column",children:h("div",{className:"filter-set-manager-column-title",children:"Filter sets"})}),h("div",{className:"filter-set-manager-card-content",children:h("div",{className:"filter-set-manager-value-input",children:v("div",{className:"filter-select-container",children:[v("select",{"data-testid":"value-card-filter-select",ref:this.dropdownRef,value:d,className:"custom-select filter-value-select",onChange:this.handleFilterChange,children:[a.length===0&&h("option",{value:"-1",disabled:!0,children:Ph}),a.map(({id:C,title:w})=>h("option",{value:C,children:w},C))]}),h(z,{"data-testid":"filter-apply-button",kind:"ghost",onClick:this.handleFilterApply,icon:cd,tooltip:"Apply Filter Set"})]})})}),h("div",{className:"filter-set-manager-menu",children:h(z,{kind:"ghost",className:"btn btn-link btn-link-icon m-2 px-2",onClick:this.handleSettingsClick,tooltip:"Settings",icon:h(j,{icon:Go,transform:"grow-4"})})})]},"back")]})})}}function rc(t){var l,a;const{model:e,widgetName:n,glContainer:s,description:i}=t,o=((l=e==null?void 0:e.rowCount)!=null?l:0)-((a=e==null?void 0:e.pendingRowCount)!=null?a:0),r=e==null?void 0:e.displayString(o,"long");return h(Vl,{widgetType:"Table",widgetName:n,glContainer:s,description:i,children:v("div",{className:"column-statistics-grid",children:[h("span",{className:"column-statistic-operation",children:"Number of Rows"}),h("span",{className:"column-statistic-value",children:r})]})})}rc.propTypes={glContainer:kd.Container.isRequired,widgetName:R.exports.string.isRequired,description:R.exports.string};rc.defaultProps={description:null};const Un=X.module("IrisGridPanel"),WE=500,zE={IrisGrid:io,IrisGridTableModel:yp,ContextMenuRoot:Du};class Yi extends S.exports.PureComponent{constructor(e){super(e),this.getGridInputFilters=pe((s,i)=>ne.getInputFiltersForColumns(s,i.filter(({value:o,excludePanelIds:r})=>{const l=te.getIdFromPanel(this);return o!=null&&(r==null||l!=null&&!r.includes(l))}))),this.getAlwaysFetchColumns=pe((s,i)=>{const o=te.getIdFromPanel(this),r=new Set(i);for(let l=0;l<s.length;l+=1){const{start:a}=s[l];a!=null&&a.panelId===o&&r.add(a.columnName)}return[...r]}),this.getPluginContent=pe((s,i,o,r,l)=>!i||!li(i)||s==null||i.table==null?null:h("div",{className:"iris-grid-plugin",children:h(s,{ref:this.pluginRef,filter:this.handlePluginFilter,onFilter:this.handlePluginFilter,fetchColumns:this.handlePluginFetchColumns,onFetchColumns:this.handlePluginFetchColumns,table:i.table,user:o,panel:this,workspace:r,components:zE,onStateChange:this.handlePluginStateChange,pluginState:l})})),this.getDehydratedIrisGridPanelState=pe((s,i,o,r,l)=>ne.dehydrateIrisGridPanelState(s,{isSelectingPartition:i,partition:o,partitionColumn:r,advancedSettings:l})),this.getDehydratedIrisGridState=pe((s,i,o,r,l,a,d,c,u,m,p,g,f,b,C,w,T,y,E,I)=>ne.dehydrateIrisGridState(s,{advancedFilters:o,aggregationSettings:T,customColumnFormatMap:r,isFilterBarShown:l,metrics:{userColumnWidths:C,userRowHeights:w},quickFilters:a,customColumns:d,reverseType:c,rollupConfig:u,showSearchBar:m,searchValue:p,selectDistinctColumns:g,selectedSearchColumns:f,sorts:i,invertSearchColumns:b,pendingDataMap:y,frozenColumns:E,conditionalFormats:I})),this.getDehydratedGridState=pe((s,i,o,r,l)=>ne.dehydrateGridState(s,{isStuckToBottom:r,isStuckToRight:l,movedColumns:i,movedRows:o})),this.getCachedPanelState=pe((s,i,o,r)=>({irisGridPanelState:s,irisGridState:i,gridState:o,pluginState:r})),this.savePanelState=je(()=>{const{irisGridState:s,gridState:i,pluginState:o}=this;P(s);const{onPanelStateUpdate:r}=this.props,{model:l,panelState:a,isSelectingPartition:d,partition:c,partitionColumn:u,advancedSettings:m}=this.state,{advancedFilters:p,aggregationSettings:g,customColumnFormatMap:f,isFilterBarShown:b,quickFilters:C,customColumns:w,reverseType:T,rollupConfig:y,showSearchBar:E,searchValue:I,selectDistinctColumns:D,selectedSearchColumns:F,sorts:x,invertSearchColumns:U,metrics:B,pendingDataMap:_,frozenColumns:H,conditionalFormats:A}=s;P(l),P(B);const{userColumnWidths:N,userRowHeights:k}=B;P(i);const{isStuckToBottom:O,isStuckToRight:V,movedColumns:G,movedRows:Q}=i,Z=this.getCachedPanelState(this.getDehydratedIrisGridPanelState(l,d,c,u,m),this.getDehydratedIrisGridState(l,x,p,f,b,C,w,T,y,E,I,D,F,U,N,k,g,_,H,A),this.getDehydratedGridState(l,G,Q,O,V),o);Z!==a&&(Un.debug("Saving panel state",this,Z),this.setState({panelState:Z}),r==null||r(Z))},WE),this.handleAdvancedSettingsChange=this.handleAdvancedSettingsChange.bind(this),this.handleColumnsChanged=this.handleColumnsChanged.bind(this),this.handleTableChanged=this.handleTableChanged.bind(this),this.handleColumnSelected=this.handleColumnSelected.bind(this),this.handleDataSelected=this.handleDataSelected.bind(this),this.handleError=this.handleError.bind(this),this.handleGridStateChange=this.handleGridStateChange.bind(this),this.handlePluginStateChange=this.handlePluginStateChange.bind(this),this.handlePartitionAppend=this.handlePartitionAppend.bind(this),this.handleCreateChart=this.handleCreateChart.bind(this),this.handleResize=this.handleResize.bind(this),this.handleShow=this.handleShow.bind(this),this.handleTabClicked=this.handleTabClicked.bind(this),this.handleDisconnect=this.handleDisconnect.bind(this),this.handleReconnect=this.handleReconnect.bind(this),this.handleLoadSuccess=this.handleLoadSuccess.bind(this),this.handleLoadError=this.handleLoadError.bind(this),this.isColumnSelectionValid=this.isColumnSelectionValid.bind(this),this.handleContextMenu=this.handleContextMenu.bind(this),this.handlePluginFilter=this.handlePluginFilter.bind(this),this.handlePluginFetchColumns=this.handlePluginFetchColumns.bind(this),this.handleClearAllFilters=this.handleClearAllFilters.bind(this),this.irisGrid=Y.createRef(),this.pluginRef=Y.createRef();const{panelState:n}=e;this.pluginState=null,this.state={error:null,isDisconnected:!1,isLoaded:!1,isLoading:!0,isModelReady:!1,model:void 0,advancedFilters:new Map,aggregationSettings:{aggregations:[],showOnTop:!1},advancedSettings:new Map(rp.DEFAULTS),customColumns:[],customColumnFormatMap:new Map,isFilterBarShown:!1,quickFilters:new Map,sorts:[],userColumnWidths:new Map,userRowHeights:new Map,reverseType:L.REVERSE_TYPE.NONE,movedColumns:[],movedRows:[],isSelectingPartition:!1,partition:void 0,partitionColumn:void 0,rollupConfig:void 0,showSearchBar:!1,searchValue:"",selectedSearchColumns:void 0,invertSearchColumns:!0,Plugin:void 0,pluginFilters:[],pluginFetchColumns:[],modelQueue:[],pendingDataMap:new Map,frozenColumns:void 0,panelState:n,irisGridStateOverrides:{},gridStateOverrides:{},isStuckToBottom:!1,isStuckToRight:!1,conditionalFormats:[],selectDistinctColumns:[]}}componentDidMount(){this.initModel()}componentDidUpdate(e,n){const{model:s}=this.state;s!==n.model&&(n.model!=null&&(this.stopModelListening(n.model),n.model.close()),s!=null&&this.startModelListening(s))}componentWillUnmount(){this.savePanelState.cancel(),this.modelPromise!=null&&(this.modelPromise.cancel(),this.modelPromise=void 0);const{model:e}=this.state;e&&(this.stopModelListening(e),e.close())}getTableName(){const{metadata:e}=this.props;return e.table}initModel(){this.setState({isModelReady:!1,isLoading:!0,error:null});const{makeModel:e}=this.props;this.modelPromise!=null&&this.modelPromise.cancel(),this.modelPromise=Te.makeCancelable(e(),n=>n.close()),this.modelPromise.then(this.handleLoadSuccess).catch(this.handleLoadError)}handleLoadSuccess(e){const n=e,{panelState:s,irisGridStateOverrides:i}=this.state,o=[];if(s!=null){const{irisGridState:r}=s,{aggregationSettings:l,customColumns:a,selectDistinctColumns:d=[],rollupConfig:c}={...r,...i};a.length>0&&o.push(u=>{u.customColumns=a}),c!=null&&c.columns.length>0&&o.push(u=>{u.rollupConfig=ne.getModelRollupConfig(u.originalColumns,c,l)}),d.length>0&&o.push(u=>{u.selectDistinctColumns=d})}this.setState({model:n,modelQueue:o}),this.initModelQueue(n,o)}initModelQueue(e,n){const s=e;if(n.length===0){this.modelInitialized(s);return}const i=n.shift();Un.debug("initModelQueue",i),i&&i(s),this.setState({modelQueue:n})}handleAdvancedSettingsChange(e,n){Un.debug("handleAdvancedSettingsChange",e,n),this.setState(({advancedSettings:s})=>s.get(e)===n?null:{advancedSettings:new Map(s).set(e,n)})}handlePluginFilter(e){const{model:n}=this.state;P(n);const{columns:s,formatter:i}=n,o=ne.getFiltersFromInputFilters(s,e,i.timeZone);this.setState({pluginFilters:o})}handlePluginFetchColumns(e){this.setState({pluginFetchColumns:e})}handleContextMenu(e){var n,s,i;return(i=(s=(n=this.pluginRef.current)==null?void 0:n.getMenu)==null?void 0:s.call(n,e))!=null?i:[]}isColumnSelectionValid(e){const{columnSelectionValidator:n}=this.props;return n&&e?n(this,e):!1}handleGridStateChange(e,n){this.irisGridState=e,this.gridState=n,this.setState({isLoaded:!0,isLoading:!1}),this.savePanelState();const{glEventHub:s,onStateChange:i}=this.props;s.emit(Et.STATE_CHANGED,this),i==null||i(e,n)}handlePluginStateChange(e){const{irisGridState:n,gridState:s}=this;this.pluginState=e,n!==null&&s!==null&&this.savePanelState()}handleColumnsChanged(e){const{isModelReady:n,model:s,modelQueue:i}=this.state;n?this.sendColumnsChange(e.detail):(P(s),this.initModelQueue(s,i))}handleTableChanged(e){Un.debug("handleTableChanged",e);const{glEventHub:n}=this.props,{detail:s}=e;n.emit(Pe.TABLE_CHANGED,this,s)}handlePartitionAppend(e,n){const{glEventHub:s}=this.props,{name:i}=e,o=this.getTableName(),r=`${o} = ${o}.where("${i}=\`${n}\`")`;s.emit(bt.SEND_COMMAND,r,!1,!0)}handleCreateChart(e,n){this.savePanelState.flush(),this.setState(()=>null,()=>{const{glEventHub:s,inputFilters:i,metadata:o}=this.props,{table:r}=o,{panelState:l}=this.state,a=te.getIdFromPanel(this);let d;l&&(d=ne.extractTableSettings(l,i)),s.emit(Et.CREATE_CHART,{metadata:{settings:e,sourcePanelId:a,table:r,tableSettings:d},table:li(n)?n.table:void 0})})}handleColumnSelected(e){const{glEventHub:n}=this.props;n.emit(Et.COLUMN_SELECTED,this,e)}handleDataSelected(e,n){const{glEventHub:s}=this.props;s.emit(Et.DATA_SELECTED,this,n)}handleResize(){this.updateGrid()}handleShow(){this.updateGrid()}handleTabClicked(){this.irisGrid.current&&this.irisGrid.current.focus()}handleError(e){Un.error(e),this.setState({error:e,isLoading:!1})}handleDisconnect(){this.setState({error:new Error("Table disconnected"),isDisconnected:!0,isLoading:!1})}handleReconnect(){this.setState({isDisconnected:!1,error:null})}handleLoadError(e){Te.isCanceled(e)||this.handleError(e)}modelInitialized(e){const{glEventHub:n,loadPlugin:s}=this.props;if(this.modelPromise=void 0,this.loadPanelState(e),this.setState({isModelReady:!0}),li(e)){const{table:i}=e,{pluginName:o}=i;if(o!==""&&s!=null&&o!=null){const r=s(o);this.setState({Plugin:r})}n.emit(Pe.TABLE_CHANGED,this,i)}this.sendColumnsChange(e.columns)}handleClearAllFilters(){const e=this.irisGrid.current,{isDisconnected:n}=this.state;e!=null&&!n&&e.clearAllFilters()}sendColumnsChange(e){Un.debug2("sendColumnsChange",e);const{glEventHub:n}=this.props;n.emit(Pe.COLUMNS_CHANGED,this,e)}startModelListening(e){e.addEventListener(Ce.EVENT.DISCONNECT,this.handleDisconnect),e.addEventListener(Ce.EVENT.RECONNECT,this.handleReconnect),e.addEventListener(Ce.EVENT.COLUMNS_CHANGED,this.handleColumnsChanged),e.addEventListener(Ce.EVENT.TABLE_CHANGED,this.handleTableChanged)}stopModelListening(e){e.removeEventListener(Ce.EVENT.DISCONNECT,this.handleDisconnect),e.removeEventListener(Ce.EVENT.RECONNECT,this.handleReconnect),e.removeEventListener(Ce.EVENT.COLUMNS_CHANGED,this.handleColumnsChanged),e.removeEventListener(Ce.EVENT.TABLE_CHANGED,this.handleTableChanged)}getCoordinateForColumn(e){var w,T,y;const{model:n}=this.state;if(!n)return null;const s=this.irisGrid.current,{gridWrapper:i}=s||{},o=(w=i==null?void 0:i.getBoundingClientRect())!=null?w:null;if(o==null||o.width<=0||o.height<=0)return null;P(s);const{metrics:r}=s.state;P(r);const{columnHeaderHeight:l,visibleColumnXs:a,visibleColumnWidths:d,right:c,columnHeaderMaxDepth:u}=r,m=n.getColumnIndexByName(e);P(m);const p=s.getVisibleColumn(m),g=(T=a.get(p))!=null?T:0,f=(y=d.get(p))!=null?y:0,b=Math.max(o.left,Math.min(p>c?o.right:o.left+g+f*.5,o.right)),C=o.top+l*u;return[b,C]}setFilterMap(e){const n=this.irisGrid.current;n!=null&&n.setFilterMap(e)}setAdvancedFilterMap(e){const n=this.irisGrid.current;n!=null&&n.setAdvancedFilterMap(e)}setFilters({quickFilters:e,advancedFilters:n}){Un.debug("setFilters",e,n);const{model:s,isDisconnected:i}=this.state,o=this.irisGrid.current;if(o==null||i){Un.debug("Ignore setFilters, model disconnected");return}P(s);const{columns:r,formatter:l}=s,a=ne.changeFilterColumnNamesToIndexes(s.columns,e).filter(([c])=>s.isFilterable(c)),d=ne.changeFilterColumnNamesToIndexes(s.columns,n).filter(([c])=>s.isFilterable(c));o.clearAllFilters(),o.setFilters({quickFilters:ne.hydrateQuickFilters(r,a,l.timeZone),advancedFilters:ne.hydrateAdvancedFilters(r,d,l.timeZone)})}setStateOverrides(e){Un.debug("setStateOverrides",e);const{irisGridState:n,gridState:s}=e;this.setState({irisGridStateOverrides:n,gridStateOverrides:s},()=>{this.initModel()})}unsetFilterValue(){}loadPanelState(e){const{panelState:n,irisGridStateOverrides:s,gridStateOverrides:i}=this.state;if(n!=null)try{const{gridState:o,irisGridState:r,irisGridPanelState:l}=n,a={...s},{quickFilters:d,advancedFilters:c}=a;d&&(a.quickFilters=ne.changeFilterColumnNamesToIndexes(e.columns,d)),c&&(a.advancedFilters=ne.changeFilterColumnNamesToIndexes(e.columns,c));const{isSelectingPartition:u,partition:m,partitionColumn:p,advancedSettings:g}=ne.hydrateIrisGridPanelState(e,l),{advancedFilters:f,customColumns:b,customColumnFormatMap:C,isFilterBarShown:w,quickFilters:T,reverseType:y,rollupConfig:E,aggregationSettings:I,sorts:D,userColumnWidths:F,userRowHeights:x,showSearchBar:U,searchValue:B,selectDistinctColumns:_,selectedSearchColumns:H,invertSearchColumns:A,pendingDataMap:N,frozenColumns:k,conditionalFormats:O}=ne.hydrateIrisGridState(e,{...r,...a}),{isStuckToBottom:V,isStuckToRight:G,movedColumns:Q,movedRows:Z}=ne.hydrateGridState(e,{...o,...i},r.customColumns);this.setState({advancedFilters:f,advancedSettings:g,conditionalFormats:O,customColumns:b,customColumnFormatMap:C,isFilterBarShown:w,isSelectingPartition:u,movedColumns:Q,movedRows:Z,partition:m,partitionColumn:p,quickFilters:T,reverseType:y,rollupConfig:E,aggregationSettings:I,sorts:D,userColumnWidths:F,userRowHeights:x,showSearchBar:U,searchValue:B,selectDistinctColumns:_,selectedSearchColumns:H,invertSearchColumns:A,pendingDataMap:N,frozenColumns:k,isStuckToBottom:V,isStuckToRight:G})}catch(o){Un.error("loadPanelState failed to load panelState",n,o)}}updateGrid(){var n,s;const e=(s=(n=this.irisGrid.current)==null?void 0:n.grid)!=null?s:null;!e||e.handleResize()}render(){var Ln,$t;const{children:e,glContainer:n,glEventHub:s,columnSelectionValidator:i,getDownloadWorker:o,inputFilters:r,links:l,metadata:a,panelState:d,user:c,workspace:u,settings:m,theme:p}=this.props,{advancedFilters:g,aggregationSettings:f,advancedSettings:b,conditionalFormats:C,customColumns:w,customColumnFormatMap:T,error:y,isDisconnected:E,isFilterBarShown:I,isSelectingPartition:D,isStuckToBottom:F,isStuckToRight:x,isLoaded:U,isLoading:B,isModelReady:_,model:H,movedColumns:A,movedRows:N,partition:k,partitionColumn:O,quickFilters:V,reverseType:G,rollupConfig:Q,sorts:Z,userColumnWidths:be,userRowHeights:le,showSearchBar:he,searchValue:De,selectDistinctColumns:ee,selectedSearchColumns:ue,invertSearchColumns:Se,Plugin:Me,pluginFilters:qe,pluginFetchColumns:ke,pendingDataMap:Qn,frozenColumns:vn}=this.state,wt=y!=null?`Unable to open table. ${y}`:void 0,{table:Re}=a,ot=(Ln=H==null?void 0:H.description)!=null?Ln:void 0,rt=($t=d==null?void 0:d.pluginState)!=null?$t:null,_t=e!=null?e:this.getPluginContent(Me,H,c,u,rt),{permissions:Zt}=c,{canCopy:Jt,canDownloadCsv:kt}=Zt;return h(Ul,{errorMessage:wt,isDisconnected:E,isLoading:B,isLoaded:U,className:"iris-grid-panel",glContainer:n,glEventHub:s,onClearAllFilters:this.handleClearAllFilters,onResize:this.handleResize,onShow:this.handleShow,onTabFocus:this.handleShow,onTabClicked:this.handleTabClicked,widgetName:Re,widgetType:"Table",description:ot,componentPanel:this,renderTabTooltip:()=>h(rc,{model:H,widgetName:Re,glContainer:n,description:ot}),children:_&&H&&h(io,{advancedFilters:g,aggregationSettings:f,advancedSettings:b,alwaysFetchColumns:this.getAlwaysFetchColumns(l,ke),columnAllowedCursor:"linker",columnNotAllowedCursor:"not-allowed",customColumns:w,customColumnFormatMap:T,columnSelectionValidator:this.isColumnSelectionValid,conditionalFormats:C,inputFilters:this.getGridInputFilters(H.columns,r),applyInputFiltersOnInit:d==null,isFilterBarShown:I,isSelectingColumn:i!=null,isSelectingPartition:D,isStuckToBottom:F,isStuckToRight:x,movedColumns:A,movedRows:N,partition:k,partitionColumn:O,quickFilters:V,reverseType:G,rollupConfig:Q,settings:m,sorts:Z,userColumnWidths:be,userRowHeights:le,model:H,showSearchBar:he,searchValue:De,selectedSearchColumns:ue,selectDistinctColumns:ee,invertSearchColumns:Se,onColumnSelected:this.handleColumnSelected,onCreateChart:this.handleCreateChart,onDataSelected:this.handleDataSelected,onError:this.handleError,onPartitionAppend:this.handlePartitionAppend,onStateChange:this.handleGridStateChange,onContextMenu:this.handleContextMenu,onAdvancedSettingsChange:this.handleAdvancedSettingsChange,customFilters:qe,pendingDataMap:Qn,canCopy:Jt,canDownloadCsv:kt,ref:this.irisGrid,getDownloadWorker:o,frozenColumns:vn,theme:p,children:_t})})}}Yi.defaultProps={onStateChange:()=>{},onPanelStateUpdate:()=>{}};Yi.displayName="IrisGridPanel";Yi.COMPONENT="IrisGridPanel";const GE=(t,{localDashboardId:e=Mn})=>({inputFilters:Xd(t,e),links:oo(t,e),columnSelectionValidator:Zd(t,e),user:gm(t),workspace:Dl(t),settings:xt(t)}),hi=Ft(GE,null,null,{forwardRef:!0})(Yi);const Hh=X.module("InputFilter"),KE=150,Ya=class extends S.exports.Component{constructor(t){super(t),this.getItemLabel=ve((i,o)=>{const{name:r,type:l}=i[o];if(o>0&&i[o-1].name===r||o<i.length-1&&i[o+1].name===r){const a=l.substring(l.lastIndexOf(".")+1);return`${r} (${a})`}return r}),this.sendUpdate=je(()=>{const{onChange:i}=this.props,{column:o,value:r,isValueShown:l}=this.state;i({column:o,isValueShown:l,value:r})},KE),this.handleColumnChange=this.handleColumnChange.bind(this),this.handleInputKeyPress=this.handleInputKeyPress.bind(this),this.handleValueChange=this.handleValueChange.bind(this),this.handleSettingsCancel=this.handleSettingsCancel.bind(this),this.handleSettingsClick=this.handleSettingsClick.bind(this),this.handleSettingsSave=this.handleSettingsSave.bind(this),this.handleBackgroundClick=this.handleBackgroundClick.bind(this),this.inputRef=Y.createRef();const{column:e,isValueShown:n,value:s}=t;this.state={column:e,selectedColumn:e,value:s,isValueShown:n}}componentDidUpdate(t,e){const{column:n}=this.props,{column:s,value:i,isValueShown:o}=this.state;n!==t.column&&this.setState({column:n,selectedColumn:n}),o!==void 0&&o&&o!==e.isValueShown&&this.focusInput(),(s!==e.column||i!==e.value||o!==e.isValueShown)&&this.sendUpdate()}componentWillUnmount(){this.sendUpdate.flush()}handleColumnChange(t){const{columns:e}=this.props,{value:n}=t.target,s=e[parseInt(n,10)];Hh.debug2("handleColumnChange",s),this.setState({selectedColumn:s,value:void 0})}handleInputKeyPress(t){t.key==="Enter"&&(t.preventDefault(),t.stopPropagation(),this.setState(({value:e})=>e==null?{value:""}:null,()=>{this.sendUpdate(),this.sendUpdate.flush()}))}handleValueChange(t){const{value:e}=t.target;Hh.debug2("handleValueChange",e),this.setState({value:e})}handleSettingsCancel(){const{column:t}=this.state;this.setState({selectedColumn:t,isValueShown:!0})}handleSettingsSave(){const{selectedColumn:t}=this.state;this.setState({column:t,isValueShown:!0})}handleSettingsClick(t){const{column:e}=this.state;this.setState({selectedColumn:e,isValueShown:!1}),t.stopPropagation()}handleBackgroundClick(t){t.target!==this.inputRef.current&&this.focusInput()}focusInput(){this.inputRef.current!==null&&(this.inputRef.current.select(),this.inputRef.current.focus())}clearFilter(){this.setState({value:""})}setFilterState({name:t,type:e,value:n,isValueShown:s}){const i=t!=null&&e!=null?{name:t,type:e}:void 0,o=s===void 0?{column:i,value:n}:{column:i,value:n,isValueShown:s};this.setState(o)}render(){const{columns:t}=this.props,{column:e,isValueShown:n,selectedColumn:s,value:i}=this.state,o=i==null||i.length===0?Ya.PLACEHOLDER.length:i.length;let r=null;if(e!=null){const l=t.findIndex(a=>a.name===e.name&&a.type===e.type);r=l>=0?this.getItemLabel(t,l):e.name}return v(rd,{className:"input-filter fill-parent-absolute",isFlipped:n!=null?n:!1,children:[h("div",{className:"input-filter-settings-card",children:v("div",{className:"input-filter-settings-content",children:[v("div",{className:"input-filter-settings-grid",children:[h("label",{children:"Filter Column"}),v("select",{value:t.findIndex(l=>l.name===(s==null?void 0:s.name)&&l.type===(s==null?void 0:s.type)),className:"custom-select",onChange:this.handleColumnChange,children:[t.map((l,a)=>h("option",{value:a,children:this.getItemLabel(t,a)},`${l.name}/${l.type}`)),t.length===0&&h("option",{value:"-1",disabled:!0,children:"No Available Columns"})]}),h("div",{className:"text-muted small",children:"Input filter control will apply its filter to all columns matching this name in this dashboard."})]}),v("div",{className:"input-filter-settings-buttons",children:[h(z,{kind:"secondary",onClick:this.handleSettingsCancel,disabled:e==null,children:"Cancel"}),h(z,{kind:"primary",className:"ml-2",onClick:this.handleSettingsSave,disabled:s==null,children:"Save"})]})]})}),v("div",{className:"input-filter-value-card",onClick:this.handleBackgroundClick,children:[h("div",{className:"input-filter-column",children:v("div",{className:"input-filter-column-title",children:[r," Filter"]})}),h("div",{className:"d-flex justify-content-center align-items-center h-100 w-100",children:h("div",{className:"input-filter-value-input d-flex flex-column justify-content-center",children:h("input",{type:"text",ref:this.inputRef,placeholder:Ya.PLACEHOLDER,value:i!=null?i:"",onChange:this.handleValueChange,onKeyPress:this.handleInputKeyPress,style:{width:`${o+3}ch`},spellCheck:"false"})})}),h("div",{className:"input-filter-menu",children:h(z,{kind:"ghost",className:"m-2 px-2",onClick:this.handleSettingsClick,icon:h(j,{icon:Go,transform:"grow-4"}),tooltip:"Input Filter Settings"})})]})]})}};let lc=Ya;lc.PLACEHOLDER="Enter value...";lc.defaultProps={column:null,isValueShown:!1,value:null};const qE=250;class zl extends S.exports.Component{constructor(e){super(e),this.handleChange=je(this.handleChange.bind(this),qE),this.handleClearAllFilters=this.handleClearAllFilters.bind(this),this.inputFilterRef=Y.createRef();const{panelState:n}=e,{value:s,isValueShown:i=!1,name:o,type:r,timestamp:l}=n!=null?n:{};this.state={columns:[],column:o!=null&&r!=null?{name:o,type:r}:void 0,value:s,timestamp:l,isValueShown:i,wasFlipped:!1,skipUpdate:!1,panelState:n}}componentDidMount(){this.updateColumns();const{column:e,value:n,timestamp:s}=this.state;if(e!=null){const{name:i,type:o}=e;this.sendUpdate(i,o,n,s)}}componentDidUpdate(e){const{columns:n}=this.props;n!==e.columns&&this.updateColumns()}handleChange({column:e,isValueShown:n=!1,value:s}){let i,o;e!=null&&({name:i,type:o}=e);let r=!0,l=Date.now();this.setState(({panelState:a,timestamp:d,wasFlipped:c,skipUpdate:u})=>{var p;const m=a!=null&&n!==a.isValueShown&&i===a.name&&o===a.type&&s===a.value;return r=(p=!u&&n&&(!m||!c))!=null?p:!1,r||(l=d),{panelState:{isValueShown:n,name:i,type:o,value:s,timestamp:l},timestamp:l,wasFlipped:m,skipUpdate:!1}},()=>{r&&this.sendUpdate(i,o,s,l)})}handleClearAllFilters(){var e;(e=this.inputFilterRef.current)==null||e.clearFilter()}sendUpdate(e,n,s,i){const{glEventHub:o}=this.props;o.emit(Pe.FILTERS_CHANGED,this,{name:e,type:n,value:s,timestamp:i})}setPanelState(e,n=!1){var s;this.setState({skipUpdate:!n}),(s=this.inputFilterRef.current)==null||s.setFilterState(e)}updateColumns(){const{columns:e}=this.props;e!=null&&this.setState(n=>{const{column:s}=n;return s==null&&e.length>0?{columns:[...e],column:e[0]}:s!=null&&!e.find(({name:i,type:o})=>s.name===i&&s.type===o)?{columns:[...e,s]}:{columns:[...e]}})}render(){const{glContainer:e,glEventHub:n}=this.props,{column:s,columns:i,isValueShown:o,value:r}=this.state;return h(jn,{className:"iris-input-filter-panel",componentPanel:this,glContainer:e,glEventHub:n,onClearAllFilters:this.handleClearAllFilters,isClonable:!0,isRenamable:!0,children:h(lc,{ref:this.inputFilterRef,column:s,columns:i,onChange:this.handleChange,isValueShown:o,value:r})})}}zl.defaultProps={panelState:null};zl.COMPONENT="InputFilterPanel";zl.displayName="InputFilterPanel";const YE=(t,e)=>{const{localDashboardId:n}=e;return{columns:Fp(t,n)}},_o=Ft(YE,null,null,{forwardRef:!0})(zl);const Mt=X.module("FilterSetManagerPanel");function XE(t){return t.setPanelState!=null}const Xa=class extends S.exports.Component{static changeFilterIndexesToColumnNames(t,e){return e.map(([n,s])=>{if(n>=t.columns.length)return null;const{name:i}=t.columns[n];return{name:i,filter:s}}).filter(n=>n!=null)}constructor(t){super(t),this.handleChange=this.handleChange.bind(this),this.handleFilterApply=this.handleFilterApply.bind(this),this.handleSetsUpdate=this.handleSetsUpdate.bind(this),this.handleGetFilterState=this.handleGetFilterState.bind(this);const{panelState:e,filterSets:n}=t,{selectedId:s=n.length>0?n[0].id:void 0,isValueShown:i=!1}=e!=null?e:{};this.state={selectedId:s,isValueShown:i,panelState:e}}getFilterState(){const{dashboardOpenedPanelMap:t}=this.props,e=[];return[...t.keys()].forEach(n=>{const s=t.get(n);if(s===void 0){Mt.error("Could not get panel",s);return}const i=te.getComponentNameFromPanel(s),o=te.getIdFromPanel(s);Mt.debug("Panel:",s,i);const{glContainer:r=null}=s.props;if(r==null){Mt.error("Could not get panel container",s);return}const l=te.getComponentConfigFromContainer(r);if(l==null){Mt.error("Could not get component config from container",r);return}const a=te.getPanelComponentState(l);if(a==null){Mt.debug(`Panel state is null ${o}`);return}switch(i){case te.getComponentName(Yi):{let d;o!=null&&(d=this.getIrisGridPanelFilters(o,a)),d!=null&&e.push({panelId:o,type:i,state:d});break}case te.getComponentName(_o):case te.getComponentName(ci):{const{isValueShown:d,name:c,type:u,value:m}=a;e.push({panelId:o,type:i,state:{isValueShown:d,name:c,type:u,value:m}});break}}}),e}getIrisGridPanelFilters(t,e){const{panelTableMap:n}=this.props,s=n.get(t);if(s==null)return Mt.error(`Unable to get table for panel ${t}.`),null;const{irisGridState:i={advancedFilters:void 0,quickFilters:void 0},gridState:o={}}=e,{advancedFilters:r,quickFilters:l}=i;let a;r&&(a=Xa.changeFilterIndexesToColumnNames(s,r));let d;return l&&(d=Xa.changeFilterIndexesToColumnNames(s,l)),{irisGridState:{...i,advancedFilters:a,quickFilters:d},gridState:{...o}}}handleGetFilterState(){return this.getFilterState()}handleChange({isValueShown:t,selectedId:e}){Mt.debug("handleChange",t,e),this.setState({isValueShown:t,selectedId:e}),this.updatePanelState()}handleFilterApply(t){const{dashboardOpenedPanelMap:e}=this.props,{panels:n,restoreFullState:s=!1}=t;Mt.debug("Apply filters from filter set",t),n.forEach(({panelId:i,type:o,state:r})=>{if(i==null){Mt.debug("panel is null",i);return}if(!e.has(i)){Mt.debug("Ignore closed panel",i);return}Mt.debug("Apply panel filters",i,o,r);const l=e.get(i);switch(o){case te.getComponentName(Yi):this.restoreIrisGridFilters(l,r,s);break;case te.getComponentName(_o):case te.getComponentName(ci):this.restoreInputFilterState(l,r);break}})}handleSetsUpdate(t){const{setDashboardFilterSets:e,localDashboardId:n}=this.props;Mt.debug("Saving updated sets",t),e(n,[...t])}updatePanelState(){this.setState(({selectedId:t,isValueShown:e})=>({panelState:{selectedId:t,isValueShown:e}}))}restoreIrisGridFilters(t,e,n){const{irisGridState:s={},advancedFilters:i=[],quickFilters:o=[]}=e,{advancedFilters:r=i,quickFilters:l=o}=s,{panelTableMap:a}=this.props,d=te.getIdFromPanel(t);if(d==null){Mt.error("Panel Id is null.");return}if(a.get(d)==null){Mt.error(`Unable to get table for panel ${d}.`);return}Mt.debug("restoreIrisGridFilters",d,e,n),n?t.setStateOverrides(e):t.setFilters({quickFilters:l,advancedFilters:r})}restoreInputFilterState(t,e){const n={...e};delete n.isValueShown,Mt.debug("restoreInputFilterState",t,n),t&&XE(t)&&t.setPanelState(n)}render(){const{glContainer:t,glEventHub:e,filterSets:n}=this.props,{isValueShown:s,selectedId:i}=this.state;return h(jn,{className:"filter-set-manager-panel",componentPanel:this,glContainer:t,glEventHub:e,isClonable:!0,isRenamable:!0,children:h("div",{className:"input-filter-container h-100 w-100 container",children:h(ll,{onChange:this.handleChange,onApply:this.handleFilterApply,onUpdateSets:this.handleSetsUpdate,isValueShown:s,filterSets:n,selectedId:i,getFilterState:this.handleGetFilterState})})})}};let ac=Xa;ac.defaultProps={panelState:null};ac.COMPONENT="FilterSetManagerPanel";const jE=(t,e)=>{const{localDashboardId:n}=e;return{filterSets:uE(t,n),dashboardOpenedPanelMap:jm(t,n),dashboardInputFilters:Xd(t,n),panelTableMap:jd(t,n)}},wa=Ft(jE,{setDashboardFilterSets:wE},null,{forwardRef:!0})(ac);const Vh=X.module("LogPanel");class Gl extends S.exports.PureComponent{constructor(e){super(e),this.handleResize=this.handleResize.bind(this),this.handleShow=this.handleShow.bind(this),this.handleHide=this.handleHide.bind(this),this.handleSessionOpened=this.handleSessionOpened.bind(this),this.handleSessionClosed=this.handleSessionClosed.bind(this),this.isBottomVisible=!0,this.logView=null;const{session:n}=this.props;this.state={session:n}}handleResize(){this.updateDimensions()}handleShow(){this.updateDimensions(),this.logView&&(this.logView.triggerFindWidget(),this.isBottomVisible&&this.logView.scrollToBottom())}handleHide(){this.logView&&(this.isBottomVisible=this.logView.isBottomVisible())}handleSessionOpened(e){Vh.debug("Session opened",[e]),this.setState({session:e})}handleSessionClosed(e){Vh.debug("Session closed",e)}updateDimensions(){this.logView&&this.logView.updateDimensions()}render(){const{glContainer:e,glEventHub:n}=this.props,{session:s}=this.state;return v(jn,{componentPanel:this,glContainer:e,glEventHub:n,onResize:this.handleResize,onHide:this.handleHide,onShow:this.handleShow,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,children:[s==null&&h("div",{className:"log-panel-disconnected-message",children:"Waiting for session connection"}),s!=null&&h(Ji,{session:s,ref:i=>{this.logView=i}})]})}}Gl.defaultProps={session:null};Gl.COMPONENT="LogPanel";Gl.TITLE="Log";const QE=(t,e)=>{var n;return{session:(n=gi(t,e.localDashboardId))==null?void 0:n.session}},al=Ft(QE,null,null,{forwardRef:!0})(Gl);class Ap extends S.exports.PureComponent{render(){const{isEditing:e,children:n,onDoubleClick:s}=this.props;return v("div",{className:"markdown-editor-container h-100 w-100",onDoubleClick:s,children:[h("div",{className:W("text-muted","edit-hint",{viewing:e===void 0||!e}),children:v("span",{children:["double-click to edit ",h(j,{icon:pl})]})}),n]})}}Ap.defaultProps={isEditing:!1};const ZE=X.module("MarkdownStartPage");class Pp extends S.exports.PureComponent{constructor(e){super(e),this.handleDeleteButtonClick=this.handleDeleteButtonClick.bind(this),this.handleDeleteModalClose=this.handleDeleteModalClose.bind(this),this.state={isDeleteModalShown:!1}}handleDeleteButtonClick(e){this.setState({isDeleteModalShown:!0,toBeDeleted:e})}handleDeleteModalClose(){this.setState({isDeleteModalShown:!1,toBeDeleted:void 0})}handleDeleteMarkdown(e){if(ZE.debug("delete markdown: ",e),e!==void 0){const{onDelete:n}=this.props;n(e)}this.setState({isDeleteModalShown:!1,toBeDeleted:void 0})}render(){const{closedMarkdowns:e,onOpen:n,onCreate:s}=this.props,{isDeleteModalShown:i,toBeDeleted:o}=this.state;return h("div",{className:"markdown-panel-start-page h-100 w-100",children:v("div",{className:"markdown-panel-start-page-container",children:[v("div",{className:"markdown-panel-start-list",children:[h("h3",{className:"list-title",children:"Start"}),h("div",{className:"list-item",children:h(z,{kind:"ghost",className:"title",onClick:s,children:"New Markdown Note"})})]}),v("div",{className:"markdown-panel-start-list",children:[h("h3",{className:"list-title",children:"Recently Closed from Dashboard"}),e.map(r=>v("div",{className:"list-item",children:[h(z,{kind:"ghost",className:"title",onClick:()=>n(r),children:r.title}),h("button",{className:"btn-link icon",type:"button",onClick:()=>{this.handleDeleteButtonClick(r)},children:h(j,{icon:wn})})]},r.id)),v($o,{isOpen:i,toggle:this.handleDeleteModalClose,className:"modal-dialog-centered markdown-delete-modal theme-bg-light",children:[h(zo,{children:"Are you sure you want to permanently delete this note?"}),h(Wo,{children:"You can't undo this action."}),v(od,{children:[h(z,{kind:"secondary",onClick:this.handleDeleteModalClose,children:"Cancel"}),h(z,{kind:"danger",onClick:()=>{this.handleDeleteMarkdown(o)},children:"Delete"})]})]})]})]})})}}Pp.defaultProps={closedMarkdowns:[],onOpen:()=>{},onCreate:()=>{},onDelete:()=>{}};const JE=t=>{const{children:e,className:n}=t,s=n!==void 0&&(n==null?void 0:n.startsWith("language-"))?n.substring(9):"plaintext";return h("pre",{children:h("code",{children:h(yl,{language:s,children:Y.Children.map(e,i=>typeof i=="string"?i.trim():i)})})})};class Hp extends S.exports.PureComponent{constructor(e){super(e),this.container=null}render(){const{isEditing:e,content:n,onEditorInitialized:s}=this.props;return h("div",{className:"markdown-editor-container",ref:i=>{this.container=i},children:e?h(Il,{settings:{language:"markdown",value:n,lineNumbers:"off"},onEditorInitialized:s}):h(ou,{components:{code:JE},children:n})})}}Hp.defaultProps={isEditing:!1,content:""};const xr=X.module("MarkdownPanel");class dc extends S.exports.Component{constructor(e){super(e),this.getClosedMarkdowns=pe(i=>i.filter(o=>o.component==="MarkdownPanel").reverse()),this.handleContainerDoubleClick=this.handleContainerDoubleClick.bind(this),this.handleCreateMarkdown=this.handleCreateMarkdown.bind(this),this.handleDeleteMarkdown=this.handleDeleteMarkdown.bind(this),this.handleOpenMarkdown=this.handleOpenMarkdown.bind(this),this.handleEditorInitialized=this.handleEditorInitialized.bind(this),this.handleEditorBlur=this.handleEditorBlur.bind(this),this.handleEditorResize=this.handleEditorResize.bind(this);const{panelState:n}=e;let s=null;n!=null&&n.content!=null&&({content:s}=n),this.state={isStartPageShown:s==null,isEditing:!1,content:s,panelState:n},this.markdownEditor=null}setEditorPosition(e){var s,i;P(this.markdownEditor);const{container:n}=this.markdownEditor;if(this.editor&&n){const o=n.getBoundingClientRect().top,r=n.scrollTop,l=n.scrollHeight,a=(i=(s=this.editor.getModel())==null?void 0:s.getLineCount())!=null?i:0;let d=Math.round((r+e-o)/l*a);d>a&&(d=a),this.editor.revealLine(d),this.editor.setPosition({lineNumber:d,column:1}),this.editor.focus()}}handleContainerDoubleClick(e){const{isEditing:n}=this.state,s=e.clientY;n||this.setState({isEditing:!0},()=>{this.setEditorPosition(s)})}handleEditorInitialized(e){xr.debug("Markdown Editor Initialized..."),this.editor=e}handleCreateMarkdown(){xr.debug("create markdown..."),this.setState({isStartPageShown:!1,content:"",isEditing:!0,panelState:{content:""}},()=>{this.editor!=null&&this.editor.focus!=null&&this.editor.focus()})}handleOpenMarkdown(e){xr.debug("open markdown...",e);const{glContainer:n,glEventHub:s}=this.props,i=te.getComponentConfigFromContainer(n);s.emit(Ie.REOPEN,e,i)}handleDeleteMarkdown(e){const{glEventHub:n}=this.props;n.emit(Ie.DELETE,e)}handleEditorBlur(e){var i;xr.debug("markdown content changed, saving...");const{isEditing:n}=this.state;if(!n||this.markdownEditor!=null&&this.markdownEditor.container!=null&&this.markdownEditor.container.contains(e.relatedTarget))return;const s=(i=this.editor)==null?void 0:i.getValue();this.setState({content:s,isEditing:!1,panelState:{content:s}})}handleEditorResize(){const{isEditing:e}=this.state;e&&this.editor&&this.editor.layout()}render(){const{glContainer:e,glEventHub:n,closedPanels:s}=this.props,{isEditing:i,isStartPageShown:o,content:r}=this.state,l=this.getClosedMarkdowns(s);return h(jn,{glContainer:e,glEventHub:n,className:"markdown-panel",componentPanel:this,onResize:this.handleEditorResize,onBlur:this.handleEditorBlur,isClonable:!0,isRenamable:!0,children:o?h(Pp,{closedMarkdowns:l,onCreate:this.handleCreateMarkdown,onOpen:this.handleOpenMarkdown,onDelete:this.handleDeleteMarkdown}):h(Ap,{isEditing:i,onDoubleClick:this.handleContainerDoubleClick,children:h(Hp,{ref:a=>{this.markdownEditor=a},isEditing:i,content:r!=null?r:void 0,onEditorInitialized:this.handleEditorInitialized})})})}}dc.defaultProps={panelState:null};dc.COMPONENT="MarkdownPanel";const e1=(t,e)=>{const{localDashboardId:n}=e;return{closedPanels:w0(t,n)}},So=Ft(e1,null,null,{forwardRef:!0})(dc);class Vp extends S.exports.PureComponent{constructor(e){super(e),this.handleRunSelected=this.handleRunSelected.bind(this),this.renderCodeBlock=this.renderCodeBlock.bind(this),this.renderLink=this.renderLink.bind(this),this.commands=new Map,this.codeElements=new Map,this.editorScrollView=Y.createRef(),this.state={hasCode:!1,hasRunCode:!1,nextStartLine:null}}componentDidMount(){this.updateHasCode()}componentDidUpdate(){this.updateHasCode()}updateHasCode(){const{hasCode:e}=this.state;this.commands.size===0&&e?this.setState({hasCode:!1}):this.commands.size>0&&!e&&this.setState({hasCode:!0})}getNextStartLine(e){const n=[...this.commands.keys()],s=n.findIndex(i=>i===e)+1;return s>=n.length?null:n[s]}handleRunSelected(e){var c,u,m;e.preventDefault(),e.stopPropagation();const{nextStartLine:n}=this.state,s=[...this.commands.keys()],i=s.findIndex(p=>p===n||n==null);if(i<0)return;const o=s[i],r=this.commands.get(o),l=this.getNextStartLine(o),a=(c=this.codeElements.get(o))==null?void 0:c.current,d=(u=a==null?void 0:a.parentElement)==null?void 0:u.nextElementSibling;if(d!=null){const{offsetTop:p}=d,g=p;(m=this.editorScrollView.current)==null||m.scroll({top:g,left:0})}this.runCode(r),this.setState({nextStartLine:l})}runCode(e){const{onRunCode:n}=this.props;n(e),this.setState({hasRunCode:!0})}renderCodeBlock(e){const{children:n,className:s,inline:i,node:o}=e,{hasRunCode:r,nextStartLine:l}=this.state,{children:a,position:d}=o;P(d);const{start:c}=d,{line:u}=c,m=a[0].value,p=Y.createRef(),g=this.commands.size===0,f=l===u||g&&l==null&&!r,b=s!==void 0&&s.startsWith("language-")?s.substring(9):"plaintext";return i!=null&&i?h("code",{className:s,children:n}):(this.commands.set(u,m),this.codeElements.set(u,p),v("div",{className:W("markdown-notebook-code-block",{"is-selected":f}),ref:p,onClick:()=>{this.setState({nextStartLine:u})},role:"presentation",children:[h(z,{kind:"ghost",icon:Yr,className:"btn-play-block",onClick:C=>{C.stopPropagation(),C.preventDefault(),this.runCode(m),this.setState({nextStartLine:u})},tooltip:"Run code"}),h("code",{children:h(yl,{language:b,children:Y.Children.map(n,C=>typeof C=="string"?C.trim():C)})})]}))}renderLink(e){const{onLinkClick:n}=this.props,{href:s,children:i,target:o}=e;return h("a",{href:s,onClick:n,target:o,children:i})}render(){const{content:e,transformImageUri:n,transformLinkUri:s}=this.props,{hasCode:i,hasRunCode:o,nextStartLine:r}=this.state;return v("div",{className:"markdown-notebook",children:[h("div",{className:"markdown-notebook-toolbar",children:h(z,{className:W("btn-play-selected-cell",{flashing:i&&!o}),kind:"ghost",icon:Yr,onClick:this.handleRunSelected,tooltip:"Run code and select next",disabled:o&&r==null||!i,children:"Run Selected Code"})}),h("div",{className:"markdown-notebook-content",ref:this.editorScrollView,children:h(ou,{components:{code:this.renderCodeBlock,a:this.renderLink},linkTarget:"_blank",remarkPlugins:[fg],transformLinkUri:s,transformImageUri:n,includeElementIndex:!0,children:e})})]})}}Vp.defaultProps={onRunCode:()=>{}};const Be=X.module("NotebookPanel"),Uh=400,_i=class extends S.exports.Component{constructor(t){super(t),this.getSettings=pe((u,m)=>({...u,minimap:{enabled:m}})),this.getOverflowActions=pe((u,m)=>[{title:"Find",icon:Zf,action:this.handleFind,group:oe.groups.high,shortcut:Bt.NOTEBOOK.FIND,order:10},{title:"Show Minimap",icon:u?ds:void 0,action:this.handleMinimapChange,group:oe.groups.medium,shortcut:Bt.NOTEBOOK.MINIMAP,order:20},{title:"Word Wrap",icon:m?ds:void 0,action:this.handleWordWrapChange,group:oe.groups.medium,shortcut:Bt.NOTEBOOK.WORDWRAP,order:30}]),this.handleBlur=this.handleBlur.bind(this),this.handleCloseCancel=this.handleCloseCancel.bind(this),this.handleCloseDiscard=this.handleCloseDiscard.bind(this),this.handleCloseSave=this.handleCloseSave.bind(this),this.handleCopy=this.handleCopy.bind(this),this.handleEditorInitialized=this.handleEditorInitialized.bind(this),this.handleEditorWillDestroy=this.handleEditorWillDestroy.bind(this),this.handleEditorChange=this.handleEditorChange.bind(this),this.handleFind=this.handleFind.bind(this),this.handleMinimapChange=this.handleMinimapChange.bind(this),this.handleWordWrapChange=this.handleWordWrapChange.bind(this),this.handleFocus=this.handleFocus.bind(this),this.handleLinkClick=this.handleLinkClick.bind(this),this.handleLoadSuccess=this.handleLoadSuccess.bind(this),this.handleLoadError=this.handleLoadError.bind(this),this.handlePanelTabClick=this.handlePanelTabClick.bind(this),this.handleRenameFile=this.handleRenameFile.bind(this),this.handleResize=this.handleResize.bind(this),this.handleRunCommand=this.handleRunCommand.bind(this),this.handleRunAll=this.handleRunAll.bind(this),this.handleRunSelected=this.handleRunSelected.bind(this),this.handleSave=this.handleSave.bind(this),this.handleSaveAsCancel=this.handleSaveAsCancel.bind(this),this.handleSaveAsSubmit=this.handleSaveAsSubmit.bind(this),this.handleSaveError=this.handleSaveError.bind(this),this.handleSaveSuccess=this.handleSaveSuccess.bind(this),this.handleSessionOpened=this.handleSessionOpened.bind(this),this.handleSessionClosed=this.handleSessionClosed.bind(this),this.handleShow=this.handleShow.bind(this),this.handleShowRename=this.handleShowRename.bind(this),this.handleTab=this.handleTab.bind(this),this.handleTabFocus=this.handleTabFocus.bind(this),this.handleTabBlur=this.handleTabBlur.bind(this),this.handleTransformLinkUri=this.handleTransformLinkUri.bind(this),this.getDropdownOverflowActions=this.getDropdownOverflowActions.bind(this),this.pending=new fs,this.debouncedSavePanelState=je(this.savePanelState.bind(this),Uh),this.debouncedLoad=je(this.load.bind(this),Uh),this.notebook=null,this.tabTitleElement=null,this.tabInitOnce=!1,this.shouldPromptClose=!0;const{isDashboardActive:e,session:n,sessionLanguage:s,panelState:i}=t;let o={value:"",language:"",wordWrap:"off"},r=null,{isPreview:l}=t;i!=null&&({fileMetadata:r=r,isPreview:l=l,settings:o=o}=i);const a=r!=null&&ce.hasPath(r.itemName),c=a===!0&&o.value!=null||!a&&o.value!=null&&o.value.length>0?1:0;this.state={error:void 0,isDashboardActive:e,isFocused:!1,isLoading:!0,isLoaded:!1,isPreview:l,savedChangeCount:0,changeCount:c,fileMetadata:r,settings:o,session:n,sessionLanguage:s,panelState:{fileMetadata:r,settings:o},showCloseModal:!1,showSaveAsModal:!1,scriptCode:""},Be.debug("constructor",t,this.state)}static handleError(t){Te.isCanceled(t)||Be.error(t)}static languageFromFileName(t){switch(ce.getExtension(t).toLowerCase()){case"py":case"python":return"python";case"groovy":return"groovy";case"scala":return"scala";default:return null}}componentDidMount(){const{glContainer:t,glEventHub:e}=this.props,{tab:n}=t;n!=null&&this.initTab(n),this.initNotebookContent(),e.on(He.RENAME_FILE,this.handleRenameFile),t.on("tabClicked",this.handlePanelTabClick)}componentDidUpdate(t,e){const{isPreview:n,settings:s}=this.state,{wordWrap:i}=s,{defaultNotebookSettings:o}=this.props;n!==e.isPreview&&this.setPreviewStatus(),i!==e.settings.wordWrap&&(this.updateEditorWordWrap(),this.debouncedSavePanelState()),o.isMinimapEnabled!==t.defaultNotebookSettings.isMinimapEnabled&&this.updateEditorMinimap()}componentWillUnmount(){this.debouncedSavePanelState.flush(),this.pending.cancel();const{glContainer:t,glEventHub:e}=this.props,{fileMetadata:n,isPreview:s}=this.state;e.off(He.RENAME_FILE,this.handleRenameFile),t.off("tabClicked",this.handlePanelTabClick),e.emit(He.UNREGISTER_FILE,n,s)}initTab(t){this.tabInitOnce||(this.tabInitOnce=!0,this.initTabCloseOverride()),this.initTabClasses(t)}initTabCloseOverride(){const{glContainer:t}=this.props,e=t.close.bind(t);t.close=()=>{const{changeCount:n,savedChangeCount:s}=this.state;return n!==s&&this.shouldPromptClose?this.setState({showCloseModal:!0}):e(),!0}}initTabClasses(t){const e=t.element.get(0);P(e);const n=e.querySelector(".lm_title");this.tabTitleElement=n,n==null||n.classList.add("notebook-title"),this.setPreviewStatus()}getNotebookValue(){const{changeCount:t,savedChangeCount:e,settings:n}=this.state,{value:s}=n;if(t!==e&&this.notebook){const i=this.notebook.getValue();return i!=null?i:s}return s}initNotebookContent(){const{fileMetadata:t,settings:e,isPreview:n}=this.state;if(t&&t.id){Be.debug("Init content from file"),this.registerFileMetadata(t,n),this.load();return}if(e.value!=null){Be.debug("Use content passed in the settings prop"),this.handleLoadSuccess();return}this.handleLoadError(new Error("Missing file metadata"))}closeFileTabById(t){const{glEventHub:e}=this.props;e.emit(He.CLOSE_FILE,{id:t})}registerFileMetadata(t,e){const{glEventHub:n,metadata:s}=this.props,{id:i}=s;n.emit(He.REGISTER_FILE,i,t,e)}renameTab(t,e){const{glEventHub:n}=this.props;n.emit(He.RENAME,t,e)}load(){const{fileMetadata:t,settings:e}=this.state;P(t);const{id:n}=t,{fileStorage:s}=this.props;this.pending.add(s.loadFile(n)).then(i=>{var a;Be.debug("Loaded file",i);const{filename:o}=i,{itemName:r}=this.state;if(o!==r){const{metadata:d}=this.props,{id:c}=d;this.renameTab(c,ce.getBaseName(o))}const l={...e,language:(a=_i.languageFromFileName(o))!=null?a:""};e.value==null&&(l.value=i.content),e.wordWrap===void 0&&(e.wordWrap="off"),this.setState({fileMetadata:{id:o,itemName:o},settings:l}),this.debouncedSavePanelState()}).then(this.handleLoadSuccess).catch(this.handleLoadError)}save(){const{fileMetadata:t}=this.state;if(t&&ce.hasPath(t.itemName)){const e=this.getNotebookValue();return e!==void 0?(this.saveContent(t.itemName,e),!0):!1}return this.setState({showSaveAsModal:!0}),!1}saveContent(t,e){Be.debug("saveContent",t,e),this.updateSavedChangeCount();const{fileStorage:n}=this.props;this.pending.add(n.saveFile({filename:t,content:e,basename:t})).then(this.handleSaveSuccess).catch(this.handleSaveError)}updateSavedChangeCount(){this.setState(({changeCount:t})=>({savedChangeCount:t}))}setPreviewStatus(){if(!this.tabTitleElement)return;const{isPreview:t}=this.state;Be.debug("setPreviewStatus",this.tabTitleElement,t),t?this.tabTitleElement.classList.add("is-preview"):this.tabTitleElement.classList.remove("is-preview")}savePanelState(){this.setState(t=>{const{changeCount:e,savedChangeCount:n,fileMetadata:s,isPreview:i,settings:o}=t,r=this.getNotebookValue(),l=e!==n?r:void 0,a={...o,value:r},c={settings:{...o,value:l},fileMetadata:s,isPreview:i};return Be.debug("Saving panel state",c),{settings:a,panelState:c}})}handleCloseDiscard(){this.shouldPromptClose=!1,this.setState({showCloseModal:!1});const{glContainer:t}=this.props;t.close()}handleCloseSave(){if(this.shouldPromptClose=!1,this.setState({showCloseModal:!1}),this.save()){const{glContainer:t}=this.props;t.close()}}handleCloseCancel(){this.shouldPromptClose=!0,this.setState({showCloseModal:!1})}handleCopy(){const{fileMetadata:t,settings:e}=this.state;P(t);const n=this.getNotebookValue(),{language:s}=e,{itemName:i}=t,o=ce.getCopyFileName(i);Be.debug("handleCopy",t,i,o),this.createNotebook(o,s,n)}handleEditorInitialized(t){this.editor=t}handleEditorWillDestroy(){this.editor=void 0}handleEditorChange(t){Be.debug2("handleEditorChanged",t),this.removePreviewStatus(),this.setState(e=>{const{changeCount:n,savedChangeCount:s}=e,{isUndoing:i,isRedoing:o}=t;return i?{changeCount:n-1,savedChangeCount:s}:!o&&n<s?{changeCount:n+1,savedChangeCount:0}:{changeCount:n+1,savedChangeCount:s}}),this.debouncedSavePanelState()}handleFind(){this.notebook&&this.notebook.toggleFind()}updateEditorMinimap(){if(this.editor){const{defaultNotebookSettings:t}=this.props;this.editor.updateOptions({minimap:{enabled:t.isMinimapEnabled}})}}handleMinimapChange(){const{settings:t,defaultNotebookSettings:e,saveSettings:n}=this.props,s={...t,defaultNotebookSettings:{isMinimapEnabled:!e.isMinimapEnabled}};n(s)}updateEditorWordWrap(){if(this.editor){const{settings:t}=this.state,{wordWrap:e}=t;this.editor.updateOptions({wordWrap:e})}}handleWordWrapChange(){this.editor&&this.setState(t=>{const{settings:e}=t,n=e.wordWrap==="on"?"off":"on";return{settings:{...e,wordWrap:n}}})}handleBlur(){Be.debug("handleBlur"),this.setState({isFocused:!1})}handleFocus(){Be.debug("handleFocus"),this.setState({isFocused:!0})}handleLinkClick(t){const{notebooksUrl:e,session:n,sessionLanguage:s}=this.props,{href:i}=t.currentTarget;if(!i||!i.startsWith(e))return;t.stopPropagation(),t.preventDefault();const o=`/${i.substring(e.length)}`.replace(/%20/g," ");if(o==="/"){Be.debug("Ignoring invalid notebook link",o);return}Be.debug("Notebook link clicked, opening",o);const{glEventHub:r}=this.props,l={value:null,language:s},a={id:o,itemName:o};r.emit(He.SELECT_NOTEBOOK,n,s,l,a)}handleLoadSuccess(){this.setState({error:void 0,isLoaded:!0,isLoading:!1})}handleLoadError(t){let e=t;Te.isCanceled(e)||(Te.isTimedOut(e)&&(e=new Error("File not found.")),Be.error(e),this.setState({error:e,isLoading:!1}))}handleSave(){Be.debug("handleSave"),this.save()}handleSaveSuccess(t){var i;const{fileStorage:e}=this.props,n={id:t.filename,itemName:t.filename},s=(i=_i.languageFromFileName(t.filename))!=null?i:"";this.setState(o=>{const{fileMetadata:r}=o,l={...o.settings,language:s};return Be.debug("handleSaveSuccess",n,r,l),r&&ce.hasPath(r.itemName)&&r.itemName!==n.itemName&&(Be.debug("handleSaveSuccess deleting old file",r.itemName),e.deleteFile(r.itemName).catch(_i.handleError)),{fileMetadata:n,settings:l,isPreview:!1}}),this.debouncedSavePanelState(),this.registerFileMetadata(n,!1)}handleSaveError(t){Te.isCanceled(t)||(this.setState({savedChangeCount:0}),Be.error(t))}handleSaveAsCancel(){this.setState({showSaveAsModal:!1})}handleSaveAsSubmit(t){var i;Be.debug("handleSaveAsSubmit",t);const{fileMetadata:e}=this.state;if(!e)return;const{itemName:n}=e,s=(i=this.getNotebookValue())!=null?i:"";if(this.setState({showSaveAsModal:!1}),ce.getBaseName(n)!==ce.getBaseName(t)){const{metadata:o}=this.props,{id:r}=o;this.renameTab(r,ce.getBaseName(t))}this.saveContent(t,s)}handleRenameFile(t,e){const{fileMetadata:n}=this.state;n&&n.id===t&&(this.setState({fileMetadata:{id:e,itemName:e}}),this.debouncedSavePanelState())}handleResize(){var t;(t=this.notebook)==null||t.updateDimensions()}handleRunCommand(t){this.runCommand(t)}handleRunAll(){var t;if(!this.notebook){Be.error("Editor is not initialized.");return}this.runCommand((t=this.notebook.getValue())!=null?t:void 0)}handleRunSelected(){if(!this.notebook){Be.error("Editor is not initialized.");return}this.runCommand(this.notebook.getSelectedCommand())}handleSessionOpened(t,{language:e}){this.setState({session:t,sessionLanguage:e})}handleSessionClosed(){this.setState({session:void 0,sessionLanguage:void 0})}handleShow(){var t;Be.debug("handleShow"),(t=this.notebook)==null||t.updateDimensions()}handleShowRename(){this.setState({showSaveAsModal:!0})}handleTab(t){Be.debug("NotebookPanel tab event",t),this.initTab(t)}handleTabFocus(...t){Be.debug("handleTabFocus",...t);const{glContainer:e}=this.props;this.setState({isDashboardActive:!0}),this.notebook&&!e.isHidden&&this.notebook.updateDimensions()}handleTabBlur(){Be.debug("handleTabBlur"),this.setState({isDashboardActive:!1})}handlePanelTabClick(){Be.debug("handlePanelTabClick"),this.focus()}handleTransformLinkUri(t){const{notebooksUrl:e}=this.props,{fileMetadata:n}=this.state;if(t.endsWith("/"))return t;if(t.startsWith("/"))return`${e}${t.substring(1)}`;let s=n==null?void 0:n.itemName;if(s===void 0)return t;s.charAt(0)==="/"&&(s=s.substring(1));const i=new URL(s,e);return new URL(t,i).href}focus(){requestAnimationFrame(()=>{this.notebook&&this.notebook.focus()})}createNotebook(t,e,n=""){const{glEventHub:s}=this.props,{session:i,sessionLanguage:o,settings:r}=this.state,l={...r,language:e,value:n},a={id:null,itemName:t};Be.debug("handleCreateNotebook",i,o,l,a),s.emit(He.CREATE_NOTEBOOK,i,o,l,a)}runCommand(t){if(t===void 0){Be.debug("Ignoring empty command.");return}this.removePreviewStatus();const{glEventHub:e}=this.props;e.emit(bt.SEND_COMMAND,t,!1,!0)}removePreviewStatus(){this.setState(({isPreview:t})=>{if(t){const{fileMetadata:e}=this.state;return e&&this.registerFileMetadata(e,!1),{isPreview:!1}}return null})}getDropdownOverflowActions(){const{defaultNotebookSettings:t}=this.props,{settings:e}=this.state;return this.getOverflowActions(t.isMinimapEnabled,this.getSettings(e,t.isMinimapEnabled).wordWrap==="on")}render(){var k,O;const{fileStorage:t,glContainer:e,glContainer:{tab:n},glEventHub:s,defaultNotebookSettings:i}=this.props,{changeCount:o,savedChangeCount:r,error:l,isDashboardActive:a,isLoaded:d,isLoading:c,isPreview:u,fileMetadata:m,session:p,sessionLanguage:g,settings:f,showCloseModal:b,showSaveAsModal:C}=this.state,w=a&&!e.isHidden&&!u,T=(k=m==null?void 0:m.itemName)!=null?k:_i.DEFAULT_NAME,y=T.endsWith(".md"),E=(m==null?void 0:m.id)!=null,I=this.getSettings(f,i.isMinimapEnabled),D=p!=null,F=g===I.language,x=!d||!D||!F,U=!d,B=[{action:this.handleSave,shortcut:ms.SAVE},{action:this.handleMinimapChange,shortcut:Bt.NOTEBOOK.MINIMAP},{action:this.handleWordWrapChange,shortcut:Bt.NOTEBOOK.WORDWRAP}],_=nh.getDisabledRunTooltip(D,F,"Notebook extension","Run"),H=nh.getDisabledRunTooltip(D,F,"Notebook extension","Run Selected"),A=[{title:E?"Rename":"Save As\u2026",order:10,group:oe.groups.high,action:this.handleShowRename},{title:"Copy File",action:this.handleCopy,group:oe.groups.high,order:20}],N=n==null?void 0:n.element.find(".lm_title_before").get(0);return v(ye,{children:[N&&ui.createPortal(h("span",{className:W("editor-unsaved-indicator",{"is-unsaved":o!==r})}),N),v(jn,{className:"notebook-container",componentPanel:this,glContainer:e,glEventHub:s,onTab:this.handleTab,onResize:this.handleResize,onShow:this.handleShow,onTabFocus:this.handleTabFocus,onTabBlur:this.handleTabBlur,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,onFocus:this.handleFocus,onBlur:this.handleBlur,additionalActions:A,renderTabTooltip:()=>T,children:[!y&&v(ye,{children:[v("div",{className:"notebook-toolbar",children:[v("span",{children:[h(z,{kind:"ghost",className:"btn-play",onClick:this.handleRunAll,disabled:x,icon:h(j,{icon:Yr,transform:"grow-4"}),tooltip:`Run ${Bt.NOTEBOOK.RUN.getDisplayText()}`,"aria-label":"Run"}),_!=null&&h(Ue,{children:_})]}),v("span",{children:[h(z,{kind:"ghost",className:"btn-play",onClick:this.handleRunSelected,disabled:x,icon:h(j,{icon:dC,transform:"grow-4"}),tooltip:`Run Selected ${Bt.NOTEBOOK.RUN_SELECTED.getDisplayText()}`,"aria-label":"Run Selected"}),H!=null&&h(Ue,{children:H})]}),h(z,{kind:"ghost",className:"mr-auto",disabled:U,onClick:this.handleSave,icon:bu,tooltip:`Save ${ms.SAVE.getDisplayText()}`,"aria-label":"Save"}),h(z,{kind:"ghost",className:"btn-overflow btn-link-icon",disabled:U,icon:gu,tooltip:"More Actions...",onClick:()=>{},children:h(Fn,{actions:this.getDropdownOverflowActions,popperOptions:_i.POPPER_OPTIONS})})]}),h(om,{isLoaded:d,isLoading:c,error:l,onChange:this.handleEditorChange,onRunCommand:this.handleRunCommand,session:p,sessionLanguage:g,onEditorInitialized:this.handleEditorInitialized,onEditorWillDestroy:this.handleEditorWillDestroy,settings:I,focusOnMount:w,ref:V=>{this.notebook=V}})]}),y&&h(Vp,{content:(O=I.value)!=null?O:"",onLinkClick:this.handleLinkClick,onRunCode:this.handleRunCommand,transformImageUri:this.handleTransformLinkUri,transformLinkUri:this.handleTransformLinkUri}),h(Wl,{isOpen:C,type:"file",defaultValue:T,title:E?"Rename":"Save file as",onSubmit:this.handleSaveAsSubmit,onCancel:this.handleSaveAsCancel,notifyOnExtensionChange:!0,storage:t}),h($i,{isOpen:b,headerText:`Do you want to save the changes you made to ${T}?`,bodyText:"Your changes will be lost if you don't save them.",onCancel:this.handleCloseCancel,onDiscard:this.handleCloseDiscard,onConfirm:this.handleCloseSave,discardButtonText:"Discard Changes",confirmButtonText:"Save"}),h(oe,{actions:B})]})]})}};let Jo=_i;Jo.COMPONENT="NotebookPanel";Jo.POPPER_OPTIONS={placement:"bottom-end"};Jo.DEFAULT_NAME="Untitled";Jo.defaultProps={isDashboardActive:!0,isPreview:!1,session:null,sessionLanguage:null,defaultNotebookSettings:null};const t1=(t,e)=>{const n=Cm(t),s=xt(t),i=MS(t),o=gi(t,e.localDashboardId),{session:r,config:l}=o!=null?o:{},{type:a}=l!=null?l:{};return{fileStorage:n,settings:s,defaultNotebookSettings:i,session:r,sessionLanguage:a}},Ys=Ft(t1,{saveSettings:Td},null,{forwardRef:!0})(Jo);class ko extends S.exports.Component{constructor(e){super(e),this.irisGridRef=Y.createRef(),this.buttonRef=Y.createRef(),this.handleReload=this.handleReload.bind(this),this.handleGridStateChange=this.handleGridStateChange.bind(this),this.handlePanelStateUpdate=this.handlePanelStateUpdate.bind(this);const{panelState:n}=e;this.state={shouldFocusGrid:!1,panelState:n}}handleReload(){var e,n;(e=this.irisGridRef.current)==null||e.initModel(),(n=this.buttonRef.current)==null||n.blur(),this.setState({shouldFocusGrid:!0})}handleGridStateChange(){var n,s,i;const{shouldFocusGrid:e}=this.state;e&&((i=(s=(n=this.irisGridRef.current)==null?void 0:n.irisGrid)==null?void 0:s.current)==null?void 0:i.grid)&&(this.irisGridRef.current.irisGrid.current.grid.focus(),this.setState({shouldFocusGrid:!1}))}handlePanelStateUpdate(e){this.setState({panelState:e})}render(){const{...e}=this.props;return h(hi,{ref:this.irisGridRef,onStateChange:this.handleGridStateChange,onPanelStateUpdate:this.handlePanelStateUpdate,...e,children:v(z,{ref:this.buttonRef,kind:"primary",className:"btn-pandas",onClick:this.handleReload,tooltip:"Click to refresh pandas dataframe, updates do not occur automatically.",children:["pandas dataframe",v("span",{children:[h(j,{icon:cd,transform:"shrink-1",className:"mr-1"}),"Reload"]})]})})}}ko.defaultProps={panelState:null};ko.COMPONENT="PandasPanel";function n1(t){Vs(t);const{id:e,layout:n,registerComponent:s,hydrate:i}=t,o=S.exports.useCallback(({dragEvent:r,fetch:l,panelId:a=ze.generate(),widget:d})=>{const{name:c,type:u}=d;if(u!==dh.VariableType.FIGURE)return;const m={name:c,figure:c},p=()=>l().then(b=>zi.makeModel(void 0,b)),g={type:"react-component",component:Bi.COMPONENT,props:{localDashboardId:e,id:a,metadata:m,makeModel:p},title:c,id:a},{root:f}=n;te.openComponent({root:f,config:g,dragEvent:r})},[e,n]);return S.exports.useEffect(function(){const l=[s(Bi.COMPONENT,Bi,i)];return()=>{l.forEach(a=>a())}},[i,s]),Ke(n.eventHub,Ie.OPEN,o),null}function s1(t){Vs(t);const{id:e,layout:n}=t,s=S.exports.useCallback(({metadata:i,panelId:o=ze.generate(),table:r})=>{const{settings:l}=i,a=()=>zi.makeModelFromSettings(l,r),d=xe.titleFromSettings(l),c={type:"react-component",component:Bi.COMPONENT,props:{localDashboardId:e,id:o,metadata:i,makeModel:a},title:d,id:o},{root:u}=n;te.openComponent({root:u,config:c})},[e,n]);return Ke(n.eventHub,Et.CREATE_CHART,s),null}const ct=X.module("ConsolePlugin");function Bh(t){return t.notebook!==void 0}function i1(t){Vs(t)}function o1(t){i1(t);const{id:e,hydrateConsole:n,layout:s,panelManager:i,registerComponent:o,notebooksUrl:r}=t,l=S.exports.useRef(0),[a]=S.exports.useState(new Map),[d]=S.exports.useState(new Map),c=nd(),u=S.exports.useCallback(()=>i.getLastUsedPanelOfType(Li),[i]),m=S.exports.useCallback((N,k=!0,O=!0)=>{if(!(N&&N.trim()))ct.info("Ignoring empty code");else{const G=u();if(!G||!(G instanceof Li.WrappedComponent)){ct.error("Console panel not found");return}ct.debug("Send command: ",N,k,O),G.addCommand(N,k,O)}},[u]),p=S.exports.useCallback(N=>{c(SE(e,N))},[c,e]),g=S.exports.useCallback(({language:N})=>{const k=N==="python"?"py":N;let O=null;return k==null?(ct.debug("No extension for language",N),O=`Untitled-${l.current}`):O=`Untitled-${l.current}.${k}`,l.current+=1,O},[]),f=S.exports.useCallback((N,k=!0)=>{const{id:O}=N;return O!=null&&a.has(O)?a.get(O):O!=null&&d.has(O)?d.get(O):k?ze.generate():null},[a,d]),b=S.exports.useCallback((N,k)=>{te.renameComponent(s.root,{id:N},k)},[s.root]),C=S.exports.useCallback((N,k)=>{ct.debug("Rename file panel",N,k);let O;if(a.has(N)&&(O=a.get(N),a.delete(N),O!=null&&a.set(k,O)),d.has(N)&&(O=d.get(N),d.delete(N),O!=null&&d.set(k,O)),O===void 0){ct.debug2(`File ${N} isn't open, no need to rename the tab`);return}b(O,ce.getBaseName(k))},[a,d,b]),w=S.exports.useCallback(N=>{const k=f(N,!1);if(k==null){ct.error("Could not find panel id for file metadata",N);return}te.activateTab(s.root,{id:k})},[f,s.root]),T=S.exports.useCallback((N,k,O)=>{if(ct.debug("registerFilePanel",N,k,O),k==null||k.id==null){ct.debug("Ignore empty file id",k);return}const{id:V}=k;if(O){d.set(V,N);return}if(a.has(V)){const G=a.get(V);if(N===G){ct.debug(`Update tab title for file ${V}`);const{itemName:Q}=k;C(V,ce.getBaseName(Q))}else ct.error(`File ${V} already associated with a different tab ${G}`);return}a.set(V,N),d.has(V)&&d.delete(V)},[a,d,C]),y=S.exports.useCallback((N,k)=>{if(ct.debug("unregisterFileTab",N,k),N==null||N.id==null){ct.debug("Ignore empty file id",N);return}const{id:O}=N;if(k){d.delete(O);return}a.delete(O)},[a,d]),E=S.exports.useCallback(N=>{ct.debug("closeFilePanel",N);const{id:k}=N;let O=null,V=!1;if(a.has(k))O=a.get(k);else if(d.has(k))O=d.get(k),V=!0;else{ct.debug(`File ${k} isn't open, ignore close event`);return}y(N,V),te.closeComponent(s.root,{id:O})},[s.root,a,d,y]),I=S.exports.useCallback(N=>{const{itemName:k}=N;return ce.getBaseName(k)},[]),D=S.exports.useCallback(N=>{const{id:k}=N;return ct.debug("fileIsOpen",N,k,a),k!=null&&a.has(k)},[a]),F=S.exports.useCallback(N=>{const{id:k}=N;return ct.debug("fileIsOpenAsPreview",N,k,d),k!=null&&d.has(k)},[d]),x=S.exports.useCallback(N=>{if(N==null)return;const k=i.getOpenedPanelById(N);k&&Bh(k)&&k.focus()},[i]),U=S.exports.useCallback(({id:N,settings:k,fileMetadata:O,session:V,sessionLanguage:G,isPreview:Q=!1})=>{const Z={settings:k,fileMetadata:O},be=I(O);return{type:"react-component",component:Ys.COMPONENT,isFocusOnShow:!1,props:{localDashboardId:e,metadata:{id:N},session:V,sessionLanguage:G,panelState:Z,isPreview:Q,notebooksUrl:r},title:be,id:N}},[I,e,r]),B=S.exports.useCallback((N,k,O,V={id:null,itemName:g(O)})=>{const G=f(V);if(D(V)&&G!=null){ct.debug("File is already open, focus panel"),w(V),x(G);return}const Q=te.getStackForComponentTypes(s.root,[Ys.COMPONENT]),Z=U({id:G,settings:O,fileMetadata:V,session:N,sessionLanguage:k});ct.debug("createNotebook",Z,a),te.openComponentInStack(Q,Z)},[D,x,g,f,s.root,U,a,w]),_=S.exports.useCallback((N,k,O,V,G=!1)=>{ct.debug("selectNotebook",V,G);const Q=D(V),Z=F(V);if(Q){if(w(V),G){const ee=f(V);x(ee)}return}if(Z&&!G){w(V);return}const[be]=Array.from(d.values());let le=null,he=null;be!=null&&(le=be,he=te.getStackForConfig(s.root,{component:Ys.COMPONENT,id:le})),he==null&&(le=f(V),he=te.getStackForComponentTypes(s.root,[Ys.COMPONENT]));const De=U({id:le,settings:O,fileMetadata:V,session:N,sessionLanguage:k,isPreview:!G});te.openComponentInStack(he,De),G&&x(le)},[w,D,F,x,f,s.root,U,d]),H=S.exports.useCallback((N,k,O={},V=!0)=>{const G=i.getLastUsedPanelOfType(Ys);G&&Bh(G)?O!=null&&O.value!=null&&G.notebook!=null&&G.notebook.append(O.value):V&&B(N,k,O)},[B,i]),A=S.exports.useCallback((N,k)=>Ua.hydrate({...N,notebooksUrl:r},k),[r]);return S.exports.useEffect(function(){const k=[o(Li.COMPONENT,Li,n),o(ol.COMPONENT,ol),o(rl.COMPONENT,rl),o(al.COMPONENT,al),o(Ys.COMPONENT,Ys,A)];return()=>{k.forEach(O=>O())}},[o,n,A]),Ke(s.eventHub,bt.SEND_COMMAND,m),Ke(s.eventHub,bt.SETTINGS_CHANGED,p),Ke(s.eventHub,He.CLOSE_FILE,E),Ke(s.eventHub,He.CREATE_NOTEBOOK,B),Ke(s.eventHub,He.SELECT_NOTEBOOK,_),Ke(s.eventHub,He.RENAME,b),Ke(s.eventHub,He.RENAME_FILE,C),Ke(s.eventHub,He.SEND_TO_NOTEBOOK,H),Ke(s.eventHub,He.REGISTER_FILE,T),Ke(s.eventHub,He.UNREGISTER_FILE,y),null}const wo=X.module("FilterPlugin");function $h(t,e){return t.concat(e)}function r1(t){Vs(t);const{id:e,layout:n,registerComponent:s}=t,i=nd(),[o]=S.exports.useState(()=>new Map),[r]=S.exports.useState(()=>new Map),[l]=S.exports.useState(()=>new Map),a=S.exports.useCallback(()=>{const b=Array.from(o.values()).reduce($h,[]).sort((T,y)=>{const E=on.toLower(T.name),I=on.toLower(y.name);if(E!==I)return E>I?1:-1;const D=on.toLower(T.type),F=on.toLower(y.type);return D!==F?D>F?1:-1:0}).reduce((T,y)=>((T.length===0||on.toLower(T[T.length-1].name)!==on.toLower(y.name)||on.toLower(T[T.length-1].type)!==on.toLower(y.type))&&T.push(y),T),[]),C=Array.from(r.values()).reduce($h,[]).sort((T,y)=>T.timestamp-y.timestamp),w=new Map(l);wo.debug("sendUpdate",{columns:b,filters:C,tableMap:w}),i(Xn(e,{columns:b,filters:C,tableMap:w}))},[i,e,o,r,l]),d=S.exports.useCallback((b,C)=>{wo.debug2("handleColumnsChanged",b,C),o.set(b,[].concat(C)),a()},[o,a]),c=S.exports.useCallback((b,C)=>{wo.debug2("handleFiltersChanged",b,C),r.set(b,[].concat(C)),a()},[r,a]),u=S.exports.useCallback((b,C)=>{wo.debug2("handleTableChanged",b,C),l.set(te.getIdFromPanel(b),C),a()},[l,a]),m=S.exports.useCallback(b=>{wo.debug2("handlePanelUnmount",b),o.delete(b),r.delete(b),l.delete(te.getIdFromPanel(b)),a()},[o,r,l,a]),p=S.exports.useCallback(({title:b="DropdownFilter",metadata:C={},panelState:w=null,id:T=ze.generate(),focusElement:y=te.DEFAULT_FOCUS_SELECTOR,createNewStack:E=!1,dragEvent:I=null})=>{const D={type:"react-component",component:ci.COMPONENT,props:{id:T,metadata:C,panelState:w,localDashboardId:e},title:b,id:T},{root:F}=n;te.openComponent({root:F,config:D,focusElement:y,createNewStack:E,dragEvent:I})},[n,e]),g=S.exports.useCallback(({title:b="InputFilter",metadata:C={},panelState:w=null,id:T=ze.generate(),focusElement:y=te.DEFAULT_FOCUS_SELECTOR,createNewStack:E=!1,dragEvent:I=null})=>{const D={type:"react-component",component:_o.COMPONENT,props:{id:T,metadata:C,panelState:w,localDashboardId:e},title:b,id:T},{root:F}=n;te.openComponent({root:F,config:D,focusElement:y,createNewStack:E,dragEvent:I})},[n,e]),f=S.exports.useCallback(({title:b="FilterSets",metadata:C={},panelState:w=null,id:T=ze.generate(),focusElement:y=te.DEFAULT_FOCUS_SELECTOR,createNewStack:E=!1,dragEvent:I=null})=>{const D={type:"react-component",component:wa.COMPONENT,props:{id:T,metadata:C,panelState:w,localDashboardId:e},title:b,id:T},{root:F}=n;te.openComponent({root:F,config:D,focusElement:y,createNewStack:E,dragEvent:I})},[n,e]);return S.exports.useEffect(function(){const C=[s(ci.COMPONENT,ci),s(_o.COMPONENT,_o),s(wa.COMPONENT,wa)];return()=>{C.forEach(w=>w())}},[s]),Ke(n.eventHub,Pe.COLUMNS_CHANGED,d),Ke(n.eventHub,Pe.FILTERS_CHANGED,c),Ke(n.eventHub,Pe.TABLE_CHANGED,u),Ke(n.eventHub,Pe.OPEN_DROPDOWN,p),Ke(n.eventHub,Pe.OPEN_INPUT,g),Ke(n.eventHub,Pe.OPEN_FILTER_SET_MANAGER,f),Ke(n.eventHub,Ie.UNMOUNT,m),null}const l1=[dh.VariableType.TABLE,dh.VariableType.TREETABLE,dh.VariableType.HIERARCHICALTABLE];function a1(t){Vs(t);const{getDownloadWorker:e,loadPlugin:n,id:s,layout:i,registerComponent:o,hydrate:r,theme:l}=t,a=S.exports.useCallback(({dragEvent:d,fetch:c,panelId:u=ze.generate(),widget:m})=>{const{name:p,type:g}=m;if(!l1.includes(g))return;const f={name:p,table:p},b=()=>c().then(T=>qd.makeModel(T)),C={type:"react-component",component:hi.COMPONENT,props:{getDownloadWorker:e,loadPlugin:n,localDashboardId:s,id:u,metadata:f,makeModel:b,theme:l},title:p,id:u},{root:w}=i;te.openComponent({root:w,config:C,dragEvent:d})},[e,s,i,n,l]);return S.exports.useEffect(function(){const c=[o(hi.COMPONENT,hi,r)];return()=>{c.forEach(u=>u())}},[r,o]),Ke(i.eventHub,Ie.OPEN,a),null}function Up(t){return typeof t.getCoordinateForColumn=="function"}function Wh(t){const e=t;return Up(t)&&typeof e.setFilterMap=="function"&&typeof e.unsetFilterValue=="function"}const vo=X.module("LinkerUtils"),Bp=class{static getLinkType(t,e,n){var l;if((t==null?void 0:t.panelId)==null||(e==null?void 0:e.panelId)==null||t.panelId===e.panelId||n!=null&&n!==t.panelId&&n!==e.panelId)return vo.debug2("Incompatible panel ids",t,e,n),"invalid";if(t.panelComponent==null||e.panelComponent==null)return vo.error("PanelComponent should not be null",t,e),"invalid";const s=(l=Bp.ALLOWED_LINKS.get(t.panelComponent))==null?void 0:l.includes(e.panelComponent);if(s===void 0||!s)return vo.debug2("Incompatible panel components",t,e),"invalid";const{columnType:i}=t,{columnType:o}=e;if(!(o===null||L.isCompatibleType(i,o)))return vo.debug2("Incompatible type",i,o),"invalid";switch(e.panelComponent){case te.getComponentName(Bi):case te.getComponentName(hi):return"tableLink";case te.getComponentName(ci):return"filterSource"}return vo.debug2("Incompatible target panel component",e.panelComponent),"invalid"}static findColumn(t,{columnName:e,columnType:n}){return t.find(({name:s,type:i})=>s===e&&i===n)}static cloneLinksForPanel(t,e,n){const s=[];return t.forEach(i=>{var o;i.start.panelId===e&&i.type!=="filterSource"?s.push({...i,id:ze.generate(),start:{...i.start,panelId:n}}):((o=i.end)==null?void 0:o.panelId)===e&&s.push({...i,id:ze.generate(),end:{...i.end,panelId:n}})}),s}};let ni=Bp;ni.ALLOWED_LINKS=new Map([[te.getComponentName(hi),[te.getComponentName(hi),te.getComponentName(Bi),te.getComponentName(ci)]]]);const d1=X.module("LinkerLink"),zh=.015,Gh=1.5,$p=12,Wp=12,Kh=2,_r=Math.sqrt((Wp*.5)**2+$p**2),qh=Math.asin(Wp*.5/$p),Yh=15,xs=Math.PI*.5,Wr=class extends S.exports.Component{constructor(t){super(t),this.getOperators=pe((e,n)=>{const{onOperatorChanged:s}=this.props;let i=L.getFilterTypes(n);return L.isBooleanType(n)&&(i=[q.eq,q.notEq]),i.flatMap((o,r)=>{if(o==="eqIgnoreCase"||o==="notEqIgnoreCase")return[];let l="";return o==="startsWith"?l="a*":o==="endsWith"?l="*z":l=L.getFilterOperatorString(o),[{title:Wr.getLabelForLinkFilter(n,o),icon:h("b",{children:l}),action:()=>s(e,o),order:r}]})}),this.handleClick=this.handleClick.bind(this),this.handleMouseEnter=this.handleMouseEnter.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.handleDelete=this.handleDelete.bind(this),this.getDropdownActions=this.getDropdownActions.bind(this),this.state={isHovering:void 0}}static makeCirclePath(t,e,n){return`M ${t} ${e} m -${n},0 a ${n},${n} 0 1,0 ${n*2},0 a ${n},${n} 0 1,0 -${n*2},0 z`}static getLabelForLinkFilter(t,e){try{if(L.isNumberType(t)||L.isCharType(t))return cm(e);if(L.isTextType(t))return dm(e);if(L.isDateType(t))return hm(e);if(L.isBooleanType(t)){if(e===q.eq)return"is equal to";if(e===q.notEq)return"is not equal to"}throw new Error(`Unrecognized column type: ${t}`)}catch(n){return d1.warn(n),""}}handleClick(t){t.stopPropagation(),t.preventDefault();const{id:e,onClick:n,onDelete:s}=this.props;t.altKey?s(e):n(e)}handleMouseEnter(){this.setState({isHovering:!0})}handleMouseLeave(){this.setState({isHovering:!1})}handleDelete(){const{id:t,onDelete:e}=this.props;e(t)}getDropdownActions(){const{id:t,startColumnType:e}=this.props;return e!=null?this.getOperators(t,e):[]}render(){const{className:t,operator:e,isSelected:n,x1:s,y1:i,x2:o,y2:r,id:l,startColumnType:a}=this.props,{isHovering:d}=this.state,c=Math.sqrt((s-o)**2+(i-r)**2),u=Math.atan2(r-i,o-s),m=Math.sin(u),p=Math.cos(u)+2,g=window.innerWidth,f=window.innerHeight,b=0,C=0,w=Math.max(b,Math.min(s+(o-s)/2+m*(c*zh)**Gh,g)),T=Math.max(C,Math.min(i+(r-i)/2+p*(c*zh)**Gh,f)),y=`M ${s} ${i} Q ${w} ${T} ${o} ${r}`,E=`M ${b} ${C} L ${b} ${f} L ${g} ${f} L ${g} ${C} z
|
|
39
39
|
${Wr.makeCirclePath(s,i,Yh)}
|
|
40
40
|
${Wr.makeCirclePath(o,r,Yh)}`,I=`link-select-clip-${l}`,D=Math.atan2(r-T,o-w),F=D-qh+Math.PI,x=D+qh+Math.PI,U=o+Math.cos(D)*Kh,B=r+Math.sin(D)*Kh,_=U+Math.cos(F)*_r,H=B+Math.sin(F)*_r,A=U+Math.cos(x)*_r,N=B+Math.sin(x)*_r,k=`${U},${B} ${_},${H} ${A},${N}`,O=.25*s+.5*w+.25*o,V=.25*i+.5*T+.25*r,G=w-s+(o-w),Z=(T-i+(r-T))/G;let le=20/Math.sqrt(1+Z**2),he=le*Z,De=le*-1,ee=he*-1;Number.isFinite(Z)?Z>0?(le*=-1,he*=-1,De*=-1,ee*=-1,De-=50-10*(Math.abs(u)%xs),ee+=10*(Math.abs(u)%xs),le-=50-10*(Math.abs(u)%xs),he+=10*(Math.abs(u)%xs)):Z<0?(De+=10*(Math.abs(u)%xs),ee+=10*(Math.abs(u)%xs),le+=10*(Math.abs(u)%xs),he+=10*(Math.abs(u)%xs)):(De=15,ee=10,le=-25,he=10):(De=10,ee=5,le=10,he=-35);let ue="";return e!==void 0&&(e==="startsWith"?ue="a*":e==="endsWith"?ue="*z":ue=L.getFilterOperatorString(e)),v(ye,{children:[v("svg",{className:W(t,{hovering:d}),children:[h("clipPath",{id:I,children:h("path",{d:E,clipRule:"evenodd"})}),h("path",{className:"link-select",d:y,onClick:this.handleClick,onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave,clipPath:`url(#${I})`}),h("path",{className:"link-background",d:y}),h("path",{className:"link-foreground",d:y}),h("circle",{className:"link-dot",cx:s,cy:i,r:"5"}),h("polygon",{className:"link-triangle",points:k})]}),a!=null&&n&&v(ye,{children:[h(z,{kind:"primary",className:"btn-fab btn-operator",style:{top:V+(Z>=0?he:ee),left:O+(Z>=0?le:De)},onClick:()=>{},icon:v("div",{className:"fa-md fa-layers",children:[h("b",{children:ue}),h(j,{icon:Gn,transform:"right-8 down-9 shrink-5"})]}),tooltip:"Change comparison operator",children:h(Fn,{actions:this.getDropdownActions,popperOptions:{placement:"bottom-start"}})}),h(z,{kind:"primary",className:"btn-fab btn-delete",style:{top:V+(Z<0?he:ee),left:O+(Z<0?le:De)},onClick:this.handleDelete,icon:wn,tooltip:"Delete"})]})]})}};let zp=Wr;zp.defaultProps={className:"",isSelected:!1,onClick(){},onDelete(){}};const va=X.module("LinkerOverlayContent");class Gp extends S.exports.Component{constructor(e){super(e),this.handleBlur=this.handleBlur.bind(this),this.handleResize=this.handleResize.bind(this),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleMouseDown=this.handleMouseDown.bind(this),this.handleMouseUp=this.handleMouseUp.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleKeyUp=this.handleKeyUp.bind(this),this.handleEscapePressed=this.handleEscapePressed.bind(this),this.handleOperatorChanged=this.handleOperatorChanged.bind(this),this.dialogRef=Y.createRef(),this.state={mouse:void 0,dialog:void 0,offset:{x:0,y:0},isDragging:!1,mode:"select"}}componentDidMount(){window.addEventListener("blur",this.handleBlur,!0),window.addEventListener("mousemove",this.handleMouseMove,!0),window.addEventListener("mouseup",this.handleMouseUp,!0),window.addEventListener("keydown",this.handleKeyDown,!0),window.addEventListener("keyup",this.handleKeyUp,!0),window.addEventListener("resize",this.handleResize,!0)}componentDidCatch(e,n){va.error("componentDidCatch",e,n)}componentWillUnmount(){window.removeEventListener("blur",this.handleBlur,!0),window.removeEventListener("mousemove",this.handleMouseMove,!0),window.removeEventListener("mouseup",this.handleMouseUp,!0),window.removeEventListener("keydown",this.handleKeyDown,!0),window.removeEventListener("keyup",this.handleKeyUp,!0),window.removeEventListener("resize",this.handleResize,!0)}getPointFromLinkPoint(e){const{panelManager:n}=this.props,{panelId:s,columnName:i}=e,o=n.getOpenedPanelById(s);if(o!=null){if(!Up(o))throw new Error(`Panel does not have getCoordinateForColumn method: ${s}`);try{const l=o.getCoordinateForColumn(i);if(l!=null)return l}catch{va.error("Could not get coordinate for column",i,o)}}const r=n.getContainerByPanelId(s);if(r==null)throw new Error(`Unable to find panel container for id: ${s}`);return te.getTabPoint(r)}handleOperatorChanged(e,n){const{links:s,onLinksUpdated:i}=this.props,o=s.map(r=>r.id===e?{...r,operator:n}:r);i(o)}handleBlur(){this.setState({mode:"select"})}handleResize(){const{dialog:e}=this.state;if(e&&this.dialogRef.current){const n=this.dialogRef.current.getBoundingClientRect(),s=gt(e.x,0,window.innerWidth-n.width),i=gt(e.y,0,window.innerHeight-n.height);this.setState({dialog:{x:s,y:i}})}}handleMouseMove(e){const{offset:n,isDragging:s}=this.state;if(this.setState({mouse:{x:e.clientX,y:e.clientY}}),s&&this.dialogRef.current){const i=this.dialogRef.current.getBoundingClientRect(),o=gt(window.innerWidth-(e.clientX+i.width+n.x),0,window.innerWidth-i.width),r=gt(window.innerHeight-(e.clientY+i.height+n.y),0,window.innerHeight-i.height);this.setState({dialog:{x:o,y:r}})}}handleMouseDown(e){const n={x:0,y:0};if(this.dialogRef.current){const s=this.dialogRef.current.getBoundingClientRect();n.x=s.right-(s.width+e.clientX),n.y=s.bottom-(s.height+e.clientY)}this.setState({isDragging:!0,offset:n})}handleMouseUp(){this.setState({isDragging:!1})}handleKeyDown(e){if(e.key==="Alt")e.preventDefault(),this.setState({mode:"delete"});else if(e.key==="Delete"||e.key==="Backspace"){const{selectedIds:n,onLinkDeleted:s}=this.props;e.preventDefault(),n.forEach(i=>s(i))}}handleKeyUp(e){e.key==="Alt"&&(e.preventDefault(),this.setState({mode:"select"}))}handleEscapePressed(){const{onCancel:e}=this.props;e()}render(){const{disabled:e,links:n,selectedIds:s,messageText:i,onLinkSelected:o,onLinkDeleted:r,onAllLinksDeleted:l,onDone:a}=this.props,{mouse:d,dialog:c,isDragging:u,mode:m}=this.state,p=n.map(g=>{var f,b;try{const{id:C,type:w,isReversed:T,start:y,end:E,operator:I}=g,D=y.columnType;let[F,x]=this.getPointFromLinkPoint(y),U=(f=d==null?void 0:d.x)!=null?f:F,B=(b=d==null?void 0:d.y)!=null?b:x;if(E!=null&&([U,B]=this.getPointFromLinkPoint(E)),T!=null&&T){const[H,A]=[F,x];[F,x]=[U,B],[U,B]=[H,A]}const _=W("linker-link",{disabled:e},{"link-filter-source":w==="filterSource"},{"link-invalid":w==="invalid"},{interactive:g.end==null},{"link-is-selected":s.has(C)},{"danger-delete":m==="delete"});return{x1:F,y1:x,x2:U,y2:B,id:C,className:_,operator:I,startColumnType:D}}catch(C){return va.warn("Unable to get point for link",g,C),null}}).filter(g=>g!=null);return v("div",{className:W("linker-overlay",{"danger-delete":m==="delete"}),children:[p.map(({x1:g,y1:f,x2:b,y2:C,id:w,className:T,operator:y,startColumnType:E})=>h(zp,{className:T,id:w,x1:g,y1:f,x2:b,y2:C,onClick:o,onDelete:r,isSelected:s.has(w),operator:y,startColumnType:E,onOperatorChanged:this.handleOperatorChanged},w)),v("div",{className:W("linker-toast-dialog",{dragging:u}),ref:this.dialogRef,style:{bottom:c==null?void 0:c.y,right:c==null?void 0:c.x},children:[h(z,{draggable:!0,kind:"inline",className:"btn-drag-handle",icon:Ko,onClick:()=>{},onMouseDown:this.handleMouseDown,children:!u&&h(Ue,{children:"Drag to reposition"})}),h("div",{className:"toast-body",children:i}),v("div",{className:"toast-footer",children:[h(z,{kind:"secondary",onClick:l,children:"Clear All"}),h(z,{kind:"primary",onClick:a,children:"Done"})]})]}),h(oe,{actions:[{action:this.handleEscapePressed,shortcut:ms.LINKER_CLOSE,isGlobal:!0}]})]})}}Gp.defaultProps={disabled:"false"};const zt=X.module("Linker"),c1=(t,e)=>({activeTool:Nl(t),isolatedLinkerPanelId:Qd(t,e.localDashboardId),links:oo(t,e.localDashboardId),timeZone:Ml(t)}),h1=Ft(c1,{setActiveTool:Fl,setDashboardLinks:Jd,addDashboardLinks:fE,deleteDashboardLinks:CE,setDashboardIsolatedLinkerPanelId:xp,setDashboardColumnSelectionValidator:bE});class u1 extends S.exports.Component{constructor(e){super(e),this.getCachedLinks=pe((n,s,i)=>{const o=[...n];return s!=null&&s.start!=null&&o.push(s),i!==void 0?o.filter(r=>{var l,a;return((l=r==null?void 0:r.start)==null?void 0:l.panelId)===i||((a=r==null?void 0:r.end)==null?void 0:a.panelId)===i||(r==null?void 0:r.end)==null}):o}),this.handleCancel=this.handleCancel.bind(this),this.handleDone=this.handleDone.bind(this),this.handlePanelCloned=this.handlePanelCloned.bind(this),this.handleFilterColumnSelect=this.handleFilterColumnSelect.bind(this),this.handleColumnsChanged=this.handleColumnsChanged.bind(this),this.handlePanelClosed=this.handlePanelClosed.bind(this),this.handleLayoutStateChanged=this.handleLayoutStateChanged.bind(this),this.handleAllLinksDeleted=this.handleAllLinksDeleted.bind(this),this.handleLinkDeleted=this.handleLinkDeleted.bind(this),this.handleLinksUpdated=this.handleLinksUpdated.bind(this),this.handleChartColumnSelect=this.handleChartColumnSelect.bind(this),this.handleGridColumnSelect=this.handleGridColumnSelect.bind(this),this.handleUpdateValues=this.handleUpdateValues.bind(this),this.handleStateChange=this.handleStateChange.bind(this),this.handleExited=this.handleExited.bind(this),this.handleLinkSelected=this.handleLinkSelected.bind(this),this.handlePanelDragging=this.handlePanelDragging.bind(this),this.handlePanelDropped=this.handlePanelDropped.bind(this),this.isColumnSelectionValid=this.isColumnSelectionValid.bind(this),this.state={linkInProgress:void 0,selectedIds:new Set,isDraggingPanel:!1}}componentDidMount(){const{layout:e}=this.props;this.startListening(e),this.updateSelectionValidators()}componentDidUpdate(e){const{activeTool:n,layout:s}=this.props;s!==e.layout&&(this.stopListening(e.layout),this.startListening(s)),n!==e.activeTool&&(this.updateSelectionValidators(),n===Yt.DEFAULT&&this.reset())}componentDidCatch(e,n){zt.error("componentDidCatch",e,n)}componentWillUnmount(){const{layout:e}=this.props;this.stopListening(e)}startListening(e){e.on("stateChanged",this.handleLayoutStateChanged);const{eventHub:n}=e;n.on(Et.COLUMN_SELECTED,this.handleGridColumnSelect),n.on(Et.DATA_SELECTED,this.handleUpdateValues),n.on(Et.STATE_CHANGED,this.handleStateChange),n.on(Ki.COLUMN_SELECTED,this.handleChartColumnSelect),n.on(Ie.CLONED,this.handlePanelCloned),n.on(Pe.COLUMN_SELECTED,this.handleFilterColumnSelect),n.on(Pe.COLUMNS_CHANGED,this.handleColumnsChanged),n.on(Ie.CLOSE,this.handlePanelClosed),n.on(Ie.CLOSED,this.handlePanelClosed),n.on(Ie.DRAGGING,this.handlePanelDragging),n.on(Ie.DROPPED,this.handlePanelDropped)}stopListening(e){e.off("stateChanged",this.handleLayoutStateChanged);const{eventHub:n}=e;n.off(Et.COLUMN_SELECTED,this.handleGridColumnSelect),n.off(Et.DATA_SELECTED,this.handleUpdateValues),n.off(Et.STATE_CHANGED,this.handleStateChange),n.off(Ki.COLUMN_SELECTED,this.handleChartColumnSelect),n.off(Ie.CLONED,this.handlePanelCloned),n.off(Pe.COLUMN_SELECTED,this.handleFilterColumnSelect),n.off(Pe.COLUMNS_CHANGED,this.handleColumnsChanged),n.off(Ie.CLOSE,this.handlePanelClosed),n.off(Ie.CLOSED,this.handlePanelClosed),n.off(Ie.DRAGGING,this.handlePanelDragging),n.off(Ie.DROPPED,this.handlePanelDropped)}reset(){this.setState({linkInProgress:void 0,selectedIds:new Set})}handleCancel(){const{linkInProgress:e}=this.state;if(e==null){const{setActiveTool:n}=this.props;n(Yt.DEFAULT)}this.setState({linkInProgress:void 0})}handleDone(){const{setActiveTool:e}=this.props;e(Yt.DEFAULT)}handleChartColumnSelect(e,n){this.columnSelected(e,n,!0)}handleFilterColumnSelect(e,n){zt.debug("handleFilterColumnSelect",this.isOverlayShown());const{links:s,localDashboardId:i,setActiveTool:o,setDashboardIsolatedLinkerPanelId:r}=this.props,l=te.getIdFromPanel(e),a=s.filter(d=>{var c,u;return((c=d.start)==null?void 0:c.panelId)===l||((u=d.end)==null?void 0:u.panelId)===l});if(!this.isOverlayShown()&&l!=null){o(Yt.LINKER),r(i,l),a.length===0&&this.columnSelected(e,n,!0,l);return}this.columnSelected(e,n,!0)}handleColumnsChanged(e,n){zt.debug("handleColumnsChanged",e,n);const{links:s}=this.props,i=te.getIdFromPanel(e);if(i==null){zt.error("Invalid panelId",e);return}const o=s.filter(({start:r,end:l})=>r.panelId===i&&ni.findColumn(n,r)==null||l!=null&&l.panelId===i&&ni.findColumn(n,l)==null);this.deleteLinks(o)}handleGridColumnSelect(e,n){this.columnSelected(e,n)}columnSelected(e,n,s=!1,i){if(i===void 0&&!this.isOverlayShown())return;const{isolatedLinkerPanelId:o}=this.props,{linkInProgress:r}=this.state,l=te.getIdFromPanel(e);if(l==null)return;const a=te.getComponentNameFromPanel(e),{name:d,type:c}=n;if(r==null||r.start==null){const u={id:ze.generate(),start:{panelId:l,panelComponent:a,columnName:d,columnType:c},type:"invalid",isReversed:s};zt.debug("starting link",u),this.setState({linkInProgress:u})}else{const{links:u}=this.props,{start:m,id:p,isReversed:g}=r,f={panelId:l,panelComponent:a,columnName:d,columnType:c},b=ni.getLinkType(g!==void 0&&g?f:m,g!==void 0&&g?m:f,i!=null?i:o);switch(b){case"invalid":zt.debug("Ignore invalid link connection",r,f);return;case"filterSource":{const w=g!==void 0&&g?m.panelId:f.panelId,T=u.filter(({end:y})=>(y==null?void 0:y.panelId)===w);this.deleteLinks(T);break}}const C={start:g!==void 0&&g?f:m,end:g!==void 0&&g?m:f,id:p,type:b,operator:q.eq};zt.info("creating link",C),this.setState({linkInProgress:void 0,selectedIds:new Set([p])},()=>{this.addLinks([C])})}}unsetFilterValueForLink(e){const{panelManager:n}=this.props;if(e.end){const{end:s}=e,{panelId:i,columnName:o,columnType:r}=s,l=n.getOpenedPanelById(i);l?Wh(l)?l.unsetFilterValue(o,r):zt.debug("endPanel.unsetFilterValue not implemented",l):zt.debug("endPanel no longer exists, ignoring unsetFilterValue",i)}}setPanelFilterMap(e,n){zt.debug("Set filter data for panel:",e,n);const{panelManager:s}=this.props,i=s.getOpenedPanelById(e);i?Wh(i)?i.setFilterMap(n):zt.debug("panel.setFilterMap not implemented",e,i):zt.debug("panel no longer exists, ignoring setFilterMap",e)}addLinks(e){const{addDashboardLinks:n,localDashboardId:s}=this.props;n(s,e)}deleteLinks(e,n=!1){const{localDashboardId:s}=this.props;if(e.forEach(i=>this.unsetFilterValueForLink(i)),n){const{setDashboardLinks:i}=this.props;i(s,[])}else if(e.length>0){const{deleteDashboardLinks:i}=this.props;i(s,e.map(({id:o})=>o))}}handleAllLinksDeleted(){const{links:e,isolatedLinkerPanelId:n}=this.props;if(n===void 0)this.deleteLinks(e,!0);else{const s=e.filter(i=>{var o,r;return((o=i==null?void 0:i.start)==null?void 0:o.panelId)===n||((r=i==null?void 0:i.end)==null?void 0:r.panelId)===n});this.deleteLinks(s)}this.reset()}handleLinkDeleted(e){const{links:n}=this.props,s=n.find(i=>i.id===e);s?this.deleteLinks([s]):zt.error("Unable to find link to delete",e)}handleUpdateValues(e,n){const s=te.getIdFromPanel(e),{links:i,timeZone:o}=this.props,r=new Map;for(let l=0;l<i.length;l+=1){const{start:a,end:d,operator:c}=i[l];if(a.panelId===s&&d!=null){const{panelId:u,columnName:m,columnType:p}=d,g=r.has(u)?r.get(u):new Map,f=g.has(m)===!0?g.get(m).filterList:[],{visibleIndex:b,isExpandable:C,isGrouped:w}=n[a.columnName];let{value:T}=n[a.columnName],y=`${T}`;T===null&&C&&w&&(T=void 0),p!=null&&L.isDateType(p)&&(y=new dt({timeZone:o,showTimeZone:!1,showTSeparator:!0,defaultDateTimeFormatString:ps.FULL_DATE_FORMAT}).format(T));const E={operator:c,text:y,value:T,startColumnIndex:b};f.push(E),g.set(m,{columnType:p,filterList:f}),r.set(u,g)}}r.forEach((l,a)=>{this.setPanelFilterMap(a,l)})}handlePanelCloned(e,n){const{links:s}=this.props,i=te.getIdFromPanel(e),o=n.id;if(i!=null){const r=ni.cloneLinksForPanel(s,i,o);this.addLinks(r)}}handlePanelDragging(e){const{links:n}=this.props;for(let s=0;s<n.length;s+=1){const i=n[s],{start:o,end:r}=i;if(o.panelId===e||(r==null?void 0:r.panelId)===e){this.setState({isDraggingPanel:!0});return}}}handlePanelDropped(){this.setState({isDraggingPanel:!1})}handlePanelClosed(e){zt.debug(`Panel ${e} closed, deleting links.`),this.deleteLinksForPanelId(e)}handleLinkSelected(e){this.setState({selectedIds:new Set([e])})}handleLinksUpdated(e){const{localDashboardId:n,setDashboardLinks:s}=this.props;s(n,e)}handleLayoutStateChanged(){this.forceUpdate()}handleStateChange(){this.forceUpdate()}handleExited(){const{localDashboardId:e,setDashboardIsolatedLinkerPanelId:n}=this.props;n(e,void 0)}deleteLinksForPanelId(e){const{links:n}=this.props;for(let s=0;s<n.length;s+=1){const i=n[s],{start:o,end:r,id:l}=i;(o.panelId===e||(r==null?void 0:r.panelId)===e)&&this.handleLinkDeleted(l)}}isOverlayShown(){const{activeTool:e}=this.props;return e===Yt.LINKER}updateSelectionValidators(){const{activeTool:e,setDashboardColumnSelectionValidator:n,localDashboardId:s}=this.props;switch(e){case Yt.LINKER:n(s,this.isColumnSelectionValid);break;default:n(s,void 0);break}}updateLinkInProgressType(e,n="invalid"){this.setState({linkInProgress:{...e,type:n}})}isColumnSelectionValid(e,n){const{linkInProgress:s}=this.state,{isolatedLinkerPanelId:i}=this.props;if((s==null?void 0:s.start)==null)return!0;if(n==null)return this.updateLinkInProgressType(s),!1;const{isReversed:o,start:r}=s,l=te.getIdFromPanel(e);if(l==null)return!1;const a={panelId:l,panelComponent:te.getComponentNameFromPanel(e),columnName:n.name,columnType:n.type},d=o!==void 0&&o?ni.getLinkType(a,r,i):ni.getLinkType(r,a,i);return this.updateLinkInProgressType(s,d),d!=="invalid"}render(){const{links:e,isolatedLinkerPanelId:n,panelManager:s}=this.props,{linkInProgress:i,selectedIds:o,isDraggingPanel:r}=this.state,l=this.isOverlayShown(),a=i!=null&&i.start!=null,d=n===void 0?"Click a column source, then click a column target to create a filter link. The filter comparison operator used by a selected link can be changed. Delete a filter link by clicking the delete button or with alt+click. Click done when finished.":"Create a link between the source column button and a table column by clicking on one, then the other. Delete a filter link by clicking the delete button or with alt+click. Click done when finished.";return r?null:h(ut,{in:l,timeout:It.transitionMs,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,onExited:this.handleExited,children:h(Gp,{disabled:a,panelManager:s,links:this.getCachedLinks(e,i,n),selectedIds:o,messageText:d,onLinkSelected:this.handleLinkSelected,onLinkDeleted:this.handleLinkDeleted,onAllLinksDeleted:this.handleAllLinksDeleted,onLinksUpdated:this.handleLinksUpdated,onDone:this.handleDone,onCancel:this.handleCancel})})}}const m1=h1(u1);function p1(t){Vs(t);const{id:e,layout:n,panelManager:s}=t;return h(m1,{layout:n,localDashboardId:e,panelManager:s})}const ja=class{static getNewMarkdownTitle(t){let e=`${ja.DEFAULT_TITLE}`,n=0;for(;t.indexOf(e)>=0;)n+=1,e=`${ja.DEFAULT_TITLE}-${n}`;return e}};let Oo=ja;Oo.DEFAULT_TITLE="Note";Oo.DEFAULT_CONTENT=`# Markdown Note
|
|
41
41
|
|
|
@@ -44,4 +44,4 @@ This note can be edited using **markdown** for styling.`;function g1(t){Vs(t);co
|
|
|
44
44
|
Web UI Version: ${t}
|
|
45
45
|
Java Version: ${o}
|
|
46
46
|
Barrage Version: ${i}`,children:"Copy Versions"})]})]})]}),h("div",{className:"app-settings-footer-item",children:h(k1,{})})]}),h("div",{className:"app-settings-footer-section",children:h("div",{className:"logo",children:h("a",{target:"_blank",rel:"noreferrer noopener",href:"https://deephaven.io",className:"d-inline-block custom-link p-1",children:h("img",{src:Yp,alt:"Deephaven Data Labs",width:"230px"})})})})]})]})]})}};let er=si;er.defaultProps={onDone:()=>{}};er.FORMATTING_SECTION_KEY="SettingsMenu.formatting";er.APPLICATION_SECTION_KEY="ApplicationMenu.settings";er.SHORTCUT_SECTION_KEY="SettingsMenu.shortcuts";const Jh=10;function Ai(t){const{forwardedProps:{menuItem:{action:e,title:n,disabled:s},iconElement:i,displayShortcut:o,isMouseSelected:r,isKeyboardSelected:l,closeMenu:a}}=t,d=S.exports.useRef(),c=S.exports.useRef(),u=S.exports.useRef(null),[m,p]=S.exports.useState(!1),g=S.exports.useCallback(C=>{d.current!=null&&c.current!=null&&u.current&&(Math.abs(d.current-C.clientX)>=Jh||Math.abs(c.current-C.clientY)>=Jh)&&(p(!0),window.removeEventListener("mousemove",g),a(),e(C),u.current=null)},[e,a]);function f(C){d.current=C.clientX,c.current=C.clientY,u.current=C.target,window.addEventListener("mousemove",g)}function b(C){u.current===C.target&&(p(!0),a(),e(),window.removeEventListener("mousemove",g)),u.current=null}return S.exports.useEffect(function(){return function(){return window.removeEventListener("mousemove",g)}},[g]),v("button",{type:"button",className:W("btn-context-menu",{disabled:s},{active:r&&!s},{"keyboard-active":l&&!s}),onMouseDown:f,onMouseUp:b,disabled:m,children:[h("span",{className:W("icon"),children:i}),h("span",{className:"title",children:n}),h("span",{className:"shortcut",children:o})]})}function hc(t){const{handleControlSelect:e,handleToolSelect:n,onClearFilter:s}=t,i=S.exports.useMemo(()=>[{title:"Input Filter",icon:iC,menuElement:h(Ai,{}),action:o=>{e(Cn.INPUT_FILTER,o)},order:10},{title:"Dropdown Filter",icon:vu,menuElement:h(Ai,{}),action:o=>{e(Cn.DROPDOWN_FILTER,o)},order:15},{title:"Markdown Widget",icon:Lf,menuElement:h(Ai,{}),action:o=>{e(Cn.MARKDOWN,o)},order:20},{title:"Filter Sets",icon:Da,menuElement:h(Ai,{}),action:o=>{e(Cn.FILTER_SET_MANAGER,o)},order:25},{disabled:!0,menuElement:h("div",{className:"context-menu-group-header",children:"Tools"}),order:30},{title:"Linker",icon:ld,action:()=>{n(Yt.LINKER)},order:40,shortcut:ms.LINKER},{disabled:!0,menuElement:h("div",{className:"context-menu-group-header",children:"Actions"}),order:50},{title:"Clear All Filters",icon:eC,action:()=>{s()},order:60,shortcut:cn.TABLE.CLEAR_ALL_FILTERS}],[e,n,s]);return h(Fn,{popperClassName:"controls-menu-popper",actions:i})}hc.propTypes={handleControlSelect:R.exports.func,handleToolSelect:R.exports.func,onClearFilter:R.exports.func};hc.defaultProps={handleControlSelect:()=>{},handleToolSelect:()=>{},onClearFilter:()=>{}};Ai.propTypes={forwardedProps:R.exports.shape({iconElement:R.exports.node,displayShortcut:R.exports.string,isMouseSelected:R.exports.bool.isRequired,isKeyboardSelected:R.exports.bool.isRequired,closeMenu:R.exports.func.isRequired,menuItem:R.exports.shape({action:R.exports.func,title:R.exports.string,disabled:R.exports.bool}).isRequired})};Ai.defaultProps={forwardedProps:null};const G1=Hs(qp,null),K1={layoutStorage:G1},q1=t=>t.layoutStorage,Y1=t=>t.serverConfigValues;Object.entries(K1).map(([t,e])=>eo.register(t,e));const eu=10;function X1(t){const{onExportLayout:e,onImportLayout:n,onResetLayout:s,onSelect:i,widgets:o=[]}=t,[r,l]=S.exports.useState(!1),[a,d]=S.exports.useState(""),c=S.exports.useRef(null),u=S.exports.useRef(),m=S.exports.useCallback((y,E)=>{y!=null&&i(y,E)},[i]),p=S.exports.useCallback(y=>{d(y.target.value)},[]),g=S.exports.useCallback(y=>{u.current!=null&&(Math.abs(u.current.x-y.clientX)>=eu||Math.abs(u.current.y-y.clientY)>=eu)&&(l(!0),window.removeEventListener("mousemove",g),m(u.current.widget,y),u.current=void 0)},[u,m]),f=S.exports.useCallback((y,E)=>{u.current={x:y.clientX,y:y.clientY,widget:E},window.addEventListener("mousemove",g)},[g]),b=S.exports.useCallback((y,E)=>{var I;window.removeEventListener("mousemove",g),((I=u.current)==null?void 0:I.widget)===E&&(l(!0),m(E)),u.current=void 0},[g,u,m]),C=S.exports.useMemo(()=>o.filter(y=>{var E;return a?(E=y.name)==null?void 0:E.toLowerCase().includes(a.toLowerCase()):!0}),[a,o]).sort((y,E)=>{var I,D,F;return(F=(D=y.name)==null?void 0:D.localeCompare((I=E.name)!=null?I:""))!=null?F:0}),w=S.exports.useMemo(()=>C.map(y=>{var E,I;return h("li",{children:v(z,{kind:"ghost","data-testid":`panel-list-item-${(E=y.name)!=null?E:""}-button`,onMouseDown:D=>{f(D,y)},onMouseUp:D=>{b(D,y)},onKeyDown:D=>{(D.key==="Enter"||D.key===" ")&&m(y)},disabled:r,onClick:()=>{},children:[h(Gu,{type:y.type})," ",(I=y.name)!=null?I:""]})},y.name)}),[C,r,f,b,m]),T=S.exports.useMemo(()=>w.length===0?h("span",{children:"No bound variables found."}):null,[w]);return v("div",{className:"widget-list-container d-flex flex-column",children:[h("div",{className:"widget-list-header",children:h(Cs,{value:a,placeholder:"Find Table, Plot or Widget",onChange:p,ref:c})}),v("ul",{className:"widget-list flex-grow-1",children:[T&&h("li",{className:"widget-list-message",children:T}),!T&&w]}),h("div",{children:h("hr",{})}),v("div",{className:"widget-list-footer",children:[v(z,{kind:"ghost",onClick:e,children:[v("div",{className:"fa-md fa-layers",children:[h(j,{mask:Ma,icon:Dc,transform:"right-5 down-5"}),h(j,{icon:Dc,transform:"right-8 down-6"})]}),"Export Layout"]}),v(z,{kind:"ghost",onClick:n,children:[v("div",{className:"fa-md fa-layers",children:[h(j,{mask:Ma,icon:Ra,transform:"right-5 down-5"}),h(j,{icon:Ra,transform:"right-8 down-6"})]}),"Import Layout"]}),h(z,{kind:"ghost",icon:ki,onClick:s,tooltip:"Reset Layout"})]})]})}const j1=async(t,e,n)=>{let s,i,o,r;if(Vr(e)?(s=e.settings,i=e.table,o=void 0,r=e.tableSettings):(s={},i="",o=e.figure,r={}),n!==void 0&&(n.tableSettings!=null&&(r=n.tableSettings),n.table!=null&&(i=n.table),n.figure!=null&&(o=n.figure),n.settings!=null&&(s={...s,...n.settings})),o!==void 0){const d={title:o,name:o,type:M.VariableType.FIGURE},c=await t.getObject(d);return zi.makeModel(s,c)}const l={title:o,name:i,type:M.VariableType.TABLE},a=await t.getObject(l);return ne.applyTableSettings(a,r,Ml(xl.getState())),zi.makeModelFromSettings(s,a)},Q1=async(t,e,n=M.VariableType.TABLE)=>{const{table:s}=e,i={title:s,name:s,type:n},o=await t.getObject(i);return qd.makeModel(o)};function Z1({onAutoFillClick:t=()=>{}}){return v("div",{className:"empty-dashboard-container",children:[v("div",{className:"hint-container",children:[h(j,{icon:gf})," ",h("br",{}),"Use the panel list to add objects from a query."]}),v("div",{className:"empty-dashboard",children:[h("div",{className:"add-panels-hint",children:"Drag Panels Here"}),h(z,{kind:"tertiary",onClick:t,children:"Auto fill objects"})]})]})}function J1(t){return t.version===2}function e2(t){return Array.isArray(t)}const kr=X.module("UserLayoutUtils"),t2={layoutConfig:[{type:"column",content:[{type:"row",height:40,content:[{type:"stack",content:[{type:"react-component",component:Li.COMPONENT,title:Li.TITLE,isClosable:!1},{type:"react-component",component:al.COMPONENT,title:al.TITLE,isClosable:!1}]},{type:"stack",width:25,content:[{type:"react-component",component:ol.COMPONENT,title:ol.TITLE,isClosable:!1},{type:"react-component",component:rl.COMPONENT,title:rl.TITLE,isClosable:!1}]}]},{type:"row",content:[{type:"stack",title:"Notebooks",content:[]}]}]}],links:[],filterSets:[],version:2},n2={layoutConfig:[],links:[],filterSets:[],version:2};function jp(t){if(J1(t))return t;if(e2(t))return{layoutConfig:t,links:[],filterSets:[],version:2};throw new Error(`Unexpected layout import format: ${t}`)}async function s2(t,e=!0){try{const n=await t.getLayouts();if(n.length>0)try{const s=await t.getLayout(n[0]);return jp(s)}catch(s){kr.error("Unable to load layout",n[0],":",s),kr.warn("No valid layouts found, falling back to default layout")}}catch(n){kr.error("Unable to fetch layout list",n),kr.warn("Falling back to default layout")}return e?t2:n2}function i2(t){const{filterSets:e,layoutConfig:n,links:s}=t;return{filterSets:e,layoutConfig:n,links:s,version:2}}const zr={exportLayout:i2,getDefaultLayout:s2,normalizeLayout:jp},Or=X.module("DownloadServiceWorkerUtils"),Qp=class{static registerOnLoaded(){new URL("/ide/",window.location.href).origin===window.location.origin&&("serviceWorker"in navigator?window.addEventListener("load",()=>{const e=new URL("/ide/download/serviceWorker.js",window.location.href);navigator.serviceWorker.register(e).then(n=>{n.update(),Or.info("Registering service worker on ",e,n)}).catch(n=>{Or.error("Failed to register service worker",n)})}):Or.info("Service worker is not supported."))}static async getServiceWorker(){if("serviceWorker"in navigator){const e=(await navigator.serviceWorker.getRegistrations()).find(n=>n.scope.endsWith(Qp.DOWNLOAD_PATH));if(e&&e.active)return Or.info("Download service worker is active."),e.active;throw new Error("Can not find download service worker.")}throw new Error("Download service worker is not available.")}static unregisterSW(){}};let cl=Qp;cl.DOWNLOAD_PATH="/download/";const Zp={react:Y},o2=Sg(Zp),r2=wg({requires:o2}),l2=vg.createRequires(Zp),a2=Tg({requires:l2}),d2=X.module("PluginUtils");class Ja{static loadComponentPlugin(e){if("".split(",").includes(e)){const o=Y.lazy(()=>Dg(()=>import(`./internal/${e}`),[])),r=Y.forwardRef((l,a)=>h(S.exports.Suspense,{fallback:h("div",{children:"Loading Plugin..."}),children:h(o,{ref:a,...l})}));return r.pluginName=e,r.displayName="Local Plugin",r}const n=new URL("/ide/plugins/",`${window.location}`),s=new URL(`${e}.js`,n),i=Y.forwardRef((o,r)=>h(r2,{url:s,render:({err:l,Component:a})=>{if(l!=null&&l!==""){const d=`Error loading plugin ${e} from ${s} due to ${l}`;return d2.error(d),h("div",{className:"error-message",children:`${d}`})}return h(a,{ref:r,...o})}}));return i.pluginName=e,i.displayName="Plugin",i}static async loadModulePlugin(e){return await a2(e)}static async loadJson(e){return new Promise((n,s)=>{const i=new XMLHttpRequest;i.addEventListener("load",()=>{try{const o=JSON.parse(i.responseText);n(o)}catch(o){s(o)}}),i.addEventListener("error",o=>{s(o)}),i.open("GET",e),i.send()})}}const Pt=X.module("AppMainContainer");class Lo extends S.exports.Component{constructor(e){super(e),this.getDashboardPlugins=pe(n=>[...n.entries()].filter(([,s])=>s.DashboardPlugin!=null).map(([s,{DashboardPlugin:i}])=>h(i,{},s))),this.handleSettingsMenuHide=this.handleSettingsMenuHide.bind(this),this.handleSettingsMenuShow=this.handleSettingsMenuShow.bind(this),this.handleError=this.handleError.bind(this),this.handleControlSelect=this.handleControlSelect.bind(this),this.handleToolSelect=this.handleToolSelect.bind(this),this.handleClearFilter=this.handleClearFilter.bind(this),this.handleDataChange=this.handleDataChange.bind(this),this.handleAutoFillClick=this.handleAutoFillClick.bind(this),this.handleGoldenLayoutChange=this.handleGoldenLayoutChange.bind(this),this.handleLayoutConfigChange=this.handleLayoutConfigChange.bind(this),this.handleExportLayoutClick=this.handleExportLayoutClick.bind(this),this.handleImportLayoutClick=this.handleImportLayoutClick.bind(this),this.handleImportLayoutFiles=this.handleImportLayoutFiles.bind(this),this.handleLoadTablePlugin=this.handleLoadTablePlugin.bind(this),this.handleResetLayoutClick=this.handleResetLayoutClick.bind(this),this.handleWidgetMenuClick=this.handleWidgetMenuClick.bind(this),this.handleWidgetsMenuClose=this.handleWidgetsMenuClose.bind(this),this.handleWidgetSelect=this.handleWidgetSelect.bind(this),this.handlePaste=this.handlePaste.bind(this),this.hydrateChart=this.hydrateChart.bind(this),this.hydrateGrid=this.hydrateGrid.bind(this),this.hydratePandas=this.hydratePandas.bind(this),this.hydrateDefault=this.hydrateDefault.bind(this),this.openNotebookFromURL=this.openNotebookFromURL.bind(this),this.importElement=Y.createRef(),this.state={contextActions:[{action:()=>{this.handleToolSelect(Yt.LINKER)},shortcut:ms.LINKER,isGlobal:!0},{action:()=>{this.sendClearFilter()},shortcut:cn.TABLE.CLEAR_ALL_FILTERS,isGlobal:!0},{action:()=>{Pt.debug("Consume unhandled save shortcut")},shortcut:ms.SAVE,isGlobal:!0}],isPanelsMenuShown:!1,isSettingsMenuShown:!1,widgets:[]}}static handleWindowBeforeUnload(e){e.preventDefault(),e.returnValue=""}static hydrateConsole(e,n){return Ua.hydrate({...e,unzip:s=>lu.loadAsync(s).then(i=>Object.values(i.files))},n)}componentDidMount(){this.initWidgets(),window.addEventListener("beforeunload",Lo.handleWindowBeforeUnload)}componentDidUpdate(e){const{dashboardData:n}=this.props;e.dashboardData!==n&&this.handleDataChange(n)}componentWillUnmount(){this.deinitWidgets(),window.removeEventListener("beforeunload",Lo.handleWindowBeforeUnload)}initWidgets(){const{connection:e}=this.props;if(e.subscribeToFieldUpdates==null){Pt.warn("subscribeToFieldUpdates not supported, not initializing widgets");return}this.widgetListenerRemover=e.subscribeToFieldUpdates(n=>{Pt.debug("Got updates",n),this.setState(({widgets:s})=>{const{updated:i,created:o,removed:r}=n,l=[...i,...r],a=s.filter(c=>!l.some(u=>u.name===c.name));return[...i,...o].forEach(c=>{c.name!=null&&c.name!==""&&a.push(c)}),{widgets:a}})})}deinitWidgets(){var e;(e=this.widgetListenerRemover)==null||e.call(this)}openNotebookFromURL(){const{match:e}=this.props,{notebookPath:n}=e.params;if(n){const{session:s,sessionConfig:i}=this.props;if(s==null||i==null){Pt.error("No session available to open notebook URL",n);return}const o={id:`/${n}`,itemName:`/${n}`},r=i.type,l={value:null,language:r};this.emitLayoutEvent(He.SELECT_NOTEBOOK,s,r,l,o,!0)}}sendClearFilter(){this.emitLayoutEvent(Pe.CLEAR_ALL_FILTERS)}emitLayoutEvent(e,...n){var s;(s=this.goldenLayout)==null||s.eventHub.emit(e,...n)}handleError(e){Te.isCanceled(e)||Pt.error(e)}handleSettingsMenuHide(){this.setState({isSettingsMenuShown:!1})}handleSettingsMenuShow(){this.setState({isSettingsMenuShown:!0})}handleControlSelect(e,n=null){switch(Pt.debug("handleControlSelect",e),e){case Cn.DROPDOWN_FILTER:this.emitLayoutEvent(Pe.OPEN_DROPDOWN,{title:"DropdownFilter",type:e,createNewStack:!0,dragEvent:n});break;case Cn.INPUT_FILTER:this.emitLayoutEvent(Pe.OPEN_INPUT,{title:"InputFilter",type:e,createNewStack:!0,dragEvent:n});break;case Cn.MARKDOWN:this.emitLayoutEvent(Dp.OPEN,{title:"Markdown",type:e,dragEvent:n});break;case Cn.FILTER_SET_MANAGER:this.emitLayoutEvent(Pe.OPEN_FILTER_SET_MANAGER,{title:"FilterSets",type:e,dragEvent:n});break;default:throw new Error(`Unrecognized control type ${e}`)}}handleToolSelect(e){Pt.debug("handleToolSelect",e);const{activeTool:n,setActiveTool:s}=this.props;s(n===e?Yt.DEFAULT:e)}handleClearFilter(){this.sendClearFilter()}handleDataChange(e){const{updateWorkspaceData:n}=this.props,{closed:s,filterSets:i,links:o}=e;n({closed:s,filterSets:i,links:o})}handleGoldenLayoutChange(e){this.goldenLayout=e}handleLayoutConfigChange(e){const{updateWorkspaceData:n}=this.props;n({layoutConfig:e})}handleWidgetMenuClick(){this.setState(({isPanelsMenuShown:e})=>({isPanelsMenuShown:!e}))}handleWidgetSelect(e,n){this.setState({isPanelsMenuShown:!1}),Pt.debug("handleWidgetSelect",e,n),this.openWidget(e,n)}handleWidgetsMenuClose(){this.setState({isPanelsMenuShown:!1})}handleAutoFillClick(){const{widgets:e}=this.state;Pt.debug("handleAutoFillClick",e);const n=e.sort((s,i)=>s.title!=null&&i.title!=null?s.title.localeCompare(i.title):0);for(let s=0;s<n.length;s+=1)this.openWidget(n[s])}handleExportLayoutClick(){Pt.info("handleExportLayoutClick"),this.setState({isPanelsMenuShown:!1});try{const{workspace:e}=this.props,{data:n}=e,s=zr.exportLayout(n);Pt.info("handleExportLayoutClick exportedConfig",s);const i=new Blob([JSON.stringify(s)],{type:"application/json"}),o=M.i18n.DateTimeFormat.format("yyyy-MM-dd-HHmmss",new Date),r=document.createElement("a");r.href=URL.createObjectURL(i),r.download=`deephaven-app-layout-${o}.json`,r.click()}catch(e){Pt.error("Unable to export layout",e)}}handleImportLayoutClick(){Pt.info("handleImportLayoutClick"),this.setState({isPanelsMenuShown:!1}),this.importElement.current!=null&&(this.importElement.current.value="",this.importElement.current.click())}handleResetLayoutClick(){Pt.info("handleResetLayoutClick"),this.setState({isPanelsMenuShown:!1}),this.resetLayout()}handleImportLayoutFiles(e){var n;e.stopPropagation(),e.preventDefault(),e.target.files!=null&&this.importLayoutFile((n=e.target.files)==null?void 0:n[0])}async importLayoutFile(e){try{const{updateDashboardData:n,updateWorkspaceData:s}=this.props,i=await e.text(),o=JSON.parse(i),{filterSets:r,layoutConfig:l,links:a}=zr.normalizeLayout(o);s({layoutConfig:l}),n(Mn,{filterSets:r,links:a})}catch(n){Pt.error("Unable to import layout",n)}}async resetLayout(){const{layoutStorage:e,session:n}=this.props,{filterSets:s,layoutConfig:i,links:o}=await zr.getDefaultLayout(e,n!==void 0),{updateDashboardData:r,updateWorkspaceData:l}=this.props;l({layoutConfig:i}),r(Mn,{filterSets:s,links:o})}handlePaste(e){let n=e.currentTarget.parentElement;for(;n!=null;){if(n.classList.contains("monaco-editor"))return;n=n.parentElement}const{clipboardData:s}=e,i=s.getData("Text"),o=/“|”/g;o.test(i)&&(e.preventDefault(),e.stopPropagation(),document.execCommand("insertText",!1,i.replace(o,'"')))}handleLoadTablePlugin(e){const{plugins:n}=this.props,s=n.get(e);return s!=null&&s.TablePlugin!=null?s.TablePlugin:Ja.loadComponentPlugin(e)}hydrateDefault(e,n){const{connection:s}=this.props,{metadata:i}=e;if((i==null?void 0:i.type)!=null&&((i==null?void 0:i.id)!=null||(i==null?void 0:i.name)!=null)){const o=i.id!=null?{type:i.type,id:i.id}:{type:i.type,name:i.name,title:i.name};return{fetch:()=>s.getObject(o),localDashboardId:n,...e}}return Ua.hydrate(e,n)}hydrateGrid(e,n){return this.hydrateTable(e,n,M.VariableType.TABLE)}hydratePandas(e,n){return this.hydrateTable(e,n,M.VariableType.PANDAS)}hydrateTable(e,n,s=M.VariableType.TABLE){const{connection:i}=this.props;return{...e,getDownloadWorker:cl.getServiceWorker,loadPlugin:this.handleLoadTablePlugin,localDashboardId:n,makeModel:()=>Q1(i,e.metadata,s)}}hydrateChart(e,n){const{connection:s}=this.props;return{...e,localDashboardId:n,makeModel:()=>{const{metadata:i,panelState:o}=e;return j1(s,i,o)}}}openWidget(e,n){const{connection:s}=this.props;this.emitLayoutEvent(Ie.OPEN,{dragEvent:n,fetch:()=>s.getObject(e),widget:e})}render(){const{activeTool:e,plugins:n,user:s,workspace:i,serverConfigValues:o}=this.props,{data:r}=i,{layoutConfig:l}=r,{permissions:a}=s,{canUsePanels:d}=a,{contextActions:c,isPanelsMenuShown:u,isSettingsMenuShown:m,widgets:p}=this.state,g=this.getDashboardPlugins(n);return v("div",{className:W("app-main-tabs","w-100","h-100","d-flex","flex-column",e?`active-tool-${e.toLowerCase()}`:""),onPaste:this.handlePaste,tabIndex:-1,children:[h("nav",{className:"nav-container",children:v("div",{className:"app-main-top-nav-menus",children:[h("img",{src:Yp,alt:"Deephaven Data Labs",width:"115px",className:"ml-1"}),v("div",{children:[v(z,{kind:"ghost",className:"btn-panels-menu",icon:cC,onClick:()=>{},children:["Controls",h(hc,{handleControlSelect:this.handleControlSelect,handleToolSelect:this.handleToolSelect,onClearFilter:this.handleClearFilter})]}),d&&v(z,{kind:"ghost",className:"btn-panels-menu btn-show-panels","data-testid":"app-main-panels-button",onClick:this.handleWidgetMenuClick,icon:rC,children:["Panels",h(kn,{isShown:u,className:"panels-menu-popper",onExited:this.handleWidgetsMenuClose,closeOnBlur:!0,interactive:!0,children:h(X1,{widgets:p,onExportLayout:this.handleExportLayoutClick,onImportLayout:this.handleImportLayoutClick,onResetLayout:this.handleResetLayoutClick,onSelect:this.handleWidgetSelect})})]}),h(z,{kind:"ghost",className:W("btn-settings-menu",{"text-warning":s.operateAs!==s.name}),onClick:this.handleSettingsMenuShow,icon:h(j,{icon:Go,transform:"grow-3 right-1 down-1"}),tooltip:"User Settings"})]})]})}),v(I0,{emptyDashboard:h(Z1,{onAutoFillClick:this.handleAutoFillClick}),id:Mn,layoutConfig:l,onGoldenLayoutChange:this.handleGoldenLayoutChange,onLayoutConfigChange:this.handleLayoutConfigChange,onLayoutInitialized:this.openNotebookFromURL,hydrate:this.hydrateDefault,children:[h(a1,{hydrate:this.hydrateGrid,getDownloadWorker:cl.getServiceWorker,loadPlugin:this.handleLoadTablePlugin}),h(n1,{hydrate:this.hydrateChart}),h(s1,{}),h(o1,{hydrateConsole:Lo.hydrateConsole,notebooksUrl:new URL("/notebooks/",`${window.location}`).href}),h(r1,{}),h(f1,{hydrate:this.hydratePandas}),h(g1,{}),h(p1,{}),g]}),h(ut,{in:m,timeout:It.transitionMidMs,classNames:"slide-left",mountOnEnter:!0,unmountOnExit:!0,children:h(er,{serverConfigValues:o,onDone:this.handleSettingsMenuHide})}),h(oe,{actions:c}),h("input",{ref:this.importElement,type:"file",accept:".json",style:{display:"none"},onChange:this.handleImportLayoutFiles})]})}}const c2=t=>{var e,n;return{activeTool:Nl(t),dashboardData:Qt(t,Mn),layoutStorage:q1(t),plugins:NS(t),connection:mE(t,Mn),session:(e=gi(t,Mn))==null?void 0:e.session,sessionConfig:(n=gi(t,Mn))==null?void 0:n.config,user:gm(t),workspace:Dl(t),serverConfigValues:Y1(t)}},h2=Ft(c2,{setActiveTool:Fl,updateDashboardData:Xn,updateWorkspaceData:Dm})(Eg(Lo));function u2(){return v("div",{className:"app",children:[h(h2,{}),h(Du,{})]})}const m2=X.module("LocalWorkspaceStorage"),Fo=class{static async makeDefaultWorkspaceData(t,e){const{filterSets:n,links:s,layoutConfig:i}=await zr.getDefaultLayout(t,e==null?void 0:e.isConsoleAvailable);return{settings:{defaultDateTimeFormat:dt.DEFAULT_DATETIME_FORMAT_STRING,formatter:[],timeZone:dt.DEFAULT_TIME_ZONE_ID,showTimeZone:!1,showTSeparator:!0,disableMoveConfirmation:!1,defaultDecimalFormatOptions:{defaultFormatString:Le.DEFAULT_FORMAT_STRING},defaultIntegerFormatOptions:{defaultFormatString:it.DEFAULT_FORMAT_STRING},truncateNumbersWithPound:!1,defaultNotebookSettings:{isMinimapEnabled:!1}},layoutConfig:i,closed:[{}],links:s,filterSets:n}}static async makeDefaultWorkspace(t,e){return{data:await Fo.makeDefaultWorkspaceData(t,e)}}constructor(t){this.layoutStorage=t}async load(t){var e;try{return JSON.parse((e=localStorage.getItem(Fo.STORAGE_KEY))!=null?e:"")}catch{return m2.info("Unable to load workspace data, initializing to default data"),Fo.makeDefaultWorkspace(this.layoutStorage,t)}}async save(t){return localStorage.setItem(Fo.STORAGE_KEY,JSON.stringify(t)),t}};let Jp=Fo;Jp.STORAGE_KEY="deephaven.WorkspaceStorage";class p2 extends Error{constructor(){super(...arguments),this.isNoConsolesError=!0}}function g2(t){return t.isNoConsolesError}const Pi=X.module("SessionUtils");function f2(){return new URL("/jsapi",`${window.location}`)}function eg(){const t=f2();return`${t.protocol}//${t.host}`}function C2(){const t=eg();return Pi.info(`Starting connection to '${t}'...`),new M.IdeConnection(t)}async function b2(t){Pi.info("Getting console types...");const e=await t.getConsoleTypes();if(Pi.info("Available types:",e),e.length===0)throw new p2("No console types available");const n=e[0];Pi.info("Starting session with type",n);const s=await t.startSession(n),i={type:n,id:ze.generate()};return Pi.info("Console session established",i),{session:s,config:i,connection:t}}function S2(){const t=eg();return Pi.info("createCoreClient",t),new M.CoreClient(t)}class w2{constructor(e,n=""){this.storageService=e,this.root=n}async getLayouts(){return(await this.storageService.listItems(this.root,"*.json")).map(n=>n.basename)}async getLayout(e){const s=await(await this.storageService.loadFile(`${this.root}/${e}`)).text();return JSON.parse(s)}}const To=X.module("GrpcFileStorageTable"),ed=class{constructor(t,e="",n=e){this.currentSize=0,this.listeners=[],this.childTables=new Map,this.storageService=t,this.baseRoot=e,this.root=n,n===e&&(this.doRefresh=je(this.doRefresh.bind(this),ed.REFRESH_DEBOUNCE))}removeBaseRoot(t){return ce.removeRoot(this.baseRoot,t)}getViewportData(){var t;return this.viewportUpdatePromise||this.refreshInternal(),(t=this.viewportUpdatePromise)!=null?t:Promise.resolve({items:[],offset:0})}getSnapshot(t){throw new Error("Method not implemented.")}get size(){return this.currentSize}setExpanded(t,e){const n=t.split("/");let s=n.shift();if((s===void 0||s==="")&&(s=n.shift()),s===void 0||s==="")throw new Error(`Invalid path: ${t}`);const i=n.join("/");if(e){if(!this.childTables.has(s)){const o=new ed(this.storageService,this.baseRoot,`${this.root}/${s}`);this.childTables.set(s,o)}if(i){const o=this.childTables.get(s);o==null||o.setExpanded(i,e)}}else if(this.childTables.has(s))if(i){const o=this.childTables.get(s);o==null||o.setExpanded(i,e)}else this.childTables.delete(s);this.currentViewport&&this.refreshInternal()}collapseAll(){this.childTables.clear(),this.currentViewport&&this.refreshInternal()}setSearch(t){throw new Error("Method not implemented.")}setViewport(t){this.currentViewport=t,this.refreshInternal()}setFilters(){throw new Error("Method not implemented.")}setSorts(){throw new Error("Method not implemented.")}setReversed(){throw new Error("Method not implemented.")}close(){this.listeners=[]}onUpdate(t){return this.listeners=[...this.listeners,t],()=>{this.listeners=this.listeners.filter(e=>e!==t)}}doRefresh(t){To.debug2("doRefresh",this.root),t(this.fetchData())}refresh(){var n;To.debug2("refresh",this.root),(n=this.viewportUpdatePromise)==null||n.cancel();const t=new Promise(s=>{this.doRefresh(s)}),e=Te.makeCancelable(t.then(s=>{if(this.viewportUpdatePromise!==e)throw new di;return this.currentViewportData=s,this.sendUpdate(),s}));e.catch(s=>{Te.isCanceled(s)||To.error("Error updating viewport",s)}),this.viewportUpdatePromise=e}refreshInternal(){try{this.refresh()}catch(t){Te.isCanceled(t)||To.error("Unable to refresh data",t)}}async fetchData(){const{currentViewport:t}=this;if(!t)throw new Error("No viewport set");let n=(await this.storageService.listItems(this.root)).map(s=>({type:s.type,filename:this.removeBaseRoot(s.filename),basename:s.basename,id:this.removeBaseRoot(s.filename),isExpanded:s.type==="directory"?this.childTables.has(s.basename):void 0})).sort((s,i)=>s.type!==i.type?s.type==="directory"?-1:1:s.basename.localeCompare(i.basename));for(let s=0;s<n.length;s+=1){const i=n[s],{basename:o,filename:r}=i;if(r===this.removeBaseRoot(`${this.root}/${o}`)&&i.type==="directory"){const l=this.childTables.get(o);if(l!=null){l.setViewport({top:0,bottom:t.bottom-s});const a=await l.getViewportData();n.splice(s+1,0,...a.items)}}}return this.currentSize=n.length,To.debug2(this.root,"items",n,t),n=n.slice(t.top,t.bottom),{items:n,offset:t.top}}sendUpdate(){var n;const{listeners:t}=this,e=(n=this.currentViewportData)!=null?n:{items:[],offset:0};for(let s=0;s<t.length;s+=1)t[s](e)}};let tg=ed;tg.REFRESH_DEBOUNCE=50;const v2=X.module("GrpcFileStorage"),ng=class{constructor(t,e=""){this.tables=[],this.refreshTables=us(()=>{this.tables.forEach(n=>n.refresh())},ng.REFRESH_THROTTLE),this.storageService=t,this.root=e}removeRoot(t){return ce.removeRoot(this.root,t)}addRoot(t){return ce.addRoot(this.root,t)}async createDirectory(t){return await this.storageService.createDirectory(this.addRoot(t)),this.refreshTables(),{type:"directory",id:t,filename:t,basename:ce.getBaseName(t)}}async getTable(){const t=new tg(this.storageService,this.root);return this.tables.push(t),t}async saveFile(t){const e=dh.storage.FileContents.text(t.content);return await this.storageService.saveFile(this.addRoot(t.filename),e,!0),this.refreshTables(),t}async loadFile(t){const n=await(await this.storageService.loadFile(this.addRoot(t))).text();return{filename:t,basename:ce.getBaseName(t),content:n}}async deleteFile(t){await this.storageService.deleteItem(this.addRoot(t)),this.refreshTables()}async moveFile(t,e){await this.storageService.moveItem(this.addRoot(t),this.addRoot(e)),this.refreshTables()}async info(t){const e=await this.storageService.listItems(this.addRoot(ce.getPath(t)),ce.getBaseName(t));if(e.length===0)throw new sc;if(e.length>1)throw v2.error("More than one matching file found, should never happen.",e),new Error("More than one matching file found");const n=e[0];return{filename:this.removeRoot(n.filename),basename:this.removeRoot(n.basename),id:this.removeRoot(n.filename),type:n.type}}};let sg=ng;sg.REFRESH_THROTTLE=150;const ai=X.module("AppInit");async function T2(){ai.debug("Loading plugins...");try{const t=await Ja.loadJson("/js-plugins/manifest.json");ai.debug("Plugin manifest loaded:",t);const e=[];for(let i=0;i<t.plugins.length;i+=1){const{name:o,main:r}=t.plugins[i],l=`/js-plugins/${o}/${r}`;e.push(Ja.loadModulePlugin(l))}const n=await Promise.all(e),s=new Map;for(let i=0;i<n.length;i+=1){const{name:o}=t.plugins[i];s.set(o,n[i])}return ai.info("Plugins loaded:",s),s}catch(t){return ai.error("Unable to load plugins:",t),new Map}}async function E2(t){let e;try{e=await b2(t)}catch(n){if(!g2(n))throw n}return e}function uc(t){const{workspace:e,setActiveTool:n,setCommandHistoryStorage:s,setDashboardData:i,setFileStorage:o,setLayoutStorage:r,setDashboardConnection:l,setDashboardSessionWrapper:a,setPlugins:d,setUser:c,setWorkspace:u,setWorkspaceStorage:m,setServerConfigValues:p}=t,[g,f]=S.exports.useState(),[b,C]=S.exports.useState(!0),w=S.exports.useCallback(async()=>{var D,F;try{ai.info("Initializing Web UI","0.24.0",navigator.userAgent);const x=await T2(),U=C2(),B=await E2(U);U.addEventListener(M.IdeConnection.HACK_CONNECTION_FAILURE,Me=>{var ke;const{detail:qe}=Me;ai.error("Connection failure",`${JSON.stringify(qe)}`),f(`Unable to connect: ${(ke=qe.details)!=null?ke:"Unknown Error"}`)});const _="user",H=S2();await H.login({type:M.CoreClient.LOGIN_TYPE_ANONYMOUS});const A=H.getStorageService(),N=new w2(A,"/layouts"),k=new sg(A,"/notebooks"),O=new Jp(N),V=new M1,G=await O.load({isConsoleAvailable:B!==void 0}),{data:Q}=G,{settings:Z}=Q;Z.defaultDecimalFormatOptions===void 0&&(Z.defaultDecimalFormatOptions={defaultFormatString:Le.DEFAULT_FORMAT_STRING}),Z.defaultIntegerFormatOptions===void 0&&(Z.defaultIntegerFormatOptions={defaultFormatString:it.DEFAULT_FORMAT_STRING}),Z.truncateNumbersWithPound===void 0&&(Z.truncateNumbersWithPound=!1);const{shortcutOverrides:be={}}=Z,he=Kt.isMacPlatform?(D=be.mac)!=null?D:{}:(F=be.windows)!=null?F:{};Object.entries(he).forEach(([Me,qe])=>{var ke;(ke=Ae.get(Me))==null||ke.setKeyState(qe)});const De={filterSets:Q.filterSets,links:Q.links},ee=await H.getServerConfigValues(),ue=new Map(ee),Se={name:_,operateAs:_,groups:[],permissions:{isSuperUser:!1,isQueryViewOnly:!1,isNonInteractive:!1,canUsePanels:!0,canCreateDashboard:!0,canCreateCodeStudio:!0,canCreateQueryMonitor:!0,canCopy:ue.get("internal.webClient.appInit.canCopy")!=="false",canDownloadCsv:ue.get("internal.webClient.appInit.canDownloadCsv")!=="false"}};n(Yt.DEFAULT),p(ue),s(V),i(Mn,De),o(k),r(N),l(Mn,U),B!==void 0&&a(Mn,B),d(x),c(Se),m(O),u(G)}catch(x){ai.error(x),f(x)}},[n,s,i,o,r,l,a,d,c,u,m,p]),T=S.exports.useCallback(()=>{document.fonts!=null?document.fonts.ready.then(()=>{C(!1)}):C(!1)},[]);S.exports.useEffect(function(){w(),T()},[w,T]);const y=e==null&&g==null||b,E=!y&&g==null,I=g!=null?`${g}`:null;return v(ye,{children:[E&&h(u2,{}),h(wl,{isLoading:y,isLoaded:E,errorMessage:I}),v("div",{id:"preload-fonts",style:{visibility:"hidden",position:"absolute",top:-1e4},children:[h("p",{className:"fira-sans-regular",children:"preload"}),h("p",{className:"fira-sans-semibold",children:"preload"}),h("p",{className:"fira-mono",children:"preload"})]})]})}uc.propTypes={workspace:R.exports.shape({}),workspaceStorage:R.exports.shape({close:R.exports.func}),setActiveTool:R.exports.func.isRequired,setCommandHistoryStorage:R.exports.func.isRequired,setDashboardData:R.exports.func.isRequired,setFileStorage:R.exports.func.isRequired,setLayoutStorage:R.exports.func.isRequired,setDashboardConnection:R.exports.func.isRequired,setDashboardSessionWrapper:R.exports.func.isRequired,setPlugins:R.exports.func.isRequired,setUser:R.exports.func.isRequired,setWorkspace:R.exports.func.isRequired,setWorkspaceStorage:R.exports.func.isRequired};uc.defaultProps={workspace:null,workspaceStorage:null};const y2=t=>({workspace:Dl(t),workspaceStorage:SS(t)}),tu=Ft(y2,{setActiveTool:Fl,setCommandHistoryStorage:_S,setDashboardData:Qm,setFileStorage:kS,setLayoutStorage:N1,setDashboardConnection:pE,setDashboardSessionWrapper:gE,setPlugins:LS,setUser:FS,setWorkspace:Rm,setWorkspaceStorage:xS,setServerConfigValues:AS})(uc);function I2(){return h(yg,{basename:"/ide/",children:v(Ig,{children:[h(Ec,{exact:!0,path:"/",component:tu}),h(Ec,{path:"/notebook/:notebookPath+",component:tu}),h(Rg,{from:"*",to:"/"})]})})}Boolean(window.location.hostname==="localhost"||window.location.hostname==="[::1]"||window.location.hostname.match(/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/));function R2(){"serviceWorker"in navigator&&navigator.serviceWorker.getRegistrations().then(t=>{t.forEach(e=>{e.scope.endsWith("/download/")||e.unregister()})})}U1();ui.render(h(iu,{store:xl,children:h(I2,{})}),document.getElementById("root"));R2();cl.registerOnLoaded();st.init({getWorker:()=>new Mg});window["__react-beautiful-dnd-disable-dev-warnings"]=!0;
|
|
47
|
-
//# sourceMappingURL=index.
|
|
47
|
+
//# sourceMappingURL=index.200d6591.js.map
|